diff --git a/dist/browser.js b/dist/browser.js index 1af3d24..f4c2dd5 100755 --- a/dist/browser.js +++ b/dist/browser.js @@ -1,10 +1,11 @@ -window.Channelize=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=124)}([function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n={ALREADY_CONNECTED:"Channelize server is already connected.",ALREADY_DISCONNECTED:"Channelize server is already disconnected.",REQUIRED_PUBLIC_KEY:"Public key is required.",INVALID_TYPE_OBJECT:"%s should be a object.",INVALID_CALLBACK:"Callback should be a function.",INVALID_FILE_OBJECT:"File should be a file object.",INVALID_USER_ID:"User Id should be a string.",INVALID_USER_IDS:"User Ids should be an array.",INVALID_CONVERSATION_TYPE:"Conversation type can be 'private' or 'public'.",INVALID_CONVERSATION_CONFIG:"Conversation config should be an object.",INVALID_CONVERSATION_IDS:"Conversation Ids should be an array.",REQUIRED_USER_OR_CONVERSATION:"One of Conversation Ids and user Ids is required.",INVALID_ID:"Id should be a string.",INVALID_USER_NAME:"Display Name should be a string.",INVALID_DATA:"Data should be an object.",INVALID_MULTIPLE_MESSAGE_OBJECT:"Message data should be an object.",INVALID_PROFILE_IMG:"Img should be a file object.",INVALID_MEMBER_IDS:"Member Ids should be an array.",INVALID_MESSAGE_MENTIONED_USERS:"Mentioned users should be an array of objects having userId, order and wordCount.",INVALID_MESSAGE_ID:"Message Id should be string.",INVALID_MESSAGE_IDS:"Message Ids should be an array.",INVALID_CONVERSATION_INCLUDE:"Include should be string and can have 'members' values only.",INVALID_EVENT:"%s event is not supported.",INVALID_DEVICE_ID:"Device Id should be a string.",INVALID_EMAIL:"Email Id is not valid.",INVALID_PASSWORD:"Password should be a string.",INVALID_ACCESS_TOKEN:"Access Token is required and should be a string.",INVALID_CLIENT_SERVER_TOKEN:"Channelize Client Server Token is required and should be a string.",INVALID_MESSAGE_BODY:"Message body should be a string.",REQUIRED_BODY_OR_ATTACHMENT:"One of Body or Attachments is required.",INVALID_TITLE:"Title should be a string.",INVALID_DATA_PARAM:"%s parameter is not allowed.",INVALID_MESSAGE_FILE_PARAMS:"File should be a FileObject or should contain %s.",REQUIRED_SOCKET_EVENT_PARAM:"%s parameter is required in event %s.",REQUIRED_LATITUDE_LONGITUDE:"Latitude and Longitude are required in location and should be numbers.",INVALID_CONVERSATION_TITLE:"Title is required in group conversations and should be string.",INVALID_CONVERSATION_MEMBERS:"Members is required and should be array.",GROUP_CONVERSATION_REQUIRED:"Conversation should be a group conversation to perform this action.",INVALID_FRIENDSHIP_TYPE:"Type should be a number and should contain 1 or 2.",REQUIRED_ATTACHMENT_TYPE:"Type is required in all attachments.",INVALID_ATTACHMENT_TYPE:"Attachments type should be an array.",INVALID_MESSAGE_TYPE:"Invalid message type.",INVALID_MESSAGE_OBJECT:"Message Type should be an object.",INVALID_MESSAGE_PARENTID:"Message Parent id should be a string.",INVALID_MESSAGE_CUSTOMTYPE:"Message Custom type should be a string.",INVALID_MESSAGE_RECIPIENTS:"Message Recipients should be an array.",INVALID_MESSAGE_EVENTS:"Message Events should be an object.",CONVERSATION_NOT_CONFIGURED_READ_EVENTS:"Conversation not configured for read events.",CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS:"Conversation not configured for typing events.",PUBLIC_CONVERSATION_REQUIRED:"Public Conversation is required for this function.",CAN_NOT_CLEAR_CONVERSATION:"Clear Conversation is only allowed for private conversations.",INVALID_REACTION_TYPE:"Reaction type should be an string.",INVALID_MESSAGE_SHOWINCONVERSATION:"Message showInConversation should be a boolean.",REQUIRED_WATCHING_CONVERSATION:"You have to watch this conversation before register watching event.",EMPTY_URL:"The Url should not be empty."}},function(e,t,r){"use strict";(function(e){function n(t,r){if("function"==typeof t)try{return r(t)}catch(t){return e.nextTick(function(){throw t})}return new Promise(function(e,t){r(function(r,n){return null!=r?t(r):arguments.length>2?e(Array.prototype.slice.call(arguments,1)):void e(n)})})}r.d(t,"a",function(){return n})}).call(this,r(6))},function(e,t,r){var n={util:r(7)};({}).toString(),e.exports=n,n.util.update(n,{VERSION:"2.656.0",Signers:{},Protocol:{Json:r(68),Query:r(102),Rest:r(45),RestJson:r(104),RestXml:r(105)},XML:{Builder:r(248),Parser:null},JSON:{Builder:r(69),Parser:r(70)},Model:{Api:r(106),Operation:r(107),Shape:r(36),Paginator:r(108),ResourceWaiter:r(109)},apiLoader:r(253),EndpointCache:r(254).EndpointCache}),r(111),r(256),r(259),r(114),r(260),r(262),r(264),r(265),r(266),r(273),n.events=new n.SequentialExecutor,n.util.memoizedProperty(n,"endpointCache",function(){return new n.EndpointCache(n.config.endpointCacheSize)},!0)},function(e,t,r){e.exports=function(){var e=e||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var r=new e;return t&&r.mixIn(t),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){var t=t,r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},s=0;s>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},c=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},l=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,s=this.blockSize,a=4*s,u=i/a,c=(u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0))*s,l=e.min(4*c,i);if(c){for(var f=0;f1)for(var r=1;r=e.length)return t.push(null);var i=r+n;i>e.length&&(i=e.length),t.push(e.slice(r,i)),r=i},t},concat:function(e){var t,r,n=0,i=0;for(r=0;r>>8^t[255&(r^e.readUInt8(n))]}return(-1^r)>>>0},hmac:function(e,t,r,n){return r||(r="binary"),"buffer"===r&&(r=void 0),n||(n="sha256"),"string"==typeof t&&(t=o.buffer.toBuffer(t)),o.crypto.lib.createHmac(n,e).update(t).digest(r)},md5:function(e,t,r){return o.crypto.hash("md5",e,t,r)},sha256:function(e,t,r){return o.crypto.hash("sha256",e,t,r)},hash:function(e,t,r,n){var i=o.crypto.createHash(e);r||(r="binary"),"buffer"===r&&(r=void 0),"string"==typeof t&&(t=o.buffer.toBuffer(t));var s=o.arraySliceFn(t),a=o.Buffer.isBuffer(t);if(o.isBrowser()&&"undefined"!=typeof ArrayBuffer&&t&&t.buffer instanceof ArrayBuffer&&(a=!0),n&&"object"==typeof t&&"function"==typeof t.on&&!a)t.on("data",function(e){i.update(e)}),t.on("error",function(e){n(e)}),t.on("end",function(){n(null,i.digest(r))});else{if(!n||!s||a||"undefined"==typeof FileReader){o.isBrowser()&&"object"==typeof t&&!a&&(t=new o.Buffer(new Uint8Array(t)));var u=i.update(t).digest(r);return n&&n(null,u),u}var c=0,l=new FileReader;l.onerror=function(){n(new Error("Failed to read data."))},l.onload=function(){var e=new o.Buffer(new Uint8Array(l.result));i.update(e),c+=e.length,l._continueReading()},l._continueReading=function(){if(c>=t.size)n(null,i.digest(r));else{var e=c+524288;e>t.size&&(e=t.size),l.readAsArrayBuffer(s.call(t,c,e))}},l._continueReading()}},toHex:function(e){for(var t=[],r=0;r=3e5,!1),i.config.isClockSkewed},applyClockOffset:function(e){e&&(i.config.systemClockOffset=e-(new Date).getTime())},extractRequestId:function(e){var t=e.httpResponse.headers["x-amz-request-id"]||e.httpResponse.headers["x-amzn-requestid"];!t&&e.data&&e.data.ResponseMetadata&&(t=e.data.ResponseMetadata.RequestId),t&&(e.requestId=t),e.error&&(e.error.requestId=t)},addPromises:function(e,t){var r=!1;void 0===t&&i&&i.config&&(t=i.config.getPromisesDependency()),void 0===t&&"undefined"!=typeof Promise&&(t=Promise),"function"!=typeof t&&(r=!0),Array.isArray(e)||(e=[e]);for(var n=0;n=0?(a++,setTimeout(c,i+(e.retryAfter||0))):r(e)},c=function(){var t="";n.handleRequest(e,s,function(e){e.on("data",function(e){t+=e.toString()}),e.on("end",function(){var n=e.statusCode;if(n<300)r(null,t);else{var i=1e3*parseInt(e.headers["retry-after"],10)||0,s=o.error(new Error,{statusCode:n,retryable:n>=500||429===n});i&&s.retryable&&(s.retryAfter=i),u(s)}})},u)};i.util.defer(c)},uuid:{v4:function(){return r(121).v4()}},convertPayloadToString:function(e){var t=e.request,r=t.operation,n=t.service.api.operations[r].output||{};n.payload&&e.data[n.payload]&&(e.data[n.payload]=e.data[n.payload].toString())},defer:function(e){"object"==typeof t&&"function"==typeof t.nextTick?t.nextTick(e):"function"==typeof n?n(e):setTimeout(e,0)},getRequestPayloadShape:function(e){var t=e.service.api.operations;if(t){var r=(t||{})[e.operation];if(r&&r.input&&r.input.payload)return r.input.members[r.input.payload]}},getProfilesFromSharedConfig:function(e,r){var n={},i={};if(t.env[o.configOptInEnv])i=e.loadFrom({isConfig:!0,filename:t.env[o.sharedConfigFileEnv]});for(var s=e.loadFrom({filename:r||t.env[o.configOptInEnv]&&t.env[o.sharedCredentialsFileEnv]}),a=0,u=Object.keys(i);a=6},parse:function(e){var t=e.split(":");return{partition:t[1],service:t[2],region:t[3],accountId:t[4],resource:t.slice(5).join(":")}},build:function(e){if(void 0===e.service||void 0===e.region||void 0===e.accountId||void 0===e.resource)throw o.error(new Error("Input ARN object is invalid"));return"arn:"+(e.partition||"aws")+":"+e.service+":"+e.region+":"+e.accountId+":"+e.resource}},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};e.exports=o}).call(this,r(6),r(80).setImmediate)},function(e,t,r){e.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,i=n.Base,o=n.WordArray,s=n.BufferedBlockAlgorithm,a=r.enc,u=(a.Utf8,a.Base64),c=r.algo,l=c.EvpKDF,f=n.Cipher=s.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?S:_}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()}),h=(n.StreamCipher=f.extend({_doFinalize:function(){var e=this._process(!0);return e},blockSize:1}),r.mode={}),p=n.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),d=h.CBC=function(){var e=p.extend();function r(e,r,n){var i=this._iv;if(i){var o=i;this._iv=t}else var o=this._prevBlock;for(var s=0;s>>2];e.sigBytes-=t}},m=(n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:d,padding:v}),reset:function(){f.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else{var n=r.createDecryptor;this._minBufferSize=1}this._mode=n.call(r,this,t&&t.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else{var t=this._process(!0);e.unpad(t)}return t},blockSize:4}),n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),g=r.format={},b=g.OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=o.create([1398893684,1701076831]).concat(r).concat(t);else var n=t;return n.toString(u)},parse:function(e){var t=u.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=o.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return m.create({ciphertext:t,salt:n})}},_=n.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),s=i.cfg;return m.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=e.createDecryptor(r,n).finalize(t.ciphertext);return i},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),w=r.kdf={},E=w.OpenSSL={execute:function(e,t,r,n){n||(n=o.random(8));var i=l.create({keySize:t+r}).compute(e,n),s=o.create(i.words.slice(t),4*r);return i.sigBytes=4*t,m.create({key:i,iv:s,salt:n})}},S=n.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:E}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var o=_.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);n.iv=i.iv;var o=_.decrypt.call(this,e,t,i.key,n);return o}})}()}(r(3))},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._client=t};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(n,"Client",void 0)},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n={sprintf:function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null;return Object.keys(t).forEach(function(t){e.includes(t)||(r=t)}),r},getRequiedFilter:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],n=Object.keys(t);return e.forEach(function(e){n.includes(e)||r.push(e)}),r},validateURL:function(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}}},function(e,t,r){r(67);var n=r(2);"undefined"!=typeof window&&(window.AWS=n),e.exports=n,"undefined"!=typeof self&&(self.AWS=n)},function(e,t,r){"use strict";var n=r(116),i=r(302),o=Object.prototype.toString;function s(e){return"[object Array]"===o.call(e)}function a(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!==e&&void 0!==e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r2?e(Array.prototype.slice.call(arguments,1)):void e(n)})})}r.d(t,"a",function(){return n})}).call(this,r(6))},function(e,t,r){var n={util:r(7)};({}).toString(),e.exports=n,n.util.update(n,{VERSION:"2.656.0",Signers:{},Protocol:{Json:r(68),Query:r(103),Rest:r(45),RestJson:r(105),RestXml:r(106)},XML:{Builder:r(248),Parser:null},JSON:{Builder:r(69),Parser:r(70)},Model:{Api:r(107),Operation:r(108),Shape:r(36),Paginator:r(109),ResourceWaiter:r(110)},apiLoader:r(253),EndpointCache:r(254).EndpointCache}),r(112),r(256),r(259),r(115),r(260),r(262),r(264),r(265),r(266),r(273),n.events=new n.SequentialExecutor,n.util.memoizedProperty(n,"endpointCache",function(){return new n.EndpointCache(n.config.endpointCacheSize)},!0)},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n={BASEPATH_CONVERSATIONS:"/conversations",BASEPATH_USERS:"/users",BASEPATH_MESSAGES:"/messages",BASEPATH_FILES:"/files",BASEPATH_PUSH_NOTIFICATION_SETTINGS:"/push_notification_settings",BASEPATH_PUSH_NOTIFICATION_TOKENS:"/push_notification_tokens",LOCALSTORAGE_PREFIX:"channelize_storage_",ROLES:{ANONYMOUS:"anonymous",USER:"user"},ANONYMOUS_ID_PREFIX:"anonymous",ANONYMOUS_USER_DISPLAY_NAME:"Anonymous User"}},function(e,t,r){e.exports=function(){var e=e||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var r=new e;return t&&r.mixIn(t),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){var t=t,r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},s=0;s>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},c=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},l=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,s=this.blockSize,a=4*s,u=i/a,c=(u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0))*s,l=e.min(4*c,i);if(c){for(var f=0;f1)for(var r=1;r=e.length)return t.push(null);var i=r+n;i>e.length&&(i=e.length),t.push(e.slice(r,i)),r=i},t},concat:function(e){var t,r,n=0,i=0;for(r=0;r>>8^t[255&(r^e.readUInt8(n))]}return(-1^r)>>>0},hmac:function(e,t,r,n){return r||(r="binary"),"buffer"===r&&(r=void 0),n||(n="sha256"),"string"==typeof t&&(t=o.buffer.toBuffer(t)),o.crypto.lib.createHmac(n,e).update(t).digest(r)},md5:function(e,t,r){return o.crypto.hash("md5",e,t,r)},sha256:function(e,t,r){return o.crypto.hash("sha256",e,t,r)},hash:function(e,t,r,n){var i=o.crypto.createHash(e);r||(r="binary"),"buffer"===r&&(r=void 0),"string"==typeof t&&(t=o.buffer.toBuffer(t));var s=o.arraySliceFn(t),a=o.Buffer.isBuffer(t);if(o.isBrowser()&&"undefined"!=typeof ArrayBuffer&&t&&t.buffer instanceof ArrayBuffer&&(a=!0),n&&"object"==typeof t&&"function"==typeof t.on&&!a)t.on("data",function(e){i.update(e)}),t.on("error",function(e){n(e)}),t.on("end",function(){n(null,i.digest(r))});else{if(!n||!s||a||"undefined"==typeof FileReader){o.isBrowser()&&"object"==typeof t&&!a&&(t=new o.Buffer(new Uint8Array(t)));var u=i.update(t).digest(r);return n&&n(null,u),u}var c=0,l=new FileReader;l.onerror=function(){n(new Error("Failed to read data."))},l.onload=function(){var e=new o.Buffer(new Uint8Array(l.result));i.update(e),c+=e.length,l._continueReading()},l._continueReading=function(){if(c>=t.size)n(null,i.digest(r));else{var e=c+524288;e>t.size&&(e=t.size),l.readAsArrayBuffer(s.call(t,c,e))}},l._continueReading()}},toHex:function(e){for(var t=[],r=0;r=3e5,!1),i.config.isClockSkewed},applyClockOffset:function(e){e&&(i.config.systemClockOffset=e-(new Date).getTime())},extractRequestId:function(e){var t=e.httpResponse.headers["x-amz-request-id"]||e.httpResponse.headers["x-amzn-requestid"];!t&&e.data&&e.data.ResponseMetadata&&(t=e.data.ResponseMetadata.RequestId),t&&(e.requestId=t),e.error&&(e.error.requestId=t)},addPromises:function(e,t){var r=!1;void 0===t&&i&&i.config&&(t=i.config.getPromisesDependency()),void 0===t&&"undefined"!=typeof Promise&&(t=Promise),"function"!=typeof t&&(r=!0),Array.isArray(e)||(e=[e]);for(var n=0;n=0?(a++,setTimeout(c,i+(e.retryAfter||0))):r(e)},c=function(){var t="";n.handleRequest(e,s,function(e){e.on("data",function(e){t+=e.toString()}),e.on("end",function(){var n=e.statusCode;if(n<300)r(null,t);else{var i=1e3*parseInt(e.headers["retry-after"],10)||0,s=o.error(new Error,{statusCode:n,retryable:n>=500||429===n});i&&s.retryable&&(s.retryAfter=i),u(s)}})},u)};i.util.defer(c)},uuid:{v4:function(){return r(122).v4()}},convertPayloadToString:function(e){var t=e.request,r=t.operation,n=t.service.api.operations[r].output||{};n.payload&&e.data[n.payload]&&(e.data[n.payload]=e.data[n.payload].toString())},defer:function(e){"object"==typeof t&&"function"==typeof t.nextTick?t.nextTick(e):"function"==typeof n?n(e):setTimeout(e,0)},getRequestPayloadShape:function(e){var t=e.service.api.operations;if(t){var r=(t||{})[e.operation];if(r&&r.input&&r.input.payload)return r.input.members[r.input.payload]}},getProfilesFromSharedConfig:function(e,r){var n={},i={};if(t.env[o.configOptInEnv])i=e.loadFrom({isConfig:!0,filename:t.env[o.sharedConfigFileEnv]});for(var s=e.loadFrom({filename:r||t.env[o.configOptInEnv]&&t.env[o.sharedCredentialsFileEnv]}),a=0,u=Object.keys(i);a=6},parse:function(e){var t=e.split(":");return{partition:t[1],service:t[2],region:t[3],accountId:t[4],resource:t.slice(5).join(":")}},build:function(e){if(void 0===e.service||void 0===e.region||void 0===e.accountId||void 0===e.resource)throw o.error(new Error("Input ARN object is invalid"));return"arn:"+(e.partition||"aws")+":"+e.service+":"+e.region+":"+e.accountId+":"+e.resource}},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};e.exports=o}).call(this,r(6),r(81).setImmediate)},function(e,t,r){e.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,i=n.Base,o=n.WordArray,s=n.BufferedBlockAlgorithm,a=r.enc,u=(a.Utf8,a.Base64),c=r.algo,l=c.EvpKDF,f=n.Cipher=s.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?E:_}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()}),h=(n.StreamCipher=f.extend({_doFinalize:function(){var e=this._process(!0);return e},blockSize:1}),r.mode={}),p=n.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),d=h.CBC=function(){var e=p.extend();function r(e,r,n){var i=this._iv;if(i){var o=i;this._iv=t}else var o=this._prevBlock;for(var s=0;s>>2];e.sigBytes-=t}},m=(n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:d,padding:v}),reset:function(){f.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else{var n=r.createDecryptor;this._minBufferSize=1}this._mode=n.call(r,this,t&&t.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else{var t=this._process(!0);e.unpad(t)}return t},blockSize:4}),n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),g=r.format={},b=g.OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=o.create([1398893684,1701076831]).concat(r).concat(t);else var n=t;return n.toString(u)},parse:function(e){var t=u.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=o.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return m.create({ciphertext:t,salt:n})}},_=n.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),s=i.cfg;return m.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=e.createDecryptor(r,n).finalize(t.ciphertext);return i},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),w=r.kdf={},S=w.OpenSSL={execute:function(e,t,r,n){n||(n=o.random(8));var i=l.create({keySize:t+r}).compute(e,n),s=o.create(i.words.slice(t),4*r);return i.sigBytes=4*t,m.create({key:i,iv:s,salt:n})}},E=n.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:S}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var o=_.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);n.iv=i.iv;var o=_.decrypt.call(this,e,t,i.key,n);return o}})}()}(r(4))},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._client=t};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(n,"Client",void 0)},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n={sprintf:function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null;return Object.keys(t).forEach(function(t){e.includes(t)||(r=t)}),r},getRequiedFilter:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],n=Object.keys(t);return e.forEach(function(e){n.includes(e)||r.push(e)}),r},validateURL:function(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}}},function(e,t,r){r(67);var n=r(2);"undefined"!=typeof window&&(window.AWS=n),e.exports=n,"undefined"!=typeof self&&(self.AWS=n)},function(e,t,r){"use strict";var n=r(117),i=r(302),o=Object.prototype.toString;function s(e){return"[object Array]"===o.call(e)}function a(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!==e&&void 0!==e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r + * @author Feross Aboukhadijeh * @license MIT - */var n=r(130),i=r(131),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|y(e,t),n=a(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return h(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer))return p(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);var i=function(e){if(u.isBuffer(e)){var t=0|d(e.length),r=a(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?a(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return l(e),a(e<0?0:0|d(e))}function h(e){for(var t=e.length<0?0:0|d(e.length),r=a(t),n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:q(e).length;t=(""+t).toLowerCase(),i=!0}}function v(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var f=!0,h=0;hi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,i){if(F(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),c=this.slice(n,i),l=e.slice(t,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||N(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||N(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function F(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}var H=function(){for(var e=new Array(256),t=0;t<16;++t)for(var r=16*t,n=0;n<16;++n)e[r+n]="0123456789abcdef"[t]+"0123456789abcdef"[n];return e}()},function(e,t,r){"use strict";var n=r(27),i=r(87),o=r(59),s=r(88),a=r(89);(e.exports=function(e,t){var r,i,u,c,l;return arguments.length<2||"string"!=typeof e?(c=t,t=e,e=null):c=arguments[2],n(e)?(r=a.call(e,"c"),i=a.call(e,"e"),u=a.call(e,"w")):(r=u=!0,i=!1),l={value:t,configurable:r,enumerable:i,writable:u},c?o(s(c),l):l}).gs=function(e,t,r){var u,c,l,f;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],n(t)?i(t)?n(r)?i(r)||(l=r,r=void 0):r=void 0:(l=t,t=r=void 0):t=void 0,n(e)?(u=a.call(e,"c"),c=a.call(e,"e")):(u=!0,c=!1),f={get:t,set:r,configurable:u,enumerable:c},l?o(s(l),f):f}},function(e,t,r){"use strict";function n(e,t){for(var r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,function(e){console&&console.warn&&console.warn(e)}(a)}return e}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=function(){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)}.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=y(u,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){"use strict";var n=r(26);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,r){"use strict";r.d(t,"a",function(){return d});var n=r(31),i=r(0),o=r(4),s=r(1),a=r(50);function u(e){"@babel/helpers - typeof";return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){for(var r=0;r=0;i-=1)t._client.Cache.get(r[i])&&(n.push(t._client.Cache.get(r[i])),r.splice(i,1));if(!r.length)return e(null,n);t._client.request("/get_url_meta_data",{method:"post",data:{urls:r}}).then(function(r){return r.data.forEach(function(e){t._client.Cache.set(e.url,e)}),e(null,r.data.concat(n))}).catch(function(r){return e(t._client.error(r))})})}},{key:"createReactionUserListQuery",value:function(){return new a.a(this._client,this.id)}}]),r}();p(d,"__properties",{id:null,type:null,customType:null,attachments:[],body:null,conversationId:null,ownerId:null,owner:{},mentionedUsers:[],isDeleted:null,createdAt:null,updatedAt:null,refMsgId:null,metaData:null,parentId:null,parentMessage:{},originalMessageId:null,reactionsCount:{},reactions:{},replyCount:null,showInConversation:null}),p(d,"basePath",o.a.BASEPATH_MESSAGES)},function(e,t,r){"use strict";r.d(t,"a",function(){return k});var n=r(31),i=r(32),o=r(4),s=r(0),a=r(10),u=r(51),c=r(17),l=r(5),f=r(1);function h(e){"@babel/helpers - typeof";return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null,t=this.config||{};return t=function(e){for(var t=1;t=t.lastReadAt[n]&&e.ownerId!=n&&(r=!1)}),r}},{key:"on",value:function(e,t){if(this.__isWatchingEvent(e)&&!this.__isWatching)return function(e){throw new Error(s["a"].REQUIRED_WATCHING_CONVERSATION)}();this._client.chsocket.on(e,this.id,t)}},{key:"__isWatchingEvent",value:function(e){return this.__watchingEvents.includes(e)}},{key:"off",value:function(e,t){this._client.chsocket.off(e,this.id,t)}},{key:"startWatching",value:function(e){var t=this;return Object(f.a)(e,function(e){t._client.request(r.basePath+"/"+t.id+"/start_watching",{method:"post"}).then(function(r){return t.__isWatching=!0,e(null,r.data)}).catch(function(r){return e(t._client.error(r))})})}},{key:"stopWatching",value:function(e){var t=this;return Object(f.a)(e,function(e){t._client.request(r.basePath+"/"+t.id+"/stop_watching",{method:"post"}).then(function(r){return t.__isWatching=!1,e(null,r.data)}).catch(function(r){return e(t._client.error(r))})})}},{key:"createWatchersListQuery",value:function(){return new m(this._client,this.id)}},{key:"createMessageListQuery",value:function(){return new u.a(this._client,this.id)}}]),r}();A(k,"__properties",{id:null,type:null,config:{},customType:null,metaData:{},lastMessage:{},lastReadAt:{},title:null,isGroup:null,createdAt:null,memberCount:0,ownerId:null,members:[],profileImageUrl:null,isActive:null,isAdmin:null,isDeleted:null,mute:null,unreadMessageCount:null,updatedAt:null,user:{},watchersCount:0}),A(k,"basePath",o.a.BASEPATH_CONVERSATIONS)},function(e,t,r){"use strict";e.exports=r(162)()?r(40).Symbol:r(165)},function(e,t,r){"use strict";var n=r(34),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var o=Object.create(r(35));o.inherits=r(13);var s=r(76),a=r(79);o.inherits(f,s);for(var u=i(a.prototype),c=0;c>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,i=n.charAt(64);if(i){var o=e.indexOf(i);-1!=o&&(t=o)}for(var s=[],a=0,u=0;u>>6-u%4*2;s[a>>>2]|=c<<24-a%4*8,a++}return r.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(r(3))},function(e,t,r){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var u=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=e[t+0],u=e[t+1],p=e[t+2],d=e[t+3],y=e[t+4],v=e[t+5],m=e[t+6],g=e[t+7],b=e[t+8],_=e[t+9],w=e[t+10],E=e[t+11],S=e[t+12],I=e[t+13],A=e[t+14],k=e[t+15],C=o[0],O=o[1],x=o[2],T=o[3];O=h(O=h(O=h(O=h(O=f(O=f(O=f(O=f(O=l(O=l(O=l(O=l(O=c(O=c(O=c(O=c(O,x=c(x,T=c(T,C=c(C,O,x,T,s,7,a[0]),O,x,u,12,a[1]),C,O,p,17,a[2]),T,C,d,22,a[3]),x=c(x,T=c(T,C=c(C,O,x,T,y,7,a[4]),O,x,v,12,a[5]),C,O,m,17,a[6]),T,C,g,22,a[7]),x=c(x,T=c(T,C=c(C,O,x,T,b,7,a[8]),O,x,_,12,a[9]),C,O,w,17,a[10]),T,C,E,22,a[11]),x=c(x,T=c(T,C=c(C,O,x,T,S,7,a[12]),O,x,I,12,a[13]),C,O,A,17,a[14]),T,C,k,22,a[15]),x=l(x,T=l(T,C=l(C,O,x,T,u,5,a[16]),O,x,m,9,a[17]),C,O,E,14,a[18]),T,C,s,20,a[19]),x=l(x,T=l(T,C=l(C,O,x,T,v,5,a[20]),O,x,w,9,a[21]),C,O,k,14,a[22]),T,C,y,20,a[23]),x=l(x,T=l(T,C=l(C,O,x,T,_,5,a[24]),O,x,A,9,a[25]),C,O,d,14,a[26]),T,C,b,20,a[27]),x=l(x,T=l(T,C=l(C,O,x,T,I,5,a[28]),O,x,p,9,a[29]),C,O,g,14,a[30]),T,C,S,20,a[31]),x=f(x,T=f(T,C=f(C,O,x,T,v,4,a[32]),O,x,b,11,a[33]),C,O,E,16,a[34]),T,C,A,23,a[35]),x=f(x,T=f(T,C=f(C,O,x,T,u,4,a[36]),O,x,y,11,a[37]),C,O,g,16,a[38]),T,C,w,23,a[39]),x=f(x,T=f(T,C=f(C,O,x,T,I,4,a[40]),O,x,s,11,a[41]),C,O,d,16,a[42]),T,C,m,23,a[43]),x=f(x,T=f(T,C=f(C,O,x,T,_,4,a[44]),O,x,S,11,a[45]),C,O,k,16,a[46]),T,C,p,23,a[47]),x=h(x,T=h(T,C=h(C,O,x,T,s,6,a[48]),O,x,g,10,a[49]),C,O,A,15,a[50]),T,C,v,21,a[51]),x=h(x,T=h(T,C=h(C,O,x,T,S,6,a[52]),O,x,d,10,a[53]),C,O,w,15,a[54]),T,C,u,21,a[55]),x=h(x,T=h(T,C=h(C,O,x,T,b,6,a[56]),O,x,k,10,a[57]),C,O,m,15,a[58]),T,C,I,21,a[59]),x=h(x,T=h(T,C=h(C,O,x,T,y,6,a[60]),O,x,E,10,a[61]),C,O,p,15,a[62]),T,C,_,21,a[63]),o[0]=o[0]+C|0,o[1]=o[1]+O|0,o[2]=o[2]+x|0,o[3]=o[3]+T|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var o=t.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,n,i,o,s){var a=e+(t&r|~t&n)+i+s;return(a<>>32-o)+t}function l(e,t,r,n,i,o,s){var a=e+(t&n|r&~n)+i+s;return(a<>>32-o)+t}function f(e,t,r,n,i,o,s){var a=e+(t^r^n)+i+s;return(a<>>32-o)+t}function h(e,t,r,n,i,o,s){var a=e+(r^(t|~n))+i+s;return(a<>>32-o)+t}r.MD5=o._createHelper(u),r.HmacMD5=o._createHmacHelper(u)}(Math),e.MD5}(r(3))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,o=t.algo,s=o.MD5,a=o.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),o=i.create(),s=o.words,a=r.keySize,u=r.iterations;s.length=0;t--){if(a.a.getRequiedFilter(["userId","order","wordCount"],e.mentionedUsers[t]).length)return function(e){throw new Error(s["a"].INVALID_MESSAGE_MENTIONED_USERS)}()}}e.parentId&&!e.type?e.type="reply":e.type=e.type?e.type:"normal"}}]),r}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(d,"basePath",o.a.BASEPATH_MESSAGES)},function(e,t,r){(function(e){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&t._extend(n,r),g(n.showHidden)&&(n.showHidden=!1),g(n.depth)&&(n.depth=2),g(n.colors)&&(n.colors=!1),g(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function l(e,r,n){if(e.customInspect&&r&&S(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return m(i)||(i=l(e,i,n)),i}var o=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(m(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(v(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),E(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(r);if(0===s.length){if(S(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(b(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E(r))return f(r)}var c,_="",I=!1,A=["{","}"];(p(r)&&(I=!0,A=["[","]"]),S(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),E(r)&&(_=" "+f(r)),0!==s.length||I&&0!=r.length?n<0?b(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=I?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,_,A)):A[0]+_+A[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),C(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=y(r)?l(e,u.value,null):l(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),g(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function y(e){return null===e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function g(e){return void 0===e}function b(e){return _(e)&&"[object RegExp]"===I(e)}function _(e){return"object"==typeof e&&null!==e}function w(e){return _(e)&&"[object Date]"===I(e)}function E(e){return _(e)&&("[object Error]"===I(e)||e instanceof Error)}function S(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(g(o)&&(o=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=e.pid;s[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else s[r]=function(){};return s[r]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=v,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=g,t.isRegExp=b,t.isObject=_,t.isDate=w,t.isError=E,t.isFunction=S,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(126);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",function(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),k[e.getMonth()],t].join(" ")}(),t.format.apply(t,arguments))},t.inherits=r(13),t._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var O="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function x(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(O&&e[O]){var t;if("function"!=typeof(t=e[O]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise(function(e,n){t=e,r=n}),i=[],o=0;o-1?t||"":t,this.isJsonValue?JSON.parse(t):t&&"function"==typeof t.toString?t.toString():t},this.toWireFormat=function(e){return this.isJsonValue?JSON.stringify(e):e}}function p(){a.apply(this,arguments),this.toType=function(e){var t=i.base64.decode(e);if(this.isSensitive&&i.isNode()&&"function"==typeof i.Buffer.alloc){var r=i.Buffer.alloc(t.length,t);t.fill(0),t=r}return t},this.toWireFormat=i.base64.encode}function d(){p.apply(this,arguments)}function y(){a.apply(this,arguments),this.toType=function(e){return"boolean"==typeof e?e:null===e||void 0===e?null:"true"===e}}a.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"},a.types={structure:c,list:l,map:f,boolean:y,timestamp:function(e){var t=this;if(a.apply(this,arguments),e.timestampFormat)o(this,"timestampFormat",e.timestampFormat);else if(t.isTimestampFormatSet&&this.timestampFormat)o(this,"timestampFormat",this.timestampFormat);else if("header"===this.location)o(this,"timestampFormat","rfc822");else if("querystring"===this.location)o(this,"timestampFormat","iso8601");else if(this.api)switch(this.api.protocol){case"json":case"rest-json":o(this,"timestampFormat","unixTimestamp");break;case"rest-xml":case"query":case"ec2":o(this,"timestampFormat","iso8601")}this.toType=function(e){return null===e||void 0===e?null:"function"==typeof e.toUTCString?e:"string"==typeof e||"number"==typeof e?i.date.parseTimestamp(e):null},this.toWireFormat=function(e){return i.date.format(e,t.timestampFormat)}},float:function(){a.apply(this,arguments),this.toType=function(e){return null===e||void 0===e?null:parseFloat(e)},this.toWireFormat=this.toType},integer:function(){a.apply(this,arguments),this.toType=function(e){return null===e||void 0===e?null:parseInt(e,10)},this.toWireFormat=this.toType},string:h,base64:d,binary:p},a.resolve=function(e,t){if(e.shape){var r=t.api.shapes[e.shape];if(!r)throw new Error("Cannot find shape reference: "+e.shape);return r}return null},a.create=function(e,t,r){if(e.isShape)return e;var n=a.resolve(e,t);if(n){var i=Object.keys(e);t.documentation||(i=i.filter(function(e){return!e.match(/documentation/)}));var o=function(){n.constructor.call(this,e,t,r)};return o.prototype=n,new o}e.type||(e.members?e.type="structure":e.member?e.type="list":e.key?e.type="map":e.type="string");var s=e.type;if(a.normalizedTypes[e.type]&&(e.type=a.normalizedTypes[e.type]),a.types[e.type])return new a.types[e.type](e,t,r);throw new Error("Unrecognized shape type: "+s)},a.shapes={StructureShape:c,ListShape:l,MapShape:f,StringShape:h,BooleanShape:y,Base64Shape:d},e.exports=a},function(e,t,r){r(67);var n=r(2),i=n.Service,o=n.apiLoader;o.services.sts={},n.STS=i.defineService("sts",["2011-06-15"]),r(287),Object.defineProperty(o.services.sts,"2011-06-15",{get:function(){var e=r(289);return e.paginators=r(290).pagination,e},enumerable:!0,configurable:!0}),e.exports=n.STS},function(e,t,r){(t=e.exports=r(76)).Stream=t,t.Readable=t,t.Writable=r(79),t.Duplex=r(24),t.Transform=r(82),t.PassThrough=r(137)},function(e,t,r){"use strict";e.exports=r(85)()?Object.setPrototypeOf:r(86)},function(e,t,r){"use strict";e.exports=r(163)()?globalThis:r(164)},function(e,t,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());e.exports=function(e){return n.call(e)===i}},function(e,t,r){"use strict";var n=Object.prototype.toString,i=n.call("");e.exports=function(e){return"string"==typeof e||e&&"object"==typeof e&&(e instanceof String||n.call(e)===i)||!1}},function(e,t,r){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.Base,o=n.WordArray,s=r.x64={};s.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),s.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n=0?"&":"?";var u=[];n.arrayEach(Object.keys(s).sort(),function(e){Array.isArray(s[e])||(s[e]=[s[e]]);for(var t=0;t-1});var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object DataView]"];e.exports={isEmptyData:function(e){return"string"==typeof e?0===e.length:0===e.byteLength},convertToBuffer:function(e){return"string"==typeof e&&(e=new n(e,"utf8")),ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}},function(e,t,r){"use strict";r.d(t,"a",function(){return d});var n=r(9),i=r(5),o=r(4),s=r(0),a=r(48),u=r(1);function c(e){"@babel/helpers - typeof";return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),P(this,"__socketClass",k),P(this,"__socket",void 0),P(this,"__events",{connected:{topic:"connected"},disconnected:{topic:"disconnected"},reconnected:{topic:"reconnected"},"conversation.updated":{topic:"users/[login_user]/conversation/updated"},"conversation.members_added":{topic:"users/[login_user]/conversation/members_added"},"conversation.members_removed":{topic:"users/[login_user]/conversation/members_removed"},"conversation.admin_added":{topic:"users/[login_user]/conversation/admin_added"},"conversation.admin_removed":{topic:"users/[login_user]/conversation/admin_removed"},"conversation.typing":{topic:"users/[login_user]/conversation/typing"},"conversation.mark_as_read":{topic:"users/[login_user]/conversation/mark_as_read"},"message.deleted_for_everyone":{topic:"users/[login_user]/messages/deleted_for_everyone"},"user.friends_added":{topic:"users/[login_user]/friends_added"},"user.friends_removed":{topic:"users/[login_user]/friends_removed"},"user.blocked":{topic:"users/[login_user]/blocked"},"user.unblocked":{topic:"users/[login_user]/unblocked"},"user.conversation_deleted":{topic:"users/[login_user]/conversation_deleted"},"user.conversation_cleared":{topic:"users/[login_user]/conversation_cleared"},"user.mute_updated":{topic:"users/[login_user]/mute_updated"},"user.joined":{topic:"users/[login_user]/joined"},"user.removed":{topic:"users/[login_user]/removed"},"user.message_created":{topic:"users/[login_user]/message_created"},"user.message_deleted":{topic:"users/[login_user]/message_deleted"},"user.total_unread_message_count_updated":{topic:"users/[login_user]/total_unread_message_count_updated"},"user.status_updated":{topic:"users/status_updated"},"user.updated":{topic:"users/updated"},"reaction.added":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/reaction_added"},"reaction.removed":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/reaction_removed"},"watcher.conversation.start_watching":{vars:["conversation_id"],topic:"conversations/[conversation_id]/start_watching"},"watcher.conversation.stop_watching":{vars:["conversation_id"],topic:"conversations/[conversation_id]/stop_watching"},"watcher.message.created":{vars:["conversation_id"],topic:"conversations/[conversation_id]/message_created"},"watcher.message.deleted_for_everyone":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/deleted_for_everyone"}}),P(this,"allowForceResubscribe",!1),P(this,"__baseEvents",["connected","disconnected","reconnected"]),P(this,"__subscribedTopics",{}),P(this,"__preConnectEvents",[]),this.__socket=new this.__socketClass(this),this.__connected=!1,this.__autoSubscribed=!1,this.__publicKey=t.publicKey}return function(e,t,r){t&&R(e.prototype,t),r&&R(e,r)}(e,[{key:"connect",value:function(e,t,r){var n=this;return Object(f.a)(r,function(r){n.__userId=e,n.__socket.connect(e,t,r)})}},{key:"__onConnected",value:function(e){this.__connected=!0,e?this.__trigger("reconnected",null):this.__trigger("connected",null),this.allowForceResubscribe&&e&&this.__autoSubscribed?this.__resubscribe():this.__autoSubscribed||this.__subscribeAll(),this.__preConnectSubscribe(),this.__setUserOnline()}},{key:"__onConnectionLost",value:function(e){this.__connected=!1,this.__trigger("disconnected",e)}},{key:"__disconnect",value:function(){this.__socket.__disconnect()}},{key:"__validate",value:function(e,t,r){if(!this.__isSupported(e))return function(t){throw new Error(C["a"].sprintf(l["a"].INVALID_EVENT,e))}();if(!this.__hasDependencyVars(e))return!0;this.__events[e].vars.forEach(function(r){if(!t[r])return function(t){throw new Error(C["a"].sprintf(l["a"].REQUIRED_SOCKET_EVENT_PARAM,r,e))}()});var n="__validate"+this.__capitalize(e);if("function"==typeof this[n]){var i=this[n](e,t);if(i.error)return function(e){throw new Error(i["message"])}()}}},{key:"on",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),r=e.pop(),n={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach(function(t){n[t]=e.shift()}),this.__validate(t,n,r),this.__isConnected()||this.__isBaseEvent(t)?this.__subscribe(t,n,r):this.__preConnectAdd(t,n,r)}},{key:"off",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),r=e.pop(),n={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach(function(t){n[t]=e.shift()}),this.__validate(t,n,r),!this.__isConnected()&&this.__isBaseEvent(t)||this.__unSubscribe(t,n,r)}},{key:"__preConnectAdd",value:function(e,t,r){this.__preConnectEvents.push({event:e,params:t,cb:r})}},{key:"__isBaseEvent",value:function(e){return this.__baseEvents.includes(e)}},{key:"__isConnected",value:function(){return this.__connected}},{key:"__preConnectSubscribe",value:function(){for(var e;e=this.__preConnectEvents.shift();)this.__subscribe(e.event,e.params,e.cb)}},{key:"__getEventTopic",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.__events[e].topic,i=this.__events[e].vars;return Array.isArray(n)?n.map(function(e){return t.__replaceTopicVar(e,i,r)}):this.__replaceTopicVar(n,i,r)}},{key:"__isSubscribed",value:function(e){return this.__subscribedTopics.hasOwnProperty(e)}},{key:"__isSupported",value:function(e){return this.__events.hasOwnProperty(e)}},{key:"__hasDependencyVars",value:function(e){return this.__events[e]&&this.__events[e].hasOwnProperty("vars")&&this.__events[e].vars.length}},{key:"__subscribe",value:function(e,t,r){var n=this,i=this.__getEventTopic(e,t);(Array.isArray(i)?i:[i]).forEach(function(t){n.__isSubscribed(t)||(n.__isBaseEvent(e)||n.__subscribeSocket(t),n.__subscribedTopics[t]={event:e,cb:[]}),r&&"function"==typeof r&&n.__subscribedTopics[t].cb.push(r)})}},{key:"__unSubscribe",value:function(e,t,r){var n=this,i=this.__getEventTopic(e,t);(Array.isArray(i)?i:[i]).forEach(function(t){n.__isSubscribed(t)&&(n.__isBaseEvent(e)||n.__unSubscribeSocket(t),delete n.__subscribedTopics[t])})}},{key:"__subscribeSocket",value:function(e){this.__socket.__subscribe(this.__publicKey+"/"+e)}},{key:"__unSubscribeSocket",value:function(e){this.__socket.__unsubscribe(this.__publicKey+"/"+e)}},{key:"__publishSocket",value:function(e,t){t=this.__addDefaultProperties(t),e=e.replace("[login_user]",this.__userId),this.__socket.__publish(this.__publicKey+"/"+e,JSON.stringify(t))}},{key:"__addDefaultProperties",value:function(e){return Object.assign(e,{version:"v2"})}},{key:"__subscribeAll",value:function(){var e=this;Object.keys(this.__events).forEach(function(t){e.__hasDependencyVars(t)||e.__subscribe(t,null)}),this.__autoSubscribed=!0}},{key:"__resubscribe",value:function(){var e=this;Object.keys(this.__subscribedTopics).forEach(function(t){var r=e.__subscribedTopics[t].event;e.__isBaseEvent(r)||e.__subscribeSocket(t)})}},{key:"__trigger",value:function(e,t){e=e.replace(this.__publicKey+"/",""),this.__isSubscribed(e)&&this.__subscribedTopics[e].cb.forEach(function(e){e(t)})}},{key:"__processPayload",value:function(e,t){var r=this.__subscribedTopics[e].event;return"function"==typeof T[r]?T[r](e,t):[t]}},{key:"__replaceTopicVar",value:function(e,t,r){return e=e.replace("[login_user]",this.__userId),t&&t.length?(t.forEach(function(t){e=e.replace("["+t+"]",r[t])}),e):e}},{key:"__capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"__validateUserUpdated",value:function(e,t){return{error:"string"!=typeof t.user_id,message:"User Id should be string"}}},{key:"__setUserOnline",value:function(){this.__publishSocket("users/server/online",{userId:this.__userId})}}]),e}(),L=r(122),j=r.n(L);function D(e,t){for(var r=0;r9?e:"0"+e}function p(e,t,r,n,i,o,a,c,l,f,h,p,d,y){var v=e+"\n"+n+"\n"+i+"\n"+("host:"+r.toLowerCase()+"\n")+"\nhost\n"+s.SHA256(f,{asBytes:!0});!0===d&&console.log("canonical request: "+v+"\n");var m=s.SHA256(v,{asBytes:!0});!0===d&&console.log("hashed canonical request: "+m+"\n");var g="AWS4-HMAC-SHA256\n"+p+"\n"+h+"/"+c+"/"+l+"/aws4_request\n"+m;!0===d&&console.log("string to sign: "+g+"\n");var b=function(e,t,r,n){var i=s.HmacSHA256(t,"AWS4"+e,{asBytes:!0}),o=s.HmacSHA256(r,i,{asBytes:!0}),a=s.HmacSHA256(n,o,{asBytes:!0});return s.HmacSHA256("aws4_request",a,{asBytes:!0})}(a,h,c,l);!0===d&&console.log("signing key: "+b+"\n");var _=s.HmacSHA256(g,b,{asBytes:!0});!0===d&&console.log("signature: "+_+"\n");var w=i+"&X-Amz-Signature="+_;u(y)||(w+="&X-Amz-Security-Token="+encodeURIComponent(y));var E=t+r+n+"?"+w;return!0===d&&console.log("url: "+E+"\n"),E}function d(e,t,r,n){var i=function(){var e=new Date;return e.getUTCFullYear()+""+h(e.getUTCMonth()+1)+h(e.getUTCDate())+"T"+h(e.getUTCHours())+h(e.getUTCMinutes())+h(e.getUTCSeconds())+"Z"}(),o=function(e){return e.substring(0,e.indexOf("T"))}(i),s="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+t+"%2F"+o+"%2F"+e.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+i+"&X-Amz-SignedHeaders=host",a=e.host;return u(e.port)||443===e.port||(a=e.host+":"+e.port),p("GET","wss://",a,"/mqtt",s,0,r,e.region,"iotdevicegateway","",o,i,e.debug,n)}function y(e){var t=e.host;return u(e.port)||443===e.port||(t=e.host+":"+e.port),"wss://"+t+"/mqtt"}function v(e){var t={},r={};return function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(this,e[r],parseInt(r,10))}(e.split(/\r?\n/),function(e){var n=(e=e.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);if(n)r=n[1];else if(r){var i=e.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);i&&(t[r]=t[r]||{},t[r][i[1]]=i[2])}}),t}function m(e){if(!(this instanceof m))return new m(e);var n=this,i=[],s=!0,h=0,p="oldest";i.length=0;var g=[];g.length=0;var b=[],_=!0;b.length=0;var w=[];w.length=0;var E,S,I,A,k="inactive",C=null,O=250,x=1e3,T=2e4,R=128e3,P=null,N="?SDK=JavaScript&Version="+r(242).version;if(u(e)||0===Object.keys(e).length)throw new Error(a.INVALID_CONNECT_OPTIONS);if(u(e.keepalive)&&(e.keepalive=300),(u(e.enableMetrics)||!0===e.enableMetrics)&&(u(e.username)?e.username=N:e.username+=N),u(e.baseReconnectTimeMs)||(x=e.baseReconnectTimeMs),u(e.minimumConnectionTimeMs)||(T=e.minimumConnectionTimeMs),u(e.maximumReconnectTimeMs)||(R=e.maximumReconnectTimeMs),u(e.drainTimeMs)||(O=e.drainTimeMs),u(e.autoResubscribe)||(_=e.autoResubscribe),u(e.offlineQueueing)||(s=e.offlineQueueing),u(e.offlineQueueMaxSize)||(h=e.offlineQueueMaxSize),u(e.offlineQueueDropBehavior)||(p=e.offlineQueueDropBehavior),E=x,e.reconnectPeriod=E,e.fastDisconnectDetection=!0,e.resubscribe=!1,e.baseReconnectTimeMs<=0)throw new Error(a.INVALID_RECONNECT_TIMING);if(R0&&i.length>=h&&("oldest"===p?i.shift():e=!1),e}()&&i.push({topic:e,message:t,options:r,callback:n})},this.subscribe=function(e,t,r){z()&&!1!==_?g.length<50?g.push({type:"subscribe",topics:e,options:t,callback:r}):n.emit("error",new Error("Maximum queued offline subscription reached")):(F("subscribe",e,t),u(r)?H.subscribe(e,t):H.subscribe(e,t,r))},this.unsubscribe=function(t,r){z()&&!1!==_?g.length<50&&g.push({type:"unsubscribe",topics:t,options:e,callback:r}):(F("unsubscribe",t),H.unsubscribe(t,r))},this.end=function(e,t){H.end(e,t)},this.handleMessage=H.handleMessage.bind(H),H.handleMessage=function(e,t){n.handleMessage(e,t)},this.updateWebSocketCredentials=function(e,t,r,n){S=e,I=t,A=r},this.getWebsocketHeaders=function(){return e.websocketOptions.headers},this.updateCustomAuthHeaders=function(t){e.websocketOptions.headers=t},this.simulateNetworkFailure=function(){H.stream.emit("error",new Error("simulated connection error")),H.stream.end()}}i(m,n.EventEmitter),e.exports=m,e.exports.DeviceClient=m,e.exports.prepareWebSocketUrl=d,e.exports.prepareWebSocketCustomAuthUrl=y}).call(this,r(6))},function(e,t){e.exports=function(){for(var e={},t=0;t=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach(function(t,r){t>=e&&(this.__redo__[r]=++t)},this),this.__redo__.push(e)):f(this,"__redo__",u("c",[e])))}),_onDelete:u(function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(t=this.__redo__.indexOf(e))&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,r){t>e&&(this.__redo__[r]=--t)},this)))}),_onClear:u(function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0})}))),f(n.prototype,l.iterator,u(function(){return this}))},function(e,t,r){"use strict";var n=r(204),i=r(206);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),h=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=r(96);function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?N+="x":N+=P[L];if(!N.match(p)){var D=T.slice(0,C),M=T.slice(C+1),q=P.match(d);q&&(D.push(q[1]),M.unshift(q[2])),M.length&&(b="/"+M.join(".")+b),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+U,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[E])for(C=0,R=l.length;C0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=S.slice(-1)[0],k=(r.host||e.host||S.length>1)&&("."===A||".."===A)||""===A,C=0,O=S.length;O>=0;O--)"."===(A=S[O])?S.splice(O,1):".."===A?(S.splice(O,1),C++):C&&(S.splice(O,1),C--);if(!w&&!E)for(;C--;C)S.unshift("..");!w||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),k&&"/"!==S.join("/").substr(-1)&&S.push("");var x,T=""===S[0]||S[0]&&"/"===S[0].charAt(0);I&&(r.hostname=r.host=T?"":S.length?S.shift():"",(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift()));return(w=w||r.host&&S.length)&&!T&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";var n=r(210);e.exports=function(e,t){var r;function i(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,(r=n.connect(t)).on("secureConnect",function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i)}),r.on("error",i),r}},function(e,t,r){"use strict";(function(t,n){var i=r(38).Transform,o=r(211),s=r(213),a=r(14).Buffer;e.exports=function(e,r,u){var c,l,f="browser"===t.title,h=!!n.WebSocket,p=f?function e(t,r,n){if(l.bufferedAmount>y)return void setTimeout(e,v,t,r,n);g&&"string"==typeof t&&(t=a.from(t,"utf8"));try{l.send(t)}catch(e){return n(e)}n()}:function(e,t,r){if(l.readyState!==l.OPEN)return void r();g&&"string"==typeof e&&(e=a.from(e,"utf8"));l.send(e,r)};r&&!Array.isArray(r)&&"object"==typeof r&&(u=r,r=null,("string"==typeof u.protocol||Array.isArray(u.protocol))&&(r=u.protocol));u||(u={});void 0===u.objectMode&&(u.objectMode=!(!0===u.binary||void 0===u.binary));var d=function(e,t,r){var n=new i({objectMode:e.objectMode});return n._write=t,n._flush=r,n}(u,p,function(e){l.close(),e()});u.objectMode||(d._writev=S);var y=u.browserBufferSize||524288,v=u.browserBufferTimeout||1e3;"object"==typeof e?l=e:(l=h&&f?new s(e,r):new s(e,r,u)).binaryType="arraybuffer";var m=void 0===l.addEventListener;l.readyState===l.OPEN?c=d:(c=c=o(void 0,void 0,u),u.objectMode||(c._writev=S),m?l.addEventListener("open",b):l.onopen=b);c.socket=l,m?(l.addEventListener("close",_),l.addEventListener("error",w),l.addEventListener("message",E)):(l.onclose=_,l.onerror=w,l.onmessage=E);d.on("close",function(){l.close()});var g=!u.objectMode;function b(){c.setReadable(d),c.setWritable(d),c.emit("connect")}function _(){c.end(),c.destroy()}function w(e){c.destroy(e)}function E(e){var t=e.data;t=t instanceof ArrayBuffer?a.from(t):a.from(t,"utf8"),d.push(t)}function S(e,t){for(var r=new Array(e.length),n=0;n>>31}var f=(n<<5|n>>>27)+u+o[c];f+=c<20?1518500249+(i&s|~i&a):c<40?1859775393+(i^s^a):c<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,u=a,a=s,s=i<<30|i>>>2,i=n,n=f}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s)}(),e.SHA1}(r(3))},function(e,t,r){e.exports=function(e){!function(){var t=e,r=t.lib,n=r.Base,i=t.enc,o=i.Utf8,s=t.algo;s.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),s=this._iKey=t.clone(),a=i.words,u=s.words,c=0;c0)try{var i=JSON.parse(r.body.toString());(i.__type||i.code)&&(t.code=(i.__type||i.code).split("#").pop()),"RequestEntityTooLarge"===t.code?t.message="Request body must be less than 1 MB":t.message=i.message||i.Message||null}catch(i){t.statusCode=r.statusCode,t.message=r.statusMessage}else t.statusCode=r.statusCode,t.message=r.statusCode.toString();e.error=n.error(new Error,t)},extractData:function(e){var t=e.httpResponse.body.toString()||"{}";if(!1===e.request.service.config.convertResponseTypes)e.data=JSON.parse(t);else{var r=e.request.service.api.operations[e.request.operation].output||{},n=new o;e.data=n.parse(t,r)}}}},function(e,t,r){var n=r(7);function i(){}function o(e,t){if(t&&void 0!==e&&null!==e)switch(t.type){case"structure":return function(e,t){var r={};return n.each(e,function(e,n){var i=t.members[e];if(i){if("body"!==i.location)return;var s=i.isLocationName?i.name:e,a=o(n,i);void 0!==a&&(r[s]=a)}}),r}(e,t);case"map":return function(e,t){var r={};return n.each(e,function(e,n){var i=o(n,t.value);void 0!==i&&(r[e]=i)}),r}(e,t);case"list":return function(e,t){var r=[];return n.arrayEach(e,function(e){var n=o(e,t.member);void 0!==n&&r.push(n)}),r}(e,t);default:return function(e,t){return t.toWireFormat(e)}(e,t)}}i.prototype.build=function(e,t){return JSON.stringify(o(e,t))},e.exports=i},function(e,t,r){var n=r(7);function i(){}function o(e,t){if(t&&void 0!==e)switch(t.type){case"structure":return function(e,t){if(null==e)return;var r={},i=t.members;return n.each(i,function(t,n){var i=n.isLocationName?n.name:t;if(Object.prototype.hasOwnProperty.call(e,i)){var s=o(e[i],n);void 0!==s&&(r[t]=s)}}),r}(e,t);case"map":return function(e,t){if(null==e)return;var r={};return n.each(e,function(e,n){var i=o(n,t.value);r[e]=void 0===i?null:i}),r}(e,t);case"list":return function(e,t){if(null==e)return;var r=[];return n.arrayEach(e,function(e){var n=o(e,t.member);void 0===n?r.push(null):r.push(n)}),r}(e,t);default:return function(e,t){return t.toType(e)}(e,t)}}i.prototype.parse=function(e,t){return o(JSON.parse(e),t)},e.exports=i},function(e,t,r){var n=r(7),i=r(2);e.exports={populateHostPrefix:function(e){if(!e.service.config.hostPrefixEnabled)return e;var t=e.service.api.operations[e.operation];if(function(e){var t=e.service.api,r=t.operations[e.operation],i=t.endpointOperation&&t.endpointOperation===n.string.lowerFirst(r.name);return"NULL"!==r.endpointDiscoveryRequired||!0===i}(e))return e;if(t.endpoint&&t.endpoint.hostPrefix){var r=function(e,t,r){return n.each(r.members,function(r,i){if(!0===i.hostLabel){if("string"!=typeof t[r]||""===t[r])throw n.error(new Error,{message:"Parameter "+r+" should be a non-empty string.",code:"InvalidParameter"});var o=new RegExp("\\{"+r+"\\}","g");e=e.replace(o,t[r])}}),e}(t.endpoint.hostPrefix,e.params,t.input);!function(e,t){e.host&&(e.host=t+e.host),e.hostname&&(e.hostname=t+e.hostname)}(e.httpRequest.endpoint,r),function(e){var t=e.split("."),r=/^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/;n.arrayEach(t,function(e){if(!e.length||e.length<1||e.length>63)throw n.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!r.test(e))throw i.util.error(new Error,{code:"ValidationError",message:e+" is not hostname compatible."})})}(e.httpRequest.endpoint.hostname)}return e}}},function(e,t,r){!function(e){"use strict";function t(e){return null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function n(e,i){if(e===i)return!0;if(Object.prototype.toString.call(e)!==Object.prototype.toString.call(i))return!1;if(!0===t(e)){if(e.length!==i.length)return!1;for(var o=0;o":!0,"=":!0,"!":!0},v={" ":!0,"\t":!0,"\n":!0};function m(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e}function g(e){return e>="0"&&e<="9"||"-"===e}function b(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e}function _(){}_.prototype={tokenize:function(e){var t,r,n,i=[];for(this._current=0;this._current"===r?"="===e[this._current]?(this._current++,{type:"GTE",value:">=",start:t}):{type:"GT",value:">",start:t}:"="===r&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,r=this._current,n=e.length;"`"!==e[this._current]&&this._current=0)return!0;if(["true","false","null"].indexOf(e)>=0)return!0;if(!("-0123456789".indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var w={};function E(){}function S(e){this.runtime=e}function I(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[s]}]},avg:{_func:this._functionAvg,_signature:[{types:[h]}]},ceil:{_func:this._functionCeil,_signature:[{types:[s]}]},contains:{_func:this._functionContains,_signature:[{types:[u,c]},{types:[a]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[u]},{types:[u]}]},floor:{_func:this._functionFloor,_signature:[{types:[s]}]},length:{_func:this._functionLength,_signature:[{types:[u,c,l]}]},map:{_func:this._functionMap,_signature:[{types:[f]},{types:[c]}]},max:{_func:this._functionMax,_signature:[{types:[h,p]}]},merge:{_func:this._functionMerge,_signature:[{types:[l],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[c]},{types:[f]}]},sum:{_func:this._functionSum,_signature:[{types:[h]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[u]},{types:[u]}]},min:{_func:this._functionMin,_signature:[{types:[h,p]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[c]},{types:[f]}]},type:{_func:this._functionType,_signature:[{types:[a]}]},keys:{_func:this._functionKeys,_signature:[{types:[l]}]},values:{_func:this._functionValues,_signature:[{types:[l]}]},sort:{_func:this._functionSort,_signature:[{types:[p,h]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[c]},{types:[f]}]},join:{_func:this._functionJoin,_signature:[{types:[u]},{types:[p]}]},reverse:{_func:this._functionReverse,_signature:[{types:[u,c]}]},to_array:{_func:this._functionToArray,_signature:[{types:[a]}]},to_string:{_func:this._functionToString,_signature:[{types:[a]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[a]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[a],variadic:!0}]}}}w.EOF=0,w.UnquotedIdentifier=0,w.QuotedIdentifier=0,w.Rbracket=0,w.Rparen=0,w.Comma=0,w.Rbrace=0,w.Number=0,w.Current=0,w.Expref=0,w.Pipe=1,w.Or=2,w.And=3,w.EQ=5,w.GT=5,w.LT=5,w.GTE=5,w.LTE=5,w.NE=5,w.Flatten=9,w.Star=20,w.Filter=21,w.Dot=40,w.Not=45,w.Lbrace=50,w.Lbracket=55,w.Lparen=60,E.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if("EOF"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Unexpected token type: "+r.type+", value: "+r.value);throw n.name="ParserError",n}return t},_loadTokens:function(e){var t=(new _).tokenize(e);t.push({type:"EOF",value:"",start:e.length}),this.tokens=t},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var r=this.nud(t),n=this._lookahead(0);e=0?this.expression(e):"Lbracket"===t?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===t?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(w[this._lookahead(0)]<10)t={type:"Identity"};else if("Lbracket"===this._lookahead(0))t=this.expression(e);else if("Filter"===this._lookahead(0))t=this.expression(e);else{if("Dot"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+r.value+"("+r.type+")");throw n.name="ParserError",n}this._match("Dot"),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];"Rbracket"!==this._lookahead(0);){var t=this.expression(0);if(e.push(t),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,r,n=[],i=["UnquotedIdentifier","QuotedIdentifier"];;){if(e=this._lookaheadToken(0),i.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match("Colon"),r={type:"KeyValuePair",name:t,value:this.expression(0)},n.push(r),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:n}}},S.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,o){var s,a,u,c,l,f,h,p,d;switch(e.type){case"Field":return null===o?null:r(o)?void 0===(f=o[e.name])?null:f:null;case"Subexpression":for(u=this.visit(e.children[0],o),d=1;d0)for(d=g;db;d+=_)u.push(o[d]);return u;case"Projection":var w=this.visit(e.children[0],o);if(!t(w))return null;for(p=[],d=0;dl;break;case"GTE":u=c>=l;break;case"LT":u=c=e&&(t=r<0?e-1:e),t}},I.prototype={callFunction:function(e,t){var r=this.functionTable[e];if(void 0===r)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,r._signature),r._func.call(this,t)},_validateArgs:function(e,t,r){var n,i,o,s;if(r[r.length-1].variadic){if(t.length=0;n--)r+=t[n];return r}var i=e[0].slice(0);return i.reverse(),i},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,r=e[0],n=0;n=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return r(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],r=this._interpreter,n=e[0],i=e[1],o=0;o0){if(this._getTypeName(e[0][0])===s)return Math.max.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;n0){if(this._getTypeName(e[0][0])===s)return Math.min.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;na?1:sa&&(a=r,t=i[c]);return t},_functionMinBy:function(e){for(var t,r,n=e[1],i=e[0],o=this.createKeyFunction(n,[s,u]),a=1/0,c=0;c=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],function(e){a.headers[e]={}}),n.forEach(["post","put","patch"],function(e){a.headers[e]=n.merge(o)}),e.exports=a}).call(this,r(6))},function(e,t,r){"use strict";(function(t){var n=r(57),i=r(38).Readable,o={objectMode:!0},s={clean:!0},a=r(138);function u(e){if(!(this instanceof u))return new u(e);this.options=e||{},this.options=n(s,e),this._inflights=new a}u.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},u.prototype.createStream=function(){var e=new i(o),r=!1,n=[],s=0;return this._inflights.forEach(function(e,t){n.push(e)}),e._read=function(){!r&&s0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):k(e,s)):w(e,s,t,!1))):n||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=E?e=E:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function I(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(A,e):A(e))}function A(e){p("emit readable"),e.emit("readable"),T(e)}function k(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(C,e,t))}function C(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(N,t,e))}function N(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):I(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&P(this),null;var n,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P(this)),null!==n&&this.emit("data",n),n},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:b;function c(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",v),e.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",b),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){p("onend"),e.end()}o.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",c);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,T(e))}}(r);e.on("drain",f);var h=!1;var d=!1;function y(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==L(o.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function v(t){p("onerror",t),b(),e.removeListener("error",v),0===a(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),b()}function g(){p("onfinish"),e.removeListener("close",m),b()}function b(){p("unpipe"),r.unpipe(e)}return r.on("data",y),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",v),e.once("close",m),e.once("finish",g),e.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?n:o.nextTick;g.WritableState=m;var c=Object.create(r(35));c.inherits=r(13);var l={deprecate:r(136)},f=r(77),h=r(14).Buffer,p=i.Uint8Array||function(){};var d,y=r(78);function v(){}function m(e,t){a=a||r(24),e=e||{};var n=t instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(o.nextTick(i,n),o.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),I(e,t))}(e,r,n,t,i);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),n?u(_,e,r,s,i):_(e,r,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function g(e){if(a=a||r(24),!(d.call(g,this)||this instanceof a))return new g(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),I(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,b(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(b(e,t,!1,t.objectMode?1:c.length,c,l,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),I(e,t)})}function I(e,t){var r=E(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(S,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}c.inherits(g,f),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===g&&(e&&e._writableState instanceof m)}})):d=function(e){return e instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&function(e){return h.isBuffer(e)||e instanceof p}(e);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=v),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),o.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),o.nextTick(n,s),i=!1),i}(this,n,e,r))&&(n.pendingcb++,i=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,I(e,t),r&&(t.finished?o.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),g.prototype.destroy=y.destroy,g.prototype._undestroy=y.undestroy,g.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(6),r(80).setImmediate,r(18))},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(135),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(18))},function(e,t,r){"use strict";var n=r(14).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=o;var n=r(24),i=Object.create(r(35));function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),this._transformState={afterTransform:function(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length65535||c%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;d+=2;if(d+=1,a){if("object"!=typeof a)return t.emit("error",new Error("Invalid will")),!1;if(!a.topic||"string"!=typeof a.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(d+=i.byteLength(a.topic)+2,a.payload&&a.payload){if(!(a.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof a.payload?d+=i.byteLength(a.payload)+2:d+=a.payload.length+2}else d+=2}var y=!1;if(null!=f){if(!S(f))return t.emit("error",new Error("Invalid username")),!1;y=!0,d+=i.byteLength(f)+2}if(null!=p){if(!y)return t.emit("error",new Error("Username is required to use password")),!1;if(!S(p))return t.emit("error",new Error("Invalid password")),!1;d+=E(p)+2}t.write(n.CONNECT_HEADER),m(t,d),w(t,o),t.write(4===s?n.VERSION4:n.VERSION3);var v=0;v|=null!=f?n.USERNAME_MASK:0,v|=null!=p?n.PASSWORD_MASK:0,v|=a&&a.retain?n.WILL_RETAIN_MASK:0,v|=a&&a.qos?a.qos<0&&h(t,l);return t.write(c)}(e,t);case"puback":case"pubrec":case"pubrel":case"pubcomp":case"unsuback":return function(e,t){var r=e||{},i=r.cmd||"puback",o=r.messageId,s=r.dup&&"pubrel"===i?n.DUP_MASK:0,a=0;"pubrel"===i&&(a=1);if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;return t.write(n.ACKS[i][a][s][0]),m(t,2),h(t,o)}(e,t);case"subscribe":return function(e,t){var r=e||{},o=r.dup?n.DUP_MASK:0,s=r.messageId,a=r.subscriptions,u=0;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;u+=2;if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(var c=0;c=0&&e<128?1:e>=128&&e<16384?2:e>=16384&&e<2097152?3:e>=2097152&&e<268435456?4:0}(e));do{t=e%128|0,(e=e/128|0)>0&&(t|=128),n.writeUInt8(t,r++)}while(e>0);return n}(t),t<16384&&(v[t]=r)),e.write(r)}function g(e,t){var r=i.byteLength(t);h(e,r),e.write(t,"utf8")}function b(e,t){return e.write(c[t])}function _(e,t){return e.write(l(t))}function w(e,t){"string"==typeof t?g(e,t):t?(h(e,t.length),e.write(t)):h(e,0)}function E(e){return e?e instanceof i?e.length:i.byteLength(e):0}function S(e){return"string"==typeof e||e instanceof i}e.exports=d},function(e,t,r){"use strict";t.decode=t.parse=r(207),t.encode=t.stringify=r(208)},function(e,t,r){"use strict";var n=r(209);e.exports=function(e,t){var r,i;return t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost",r=t.port,i=t.hostname,n.createConnection(r,i)}},function(e,t,r){"use strict";var n=!1,i=[];function o(e){n?wx.sendSocketMessage({data:e.buffer||e}):i.push(e)}var s=r(63);function a(e,t){var r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var a=function(e,t){var r="wxs"===e.protocol?"wss":"ws",n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s(function(e,t){var r={OPEN:1,CLOSING:2,CLOSED:3,readyState:n?1:0,send:o,close:wx.closeSocket,onopen:null,onmessage:null,onclose:null,onerror:null};return wx.connectSocket({url:e,protocols:t}),wx.onSocketOpen(function(e){r.readyState=r.OPEN,n=!0;for(var t=0;t>>7)^(d<<14|d>>>18)^d>>>3,v=c[p-2],m=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;c[p]=y+c[p-7]+m+c[p-16]}var g=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[p]+c[p];h=f,f=l,l=a,a=s+_|0,s=o,o=i,i=n,n=_+(b+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=o._createHelper(l),r.HmacSHA256=o._createHmacHelper(l)}(Math),e.SHA256}(r(3))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,i=n.Word,o=n.WordArray,s=t.algo;function a(){return i.create.apply(i,arguments)}var u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=a()}();var l=s.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],f=r[6],h=r[7],p=n.high,d=n.low,y=i.high,v=i.low,m=o.high,g=o.low,b=s.high,_=s.low,w=a.high,E=a.low,S=l.high,I=l.low,A=f.high,k=f.low,C=h.high,O=h.low,x=p,T=d,R=y,P=v,N=m,L=g,j=b,D=_,M=w,q=E,U=S,B=I,F=A,z=k,H=C,V=O,K=0;K<80;K++){var W=c[K];if(K<16)var G=W.high=0|e[t+2*K],X=W.low=0|e[t+2*K+1];else{var Q=c[K-15],J=Q.high,Y=Q.low,$=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Z=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=c[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=c[K-7],se=oe.high,ae=oe.low,ue=c[K-16],ce=ue.high,le=ue.low;G=(G=(G=$+se+((X=Z+ae)>>>0>>0?1:0))+ne+((X+=ie)>>>0>>0?1:0))+ce+((X+=le)>>>0>>0?1:0),W.high=G,W.low=X}var fe,he=M&U^~M&F,pe=q&B^~q&z,de=x&R^x&N^R&N,ye=T&P^T&L^P&L,ve=(x>>>28|T<<4)^(x<<30|T>>>2)^(x<<25|T>>>7),me=(T>>>28|x<<4)^(T<<30|x>>>2)^(T<<25|x>>>7),ge=(M>>>14|q<<18)^(M>>>18|q<<14)^(M<<23|q>>>9),be=(q>>>14|M<<18)^(q>>>18|M<<14)^(q<<23|M>>>9),_e=u[K],we=_e.high,Ee=_e.low,Se=H+ge+((fe=V+be)>>>0>>0?1:0),Ie=me+ye;H=F,V=z,F=U,z=B,U=M,B=q,M=j+(Se=(Se=(Se=Se+he+((fe+=pe)>>>0>>0?1:0))+we+((fe+=Ee)>>>0>>0?1:0))+G+((fe+=X)>>>0>>0?1:0))+((q=D+fe|0)>>>0>>0?1:0)|0,j=N,D=L,N=R,L=P,R=x,P=T,x=Se+(ve+de+(Ie>>>0>>0?1:0))+((T=fe+Ie|0)>>>0>>0?1:0)|0}d=n.low=d+T,n.high=p+x+(d>>>0>>0?1:0),v=i.low=v+P,i.high=y+R+(v>>>0

>>0?1:0),g=o.low=g+L,o.high=m+N+(g>>>0>>0?1:0),_=s.low=_+D,s.high=b+j+(_>>>0>>0?1:0),E=a.low=E+q,a.high=w+M+(E>>>0>>0?1:0),I=l.low=I+B,l.high=S+U+(I>>>0>>0?1:0),k=f.low=k+z,f.high=A+F+(k>>>0>>0?1:0),O=h.low=O+V,h.high=C+H+(O>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(l),t.HmacSHA512=r._createHmacHelper(l)}(),e.SHA512}(r(3),r(43))},function(e,t,r){var n=r(2),i=r(7),o=r(247),s=r(36),a=r(71).populateHostPrefix;e.exports={buildRequest:function(e){var t=e.service.api.operations[e.operation],r=e.httpRequest;r.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",r.params={Version:e.service.api.apiVersion,Action:t.name},(new o).serialize(e.params,t.input,function(e,t){r.params[e]=t}),r.body=i.queryParamsToString(r.params),a(e)},extractError:function(e){var t,r=e.httpResponse.body.toString();if(r.match("0){var f=(t=new n.XML.Parser).parse(s.toString(),u);i.update(e.data,f)}}}},function(e,t,r){var n=r(103),i=r(107),o=r(36),s=r(108),a=r(109),u=r(110),c=r(7),l=c.property,f=c.memoizedProperty;e.exports=function(e,t){var r=this;e=e||{},(t=t||{}).api=this,e.metadata=e.metadata||{};var h=t.serviceIdentifier;delete t.serviceIdentifier,l(this,"isApi",!0,!1),l(this,"apiVersion",e.metadata.apiVersion),l(this,"endpointPrefix",e.metadata.endpointPrefix),l(this,"signingName",e.metadata.signingName),l(this,"globalEndpoint",e.metadata.globalEndpoint),l(this,"signatureVersion",e.metadata.signatureVersion),l(this,"jsonVersion",e.metadata.jsonVersion),l(this,"targetPrefix",e.metadata.targetPrefix),l(this,"protocol",e.metadata.protocol),l(this,"timestampFormat",e.metadata.timestampFormat),l(this,"xmlNamespaceUri",e.metadata.xmlNamespace),l(this,"abbreviation",e.metadata.serviceAbbreviation),l(this,"fullName",e.metadata.serviceFullName),l(this,"serviceId",e.metadata.serviceId),h&&u[h]&&l(this,"xmlNoDefaultLists",u[h].xmlNoDefaultLists,!1),f(this,"className",function(){var t=e.metadata.serviceAbbreviation||e.metadata.serviceFullName;return t?("ElasticLoadBalancing"===(t=t.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g,""))&&(t="ELB"),t):null}),l(this,"operations",new n(e.operations,t,function(e,r){return new i(e,r,t)},c.string.lowerFirst,function(e,t){!0===t.endpointoperation&&l(r,"endpointOperation",c.string.lowerFirst(e))})),l(this,"shapes",new n(e.shapes,t,function(e,r){return o.create(r,t)})),l(this,"paginators",new n(e.paginators,t,function(e,r){return new s(e,r,t)})),l(this,"waiters",new n(e.waiters,t,function(e,r){return new a(e,r,t)},c.string.lowerFirst)),t.documentation&&(l(this,"documentation",e.documentation),l(this,"documentationUrl",e.documentationUrl))}},function(e,t,r){var n=r(36),i=r(7),o=i.property,s=i.memoizedProperty;e.exports=function(e,t,r){var i=this;r=r||{},o(this,"name",t.name||e),o(this,"api",r.api,!1),t.http=t.http||{},o(this,"endpoint",t.endpoint),o(this,"httpMethod",t.http.method||"POST"),o(this,"httpPath",t.http.requestUri||"/"),o(this,"authtype",t.authtype||""),o(this,"endpointDiscoveryRequired",t.endpointdiscovery?t.endpointdiscovery.required?"REQUIRED":"OPTIONAL":"NULL"),s(this,"input",function(){return t.input?n.create(t.input,r):new n.create({type:"structure"},r)}),s(this,"output",function(){return t.output?n.create(t.output,r):new n.create({type:"structure"},r)}),s(this,"errors",function(){var e=[];if(!t.errors)return null;for(var i=0;i-1&&r.splice(i,1)}return this},removeAllListeners:function(e){return e?delete this._events[e]:this._events={},this},emit:function(e,t,r){r||(r=function(){});var n=this.listeners(e),i=n.length;return this.callListeners(n,t,r),i>0},callListeners:function(e,t,r,i){var o=this,s=i||null;function a(i){if(i&&(s=n.util.error(s||new Error,i),o._haltHandlersOnError))return r.call(o,s);o.callListeners(e,t,r,s)}for(;e.length>0;){var u=e.shift();if(u._isAsync)return void u.apply(o,t.concat([a]));try{u.apply(o,t)}catch(e){s=n.util.error(s||new Error,e)}if(s&&o._haltHandlersOnError)return void r.call(o,s)}r.call(o,s)},addListeners:function(e){var t=this;return e._events&&(e=e._events),n.util.each(e,function(e,r){"function"==typeof r&&(r=[r]),n.util.arrayEach(r,function(r){t.on(e,r)})}),t},addNamedListener:function(e,t,r,n){return this[e]=r,this.addListener(t,r,n),this},addNamedAsyncListener:function(e,t,r,n){return r._isAsync=!0,this.addNamedListener(e,t,r,n)},addNamedListeners:function(e){var t=this;return e(function(){t.addNamedListener.apply(t,arguments)},function(){t.addNamedAsyncListener.apply(t,arguments)}),this}}),n.SequentialExecutor.prototype.addListener=n.SequentialExecutor.prototype.on,e.exports=n.SequentialExecutor},function(e,t,r){var n=r(2);n.Credentials=n.util.inherit({constructor:function(){if(n.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof arguments[0]){var e=arguments[0].credentials||arguments[0];this.accessKeyId=e.accessKeyId,this.secretAccessKey=e.secretAccessKey,this.sessionToken=e.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var e=n.util.date.getDate().getTime(),t=new Date(e+1e3*this.expiryWindow);return!!(this.expireTime&&t>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(e){var t=this;this.needsRefresh()?this.refresh(function(r){r||(t.expired=!1),e&&e(r)}):e&&e()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,t){var r=this;1===r.refreshCallbacks.push(e)&&r.load(function(e){n.util.arrayEach(r.refreshCallbacks,function(r){t?r(e):n.util.defer(function(){r(e)})}),r.refreshCallbacks.length=0})},load:function(e){e()}}),n.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=n.util.promisifyMethod("get",e),this.prototype.refreshPromise=n.util.promisifyMethod("refresh",e)},n.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},n.util.addPromises(n.Credentials)},function(e,t,r){var n=r(2);n.CredentialProviderChain=n.util.inherit(n.Credentials,{constructor:function(e){this.providers=e||n.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var t=this;if(0===t.providers.length)return e(new Error("No providers")),t;if(1===t.resolveCallbacks.push(e)){var r=0,i=t.providers.slice(0);!function e(o,s){if(!o&&s||r===i.length)return n.util.arrayEach(t.resolveCallbacks,function(e){e(o,s)}),void(t.resolveCallbacks.length=0);var a=i[r++];(s="function"==typeof a?a.call():a).get?s.get(function(t){e(t,t?null:s)}):e(null,s)}()}return t}}),n.CredentialProviderChain.defaultProviders=[],n.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=n.util.promisifyMethod("resolve",e)},n.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},n.util.addPromises(n.CredentialProviderChain)},function(e,t,r){var n=r(2),i=n.util.inherit;n.Endpoint=i({constructor:function(e,t){if(n.util.hideProperties(this,["slashes","auth","hash","search","query"]),void 0===e||null===e)throw new Error("Invalid endpoint: "+e);if("string"!=typeof e)return n.util.copy(e);e.match(/^http/)||(e=((t&&void 0!==t.sslEnabled?t.sslEnabled:n.config.sslEnabled)?"https":"http")+"://"+e);n.util.update(this,n.util.urlParse(e)),this.port?this.port=parseInt(this.port,10):this.port="https:"===this.protocol?443:80}}),n.HttpRequest=i({constructor:function(e,t){e=new n.Endpoint(e),this.method="POST",this.path=e.path||"/",this.headers={},this.body="",this.endpoint=e,this.region=t,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=n.util.userAgent()},getUserAgentHeaderName:function(){return(n.util.isBrowser()?"X-Amz-":"")+"User-Agent"},appendToUserAgent:function(e){"string"==typeof e&&e&&(this._userAgent+=" "+e),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var e=this.path.split("?",2)[1];return e?(e=n.util.queryStringParse(e),n.util.queryParamsToString(e)):""},updateEndpoint:function(e){var t=new n.Endpoint(e);this.endpoint=t,this.path=t.path||"/",this.headers.Host&&(this.headers.Host=t.host)}}),n.HttpResponse=i({constructor:function(){this.statusCode=void 0,this.headers={},this.body=void 0,this.streaming=!1,this.stream=null},createUnbufferedStream:function(){return this.streaming=!0,this.stream}}),n.HttpClient=i({}),n.HttpClient.getInstance=function(){return void 0===this.singleton&&(this.singleton=new this),this.singleton}},function(e,t,r){var n=r(2),i=n.util.inherit;n.Signers.V3=i(n.Signers.RequestSigner,{addAuthorization:function(e,t){var r=n.util.date.rfc822(t);this.request.headers["X-Amz-Date"]=r,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken),this.request.headers["X-Amzn-Authorization"]=this.authorization(e,r)},authorization:function(e){return"AWS3 AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,SignedHeaders="+this.signedHeaders()+",Signature="+this.signature(e)},signedHeaders:function(){var e=[];return n.util.arrayEach(this.headersToSign(),function(t){e.push(t.toLowerCase())}),e.sort().join(";")},canonicalHeaders:function(){var e=this.request.headers,t=[];return n.util.arrayEach(this.headersToSign(),function(r){t.push(r.toLowerCase().trim()+":"+String(e[r]).trim())}),t.sort().join("\n")+"\n"},headersToSign:function(){var e=[];return n.util.each(this.request.headers,function(t){("Host"===t||"Content-Encoding"===t||t.match(/^X-Amz/i))&&e.push(t)}),e},signature:function(e){return n.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push("/"),e.push(""),e.push(this.canonicalHeaders()),e.push(this.request.body),n.util.crypto.sha256(e.join("\n"))}}),e.exports=n.Signers.V3},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;nf)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=d,h=y,c=a;var m=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;i[n++]=m>>>24&255,i[n++]=m>>>16&255,i[n++]=m>>>8&255,i[n++]=255&m;var g=d/4294967296*1e4&268435455;i[n++]=g>>>8&255,i[n++]=255&g,i[n++]=g>>>24&15|16,i[n++]=g>>>16&255,i[n++]=a>>>8|128,i[n++]=255&a;for(var b=0;b<6;++b)i[n+b]=s[b];return t||l(i)};var d=function(e,t,r){function n(e,n,i,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r>>9<<4)+1}function v(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function m(e,t,r,n,i,o){return v(function(e,t){return e<>>32-t}(v(v(t,e),v(n,o)),i),r)}function g(e,t,r,n,i,o,s){return m(t&r|~t&n,e,t,i,o,s)}function b(e,t,r,n,i,o,s){return m(t&n|r&~n,e,t,i,o,s)}function _(e,t,r,n,i,o,s){return m(t^r^n,e,t,i,o,s)}function w(e,t,r,n,i,o,s){return m(r^(t|~n),e,t,i,o,s)}var E=d("v3",48,function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r>5]>>>n%32&255,o=parseInt("0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>32-t}var k=d("v5",80,function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i>>0;b=g,g=m,m=A(v,30)>>>0,v=y,y=E}r[0]=r[0]+y>>>0,r[1]=r[1]+v>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+g>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})},function(e,t,r){e.exports=r(301)},function(e,t,r){"use strict";r.d(t,"a",function(){return v});var n=r(55),i=r(47),o=r(49),s=r(32),a=r(53),u=r(5),c=r(22),l=r(21),f=r(48),h=r(52),p=r(51),d=r(54),y=r(50),v={User:{Service:i.a,Model:u.a,ListQuery:f.a},Conversation:{Service:o.a,Model:c.a,ListQuery:h.a},Message:{Service:s.a,Model:l.a,ListQuery:p.a,ReactionUserListQuery:y.a},File:{Service:d.a},PushNotification:{Service:a.a},Client:n.a}},function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Channelize",function(){return o}),r.d(t,"core",function(){return a}),r.d(t,"client",function(){return u});var n=r(55),i=r(123);e.Channelize?console.error("ERROR: It appears that you have multiple copies of the Channelize WebSDK in your build!"):e.Channelize={core:i.a,client:n.a};var o=e.Channelize,s=e.Channelize,a=s.core,u=s.client}.call(this,r(18))},function(e,t,r){e.exports.device=r(56),e.exports.thingShadow=r(245),e.exports.jobs=r(246)},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t,r){"use strict";(function(t){var n=r(128),i=r(75),o=r(61),s=r(57),a={};function u(e,t){if("object"!=typeof e||t||(t=e,e=null),t=t||{},e){var r=o.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=s(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){var t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!a[t.protocol]){var i=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs"].filter(function(e,t){return(!i||t%2!=0)&&"function"==typeof a[e]})[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");return t.protocol&&(t.defaultProtocol=t.protocol),new n(function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),a[t.protocol](e,t)},t)}"browser"!==t.title?(a.mqtt=r(97),a.tcp=r(97),a.ssl=r(62),a.tls=r(62),a.mqtts=r(62)):(a.wx=r(98),a.wxs=r(98)),a.ws=r(99),a.wss=r(99),e.exports=u,e.exports.connect=u,e.exports.MqttClient=n,e.exports.Store=i}).call(this,r(6))},function(e,t,r){"use strict";(function(t,n){var i=r(19),o=r(75),s=r(93),a=r(195),u=r(38).Writable,c=r(13),l=r(202),f=r(203),h=r(57),p=t.setImmediate||function(e){n.nextTick(e)},d={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0};function y(e,t,r){e.emit("packetsend",t),!a.writeToStream(t,e.stream)&&r?e.stream.once("drain",r):r&&r()}function v(e,t,r){e.outgoingStore.put(t,function(n){if(n)return r&&r(n);y(e,t,r)})}function m(){}function g(e,t){var r,n=this;if(!(this instanceof g))return new g(e,t);for(r in this.options=t||{},d)void 0===this.options[r]?this.options[r]=d[r]:this.options[r]=t[r];this.options.clientId="string"==typeof this.options.clientId?this.options.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),this.streamBuilder=e,this.outgoingStore=this.options.outgoingStore||new o,this.incomingStore=this.options.incomingStore||new o,this.queueQoSZero=void 0===this.options.queueQoSZero||this.options.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this.on("connect",function(){if(!this.disconnected){this.connected=!0;var e=this.outgoingStore.createStream();this.once("close",t),e.on("end",function(){n.removeListener("close",t)}),e.on("error",function(e){n.removeListener("close",t),n.emit("error",e)}),function t(){if(e){var r,i=e.read(1);i?n.disconnecting||n.reconnectTimer?e.destroy&&e.destroy():(r=n.outgoing[i.messageId],n.outgoing[i.messageId]=function(e,n){r&&r(e,n),t()},n._sendPacket(i)):e.once("readable",t)}}()}function t(){e.destroy(),e=null}}),this.on("close",function(){this.connected=!1,clearTimeout(this.connackTimer)}),this.on("connect",this._setupPingTimer),this.on("connect",function(){var e=this.queue;!function t(){var r,i=e.shift();i&&(r=i.packet,n._sendPacket(r,function(e){i.cb&&i.cb(e),t()}))}()});var s=!0;this.on("connect",function(){!s&&this.options.clean&&Object.keys(this._resubscribeTopics).length>0&&(this.options.resubscribe?(this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics)):this._resubscribeTopics={}),s=!1}),this.on("close",function(){null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null)}),this.on("close",this._setupReconnect),i.EventEmitter.call(this),this._setupStream()}c(g,i.EventEmitter),g.prototype._setupStream=function(){var e,t=this,r=new u,i=a.parser(this.options),o=null,c=[];function l(){n.nextTick(f)}function f(){var e=c.shift(),r=o;e?t._handlePacket(e,l):(o=null,r())}this._clearReconnect(),this.stream=this.streamBuilder(this),i.on("packet",function(e){c.push(e)}),r._write=function(e,t,r){o=r,i.parse(e),f()},this.stream.pipe(r),this.stream.on("error",m),s(this.stream,this.emit.bind(this,"close")),(e=Object.create(this.options)).cmd="connect",y(this,e),i.on("error",this.emit.bind(this,"error")),this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){t._cleanUp(!0)},this.options.connectTimeout)},g.prototype._handlePacket=function(e,t){switch(this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"pingresp":this._handlePingresp(e),t()}},g.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},g.prototype.publish=function(e,t,r,n){var i;"function"==typeof r&&(n=r,r=null);if(r=h({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;switch(i={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:this._nextId(),dup:r.dup},r.qos){case 1:case 2:this.outgoing[i.messageId]=n||m,this._sendPacket(i);break;default:this._sendPacket(i,n)}return this},g.prototype.subscribe=function(){var e,t,r=Array.prototype.slice.call(arguments),n=[],i=r.shift(),o=i.resubscribe,s=r.pop()||m,a=r.pop(),u=this;if(delete i.resubscribe,"string"==typeof i&&(i=[i]),"function"!=typeof s&&(a=s,s=m),null!==(t=f.validateTopics(i)))return p(s,new Error("Invalid topic "+t)),this;if(this._checkDisconnecting(s))return this;if(a=h({qos:0},a),Array.isArray(i)?i.forEach(function(e){(u._resubscribeTopics[e]0&&(u._resubscribeTopics[e.topic]=e.qos,c.push(e.topic))}),u.messageIdToTopic[e.messageId]=c}return this.outgoing[e.messageId]=function(e,t){if(!e)for(var r=t.granted,i=0;i0?this.once("outgoingEmpty",setTimeout.bind(null,i,10)):i(),this)},g.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e];return delete this.outgoing[e],this.outgoingStore.del({messageId:e},function(){t(new Error("Message removed"))}),this},g.prototype.reconnect=function(e){var t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},g.prototype._reconnect=function(){this.emit("reconnect"),this._setupStream()},g.prototype._setupReconnect=function(){var e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0&&(this.reconnecting||(this.emit("offline"),this.reconnecting=!0),e.reconnectTimer=setInterval(function(){e._reconnect()},e.options.reconnectPeriod))},g.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},g.prototype._cleanUp=function(e,t){t&&this.stream.on("close",t),e?(0===this.options.reconnectPeriod&&this.options.clean&&function(e){e&&Object.keys(e).forEach(function(t){"function"==typeof e[t]&&(e[t](new Error("Connection closed")),delete e[t])})}(this.outgoing),this.stream.destroy()):this._sendPacket({cmd:"disconnect"},p.bind(null,this.stream.end.bind(this.stream))),this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(this.stream.removeListener("close",t),t())},g.prototype._sendPacket=function(e,t){if(this.connected){switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void v(this,e,t);default:return void y(this,e,t)}switch(e.qos){case 2:case 1:v(this,e,t);break;case 0:default:y(this,e,t)}}else 0===(e.qos||0)&&this.queueQoSZero||"publish"!==e.cmd?this.queue.push({packet:e,cb:t}):e.qos>0?(t=this.outgoing[e.messageId],this.outgoingStore.put(e,function(e){if(e)return t&&t(e)})):t&&t(new Error("No connection to broker"))},g.prototype._setupPingTimer=function(){var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=l(function(){e._checkPing()},1e3*this.options.keepalive))},g.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},g.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):this._cleanUp(!0)},g.prototype._handlePingresp=function(){this.pingResp=!0},g.prototype._handleConnack=function(e){var t=e.returnCode;if(clearTimeout(this.connackTimer),0===t)this.reconnecting=!1,this.emit("connect",e);else if(t>0){var r=new Error("Connection refused: "+["","Unacceptable protocol version","Identifier rejected","Server unavailable","Bad username or password","Not authorized"][t]);r.code=t,this.emit("error",r)}},g.prototype._handlePublish=function(e,t){t=void 0!==t?t:m;var r=e.topic.toString(),n=e.payload,i=e.qos,o=e.messageId,s=this;switch(i){case 2:this.incomingStore.put(e,function(e){if(e)return t(e);s._sendPacket({cmd:"pubrec",messageId:o},t)});break;case 1:this.emit("message",r,n,e),this.handleMessage(e,function(e){if(e)return t(e);s._sendPacket({cmd:"puback",messageId:o},t)});break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t)}},g.prototype.handleMessage=function(e,t){t()},g.prototype._handleAck=function(e){var t=e.messageId,r=e.cmd,n=null,i=this.outgoing[t],o=this;if(i){switch(r){case"pubcomp":case"puback":delete this.outgoing[t],this.outgoingStore.del(e,i);break;case"pubrec":n={cmd:"pubrel",qos:2,messageId:t},this._sendPacket(n);break;case"suback":if(delete this.outgoing[t],1===e.granted.length&&0!=(128&e.granted[0])){var s=this.messageIdToTopic[t];s&&s.forEach(function(e){delete o._resubscribeTopics[e]})}i(null,e);break;case"unsuback":delete this.outgoing[t],i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}},g.prototype._handlePubrel=function(e,t){t=void 0!==t?t:m;var r=this,n={cmd:"pubcomp",messageId:e.messageId};r.incomingStore.get(e,function(i,o){i||"pubrel"===o.cmd?r._sendPacket(n,t):(r.emit("message",o.topic,o.payload,o),r.incomingStore.put(e,function(e){if(e)return t(e);r.handleMessage(o,function(e){if(e)return t(e);r._sendPacket(n,t)})}))})},g.prototype._nextId=function(){var e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},g.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},e.exports=g}).call(this,r(18),r(6))},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],a=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function f(e,t,r){for(var n,i=[],o=t;o>1,l=-7,f=r?i-1:0,h=r?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},function(e,t){},function(e,t,r){"use strict";var n=r(14).Buffer,i=r(134);function o(e,t,r){e.copy(t,r)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t=n.allocUnsafe(e>>>0),r=this.head,i=0;r;)o(r.data,t,i),i+=r.data.length,r=r.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i=1,o={},s=!1,a=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick(function(){l(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?function(){var t="setImmediate$"+Math.random()+"$",r=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&l(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),n=function(r){e.postMessage(t+r,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){l(e.data)},n=function(t){e.port2.postMessage(t)}}():a&&"onreadystatechange"in a.createElement("script")?function(){var e=a.documentElement;n=function(t){var r=a.createElement("script");r.onreadystatechange=function(){l(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():n=function(e){setTimeout(l,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0?c(l):i(this.length)-c(u(l));t0?1:-1}},function(e,t,r){"use strict";var n=r(26),i={function:!0,object:!0};e.exports=function(e){return n(e)&&i[typeof e]||!1}},function(e,t,r){"use strict";var n,i=Object.create;r(85)()||(n=r(86)),e.exports=function(){var e,t,r;return n?1!==n.level?i:(e={},t={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(e){t[e]="__proto__"!==e?r:{configurable:!0,enumerable:!1,writable:!0,value:void 0}}),Object.defineProperties(e,t),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:e}),function(t,r){return i(null===t?e:t,r)}):i}()},function(e,t,r){"use strict";var n=r(153);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!n(e)}},function(e,t,r){"use strict";var n=r(58);e.exports=function(e){if(!n(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,r){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var n=r(156),i=r(20),o=Math.max;e.exports=function(e,t){var r,s,a,u=o(arguments.length,2);for(e=Object(i(e)),a=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},s=1;s-1}},function(e,t,r){"use strict";var n,i,o,s,a,u,c,l=r(16),f=r(25),h=Function.prototype.apply,p=Function.prototype.call,d=Object.create,y=Object.defineProperty,v=Object.defineProperties,m=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};a={on:n=function(e,t){var r;return f(t),m.call(this,"__ee__")?r=this.__ee__:(r=g.value=d(null),y(this,"__ee__",g),g.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},once:i=function(e,t){var r,i;return f(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),h.call(t,this,arguments)}),r.__eeOnceListener__=t,this},off:o=function(e,t){var r,n,i,o;if(f(t),!m.call(this,"__ee__"))return this;if(!(r=this.__ee__)[e])return this;if("object"==typeof(n=r[e]))for(o=0;i=n[o];++o)i!==t&&i.__eeOnceListener__!==t||(2===n.length?r[e]=n[o?0:1]:n.splice(o,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},emit:s=function(e){var t,r,n,i,o;if(m.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(r=arguments.length,o=new Array(r-1),t=1;t=55296&&v<=56319&&(y+=e[++p]),u.call(t,m,y,f),!h);++p);else c.call(e,function(e){return u.call(t,m,e,f),h})}},function(e,t,r){"use strict";var n=r(41),i=r(42),o=r(173),s=r(188),a=r(91),u=r(23).iterator;e.exports=function(e){return"function"==typeof a(e)[u]?e[u]():n(e)?new o(e):i(e)?new s(e):new o(e)}},function(e,t,r){"use strict";var n,i=r(39),o=r(89),s=r(16),a=r(23),u=r(60),c=Object.defineProperty;n=e.exports=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,e),t=t?o.call(t,"key+value")?"key+value":o.call(t,"key")?"key":"value":"value",c(this,"__kind__",s("",t))},i&&i(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:s(function(e){return"value"===this.__kind__?this.__list__[e]:"key+value"===this.__kind__?[e,this.__list__[e]]:e})}),c(n.prototype,a.toStringTag,s("c","Array Iterator"))},function(e,t,r){"use strict";var n,i=r(27),o=r(175),s=r(179),a=r(180),u=r(88),c=r(185),l=Function.prototype.bind,f=Object.defineProperty,h=Object.prototype.hasOwnProperty;n=function(e,t,r){var n,i=o(t)&&s(t.value);return delete(n=a(t)).writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&h.call(this,e)?i:(t.value=l.call(i,r.resolveContext?r.resolveContext(this):this),f(this,e,t),this[e])},n},e.exports=function(e){var t=u(arguments[1]);return i(t.resolveContext)&&s(t.resolveContext),c(e,function(e,r){return n(r,e,t)})}},function(e,t,r){"use strict";var n=r(92),i=r(27);e.exports=function(e){return i(e)?e:n(e,"Cannot use %v",arguments[1])}},function(e,t,r){"use strict";var n=r(27),i=r(58),o=Object.prototype.toString;e.exports=function(e){if(!n(e))return null;if(i(e)){var t=e.toString;if("function"!=typeof t)return null;if(t===o)return null}try{return""+e}catch(e){return null}}},function(e,t,r){"use strict";var n=r(178),i=/[\n\r\u2028\u2029]/g;e.exports=function(e){var t=n(e);return null===t?"":(t.length>100&&(t=t.slice(0,99)+"…"),t=t.replace(i,function(e){switch(e){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}}))}},function(e,t,r){"use strict";e.exports=function(e){try{return e.toString()}catch(t){try{return String(e)}catch(e){return null}}}},function(e,t,r){"use strict";var n=r(92),i=r(87);e.exports=function(e){return i(e)?e:n(e,"%v is not a plain function",arguments[1])}},function(e,t,r){"use strict";var n=r(181),i=r(59),o=r(20);e.exports=function(e){var t=Object(o(e)),r=arguments[1],s=Object(arguments[2]);if(t!==e&&!r)return t;var a={};return r?n(r,function(t){(s.ensure||t in e)&&(a[t]=e[t])}):i(a,e),a}},function(e,t,r){"use strict";e.exports=r(182)()?Array.from:r(183)},function(e,t,r){"use strict";e.exports=function(){var e,t,r=Array.from;return"function"==typeof r&&(t=r(e=["raz","dwa"]),Boolean(t&&t!==e&&"dwa"===t[1]))}},function(e,t,r){"use strict";var n=r(23).iterator,i=r(41),o=r(184),s=r(84),a=r(25),u=r(20),c=r(26),l=r(42),f=Array.isArray,h=Function.prototype.call,p={configurable:!0,enumerable:!0,writable:!0,value:null},d=Object.defineProperty;e.exports=function(e){var t,r,y,v,m,g,b,_,w,E,S=arguments[1],I=arguments[2];if(e=Object(u(e)),c(S)&&a(S),this&&this!==Array&&o(this))t=this;else{if(!S){if(i(e))return 1!==(m=e.length)?Array.apply(null,e):((v=new Array(1))[0]=e[0],v);if(f(e)){for(v=new Array(m=e.length),r=0;r=55296&&g<=56319&&(E+=e[++r]),E=S?h.call(S,I,E,y):E,t?(p.value=E,d(v,y,p)):v[y]=E,++y;m=y}if(void 0===m)for(m=s(e.length),t&&(v=new t(m)),r=0;r=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r})}),u(n.prototype,s.toStringTag,o("c","String Iterator"))},function(e,t,r){"use strict";var n,i=r(39),o=r(16),s=r(60),a=r(23).toStringTag,u=r(190),c=Object.defineProperties,l=s.prototype._unBind;n=e.exports=function(e,t){if(!(this instanceof n))return new n(e,t);s.call(this,e.__mapKeysData__,e),t&&u[t]||(t="key+value"),c(this,{__kind__:o("",t),__values__:o("w",e.__mapValuesData__)})},i&&i(n,s),n.prototype=Object.create(s.prototype,{constructor:o(n),_resolve:o(function(e){return"value"===this.__kind__?this.__values__[e]:"key"===this.__kind__?this.__list__[e]:[this.__list__[e],this.__values__[e]]}),_unBind:o(function(){this.__values__=null,l.call(this)}),toString:o(function(){return"[object Map Iterator]"})}),Object.defineProperty(n.prototype,a,o("c","Map Iterator"))},function(e,t,r){"use strict";e.exports=r(191)("key","value","key+value")},function(e,t,r){"use strict";var n=Array.prototype.forEach,i=Object.create;e.exports=function(e){var t=i(null);return n.call(arguments,function(e){t[e]=!0}),t}},function(e,t,r){"use strict";e.exports="undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)},function(e,t,r){var n=r(194);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},function(e,t){e.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");Object.keys(t).forEach(function(e){n[e]=t[e]});return n;function n(){for(var e=new Array(arguments.length),r=0;r0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,this._stateCounter>=this._states.length&&(this._stateCounter=0);return this._list.length},u.prototype._parseHeader=function(){var e=this._list.readUInt8(0);return this.packet.cmd=a.types[e>>a.CMD_SHIFT],this.packet.retain=0!=(e&a.RETAIN_MASK),this.packet.qos=e>>a.QOS_SHIFT&a.QOS_MASK,this.packet.dup=0!=(e&a.DUP_MASK),this._list.consume(1),!0},u.prototype._parseLength=function(){for(var e,t=0,r=1,n=0,i=!0;t<5&&(n+=r*((e=this._list.readUInt8(t++))&a.LENGTH_MASK),r*=128,0!=(e&a.LENGTH_FIN_MASK));)if(this._list.length<=t){i=!1;break}return i&&(this.packet.length=n,this._list.consume(t)),i},u.prototype._parsePayload=function(){var e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseMessageId();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":case"disconnect":break;default:this._emitError(new Error("Not supported"))}e=!0}return e},u.prototype._parseConnect=function(){var e,t,r,n,i,o,s={},u=this.packet;if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==e&&"MQIsdp"!==e)return this._emitError(new Error("Invalid protocolId"));if(u.protocolId=e,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(u.protocolVersion=this._list.readUInt8(this._pos),3!==u.protocolVersion&&4!==u.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.username=this._list.readUInt8(this._pos)&a.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&a.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&a.WILL_FLAG_MASK,s.will&&(u.will={},u.will.retain=0!=(this._list.readUInt8(this._pos)&a.WILL_RETAIN_MASK),u.will.qos=(this._list.readUInt8(this._pos)&a.WILL_QOS_MASK)>>a.WILL_QOS_SHIFT),u.clean=0!=(this._list.readUInt8(this._pos)&a.CLEAN_SESSION_MASK),this._pos++,u.keepalive=this._parseNum(),-1===u.keepalive)return this._emitError(new Error("Packet too short"));if(null===(t=this._parseString()))return this._emitError(new Error("Packet too short"));if(u.clientId=t,s.will){if(null===(r=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(u.will.topic=r,null===(n=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));u.will.payload=n}if(s.username){if(null===(o=this._parseString()))return this._emitError(new Error("Cannot parse username"));u.username=o}if(s.password){if(null===(i=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));u.password=i}return u},u.prototype._parseConnack=function(){var e=this.packet;return this._list.length<2?null:(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&a.SESSIONPRESENT_MASK),e.returnCode=this._list.readUInt8(this._pos),-1===e.returnCode?this._emitError(new Error("Cannot parse return code")):void 0)},u.prototype._parsePublish=function(){var e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));e.qos>0&&!this._parseMessageId()||(e.payload=this._list.slice(this._pos,e.length))},u.prototype._parseSubscribe=function(){var e,t,r=this.packet;if(1!==r.qos)return this._emitError(new Error("Wrong subscribe header"));if(r.subscriptions=[],this._parseMessageId())for(;this._pos=r.length)return this._emitError(new Error("Malformed Subscribe Payload"));t=this._list.readUInt8(this._pos++),r.subscriptions.push({topic:e,qos:t})}},u.prototype._parseSuback=function(){if(this.packet.granted=[],this._parseMessageId())for(;this._posthis._list.length||n>this.packet.length?null:(t=this._list.toString("utf8",this._pos,n),this._pos+=r,t)},u.prototype._parseBuffer=function(){var e,t=this._parseNum(),r=t+this._pos;return-1===t||r>this._list.length||r>this.packet.length?null:(e=this._list.slice(this._pos,r),this._pos+=t,e)},u.prototype._parseNum=function(){if(this._list.length-this._pos<2)return-1;var e=this._list.readUInt16BE(this._pos);return this._pos+=2,e},u.prototype._newPacket=function(){return this.packet&&(this._list.consume(this.packet.length),this.emit("packet",this.packet)),this.packet=new s,!0},u.prototype._emitError=function(e){this.error=e,this.emit("error",e)},e.exports=u},function(e,t,r){var n=r(198),i=r(33),o=r(14).Buffer;function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)})}else this.append(e);n.call(this)}i.inherits(s,n),s.prototype._offset=function(e){var t,r=0,n=0;if(0===e)return[0,0];for(;nthis.length)&&(n=this.length),r>=this.length)return e||o.alloc(0);if(n<=0)return e||o.alloc(0);var i,s,a=!!e,u=this._offset(r),c=n-r,l=c,f=a&&t||0,h=u[1];if(0===r&&n==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:o.concat(this._bufs,this.length);for(s=0;s(i=this._bufs[s].length-h))){this._bufs[s].copy(e,f,h,h+l);break}this._bufs[s].copy(e,f,h),f+=i,l-=i,h&&(h=0)}return e},s.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,e<0&&(e+=this.length),t<0&&(t+=this.length);var r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0==n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!=r[1]&&(i[0]=i[0].slice(r[1])),new s(i)},s.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},s.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;e>8,0),t.writeUInt8(255&e,1),t}e.exports={cache:o,generateCache:function(){for(var e=0;e0){e=new Array(arguments.length-2);for(var t=0;t= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=c-l,E=Math.floor,S=String.fromCharCode;function I(e){throw RangeError(_[e])}function A(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function k(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+A((e=e.replace(b,".")).split("."),t).join(".")}function C(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=S((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=S(e)}).join("")}function x(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function T(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function R(e,t,r){var n=0;for(e=r?E(e/p):e>>1,e+=E(e/t);e>w*f>>1;n+=c)e=E(e/w);return E(n+(w+1)*e/(e+h))}function P(e){var t,r,n,i,o,s,a,h,p,m,g=[],b=e.length,_=0,w=y,S=d;for((r=e.lastIndexOf(v))<0&&(r=0),n=0;n=128&&I("not-basic"),g.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=b&&I("invalid-input"),((h=x(e.charCodeAt(i++)))>=c||h>E((u-_)/s))&&I("overflow"),_+=h*s,!(h<(p=a<=S?l:a>=S+f?f:a-S));a+=c)s>E(u/(m=c-p))&&I("overflow"),s*=m;S=R(_-o,t=g.length+1,0==o),E(_/t)>u-w&&I("overflow"),w+=E(_/t),_%=t,g.splice(_++,0,w)}return O(g)}function N(e){var t,r,n,i,o,s,a,h,p,m,g,b,_,w,A,k=[];for(b=(e=C(e)).length,t=y,r=0,o=d,s=0;s=t&&gE((u-r)/(_=n+1))&&I("overflow"),r+=(a-t)*_,t=a,s=0;su&&I("overflow"),g==t){for(h=r,p=c;!(h<(m=p<=o?l:p>=o+f?f:p-o));p+=c)A=h-m,w=c-m,k.push(S(T(m+A%w,0))),h=E(A/w);k.push(S(T(h,0))),o=R(r,_,n==i),r=0,++n}++r,++t}return k.join("")}a={version:"1.3.2",ucs2:{decode:C,encode:O},decode:P,encode:N,toASCII:function(e){return k(e,function(e){return g.test(e)?"xn--"+N(e):e})},toUnicode:function(e){return k(e,function(e){return m.test(e)?P(e.slice(4).toLowerCase()):e})}},void 0===(i=function(){return a}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(205)(e),r(18))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(f=y.substr(0,v),h=y.substr(v+1)):(f=y,h=""),p=decodeURIComponent(f),d=decodeURIComponent(h),n(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(n(e))}).join(t):a+encodeURIComponent(n(e[s]))}).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)}).prototype=t}}(),e.lib.WordArray}(r(3))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(r(3))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.algo,i=n.SHA256,o=n.SHA224=i.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}});t.SHA224=i._createHelper(o),t.HmacSHA224=i._createHmacHelper(o)}(),e.SHA224}(r(3),r(100))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.x64,n=r.Word,i=r.WordArray,o=t.algo,s=o.SHA512,a=o.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}});t.SHA384=s._createHelper(a),t.HmacSHA384=s._createHmacHelper(a)}(),e.SHA384}(r(3),r(43),r(101))},function(e,t,r){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.x64.Word,a=r.algo,u=[],c=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){u[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var a=0,f=0,h=0;h<7;h++){if(1&i){var p=(1<>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(O=r[i]).high^=s,O.low^=o}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var p=0,d=0,y=0;y<5;y++)p^=(O=r[h+5*y]).high,d^=O.low;var v=f[h];v.high=p,v.low=d}for(h=0;h<5;h++){var m=f[(h+4)%5],g=f[(h+1)%5],b=g.high,_=g.low;for(p=m.high^(b<<1|_>>>31),d=m.low^(_<<1|b>>>31),y=0;y<5;y++)(O=r[h+5*y]).high^=p,O.low^=d}for(var w=1;w<25;w++){var E=(O=r[w]).high,S=O.low,I=u[w];I<32?(p=E<>>32-I,d=S<>>32-I):(p=S<>>64-I,d=E<>>64-I);var A=f[c[w]];A.high=p,A.low=d}var k=f[0],C=r[0];for(k.high=C.high,k.low=C.low,h=0;h<5;h++)for(y=0;y<5;y++){var O=r[w=h+5*y],x=f[w],T=f[(h+1)%5+5*y],R=f[(h+2)%5+5*y];O.high=x.high^~T.high&R.high,O.low=x.low^~T.low&R.low}O=r[0];var P=l[a];O.high^=P.high,O.low^=P.low}},_doFinalize:function(){var e=this._data,r=e.words,n=(this._nDataBytes,8*e.sigBytes),o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/o)*o>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,u=a/8,c=[],l=0;l>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),c.push(p),c.push(h)}return new i.init(c,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=o._createHelper(h),r.HmacSHA3=o._createHmacHelper(h)}(Math),e.SHA3}(r(3),r(43))},function(e,t,r){e.exports=function(e){ + */ +var n=r(130),i=r(131),o=r(77);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.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 r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(n)return B(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var f=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),c=this.slice(n,i),l=e.slice(t,r),f=0;fi)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function L(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function D(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,o){return o||D(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,o){return o||D(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if(e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},u.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]},u.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])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||x(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||x(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||x(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.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},u.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]},u.prototype.readFloatLE=function(e,t){return t||x(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(13))},function(e,t,r){"use strict";var n=r(27),i=r(88),o=r(59),s=r(89),a=r(90);(e.exports=function(e,t){var r,i,u,c,l;return arguments.length<2||"string"!=typeof e?(c=t,t=e,e=null):c=arguments[2],n(e)?(r=a.call(e,"c"),i=a.call(e,"e"),u=a.call(e,"w")):(r=u=!0,i=!1),l={value:t,configurable:r,enumerable:i,writable:u},c?o(s(c),l):l}).gs=function(e,t,r){var u,c,l,f;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],n(t)?i(t)?n(r)?i(r)||(l=r,r=void 0):r=void 0:(l=t,t=r=void 0):t=void 0,n(e)?(u=a.call(e,"c"),c=a.call(e,"e")):(u=!0,c=!1),f={get:t,set:r,configurable:u,enumerable:c},l?o(s(l),f):f}},function(e,t,r){"use strict";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 i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,function(e){console&&console.warn&&console.warn(e)}(a)}return e}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=function(){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)}.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=y(u,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){"use strict";var n=r(26);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,r){"use strict";r.d(t,"a",function(){return d});var n=r(31),i=r(0),o=r(3),s=r(1),a=r(50);function u(e){"@babel/helpers - typeof";return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){for(var r=0;r=0;i-=1)t._client.Cache.get(r[i])&&(n.push(t._client.Cache.get(r[i])),r.splice(i,1));if(!r.length)return e(null,n);t._client.request("/get_url_meta_data",{method:"post",data:{urls:r}}).then(function(r){return r.data.forEach(function(e){t._client.Cache.set(e.url,e)}),e(null,r.data.concat(n))}).catch(function(r){return e(t._client.error(r))})})}},{key:"createReactionUserListQuery",value:function(){return new a.a(this._client,this.id)}}]),r}();p(d,"__properties",{id:null,type:null,customType:null,attachments:[],body:null,conversationId:null,ownerId:null,owner:{},mentionedUsers:[],isDeleted:null,createdAt:null,updatedAt:null,refMsgId:null,metaData:null,parentId:null,parentMessage:{},originalMessageId:null,reactionsCount:{},reactions:{},replyCount:null,showInConversation:null}),p(d,"basePath",o.a.BASEPATH_MESSAGES)},function(e,t,r){"use strict";r.d(t,"a",function(){return k});var n=r(31),i=r(32),o=r(3),s=r(0),a=r(10),u=r(51),c=r(18),l=r(5),f=r(1);function h(e){"@babel/helpers - typeof";return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null,t=this.config||{};return t=function(e){for(var t=1;t=t.lastReadAt[n]&&e.ownerId!=n&&(r=!1)}),r}},{key:"on",value:function(e,t){if(this.__isWatchingEvent(e)&&!this.__isWatching)throw new Error(s.a.REQUIRED_WATCHING_CONVERSATION);this._client.chsocket.on(e,this.id,t)}},{key:"__isWatchingEvent",value:function(e){return this.__watchingEvents.includes(e)}},{key:"off",value:function(e,t){this._client.chsocket.off(e,this.id,t)}},{key:"startWatching",value:function(e){var t=this;return Object(f.a)(e,function(e){t._client.request(r.basePath+"/"+t.id+"/start_watching",{method:"post"}).then(function(r){return t.__isWatching=!0,e(null,r.data)}).catch(function(r){return e(t._client.error(r))})})}},{key:"stopWatching",value:function(e){var t=this;return Object(f.a)(e,function(e){t._client.request(r.basePath+"/"+t.id+"/stop_watching",{method:"post"}).then(function(r){return t.__isWatching=!1,e(null,r.data)}).catch(function(r){return e(t._client.error(r))})})}},{key:"createWatchersListQuery",value:function(){return new m(this._client,this.id)}},{key:"createMessageListQuery",value:function(){return new u.a(this._client,this.id)}}]),r}();A(k,"__properties",{id:null,type:null,config:{},customType:null,metaData:{},lastMessage:{},lastReadAt:{},title:null,isGroup:null,createdAt:null,memberCount:0,ownerId:null,members:[],profileImageUrl:null,isActive:null,isAdmin:null,isDeleted:null,mute:null,unreadMessageCount:null,updatedAt:null,user:{},watchersCount:0}),A(k,"basePath",o.a.BASEPATH_CONVERSATIONS)},function(e,t,r){"use strict";e.exports=r(162)()?r(40).Symbol:r(165)},function(e,t,r){"use strict";var n=r(34),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var o=Object.create(r(35));o.inherits=r(14);var s=r(76),a=r(80);o.inherits(f,s);for(var u=i(a.prototype),c=0;c>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,i=n.charAt(64);if(i){var o=e.indexOf(i);-1!=o&&(t=o)}for(var s=[],a=0,u=0;u>>6-u%4*2;s[a>>>2]|=c<<24-a%4*8,a++}return r.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(r(4))},function(e,t,r){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var u=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=e[t+0],u=e[t+1],p=e[t+2],d=e[t+3],y=e[t+4],v=e[t+5],m=e[t+6],g=e[t+7],b=e[t+8],_=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],I=e[t+13],A=e[t+14],k=e[t+15],C=o[0],O=o[1],R=o[2],T=o[3];O=h(O=h(O=h(O=h(O=f(O=f(O=f(O=f(O=l(O=l(O=l(O=l(O=c(O=c(O=c(O=c(O,R=c(R,T=c(T,C=c(C,O,R,T,s,7,a[0]),O,R,u,12,a[1]),C,O,p,17,a[2]),T,C,d,22,a[3]),R=c(R,T=c(T,C=c(C,O,R,T,y,7,a[4]),O,R,v,12,a[5]),C,O,m,17,a[6]),T,C,g,22,a[7]),R=c(R,T=c(T,C=c(C,O,R,T,b,7,a[8]),O,R,_,12,a[9]),C,O,w,17,a[10]),T,C,S,22,a[11]),R=c(R,T=c(T,C=c(C,O,R,T,E,7,a[12]),O,R,I,12,a[13]),C,O,A,17,a[14]),T,C,k,22,a[15]),R=l(R,T=l(T,C=l(C,O,R,T,u,5,a[16]),O,R,m,9,a[17]),C,O,S,14,a[18]),T,C,s,20,a[19]),R=l(R,T=l(T,C=l(C,O,R,T,v,5,a[20]),O,R,w,9,a[21]),C,O,k,14,a[22]),T,C,y,20,a[23]),R=l(R,T=l(T,C=l(C,O,R,T,_,5,a[24]),O,R,A,9,a[25]),C,O,d,14,a[26]),T,C,b,20,a[27]),R=l(R,T=l(T,C=l(C,O,R,T,I,5,a[28]),O,R,p,9,a[29]),C,O,g,14,a[30]),T,C,E,20,a[31]),R=f(R,T=f(T,C=f(C,O,R,T,v,4,a[32]),O,R,b,11,a[33]),C,O,S,16,a[34]),T,C,A,23,a[35]),R=f(R,T=f(T,C=f(C,O,R,T,u,4,a[36]),O,R,y,11,a[37]),C,O,g,16,a[38]),T,C,w,23,a[39]),R=f(R,T=f(T,C=f(C,O,R,T,I,4,a[40]),O,R,s,11,a[41]),C,O,d,16,a[42]),T,C,m,23,a[43]),R=f(R,T=f(T,C=f(C,O,R,T,_,4,a[44]),O,R,E,11,a[45]),C,O,k,16,a[46]),T,C,p,23,a[47]),R=h(R,T=h(T,C=h(C,O,R,T,s,6,a[48]),O,R,g,10,a[49]),C,O,A,15,a[50]),T,C,v,21,a[51]),R=h(R,T=h(T,C=h(C,O,R,T,E,6,a[52]),O,R,d,10,a[53]),C,O,w,15,a[54]),T,C,u,21,a[55]),R=h(R,T=h(T,C=h(C,O,R,T,b,6,a[56]),O,R,k,10,a[57]),C,O,m,15,a[58]),T,C,I,21,a[59]),R=h(R,T=h(T,C=h(C,O,R,T,y,6,a[60]),O,R,S,10,a[61]),C,O,p,15,a[62]),T,C,_,21,a[63]),o[0]=o[0]+C|0,o[1]=o[1]+O|0,o[2]=o[2]+R|0,o[3]=o[3]+T|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var o=t.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,n,i,o,s){var a=e+(t&r|~t&n)+i+s;return(a<>>32-o)+t}function l(e,t,r,n,i,o,s){var a=e+(t&n|r&~n)+i+s;return(a<>>32-o)+t}function f(e,t,r,n,i,o,s){var a=e+(t^r^n)+i+s;return(a<>>32-o)+t}function h(e,t,r,n,i,o,s){var a=e+(r^(t|~n))+i+s;return(a<>>32-o)+t}r.MD5=o._createHelper(u),r.HmacMD5=o._createHmacHelper(u)}(Math),e.MD5}(r(4))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,o=t.algo,s=o.MD5,a=o.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),o=i.create(),s=o.words,a=r.keySize,u=r.iterations;s.length=0;t--){if(a.a.getRequiedFilter(["userId","order","wordCount"],e.mentionedUsers[t]).length)return cb(s.a.INVALID_MESSAGE_MENTIONED_USERS)}}e.parentId&&!e.type?e.type="reply":e.type=e.type?e.type:"normal"}}]),r}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(d,"basePath",o.a.BASEPATH_MESSAGES)},function(e,t,r){(function(e){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&t._extend(n,r),g(n.showHidden)&&(n.showHidden=!1),g(n.depth)&&(n.depth=2),g(n.colors)&&(n.colors=!1),g(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function l(e,r,n){if(e.customInspect&&r&&E(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return m(i)||(i=l(e,i,n)),i}var o=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(m(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(v(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),S(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(r);if(0===s.length){if(E(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(b(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(S(r))return f(r)}var c,_="",I=!1,A=["{","}"];(p(r)&&(I=!0,A=["[","]"]),E(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),S(r)&&(_=" "+f(r)),0!==s.length||I&&0!=r.length?n<0?b(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=I?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,_,A)):A[0]+_+A[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),C(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=y(r)?l(e,u.value,null):l(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),g(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function y(e){return null===e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function g(e){return void 0===e}function b(e){return _(e)&&"[object RegExp]"===I(e)}function _(e){return"object"==typeof e&&null!==e}function w(e){return _(e)&&"[object Date]"===I(e)}function S(e){return _(e)&&("[object Error]"===I(e)||e instanceof Error)}function E(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(g(o)&&(o=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=e.pid;s[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else s[r]=function(){};return s[r]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=v,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=g,t.isRegExp=b,t.isObject=_,t.isDate=w,t.isError=S,t.isFunction=E,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(127);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",function(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),k[e.getMonth()],t].join(" ")}(),t.format.apply(t,arguments))},t.inherits=r(14),t._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var O="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(O&&e[O]){var t;if("function"!=typeof(t=e[O]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise(function(e,n){t=e,r=n}),i=[],o=0;o-1?t||"":t,this.isJsonValue?JSON.parse(t):t&&"function"==typeof t.toString?t.toString():t},this.toWireFormat=function(e){return this.isJsonValue?JSON.stringify(e):e}}function p(){a.apply(this,arguments),this.toType=function(e){var t=i.base64.decode(e);if(this.isSensitive&&i.isNode()&&"function"==typeof i.Buffer.alloc){var r=i.Buffer.alloc(t.length,t);t.fill(0),t=r}return t},this.toWireFormat=i.base64.encode}function d(){p.apply(this,arguments)}function y(){a.apply(this,arguments),this.toType=function(e){return"boolean"==typeof e?e:null===e||void 0===e?null:"true"===e}}a.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"},a.types={structure:c,list:l,map:f,boolean:y,timestamp:function(e){var t=this;if(a.apply(this,arguments),e.timestampFormat)o(this,"timestampFormat",e.timestampFormat);else if(t.isTimestampFormatSet&&this.timestampFormat)o(this,"timestampFormat",this.timestampFormat);else if("header"===this.location)o(this,"timestampFormat","rfc822");else if("querystring"===this.location)o(this,"timestampFormat","iso8601");else if(this.api)switch(this.api.protocol){case"json":case"rest-json":o(this,"timestampFormat","unixTimestamp");break;case"rest-xml":case"query":case"ec2":o(this,"timestampFormat","iso8601")}this.toType=function(e){return null===e||void 0===e?null:"function"==typeof e.toUTCString?e:"string"==typeof e||"number"==typeof e?i.date.parseTimestamp(e):null},this.toWireFormat=function(e){return i.date.format(e,t.timestampFormat)}},float:function(){a.apply(this,arguments),this.toType=function(e){return null===e||void 0===e?null:parseFloat(e)},this.toWireFormat=this.toType},integer:function(){a.apply(this,arguments),this.toType=function(e){return null===e||void 0===e?null:parseInt(e,10)},this.toWireFormat=this.toType},string:h,base64:d,binary:p},a.resolve=function(e,t){if(e.shape){var r=t.api.shapes[e.shape];if(!r)throw new Error("Cannot find shape reference: "+e.shape);return r}return null},a.create=function(e,t,r){if(e.isShape)return e;var n=a.resolve(e,t);if(n){var i=Object.keys(e);t.documentation||(i=i.filter(function(e){return!e.match(/documentation/)}));var o=function(){n.constructor.call(this,e,t,r)};return o.prototype=n,new o}e.type||(e.members?e.type="structure":e.member?e.type="list":e.key?e.type="map":e.type="string");var s=e.type;if(a.normalizedTypes[e.type]&&(e.type=a.normalizedTypes[e.type]),a.types[e.type])return new a.types[e.type](e,t,r);throw new Error("Unrecognized shape type: "+s)},a.shapes={StructureShape:c,ListShape:l,MapShape:f,StringShape:h,BooleanShape:y,Base64Shape:d},e.exports=a},function(e,t,r){r(67);var n=r(2),i=n.Service,o=n.apiLoader;o.services.sts={},n.STS=i.defineService("sts",["2011-06-15"]),r(287),Object.defineProperty(o.services.sts,"2011-06-15",{get:function(){var e=r(289);return e.paginators=r(290).pagination,e},enumerable:!0,configurable:!0}),e.exports=n.STS},function(e,t,r){(t=e.exports=r(76)).Stream=t,t.Readable=t,t.Writable=r(80),t.Duplex=r(24),t.Transform=r(83),t.PassThrough=r(137)},function(e,t,r){"use strict";e.exports=r(86)()?Object.setPrototypeOf:r(87)},function(e,t,r){"use strict";e.exports=r(163)()?globalThis:r(164)},function(e,t,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());e.exports=function(e){return n.call(e)===i}},function(e,t,r){"use strict";var n=Object.prototype.toString,i=n.call("");e.exports=function(e){return"string"==typeof e||e&&"object"==typeof e&&(e instanceof String||n.call(e)===i)||!1}},function(e,t,r){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.Base,o=n.WordArray,s=r.x64={};s.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),s.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n=0?"&":"?";var u=[];n.arrayEach(Object.keys(s).sort(),function(e){Array.isArray(s[e])||(s[e]=[s[e]]);for(var t=0;t-1});var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object DataView]"];e.exports={isEmptyData:function(e){return"string"==typeof e?0===e.length:0===e.byteLength},convertToBuffer:function(e){return"string"==typeof e&&(e=new n(e,"utf8")),ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}},function(e,t,r){"use strict";r.d(t,"a",function(){return d});var n=r(9),i=r(5),o=r(3),s=r(0),a=r(48),u=r(1);function c(e){"@babel/helpers - typeof";return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),P(this,"__socketClass",k),P(this,"__socket",void 0),P(this,"__events",{connected:{topic:"connected"},disconnected:{topic:"disconnected"},reconnected:{topic:"reconnected"},"conversation.updated":{topic:"users/[login_user]/conversation/updated"},"conversation.members_added":{topic:"users/[login_user]/conversation/members_added"},"conversation.members_removed":{topic:"users/[login_user]/conversation/members_removed"},"conversation.admin_added":{topic:"users/[login_user]/conversation/admin_added"},"conversation.admin_removed":{topic:"users/[login_user]/conversation/admin_removed"},"conversation.typing":{topic:"users/[login_user]/conversation/typing"},"conversation.mark_as_read":{topic:"users/[login_user]/conversation/mark_as_read"},"message.deleted_for_everyone":{topic:"users/[login_user]/messages/deleted_for_everyone"},"user.friends_added":{topic:"users/[login_user]/friends_added"},"user.friends_removed":{topic:"users/[login_user]/friends_removed"},"user.blocked":{topic:"users/[login_user]/blocked"},"user.unblocked":{topic:"users/[login_user]/unblocked"},"user.conversation_deleted":{topic:"users/[login_user]/conversation_deleted"},"user.conversation_cleared":{topic:"users/[login_user]/conversation_cleared"},"user.mute_updated":{topic:"users/[login_user]/mute_updated"},"user.joined":{topic:"users/[login_user]/joined"},"user.removed":{topic:"users/[login_user]/removed"},"user.message_created":{topic:"users/[login_user]/message_created"},"user.message_deleted":{topic:"users/[login_user]/message_deleted"},"user.total_unread_message_count_updated":{topic:"users/[login_user]/total_unread_message_count_updated"},"user.status_updated":{topic:"users/status_updated"},"user.updated":{topic:"users/updated"},"reaction.added":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/reaction_added"},"reaction.removed":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/reaction_removed"},"watcher.conversation.start_watching":{vars:["conversation_id"],topic:"conversations/[conversation_id]/start_watching"},"watcher.conversation.stop_watching":{vars:["conversation_id"],topic:"conversations/[conversation_id]/stop_watching"},"watcher.message.created":{vars:["conversation_id"],topic:"conversations/[conversation_id]/message_created"},"watcher.message.deleted_for_everyone":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/deleted_for_everyone"}}),P(this,"allowForceResubscribe",!1),P(this,"__baseEvents",["connected","disconnected","reconnected"]),P(this,"__subscribedTopics",{}),P(this,"__preConnectEvents",[]),this.__socket=new this.__socketClass(this),this.__connected=!1,this.__autoSubscribed=!1,this.__publicKey=t.publicKey}return function(e,t,r){t&&x(e.prototype,t),r&&x(e,r)}(e,[{key:"connect",value:function(e,t,r){var n=this;return Object(f.a)(r,function(r){n.__userId=e,n.__socket.connect(e,t,r)})}},{key:"__onConnected",value:function(e){this.__connected=!0,e?this.__trigger("reconnected",null):this.__trigger("connected",null),this.allowForceResubscribe&&e&&this.__autoSubscribed?this.__resubscribe():this.__autoSubscribed||this.__subscribeAll(),this.__preConnectSubscribe(),this.__setUserOnline()}},{key:"__onConnectionLost",value:function(e){this.__connected=!1,this.__trigger("disconnected",e),this.__resetProperties()}},{key:"__disconnect",value:function(){this.__socket.__disconnect()}},{key:"__validate",value:function(e,t,r){if(!this.__isSupported(e))throw new Error(C.a.sprintf(l.a.INVALID_EVENT,e));if(!this.__hasDependencyVars(e))return!0;this.__events[e].vars.forEach(function(r){if(!t[r])throw new Error(C.a.sprintf(l.a.REQUIRED_SOCKET_EVENT_PARAM,r,e))});var n="__validate"+this.__capitalize(e);if("function"==typeof this[n]){var i=this[n](e,t);if(i.error)throw new Error(i.message)}}},{key:"on",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),r=e.pop(),n={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach(function(t){n[t]=e.shift()}),this.__validate(t,n,r),this.__isConnected()||this.__isBaseEvent(t)?this.__subscribe(t,n,r):this.__preConnectAdd(t,n,r)}},{key:"off",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),r={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach(function(t){r[t]=e.shift()}),this.__validate(t,r),!this.__isConnected()&&this.__isBaseEvent(t)||this.__unsubscribe(t,r)}},{key:"__resetProperties",value:function(){this.__autoSubscribed=!1,this.__subscribedTopics={},this.__preConnectEvents=[]}},{key:"__preConnectAdd",value:function(e,t,r){this.__preConnectEvents.push({event:e,params:t,cb:r})}},{key:"__isBaseEvent",value:function(e){return this.__baseEvents.includes(e)}},{key:"__isConnected",value:function(){return this.__connected}},{key:"__preConnectSubscribe",value:function(){for(var e;e=this.__preConnectEvents.shift();)this.__subscribe(e.event,e.params,e.cb)}},{key:"__getEventTopic",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.__events[e].topic,i=this.__events[e].vars;return Array.isArray(n)?n.map(function(e){return t.__replaceTopicVar(e,i,r)}):this.__replaceTopicVar(n,i,r)}},{key:"__isSubscribed",value:function(e){return this.__subscribedTopics.hasOwnProperty(e)}},{key:"__isSupported",value:function(e){return this.__events.hasOwnProperty(e)}},{key:"__hasDependencyVars",value:function(e){return this.__events[e]&&this.__events[e].hasOwnProperty("vars")&&this.__events[e].vars.length}},{key:"__subscribe",value:function(e,t,r){var n=this,i=this.__getEventTopic(e,t);i.includes("[login_user]")&&!this.__userId||(Array.isArray(i)?i:[i]).forEach(function(t){n.__isSubscribed(t)||(n.__isBaseEvent(e)||n.__subscribeSocket(t),n.__subscribedTopics[t]={event:e,cb:[]}),r&&"function"==typeof r&&n.__subscribedTopics[t].cb.push(r)})}},{key:"__unsubscribe",value:function(e,t){var r=this,n=this.__getEventTopic(e,t);n.includes("[login_user]")&&!this.__userId||(Array.isArray(n)?n:[n]).forEach(function(t){r.__isSubscribed(t)&&(r.__isBaseEvent(e)||r.__unsubscribeSocket(t),delete r.__subscribedTopics[t])})}},{key:"__subscribeSocket",value:function(e){this.__socket.__subscribe(this.__publicKey+"/"+e)}},{key:"__unsubscribeSocket",value:function(e){this.__socket.__unsubscribe(this.__publicKey+"/"+e)}},{key:"__publishSocket",value:function(e,t){t=this.__addDefaultProperties(t),e=e.replace("[login_user]",this.__userId),this.__socket.__publish(this.__publicKey+"/"+e,JSON.stringify(t))}},{key:"__addDefaultProperties",value:function(e){return Object.assign(e,{version:"v2"})}},{key:"__subscribeAll",value:function(){var e=this;Object.keys(this.__events).forEach(function(t){e.__hasDependencyVars(t)||e.__subscribe(t,null)}),this.__autoSubscribed=!0}},{key:"__resubscribe",value:function(){var e=this;Object.keys(this.__subscribedTopics).forEach(function(t){var r=e.__subscribedTopics[t].event;e.__isBaseEvent(r)||e.__subscribeSocket(t)})}},{key:"__trigger",value:function(e,t){e=e.replace(this.__publicKey+"/",""),this.__isSubscribed(e)&&this.__subscribedTopics[e].cb.forEach(function(e){e(t)})}},{key:"__processPayload",value:function(e,t){var r=this.__subscribedTopics[e].event;return"function"==typeof T[r]?T[r](e,t):[t]}},{key:"__replaceTopicVar",value:function(e,t,r){return this.__userId&&(e=e.replace("[login_user]",this.__userId)),t&&t.length?(t.forEach(function(t){e=e.replace("["+t+"]",r[t])}),e):e}},{key:"__capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"__validateUserUpdated",value:function(e,t){return{error:"string"!=typeof t.user_id,message:"User Id should be string"}}},{key:"__setUserOnline",value:function(){this.__userId&&this.__publishSocket("users/server/online",{userId:this.__userId})}},{key:"getDependencyEvents",value:function(e){var t=this,r=[];return Object.keys(this.__events).forEach(function(n){var i=t.__events[n].vars;i&&i.includes(e)&&r.push(n)}),r}}]),e}(),L=r(123),D=r.n(L);function j(e,t){for(var r=0;r9?e:"0"+e}function p(e,t,r,n,i,o,a,c,l,f,h,p,d,y){var v=e+"\n"+n+"\n"+i+"\n"+("host:"+r.toLowerCase()+"\n")+"\nhost\n"+s.SHA256(f,{asBytes:!0});!0===d&&console.log("canonical request: "+v+"\n");var m=s.SHA256(v,{asBytes:!0});!0===d&&console.log("hashed canonical request: "+m+"\n");var g="AWS4-HMAC-SHA256\n"+p+"\n"+h+"/"+c+"/"+l+"/aws4_request\n"+m;!0===d&&console.log("string to sign: "+g+"\n");var b=function(e,t,r,n){var i=s.HmacSHA256(t,"AWS4"+e,{asBytes:!0}),o=s.HmacSHA256(r,i,{asBytes:!0}),a=s.HmacSHA256(n,o,{asBytes:!0});return s.HmacSHA256("aws4_request",a,{asBytes:!0})}(a,h,c,l);!0===d&&console.log("signing key: "+b+"\n");var _=s.HmacSHA256(g,b,{asBytes:!0});!0===d&&console.log("signature: "+_+"\n");var w=i+"&X-Amz-Signature="+_;u(y)||(w+="&X-Amz-Security-Token="+encodeURIComponent(y));var S=t+r+n+"?"+w;return!0===d&&console.log("url: "+S+"\n"),S}function d(e,t,r,n){var i=function(){var e=new Date;return e.getUTCFullYear()+""+h(e.getUTCMonth()+1)+h(e.getUTCDate())+"T"+h(e.getUTCHours())+h(e.getUTCMinutes())+h(e.getUTCSeconds())+"Z"}(),o=function(e){return e.substring(0,e.indexOf("T"))}(i),s="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+t+"%2F"+o+"%2F"+e.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+i+"&X-Amz-SignedHeaders=host",a=e.host;return u(e.port)||443===e.port||(a=e.host+":"+e.port),p("GET","wss://",a,"/mqtt",s,0,r,e.region,"iotdevicegateway","",o,i,e.debug,n)}function y(e){var t=e.host;return u(e.port)||443===e.port||(t=e.host+":"+e.port),"wss://"+t+"/mqtt"}function v(e){var t={},r={};return function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(this,e[r],parseInt(r,10))}(e.split(/\r?\n/),function(e){var n=(e=e.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);if(n)r=n[1];else if(r){var i=e.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);i&&(t[r]=t[r]||{},t[r][i[1]]=i[2])}}),t}function m(e){if(!(this instanceof m))return new m(e);var n=this,i=[],s=!0,h=0,p="oldest";i.length=0;var g=[];g.length=0;var b=[],_=!0;b.length=0;var w=[];w.length=0;var S,E,I,A,k="inactive",C=null,O=250,R=1e3,T=2e4,x=128e3,P=null,N="?SDK=JavaScript&Version="+r(242).version;if(u(e)||0===Object.keys(e).length)throw new Error(a.INVALID_CONNECT_OPTIONS);if(u(e.keepalive)&&(e.keepalive=300),(u(e.enableMetrics)||!0===e.enableMetrics)&&(u(e.username)?e.username=N:e.username+=N),u(e.baseReconnectTimeMs)||(R=e.baseReconnectTimeMs),u(e.minimumConnectionTimeMs)||(T=e.minimumConnectionTimeMs),u(e.maximumReconnectTimeMs)||(x=e.maximumReconnectTimeMs),u(e.drainTimeMs)||(O=e.drainTimeMs),u(e.autoResubscribe)||(_=e.autoResubscribe),u(e.offlineQueueing)||(s=e.offlineQueueing),u(e.offlineQueueMaxSize)||(h=e.offlineQueueMaxSize),u(e.offlineQueueDropBehavior)||(p=e.offlineQueueDropBehavior),S=R,e.reconnectPeriod=S,e.fastDisconnectDetection=!0,e.resubscribe=!1,e.baseReconnectTimeMs<=0)throw new Error(a.INVALID_RECONNECT_TIMING);if(x0&&i.length>=h&&("oldest"===p?i.shift():e=!1),e}()&&i.push({topic:e,message:t,options:r,callback:n})},this.subscribe=function(e,t,r){z()&&!1!==_?g.length<50?g.push({type:"subscribe",topics:e,options:t,callback:r}):n.emit("error",new Error("Maximum queued offline subscription reached")):(F("subscribe",e,t),u(r)?H.subscribe(e,t):H.subscribe(e,t,r))},this.unsubscribe=function(t,r){z()&&!1!==_?g.length<50&&g.push({type:"unsubscribe",topics:t,options:e,callback:r}):(F("unsubscribe",t),H.unsubscribe(t,r))},this.end=function(e,t){H.end(e,t)},this.handleMessage=H.handleMessage.bind(H),H.handleMessage=function(e,t){n.handleMessage(e,t)},this.updateWebSocketCredentials=function(e,t,r,n){E=e,I=t,A=r},this.getWebsocketHeaders=function(){return e.websocketOptions.headers},this.updateCustomAuthHeaders=function(t){e.websocketOptions.headers=t},this.simulateNetworkFailure=function(){H.stream.emit("error",new Error("simulated connection error")),H.stream.end()}}i(m,n.EventEmitter),e.exports=m,e.exports.DeviceClient=m,e.exports.prepareWebSocketUrl=d,e.exports.prepareWebSocketCustomAuthUrl=y}).call(this,r(6))},function(e,t){e.exports=function(){for(var e={},t=0;t=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach(function(t,r){t>=e&&(this.__redo__[r]=++t)},this),this.__redo__.push(e)):f(this,"__redo__",u("c",[e])))}),_onDelete:u(function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(t=this.__redo__.indexOf(e))&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,r){t>e&&(this.__redo__[r]=--t)},this)))}),_onClear:u(function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0})}))),f(n.prototype,l.iterator,u(function(){return this}))},function(e,t,r){"use strict";var n=r(204),i=r(206);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),h=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=r(97);function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?N+="x":N+=P[L];if(!N.match(p)){var j=T.slice(0,C),M=T.slice(C+1),U=P.match(d);U&&(j.push(U[1]),M.unshift(U[2])),M.length&&(b="/"+M.join(".")+b),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=n.toASCII(this.hostname));var q=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+q,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[S])for(C=0,x=l.length;C0)&&r.host.split("@"))&&(r.auth=R.shift(),r.host=r.hostname=R.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],k=(r.host||e.host||E.length>1)&&("."===A||".."===A)||""===A,C=0,O=E.length;O>=0;O--)"."===(A=E[O])?E.splice(O,1):".."===A?(E.splice(O,1),C++):C&&(E.splice(O,1),C--);if(!w&&!S)for(;C--;C)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),k&&"/"!==E.join("/").substr(-1)&&E.push("");var R,T=""===E[0]||E[0]&&"/"===E[0].charAt(0);I&&(r.hostname=r.host=T?"":E.length?E.shift():"",(R=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=R.shift(),r.host=r.hostname=R.shift()));return(w=w||r.host&&E.length)&&!T&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";var n=r(210);e.exports=function(e,t){var r;function i(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,(r=n.connect(t)).on("secureConnect",function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i)}),r.on("error",i),r}},function(e,t,r){"use strict";(function(t,n){var i=r(38).Transform,o=r(211),s=r(213),a=r(15).Buffer;e.exports=function(e,r,u){var c,l,f="browser"===t.title,h=!!n.WebSocket,p=f?function e(t,r,n){if(l.bufferedAmount>y)return void setTimeout(e,v,t,r,n);g&&"string"==typeof t&&(t=a.from(t,"utf8"));try{l.send(t)}catch(e){return n(e)}n()}:function(e,t,r){if(l.readyState!==l.OPEN)return void r();g&&"string"==typeof e&&(e=a.from(e,"utf8"));l.send(e,r)};r&&!Array.isArray(r)&&"object"==typeof r&&(u=r,r=null,("string"==typeof u.protocol||Array.isArray(u.protocol))&&(r=u.protocol));u||(u={});void 0===u.objectMode&&(u.objectMode=!(!0===u.binary||void 0===u.binary));var d=function(e,t,r){var n=new i({objectMode:e.objectMode});return n._write=t,n._flush=r,n}(u,p,function(e){l.close(),e()});u.objectMode||(d._writev=E);var y=u.browserBufferSize||524288,v=u.browserBufferTimeout||1e3;"object"==typeof e?l=e:(l=h&&f?new s(e,r):new s(e,r,u)).binaryType="arraybuffer";var m=void 0===l.addEventListener;l.readyState===l.OPEN?c=d:(c=c=o(void 0,void 0,u),u.objectMode||(c._writev=E),m?l.addEventListener("open",b):l.onopen=b);c.socket=l,m?(l.addEventListener("close",_),l.addEventListener("error",w),l.addEventListener("message",S)):(l.onclose=_,l.onerror=w,l.onmessage=S);d.on("close",function(){l.close()});var g=!u.objectMode;function b(){c.setReadable(d),c.setWritable(d),c.emit("connect")}function _(){c.end(),c.destroy()}function w(e){c.destroy(e)}function S(e){var t=e.data;t=t instanceof ArrayBuffer?a.from(t):a.from(t,"utf8"),d.push(t)}function E(e,t){for(var r=new Array(e.length),n=0;n>>31}var f=(n<<5|n>>>27)+u+o[c];f+=c<20?1518500249+(i&s|~i&a):c<40?1859775393+(i^s^a):c<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,u=a,a=s,s=i<<30|i>>>2,i=n,n=f}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s)}(),e.SHA1}(r(4))},function(e,t,r){e.exports=function(e){!function(){var t=e,r=t.lib,n=r.Base,i=t.enc,o=i.Utf8,s=t.algo;s.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),s=this._iKey=t.clone(),a=i.words,u=s.words,c=0;c0)try{var i=JSON.parse(r.body.toString());(i.__type||i.code)&&(t.code=(i.__type||i.code).split("#").pop()),"RequestEntityTooLarge"===t.code?t.message="Request body must be less than 1 MB":t.message=i.message||i.Message||null}catch(i){t.statusCode=r.statusCode,t.message=r.statusMessage}else t.statusCode=r.statusCode,t.message=r.statusCode.toString();e.error=n.error(new Error,t)},extractData:function(e){var t=e.httpResponse.body.toString()||"{}";if(!1===e.request.service.config.convertResponseTypes)e.data=JSON.parse(t);else{var r=e.request.service.api.operations[e.request.operation].output||{},n=new o;e.data=n.parse(t,r)}}}},function(e,t,r){var n=r(7);function i(){}function o(e,t){if(t&&void 0!==e&&null!==e)switch(t.type){case"structure":return function(e,t){var r={};return n.each(e,function(e,n){var i=t.members[e];if(i){if("body"!==i.location)return;var s=i.isLocationName?i.name:e,a=o(n,i);void 0!==a&&(r[s]=a)}}),r}(e,t);case"map":return function(e,t){var r={};return n.each(e,function(e,n){var i=o(n,t.value);void 0!==i&&(r[e]=i)}),r}(e,t);case"list":return function(e,t){var r=[];return n.arrayEach(e,function(e){var n=o(e,t.member);void 0!==n&&r.push(n)}),r}(e,t);default:return function(e,t){return t.toWireFormat(e)}(e,t)}}i.prototype.build=function(e,t){return JSON.stringify(o(e,t))},e.exports=i},function(e,t,r){var n=r(7);function i(){}function o(e,t){if(t&&void 0!==e)switch(t.type){case"structure":return function(e,t){if(null==e)return;var r={},i=t.members;return n.each(i,function(t,n){var i=n.isLocationName?n.name:t;if(Object.prototype.hasOwnProperty.call(e,i)){var s=o(e[i],n);void 0!==s&&(r[t]=s)}}),r}(e,t);case"map":return function(e,t){if(null==e)return;var r={};return n.each(e,function(e,n){var i=o(n,t.value);r[e]=void 0===i?null:i}),r}(e,t);case"list":return function(e,t){if(null==e)return;var r=[];return n.arrayEach(e,function(e){var n=o(e,t.member);void 0===n?r.push(null):r.push(n)}),r}(e,t);default:return function(e,t){return t.toType(e)}(e,t)}}i.prototype.parse=function(e,t){return o(JSON.parse(e),t)},e.exports=i},function(e,t,r){var n=r(7),i=r(2);e.exports={populateHostPrefix:function(e){if(!e.service.config.hostPrefixEnabled)return e;var t=e.service.api.operations[e.operation];if(function(e){var t=e.service.api,r=t.operations[e.operation],i=t.endpointOperation&&t.endpointOperation===n.string.lowerFirst(r.name);return"NULL"!==r.endpointDiscoveryRequired||!0===i}(e))return e;if(t.endpoint&&t.endpoint.hostPrefix){var r=function(e,t,r){return n.each(r.members,function(r,i){if(!0===i.hostLabel){if("string"!=typeof t[r]||""===t[r])throw n.error(new Error,{message:"Parameter "+r+" should be a non-empty string.",code:"InvalidParameter"});var o=new RegExp("\\{"+r+"\\}","g");e=e.replace(o,t[r])}}),e}(t.endpoint.hostPrefix,e.params,t.input);!function(e,t){e.host&&(e.host=t+e.host),e.hostname&&(e.hostname=t+e.hostname)}(e.httpRequest.endpoint,r),function(e){var t=e.split("."),r=/^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/;n.arrayEach(t,function(e){if(!e.length||e.length<1||e.length>63)throw n.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!r.test(e))throw i.util.error(new Error,{code:"ValidationError",message:e+" is not hostname compatible."})})}(e.httpRequest.endpoint.hostname)}return e}}},function(e,t,r){!function(e){"use strict";function t(e){return null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function n(e,i){if(e===i)return!0;if(Object.prototype.toString.call(e)!==Object.prototype.toString.call(i))return!1;if(!0===t(e)){if(e.length!==i.length)return!1;for(var o=0;o":!0,"=":!0,"!":!0},v={" ":!0,"\t":!0,"\n":!0};function m(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e}function g(e){return e>="0"&&e<="9"||"-"===e}function b(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e}function _(){}_.prototype={tokenize:function(e){var t,r,n,i=[];for(this._current=0;this._current"===r?"="===e[this._current]?(this._current++,{type:"GTE",value:">=",start:t}):{type:"GT",value:">",start:t}:"="===r&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,r=this._current,n=e.length;"`"!==e[this._current]&&this._current=0)return!0;if(["true","false","null"].indexOf(e)>=0)return!0;if(!("-0123456789".indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var w={};function S(){}function E(e){this.runtime=e}function I(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[s]}]},avg:{_func:this._functionAvg,_signature:[{types:[h]}]},ceil:{_func:this._functionCeil,_signature:[{types:[s]}]},contains:{_func:this._functionContains,_signature:[{types:[u,c]},{types:[a]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[u]},{types:[u]}]},floor:{_func:this._functionFloor,_signature:[{types:[s]}]},length:{_func:this._functionLength,_signature:[{types:[u,c,l]}]},map:{_func:this._functionMap,_signature:[{types:[f]},{types:[c]}]},max:{_func:this._functionMax,_signature:[{types:[h,p]}]},merge:{_func:this._functionMerge,_signature:[{types:[l],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[c]},{types:[f]}]},sum:{_func:this._functionSum,_signature:[{types:[h]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[u]},{types:[u]}]},min:{_func:this._functionMin,_signature:[{types:[h,p]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[c]},{types:[f]}]},type:{_func:this._functionType,_signature:[{types:[a]}]},keys:{_func:this._functionKeys,_signature:[{types:[l]}]},values:{_func:this._functionValues,_signature:[{types:[l]}]},sort:{_func:this._functionSort,_signature:[{types:[p,h]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[c]},{types:[f]}]},join:{_func:this._functionJoin,_signature:[{types:[u]},{types:[p]}]},reverse:{_func:this._functionReverse,_signature:[{types:[u,c]}]},to_array:{_func:this._functionToArray,_signature:[{types:[a]}]},to_string:{_func:this._functionToString,_signature:[{types:[a]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[a]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[a],variadic:!0}]}}}w.EOF=0,w.UnquotedIdentifier=0,w.QuotedIdentifier=0,w.Rbracket=0,w.Rparen=0,w.Comma=0,w.Rbrace=0,w.Number=0,w.Current=0,w.Expref=0,w.Pipe=1,w.Or=2,w.And=3,w.EQ=5,w.GT=5,w.LT=5,w.GTE=5,w.LTE=5,w.NE=5,w.Flatten=9,w.Star=20,w.Filter=21,w.Dot=40,w.Not=45,w.Lbrace=50,w.Lbracket=55,w.Lparen=60,S.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if("EOF"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Unexpected token type: "+r.type+", value: "+r.value);throw n.name="ParserError",n}return t},_loadTokens:function(e){var t=(new _).tokenize(e);t.push({type:"EOF",value:"",start:e.length}),this.tokens=t},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var r=this.nud(t),n=this._lookahead(0);e=0?this.expression(e):"Lbracket"===t?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===t?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(w[this._lookahead(0)]<10)t={type:"Identity"};else if("Lbracket"===this._lookahead(0))t=this.expression(e);else if("Filter"===this._lookahead(0))t=this.expression(e);else{if("Dot"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+r.value+"("+r.type+")");throw n.name="ParserError",n}this._match("Dot"),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];"Rbracket"!==this._lookahead(0);){var t=this.expression(0);if(e.push(t),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,r,n=[],i=["UnquotedIdentifier","QuotedIdentifier"];;){if(e=this._lookaheadToken(0),i.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match("Colon"),r={type:"KeyValuePair",name:t,value:this.expression(0)},n.push(r),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:n}}},E.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,o){var s,a,u,c,l,f,h,p,d;switch(e.type){case"Field":return null===o?null:r(o)?void 0===(f=o[e.name])?null:f:null;case"Subexpression":for(u=this.visit(e.children[0],o),d=1;d0)for(d=g;db;d+=_)u.push(o[d]);return u;case"Projection":var w=this.visit(e.children[0],o);if(!t(w))return null;for(p=[],d=0;dl;break;case"GTE":u=c>=l;break;case"LT":u=c=e&&(t=r<0?e-1:e),t}},I.prototype={callFunction:function(e,t){var r=this.functionTable[e];if(void 0===r)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,r._signature),r._func.call(this,t)},_validateArgs:function(e,t,r){var n,i,o,s;if(r[r.length-1].variadic){if(t.length=0;n--)r+=t[n];return r}var i=e[0].slice(0);return i.reverse(),i},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,r=e[0],n=0;n=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return r(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],r=this._interpreter,n=e[0],i=e[1],o=0;o0){if(this._getTypeName(e[0][0])===s)return Math.max.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;n0){if(this._getTypeName(e[0][0])===s)return Math.min.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;na?1:sa&&(a=r,t=i[c]);return t},_functionMinBy:function(e){for(var t,r,n=e[1],i=e[0],o=this.createKeyFunction(n,[s,u]),a=1/0,c=0;c=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],function(e){a.headers[e]={}}),n.forEach(["post","put","patch"],function(e){a.headers[e]=n.merge(o)}),e.exports=a}).call(this,r(6))},function(e,t,r){"use strict";(function(t){var n=r(57),i=r(38).Readable,o={objectMode:!0},s={clean:!0},a=r(138);function u(e){if(!(this instanceof u))return new u(e);this.options=e||{},this.options=n(s,e),this._inflights=new a}u.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},u.prototype.createStream=function(){var e=new i(o),r=!1,n=[],s=0;return this._inflights.forEach(function(e,t){n.push(e)}),e._read=function(){!r&&s0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):k(e,s)):w(e,s,t,!1))):n||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=S?e=S:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function I(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(A,e):A(e))}function A(e){p("emit readable"),e.emit("readable"),T(e)}function k(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(C,e,t))}function C(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(N,t,e))}function N(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):I(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&P(this),null;var n,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?x(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P(this)),null!==n&&this.emit("data",n),n},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:b;function c(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",v),e.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",b),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){p("onend"),e.end()}o.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",c);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,T(e))}}(r);e.on("drain",f);var h=!1;var d=!1;function y(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==L(o.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function v(t){p("onerror",t),b(),e.removeListener("error",v),0===a(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),b()}function g(){p("onfinish"),e.removeListener("close",m),b()}function b(){p("unpipe"),r.unpipe(e)}return r.on("data",y),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",v),e.once("close",m),e.once("finish",g),e.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?n:o.nextTick;g.WritableState=m;var c=Object.create(r(35));c.inherits=r(14);var l={deprecate:r(136)},f=r(78),h=r(15).Buffer,p=i.Uint8Array||function(){};var d,y=r(79);function v(){}function m(e,t){a=a||r(24),e=e||{};var n=t instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(o.nextTick(i,n),o.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),I(e,t))}(e,r,n,t,i);else{var s=S(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),n?u(_,e,r,s,i):_(e,r,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function g(e){if(a=a||r(24),!(d.call(g,this)||this instanceof a))return new g(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),I(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,b(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(b(e,t,!1,t.objectMode?1:c.length,c,l,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function E(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),I(e,t)})}function I(e,t){var r=S(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(E,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}c.inherits(g,f),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===g&&(e&&e._writableState instanceof m)}})):d=function(e){return e instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&function(e){return h.isBuffer(e)||e instanceof p}(e);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=v),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),o.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),o.nextTick(n,s),i=!1),i}(this,n,e,r))&&(n.pendingcb++,i=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,I(e,t),r&&(t.finished?o.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),g.prototype.destroy=y.destroy,g.prototype._undestroy=y.undestroy,g.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(6),r(81).setImmediate,r(13))},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(135),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(13))},function(e,t,r){"use strict";var n=r(15).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=o;var n=r(24),i=Object.create(r(35));function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),this._transformState={afterTransform:function(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length65535||c%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;d+=2;if(d+=1,a){if("object"!=typeof a)return t.emit("error",new Error("Invalid will")),!1;if(!a.topic||"string"!=typeof a.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(d+=i.byteLength(a.topic)+2,a.payload&&a.payload){if(!(a.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof a.payload?d+=i.byteLength(a.payload)+2:d+=a.payload.length+2}else d+=2}var y=!1;if(null!=f){if(!E(f))return t.emit("error",new Error("Invalid username")),!1;y=!0,d+=i.byteLength(f)+2}if(null!=p){if(!y)return t.emit("error",new Error("Username is required to use password")),!1;if(!E(p))return t.emit("error",new Error("Invalid password")),!1;d+=S(p)+2}t.write(n.CONNECT_HEADER),m(t,d),w(t,o),t.write(4===s?n.VERSION4:n.VERSION3);var v=0;v|=null!=f?n.USERNAME_MASK:0,v|=null!=p?n.PASSWORD_MASK:0,v|=a&&a.retain?n.WILL_RETAIN_MASK:0,v|=a&&a.qos?a.qos<0&&h(t,l);return t.write(c)}(e,t);case"puback":case"pubrec":case"pubrel":case"pubcomp":case"unsuback":return function(e,t){var r=e||{},i=r.cmd||"puback",o=r.messageId,s=r.dup&&"pubrel"===i?n.DUP_MASK:0,a=0;"pubrel"===i&&(a=1);if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;return t.write(n.ACKS[i][a][s][0]),m(t,2),h(t,o)}(e,t);case"subscribe":return function(e,t){var r=e||{},o=r.dup?n.DUP_MASK:0,s=r.messageId,a=r.subscriptions,u=0;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;u+=2;if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(var c=0;c=0&&e<128?1:e>=128&&e<16384?2:e>=16384&&e<2097152?3:e>=2097152&&e<268435456?4:0}(e));do{t=e%128|0,(e=e/128|0)>0&&(t|=128),n.writeUInt8(t,r++)}while(e>0);return n}(t),t<16384&&(v[t]=r)),e.write(r)}function g(e,t){var r=i.byteLength(t);h(e,r),e.write(t,"utf8")}function b(e,t){return e.write(c[t])}function _(e,t){return e.write(l(t))}function w(e,t){"string"==typeof t?g(e,t):t?(h(e,t.length),e.write(t)):h(e,0)}function S(e){return e?e instanceof i?e.length:i.byteLength(e):0}function E(e){return"string"==typeof e||e instanceof i}e.exports=d},function(e,t,r){"use strict";t.decode=t.parse=r(207),t.encode=t.stringify=r(208)},function(e,t,r){"use strict";var n=r(209);e.exports=function(e,t){var r,i;return t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost",r=t.port,i=t.hostname,n.createConnection(r,i)}},function(e,t,r){"use strict";var n=!1,i=[];function o(e){n?wx.sendSocketMessage({data:e.buffer||e}):i.push(e)}var s=r(63);function a(e,t){var r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var a=function(e,t){var r="wxs"===e.protocol?"wss":"ws",n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s(function(e,t){var r={OPEN:1,CLOSING:2,CLOSED:3,readyState:n?1:0,send:o,close:wx.closeSocket,onopen:null,onmessage:null,onclose:null,onerror:null};return wx.connectSocket({url:e,protocols:t}),wx.onSocketOpen(function(e){r.readyState=r.OPEN,n=!0;for(var t=0;t>>7)^(d<<14|d>>>18)^d>>>3,v=c[p-2],m=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;c[p]=y+c[p-7]+m+c[p-16]}var g=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[p]+c[p];h=f,f=l,l=a,a=s+_|0,s=o,o=i,i=n,n=_+(b+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=o._createHelper(l),r.HmacSHA256=o._createHmacHelper(l)}(Math),e.SHA256}(r(4))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,i=n.Word,o=n.WordArray,s=t.algo;function a(){return i.create.apply(i,arguments)}var u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=a()}();var l=s.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],f=r[6],h=r[7],p=n.high,d=n.low,y=i.high,v=i.low,m=o.high,g=o.low,b=s.high,_=s.low,w=a.high,S=a.low,E=l.high,I=l.low,A=f.high,k=f.low,C=h.high,O=h.low,R=p,T=d,x=y,P=v,N=m,L=g,D=b,j=_,M=w,U=S,q=E,B=I,F=A,z=k,H=C,V=O,K=0;K<80;K++){var W=c[K];if(K<16)var G=W.high=0|e[t+2*K],Y=W.low=0|e[t+2*K+1];else{var X=c[K-15],Q=X.high,J=X.low,$=(Q>>>1|J<<31)^(Q>>>8|J<<24)^Q>>>7,Z=(J>>>1|Q<<31)^(J>>>8|Q<<24)^(J>>>7|Q<<25),ee=c[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=c[K-7],se=oe.high,ae=oe.low,ue=c[K-16],ce=ue.high,le=ue.low;G=(G=(G=$+se+((Y=Z+ae)>>>0>>0?1:0))+ne+((Y+=ie)>>>0>>0?1:0))+ce+((Y+=le)>>>0>>0?1:0),W.high=G,W.low=Y}var fe,he=M&q^~M&F,pe=U&B^~U&z,de=R&x^R&N^x&N,ye=T&P^T&L^P&L,ve=(R>>>28|T<<4)^(R<<30|T>>>2)^(R<<25|T>>>7),me=(T>>>28|R<<4)^(T<<30|R>>>2)^(T<<25|R>>>7),ge=(M>>>14|U<<18)^(M>>>18|U<<14)^(M<<23|U>>>9),be=(U>>>14|M<<18)^(U>>>18|M<<14)^(U<<23|M>>>9),_e=u[K],we=_e.high,Se=_e.low,Ee=H+ge+((fe=V+be)>>>0>>0?1:0),Ie=me+ye;H=F,V=z,F=q,z=B,q=M,B=U,M=D+(Ee=(Ee=(Ee=Ee+he+((fe+=pe)>>>0>>0?1:0))+we+((fe+=Se)>>>0>>0?1:0))+G+((fe+=Y)>>>0>>0?1:0))+((U=j+fe|0)>>>0>>0?1:0)|0,D=N,j=L,N=x,L=P,x=R,P=T,R=Ee+(ve+de+(Ie>>>0>>0?1:0))+((T=fe+Ie|0)>>>0>>0?1:0)|0}d=n.low=d+T,n.high=p+R+(d>>>0>>0?1:0),v=i.low=v+P,i.high=y+x+(v>>>0

>>0?1:0),g=o.low=g+L,o.high=m+N+(g>>>0>>0?1:0),_=s.low=_+j,s.high=b+D+(_>>>0>>0?1:0),S=a.low=S+U,a.high=w+M+(S>>>0>>0?1:0),I=l.low=I+B,l.high=E+q+(I>>>0>>0?1:0),k=f.low=k+z,f.high=A+F+(k>>>0>>0?1:0),O=h.low=O+V,h.high=C+H+(O>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(l),t.HmacSHA512=r._createHmacHelper(l)}(),e.SHA512}(r(4),r(43))},function(e,t,r){var n=r(2),i=r(7),o=r(247),s=r(36),a=r(71).populateHostPrefix;e.exports={buildRequest:function(e){var t=e.service.api.operations[e.operation],r=e.httpRequest;r.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",r.params={Version:e.service.api.apiVersion,Action:t.name},(new o).serialize(e.params,t.input,function(e,t){r.params[e]=t}),r.body=i.queryParamsToString(r.params),a(e)},extractError:function(e){var t,r=e.httpResponse.body.toString();if(r.match("0){var f=(t=new n.XML.Parser).parse(s.toString(),u);i.update(e.data,f)}}}},function(e,t,r){var n=r(104),i=r(108),o=r(36),s=r(109),a=r(110),u=r(111),c=r(7),l=c.property,f=c.memoizedProperty;e.exports=function(e,t){var r=this;e=e||{},(t=t||{}).api=this,e.metadata=e.metadata||{};var h=t.serviceIdentifier;delete t.serviceIdentifier,l(this,"isApi",!0,!1),l(this,"apiVersion",e.metadata.apiVersion),l(this,"endpointPrefix",e.metadata.endpointPrefix),l(this,"signingName",e.metadata.signingName),l(this,"globalEndpoint",e.metadata.globalEndpoint),l(this,"signatureVersion",e.metadata.signatureVersion),l(this,"jsonVersion",e.metadata.jsonVersion),l(this,"targetPrefix",e.metadata.targetPrefix),l(this,"protocol",e.metadata.protocol),l(this,"timestampFormat",e.metadata.timestampFormat),l(this,"xmlNamespaceUri",e.metadata.xmlNamespace),l(this,"abbreviation",e.metadata.serviceAbbreviation),l(this,"fullName",e.metadata.serviceFullName),l(this,"serviceId",e.metadata.serviceId),h&&u[h]&&l(this,"xmlNoDefaultLists",u[h].xmlNoDefaultLists,!1),f(this,"className",function(){var t=e.metadata.serviceAbbreviation||e.metadata.serviceFullName;return t?("ElasticLoadBalancing"===(t=t.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g,""))&&(t="ELB"),t):null}),l(this,"operations",new n(e.operations,t,function(e,r){return new i(e,r,t)},c.string.lowerFirst,function(e,t){!0===t.endpointoperation&&l(r,"endpointOperation",c.string.lowerFirst(e))})),l(this,"shapes",new n(e.shapes,t,function(e,r){return o.create(r,t)})),l(this,"paginators",new n(e.paginators,t,function(e,r){return new s(e,r,t)})),l(this,"waiters",new n(e.waiters,t,function(e,r){return new a(e,r,t)},c.string.lowerFirst)),t.documentation&&(l(this,"documentation",e.documentation),l(this,"documentationUrl",e.documentationUrl))}},function(e,t,r){var n=r(36),i=r(7),o=i.property,s=i.memoizedProperty;e.exports=function(e,t,r){var i=this;r=r||{},o(this,"name",t.name||e),o(this,"api",r.api,!1),t.http=t.http||{},o(this,"endpoint",t.endpoint),o(this,"httpMethod",t.http.method||"POST"),o(this,"httpPath",t.http.requestUri||"/"),o(this,"authtype",t.authtype||""),o(this,"endpointDiscoveryRequired",t.endpointdiscovery?t.endpointdiscovery.required?"REQUIRED":"OPTIONAL":"NULL"),s(this,"input",function(){return t.input?n.create(t.input,r):new n.create({type:"structure"},r)}),s(this,"output",function(){return t.output?n.create(t.output,r):new n.create({type:"structure"},r)}),s(this,"errors",function(){var e=[];if(!t.errors)return null;for(var i=0;i-1&&r.splice(i,1)}return this},removeAllListeners:function(e){return e?delete this._events[e]:this._events={},this},emit:function(e,t,r){r||(r=function(){});var n=this.listeners(e),i=n.length;return this.callListeners(n,t,r),i>0},callListeners:function(e,t,r,i){var o=this,s=i||null;function a(i){if(i&&(s=n.util.error(s||new Error,i),o._haltHandlersOnError))return r.call(o,s);o.callListeners(e,t,r,s)}for(;e.length>0;){var u=e.shift();if(u._isAsync)return void u.apply(o,t.concat([a]));try{u.apply(o,t)}catch(e){s=n.util.error(s||new Error,e)}if(s&&o._haltHandlersOnError)return void r.call(o,s)}r.call(o,s)},addListeners:function(e){var t=this;return e._events&&(e=e._events),n.util.each(e,function(e,r){"function"==typeof r&&(r=[r]),n.util.arrayEach(r,function(r){t.on(e,r)})}),t},addNamedListener:function(e,t,r,n){return this[e]=r,this.addListener(t,r,n),this},addNamedAsyncListener:function(e,t,r,n){return r._isAsync=!0,this.addNamedListener(e,t,r,n)},addNamedListeners:function(e){var t=this;return e(function(){t.addNamedListener.apply(t,arguments)},function(){t.addNamedAsyncListener.apply(t,arguments)}),this}}),n.SequentialExecutor.prototype.addListener=n.SequentialExecutor.prototype.on,e.exports=n.SequentialExecutor},function(e,t,r){var n=r(2);n.Credentials=n.util.inherit({constructor:function(){if(n.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof arguments[0]){var e=arguments[0].credentials||arguments[0];this.accessKeyId=e.accessKeyId,this.secretAccessKey=e.secretAccessKey,this.sessionToken=e.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var e=n.util.date.getDate().getTime(),t=new Date(e+1e3*this.expiryWindow);return!!(this.expireTime&&t>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(e){var t=this;this.needsRefresh()?this.refresh(function(r){r||(t.expired=!1),e&&e(r)}):e&&e()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,t){var r=this;1===r.refreshCallbacks.push(e)&&r.load(function(e){n.util.arrayEach(r.refreshCallbacks,function(r){t?r(e):n.util.defer(function(){r(e)})}),r.refreshCallbacks.length=0})},load:function(e){e()}}),n.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=n.util.promisifyMethod("get",e),this.prototype.refreshPromise=n.util.promisifyMethod("refresh",e)},n.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},n.util.addPromises(n.Credentials)},function(e,t,r){var n=r(2);n.CredentialProviderChain=n.util.inherit(n.Credentials,{constructor:function(e){this.providers=e||n.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var t=this;if(0===t.providers.length)return e(new Error("No providers")),t;if(1===t.resolveCallbacks.push(e)){var r=0,i=t.providers.slice(0);!function e(o,s){if(!o&&s||r===i.length)return n.util.arrayEach(t.resolveCallbacks,function(e){e(o,s)}),void(t.resolveCallbacks.length=0);var a=i[r++];(s="function"==typeof a?a.call():a).get?s.get(function(t){e(t,t?null:s)}):e(null,s)}()}return t}}),n.CredentialProviderChain.defaultProviders=[],n.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=n.util.promisifyMethod("resolve",e)},n.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},n.util.addPromises(n.CredentialProviderChain)},function(e,t,r){var n=r(2),i=n.util.inherit;n.Endpoint=i({constructor:function(e,t){if(n.util.hideProperties(this,["slashes","auth","hash","search","query"]),void 0===e||null===e)throw new Error("Invalid endpoint: "+e);if("string"!=typeof e)return n.util.copy(e);e.match(/^http/)||(e=((t&&void 0!==t.sslEnabled?t.sslEnabled:n.config.sslEnabled)?"https":"http")+"://"+e);n.util.update(this,n.util.urlParse(e)),this.port?this.port=parseInt(this.port,10):this.port="https:"===this.protocol?443:80}}),n.HttpRequest=i({constructor:function(e,t){e=new n.Endpoint(e),this.method="POST",this.path=e.path||"/",this.headers={},this.body="",this.endpoint=e,this.region=t,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=n.util.userAgent()},getUserAgentHeaderName:function(){return(n.util.isBrowser()?"X-Amz-":"")+"User-Agent"},appendToUserAgent:function(e){"string"==typeof e&&e&&(this._userAgent+=" "+e),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var e=this.path.split("?",2)[1];return e?(e=n.util.queryStringParse(e),n.util.queryParamsToString(e)):""},updateEndpoint:function(e){var t=new n.Endpoint(e);this.endpoint=t,this.path=t.path||"/",this.headers.Host&&(this.headers.Host=t.host)}}),n.HttpResponse=i({constructor:function(){this.statusCode=void 0,this.headers={},this.body=void 0,this.streaming=!1,this.stream=null},createUnbufferedStream:function(){return this.streaming=!0,this.stream}}),n.HttpClient=i({}),n.HttpClient.getInstance=function(){return void 0===this.singleton&&(this.singleton=new this),this.singleton}},function(e,t,r){var n=r(2),i=n.util.inherit;n.Signers.V3=i(n.Signers.RequestSigner,{addAuthorization:function(e,t){var r=n.util.date.rfc822(t);this.request.headers["X-Amz-Date"]=r,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken),this.request.headers["X-Amzn-Authorization"]=this.authorization(e,r)},authorization:function(e){return"AWS3 AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,SignedHeaders="+this.signedHeaders()+",Signature="+this.signature(e)},signedHeaders:function(){var e=[];return n.util.arrayEach(this.headersToSign(),function(t){e.push(t.toLowerCase())}),e.sort().join(";")},canonicalHeaders:function(){var e=this.request.headers,t=[];return n.util.arrayEach(this.headersToSign(),function(r){t.push(r.toLowerCase().trim()+":"+String(e[r]).trim())}),t.sort().join("\n")+"\n"},headersToSign:function(){var e=[];return n.util.each(this.request.headers,function(t){("Host"===t||"Content-Encoding"===t||t.match(/^X-Amz/i))&&e.push(t)}),e},signature:function(e){return n.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push("/"),e.push(""),e.push(this.canonicalHeaders()),e.push(this.request.body),n.util.crypto.sha256(e.join("\n"))}}),e.exports=n.Signers.V3},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n1&&void 0!==arguments[1]?arguments[1]:0,r=(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase();if(!a(r))throw TypeError("Stringified UUID is invalid");return r},p=0,d=0;var y=function(e,t,r){var n=t&&r||0,i=t||new Array(16),s=(e=e||{}).node||l,a=void 0!==e.clockseq?e.clockseq:f;if(null==s||null==a){var u=e.random||(e.rng||o)();null==s&&(s=l=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=f=16383&(u[6]<<8|u[7]))}var c=void 0!==e.msecs?e.msecs:Date.now(),y=void 0!==e.nsecs?e.nsecs:d+1,v=c-p+(y-d)/1e4;if(v<0&&void 0===e.clockseq&&(a=a+1&16383),(v<0||c>p)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=c,d=y,f=a;var m=(1e4*(268435455&(c+=122192928e5))+y)%4294967296;i[n++]=m>>>24&255,i[n++]=m>>>16&255,i[n++]=m>>>8&255,i[n++]=255&m;var g=c/4294967296*1e4&268435455;i[n++]=g>>>8&255,i[n++]=255&g,i[n++]=g>>>24&15|16,i[n++]=g>>>16&255,i[n++]=a>>>8|128,i[n++]=255&a;for(var b=0;b<6;++b)i[n+b]=s[b];return t||h(i)};var v=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};var m=function(e,t,r){function n(e,n,i,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r>>9<<4)+1}function b(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function _(e,t,r,n,i,o){return b(function(e,t){return e<>>32-t}(b(b(t,e),b(n,o)),i),r)}function w(e,t,r,n,i,o,s){return _(t&r|~t&n,e,t,i,o,s)}function S(e,t,r,n,i,o,s){return _(t&n|r&~n,e,t,i,o,s)}function E(e,t,r,n,i,o,s){return _(t^r^n,e,t,i,o,s)}function I(e,t,r,n,i,o,s){return _(r^(t|~n),e,t,i,o,s)}var A=m("v3",48,function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r>5]>>>n%32&255,o=parseInt("0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>32-t}var R=m("v5",80,function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i>>0;b=g,g=m,m=O(v,30)>>>0,v=y,y=S}r[0]=r[0]+y>>>0,r[1]=r[1]+v>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+g>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]}),T="00000000-0000-0000-0000-000000000000";var x=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},function(e,t,r){e.exports=r(301)},function(e,t,r){"use strict";r.d(t,"a",function(){return v});var n=r(55),i=r(47),o=r(49),s=r(32),a=r(53),u=r(5),c=r(22),l=r(21),f=r(48),h=r(52),p=r(51),d=r(54),y=r(50),v={User:{Service:i.a,Model:u.a,ListQuery:f.a},Conversation:{Service:o.a,Model:c.a,ListQuery:h.a},Message:{Service:s.a,Model:l.a,ListQuery:p.a,ReactionUserListQuery:y.a},File:{Service:d.a},PushNotification:{Service:a.a},Client:n.a}},function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Channelize",function(){return o}),r.d(t,"core",function(){return a}),r.d(t,"client",function(){return u});var n=r(55),i=r(124);e.Channelize?console.error("ERROR: It appears that you have multiple copies of the Channelize WebSDK in your build!"):e.Channelize={core:i.a,client:n.a};var o=e.Channelize,s=e.Channelize,a=s.core,u=s.client}.call(this,r(13))},function(e,t,r){e.exports.device=r(56),e.exports.thingShadow=r(245),e.exports.jobs=r(246)},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t,r){"use strict";(function(t){var n=r(129),i=r(75),o=r(61),s=r(57),a={};function u(e,t){if("object"!=typeof e||t||(t=e,e=null),t=t||{},e){var r=o.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=s(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){var t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!a[t.protocol]){var i=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs"].filter(function(e,t){return(!i||t%2!=0)&&"function"==typeof a[e]})[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");return t.protocol&&(t.defaultProtocol=t.protocol),new n(function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),a[t.protocol](e,t)},t)}"browser"!==t.title?(a.mqtt=r(98),a.tcp=r(98),a.ssl=r(62),a.tls=r(62),a.mqtts=r(62)):(a.wx=r(99),a.wxs=r(99)),a.ws=r(100),a.wss=r(100),e.exports=u,e.exports.connect=u,e.exports.MqttClient=n,e.exports.Store=i}).call(this,r(6))},function(e,t,r){"use strict";(function(t,n){var i=r(19),o=r(75),s=r(94),a=r(195),u=r(38).Writable,c=r(14),l=r(202),f=r(203),h=r(57),p=t.setImmediate||function(e){n.nextTick(e)},d={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0};function y(e,t,r){e.emit("packetsend",t),!a.writeToStream(t,e.stream)&&r?e.stream.once("drain",r):r&&r()}function v(e,t,r){e.outgoingStore.put(t,function(n){if(n)return r&&r(n);y(e,t,r)})}function m(){}function g(e,t){var r,n=this;if(!(this instanceof g))return new g(e,t);for(r in this.options=t||{},d)void 0===this.options[r]?this.options[r]=d[r]:this.options[r]=t[r];this.options.clientId="string"==typeof this.options.clientId?this.options.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),this.streamBuilder=e,this.outgoingStore=this.options.outgoingStore||new o,this.incomingStore=this.options.incomingStore||new o,this.queueQoSZero=void 0===this.options.queueQoSZero||this.options.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this.on("connect",function(){if(!this.disconnected){this.connected=!0;var e=this.outgoingStore.createStream();this.once("close",t),e.on("end",function(){n.removeListener("close",t)}),e.on("error",function(e){n.removeListener("close",t),n.emit("error",e)}),function t(){if(e){var r,i=e.read(1);i?n.disconnecting||n.reconnectTimer?e.destroy&&e.destroy():(r=n.outgoing[i.messageId],n.outgoing[i.messageId]=function(e,n){r&&r(e,n),t()},n._sendPacket(i)):e.once("readable",t)}}()}function t(){e.destroy(),e=null}}),this.on("close",function(){this.connected=!1,clearTimeout(this.connackTimer)}),this.on("connect",this._setupPingTimer),this.on("connect",function(){var e=this.queue;!function t(){var r,i=e.shift();i&&(r=i.packet,n._sendPacket(r,function(e){i.cb&&i.cb(e),t()}))}()});var s=!0;this.on("connect",function(){!s&&this.options.clean&&Object.keys(this._resubscribeTopics).length>0&&(this.options.resubscribe?(this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics)):this._resubscribeTopics={}),s=!1}),this.on("close",function(){null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null)}),this.on("close",this._setupReconnect),i.EventEmitter.call(this),this._setupStream()}c(g,i.EventEmitter),g.prototype._setupStream=function(){var e,t=this,r=new u,i=a.parser(this.options),o=null,c=[];function l(){n.nextTick(f)}function f(){var e=c.shift(),r=o;e?t._handlePacket(e,l):(o=null,r())}this._clearReconnect(),this.stream=this.streamBuilder(this),i.on("packet",function(e){c.push(e)}),r._write=function(e,t,r){o=r,i.parse(e),f()},this.stream.pipe(r),this.stream.on("error",m),s(this.stream,this.emit.bind(this,"close")),(e=Object.create(this.options)).cmd="connect",y(this,e),i.on("error",this.emit.bind(this,"error")),this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){t._cleanUp(!0)},this.options.connectTimeout)},g.prototype._handlePacket=function(e,t){switch(this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"pingresp":this._handlePingresp(e),t()}},g.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},g.prototype.publish=function(e,t,r,n){var i;"function"==typeof r&&(n=r,r=null);if(r=h({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;switch(i={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:this._nextId(),dup:r.dup},r.qos){case 1:case 2:this.outgoing[i.messageId]=n||m,this._sendPacket(i);break;default:this._sendPacket(i,n)}return this},g.prototype.subscribe=function(){var e,t,r=Array.prototype.slice.call(arguments),n=[],i=r.shift(),o=i.resubscribe,s=r.pop()||m,a=r.pop(),u=this;if(delete i.resubscribe,"string"==typeof i&&(i=[i]),"function"!=typeof s&&(a=s,s=m),null!==(t=f.validateTopics(i)))return p(s,new Error("Invalid topic "+t)),this;if(this._checkDisconnecting(s))return this;if(a=h({qos:0},a),Array.isArray(i)?i.forEach(function(e){(u._resubscribeTopics[e]0&&(u._resubscribeTopics[e.topic]=e.qos,c.push(e.topic))}),u.messageIdToTopic[e.messageId]=c}return this.outgoing[e.messageId]=function(e,t){if(!e)for(var r=t.granted,i=0;i0?this.once("outgoingEmpty",setTimeout.bind(null,i,10)):i(),this)},g.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e];return delete this.outgoing[e],this.outgoingStore.del({messageId:e},function(){t(new Error("Message removed"))}),this},g.prototype.reconnect=function(e){var t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},g.prototype._reconnect=function(){this.emit("reconnect"),this._setupStream()},g.prototype._setupReconnect=function(){var e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0&&(this.reconnecting||(this.emit("offline"),this.reconnecting=!0),e.reconnectTimer=setInterval(function(){e._reconnect()},e.options.reconnectPeriod))},g.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},g.prototype._cleanUp=function(e,t){t&&this.stream.on("close",t),e?(0===this.options.reconnectPeriod&&this.options.clean&&function(e){e&&Object.keys(e).forEach(function(t){"function"==typeof e[t]&&(e[t](new Error("Connection closed")),delete e[t])})}(this.outgoing),this.stream.destroy()):this._sendPacket({cmd:"disconnect"},p.bind(null,this.stream.end.bind(this.stream))),this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(this.stream.removeListener("close",t),t())},g.prototype._sendPacket=function(e,t){if(this.connected){switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void v(this,e,t);default:return void y(this,e,t)}switch(e.qos){case 2:case 1:v(this,e,t);break;case 0:default:y(this,e,t)}}else 0===(e.qos||0)&&this.queueQoSZero||"publish"!==e.cmd?this.queue.push({packet:e,cb:t}):e.qos>0?(t=this.outgoing[e.messageId],this.outgoingStore.put(e,function(e){if(e)return t&&t(e)})):t&&t(new Error("No connection to broker"))},g.prototype._setupPingTimer=function(){var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=l(function(){e._checkPing()},1e3*this.options.keepalive))},g.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},g.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):this._cleanUp(!0)},g.prototype._handlePingresp=function(){this.pingResp=!0},g.prototype._handleConnack=function(e){var t=e.returnCode;if(clearTimeout(this.connackTimer),0===t)this.reconnecting=!1,this.emit("connect",e);else if(t>0){var r=new Error("Connection refused: "+["","Unacceptable protocol version","Identifier rejected","Server unavailable","Bad username or password","Not authorized"][t]);r.code=t,this.emit("error",r)}},g.prototype._handlePublish=function(e,t){t=void 0!==t?t:m;var r=e.topic.toString(),n=e.payload,i=e.qos,o=e.messageId,s=this;switch(i){case 2:this.incomingStore.put(e,function(e){if(e)return t(e);s._sendPacket({cmd:"pubrec",messageId:o},t)});break;case 1:this.emit("message",r,n,e),this.handleMessage(e,function(e){if(e)return t(e);s._sendPacket({cmd:"puback",messageId:o},t)});break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t)}},g.prototype.handleMessage=function(e,t){t()},g.prototype._handleAck=function(e){var t=e.messageId,r=e.cmd,n=null,i=this.outgoing[t],o=this;if(i){switch(r){case"pubcomp":case"puback":delete this.outgoing[t],this.outgoingStore.del(e,i);break;case"pubrec":n={cmd:"pubrel",qos:2,messageId:t},this._sendPacket(n);break;case"suback":if(delete this.outgoing[t],1===e.granted.length&&0!=(128&e.granted[0])){var s=this.messageIdToTopic[t];s&&s.forEach(function(e){delete o._resubscribeTopics[e]})}i(null,e);break;case"unsuback":delete this.outgoing[t],i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}},g.prototype._handlePubrel=function(e,t){t=void 0!==t?t:m;var r=this,n={cmd:"pubcomp",messageId:e.messageId};r.incomingStore.get(e,function(i,o){i||"pubrel"===o.cmd?r._sendPacket(n,t):(r.emit("message",o.topic,o.payload,o),r.incomingStore.put(e,function(e){if(e)return t(e);r.handleMessage(o,function(e){if(e)return t(e);r._sendPacket(n,t)})}))})},g.prototype._nextId=function(){var e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},g.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},e.exports=g}).call(this,r(13),r(6))},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],a=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function f(e,t,r){for(var n,i=[],o=t;o>1,l=-7,f=r?i-1:0,h=r?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},function(e,t){},function(e,t,r){"use strict";var n=r(15).Buffer,i=r(134);function o(e,t,r){e.copy(t,r)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t=n.allocUnsafe(e>>>0),r=this.head,i=0;r;)o(r.data,t,i),i+=r.data.length,r=r.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i=1,o={},s=!1,a=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick(function(){l(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?function(){var t="setImmediate$"+Math.random()+"$",r=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&l(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),n=function(r){e.postMessage(t+r,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){l(e.data)},n=function(t){e.port2.postMessage(t)}}():a&&"onreadystatechange"in a.createElement("script")?function(){var e=a.documentElement;n=function(t){var r=a.createElement("script");r.onreadystatechange=function(){l(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():n=function(e){setTimeout(l,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0?c(l):i(this.length)-c(u(l));t0?1:-1}},function(e,t,r){"use strict";var n=r(26),i={function:!0,object:!0};e.exports=function(e){return n(e)&&i[typeof e]||!1}},function(e,t,r){"use strict";var n,i=Object.create;r(86)()||(n=r(87)),e.exports=function(){var e,t,r;return n?1!==n.level?i:(e={},t={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(e){t[e]="__proto__"!==e?r:{configurable:!0,enumerable:!1,writable:!0,value:void 0}}),Object.defineProperties(e,t),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:e}),function(t,r){return i(null===t?e:t,r)}):i}()},function(e,t,r){"use strict";var n=r(153);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!n(e)}},function(e,t,r){"use strict";var n=r(58);e.exports=function(e){if(!n(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,r){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var n=r(156),i=r(20),o=Math.max;e.exports=function(e,t){var r,s,a,u=o(arguments.length,2);for(e=Object(i(e)),a=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},s=1;s-1}},function(e,t,r){"use strict";var n,i,o,s,a,u,c,l=r(17),f=r(25),h=Function.prototype.apply,p=Function.prototype.call,d=Object.create,y=Object.defineProperty,v=Object.defineProperties,m=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};a={on:n=function(e,t){var r;return f(t),m.call(this,"__ee__")?r=this.__ee__:(r=g.value=d(null),y(this,"__ee__",g),g.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},once:i=function(e,t){var r,i;return f(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),h.call(t,this,arguments)}),r.__eeOnceListener__=t,this},off:o=function(e,t){var r,n,i,o;if(f(t),!m.call(this,"__ee__"))return this;if(!(r=this.__ee__)[e])return this;if("object"==typeof(n=r[e]))for(o=0;i=n[o];++o)i!==t&&i.__eeOnceListener__!==t||(2===n.length?r[e]=n[o?0:1]:n.splice(o,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},emit:s=function(e){var t,r,n,i,o;if(m.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(r=arguments.length,o=new Array(r-1),t=1;t=55296&&v<=56319&&(y+=e[++p]),u.call(t,m,y,f),!h);++p);else c.call(e,function(e){return u.call(t,m,e,f),h})}},function(e,t,r){"use strict";var n=r(41),i=r(42),o=r(173),s=r(188),a=r(92),u=r(23).iterator;e.exports=function(e){return"function"==typeof a(e)[u]?e[u]():n(e)?new o(e):i(e)?new s(e):new o(e)}},function(e,t,r){"use strict";var n,i=r(39),o=r(90),s=r(17),a=r(23),u=r(60),c=Object.defineProperty;n=e.exports=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,e),t=t?o.call(t,"key+value")?"key+value":o.call(t,"key")?"key":"value":"value",c(this,"__kind__",s("",t))},i&&i(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:s(function(e){return"value"===this.__kind__?this.__list__[e]:"key+value"===this.__kind__?[e,this.__list__[e]]:e})}),c(n.prototype,a.toStringTag,s("c","Array Iterator"))},function(e,t,r){"use strict";var n,i=r(27),o=r(175),s=r(179),a=r(180),u=r(89),c=r(185),l=Function.prototype.bind,f=Object.defineProperty,h=Object.prototype.hasOwnProperty;n=function(e,t,r){var n,i=o(t)&&s(t.value);return delete(n=a(t)).writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&h.call(this,e)?i:(t.value=l.call(i,r.resolveContext?r.resolveContext(this):this),f(this,e,t),this[e])},n},e.exports=function(e){var t=u(arguments[1]);return i(t.resolveContext)&&s(t.resolveContext),c(e,function(e,r){return n(r,e,t)})}},function(e,t,r){"use strict";var n=r(93),i=r(27);e.exports=function(e){return i(e)?e:n(e,"Cannot use %v",arguments[1])}},function(e,t,r){"use strict";var n=r(27),i=r(58),o=Object.prototype.toString;e.exports=function(e){if(!n(e))return null;if(i(e)){var t=e.toString;if("function"!=typeof t)return null;if(t===o)return null}try{return""+e}catch(e){return null}}},function(e,t,r){"use strict";var n=r(178),i=/[\n\r\u2028\u2029]/g;e.exports=function(e){var t=n(e);return null===t?"":(t.length>100&&(t=t.slice(0,99)+"…"),t=t.replace(i,function(e){switch(e){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}}))}},function(e,t,r){"use strict";e.exports=function(e){try{return e.toString()}catch(t){try{return String(e)}catch(e){return null}}}},function(e,t,r){"use strict";var n=r(93),i=r(88);e.exports=function(e){return i(e)?e:n(e,"%v is not a plain function",arguments[1])}},function(e,t,r){"use strict";var n=r(181),i=r(59),o=r(20);e.exports=function(e){var t=Object(o(e)),r=arguments[1],s=Object(arguments[2]);if(t!==e&&!r)return t;var a={};return r?n(r,function(t){(s.ensure||t in e)&&(a[t]=e[t])}):i(a,e),a}},function(e,t,r){"use strict";e.exports=r(182)()?Array.from:r(183)},function(e,t,r){"use strict";e.exports=function(){var e,t,r=Array.from;return"function"==typeof r&&(t=r(e=["raz","dwa"]),Boolean(t&&t!==e&&"dwa"===t[1]))}},function(e,t,r){"use strict";var n=r(23).iterator,i=r(41),o=r(184),s=r(85),a=r(25),u=r(20),c=r(26),l=r(42),f=Array.isArray,h=Function.prototype.call,p={configurable:!0,enumerable:!0,writable:!0,value:null},d=Object.defineProperty;e.exports=function(e){var t,r,y,v,m,g,b,_,w,S,E=arguments[1],I=arguments[2];if(e=Object(u(e)),c(E)&&a(E),this&&this!==Array&&o(this))t=this;else{if(!E){if(i(e))return 1!==(m=e.length)?Array.apply(null,e):((v=new Array(1))[0]=e[0],v);if(f(e)){for(v=new Array(m=e.length),r=0;r=55296&&g<=56319&&(S+=e[++r]),S=E?h.call(E,I,S,y):S,t?(p.value=S,d(v,y,p)):v[y]=S,++y;m=y}if(void 0===m)for(m=s(e.length),t&&(v=new t(m)),r=0;r=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r})}),u(n.prototype,s.toStringTag,o("c","String Iterator"))},function(e,t,r){"use strict";var n,i=r(39),o=r(17),s=r(60),a=r(23).toStringTag,u=r(190),c=Object.defineProperties,l=s.prototype._unBind;n=e.exports=function(e,t){if(!(this instanceof n))return new n(e,t);s.call(this,e.__mapKeysData__,e),t&&u[t]||(t="key+value"),c(this,{__kind__:o("",t),__values__:o("w",e.__mapValuesData__)})},i&&i(n,s),n.prototype=Object.create(s.prototype,{constructor:o(n),_resolve:o(function(e){return"value"===this.__kind__?this.__values__[e]:"key"===this.__kind__?this.__list__[e]:[this.__list__[e],this.__values__[e]]}),_unBind:o(function(){this.__values__=null,l.call(this)}),toString:o(function(){return"[object Map Iterator]"})}),Object.defineProperty(n.prototype,a,o("c","Map Iterator"))},function(e,t,r){"use strict";e.exports=r(191)("key","value","key+value")},function(e,t,r){"use strict";var n=Array.prototype.forEach,i=Object.create;e.exports=function(e){var t=i(null);return n.call(arguments,function(e){t[e]=!0}),t}},function(e,t,r){"use strict";e.exports="undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)},function(e,t,r){var n=r(194);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},function(e,t){e.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");Object.keys(t).forEach(function(e){n[e]=t[e]});return n;function n(){for(var e=new Array(arguments.length),r=0;r0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,this._stateCounter>=this._states.length&&(this._stateCounter=0);return this._list.length},u.prototype._parseHeader=function(){var e=this._list.readUInt8(0);return this.packet.cmd=a.types[e>>a.CMD_SHIFT],this.packet.retain=0!=(e&a.RETAIN_MASK),this.packet.qos=e>>a.QOS_SHIFT&a.QOS_MASK,this.packet.dup=0!=(e&a.DUP_MASK),this._list.consume(1),!0},u.prototype._parseLength=function(){for(var e,t=0,r=1,n=0,i=!0;t<5&&(n+=r*((e=this._list.readUInt8(t++))&a.LENGTH_MASK),r*=128,0!=(e&a.LENGTH_FIN_MASK));)if(this._list.length<=t){i=!1;break}return i&&(this.packet.length=n,this._list.consume(t)),i},u.prototype._parsePayload=function(){var e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseMessageId();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":case"disconnect":break;default:this._emitError(new Error("Not supported"))}e=!0}return e},u.prototype._parseConnect=function(){var e,t,r,n,i,o,s={},u=this.packet;if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==e&&"MQIsdp"!==e)return this._emitError(new Error("Invalid protocolId"));if(u.protocolId=e,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(u.protocolVersion=this._list.readUInt8(this._pos),3!==u.protocolVersion&&4!==u.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.username=this._list.readUInt8(this._pos)&a.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&a.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&a.WILL_FLAG_MASK,s.will&&(u.will={},u.will.retain=0!=(this._list.readUInt8(this._pos)&a.WILL_RETAIN_MASK),u.will.qos=(this._list.readUInt8(this._pos)&a.WILL_QOS_MASK)>>a.WILL_QOS_SHIFT),u.clean=0!=(this._list.readUInt8(this._pos)&a.CLEAN_SESSION_MASK),this._pos++,u.keepalive=this._parseNum(),-1===u.keepalive)return this._emitError(new Error("Packet too short"));if(null===(t=this._parseString()))return this._emitError(new Error("Packet too short"));if(u.clientId=t,s.will){if(null===(r=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(u.will.topic=r,null===(n=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));u.will.payload=n}if(s.username){if(null===(o=this._parseString()))return this._emitError(new Error("Cannot parse username"));u.username=o}if(s.password){if(null===(i=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));u.password=i}return u},u.prototype._parseConnack=function(){var e=this.packet;return this._list.length<2?null:(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&a.SESSIONPRESENT_MASK),e.returnCode=this._list.readUInt8(this._pos),-1===e.returnCode?this._emitError(new Error("Cannot parse return code")):void 0)},u.prototype._parsePublish=function(){var e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));e.qos>0&&!this._parseMessageId()||(e.payload=this._list.slice(this._pos,e.length))},u.prototype._parseSubscribe=function(){var e,t,r=this.packet;if(1!==r.qos)return this._emitError(new Error("Wrong subscribe header"));if(r.subscriptions=[],this._parseMessageId())for(;this._pos=r.length)return this._emitError(new Error("Malformed Subscribe Payload"));t=this._list.readUInt8(this._pos++),r.subscriptions.push({topic:e,qos:t})}},u.prototype._parseSuback=function(){if(this.packet.granted=[],this._parseMessageId())for(;this._posthis._list.length||n>this.packet.length?null:(t=this._list.toString("utf8",this._pos,n),this._pos+=r,t)},u.prototype._parseBuffer=function(){var e,t=this._parseNum(),r=t+this._pos;return-1===t||r>this._list.length||r>this.packet.length?null:(e=this._list.slice(this._pos,r),this._pos+=t,e)},u.prototype._parseNum=function(){if(this._list.length-this._pos<2)return-1;var e=this._list.readUInt16BE(this._pos);return this._pos+=2,e},u.prototype._newPacket=function(){return this.packet&&(this._list.consume(this.packet.length),this.emit("packet",this.packet)),this.packet=new s,!0},u.prototype._emitError=function(e){this.error=e,this.emit("error",e)},e.exports=u},function(e,t,r){var n=r(198),i=r(33),o=r(15).Buffer;function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)})}else this.append(e);n.call(this)}i.inherits(s,n),s.prototype._offset=function(e){var t,r=0,n=0;if(0===e)return[0,0];for(;nthis.length)&&(n=this.length),r>=this.length)return e||o.alloc(0);if(n<=0)return e||o.alloc(0);var i,s,a=!!e,u=this._offset(r),c=n-r,l=c,f=a&&t||0,h=u[1];if(0===r&&n==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:o.concat(this._bufs,this.length);for(s=0;s(i=this._bufs[s].length-h))){this._bufs[s].copy(e,f,h,h+l);break}this._bufs[s].copy(e,f,h),f+=i,l-=i,h&&(h=0)}return e},s.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,e<0&&(e+=this.length),t<0&&(t+=this.length);var r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0==n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!=r[1]&&(i[0]=i[0].slice(r[1])),new s(i)},s.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},s.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;e>8,0),t.writeUInt8(255&e,1),t}e.exports={cache:o,generateCache:function(){for(var e=0;e0){e=new Array(arguments.length-2);for(var t=0;t= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=c-l,S=Math.floor,E=String.fromCharCode;function I(e){throw RangeError(_[e])}function A(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function k(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+A((e=e.replace(b,".")).split("."),t).join(".")}function C(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=E((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=E(e)}).join("")}function R(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function T(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function x(e,t,r){var n=0;for(e=r?S(e/p):e>>1,e+=S(e/t);e>w*f>>1;n+=c)e=S(e/w);return S(n+(w+1)*e/(e+h))}function P(e){var t,r,n,i,o,s,a,h,p,m,g=[],b=e.length,_=0,w=y,E=d;for((r=e.lastIndexOf(v))<0&&(r=0),n=0;n=128&&I("not-basic"),g.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=b&&I("invalid-input"),((h=R(e.charCodeAt(i++)))>=c||h>S((u-_)/s))&&I("overflow"),_+=h*s,!(h<(p=a<=E?l:a>=E+f?f:a-E));a+=c)s>S(u/(m=c-p))&&I("overflow"),s*=m;E=x(_-o,t=g.length+1,0==o),S(_/t)>u-w&&I("overflow"),w+=S(_/t),_%=t,g.splice(_++,0,w)}return O(g)}function N(e){var t,r,n,i,o,s,a,h,p,m,g,b,_,w,A,k=[];for(b=(e=C(e)).length,t=y,r=0,o=d,s=0;s=t&&gS((u-r)/(_=n+1))&&I("overflow"),r+=(a-t)*_,t=a,s=0;su&&I("overflow"),g==t){for(h=r,p=c;!(h<(m=p<=o?l:p>=o+f?f:p-o));p+=c)A=h-m,w=c-m,k.push(E(T(m+A%w,0))),h=S(A/w);k.push(E(T(h,0))),o=x(r,_,n==i),r=0,++n}++r,++t}return k.join("")}a={version:"1.3.2",ucs2:{decode:C,encode:O},decode:P,encode:N,toASCII:function(e){return k(e,function(e){return g.test(e)?"xn--"+N(e):e})},toUnicode:function(e){return k(e,function(e){return m.test(e)?P(e.slice(4).toLowerCase()):e})}},void 0===(i=function(){return a}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(205)(e),r(13))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(f=y.substr(0,v),h=y.substr(v+1)):(f=y,h=""),p=decodeURIComponent(f),d=decodeURIComponent(h),n(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(n(e))}).join(t):a+encodeURIComponent(n(e[s]))}).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)}).prototype=t}}(),e.lib.WordArray}(r(4))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(r(4))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.algo,i=n.SHA256,o=n.SHA224=i.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}});t.SHA224=i._createHelper(o),t.HmacSHA224=i._createHmacHelper(o)}(),e.SHA224}(r(4),r(101))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.x64,n=r.Word,i=r.WordArray,o=t.algo,s=o.SHA512,a=o.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}});t.SHA384=s._createHelper(a),t.HmacSHA384=s._createHmacHelper(a)}(),e.SHA384}(r(4),r(43),r(102))},function(e,t,r){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.x64.Word,a=r.algo,u=[],c=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){u[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var a=0,f=0,h=0;h<7;h++){if(1&i){var p=(1<>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(O=r[i]).high^=s,O.low^=o}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var p=0,d=0,y=0;y<5;y++)p^=(O=r[h+5*y]).high,d^=O.low;var v=f[h];v.high=p,v.low=d}for(h=0;h<5;h++){var m=f[(h+4)%5],g=f[(h+1)%5],b=g.high,_=g.low;for(p=m.high^(b<<1|_>>>31),d=m.low^(_<<1|b>>>31),y=0;y<5;y++)(O=r[h+5*y]).high^=p,O.low^=d}for(var w=1;w<25;w++){var S=(O=r[w]).high,E=O.low,I=u[w];I<32?(p=S<>>32-I,d=E<>>32-I):(p=E<>>64-I,d=S<>>64-I);var A=f[c[w]];A.high=p,A.low=d}var k=f[0],C=r[0];for(k.high=C.high,k.low=C.low,h=0;h<5;h++)for(y=0;y<5;y++){var O=r[w=h+5*y],R=f[w],T=f[(h+1)%5+5*y],x=f[(h+2)%5+5*y];O.high=R.high^~T.high&x.high,O.low=R.low^~T.low&x.low}O=r[0];var P=l[a];O.high^=P.high,O.low^=P.low}},_doFinalize:function(){var e=this._data,r=e.words,n=(this._nDataBytes,8*e.sigBytes),o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/o)*o>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,u=a/8,c=[],l=0;l>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),c.push(p),c.push(h)}return new i.init(c,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=o._createHelper(h),r.HmacSHA3=o._createHmacHelper(h)}(Math),e.SHA3}(r(4),r(43))},function(e,t,r){e.exports=function(e){ /** @preserve (c) 2012 by Cédric Mesnil. All rights reserved. @@ -15,17 +16,17 @@ window.Channelize=function(e){var t={};function r(n){if(t[n])return t[n].exports THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),f=i.create([0,1518500249,1859775393,2400959708,2840853838]),h=i.create([1352829926,1548603684,1836072691,2053994217,0]),p=s.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,s,p,_,w,E,S,I,A,k,C,O=this._hash.words,x=f.words,T=h.words,R=a.words,P=u.words,N=c.words,L=l.words;for(E=o=O[0],S=s=O[1],I=p=O[2],A=_=O[3],k=w=O[4],r=0;r<80;r+=1)C=o+e[t+R[r]]|0,C+=r<16?d(s,p,_)+x[0]:r<32?y(s,p,_)+x[1]:r<48?v(s,p,_)+x[2]:r<64?m(s,p,_)+x[3]:g(s,p,_)+x[4],C=(C=b(C|=0,N[r]))+w|0,o=w,w=_,_=b(p,10),p=s,s=C,C=E+e[t+P[r]]|0,C+=r<16?g(S,I,A)+T[0]:r<32?m(S,I,A)+T[1]:r<48?v(S,I,A)+T[2]:r<64?y(S,I,A)+T[3]:d(S,I,A)+T[4],C=(C=b(C|=0,L[r]))+k|0,E=k,k=A,A=b(I,10),I=S,S=C;C=O[1]+p+A|0,O[1]=O[2]+_+k|0,O[2]=O[3]+w+E|0,O[3]=O[4]+o+S|0,O[4]=O[0]+s+I|0,O[0]=C},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,r){return e^t^r}function y(e,t,r){return e&t|~e&r}function v(e,t,r){return(e|~t)^r}function m(e,t,r){return e&r|t&~r}function g(e,t,r){return e^(t|~r)}function b(e,t){return e<>>32-t}r.RIPEMD160=o._createHelper(p),r.HmacRIPEMD160=o._createHmacHelper(p)}(Math),e.RIPEMD160}(r(3))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,o=t.algo,s=o.SHA1,a=o.HMAC,u=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=a.create(r.hasher,e),o=i.create(),s=i.create([1]),u=o.words,c=s.words,l=r.keySize,f=r.iterations;u.length>>24)|4278255360&(i<<24|i>>>8)}var o,s,p,_,w,S,E,I,A,k,C,O=this._hash.words,R=f.words,T=h.words,x=a.words,P=u.words,N=c.words,L=l.words;for(S=o=O[0],E=s=O[1],I=p=O[2],A=_=O[3],k=w=O[4],r=0;r<80;r+=1)C=o+e[t+x[r]]|0,C+=r<16?d(s,p,_)+R[0]:r<32?y(s,p,_)+R[1]:r<48?v(s,p,_)+R[2]:r<64?m(s,p,_)+R[3]:g(s,p,_)+R[4],C=(C=b(C|=0,N[r]))+w|0,o=w,w=_,_=b(p,10),p=s,s=C,C=S+e[t+P[r]]|0,C+=r<16?g(E,I,A)+T[0]:r<32?m(E,I,A)+T[1]:r<48?v(E,I,A)+T[2]:r<64?y(E,I,A)+T[3]:d(E,I,A)+T[4],C=(C=b(C|=0,L[r]))+k|0,S=k,k=A,A=b(I,10),I=E,E=C;C=O[1]+p+A|0,O[1]=O[2]+_+k|0,O[2]=O[3]+w+S|0,O[3]=O[4]+o+E|0,O[4]=O[0]+s+I|0,O[0]=C},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,r){return e^t^r}function y(e,t,r){return e&t|~e&r}function v(e,t,r){return(e|~t)^r}function m(e,t,r){return e&r|t&~r}function g(e,t,r){return e^(t|~r)}function b(e,t){return e<>>32-t}r.RIPEMD160=o._createHelper(p),r.HmacRIPEMD160=o._createHmacHelper(p)}(Math),e.RIPEMD160}(r(4))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,o=t.algo,s=o.SHA1,a=o.HMAC,u=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=a.create(r.hasher,e),o=i.create(),s=i.create([1]),u=o.words,c=s.words,l=r.keySize,f=r.iterations;u.length>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}var n=t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),function(e){0===(e[0]=r(e[0]))&&(e[1]=r(e[1]))}(s);var a=s.slice(0);n.encryptBlock(a,0);for(var u=0;u>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(r(3),r(8))},function(e,t,r){e.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,i=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(i-1)).concat(e.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(r(3),r(8))},function(e,t,r){e.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(r(3),r(8))},function(e,t,r){e.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1;!(t[r>>>2]>>>24-r%4*8&255);)r--;e.sigBytes=r+1}},e.pad.ZeroPadding}(r(3),r(8))},function(e,t,r){e.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(r(3),r(8))},function(e,t,r){e.exports=function(e){return function(t){var r=e,n=r.lib.CipherParams,i=r.enc.Hex;r.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return n.create({ciphertext:t})}}}(),e.format.Hex}(r(3),r(8))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,i=[],o=[],s=[],a=[],u=[],c=[],l=[],f=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,i[r]=d,o[d]=r;var y=e[r],v=e[y],m=e[v],g=257*e[d]^16843008*d;s[r]=g<<24|g>>>8,a[r]=g<<16|g>>>16,u[r]=g<<8|g>>>24,c[r]=g,g=16843009*m^65537*v^257*y^16843008*r,l[d]=g<<24|g>>>8,f[d]=g<<16|g>>>16,h[d]=g<<8|g>>>24,p[d]=g,r?(r=y^e[e[e[m^y]]],n^=e[e[n]]):r=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],y=n.AES=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],s=0;s6&&s%r==4&&(a=i[a>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a]):(a=i[(a=a<<8|a>>>24)>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a],a^=d[s/r|0]<<24),o[s]=o[s-r]^a}for(var u=this._invKeySchedule=[],c=0;c>>24]]^f[i[a>>>16&255]]^h[i[a>>>8&255]]^p[i[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,u,c,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,f,h,p,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,s,a){for(var u=this._nRounds,c=e[t]^r[0],l=e[t+1]^r[1],f=e[t+2]^r[2],h=e[t+3]^r[3],p=4,d=1;d>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^r[p++],v=n[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^r[p++],m=n[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^r[p++],g=n[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^r[p++];c=y,l=v,f=m,h=g}y=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^r[p++],v=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^r[p++],m=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^r[p++],g=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^r[p++],e[t]=y,e[t+1]=v,e[t+2]=m,e[t+3]=g},keySize:8});t.AES=r._createHelper(y)}(),e.AES}(r(3),r(28),r(29),r(30),r(8))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,i=r.BlockCipher,o=t.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var c=i[o]=[],l=u[o];for(r=0;r<24;r++)c[r/6|0]|=t[(a[r]-1+l)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(a[r+24]-1+l)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var f=this._invSubKeys=[];for(r=0;r<16;r++)f[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,u=0;u<8;u++)a|=c[u][((s^i[u])&l[u])>>>0];this._lBlock=s,this._rBlock=o^a}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<>>2]>>>24-s%4*8&255;o=(o+n[i]+a)%256;var u=n[i];n[i]=n[o],n[o]=u}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}t.RC4=r._createHelper(i);var s=n.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});t.RC4Drop=r._createHelper(s)}(),e.RC4}(r(3),r(28),r(29),r(30),r(8))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=[],i=[],o=[],s=t.algo.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)a.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,s=o[0],u=o[1],c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(i[0]^=c,i[1]^=f,i[2]^=l,i[3]^=h,i[4]^=c,i[5]^=f,i[6]^=l,i[7]^=h,r=0;r<4;r++)a.call(this)}},_doProcessBlock:function(e,t){var r=this._X;a.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],s=65535&n,a=n>>>16,u=((s*s>>>17)+s*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=u^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.Rabbit=r._createHelper(s)}(),e.Rabbit}(r(3),r(28),r(29),r(30),r(8))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=[],i=[],o=[],s=t.algo.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)a.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,s=o[0],u=o[1],c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(n[0]^=c,n[1]^=f,n[2]^=l,n[3]^=h,n[4]^=c,n[5]^=f,n[6]^=l,n[7]^=h,i=0;i<4;i++)a.call(this)}},_doProcessBlock:function(e,t){var r=this._X;a.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],s=65535&n,a=n>>>16,u=((s*s>>>17)+s*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=u^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.RabbitLegacy=r._createHelper(s)}(),e.RabbitLegacy}(r(3),r(28),r(29),r(30),r(8))},function(e,t){e.exports={INVALID_CONNECT_OPTIONS:"Invalid connect options supplied.",INVALID_CLIENT_ID_OPTION:'Invalid "clientId" (mqtt client id) option supplied.',INVALID_RECONNECT_TIMING:"Invalid reconnect timing options supplied.",INVALID_OFFLINE_QUEUEING_PARAMETERS:"Invalid offline queueing options supplied."}},function(e,t,r){(function(t){var n=r(66),i=r(44),o=r(240);e.exports=function(e){if(i(e.keyPath)&&i(e.privateKey))throw new Error(o.NO_KEY_OPTION);if(i(e.certPath)&&i(e.clientCert))throw new Error(o.NO_CERT_OPTION);if(i(e.caPath)&&i(e.caCert))throw new Error(o.NO_CA_OPTION);if(!i(e.caCert))if(t.isBuffer(e.caCert))e.ca=e.caCert;else{if(!n.existsSync(e.caCert))throw new Error(o.INVALID_CA_CERT_OPTION);e.ca=n.readFileSync(e.caCert)}if(!i(e.privateKey))if(t.isBuffer(e.privateKey))e.key=e.privateKey;else{if(!n.existsSync(e.privateKey))throw new Error(o.INVALID_PRIVATE_KEY_OPTION);e.key=n.readFileSync(e.privateKey)}if(!i(e.clientCert))if(t.isBuffer(e.clientCert))e.cert=e.clientCert;else{if(!n.existsSync(e.clientCert))throw new Error(o.INVALID_CLIENT_CERT_OPTION);e.cert=n.readFileSync(e.clientCert)}if(n.existsSync(e.keyPath))e.key=n.readFileSync(e.keyPath);else if(!i(e.keyPath))throw new Error(o.INVALID_KEY_PATH_OPTION);if(n.existsSync(e.certPath))e.cert=n.readFileSync(e.certPath);else if(!i(e.certPath))throw new Error(o.INVALID_CERT_PATH_OPTION);if(n.existsSync(e.caPath))e.ca=n.readFileSync(e.caPath);else if(!i(e.caPath))throw new Error(o.INVALID_CA_PATH_OPTION);e.requestCert=!0,e.rejectUnauthorized=!0}}).call(this,r(15).Buffer)},function(e,t){e.exports={NO_KEY_OPTION:'No "keyPath" or "privateKey" option supplied.',NO_CERT_OPTION:'No "certPath" or "clientCert" option supplied.',NO_CA_OPTION:'No "caPath" or "caCert" option supplied.',INVALID_KEY_PATH_OPTION:'Invalid "keyPath" option supplied.',INVALID_CERT_PATH_OPTION:'Invalid "certPath" option supplied.',INVALID_CA_PATH_OPTION:'Invalid "caPath" option supplied.',INVALID_CLIENT_CERT_OPTION:'Invalid "clientCert" option supplied.',INVALID_PRIVATE_KEY_OPTION:'Invalid "privateKey" option supplied.',INVALID_CA_CERT_OPTION:'Invalid "caCert" option supplied.'}},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return t=r(n(t.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+t||"."},t.normalize=function(e){var o=t.isAbsolute(e),s="/"===i(e,-1);return(e=r(n(e.split("/"),function(e){return!!e}),!o).join("/"))||o||(e="."),e&&s&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":e.slice(0,n)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,n=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){r=t+1;break}}else-1===n&&(i=!1,n=t+1);return-1===n?"":e.slice(r,n)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,n=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===n&&(i=!1,n=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){r=s+1;break}}return-1===t||-1===n||0===o||1===o&&t===n-1&&t===r+1?"":e.slice(t,n)};var i="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(6))},function(e){e.exports=JSON.parse('{"_args":[["aws-iot-device-sdk@2.2.4","/opt/lampp/htdocs/channelize/channelize-websdk"]],"_from":"aws-iot-device-sdk@2.2.4","_id":"aws-iot-device-sdk@2.2.4","_inBundle":false,"_integrity":"sha512-DgNVTPQMVHxC1o6SENWDjio2Ku8gz70XPi5CoS31Q4ndWpx3zwq3QKBvGdRm02SF4Xb4ft5cd9tXQCeIjgkqlQ==","_location":"/aws-iot-device-sdk","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"aws-iot-device-sdk@2.2.4","name":"aws-iot-device-sdk","escapedName":"aws-iot-device-sdk","rawSpec":"2.2.4","saveSpec":null,"fetchSpec":"2.2.4"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/aws-iot-device-sdk/-/aws-iot-device-sdk-2.2.4.tgz","_spec":"2.2.4","_where":"/opt/lampp/htdocs/channelize/channelize-websdk","author":{"name":"Amazon Web Services","url":"http://aws.amazon.com"},"bugs":{"url":"http://github.com/aws/aws-iot-device-sdk-js/issues"},"dependencies":{"crypto-js":"3.1.6","minimist":"1.2.5","mqtt":"2.18.8","websocket-stream":"^5.0.1"},"description":"AWS IoT Node.js SDK for Embedded Devices","devDependencies":{"gulp":"^3.9.0","gulp-beautify":"^2.0.0","gulp-concat":"^2.6.0","gulp-coverage":"^0.3.38","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1","jshint":"^2.9.1","jshint-stylish":"^2.2.1","rewire":"^2.5.1","sinon":"^1.17.3"},"engines":{"node":">=4.0.0"},"homepage":"https://github.com/aws/aws-iot-device-sdk-js","keywords":["api","amazon","aws","iot","mqtt"],"license":"Apache-2.0","main":"index.js","name":"aws-iot-device-sdk","repository":{"type":"git","url":"git://github.com/aws/aws-iot-device-sdk-js.git"},"scripts":{"beautify":"node ./node_modules/gulp/bin/gulp.js beautify","browserize":"./scripts/browserize.sh","test":"node ./node_modules/gulp/bin/gulp.js test --verbose"},"version":"2.2.4"}')},function(e,t,r){var n=r(66);e.exports=function(e,t){var r;function i(t){e.emit("error",t),r.end()}return(r=n.connect(t)).on("secureConnect",function(){r.authorized?r.removeListener("error",i):r.emit("error",new Error("TLS not authorized"))}),r.on("error",i),r}},function(e,t,r){const n=r(63);e.exports=function(e,t){return n(t.url,["mqttv3.1"],t.websocketOptions)}},function(e,t,r){var n=r(19),i=r(33).inherits,o=r(56),s=r(44);function a(e,t,r){return s(r)?"$aws/things/"+e+"/shadow/"+t:"$aws/things/"+e+"/shadow/"+t+"/"+r}function u(e){return"$aws/things/"===e.substring(0,12)}function c(e,t){if(!(this instanceof c))return new c(e,t);var r=this,i=[{}],l=0,f=1e4,h=!0,p=o.DeviceClient(e);s(t)||s(t.operationTimeout)||(f=t.operationTimeout),this._handleSubscriptions=function(e,t,r,n){for(var o=[],u=0,c=t.length;u0)return void n("Not all subscriptions were granted",r);n()}})):s(n)||y.push(n),p[r].apply(p,y)},this._handleMessages=function(t,r,n,o){var a={};try{a=JSON.parse(o.toString())}catch(t){return void(!0===e.debug&&console.error("failed parsing JSON '"+o.toString()+"', "+t))}var u=a.clientToken,c=a.version;if(delete a.clientToken,!s(c)&&"rejected"!==n)if(s(i[t].version)||c>=i[t].version)i[t].version=c;else if("delete"!==r&&!0===i[t].discardStale)return void(!0===e.debug&&console.warn("out-of-date version '"+c+"' on '"+t+"' (local version '"+i[t].version+"')"));"delta"!==n?s(i[t].clientToken)||i[t].clientToken!==u?"accepted"===n&&"get"!==r&&this.emit("foreignStateChange",t,r,a):(clearTimeout(i[t].timeout),delete i[t].timeout,delete i[t].clientToken,i[t].pending=!1,!1===i[t].persistentSubscribe&&this._handleSubscriptions(t,[{operations:[r],statii:["accepted","rejected"]}],"unsubscribe"),this.emit("status",t,n,u,a)):this.emit("delta",t,a)},p.on("connect",function(){r.emit("connect")}),p.on("close",function(){r.emit("close")}),p.on("reconnect",function(){r.emit("reconnect")}),p.on("offline",function(){r.emit("offline")}),p.on("error",function(e){r.emit("error",e)}),p.on("packetsend",function(e){r.emit("packetsend",e)}),p.on("packetreceive",function(e){r.emit("packetreceive",e)}),p.on("message",function(e,t){if(!0===h){var n=e.split("/");!function(e,t){var r=!1;return"$aws"===e[0]&&("things"!==e[1]||"shadow"!==e[3]||"update"!==e[4]&&"get"!==e[4]&&"delete"!==e[4]||("subscribe"===t?"accepted"!==e[5]&&"rejected"!==e[5]&&"delta"!==e[5]||6!==e.length||(r=!0):5===e.length&&(r=!0))),r}(n,"subscribe")?r.emit("message",e,t):i.hasOwnProperty(n[2])&&r._handleMessages(n[2],n[4],n[5],t)}}),this._thingOperation=function(t,n,o){var u=null;if(i.hasOwnProperty(t))if(!1===i[t].pending){var c;if(i[t].pending=!0,s(o.clientToken)){var h=e.clientId.length;c=h>48?e.clientId.substr(h-48)+"-"+l++:e.clientId+"-"+l++}else c=o.clientToken;i[t].clientToken=c;var d=a(t,n);i[t].timeout=setTimeout(function(e,t){!1===i[e].persistentSubscribe&&r._handleSubscriptions(e,[{operations:[n],statii:["accepted","rejected"]}],"unsubscribe"),i[e].pending=!1,delete i[e].timeout,delete i[e].clientToken,r.emit("timeout",e,t)},f,t,c),!1===i[t].persistentSubscribe?this._handleSubscriptions(t,[{operations:[n],statii:["accepted","rejected"]}],"subscribe",function(e,r){s(e)&&s(r)?s(o)||(!s(i[t].version)&&i[t].enableVersioning&&(o.version=i[t].version),o.clientToken=c,p.publish(d,JSON.stringify(o),{qos:i[t].qos}),s(i[t])||!0!==i[t].debug||console.log("publishing '"+JSON.stringify(o)+" on '"+d+"'")):console.warn("failed subscription to accepted/rejected topics")}):(!s(i[t].version)&&i[t].enableVersioning&&(o.version=i[t].version),o.clientToken=c,p.publish(d,JSON.stringify(o),{qos:i[t].qos}),!0===i[t].debug&&console.log("publishing '"+JSON.stringify(o)+" on '"+d+"'")),u=c}else!0===e.debug&&console.error(n+" still in progress on thing: ",t);else!0===e.debug&&console.error("attempting to "+n+" unknown thing: ",t);return u},this.register=function(t,r,n){if(i.hasOwnProperty(t))!0===e.debug&&console.error("thing already registered: ",t);else{var o=!1,a=[];i[t]={persistentSubscribe:!0,debug:!1,discardStale:!0,enableVersioning:!0,qos:0,pending:!0},"function"==typeof r&&(n=r,r=null),s(r)||(s(r.ignoreDeltas)||(o=r.ignoreDeltas),s(r.persistentSubscribe)||(i[t].persistentSubscribe=r.persistentSubscribe),s(r.debug)||(i[t].debug=r.debug),s(r.discardStale)||(i[t].discardStale=r.discardStale),s(r.enableVersioning)||(i[t].enableVersioning=r.enableVersioning),s(r.qos)||(i[t].qos=r.qos)),!1===o&&a.push({operations:["update"],statii:["delta"]}),!0===i[t].persistentSubscribe&&a.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),a.length>0?this._handleSubscriptions(t,a,"subscribe",function(e,r){s(e)&&s(r)&&(i[t].pending=!1),s(n)||n(e,r)}):(i[t].pending=!1,s(n)||n())}},this.unregister=function(t){if(i.hasOwnProperty(t)){var r=[];r.push({operations:["update"],statii:["delta"]}),!0===i[t].persistentSubscribe&&r.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),this._handleSubscriptions(t,r,"unsubscribe"),s(i[t].timeout)||clearTimeout(i[t].timeout),delete i[t]}else!0===e.debug&&console.error("attempting to unregister unknown thing: ",t)},this.update=function(e,t){var n=null;return s(t.version)?n=r._thingOperation(e,"update",t):console.error("message can't contain 'version' property"),n},this.get=function(e,t){var n={};return s(t)||(n.clientToken=t),r._thingOperation(e,"get",n)},this.delete=function(e,t){var n={};return s(t)||(n.clientToken=t),r._thingOperation(e,"delete",n)},this.publish=function(e,t,r,n){if(u(e))throw"cannot publish to reserved topic '"+e+"'";p.publish(e,t,r,n)},this.subscribe=function(e,t,r){var n=[];"string"==typeof e?n.push(e):"object"==typeof e&&e.length&&(n=e);for(var i=0;i0||n?o.toString():""},e.exports=s},function(e,t,r){var n=r(250).escapeAttribute;function i(e,t){void 0===t&&(t=[]),this.name=e,this.children=t,this.attributes={}}i.prototype.addAttribute=function(e,t){return this.attributes[e]=t,this},i.prototype.addChildNode=function(e){return this.children.push(e),this},i.prototype.removeAttribute=function(e){return delete this.attributes[e],this},i.prototype.toString=function(){for(var e=Boolean(this.children.length),t="<"+this.name,r=this.attributes,i=0,o=Object.keys(r);i"+this.children.map(function(e){return e.toString()}).join("")+"":"/>")},e.exports={XmlNode:i}},function(e,t){e.exports={escapeAttribute:function(e){return e.replace(/&/g,"&").replace(/'/g,"'").replace(//g,">").replace(/"/g,""")}}},function(e,t,r){var n=r(252).escapeElement;function i(e){this.value=e}i.prototype.toString=function(){return n(""+this.value)},e.exports={XmlText:i}},function(e,t){e.exports={escapeElement:function(e){return e.replace(/&/g,"&").replace(//g,">")}}},function(e,t){function r(e,t){if(!r.services.hasOwnProperty(e))throw new Error("InvalidService: Failed to load api for "+e);return r.services[e][t]}r.services={},e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(255),i=1e3,o=function(){function e(e){void 0===e&&(e=i),this.maxSize=e,this.cache=new n.LRUCache(e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),e.prototype.put=function(t,r){var n="string"!=typeof t?e.getKeyString(t):t,i=this.populateValue(r);this.cache.put(n,i)},e.prototype.get=function(t){var r="string"!=typeof t?e.getKeyString(t):t,n=Date.now(),i=this.cache.get(r);if(i)for(var o=0;o=0;i--)if("*"!==t[i][t[i].length-1]&&(r=t[i]),t[i].substr(0,10)<=e)return r;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+e+"'")},api:{},defaultRetryCount:3,customizeRequests:function(e){if(e){if("function"!=typeof e)throw new Error("Invalid callback type '"+typeof e+"' provided in customizeRequests");this.customRequestHandler=e}else this.customRequestHandler=null},makeRequest:function(e,t,r){if("function"==typeof t&&(r=t,t=null),t=t||{},this.config.params){var i=this.api.operations[e];i&&(t=n.util.copy(t),n.util.each(this.config.params,function(e,r){i.input.members[e]&&(void 0!==t[e]&&null!==t[e]||(t[e]=r))}))}var o=new n.Request(this,e,t);return this.addAllRequestListeners(o),this.attachMonitoringEmitter(o),r&&o.send(r),o},makeUnauthenticatedRequest:function(e,t,r){"function"==typeof t&&(r=t,t={});var n=this.makeRequest(e,t).toUnauthenticated();return r?n.send(r):n},waitFor:function(e,t,r){return new n.ResourceWaiter(this,e).wait(t,r)},addAllRequestListeners:function(e){for(var t=[n.events,n.EventListeners.Core,this.serviceInterface(),n.EventListeners.CorePost],r=0;r299?(i.code&&(r.FinalAwsException=i.code),i.message&&(r.FinalAwsExceptionMessage=i.message)):((i.code||i.name)&&(r.FinalSdkException=i.code||i.name),i.message&&(r.FinalSdkExceptionMessage=i.message))}return r},apiAttemptEvent:function(e){var t=e.service.api.operations[e.operation],r={Type:"ApiCallAttempt",Api:t?t.name:e.operation,Version:1,Service:e.service.api.serviceId||e.service.api.endpointPrefix,Fqdn:e.httpRequest.endpoint.hostname,UserAgent:e.httpRequest.getUserAgent()},n=e.response;return n.httpResponse.statusCode&&(r.HttpStatusCode=n.httpResponse.statusCode),!e._unAuthenticated&&e.service.config.credentials&&e.service.config.credentials.accessKeyId&&(r.AccessKey=e.service.config.credentials.accessKeyId),n.httpResponse.headers?(e.httpRequest.headers["x-amz-security-token"]&&(r.SessionToken=e.httpRequest.headers["x-amz-security-token"]),n.httpResponse.headers["x-amzn-requestid"]&&(r.XAmznRequestId=n.httpResponse.headers["x-amzn-requestid"]),n.httpResponse.headers["x-amz-request-id"]&&(r.XAmzRequestId=n.httpResponse.headers["x-amz-request-id"]),n.httpResponse.headers["x-amz-id-2"]&&(r.XAmzId2=n.httpResponse.headers["x-amz-id-2"]),r):r},attemptFailEvent:function(e){var t=this.apiAttemptEvent(e),r=e.response,n=r.error;return r.httpResponse.statusCode>299?(n.code&&(t.AwsException=n.code),n.message&&(t.AwsExceptionMessage=n.message)):((n.code||n.name)&&(t.SdkException=n.code||n.name),n.message&&(t.SdkExceptionMessage=n.message)),t},attachMonitoringEmitter:function(e){var t,r,i,o,s,a,u=0,c=this;e.on("validate",function(){o=n.util.realClock.now(),a=Date.now()},!0),e.on("sign",function(){r=n.util.realClock.now(),t=Date.now(),s=e.httpRequest.region,u++},!0),e.on("validateResponse",function(){i=Math.round(n.util.realClock.now()-r)}),e.addNamedListener("API_CALL_ATTEMPT","success",function(){var r=c.apiAttemptEvent(e);r.Timestamp=t,r.AttemptLatency=i>=0?i:0,r.Region=s,c.emit("apiCallAttempt",[r])}),e.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",function(){var o=c.attemptFailEvent(e);o.Timestamp=t,i=i||Math.round(n.util.realClock.now()-r),o.AttemptLatency=i>=0?i:0,o.Region=s,c.emit("apiCallAttempt",[o])}),e.addNamedListener("API_CALL","complete",function(){var t=c.apiCallEvent(e);if(t.AttemptCount=u,!(t.AttemptCount<=0)){t.Timestamp=a;var r=Math.round(n.util.realClock.now()-o);t.Latency=r>=0?r:0;var i=e.response;i.error&&i.error.retryable&&"number"==typeof i.retryCount&&"number"==typeof i.maxRetries&&i.retryCount>=i.maxRetries&&(t.MaxRetriesExceeded=1),c.emit("apiCall",[t])}})},setupRequestListeners:function(e){},getSignerClass:function(e){var t,r=null,i="";e&&(i=(r=(e.service.api.operations||{})[e.operation]||null)?r.authtype:"");return t=this.config.signatureVersion?this.config.signatureVersion:"v4"===i||"v4-unsigned-body"===i?"v4":this.api.signatureVersion,n.Signers.RequestSigner.getVersion(t)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return n.EventListeners.Query;case"json":return n.EventListeners.Json;case"rest-json":return n.EventListeners.RestJson;case"rest-xml":return n.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e,t){return n.util.calculateRetryDelay(e,this.config.retryDelayOptions,t)},retryableError:function(e){return!!this.timeoutError(e)||(!!this.networkingError(e)||(!!this.expiredCredentialsError(e)||(!!this.throttledError(e)||e.statusCode>=500)))},networkingError:function(e){return"NetworkingError"===e.code},timeoutError:function(e){return"TimeoutError"===e.code},expiredCredentialsError:function(e){return"ExpiredTokenException"===e.code},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return Math.abs(this.getSkewCorrectedDate().getTime()-e)>=3e5},throttledError:function(e){if(429===e.statusCode)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":case"EC2ThrottledException":return!0;default:return!1}},endpointFromTemplate:function(e){if("string"!=typeof e)return e;var t=e;return t=(t=(t=t.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(e){this.endpoint=new n.Endpoint(e,this.config)},paginationConfig:function(e,t){var r=this.api.operations[e].paginator;if(!r){if(t){var i=new Error;throw n.util.error(i,"No pagination configuration for "+e)}return null}return r}}),n.util.update(n.Service,{defineMethods:function(e){n.util.each(e.prototype.api.operations,function(t){e.prototype[t]||("none"===e.prototype.api.operations[t].authtype?e.prototype[t]=function(e,r){return this.makeUnauthenticatedRequest(t,e,r)}:e.prototype[t]=function(e,r){return this.makeRequest(t,e,r)})})},defineService:function(e,t,r){n.Service._serviceMap[e]=!0,Array.isArray(t)||(r=t,t=[]);var i=s(n.Service,r||{});if("string"==typeof e){n.Service.addVersions(i,t);var o=i.serviceIdentifier||e;i.serviceIdentifier=o}else i.prototype.api=e,n.Service.defineMethods(i);if(n.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&n.util.clientSideMonitoring){var a=n.util.clientSideMonitoring.Publisher,u=(0,n.util.clientSideMonitoring.configProvider)();this.prototype.publisher=new a(u),u.enabled&&(n.Service._clientSideMonitoring=!0)}return n.SequentialExecutor.call(i.prototype),n.Service.addDefaultMonitoringListeners(i.prototype),i},addVersions:function(e,t){Array.isArray(t)||(t=[t]),e.services=e.services||{};for(var r=0;r=0)return e.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",t();n.util.computeSha256(o,function(r,n){r?t(r):(e.httpRequest.headers["X-Amz-Content-Sha256"]=n,t())})}else t()}}),e("SET_CONTENT_LENGTH","afterBuild",function(e){var t=function(e){if(!e.service.api.operations)return"";var t=e.service.api.operations[e.operation];return t?t.authtype:""}(e),r=n.util.getRequestPayloadShape(e);if(void 0===e.httpRequest.headers["Content-Length"])try{var i=n.util.string.byteLength(e.httpRequest.body);e.httpRequest.headers["Content-Length"]=i}catch(n){if(r&&r.isStreaming){if(r.requiresLength)throw n;if(t.indexOf("unsigned-body")>=0)return void(e.httpRequest.headers["Transfer-Encoding"]="chunked");throw n}throw n}}),e("SET_HTTP_HOST","afterBuild",function(e){e.httpRequest.headers.Host=e.httpRequest.endpoint.host}),e("RESTART","restart",function(){var e=this.response.error;e&&e.retryable&&(this.httpRequest=new n.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=600?this.emit("sign",[this],function(e){e?t(e):o()}):o()}),e("HTTP_HEADERS","httpHeaders",function(e,t,r,i){r.httpResponse.statusCode=e,r.httpResponse.statusMessage=i,r.httpResponse.headers=t,r.httpResponse.body=n.util.buffer.toBuffer(""),r.httpResponse.buffers=[],r.httpResponse.numBytes=0;var o=t.date||t.Date,s=r.request.service;if(o){var a=Date.parse(o);s.config.correctClockSkew&&s.isClockSkewed(a)&&s.applyClockOffset(a)}}),e("HTTP_DATA","httpData",function(e,t){if(e){if(n.util.isNode()){t.httpResponse.numBytes+=e.length;var r=t.httpResponse.headers["content-length"],i={loaded:t.httpResponse.numBytes,total:r};t.request.emit("httpDownloadProgress",[i,t])}t.httpResponse.buffers.push(n.util.buffer.toBuffer(e))}}),e("HTTP_DONE","httpDone",function(e){if(e.httpResponse.buffers&&e.httpResponse.buffers.length>0){var t=n.util.buffer.concat(e.httpResponse.buffers);e.httpResponse.body=t}delete e.httpResponse.numBytes,delete e.httpResponse.buffers}),e("FINALIZE_ERROR","retry",function(e){e.httpResponse.statusCode&&(e.error.statusCode=e.httpResponse.statusCode,void 0===e.error.retryable&&(e.error.retryable=this.service.retryableError(e.error,this)))}),e("INVALIDATE_CREDENTIALS","retry",function(e){if(e.error)switch(e.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":e.error.retryable=!0,e.request.service.config.credentials.expired=!0}}),e("EXPIRED_SIGNATURE","retry",function(e){var t=e.error;t&&"string"==typeof t.code&&"string"==typeof t.message&&t.code.match(/Signature/)&&t.message.match(/expired/)&&(e.error.retryable=!0)}),e("CLOCK_SKEWED","retry",function(e){e.error&&this.service.clockSkewError(e.error)&&this.service.config.correctClockSkew&&(e.error.retryable=!0)}),e("REDIRECT","retry",function(e){e.error&&e.error.statusCode>=300&&e.error.statusCode<400&&e.httpResponse.headers.location&&(this.httpRequest.endpoint=new n.Endpoint(e.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,e.error.redirect=!0,e.error.retryable=!0)}),e("RETRY_CHECK","retry",function(e){e.error&&(e.error.redirect&&e.redirectCount=0?(e.error=null,setTimeout(t,r)):t()})}),CorePost:(new i).addNamedListeners(function(e){e("EXTRACT_REQUEST_ID","extractData",n.util.extractRequestId),e("EXTRACT_REQUEST_ID","extractError",n.util.extractRequestId),e("ENOTFOUND_ERROR","httpError",function(e){if("NetworkingError"===e.code&&"ENOTFOUND"===e.errno){var t="Inaccessible host: `"+e.hostname+"'. This service may not be available in the `"+e.region+"' region.";this.response.error=n.util.error(new Error(t),{code:"UnknownEndpoint",region:e.region,hostname:e.hostname,retryable:!0,originalError:e})}})}),Logger:(new i).addNamedListeners(function(e){e("LOG_REQUEST","complete",function(e){var t=e.request,i=t.service.config.logger;if(i){var o=function(){var o=(e.request.service.getSkewCorrectedDate().getTime()-t.startTime.getTime())/1e3,s=!!i.isTTY,a=e.httpResponse.statusCode,u=t.params;t.service.api.operations&&t.service.api.operations[t.operation]&&t.service.api.operations[t.operation].input&&(u=function e(t,r){if(!r)return r;switch(t.type){case"structure":var i={};return n.util.each(r,function(r,n){Object.prototype.hasOwnProperty.call(t.members,r)?i[r]=e(t.members[r],n):i[r]=n}),i;case"list":var o=[];return n.util.arrayEach(r,function(r,n){o.push(e(t.member,r))}),o;case"map":var s={};return n.util.each(r,function(r,n){s[r]=e(t.value,n)}),s;default:return t.isSensitive?"***SensitiveInformation***":r}}(t.service.api.operations[t.operation].input,t.params));var c=r(33).inspect(u,!0,null),l="";return s&&(l+=""),l+="[AWS "+t.service.serviceIdentifier+" "+a,l+=" "+o.toString()+"s "+e.retryCount+" retries]",s&&(l+=""),l+=" "+n.util.string.lowerFirst(t.operation),l+="("+c+")",s&&(l+=""),l}();"function"==typeof i.log?i.log(o):"function"==typeof i.write&&i.write(o+"\n")}})}),Json:(new i).addNamedListeners(function(e){var t=r(68);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),Rest:(new i).addNamedListeners(function(e){var t=r(45);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),RestJson:(new i).addNamedListeners(function(e){var t=r(104);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),RestXml:(new i).addNamedListeners(function(e){var t=r(105);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),Query:(new i).addNamedListeners(function(e){var t=r(102);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})}},function(e,t,r){(function(t){var n=r(2),i=r(7),o=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function s(e){var t=e.service,r=t.api||{},n=(r.operations,{});return t.config.region&&(n.region=t.config.region),r.serviceId&&(n.serviceId=r.serviceId),t.config.credentials.accessKeyId&&(n.accessKeyId=t.config.credentials.accessKeyId),n}function a(e,t){var r={};return function e(t,r,n){n&&void 0!==r&&null!==r&&"structure"===n.type&&n.required&&n.required.length>0&&i.arrayEach(n.required,function(i){var o=n.members[i];if(!0===o.endpointDiscoveryId){var s=o.isLocationName?o.name:i;t[s]=String(r[i])}else e(t,r[i],o)})}(r,e.params,t),r}function u(e){var t=e.service,r=t.api,o=r.operations?r.operations[e.operation]:void 0,u=a(e,o?o.input:void 0),c=s(e);Object.keys(u).length>0&&(c=i.update(c,u),o&&(c.operation=o.name));var l=n.endpointCache.get(c);if(!l||1!==l.length||""!==l[0].Address)if(l&&l.length>0)e.httpRequest.updateEndpoint(l[0].Address);else{var h=t.makeRequest(r.endpointOperation,{Operation:o.name,Identifiers:u});f(h),h.removeListener("validate",n.EventListeners.Core.VALIDATE_PARAMETERS),h.removeListener("retry",n.EventListeners.Core.RETRY_CHECK),n.endpointCache.put(c,[{Address:"",CachePeriodInMinutes:1}]),h.send(function(e,t){t&&t.Endpoints?n.endpointCache.put(c,t.Endpoints):e&&n.endpointCache.put(c,[{Address:"",CachePeriodInMinutes:1}])})}}var c={};function l(e,t){var r=e.service,o=r.api,u=o.operations?o.operations[e.operation]:void 0,l=u?u.input:void 0,h=a(e,l),p=s(e);Object.keys(h).length>0&&(p=i.update(p,h),u&&(p.operation=u.name));var d=n.EndpointCache.getKeyString(p),y=n.endpointCache.get(d);if(y&&1===y.length&&""===y[0].Address)return c[d]||(c[d]=[]),void c[d].push({request:e,callback:t});if(y&&y.length>0)e.httpRequest.updateEndpoint(y[0].Address),t();else{var v=r.makeRequest(o.endpointOperation,{Operation:u.name,Identifiers:h});v.removeListener("validate",n.EventListeners.Core.VALIDATE_PARAMETERS),f(v),n.endpointCache.put(d,[{Address:"",CachePeriodInMinutes:60}]),v.send(function(r,o){if(r){var s={code:"EndpointDiscoveryException",message:"Request cannot be fulfilled without specifying an endpoint",retryable:!1};if(e.response.error=i.error(r,s),n.endpointCache.remove(p),c[d]){var a=c[d];i.arrayEach(a,function(e){e.request.response.error=i.error(r,s),e.callback()}),delete c[d]}}else if(o&&(n.endpointCache.put(d,o.Endpoints),e.httpRequest.updateEndpoint(o.Endpoints[0].Address),c[d])){a=c[d];i.arrayEach(a,function(e){e.request.httpRequest.updateEndpoint(o.Endpoints[0].Address),e.callback()}),delete c[d]}t()})}}function f(e){var t=e.service.api.apiVersion;t&&!e.httpRequest.headers["x-amz-api-version"]&&(e.httpRequest.headers["x-amz-api-version"]=t)}function h(e){var t=e.error,r=e.httpResponse;if(t&&("InvalidEndpointException"===t.code||421===r.statusCode)){var o=e.request,u=o.service.api.operations||{},c=a(o,u[o.operation]?u[o.operation].input:void 0),l=s(o);Object.keys(c).length>0&&(l=i.update(l,c),u[o.operation]&&(l.operation=u[o.operation].name)),n.endpointCache.remove(l)}}function p(e){return["false","0"].indexOf(e)>=0}e.exports={discoverEndpoint:function(e,r){var s=e.service||{};if(function(e){if(e._originalConfig&&e._originalConfig.endpoint&&!0===e._originalConfig.endpointDiscoveryEnabled)throw i.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var t=n.config[e.serviceIdentifier]||{};return Boolean(n.config.endpoint||t.endpoint||e._originalConfig&&e._originalConfig.endpoint)}(s)||e.isPresigned())return r();var a=(s.api.operations||{})[e.operation],c=a?a.endpointDiscoveryRequired:"NULL";if(!function(e){if(!0===(e.service||{}).config.endpointDiscoveryEnabled)return!0;if(i.isBrowser())return!1;for(var r=0;r=0){u=!0;var c=0}var l=function(){u&&c!==a?i.emit("error",t.util.error(new Error("Stream content length mismatch. Received "+c+" of "+a+" bytes."),{code:"StreamContentLengthMismatch"})):2===t.HttpClient.streamsApiVersion?i.end():i.emit("end")},f=s.httpResponse.createUnbufferedStream();if(2===t.HttpClient.streamsApiVersion)if(u){var h=new r.PassThrough;h._write=function(e){return e&&e.length&&(c+=e.length),r.PassThrough.prototype._write.apply(this,arguments)},h.on("end",l),i.on("error",function(e){u=!1,f.unpipe(h),h.emit("end"),h.end()}),f.pipe(h).pipe(i,{end:!1})}else f.pipe(i);else u&&f.on("data",function(e){e&&e.length&&(c+=e.length)}),f.on("data",function(e){i.emit("data",e)}),f.on("end",l);f.on("error",function(e){u=!1,i.emit("error",e)})}}),i},emitEvent:function(e,r,n){"function"==typeof r&&(n=r,r=null),n||(n=function(){}),r||(r=this.eventParameters(e,this.response)),t.SequentialExecutor.prototype.emit.call(this,e,r,function(e){e&&(this.response.error=e),n.call(this,e)})},eventParameters:function(e){switch(e){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(e,r){return r||"function"!=typeof e||(r=e,e=null),(new t.Signers.Presign).sign(this.toGet(),e,r)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",t.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",t.EventListeners.Core.SIGN),this},toGet:function(){return"query"!==this.service.api.protocol&&"ec2"!==this.service.api.protocol||(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(e){e.httpRequest.method="GET",e.httpRequest.path=e.service.endpoint.path+"?"+e.httpRequest.body,e.httpRequest.body="",delete e.httpRequest.headers["Content-Length"],delete e.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),t.Request.addPromisesToClass=function(e){this.prototype.promise=function(){var t=this;return this.httpRequest.appendToUserAgent("promise"),new e(function(e,r){t.on("complete",function(t){t.error?r(t.error):e(Object.defineProperty(t.data||{},"$response",{value:t}))}),t.runTo()})}},t.Request.deletePromisesFromClass=function(){delete this.prototype.promise},t.util.addPromises(t.Request),t.util.mixin(t.Request,t.SequentialExecutor)}).call(this,r(6))},function(e,t){function r(e,t){this.currentState=t||null,this.states=e||{}}r.prototype.runTo=function(e,t,r,n){"function"==typeof e&&(n=r,r=t,t=e,e=null);var i=this,o=i.states[i.currentState];o.fn.call(r||i,n,function(n){if(n){if(!o.fail)return t?t.call(r,n):null;i.currentState=o.fail}else{if(!o.accept)return t?t.call(r):null;i.currentState=o.accept}if(i.currentState===e)return t?t.call(r,n):null;i.runTo(e,t,r,n)})},r.prototype.addState=function(e,t,r,n){return"function"==typeof t?(n=t,t=null,r=null):"function"==typeof r&&(n=r,r=null),this.currentState||(this.currentState=e),this.states[e]={accept:t,fail:r,fn:n},this},e.exports=r},function(e,t,r){var n=r(2),i=n.util.inherit,o=r(72);n.Response=i({constructor:function(e){this.request=e,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new n.HttpResponse,e&&(this.maxRetries=e.service.numRetries(),this.maxRedirects=e.service.config.maxRedirects)},nextPage:function(e){var t,r=this.request.service,i=this.request.operation;try{t=r.paginationConfig(i,!0)}catch(e){this.error=e}if(!this.hasNextPage()){if(e)e(this.error,null);else if(this.error)throw this.error;return null}var o=n.util.copy(this.request.params);if(this.nextPageTokens){var s=t.inputToken;"string"==typeof s&&(s=[s]);for(var a=0;a=0?"&":"?";this.request.path+=o+n.util.queryParamsToString(i)},authorization:function(e,t){var r=[],n=this.credentialString(t);return r.push(this.algorithm+" Credential="+e.accessKeyId+"/"+n),r.push("SignedHeaders="+this.signedHeaders()),r.push("Signature="+this.signature(e,t)),r.join(", ")},signature:function(e,t){var r=i.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return n.util.crypto.hmac(r,this.stringToSign(t),"hex")},stringToSign:function(e){var t=[];return t.push("AWS4-HMAC-SHA256"),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")},canonicalString:function(){var e=[],t=this.request.pathname();return"s3"!==this.serviceName&&"s3v4"!==this.signatureVersion&&(t=n.util.uriEscapePath(t)),e.push(this.request.method),e.push(t),e.push(this.request.search()),e.push(this.canonicalHeaders()+"\n"),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")},canonicalHeaders:function(){var e=[];n.util.each.call(this,this.request.headers,function(t,r){e.push([t,r])}),e.sort(function(e,t){return e[0].toLowerCase()50&&delete i[o.shift()]),p},emptyCache:function(){i={},o=[]}}},function(e,t,r){var n=r(2),i=n.util.inherit;n.Signers.S3=i(n.Signers.RequestSigner,{subResources:{acl:1,accelerate:1,analytics:1,cors:1,lifecycle:1,delete:1,inventory:1,location:1,logging:1,metrics:1,notification:1,partNumber:1,policy:1,requestPayment:1,replication:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(e,t){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=n.util.date.rfc822(t)),e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken);var r=this.sign(e.secretAccessKey,this.stringToSign()),i="AWS "+e.accessKeyId+":"+r;this.request.headers.Authorization=i},stringToSign:function(){var e=this.request,t=[];t.push(e.method),t.push(e.headers["Content-MD5"]||""),t.push(e.headers["Content-Type"]||""),t.push(e.headers["presigned-expires"]||"");var r=this.canonicalizedAmzHeaders();return r&&t.push(r),t.push(this.canonicalizedResource()),t.join("\n")},canonicalizedAmzHeaders:function(){var e=[];n.util.each(this.request.headers,function(t){t.match(/^x-amz-/i)&&e.push(t)}),e.sort(function(e,t){return e.toLowerCase()604800){throw n.util.error(new Error,{code:"InvalidExpiryTime",message:"Presigning does not support expiry time greater than a week with SigV4 signing.",retryable:!1})}e.httpRequest.headers[o]=t}else{if(r!==n.Signers.S3)throw n.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});var i=e.service?e.service.getSkewCorrectedDate():n.util.date.getDate();e.httpRequest.headers[o]=parseInt(n.util.date.unixTimestamp(i)+t,10).toString()}}function a(e){var t=e.httpRequest.endpoint,r=n.util.urlParse(e.httpRequest.path),i={};r.search&&(i=n.util.queryStringParse(r.search.substr(1)));var s=e.httpRequest.headers.Authorization.split(" ");if("AWS"===s[0])s=s[1].split(":"),i.AWSAccessKeyId=s[0],i.Signature=s[1],n.util.each(e.httpRequest.headers,function(e,t){e===o&&(e="Expires"),0===e.indexOf("x-amz-meta-")&&(delete i[e],e=e.toLowerCase()),i[e]=t}),delete e.httpRequest.headers[o],delete i.Authorization,delete i.Host;else if("AWS4-HMAC-SHA256"===s[0]){s.shift();var a=s.join(" ").match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];i["X-Amz-Signature"]=a,delete i.Expires}t.pathname=r.pathname,t.search=n.util.queryParamsToString(i)}n.Signers.Presign=i({sign:function(e,t,r){if(e.httpRequest.headers[o]=t||3600,e.on("build",s),e.on("sign",a),e.removeListener("afterBuild",n.EventListeners.Core.SET_CONTENT_LENGTH),e.removeListener("afterBuild",n.EventListeners.Core.COMPUTE_SHA256),e.emit("beforePresign",[e]),!r){if(e.build(),e.response.error)throw e.response.error;return n.util.urlFormat(e.httpRequest.endpoint)}e.build(function(){this.response.error?r(this.response.error):r(null,n.util.urlFormat(e.httpRequest.endpoint))})}}),e.exports=n.Signers.Presign},function(e,t,r){var n=r(2);n.ParamValidator=n.util.inherit({constructor:function(e){!0!==e&&void 0!==e||(e={min:!0}),this.validation=e},validate:function(e,t,r){if(this.errors=[],this.validateMember(e,t||{},r||"params"),this.errors.length>1){var i=this.errors.join("\n* ");throw i="There were "+this.errors.length+" validation errors:\n* "+i,n.util.error(new Error(i),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(e,t){this.errors.push(n.util.error(new Error(t),{code:e}))},validateStructure:function(e,t,r){var n;this.validateType(t,r,["object"],"structure");for(var i=0;e.required&&i= 1, but found "'+t+'" for '+r)},validatePattern:function(e,t,r){this.validation.pattern&&void 0!==e.pattern&&(new RegExp(e.pattern).test(t)||this.fail("PatternMatchError",'Provided value "'+t+'" does not match regex pattern /'+e.pattern+"/ for "+r))},validateRange:function(e,t,r,n){this.validation.min&&void 0!==e.min&&t= "+e.min+", but found "+t+" for "+r),this.validation.max&&void 0!==e.max&&t>e.max&&this.fail("MaxRangeError","Expected "+n+" <= "+e.max+", but found "+t+" for "+r)},validateEnum:function(e,t,r){this.validation.enum&&void 0!==e.enum&&-1===e.enum.indexOf(t)&&this.fail("EnumError","Found string value of "+t+", but expected "+e.enum.join("|")+" for "+r)},validateType:function(e,t,r,i){if(null===e||void 0===e)return!1;for(var o=!1,s=0;se.BLOCK_SIZE){var i=new e;i.update(r),r=i.digest()}var o=new Uint8Array(e.BLOCK_SIZE);return o.set(r),o}(e,t),i=new Uint8Array(e.BLOCK_SIZE);i.set(r);for(var o=0;o>>32-i)+r&4294967295}function u(e,t,r,n,i,o,s){return a(t&r|~t&n,e,t,i,o,s)}function c(e,t,r,n,i,o,s){return a(t&n|r&~n,e,t,i,o,s)}function l(e,t,r,n,i,o,s){return a(t^r^n,e,t,i,o,s)}function f(e,t,r,n,i,o,s){return a(r^(t|~n),e,t,i,o,s)}e.exports=s,s.BLOCK_SIZE=o,s.prototype.update=function(e){if(n.isEmptyData(e))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=n.convertToBuffer(e),r=0,i=t.byteLength;for(this.bytesHashed+=i;i>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),i--,this.bufferLength===o&&(this.hashBuffer(),this.bufferLength=0);return this},s.prototype.digest=function(e){if(!this.finished){var t=this.buffer,r=this.bufferLength,n=8*this.bytesHashed;if(t.setUint8(this.bufferLength++,128),r%o>=o-8){for(var s=this.bufferLength;s>>0,!0),t.setUint32(o-4,Math.floor(n/4294967296),!0),this.hashBuffer(),this.finished=!0}var a=new DataView(new ArrayBuffer(16));for(s=0;s<4;s++)a.setUint32(4*s,this.state[s],!0);var u=new i(a.buffer,a.byteOffset,a.byteLength);return e?u.toString(e):u},s.prototype.hashBuffer=function(){var e=this.buffer,t=this.state,r=t[0],n=t[1],i=t[2],o=t[3];n=f(n=f(n=f(n=f(n=l(n=l(n=l(n=l(n=c(n=c(n=c(n=c(n=u(n=u(n=u(n=u(n,i=u(i,o=u(o,r=u(r,n,i,o,e.getUint32(0,!0),7,3614090360),n,i,e.getUint32(4,!0),12,3905402710),r,n,e.getUint32(8,!0),17,606105819),o,r,e.getUint32(12,!0),22,3250441966),i=u(i,o=u(o,r=u(r,n,i,o,e.getUint32(16,!0),7,4118548399),n,i,e.getUint32(20,!0),12,1200080426),r,n,e.getUint32(24,!0),17,2821735955),o,r,e.getUint32(28,!0),22,4249261313),i=u(i,o=u(o,r=u(r,n,i,o,e.getUint32(32,!0),7,1770035416),n,i,e.getUint32(36,!0),12,2336552879),r,n,e.getUint32(40,!0),17,4294925233),o,r,e.getUint32(44,!0),22,2304563134),i=u(i,o=u(o,r=u(r,n,i,o,e.getUint32(48,!0),7,1804603682),n,i,e.getUint32(52,!0),12,4254626195),r,n,e.getUint32(56,!0),17,2792965006),o,r,e.getUint32(60,!0),22,1236535329),i=c(i,o=c(o,r=c(r,n,i,o,e.getUint32(4,!0),5,4129170786),n,i,e.getUint32(24,!0),9,3225465664),r,n,e.getUint32(44,!0),14,643717713),o,r,e.getUint32(0,!0),20,3921069994),i=c(i,o=c(o,r=c(r,n,i,o,e.getUint32(20,!0),5,3593408605),n,i,e.getUint32(40,!0),9,38016083),r,n,e.getUint32(60,!0),14,3634488961),o,r,e.getUint32(16,!0),20,3889429448),i=c(i,o=c(o,r=c(r,n,i,o,e.getUint32(36,!0),5,568446438),n,i,e.getUint32(56,!0),9,3275163606),r,n,e.getUint32(12,!0),14,4107603335),o,r,e.getUint32(32,!0),20,1163531501),i=c(i,o=c(o,r=c(r,n,i,o,e.getUint32(52,!0),5,2850285829),n,i,e.getUint32(8,!0),9,4243563512),r,n,e.getUint32(28,!0),14,1735328473),o,r,e.getUint32(48,!0),20,2368359562),i=l(i,o=l(o,r=l(r,n,i,o,e.getUint32(20,!0),4,4294588738),n,i,e.getUint32(32,!0),11,2272392833),r,n,e.getUint32(44,!0),16,1839030562),o,r,e.getUint32(56,!0),23,4259657740),i=l(i,o=l(o,r=l(r,n,i,o,e.getUint32(4,!0),4,2763975236),n,i,e.getUint32(16,!0),11,1272893353),r,n,e.getUint32(28,!0),16,4139469664),o,r,e.getUint32(40,!0),23,3200236656),i=l(i,o=l(o,r=l(r,n,i,o,e.getUint32(52,!0),4,681279174),n,i,e.getUint32(0,!0),11,3936430074),r,n,e.getUint32(12,!0),16,3572445317),o,r,e.getUint32(24,!0),23,76029189),i=l(i,o=l(o,r=l(r,n,i,o,e.getUint32(36,!0),4,3654602809),n,i,e.getUint32(48,!0),11,3873151461),r,n,e.getUint32(60,!0),16,530742520),o,r,e.getUint32(8,!0),23,3299628645),i=f(i,o=f(o,r=f(r,n,i,o,e.getUint32(0,!0),6,4096336452),n,i,e.getUint32(28,!0),10,1126891415),r,n,e.getUint32(56,!0),15,2878612391),o,r,e.getUint32(20,!0),21,4237533241),i=f(i,o=f(o,r=f(r,n,i,o,e.getUint32(48,!0),6,1700485571),n,i,e.getUint32(12,!0),10,2399980690),r,n,e.getUint32(40,!0),15,4293915773),o,r,e.getUint32(4,!0),21,2240044497),i=f(i,o=f(o,r=f(r,n,i,o,e.getUint32(32,!0),6,1873313359),n,i,e.getUint32(60,!0),10,4264355552),r,n,e.getUint32(24,!0),15,2734768916),o,r,e.getUint32(52,!0),21,1309151649),i=f(i,o=f(o,r=f(r,n,i,o,e.getUint32(16,!0),6,4149444226),n,i,e.getUint32(44,!0),10,3174756917),r,n,e.getUint32(8,!0),15,718787259),o,r,e.getUint32(36,!0),21,3951481745),t[0]=r+t[0]&4294967295,t[1]=n+t[1]&4294967295,t[2]=i+t[2]&4294967295,t[3]=o+t[3]&4294967295}},function(e,t,r){var n=r(15).Buffer,i=r(46);new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function o(){this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=new Uint32Array(80),this.offset=0,this.shift=24,this.totalLength=0}e.exports=o,o.BLOCK_SIZE=64,o.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(i.isEmptyData(e))return this;var t=(e=i.convertToBuffer(e)).length;this.totalLength+=8*t;for(var r=0;r14||14===this.offset&&this.shift<24)&&this.processBlock(),this.offset=14,this.shift=24,this.write(0),this.write(0),this.write(this.totalLength>0xffffffffff?this.totalLength/1099511627776:0),this.write(this.totalLength>4294967295?this.totalLength/4294967296:0);for(var t=24;t>=0;t-=8)this.write(this.totalLength>>t);var r=new n(20),i=new DataView(r.buffer);return i.setUint32(0,this.h0,!1),i.setUint32(4,this.h1,!1),i.setUint32(8,this.h2,!1),i.setUint32(12,this.h3,!1),i.setUint32(16,this.h4,!1),e?r.toString(e):r},o.prototype.processBlock=function(){for(var e=16;e<80;e++){var t=this.block[e-3]^this.block[e-8]^this.block[e-14]^this.block[e-16];this.block[e]=t<<1|t>>>31}var r,n,i=this.h0,o=this.h1,s=this.h2,a=this.h3,u=this.h4;for(e=0;e<80;e++){e<20?(r=a^o&(s^a),n=1518500249):e<40?(r=o^s^a,n=1859775393):e<60?(r=o&s|a&(o|s),n=2400959708):(r=o^s^a,n=3395469782);var c=(i<<5|i>>>27)+r+u+n+(0|this.block[e]);u=a,a=s,s=o<<30|o>>>2,o=i,i=c}for(this.h0=this.h0+i|0,this.h1=this.h1+o|0,this.h2=this.h2+s|0,this.h3=this.h3+a|0,this.h4=this.h4+u|0,this.offset=0,e=0;e<16;e++)this.block[e]=0}},function(e,t,r){var n=r(15).Buffer,i=r(46),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=Math.pow(2,53)-1;function a(){this.state=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}e.exports=a,a.BLOCK_SIZE=64,a.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(i.isEmptyData(e))return this;var t=0,r=(e=i.convertToBuffer(e)).byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>s)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},a.prototype.digest=function(e){if(!this.finished){var t=8*this.bytesHashed,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),i=this.bufferLength;if(r.setUint8(this.bufferLength++,128),i%64>=56){for(var o=this.bufferLength;o<64;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(o=this.bufferLength;o<56;o++)r.setUint8(o,0);r.setUint32(56,Math.floor(t/4294967296),!0),r.setUint32(60,t),this.hashBuffer(),this.finished=!0}var s=new n(32);for(o=0;o<8;o++)s[4*o]=this.state[o]>>>24&255,s[4*o+1]=this.state[o]>>>16&255,s[4*o+2]=this.state[o]>>>8&255,s[4*o+3]=this.state[o]>>>0&255;return e?s.toString(e):s},a.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],n=t[1],i=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<64;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var h=this.temp[f-2],p=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,d=((h=this.temp[f-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[f]=(p+this.temp[f-7]|0)+(d+this.temp[f-16]|0)}var y=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(o[f]+this.temp[f]|0)|0)|0,v=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&n^r&i^n&i)|0;l=c,c=u,u=a,a=s+y|0,s=i,i=n,n=r,r=y+v|0}t[0]+=r,t[1]+=n,t[2]+=i,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l}},function(e,t){e.exports={now:function(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}}},function(e,t,r){var n=r(281).eventMessageChunker,i=r(282).parseEvent;e.exports={createEventStream:function(e,t,r){for(var o=n(e),s=[],a=0;a-1&&(e[t]++,0===e[t]);t--);}o.fromNumber=function(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(e+" is too large (or, if negative, too small) to represent as an Int64");for(var t=new Uint8Array(8),r=7,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;return e<0&&s(t),new o(t)},o.prototype.valueOf=function(){var e=this.bytes.slice(0),t=128&e[0];return t&&s(e),parseInt(e.toString("hex"),16)*(t?-1:1)},o.prototype.toString=function(){return String(this.valueOf())},e.exports={Int64:o}},function(e,t,r){var n=r(2).util,i=n.buffer.toBuffer,o=4,s=2*o,a=4,u=s+2*a;e.exports={splitMessage:function(e){if(n.Buffer.isBuffer(e)||(e=i(e)),e.length=0)return e.toLowerCase();throw n.util.error(new Error,t)}}e.exports=function(e,r){var o;if((e=e||{})[r.clientConfig]&&(o=i(e[r.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+r.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+e[r.clientConfig]+'".'})))return o;if(!n.util.isNode())return o;if(Object.prototype.hasOwnProperty.call(t.env,r.env)&&(o=i(t.env[r.env],{code:"InvalidEnvironmentalVariable",message:"invalid "+r.env+' environmental variable. Expect "legacy" or "regional". Got "'+t.env[r.env]+'".'})))return o;var s={};try{s=n.util.getProfilesFromSharedConfig(n.util.iniLoader)[t.env.AWS_PROFILE||n.util.defaultProfile]}catch(e){}return s&&Object.prototype.hasOwnProperty.call(s,r.sharedConfig)&&(o=i(s[r.sharedConfig],{code:"InvalidConfiguration",message:"invalid "+r.sharedConfig+' profile config. Expect "legacy" or "regional". Got "'+s[r.sharedConfig]+'".'})),o}}).call(this,r(6))},function(e){e.exports=JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2011-06-15","endpointPrefix":"sts","globalEndpoint":"sts.amazonaws.com","protocol":"query","serviceAbbreviation":"AWS STS","serviceFullName":"AWS Security Token Service","serviceId":"STS","signatureVersion":"v4","uid":"sts-2011-06-15","xmlNamespace":"https://sts.amazonaws.com/doc/2011-06-15/"},"operations":{"AssumeRole":{"input":{"type":"structure","required":["RoleArn","RoleSessionName"],"members":{"RoleArn":{},"RoleSessionName":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"},"Tags":{"shape":"S8"},"TransitiveTagKeys":{"type":"list","member":{}},"ExternalId":{},"SerialNumber":{},"TokenCode":{}}},"output":{"resultWrapper":"AssumeRoleResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"}}}},"AssumeRoleWithSAML":{"input":{"type":"structure","required":["RoleArn","PrincipalArn","SAMLAssertion"],"members":{"RoleArn":{},"PrincipalArn":{},"SAMLAssertion":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"}}},"output":{"resultWrapper":"AssumeRoleWithSAMLResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"},"Subject":{},"SubjectType":{},"Issuer":{},"Audience":{},"NameQualifier":{}}}},"AssumeRoleWithWebIdentity":{"input":{"type":"structure","required":["RoleArn","RoleSessionName","WebIdentityToken"],"members":{"RoleArn":{},"RoleSessionName":{},"WebIdentityToken":{},"ProviderId":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"}}},"output":{"resultWrapper":"AssumeRoleWithWebIdentityResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"SubjectFromWebIdentityToken":{},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"},"Provider":{},"Audience":{}}}},"DecodeAuthorizationMessage":{"input":{"type":"structure","required":["EncodedMessage"],"members":{"EncodedMessage":{}}},"output":{"resultWrapper":"DecodeAuthorizationMessageResult","type":"structure","members":{"DecodedMessage":{}}}},"GetAccessKeyInfo":{"input":{"type":"structure","required":["AccessKeyId"],"members":{"AccessKeyId":{}}},"output":{"resultWrapper":"GetAccessKeyInfoResult","type":"structure","members":{"Account":{}}}},"GetCallerIdentity":{"input":{"type":"structure","members":{}},"output":{"resultWrapper":"GetCallerIdentityResult","type":"structure","members":{"UserId":{},"Account":{},"Arn":{}}}},"GetFederationToken":{"input":{"type":"structure","required":["Name"],"members":{"Name":{},"Policy":{},"PolicyArns":{"shape":"S4"},"DurationSeconds":{"type":"integer"},"Tags":{"shape":"S8"}}},"output":{"resultWrapper":"GetFederationTokenResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"FederatedUser":{"type":"structure","required":["FederatedUserId","Arn"],"members":{"FederatedUserId":{},"Arn":{}}},"PackedPolicySize":{"type":"integer"}}}},"GetSessionToken":{"input":{"type":"structure","members":{"DurationSeconds":{"type":"integer"},"SerialNumber":{},"TokenCode":{}}},"output":{"resultWrapper":"GetSessionTokenResult","type":"structure","members":{"Credentials":{"shape":"Sh"}}}}},"shapes":{"S4":{"type":"list","member":{"type":"structure","members":{"arn":{}}}},"S8":{"type":"list","member":{"type":"structure","required":["Key","Value"],"members":{"Key":{},"Value":{}}}},"Sh":{"type":"structure","required":["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],"members":{"AccessKeyId":{},"SecretAccessKey":{},"SessionToken":{},"Expiration":{"type":"timestamp"}}},"Sm":{"type":"structure","required":["AssumedRoleId","Arn"],"members":{"AssumedRoleId":{},"Arn":{}}}}}')},function(e){e.exports=JSON.parse('{"pagination":{}}')},function(e,t,r){var n=r(2),i=r(37);n.ChainableTemporaryCredentials=n.util.inherit(n.Credentials,{constructor:function(e){n.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var t=n.util.copy(e.params)||{};if(t.RoleArn&&(t.RoleSessionName=t.RoleSessionName||"temporary-credentials"),t.SerialNumber){if(!e.tokenCodeFn||"function"!=typeof e.tokenCodeFn)throw new n.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}var r=n.util.merge({params:t,credentials:e.masterCredentials||n.config.credentials},e.stsConfig||{});this.service=new i(r)},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this,r=t.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(n,i){var o={};n?e(n):(i&&(o.TokenCode=i),t.service[r](o,function(r,n){r||t.service.credentialsFrom(n,t),e(r)}))})},getTokenCode:function(e){var t=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(r,i){if(r){var o=r;return r instanceof Error&&(o=r.message),void e(n.util.error(new Error("Error fetching MFA token: "+o),{code:t.errorCode}))}e(null,i)}):e(null)}})},function(e,t,r){var n=r(2),i=r(37);n.WebIdentityCredentials=n.util.inherit(n.Credentials,{constructor:function(e,t){n.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=n.util.copy(t||{})},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.service.assumeRoleWithWebIdentity(function(r,n){t.data=null,r||(t.data=n,t.service.credentialsFrom(n,t)),e(r)})},createClients:function(){if(!this.service){var e=n.util.merge({},this._clientConfig);e.params=this.params,this.service=new i(e)}}})},function(e,t,r){var n=r(2),i=r(294),o=r(37);n.CognitoIdentityCredentials=n.util.inherit(n.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,t){n.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=n.util.copy(t||{}),this.loadCachedId();var r=this;Object.defineProperty(this,"identityId",{get:function(){return r.loadCachedId(),r._identityId||r.params.IdentityId},set:function(e){r._identityId=e}})},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.data=null,t._identityId=null,t.getId(function(r){r?(t.clearIdOnNotAuthorized(r),e(r)):t.params.RoleArn?t.getCredentialsFromSTS(e):t.getCredentialsForIdentity(e)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,t=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+t],delete this.storage[this.localStorageKey.providers+e+t]},clearIdOnNotAuthorized:function(e){"NotAuthorizedException"==e.code&&this.clearCachedId()},getId:function(e){var t=this;if("string"==typeof t.params.IdentityId)return e(null,t.params.IdentityId);t.cognito.getId(function(r,n){!r&&n.IdentityId?(t.params.IdentityId=n.IdentityId,e(null,n.IdentityId)):e(r)})},loadCredentials:function(e,t){e&&t&&(t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(e){var t=this;t.cognito.getCredentialsForIdentity(function(r,n){r?t.clearIdOnNotAuthorized(r):(t.cacheId(n),t.data=n,t.loadCredentials(t.data,t)),e(r)})},getCredentialsFromSTS:function(e){var t=this;t.cognito.getOpenIdToken(function(r,n){r?(t.clearIdOnNotAuthorized(r),e(r)):(t.cacheId(n),t.params.WebIdentityToken=n.Token,t.webIdentityCredentials.refresh(function(r){r||(t.data=t.webIdentityCredentials.data,t.sts.credentialsFrom(t.data,t)),e(r)}))})},loadCachedId:function(){if(n.util.isBrowser()&&!this.params.IdentityId){var e=this.getStorage("id");if(e&&this.params.Logins){var t=Object.keys(this.params.Logins);0!==(this.getStorage("providers")||"").split(",").filter(function(e){return-1!==t.indexOf(e)}).length&&(this.params.IdentityId=e)}else e&&(this.params.IdentityId=e)}},createClients:function(){var e=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new n.WebIdentityCredentials(this.params,e),!this.cognito){var t=n.util.merge({},e);t.params=this.params,this.cognito=new i(t)}this.sts=this.sts||new o(e)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,n.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,t){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=t}catch(e){}},storage:function(){try{var e=n.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return e["aws.test-storage"]="foobar",delete e["aws.test-storage"],e}catch(e){return{}}}()})},function(e,t,r){r(67);var n=r(2),i=n.Service,o=n.apiLoader;o.services.cognitoidentity={},n.CognitoIdentity=i.defineService("cognitoidentity",["2014-06-30"]),r(295),Object.defineProperty(o.services.cognitoidentity,"2014-06-30",{get:function(){var e=r(296);return e.paginators=r(297).pagination,e},enumerable:!0,configurable:!0}),e.exports=n.CognitoIdentity},function(e,t,r){var n=r(2);n.util.update(n.CognitoIdentity.prototype,{getOpenIdToken:function(e,t){return this.makeUnauthenticatedRequest("getOpenIdToken",e,t)},getId:function(e,t){return this.makeUnauthenticatedRequest("getId",e,t)},getCredentialsForIdentity:function(e,t){return this.makeUnauthenticatedRequest("getCredentialsForIdentity",e,t)}})},function(e){e.exports=JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2014-06-30","endpointPrefix":"cognito-identity","jsonVersion":"1.1","protocol":"json","serviceFullName":"Amazon Cognito Identity","serviceId":"Cognito Identity","signatureVersion":"v4","targetPrefix":"AWSCognitoIdentityService","uid":"cognito-identity-2014-06-30"},"operations":{"CreateIdentityPool":{"input":{"type":"structure","required":["IdentityPoolName","AllowUnauthenticatedIdentities"],"members":{"IdentityPoolName":{},"AllowUnauthenticatedIdentities":{"type":"boolean"},"AllowClassicFlow":{"type":"boolean"},"SupportedLoginProviders":{"shape":"S5"},"DeveloperProviderName":{},"OpenIdConnectProviderARNs":{"shape":"S9"},"CognitoIdentityProviders":{"shape":"Sb"},"SamlProviderARNs":{"shape":"Sg"},"IdentityPoolTags":{"shape":"Sh"}}},"output":{"shape":"Sk"}},"DeleteIdentities":{"input":{"type":"structure","required":["IdentityIdsToDelete"],"members":{"IdentityIdsToDelete":{"type":"list","member":{}}}},"output":{"type":"structure","members":{"UnprocessedIdentityIds":{"type":"list","member":{"type":"structure","members":{"IdentityId":{},"ErrorCode":{}}}}}}},"DeleteIdentityPool":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}}},"DescribeIdentity":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{}}},"output":{"shape":"Sv"}},"DescribeIdentityPool":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}},"output":{"shape":"Sk"}},"GetCredentialsForIdentity":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{},"Logins":{"shape":"S10"},"CustomRoleArn":{}}},"output":{"type":"structure","members":{"IdentityId":{},"Credentials":{"type":"structure","members":{"AccessKeyId":{},"SecretKey":{},"SessionToken":{},"Expiration":{"type":"timestamp"}}}}}},"GetId":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"AccountId":{},"IdentityPoolId":{},"Logins":{"shape":"S10"}}},"output":{"type":"structure","members":{"IdentityId":{}}}},"GetIdentityPoolRoles":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}},"output":{"type":"structure","members":{"IdentityPoolId":{},"Roles":{"shape":"S1c"},"RoleMappings":{"shape":"S1e"}}}},"GetOpenIdToken":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{},"Logins":{"shape":"S10"}}},"output":{"type":"structure","members":{"IdentityId":{},"Token":{}}}},"GetOpenIdTokenForDeveloperIdentity":{"input":{"type":"structure","required":["IdentityPoolId","Logins"],"members":{"IdentityPoolId":{},"IdentityId":{},"Logins":{"shape":"S10"},"TokenDuration":{"type":"long"}}},"output":{"type":"structure","members":{"IdentityId":{},"Token":{}}}},"ListIdentities":{"input":{"type":"structure","required":["IdentityPoolId","MaxResults"],"members":{"IdentityPoolId":{},"MaxResults":{"type":"integer"},"NextToken":{},"HideDisabled":{"type":"boolean"}}},"output":{"type":"structure","members":{"IdentityPoolId":{},"Identities":{"type":"list","member":{"shape":"Sv"}},"NextToken":{}}}},"ListIdentityPools":{"input":{"type":"structure","required":["MaxResults"],"members":{"MaxResults":{"type":"integer"},"NextToken":{}}},"output":{"type":"structure","members":{"IdentityPools":{"type":"list","member":{"type":"structure","members":{"IdentityPoolId":{},"IdentityPoolName":{}}}},"NextToken":{}}}},"ListTagsForResource":{"input":{"type":"structure","required":["ResourceArn"],"members":{"ResourceArn":{}}},"output":{"type":"structure","members":{"Tags":{"shape":"Sh"}}}},"LookupDeveloperIdentity":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{},"IdentityId":{},"DeveloperUserIdentifier":{},"MaxResults":{"type":"integer"},"NextToken":{}}},"output":{"type":"structure","members":{"IdentityId":{},"DeveloperUserIdentifierList":{"type":"list","member":{}},"NextToken":{}}}},"MergeDeveloperIdentities":{"input":{"type":"structure","required":["SourceUserIdentifier","DestinationUserIdentifier","DeveloperProviderName","IdentityPoolId"],"members":{"SourceUserIdentifier":{},"DestinationUserIdentifier":{},"DeveloperProviderName":{},"IdentityPoolId":{}}},"output":{"type":"structure","members":{"IdentityId":{}}}},"SetIdentityPoolRoles":{"input":{"type":"structure","required":["IdentityPoolId","Roles"],"members":{"IdentityPoolId":{},"Roles":{"shape":"S1c"},"RoleMappings":{"shape":"S1e"}}}},"TagResource":{"input":{"type":"structure","required":["ResourceArn","Tags"],"members":{"ResourceArn":{},"Tags":{"shape":"Sh"}}},"output":{"type":"structure","members":{}}},"UnlinkDeveloperIdentity":{"input":{"type":"structure","required":["IdentityId","IdentityPoolId","DeveloperProviderName","DeveloperUserIdentifier"],"members":{"IdentityId":{},"IdentityPoolId":{},"DeveloperProviderName":{},"DeveloperUserIdentifier":{}}}},"UnlinkIdentity":{"input":{"type":"structure","required":["IdentityId","Logins","LoginsToRemove"],"members":{"IdentityId":{},"Logins":{"shape":"S10"},"LoginsToRemove":{"shape":"Sw"}}}},"UntagResource":{"input":{"type":"structure","required":["ResourceArn","TagKeys"],"members":{"ResourceArn":{},"TagKeys":{"type":"list","member":{}}}},"output":{"type":"structure","members":{}}},"UpdateIdentityPool":{"input":{"shape":"Sk"},"output":{"shape":"Sk"}}},"shapes":{"S5":{"type":"map","key":{},"value":{}},"S9":{"type":"list","member":{}},"Sb":{"type":"list","member":{"type":"structure","members":{"ProviderName":{},"ClientId":{},"ServerSideTokenCheck":{"type":"boolean"}}}},"Sg":{"type":"list","member":{}},"Sh":{"type":"map","key":{},"value":{}},"Sk":{"type":"structure","required":["IdentityPoolId","IdentityPoolName","AllowUnauthenticatedIdentities"],"members":{"IdentityPoolId":{},"IdentityPoolName":{},"AllowUnauthenticatedIdentities":{"type":"boolean"},"AllowClassicFlow":{"type":"boolean"},"SupportedLoginProviders":{"shape":"S5"},"DeveloperProviderName":{},"OpenIdConnectProviderARNs":{"shape":"S9"},"CognitoIdentityProviders":{"shape":"Sb"},"SamlProviderARNs":{"shape":"Sg"},"IdentityPoolTags":{"shape":"Sh"}}},"Sv":{"type":"structure","members":{"IdentityId":{},"Logins":{"shape":"Sw"},"CreationDate":{"type":"timestamp"},"LastModifiedDate":{"type":"timestamp"}}},"Sw":{"type":"list","member":{}},"S10":{"type":"map","key":{},"value":{}},"S1c":{"type":"map","key":{},"value":{}},"S1e":{"type":"map","key":{},"value":{"type":"structure","required":["Type"],"members":{"Type":{},"AmbiguousRoleResolution":{},"RulesConfiguration":{"type":"structure","required":["Rules"],"members":{"Rules":{"type":"list","member":{"type":"structure","required":["Claim","MatchType","Value","RoleARN"],"members":{"Claim":{},"MatchType":{},"Value":{},"RoleARN":{}}}}}}}}}}}')},function(e){e.exports=JSON.parse('{"pagination":{}}')},function(e,t,r){var n=r(2),i=r(37);n.SAMLCredentials=n.util.inherit(n.Credentials,{constructor:function(e){n.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.service.assumeRoleWithSAML(function(r,n){r||t.service.credentialsFrom(n,t),e(r)})},createClients:function(){this.service=this.service||new i({params:this.params})}})},function(e,t,r){var n=r(7),i=r(36);function o(){}function s(e,t){for(var r=e.getElementsByTagName(t),n=0,i=r.length;n=this.HEADERS_RECEIVED&&!f&&(u.statusCode=l.status,u.headers=s.parseHeaders(l.getAllResponseHeaders()),u.emit("headers",u.statusCode,u.headers,l.statusText),f=!0),this.readyState===this.DONE&&s.finishRequest(l,u)},!1),l.upload.addEventListener("progress",function(e){u.emit("sendProgress",e)}),l.addEventListener("progress",function(e){u.emit("receiveProgress",e)},!1),l.addEventListener("timeout",function(){o(n.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),l.addEventListener("error",function(){o(n.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),l.addEventListener("abort",function(){o(n.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))},!1),r(u),l.open(e.method,c,!1!==t.xhrAsync),n.util.each(e.headers,function(e,t){"Content-Length"!==e&&"User-Agent"!==e&&"Host"!==e&&l.setRequestHeader(e,t)}),t.timeout&&!1!==t.xhrAsync&&(l.timeout=t.timeout),t.xhrWithCredentials&&(l.withCredentials=!0);try{l.responseType="arraybuffer"}catch(e){}try{e.body?l.send(e.body):l.send()}catch(t){if(!e.body||"object"!=typeof e.body.buffer)throw t;l.send(e.body.buffer)}return u},parseHeaders:function(e){var t={};return n.util.arrayEach(e.split(/\r?\n/),function(e){var r=e.split(":",1)[0],n=e.substring(r.length+2);r.length>0&&(t[r.toLowerCase()]=n)}),t},finishRequest:function(e,t){var r;if("arraybuffer"===e.responseType&&e.response){var i=e.response;r=new n.util.Buffer(i.byteLength);for(var o=new Uint8Array(i),s=0;s>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}var n=t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),function(e){0===(e[0]=r(e[0]))&&(e[1]=r(e[1]))}(s);var a=s.slice(0);n.encryptBlock(a,0);for(var u=0;u>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(r(4),r(8))},function(e,t,r){e.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,i=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(i-1)).concat(e.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(r(4),r(8))},function(e,t,r){e.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(r(4),r(8))},function(e,t,r){e.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1;!(t[r>>>2]>>>24-r%4*8&255);)r--;e.sigBytes=r+1}},e.pad.ZeroPadding}(r(4),r(8))},function(e,t,r){e.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(r(4),r(8))},function(e,t,r){e.exports=function(e){return function(t){var r=e,n=r.lib.CipherParams,i=r.enc.Hex;r.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return n.create({ciphertext:t})}}}(),e.format.Hex}(r(4),r(8))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,i=[],o=[],s=[],a=[],u=[],c=[],l=[],f=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,i[r]=d,o[d]=r;var y=e[r],v=e[y],m=e[v],g=257*e[d]^16843008*d;s[r]=g<<24|g>>>8,a[r]=g<<16|g>>>16,u[r]=g<<8|g>>>24,c[r]=g,g=16843009*m^65537*v^257*y^16843008*r,l[d]=g<<24|g>>>8,f[d]=g<<16|g>>>16,h[d]=g<<8|g>>>24,p[d]=g,r?(r=y^e[e[e[m^y]]],n^=e[e[n]]):r=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],y=n.AES=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],s=0;s6&&s%r==4&&(a=i[a>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a]):(a=i[(a=a<<8|a>>>24)>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a],a^=d[s/r|0]<<24),o[s]=o[s-r]^a}for(var u=this._invKeySchedule=[],c=0;c>>24]]^f[i[a>>>16&255]]^h[i[a>>>8&255]]^p[i[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,u,c,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,f,h,p,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,s,a){for(var u=this._nRounds,c=e[t]^r[0],l=e[t+1]^r[1],f=e[t+2]^r[2],h=e[t+3]^r[3],p=4,d=1;d>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^r[p++],v=n[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^r[p++],m=n[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^r[p++],g=n[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^r[p++];c=y,l=v,f=m,h=g}y=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^r[p++],v=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^r[p++],m=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^r[p++],g=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^r[p++],e[t]=y,e[t+1]=v,e[t+2]=m,e[t+3]=g},keySize:8});t.AES=r._createHelper(y)}(),e.AES}(r(4),r(28),r(29),r(30),r(8))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,i=r.BlockCipher,o=t.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var c=i[o]=[],l=u[o];for(r=0;r<24;r++)c[r/6|0]|=t[(a[r]-1+l)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(a[r+24]-1+l)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var f=this._invSubKeys=[];for(r=0;r<16;r++)f[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,u=0;u<8;u++)a|=c[u][((s^i[u])&l[u])>>>0];this._lBlock=s,this._rBlock=o^a}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<>>2]>>>24-s%4*8&255;o=(o+n[i]+a)%256;var u=n[i];n[i]=n[o],n[o]=u}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}t.RC4=r._createHelper(i);var s=n.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});t.RC4Drop=r._createHelper(s)}(),e.RC4}(r(4),r(28),r(29),r(30),r(8))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=[],i=[],o=[],s=t.algo.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)a.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,s=o[0],u=o[1],c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(i[0]^=c,i[1]^=f,i[2]^=l,i[3]^=h,i[4]^=c,i[5]^=f,i[6]^=l,i[7]^=h,r=0;r<4;r++)a.call(this)}},_doProcessBlock:function(e,t){var r=this._X;a.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],s=65535&n,a=n>>>16,u=((s*s>>>17)+s*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=u^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.Rabbit=r._createHelper(s)}(),e.Rabbit}(r(4),r(28),r(29),r(30),r(8))},function(e,t,r){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=[],i=[],o=[],s=t.algo.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)a.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,s=o[0],u=o[1],c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(n[0]^=c,n[1]^=f,n[2]^=l,n[3]^=h,n[4]^=c,n[5]^=f,n[6]^=l,n[7]^=h,i=0;i<4;i++)a.call(this)}},_doProcessBlock:function(e,t){var r=this._X;a.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],s=65535&n,a=n>>>16,u=((s*s>>>17)+s*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=u^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.RabbitLegacy=r._createHelper(s)}(),e.RabbitLegacy}(r(4),r(28),r(29),r(30),r(8))},function(e,t){e.exports={INVALID_CONNECT_OPTIONS:"Invalid connect options supplied.",INVALID_CLIENT_ID_OPTION:'Invalid "clientId" (mqtt client id) option supplied.',INVALID_RECONNECT_TIMING:"Invalid reconnect timing options supplied.",INVALID_OFFLINE_QUEUEING_PARAMETERS:"Invalid offline queueing options supplied."}},function(e,t,r){(function(t){var n=r(66),i=r(44),o=r(240);e.exports=function(e){if(i(e.keyPath)&&i(e.privateKey))throw new Error(o.NO_KEY_OPTION);if(i(e.certPath)&&i(e.clientCert))throw new Error(o.NO_CERT_OPTION);if(i(e.caPath)&&i(e.caCert))throw new Error(o.NO_CA_OPTION);if(!i(e.caCert))if(t.isBuffer(e.caCert))e.ca=e.caCert;else{if(!n.existsSync(e.caCert))throw new Error(o.INVALID_CA_CERT_OPTION);e.ca=n.readFileSync(e.caCert)}if(!i(e.privateKey))if(t.isBuffer(e.privateKey))e.key=e.privateKey;else{if(!n.existsSync(e.privateKey))throw new Error(o.INVALID_PRIVATE_KEY_OPTION);e.key=n.readFileSync(e.privateKey)}if(!i(e.clientCert))if(t.isBuffer(e.clientCert))e.cert=e.clientCert;else{if(!n.existsSync(e.clientCert))throw new Error(o.INVALID_CLIENT_CERT_OPTION);e.cert=n.readFileSync(e.clientCert)}if(n.existsSync(e.keyPath))e.key=n.readFileSync(e.keyPath);else if(!i(e.keyPath))throw new Error(o.INVALID_KEY_PATH_OPTION);if(n.existsSync(e.certPath))e.cert=n.readFileSync(e.certPath);else if(!i(e.certPath))throw new Error(o.INVALID_CERT_PATH_OPTION);if(n.existsSync(e.caPath))e.ca=n.readFileSync(e.caPath);else if(!i(e.caPath))throw new Error(o.INVALID_CA_PATH_OPTION);e.requestCert=!0,e.rejectUnauthorized=!0}}).call(this,r(16).Buffer)},function(e,t){e.exports={NO_KEY_OPTION:'No "keyPath" or "privateKey" option supplied.',NO_CERT_OPTION:'No "certPath" or "clientCert" option supplied.',NO_CA_OPTION:'No "caPath" or "caCert" option supplied.',INVALID_KEY_PATH_OPTION:'Invalid "keyPath" option supplied.',INVALID_CERT_PATH_OPTION:'Invalid "certPath" option supplied.',INVALID_CA_PATH_OPTION:'Invalid "caPath" option supplied.',INVALID_CLIENT_CERT_OPTION:'Invalid "clientCert" option supplied.',INVALID_PRIVATE_KEY_OPTION:'Invalid "privateKey" option supplied.',INVALID_CA_CERT_OPTION:'Invalid "caCert" option supplied.'}},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return t=r(n(t.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+t||"."},t.normalize=function(e){var o=t.isAbsolute(e),s="/"===i(e,-1);return(e=r(n(e.split("/"),function(e){return!!e}),!o).join("/"))||o||(e="."),e&&s&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":e.slice(0,n)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,n=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){r=t+1;break}}else-1===n&&(i=!1,n=t+1);return-1===n?"":e.slice(r,n)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,n=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===n&&(i=!1,n=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){r=s+1;break}}return-1===t||-1===n||0===o||1===o&&t===n-1&&t===r+1?"":e.slice(t,n)};var i="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(6))},function(e){e.exports=JSON.parse('{"_args":[["aws-iot-device-sdk@2.2.4","/opt/lampp/htdocs/channelize/channelize-websdk"]],"_from":"aws-iot-device-sdk@2.2.4","_id":"aws-iot-device-sdk@2.2.4","_inBundle":false,"_integrity":"sha512-DgNVTPQMVHxC1o6SENWDjio2Ku8gz70XPi5CoS31Q4ndWpx3zwq3QKBvGdRm02SF4Xb4ft5cd9tXQCeIjgkqlQ==","_location":"/aws-iot-device-sdk","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"aws-iot-device-sdk@2.2.4","name":"aws-iot-device-sdk","escapedName":"aws-iot-device-sdk","rawSpec":"2.2.4","saveSpec":null,"fetchSpec":"2.2.4"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/aws-iot-device-sdk/-/aws-iot-device-sdk-2.2.4.tgz","_spec":"2.2.4","_where":"/opt/lampp/htdocs/channelize/channelize-websdk","author":{"name":"Amazon Web Services","url":"http://aws.amazon.com"},"bugs":{"url":"http://github.com/aws/aws-iot-device-sdk-js/issues"},"dependencies":{"crypto-js":"3.1.6","minimist":"1.2.5","mqtt":"2.18.8","websocket-stream":"^5.0.1"},"description":"AWS IoT Node.js SDK for Embedded Devices","devDependencies":{"gulp":"^3.9.0","gulp-beautify":"^2.0.0","gulp-concat":"^2.6.0","gulp-coverage":"^0.3.38","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1","jshint":"^2.9.1","jshint-stylish":"^2.2.1","rewire":"^2.5.1","sinon":"^1.17.3"},"engines":{"node":">=4.0.0"},"homepage":"https://github.com/aws/aws-iot-device-sdk-js","keywords":["api","amazon","aws","iot","mqtt"],"license":"Apache-2.0","main":"index.js","name":"aws-iot-device-sdk","repository":{"type":"git","url":"git://github.com/aws/aws-iot-device-sdk-js.git"},"scripts":{"beautify":"node ./node_modules/gulp/bin/gulp.js beautify","browserize":"./scripts/browserize.sh","test":"node ./node_modules/gulp/bin/gulp.js test --verbose"},"version":"2.2.4"}')},function(e,t,r){var n=r(66);e.exports=function(e,t){var r;function i(t){e.emit("error",t),r.end()}return(r=n.connect(t)).on("secureConnect",function(){r.authorized?r.removeListener("error",i):r.emit("error",new Error("TLS not authorized"))}),r.on("error",i),r}},function(e,t,r){const n=r(63);e.exports=function(e,t){return n(t.url,["mqttv3.1"],t.websocketOptions)}},function(e,t,r){var n=r(19),i=r(33).inherits,o=r(56),s=r(44);function a(e,t,r){return s(r)?"$aws/things/"+e+"/shadow/"+t:"$aws/things/"+e+"/shadow/"+t+"/"+r}function u(e){return"$aws/things/"===e.substring(0,12)}function c(e,t){if(!(this instanceof c))return new c(e,t);var r=this,i=[{}],l=0,f=1e4,h=!0,p=o.DeviceClient(e);s(t)||s(t.operationTimeout)||(f=t.operationTimeout),this._handleSubscriptions=function(e,t,r,n){for(var o=[],u=0,c=t.length;u0)return void n("Not all subscriptions were granted",r);n()}})):s(n)||y.push(n),p[r].apply(p,y)},this._handleMessages=function(t,r,n,o){var a={};try{a=JSON.parse(o.toString())}catch(t){return void(!0===e.debug&&console.error("failed parsing JSON '"+o.toString()+"', "+t))}var u=a.clientToken,c=a.version;if(delete a.clientToken,!s(c)&&"rejected"!==n)if(s(i[t].version)||c>=i[t].version)i[t].version=c;else if("delete"!==r&&!0===i[t].discardStale)return void(!0===e.debug&&console.warn("out-of-date version '"+c+"' on '"+t+"' (local version '"+i[t].version+"')"));"delta"!==n?s(i[t].clientToken)||i[t].clientToken!==u?"accepted"===n&&"get"!==r&&this.emit("foreignStateChange",t,r,a):(clearTimeout(i[t].timeout),delete i[t].timeout,delete i[t].clientToken,i[t].pending=!1,!1===i[t].persistentSubscribe&&this._handleSubscriptions(t,[{operations:[r],statii:["accepted","rejected"]}],"unsubscribe"),this.emit("status",t,n,u,a)):this.emit("delta",t,a)},p.on("connect",function(){r.emit("connect")}),p.on("close",function(){r.emit("close")}),p.on("reconnect",function(){r.emit("reconnect")}),p.on("offline",function(){r.emit("offline")}),p.on("error",function(e){r.emit("error",e)}),p.on("packetsend",function(e){r.emit("packetsend",e)}),p.on("packetreceive",function(e){r.emit("packetreceive",e)}),p.on("message",function(e,t){if(!0===h){var n=e.split("/");!function(e,t){var r=!1;return"$aws"===e[0]&&("things"!==e[1]||"shadow"!==e[3]||"update"!==e[4]&&"get"!==e[4]&&"delete"!==e[4]||("subscribe"===t?"accepted"!==e[5]&&"rejected"!==e[5]&&"delta"!==e[5]||6!==e.length||(r=!0):5===e.length&&(r=!0))),r}(n,"subscribe")?r.emit("message",e,t):i.hasOwnProperty(n[2])&&r._handleMessages(n[2],n[4],n[5],t)}}),this._thingOperation=function(t,n,o){var u=null;if(i.hasOwnProperty(t))if(!1===i[t].pending){var c;if(i[t].pending=!0,s(o.clientToken)){var h=e.clientId.length;c=h>48?e.clientId.substr(h-48)+"-"+l++:e.clientId+"-"+l++}else c=o.clientToken;i[t].clientToken=c;var d=a(t,n);i[t].timeout=setTimeout(function(e,t){!1===i[e].persistentSubscribe&&r._handleSubscriptions(e,[{operations:[n],statii:["accepted","rejected"]}],"unsubscribe"),i[e].pending=!1,delete i[e].timeout,delete i[e].clientToken,r.emit("timeout",e,t)},f,t,c),!1===i[t].persistentSubscribe?this._handleSubscriptions(t,[{operations:[n],statii:["accepted","rejected"]}],"subscribe",function(e,r){s(e)&&s(r)?s(o)||(!s(i[t].version)&&i[t].enableVersioning&&(o.version=i[t].version),o.clientToken=c,p.publish(d,JSON.stringify(o),{qos:i[t].qos}),s(i[t])||!0!==i[t].debug||console.log("publishing '"+JSON.stringify(o)+" on '"+d+"'")):console.warn("failed subscription to accepted/rejected topics")}):(!s(i[t].version)&&i[t].enableVersioning&&(o.version=i[t].version),o.clientToken=c,p.publish(d,JSON.stringify(o),{qos:i[t].qos}),!0===i[t].debug&&console.log("publishing '"+JSON.stringify(o)+" on '"+d+"'")),u=c}else!0===e.debug&&console.error(n+" still in progress on thing: ",t);else!0===e.debug&&console.error("attempting to "+n+" unknown thing: ",t);return u},this.register=function(t,r,n){if(i.hasOwnProperty(t))!0===e.debug&&console.error("thing already registered: ",t);else{var o=!1,a=[];i[t]={persistentSubscribe:!0,debug:!1,discardStale:!0,enableVersioning:!0,qos:0,pending:!0},"function"==typeof r&&(n=r,r=null),s(r)||(s(r.ignoreDeltas)||(o=r.ignoreDeltas),s(r.persistentSubscribe)||(i[t].persistentSubscribe=r.persistentSubscribe),s(r.debug)||(i[t].debug=r.debug),s(r.discardStale)||(i[t].discardStale=r.discardStale),s(r.enableVersioning)||(i[t].enableVersioning=r.enableVersioning),s(r.qos)||(i[t].qos=r.qos)),!1===o&&a.push({operations:["update"],statii:["delta"]}),!0===i[t].persistentSubscribe&&a.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),a.length>0?this._handleSubscriptions(t,a,"subscribe",function(e,r){s(e)&&s(r)&&(i[t].pending=!1),s(n)||n(e,r)}):(i[t].pending=!1,s(n)||n())}},this.unregister=function(t){if(i.hasOwnProperty(t)){var r=[];r.push({operations:["update"],statii:["delta"]}),!0===i[t].persistentSubscribe&&r.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),this._handleSubscriptions(t,r,"unsubscribe"),s(i[t].timeout)||clearTimeout(i[t].timeout),delete i[t]}else!0===e.debug&&console.error("attempting to unregister unknown thing: ",t)},this.update=function(e,t){var n=null;return s(t.version)?n=r._thingOperation(e,"update",t):console.error("message can't contain 'version' property"),n},this.get=function(e,t){var n={};return s(t)||(n.clientToken=t),r._thingOperation(e,"get",n)},this.delete=function(e,t){var n={};return s(t)||(n.clientToken=t),r._thingOperation(e,"delete",n)},this.publish=function(e,t,r,n){if(u(e))throw"cannot publish to reserved topic '"+e+"'";p.publish(e,t,r,n)},this.subscribe=function(e,t,r){var n=[];"string"==typeof e?n.push(e):"object"==typeof e&&e.length&&(n=e);for(var i=0;i0||n?o.toString():""},e.exports=s},function(e,t,r){var n=r(250).escapeAttribute;function i(e,t){void 0===t&&(t=[]),this.name=e,this.children=t,this.attributes={}}i.prototype.addAttribute=function(e,t){return this.attributes[e]=t,this},i.prototype.addChildNode=function(e){return this.children.push(e),this},i.prototype.removeAttribute=function(e){return delete this.attributes[e],this},i.prototype.toString=function(){for(var e=Boolean(this.children.length),t="<"+this.name,r=this.attributes,i=0,o=Object.keys(r);i"+this.children.map(function(e){return e.toString()}).join("")+"":"/>")},e.exports={XmlNode:i}},function(e,t){e.exports={escapeAttribute:function(e){return e.replace(/&/g,"&").replace(/'/g,"'").replace(//g,">").replace(/"/g,""")}}},function(e,t,r){var n=r(252).escapeElement;function i(e){this.value=e}i.prototype.toString=function(){return n(""+this.value)},e.exports={XmlText:i}},function(e,t){e.exports={escapeElement:function(e){return e.replace(/&/g,"&").replace(//g,">")}}},function(e,t){function r(e,t){if(!r.services.hasOwnProperty(e))throw new Error("InvalidService: Failed to load api for "+e);return r.services[e][t]}r.services={},e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(255),i=1e3,o=function(){function e(e){void 0===e&&(e=i),this.maxSize=e,this.cache=new n.LRUCache(e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),e.prototype.put=function(t,r){var n="string"!=typeof t?e.getKeyString(t):t,i=this.populateValue(r);this.cache.put(n,i)},e.prototype.get=function(t){var r="string"!=typeof t?e.getKeyString(t):t,n=Date.now(),i=this.cache.get(r);if(i)for(var o=0;o=0;i--)if("*"!==t[i][t[i].length-1]&&(r=t[i]),t[i].substr(0,10)<=e)return r;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+e+"'")},api:{},defaultRetryCount:3,customizeRequests:function(e){if(e){if("function"!=typeof e)throw new Error("Invalid callback type '"+typeof e+"' provided in customizeRequests");this.customRequestHandler=e}else this.customRequestHandler=null},makeRequest:function(e,t,r){if("function"==typeof t&&(r=t,t=null),t=t||{},this.config.params){var i=this.api.operations[e];i&&(t=n.util.copy(t),n.util.each(this.config.params,function(e,r){i.input.members[e]&&(void 0!==t[e]&&null!==t[e]||(t[e]=r))}))}var o=new n.Request(this,e,t);return this.addAllRequestListeners(o),this.attachMonitoringEmitter(o),r&&o.send(r),o},makeUnauthenticatedRequest:function(e,t,r){"function"==typeof t&&(r=t,t={});var n=this.makeRequest(e,t).toUnauthenticated();return r?n.send(r):n},waitFor:function(e,t,r){return new n.ResourceWaiter(this,e).wait(t,r)},addAllRequestListeners:function(e){for(var t=[n.events,n.EventListeners.Core,this.serviceInterface(),n.EventListeners.CorePost],r=0;r299?(i.code&&(r.FinalAwsException=i.code),i.message&&(r.FinalAwsExceptionMessage=i.message)):((i.code||i.name)&&(r.FinalSdkException=i.code||i.name),i.message&&(r.FinalSdkExceptionMessage=i.message))}return r},apiAttemptEvent:function(e){var t=e.service.api.operations[e.operation],r={Type:"ApiCallAttempt",Api:t?t.name:e.operation,Version:1,Service:e.service.api.serviceId||e.service.api.endpointPrefix,Fqdn:e.httpRequest.endpoint.hostname,UserAgent:e.httpRequest.getUserAgent()},n=e.response;return n.httpResponse.statusCode&&(r.HttpStatusCode=n.httpResponse.statusCode),!e._unAuthenticated&&e.service.config.credentials&&e.service.config.credentials.accessKeyId&&(r.AccessKey=e.service.config.credentials.accessKeyId),n.httpResponse.headers?(e.httpRequest.headers["x-amz-security-token"]&&(r.SessionToken=e.httpRequest.headers["x-amz-security-token"]),n.httpResponse.headers["x-amzn-requestid"]&&(r.XAmznRequestId=n.httpResponse.headers["x-amzn-requestid"]),n.httpResponse.headers["x-amz-request-id"]&&(r.XAmzRequestId=n.httpResponse.headers["x-amz-request-id"]),n.httpResponse.headers["x-amz-id-2"]&&(r.XAmzId2=n.httpResponse.headers["x-amz-id-2"]),r):r},attemptFailEvent:function(e){var t=this.apiAttemptEvent(e),r=e.response,n=r.error;return r.httpResponse.statusCode>299?(n.code&&(t.AwsException=n.code),n.message&&(t.AwsExceptionMessage=n.message)):((n.code||n.name)&&(t.SdkException=n.code||n.name),n.message&&(t.SdkExceptionMessage=n.message)),t},attachMonitoringEmitter:function(e){var t,r,i,o,s,a,u=0,c=this;e.on("validate",function(){o=n.util.realClock.now(),a=Date.now()},!0),e.on("sign",function(){r=n.util.realClock.now(),t=Date.now(),s=e.httpRequest.region,u++},!0),e.on("validateResponse",function(){i=Math.round(n.util.realClock.now()-r)}),e.addNamedListener("API_CALL_ATTEMPT","success",function(){var r=c.apiAttemptEvent(e);r.Timestamp=t,r.AttemptLatency=i>=0?i:0,r.Region=s,c.emit("apiCallAttempt",[r])}),e.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",function(){var o=c.attemptFailEvent(e);o.Timestamp=t,i=i||Math.round(n.util.realClock.now()-r),o.AttemptLatency=i>=0?i:0,o.Region=s,c.emit("apiCallAttempt",[o])}),e.addNamedListener("API_CALL","complete",function(){var t=c.apiCallEvent(e);if(t.AttemptCount=u,!(t.AttemptCount<=0)){t.Timestamp=a;var r=Math.round(n.util.realClock.now()-o);t.Latency=r>=0?r:0;var i=e.response;i.error&&i.error.retryable&&"number"==typeof i.retryCount&&"number"==typeof i.maxRetries&&i.retryCount>=i.maxRetries&&(t.MaxRetriesExceeded=1),c.emit("apiCall",[t])}})},setupRequestListeners:function(e){},getSignerClass:function(e){var t,r=null,i="";e&&(i=(r=(e.service.api.operations||{})[e.operation]||null)?r.authtype:"");return t=this.config.signatureVersion?this.config.signatureVersion:"v4"===i||"v4-unsigned-body"===i?"v4":this.api.signatureVersion,n.Signers.RequestSigner.getVersion(t)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return n.EventListeners.Query;case"json":return n.EventListeners.Json;case"rest-json":return n.EventListeners.RestJson;case"rest-xml":return n.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e,t){return n.util.calculateRetryDelay(e,this.config.retryDelayOptions,t)},retryableError:function(e){return!!this.timeoutError(e)||(!!this.networkingError(e)||(!!this.expiredCredentialsError(e)||(!!this.throttledError(e)||e.statusCode>=500)))},networkingError:function(e){return"NetworkingError"===e.code},timeoutError:function(e){return"TimeoutError"===e.code},expiredCredentialsError:function(e){return"ExpiredTokenException"===e.code},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return Math.abs(this.getSkewCorrectedDate().getTime()-e)>=3e5},throttledError:function(e){if(429===e.statusCode)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":case"EC2ThrottledException":return!0;default:return!1}},endpointFromTemplate:function(e){if("string"!=typeof e)return e;var t=e;return t=(t=(t=t.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(e){this.endpoint=new n.Endpoint(e,this.config)},paginationConfig:function(e,t){var r=this.api.operations[e].paginator;if(!r){if(t){var i=new Error;throw n.util.error(i,"No pagination configuration for "+e)}return null}return r}}),n.util.update(n.Service,{defineMethods:function(e){n.util.each(e.prototype.api.operations,function(t){e.prototype[t]||("none"===e.prototype.api.operations[t].authtype?e.prototype[t]=function(e,r){return this.makeUnauthenticatedRequest(t,e,r)}:e.prototype[t]=function(e,r){return this.makeRequest(t,e,r)})})},defineService:function(e,t,r){n.Service._serviceMap[e]=!0,Array.isArray(t)||(r=t,t=[]);var i=s(n.Service,r||{});if("string"==typeof e){n.Service.addVersions(i,t);var o=i.serviceIdentifier||e;i.serviceIdentifier=o}else i.prototype.api=e,n.Service.defineMethods(i);if(n.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&n.util.clientSideMonitoring){var a=n.util.clientSideMonitoring.Publisher,u=(0,n.util.clientSideMonitoring.configProvider)();this.prototype.publisher=new a(u),u.enabled&&(n.Service._clientSideMonitoring=!0)}return n.SequentialExecutor.call(i.prototype),n.Service.addDefaultMonitoringListeners(i.prototype),i},addVersions:function(e,t){Array.isArray(t)||(t=[t]),e.services=e.services||{};for(var r=0;r=0)return e.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",t();n.util.computeSha256(o,function(r,n){r?t(r):(e.httpRequest.headers["X-Amz-Content-Sha256"]=n,t())})}else t()}}),e("SET_CONTENT_LENGTH","afterBuild",function(e){var t=function(e){if(!e.service.api.operations)return"";var t=e.service.api.operations[e.operation];return t?t.authtype:""}(e),r=n.util.getRequestPayloadShape(e);if(void 0===e.httpRequest.headers["Content-Length"])try{var i=n.util.string.byteLength(e.httpRequest.body);e.httpRequest.headers["Content-Length"]=i}catch(n){if(r&&r.isStreaming){if(r.requiresLength)throw n;if(t.indexOf("unsigned-body")>=0)return void(e.httpRequest.headers["Transfer-Encoding"]="chunked");throw n}throw n}}),e("SET_HTTP_HOST","afterBuild",function(e){e.httpRequest.headers.Host=e.httpRequest.endpoint.host}),e("RESTART","restart",function(){var e=this.response.error;e&&e.retryable&&(this.httpRequest=new n.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=600?this.emit("sign",[this],function(e){e?t(e):o()}):o()}),e("HTTP_HEADERS","httpHeaders",function(e,t,r,i){r.httpResponse.statusCode=e,r.httpResponse.statusMessage=i,r.httpResponse.headers=t,r.httpResponse.body=n.util.buffer.toBuffer(""),r.httpResponse.buffers=[],r.httpResponse.numBytes=0;var o=t.date||t.Date,s=r.request.service;if(o){var a=Date.parse(o);s.config.correctClockSkew&&s.isClockSkewed(a)&&s.applyClockOffset(a)}}),e("HTTP_DATA","httpData",function(e,t){if(e){if(n.util.isNode()){t.httpResponse.numBytes+=e.length;var r=t.httpResponse.headers["content-length"],i={loaded:t.httpResponse.numBytes,total:r};t.request.emit("httpDownloadProgress",[i,t])}t.httpResponse.buffers.push(n.util.buffer.toBuffer(e))}}),e("HTTP_DONE","httpDone",function(e){if(e.httpResponse.buffers&&e.httpResponse.buffers.length>0){var t=n.util.buffer.concat(e.httpResponse.buffers);e.httpResponse.body=t}delete e.httpResponse.numBytes,delete e.httpResponse.buffers}),e("FINALIZE_ERROR","retry",function(e){e.httpResponse.statusCode&&(e.error.statusCode=e.httpResponse.statusCode,void 0===e.error.retryable&&(e.error.retryable=this.service.retryableError(e.error,this)))}),e("INVALIDATE_CREDENTIALS","retry",function(e){if(e.error)switch(e.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":e.error.retryable=!0,e.request.service.config.credentials.expired=!0}}),e("EXPIRED_SIGNATURE","retry",function(e){var t=e.error;t&&"string"==typeof t.code&&"string"==typeof t.message&&t.code.match(/Signature/)&&t.message.match(/expired/)&&(e.error.retryable=!0)}),e("CLOCK_SKEWED","retry",function(e){e.error&&this.service.clockSkewError(e.error)&&this.service.config.correctClockSkew&&(e.error.retryable=!0)}),e("REDIRECT","retry",function(e){e.error&&e.error.statusCode>=300&&e.error.statusCode<400&&e.httpResponse.headers.location&&(this.httpRequest.endpoint=new n.Endpoint(e.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,e.error.redirect=!0,e.error.retryable=!0)}),e("RETRY_CHECK","retry",function(e){e.error&&(e.error.redirect&&e.redirectCount=0?(e.error=null,setTimeout(t,r)):t()})}),CorePost:(new i).addNamedListeners(function(e){e("EXTRACT_REQUEST_ID","extractData",n.util.extractRequestId),e("EXTRACT_REQUEST_ID","extractError",n.util.extractRequestId),e("ENOTFOUND_ERROR","httpError",function(e){if("NetworkingError"===e.code&&"ENOTFOUND"===e.errno){var t="Inaccessible host: `"+e.hostname+"'. This service may not be available in the `"+e.region+"' region.";this.response.error=n.util.error(new Error(t),{code:"UnknownEndpoint",region:e.region,hostname:e.hostname,retryable:!0,originalError:e})}})}),Logger:(new i).addNamedListeners(function(e){e("LOG_REQUEST","complete",function(e){var t=e.request,i=t.service.config.logger;if(i){var o=function(){var o=(e.request.service.getSkewCorrectedDate().getTime()-t.startTime.getTime())/1e3,s=!!i.isTTY,a=e.httpResponse.statusCode,u=t.params;t.service.api.operations&&t.service.api.operations[t.operation]&&t.service.api.operations[t.operation].input&&(u=function e(t,r){if(!r)return r;switch(t.type){case"structure":var i={};return n.util.each(r,function(r,n){Object.prototype.hasOwnProperty.call(t.members,r)?i[r]=e(t.members[r],n):i[r]=n}),i;case"list":var o=[];return n.util.arrayEach(r,function(r,n){o.push(e(t.member,r))}),o;case"map":var s={};return n.util.each(r,function(r,n){s[r]=e(t.value,n)}),s;default:return t.isSensitive?"***SensitiveInformation***":r}}(t.service.api.operations[t.operation].input,t.params));var c=r(33).inspect(u,!0,null),l="";return s&&(l+=""),l+="[AWS "+t.service.serviceIdentifier+" "+a,l+=" "+o.toString()+"s "+e.retryCount+" retries]",s&&(l+=""),l+=" "+n.util.string.lowerFirst(t.operation),l+="("+c+")",s&&(l+=""),l}();"function"==typeof i.log?i.log(o):"function"==typeof i.write&&i.write(o+"\n")}})}),Json:(new i).addNamedListeners(function(e){var t=r(68);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),Rest:(new i).addNamedListeners(function(e){var t=r(45);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),RestJson:(new i).addNamedListeners(function(e){var t=r(105);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),RestXml:(new i).addNamedListeners(function(e){var t=r(106);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),Query:(new i).addNamedListeners(function(e){var t=r(103);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})}},function(e,t,r){(function(t){var n=r(2),i=r(7),o=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function s(e){var t=e.service,r=t.api||{},n=(r.operations,{});return t.config.region&&(n.region=t.config.region),r.serviceId&&(n.serviceId=r.serviceId),t.config.credentials.accessKeyId&&(n.accessKeyId=t.config.credentials.accessKeyId),n}function a(e,t){var r={};return function e(t,r,n){n&&void 0!==r&&null!==r&&"structure"===n.type&&n.required&&n.required.length>0&&i.arrayEach(n.required,function(i){var o=n.members[i];if(!0===o.endpointDiscoveryId){var s=o.isLocationName?o.name:i;t[s]=String(r[i])}else e(t,r[i],o)})}(r,e.params,t),r}function u(e){var t=e.service,r=t.api,o=r.operations?r.operations[e.operation]:void 0,u=a(e,o?o.input:void 0),c=s(e);Object.keys(u).length>0&&(c=i.update(c,u),o&&(c.operation=o.name));var l=n.endpointCache.get(c);if(!l||1!==l.length||""!==l[0].Address)if(l&&l.length>0)e.httpRequest.updateEndpoint(l[0].Address);else{var h=t.makeRequest(r.endpointOperation,{Operation:o.name,Identifiers:u});f(h),h.removeListener("validate",n.EventListeners.Core.VALIDATE_PARAMETERS),h.removeListener("retry",n.EventListeners.Core.RETRY_CHECK),n.endpointCache.put(c,[{Address:"",CachePeriodInMinutes:1}]),h.send(function(e,t){t&&t.Endpoints?n.endpointCache.put(c,t.Endpoints):e&&n.endpointCache.put(c,[{Address:"",CachePeriodInMinutes:1}])})}}var c={};function l(e,t){var r=e.service,o=r.api,u=o.operations?o.operations[e.operation]:void 0,l=u?u.input:void 0,h=a(e,l),p=s(e);Object.keys(h).length>0&&(p=i.update(p,h),u&&(p.operation=u.name));var d=n.EndpointCache.getKeyString(p),y=n.endpointCache.get(d);if(y&&1===y.length&&""===y[0].Address)return c[d]||(c[d]=[]),void c[d].push({request:e,callback:t});if(y&&y.length>0)e.httpRequest.updateEndpoint(y[0].Address),t();else{var v=r.makeRequest(o.endpointOperation,{Operation:u.name,Identifiers:h});v.removeListener("validate",n.EventListeners.Core.VALIDATE_PARAMETERS),f(v),n.endpointCache.put(d,[{Address:"",CachePeriodInMinutes:60}]),v.send(function(r,o){if(r){var s={code:"EndpointDiscoveryException",message:"Request cannot be fulfilled without specifying an endpoint",retryable:!1};if(e.response.error=i.error(r,s),n.endpointCache.remove(p),c[d]){var a=c[d];i.arrayEach(a,function(e){e.request.response.error=i.error(r,s),e.callback()}),delete c[d]}}else if(o&&(n.endpointCache.put(d,o.Endpoints),e.httpRequest.updateEndpoint(o.Endpoints[0].Address),c[d])){a=c[d];i.arrayEach(a,function(e){e.request.httpRequest.updateEndpoint(o.Endpoints[0].Address),e.callback()}),delete c[d]}t()})}}function f(e){var t=e.service.api.apiVersion;t&&!e.httpRequest.headers["x-amz-api-version"]&&(e.httpRequest.headers["x-amz-api-version"]=t)}function h(e){var t=e.error,r=e.httpResponse;if(t&&("InvalidEndpointException"===t.code||421===r.statusCode)){var o=e.request,u=o.service.api.operations||{},c=a(o,u[o.operation]?u[o.operation].input:void 0),l=s(o);Object.keys(c).length>0&&(l=i.update(l,c),u[o.operation]&&(l.operation=u[o.operation].name)),n.endpointCache.remove(l)}}function p(e){return["false","0"].indexOf(e)>=0}e.exports={discoverEndpoint:function(e,r){var s=e.service||{};if(function(e){if(e._originalConfig&&e._originalConfig.endpoint&&!0===e._originalConfig.endpointDiscoveryEnabled)throw i.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var t=n.config[e.serviceIdentifier]||{};return Boolean(n.config.endpoint||t.endpoint||e._originalConfig&&e._originalConfig.endpoint)}(s)||e.isPresigned())return r();var a=(s.api.operations||{})[e.operation],c=a?a.endpointDiscoveryRequired:"NULL";if(!function(e){if(!0===(e.service||{}).config.endpointDiscoveryEnabled)return!0;if(i.isBrowser())return!1;for(var r=0;r=0){u=!0;var c=0}var l=function(){u&&c!==a?i.emit("error",t.util.error(new Error("Stream content length mismatch. Received "+c+" of "+a+" bytes."),{code:"StreamContentLengthMismatch"})):2===t.HttpClient.streamsApiVersion?i.end():i.emit("end")},f=s.httpResponse.createUnbufferedStream();if(2===t.HttpClient.streamsApiVersion)if(u){var h=new r.PassThrough;h._write=function(e){return e&&e.length&&(c+=e.length),r.PassThrough.prototype._write.apply(this,arguments)},h.on("end",l),i.on("error",function(e){u=!1,f.unpipe(h),h.emit("end"),h.end()}),f.pipe(h).pipe(i,{end:!1})}else f.pipe(i);else u&&f.on("data",function(e){e&&e.length&&(c+=e.length)}),f.on("data",function(e){i.emit("data",e)}),f.on("end",l);f.on("error",function(e){u=!1,i.emit("error",e)})}}),i},emitEvent:function(e,r,n){"function"==typeof r&&(n=r,r=null),n||(n=function(){}),r||(r=this.eventParameters(e,this.response)),t.SequentialExecutor.prototype.emit.call(this,e,r,function(e){e&&(this.response.error=e),n.call(this,e)})},eventParameters:function(e){switch(e){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(e,r){return r||"function"!=typeof e||(r=e,e=null),(new t.Signers.Presign).sign(this.toGet(),e,r)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",t.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",t.EventListeners.Core.SIGN),this},toGet:function(){return"query"!==this.service.api.protocol&&"ec2"!==this.service.api.protocol||(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(e){e.httpRequest.method="GET",e.httpRequest.path=e.service.endpoint.path+"?"+e.httpRequest.body,e.httpRequest.body="",delete e.httpRequest.headers["Content-Length"],delete e.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),t.Request.addPromisesToClass=function(e){this.prototype.promise=function(){var t=this;return this.httpRequest.appendToUserAgent("promise"),new e(function(e,r){t.on("complete",function(t){t.error?r(t.error):e(Object.defineProperty(t.data||{},"$response",{value:t}))}),t.runTo()})}},t.Request.deletePromisesFromClass=function(){delete this.prototype.promise},t.util.addPromises(t.Request),t.util.mixin(t.Request,t.SequentialExecutor)}).call(this,r(6))},function(e,t){function r(e,t){this.currentState=t||null,this.states=e||{}}r.prototype.runTo=function(e,t,r,n){"function"==typeof e&&(n=r,r=t,t=e,e=null);var i=this,o=i.states[i.currentState];o.fn.call(r||i,n,function(n){if(n){if(!o.fail)return t?t.call(r,n):null;i.currentState=o.fail}else{if(!o.accept)return t?t.call(r):null;i.currentState=o.accept}if(i.currentState===e)return t?t.call(r,n):null;i.runTo(e,t,r,n)})},r.prototype.addState=function(e,t,r,n){return"function"==typeof t?(n=t,t=null,r=null):"function"==typeof r&&(n=r,r=null),this.currentState||(this.currentState=e),this.states[e]={accept:t,fail:r,fn:n},this},e.exports=r},function(e,t,r){var n=r(2),i=n.util.inherit,o=r(72);n.Response=i({constructor:function(e){this.request=e,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new n.HttpResponse,e&&(this.maxRetries=e.service.numRetries(),this.maxRedirects=e.service.config.maxRedirects)},nextPage:function(e){var t,r=this.request.service,i=this.request.operation;try{t=r.paginationConfig(i,!0)}catch(e){this.error=e}if(!this.hasNextPage()){if(e)e(this.error,null);else if(this.error)throw this.error;return null}var o=n.util.copy(this.request.params);if(this.nextPageTokens){var s=t.inputToken;"string"==typeof s&&(s=[s]);for(var a=0;a=0?"&":"?";this.request.path+=o+n.util.queryParamsToString(i)},authorization:function(e,t){var r=[],n=this.credentialString(t);return r.push(this.algorithm+" Credential="+e.accessKeyId+"/"+n),r.push("SignedHeaders="+this.signedHeaders()),r.push("Signature="+this.signature(e,t)),r.join(", ")},signature:function(e,t){var r=i.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return n.util.crypto.hmac(r,this.stringToSign(t),"hex")},stringToSign:function(e){var t=[];return t.push("AWS4-HMAC-SHA256"),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")},canonicalString:function(){var e=[],t=this.request.pathname();return"s3"!==this.serviceName&&"s3v4"!==this.signatureVersion&&(t=n.util.uriEscapePath(t)),e.push(this.request.method),e.push(t),e.push(this.request.search()),e.push(this.canonicalHeaders()+"\n"),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")},canonicalHeaders:function(){var e=[];n.util.each.call(this,this.request.headers,function(t,r){e.push([t,r])}),e.sort(function(e,t){return e[0].toLowerCase()50&&delete i[o.shift()]),p},emptyCache:function(){i={},o=[]}}},function(e,t,r){var n=r(2),i=n.util.inherit;n.Signers.S3=i(n.Signers.RequestSigner,{subResources:{acl:1,accelerate:1,analytics:1,cors:1,lifecycle:1,delete:1,inventory:1,location:1,logging:1,metrics:1,notification:1,partNumber:1,policy:1,requestPayment:1,replication:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(e,t){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=n.util.date.rfc822(t)),e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken);var r=this.sign(e.secretAccessKey,this.stringToSign()),i="AWS "+e.accessKeyId+":"+r;this.request.headers.Authorization=i},stringToSign:function(){var e=this.request,t=[];t.push(e.method),t.push(e.headers["Content-MD5"]||""),t.push(e.headers["Content-Type"]||""),t.push(e.headers["presigned-expires"]||"");var r=this.canonicalizedAmzHeaders();return r&&t.push(r),t.push(this.canonicalizedResource()),t.join("\n")},canonicalizedAmzHeaders:function(){var e=[];n.util.each(this.request.headers,function(t){t.match(/^x-amz-/i)&&e.push(t)}),e.sort(function(e,t){return e.toLowerCase()604800){throw n.util.error(new Error,{code:"InvalidExpiryTime",message:"Presigning does not support expiry time greater than a week with SigV4 signing.",retryable:!1})}e.httpRequest.headers[o]=t}else{if(r!==n.Signers.S3)throw n.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});var i=e.service?e.service.getSkewCorrectedDate():n.util.date.getDate();e.httpRequest.headers[o]=parseInt(n.util.date.unixTimestamp(i)+t,10).toString()}}function a(e){var t=e.httpRequest.endpoint,r=n.util.urlParse(e.httpRequest.path),i={};r.search&&(i=n.util.queryStringParse(r.search.substr(1)));var s=e.httpRequest.headers.Authorization.split(" ");if("AWS"===s[0])s=s[1].split(":"),i.AWSAccessKeyId=s[0],i.Signature=s[1],n.util.each(e.httpRequest.headers,function(e,t){e===o&&(e="Expires"),0===e.indexOf("x-amz-meta-")&&(delete i[e],e=e.toLowerCase()),i[e]=t}),delete e.httpRequest.headers[o],delete i.Authorization,delete i.Host;else if("AWS4-HMAC-SHA256"===s[0]){s.shift();var a=s.join(" ").match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];i["X-Amz-Signature"]=a,delete i.Expires}t.pathname=r.pathname,t.search=n.util.queryParamsToString(i)}n.Signers.Presign=i({sign:function(e,t,r){if(e.httpRequest.headers[o]=t||3600,e.on("build",s),e.on("sign",a),e.removeListener("afterBuild",n.EventListeners.Core.SET_CONTENT_LENGTH),e.removeListener("afterBuild",n.EventListeners.Core.COMPUTE_SHA256),e.emit("beforePresign",[e]),!r){if(e.build(),e.response.error)throw e.response.error;return n.util.urlFormat(e.httpRequest.endpoint)}e.build(function(){this.response.error?r(this.response.error):r(null,n.util.urlFormat(e.httpRequest.endpoint))})}}),e.exports=n.Signers.Presign},function(e,t,r){var n=r(2);n.ParamValidator=n.util.inherit({constructor:function(e){!0!==e&&void 0!==e||(e={min:!0}),this.validation=e},validate:function(e,t,r){if(this.errors=[],this.validateMember(e,t||{},r||"params"),this.errors.length>1){var i=this.errors.join("\n* ");throw i="There were "+this.errors.length+" validation errors:\n* "+i,n.util.error(new Error(i),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(e,t){this.errors.push(n.util.error(new Error(t),{code:e}))},validateStructure:function(e,t,r){var n;this.validateType(t,r,["object"],"structure");for(var i=0;e.required&&i= 1, but found "'+t+'" for '+r)},validatePattern:function(e,t,r){this.validation.pattern&&void 0!==e.pattern&&(new RegExp(e.pattern).test(t)||this.fail("PatternMatchError",'Provided value "'+t+'" does not match regex pattern /'+e.pattern+"/ for "+r))},validateRange:function(e,t,r,n){this.validation.min&&void 0!==e.min&&t= "+e.min+", but found "+t+" for "+r),this.validation.max&&void 0!==e.max&&t>e.max&&this.fail("MaxRangeError","Expected "+n+" <= "+e.max+", but found "+t+" for "+r)},validateEnum:function(e,t,r){this.validation.enum&&void 0!==e.enum&&-1===e.enum.indexOf(t)&&this.fail("EnumError","Found string value of "+t+", but expected "+e.enum.join("|")+" for "+r)},validateType:function(e,t,r,i){if(null===e||void 0===e)return!1;for(var o=!1,s=0;se.BLOCK_SIZE){var i=new e;i.update(r),r=i.digest()}var o=new Uint8Array(e.BLOCK_SIZE);return o.set(r),o}(e,t),i=new Uint8Array(e.BLOCK_SIZE);i.set(r);for(var o=0;o>>32-i)+r&4294967295}function u(e,t,r,n,i,o,s){return a(t&r|~t&n,e,t,i,o,s)}function c(e,t,r,n,i,o,s){return a(t&n|r&~n,e,t,i,o,s)}function l(e,t,r,n,i,o,s){return a(t^r^n,e,t,i,o,s)}function f(e,t,r,n,i,o,s){return a(r^(t|~n),e,t,i,o,s)}e.exports=s,s.BLOCK_SIZE=o,s.prototype.update=function(e){if(n.isEmptyData(e))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=n.convertToBuffer(e),r=0,i=t.byteLength;for(this.bytesHashed+=i;i>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),i--,this.bufferLength===o&&(this.hashBuffer(),this.bufferLength=0);return this},s.prototype.digest=function(e){if(!this.finished){var t=this.buffer,r=this.bufferLength,n=8*this.bytesHashed;if(t.setUint8(this.bufferLength++,128),r%o>=o-8){for(var s=this.bufferLength;s>>0,!0),t.setUint32(o-4,Math.floor(n/4294967296),!0),this.hashBuffer(),this.finished=!0}var a=new DataView(new ArrayBuffer(16));for(s=0;s<4;s++)a.setUint32(4*s,this.state[s],!0);var u=new i(a.buffer,a.byteOffset,a.byteLength);return e?u.toString(e):u},s.prototype.hashBuffer=function(){var e=this.buffer,t=this.state,r=t[0],n=t[1],i=t[2],o=t[3];n=f(n=f(n=f(n=f(n=l(n=l(n=l(n=l(n=c(n=c(n=c(n=c(n=u(n=u(n=u(n=u(n,i=u(i,o=u(o,r=u(r,n,i,o,e.getUint32(0,!0),7,3614090360),n,i,e.getUint32(4,!0),12,3905402710),r,n,e.getUint32(8,!0),17,606105819),o,r,e.getUint32(12,!0),22,3250441966),i=u(i,o=u(o,r=u(r,n,i,o,e.getUint32(16,!0),7,4118548399),n,i,e.getUint32(20,!0),12,1200080426),r,n,e.getUint32(24,!0),17,2821735955),o,r,e.getUint32(28,!0),22,4249261313),i=u(i,o=u(o,r=u(r,n,i,o,e.getUint32(32,!0),7,1770035416),n,i,e.getUint32(36,!0),12,2336552879),r,n,e.getUint32(40,!0),17,4294925233),o,r,e.getUint32(44,!0),22,2304563134),i=u(i,o=u(o,r=u(r,n,i,o,e.getUint32(48,!0),7,1804603682),n,i,e.getUint32(52,!0),12,4254626195),r,n,e.getUint32(56,!0),17,2792965006),o,r,e.getUint32(60,!0),22,1236535329),i=c(i,o=c(o,r=c(r,n,i,o,e.getUint32(4,!0),5,4129170786),n,i,e.getUint32(24,!0),9,3225465664),r,n,e.getUint32(44,!0),14,643717713),o,r,e.getUint32(0,!0),20,3921069994),i=c(i,o=c(o,r=c(r,n,i,o,e.getUint32(20,!0),5,3593408605),n,i,e.getUint32(40,!0),9,38016083),r,n,e.getUint32(60,!0),14,3634488961),o,r,e.getUint32(16,!0),20,3889429448),i=c(i,o=c(o,r=c(r,n,i,o,e.getUint32(36,!0),5,568446438),n,i,e.getUint32(56,!0),9,3275163606),r,n,e.getUint32(12,!0),14,4107603335),o,r,e.getUint32(32,!0),20,1163531501),i=c(i,o=c(o,r=c(r,n,i,o,e.getUint32(52,!0),5,2850285829),n,i,e.getUint32(8,!0),9,4243563512),r,n,e.getUint32(28,!0),14,1735328473),o,r,e.getUint32(48,!0),20,2368359562),i=l(i,o=l(o,r=l(r,n,i,o,e.getUint32(20,!0),4,4294588738),n,i,e.getUint32(32,!0),11,2272392833),r,n,e.getUint32(44,!0),16,1839030562),o,r,e.getUint32(56,!0),23,4259657740),i=l(i,o=l(o,r=l(r,n,i,o,e.getUint32(4,!0),4,2763975236),n,i,e.getUint32(16,!0),11,1272893353),r,n,e.getUint32(28,!0),16,4139469664),o,r,e.getUint32(40,!0),23,3200236656),i=l(i,o=l(o,r=l(r,n,i,o,e.getUint32(52,!0),4,681279174),n,i,e.getUint32(0,!0),11,3936430074),r,n,e.getUint32(12,!0),16,3572445317),o,r,e.getUint32(24,!0),23,76029189),i=l(i,o=l(o,r=l(r,n,i,o,e.getUint32(36,!0),4,3654602809),n,i,e.getUint32(48,!0),11,3873151461),r,n,e.getUint32(60,!0),16,530742520),o,r,e.getUint32(8,!0),23,3299628645),i=f(i,o=f(o,r=f(r,n,i,o,e.getUint32(0,!0),6,4096336452),n,i,e.getUint32(28,!0),10,1126891415),r,n,e.getUint32(56,!0),15,2878612391),o,r,e.getUint32(20,!0),21,4237533241),i=f(i,o=f(o,r=f(r,n,i,o,e.getUint32(48,!0),6,1700485571),n,i,e.getUint32(12,!0),10,2399980690),r,n,e.getUint32(40,!0),15,4293915773),o,r,e.getUint32(4,!0),21,2240044497),i=f(i,o=f(o,r=f(r,n,i,o,e.getUint32(32,!0),6,1873313359),n,i,e.getUint32(60,!0),10,4264355552),r,n,e.getUint32(24,!0),15,2734768916),o,r,e.getUint32(52,!0),21,1309151649),i=f(i,o=f(o,r=f(r,n,i,o,e.getUint32(16,!0),6,4149444226),n,i,e.getUint32(44,!0),10,3174756917),r,n,e.getUint32(8,!0),15,718787259),o,r,e.getUint32(36,!0),21,3951481745),t[0]=r+t[0]&4294967295,t[1]=n+t[1]&4294967295,t[2]=i+t[2]&4294967295,t[3]=o+t[3]&4294967295}},function(e,t,r){var n=r(16).Buffer,i=r(46);new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function o(){this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=new Uint32Array(80),this.offset=0,this.shift=24,this.totalLength=0}e.exports=o,o.BLOCK_SIZE=64,o.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(i.isEmptyData(e))return this;var t=(e=i.convertToBuffer(e)).length;this.totalLength+=8*t;for(var r=0;r14||14===this.offset&&this.shift<24)&&this.processBlock(),this.offset=14,this.shift=24,this.write(0),this.write(0),this.write(this.totalLength>0xffffffffff?this.totalLength/1099511627776:0),this.write(this.totalLength>4294967295?this.totalLength/4294967296:0);for(var t=24;t>=0;t-=8)this.write(this.totalLength>>t);var r=new n(20),i=new DataView(r.buffer);return i.setUint32(0,this.h0,!1),i.setUint32(4,this.h1,!1),i.setUint32(8,this.h2,!1),i.setUint32(12,this.h3,!1),i.setUint32(16,this.h4,!1),e?r.toString(e):r},o.prototype.processBlock=function(){for(var e=16;e<80;e++){var t=this.block[e-3]^this.block[e-8]^this.block[e-14]^this.block[e-16];this.block[e]=t<<1|t>>>31}var r,n,i=this.h0,o=this.h1,s=this.h2,a=this.h3,u=this.h4;for(e=0;e<80;e++){e<20?(r=a^o&(s^a),n=1518500249):e<40?(r=o^s^a,n=1859775393):e<60?(r=o&s|a&(o|s),n=2400959708):(r=o^s^a,n=3395469782);var c=(i<<5|i>>>27)+r+u+n+(0|this.block[e]);u=a,a=s,s=o<<30|o>>>2,o=i,i=c}for(this.h0=this.h0+i|0,this.h1=this.h1+o|0,this.h2=this.h2+s|0,this.h3=this.h3+a|0,this.h4=this.h4+u|0,this.offset=0,e=0;e<16;e++)this.block[e]=0}},function(e,t,r){var n=r(16).Buffer,i=r(46),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=Math.pow(2,53)-1;function a(){this.state=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}e.exports=a,a.BLOCK_SIZE=64,a.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(i.isEmptyData(e))return this;var t=0,r=(e=i.convertToBuffer(e)).byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>s)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},a.prototype.digest=function(e){if(!this.finished){var t=8*this.bytesHashed,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),i=this.bufferLength;if(r.setUint8(this.bufferLength++,128),i%64>=56){for(var o=this.bufferLength;o<64;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(o=this.bufferLength;o<56;o++)r.setUint8(o,0);r.setUint32(56,Math.floor(t/4294967296),!0),r.setUint32(60,t),this.hashBuffer(),this.finished=!0}var s=new n(32);for(o=0;o<8;o++)s[4*o]=this.state[o]>>>24&255,s[4*o+1]=this.state[o]>>>16&255,s[4*o+2]=this.state[o]>>>8&255,s[4*o+3]=this.state[o]>>>0&255;return e?s.toString(e):s},a.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],n=t[1],i=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<64;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var h=this.temp[f-2],p=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,d=((h=this.temp[f-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[f]=(p+this.temp[f-7]|0)+(d+this.temp[f-16]|0)}var y=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(o[f]+this.temp[f]|0)|0)|0,v=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&n^r&i^n&i)|0;l=c,c=u,u=a,a=s+y|0,s=i,i=n,n=r,r=y+v|0}t[0]+=r,t[1]+=n,t[2]+=i,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l}},function(e,t){e.exports={now:function(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}}},function(e,t,r){var n=r(281).eventMessageChunker,i=r(282).parseEvent;e.exports={createEventStream:function(e,t,r){for(var o=n(e),s=[],a=0;a-1&&(e[t]++,0===e[t]);t--);}o.fromNumber=function(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(e+" is too large (or, if negative, too small) to represent as an Int64");for(var t=new Uint8Array(8),r=7,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;return e<0&&s(t),new o(t)},o.prototype.valueOf=function(){var e=this.bytes.slice(0),t=128&e[0];return t&&s(e),parseInt(e.toString("hex"),16)*(t?-1:1)},o.prototype.toString=function(){return String(this.valueOf())},e.exports={Int64:o}},function(e,t,r){var n=r(2).util,i=n.buffer.toBuffer,o=4,s=2*o,a=4,u=s+2*a;e.exports={splitMessage:function(e){if(n.Buffer.isBuffer(e)||(e=i(e)),e.length=0)return e.toLowerCase();throw n.util.error(new Error,t)}}e.exports=function(e,r){var o;if((e=e||{})[r.clientConfig]&&(o=i(e[r.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+r.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+e[r.clientConfig]+'".'})))return o;if(!n.util.isNode())return o;if(Object.prototype.hasOwnProperty.call(t.env,r.env)&&(o=i(t.env[r.env],{code:"InvalidEnvironmentalVariable",message:"invalid "+r.env+' environmental variable. Expect "legacy" or "regional". Got "'+t.env[r.env]+'".'})))return o;var s={};try{s=n.util.getProfilesFromSharedConfig(n.util.iniLoader)[t.env.AWS_PROFILE||n.util.defaultProfile]}catch(e){}return s&&Object.prototype.hasOwnProperty.call(s,r.sharedConfig)&&(o=i(s[r.sharedConfig],{code:"InvalidConfiguration",message:"invalid "+r.sharedConfig+' profile config. Expect "legacy" or "regional". Got "'+s[r.sharedConfig]+'".'})),o}}).call(this,r(6))},function(e){e.exports=JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2011-06-15","endpointPrefix":"sts","globalEndpoint":"sts.amazonaws.com","protocol":"query","serviceAbbreviation":"AWS STS","serviceFullName":"AWS Security Token Service","serviceId":"STS","signatureVersion":"v4","uid":"sts-2011-06-15","xmlNamespace":"https://sts.amazonaws.com/doc/2011-06-15/"},"operations":{"AssumeRole":{"input":{"type":"structure","required":["RoleArn","RoleSessionName"],"members":{"RoleArn":{},"RoleSessionName":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"},"Tags":{"shape":"S8"},"TransitiveTagKeys":{"type":"list","member":{}},"ExternalId":{},"SerialNumber":{},"TokenCode":{}}},"output":{"resultWrapper":"AssumeRoleResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"}}}},"AssumeRoleWithSAML":{"input":{"type":"structure","required":["RoleArn","PrincipalArn","SAMLAssertion"],"members":{"RoleArn":{},"PrincipalArn":{},"SAMLAssertion":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"}}},"output":{"resultWrapper":"AssumeRoleWithSAMLResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"},"Subject":{},"SubjectType":{},"Issuer":{},"Audience":{},"NameQualifier":{}}}},"AssumeRoleWithWebIdentity":{"input":{"type":"structure","required":["RoleArn","RoleSessionName","WebIdentityToken"],"members":{"RoleArn":{},"RoleSessionName":{},"WebIdentityToken":{},"ProviderId":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"}}},"output":{"resultWrapper":"AssumeRoleWithWebIdentityResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"SubjectFromWebIdentityToken":{},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"},"Provider":{},"Audience":{}}}},"DecodeAuthorizationMessage":{"input":{"type":"structure","required":["EncodedMessage"],"members":{"EncodedMessage":{}}},"output":{"resultWrapper":"DecodeAuthorizationMessageResult","type":"structure","members":{"DecodedMessage":{}}}},"GetAccessKeyInfo":{"input":{"type":"structure","required":["AccessKeyId"],"members":{"AccessKeyId":{}}},"output":{"resultWrapper":"GetAccessKeyInfoResult","type":"structure","members":{"Account":{}}}},"GetCallerIdentity":{"input":{"type":"structure","members":{}},"output":{"resultWrapper":"GetCallerIdentityResult","type":"structure","members":{"UserId":{},"Account":{},"Arn":{}}}},"GetFederationToken":{"input":{"type":"structure","required":["Name"],"members":{"Name":{},"Policy":{},"PolicyArns":{"shape":"S4"},"DurationSeconds":{"type":"integer"},"Tags":{"shape":"S8"}}},"output":{"resultWrapper":"GetFederationTokenResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"FederatedUser":{"type":"structure","required":["FederatedUserId","Arn"],"members":{"FederatedUserId":{},"Arn":{}}},"PackedPolicySize":{"type":"integer"}}}},"GetSessionToken":{"input":{"type":"structure","members":{"DurationSeconds":{"type":"integer"},"SerialNumber":{},"TokenCode":{}}},"output":{"resultWrapper":"GetSessionTokenResult","type":"structure","members":{"Credentials":{"shape":"Sh"}}}}},"shapes":{"S4":{"type":"list","member":{"type":"structure","members":{"arn":{}}}},"S8":{"type":"list","member":{"type":"structure","required":["Key","Value"],"members":{"Key":{},"Value":{}}}},"Sh":{"type":"structure","required":["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],"members":{"AccessKeyId":{},"SecretAccessKey":{},"SessionToken":{},"Expiration":{"type":"timestamp"}}},"Sm":{"type":"structure","required":["AssumedRoleId","Arn"],"members":{"AssumedRoleId":{},"Arn":{}}}}}')},function(e){e.exports=JSON.parse('{"pagination":{}}')},function(e,t,r){var n=r(2),i=r(37);n.ChainableTemporaryCredentials=n.util.inherit(n.Credentials,{constructor:function(e){n.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var t=n.util.copy(e.params)||{};if(t.RoleArn&&(t.RoleSessionName=t.RoleSessionName||"temporary-credentials"),t.SerialNumber){if(!e.tokenCodeFn||"function"!=typeof e.tokenCodeFn)throw new n.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}var r=n.util.merge({params:t,credentials:e.masterCredentials||n.config.credentials},e.stsConfig||{});this.service=new i(r)},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this,r=t.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(n,i){var o={};n?e(n):(i&&(o.TokenCode=i),t.service[r](o,function(r,n){r||t.service.credentialsFrom(n,t),e(r)}))})},getTokenCode:function(e){var t=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(r,i){if(r){var o=r;return r instanceof Error&&(o=r.message),void e(n.util.error(new Error("Error fetching MFA token: "+o),{code:t.errorCode}))}e(null,i)}):e(null)}})},function(e,t,r){var n=r(2),i=r(37);n.WebIdentityCredentials=n.util.inherit(n.Credentials,{constructor:function(e,t){n.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=n.util.copy(t||{})},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.service.assumeRoleWithWebIdentity(function(r,n){t.data=null,r||(t.data=n,t.service.credentialsFrom(n,t)),e(r)})},createClients:function(){if(!this.service){var e=n.util.merge({},this._clientConfig);e.params=this.params,this.service=new i(e)}}})},function(e,t,r){var n=r(2),i=r(294),o=r(37);n.CognitoIdentityCredentials=n.util.inherit(n.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,t){n.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=n.util.copy(t||{}),this.loadCachedId();var r=this;Object.defineProperty(this,"identityId",{get:function(){return r.loadCachedId(),r._identityId||r.params.IdentityId},set:function(e){r._identityId=e}})},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.data=null,t._identityId=null,t.getId(function(r){r?(t.clearIdOnNotAuthorized(r),e(r)):t.params.RoleArn?t.getCredentialsFromSTS(e):t.getCredentialsForIdentity(e)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,t=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+t],delete this.storage[this.localStorageKey.providers+e+t]},clearIdOnNotAuthorized:function(e){"NotAuthorizedException"==e.code&&this.clearCachedId()},getId:function(e){var t=this;if("string"==typeof t.params.IdentityId)return e(null,t.params.IdentityId);t.cognito.getId(function(r,n){!r&&n.IdentityId?(t.params.IdentityId=n.IdentityId,e(null,n.IdentityId)):e(r)})},loadCredentials:function(e,t){e&&t&&(t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(e){var t=this;t.cognito.getCredentialsForIdentity(function(r,n){r?t.clearIdOnNotAuthorized(r):(t.cacheId(n),t.data=n,t.loadCredentials(t.data,t)),e(r)})},getCredentialsFromSTS:function(e){var t=this;t.cognito.getOpenIdToken(function(r,n){r?(t.clearIdOnNotAuthorized(r),e(r)):(t.cacheId(n),t.params.WebIdentityToken=n.Token,t.webIdentityCredentials.refresh(function(r){r||(t.data=t.webIdentityCredentials.data,t.sts.credentialsFrom(t.data,t)),e(r)}))})},loadCachedId:function(){if(n.util.isBrowser()&&!this.params.IdentityId){var e=this.getStorage("id");if(e&&this.params.Logins){var t=Object.keys(this.params.Logins);0!==(this.getStorage("providers")||"").split(",").filter(function(e){return-1!==t.indexOf(e)}).length&&(this.params.IdentityId=e)}else e&&(this.params.IdentityId=e)}},createClients:function(){var e=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new n.WebIdentityCredentials(this.params,e),!this.cognito){var t=n.util.merge({},e);t.params=this.params,this.cognito=new i(t)}this.sts=this.sts||new o(e)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,n.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,t){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=t}catch(e){}},storage:function(){try{var e=n.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return e["aws.test-storage"]="foobar",delete e["aws.test-storage"],e}catch(e){return{}}}()})},function(e,t,r){r(67);var n=r(2),i=n.Service,o=n.apiLoader;o.services.cognitoidentity={},n.CognitoIdentity=i.defineService("cognitoidentity",["2014-06-30"]),r(295),Object.defineProperty(o.services.cognitoidentity,"2014-06-30",{get:function(){var e=r(296);return e.paginators=r(297).pagination,e},enumerable:!0,configurable:!0}),e.exports=n.CognitoIdentity},function(e,t,r){var n=r(2);n.util.update(n.CognitoIdentity.prototype,{getOpenIdToken:function(e,t){return this.makeUnauthenticatedRequest("getOpenIdToken",e,t)},getId:function(e,t){return this.makeUnauthenticatedRequest("getId",e,t)},getCredentialsForIdentity:function(e,t){return this.makeUnauthenticatedRequest("getCredentialsForIdentity",e,t)}})},function(e){e.exports=JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2014-06-30","endpointPrefix":"cognito-identity","jsonVersion":"1.1","protocol":"json","serviceFullName":"Amazon Cognito Identity","serviceId":"Cognito Identity","signatureVersion":"v4","targetPrefix":"AWSCognitoIdentityService","uid":"cognito-identity-2014-06-30"},"operations":{"CreateIdentityPool":{"input":{"type":"structure","required":["IdentityPoolName","AllowUnauthenticatedIdentities"],"members":{"IdentityPoolName":{},"AllowUnauthenticatedIdentities":{"type":"boolean"},"AllowClassicFlow":{"type":"boolean"},"SupportedLoginProviders":{"shape":"S5"},"DeveloperProviderName":{},"OpenIdConnectProviderARNs":{"shape":"S9"},"CognitoIdentityProviders":{"shape":"Sb"},"SamlProviderARNs":{"shape":"Sg"},"IdentityPoolTags":{"shape":"Sh"}}},"output":{"shape":"Sk"}},"DeleteIdentities":{"input":{"type":"structure","required":["IdentityIdsToDelete"],"members":{"IdentityIdsToDelete":{"type":"list","member":{}}}},"output":{"type":"structure","members":{"UnprocessedIdentityIds":{"type":"list","member":{"type":"structure","members":{"IdentityId":{},"ErrorCode":{}}}}}}},"DeleteIdentityPool":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}}},"DescribeIdentity":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{}}},"output":{"shape":"Sv"}},"DescribeIdentityPool":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}},"output":{"shape":"Sk"}},"GetCredentialsForIdentity":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{},"Logins":{"shape":"S10"},"CustomRoleArn":{}}},"output":{"type":"structure","members":{"IdentityId":{},"Credentials":{"type":"structure","members":{"AccessKeyId":{},"SecretKey":{},"SessionToken":{},"Expiration":{"type":"timestamp"}}}}}},"GetId":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"AccountId":{},"IdentityPoolId":{},"Logins":{"shape":"S10"}}},"output":{"type":"structure","members":{"IdentityId":{}}}},"GetIdentityPoolRoles":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}},"output":{"type":"structure","members":{"IdentityPoolId":{},"Roles":{"shape":"S1c"},"RoleMappings":{"shape":"S1e"}}}},"GetOpenIdToken":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{},"Logins":{"shape":"S10"}}},"output":{"type":"structure","members":{"IdentityId":{},"Token":{}}}},"GetOpenIdTokenForDeveloperIdentity":{"input":{"type":"structure","required":["IdentityPoolId","Logins"],"members":{"IdentityPoolId":{},"IdentityId":{},"Logins":{"shape":"S10"},"TokenDuration":{"type":"long"}}},"output":{"type":"structure","members":{"IdentityId":{},"Token":{}}}},"ListIdentities":{"input":{"type":"structure","required":["IdentityPoolId","MaxResults"],"members":{"IdentityPoolId":{},"MaxResults":{"type":"integer"},"NextToken":{},"HideDisabled":{"type":"boolean"}}},"output":{"type":"structure","members":{"IdentityPoolId":{},"Identities":{"type":"list","member":{"shape":"Sv"}},"NextToken":{}}}},"ListIdentityPools":{"input":{"type":"structure","required":["MaxResults"],"members":{"MaxResults":{"type":"integer"},"NextToken":{}}},"output":{"type":"structure","members":{"IdentityPools":{"type":"list","member":{"type":"structure","members":{"IdentityPoolId":{},"IdentityPoolName":{}}}},"NextToken":{}}}},"ListTagsForResource":{"input":{"type":"structure","required":["ResourceArn"],"members":{"ResourceArn":{}}},"output":{"type":"structure","members":{"Tags":{"shape":"Sh"}}}},"LookupDeveloperIdentity":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{},"IdentityId":{},"DeveloperUserIdentifier":{},"MaxResults":{"type":"integer"},"NextToken":{}}},"output":{"type":"structure","members":{"IdentityId":{},"DeveloperUserIdentifierList":{"type":"list","member":{}},"NextToken":{}}}},"MergeDeveloperIdentities":{"input":{"type":"structure","required":["SourceUserIdentifier","DestinationUserIdentifier","DeveloperProviderName","IdentityPoolId"],"members":{"SourceUserIdentifier":{},"DestinationUserIdentifier":{},"DeveloperProviderName":{},"IdentityPoolId":{}}},"output":{"type":"structure","members":{"IdentityId":{}}}},"SetIdentityPoolRoles":{"input":{"type":"structure","required":["IdentityPoolId","Roles"],"members":{"IdentityPoolId":{},"Roles":{"shape":"S1c"},"RoleMappings":{"shape":"S1e"}}}},"TagResource":{"input":{"type":"structure","required":["ResourceArn","Tags"],"members":{"ResourceArn":{},"Tags":{"shape":"Sh"}}},"output":{"type":"structure","members":{}}},"UnlinkDeveloperIdentity":{"input":{"type":"structure","required":["IdentityId","IdentityPoolId","DeveloperProviderName","DeveloperUserIdentifier"],"members":{"IdentityId":{},"IdentityPoolId":{},"DeveloperProviderName":{},"DeveloperUserIdentifier":{}}}},"UnlinkIdentity":{"input":{"type":"structure","required":["IdentityId","Logins","LoginsToRemove"],"members":{"IdentityId":{},"Logins":{"shape":"S10"},"LoginsToRemove":{"shape":"Sw"}}}},"UntagResource":{"input":{"type":"structure","required":["ResourceArn","TagKeys"],"members":{"ResourceArn":{},"TagKeys":{"type":"list","member":{}}}},"output":{"type":"structure","members":{}}},"UpdateIdentityPool":{"input":{"shape":"Sk"},"output":{"shape":"Sk"}}},"shapes":{"S5":{"type":"map","key":{},"value":{}},"S9":{"type":"list","member":{}},"Sb":{"type":"list","member":{"type":"structure","members":{"ProviderName":{},"ClientId":{},"ServerSideTokenCheck":{"type":"boolean"}}}},"Sg":{"type":"list","member":{}},"Sh":{"type":"map","key":{},"value":{}},"Sk":{"type":"structure","required":["IdentityPoolId","IdentityPoolName","AllowUnauthenticatedIdentities"],"members":{"IdentityPoolId":{},"IdentityPoolName":{},"AllowUnauthenticatedIdentities":{"type":"boolean"},"AllowClassicFlow":{"type":"boolean"},"SupportedLoginProviders":{"shape":"S5"},"DeveloperProviderName":{},"OpenIdConnectProviderARNs":{"shape":"S9"},"CognitoIdentityProviders":{"shape":"Sb"},"SamlProviderARNs":{"shape":"Sg"},"IdentityPoolTags":{"shape":"Sh"}}},"Sv":{"type":"structure","members":{"IdentityId":{},"Logins":{"shape":"Sw"},"CreationDate":{"type":"timestamp"},"LastModifiedDate":{"type":"timestamp"}}},"Sw":{"type":"list","member":{}},"S10":{"type":"map","key":{},"value":{}},"S1c":{"type":"map","key":{},"value":{}},"S1e":{"type":"map","key":{},"value":{"type":"structure","required":["Type"],"members":{"Type":{},"AmbiguousRoleResolution":{},"RulesConfiguration":{"type":"structure","required":["Rules"],"members":{"Rules":{"type":"list","member":{"type":"structure","required":["Claim","MatchType","Value","RoleARN"],"members":{"Claim":{},"MatchType":{},"Value":{},"RoleARN":{}}}}}}}}}}}')},function(e){e.exports=JSON.parse('{"pagination":{}}')},function(e,t,r){var n=r(2),i=r(37);n.SAMLCredentials=n.util.inherit(n.Credentials,{constructor:function(e){n.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.service.assumeRoleWithSAML(function(r,n){r||t.service.credentialsFrom(n,t),e(r)})},createClients:function(){this.service=this.service||new i({params:this.params})}})},function(e,t,r){var n=r(7),i=r(36);function o(){}function s(e,t){for(var r=e.getElementsByTagName(t),n=0,i=r.length;n=this.HEADERS_RECEIVED&&!f&&(u.statusCode=l.status,u.headers=s.parseHeaders(l.getAllResponseHeaders()),u.emit("headers",u.statusCode,u.headers,l.statusText),f=!0),this.readyState===this.DONE&&s.finishRequest(l,u)},!1),l.upload.addEventListener("progress",function(e){u.emit("sendProgress",e)}),l.addEventListener("progress",function(e){u.emit("receiveProgress",e)},!1),l.addEventListener("timeout",function(){o(n.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),l.addEventListener("error",function(){o(n.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),l.addEventListener("abort",function(){o(n.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))},!1),r(u),l.open(e.method,c,!1!==t.xhrAsync),n.util.each(e.headers,function(e,t){"Content-Length"!==e&&"User-Agent"!==e&&"Host"!==e&&l.setRequestHeader(e,t)}),t.timeout&&!1!==t.xhrAsync&&(l.timeout=t.timeout),t.xhrWithCredentials&&(l.withCredentials=!0);try{l.responseType="arraybuffer"}catch(e){}try{e.body?l.send(e.body):l.send()}catch(t){if(!e.body||"object"!=typeof e.body.buffer)throw t;l.send(e.body.buffer)}return u},parseHeaders:function(e){var t={};return n.util.arrayEach(e.split(/\r?\n/),function(e){var r=e.split(":",1)[0],n=e.substring(r.length+2);r.length>0&&(t[r.toLowerCase()]=n)}),t},finishRequest:function(e,t){var r;if("arraybuffer"===e.responseType&&e.response){var i=e.response;r=new n.util.Buffer(i.byteLength);for(var o=new Uint8Array(i),s=0;s * @license MIT */ -e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(74),i=r(12),o=r(311),s=r(312);function a(e){this.defaults=e,this.interceptors={request:new o,response:new o}}a.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),(e=i.merge(n,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[s,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r},i.forEach(["delete","get","head","options"],function(e){a.prototype[e]=function(t,r){return this.request(i.merge(r||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){a.prototype[e]=function(t,r,n){return this.request(i.merge(n||{},{method:e,url:t,data:r}))}}),e.exports=a},function(e,t,r){"use strict";var n=r(12);e.exports=function(e,t){n.forEach(e,function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])})}},function(e,t,r){"use strict";var n=r(118);e.exports=function(e,t,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e}},function(e,t,r){"use strict";var n=r(12);function i(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var s=[];n.forEach(t,function(e,t){null!==e&&void 0!==e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))}))}),o=s.join("&")}return o&&(e+=(-1===e.indexOf("?")?"?":"&")+o),e}},function(e,t,r){"use strict";var n=r(12),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,s={};return e?(n.forEach(e.split("\n"),function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}}),s):s}},function(e,t,r){"use strict";var n=r(12);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(12);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";var n=r(12);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=i},function(e,t,r){"use strict";var n=r(12),i=r(313),o=r(119),s=r(74),a=r(314),u=r(315);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!a(e.url)&&(e.url=u(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||s.adapter)(e).then(function(t){return c(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,r){"use strict";var n=r(12);e.exports=function(e,t,r){return n.forEach(r,function(r){e=r(e,t)}),e}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(120);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var r=this;e(function(e){r.reason||(r.reason=new n(e),t(r.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i(function(t){e=t}),cancel:e}},e.exports=i},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}]); \ No newline at end of file +e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(74),i=r(12),o=r(311),s=r(312);function a(e){this.defaults=e,this.interceptors={request:new o,response:new o}}a.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),(e=i.merge(n,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[s,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r},i.forEach(["delete","get","head","options"],function(e){a.prototype[e]=function(t,r){return this.request(i.merge(r||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){a.prototype[e]=function(t,r,n){return this.request(i.merge(n||{},{method:e,url:t,data:r}))}}),e.exports=a},function(e,t,r){"use strict";var n=r(12);e.exports=function(e,t){n.forEach(e,function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])})}},function(e,t,r){"use strict";var n=r(119);e.exports=function(e,t,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e}},function(e,t,r){"use strict";var n=r(12);function i(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var s=[];n.forEach(t,function(e,t){null!==e&&void 0!==e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))}))}),o=s.join("&")}return o&&(e+=(-1===e.indexOf("?")?"?":"&")+o),e}},function(e,t,r){"use strict";var n=r(12),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,s={};return e?(n.forEach(e.split("\n"),function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}}),s):s}},function(e,t,r){"use strict";var n=r(12);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(12);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";var n=r(12);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=i},function(e,t,r){"use strict";var n=r(12),i=r(313),o=r(120),s=r(74),a=r(314),u=r(315);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!a(e.url)&&(e.url=u(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||s.adapter)(e).then(function(t){return c(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,r){"use strict";var n=r(12);e.exports=function(e,t,r){return n.forEach(r,function(r){e=r(e,t)}),e}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(121);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var r=this;e(function(e){r.reason||(r.reason=new n(e),t(r.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i(function(t){e=t}),cancel:e}},e.exports=i},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}]); \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index ebe3756..7f71dbe 100755 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=23)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r={ALREADY_CONNECTED:"Channelize server is already connected.",ALREADY_DISCONNECTED:"Channelize server is already disconnected.",REQUIRED_PUBLIC_KEY:"Public key is required.",INVALID_TYPE_OBJECT:"%s should be a object.",INVALID_CALLBACK:"Callback should be a function.",INVALID_FILE_OBJECT:"File should be a file object.",INVALID_USER_ID:"User Id should be a string.",INVALID_USER_IDS:"User Ids should be an array.",INVALID_CONVERSATION_TYPE:"Conversation type can be 'private' or 'public'.",INVALID_CONVERSATION_CONFIG:"Conversation config should be an object.",INVALID_CONVERSATION_IDS:"Conversation Ids should be an array.",REQUIRED_USER_OR_CONVERSATION:"One of Conversation Ids and user Ids is required.",INVALID_ID:"Id should be a string.",INVALID_USER_NAME:"Display Name should be a string.",INVALID_DATA:"Data should be an object.",INVALID_MULTIPLE_MESSAGE_OBJECT:"Message data should be an object.",INVALID_PROFILE_IMG:"Img should be a file object.",INVALID_MEMBER_IDS:"Member Ids should be an array.",INVALID_MESSAGE_MENTIONED_USERS:"Mentioned users should be an array of objects having userId, order and wordCount.",INVALID_MESSAGE_ID:"Message Id should be string.",INVALID_MESSAGE_IDS:"Message Ids should be an array.",INVALID_CONVERSATION_INCLUDE:"Include should be string and can have 'members' values only.",INVALID_EVENT:"%s event is not supported.",INVALID_DEVICE_ID:"Device Id should be a string.",INVALID_EMAIL:"Email Id is not valid.",INVALID_PASSWORD:"Password should be a string.",INVALID_ACCESS_TOKEN:"Access Token is required and should be a string.",INVALID_CLIENT_SERVER_TOKEN:"Channelize Client Server Token is required and should be a string.",INVALID_MESSAGE_BODY:"Message body should be a string.",REQUIRED_BODY_OR_ATTACHMENT:"One of Body or Attachments is required.",INVALID_TITLE:"Title should be a string.",INVALID_DATA_PARAM:"%s parameter is not allowed.",INVALID_MESSAGE_FILE_PARAMS:"File should be a FileObject or should contain %s.",REQUIRED_SOCKET_EVENT_PARAM:"%s parameter is required in event %s.",REQUIRED_LATITUDE_LONGITUDE:"Latitude and Longitude are required in location and should be numbers.",INVALID_CONVERSATION_TITLE:"Title is required in group conversations and should be string.",INVALID_CONVERSATION_MEMBERS:"Members is required and should be array.",GROUP_CONVERSATION_REQUIRED:"Conversation should be a group conversation to perform this action.",INVALID_FRIENDSHIP_TYPE:"Type should be a number and should contain 1 or 2.",REQUIRED_ATTACHMENT_TYPE:"Type is required in all attachments.",INVALID_ATTACHMENT_TYPE:"Attachments type should be an array.",INVALID_MESSAGE_TYPE:"Invalid message type.",INVALID_MESSAGE_OBJECT:"Message Type should be an object.",INVALID_MESSAGE_PARENTID:"Message Parent id should be a string.",INVALID_MESSAGE_CUSTOMTYPE:"Message Custom type should be a string.",INVALID_MESSAGE_RECIPIENTS:"Message Recipients should be an array.",INVALID_MESSAGE_EVENTS:"Message Events should be an object.",CONVERSATION_NOT_CONFIGURED_READ_EVENTS:"Conversation not configured for read events.",CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS:"Conversation not configured for typing events.",PUBLIC_CONVERSATION_REQUIRED:"Public Conversation is required for this function.",CAN_NOT_CLEAR_CONVERSATION:"Clear Conversation is only allowed for private conversations.",INVALID_REACTION_TYPE:"Reaction type should be an string.",INVALID_MESSAGE_SHOWINCONVERSATION:"Message showInConversation should be a boolean.",REQUIRED_WATCHING_CONVERSATION:"You have to watch this conversation before register watching event.",EMPTY_URL:"The Url should not be empty."}},function(e,t,n){"use strict";(function(e){function r(t,n){if("function"==typeof t)try{return n(t)}catch(t){return e.nextTick((function(){throw t}))}return new Promise((function(e,t){n((function(n,r){return null!=n?t(n):arguments.length>2?e(Array.prototype.slice.call(arguments,1)):void e(r)}))}))}n.d(t,"a",(function(){return r}))}).call(this,n(25))},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r={BASEPATH_CONVERSATIONS:"/conversations",BASEPATH_USERS:"/users",BASEPATH_MESSAGES:"/messages",BASEPATH_FILES:"/files",BASEPATH_PUSH_NOTIFICATION_SETTINGS:"/push_notification_settings",BASEPATH_PUSH_NOTIFICATION_TOKENS:"/push_notification_tokens",LOCALSTORAGE_PREFIX:"channelize_storage_"}},function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var r=n(10),o=n(2),i=n(0),u=n(5),c=n(1);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null;return Object.keys(t).forEach((function(t){e.includes(t)||(n=t)})),n},getRequiedFilter:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=Object.keys(t);return e.forEach((function(e){r.includes(e)||n.push(e)})),n},validateURL:function(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}}},function(e,t){e.exports=require("aws-sdk/global")},function(e,t,n){"use strict";function r(e,t){for(var n=0;n=0;o-=1)t._client.Cache.get(n[o])&&(r.push(t._client.Cache.get(n[o])),n.splice(o,1));if(!n.length)return e(null,r);t._client.request("/get_url_meta_data",{method:"post",data:{urls:n}}).then((function(n){return n.data.forEach((function(e){t._client.Cache.set(e.url,e)})),e(null,n.data.concat(r))})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"createReactionUserListQuery",value:function(){return new c.a(this._client,this.id)}}])&&s(n.prototype,r),i&&s(n,i),p}(r.a);d(p,"__properties",{id:null,type:null,customType:null,attachments:[],body:null,conversationId:null,ownerId:null,owner:{},mentionedUsers:[],isDeleted:null,createdAt:null,updatedAt:null,refMsgId:null,metaData:null,parentId:null,parentMessage:{},originalMessageId:null,reactionsCount:{},reactions:{},replyCount:null,showInConversation:null}),d(p,"basePath",i.a.BASEPATH_MESSAGES)},function(e,t,n){"use strict";n.d(t,"a",(function(){return N}));var r=n(10),o=n(11),i=n(2),u=n(0),c=n(5),a=n(16),s=n(7),l=n(3),f=n(1);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t={typing_events:!0,read_events:!0,push_notification:!0},n=this.config||{};return n=O({},t,{},n),e?n[e]:n}},{key:"join",value:function(e){var t=this;return Object(f.a)(e,(function(e){return t.isGroup?"public"!=t.type?function(e){throw e}(new Error(u.a.PUBLIC_CONVERSATION_REQUIRED)):void t._client.request(l.basePath+"/"+t.id+"/join",{method:"post"}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))})):function(e){throw e}(new Error(u.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"addAdmin",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?e&&"string"==typeof e?void n._client.request(l.basePath+"/"+n.id+"/add_admin",{method:"put",data:{userId:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):function(e){throw e}(new Error(u.a.INVALID_USER_ID)):function(e){throw e}(new Error(u.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"removeAdmin",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?e&&"string"==typeof e?void n._client.request(l.basePath+"/"+n.id+"/remove_admin",{method:"put",data:{userId:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):function(e){throw e}(new Error(u.a.INVALID_USER_ID)):function(e){throw e}(new Error(u.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"addMembers",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?Array.isArray(e)?void n._client.request(l.basePath+"/"+n.id+"/add_members",{method:"post",data:{members:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):function(e){throw e}(new Error(u.a.INVALID_MEMBER_IDS)):function(e){throw e}(new Error(u.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"removeMembers",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?Array.isArray(e)?void n._client.request(l.basePath+"/"+n.id+"/remove_members",{method:"post",data:{members:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):function(e){throw e}(new Error(u.a.INVALID_MEMBER_IDS)):function(e){throw e}(new Error(u.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"clear",value:function(e){var t=this;return Object(f.a)(e,(function(e){if("private"!=t.type)return e(new Error(u.a.CAN_NOT_CLEAR_CONVERSATION));t._client.request(l.basePath+"/"+t.id+"/clear",{method:"delete"}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"delete",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/delete",{method:"delete"}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"leave",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/leave",{method:"post"}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"markAsRead",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){if(!n.getConfig("read_events"))return t(new Error(u.a.CONVERSATION_NOT_CONFIGURED_READ_EVENTS));var r;if(e)r=e;else{var o=new Date;r=o.toISOString()}n._client.request(l.basePath+"/"+n.id+"/mark_as_read",{method:"put",data:{timestamp:r}}).then((function(e){return n.lastReadAt.hasOwnProperty(n._client.loginUser.id)&&(n.lastReadAt[n._client.loginUser.id]=r),t(null,e.data)})).catch((function(e){return t(n._client.error(e))}))}))}},{key:"update",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){n._client.request(l.basePath+"/"+n.id,{method:"put",data:e}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))}))}))}},{key:"updateTitle",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?"string"!=typeof e?function(e){throw e}(new Error(u.a.INVALID_TITLE)):void n._client.request(l.basePath+"/"+n.id+"/update_title",{method:"put",data:{title:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):function(e){throw e}(new Error(u.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"muteConversation",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/update_settings",{method:"put",data:{mute:!0}}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"unmuteConversation",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/update_settings",{method:"put",data:{mute:!1}}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"updateProfilePhoto",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){if(!n.isGroup)return function(e){throw e}(new Error(u.a.GROUP_CONVERSATION_REQUIRED));if("string"==typeof e&&c.a.validateURL(e)){var r={profileImageUrl:e};return n._client.request(l.basePath+"/"+n.id+"/update_profile",{method:"put",data:r}).then((function(e){return t(null,e.data)})).catch((function(e){return t(e,null)}))}if("object"!=I(e))return function(e){throw e}(new Error(u.a.INVALID_PROFILE_IMG));n._client.File.upload(e,"image",!1,(function(e,r){if(e)return t(e);var o={profileImageUrl:r.fileUrl};n._client.request(l.basePath+"/"+n.id+"/update_profile",{method:"put",data:o}).then((function(e){return t(null,e.data)})).catch((function(e){return t(e,null)}))}))}))}},{key:"sendMessage",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){e.conversationId=n.id,e.isGroup=n.isGroup,n.messageService._sendMessage(e,(function(e,r){return e?t(n._client.error(e)):t(null,r)}))}))}},{key:"startTyping",value:function(e){var t=this;return Object(f.a)(e,(function(e){if(!t.getConfig("typing_events"))return e(new Error(u.a.CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS));t._client.request(l.basePath+"/"+t.id+"/send_typing_status",{method:"post",data:{isTyping:!0}}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"stopTyping",value:function(e){var t=this;return Object(f.a)(e,(function(e){if(!t.getConfig("typing_events"))return e(new Error(u.a.CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS));t._client.request(l.basePath+"/"+t.id+"/send_typing_status",{method:"post",data:{isTyping:!1}}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"getMembers",value:function(e){var t=this;if(this.members.length)return e(null,this.members);this._client.request(l.basePath+"/"+this.id+"/members").then((function(n){return t.members=n.data,e(null,n.data)})).catch((function(n){return e(t._client.error(n))}))}},{key:"getReadMembers",value:function(e){var t=this;if("object"!=I(e))return function(e){throw e}(new Error(u.a.INVALID_MESSAGE_OBJECT));var n={};return Object.keys(this.lastReadAt).forEach((function(r){e.createdAt<=t.lastReadAt[r]&&(n[r]=t.lastReadAt[r])})),n}},{key:"readByAllMembers",value:function(e){var t=this;if("object"!=I(e))return function(e){throw e}(new Error(u.a.INVALID_MESSAGE_OBJECT));var n=!0;return Object.keys(this.lastReadAt).forEach((function(r){e.createdAt>=t.lastReadAt[r]&&e.ownerId!=r&&(n=!1)})),n}},{key:"on",value:function(e,t){if(this.__isWatchingEvent(e)&&!this.__isWatching)return function(e){throw e}(new Error(u.a.REQUIRED_WATCHING_CONVERSATION));this._client.chsocket.on(e,this.id,t)}},{key:"__isWatchingEvent",value:function(e){return this.__watchingEvents.includes(e)}},{key:"off",value:function(e,t){this._client.chsocket.off(e,this.id,t)}},{key:"startWatching",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/start_watching",{method:"post"}).then((function(n){return t.__isWatching=!0,e(null,n.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"stopWatching",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/stop_watching",{method:"post"}).then((function(n){return t.__isWatching=!1,e(null,n.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"createWatchersListQuery",value:function(){return new m(this._client,this.id)}},{key:"createMessageListQuery",value:function(){return new a.a(this._client,this.id)}}])&&S(n.prototype,r),i&&S(n,i),l}(r.a);R(N,"__properties",{id:null,type:null,config:{},customType:null,metaData:{},lastMessage:{},lastReadAt:{},title:null,isGroup:null,createdAt:null,memberCount:0,ownerId:null,members:[],profileImageUrl:null,isActive:null,isAdmin:null,isDeleted:null,mute:null,unreadMessageCount:null,updatedAt:null,user:{},watchersCount:0}),R(N,"basePath",i.a.BASEPATH_CONVERSATIONS)},function(e,t,n){"use strict";function r(e,t){for(var n=0;n=0;t--)if(c.a.getRequiedFilter(["userId","order","wordCount"],e.mentionedUsers[t]).length)return function(e){throw e}(new Error(u.a.INVALID_MESSAGE_MENTIONED_USERS))}e.parentId&&!e.type?e.type="reply":e.type=e.type?e.type:"normal"}}],(r=null)&&f(n.prototype,r),i&&f(n,i),b}(r.a);y=E,b="basePath",v=i.a.BASEPATH_MESSAGES,b in y?Object.defineProperty(y,b,{value:v,enumerable:!0,configurable:!0,writable:!0}):y[b]=v},function(e,t,n){"use strict";n.d(t,"a",(function(){return E}));var r=n(4),o=n(3),i=n(2),u=n(0),c=n(13),a=n(1);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};V(this,e),M(this,"__socketClass",R),M(this,"__socket",void 0),M(this,"__events",{connected:{topic:"connected"},disconnected:{topic:"disconnected"},reconnected:{topic:"reconnected"},"conversation.updated":{topic:"users/[login_user]/conversation/updated"},"conversation.members_added":{topic:"users/[login_user]/conversation/members_added"},"conversation.members_removed":{topic:"users/[login_user]/conversation/members_removed"},"conversation.admin_added":{topic:"users/[login_user]/conversation/admin_added"},"conversation.admin_removed":{topic:"users/[login_user]/conversation/admin_removed"},"conversation.typing":{topic:"users/[login_user]/conversation/typing"},"conversation.mark_as_read":{topic:"users/[login_user]/conversation/mark_as_read"},"message.deleted_for_everyone":{topic:"users/[login_user]/messages/deleted_for_everyone"},"user.friends_added":{topic:"users/[login_user]/friends_added"},"user.friends_removed":{topic:"users/[login_user]/friends_removed"},"user.blocked":{topic:"users/[login_user]/blocked"},"user.unblocked":{topic:"users/[login_user]/unblocked"},"user.conversation_deleted":{topic:"users/[login_user]/conversation_deleted"},"user.conversation_cleared":{topic:"users/[login_user]/conversation_cleared"},"user.mute_updated":{topic:"users/[login_user]/mute_updated"},"user.joined":{topic:"users/[login_user]/joined"},"user.removed":{topic:"users/[login_user]/removed"},"user.message_created":{topic:"users/[login_user]/message_created"},"user.message_deleted":{topic:"users/[login_user]/message_deleted"},"user.total_unread_message_count_updated":{topic:"users/[login_user]/total_unread_message_count_updated"},"user.status_updated":{topic:"users/status_updated"},"user.updated":{topic:"users/updated"},"reaction.added":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/reaction_added"},"reaction.removed":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/reaction_removed"},"watcher.conversation.start_watching":{vars:["conversation_id"],topic:"conversations/[conversation_id]/start_watching"},"watcher.conversation.stop_watching":{vars:["conversation_id"],topic:"conversations/[conversation_id]/stop_watching"},"watcher.message.created":{vars:["conversation_id"],topic:"conversations/[conversation_id]/message_created"},"watcher.message.deleted_for_everyone":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/deleted_for_everyone"}}),M(this,"allowForceResubscribe",!1),M(this,"__baseEvents",["connected","disconnected","reconnected"]),M(this,"__subscribedTopics",{}),M(this,"__preConnectEvents",[]),this.__socket=new this.__socketClass(this),this.__connected=!1,this.__autoSubscribed=!1,this.__publicKey=t.publicKey}var t,n,r;return t=e,(n=[{key:"connect",value:function(e,t,n){var r=this;return Object(f.a)(n,(function(n){r.__userId=e,r.__socket.connect(e,t,n)}))}},{key:"__onConnected",value:function(e){this.__connected=!0,e?this.__trigger("reconnected",null):this.__trigger("connected",null),this.allowForceResubscribe&&e&&this.__autoSubscribed?this.__resubscribe():this.__autoSubscribed||this.__subscribeAll(),this.__preConnectSubscribe(),this.__setUserOnline()}},{key:"__onConnectionLost",value:function(e){this.__connected=!1,this.__trigger("disconnected",e)}},{key:"__disconnect",value:function(){this.__socket.__disconnect()}},{key:"__validate",value:function(e,t,n){if(!this.__isSupported(e))return function(e){throw e}(new Error(N.a.sprintf(l.a.INVALID_EVENT,e)));if(!this.__hasDependencyVars(e))return!0;this.__events[e].vars.forEach((function(n){if(!t[n])return function(e){throw e}(new Error(N.a.sprintf(l.a.REQUIRED_SOCKET_EVENT_PARAM,n,e)))}));var r="__validate"+this.__capitalize(e);if("function"==typeof this[r]){var o=this[r](e,t);if(o.error)return function(e){throw e}(new Error(o.message))}}},{key:"on",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),n=e.pop(),r={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach((function(t){r[t]=e.shift()})),this.__validate(t,r,n),this.__isConnected()||this.__isBaseEvent(t)?this.__subscribe(t,r,n):this.__preConnectAdd(t,r,n)}},{key:"off",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),n=e.pop(),r={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach((function(t){r[t]=e.shift()})),this.__validate(t,r,n),!this.__isConnected()&&this.__isBaseEvent(t)||this.__unSubscribe(t,r,n)}},{key:"__preConnectAdd",value:function(e,t,n){this.__preConnectEvents.push({event:e,params:t,cb:n})}},{key:"__isBaseEvent",value:function(e){return this.__baseEvents.includes(e)}},{key:"__isConnected",value:function(){return this.__connected}},{key:"__preConnectSubscribe",value:function(){for(var e;e=this.__preConnectEvents.shift();)this.__subscribe(e.event,e.params,e.cb)}},{key:"__getEventTopic",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.__events[e].topic,o=this.__events[e].vars;return Array.isArray(r)?r.map((function(e){return t.__replaceTopicVar(e,o,n)})):this.__replaceTopicVar(r,o,n)}},{key:"__isSubscribed",value:function(e){return this.__subscribedTopics.hasOwnProperty(e)}},{key:"__isSupported",value:function(e){return this.__events.hasOwnProperty(e)}},{key:"__hasDependencyVars",value:function(e){return this.__events[e]&&this.__events[e].hasOwnProperty("vars")&&this.__events[e].vars.length}},{key:"__subscribe",value:function(e,t,n){var r=this,o=this.__getEventTopic(e,t);(Array.isArray(o)?o:[o]).forEach((function(t){r.__isSubscribed(t)||(r.__isBaseEvent(e)||r.__subscribeSocket(t),r.__subscribedTopics[t]={event:e,cb:[]}),n&&"function"==typeof n&&r.__subscribedTopics[t].cb.push(n)}))}},{key:"__unSubscribe",value:function(e,t,n){var r=this,o=this.__getEventTopic(e,t);(Array.isArray(o)?o:[o]).forEach((function(t){r.__isSubscribed(t)&&(r.__isBaseEvent(e)||r.__unSubscribeSocket(t),delete r.__subscribedTopics[t])}))}},{key:"__subscribeSocket",value:function(e){this.__socket.__subscribe(this.__publicKey+"/"+e)}},{key:"__unSubscribeSocket",value:function(e){this.__socket.__unsubscribe(this.__publicKey+"/"+e)}},{key:"__publishSocket",value:function(e,t){t=this.__addDefaultProperties(t),e=e.replace("[login_user]",this.__userId),this.__socket.__publish(this.__publicKey+"/"+e,JSON.stringify(t))}},{key:"__addDefaultProperties",value:function(e){return Object.assign(e,{version:"v2"})}},{key:"__subscribeAll",value:function(){var e=this;Object.keys(this.__events).forEach((function(t){e.__hasDependencyVars(t)||e.__subscribe(t,null)})),this.__autoSubscribed=!0}},{key:"__resubscribe",value:function(){var e=this;Object.keys(this.__subscribedTopics).forEach((function(t){var n=e.__subscribedTopics[t].event;e.__isBaseEvent(n)||e.__subscribeSocket(t)}))}},{key:"__trigger",value:function(e,t){e=e.replace(this.__publicKey+"/",""),this.__isSubscribed(e)&&this.__subscribedTopics[e].cb.forEach((function(e){e(t)}))}},{key:"__processPayload",value:function(e,t){var n=this.__subscribedTopics[e].event;return"function"==typeof L[n]?L[n](e,t):[t]}},{key:"__replaceTopicVar",value:function(e,t,n){return e=e.replace("[login_user]",this.__userId),t&&t.length?(t.forEach((function(t){e=e.replace("["+t+"]",n[t])})),e):e}},{key:"__capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"__validateUserUpdated",value:function(e,t){return{error:"string"!=typeof t.user_id,message:"User Id should be string"}}},{key:"__setUserOnline",value:function(){this.__publishSocket("users/server/online",{userId:this.__userId})}}])&&U(t.prototype,n),r&&U(t,r),e}(),G=n(21),z=n.n(G);function B(e,t){for(var n=0;n1)for(var n=1;n2?e(Array.prototype.slice.call(arguments,1)):void e(r)}))}))}n.d(t,"a",(function(){return r}))}).call(this,n(25))},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r={BASEPATH_CONVERSATIONS:"/conversations",BASEPATH_USERS:"/users",BASEPATH_MESSAGES:"/messages",BASEPATH_FILES:"/files",BASEPATH_PUSH_NOTIFICATION_SETTINGS:"/push_notification_settings",BASEPATH_PUSH_NOTIFICATION_TOKENS:"/push_notification_tokens",LOCALSTORAGE_PREFIX:"channelize_storage_",ROLES:{ANONYMOUS:"anonymous",USER:"user"},ANONYMOUS_ID_PREFIX:"anonymous",ANONYMOUS_USER_DISPLAY_NAME:"Anonymous User"}},function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var r=n(10),i=n(2),o=n(0),u=n(5),c=n(1);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null;return Object.keys(t).forEach((function(t){e.includes(t)||(n=t)})),n},getRequiedFilter:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=Object.keys(t);return e.forEach((function(e){r.includes(e)||n.push(e)})),n},validateURL:function(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}}},function(e,t){e.exports=require("aws-sdk/global")},function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){for(var n=0;n=0;i-=1)t._client.Cache.get(n[i])&&(r.push(t._client.Cache.get(n[i])),n.splice(i,1));if(!n.length)return e(null,r);t._client.request("/get_url_meta_data",{method:"post",data:{urls:n}}).then((function(n){return n.data.forEach((function(e){t._client.Cache.set(e.url,e)})),e(null,n.data.concat(r))})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"createReactionUserListQuery",value:function(){return new c.a(this._client,this.id)}}])&&s(n.prototype,r),o&&s(n,o),p}(r.a);d(p,"__properties",{id:null,type:null,customType:null,attachments:[],body:null,conversationId:null,ownerId:null,owner:{},mentionedUsers:[],isDeleted:null,createdAt:null,updatedAt:null,refMsgId:null,metaData:null,parentId:null,parentMessage:{},originalMessageId:null,reactionsCount:{},reactions:{},replyCount:null,showInConversation:null}),d(p,"basePath",o.a.BASEPATH_MESSAGES)},function(e,t,n){"use strict";n.d(t,"a",(function(){return C}));var r=n(10),i=n(11),o=n(2),u=n(0),c=n(5),a=n(16),s=n(7),l=n(3),f=n(1);function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t={typing_events:!0,read_events:!0,push_notification:!0},n=this.config||{};return n=A({},t,{},n),e?n[e]:n}},{key:"join",value:function(e){var t=this;return Object(f.a)(e,(function(e){return t.isGroup?"public"!=t.type?e(u.a.PUBLIC_CONVERSATION_REQUIRED):void t._client.request(l.basePath+"/"+t.id+"/join",{method:"post"}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))})):e(u.a.GROUP_CONVERSATION_REQUIRED)}))}},{key:"addAdmin",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?e&&"string"==typeof e?void n._client.request(l.basePath+"/"+n.id+"/add_admin",{method:"put",data:{userId:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):t(u.a.INVALID_USER_ID):t(u.a.GROUP_CONVERSATION_REQUIRED)}))}},{key:"removeAdmin",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?e&&"string"==typeof e?void n._client.request(l.basePath+"/"+n.id+"/remove_admin",{method:"put",data:{userId:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):t(u.a.INVALID_USER_ID):t(u.a.GROUP_CONVERSATION_REQUIRED)}))}},{key:"addMembers",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?Array.isArray(e)?void n._client.request(l.basePath+"/"+n.id+"/add_members",{method:"post",data:{members:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):t(u.a.INVALID_MEMBER_IDS):t(u.a.GROUP_CONVERSATION_REQUIRED)}))}},{key:"removeMembers",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?Array.isArray(e)?void n._client.request(l.basePath+"/"+n.id+"/remove_members",{method:"post",data:{members:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):t(u.a.INVALID_MEMBER_IDS):t(u.a.GROUP_CONVERSATION_REQUIRED)}))}},{key:"clear",value:function(e){var t=this;return Object(f.a)(e,(function(e){if("private"!=t.type)return e(new Error(u.a.CAN_NOT_CLEAR_CONVERSATION));t._client.request(l.basePath+"/"+t.id+"/clear",{method:"delete"}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"delete",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/delete",{method:"delete"}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"leave",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/leave",{method:"post"}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"markAsRead",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){if(!n.getConfig("read_events"))return t(new Error(u.a.CONVERSATION_NOT_CONFIGURED_READ_EVENTS));var r;if(e)r=e;else{var i=new Date;r=i.toISOString()}n._client.request(l.basePath+"/"+n.id+"/mark_as_read",{method:"put",data:{timestamp:r}}).then((function(e){return n._client.loginUser&&n.lastReadAt.hasOwnProperty(n._client.loginUser.id)&&(n.lastReadAt[n._client.loginUser.id]=r),t(null,e.data)})).catch((function(e){return t(n._client.error(e))}))}))}},{key:"update",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){n._client.request(l.basePath+"/"+n.id,{method:"put",data:e}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))}))}))}},{key:"updateTitle",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){return n.isGroup?"string"!=typeof e?t(u.a.INVALID_TITLE):void n._client.request(l.basePath+"/"+n.id+"/update_title",{method:"put",data:{title:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(n._client.error(e))})):t(u.a.GROUP_CONVERSATION_REQUIRED)}))}},{key:"muteConversation",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/update_settings",{method:"put",data:{mute:!0}}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"unmuteConversation",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/update_settings",{method:"put",data:{mute:!1}}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"updateProfilePhoto",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){if(!n.isGroup)return t(u.a.GROUP_CONVERSATION_REQUIRED);if("string"==typeof e&&c.a.validateURL(e)){var r={profileImageUrl:e};return n._client.request(l.basePath+"/"+n.id+"/update_profile",{method:"put",data:r}).then((function(e){return t(null,e.data)})).catch((function(e){return t(e,null)}))}if("object"!=O(e))return t(u.a.INVALID_PROFILE_IMG);n._client.File.upload(e,"image",!1,(function(e,r){if(e)return t(e);var i={profileImageUrl:r.fileUrl};n._client.request(l.basePath+"/"+n.id+"/update_profile",{method:"put",data:i}).then((function(e){return t(null,e.data)})).catch((function(e){return t(e,null)}))}))}))}},{key:"sendMessage",value:function(e,t){var n=this;return Object(f.a)(t,(function(t){e.conversationId=n.id,e.isGroup=n.isGroup,n.messageService._sendMessage(e,(function(e,r){return e?t(n._client.error(e)):t(null,r)}))}))}},{key:"startTyping",value:function(e){var t=this;return Object(f.a)(e,(function(e){if(!t.getConfig("typing_events"))return e(new Error(u.a.CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS));t._client.request(l.basePath+"/"+t.id+"/send_typing_status",{method:"post",data:{isTyping:!0}}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"stopTyping",value:function(e){var t=this;return Object(f.a)(e,(function(e){if(!t.getConfig("typing_events"))return e(new Error(u.a.CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS));t._client.request(l.basePath+"/"+t.id+"/send_typing_status",{method:"post",data:{isTyping:!1}}).then((function(t){return e(null,t.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"getMembers",value:function(e){var t=this;if(this.members.length)return e(null,this.members);this._client.request(l.basePath+"/"+this.id+"/members").then((function(n){return t.members=n.data,e(null,n.data)})).catch((function(n){return e(t._client.error(n))}))}},{key:"getReadMembers",value:function(e){var t=this;if("object"!=O(e))throw new Error(u.a.INVALID_MESSAGE_OBJECT);var n={};return Object.keys(this.lastReadAt).forEach((function(r){e.createdAt<=t.lastReadAt[r]&&(n[r]=t.lastReadAt[r])})),n}},{key:"readByAllMembers",value:function(e){var t=this;if("object"!=O(e))throw new Error(u.a.INVALID_MESSAGE_OBJECT);var n=!0;return Object.keys(this.lastReadAt).forEach((function(r){e.createdAt>=t.lastReadAt[r]&&e.ownerId!=r&&(n=!1)})),n}},{key:"on",value:function(e,t){if(this.__isWatchingEvent(e)&&!this.__isWatching)throw new Error(u.a.REQUIRED_WATCHING_CONVERSATION);this._client.chsocket.on(e,this.id,t)}},{key:"__isWatchingEvent",value:function(e){return this.__watchingEvents.includes(e)}},{key:"off",value:function(e,t){this._client.chsocket.off(e,this.id,t)}},{key:"startWatching",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/start_watching",{method:"post"}).then((function(n){return t.__isWatching=!0,e(null,n.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"stopWatching",value:function(e){var t=this;return Object(f.a)(e,(function(e){t._client.request(l.basePath+"/"+t.id+"/stop_watching",{method:"post"}).then((function(n){return t.__isWatching=!1,e(null,n.data)})).catch((function(n){return e(t._client.error(n))}))}))}},{key:"createWatchersListQuery",value:function(){return new I(this._client,this.id)}},{key:"createMessageListQuery",value:function(){return new a.a(this._client,this.id)}}])&&S(n.prototype,r),o&&S(n,o),l}(r.a);N(C,"__properties",{id:null,type:null,config:{},customType:null,metaData:{},lastMessage:{},lastReadAt:{},title:null,isGroup:null,createdAt:null,memberCount:0,ownerId:null,members:[],profileImageUrl:null,isActive:null,isAdmin:null,isDeleted:null,mute:null,unreadMessageCount:null,updatedAt:null,user:{},watchersCount:0}),N(C,"basePath",o.a.BASEPATH_CONVERSATIONS)},function(e,t,n){"use strict";function r(e,t){for(var n=0;n=0;t--)if(c.a.getRequiedFilter(["userId","order","wordCount"],e.mentionedUsers[t]).length)return cb(u.a.INVALID_MESSAGE_MENTIONED_USERS)}e.parentId&&!e.type?e.type="reply":e.type=e.type?e.type:"normal"}}],(r=null)&&f(n.prototype,r),o&&f(n,o),b}(r.a);y=g,b="basePath",v=o.a.BASEPATH_MESSAGES,b in y?Object.defineProperty(y,b,{value:v,enumerable:!0,configurable:!0,writable:!0}):y[b]=v},function(e,t,n){"use strict";n.d(t,"a",(function(){return g}));var r=n(4),i=n(3),o=n(2),u=n(0),c=n(13),a=n(1);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};U(this,e),M(this,"__socketClass",N),M(this,"__socket",void 0),M(this,"__events",{connected:{topic:"connected"},disconnected:{topic:"disconnected"},reconnected:{topic:"reconnected"},"conversation.updated":{topic:"users/[login_user]/conversation/updated"},"conversation.members_added":{topic:"users/[login_user]/conversation/members_added"},"conversation.members_removed":{topic:"users/[login_user]/conversation/members_removed"},"conversation.admin_added":{topic:"users/[login_user]/conversation/admin_added"},"conversation.admin_removed":{topic:"users/[login_user]/conversation/admin_removed"},"conversation.typing":{topic:"users/[login_user]/conversation/typing"},"conversation.mark_as_read":{topic:"users/[login_user]/conversation/mark_as_read"},"message.deleted_for_everyone":{topic:"users/[login_user]/messages/deleted_for_everyone"},"user.friends_added":{topic:"users/[login_user]/friends_added"},"user.friends_removed":{topic:"users/[login_user]/friends_removed"},"user.blocked":{topic:"users/[login_user]/blocked"},"user.unblocked":{topic:"users/[login_user]/unblocked"},"user.conversation_deleted":{topic:"users/[login_user]/conversation_deleted"},"user.conversation_cleared":{topic:"users/[login_user]/conversation_cleared"},"user.mute_updated":{topic:"users/[login_user]/mute_updated"},"user.joined":{topic:"users/[login_user]/joined"},"user.removed":{topic:"users/[login_user]/removed"},"user.message_created":{topic:"users/[login_user]/message_created"},"user.message_deleted":{topic:"users/[login_user]/message_deleted"},"user.total_unread_message_count_updated":{topic:"users/[login_user]/total_unread_message_count_updated"},"user.status_updated":{topic:"users/status_updated"},"user.updated":{topic:"users/updated"},"reaction.added":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/reaction_added"},"reaction.removed":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/reaction_removed"},"watcher.conversation.start_watching":{vars:["conversation_id"],topic:"conversations/[conversation_id]/start_watching"},"watcher.conversation.stop_watching":{vars:["conversation_id"],topic:"conversations/[conversation_id]/stop_watching"},"watcher.message.created":{vars:["conversation_id"],topic:"conversations/[conversation_id]/message_created"},"watcher.message.deleted_for_everyone":{vars:["conversation_id"],topic:"conversations/[conversation_id]/messages/deleted_for_everyone"}}),M(this,"allowForceResubscribe",!1),M(this,"__baseEvents",["connected","disconnected","reconnected"]),M(this,"__subscribedTopics",{}),M(this,"__preConnectEvents",[]),this.__socket=new this.__socketClass(this),this.__connected=!1,this.__autoSubscribed=!1,this.__publicKey=t.publicKey}var t,n,r;return t=e,(n=[{key:"connect",value:function(e,t,n){var r=this;return Object(f.a)(n,(function(n){r.__userId=e,r.__socket.connect(e,t,n)}))}},{key:"__onConnected",value:function(e){this.__connected=!0,e?this.__trigger("reconnected",null):this.__trigger("connected",null),this.allowForceResubscribe&&e&&this.__autoSubscribed?this.__resubscribe():this.__autoSubscribed||this.__subscribeAll(),this.__preConnectSubscribe(),this.__setUserOnline()}},{key:"__onConnectionLost",value:function(e){this.__connected=!1,this.__trigger("disconnected",e),this.__resetProperties()}},{key:"__disconnect",value:function(){this.__socket.__disconnect()}},{key:"__validate",value:function(e,t,n){if(!this.__isSupported(e))throw new Error(C.a.sprintf(l.a.INVALID_EVENT,e));if(!this.__hasDependencyVars(e))return!0;this.__events[e].vars.forEach((function(n){if(!t[n])throw new Error(C.a.sprintf(l.a.REQUIRED_SOCKET_EVENT_PARAM,n,e))}));var r="__validate"+this.__capitalize(e);if("function"==typeof this[r]){var i=this[r](e,t);if(i.error)throw new Error(i.message)}}},{key:"on",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),n=e.pop(),r={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach((function(t){r[t]=e.shift()})),this.__validate(t,r,n),this.__isConnected()||this.__isBaseEvent(t)?this.__subscribe(t,r,n):this.__preConnectAdd(t,r,n)}},{key:"off",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),n={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach((function(t){n[t]=e.shift()})),this.__validate(t,n),!this.__isConnected()&&this.__isBaseEvent(t)||this.__unsubscribe(t,n)}},{key:"__resetProperties",value:function(){this.__autoSubscribed=!1,this.__subscribedTopics={},this.__preConnectEvents=[]}},{key:"__preConnectAdd",value:function(e,t,n){this.__preConnectEvents.push({event:e,params:t,cb:n})}},{key:"__isBaseEvent",value:function(e){return this.__baseEvents.includes(e)}},{key:"__isConnected",value:function(){return this.__connected}},{key:"__preConnectSubscribe",value:function(){for(var e;e=this.__preConnectEvents.shift();)this.__subscribe(e.event,e.params,e.cb)}},{key:"__getEventTopic",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.__events[e].topic,i=this.__events[e].vars;return Array.isArray(r)?r.map((function(e){return t.__replaceTopicVar(e,i,n)})):this.__replaceTopicVar(r,i,n)}},{key:"__isSubscribed",value:function(e){return this.__subscribedTopics.hasOwnProperty(e)}},{key:"__isSupported",value:function(e){return this.__events.hasOwnProperty(e)}},{key:"__hasDependencyVars",value:function(e){return this.__events[e]&&this.__events[e].hasOwnProperty("vars")&&this.__events[e].vars.length}},{key:"__subscribe",value:function(e,t,n){var r=this,i=this.__getEventTopic(e,t);i.includes("[login_user]")&&!this.__userId||(Array.isArray(i)?i:[i]).forEach((function(t){r.__isSubscribed(t)||(r.__isBaseEvent(e)||r.__subscribeSocket(t),r.__subscribedTopics[t]={event:e,cb:[]}),n&&"function"==typeof n&&r.__subscribedTopics[t].cb.push(n)}))}},{key:"__unsubscribe",value:function(e,t){var n=this,r=this.__getEventTopic(e,t);r.includes("[login_user]")&&!this.__userId||(Array.isArray(r)?r:[r]).forEach((function(t){n.__isSubscribed(t)&&(n.__isBaseEvent(e)||n.__unsubscribeSocket(t),delete n.__subscribedTopics[t])}))}},{key:"__subscribeSocket",value:function(e){this.__socket.__subscribe(this.__publicKey+"/"+e)}},{key:"__unsubscribeSocket",value:function(e){this.__socket.__unsubscribe(this.__publicKey+"/"+e)}},{key:"__publishSocket",value:function(e,t){t=this.__addDefaultProperties(t),e=e.replace("[login_user]",this.__userId),this.__socket.__publish(this.__publicKey+"/"+e,JSON.stringify(t))}},{key:"__addDefaultProperties",value:function(e){return Object.assign(e,{version:"v2"})}},{key:"__subscribeAll",value:function(){var e=this;Object.keys(this.__events).forEach((function(t){e.__hasDependencyVars(t)||e.__subscribe(t,null)})),this.__autoSubscribed=!0}},{key:"__resubscribe",value:function(){var e=this;Object.keys(this.__subscribedTopics).forEach((function(t){var n=e.__subscribedTopics[t].event;e.__isBaseEvent(n)||e.__subscribeSocket(t)}))}},{key:"__trigger",value:function(e,t){e=e.replace(this.__publicKey+"/",""),this.__isSubscribed(e)&&this.__subscribedTopics[e].cb.forEach((function(e){e(t)}))}},{key:"__processPayload",value:function(e,t){var n=this.__subscribedTopics[e].event;return"function"==typeof L[n]?L[n](e,t):[t]}},{key:"__replaceTopicVar",value:function(e,t,n){return this.__userId&&(e=e.replace("[login_user]",this.__userId)),t&&t.length?(t.forEach((function(t){e=e.replace("["+t+"]",n[t])})),e):e}},{key:"__capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"__validateUserUpdated",value:function(e,t){return{error:"string"!=typeof t.user_id,message:"User Id should be string"}}},{key:"__setUserOnline",value:function(){this.__userId&&this.__publishSocket("users/server/online",{userId:this.__userId})}},{key:"getDependencyEvents",value:function(e){var t=this,n=[];return Object.keys(this.__events).forEach((function(r){var i=t.__events[r].vars;i&&i.includes(e)&&n.push(r)})),n}}])&&V(t.prototype,n),r&&V(t,r),e}(),G=n(21),z=n.n(G);function B(e,t){for(var n=0;n1)for(var n=1;n