dop-sdk
Version:
Mini App SDK for JavaScript by VTB
3 lines • 71.9 kB
JavaScript
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MiniApp=e()}}((function(){var e,r,t,n,o,i,u,a,s,c,p,f,l,d,h,E=(e=function(e,t){(function(e){(function(){"use strict";function e(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=new Uint8Array(e);return r.__proto__=n.prototype,r}function n(e,r,t){if("number"==typeof e){if("string"==typeof r)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return o(e,r,t)}function o(r,t,o){if("string"==typeof r)return function(r,t){if("string"==typeof t&&""!==t||(t="utf8"),!n.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var o=0|c(r,t),i=e(o),u=i.write(r,t);return u!==o&&(i=i.slice(0,u)),i}(r,t);if(ArrayBuffer.isView(r))return a(r);if(null==r)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(j(r,ArrayBuffer)||r&&j(r.buffer,ArrayBuffer))return function(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');var o;return(o=void 0===r&&void 0===t?new Uint8Array(e):void 0===t?new Uint8Array(e,r):new Uint8Array(e,r,t)).__proto__=n.prototype,o}(r,t,o);if("number"==typeof r)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=r.valueOf&&r.valueOf();if(null!=i&&i!==r)return n.from(i,t,o);var u=function(r){if(n.isBuffer(r)){var t=0|s(r.length),o=e(t);return 0===o.length||r.copy(o,0,0,t),o}return void 0!==r.length?"number"!=typeof r.length||G(r.length)?e(0):a(r):"Buffer"===r.type&&Array.isArray(r.data)?a(r.data):void 0}(r);if(u)return u;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof r[Symbol.toPrimitive])return n.from(r[Symbol.toPrimitive]("string"),t,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}function i(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(r){return i(r),e(r<0?0:0|s(r))}function a(r){for(var t=r.length<0?0:0|s(r.length),n=e(t),o=0;o<t;o+=1)n[o]=255&r[o];return n}function s(e){if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function c(e,r){if(n.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var t=e.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===t)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return L(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*t;case"hex":return t>>>1;case"base64":return D(e).length;default:if(i)return o?-1:L(e).length;r=(""+r).toLowerCase(),i=!0}}function p(e,r,t){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===t||t>this.length)&&(t=this.length),t<=0)return"";if((t>>>=0)<=(r>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return w(this,r,t);case"utf8":case"utf-8":return O(this,r,t);case"ascii":return m(this,r,t);case"latin1":case"binary":return T(this,r,t);case"base64":return _(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function f(e,r,t){var n=e[r];e[r]=e[t],e[t]=n}function l(e,r,t,o,i){if(0===e.length)return-1;if("string"==typeof t?(o=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),G(t=+t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return-1;t=e.length-1}else if(t<0){if(!i)return-1;t=0}if("string"==typeof r&&(r=n.from(r,o)),n.isBuffer(r))return 0===r.length?-1:d(e,r,t,o,i);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):d(e,[r],t,o,i);throw new TypeError("val must be string, number or Buffer")}function d(e,r,t,n,o){var i,u=1,a=e.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||r.length<2)return-1;u=2,a/=2,s/=2,t/=2}function c(e,r){return 1===u?e[r]:e.readUInt16BE(r*u)}if(o){var p=-1;for(i=t;i<a;i++)if(c(e,i)===c(r,-1===p?0:i-p)){if(-1===p&&(p=i),i-p+1===s)return p*u}else-1!==p&&(i-=i-p),p=-1}else for(t+s>a&&(t=a-s),i=t;i>=0;i--){for(var f=!0,l=0;l<s;l++)if(c(e,i+l)!==c(r,l)){f=!1;break}if(f)return i}return-1}function h(e,r,t,n){t=Number(t)||0;var o=e.length-t;n?(n=Number(n))>o&&(n=o):n=o;var i=r.length;n>i/2&&(n=i/2);for(var u=0;u<n;++u){var a=parseInt(r.substr(2*u,2),16);if(G(a))return u;e[t+u]=a}return u}function E(e,r,t,n){return F(L(r,e.length-t),e,t,n)}function g(e,r,t,n){return F(function(e){for(var r=[],t=0;t<e.length;++t)r.push(255&e.charCodeAt(t));return r}(r),e,t,n)}function v(e,r,t,n){return g(e,r,t,n)}function S(e,r,t,n){return F(D(r),e,t,n)}function A(e,r,t,n){return F(function(e,r){for(var t,n,o,i=[],u=0;u<e.length&&!((r-=2)<0);++u)n=(t=e.charCodeAt(u))>>8,o=t%256,i.push(o),i.push(n);return i}(r,e.length-t),e,t,n)}function _(e,r,t){return 0===r&&t===e.length?y.fromByteArray(e):y.fromByteArray(e.slice(r,t))}function O(e,r,t){t=Math.min(e.length,t);for(var n=[],o=r;o<t;){var i,u,a,s,c=e[o],p=null,f=c>239?4:c>223?3:c>191?2:1;if(o+f<=t)switch(f){case 1:c<128&&(p=c);break;case 2:128==(192&(i=e[o+1]))&&(s=(31&c)<<6|63&i)>127&&(p=s);break;case 3:i=e[o+1],u=e[o+2],128==(192&i)&&128==(192&u)&&(s=(15&c)<<12|(63&i)<<6|63&u)>2047&&(s<55296||s>57343)&&(p=s);break;case 4:i=e[o+1],u=e[o+2],a=e[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&(s=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&a)>65535&&s<1114112&&(p=s)}null===p?(p=65533,f=1):p>65535&&(p-=65536,n.push(p>>>10&1023|55296),p=56320|1023&p),n.push(p),o+=f}return function(e){var r=e.length;if(r<=b)return String.fromCharCode.apply(String,e);for(var t="",n=0;n<r;)t+=String.fromCharCode.apply(String,e.slice(n,n+=b));return t}(n)}t.Buffer=n,t.INSPECT_MAX_BYTES=50,n.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(r){return!1}}(),n.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&n[Symbol.species]===n&&Object.defineProperty(n,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),n.poolSize=8192,n.from=function(e,r,t){return o(e,r,t)},n.prototype.__proto__=Uint8Array.prototype,n.__proto__=Uint8Array,n.alloc=function(r,t,n){return function(r,t,n){return i(r),r<=0?e(r):void 0!==t?"string"==typeof n?e(r).fill(t,n):e(r).fill(t):e(r)}(r,t,n)},n.allocUnsafe=function(e){return u(e)},n.allocUnsafeSlow=function(e){return u(e)},n.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==n.prototype},n.compare=function(e,r){if(j(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),j(r,Uint8Array)&&(r=n.from(r,r.offset,r.byteLength)),!n.isBuffer(e)||!n.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var t=e.length,o=r.length,i=0,u=Math.min(t,o);i<u;++i)if(e[i]!==r[i]){t=e[i],o=r[i];break}return t<o?-1:o<t?1:0},n.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return n.alloc(0);var t;if(void 0===r)for(r=0,t=0;t<e.length;++t)r+=e[t].length;var o=n.allocUnsafe(r),i=0;for(t=0;t<e.length;++t){var u=e[t];if(j(u,Uint8Array)&&(u=n.from(u)),!n.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(o,i),i+=u.length}return o},n.byteLength=c,n.prototype._isBuffer=!0,n.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)f(this,r,r+1);return this},n.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)f(this,r,r+3),f(this,r+1,r+2);return this},n.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)f(this,r,r+7),f(this,r+1,r+6),f(this,r+2,r+5),f(this,r+3,r+4);return this},n.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):p.apply(this,arguments)},n.prototype.toLocaleString=n.prototype.toString,n.prototype.equals=function(e){if(!n.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===n.compare(this,e)},n.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n.prototype.compare=function(e,r,t,o,i){if(j(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),!n.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=0),void 0===t&&(t=e?e.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),r<0||t>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=t)return 0;if(o>=i)return-1;if(r>=t)return 1;if(this===e)return 0;for(var u=(i>>>=0)-(o>>>=0),a=(t>>>=0)-(r>>>=0),s=Math.min(u,a),c=this.slice(o,i),p=e.slice(r,t),f=0;f<s;++f)if(c[f]!==p[f]){u=c[f],a=p[f];break}return u<a?-1:a<u?1:0},n.prototype.includes=function(e,r,t){return-1!==this.indexOf(e,r,t)},n.prototype.indexOf=function(e,r,t){return l(this,e,r,t,!0)},n.prototype.lastIndexOf=function(e,r,t){return l(this,e,r,t,!1)},n.prototype.write=function(e,r,t,n){if(void 0===r)n="utf8",t=this.length,r=0;else if(void 0===t&&"string"==typeof r)n=r,t=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r>>>=0,isFinite(t)?(t>>>=0,void 0===n&&(n="utf8")):(n=t,t=void 0)}var o=this.length-r;if((void 0===t||t>o)&&(t=o),e.length>0&&(t<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return h(this,e,r,t);case"utf8":case"utf-8":return E(this,e,r,t);case"ascii":return g(this,e,r,t);case"latin1":case"binary":return v(this,e,r,t);case"base64":return S(this,e,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,r,t);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var b=4096;function m(e,r,t){var n="";t=Math.min(e.length,t);for(var o=r;o<t;++o)n+=String.fromCharCode(127&e[o]);return n}function T(e,r,t){var n="";t=Math.min(e.length,t);for(var o=r;o<t;++o)n+=String.fromCharCode(e[o]);return n}function w(e,r,t){var n,o=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>o)&&(t=o);for(var i="",u=r;u<t;++u)i+=(n=e[u])<16?"0"+n.toString(16):n.toString(16);return i}function I(e,r,t){for(var n=e.slice(r,t),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function N(e,r,t){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}function M(e,r,t,o,i,u){if(!n.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<u)throw new RangeError('"value" argument is out of bounds');if(t+o>e.length)throw new RangeError("Index out of range")}function C(e,r,t,n,o,i){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function U(e,r,t,n,o){return r=+r,t>>>=0,o||C(e,0,t,4),P.write(e,r,t,n,23,4),t+4}function B(e,r,t,n,o){return r=+r,t>>>=0,o||C(e,0,t,8),P.write(e,r,t,n,52,8),t+8}n.prototype.slice=function(e,r){var t=this.length;(e=~~e)<0?(e+=t)<0&&(e=0):e>t&&(e=t),(r=void 0===r?t:~~r)<0?(r+=t)<0&&(r=0):r>t&&(r=t),r<e&&(r=e);var o=this.subarray(e,r);return o.__proto__=n.prototype,o},n.prototype.readUIntLE=function(e,r,t){e>>>=0,r>>>=0,t||N(e,r,this.length);for(var n=this[e],o=1,i=0;++i<r&&(o*=256);)n+=this[e+i]*o;return n},n.prototype.readUIntBE=function(e,r,t){e>>>=0,r>>>=0,t||N(e,r,this.length);for(var n=this[e+--r],o=1;r>0&&(o*=256);)n+=this[e+--r]*o;return n},n.prototype.readUInt8=function(e,r){return e>>>=0,r||N(e,1,this.length),this[e]},n.prototype.readUInt16LE=function(e,r){return e>>>=0,r||N(e,2,this.length),this[e]|this[e+1]<<8},n.prototype.readUInt16BE=function(e,r){return e>>>=0,r||N(e,2,this.length),this[e]<<8|this[e+1]},n.prototype.readUInt32LE=function(e,r){return e>>>=0,r||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},n.prototype.readUInt32BE=function(e,r){return e>>>=0,r||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},n.prototype.readIntLE=function(e,r,t){e>>>=0,r>>>=0,t||N(e,r,this.length);for(var n=this[e],o=1,i=0;++i<r&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*r)),n},n.prototype.readIntBE=function(e,r,t){e>>>=0,r>>>=0,t||N(e,r,this.length);for(var n=r,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},n.prototype.readInt8=function(e,r){return e>>>=0,r||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},n.prototype.readInt16LE=function(e,r){e>>>=0,r||N(e,2,this.length);var t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},n.prototype.readInt16BE=function(e,r){e>>>=0,r||N(e,2,this.length);var t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},n.prototype.readInt32LE=function(e,r){return e>>>=0,r||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},n.prototype.readInt32BE=function(e,r){return e>>>=0,r||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},n.prototype.readFloatLE=function(e,r){return e>>>=0,r||N(e,4,this.length),P.read(this,e,!0,23,4)},n.prototype.readFloatBE=function(e,r){return e>>>=0,r||N(e,4,this.length),P.read(this,e,!1,23,4)},n.prototype.readDoubleLE=function(e,r){return e>>>=0,r||N(e,8,this.length),P.read(this,e,!0,52,8)},n.prototype.readDoubleBE=function(e,r){return e>>>=0,r||N(e,8,this.length),P.read(this,e,!1,52,8)},n.prototype.writeUIntLE=function(e,r,t,n){e=+e,r>>>=0,t>>>=0,n||M(this,e,r,t,Math.pow(2,8*t)-1,0);var o=1,i=0;for(this[r]=255&e;++i<t&&(o*=256);)this[r+i]=e/o&255;return r+t},n.prototype.writeUIntBE=function(e,r,t,n){e=+e,r>>>=0,t>>>=0,n||M(this,e,r,t,Math.pow(2,8*t)-1,0);var o=t-1,i=1;for(this[r+o]=255&e;--o>=0&&(i*=256);)this[r+o]=e/i&255;return r+t},n.prototype.writeUInt8=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,1,255,0),this[r]=255&e,r+1},n.prototype.writeUInt16LE=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,2,65535,0),this[r]=255&e,this[r+1]=e>>>8,r+2},n.prototype.writeUInt16BE=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=255&e,r+2},n.prototype.writeUInt32LE=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e,r+4},n.prototype.writeUInt32BE=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e,r+4},n.prototype.writeIntLE=function(e,r,t,n){if(e=+e,r>>>=0,!n){var o=Math.pow(2,8*t-1);M(this,e,r,t,o-1,-o)}var i=0,u=1,a=0;for(this[r]=255&e;++i<t&&(u*=256);)e<0&&0===a&&0!==this[r+i-1]&&(a=1),this[r+i]=(e/u|0)-a&255;return r+t},n.prototype.writeIntBE=function(e,r,t,n){if(e=+e,r>>>=0,!n){var o=Math.pow(2,8*t-1);M(this,e,r,t,o-1,-o)}var i=t-1,u=1,a=0;for(this[r+i]=255&e;--i>=0&&(u*=256);)e<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(e/u|0)-a&255;return r+t},n.prototype.writeInt8=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=255&e,r+1},n.prototype.writeInt16LE=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,2,32767,-32768),this[r]=255&e,this[r+1]=e>>>8,r+2},n.prototype.writeInt16BE=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=255&e,r+2},n.prototype.writeInt32LE=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,4,2147483647,-2147483648),this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4},n.prototype.writeInt32BE=function(e,r,t){return e=+e,r>>>=0,t||M(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e,r+4},n.prototype.writeFloatLE=function(e,r,t){return U(this,e,r,!0,t)},n.prototype.writeFloatBE=function(e,r,t){return U(this,e,r,!1,t)},n.prototype.writeDoubleLE=function(e,r,t){return B(this,e,r,!0,t)},n.prototype.writeDoubleBE=function(e,r,t){return B(this,e,r,!1,t)},n.prototype.copy=function(e,r,t,o){if(!n.isBuffer(e))throw new TypeError("argument should be a Buffer");if(t||(t=0),o||0===o||(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<t&&(o=t),o===t)return 0;if(0===e.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(t<0||t>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-t&&(o=e.length-r+t);var i=o-t;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(r,t,o);else if(this===e&&t<r&&r<o)for(var u=i-1;u>=0;--u)e[u+r]=this[u+t];else Uint8Array.prototype.set.call(e,this.subarray(t,o),r);return i},n.prototype.fill=function(e,r,t,o){if("string"==typeof e){if("string"==typeof r?(o=r,r=0,t=this.length):"string"==typeof t&&(o=t,t=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!n.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===e.length){var i=e.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(e=i)}}else"number"==typeof e&&(e&=255);if(r<0||this.length<r||this.length<t)throw new RangeError("Out of range index");if(t<=r)return this;var u;if(r>>>=0,t=void 0===t?this.length:t>>>0,e||(e=0),"number"==typeof e)for(u=r;u<t;++u)this[u]=e;else{var a=n.isBuffer(e)?e:n.from(e,o),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<t-r;++u)this[u+r]=a[u%s]}return this};var R=/[^+/0-9A-Za-z-_]/g;function L(e,r){var t;r=r||1/0;for(var n=e.length,o=null,i=[],u=0;u<n;++u){if((t=e.charCodeAt(u))>55295&&t<57344){if(!o){if(t>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=t;continue}if(t<56320){(r-=3)>-1&&i.push(239,191,189),o=t;continue}t=65536+(o-55296<<10|t-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,t<128){if((r-=1)<0)break;i.push(t)}else if(t<2048){if((r-=2)<0)break;i.push(t>>6|192,63&t|128)}else if(t<65536){if((r-=3)<0)break;i.push(t>>12|224,t>>6&63|128,63&t|128)}else{if(!(t<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}}return i}function D(e){return y.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,r,t,n){for(var o=0;o<n&&!(o+t>=r.length||o>=e.length);++o)r[o+t]=e[o];return o}function j(e,r){return e instanceof r||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===r.name}function G(e){return e!=e}}).call(this)}).call(this,E({}).Buffer)},function(t){return r||e(r={exports:{},parent:t},r.exports),r.exports}),g={};Object.defineProperty(g,"__esModule",{value:!0}),g.NotificationEvent=g.BrowserManagerEvent=g.UtilsEvent=g.CookiesEvent=g.GalleryManagerEvent=g.InAppPurchaseEvent=g.MiniAppPreferenceEvent=g.SecureStorageEvent=g.UniversalBridgeEvent=g.WebConfigEvent=g.ChatServiceEvent=g.UserInfoEvent=g.CommonEvents=g.HostAppEvents=g.MiniAppKeyboardEvents=g.MiniAppEvents=void 0,(h=g.MiniAppEvents||(g.MiniAppEvents={})).EXTERNAL_WEBVIEW_CLOSE="miniappwebviewclosed",h.PAUSE="miniapppause",h.RESUME="miniappresume",(d=g.MiniAppKeyboardEvents||(g.MiniAppKeyboardEvents={})).KEYBOARDSHOWN="miniappkeyboardshown",d.KEYBOARDHIDDEN="miniappkeyboardhidden",(g.HostAppEvents||(g.HostAppEvents={})).RECEIVE_JSON_INFO="miniappreceivejsoninfo",(l=g.CommonEvents||(g.CommonEvents={})).GET_UNIQUE_ID="getUniqueId",l.GET_MESSAGE_UNIQUE_ID="getMessagingUniqueId",l.GET_MAU_ID="getMauid",l.REQUEST_CUSTOM_PERMISSIONS="requestCustomPermissions",l.LOAD_AD="loadAd",l.SHOW_AD="showAd",l.SHARE_INFO="shareInfo",l.SET_SCREEN_ORIENTATION="setScreenOrientation",l.GET_POINTS="getPoints",l.GET_HOST_ENVIRONMENT_INFO="getHostEnvironmentInfo",l.DOWNLOAD_FILE="downloadFile",l.SET_CLOSE_ALERT="setCloseAlert",l.REQUEST_PERMISSION="requestPermission",(f=g.UserInfoEvent||(g.UserInfoEvent={})).GET_USER_NAME="getUserName",f.GET_PROFILE_PHOTO="getProfilePhoto",f.GET_POINT="getPoints",f.GET_PHONE_NUMBER="getPhoneNumber",f.IS_LOGGED_IN="isLoggedIn",f.GET_ACCESS_TOKEN="getAccessToken",f.GET_CONTACTS="getContacts",(p=g.ChatServiceEvent||(g.ChatServiceEvent={})).SEND_MESSAGE_TO_CONTACT="sendMessageToContact",p.SEND_MESSAGE_TO_CONTACT_ID="sendMessageToContactId",p.SEND_MESSAGE_TO_MULTIPLE_CONTACTS="sendMessageToMultipleContacts",(g.WebConfigEvent||(g.WebConfigEvent={})).ALLOW_BACK_FORWARD_NAVIGATION_GESTURES="allowBackForwardNavigationGestures",(c=g.UniversalBridgeEvent||(g.UniversalBridgeEvent={})).SEND_JSON_TO_HOST_APP="sendJsonToHostapp",c.SEND_INFO_TO_HOST_APP="sendInfoToHostapp",(s=g.SecureStorageEvent||(g.SecureStorageEvent={})).SET_SECURE_STORAGE_ITEM="setSecureStorageItems",s.GET_SECURE_STORAGE_ITEM="getSecureStorageItem",s.REMOVE_SECURE_STORAGE_ITEM="removeSecureStorageItems",s.CLEAR_SECURE_STORAGE="clearSecureStorage",s.GET_SECURE_STORAGE_SIZE="getSecureStorageSize",(a=g.MiniAppPreferenceEvent||(g.MiniAppPreferenceEvent={})).SET_MINI_APP_PREFERENCE="setMiniAppPreference",a.GET_MINI_APP_PREFERENCE="getMiniAppPreference",a.REMOVE_MINI_APP_PREFERENCE="removeMiniAppPreference",a.CLEAR_MINI_APP_PREFERENCE="clearMiniAppPreferences",(u=g.InAppPurchaseEvent||(g.InAppPurchaseEvent={})).GET_ALL_PRODUCT="getAllProducts",u.PURCHASE_PRODUCT_WITH="purchaseProductWith",u.CONSUME_PRODUCT_WITH="consumeProductWith",(g.GalleryManagerEvent||(g.GalleryManagerEvent={})).GET_IMAGE_FROM_GALLERY="getImageFromGallery",(i=g.CookiesEvent||(g.CookiesEvent={})).GET_ALL_COOKIES="getAllCookies",i.GET_COOKIES="getCookies",(o=g.UtilsEvent||(g.UtilsEvent={})).CLOSE_MINI_APP="closeMiniApp",o.MINI_APP_FINISHED_LOADING="miniAppFinishedLoading",o.GET_HOST_APP_THEME_COLORS="getHostAppThemeColors",o.SET_CLOSE_ALERT="setCloseAlert",o.IS_DARK_MODE="isDarkMode",o.SEND_ANALYTICS="sendAnalytics",o.GET_FEATURE_LIST="getFeatureList",o.CAN_OPEN_APP_DEEPLINK="canOpenAppDeeplink",o.IS_APP_DEEPLINK_SUPPORTED="isAppDeeplinkSupported",(n=g.BrowserManagerEvent||(g.BrowserManagerEvent={})).LAUNCH_EXTERNAL_BROWSER="launchExternalBrowser",n.LAUNCH_INTERNAL_BROWSER="launchInternalBrowser",(t=g.NotificationEvent||(g.NotificationEvent={})).SHOULD_CLEAR_NOTIFICATIONS="shouldClearNotifications",t.SHOULD_UPDATE_BADGE_NUMBER="shouldUpdateBadgeNumber",t.SHOULD_UPDATE_NOTIFICATION_INFO="shouldUpdateNotificationInfo";for(var y={toByteArray:function(e){var r,t,n=b(e),o=n[0],i=n[1],u=new A(function(e,r,t){return 3*(r+t)/4-t}(0,o,i)),a=0,s=i>0?o-4:o;for(t=0;t<s;t+=4)r=S[e.charCodeAt(t)]<<18|S[e.charCodeAt(t+1)]<<12|S[e.charCodeAt(t+2)]<<6|S[e.charCodeAt(t+3)],u[a++]=r>>16&255,u[a++]=r>>8&255,u[a++]=255&r;return 2===i&&(r=S[e.charCodeAt(t)]<<2|S[e.charCodeAt(t+1)]>>4,u[a++]=255&r),1===i&&(r=S[e.charCodeAt(t)]<<10|S[e.charCodeAt(t+1)]<<4|S[e.charCodeAt(t+2)]>>2,u[a++]=r>>8&255,u[a++]=255&r),u},fromByteArray:function(e){for(var r,t=e.length,n=t%3,o=[],i=0,u=t-n;i<u;i+=16383)o.push(m(e,i,i+16383>u?u:i+16383));return 1===n?(r=e[t-1],o.push(v[r>>2]+v[r<<4&63]+"==")):2===n&&(r=(e[t-2]<<8)+e[t-1],o.push(v[r>>10]+v[r>>4&63]+v[r<<2&63]+"=")),o.join("")}},v=[],S=[],A="undefined"!=typeof Uint8Array?Uint8Array:Array,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",O=0;O<64;++O)v[O]=_[O],S[_.charCodeAt(O)]=O;function b(e){var r=e.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");return-1===t&&(t=r),[t,t===r?0:4-t%4]}function m(e,r,t){for(var n,o,i=[],u=r;u<t;u+=3)n=(e[u]<<16&16711680)+(e[u+1]<<8&65280)+(255&e[u+2]),i.push(v[(o=n)>>18&63]+v[o>>12&63]+v[o>>6&63]+v[63&o]);return i.join("")}S["-".charCodeAt(0)]=62,S["_".charCodeAt(0)]=63;var P={
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
read:function(e,r,t,n,o){var i,u,a=8*o-n-1,s=(1<<a)-1,c=s>>1,p=-7,f=t?o-1:0,l=t?-1:1,d=e[r+f];for(f+=l,i=d&(1<<-p)-1,d>>=-p,p+=a;p>0;i=256*i+e[r+f],f+=l,p-=8);for(u=i&(1<<-p)-1,i>>=-p,p+=n;p>0;u=256*u+e[r+f],f+=l,p-=8);if(0===i)i=1-c;else{if(i===s)return u?NaN:1/0*(d?-1:1);u+=Math.pow(2,n),i-=c}return(d?-1:1)*u*Math.pow(2,i-n)},write:function(e,r,t,n,o,i){var u,a,s,c=8*i-o-1,p=(1<<c)-1,f=p>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,h=n?1:-1,E=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=p):(u=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-u))<1&&(u--,s*=2),(r+=u+f>=1?l/s:l*Math.pow(2,1-f))*s>=2&&(u++,s/=2),u+f>=p?(a=0,u=p):u+f>=1?(a=(r*s-1)*Math.pow(2,o),u+=f):(a=r*Math.pow(2,f-1)*Math.pow(2,o),u=0));o>=8;e[t+d]=255&a,d+=h,a/=256,o-=8);for(u=u<<o|a,c+=o;c>0;e[t+d]=255&u,d+=h,u/=256,c-=8);e[t+d-h]|=128*E}},T={};(function(e){(function(){"use strict";function t(e){try{JSON.parse(e)}catch(r){return!1}return!0}Object.defineProperty(T,"__esModule",{value:!0}),T.convertUnicodeCharactersForAndroid=T.convertUnicodeCharacters=void 0,T.convertUnicodeCharacters=function(r){var o=e.from(r,"base64").toString("utf8"),i=n(o),u=JSON.stringify(i),a=u.replace(/\\\\/g,"\\");return!0===t(a)?JSON.parse(a):JSON.parse(u)};var n=function(e){return e.replace(/\\(\d{3})/g,(function(e,r){return String.fromCharCode(o(r))}))},o=function(e){return Number.parseInt(e,8)};T.convertUnicodeCharactersForAndroid=function(r){var n=e.from(r,"base64").toString("utf8"),o=JSON.stringify(n),i=o.replace(/\\\\/g,"\\");return!0===t(o)?JSON.parse(o):JSON.parse(i)}}).call(this)}).call(this,E({}).Buffer);var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.getBridge=void 0,w.getBridge=function(){return window.MiniAppBridge};var I,N={},M=this&&this.__extends||(I=function(e,r){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}I(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)});Object.defineProperty(N,"__esModule",{value:!0}),N.MiniAppError=void 0;var C=function(e){function r(t){var n=e.call(this)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.name=t.type,n.message=t.message,n}return M(r,e),r}(Error);N.MiniAppError=C;var U,B,R={},L=this&&this.__extends||(U=function(e,r){return(U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}U(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)});Object.defineProperty(R,"__esModule",{value:!0}),R.parseAuthError=R.AuthorizationFailureError=R.ScopesNotSupportedError=R.AudienceNotSupportedError=void 0,function(e){e.AudienceNotSupportedError="AudienceNotSupportedError",e.ScopesNotSupportedError="ScopesNotSupportedError",e.AuthorizationFailureError="AuthorizationFailureError"}(B||(B={}));var D=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="The value passed for 'audience' is not supported.",n}return L(r,e),r}(N.MiniAppError);R.AudienceNotSupportedError=D;var F=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="The value passed for 'scopes' is not supported.",n}return L(r,e),r}(N.MiniAppError);R.ScopesNotSupportedError=F;var j=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n}return L(r,e),r}(N.MiniAppError);R.AuthorizationFailureError=j,R.parseAuthError=function(e){switch(B[e.type]){case B.AuthorizationFailureError:return new j(e);case B.AudienceNotSupportedError:return new D(e);case B.ScopesNotSupportedError:return new F(e);default:return}};var G,k,H={},x=this&&this.__extends||(G=function(e,r){return(G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}G(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)});Object.defineProperty(H,"__esModule",{value:!0}),H.parseDownloadError=H.DownloadHttpError=H.SaveFailureError=H.InvalidUrlError=H.DownloadFailedError=void 0,function(e){e.DownloadFailedError="DownloadFailedError",e.InvalidUrlError="InvalidUrlError",e.SaveFailureError="SaveFailureError",e.DownloadHttpError="DownloadHttpError"}(k||(k={}));var W=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Failed to download the file.",n}return x(r,e),r}(N.MiniAppError);H.DownloadFailedError=W;var K=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="The provided URL is invalid.",n}return x(r,e),r}(N.MiniAppError);H.InvalidUrlError=K;var J=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Failed to save the file to the device.",n}return x(r,e),r}(N.MiniAppError);H.SaveFailureError=J;var V=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.code=t.code,n.message=t.message,n}return x(r,e),r}(N.MiniAppError);H.DownloadHttpError=V,H.parseDownloadError=function(e){switch(k[e.type]){case k.DownloadFailedError:return new W(e);case k.InvalidUrlError:return new K(e);case k.SaveFailureError:return new J(e);case k.DownloadHttpError:return new V(e);default:return}};var z,q,Q={},Y=this&&this.__extends||(z=function(e,r){return(z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}z(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)});Object.defineProperty(Q,"__esModule",{value:!0}),Q.parseInAppPurchaseError=Q.UserCancelledPurchaseError=Q.ProductPurchasedAlreadyError=Q.ProductNotFoundError=Q.ConsumeFailedError=Q.PurchaseFailedError=void 0,function(e){e.PurchaseFailedError="PurchaseFailedError",e.ConsumeFailedError="ConsumeFailedError",e.ProductNotFoundError="ProductNotFoundError",e.ProductPurchasedAlreadyError="ProductPurchasedAlreadyError",e.UserCancelledPurchaseError="UserCancelledPurchaseError"}(q||(q={}));var X=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Product Purchase failed, please try again later",n}return Y(r,e),r}(N.MiniAppError);Q.PurchaseFailedError=X;var Z=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Unable to consume the product, please make sure the product is purchased already",n}return Y(r,e),r}(N.MiniAppError);Q.ConsumeFailedError=Z;var $=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Unable to find the ProductId. Please make sure that the productId is registered in Google Play",n}return Y(r,e),r}(N.MiniAppError);Q.ProductNotFoundError=$;var ee=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="This Product is purchased already",n}return Y(r,e),r}(N.MiniAppError);Q.ProductPurchasedAlreadyError=ee;var re=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="User cancelled the purchase",n}return Y(r,e),r}(N.MiniAppError);Q.UserCancelledPurchaseError=re,Q.parseInAppPurchaseError=function(e){switch(q[e.type]){case q.PurchaseFailedError:return new X(e);case q.ConsumeFailedError:return new Z(e);case q.ProductNotFoundError:return new $(e);case q.ProductPurchasedAlreadyError:return new ee(e);case q.UserCancelledPurchaseError:return new re(e);default:return}};var te,ne,oe={},ie=this&&this.__extends||(te=function(e,r){return(te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}te(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)});Object.defineProperty(oe,"__esModule",{value:!0}),oe.parseStorageError=oe.SecureStorageIOError=oe.SecureStorageUnavailableError=oe.SecureStorageBusyError=oe.SecureStorageFullError=void 0,function(e){e.SecureStorageFullError="SecureStorageFullError",e.SecureStorageBusyError="SecureStorageBusyError",e.SecureStorageUnavailableError="SecureStorageUnavailableError",e.SecureStorageIOError="SecureStorageIOError"}(ne||(ne={}));var ue=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Storage limit is exceeded or full already",n}return ie(r,e),r}(N.MiniAppError);oe.SecureStorageFullError=ue;var ae=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Storage is busy, please try again",n}return ie(r,e),r}(N.MiniAppError);oe.SecureStorageBusyError=ae;var se=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Storage is not yet loaded or failed to load",n}return ie(r,e),r}(N.MiniAppError);oe.SecureStorageUnavailableError=se;var ce=function(e){function r(t){var n=e.call(this,t)||this;return n.errorInput=t,Object.setPrototypeOf(n,r.prototype),n.message="Unable to read/write changes in Storage.",n}return ie(r,e),r}(N.MiniAppError);oe.SecureStorageIOError=ce,oe.parseStorageError=function(e){switch(ne[e.type]){case ne.SecureStorageFullError:return new ue(e);case ne.SecureStorageBusyError:return new ae(e);case ne.SecureStorageUnavailableError:return new se(e);case ne.SecureStorageIOError:return new ce(e);default:return}};var pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.UserCancelledPurchaseError=pe.ProductPurchasedAlreadyError=pe.ProductNotFoundError=pe.ConsumeFailedError=pe.PurchaseFailedError=pe.SecureStorageIOError=pe.SecureStorageUnavailableError=pe.SecureStorageBusyError=pe.SecureStorageFullError=pe.ScopesNotSupportedError=pe.SaveFailureError=pe.parseMiniAppError=pe.MiniAppError=pe.InvalidUrlError=pe.DownloadHttpError=pe.DownloadFailedError=pe.AudienceNotSupportedError=pe.AuthorizationFailureError=void 0,Object.defineProperty(pe,"AuthorizationFailureError",{enumerable:!0,get:function(){return R.AuthorizationFailureError}}),Object.defineProperty(pe,"AudienceNotSupportedError",{enumerable:!0,get:function(){return R.AudienceNotSupportedError}}),Object.defineProperty(pe,"ScopesNotSupportedError",{enumerable:!0,get:function(){return R.ScopesNotSupportedError}}),Object.defineProperty(pe,"DownloadFailedError",{enumerable:!0,get:function(){return H.DownloadFailedError}}),Object.defineProperty(pe,"InvalidUrlError",{enumerable:!0,get:function(){return H.InvalidUrlError}}),Object.defineProperty(pe,"SaveFailureError",{enumerable:!0,get:function(){return H.SaveFailureError}}),Object.defineProperty(pe,"DownloadHttpError",{enumerable:!0,get:function(){return H.DownloadHttpError}}),Object.defineProperty(pe,"ConsumeFailedError",{enumerable:!0,get:function(){return Q.ConsumeFailedError}}),Object.defineProperty(pe,"ProductNotFoundError",{enumerable:!0,get:function(){return Q.ProductNotFoundError}}),Object.defineProperty(pe,"ProductPurchasedAlreadyError",{enumerable:!0,get:function(){return Q.ProductPurchasedAlreadyError}}),Object.defineProperty(pe,"PurchaseFailedError",{enumerable:!0,get:function(){return Q.PurchaseFailedError}}),Object.defineProperty(pe,"UserCancelledPurchaseError",{enumerable:!0,get:function(){return Q.UserCancelledPurchaseError}}),Object.defineProperty(pe,"MiniAppError",{enumerable:!0,get:function(){return N.MiniAppError}}),Object.defineProperty(pe,"SecureStorageBusyError",{enumerable:!0,get:function(){return oe.SecureStorageBusyError}}),Object.defineProperty(pe,"SecureStorageFullError",{enumerable:!0,get:function(){return oe.SecureStorageFullError}}),Object.defineProperty(pe,"SecureStorageIOError",{enumerable:!0,get:function(){return oe.SecureStorageIOError}}),Object.defineProperty(pe,"SecureStorageUnavailableError",{enumerable:!0,get:function(){return oe.SecureStorageUnavailableError}}),pe.parseMiniAppError=function(e){try{var t=JSON.parse(e);return(0,R.parseAuthError)(t)||(0,H.parseDownloadError)(t)||(0,oe.parseStorageError)(t)||(0,Q.parseInAppPurchaseError)(t)||new N.MiniAppError(t)}catch(r){return console.error(r),""!==e||void 0!==e?new N.MiniAppError({type:"MiniAppError",message:e}):new N.MiniAppError({type:"MiniAppError",message:"Failed to parse the error"})}};var fe={};Object.defineProperty(fe,"__esModule",{value:!0}),fe.AccessTokenData=void 0;fe.AccessTokenData=function(e){this.token=e.token,this.validUntil=new Date(e.validUntil),this.scopes=new le(e.scopes)};var le=function(e){this.audience=e.audience,this.scopes=e.scopes},de={},he=this&&this.__assign||function(){return(he=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)},Ee=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,u){function a(e){try{c(o.next(e))}catch(r){u(r)}}function s(e){try{c(o.throw(e))}catch(r){u(r)}}function c(e){var r;e.done?i(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},ge=this&&this.__generator||function(e,t){var n,o,i,u,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return u={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(r){s=[6,r],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(de,"__esModule",{value:!0}),de.DecodeManager=void 0;var ye=E({}),ve=function(){function e(){}return e.prototype.decodeContacts=function(e){return Ee(this,void 0,void 0,(function(){var r,t,n,o,i;return ge(this,(function(u){switch(u.label){case 0:r=[],t=0,n=e,u.label=1;case 1:return t<n.length?(o=n[t]).name?[4,this.decodeBase64(o.name)]:[3,3]:[3,5];case 2:return i=u.sent(),r.push(he(he({},o),{name:i})),[3,4];case 3:r.push(o),u.label=4;case 4:return t++,[3,1];case 5:return console.log("DECODED Contacts: ",r),[2,r]}}))}))},e.prototype.decodeBase64=function(e){return Ee(this,void 0,void 0,(function(){var r;return ge(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.decode(e)];case 1:return[2,t.sent().toString()];case 2:return r=t.sent(),console.error("Error decoding input: ".concat(r.message)),[2,""];case 3:return[2]}}))}))},e.prototype.decode=function(e){return e=e||"",ye.Buffer.from(e,"base64")},e}();de.DecodeManager=ve;var Se={},Ae=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,u){function a(e){try{c(o.next(e))}catch(r){u(r)}}function s(e){try{c(o.throw(e))}catch(r){u(r)}}function c(e){var r;e.done?i(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},_e=this&&this.__generator||function(e,t){var n,o,i,u,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return u={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(r){s=[6,r],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(Se,"__esModule",{value:!0}),Se.UserInfo=void 0;var Oe=function(){function e(){}return e.prototype.getUserName=function(){var e=(0,w.getBridge)().platform;return(0,w.getBridge)().sendToNative(g.UserInfoEvent.GET_USER_NAME,null).then((function(r){return"iOS"===e?(0,T.convertUnicodeCharacters)(r):(0,T.convertUnicodeCharactersForAndroid)(r)})).catch((function(e){throw e}))},e.prototype.getProfilePhoto=function(){return(0,w.getBridge)().sendToNative(g.UserInfoEvent.GET_PROFILE_PHOTO,null)},e.prototype.getContacts=function(){return Ae(this,void 0,void 0,(function(){return _e(this,(function(e){try{return[2,(0,w.getBridge)().sendToNative(g.UserInfoEvent.GET_CONTACTS,{isContactsEncodingRequired:!0}).then((function(e){var r=JSON.parse(e);return(new de.DecodeManager).decodeContacts(r)})).catch((function(e){return e}))]}catch(r){return console.error("Error retrieving contacts: ".concat(r.message)),[2,[]]}return[2]}))}))},e.prototype.getAccessToken=function(e,r){return Ae(this,void 0,void 0,(function(){var t,n,o;return _e(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,(0,w.getBridge)().sendToNative(g.UserInfoEvent.GET_ACCESS_TOKEN,{audience:e,scopes:r})];case 1:return t=i.sent(),n=JSON.parse(t),[2,new fe.AccessTokenData(n)];case 2:return o=i.sent(),[2,(0,pe.parseMiniAppError)(o)];case 3:return[2]}}))}))},e.prototype.getPoints=function(){return Ae(this,void 0,void 0,(function(){var e,r;return _e(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,w.getBridge)().sendToNative(g.UserInfoEvent.GET_POINT,null)];case 1:return e=t.sent(),[2,JSON.parse(e)];case 2:return r=t.sent(),[2,(0,pe.parseMiniAppError)(r)];case 3:return[2]}}))}))},e.prototype.getPhoneNumber=function(){return(0,w.getBridge)().sendToNative(g.UserInfoEvent.GET_PHONE_NUMBER,null)},e.prototype.isLoggedIn=function(){return(0,w.getBridge)().sendToNative(g.UserInfoEvent.IS_LOGGED_IN,null)},e}();Se.UserInfo=Oe;var be={},me=this&&this.__assign||function(){return(me=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};Object.defineProperty(be,"__esModule",{value:!0}),be.ChatService=void 0;var Pe=function(){function e(){}return e.prototype.sendMessageToContact=function(e){return(0,w.getBridge)().sendToNative(g.ChatServiceEvent.SEND_MESSAGE_TO_CONTACT,{messageToContact:me(me({},e),{bannerMessage:Te(e.bannerMessage)})}).then((function(e){return"null"!==e&&null!==e?e:null})).catch((function(e){return e}))},e.prototype.sendMessageToContactId=function(e,r){return(0,w.getBridge)().sendToNative(g.ChatServiceEvent.SEND_MESSAGE_TO_CONTACT_ID,{contactId:e,messageToContact:me(me({},r),{bannerMessage:Te(r.bannerMessage)})}).then((function(e){return"null"!==e&&null!==e?e:null})).catch((function(e){return e}))},e.prototype.sendMessageToMultipleContacts=function(e){return(0,w.getBridge)().sendToNative(g.ChatServiceEvent.SEND_MESSAGE_TO_MULTIPLE_CONTACTS,{messageToContact:me(me({},e),{bannerMessage:Te(e.bannerMessage)})}).then((function(e){return"null"!==e&&null!==e?JSON.parse(e):null})).catch((function(e){return e}))},e}();function Te(e,r){return void 0===e&&(e=null),void 0===r&&(r=128),(null==e?void 0:e.length)>r?(null==e?void 0:e.substring(0,r-1))+"\u2026":e}be.ChatService=Pe;var we,Ie={};Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.MiniAppSecureStorageEvents=void 0,(we=Ie.MiniAppSecureStorageEvents||(Ie.MiniAppSecureStorageEvents={})).onReady="miniappsecurestorageready",we.onLoadError="miniappsecurestorageloaderror";var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.SecureStorageService=void 0;var Me=function(){function e(){var e=this;this.isSecureStorageReady=!1,this.secureStorageLoadError=null,window&&(window.addEventListener(Ie.MiniAppSecureStorageEvents.onReady,(function(){return e.isSecureStorageReady=!0})),window.addEventListener(Ie.MiniAppSecureStorageEvents.onLoadError,(function(r){return e.secureStorageLoadError=(0,pe.parseMiniAppError)(r.detail.message)})))}return e.prototype.setItems=function(e){return(0,w.getBridge)().sendToNative(g.SecureStorageEvent.SET_SECURE_STORAGE_ITEM,{secureStorageItems:e}).then((function(e){return!0})).catch((function(e){return(0,pe.parseMiniAppError)(e)}))},e.prototype.getItem=function(e){return(0,w.getBridge)().sendToNative(g.SecureStorageEvent.GET_SECURE_STORAGE_ITEM,{secureStorageKey:e}).then((function(e){return e})).catch((function(e){return(0,pe.parseMiniAppError)(e)}))},e.prototype.removeItems=function(e){return(0,w.getBridge)().sendToNative(g.SecureStorageEvent.REMOVE_SECURE_STORAGE_ITEM,{secureStorageKeyList:e}).then((function(e){return e})).catch((function(e){return(0,pe.parseMiniAppError)(e)}))},e.prototype.clear=function(){return(0,w.getBridge)().sendToNative(g.SecureStorageEvent.CLEAR_SECURE_STORAGE,null).then((function(e){return e})).catch((function(e){return(0,pe.parseMiniAppError)(e)}))},e.prototype.size=function(){return(0,w.getBridge)().sendToNative(g.SecureStorageEvent.GET_SECURE_STORAGE_SIZE,null).then((function(e){return JSON.parse(e)})).catch((function(e){return(0,pe.parseMiniAppError)(e)}))},e.prototype.onReady=function(e){this.isSecureStorageReady?e():window.addEventListener(Ie.MiniAppSecureStorageEvents.onReady,(function(){e()}))},e.prototype.onLoadError=function(e){this.secureStorageLoadError?e(this.secureStorageLoadError):window.addEventListener(Ie.MiniAppSecureStorageEvents.onLoadError,(function(r){e((0,pe.parseMiniAppError)(r.detail.message))}))},e}();Ne.SecureStorageService=Me;var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.UniversalBridge=void 0;var Ue=function(){function e(){}return e.prototype.sendJsonToHostapp=function(e){return(0,w.getBridge)().sendToNative(g.UniversalBridgeEvent.SEND_JSON_TO_HOST_APP,{jsonInfo:e}).then((function(e){return e})).catch((function(e){return(0,pe.parseMiniAppError)(e)}))},e.prototype.sendInfoToHostapp=function(e){return(0,w.getBridge)().sendToNative(g.UniversalBridgeEvent.SEND_INFO_TO_HOST_APP,{universalBridgeInfo:e}).then((function(e){return e})).catch((function(e){return(0,pe.parseMiniAppError)(e)}))},e}();Ce.UniversalBridge=Ue;var Be={};Object.defineProperty(Be,"__esModule",{value:!0}),Be.MiniAppBridgeUtils=void 0;var Re=function(){function e(){}return e.BooleanValue=function(e){if("boolean"==typeof e)return e;if("string"==typeof e){var r=e.toLowerCase();if("true"===r||"1"===r)return!0