UNPKG

@backand/vanilla-sdk

Version:
2 lines 73.2 kB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.backand=e()}}(function(){var e;return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return o(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function o(e){return 3*e.length/4-r(e)}function i(e){var t,n,o,i,a,s,u=e.length;a=r(e),s=new c(3*u/4-a),o=a>0?u-4:u;var f=0;for(t=0,n=0;t<o;t+=4,n+=3)i=l[e.charCodeAt(t)]<<18|l[e.charCodeAt(t+1)]<<12|l[e.charCodeAt(t+2)]<<6|l[e.charCodeAt(t+3)],s[f++]=i>>16&255,s[f++]=i>>8&255,s[f++]=255&i;return 2===a?(i=l[e.charCodeAt(t)]<<2|l[e.charCodeAt(t+1)]>>4,s[f++]=255&i):1===a&&(i=l[e.charCodeAt(t)]<<10|l[e.charCodeAt(t+1)]<<4|l[e.charCodeAt(t+2)]>>2,s[f++]=i>>8&255,s[f++]=255&i),s}function a(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16)+(e[i+1]<<8)+e[i+2],o.push(a(r));return o.join("")}function u(e){for(var t,n=e.length,r=n%3,o="",i=[],a=16383,u=0,l=n-r;u<l;u+=a)i.push(s(e,u,u+a>l?l:u+a));return 1===r?(t=e[n-1],o+=f[t>>2],o+=f[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=f[t>>10],o+=f[t>>4&63],o+=f[t<<2&63],o+="="),i.push(o),i.join("")}n.byteLength=o,n.toByteArray=i,n.fromByteArray=u;for(var f=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,p=d.length;h<p;++h)f[h]=d[h],l[d.charCodeAt(h)]=h;l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function o(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=a.prototype):(null===e&&(e=new a(t)),e.length=t),e}function a(e,t,n){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return l(this,e)}return s(this,e,t,n)}function s(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?h(e,t,n,r):"string"==typeof t?c(e,t,n):p(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t,n,r){return u(t),t<=0?i(e,t):void 0!==n?"string"==typeof r?i(e,t).fill(n,r):i(e,t).fill(n):i(e,t)}function l(e,t){if(u(t),e=i(e,t<0?0:0|g(t)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function c(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|m(t,n);e=i(e,r);var o=e.write(t,n);return o!==r&&(e=e.slice(0,o)),e}function d(e,t){var n=t.length<0?0:0|g(t.length);e=i(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function h(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),a.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=a.prototype):e=d(e,t),e}function p(e,t){if(a.isBuffer(t)){var n=0|g(t.length);return e=i(e,n),0===e.length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||X(t.length)?i(e,0):d(e,t);if("Buffer"===t.type&&$(t.data))return d(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function g(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),a.alloc(+e)}function m(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return J(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return U(this,t,n);case"latin1":case"binary":return N(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function _(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){function i(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var f;if(o){var l=-1;for(f=n;f<s;f++)if(i(e,f)===i(t,l===-1?0:f-l)){if(l===-1&&(l=f),f-l+1===u)return l*a}else l!==-1&&(f-=f-l),l=-1}else for(n+u>s&&(n=s-u),f=n;f>=0;f--){for(var c=!0,d=0;d<u;d++)if(i(e,f+d)!==i(t,d)){c=!1;break}if(c)return f}return-1}function k(e,t,n,r){n=Number(n)||0;var o=e.length-n;r?(r=Number(r),r>o&&(r=o)):r=o;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function E(e,t,n,r){return W(J(t,e.length-n),e,n,r)}function T(e,t,n,r){return W(V(t),e,n,r)}function S(e,t,n,r){return T(e,t,n,r)}function O(e,t,n,r){return W(H(t),e,n,r)}function R(e,t,n,r){return W(K(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?Q.fromByteArray(e):Q.fromByteArray(e.slice(t,n))}function P(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o<n;){var i=e[o],a=null,s=i>239?4:i>223?3:i>191?2:1;if(o+s<=n){var u,f,l,c;switch(s){case 1:i<128&&(a=i);break;case 2:u=e[o+1],128===(192&u)&&(c=(31&i)<<6|63&u,c>127&&(a=c));break;case 3:u=e[o+1],f=e[o+2],128===(192&u)&&128===(192&f)&&(c=(15&i)<<12|(63&u)<<6|63&f,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:u=e[o+1],f=e[o+2],l=e[o+3],128===(192&u)&&128===(192&f)&&128===(192&l)&&(c=(15&i)<<18|(63&u)<<12|(63&f)<<6|63&l,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),o+=s}return I(r)}function I(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function U(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function N(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function j(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=t;i<n;++i)o+=G(e[i]);return o}function M(e,t,n){for(var r=e.slice(t,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function x(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,o,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function C(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o<i;++o)e[n+o]=(t&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function B(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o<i;++o)e[n+o]=t>>>8*(r?o:3-o)&255}function q(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return o||q(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function Y(e,t,n,r,o){return o||q(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function F(e){if(e=z(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function G(e){return e<16?"0"+e.toString(16):e.toString(16)}function J(e,t){t=t||1/0;for(var n,r=e.length,o=null,i=[],a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=(o-55296<<10|n-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function K(e,t){for(var n,r,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}function H(e){return Q.toByteArray(F(e))}function W(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function X(e){return e!==e}var Q=e("base64-js"),Z=e("ieee754"),$=e("isarray");n.Buffer=a,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=o(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return f(null,e,t,n)},a.allocUnsafe=function(e){return l(null,e)},a.allocUnsafeSlow=function(e){return l(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!$(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=a.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var i=e[n];if(!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o),o+=i.length}return r},a.byteLength=m,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)_(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this},a.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?P(this,0,e):v.apply(this,arguments)},a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},a.prototype.compare=function(e,t,n,r,o){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var i=o-r,s=n-t,u=Math.min(i,s),f=this.slice(r,o),l=e.slice(t,n),c=0;c<u;++c)if(f[c]!==l[c]){i=f[c],s=l[c];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},a.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},a.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return k(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":return T(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return O(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r;if(a.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=a.prototype;else{var o=t-e;r=new a(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+e]}return r},a.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e],o=1,i=0;++i<t&&(o*=256);)r+=this[e+i]*o;return r},a.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},a.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e],o=1,i=0;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return t||x(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||x(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||x(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||x(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var o=Math.pow(2,8*n)-1;L(this,e,t,n,o,0)}var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},a.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var o=Math.pow(2,8*n)-1;L(this,e,t,n,o,0)}var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):C(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):C(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);L(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);L(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):C(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):C(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return Y(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return Y(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o,i=r-n;if(this===e&&n<t&&t<r)for(o=i-1;o>=0;--o)e[o+t]=this[o+n];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),t);return i},a.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var i;if("number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var s=a.isBuffer(e)?e:J(new a(e,r).toString()),u=s.length;for(i=0;i<n-t;++i)this[i+t]=s[i%u]}return this};var te=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":1,ieee754:4,isarray:5}],3:[function(t,n,r){(function(o,i){!function(t,o){"object"==typeof r&&"undefined"!=typeof n?n.exports=o():"function"==typeof e&&e.amd?e(o):t.ES6Promise=o()}(this,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function n(e){return"function"==typeof e}function r(e){W=e}function a(e){X=e}function s(){return function(){return o.nextTick(d)}}function u(){return"undefined"!=typeof H?function(){H(d)}:c()}function f(){var e=0,t=new $(d),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function l(){var e=new MessageChannel;return e.port1.onmessage=d,function(){return e.port2.postMessage(0)}}function c(){var e=setTimeout;return function(){return e(d,1)}}function d(){for(var e=0;e<K;e+=2){var t=ne[e],n=ne[e+1];t(n),ne[e]=void 0,ne[e+1]=void 0}K=0}function h(){try{var e=t,n=e("vertx");return H=n.runOnLoop||n.runOnContext,u()}catch(e){return c()}}function p(e,t){var n=arguments,r=this,o=new this.constructor(y);void 0===o[oe]&&x(o);var i=r._state;return i?!function(){var e=n[i-1];X(function(){return N(i,o,e,r._result)})}():A(r,o,e,t),o}function g(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(y);return T(n,e),n}function y(){}function m(){return new TypeError("You cannot resolve a promise with itself")}function v(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){try{return e.then}catch(e){return ue.error=e,ue}}function w(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}function b(e,t,n){X(function(e){var r=!1,o=w(n,t,function(n){r||(r=!0,t!==n?T(e,n):O(e,n))},function(t){r||(r=!0,R(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,R(e,o))},e)}function k(e,t){t._state===ae?O(e,t._result):t._state===se?R(e,t._result):A(t,void 0,function(t){return T(e,t)},function(t){return R(e,t)})}function E(e,t,r){t.constructor===e.constructor&&r===p&&t.constructor.resolve===g?k(e,t):r===ue?R(e,ue.error):void 0===r?O(e,t):n(r)?b(e,t,r):O(e,t)}function T(t,n){t===n?R(t,m()):e(n)?E(t,n,_(n)):O(t,n)}function S(e){e._onerror&&e._onerror(e._result),P(e)}function O(e,t){e._state===ie&&(e._result=t,e._state=ae,0!==e._subscribers.length&&X(P,e))}function R(e,t){e._state===ie&&(e._state=se,e._result=t,X(S,e))}function A(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ae]=n,o[i+se]=r,0===i&&e._state&&X(P,e)}function P(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,o=void 0,i=e._result,a=0;a<t.length;a+=3)r=t[a],o=t[a+n],r?N(n,r,o,i):o(i);e._subscribers.length=0}}function I(){this.error=null}function U(e,t){try{return e(t)}catch(e){return fe.error=e,fe}}function N(e,t,r,o){var i=n(r),a=void 0,s=void 0,u=void 0,f=void 0;if(i){if(a=U(r,o),a===fe?(f=!0,s=a.error,a=null):u=!0,t===a)return void R(t,v())}else a=o,u=!0;t._state!==ie||(i&&u?T(t,a):f?R(t,s):e===ae?O(t,a):e===se&&R(t,a))}function j(e,t){try{t(function(t){T(e,t)},function(t){R(e,t)})}catch(t){R(e,t)}}function M(){return le++}function x(e){e[oe]=le++,e._state=void 0,e._result=void 0,e._subscribers=[]}function L(e,t){this._instanceConstructor=e,this.promise=new e(y),this.promise[oe]||x(this.promise),V(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?O(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&O(this.promise,this._result))):R(this.promise,C())}function C(){return new Error("Array Methods must be provided an Array")}function B(e){return new L(this,e).promise}function q(e){var t=this;return new t(V(e)?function(n,r){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,r)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function D(e){var t=this,n=new t(y);return R(n,e),n}function Y(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function F(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function z(e){this[oe]=M(),this._result=this._state=void 0,this._subscribers=[],y!==e&&("function"!=typeof e&&Y(),this instanceof z?j(this,e):F())}function G(){var e=void 0;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=z}var J=void 0;J=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var V=J,K=0,H=void 0,W=void 0,X=function(e,t){ne[K]=e,ne[K+1]=t,K+=2,2===K&&(W?W(d):re())},Q="undefined"!=typeof window?window:void 0,Z=Q||{},$=Z.MutationObserver||Z.WebKitMutationObserver,ee="undefined"==typeof self&&"undefined"!=typeof o&&"[object process]"==={}.toString.call(o),te="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ne=new Array(1e3),re=void 0;re=ee?s():$?f():te?l():void 0===Q&&"function"==typeof t?h():c();var oe=Math.random().toString(36).substring(16),ie=void 0,ae=1,se=2,ue=new I,fe=new I,le=0;return L.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===ie&&n<e;n++)this._eachEntry(t[n],n)},L.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===g){var o=_(e);if(o===p&&e._state!==ie)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===z){var i=new n(y);E(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},L.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===ie&&(this._remaining--,e===se?R(r,n):this._result[t]=n),0===this._remaining&&O(r,this._result)},L.prototype._willSettleAt=function(e,t){var n=this;A(e,void 0,function(e){return n._settledAt(ae,t,e)},function(e){return n._settledAt(se,t,e)})},z.all=B,z.race=q,z.resolve=g,z.reject=D,z._setScheduler=r,z._setAsap=a,z._asap=X,z.prototype={constructor:z,then:p,catch:function(e){return this.then(null,e)}},z.polyfill=G,z.Promise=z,z})}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:6}],4:[function(e,t,n){n.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,u=(1<<s)-1,f=u>>1,l=-7,c=n?o-1:0,d=n?-1:1,h=e[t+c];for(c+=d,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+c],c+=d,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+c],c+=d,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:(h?-1:1)*(1/0);a+=Math.pow(2,r),i-=f}return(h?-1:1)*a*Math.pow(2,i-r)},n.write=function(e,t,n,r,o,i){var a,s,u,f=8*i-o-1,l=(1<<f)-1,c=l>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+c>=1?d/u:d*Math.pow(2,1-c),t*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(t*u-1)*Math.pow(2,o),a+=c):(s=t*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<<o|s,f+=o;f>0;e[n+h]=255&a,h+=p,a/=256,f-=8);e[n+h-p]|=128*g}},{}],5:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],6:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(d===clearTimeout)return clearTimeout(e);if((d===o||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function s(){y&&p&&(y=!1,p.length?g=p.concat(g):m=-1,g.length&&u())}function u(){if(!y){var e=i(s);y=!0;for(var t=g.length;t;){for(p=g,g=[];++m<t;)p&&p[m].run();m=-1,t=g.length}p=null,y=!1,a(e)}}function f(e,t){this.fun=e,this.array=t}function l(){}var c,d,h=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(e){c=r}try{d="function"==typeof clearTimeout?clearTimeout:o}catch(e){d=o}}();var p,g=[],y=!1,m=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];g.push(new f(e,t)),1!==g.length||y||i(u)},f.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.EVENTS={SIGNIN:"SIGNIN",SIGNOUT:"SIGNOUT",SIGNUP:"SIGNUP",START_OFFLINE_MODE:"startOfflineMode",END_OFFLINE_MODE:"endOfflineMode"},n.URLS={token:"token",signup:"1/user/signup",requestResetPassword:"1/user/requestResetPassword",resetPassword:"1/user/resetPassword",changePassword:"1/user/changePassword",socialSigninWithToken:"1/user/PROVIDER/token",signout:"1/user/signout",profile:"api/account/profile",objects:"1/objects",objectsAction:"1/objects/action",query:"1/query/data",bulk:"1/bulk",fn:"1/function/general",socialProviders:"1/user/socialProviders"},n.SOCIAL_PROVIDERS={github:{name:"github",label:"Github",url:"www.github.com",css:{backgroundColor:"#444" },id:1},google:{name:"google",label:"Google",url:"www.google.com",css:{backgroundColor:"#dd4b39"},id:2},facebook:{name:"facebook",label:"Facebook",url:"www.facebook.com",css:{backgroundColor:"#3b5998"},id:3},twitter:{name:"twitter",label:"Twitter",url:"www.twitter.com",css:{backgroundColor:"#55acee"},id:4},azuread:{name:"azuread",label:"Azure Active Directory",url:"www.azuread.com",css:{backgroundColor:"#3b9844"},id:5},adfs:{name:"adfs",label:"ADFS",url:"www.adfs.com",css:{backgroundColor:"#3b9844"},id:6}}},{}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default={appName:null,anonymousToken:null,useAnonymousTokenByDefault:!0,signUpToken:null,masterToken:null,userToken:null,accessToken:null,apiUrl:"https://api.backand.com",exportUtils:!1,storage:{},storagePrefix:"BACKAND_",externalStorage:null,manageRefreshToken:!0,runSigninAfterSignup:!0,runSocket:!1,socketUrl:"https://socket.backand.com",isMobile:!1,mobilePlatform:"ionic",runOffline:!1,allowUpdatesinOfflineMode:!1,beforeExecuteOfflineItem:function(e){return!0},afterExecuteOfflineItem:function(e,t){}}},{}],9:[function(e,t,n){"use strict";function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=(n.filter={create:function(e,t,n){return{fieldName:e,operator:t,value:n}},operators:{numeric:{equals:"equals",notEquals:"notEquals",greaterThan:"greaterThan",greaterThanOrEqualsTo:"greaterThanOrEqualsTo",lessThan:"lessThan",lessThanOrEqualsTo:"lessThanOrEqualsTo",empty:"empty",notEmpty:"notEmpty"},date:{equals:"equals",notEquals:"notEquals",greaterThan:"greaterThan",greaterThanOrEqualsTo:"greaterThanOrEqualsTo",lessThan:"lessThan",lessThanOrEqualsTo:"lessThanOrEqualsTo",empty:"empty",notEmpty:"notEmpty"},text:{equals:"equals",notEquals:"notEquals",startsWith:"startsWith",endsWith:"endsWith",contains:"contains",notContains:"notContains",empty:"empty",notEmpty:"notEmpty"},boolean:{equals:"equals"},relation:{in:"in"}}},n.sort={create:function(e,t){return{fieldName:e,order:t}},orders:{asc:"asc",desc:"desc"}},n.exclude={options:{metadata:"metadata",totalRows:"totalRows",all:"metadata,totalRows"}},n.StorageAbstract=function(){function e(){if(i(this,e),this.constructor===e)throw new TypeError("Can not construct abstract class.");if(void 0===this.setItem||this.setItem===e.prototype.setItem)throw new TypeError("Must override setItem method.");if(void 0===this.getItem||this.getItem===e.prototype.getItem)throw new TypeError("Must override getItem method.");if(void 0===this.removeItem||this.removeItem===e.prototype.removeItem)throw new TypeError("Must override removeItem method.");if(void 0===this.clear||this.clear===e.prototype.clear)throw new TypeError("Must override clear method.")}return a(e,[{key:"setItem",value:function(e,t){throw new TypeError("Do not call abstract method setItem from child.")}},{key:"getItem",value:function(e){throw new TypeError("Do not call abstract method getItem from child.")}},{key:"removeItem",value:function(e){throw new TypeError("Do not call abstract method removeItem from child.")}},{key:"clear",value:function(){throw new TypeError("Do not call abstract method clear from child.")}}]),e}());n.MemoryStorage=function(e){function t(e){i(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.externalStorage=e,n.data={},n}return o(t,e),a(t,[{key:"setItem",value:function(e,t){return this.externalStorage&&this.externalStorage.setItem&&this.externalStorage.setItem(e,t),this.data[e]=String(t)}},{key:"getItem",value:function(e){return!this.data.hasOwnProperty(e)&&this.externalStorage&&this.externalStorage.getItem&&(this.data[e]=this.externalStorage.getItem(e)),this.data.hasOwnProperty(e)?this.data[e]:null}},{key:"removeItem",value:function(e){return delete this.data[e],null}},{key:"clear",value:function(){return this.data={}}}]),t}(s)},{}],10:[function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=e("./defaults"),s=o(a),u=e("./constants"),f=r(u),l=e("./helpers"),c=r(l),d=e("./utils/utils"),h=o(d),p=e("./utils/storage"),g=o(p),y=e("./utils/http"),m=o(y),v=e("./utils/interceptors"),_=o(v),w=e("./utils/socket"),b=o(w),k=e("./utils/detector"),E=o(k),T=e("./utils/fns"),S=e("./services/auth"),O=o(S),R=e("./services/object"),A=o(R),P=e("./services/file"),I=o(P),U=e("./services/query"),N=o(U),j=e("./services/offline"),M=o(j),x=e("./services/user"),L=o(x),C=e("./services/analytics"),B=(o(C),e("./services/function")),q=o(B),D=e("./services/bulk"),Y=o(D),F=e("es6-promise");!function(e){e.Promise||(e.Promise=F.Promise)}("undefined"!=typeof self?self:new Function("return this")());var z=(0,E.default)();if(s.default.storage="browser"===z.env?window.localStorage:new c.MemoryStorage,s.default.isMobile="mobile"===z.device||"tablet"===z.device,"browser"===z.env&&(function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}return"function"!=typeof window.CustomEvent&&(e.prototype=window.Event.prototype,void(window.CustomEvent=e))}(),window.location)){var G=/(data|error)=(.+)/.exec(window.location.href);if(G&&G[1]&&G[2]){var J={data:JSON.parse(decodeURIComponent(G[2].replace(/#.*/,"")))};J.status="data"===G[1]?200:0,"Internet Explorer"!==z.type?window.opener.postMessage(JSON.stringify(J),location.origin):localStorage.setItem("SOCIAL_DATA",JSON.stringify(J))}}var V={constants:f,helpers:c};V.init=function(){function e(e,n){return s.default.afterExecuteOfflineItem(n,e.payload),t(h.default.storage.get("queue"))}function t(n){if(!h.default.offline){var r=n.shift();if(h.default.storage.set("queue",n),r)return s.default.beforeExecuteOfflineItem(r.payload)?void("create"===r.action?A.default[r.action].apply(null,r.params).then(e.bind(null,r)).catch(e.bind(null,r)):A.default.getOne(r.params[0],r.params[1]).then(function(e){return e.data.updatedAt?new Date(e.data.updatedAt)>h.default.offlineAt?F.Promise.reject((0,T.__generateFakeResponse__)(0,"",{},"Cannot update this object, object was updated after you entered offline mode",{})):A.default[r.action].apply(null,r.params):F.Promise.reject((0,T.__generateFakeResponse__)(0,"",{},"Cannot update this object, object is missing updatedAt property",{}))}).then(e.bind(null,r)).catch(e.bind(null,r))):t(h.default.storage.get("queue"))}}function n(e){h.default.forceOffline||(h.default.offline="undefined"!=typeof navigator&&!navigator.onLine),h.default.offline?(h.default.offlineAt=new Date,(0,T.__dispatchEvent__)("startOfflineMode"),console.info("SDK started offline mode")):((0,T.__dispatchEvent__)("endOfflineMode"),console.info("SDK finished offline mode"),t(h.default.storage.get("queue")))}var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(i(s.default,r),!s.default.appName)throw new Error("appName is missing");s.default.anonymousToken||(s.default.useAnonymousTokenByDefault=!1),s.default.externalStorage&&(s.default.storage=new c.MemoryStorage(s.default.externalStorage)),i(h.default,{storage:new g.default(s.default.storage,s.default.storagePrefix),http:m.default.create({baseURL:s.default.apiUrl}),offline:"undefined"!=typeof navigator&&!navigator.onLine,forceOffline:!1,offlineAt:null,detector:z}),s.default.masterToken&&s.default.userToken&&O.default.useBasicAuth(),s.default.accessToken&&O.default.useAccessAuth(),s.default.runSocket&&i(h.default,{socket:new b.default(s.default.socketUrl)}),h.default.http.config.interceptors={request:_.default.requestInterceptor,response:_.default.responseInterceptor,responseError:_.default.responseErrorInterceptor};var o=h.default.storage.get("user");if(!o||!o.token.AnonymousToken||o.token.AnonymousToken===s.default.anonymousToken&&s.default.useAnonymousTokenByDefault||h.default.storage.remove("user"),o&&o.details.token_type&&"Basic"===o.details.token_type&&o.token.Authorization!=="Basic "+O.default.createBasicToken(s.default.masterToken,s.default.userToken)&&h.default.storage.remove("user"),o&&o.details.access_token&&o.details.appName!==s.default.appName&&h.default.storage.remove("user"),s.default.runOffline&&"browser"===h.default.detector.env&&(window.addEventListener("online",n),window.addEventListener("offline",n)),s.default.runOffline&&(h.default.storage.get("cache")||h.default.storage.set("cache",{}),h.default.storage.get("queue")||h.default.storage.set("queue",[])),delete V.init,i(V,O.default,{invoke:h.default.http,defaults:s.default,object:A.default,file:I.default,query:N.default,user:L.default,offline:M.default,fn:q.default,bulk:Y.default}),s.default.runSocket){o=h.default.storage.get("user");var a=o?o.token.Authorization:null;h.default.socket.connect(a,s.default.anonymousToken,s.default.appName),i(V,{on:b.default.prototype.on.bind(h.default.socket)})}s.default.exportUtils&&i(V,{utils:h.default})},t.exports=V},{"./constants":7,"./defaults":8,"./helpers":9,"./services/analytics":11,"./services/auth":12,"./services/bulk":13,"./services/file":14,"./services/function":15,"./services/object":16,"./services/offline":17,"./services/query":18,"./services/user":19,"./utils/detector":20,"./utils/fns":21,"./utils/http":22,"./utils/interceptors":23,"./utils/socket":24,"./utils/storage":25,"./utils/utils":26,"es6-promise":3}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default='!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";\nanalytics.load("hbAGffWTKHq2CcWndS7m2lCX3nHJzmYN");\nanalytics.page();\n}}();'},{}],12:[function(e,t,n){(function(t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=[];return Object.keys(e).forEach(function(n){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]))}),t=t.join("&"),A.default.http({url:T.URLS.token,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:t+"&appName="+O.default.appName+"&grant_type=password"}).then(function(e){return A.default.storage.set("user",{token:{Authorization:"Bearer "+e.data.access_token},details:e.data}),(0,P.__dispatchEvent__)(T.EVENTS.SIGNIN),O.default.runSocket&&A.default.socket.connect(A.default.storage.get("user").token.Authorization,O.default.anonymousToken,O.default.appName),e})}function i(){return new Promise(function(e,t){if(O.default.userToken&&O.default.masterToken){var n={token_type:"Basic",expires_in:0,appName:O.default.appName,username:"",role:"",firstName:"",lastName:"",fullName:"",regId:0,userId:null},r="Basic "+s(O.default.masterToken,O.default.userToken);A.default.storage.set("user",{token:{Authorization:r},details:n}),e((0,P.__generateFakeResponse__)(200,"OK",{},n,{}))}else t((0,P.__generateFakeResponse__)(0,"",{},"userToken or masterToken are missing for basic authentication"))})}function a(){return new Promise(function(e,t){if(O.default.accessToken){var n={token_type:"",expires_in:0,appName:O.default.appName,username:"",role:"",firstName:"",lastName:"",fullName:"",regId:0,userId:null},r=O.default.accessToken.toLowerCase().startsWith("bearer")?O.default.accessToken:"Bearer "+O.default.accessToken;A.default.storage.set("user",{token:{Authorization:r,appName:O.default.appName},details:n}),e((0,P.__generateFakeResponse__)(200,"OK",{},n,{}))}else t((0,P.__generateFakeResponse__)(0,"",{},"accessToken is missing for Access authentication"))})}function s(e,n){return new t(e+":"+n).toString("base64")}function u(){return new Promise(function(e,t){var n=A.default.storage.get("user");n&&n.details.refresh_token?e(o({username:n.details.username,refreshToken:n.details.refresh_token})):t((0,P.__generateFakeResponse__)(0,"",{},"No cached user or refreshToken found. authentication is required.",{}))})}function f(){return new Promise(function(e,t){if(O.default.anonymousToken){var n={token_type:"AnonymousToken",expires_in:0,appName:O.default.appName,username:"Guest",role:"",firstName:"anonymous",lastName:"anonymous",fullName:"",regId:0,userId:null};A.default.storage.set("user",{token:{AnonymousToken:O.default.anonymousToken},details:n}),O.default.runSocket&&A.default.socket.connect(null,O.default.anonymousToken,O.default.appName),e((0,P.__generateFakeResponse__)(200,"OK",{},n,{}))}else t((0,P.__generateFakeResponse__)(0,"",{},"anonymousToken is missing",{}))})}function l(e,t){return o({username:e,password:t})}function c(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};return A.default.http({url:T.URLS.signup,method:"POST",headers:{SignUpToken:O.default.signUpToken},data:{firstName:e,lastName:t,email:n,password:r,confirmPassword:o,parameters:i}}).then(function(e){return(0,P.__dispatchEvent__)(T.EVENTS.SIGNUP),O.default.runSigninAfterSignup?l(e.data.username,r):e})}function d(e,t,n){var r=T.SOCIAL_PROVIDERS[e],o=t?"up":"in",i="&signupIfNotSignedIn="+(!t&&n?"true":"false");return"/user/socialSign"+o+"?provider="+r.name+i+"&response_type=token&client_id=self&redirect_uri="+r.url+"&state="}function h(e,t,n,r){return new Promise(function(o,i){T.SOCIAL_PROVIDERS[e]||i((0,P.__generateFakeResponse__)(0,"",{},"Unknown Social Provider",{}));var a=O.default.apiUrl+"/1/"+d(e,t,!0)+"&appname="+O.default.appName+(r?"&email="+r:"")+"&returnAddress=",s=null;O.default.isMobile?"ionic"===O.default.mobilePlatform?!function(){var e="http://www.backandblabla.bla";a+=e;var t=function t(n){if(0===n.url.indexOf(e)){var r=/(data|error)=(.+)/.exec(n.url),a={};r&&r[1]&&r[2]&&(a.data=JSON.parse(decodeURIComponent(r[2].replace(/#.*/,""))),a.status="data"===r[1]?200:0),s.removeEventListener("loadstart",t,!1),s&&s.close&&s.close(),200!=a.status?i(a):o(a)}};s=cordova.InAppBrowser.open(a,"_blank"),s.addEventListener("loadstart",t,!1)}():i("react-native"===O.default.mobilePlatform?(0,P.__generateFakeResponse__)(0,"",{},"react-native is not supported yet for socials",{}):(0,P.__generateFakeResponse__)(0,"",{},"isMobile is true but mobilePlatform is not supported.\n 'try contact us in request to add support for this platform",{})):"browser"===A.default.detector.env?!function(){var e=function e(t){var n="message"===t.type?t.origin:t.url;window.location.origin||(window.location.origin=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")),n.indexOf(window.location.origin)===-1&&i((0,P.__generateFakeResponse__)(0,"",{},"Unknown Origin Message",{}));var r="message"===t.type?JSON.parse(t.data):JSON.parse(t.newValue);window.removeEventListener("message",e,!1),window.removeEventListener("storage",e,!1),s&&s.close&&s.close(),"storage"===t.type&&localStorage.removeItem(t.key),200!=r.status?i(r):o(r)};"Internet Explorer"!==A.default.detector.type?(s=window.open(a,"socialpopup",n),window.addEventListener("message",e,!1)):(s=window.open("","",n),s.location=a,window.addEventListener("storage",e,!1))}():"node"===A.default.detector.env&&i((0,P.__generateFakeResponse__)(0,"",{},"socials are not supported in a nodejs environment",{})),s&&s.focus&&s.focus()})}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"left=1, top=1, width=500, height=560";return h(e,!1,t,"").then(function(e){return(0,P.__dispatchEvent__)(T.EVENTS.SIGNUP),o({accessToken:e.data.access_token})})}function g(e,t){return A.default.http({url:T.URLS.socialSigninWithToken.replace("PROVIDER",e),method:"GET",params:{accessToken:t,appName:O.default.appName,signupIfNotSignedIn:!0}}).then(function(e){return A.default.storage.set("user",{token:{Authorization:"Bearer "+e.data.access_token},details:e.data}),(0,P.__dispatchEvent__)(T.EVENTS.SIGNIN),O.default.runSocket&&A.default.socket.connect(A.default.storage.get("user").token.Authorization,O.default.anonymousToken,O.default.appName),A.default.http({url:T.URLS.objects+"/users",method:"GET",params:{filter:[{fieldName:"email",operator:"equals",value:e.data.username}]}}).then(function(t){var n=t.data.data[0],r=n.id,o=n.firstName,i=n.lastName,a=A.default.storage.get("user"),s={userId:r.toString(),firstName:o,lastName:i};return A.default.storage.set("user",{token:a.token,details:E({},a