Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ololoepepe/api-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ololoepepe/api-wrapper - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

2

dist/index.browser.js
/*! For license information please see index.browser.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apiWrapper=t():e.apiWrapper=t()}(self,(()=>(()=>{var e={591:(e,t,r)=>{var n=r(8)["default"];function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports["default"]=e.exports;var t={},r=Object.prototype,i=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(L){l=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=A(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=f(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,a),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(L){return{type:"throw",arg:L}}}t.wrap=p;var h={};function d(){}function y(){}function v(){}var m={};l(m,c,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(O([])));b&&b!==r&&i.call(b,c)&&(m=b);var w=v.prototype=d.prototype=Object.create(m);function _(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(o,a,c,s){var u=f(e[o],e,a);if("throw"!==u.type){var l=u.arg,p=l.value;return p&&"object"==n(p)&&i.call(p,"__await")?t.resolve(p.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(p).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function A(e,t){var r=e.iterator[t.method];if(undefined===r){if(t.delegate=null,"throw"===t.method){if(e.iterator["return"]&&(t.method="return",t.arg=undefined,A(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=undefined),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function O(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(i.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=undefined,t.done=!0,t};return n.next=n}}return{next:T}}function T(){return{value:undefined,done:!0}}return y.prototype=v,l(w,"constructor",v),l(v,"constructor",y),y.displayName=l(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,l(e,u,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},_(x.prototype),l(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(p(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},_(w),l(w,u,"Generator"),l(w,c,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(D),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=undefined)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=undefined),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),s=i.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),D(r),h}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;D(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:O(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=undefined),h}},t}e.exports=o,e.exports.__esModule=!0,e.exports["default"]=e.exports},8:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports["default"]=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports["default"]=e.exports},757:(e,t,r)=>{var n=r(591)();e.exports=n;try{regeneratorRuntime=n}catch(o){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}y(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,r)}(e,o,{once:!0})}))},i.EventEmitter=i,i.prototype._events=undefined,i.prototype._eventsCount=0,i.prototype._maxListeners=undefined;var a=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return e._maxListeners===undefined?i.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var o,i,a,u;if(c(r),(i=e._events)===undefined?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==undefined&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),a===undefined)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=s(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:undefined,target:e,type:t,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function f(e,t,r){var n=e._events;if(n===undefined)return[];var o=n[t];return o===undefined?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):d(o,o.length)}function h(e){var t=this._events;if(t!==undefined){var r=t[e];if("function"==typeof r)return 1;if(r!==undefined)return r.length}return 0}function d(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){this._events!==undefined&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||undefined},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(i!==undefined)o=o&&i.error===undefined;else if(!o)return!1;if(o){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var c=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw c.context=a,c}var s=i[e];if(s===undefined)return!1;if("function"==typeof s)n(s,this,t);else{var u=s.length,l=d(s,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,o,i,a;if(c(t),(n=this._events)===undefined)return this;if((r=n[e])===undefined)return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),n.removeListener!==undefined&&this.emit("removeListener",e,a||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if((r=this._events)===undefined)return this;if(r.removeListener===undefined)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):r[e]!==undefined&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t!==undefined)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}}},t={};function r(n){var o=t[n];if(o!==undefined)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e["default"]:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function e(t,r){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e(t,r)}function t(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function o(r,n,i){return o=t()?Reflect.construct.bind():function(t,r,n){var o=[null];o.push.apply(o,r);var i=new(Function.bind.apply(t,o));return n&&e(i,n.prototype),i},o.apply(null,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function a(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t,r,n,o,i,a){try{var c=e[i](a),s=c.value}catch(u){return void r(u)}c.done?t(s):Promise.resolve(s).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){c(i,n,o,a,s,"next",e)}function s(e){c(i,n,o,a,s,"throw",e)}a(undefined)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}r.r(n),r.d(n,{ApiAuthenticator:()=>O,ApiError:()=>k,ApiRealtimeTransport:()=>T,ApiTransport:()=>L,ApiWrapper:()=>G});var f=r(757),h=r.n(f);function d(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&e(t,r)}function y(e){return y="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},y(e)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e,t){if(t&&("object"===y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function b(t){var r="function"==typeof Map?new Map:undefined;return b=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,i)}function i(){return o(t,arguments,g(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),e(i,t)},b(t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g(e);if(t){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}var _="api_wrapper/authentication_failed",x="api_wrapper/method_not_implemented",A="api_wrapper/parameter_not_provided",E="api_wrapper/realtime_transport",D="api_wrapper/unexpected",k=function(e){d(r,e);var t=w(r);function r(){var e,n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:D,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:n,i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return u(this,r),(e=t.call(this,o)).code=n,e.data=i,e}return p(r,null,[{key:"createAuthenticationFailedErrorArgs",value:function(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[_,"[".concat(t,".").concat(r).concat(n?"::".concat(n):"","] Authentication failed"),{className:t,methodName:r,originalError:e,place:n}]}},{key:"createMethodNotImplementedErrorArgs",value:function(e,t){return[x,"[".concat(e,".").concat(t,"] Method not implemented: ").concat(t),{className:e,methodName:t}]}},{key:"createParameterNotProvidedErrorArgs",value:function(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[A,"[".concat(t,".").concat(r).concat(n?"::".concat(n):"","] Parameter not provided: ").concat(e),{className:t,methodName:r,parameterName:e,place:n}]}},{key:"createRealtimeTransportErrorArgs",value:function(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[E,"[".concat(t,".").concat(r).concat(n?"::".concat(n):"","] Realtime transport error: ").concat(e.message),{className:t,methodName:r,originalError:e,place:n}]}}]),r}(b(Error)),O=function(){function e(){u(this,e)}var t,r,n;return p(e,[{key:"authenticate",value:(n=s(h().mark((function i(e,t){return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw console.log("[ApiAuthenticator.authenticate]","wrapper:",e),console.log("[ApiAuthenticator.authenticate]","previousAuthenticationData:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","authenticate")));case 3:case"end":return r.stop()}}),i)}))),function(e,t){return n.apply(this,arguments)})},{key:"loadAuthenticationData",value:(r=s(h().mark((function c(){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","loadAuthenticationData")));case 1:case"end":return e.stop()}}),c)}))),function(){return r.apply(this,arguments)})},{key:"saveAuthenticationData",value:(t=s(h().mark((function l(e){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw console.log("[ApiAuthenticator.saveAuthenticationData]","authenticationData:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","saveAuthenticationData")));case 2:case"end":return t.stop()}}),l)}))),function(e){return t.apply(this,arguments)})}]),e}(),T=function(){function e(){u(this,e)}return p(e,[{key:"connect",value:function(e){var t=e.onConnect,r=e.onDisconnect,n=e.wrapper;throw console.log("[ApiRealtimeTransport.connect]","onConnect:",t),console.log("[ApiRealtimeTransport.connect]","onDisconnect:",r),console.log("[ApiRealtimeTransport.connect]","wrapper:",n),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","connect")))}},{key:"disconnect",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","disconnect")))}},{key:"subscribe",value:function(e){var t=e.callbacks,r=e.isPrivate,n=e.onSubscribe,i=e.onUnsubscribe,c=e.subscriptionData;throw console.log("[ApiRealtimeTransport.subscribe]","callbacks:",t),console.log("[ApiRealtimeTransport.subscribe]","isPrivate:",r),console.log("[ApiRealtimeTransport.subscribe]","onSubscribe:",n),console.log("[ApiRealtimeTransport.subscribe]","onUnsubscribe:",i),console.log("[ApiRealtimeTransport.subscribe]","subscriptionData:",c),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","subscribe")))}},{key:"unsubscribe",value:function(e){var t=e.subscriptionData;throw console.log("[ApiRealtimeTransport.unsubscribe]","subscriptionData:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","unsubscribe")))}}]),e}(),L=function(){function e(){u(this,e)}var t;return p(e,[{key:"callMethod",value:(t=s(h().mark((function r(e){var t,n,i,c;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw t=e.authenticationData,n=e.methodData,i=e.requestData,c=e.wrapper,console.log("[ApiTransport.callMethod]","authenticationData:",t),console.log("[ApiTransport.callMethod]","methodData:",n),console.log("[ApiTransport.callMethod]","requestData:",i),console.log("[ApiTransport.callMethod]","wrapper:",c),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","callMethod")));case 6:case"end":return r.stop()}}),r)}))),function(e){return t.apply(this,arguments)})},{key:"getCreateMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getCreateMethodData")))}},{key:"getDeleteMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getDeleteMethodData")))}},{key:"getReadMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getReadMethodData")))}},{key:"getUpdateMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getUpdateMethodData")))}},{key:"isAuthenticationFailedError",value:function(e){throw console.log("[ApiTransport.isAuthenticationFailedError]","error:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","isAuthenticationFailedError")))}},{key:"isSessionExpiredError",value:function(e){throw console.log("[ApiTransport.isSessionExpiredError]","error:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","isSessionExpiredError")))}}]),e}(),P=r(187),j=r.n(P);function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r["return"]||r["return"]()}finally{if(c)throw i}}}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){M(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var I={Connected:"connected",Connecting:"connecting",Disconnected:"disconnected",Disconnecting:"disconnecting"},F={delay:1e3,delayFactor:2,maxDelay:32e3},W=function(){function e(t){var r=t.onError,n=t.realtimeTransport,o=t.reconnectConfig,i=void 0===o?{}:o,a=t.wrapper;u(this,e),this._connectionState=I.Disconnected,this._onError=r,this._realtimeTransport=n,this._reconnectConfig=C(C({},F),i),this._reconnectDelay=this._reconnectConfig.delay,this._subscriptions=new Set,this._wrapper=a}return p(e,[{key:"getRealtimeTransport",value:function(){return this._realtimeTransport}},{key:"getWrapper",value:function(){return this._wrapper}},{key:"subscribe",value:function(e){var t=this,r=e.callbacks,n=e.isPrivate,o=void 0!==n&&n,i=e.subscriptionData,a=this.getRealtimeTransport(),c={callbacks:r,isPrivate:o,subscriptionData:i,isSubscribed:!1};switch(this._subscriptions.add(c),this._connectionState){case I.Disconnected:this._connect();break;case I.Connected:this._subscribe(c)}return function(){if(c.isSubscribed&&a.unsubscribe({subscriptionData:i}),t._subscriptions["delete"](c),t._subscriptions.size<1){if([I.Disconnected,I.Disconnecting].includes(t._connectionState))return;t._disconnect()}}}},{key:"_connect",value:function(){var e=this;this._connectionState=I.Connecting,this.getRealtimeTransport().connect({onConnect:function(){return e._handleConnect()},onDisconnect:function(t){return e._handleDisconnect(t)},wrapper:this.getWrapper()})}},{key:"_disconnect",value:function(){this._connectionState=I.Disconnecting,this.getRealtimeTransport().disconnect()}},{key:"_handleConnect",value:function(){this._reconnectDelay=this._reconnectConfig.delay,this._connectionState=I.Connected;var e,t=S(this._subscriptions);try{for(t.s();!(e=t.n()).done;){var r=e.value;r.isSubscribed||this._subscribe(r)}}catch(n){t.e(n)}finally{t.f()}}},{key:"_handleDisconnect",value:function(e){var t=this,r=this._connectionState===I.Disconnecting;this._connectionState=I.Disconnected,e?this._onError(e):this._subscriptions.size<1||(r?this._connect():(this._reconnectDelay<this._reconnectConfig.maxDelay&&(this._reconnectDelay*=this._reconnectConfig.delayFactor),setTimeout((function(){return t._connect()}),this._reconnectDelay)))}},{key:"_subscribe",value:function(e){var t=e.callbacks,r=e.isPrivate,n=e.subscriptionData;this.getRealtimeTransport().subscribe({callbacks:t,isPrivate:r,subscriptionData:n,onSubscribe:function(){e.isSubscribed=!0},onUnsubscribe:function(){e.isSubscribed=!1}})}}]),e}();function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g(e);if(t){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}var U=new Map,G=function(e){d(g,e);var t,r,n,i,c,l,f,y,m=q(g);function g(e){var t,r=e.authenticator,n=e.realtimeTransport,i=e.reconnectConfig,c=void 0===i?{}:i,s=e.transport;if(u(this,g),!r)throw o(k,a(k.createParameterNotProvidedErrorArgs("authenticator","ApiWrapper","constructor")));if(!n)throw o(k,a(k.createParameterNotProvidedErrorArgs("realtimeTransport","ApiWrapper","constructor")));if(!s)throw o(k,a(k.createParameterNotProvidedErrorArgs("transport","ApiWrapper","constructor")));return(t=m.call(this))._authenticator=r,t._realtimeTransportWrapper=new W({realtimeTransport:n,reconnectConfig:c,onError:t._handleRealtimeTransportWrapperError,wrapper:v(t)}),t._transport=s,t}return p(g,[{key:"authenticate",value:(y=s(h().mark((function b(){var e,t,r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=this.getAuthenticator(),n.prev=1,n.next=4,this._getAuthenticationPromise();case 4:return t=n.sent,n.next=7,e.saveAuthenticationData(t);case 7:return n.abrupt("return",t);case 10:if(n.prev=10,n.t0=n["catch"](1),!this.getTransport().isAuthenticationFailedError(n.t0)){n.next=16;break}throw r=o(k,a(k.createAuthenticationFailedErrorArgs(n.t0,"ApiWrapper","authenticate"))),this.emit("error",r),r;case 16:throw this.emit("error",n.t0),n.t0;case 18:case"end":return n.stop()}}),b,this,[[1,10]])}))),function(){return y.apply(this,arguments)})},{key:"callMethod",value:(f=s(h().mark((function w(e){var t,r,n=arguments;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t=n.length>1&&n[1]!==undefined?n[1]:null,r=n.length>2&&n[2]!==undefined&&n[2],o.next=4,this._callMethod({isPrivate:r,methodData:e,requestData:t});case 4:return o.abrupt("return",o.sent);case 5:case"end":return o.stop()}}),w,this)}))),function(e){return f.apply(this,arguments)})},{key:"create",value:(l=s(h().mark((function _(){var e,t,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=r.length>0&&r[0]!==undefined?r[0]:null,t=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:t,requestData:e,methodData:this.getTransport().getCreateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),_,this)}))),function(){return l.apply(this,arguments)})},{key:"delete",value:(c=s(h().mark((function x(){var e,t,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=r.length>0&&r[0]!==undefined?r[0]:null,t=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:t,requestData:e,methodData:this.getTransport().getDeleteMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),x,this)}))),function(){return c.apply(this,arguments)})},{key:"getAuthenticationData",value:(i=s(h().mark((function A(){var e,t;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=this.getAuthenticator(),r.next=3,e.loadAuthenticationData();case 3:if(t=r.sent){r.next=8;break}return r.next=7,this.authenticate();case 7:t=r.sent;case 8:return r.abrupt("return",t);case 9:case"end":return r.stop()}}),A,this)}))),function(){return i.apply(this,arguments)})},{key:"getAuthenticator",value:function(){return this._authenticator}},{key:"getRealtimeTransportWrapper",value:function(){return this._realtimeTransportWrapper}},{key:"getTransport",value:function(){return this._transport}},{key:"read",value:(n=s(h().mark((function E(){var e,t,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=r.length>0&&r[0]!==undefined?r[0]:null,t=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:t,requestData:e,methodData:this.getTransport().getReadMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),E,this)}))),function(){return n.apply(this,arguments)})},{key:"subscribe",value:function(e,t){var r=arguments.length>2&&arguments[2]!==undefined&&arguments[2];return this.getRealtimeTransportWrapper().subscribe({callbacks:t,isPrivate:r,subscriptionData:e})}},{key:"update",value:(r=s(h().mark((function D(){var e,t,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=r.length>0&&r[0]!==undefined?r[0]:null,t=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:t,requestData:e,methodData:this.getTransport().getUpdateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),D,this)}))),function(){return r.apply(this,arguments)})},{key:"_callMethod",value:(t=s(h().mark((function O(){var e,t,r,n,o,i,a,c,s,u,l=arguments;return h().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(e=l.length>0&&l[0]!==undefined?l[0]:{},t=e.isPrivate,r=void 0!==t&&t,n=e.isRetry,o=void 0!==n&&n,i=e.methodData,a=e.requestData,c=void 0===a?null:a,s=this.getTransport(),!r){p.next=8;break}return p.next=5,this.getAuthenticationData();case 5:p.t0=p.sent,p.next=9;break;case 8:p.t0=null;case 9:return u=p.t0,p.prev=10,p.next=13,s.callMethod({authenticationData:u,methodData:i,requestData:c,wrapper:this});case 13:return p.abrupt("return",p.sent);case 16:if(p.prev=16,p.t1=p["catch"](10),o||!s.isSessionExpiredError(p.t1)){p.next=24;break}return p.next=21,this.authenticate();case 21:return p.next=23,this._callMethod({isPrivate:r,methodData:i,requestData:c,isRetry:!0});case 23:return p.abrupt("return",p.sent);case 24:throw this.emit("error",p.t1),p.t1;case 26:case"end":return p.stop()}}),O,this,[[10,16]])}))),function(){return t.apply(this,arguments)})},{key:"_getAuthenticationPromise",value:function(){var e=this,t=this.getAuthenticator(),r=U.get(t);return r||(r=s(h().mark((function n(){var r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.loadAuthenticationData();case 2:return r=n.sent,n.next=5,t.authenticate(e,r);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))(),U.set(t,r),s(h().mark((function o(){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r;case 3:e.next=7;break;case 5:e.prev=5,e.t0=e["catch"](0);case 7:return e.prev=7,U["delete"](t),e.finish(7);case 10:case"end":return e.stop()}}),o,null,[[0,5,7,10]])})))(),r)}},{key:"_handleRealtimeTransportWrapperError",value:function(e){this.emit("error",o(k,a(k.createRealtimeTransportErrorArgs(e,"ApiWrapper","_handleRealtimeTransportWrapperEvent"))))}}]),g}(j())})(),n})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apiWrapper=t():e.apiWrapper=t()}(self,(()=>(()=>{var e={591:(e,t,r)=>{var n=r(8)["default"];function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports["default"]=e.exports;var t={},r=Object.prototype,i=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(L){l=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=A(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=f(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,a),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(L){return{type:"throw",arg:L}}}t.wrap=p;var h={};function d(){}function y(){}function v(){}var m={};l(m,c,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(O([])));b&&b!==r&&i.call(b,c)&&(m=b);var w=v.prototype=d.prototype=Object.create(m);function _(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(o,a,c,s){var u=f(e[o],e,a);if("throw"!==u.type){var l=u.arg,p=l.value;return p&&"object"==n(p)&&i.call(p,"__await")?t.resolve(p.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(p).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function A(e,t){var r=e.iterator[t.method];if(undefined===r){if(t.delegate=null,"throw"===t.method){if(e.iterator["return"]&&(t.method="return",t.arg=undefined,A(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=undefined),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function O(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(i.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=undefined,t.done=!0,t};return n.next=n}}return{next:T}}function T(){return{value:undefined,done:!0}}return y.prototype=v,l(w,"constructor",v),l(v,"constructor",y),y.displayName=l(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,l(e,u,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},_(x.prototype),l(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(p(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},_(w),l(w,u,"Generator"),l(w,c,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(D),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=undefined)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=undefined),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),s=i.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),D(r),h}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;D(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:O(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=undefined),h}},t}e.exports=o,e.exports.__esModule=!0,e.exports["default"]=e.exports},8:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports["default"]=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports["default"]=e.exports},757:(e,t,r)=>{var n=r(591)();e.exports=n;try{regeneratorRuntime=n}catch(o){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}y(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,r)}(e,o,{once:!0})}))},i.EventEmitter=i,i.prototype._events=undefined,i.prototype._eventsCount=0,i.prototype._maxListeners=undefined;var a=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return e._maxListeners===undefined?i.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var o,i,a,u;if(c(r),(i=e._events)===undefined?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==undefined&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),a===undefined)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=s(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:undefined,target:e,type:t,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function f(e,t,r){var n=e._events;if(n===undefined)return[];var o=n[t];return o===undefined?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):d(o,o.length)}function h(e){var t=this._events;if(t!==undefined){var r=t[e];if("function"==typeof r)return 1;if(r!==undefined)return r.length}return 0}function d(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){this._events!==undefined&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||undefined},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(i!==undefined)o=o&&i.error===undefined;else if(!o)return!1;if(o){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var c=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw c.context=a,c}var s=i[e];if(s===undefined)return!1;if("function"==typeof s)n(s,this,t);else{var u=s.length,l=d(s,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,o,i,a;if(c(t),(n=this._events)===undefined)return this;if((r=n[e])===undefined)return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),n.removeListener!==undefined&&this.emit("removeListener",e,a||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if((r=this._events)===undefined)return this;if(r.removeListener===undefined)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):r[e]!==undefined&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t!==undefined)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}}},t={};function r(n){var o=t[n];if(o!==undefined)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e["default"]:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function e(t,r){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e(t,r)}function t(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function o(r,n,i){return o=t()?Reflect.construct.bind():function(t,r,n){var o=[null];o.push.apply(o,r);var i=new(Function.bind.apply(t,o));return n&&e(i,n.prototype),i},o.apply(null,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function a(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t,r,n,o,i,a){try{var c=e[i](a),s=c.value}catch(u){return void r(u)}c.done?t(s):Promise.resolve(s).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){c(i,n,o,a,s,"next",e)}function s(e){c(i,n,o,a,s,"throw",e)}a(undefined)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}r.r(n),r.d(n,{ApiAuthenticator:()=>O,ApiError:()=>k,ApiRealtimeTransport:()=>T,ApiTransport:()=>L,ApiWrapper:()=>G});var f=r(757),h=r.n(f);function d(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&e(t,r)}function y(e){return y="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},y(e)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e,t){if(t&&("object"===y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function b(t){var r="function"==typeof Map?new Map:undefined;return b=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,i)}function i(){return o(t,arguments,g(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),e(i,t)},b(t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g(e);if(t){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}var _="api_wrapper/authentication_failed",x="api_wrapper/method_not_implemented",A="api_wrapper/parameter_not_provided",E="api_wrapper/realtime_transport",D="api_wrapper/unexpected",k=function(e){d(r,e);var t=w(r);function r(){var e,n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:D,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:n,i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return u(this,r),(e=t.call(this,o)).code=n,e.data=i,e}return p(r,null,[{key:"createAuthenticationFailedErrorArgs",value:function(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[_,"[".concat(t,".").concat(r).concat(n?"::".concat(n):"","] Authentication failed"),{className:t,methodName:r,originalError:e,place:n}]}},{key:"createMethodNotImplementedErrorArgs",value:function(e,t){return[x,"[".concat(e,".").concat(t,"] Method not implemented: ").concat(t),{className:e,methodName:t}]}},{key:"createParameterNotProvidedErrorArgs",value:function(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[A,"[".concat(t,".").concat(r).concat(n?"::".concat(n):"","] Parameter not provided: ").concat(e),{className:t,methodName:r,parameterName:e,place:n}]}},{key:"createRealtimeTransportErrorArgs",value:function(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[E,"[".concat(t,".").concat(r).concat(n?"::".concat(n):"","] Realtime transport error: ").concat(e.message),{className:t,methodName:r,originalError:e,place:n}]}}]),r}(b(Error)),O=function(){function e(){u(this,e)}var t,r,n;return p(e,[{key:"authenticate",value:(n=s(h().mark((function i(e,t){return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw console.log("[ApiAuthenticator.authenticate]","wrapper:",e),console.log("[ApiAuthenticator.authenticate]","previousAuthenticationData:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","authenticate")));case 3:case"end":return r.stop()}}),i)}))),function(e,t){return n.apply(this,arguments)})},{key:"loadAuthenticationData",value:(r=s(h().mark((function c(){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","loadAuthenticationData")));case 1:case"end":return e.stop()}}),c)}))),function(){return r.apply(this,arguments)})},{key:"saveAuthenticationData",value:(t=s(h().mark((function l(e){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw console.log("[ApiAuthenticator.saveAuthenticationData]","authenticationData:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","saveAuthenticationData")));case 2:case"end":return t.stop()}}),l)}))),function(e){return t.apply(this,arguments)})}]),e}(),T=function(){function e(){u(this,e)}return p(e,[{key:"connect",value:function(e){var t=e.onConnect,r=e.onDisconnect,n=e.wrapper;throw console.log("[ApiRealtimeTransport.connect]","onConnect:",t),console.log("[ApiRealtimeTransport.connect]","onDisconnect:",r),console.log("[ApiRealtimeTransport.connect]","wrapper:",n),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","connect")))}},{key:"disconnect",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","disconnect")))}},{key:"subscribe",value:function(e){var t=e.callbacks,r=e.isPrivate,n=e.onSubscribe,i=e.onUnsubscribe,c=e.subscriptionData;throw console.log("[ApiRealtimeTransport.subscribe]","callbacks:",t),console.log("[ApiRealtimeTransport.subscribe]","isPrivate:",r),console.log("[ApiRealtimeTransport.subscribe]","onSubscribe:",n),console.log("[ApiRealtimeTransport.subscribe]","onUnsubscribe:",i),console.log("[ApiRealtimeTransport.subscribe]","subscriptionData:",c),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","subscribe")))}},{key:"unsubscribe",value:function(e){var t=e.subscriptionData;throw console.log("[ApiRealtimeTransport.unsubscribe]","subscriptionData:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","unsubscribe")))}}]),e}(),L=function(){function e(){u(this,e)}var t;return p(e,[{key:"callMethod",value:(t=s(h().mark((function r(e){var t,n,i,c;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw t=e.authenticationData,n=e.methodData,i=e.requestData,c=e.wrapper,console.log("[ApiTransport.callMethod]","authenticationData:",t),console.log("[ApiTransport.callMethod]","methodData:",n),console.log("[ApiTransport.callMethod]","requestData:",i),console.log("[ApiTransport.callMethod]","wrapper:",c),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","callMethod")));case 6:case"end":return r.stop()}}),r)}))),function(e){return t.apply(this,arguments)})},{key:"getCreateMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getCreateMethodData")))}},{key:"getDeleteMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getDeleteMethodData")))}},{key:"getReadMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getReadMethodData")))}},{key:"getUpdateMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getUpdateMethodData")))}},{key:"isAuthenticationFailedError",value:function(e){throw console.log("[ApiTransport.isAuthenticationFailedError]","error:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","isAuthenticationFailedError")))}},{key:"isSessionExpiredError",value:function(e){throw console.log("[ApiTransport.isSessionExpiredError]","error:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","isSessionExpiredError")))}}]),e}(),P=r(187),j=r.n(P);function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r["return"]||r["return"]()}finally{if(c)throw i}}}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){M(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var I={Connected:"connected",Connecting:"connecting",Disconnected:"disconnected",Disconnecting:"disconnecting"},F={delay:1e3,delayFactor:2,maxDelay:32e3},W=function(){function e(t){var r=t.onError,n=t.realtimeTransport,o=t.reconnectConfig,i=void 0===o?{}:o,a=t.wrapper;u(this,e),this._connectionState=I.Disconnected,this._onError=r,this._realtimeTransport=n,this._reconnectConfig=C(C({},F),i),this._reconnectDelay=this._reconnectConfig.delay,this._subscriptions=new Set,this._wrapper=a}return p(e,[{key:"getRealtimeTransport",value:function(){return this._realtimeTransport}},{key:"getWrapper",value:function(){return this._wrapper}},{key:"subscribe",value:function(e){var t=this,r=e.callbacks,n=e.isPrivate,o=void 0!==n&&n,i=e.subscriptionData,a=this.getRealtimeTransport(),c={callbacks:r,isPrivate:o,subscriptionData:i,isSubscribed:!1};switch(this._subscriptions.add(c),this._connectionState){case I.Disconnected:this._connect();break;case I.Connected:this._subscribe(c)}return function(){if(c.isSubscribed&&a.unsubscribe({subscriptionData:i}),t._subscriptions["delete"](c),t._subscriptions.size<1){if([I.Disconnected,I.Disconnecting].includes(t._connectionState))return;t._disconnect()}}}},{key:"_connect",value:function(){var e=this;this._connectionState=I.Connecting,this.getRealtimeTransport().connect({onConnect:function(){return e._handleConnect()},onDisconnect:function(t){return e._handleDisconnect(t)},wrapper:this.getWrapper()})}},{key:"_disconnect",value:function(){this._connectionState=I.Disconnecting,this.getRealtimeTransport().disconnect()}},{key:"_handleConnect",value:function(){this._reconnectDelay=this._reconnectConfig.delay,this._connectionState=I.Connected;var e,t=S(this._subscriptions);try{for(t.s();!(e=t.n()).done;){var r=e.value;r.isSubscribed||this._subscribe(r)}}catch(n){t.e(n)}finally{t.f()}}},{key:"_handleDisconnect",value:function(e){var t=this,r=this._connectionState===I.Disconnecting;this._connectionState=I.Disconnected,e?this._onError(e):this._subscriptions.size<1||(r?this._connect():(this._reconnectDelay<this._reconnectConfig.maxDelay&&(this._reconnectDelay*=this._reconnectConfig.delayFactor),setTimeout((function(){return t._connect()}),this._reconnectDelay)))}},{key:"_subscribe",value:function(e){var t=e.callbacks,r=e.isPrivate,n=e.subscriptionData;this.getRealtimeTransport().subscribe({callbacks:t,isPrivate:r,subscriptionData:n,onSubscribe:function(){e.isSubscribed=!0},onUnsubscribe:function(){e.isSubscribed=!1}})}}]),e}();function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g(e);if(t){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}var U=new Map,G=function(e){d(g,e);var t,r,n,i,c,l,f,y,m=q(g);function g(e){var t,r=e.authenticator,n=e.realtimeTransport,i=e.reconnectConfig,c=void 0===i?{}:i,s=e.transport;if(u(this,g),!r)throw o(k,a(k.createParameterNotProvidedErrorArgs("authenticator","ApiWrapper","constructor")));if(!n)throw o(k,a(k.createParameterNotProvidedErrorArgs("realtimeTransport","ApiWrapper","constructor")));if(!s)throw o(k,a(k.createParameterNotProvidedErrorArgs("transport","ApiWrapper","constructor")));return(t=m.call(this))._authenticator=r,t._realtimeTransportWrapper=new W({realtimeTransport:n,reconnectConfig:c,onError:t._handleRealtimeTransportWrapperError.bind(v(t)),wrapper:v(t)}),t._transport=s,t}return p(g,[{key:"authenticate",value:(y=s(h().mark((function b(){var e,t,r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=this.getAuthenticator(),n.prev=1,n.next=4,this._getAuthenticationPromise();case 4:return t=n.sent,n.next=7,e.saveAuthenticationData(t);case 7:return n.abrupt("return",t);case 10:if(n.prev=10,n.t0=n["catch"](1),!this.getTransport().isAuthenticationFailedError(n.t0)){n.next=16;break}throw r=o(k,a(k.createAuthenticationFailedErrorArgs(n.t0,"ApiWrapper","authenticate"))),this.emit("error",r),r;case 16:throw this.emit("error",n.t0),n.t0;case 18:case"end":return n.stop()}}),b,this,[[1,10]])}))),function(){return y.apply(this,arguments)})},{key:"callMethod",value:(f=s(h().mark((function w(e){var t,r,n=arguments;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t=n.length>1&&n[1]!==undefined?n[1]:null,r=n.length>2&&n[2]!==undefined&&n[2],o.next=4,this._callMethod({isPrivate:r,methodData:e,requestData:t});case 4:return o.abrupt("return",o.sent);case 5:case"end":return o.stop()}}),w,this)}))),function(e){return f.apply(this,arguments)})},{key:"create",value:(l=s(h().mark((function _(){var e,t,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=r.length>0&&r[0]!==undefined?r[0]:null,t=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:t,requestData:e,methodData:this.getTransport().getCreateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),_,this)}))),function(){return l.apply(this,arguments)})},{key:"delete",value:(c=s(h().mark((function x(){var e,t,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=r.length>0&&r[0]!==undefined?r[0]:null,t=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:t,requestData:e,methodData:this.getTransport().getDeleteMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),x,this)}))),function(){return c.apply(this,arguments)})},{key:"getAuthenticationData",value:(i=s(h().mark((function A(){var e,t;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=this.getAuthenticator(),r.next=3,e.loadAuthenticationData();case 3:if(t=r.sent){r.next=8;break}return r.next=7,this.authenticate();case 7:t=r.sent;case 8:return r.abrupt("return",t);case 9:case"end":return r.stop()}}),A,this)}))),function(){return i.apply(this,arguments)})},{key:"getAuthenticator",value:function(){return this._authenticator}},{key:"getRealtimeTransportWrapper",value:function(){return this._realtimeTransportWrapper}},{key:"getTransport",value:function(){return this._transport}},{key:"read",value:(n=s(h().mark((function E(){var e,t,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=r.length>0&&r[0]!==undefined?r[0]:null,t=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:t,requestData:e,methodData:this.getTransport().getReadMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),E,this)}))),function(){return n.apply(this,arguments)})},{key:"subscribe",value:function(e,t){var r=arguments.length>2&&arguments[2]!==undefined&&arguments[2];return this.getRealtimeTransportWrapper().subscribe({callbacks:t,isPrivate:r,subscriptionData:e})}},{key:"update",value:(r=s(h().mark((function D(){var e,t,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=r.length>0&&r[0]!==undefined?r[0]:null,t=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:t,requestData:e,methodData:this.getTransport().getUpdateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),D,this)}))),function(){return r.apply(this,arguments)})},{key:"_callMethod",value:(t=s(h().mark((function O(){var e,t,r,n,o,i,a,c,s,u,l=arguments;return h().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(e=l.length>0&&l[0]!==undefined?l[0]:{},t=e.isPrivate,r=void 0!==t&&t,n=e.isRetry,o=void 0!==n&&n,i=e.methodData,a=e.requestData,c=void 0===a?null:a,s=this.getTransport(),!r){p.next=8;break}return p.next=5,this.getAuthenticationData();case 5:p.t0=p.sent,p.next=9;break;case 8:p.t0=null;case 9:return u=p.t0,p.prev=10,p.next=13,s.callMethod({authenticationData:u,methodData:i,requestData:c,wrapper:this});case 13:return p.abrupt("return",p.sent);case 16:if(p.prev=16,p.t1=p["catch"](10),o||!s.isSessionExpiredError(p.t1)){p.next=24;break}return p.next=21,this.authenticate();case 21:return p.next=23,this._callMethod({isPrivate:r,methodData:i,requestData:c,isRetry:!0});case 23:return p.abrupt("return",p.sent);case 24:throw this.emit("error",p.t1),p.t1;case 26:case"end":return p.stop()}}),O,this,[[10,16]])}))),function(){return t.apply(this,arguments)})},{key:"_getAuthenticationPromise",value:function(){var e=this,t=this.getAuthenticator(),r=U.get(t);return r||(r=s(h().mark((function n(){var r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.loadAuthenticationData();case 2:return r=n.sent,n.next=5,t.authenticate(e,r);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))(),U.set(t,r),s(h().mark((function o(){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r;case 3:e.next=7;break;case 5:e.prev=5,e.t0=e["catch"](0);case 7:return e.prev=7,U["delete"](t),e.finish(7);case 10:case"end":return e.stop()}}),o,null,[[0,5,7,10]])})))(),r)}},{key:"_handleRealtimeTransportWrapperError",value:function(e){this.emit("error",o(k,a(k.createRealtimeTransportErrorArgs(e,"ApiWrapper","_handleRealtimeTransportWrapperEvent"))))}}]),g}(j())})(),n})()));
//# sourceMappingURL=index.browser.js.map
/*! For license information please see index.node.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apiWrapper=e():t.apiWrapper=e()}(global,(()=>(()=>{var t={228:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports["default"]=t.exports},646:(t,e,r)=>{var n=r(228);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},506:t=>{t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports["default"]=t.exports},926:t=>{function e(t,e,r,n,o,a,i){try{var c=t[a](i),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function c(t){e(i,o,a,c,s,"next",t)}function s(t){e(i,o,a,c,s,"throw",t)}c(undefined)}))}},t.exports.__esModule=!0,t.exports["default"]=t.exports},575:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports["default"]=t.exports},100:(t,e,r)=>{var n=r(489),o=r(67);function a(e,r,i){return o()?(t.exports=a=Reflect.construct.bind(),t.exports.__esModule=!0,t.exports["default"]=t.exports):(t.exports=a=function(t,e,r){var o=[null];o.push.apply(o,e);var a=new(Function.bind.apply(t,o));return r&&n(a,r.prototype),a},t.exports.__esModule=!0,t.exports["default"]=t.exports),a.apply(null,arguments)}t.exports=a,t.exports.__esModule=!0,t.exports["default"]=t.exports},913:t=>{function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports["default"]=t.exports},713:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports["default"]=t.exports},754:t=>{function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},205:(t,e,r)=>{var n=r(489);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)},t.exports.__esModule=!0,t.exports["default"]=t.exports},430:t=>{t.exports=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},t.exports.__esModule=!0,t.exports["default"]=t.exports},67:t=>{t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports["default"]=t.exports},860:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},206:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports["default"]=t.exports},585:(t,e,r)=>{var n=r(8)["default"],o=r(506);t.exports=function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},591:(t,e,r)=>{var n=r(8)["default"];function o(){"use strict";t.exports=o=function(){return e},t.exports.__esModule=!0,t.exports["default"]=t.exports;var e={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(O){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),i=new k(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return T()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=A(i,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=f(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,i),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var h={};function d(){}function y(){}function v(){}var m={};p(m,c,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(E([])));b&&b!==r&&a.call(b,c)&&(m=b);var x=v.prototype=d.prototype=Object.create(m);function _(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function r(o,i,c,s){var u=f(t[o],t,i);if("throw"!==u.type){var p=u.arg,l=p.value;return l&&"object"==n(l)&&a.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,c,s)}),(function(t){r("throw",t,c,s)})):e.resolve(l).then((function(t){p.value=t,c(p)}),(function(t){return r("throw",t,c,s)}))}s(u.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function A(t,e){var r=t.iterator[e.method];if(undefined===r){if(e.delegate=null,"throw"===e.method){if(t.iterator["return"]&&(e.method="return",e.arg=undefined,A(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=undefined),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function E(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(a.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=undefined,e.done=!0,e};return n.next=n}}return{next:T}}function T(){return{value:undefined,done:!0}}return y.prototype=v,p(x,"constructor",v),p(v,"constructor",y),y.displayName=p(v,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,p(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},_(w.prototype),p(w.prototype,s,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},_(x),p(x,u,"Generator"),p(x,c,(function(){return this})),p(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=undefined)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=undefined),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),M(r),h}},"catch":function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;M(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=undefined),h}},e}t.exports=o,t.exports.__esModule=!0,t.exports["default"]=t.exports},489:t=>{function e(r,n){return t.exports=e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r,n)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},319:(t,e,r)=>{var n=r(646),o=r(860),a=r(379),i=r(206);t.exports=function(t){return n(t)||o(t)||a(t)||i()},t.exports.__esModule=!0,t.exports["default"]=t.exports},8:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},379:(t,e,r)=>{var n=r(228);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports["default"]=t.exports},957:(t,e,r)=>{var n=r(754),o=r(489),a=r(430),i=r(100);function c(e){var r="function"==typeof Map?new Map:undefined;return t.exports=c=function(t){if(null===t||!a(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return i(t,arguments,n(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)},t.exports.__esModule=!0,t.exports["default"]=t.exports,c(e)}t.exports=c,t.exports.__esModule=!0,t.exports["default"]=t.exports},757:(t,e,r)=>{var n=r(591)();t.exports=n;try{regeneratorRuntime=n}catch(o){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var o=e[n];if(o!==undefined)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{ApiAuthenticator:()=>T,ApiError:()=>E,ApiRealtimeTransport:()=>O,ApiTransport:()=>P,ApiWrapper:()=>$});var t=r(100),e=r.n(t),o=r(319),a=r.n(o),i=r(926),c=r.n(i),s=r(575),u=r.n(s),p=r(913),l=r.n(p),f=r(757),h=r.n(f),d=r(205),y=r.n(d),v=r(585),m=r.n(v),g=r(754),b=r.n(g),x=r(957);function _(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b()(t);if(e){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var w="api_wrapper/authentication_failed",A="api_wrapper/method_not_implemented",D="api_wrapper/parameter_not_provided",M="api_wrapper/realtime_transport",k="api_wrapper/unexpected",E=function(t){y()(r,t);var e=_(r);function r(){var t,n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:k,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:n,a=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return u()(this,r),(t=e.call(this,o)).code=n,t.data=a,t}return l()(r,null,[{key:"createAuthenticationFailedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[w,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Authentication failed"),{className:e,methodName:r,originalError:t,place:n}]}},{key:"createMethodNotImplementedErrorArgs",value:function(t,e){return[A,"[".concat(t,".").concat(e,"] Method not implemented: ").concat(e),{className:t,methodName:e}]}},{key:"createParameterNotProvidedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[D,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Parameter not provided: ").concat(t),{className:e,methodName:r,parameterName:t,place:n}]}},{key:"createRealtimeTransportErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[M,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Realtime transport error: ").concat(t.message),{className:e,methodName:r,originalError:t,place:n}]}}]),r}(r.n(x)()(Error)),T=function(){function t(){u()(this,t)}var r,n,o;return l()(t,[{key:"authenticate",value:(o=c()(h().mark((function i(t,r){return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:throw console.log("[ApiAuthenticator.authenticate]","wrapper:",t),console.log("[ApiAuthenticator.authenticate]","previousAuthenticationData:",r),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiAuthenticator","authenticate")));case 3:case"end":return n.stop()}}),i)}))),function(t,e){return o.apply(this,arguments)})},{key:"loadAuthenticationData",value:(n=c()(h().mark((function s(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiAuthenticator","loadAuthenticationData")));case 1:case"end":return t.stop()}}),s)}))),function(){return n.apply(this,arguments)})},{key:"saveAuthenticationData",value:(r=c()(h().mark((function p(t){return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw console.log("[ApiAuthenticator.saveAuthenticationData]","authenticationData:",t),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiAuthenticator","saveAuthenticationData")));case 2:case"end":return r.stop()}}),p)}))),function(t){return r.apply(this,arguments)})}]),t}(),O=function(){function t(){u()(this,t)}return l()(t,[{key:"connect",value:function(t){var r=t.onConnect,n=t.onDisconnect,o=t.wrapper;throw console.log("[ApiRealtimeTransport.connect]","onConnect:",r),console.log("[ApiRealtimeTransport.connect]","onDisconnect:",n),console.log("[ApiRealtimeTransport.connect]","wrapper:",o),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","connect")))}},{key:"disconnect",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","disconnect")))}},{key:"subscribe",value:function(t){var r=t.callbacks,n=t.isPrivate,o=t.onSubscribe,i=t.onUnsubscribe,c=t.subscriptionData;throw console.log("[ApiRealtimeTransport.subscribe]","callbacks:",r),console.log("[ApiRealtimeTransport.subscribe]","isPrivate:",n),console.log("[ApiRealtimeTransport.subscribe]","onSubscribe:",o),console.log("[ApiRealtimeTransport.subscribe]","onUnsubscribe:",i),console.log("[ApiRealtimeTransport.subscribe]","subscriptionData:",c),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","subscribe")))}},{key:"unsubscribe",value:function(t){var r=t.subscriptionData;throw console.log("[ApiRealtimeTransport.unsubscribe]","subscriptionData:",r),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","unsubscribe")))}}]),t}(),P=function(){function t(){u()(this,t)}var r;return l()(t,[{key:"callMethod",value:(r=c()(h().mark((function n(t){var r,o,i,c;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:throw r=t.authenticationData,o=t.methodData,i=t.requestData,c=t.wrapper,console.log("[ApiTransport.callMethod]","authenticationData:",r),console.log("[ApiTransport.callMethod]","methodData:",o),console.log("[ApiTransport.callMethod]","requestData:",i),console.log("[ApiTransport.callMethod]","wrapper:",c),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","callMethod")));case 6:case"end":return n.stop()}}),n)}))),function(t){return r.apply(this,arguments)})},{key:"getCreateMethodData",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","getCreateMethodData")))}},{key:"getDeleteMethodData",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","getDeleteMethodData")))}},{key:"getReadMethodData",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","getReadMethodData")))}},{key:"getUpdateMethodData",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","getUpdateMethodData")))}},{key:"isAuthenticationFailedError",value:function(t){throw console.log("[ApiTransport.isAuthenticationFailedError]","error:",t),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","isAuthenticationFailedError")))}},{key:"isSessionExpiredError",value:function(t){throw console.log("[ApiTransport.isSessionExpiredError]","error:",t),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","isSessionExpiredError")))}}]),t}(),S=r(506),R=r.n(S);const j=require("events");var N=r.n(j),L=r(713),C=r.n(L);function I(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return W(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){c=!0,a=t},f:function(){try{i||null==r["return"]||r["return"]()}finally{if(c)throw a}}}}function W(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function q(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach((function(e){C()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var G={Connected:"connected",Connecting:"connecting",Disconnected:"disconnected",Disconnecting:"disconnecting"},U={delay:1e3,delayFactor:2,maxDelay:32e3},B=function(){function t(e){var r=e.onError,n=e.realtimeTransport,o=e.reconnectConfig,a=void 0===o?{}:o,i=e.wrapper;u()(this,t),this._connectionState=G.Disconnected,this._onError=r,this._realtimeTransport=n,this._reconnectConfig=q(q({},U),a),this._reconnectDelay=this._reconnectConfig.delay,this._subscriptions=new Set,this._wrapper=i}return l()(t,[{key:"getRealtimeTransport",value:function(){return this._realtimeTransport}},{key:"getWrapper",value:function(){return this._wrapper}},{key:"subscribe",value:function(t){var e=this,r=t.callbacks,n=t.isPrivate,o=void 0!==n&&n,a=t.subscriptionData,i=this.getRealtimeTransport(),c={callbacks:r,isPrivate:o,subscriptionData:a,isSubscribed:!1};switch(this._subscriptions.add(c),this._connectionState){case G.Disconnected:this._connect();break;case G.Connected:this._subscribe(c)}return function(){if(c.isSubscribed&&i.unsubscribe({subscriptionData:a}),e._subscriptions["delete"](c),e._subscriptions.size<1){if([G.Disconnected,G.Disconnecting].includes(e._connectionState))return;e._disconnect()}}}},{key:"_connect",value:function(){var t=this;this._connectionState=G.Connecting,this.getRealtimeTransport().connect({onConnect:function(){return t._handleConnect()},onDisconnect:function(e){return t._handleDisconnect(e)},wrapper:this.getWrapper()})}},{key:"_disconnect",value:function(){this._connectionState=G.Disconnecting,this.getRealtimeTransport().disconnect()}},{key:"_handleConnect",value:function(){this._reconnectDelay=this._reconnectConfig.delay,this._connectionState=G.Connected;var t,e=I(this._subscriptions);try{for(e.s();!(t=e.n()).done;){var r=t.value;r.isSubscribed||this._subscribe(r)}}catch(n){e.e(n)}finally{e.f()}}},{key:"_handleDisconnect",value:function(t){var e=this,r=this._connectionState===G.Disconnecting;this._connectionState=G.Disconnected,t?this._onError(t):this._subscriptions.size<1||(r?this._connect():(this._reconnectDelay<this._reconnectConfig.maxDelay&&(this._reconnectDelay*=this._reconnectConfig.delayFactor),setTimeout((function(){return e._connect()}),this._reconnectDelay)))}},{key:"_subscribe",value:function(t){var e=t.callbacks,r=t.isPrivate,n=t.subscriptionData;this.getRealtimeTransport().subscribe({callbacks:e,isPrivate:r,subscriptionData:n,onSubscribe:function(){t.isSubscribed=!0},onUnsubscribe:function(){t.isSubscribed=!1}})}}]),t}();function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b()(t);if(e){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var Y=new Map,$=function(t){y()(m,t);var r,n,o,i,s,p,f,d,v=z(m);function m(t){var r,n=t.authenticator,o=t.realtimeTransport,i=t.reconnectConfig,c=void 0===i?{}:i,s=t.transport;if(u()(this,m),!n)throw e()(E,a()(E.createParameterNotProvidedErrorArgs("authenticator","ApiWrapper","constructor")));if(!o)throw e()(E,a()(E.createParameterNotProvidedErrorArgs("realtimeTransport","ApiWrapper","constructor")));if(!s)throw e()(E,a()(E.createParameterNotProvidedErrorArgs("transport","ApiWrapper","constructor")));return(r=v.call(this))._authenticator=n,r._realtimeTransportWrapper=new B({realtimeTransport:o,reconnectConfig:c,onError:r._handleRealtimeTransportWrapperError,wrapper:R()(r)}),r._transport=s,r}return l()(m,[{key:"authenticate",value:(d=c()(h().mark((function g(){var t,r,n;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t=this.getAuthenticator(),o.prev=1,o.next=4,this._getAuthenticationPromise();case 4:return r=o.sent,o.next=7,t.saveAuthenticationData(r);case 7:return o.abrupt("return",r);case 10:if(o.prev=10,o.t0=o["catch"](1),!this.getTransport().isAuthenticationFailedError(o.t0)){o.next=16;break}throw n=e()(E,a()(E.createAuthenticationFailedErrorArgs(o.t0,"ApiWrapper","authenticate"))),this.emit("error",n),n;case 16:throw this.emit("error",o.t0),o.t0;case 18:case"end":return o.stop()}}),g,this,[[1,10]])}))),function(){return d.apply(this,arguments)})},{key:"callMethod",value:(f=c()(h().mark((function b(t){var e,r,n=arguments;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return e=n.length>1&&n[1]!==undefined?n[1]:null,r=n.length>2&&n[2]!==undefined&&n[2],o.next=4,this._callMethod({isPrivate:r,methodData:t,requestData:e});case 4:return o.abrupt("return",o.sent);case 5:case"end":return o.stop()}}),b,this)}))),function(t){return f.apply(this,arguments)})},{key:"create",value:(p=c()(h().mark((function x(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getCreateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),x,this)}))),function(){return p.apply(this,arguments)})},{key:"delete",value:(s=c()(h().mark((function _(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getDeleteMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),_,this)}))),function(){return s.apply(this,arguments)})},{key:"getAuthenticationData",value:(i=c()(h().mark((function w(){var t,e;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=this.getAuthenticator(),r.next=3,t.loadAuthenticationData();case 3:if(e=r.sent){r.next=8;break}return r.next=7,this.authenticate();case 7:e=r.sent;case 8:return r.abrupt("return",e);case 9:case"end":return r.stop()}}),w,this)}))),function(){return i.apply(this,arguments)})},{key:"getAuthenticator",value:function(){return this._authenticator}},{key:"getRealtimeTransportWrapper",value:function(){return this._realtimeTransportWrapper}},{key:"getTransport",value:function(){return this._transport}},{key:"read",value:(o=c()(h().mark((function A(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getReadMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),A,this)}))),function(){return o.apply(this,arguments)})},{key:"subscribe",value:function(t,e){var r=arguments.length>2&&arguments[2]!==undefined&&arguments[2];return this.getRealtimeTransportWrapper().subscribe({callbacks:e,isPrivate:r,subscriptionData:t})}},{key:"update",value:(n=c()(h().mark((function D(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getUpdateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),D,this)}))),function(){return n.apply(this,arguments)})},{key:"_callMethod",value:(r=c()(h().mark((function M(){var t,e,r,n,o,a,i,c,s,u,p=arguments;return h().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(t=p.length>0&&p[0]!==undefined?p[0]:{},e=t.isPrivate,r=void 0!==e&&e,n=t.isRetry,o=void 0!==n&&n,a=t.methodData,i=t.requestData,c=void 0===i?null:i,s=this.getTransport(),!r){l.next=8;break}return l.next=5,this.getAuthenticationData();case 5:l.t0=l.sent,l.next=9;break;case 8:l.t0=null;case 9:return u=l.t0,l.prev=10,l.next=13,s.callMethod({authenticationData:u,methodData:a,requestData:c,wrapper:this});case 13:return l.abrupt("return",l.sent);case 16:if(l.prev=16,l.t1=l["catch"](10),o||!s.isSessionExpiredError(l.t1)){l.next=24;break}return l.next=21,this.authenticate();case 21:return l.next=23,this._callMethod({isPrivate:r,methodData:a,requestData:c,isRetry:!0});case 23:return l.abrupt("return",l.sent);case 24:throw this.emit("error",l.t1),l.t1;case 26:case"end":return l.stop()}}),M,this,[[10,16]])}))),function(){return r.apply(this,arguments)})},{key:"_getAuthenticationPromise",value:function(){var t=this,e=this.getAuthenticator(),r=Y.get(e);return r||(r=c()(h().mark((function n(){var r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.loadAuthenticationData();case 2:return r=n.sent,n.next=5,e.authenticate(t,r);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))(),Y.set(e,r),c()(h().mark((function o(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:t.next=7;break;case 5:t.prev=5,t.t0=t["catch"](0);case 7:return t.prev=7,Y["delete"](e),t.finish(7);case 10:case"end":return t.stop()}}),o,null,[[0,5,7,10]])})))(),r)}},{key:"_handleRealtimeTransportWrapperError",value:function(t){this.emit("error",e()(E,a()(E.createRealtimeTransportErrorArgs(t,"ApiWrapper","_handleRealtimeTransportWrapperEvent"))))}}]),m}(N())})(),n})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apiWrapper=e():t.apiWrapper=e()}(global,(()=>(()=>{var t={228:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports["default"]=t.exports},646:(t,e,r)=>{var n=r(228);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},506:t=>{t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports["default"]=t.exports},926:t=>{function e(t,e,r,n,o,a,i){try{var c=t[a](i),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function c(t){e(i,o,a,c,s,"next",t)}function s(t){e(i,o,a,c,s,"throw",t)}c(undefined)}))}},t.exports.__esModule=!0,t.exports["default"]=t.exports},575:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports["default"]=t.exports},100:(t,e,r)=>{var n=r(489),o=r(67);function a(e,r,i){return o()?(t.exports=a=Reflect.construct.bind(),t.exports.__esModule=!0,t.exports["default"]=t.exports):(t.exports=a=function(t,e,r){var o=[null];o.push.apply(o,e);var a=new(Function.bind.apply(t,o));return r&&n(a,r.prototype),a},t.exports.__esModule=!0,t.exports["default"]=t.exports),a.apply(null,arguments)}t.exports=a,t.exports.__esModule=!0,t.exports["default"]=t.exports},913:t=>{function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports["default"]=t.exports},713:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports["default"]=t.exports},754:t=>{function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},205:(t,e,r)=>{var n=r(489);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)},t.exports.__esModule=!0,t.exports["default"]=t.exports},430:t=>{t.exports=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},t.exports.__esModule=!0,t.exports["default"]=t.exports},67:t=>{t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports["default"]=t.exports},860:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},206:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports["default"]=t.exports},585:(t,e,r)=>{var n=r(8)["default"],o=r(506);t.exports=function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},591:(t,e,r)=>{var n=r(8)["default"];function o(){"use strict";t.exports=o=function(){return e},t.exports.__esModule=!0,t.exports["default"]=t.exports;var e={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(O){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),i=new k(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return T()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=A(i,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=f(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,i),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var h={};function d(){}function y(){}function v(){}var m={};p(m,c,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(E([])));b&&b!==r&&a.call(b,c)&&(m=b);var x=v.prototype=d.prototype=Object.create(m);function _(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function r(o,i,c,s){var u=f(t[o],t,i);if("throw"!==u.type){var p=u.arg,l=p.value;return l&&"object"==n(l)&&a.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,c,s)}),(function(t){r("throw",t,c,s)})):e.resolve(l).then((function(t){p.value=t,c(p)}),(function(t){return r("throw",t,c,s)}))}s(u.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function A(t,e){var r=t.iterator[e.method];if(undefined===r){if(e.delegate=null,"throw"===e.method){if(t.iterator["return"]&&(e.method="return",e.arg=undefined,A(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=undefined),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function E(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(a.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=undefined,e.done=!0,e};return n.next=n}}return{next:T}}function T(){return{value:undefined,done:!0}}return y.prototype=v,p(x,"constructor",v),p(v,"constructor",y),y.displayName=p(v,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,p(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},_(w.prototype),p(w.prototype,s,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},_(x),p(x,u,"Generator"),p(x,c,(function(){return this})),p(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=undefined)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=undefined),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),M(r),h}},"catch":function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;M(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=undefined),h}},e}t.exports=o,t.exports.__esModule=!0,t.exports["default"]=t.exports},489:t=>{function e(r,n){return t.exports=e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r,n)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},319:(t,e,r)=>{var n=r(646),o=r(860),a=r(379),i=r(206);t.exports=function(t){return n(t)||o(t)||a(t)||i()},t.exports.__esModule=!0,t.exports["default"]=t.exports},8:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},379:(t,e,r)=>{var n=r(228);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports["default"]=t.exports},957:(t,e,r)=>{var n=r(754),o=r(489),a=r(430),i=r(100);function c(e){var r="function"==typeof Map?new Map:undefined;return t.exports=c=function(t){if(null===t||!a(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return i(t,arguments,n(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)},t.exports.__esModule=!0,t.exports["default"]=t.exports,c(e)}t.exports=c,t.exports.__esModule=!0,t.exports["default"]=t.exports},757:(t,e,r)=>{var n=r(591)();t.exports=n;try{regeneratorRuntime=n}catch(o){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var o=e[n];if(o!==undefined)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{ApiAuthenticator:()=>T,ApiError:()=>E,ApiRealtimeTransport:()=>O,ApiTransport:()=>P,ApiWrapper:()=>$});var t=r(100),e=r.n(t),o=r(319),a=r.n(o),i=r(926),c=r.n(i),s=r(575),u=r.n(s),p=r(913),l=r.n(p),f=r(757),h=r.n(f),d=r(205),y=r.n(d),v=r(585),m=r.n(v),g=r(754),b=r.n(g),x=r(957);function _(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b()(t);if(e){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var w="api_wrapper/authentication_failed",A="api_wrapper/method_not_implemented",D="api_wrapper/parameter_not_provided",M="api_wrapper/realtime_transport",k="api_wrapper/unexpected",E=function(t){y()(r,t);var e=_(r);function r(){var t,n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:k,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:n,a=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return u()(this,r),(t=e.call(this,o)).code=n,t.data=a,t}return l()(r,null,[{key:"createAuthenticationFailedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[w,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Authentication failed"),{className:e,methodName:r,originalError:t,place:n}]}},{key:"createMethodNotImplementedErrorArgs",value:function(t,e){return[A,"[".concat(t,".").concat(e,"] Method not implemented: ").concat(e),{className:t,methodName:e}]}},{key:"createParameterNotProvidedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[D,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Parameter not provided: ").concat(t),{className:e,methodName:r,parameterName:t,place:n}]}},{key:"createRealtimeTransportErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[M,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Realtime transport error: ").concat(t.message),{className:e,methodName:r,originalError:t,place:n}]}}]),r}(r.n(x)()(Error)),T=function(){function t(){u()(this,t)}var r,n,o;return l()(t,[{key:"authenticate",value:(o=c()(h().mark((function i(t,r){return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:throw console.log("[ApiAuthenticator.authenticate]","wrapper:",t),console.log("[ApiAuthenticator.authenticate]","previousAuthenticationData:",r),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiAuthenticator","authenticate")));case 3:case"end":return n.stop()}}),i)}))),function(t,e){return o.apply(this,arguments)})},{key:"loadAuthenticationData",value:(n=c()(h().mark((function s(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiAuthenticator","loadAuthenticationData")));case 1:case"end":return t.stop()}}),s)}))),function(){return n.apply(this,arguments)})},{key:"saveAuthenticationData",value:(r=c()(h().mark((function p(t){return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw console.log("[ApiAuthenticator.saveAuthenticationData]","authenticationData:",t),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiAuthenticator","saveAuthenticationData")));case 2:case"end":return r.stop()}}),p)}))),function(t){return r.apply(this,arguments)})}]),t}(),O=function(){function t(){u()(this,t)}return l()(t,[{key:"connect",value:function(t){var r=t.onConnect,n=t.onDisconnect,o=t.wrapper;throw console.log("[ApiRealtimeTransport.connect]","onConnect:",r),console.log("[ApiRealtimeTransport.connect]","onDisconnect:",n),console.log("[ApiRealtimeTransport.connect]","wrapper:",o),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","connect")))}},{key:"disconnect",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","disconnect")))}},{key:"subscribe",value:function(t){var r=t.callbacks,n=t.isPrivate,o=t.onSubscribe,i=t.onUnsubscribe,c=t.subscriptionData;throw console.log("[ApiRealtimeTransport.subscribe]","callbacks:",r),console.log("[ApiRealtimeTransport.subscribe]","isPrivate:",n),console.log("[ApiRealtimeTransport.subscribe]","onSubscribe:",o),console.log("[ApiRealtimeTransport.subscribe]","onUnsubscribe:",i),console.log("[ApiRealtimeTransport.subscribe]","subscriptionData:",c),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","subscribe")))}},{key:"unsubscribe",value:function(t){var r=t.subscriptionData;throw console.log("[ApiRealtimeTransport.unsubscribe]","subscriptionData:",r),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","unsubscribe")))}}]),t}(),P=function(){function t(){u()(this,t)}var r;return l()(t,[{key:"callMethod",value:(r=c()(h().mark((function n(t){var r,o,i,c;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:throw r=t.authenticationData,o=t.methodData,i=t.requestData,c=t.wrapper,console.log("[ApiTransport.callMethod]","authenticationData:",r),console.log("[ApiTransport.callMethod]","methodData:",o),console.log("[ApiTransport.callMethod]","requestData:",i),console.log("[ApiTransport.callMethod]","wrapper:",c),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","callMethod")));case 6:case"end":return n.stop()}}),n)}))),function(t){return r.apply(this,arguments)})},{key:"getCreateMethodData",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","getCreateMethodData")))}},{key:"getDeleteMethodData",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","getDeleteMethodData")))}},{key:"getReadMethodData",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","getReadMethodData")))}},{key:"getUpdateMethodData",value:function(){throw e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","getUpdateMethodData")))}},{key:"isAuthenticationFailedError",value:function(t){throw console.log("[ApiTransport.isAuthenticationFailedError]","error:",t),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","isAuthenticationFailedError")))}},{key:"isSessionExpiredError",value:function(t){throw console.log("[ApiTransport.isSessionExpiredError]","error:",t),e()(E,a()(E.createMethodNotImplementedErrorArgs("ApiTransport","isSessionExpiredError")))}}]),t}(),S=r(506),R=r.n(S);const j=require("events");var N=r.n(j),L=r(713),C=r.n(L);function I(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return W(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){c=!0,a=t},f:function(){try{i||null==r["return"]||r["return"]()}finally{if(c)throw a}}}}function W(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function q(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach((function(e){C()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var G={Connected:"connected",Connecting:"connecting",Disconnected:"disconnected",Disconnecting:"disconnecting"},U={delay:1e3,delayFactor:2,maxDelay:32e3},B=function(){function t(e){var r=e.onError,n=e.realtimeTransport,o=e.reconnectConfig,a=void 0===o?{}:o,i=e.wrapper;u()(this,t),this._connectionState=G.Disconnected,this._onError=r,this._realtimeTransport=n,this._reconnectConfig=q(q({},U),a),this._reconnectDelay=this._reconnectConfig.delay,this._subscriptions=new Set,this._wrapper=i}return l()(t,[{key:"getRealtimeTransport",value:function(){return this._realtimeTransport}},{key:"getWrapper",value:function(){return this._wrapper}},{key:"subscribe",value:function(t){var e=this,r=t.callbacks,n=t.isPrivate,o=void 0!==n&&n,a=t.subscriptionData,i=this.getRealtimeTransport(),c={callbacks:r,isPrivate:o,subscriptionData:a,isSubscribed:!1};switch(this._subscriptions.add(c),this._connectionState){case G.Disconnected:this._connect();break;case G.Connected:this._subscribe(c)}return function(){if(c.isSubscribed&&i.unsubscribe({subscriptionData:a}),e._subscriptions["delete"](c),e._subscriptions.size<1){if([G.Disconnected,G.Disconnecting].includes(e._connectionState))return;e._disconnect()}}}},{key:"_connect",value:function(){var t=this;this._connectionState=G.Connecting,this.getRealtimeTransport().connect({onConnect:function(){return t._handleConnect()},onDisconnect:function(e){return t._handleDisconnect(e)},wrapper:this.getWrapper()})}},{key:"_disconnect",value:function(){this._connectionState=G.Disconnecting,this.getRealtimeTransport().disconnect()}},{key:"_handleConnect",value:function(){this._reconnectDelay=this._reconnectConfig.delay,this._connectionState=G.Connected;var t,e=I(this._subscriptions);try{for(e.s();!(t=e.n()).done;){var r=t.value;r.isSubscribed||this._subscribe(r)}}catch(n){e.e(n)}finally{e.f()}}},{key:"_handleDisconnect",value:function(t){var e=this,r=this._connectionState===G.Disconnecting;this._connectionState=G.Disconnected,t?this._onError(t):this._subscriptions.size<1||(r?this._connect():(this._reconnectDelay<this._reconnectConfig.maxDelay&&(this._reconnectDelay*=this._reconnectConfig.delayFactor),setTimeout((function(){return e._connect()}),this._reconnectDelay)))}},{key:"_subscribe",value:function(t){var e=t.callbacks,r=t.isPrivate,n=t.subscriptionData;this.getRealtimeTransport().subscribe({callbacks:e,isPrivate:r,subscriptionData:n,onSubscribe:function(){t.isSubscribed=!0},onUnsubscribe:function(){t.isSubscribed=!1}})}}]),t}();function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b()(t);if(e){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var Y=new Map,$=function(t){y()(m,t);var r,n,o,i,s,p,f,d,v=z(m);function m(t){var r,n=t.authenticator,o=t.realtimeTransport,i=t.reconnectConfig,c=void 0===i?{}:i,s=t.transport;if(u()(this,m),!n)throw e()(E,a()(E.createParameterNotProvidedErrorArgs("authenticator","ApiWrapper","constructor")));if(!o)throw e()(E,a()(E.createParameterNotProvidedErrorArgs("realtimeTransport","ApiWrapper","constructor")));if(!s)throw e()(E,a()(E.createParameterNotProvidedErrorArgs("transport","ApiWrapper","constructor")));return(r=v.call(this))._authenticator=n,r._realtimeTransportWrapper=new B({realtimeTransport:o,reconnectConfig:c,onError:r._handleRealtimeTransportWrapperError.bind(R()(r)),wrapper:R()(r)}),r._transport=s,r}return l()(m,[{key:"authenticate",value:(d=c()(h().mark((function g(){var t,r,n;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t=this.getAuthenticator(),o.prev=1,o.next=4,this._getAuthenticationPromise();case 4:return r=o.sent,o.next=7,t.saveAuthenticationData(r);case 7:return o.abrupt("return",r);case 10:if(o.prev=10,o.t0=o["catch"](1),!this.getTransport().isAuthenticationFailedError(o.t0)){o.next=16;break}throw n=e()(E,a()(E.createAuthenticationFailedErrorArgs(o.t0,"ApiWrapper","authenticate"))),this.emit("error",n),n;case 16:throw this.emit("error",o.t0),o.t0;case 18:case"end":return o.stop()}}),g,this,[[1,10]])}))),function(){return d.apply(this,arguments)})},{key:"callMethod",value:(f=c()(h().mark((function b(t){var e,r,n=arguments;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return e=n.length>1&&n[1]!==undefined?n[1]:null,r=n.length>2&&n[2]!==undefined&&n[2],o.next=4,this._callMethod({isPrivate:r,methodData:t,requestData:e});case 4:return o.abrupt("return",o.sent);case 5:case"end":return o.stop()}}),b,this)}))),function(t){return f.apply(this,arguments)})},{key:"create",value:(p=c()(h().mark((function x(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getCreateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),x,this)}))),function(){return p.apply(this,arguments)})},{key:"delete",value:(s=c()(h().mark((function _(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getDeleteMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),_,this)}))),function(){return s.apply(this,arguments)})},{key:"getAuthenticationData",value:(i=c()(h().mark((function w(){var t,e;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=this.getAuthenticator(),r.next=3,t.loadAuthenticationData();case 3:if(e=r.sent){r.next=8;break}return r.next=7,this.authenticate();case 7:e=r.sent;case 8:return r.abrupt("return",e);case 9:case"end":return r.stop()}}),w,this)}))),function(){return i.apply(this,arguments)})},{key:"getAuthenticator",value:function(){return this._authenticator}},{key:"getRealtimeTransportWrapper",value:function(){return this._realtimeTransportWrapper}},{key:"getTransport",value:function(){return this._transport}},{key:"read",value:(o=c()(h().mark((function A(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getReadMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),A,this)}))),function(){return o.apply(this,arguments)})},{key:"subscribe",value:function(t,e){var r=arguments.length>2&&arguments[2]!==undefined&&arguments[2];return this.getRealtimeTransportWrapper().subscribe({callbacks:e,isPrivate:r,subscriptionData:t})}},{key:"update",value:(n=c()(h().mark((function D(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getUpdateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),D,this)}))),function(){return n.apply(this,arguments)})},{key:"_callMethod",value:(r=c()(h().mark((function M(){var t,e,r,n,o,a,i,c,s,u,p=arguments;return h().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(t=p.length>0&&p[0]!==undefined?p[0]:{},e=t.isPrivate,r=void 0!==e&&e,n=t.isRetry,o=void 0!==n&&n,a=t.methodData,i=t.requestData,c=void 0===i?null:i,s=this.getTransport(),!r){l.next=8;break}return l.next=5,this.getAuthenticationData();case 5:l.t0=l.sent,l.next=9;break;case 8:l.t0=null;case 9:return u=l.t0,l.prev=10,l.next=13,s.callMethod({authenticationData:u,methodData:a,requestData:c,wrapper:this});case 13:return l.abrupt("return",l.sent);case 16:if(l.prev=16,l.t1=l["catch"](10),o||!s.isSessionExpiredError(l.t1)){l.next=24;break}return l.next=21,this.authenticate();case 21:return l.next=23,this._callMethod({isPrivate:r,methodData:a,requestData:c,isRetry:!0});case 23:return l.abrupt("return",l.sent);case 24:throw this.emit("error",l.t1),l.t1;case 26:case"end":return l.stop()}}),M,this,[[10,16]])}))),function(){return r.apply(this,arguments)})},{key:"_getAuthenticationPromise",value:function(){var t=this,e=this.getAuthenticator(),r=Y.get(e);return r||(r=c()(h().mark((function n(){var r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.loadAuthenticationData();case 2:return r=n.sent,n.next=5,e.authenticate(t,r);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))(),Y.set(e,r),c()(h().mark((function o(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:t.next=7;break;case 5:t.prev=5,t.t0=t["catch"](0);case 7:return t.prev=7,Y["delete"](e),t.finish(7);case 10:case"end":return t.stop()}}),o,null,[[0,5,7,10]])})))(),r)}},{key:"_handleRealtimeTransportWrapperError",value:function(t){this.emit("error",e()(E,a()(E.createRealtimeTransportErrorArgs(t,"ApiWrapper","_handleRealtimeTransportWrapperEvent"))))}}]),m}(N())})(),n})()));
//# sourceMappingURL=index.node.js.map
{
"name": "@ololoepepe/api-wrapper",
"version": "0.0.22",
"version": "0.0.23",
"description": "A wrapper around your API calls",

@@ -5,0 +5,0 @@ "main": "dist/index.node.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc