From ecdea5225065938e8b60117eb671fa6c1d2f39bb Mon Sep 17 00:00:00 2001 From: Daniel Caspi Date: Fri, 14 May 2021 00:24:14 -0500 Subject: [PATCH] Bump AWS SDK to v2.906.0 --- dist/AwsSdk.js | 4 ++-- src-sdk/aws-sdk.js | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dist/AwsSdk.js b/dist/AwsSdk.js index a6289df..8d9a84f 100644 --- a/dist/AwsSdk.js +++ b/dist/AwsSdk.js @@ -1,4 +1,4 @@ -// AWS SDK for JavaScript v2.903.0 +// AWS SDK for JavaScript v2.906.0 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // License at https://sdk.amazonaws.com/js/BUNDLE_LICENSE.txt -(function(){var window=window||{};!function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i-1});var viewStrings=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object DataView]"];module.exports={isEmptyData:function(data){return"string"==typeof data?0===data.length:0===data.byteLength},convertToBuffer:function(data){return"string"==typeof data&&(data=new Buffer(data,"utf8")),ArrayBuffer.isView(data)?new Uint8Array(data.buffer,data.byteOffset,data.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(data)}}},{"buffer/":92}],20:[function(require,module,exports){var hashUtils=require("./browserHashUtils");function Hmac(hashCtor,secret){this.hash=new hashCtor,this.outer=new hashCtor;var inner=function(hashCtor,secret){var input=hashUtils.convertToBuffer(secret);if(input.byteLength>hashCtor.BLOCK_SIZE){var bufferHash=new hashCtor;bufferHash.update(input),input=bufferHash.digest()}var buffer=new Uint8Array(hashCtor.BLOCK_SIZE);return buffer.set(input),buffer}(hashCtor,secret),outer=new Uint8Array(hashCtor.BLOCK_SIZE);outer.set(inner);for(var i=0;i>>32-s)+b&4294967295}function ff(a,b,c,d,x,s,t){return cmn(b&c|~b&d,a,b,x,s,t)}function gg(a,b,c,d,x,s,t){return cmn(b&d|c&~d,a,b,x,s,t)}function hh(a,b,c,d,x,s,t){return cmn(b^c^d,a,b,x,s,t)}function ii(a,b,c,d,x,s,t){return cmn(c^(b|~d),a,b,x,s,t)}module.exports=Md5,Md5.BLOCK_SIZE=BLOCK_SIZE,Md5.prototype.update=function(sourceData){if(hashUtils.isEmptyData(sourceData))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var data=hashUtils.convertToBuffer(sourceData),position=0,byteLength=data.byteLength;for(this.bytesHashed+=byteLength;byteLength>0;)this.buffer.setUint8(this.bufferLength++,data[position++]),byteLength--,this.bufferLength===BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0);return this},Md5.prototype.digest=function(encoding){if(!this.finished){var buffer=this.buffer,undecoratedLength=this.bufferLength,bitsHashed=8*this.bytesHashed;if(buffer.setUint8(this.bufferLength++,128),undecoratedLength%BLOCK_SIZE>=BLOCK_SIZE-8){for(var i=this.bufferLength;i>>0,!0),buffer.setUint32(BLOCK_SIZE-4,Math.floor(bitsHashed/4294967296),!0),this.hashBuffer(),this.finished=!0}var out=new DataView(new ArrayBuffer(16));for(i=0;i<4;i++)out.setUint32(4*i,this.state[i],!0);var buff=new Buffer(out.buffer,out.byteOffset,out.byteLength);return encoding?buff.toString(encoding):buff},Md5.prototype.hashBuffer=function(){var buffer=this.buffer,state=this.state,a=state[0],b=state[1],c=state[2],d=state[3];a=ff(a,b,c,d,buffer.getUint32(0,!0),7,3614090360),d=ff(d,a,b,c,buffer.getUint32(4,!0),12,3905402710),c=ff(c,d,a,b,buffer.getUint32(8,!0),17,606105819),b=ff(b,c,d,a,buffer.getUint32(12,!0),22,3250441966),a=ff(a,b,c,d,buffer.getUint32(16,!0),7,4118548399),d=ff(d,a,b,c,buffer.getUint32(20,!0),12,1200080426),c=ff(c,d,a,b,buffer.getUint32(24,!0),17,2821735955),b=ff(b,c,d,a,buffer.getUint32(28,!0),22,4249261313),a=ff(a,b,c,d,buffer.getUint32(32,!0),7,1770035416),d=ff(d,a,b,c,buffer.getUint32(36,!0),12,2336552879),c=ff(c,d,a,b,buffer.getUint32(40,!0),17,4294925233),b=ff(b,c,d,a,buffer.getUint32(44,!0),22,2304563134),a=ff(a,b,c,d,buffer.getUint32(48,!0),7,1804603682),d=ff(d,a,b,c,buffer.getUint32(52,!0),12,4254626195),c=ff(c,d,a,b,buffer.getUint32(56,!0),17,2792965006),a=gg(a,b=ff(b,c,d,a,buffer.getUint32(60,!0),22,1236535329),c,d,buffer.getUint32(4,!0),5,4129170786),d=gg(d,a,b,c,buffer.getUint32(24,!0),9,3225465664),c=gg(c,d,a,b,buffer.getUint32(44,!0),14,643717713),b=gg(b,c,d,a,buffer.getUint32(0,!0),20,3921069994),a=gg(a,b,c,d,buffer.getUint32(20,!0),5,3593408605),d=gg(d,a,b,c,buffer.getUint32(40,!0),9,38016083),c=gg(c,d,a,b,buffer.getUint32(60,!0),14,3634488961),b=gg(b,c,d,a,buffer.getUint32(16,!0),20,3889429448),a=gg(a,b,c,d,buffer.getUint32(36,!0),5,568446438),d=gg(d,a,b,c,buffer.getUint32(56,!0),9,3275163606),c=gg(c,d,a,b,buffer.getUint32(12,!0),14,4107603335),b=gg(b,c,d,a,buffer.getUint32(32,!0),20,1163531501),a=gg(a,b,c,d,buffer.getUint32(52,!0),5,2850285829),d=gg(d,a,b,c,buffer.getUint32(8,!0),9,4243563512),c=gg(c,d,a,b,buffer.getUint32(28,!0),14,1735328473),a=hh(a,b=gg(b,c,d,a,buffer.getUint32(48,!0),20,2368359562),c,d,buffer.getUint32(20,!0),4,4294588738),d=hh(d,a,b,c,buffer.getUint32(32,!0),11,2272392833),c=hh(c,d,a,b,buffer.getUint32(44,!0),16,1839030562),b=hh(b,c,d,a,buffer.getUint32(56,!0),23,4259657740),a=hh(a,b,c,d,buffer.getUint32(4,!0),4,2763975236),d=hh(d,a,b,c,buffer.getUint32(16,!0),11,1272893353),c=hh(c,d,a,b,buffer.getUint32(28,!0),16,4139469664),b=hh(b,c,d,a,buffer.getUint32(40,!0),23,3200236656),a=hh(a,b,c,d,buffer.getUint32(52,!0),4,681279174),d=hh(d,a,b,c,buffer.getUint32(0,!0),11,3936430074),c=hh(c,d,a,b,buffer.getUint32(12,!0),16,3572445317),b=hh(b,c,d,a,buffer.getUint32(24,!0),23,76029189),a=hh(a,b,c,d,buffer.getUint32(36,!0),4,3654602809),d=hh(d,a,b,c,buffer.getUint32(48,!0),11,3873151461),c=hh(c,d,a,b,buffer.getUint32(60,!0),16,530742520),a=ii(a,b=hh(b,c,d,a,buffer.getUint32(8,!0),23,3299628645),c,d,buffer.getUint32(0,!0),6,4096336452),d=ii(d,a,b,c,buffer.getUint32(28,!0),10,1126891415),c=ii(c,d,a,b,buffer.getUint32(56,!0),15,2878612391),b=ii(b,c,d,a,buffer.getUint32(20,!0),21,4237533241),a=ii(a,b,c,d,buffer.getUint32(48,!0),6,1700485571),d=ii(d,a,b,c,buffer.getUint32(12,!0),10,2399980690),c=ii(c,d,a,b,buffer.getUint32(40,!0),15,4293915773),b=ii(b,c,d,a,buffer.getUint32(4,!0),21,2240044497),a=ii(a,b,c,d,buffer.getUint32(32,!0),6,1873313359),d=ii(d,a,b,c,buffer.getUint32(60,!0),10,4264355552),c=ii(c,d,a,b,buffer.getUint32(24,!0),15,2734768916),b=ii(b,c,d,a,buffer.getUint32(52,!0),21,1309151649),a=ii(a,b,c,d,buffer.getUint32(16,!0),6,4149444226),d=ii(d,a,b,c,buffer.getUint32(44,!0),10,3174756917),c=ii(c,d,a,b,buffer.getUint32(8,!0),15,718787259),b=ii(b,c,d,a,buffer.getUint32(36,!0),21,3951481745),state[0]=a+state[0]&4294967295,state[1]=b+state[1]&4294967295,state[2]=c+state[2]&4294967295,state[3]=d+state[3]&4294967295}},{"./browserHashUtils":19,"buffer/":92}],22:[function(require,module,exports){var Buffer=require("buffer/").Buffer,hashUtils=require("./browserHashUtils");new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function Sha1(){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}module.exports=Sha1,Sha1.BLOCK_SIZE=64,Sha1.prototype.update=function(data){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(hashUtils.isEmptyData(data))return this;var length=(data=hashUtils.convertToBuffer(data)).length;this.totalLength+=8*length;for(var i=0;i14||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 s=24;s>=0;s-=8)this.write(this.totalLength>>s);var out=new Buffer(20),outView=new DataView(out.buffer);return outView.setUint32(0,this.h0,!1),outView.setUint32(4,this.h1,!1),outView.setUint32(8,this.h2,!1),outView.setUint32(12,this.h3,!1),outView.setUint32(16,this.h4,!1),encoding?out.toString(encoding):out},Sha1.prototype.processBlock=function(){for(var i=16;i<80;i++){var w=this.block[i-3]^this.block[i-8]^this.block[i-14]^this.block[i-16];this.block[i]=w<<1|w>>>31}var f,k,a=this.h0,b=this.h1,c=this.h2,d=this.h3,e=this.h4;for(i=0;i<80;i++){i<20?(f=d^b&(c^d),k=1518500249):i<40?(f=b^c^d,k=1859775393):i<60?(f=b&c|d&(b|c),k=2400959708):(f=b^c^d,k=3395469782);var temp=(a<<5|a>>>27)+f+e+k+(0|this.block[i]);e=d,d=c,c=b<<30|b>>>2,b=a,a=temp}for(this.h0=this.h0+a|0,this.h1=this.h1+b|0,this.h2=this.h2+c|0,this.h3=this.h3+d|0,this.h4=this.h4+e|0,this.offset=0,i=0;i<16;i++)this.block[i]=0}},{"./browserHashUtils":19,"buffer/":92}],23:[function(require,module,exports){var Buffer=require("buffer/").Buffer,hashUtils=require("./browserHashUtils"),KEY=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]),MAX_HASHABLE_LENGTH=Math.pow(2,53)-1;function Sha256(){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}module.exports=Sha256,Sha256.BLOCK_SIZE=64,Sha256.prototype.update=function(data){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(hashUtils.isEmptyData(data))return this;var position=0,byteLength=(data=hashUtils.convertToBuffer(data)).byteLength;if(this.bytesHashed+=byteLength,8*this.bytesHashed>MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;byteLength>0;)this.buffer[this.bufferLength++]=data[position++],byteLength--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},Sha256.prototype.digest=function(encoding){if(!this.finished){var bitsHashed=8*this.bytesHashed,bufferView=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),undecoratedLength=this.bufferLength;if(bufferView.setUint8(this.bufferLength++,128),undecoratedLength%64>=56){for(var i=this.bufferLength;i<64;i++)bufferView.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<56;i++)bufferView.setUint8(i,0);bufferView.setUint32(56,Math.floor(bitsHashed/4294967296),!0),bufferView.setUint32(60,bitsHashed),this.hashBuffer(),this.finished=!0}var out=new Buffer(32);for(i=0;i<8;i++)out[4*i]=this.state[i]>>>24&255,out[4*i+1]=this.state[i]>>>16&255,out[4*i+2]=this.state[i]>>>8&255,out[4*i+3]=this.state[i]>>>0&255;return encoding?out.toString(encoding):out},Sha256.prototype.hashBuffer=function(){for(var buffer=this.buffer,state=this.state,state0=state[0],state1=state[1],state2=state[2],state3=state[3],state4=state[4],state5=state[5],state6=state[6],state7=state[7],i=0;i<64;i++){if(i<16)this.temp[i]=(255&buffer[4*i])<<24|(255&buffer[4*i+1])<<16|(255&buffer[4*i+2])<<8|255&buffer[4*i+3];else{var u=this.temp[i-2],t1_1=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,t2_1=((u=this.temp[i-15])>>>7|u<<25)^(u>>>18|u<<14)^u>>>3;this.temp[i]=(t1_1+this.temp[i-7]|0)+(t2_1+this.temp[i-16]|0)}var t1=(((state4>>>6|state4<<26)^(state4>>>11|state4<<21)^(state4>>>25|state4<<7))+(state4&state5^~state4&state6)|0)+(state7+(KEY[i]+this.temp[i]|0)|0)|0,t2=((state0>>>2|state0<<30)^(state0>>>13|state0<<19)^(state0>>>22|state0<<10))+(state0&state1^state0&state2^state1&state2)|0;state7=state6,state6=state5,state5=state4,state4=state3+t1|0,state3=state2,state2=state1,state1=state0,state0=t1+t2|0}state[0]+=state0,state[1]+=state1,state[2]+=state2,state[3]+=state3,state[4]+=state4,state[5]+=state5,state[6]+=state6,state[7]+=state7}},{"./browserHashUtils":19,"buffer/":92}],24:[function(require,module,exports){(function(process){(function(){var util=require("./util");util.crypto.lib=require("./browserCryptoLib"),util.Buffer=require("buffer/").Buffer,util.url=require("url/"),util.querystring=require("querystring/"),util.realClock=require("./realclock/browserClock"),util.environment="js",util.createEventStream=require("./event-stream/buffered-create-event-stream").createEventStream,util.isBrowser=function(){return!0},util.isNode=function(){return!1};var AWS=require("./core");if(module.exports=AWS,require("./credentials"),require("./credentials/credential_provider_chain"),require("./credentials/temporary_credentials"),require("./credentials/chainable_temporary_credentials"),require("./credentials/web_identity_credentials"),require("./credentials/cognito_identity_credentials"),require("./credentials/saml_credentials"),AWS.XML.Parser=require("./xml/browser_parser"),require("./http/xhr"),void 0===process)var process={browser:!0}}).call(this)}).call(this,require("_process"))},{"./browserCryptoLib":18,"./core":27,"./credentials":28,"./credentials/chainable_temporary_credentials":29,"./credentials/cognito_identity_credentials":30,"./credentials/credential_provider_chain":31,"./credentials/saml_credentials":32,"./credentials/temporary_credentials":33,"./credentials/web_identity_credentials":34,"./event-stream/buffered-create-event-stream":36,"./http/xhr":44,"./realclock/browserClock":61,"./util":83,"./xml/browser_parser":84,_process:97,"buffer/":92,"querystring/":104,"url/":106}],25:[function(require,module,exports){var PromisesDependency,AWS=require("./core");require("./credentials"),require("./credentials/credential_provider_chain"),AWS.Config=AWS.util.inherit({constructor:function(options){void 0===options&&(options={}),options=this.extractCredentials(options),AWS.util.each.call(this,this.keys,function(key,value){this.set(key,options[key],value)})},getCredentials:function(callback){var err,self=this;function finish(err){callback(err,err?null:self.credentials)}function credError(msg,err){return new AWS.util.error(err||new Error,{code:"CredentialsError",message:msg,name:"CredentialsError"})}self.credentials?"function"==typeof self.credentials.get?self.credentials.get(function(err){err&&(err=credError("Could not load credentials from "+self.credentials.constructor.name,err)),finish(err)}):(err=null,self.credentials.accessKeyId&&self.credentials.secretAccessKey||(err=credError("Missing credentials")),finish(err)):self.credentialProvider?self.credentialProvider.resolve(function(err,creds){err&&(err=credError("Could not load credentials from any providers",err)),self.credentials=creds,finish(err)}):finish(credError("No credentials to load"))},update:function(options,allowUnknownKeys){allowUnknownKeys=allowUnknownKeys||!1,options=this.extractCredentials(options),AWS.util.each.call(this,options,function(key,value){(allowUnknownKeys||Object.prototype.hasOwnProperty.call(this.keys,key)||AWS.Service.hasService(key))&&this.set(key,value)})},loadFromPath:function(path){this.clear();var options=JSON.parse(AWS.util.readFileSync(path)),fileSystemCreds=new AWS.FileSystemCredentials(path),chain=new AWS.CredentialProviderChain;return chain.providers.unshift(fileSystemCreds),chain.resolve(function(err,creds){if(err)throw err;options.credentials=creds}),this.constructor(options),this},clear:function(){AWS.util.each.call(this,this.keys,function(key){delete this[key]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(property,value,defaultValue){void 0===value?(void 0===defaultValue&&(defaultValue=this.keys[property]),this[property]="function"==typeof defaultValue?defaultValue.call(this):defaultValue):"httpOptions"===property&&this[property]?this[property]=AWS.util.merge(this[property],value):this[property]=value},keys:{credentials:null,credentialProvider:null,region:null,logger:null,apiVersions:{},apiVersion:null,endpoint:void 0,httpOptions:{timeout:12e4},maxRetries:void 0,maxRedirects:10,paramValidation:!0,sslEnabled:!0,s3ForcePathStyle:!1,s3BucketEndpoint:!1,s3DisableBodySigning:!0,s3UsEast1RegionalEndpoint:"legacy",s3UseArnRegion:void 0,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0,retryDelayOptions:{},useAccelerateEndpoint:!1,clientSideMonitoring:!1,endpointDiscoveryEnabled:void 0,endpointCacheSize:1e3,hostPrefixEnabled:!0,stsRegionalEndpoints:"legacy"},extractCredentials:function(options){return options.accessKeyId&&options.secretAccessKey&&((options=AWS.util.copy(options)).credentials=new AWS.Credentials(options)),options},setPromisesDependency:function(dep){PromisesDependency=dep,null===dep&&"function"==typeof Promise&&(PromisesDependency=Promise);var constructors=[AWS.Request,AWS.Credentials,AWS.CredentialProviderChain];AWS.S3&&(constructors.push(AWS.S3),AWS.S3.ManagedUpload&&constructors.push(AWS.S3.ManagedUpload)),AWS.util.addPromises(constructors,PromisesDependency)},getPromisesDependency:function(){return PromisesDependency}}),AWS.config=new AWS.Config},{"./core":27,"./credentials":28,"./credentials/credential_provider_chain":31}],26:[function(require,module,exports){(function(process){(function(){var AWS=require("./core");function validateRegionalEndpointsFlagValue(configValue,errorOptions){if("string"==typeof configValue){if(["legacy","regional"].indexOf(configValue.toLowerCase())>=0)return configValue.toLowerCase();throw AWS.util.error(new Error,errorOptions)}}module.exports=function(originalConfig,options){var resolved;if((originalConfig=originalConfig||{})[options.clientConfig]&&(resolved=validateRegionalEndpointsFlagValue(originalConfig[options.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+options.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+originalConfig[options.clientConfig]+'".'})))return resolved;if(!AWS.util.isNode())return resolved;if(Object.prototype.hasOwnProperty.call(process.env,options.env)&&(resolved=validateRegionalEndpointsFlagValue(process.env[options.env],{code:"InvalidEnvironmentalVariable",message:"invalid "+options.env+' environmental variable. Expect "legacy" or "regional". Got "'+process.env[options.env]+'".'})))return resolved;var profile={};try{profile=AWS.util.getProfilesFromSharedConfig(AWS.util.iniLoader)[process.env.AWS_PROFILE||AWS.util.defaultProfile]}catch(e){}return profile&&Object.prototype.hasOwnProperty.call(profile,options.sharedConfig)&&(resolved=validateRegionalEndpointsFlagValue(profile[options.sharedConfig],{code:"InvalidConfiguration",message:"invalid "+options.sharedConfig+' profile config. Expect "legacy" or "regional". Got "'+profile[options.sharedConfig]+'".'})),resolved}}).call(this)}).call(this,require("_process"))},{"./core":27,_process:97}],27:[function(require,module,exports){var AWS={util:require("./util")};({}).toString(),module.exports=AWS,AWS.util.update(AWS,{VERSION:"2.903.0",Signers:{},Protocol:{Json:require("./protocol/json"),Query:require("./protocol/query"),Rest:require("./protocol/rest"),RestJson:require("./protocol/rest_json"),RestXml:require("./protocol/rest_xml")},XML:{Builder:require("./xml/builder"),Parser:null},JSON:{Builder:require("./json/builder"),Parser:require("./json/parser")},Model:{Api:require("./model/api"),Operation:require("./model/operation"),Shape:require("./model/shape"),Paginator:require("./model/paginator"),ResourceWaiter:require("./model/resource_waiter")},apiLoader:require("./api_loader"),EndpointCache:require("../vendor/endpoint-cache").EndpointCache}),require("./sequential_executor"),require("./service"),require("./config"),require("./http"),require("./event_listeners"),require("./request"),require("./response"),require("./resource_waiter"),require("./signers/request_signer"),require("./param_validator"),AWS.events=new AWS.SequentialExecutor,AWS.util.memoizedProperty(AWS,"endpointCache",function(){return new AWS.EndpointCache(AWS.config.endpointCacheSize)},!0)},{"../vendor/endpoint-cache":115,"./api_loader":17,"./config":25,"./event_listeners":42,"./http":43,"./json/builder":45,"./json/parser":46,"./model/api":47,"./model/operation":49,"./model/paginator":50,"./model/resource_waiter":51,"./model/shape":52,"./param_validator":53,"./protocol/json":55,"./protocol/query":56,"./protocol/rest":57,"./protocol/rest_json":58,"./protocol/rest_xml":59,"./request":64,"./resource_waiter":65,"./response":66,"./sequential_executor":68,"./service":69,"./signers/request_signer":75,"./util":83,"./xml/builder":85}],28:[function(require,module,exports){var AWS=require("./core");AWS.Credentials=AWS.util.inherit({constructor:function(){if(AWS.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof arguments[0]){var creds=arguments[0].credentials||arguments[0];this.accessKeyId=creds.accessKeyId,this.secretAccessKey=creds.secretAccessKey,this.sessionToken=creds.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var currentTime=AWS.util.date.getDate().getTime(),adjustedTime=new Date(currentTime+1e3*this.expiryWindow);return!!(this.expireTime&&adjustedTime>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(callback){var self=this;this.needsRefresh()?this.refresh(function(err){err||(self.expired=!1),callback&&callback(err)}):callback&&callback()},refresh:function(callback){this.expired=!1,callback()},coalesceRefresh:function(callback,sync){var self=this;1===self.refreshCallbacks.push(callback)&&self.load(function(err){AWS.util.arrayEach(self.refreshCallbacks,function(callback){sync?callback(err):AWS.util.defer(function(){callback(err)})}),self.refreshCallbacks.length=0})},load:function(callback){callback()}}),AWS.Credentials.addPromisesToClass=function(PromiseDependency){this.prototype.getPromise=AWS.util.promisifyMethod("get",PromiseDependency),this.prototype.refreshPromise=AWS.util.promisifyMethod("refresh",PromiseDependency)},AWS.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},AWS.util.addPromises(AWS.Credentials)},{"./core":27}],29:[function(require,module,exports){var AWS=require("../core"),STS=require("../../clients/sts");AWS.ChainableTemporaryCredentials=AWS.util.inherit(AWS.Credentials,{constructor:function(options){AWS.Credentials.call(this),options=options||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var params=AWS.util.copy(options.params)||{};if(params.RoleArn&&(params.RoleSessionName=params.RoleSessionName||"temporary-credentials"),params.SerialNumber){if(!options.tokenCodeFn||"function"!=typeof options.tokenCodeFn)throw new AWS.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=options.tokenCodeFn}var config=AWS.util.merge({params:params,credentials:options.masterCredentials||AWS.config.credentials},options.stsConfig||{});this.service=new STS(config)},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this,operation=self.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(err,tokenCode){var params={};err?callback(err):(tokenCode&&(params.TokenCode=tokenCode),self.service[operation](params,function(err,data){err||self.service.credentialsFrom(data,self),callback(err)}))})},getTokenCode:function(callback){var self=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(err,token){if(err){var message=err;return err instanceof Error&&(message=err.message),void callback(AWS.util.error(new Error("Error fetching MFA token: "+message),{code:self.errorCode}))}callback(null,token)}):callback(null)}})},{"../../clients/sts":16,"../core":27}],30:[function(require,module,exports){var AWS=require("../core"),CognitoIdentity=require("../../clients/cognitoidentity"),STS=require("../../clients/sts");AWS.CognitoIdentityCredentials=AWS.util.inherit(AWS.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(params,clientConfig){AWS.Credentials.call(this),this.expired=!0,this.params=params,this.data=null,this._identityId=null,this._clientConfig=AWS.util.copy(clientConfig||{}),this.loadCachedId();var self=this;Object.defineProperty(this,"identityId",{get:function(){return self.loadCachedId(),self._identityId||self.params.IdentityId},set:function(identityId){self._identityId=identityId}})},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this;self.createClients(),self.data=null,self._identityId=null,self.getId(function(err){err?(self.clearIdOnNotAuthorized(err),callback(err)):self.params.RoleArn?self.getCredentialsFromSTS(callback):self.getCredentialsForIdentity(callback)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var poolId=this.params.IdentityPoolId,loginId=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+poolId+loginId],delete this.storage[this.localStorageKey.providers+poolId+loginId]},clearIdOnNotAuthorized:function(err){"NotAuthorizedException"==err.code&&this.clearCachedId()},getId:function(callback){var self=this;if("string"==typeof self.params.IdentityId)return callback(null,self.params.IdentityId);self.cognito.getId(function(err,data){!err&&data.IdentityId?(self.params.IdentityId=data.IdentityId,callback(null,data.IdentityId)):callback(err)})},loadCredentials:function(data,credentials){data&&credentials&&(credentials.expired=!1,credentials.accessKeyId=data.Credentials.AccessKeyId,credentials.secretAccessKey=data.Credentials.SecretKey,credentials.sessionToken=data.Credentials.SessionToken,credentials.expireTime=data.Credentials.Expiration)},getCredentialsForIdentity:function(callback){var self=this;self.cognito.getCredentialsForIdentity(function(err,data){err?self.clearIdOnNotAuthorized(err):(self.cacheId(data),self.data=data,self.loadCredentials(self.data,self)),callback(err)})},getCredentialsFromSTS:function(callback){var self=this;self.cognito.getOpenIdToken(function(err,data){err?(self.clearIdOnNotAuthorized(err),callback(err)):(self.cacheId(data),self.params.WebIdentityToken=data.Token,self.webIdentityCredentials.refresh(function(webErr){webErr||(self.data=self.webIdentityCredentials.data,self.sts.credentialsFrom(self.data,self)),callback(webErr)}))})},loadCachedId:function(){if(AWS.util.isBrowser()&&!this.params.IdentityId){var id=this.getStorage("id");if(id&&this.params.Logins){var actualProviders=Object.keys(this.params.Logins);0!==(this.getStorage("providers")||"").split(",").filter(function(n){return-1!==actualProviders.indexOf(n)}).length&&(this.params.IdentityId=id)}else id&&(this.params.IdentityId=id)}},createClients:function(){var clientConfig=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new AWS.WebIdentityCredentials(this.params,clientConfig),!this.cognito){var cognitoConfig=AWS.util.merge({},clientConfig);cognitoConfig.params=this.params,this.cognito=new CognitoIdentity(cognitoConfig)}this.sts=this.sts||new STS(clientConfig)},cacheId:function(data){this._identityId=data.IdentityId,this.params.IdentityId=this._identityId,AWS.util.isBrowser()&&(this.setStorage("id",data.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(key){return this.storage[this.localStorageKey[key]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(key,val){try{this.storage[this.localStorageKey[key]+this.params.IdentityPoolId+(this.params.LoginId||"")]=val}catch(_){}},storage:function(){try{var storage=AWS.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return storage["aws.test-storage"]="foobar",delete storage["aws.test-storage"],storage}catch(_){return{}}}()})},{"../../clients/cognitoidentity":15,"../../clients/sts":16,"../core":27}],31:[function(require,module,exports){var AWS=require("../core");AWS.CredentialProviderChain=AWS.util.inherit(AWS.Credentials,{constructor:function(providers){this.providers=providers||AWS.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(callback){var self=this;if(0===self.providers.length)return callback(new Error("No providers")),self;if(1===self.resolveCallbacks.push(callback)){var index=0,providers=self.providers.slice(0);!function resolveNext(err,creds){if(!err&&creds||index===providers.length)return AWS.util.arrayEach(self.resolveCallbacks,function(callback){callback(err,creds)}),void(self.resolveCallbacks.length=0);var provider=providers[index++];(creds="function"==typeof provider?provider.call():provider).get?creds.get(function(getErr){resolveNext(getErr,getErr?null:creds)}):resolveNext(null,creds)}()}return self}}),AWS.CredentialProviderChain.defaultProviders=[],AWS.CredentialProviderChain.addPromisesToClass=function(PromiseDependency){this.prototype.resolvePromise=AWS.util.promisifyMethod("resolve",PromiseDependency)},AWS.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},AWS.util.addPromises(AWS.CredentialProviderChain)},{"../core":27}],32:[function(require,module,exports){var AWS=require("../core"),STS=require("../../clients/sts");AWS.SAMLCredentials=AWS.util.inherit(AWS.Credentials,{constructor:function(params){AWS.Credentials.call(this),this.expired=!0,this.params=params},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this;self.createClients(),self.service.assumeRoleWithSAML(function(err,data){err||self.service.credentialsFrom(data,self),callback(err)})},createClients:function(){this.service=this.service||new STS({params:this.params})}})},{"../../clients/sts":16,"../core":27}],33:[function(require,module,exports){var AWS=require("../core"),STS=require("../../clients/sts");AWS.TemporaryCredentials=AWS.util.inherit(AWS.Credentials,{constructor:function(params,masterCredentials){AWS.Credentials.call(this),this.loadMasterCredentials(masterCredentials),this.expired=!0,this.params=params||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this;self.createClients(),self.masterCredentials.get(function(){self.service.config.credentials=self.masterCredentials,(self.params.RoleArn?self.service.assumeRole:self.service.getSessionToken).call(self.service,function(err,data){err||self.service.credentialsFrom(data,self),callback(err)})})},loadMasterCredentials:function(masterCredentials){for(this.masterCredentials=masterCredentials||AWS.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;"function"!=typeof this.masterCredentials.get&&(this.masterCredentials=new AWS.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new STS({params:this.params})}})},{"../../clients/sts":16,"../core":27}],34:[function(require,module,exports){var AWS=require("../core"),STS=require("../../clients/sts");AWS.WebIdentityCredentials=AWS.util.inherit(AWS.Credentials,{constructor:function(params,clientConfig){AWS.Credentials.call(this),this.expired=!0,this.params=params,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=AWS.util.copy(clientConfig||{})},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this;self.createClients(),self.service.assumeRoleWithWebIdentity(function(err,data){self.data=null,err||(self.data=data,self.service.credentialsFrom(data,self)),callback(err)})},createClients:function(){if(!this.service){var stsConfig=AWS.util.merge({},this._clientConfig);stsConfig.params=this.params,this.service=new STS(stsConfig)}}})},{"../../clients/sts":16,"../core":27}],35:[function(require,module,exports){(function(process){(function(){var AWS=require("./core"),util=require("./util"),endpointDiscoveryEnabledEnvs=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function getCacheKey(request){var service=request.service,api=service.api||{},identifiers=(api.operations,{});return service.config.region&&(identifiers.region=service.config.region),api.serviceId&&(identifiers.serviceId=api.serviceId),service.config.credentials.accessKeyId&&(identifiers.accessKeyId=service.config.credentials.accessKeyId),identifiers}function marshallCustomIdentifiers(request,shape){var identifiers={};return function marshallCustomIdentifiersHelper(result,params,shape){shape&&null!=params&&"structure"===shape.type&&shape.required&&shape.required.length>0&&util.arrayEach(shape.required,function(name){var memberShape=shape.members[name];if(!0===memberShape.endpointDiscoveryId){var locationName=memberShape.isLocationName?memberShape.name:name;result[locationName]=String(params[name])}else marshallCustomIdentifiersHelper(result,params[name],memberShape)})}(identifiers,request.params,shape),identifiers}function optionalDiscoverEndpoint(request){var service=request.service,api=service.api,operationModel=api.operations?api.operations[request.operation]:void 0,identifiers=marshallCustomIdentifiers(request,operationModel?operationModel.input:void 0),cacheKey=getCacheKey(request);Object.keys(identifiers).length>0&&(cacheKey=util.update(cacheKey,identifiers),operationModel&&(cacheKey.operation=operationModel.name));var endpoints=AWS.endpointCache.get(cacheKey);if(!endpoints||1!==endpoints.length||""!==endpoints[0].Address)if(endpoints&&endpoints.length>0)request.httpRequest.updateEndpoint(endpoints[0].Address);else{var endpointRequest=service.makeRequest(api.endpointOperation,{Operation:operationModel.name,Identifiers:identifiers});addApiVersionHeader(endpointRequest),endpointRequest.removeListener("validate",AWS.EventListeners.Core.VALIDATE_PARAMETERS),endpointRequest.removeListener("retry",AWS.EventListeners.Core.RETRY_CHECK),AWS.endpointCache.put(cacheKey,[{Address:"",CachePeriodInMinutes:1}]),endpointRequest.send(function(err,data){data&&data.Endpoints?AWS.endpointCache.put(cacheKey,data.Endpoints):err&&AWS.endpointCache.put(cacheKey,[{Address:"",CachePeriodInMinutes:1}])})}}var requestQueue={};function requiredDiscoverEndpoint(request,done){var service=request.service,api=service.api,operationModel=api.operations?api.operations[request.operation]:void 0,inputShape=operationModel?operationModel.input:void 0,identifiers=marshallCustomIdentifiers(request,inputShape),cacheKey=getCacheKey(request);Object.keys(identifiers).length>0&&(cacheKey=util.update(cacheKey,identifiers),operationModel&&(cacheKey.operation=operationModel.name));var cacheKeyStr=AWS.EndpointCache.getKeyString(cacheKey),endpoints=AWS.endpointCache.get(cacheKeyStr);if(endpoints&&1===endpoints.length&&""===endpoints[0].Address)return requestQueue[cacheKeyStr]||(requestQueue[cacheKeyStr]=[]),void requestQueue[cacheKeyStr].push({request:request,callback:done});if(endpoints&&endpoints.length>0)request.httpRequest.updateEndpoint(endpoints[0].Address),done();else{var endpointRequest=service.makeRequest(api.endpointOperation,{Operation:operationModel.name,Identifiers:identifiers});endpointRequest.removeListener("validate",AWS.EventListeners.Core.VALIDATE_PARAMETERS),addApiVersionHeader(endpointRequest),AWS.endpointCache.put(cacheKeyStr,[{Address:"",CachePeriodInMinutes:60}]),endpointRequest.send(function(err,data){if(err){if(request.response.error=util.error(err,{retryable:!1}),AWS.endpointCache.remove(cacheKey),requestQueue[cacheKeyStr]){var pendingRequests=requestQueue[cacheKeyStr];util.arrayEach(pendingRequests,function(requestContext){requestContext.request.response.error=util.error(err,{retryable:!1}),requestContext.callback()}),delete requestQueue[cacheKeyStr]}}else if(data&&(AWS.endpointCache.put(cacheKeyStr,data.Endpoints),request.httpRequest.updateEndpoint(data.Endpoints[0].Address),requestQueue[cacheKeyStr])){pendingRequests=requestQueue[cacheKeyStr];util.arrayEach(pendingRequests,function(requestContext){requestContext.request.httpRequest.updateEndpoint(data.Endpoints[0].Address),requestContext.callback()}),delete requestQueue[cacheKeyStr]}done()})}}function addApiVersionHeader(endpointRequest){var apiVersion=endpointRequest.service.api.apiVersion;apiVersion&&!endpointRequest.httpRequest.headers["x-amz-api-version"]&&(endpointRequest.httpRequest.headers["x-amz-api-version"]=apiVersion)}function invalidateCachedEndpoints(response){var error=response.error,httpResponse=response.httpResponse;if(error&&("InvalidEndpointException"===error.code||421===httpResponse.statusCode)){var request=response.request,operations=request.service.api.operations||{},identifiers=marshallCustomIdentifiers(request,operations[request.operation]?operations[request.operation].input:void 0),cacheKey=getCacheKey(request);Object.keys(identifiers).length>0&&(cacheKey=util.update(cacheKey,identifiers),operations[request.operation]&&(cacheKey.operation=operations[request.operation].name)),AWS.endpointCache.remove(cacheKey)}}function isFalsy(value){return["false","0"].indexOf(value)>=0}module.exports={discoverEndpoint:function(request,done){var service=request.service||{};if(function(client){if(client._originalConfig&&client._originalConfig.endpoint&&!0===client._originalConfig.endpointDiscoveryEnabled)throw util.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var svcConfig=AWS.config[client.serviceIdentifier]||{};return Boolean(AWS.config.endpoint||svcConfig.endpoint||client._originalConfig&&client._originalConfig.endpoint)}(service)||request.isPresigned())return done();var operationModel=(service.api.operations||{})[request.operation],isEndpointDiscoveryRequired=operationModel?operationModel.endpointDiscoveryRequired:"NULL",isEnabled=function(request){var service=request.service||{};if(void 0!==service.config.endpointDiscoveryEnabled)return service.config.endpointDiscoveryEnabled;if(!util.isBrowser()){for(var i=0;i-1&&(bytes[i]++,0===bytes[i]);i--);}Int64.fromNumber=function(number){if(number>0x8000000000000000||number<-0x8000000000000000)throw new Error(number+" is too large (or, if negative, too small) to represent as an Int64");for(var bytes=new Uint8Array(8),i=7,remaining=Math.abs(Math.round(number));i>-1&&remaining>0;i--,remaining/=256)bytes[i]=remaining;return number<0&&negate(bytes),new Int64(bytes)},Int64.prototype.valueOf=function(){var bytes=this.bytes.slice(0),negative=128&bytes[0];return negative&&negate(bytes),parseInt(bytes.toString("hex"),16)*(negative?-1:1)},Int64.prototype.toString=function(){return String(this.valueOf())},module.exports={Int64:Int64}},{"../core":27}],39:[function(require,module,exports){var parseMessage=require("./parse-message").parseMessage;module.exports={parseEvent:function(parser,message,shape){var parsedMessage=parseMessage(message),messageType=parsedMessage.headers[":message-type"];if(messageType){if("error"===messageType.value)throw function(message){var errorCode=message.headers[":error-code"],errorMessage=message.headers[":error-message"],error=new Error(errorMessage.value||errorMessage);return error.code=error.name=errorCode.value||errorCode,error}(parsedMessage);if("event"!==messageType.value)return}var eventType=parsedMessage.headers[":event-type"],eventModel=shape.members[eventType.value];if(eventModel){var result={},eventPayloadMemberName=eventModel.eventPayloadMemberName;if(eventPayloadMemberName){var payloadShape=eventModel.members[eventPayloadMemberName];"binary"===payloadShape.type?result[eventPayloadMemberName]=parsedMessage.body:result[eventPayloadMemberName]=parser.parse(parsedMessage.body.toString(),payloadShape)}for(var eventHeaderNames=eventModel.eventHeaderMemberNames,i=0;i=0)return req.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",done();AWS.util.computeSha256(body,function(err,sha){err?done(err):(req.httpRequest.headers["X-Amz-Content-Sha256"]=sha,done())})}else done()}}),add("SET_CONTENT_LENGTH","afterBuild",function(req){var authtype=function(req){if(!req.service.api.operations)return"";var operation=req.service.api.operations[req.operation];return operation?operation.authtype:""}(req),payloadMember=AWS.util.getRequestPayloadShape(req);if(void 0===req.httpRequest.headers["Content-Length"])try{var length=AWS.util.string.byteLength(req.httpRequest.body);req.httpRequest.headers["Content-Length"]=length}catch(err){if(payloadMember&&payloadMember.isStreaming){if(payloadMember.requiresLength)throw err;if(authtype.indexOf("unsigned-body")>=0)return void(req.httpRequest.headers["Transfer-Encoding"]="chunked");throw err}throw err}}),add("SET_HTTP_HOST","afterBuild",function(req){req.httpRequest.headers.Host=req.httpRequest.endpoint.host}),add("RESTART","restart",function(){var err=this.response.error;err&&err.retryable&&(this.httpRequest=new AWS.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=600?this.emit("sign",[this],function(err){err?done(err):executeSend()}):executeSend()}),add("HTTP_HEADERS","httpHeaders",function(statusCode,headers,resp,statusMessage){resp.httpResponse.statusCode=statusCode,resp.httpResponse.statusMessage=statusMessage,resp.httpResponse.headers=headers,resp.httpResponse.body=AWS.util.buffer.toBuffer(""),resp.httpResponse.buffers=[],resp.httpResponse.numBytes=0;var dateHeader=headers.date||headers.Date,service=resp.request.service;if(dateHeader){var serverTime=Date.parse(dateHeader);service.config.correctClockSkew&&service.isClockSkewed(serverTime)&&service.applyClockOffset(serverTime)}}),add("HTTP_DATA","httpData",function(chunk,resp){if(chunk){if(AWS.util.isNode()){resp.httpResponse.numBytes+=chunk.length;var total=resp.httpResponse.headers["content-length"],progress={loaded:resp.httpResponse.numBytes,total:total};resp.request.emit("httpDownloadProgress",[progress,resp])}resp.httpResponse.buffers.push(AWS.util.buffer.toBuffer(chunk))}}),add("HTTP_DONE","httpDone",function(resp){if(resp.httpResponse.buffers&&resp.httpResponse.buffers.length>0){var body=AWS.util.buffer.concat(resp.httpResponse.buffers);resp.httpResponse.body=body}delete resp.httpResponse.numBytes,delete resp.httpResponse.buffers}),add("FINALIZE_ERROR","retry",function(resp){resp.httpResponse.statusCode&&(resp.error.statusCode=resp.httpResponse.statusCode,void 0===resp.error.retryable&&(resp.error.retryable=this.service.retryableError(resp.error,this)))}),add("INVALIDATE_CREDENTIALS","retry",function(resp){if(resp.error)switch(resp.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":resp.error.retryable=!0,resp.request.service.config.credentials.expired=!0}}),add("EXPIRED_SIGNATURE","retry",function(resp){var err=resp.error;err&&"string"==typeof err.code&&"string"==typeof err.message&&err.code.match(/Signature/)&&err.message.match(/expired/)&&(resp.error.retryable=!0)}),add("CLOCK_SKEWED","retry",function(resp){resp.error&&this.service.clockSkewError(resp.error)&&this.service.config.correctClockSkew&&(resp.error.retryable=!0)}),add("REDIRECT","retry",function(resp){resp.error&&resp.error.statusCode>=300&&resp.error.statusCode<400&&resp.httpResponse.headers.location&&(this.httpRequest.endpoint=new AWS.Endpoint(resp.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,resp.error.redirect=!0,resp.error.retryable=!0)}),add("RETRY_CHECK","retry",function(resp){resp.error&&(resp.error.redirect&&resp.redirectCount=0?(resp.error=null,setTimeout(done,delay)):done()})}),CorePost:(new SequentialExecutor).addNamedListeners(function(add){add("EXTRACT_REQUEST_ID","extractData",AWS.util.extractRequestId),add("EXTRACT_REQUEST_ID","extractError",AWS.util.extractRequestId),add("ENOTFOUND_ERROR","httpError",function(err){if("NetworkingError"===err.code&&function(err){return"ENOTFOUND"===err.errno||"number"==typeof err.errno&&"function"==typeof AWS.util.getSystemErrorName&&["EAI_NONAME","EAI_NODATA"].indexOf(AWS.util.getSystemErrorName(err.errno)>=0)}(err)){var message="Inaccessible host: `"+err.hostname+"'. This service may not be available in the `"+err.region+"' region.";this.response.error=AWS.util.error(new Error(message),{code:"UnknownEndpoint",region:err.region,hostname:err.hostname,retryable:!0,originalError:err})}})}),Logger:(new SequentialExecutor).addNamedListeners(function(add){add("LOG_REQUEST","complete",function(resp){var req=resp.request,logger=req.service.config.logger;if(logger){var line=function(){var delta=(resp.request.service.getSkewCorrectedDate().getTime()-req.startTime.getTime())/1e3,ansi=!!logger.isTTY,status=resp.httpResponse.statusCode,censoredParams=req.params;req.service.api.operations&&req.service.api.operations[req.operation]&&req.service.api.operations[req.operation].input&&(censoredParams=function filterSensitiveLog(inputShape,shape){if(!shape)return shape;if(inputShape.isSensitive)return"***SensitiveInformation***";switch(inputShape.type){case"structure":var struct={};return AWS.util.each(shape,function(subShapeName,subShape){Object.prototype.hasOwnProperty.call(inputShape.members,subShapeName)?struct[subShapeName]=filterSensitiveLog(inputShape.members[subShapeName],subShape):struct[subShapeName]=subShape}),struct;case"list":var list=[];return AWS.util.arrayEach(shape,function(subShape,index){list.push(filterSensitiveLog(inputShape.member,subShape))}),list;case"map":var map={};return AWS.util.each(shape,function(key,value){map[key]=filterSensitiveLog(inputShape.value,value)}),map;default:return shape}}(req.service.api.operations[req.operation].input,req.params));var params=require("util").inspect(censoredParams,!0,null),message="";return ansi&&(message+=""),message+="[AWS "+req.service.serviceIdentifier+" "+status,message+=" "+delta.toString()+"s "+resp.retryCount+" retries]",ansi&&(message+=""),message+=" "+AWS.util.string.lowerFirst(req.operation),message+="("+params+")",ansi&&(message+=""),message}();"function"==typeof logger.log?logger.log(line):"function"==typeof logger.write&&logger.write(line+"\n")}})}),Json:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/json");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)}),Rest:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/rest");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)}),RestJson:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/rest_json");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)}),RestXml:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/rest_xml");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)}),Query:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/query");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)})}},{"./core":27,"./discover_endpoint":35,"./protocol/json":55,"./protocol/query":56,"./protocol/rest":57,"./protocol/rest_json":58,"./protocol/rest_xml":59,"./sequential_executor":68,util:109}],43:[function(require,module,exports){var AWS=require("./core"),inherit=AWS.util.inherit;AWS.Endpoint=inherit({constructor:function(endpoint,config){if(AWS.util.hideProperties(this,["slashes","auth","hash","search","query"]),null==endpoint)throw new Error("Invalid endpoint: "+endpoint);if("string"!=typeof endpoint)return AWS.util.copy(endpoint);endpoint.match(/^http/)||(endpoint=((config&&void 0!==config.sslEnabled?config.sslEnabled:AWS.config.sslEnabled)?"https":"http")+"://"+endpoint);AWS.util.update(this,AWS.util.urlParse(endpoint)),this.port?this.port=parseInt(this.port,10):this.port="https:"===this.protocol?443:80}}),AWS.HttpRequest=inherit({constructor:function(endpoint,region){endpoint=new AWS.Endpoint(endpoint),this.method="POST",this.path=endpoint.path||"/",this.headers={},this.body="",this.endpoint=endpoint,this.region=region,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=AWS.util.userAgent()},getUserAgentHeaderName:function(){return(AWS.util.isBrowser()?"X-Amz-":"")+"User-Agent"},appendToUserAgent:function(agentPartial){"string"==typeof agentPartial&&agentPartial&&(this._userAgent+=" "+agentPartial),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var query=this.path.split("?",2)[1];return query?(query=AWS.util.queryStringParse(query),AWS.util.queryParamsToString(query)):""},updateEndpoint:function(endpointStr){var newEndpoint=new AWS.Endpoint(endpointStr);this.endpoint=newEndpoint,this.path=newEndpoint.path||"/",this.headers.Host&&(this.headers.Host=newEndpoint.host)}}),AWS.HttpResponse=inherit({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}}),AWS.HttpClient=inherit({}),AWS.HttpClient.getInstance=function(){return void 0===this.singleton&&(this.singleton=new this),this.singleton}},{"./core":27}],44:[function(require,module,exports){var AWS=require("../core"),EventEmitter=require("events").EventEmitter;require("../http"),AWS.XHRGoogleClient=AWS.util.inherit({handleRequest:function(httpRequest,httpOptions,callback,errCallback){var endpoint=httpRequest.endpoint,emitter=new EventEmitter,href=endpoint.protocol+"//"+endpoint.hostname;80!==endpoint.port&&443!==endpoint.port&&(href+=":"+endpoint.port),href+=httpRequest.path,callback(emitter);var headers={};AWS.util.each(httpRequest.headers,function(key,value){"Content-Length"!==key&&"User-Agent"!==key&&"Host"!==key&&(headers[key]=value)});httpOptions.xhrWithCredentials;try{var options={method:httpRequest.method,contentType:httpRequest.headers["Content-Type"],headers:headers,muteHttpExceptions:!0,payload:httpRequest.body},response=UrlFetchApp.fetch(href,options),responseCode=response.getResponseCode(),responseText=response.getContentText();if(responseCode/100!=2)throw Error(responseText);emitter.statusCode=responseCode,emitter.headers=this.parseHeaders(response.getHeaders()),emitter.emit("headers",emitter.statusCode,emitter.headers),this.finishRequest(response.getBlob(),emitter)}catch(err){Logger.log(err),errCallback(AWS.util.error(new Error("Network Failure"),{code:"NetworkingError"}))}return emitter},parseHeaders:function(rawHeaders){return Object.fromEntries(Object.entries(rawHeaders).map(([k,v])=>[k.toLowerCase(),v]))},finishRequest:function(blob,emitter){var buffer;if("text/plain"!==blob.getContentType()){var ab=blob.getBytes();buffer=new AWS.util.Buffer(ab.length);for(var view=new Uint8Array(ab),i=0;i=this.HEADERS_RECEIVED&&!headersEmitted&&(emitter.statusCode=xhr.status,emitter.headers=self.parseHeaders(xhr.getAllResponseHeaders()),emitter.emit("headers",emitter.statusCode,emitter.headers,xhr.statusText),headersEmitted=!0),this.readyState===this.DONE&&self.finishRequest(xhr,emitter)},!1),xhr.upload.addEventListener("progress",function(evt){emitter.emit("sendProgress",evt)}),xhr.addEventListener("progress",function(evt){emitter.emit("receiveProgress",evt)},!1),xhr.addEventListener("timeout",function(){errCallback(AWS.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),xhr.addEventListener("error",function(){errCallback(AWS.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),xhr.addEventListener("abort",function(){errCallback(AWS.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))},!1),callback(emitter),xhr.open(httpRequest.method,href,!1!==httpOptions.xhrAsync),AWS.util.each(httpRequest.headers,function(key,value){"Content-Length"!==key&&"User-Agent"!==key&&"Host"!==key&&xhr.setRequestHeader(key,value)}),httpOptions.timeout&&!1!==httpOptions.xhrAsync&&(xhr.timeout=httpOptions.timeout),httpOptions.xhrWithCredentials&&(xhr.withCredentials=!0);try{xhr.responseType="arraybuffer"}catch(e){}try{httpRequest.body?xhr.send(httpRequest.body):xhr.send()}catch(err){if(!httpRequest.body||"object"!=typeof httpRequest.body.buffer)throw err;xhr.send(httpRequest.body.buffer)}return emitter},parseHeaders:function(rawHeaders){var headers={};return AWS.util.arrayEach(rawHeaders.split(/\r?\n/),function(line){var key=line.split(":",1)[0],value=line.substring(key.length+2);key.length>0&&(headers[key.toLowerCase()]=value)}),headers},finishRequest:function(xhr,emitter){var buffer;if("arraybuffer"===xhr.responseType&&xhr.response){var ab=xhr.response;buffer=new AWS.util.Buffer(ab.byteLength);for(var view=new Uint8Array(ab),i=0;i-1?value||"":value,this.isJsonValue?JSON.parse(value):value&&"function"==typeof value.toString?value.toString():value},this.toWireFormat=function(value){return this.isJsonValue?JSON.stringify(value):value}}function BinaryShape(){Shape.apply(this,arguments),this.toType=function(value){var buf=util.base64.decode(value);if(this.isSensitive&&util.isNode()&&"function"==typeof util.Buffer.alloc){var secureBuf=util.Buffer.alloc(buf.length,buf);buf.fill(0),buf=secureBuf}return buf},this.toWireFormat=util.base64.encode}function Base64Shape(){BinaryShape.apply(this,arguments)}function BooleanShape(){Shape.apply(this,arguments),this.toType=function(value){return"boolean"==typeof value?value:null==value?null:"true"===value}}Shape.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"},Shape.types={structure:StructureShape,list:ListShape,map:MapShape,boolean:BooleanShape,timestamp:function(shape){var self=this;if(Shape.apply(this,arguments),shape.timestampFormat)property(this,"timestampFormat",shape.timestampFormat);else if(self.isTimestampFormatSet&&this.timestampFormat)property(this,"timestampFormat",this.timestampFormat);else if("header"===this.location)property(this,"timestampFormat","rfc822");else if("querystring"===this.location)property(this,"timestampFormat","iso8601");else if(this.api)switch(this.api.protocol){case"json":case"rest-json":property(this,"timestampFormat","unixTimestamp");break;case"rest-xml":case"query":case"ec2":property(this,"timestampFormat","iso8601")}this.toType=function(value){return null==value?null:"function"==typeof value.toUTCString?value:"string"==typeof value||"number"==typeof value?util.date.parseTimestamp(value):null},this.toWireFormat=function(value){return util.date.format(value,self.timestampFormat)}},float:function(){Shape.apply(this,arguments),this.toType=function(value){return null==value?null:parseFloat(value)},this.toWireFormat=this.toType},integer:function(){Shape.apply(this,arguments),this.toType=function(value){return null==value?null:parseInt(value,10)},this.toWireFormat=this.toType},string:StringShape,base64:Base64Shape,binary:BinaryShape},Shape.resolve=function(shape,options){if(shape.shape){var refShape=options.api.shapes[shape.shape];if(!refShape)throw new Error("Cannot find shape reference: "+shape.shape);return refShape}return null},Shape.create=function(shape,options,memberName){if(shape.isShape)return shape;var refShape=Shape.resolve(shape,options);if(refShape){var filteredKeys=Object.keys(shape);options.documentation||(filteredKeys=filteredKeys.filter(function(name){return!name.match(/documentation/)}));var InlineShape=function(){refShape.constructor.call(this,shape,options,memberName)};return InlineShape.prototype=refShape,new InlineShape}shape.type||(shape.members?shape.type="structure":shape.member?shape.type="list":shape.key?shape.type="map":shape.type="string");var origType=shape.type;if(Shape.normalizedTypes[shape.type]&&(shape.type=Shape.normalizedTypes[shape.type]),Shape.types[shape.type])return new Shape.types[shape.type](shape,options,memberName);throw new Error("Unrecognized shape type: "+origType)},Shape.shapes={StructureShape:StructureShape,ListShape:ListShape,MapShape:MapShape,StringShape:StringShape,BooleanShape:BooleanShape,Base64Shape:Base64Shape},module.exports=Shape},{"../util":83,"./collection":48}],53:[function(require,module,exports){var AWS=require("./core");AWS.ParamValidator=AWS.util.inherit({constructor:function(validation){!0!==validation&&void 0!==validation||(validation={min:!0}),this.validation=validation},validate:function(shape,params,context){if(this.errors=[],this.validateMember(shape,params||{},context||"params"),this.errors.length>1){var msg=this.errors.join("\n* ");throw msg="There were "+this.errors.length+" validation errors:\n* "+msg,AWS.util.error(new Error(msg),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(code,message){this.errors.push(AWS.util.error(new Error(message),{code:code}))},validateStructure:function(shape,params,context){var paramName;this.validateType(params,context,["object"],"structure");for(var i=0;shape.required&&i= 1, but found "'+value+'" for '+context)},validatePattern:function(shape,value,context){this.validation.pattern&&void 0!==shape.pattern&&(new RegExp(shape.pattern).test(value)||this.fail("PatternMatchError",'Provided value "'+value+'" does not match regex pattern /'+shape.pattern+"/ for "+context))},validateRange:function(shape,value,context,descriptor){this.validation.min&&void 0!==shape.min&&value= "+shape.min+", but found "+value+" for "+context),this.validation.max&&void 0!==shape.max&&value>shape.max&&this.fail("MaxRangeError","Expected "+descriptor+" <= "+shape.max+", but found "+value+" for "+context)},validateEnum:function(shape,value,context){this.validation.enum&&void 0!==shape.enum&&-1===shape.enum.indexOf(value)&&this.fail("EnumError","Found string value of "+value+", but expected "+shape.enum.join("|")+" for "+context)},validateType:function(value,context,acceptedTypes,type){if(null==value)return!1;for(var foundInvalidType=!1,i=0;i63)throw util.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!hostPattern.test(label))throw AWS.util.error(new Error,{code:"ValidationError",message:label+" is not hostname compatible."})})}var endpoint,prefix;return request}}},{"../core":27,"../util":83}],55:[function(require,module,exports){var util=require("../util"),JsonBuilder=require("../json/builder"),JsonParser=require("../json/parser"),populateHostPrefix=require("./helpers").populateHostPrefix;module.exports={buildRequest:function(req){var httpRequest=req.httpRequest,api=req.service.api,target=api.targetPrefix+"."+api.operations[req.operation].name,version=api.jsonVersion||"1.0",input=api.operations[req.operation].input,builder=new JsonBuilder;1===version&&(version="1.0"),httpRequest.body=builder.build(req.params||{},input),httpRequest.headers["Content-Type"]="application/x-amz-json-"+version,httpRequest.headers["X-Amz-Target"]=target,populateHostPrefix(req)},extractError:function(resp){var error={},httpResponse=resp.httpResponse;if(error.code=httpResponse.headers["x-amzn-errortype"]||"UnknownError","string"==typeof error.code&&(error.code=error.code.split(":")[0]),httpResponse.body.length>0)try{var e=JSON.parse(httpResponse.body.toString()),code=e.__type||e.code||e.Code;code&&(error.code=code.split("#").pop()),"RequestEntityTooLarge"===error.code?error.message="Request body must be less than 1 MB":error.message=e.message||e.Message||null}catch(e){error.statusCode=httpResponse.statusCode,error.message=httpResponse.statusMessage}else error.statusCode=httpResponse.statusCode,error.message=httpResponse.statusCode.toString();resp.error=util.error(new Error,error)},extractData:function(resp){var body=resp.httpResponse.body.toString()||"{}";if(!1===resp.request.service.config.convertResponseTypes)resp.data=JSON.parse(body);else{var shape=resp.request.service.api.operations[resp.request.operation].output||{},parser=new JsonParser;resp.data=parser.parse(body,shape)}}}},{"../json/builder":45,"../json/parser":46,"../util":83,"./helpers":54}],56:[function(require,module,exports){var AWS=require("../core"),util=require("../util"),QueryParamSerializer=require("../query/query_param_serializer"),Shape=require("../model/shape"),populateHostPrefix=require("./helpers").populateHostPrefix;module.exports={buildRequest:function(req){var operation=req.service.api.operations[req.operation],httpRequest=req.httpRequest;httpRequest.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",httpRequest.params={Version:req.service.api.apiVersion,Action:operation.name},(new QueryParamSerializer).serialize(req.params,operation.input,function(name,value){httpRequest.params[name]=value}),httpRequest.body=util.queryParamsToString(httpRequest.params),populateHostPrefix(req)},extractError:function(resp){var data,body=resp.httpResponse.body.toString();if(body.match("=0?"&":"?";var parts=[];util.arrayEach(Object.keys(queryString).sort(),function(key){Array.isArray(queryString[key])||(queryString[key]=[queryString[key]]);for(var i=0;i0){var data=(parser=new AWS.XML.Parser).parse(body.toString(),output);util.update(resp.data,data)}}}},{"../core":27,"../util":83,"./rest":57}],60:[function(require,module,exports){var util=require("../util");function QueryParamSerializer(){}function ucfirst(shape){return shape.isQueryName||"ec2"!==shape.api.protocol?shape.name:shape.name[0].toUpperCase()+shape.name.substr(1)}function serializeStructure(prefix,struct,rules,fn){util.each(rules.members,function(name,member){var value=struct[name];if(null!=value){var memberName=ucfirst(member);serializeMember(memberName=prefix?prefix+"."+memberName:memberName,value,member,fn)}})}function serializeMember(name,value,rules,fn){null!=value&&("structure"===rules.type?serializeStructure(name,value,rules,fn):"list"===rules.type?function(name,list,rules,fn){var memberRules=rules.member||{};0!==list.length?util.arrayEach(list,function(v,n){var suffix="."+(n+1);if("ec2"===rules.api.protocol)suffix+="";else if(rules.flattened){if(memberRules.name){var parts=name.split(".");parts.pop(),parts.push(ucfirst(memberRules)),name=parts.join(".")}}else suffix="."+(memberRules.name?memberRules.name:"member")+suffix;serializeMember(name+suffix,v,memberRules,fn)}):fn.call(this,name,null)}(name,value,rules,fn):"map"===rules.type?function(name,map,rules,fn){var i=1;util.each(map,function(key,value){var position=(rules.flattened?".":".entry.")+i+++".",keyName=position+(rules.key.name||"key"),valueName=position+(rules.value.name||"value");serializeMember(name+keyName,key,rules.key,fn),serializeMember(name+valueName,value,rules.value,fn)})}(name,value,rules,fn):fn(name,rules.toWireFormat(value).toString()))}QueryParamSerializer.prototype.serialize=function(params,shape,fn){serializeStructure("",params,shape,fn)},module.exports=QueryParamSerializer},{"../util":83}],61:[function(require,module,exports){module.exports={now:function(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}}},{}],62:[function(require,module,exports){var util=require("./util"),regionConfig=require("./region_config_data.json");function applyConfig(service,config){util.each(config,function(key,value){"globalEndpoint"!==key&&(void 0!==service.config[key]&&null!==service.config[key]||(service.config[key]=value))})}module.exports={configureEndpoint:function(service){for(var keys=function(service){var region=service.config.region,regionPrefix=function(region){if(!region)return null;var parts=region.split("-");return parts.length<3?null:parts.slice(0,parts.length-2).join("-")+"-*"}(region),endpointPrefix=service.api.endpointPrefix;return[[region,endpointPrefix],[regionPrefix,endpointPrefix],[region,"*"],[regionPrefix,"*"],["*",endpointPrefix],["*","*"]].map(function(item){return item[0]&&item[1]?item.join("/"):null})}(service),i=0;i=0){shouldCheckContentLength=!0;var receivedLen=0}var checkContentLengthAndEmit=function(){shouldCheckContentLength&&receivedLen!==expectedLen?stream.emit("error",AWS.util.error(new Error("Stream content length mismatch. Received "+receivedLen+" of "+expectedLen+" bytes."),{code:"StreamContentLengthMismatch"})):2===AWS.HttpClient.streamsApiVersion?stream.end():stream.emit("end")},httpStream=resp.httpResponse.createUnbufferedStream();if(2===AWS.HttpClient.streamsApiVersion)if(shouldCheckContentLength){var lengthAccumulator=new streams.PassThrough;lengthAccumulator._write=function(chunk){return chunk&&chunk.length&&(receivedLen+=chunk.length),streams.PassThrough.prototype._write.apply(this,arguments)},lengthAccumulator.on("end",checkContentLengthAndEmit),stream.on("error",function(err){shouldCheckContentLength=!1,httpStream.unpipe(lengthAccumulator),lengthAccumulator.emit("end"),lengthAccumulator.end()}),httpStream.pipe(lengthAccumulator).pipe(stream,{end:!1})}else httpStream.pipe(stream);else shouldCheckContentLength&&httpStream.on("data",function(arg){arg&&arg.length&&(receivedLen+=arg.length)}),httpStream.on("data",function(arg){stream.emit("data",arg)}),httpStream.on("end",checkContentLengthAndEmit);httpStream.on("error",function(err){shouldCheckContentLength=!1,stream.emit("error",err)})}}),stream},emitEvent:function(eventName,args,done){"function"==typeof args&&(done=args,args=null),done||(done=function(){}),args||(args=this.eventParameters(eventName,this.response)),AWS.SequentialExecutor.prototype.emit.call(this,eventName,args,function(err){err&&(this.response.error=err),done.call(this,err)})},eventParameters:function(eventName){switch(eventName){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(expires,callback){return callback||"function"!=typeof expires||(callback=expires,expires=null),(new AWS.Signers.Presign).sign(this.toGet(),expires,callback)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",AWS.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",AWS.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(request){request.httpRequest.method="GET",request.httpRequest.path=request.service.endpoint.path+"?"+request.httpRequest.body,request.httpRequest.body="",delete request.httpRequest.headers["Content-Length"],delete request.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),AWS.Request.addPromisesToClass=function(PromiseDependency){this.prototype.promise=function(){var self=this;return this.httpRequest.appendToUserAgent("promise"),new PromiseDependency(function(resolve,reject){self.on("complete",function(resp){resp.error?reject(resp.error):resolve(Object.defineProperty(resp.data||{},"$response",{value:resp}))}),self.runTo()})}},AWS.Request.deletePromisesFromClass=function(){delete this.prototype.promise},AWS.util.addPromises(AWS.Request),AWS.util.mixin(AWS.Request,AWS.SequentialExecutor)}).call(this)}).call(this,require("_process"))},{"./core":27,"./state_machine":82,_process:97,jmespath:96}],65:[function(require,module,exports){var AWS=require("./core"),inherit=AWS.util.inherit,jmespath=require("jmespath");function CHECK_ACCEPTORS(resp){var waiter=resp.request._waiter,acceptors=waiter.config.acceptors,acceptorMatched=!1,state="retry";acceptors.forEach(function(acceptor){if(!acceptorMatched){var matcher=waiter.matchers[acceptor.matcher];matcher&&matcher(resp,acceptor.expected,acceptor.argument)&&(acceptorMatched=!0,state=acceptor.state)}}),!acceptorMatched&&resp.error&&(state="failure"),"success"===state?waiter.setSuccess(resp):waiter.setError(resp,"retry"===state)}AWS.ResourceWaiter=inherit({constructor:function(service,state){this.service=service,this.state=state,this.loadWaiterConfig(this.state)},service:null,state:null,config:null,matchers:{path:function(resp,expected,argument){try{var result=jmespath.search(resp.data,argument)}catch(err){return!1}return jmespath.strictDeepEqual(result,expected)},pathAll:function(resp,expected,argument){try{var results=jmespath.search(resp.data,argument)}catch(err){return!1}Array.isArray(results)||(results=[results]);var numResults=results.length;if(!numResults)return!1;for(var ind=0;ind=1&&self.doneParts===self.numParts&&self.finishMultiPart()}))}runFill&&self.fillQueue.call(self)},abort:function(){!0===this.isDoneChunking&&1===this.totalPartNumbers&&this.singlePart?this.singlePart.abort():this.cleanup(AWS.util.error(new Error("Request aborted by user"),{code:"RequestAbortedError",retryable:!1}))},validateBody:function(){if(this.body=this.service.config.params.Body,"string"==typeof this.body)this.body=AWS.util.buffer.toBuffer(this.body);else if(!this.body)throw new Error("params.Body is required");this.sliceFn=AWS.util.arraySliceFn(this.body)},bindServiceObject:function(params){params=params||{};if(this.service){var service=this.service,config=AWS.util.copy(service.config);config.signatureVersion=service.getSignatureVersion(),this.service=new service.constructor.__super__(config),this.service.config.params=AWS.util.merge(this.service.config.params||{},params),Object.defineProperty(this.service,"_originalConfig",{get:function(){return service._originalConfig},enumerable:!1,configurable:!0})}else this.service=new AWS.S3({params:params})},adjustTotalBytes:function(){try{this.totalBytes=byteLength(this.body)}catch(e){}if(this.totalBytes){var newPartSize=Math.ceil(this.totalBytes/this.maxTotalParts);newPartSize>this.partSize&&(this.partSize=newPartSize)}else this.totalBytes=void 0},isDoneChunking:!1,partPos:0,totalChunkedBytes:0,totalUploadedBytes:0,totalBytes:void 0,numParts:0,totalPartNumbers:0,activeParts:0,doneParts:0,parts:null,completeInfo:null,failed:!1,multipartReq:null,partBuffers:null,partBufferLength:0,fillBuffer:function(){var bodyLen=byteLength(this.body);if(0===bodyLen)return this.isDoneChunking=!0,this.numParts=1,void this.nextChunk(this.body);for(;this.activeParts=this.queueSize)){var buf=this.body.read(this.partSize-this.partBufferLength)||this.body.read();if(buf&&(this.partBuffers.push(buf),this.partBufferLength+=buf.length,this.totalChunkedBytes+=buf.length),this.partBufferLength>=this.partSize){var pbuf=1===this.partBuffers.length?this.partBuffers[0]:Buffer.concat(this.partBuffers);if(this.partBuffers=[],this.partBufferLength=0,pbuf.length>this.partSize){var rest=pbuf.slice(this.partSize);this.partBuffers.push(rest),this.partBufferLength+=rest.length,pbuf=pbuf.slice(0,this.partSize)}this.nextChunk(pbuf)}this.isDoneChunking&&!this.isDoneSending&&(pbuf=1===this.partBuffers.length?this.partBuffers[0]:Buffer.concat(this.partBuffers),this.partBuffers=[],this.partBufferLength=0,this.totalBytes=this.totalChunkedBytes,this.isDoneSending=!0,(0===this.numParts||pbuf.length>0)&&(this.numParts++,this.nextChunk(pbuf))),this.body.read(0)}},nextChunk:function(chunk){var self=this;if(self.failed)return null;var partNumber=++self.totalPartNumbers;if(self.isDoneChunking&&1===partNumber){var params={Body:chunk};this.tags&&(params.Tagging=this.getTaggingHeader());var req=self.service.putObject(params);return req._managedUpload=self,req.on("httpUploadProgress",self.progress).send(self.finishSinglePart),self.singlePart=req,null}if(self.service.config.params.ContentMD5){var err=AWS.util.error(new Error("The Content-MD5 you specified is invalid for multi-part uploads."),{code:"InvalidDigest",retryable:!1});return self.cleanup(err),null}if(self.completeInfo[partNumber]&&null!==self.completeInfo[partNumber].ETag)return null;self.activeParts++,self.service.config.params.UploadId?self.uploadPart(chunk,partNumber):self.multipartReq?self.queueChunks(chunk,partNumber):(self.multipartReq=self.service.createMultipartUpload(),self.multipartReq.on("success",function(resp){self.service.config.params.UploadId=resp.data.UploadId,self.multipartReq=null}),self.queueChunks(chunk,partNumber),self.multipartReq.on("error",function(err){self.cleanup(err)}),self.multipartReq.send())},getTaggingHeader:function(){for(var kvPairStrings=[],i=0;i-1&&listeners.splice(position,1)}return this},removeAllListeners:function(eventName){return eventName?delete this._events[eventName]:this._events={},this},emit:function(eventName,eventArgs,doneCallback){doneCallback||(doneCallback=function(){});var listeners=this.listeners(eventName),count=listeners.length;return this.callListeners(listeners,eventArgs,doneCallback),count>0},callListeners:function(listeners,args,doneCallback,prevError){var self=this,error=prevError||null;function callNextListener(err){if(err&&(error=AWS.util.error(error||new Error,err),self._haltHandlersOnError))return doneCallback.call(self,error);self.callListeners(listeners,args,doneCallback,error)}for(;listeners.length>0;){var listener=listeners.shift();if(listener._isAsync)return void listener.apply(self,args.concat([callNextListener]));try{listener.apply(self,args)}catch(err){error=AWS.util.error(error||new Error,err)}if(error&&self._haltHandlersOnError)return void doneCallback.call(self,error)}doneCallback.call(self,error)},addListeners:function(listeners){var self=this;return listeners._events&&(listeners=listeners._events),AWS.util.each(listeners,function(event,callbacks){"function"==typeof callbacks&&(callbacks=[callbacks]),AWS.util.arrayEach(callbacks,function(callback){self.on(event,callback)})}),self},addNamedListener:function(name,eventName,callback,toHead){return this[name]=callback,this.addListener(eventName,callback,toHead),this},addNamedAsyncListener:function(name,eventName,callback,toHead){return callback._isAsync=!0,this.addNamedListener(name,eventName,callback,toHead)},addNamedListeners:function(callback){var self=this;return callback(function(){self.addNamedListener.apply(self,arguments)},function(){self.addNamedAsyncListener.apply(self,arguments)}),this}}),AWS.SequentialExecutor.prototype.addListener=AWS.SequentialExecutor.prototype.on,module.exports=AWS.SequentialExecutor},{"./core":27}],69:[function(require,module,exports){(function(process){(function(){var AWS=require("./core"),Api=require("./model/api"),regionConfig=require("./region_config"),inherit=AWS.util.inherit,clientCount=0;AWS.Service=inherit({constructor:function(config){if(!this.loadServiceClass)throw AWS.util.error(new Error,"Service must be constructed with `new' operator");var ServiceClass=this.loadServiceClass(config||{});if(ServiceClass){var originalConfig=AWS.util.copy(config),svc=new ServiceClass(config);return Object.defineProperty(svc,"_originalConfig",{get:function(){return originalConfig},enumerable:!1,configurable:!0}),svc._clientId=++clientCount,svc}this.initialize(config)},initialize:function(config){var svcConfig=AWS.config[this.serviceIdentifier];if(this.config=new AWS.Config(AWS.config),svcConfig&&this.config.update(svcConfig,!0),config&&this.config.update(config,!0),this.validateService(),this.config.endpoint||regionConfig.configureEndpoint(this),this.config.endpoint=this.endpointFromTemplate(this.config.endpoint),this.setEndpoint(this.config.endpoint),AWS.SequentialExecutor.call(this),AWS.Service.addDefaultMonitoringListeners(this),(this.config.clientSideMonitoring||AWS.Service._clientSideMonitoring)&&this.publisher){var publisher=this.publisher;this.addNamedListener("PUBLISH_API_CALL","apiCall",function(event){process.nextTick(function(){publisher.eventHandler(event)})}),this.addNamedListener("PUBLISH_API_ATTEMPT","apiCallAttempt",function(event){process.nextTick(function(){publisher.eventHandler(event)})})}},validateService:function(){},loadServiceClass:function(serviceConfig){var config=serviceConfig;if(AWS.util.isEmpty(this.api)){if(config.apiConfig)return AWS.Service.defineServiceApi(this.constructor,config.apiConfig);if(this.constructor.services){(config=new AWS.Config(AWS.config)).update(serviceConfig,!0);var version=config.apiVersions[this.constructor.serviceIdentifier];return version=version||config.apiVersion,this.getLatestServiceClass(version)}return null}return null},getLatestServiceClass:function(version){return version=this.getLatestServiceVersion(version),null===this.constructor.services[version]&&AWS.Service.defineServiceApi(this.constructor,version),this.constructor.services[version]},getLatestServiceVersion:function(version){if(!this.constructor.services||0===this.constructor.services.length)throw new Error("No services defined on "+this.constructor.serviceIdentifier);if(version?AWS.util.isType(version,Date)&&(version=AWS.util.date.iso8601(version).split("T")[0]):version="latest",Object.hasOwnProperty(this.constructor.services,version))return version;for(var keys=Object.keys(this.constructor.services).sort(),selectedVersion=null,i=keys.length-1;i>=0;i--)if("*"!==keys[i][keys[i].length-1]&&(selectedVersion=keys[i]),keys[i].substr(0,10)<=version)return selectedVersion;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+version+"'")},api:{},defaultRetryCount:3,customizeRequests:function(callback){if(callback){if("function"!=typeof callback)throw new Error("Invalid callback type '"+typeof callback+"' provided in customizeRequests");this.customRequestHandler=callback}else this.customRequestHandler=null},makeRequest:function(operation,params,callback){if("function"==typeof params&&(callback=params,params=null),params=params||{},this.config.params){var rules=this.api.operations[operation];rules&&(params=AWS.util.copy(params),AWS.util.each(this.config.params,function(key,value){rules.input.members[key]&&(void 0!==params[key]&&null!==params[key]||(params[key]=value))}))}var request=new AWS.Request(this,operation,params);return this.addAllRequestListeners(request),this.attachMonitoringEmitter(request),callback&&request.send(callback),request},makeUnauthenticatedRequest:function(operation,params,callback){"function"==typeof params&&(callback=params,params={});var request=this.makeRequest(operation,params).toUnauthenticated();return callback?request.send(callback):request},waitFor:function(state,params,callback){return new AWS.ResourceWaiter(this,state).wait(params,callback)},addAllRequestListeners:function(request){for(var list=[AWS.events,AWS.EventListeners.Core,this.serviceInterface(),AWS.EventListeners.CorePost],i=0;i299?(error.code&&(monitoringEvent.FinalAwsException=error.code),error.message&&(monitoringEvent.FinalAwsExceptionMessage=error.message)):((error.code||error.name)&&(monitoringEvent.FinalSdkException=error.code||error.name),error.message&&(monitoringEvent.FinalSdkExceptionMessage=error.message))}return monitoringEvent},apiAttemptEvent:function(request){var api=request.service.api.operations[request.operation],monitoringEvent={Type:"ApiCallAttempt",Api:api?api.name:request.operation,Version:1,Service:request.service.api.serviceId||request.service.api.endpointPrefix,Fqdn:request.httpRequest.endpoint.hostname,UserAgent:request.httpRequest.getUserAgent()},response=request.response;return response.httpResponse.statusCode&&(monitoringEvent.HttpStatusCode=response.httpResponse.statusCode),!request._unAuthenticated&&request.service.config.credentials&&request.service.config.credentials.accessKeyId&&(monitoringEvent.AccessKey=request.service.config.credentials.accessKeyId),response.httpResponse.headers?(request.httpRequest.headers["x-amz-security-token"]&&(monitoringEvent.SessionToken=request.httpRequest.headers["x-amz-security-token"]),response.httpResponse.headers["x-amzn-requestid"]&&(monitoringEvent.XAmznRequestId=response.httpResponse.headers["x-amzn-requestid"]),response.httpResponse.headers["x-amz-request-id"]&&(monitoringEvent.XAmzRequestId=response.httpResponse.headers["x-amz-request-id"]),response.httpResponse.headers["x-amz-id-2"]&&(monitoringEvent.XAmzId2=response.httpResponse.headers["x-amz-id-2"]),monitoringEvent):monitoringEvent},attemptFailEvent:function(request){var monitoringEvent=this.apiAttemptEvent(request),response=request.response,error=response.error;return response.httpResponse.statusCode>299?(error.code&&(monitoringEvent.AwsException=error.code),error.message&&(monitoringEvent.AwsExceptionMessage=error.message)):((error.code||error.name)&&(monitoringEvent.SdkException=error.code||error.name),error.message&&(monitoringEvent.SdkExceptionMessage=error.message)),monitoringEvent},attachMonitoringEmitter:function(request){var attemptTimestamp,attemptStartRealTime,attemptLatency,callStartRealTime,region,callTimestamp,attemptCount=0,self=this;request.on("validate",function(){callStartRealTime=AWS.util.realClock.now(),callTimestamp=Date.now()},!0),request.on("sign",function(){attemptStartRealTime=AWS.util.realClock.now(),attemptTimestamp=Date.now(),region=request.httpRequest.region,attemptCount++},!0),request.on("validateResponse",function(){attemptLatency=Math.round(AWS.util.realClock.now()-attemptStartRealTime)}),request.addNamedListener("API_CALL_ATTEMPT","success",function(){var apiAttemptEvent=self.apiAttemptEvent(request);apiAttemptEvent.Timestamp=attemptTimestamp,apiAttemptEvent.AttemptLatency=attemptLatency>=0?attemptLatency:0,apiAttemptEvent.Region=region,self.emit("apiCallAttempt",[apiAttemptEvent])}),request.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",function(){var apiAttemptEvent=self.attemptFailEvent(request);apiAttemptEvent.Timestamp=attemptTimestamp,attemptLatency=attemptLatency||Math.round(AWS.util.realClock.now()-attemptStartRealTime),apiAttemptEvent.AttemptLatency=attemptLatency>=0?attemptLatency:0,apiAttemptEvent.Region=region,self.emit("apiCallAttempt",[apiAttemptEvent])}),request.addNamedListener("API_CALL","complete",function(){var apiCallEvent=self.apiCallEvent(request);if(apiCallEvent.AttemptCount=attemptCount,!(apiCallEvent.AttemptCount<=0)){apiCallEvent.Timestamp=callTimestamp;var latency=Math.round(AWS.util.realClock.now()-callStartRealTime);apiCallEvent.Latency=latency>=0?latency:0;var response=request.response;response.error&&response.error.retryable&&"number"==typeof response.retryCount&&"number"==typeof response.maxRetries&&response.retryCount>=response.maxRetries&&(apiCallEvent.MaxRetriesExceeded=1),self.emit("apiCall",[apiCallEvent])}})},setupRequestListeners:function(request){},getSigningName:function(){return this.api.signingName||this.api.endpointPrefix},getSignerClass:function(request){var version,operation=null,authtype="";request&&(authtype=(operation=(request.service.api.operations||{})[request.operation]||null)?operation.authtype:"");return version=this.config.signatureVersion?this.config.signatureVersion:"v4"===authtype||"v4-unsigned-body"===authtype?"v4":this.api.signatureVersion,AWS.Signers.RequestSigner.getVersion(version)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return AWS.EventListeners.Query;case"json":return AWS.EventListeners.Json;case"rest-json":return AWS.EventListeners.RestJson;case"rest-xml":return AWS.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(resp){return resp.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(retryCount,err){return AWS.util.calculateRetryDelay(retryCount,this.config.retryDelayOptions,err)},retryableError:function(error){return!!this.timeoutError(error)||(!!this.networkingError(error)||(!!this.expiredCredentialsError(error)||(!!this.throttledError(error)||error.statusCode>=500)))},networkingError:function(error){return"NetworkingError"===error.code},timeoutError:function(error){return"TimeoutError"===error.code},expiredCredentialsError:function(error){return"ExpiredTokenException"===error.code},clockSkewError:function(error){switch(error.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(newServerTime){newServerTime&&(this.config.systemClockOffset=newServerTime-Date.now())},isClockSkewed:function(newServerTime){if(newServerTime)return Math.abs(this.getSkewCorrectedDate().getTime()-newServerTime)>=3e5},throttledError:function(error){if(429===error.statusCode)return!0;switch(error.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(endpoint){if("string"!=typeof endpoint)return endpoint;var e=endpoint;return e=(e=(e=e.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(endpoint){this.endpoint=new AWS.Endpoint(endpoint,this.config)},paginationConfig:function(operation,throwException){var paginator=this.api.operations[operation].paginator;if(!paginator){if(throwException){var e=new Error;throw AWS.util.error(e,"No pagination configuration for "+operation)}return null}return paginator}}),AWS.util.update(AWS.Service,{defineMethods:function(svc){AWS.util.each(svc.prototype.api.operations,function(method){svc.prototype[method]||("none"===svc.prototype.api.operations[method].authtype?svc.prototype[method]=function(params,callback){return this.makeUnauthenticatedRequest(method,params,callback)}:svc.prototype[method]=function(params,callback){return this.makeRequest(method,params,callback)})})},defineService:function(serviceIdentifier,versions,features){AWS.Service._serviceMap[serviceIdentifier]=!0,Array.isArray(versions)||(features=versions,versions=[]);var svc=inherit(AWS.Service,features||{});if("string"==typeof serviceIdentifier){AWS.Service.addVersions(svc,versions);var identifier=svc.serviceIdentifier||serviceIdentifier;svc.serviceIdentifier=identifier}else svc.prototype.api=serviceIdentifier,AWS.Service.defineMethods(svc);if(AWS.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&AWS.util.clientSideMonitoring){var Publisher=AWS.util.clientSideMonitoring.Publisher,publisherConfig=(0,AWS.util.clientSideMonitoring.configProvider)();this.prototype.publisher=new Publisher(publisherConfig),publisherConfig.enabled&&(AWS.Service._clientSideMonitoring=!0)}return AWS.SequentialExecutor.call(svc.prototype),AWS.Service.addDefaultMonitoringListeners(svc.prototype),svc},addVersions:function(svc,versions){Array.isArray(versions)||(versions=[versions]),svc.services=svc.services||{};for(var i=0;i1&&(msg="Multiple configuration errors:\n"+messages.join("\n")),msg)throw AWS.util.error(new Error,{name:"InvalidEndpoint",message:msg})},shouldDisableBodySigning:function(request){var signerClass=this.getSignerClass();return!0===this.config.s3DisableBodySigning&&signerClass===AWS.Signers.V4&&"https:"===request.httpRequest.endpoint.protocol},setupRequestListeners:function(request){if(request.addListener("validate",this.validateScheme),request.addListener("validate",this.validateBucketName,!0),request.addListener("validate",this.optInUsEast1RegionalEndpoint,!0),request.removeListener("validate",AWS.EventListeners.Core.VALIDATE_REGION),request.addListener("build",this.addContentType),request.addListener("build",this.computeContentMd5),request.addListener("build",this.computeSseCustomerKeyMd5),request.addListener("build",this.populateURI),request.addListener("afterBuild",this.addExpect100Continue),request.addListener("extractError",this.extractError),request.addListener("extractData",AWS.util.hoistPayloadMember),request.addListener("extractData",this.extractData),request.addListener("extractData",this.extractErrorFrom200Response),request.addListener("beforePresign",this.prepareSignedUrl),this.shouldDisableBodySigning(request)&&(request.removeListener("afterBuild",AWS.EventListeners.Core.COMPUTE_SHA256),request.addListener("afterBuild",this.disableBodySigning)),"createBucket"!==request.operation&&s3util.isArnInParam(request,"Bucket"))return request._parsedArn=AWS.util.ARN.parse(request.params.Bucket),request.removeListener("validate",this.validateBucketName),request.removeListener("build",this.populateURI),"s3"===request._parsedArn.service?(request.addListener("validate",s3util.validateS3AccessPointArn),request.addListener("validate",this.validateArnResourceType)):"s3-outposts"===request._parsedArn.service&&(request.addListener("validate",s3util.validateOutpostsAccessPointArn),request.addListener("validate",s3util.validateOutpostsArn)),request.addListener("validate",s3util.validateArnRegion),request.addListener("validate",s3util.validateArnAccount),request.addListener("validate",s3util.validateArnService),request.addListener("build",this.populateUriFromAccessPointArn),void request.addListener("build",s3util.validatePopulateUriFromArn);request.addListener("validate",this.validateBucketEndpoint),request.addListener("validate",this.correctBucketRegionFromCache),request.onAsync("extractError",this.requestBucketRegion),AWS.util.isBrowser()&&request.onAsync("retry",this.reqRegionForNetworkingError)},validateScheme:function(req){var params=req.params,scheme=req.httpRequest.endpoint.protocol;if((params.SSECustomerKey||params.CopySourceSSECustomerKey)&&"https:"!==scheme){throw AWS.util.error(new Error,{code:"ConfigError",message:"Cannot send SSE keys over HTTP. Set 'sslEnabled'to 'true' in your configuration"})}},validateBucketEndpoint:function(req){if(!req.params.Bucket&&req.service.config.s3BucketEndpoint){throw AWS.util.error(new Error,{code:"ConfigError",message:"Cannot send requests to root API with `s3BucketEndpoint` set."})}},validateArnResourceType:function(req){var resource=req._parsedArn.resource;if(0!==resource.indexOf("accesspoint:")&&0!==resource.indexOf("accesspoint/"))throw AWS.util.error(new Error,{code:"InvalidARN",message:"ARN resource should begin with 'accesspoint/'"})},validateBucketName:function(req){var signatureVersion=req.service.getSignatureVersion(req),bucket=req.params&&req.params.Bucket,key=req.params&&req.params.Key,slashIndex=bucket&&bucket.indexOf("/");if(bucket&&slashIndex>=0)if("string"==typeof key&&slashIndex>0){req.params=AWS.util.copy(req.params);var prefix=bucket.substr(slashIndex+1)||"";req.params.Key=prefix+"/"+key,req.params.Bucket=bucket.substr(0,slashIndex)}else if("v4"===signatureVersion){var msg="Bucket names cannot contain forward slashes. Bucket: "+bucket;throw AWS.util.error(new Error,{code:"InvalidBucket",message:msg})}},isValidAccelerateOperation:function(operation){return-1===["createBucket","deleteBucket","listBuckets"].indexOf(operation)},optInUsEast1RegionalEndpoint:function(req){var service=req.service,config=service.config;if(config.s3UsEast1RegionalEndpoint=resolveRegionalEndpointsFlag(service._originalConfig,{env:"AWS_S3_US_EAST_1_REGIONAL_ENDPOINT",sharedConfig:"s3_us_east_1_regional_endpoint",clientConfig:"s3UsEast1RegionalEndpoint"}),!(service._originalConfig||{}).endpoint&&"us-east-1"===req.httpRequest.region&&"regional"===config.s3UsEast1RegionalEndpoint&&req.httpRequest.endpoint.hostname.indexOf("s3.amazonaws.com")>=0){var insertPoint=config.endpoint.indexOf(".amazonaws.com");regionalEndpoint=config.endpoint.substring(0,insertPoint)+".us-east-1"+config.endpoint.substring(insertPoint),req.httpRequest.updateEndpoint(regionalEndpoint)}},populateURI:function(req){var httpRequest=req.httpRequest,b=req.params.Bucket,service=req.service,endpoint=httpRequest.endpoint;if(b&&!service.pathStyleBucketName(b)){service.config.useAccelerateEndpoint&&service.isValidAccelerateOperation(req.operation)?service.config.useDualstack?endpoint.hostname=b+".s3-accelerate.dualstack.amazonaws.com":endpoint.hostname=b+".s3-accelerate.amazonaws.com":service.config.s3BucketEndpoint||(endpoint.hostname=b+"."+endpoint.hostname);var port=endpoint.port;endpoint.host=80!==port&&443!==port?endpoint.hostname+":"+endpoint.port:endpoint.hostname,httpRequest.virtualHostedBucket=b,service.removeVirtualHostedBucketFromPath(req)}},removeVirtualHostedBucketFromPath:function(req){var httpRequest=req.httpRequest,bucket=httpRequest.virtualHostedBucket;if(bucket&&httpRequest.path){if(req.params&&req.params.Key){var encodedS3Key="/"+AWS.util.uriEscapePath(req.params.Key);if(0===httpRequest.path.indexOf(encodedS3Key)&&(httpRequest.path.length===encodedS3Key.length||"?"===httpRequest.path[encodedS3Key.length]))return}httpRequest.path=httpRequest.path.replace(new RegExp("/"+bucket),""),"/"!==httpRequest.path[0]&&(httpRequest.path="/"+httpRequest.path)}},populateUriFromAccessPointArn:function(req){var accessPointArn=req._parsedArn,isOutpostArn="s3-outposts"===accessPointArn.service,isObjectLambdaArn="s3-object-lambda"===accessPointArn.service,outpostsSuffix=isOutpostArn?"."+accessPointArn.outpostId:"",serviceName=isOutpostArn?"s3-outposts":"s3-accesspoint",dualStackSuffix=!isOutpostArn&&req.service.config.useDualstack?".dualstack":"",endpoint=req.httpRequest.endpoint,dnsSuffix=regionUtil.getEndpointSuffix(accessPointArn.region),useArnRegion=req.service.config.s3UseArnRegion;if(endpoint.hostname=[accessPointArn.accessPoint+"-"+accessPointArn.accountId+outpostsSuffix,serviceName+dualStackSuffix,useArnRegion?accessPointArn.region:req.service.config.region,dnsSuffix].join("."),isObjectLambdaArn){serviceName="s3-object-lambda";var accesspointName=accessPointArn.resource.split("/")[1];endpoint.hostname=[accesspointName+"-"+accessPointArn.accountId,serviceName,useArnRegion?accessPointArn.region:req.service.config.region,dnsSuffix].join(".")}endpoint.host=endpoint.hostname;var encodedArn=AWS.util.uriEscape(req.params.Bucket),path=req.httpRequest.path;req.httpRequest.path=path.replace(new RegExp("/"+encodedArn),""),"/"!==req.httpRequest.path[0]&&(req.httpRequest.path="/"+req.httpRequest.path),req.httpRequest.region=accessPointArn.region},addExpect100Continue:function(req){var len=req.httpRequest.headers["Content-Length"];AWS.util.isNode()&&(len>=1048576||req.params.Body instanceof AWS.util.stream.Stream)&&(req.httpRequest.headers.Expect="100-continue")},addContentType:function(req){var httpRequest=req.httpRequest;if("GET"!==httpRequest.method&&"HEAD"!==httpRequest.method){httpRequest.headers["Content-Type"]||(httpRequest.headers["Content-Type"]="application/octet-stream");var contentType=httpRequest.headers["Content-Type"];if(AWS.util.isBrowser())if("string"!=typeof httpRequest.body||contentType.match(/;\s*charset=/)){httpRequest.headers["Content-Type"]=contentType.replace(/(;\s*charset=)(.+)$/,function(_,prefix,charsetName){return prefix+charsetName.toUpperCase()})}else{httpRequest.headers["Content-Type"]+="; charset=UTF-8"}}else delete httpRequest.headers["Content-Type"]},computableChecksumOperations:{putBucketCors:!0,putBucketLifecycle:!0,putBucketLifecycleConfiguration:!0,putBucketTagging:!0,deleteObjects:!0,putBucketReplication:!0,putObjectLegalHold:!0,putObjectRetention:!0,putObjectLockConfiguration:!0},willComputeChecksums:function(req){if(this.computableChecksumOperations[req.operation])return!0;if(!this.config.computeChecksums)return!1;if(!AWS.util.Buffer.isBuffer(req.httpRequest.body)&&"string"!=typeof req.httpRequest.body)return!1;var rules=req.service.api.operations[req.operation].input.members;return!(!req.service.shouldDisableBodySigning(req)||Object.prototype.hasOwnProperty.call(req.httpRequest.headers,"presigned-expires")||!rules.ContentMD5||req.params.ContentMD5)||!(req.service.getSignerClass(req)===AWS.Signers.V4&&rules.ContentMD5&&!rules.ContentMD5.required)&&(!(!rules.ContentMD5||req.params.ContentMD5)||void 0)},computeContentMd5:function(req){if(req.service.willComputeChecksums(req)){var md5=AWS.util.crypto.md5(req.httpRequest.body,"base64");req.httpRequest.headers["Content-MD5"]=md5}},computeSseCustomerKeyMd5:function(req){AWS.util.each({SSECustomerKey:"x-amz-server-side-encryption-customer-key-MD5",CopySourceSSECustomerKey:"x-amz-copy-source-server-side-encryption-customer-key-MD5"},function(key,header){if(req.params[key]){var value=AWS.util.crypto.md5(req.params[key],"base64");req.httpRequest.headers[header]=value}})},pathStyleBucketName:function(bucketName){return!!this.config.s3ForcePathStyle||!this.config.s3BucketEndpoint&&(!s3util.dnsCompatibleBucketName(bucketName)||!(!this.config.sslEnabled||!bucketName.match(/\./)))},extractErrorFrom200Response:function(resp){if(operationsWith200StatusCodeError[resp.request.operation]){var httpResponse=resp.httpResponse;if(httpResponse.body&&httpResponse.body.toString().match(""))throw resp.data=null,(this.service?this.service:this).extractError(resp),resp.error;if(!httpResponse.body||!httpResponse.body.toString().match(/<[\w_]/))throw resp.data=null,AWS.util.error(new Error,{code:"InternalError",message:"S3 aborted request"})}},retryableError:function(error,request){return!(!operationsWith200StatusCodeError[request.operation]||200!==error.statusCode)||(!request._requestRegionForBucket||!request.service.bucketRegionCache[request._requestRegionForBucket])&&(!(!error||"RequestTimeout"!==error.code)||(error&&-1!=regionRedirectErrorCodes.indexOf(error.code)&&error.region&&error.region!=request.httpRequest.region?(request.httpRequest.region=error.region,301===error.statusCode&&request.service.updateReqBucketRegion(request),!0):AWS.Service.prototype.retryableError.call(this,error,request)))},updateReqBucketRegion:function(request,region){var httpRequest=request.httpRequest;if("string"==typeof region&®ion.length&&(httpRequest.region=region),httpRequest.endpoint.host.match(/s3(?!-accelerate).*\.amazonaws\.com$/)){var service=request.service,s3Config=service.config,s3BucketEndpoint=s3Config.s3BucketEndpoint;s3BucketEndpoint&&delete s3Config.s3BucketEndpoint;var newConfig=AWS.util.copy(s3Config);delete newConfig.endpoint,newConfig.region=httpRequest.region,httpRequest.endpoint=new AWS.S3(newConfig).endpoint,service.populateURI(request),s3Config.s3BucketEndpoint=s3BucketEndpoint,httpRequest.headers.Host=httpRequest.endpoint.host,"validate"===request._asm.currentState&&(request.removeListener("build",service.populateURI),request.addListener("build",service.removeVirtualHostedBucketFromPath))}},extractData:function(resp){var req=resp.request;if("getBucketLocation"===req.operation){var match=resp.httpResponse.body.toString().match(/>(.+)<\/Location/);delete resp.data._,resp.data.LocationConstraint=match?match[1]:""}var bucket=req.params.Bucket||null;if("deleteBucket"!==req.operation||"string"!=typeof bucket||resp.error){var region=(resp.httpResponse.headers||{})["x-amz-bucket-region"]||null;if(!region&&"createBucket"===req.operation&&!resp.error){var createBucketConfiguration=req.params.CreateBucketConfiguration;region=createBucketConfiguration?"EU"===createBucketConfiguration.LocationConstraint?"eu-west-1":createBucketConfiguration.LocationConstraint:"us-east-1"}region&&bucket&®ion!==req.service.bucketRegionCache[bucket]&&(req.service.bucketRegionCache[bucket]=region)}else req.service.clearBucketRegionCache(bucket);req.service.extractRequestIds(resp)},extractError:function(resp){var cachedRegion,codes={304:"NotModified",403:"Forbidden",400:"BadRequest",404:"NotFound"},req=resp.request,code=resp.httpResponse.statusCode,body=resp.httpResponse.body||"",region=(resp.httpResponse.headers||{})["x-amz-bucket-region"]||null,bucket=req.params.Bucket||null,bucketRegionCache=req.service.bucketRegionCache;if(region&&bucket&®ion!==bucketRegionCache[bucket]&&(bucketRegionCache[bucket]=region),codes[code]&&0===body.length)bucket&&!region&&(cachedRegion=bucketRegionCache[bucket]||null)!==req.httpRequest.region&&(region=cachedRegion),resp.error=AWS.util.error(new Error,{code:codes[code],message:null,region:region});else{var data=(new AWS.XML.Parser).parse(body.toString());data.Region&&!region?(region=data.Region,bucket&®ion!==bucketRegionCache[bucket]&&(bucketRegionCache[bucket]=region)):!bucket||region||data.Region||(cachedRegion=bucketRegionCache[bucket]||null)!==req.httpRequest.region&&(region=cachedRegion),resp.error=AWS.util.error(new Error,{code:data.Code||code,message:data.Message||null,region:region})}req.service.extractRequestIds(resp)},requestBucketRegion:function(resp,done){var error=resp.error,req=resp.request,bucket=req.params.Bucket||null;if(!error||!bucket||error.region||"listObjects"===req.operation||AWS.util.isNode()&&"headBucket"===req.operation||400===error.statusCode&&"headObject"!==req.operation||-1===regionRedirectErrorCodes.indexOf(error.code))return done();var reqOperation=AWS.util.isNode()?"headBucket":"listObjects",reqParams={Bucket:bucket};"listObjects"===reqOperation&&(reqParams.MaxKeys=0);var regionReq=req.service[reqOperation](reqParams);regionReq._requestRegionForBucket=bucket,regionReq.send(function(){var region=req.service.bucketRegionCache[bucket]||null;error.region=region,done()})},reqRegionForNetworkingError:function(resp,done){if(!AWS.util.isBrowser())return done();var error=resp.error,request=resp.request,bucket=request.params.Bucket;if(!error||"NetworkingError"!==error.code||!bucket||"us-east-1"===request.httpRequest.region)return done();var service=request.service,bucketRegionCache=service.bucketRegionCache,cachedRegion=bucketRegionCache[bucket]||null;if(cachedRegion&&cachedRegion!==request.httpRequest.region)service.updateReqBucketRegion(request,cachedRegion),done();else if(s3util.dnsCompatibleBucketName(bucket))if(request.httpRequest.virtualHostedBucket){var getRegionReq=service.listObjects({Bucket:bucket,MaxKeys:0});service.updateReqBucketRegion(getRegionReq,"us-east-1"),getRegionReq._requestRegionForBucket=bucket,getRegionReq.send(function(){var region=service.bucketRegionCache[bucket]||null;region&®ion!==request.httpRequest.region&&service.updateReqBucketRegion(request,region),done()})}else done();else service.updateReqBucketRegion(request,"us-east-1"),"us-east-1"!==bucketRegionCache[bucket]&&(bucketRegionCache[bucket]="us-east-1"),done()},bucketRegionCache:{},clearBucketRegionCache:function(buckets){var bucketRegionCache=this.bucketRegionCache;buckets?"string"==typeof buckets&&(buckets=[buckets]):buckets=Object.keys(bucketRegionCache);for(var i=0;i=0||regionFromArn.indexOf("fips")>=0)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"ARN endpoint is not compatible with FIPS region"});if(!useArnRegion&®ionFromArn!==clientRegion)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"Configured region conflicts with access point region"});if(useArnRegion&®ionUtil.getEndpointSuffix(regionFromArn)!==regionUtil.getEndpointSuffix(clientRegion))throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"Configured region and access point region not in same partition"});if(req.service.config.useAccelerateEndpoint)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"useAccelerateEndpoint config is not supported with access point ARN"});if("s3-outposts"===req._parsedArn.service&&req.service.config.useDualstack)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"useDualstack config is not supported with outposts access point ARN"})},loadUseArnRegionConfig:function(req){var envName="AWS_S3_USE_ARN_REGION",configName="s3_use_arn_region",useArnRegion=!0,originalConfig=req.service._originalConfig||{};if(void 0!==req.service.config.s3UseArnRegion)return req.service.config.s3UseArnRegion;if(void 0!==originalConfig.s3UseArnRegion)useArnRegion=!0===originalConfig.s3UseArnRegion;else if(AWS.util.isNode())if(process.env[envName]){var value=process.env[envName].trim().toLowerCase();if(["false","true"].indexOf(value)<0)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:envName+" only accepts true or false. Got "+process.env[envName],retryable:!1});useArnRegion="true"===value}else{var profile={};try{profile=AWS.util.getProfilesFromSharedConfig(AWS.util.iniLoader)[process.env.AWS_PROFILE||AWS.util.defaultProfile]}catch(e){}if(profile[configName]){if(["false","true"].indexOf(profile[configName].trim().toLowerCase())<0)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:configName+" only accepts true or false. Got "+profile[configName],retryable:!1});useArnRegion="true"===profile[configName].trim().toLowerCase()}}return req.service.config.s3UseArnRegion=useArnRegion,useArnRegion},validatePopulateUriFromArn:function(req){if(req.service._originalConfig&&req.service._originalConfig.endpoint)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"Custom endpoint is not compatible with access point ARN"});if(req.service.config.s3ForcePathStyle)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"Cannot construct path-style endpoint with access point"})},dnsCompatibleBucketName:function(bucketName){var b=bucketName,domain=new RegExp(/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/),ipAddress=new RegExp(/(\d+\.){3}\d+/),dots=new RegExp(/\.\./);return!(!b.match(domain)||b.match(ipAddress)||b.match(dots))}};module.exports=s3util}).call(this)}).call(this,require("_process"))},{"../core":27,"../region_config":62,_process:97}],73:[function(require,module,exports){var AWS=require("../core"),resolveRegionalEndpointsFlag=require("../config_regional_endpoint");AWS.util.update(AWS.STS.prototype,{credentialsFrom:function(data,credentials){return data?(credentials||(credentials=new AWS.TemporaryCredentials),credentials.expired=!1,credentials.accessKeyId=data.Credentials.AccessKeyId,credentials.secretAccessKey=data.Credentials.SecretAccessKey,credentials.sessionToken=data.Credentials.SessionToken,credentials.expireTime=data.Credentials.Expiration,credentials):null},assumeRoleWithWebIdentity:function(params,callback){return this.makeUnauthenticatedRequest("assumeRoleWithWebIdentity",params,callback)},assumeRoleWithSAML:function(params,callback){return this.makeUnauthenticatedRequest("assumeRoleWithSAML",params,callback)},setupRequestListeners:function(request){request.addListener("validate",this.optInRegionalEndpoint,!0)},optInRegionalEndpoint:function(req){var service=req.service,config=service.config;if(config.stsRegionalEndpoints=resolveRegionalEndpointsFlag(service._originalConfig,{env:"AWS_STS_REGIONAL_ENDPOINTS",sharedConfig:"sts_regional_endpoints",clientConfig:"stsRegionalEndpoints"}),"regional"===config.stsRegionalEndpoints&&service.isGlobalEndpoint){if(!config.region)throw AWS.util.error(new Error,{code:"ConfigError",message:"Missing region in config"});var insertPoint=config.endpoint.indexOf(".amazonaws.com"),regionalEndpoint=config.endpoint.substring(0,insertPoint)+"."+config.region+config.endpoint.substring(insertPoint);req.httpRequest.updateEndpoint(regionalEndpoint),req.httpRequest.region=config.region}}})},{"../config_regional_endpoint":26,"../core":27}],74:[function(require,module,exports){var AWS=require("../core"),inherit=AWS.util.inherit,expiresHeader="presigned-expires";function signedUrlBuilder(request){var expires=request.httpRequest.headers[expiresHeader],signerClass=request.service.getSignerClass(request);if(delete request.httpRequest.headers["User-Agent"],delete request.httpRequest.headers["X-Amz-User-Agent"],signerClass===AWS.Signers.V4){if(expires>604800){throw AWS.util.error(new Error,{code:"InvalidExpiryTime",message:"Presigning does not support expiry time greater than a week with SigV4 signing.",retryable:!1})}request.httpRequest.headers[expiresHeader]=expires}else{if(signerClass!==AWS.Signers.S3)throw AWS.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});var now=request.service?request.service.getSkewCorrectedDate():AWS.util.date.getDate();request.httpRequest.headers[expiresHeader]=parseInt(AWS.util.date.unixTimestamp(now)+expires,10).toString()}}function signedUrlSigner(request){var endpoint=request.httpRequest.endpoint,parsedUrl=AWS.util.urlParse(request.httpRequest.path),queryParams={};parsedUrl.search&&(queryParams=AWS.util.queryStringParse(parsedUrl.search.substr(1)));var auth=request.httpRequest.headers.Authorization.split(" ");if("AWS"===auth[0])auth=auth[1].split(":"),queryParams.Signature=auth.pop(),queryParams.AWSAccessKeyId=auth.join(":"),AWS.util.each(request.httpRequest.headers,function(key,value){key===expiresHeader&&(key="Expires"),0===key.indexOf("x-amz-meta-")&&(delete queryParams[key],key=key.toLowerCase()),queryParams[key]=value}),delete request.httpRequest.headers[expiresHeader],delete queryParams.Authorization,delete queryParams.Host;else if("AWS4-HMAC-SHA256"===auth[0]){auth.shift();var signature=auth.join(" ").match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];queryParams["X-Amz-Signature"]=signature,delete queryParams.Expires}endpoint.pathname=parsedUrl.pathname,endpoint.search=AWS.util.queryParamsToString(queryParams)}AWS.Signers.Presign=inherit({sign:function(request,expireTime,callback){if(request.httpRequest.headers[expiresHeader]=expireTime||3600,request.on("build",signedUrlBuilder),request.on("sign",signedUrlSigner),request.removeListener("afterBuild",AWS.EventListeners.Core.SET_CONTENT_LENGTH),request.removeListener("afterBuild",AWS.EventListeners.Core.COMPUTE_SHA256),request.emit("beforePresign",[request]),!callback){if(request.build(),request.response.error)throw request.response.error;return AWS.util.urlFormat(request.httpRequest.endpoint)}request.build(function(){this.response.error?callback(this.response.error):callback(null,AWS.util.urlFormat(request.httpRequest.endpoint))})}}),module.exports=AWS.Signers.Presign},{"../core":27}],75:[function(require,module,exports){var AWS=require("../core"),inherit=AWS.util.inherit;AWS.Signers.RequestSigner=inherit({constructor:function(request){this.request=request},setServiceClientId:function(id){this.serviceClientId=id},getServiceClientId:function(){return this.serviceClientId}}),AWS.Signers.RequestSigner.getVersion=function(version){switch(version){case"v2":return AWS.Signers.V2;case"v3":return AWS.Signers.V3;case"s3v4":case"v4":return AWS.Signers.V4;case"s3":return AWS.Signers.S3;case"v3https":return AWS.Signers.V3Https}throw new Error("Unknown signing version "+version)},require("./v2"),require("./v3"),require("./v3https"),require("./v4"),require("./s3"),require("./presign")},{"../core":27,"./presign":74,"./s3":76,"./v2":77,"./v3":78,"./v3https":79,"./v4":80}],76:[function(require,module,exports){var AWS=require("../core"),inherit=AWS.util.inherit;AWS.Signers.S3=inherit(AWS.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(credentials,date){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=AWS.util.date.rfc822(date)),credentials.sessionToken&&(this.request.headers["x-amz-security-token"]=credentials.sessionToken);var signature=this.sign(credentials.secretAccessKey,this.stringToSign()),auth="AWS "+credentials.accessKeyId+":"+signature;this.request.headers.Authorization=auth},stringToSign:function(){var r=this.request,parts=[];parts.push(r.method),parts.push(r.headers["Content-MD5"]||""),parts.push(r.headers["Content-Type"]||""),parts.push(r.headers["presigned-expires"]||"");var headers=this.canonicalizedAmzHeaders();return headers&&parts.push(headers),parts.push(this.canonicalizedResource()),parts.join("\n")},canonicalizedAmzHeaders:function(){var amzHeaders=[];AWS.util.each(this.request.headers,function(name){name.match(/^x-amz-/i)&&amzHeaders.push(name)}),amzHeaders.sort(function(a,b){return a.toLowerCase()=0?"&":"?";this.request.path+=sep+AWS.util.queryParamsToString(qs)},authorization:function(credentials,datetime){var parts=[],credString=this.credentialString(datetime);return parts.push(this.algorithm+" Credential="+credentials.accessKeyId+"/"+credString),parts.push("SignedHeaders="+this.signedHeaders()),parts.push("Signature="+this.signature(credentials,datetime)),parts.join(", ")},signature:function(credentials,datetime){var signingKey=v4Credentials.getSigningKey(credentials,datetime.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return AWS.util.crypto.hmac(signingKey,this.stringToSign(datetime),"hex")},stringToSign:function(datetime){var parts=[];return parts.push("AWS4-HMAC-SHA256"),parts.push(datetime),parts.push(this.credentialString(datetime)),parts.push(this.hexEncodedHash(this.canonicalString())),parts.join("\n")},canonicalString:function(){var parts=[],pathname=this.request.pathname();return"s3"!==this.serviceName&&"s3v4"!==this.signatureVersion&&(pathname=AWS.util.uriEscapePath(pathname)),parts.push(this.request.method),parts.push(pathname),parts.push(this.request.search()),parts.push(this.canonicalHeaders()+"\n"),parts.push(this.signedHeaders()),parts.push(this.hexEncodedBodyHash()),parts.join("\n")},canonicalHeaders:function(){var headers=[];AWS.util.each.call(this,this.request.headers,function(key,item){headers.push([key,item])}),headers.sort(function(a,b){return a[0].toLowerCase()50&&delete cachedSecret[cacheQueue.shift()]),signingKey},emptyCache:function(){cachedSecret={},cacheQueue=[]}}},{"../core":27}],82:[function(require,module,exports){function AcceptorStateMachine(states,state){this.currentState=state||null,this.states=states||{}}AcceptorStateMachine.prototype.runTo=function(finalState,done,bindObject,inputError){"function"==typeof finalState&&(inputError=bindObject,bindObject=done,done=finalState,finalState=null);var self=this,state=self.states[self.currentState];state.fn.call(bindObject||self,inputError,function(err){if(err){if(!state.fail)return done?done.call(bindObject,err):null;self.currentState=state.fail}else{if(!state.accept)return done?done.call(bindObject):null;self.currentState=state.accept}if(self.currentState===finalState)return done?done.call(bindObject,err):null;self.runTo(finalState,done,bindObject,err)})},AcceptorStateMachine.prototype.addState=function(name,acceptState,failState,fn){return"function"==typeof acceptState?(fn=acceptState,acceptState=null,failState=null):"function"==typeof failState&&(fn=failState,failState=null),this.currentState||(this.currentState=name),this.states[name]={accept:acceptState,fail:failState,fn:fn},this},module.exports=AcceptorStateMachine},{}],83:[function(require,module,exports){(function(process,setImmediate){(function(){var AWS,util={environment:"nodejs",engine:function(){if(util.isBrowser()&&"undefined"!=typeof navigator)return navigator.userAgent;var engine=process.platform+"/"+process.version;return process.env.AWS_EXECUTION_ENV&&(engine+=" exec-env/"+process.env.AWS_EXECUTION_ENV),engine},userAgent:function(){var name=util.environment,agent="aws-sdk-"+name+"/"+require("./core").VERSION;return"nodejs"===name&&(agent+=" "+util.engine()),agent},uriEscape:function(string){var output=encodeURIComponent(string);return output=(output=output.replace(/[^A-Za-z0-9_.~\-%]+/g,escape)).replace(/[*]/g,function(ch){return"%"+ch.charCodeAt(0).toString(16).toUpperCase()})},uriEscapePath:function(string){var parts=[];return util.arrayEach(string.split("/"),function(part){parts.push(util.uriEscape(part))}),parts.join("/")},urlParse:function(url){return util.url.parse(url)},urlFormat:function(url){return util.url.format(url)},queryStringParse:function(qs){return util.querystring.parse(qs)},queryParamsToString:function(params){var items=[],escape=util.uriEscape,sortedKeys=Object.keys(params).sort();return util.arrayEach(sortedKeys,function(name){var value=params[name],ename=escape(name),result=ename+"=";if(Array.isArray(value)){var vals=[];util.arrayEach(value,function(item){vals.push(escape(item))}),result=ename+"="+vals.sort().join("&"+ename+"=")}else null!=value&&(result=ename+"="+escape(value));items.push(result)}),items.join("&")},readFileSync:function(path){return util.isBrowser()?null:require("fs").readFileSync(path,"utf-8")},base64:{encode:function(string){if("number"==typeof string)throw util.error(new Error("Cannot base64 encode number "+string));return null==string?string:util.buffer.toBuffer(string).toString("base64")},decode:function(string){if("number"==typeof string)throw util.error(new Error("Cannot base64 decode number "+string));return null==string?string:util.buffer.toBuffer(string,"base64")}},buffer:{toBuffer:function(data,encoding){return"function"==typeof util.Buffer.from&&util.Buffer.from!==Uint8Array.from?util.Buffer.from(data,encoding):new util.Buffer(data,encoding)},alloc:function(size,fill,encoding){if("number"!=typeof size)throw new Error("size passed to alloc must be a number.");if("function"==typeof util.Buffer.alloc)return util.Buffer.alloc(size,fill,encoding);var buf=new util.Buffer(size);return void 0!==fill&&"function"==typeof buf.fill&&buf.fill(fill,void 0,void 0,encoding),buf},toStream:function(buffer){util.Buffer.isBuffer(buffer)||(buffer=util.buffer.toBuffer(buffer));var readable=new util.stream.Readable,pos=0;return readable._read=function(size){if(pos>=buffer.length)return readable.push(null);var end=pos+size;end>buffer.length&&(end=buffer.length),readable.push(buffer.slice(pos,end)),pos=end},readable},concat:function(buffers){var buffer,i,length=0,offset=0;for(i=0;i>>8^tbl[255&(crc^data.readUInt8(i))]}return(-1^crc)>>>0},hmac:function(key,string,digest,fn){return digest||(digest="binary"),"buffer"===digest&&(digest=void 0),fn||(fn="sha256"),"string"==typeof string&&(string=util.buffer.toBuffer(string)),util.crypto.lib.createHmac(fn,key).update(string).digest(digest)},md5:function(data,digest,callback){return util.crypto.hash("md5",data,digest,callback)},sha256:function(data,digest,callback){return util.crypto.hash("sha256",data,digest,callback)},hash:function(algorithm,data,digest,callback){var hash=util.crypto.createHash(algorithm);digest||(digest="binary"),"buffer"===digest&&(digest=void 0),"string"==typeof data&&(data=util.buffer.toBuffer(data));var sliceFn=util.arraySliceFn(data),isBuffer=util.Buffer.isBuffer(data);if(util.isBrowser()&&"undefined"!=typeof ArrayBuffer&&data&&data.buffer instanceof ArrayBuffer&&(isBuffer=!0),callback&&"object"==typeof data&&"function"==typeof data.on&&!isBuffer)data.on("data",function(chunk){hash.update(chunk)}),data.on("error",function(err){callback(err)}),data.on("end",function(){callback(null,hash.digest(digest))});else{if(!callback||!sliceFn||isBuffer||"undefined"==typeof FileReader){util.isBrowser()&&"object"==typeof data&&!isBuffer&&(data=new util.Buffer(new Uint8Array(data)));var out=hash.update(data).digest(digest);return callback&&callback(null,out),out}var index=0,reader=new FileReader;reader.onerror=function(){callback(new Error("Failed to read data."))},reader.onload=function(){var buf=new util.Buffer(new Uint8Array(reader.result));hash.update(buf),index+=buf.length,reader._continueReading()},reader._continueReading=function(){if(index>=data.size)callback(null,hash.digest(digest));else{var back=index+524288;back>data.size&&(back=data.size),reader.readAsArrayBuffer(sliceFn.call(data,index,back))}},reader._continueReading()}},toHex:function(data){for(var out=[],i=0;i=3e5,!1),AWS.config.isClockSkewed},applyClockOffset:function(serverTime){serverTime&&(AWS.config.systemClockOffset=serverTime-(new Date).getTime())},extractRequestId:function(resp){var requestId=resp.httpResponse.headers["x-amz-request-id"]||resp.httpResponse.headers["x-amzn-requestid"];!requestId&&resp.data&&resp.data.ResponseMetadata&&(requestId=resp.data.ResponseMetadata.RequestId),requestId&&(resp.requestId=requestId),resp.error&&(resp.error.requestId=requestId)},addPromises:function(constructors,PromiseDependency){var deletePromises=!1;void 0===PromiseDependency&&AWS&&AWS.config&&(PromiseDependency=AWS.config.getPromisesDependency()),void 0===PromiseDependency&&"undefined"!=typeof Promise&&(PromiseDependency=Promise),"function"!=typeof PromiseDependency&&(deletePromises=!0),Array.isArray(constructors)||(constructors=[constructors]);for(var ind=0;ind=0)return retryCount++,void setTimeout(sendRequest,delay+(err.retryAfter||0))}cb(err)},sendRequest=function(){var data="";http.handleRequest(httpRequest,httpOptions,function(httpResponse){httpResponse.on("data",function(chunk){data+=chunk.toString()}),httpResponse.on("end",function(){var statusCode=httpResponse.statusCode;if(statusCode<300)cb(null,data);else{var retryAfter=1e3*parseInt(httpResponse.headers["retry-after"],10)||0,err=util.error(new Error,{statusCode:statusCode,retryable:statusCode>=500||429===statusCode});retryAfter&&err.retryable&&(err.retryAfter=retryAfter),errCallback(err)}})},errCallback)};AWS.util.defer(sendRequest)},uuid:{v4:function(){return require("uuid").v4()}},convertPayloadToString:function(resp){var req=resp.request,operation=req.operation,rules=req.service.api.operations[operation].output||{};rules.payload&&resp.data[rules.payload]&&(resp.data[rules.payload]=resp.data[rules.payload].toString())},defer:function(callback){"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick(callback):"function"==typeof setImmediate?setImmediate(callback):setTimeout(callback,0)},getRequestPayloadShape:function(req){var operations=req.service.api.operations;if(operations){var operation=(operations||{})[req.operation];if(operation&&operation.input&&operation.input.payload)return operation.input.members[operation.input.payload]}},getProfilesFromSharedConfig:function(iniLoader,filename){var profiles={},profilesFromConfig={};if(process.env[util.configOptInEnv])profilesFromConfig=iniLoader.loadFrom({isConfig:!0,filename:process.env[util.sharedConfigFileEnv]});var profilesFromCreds={};try{profilesFromCreds=iniLoader.loadFrom({filename:filename||process.env[util.configOptInEnv]&&process.env[util.sharedCredentialsFileEnv]})}catch(error){if(!process.env[util.configOptInEnv])throw error}for(var i=0,profileNames=Object.keys(profilesFromConfig);i=6},parse:function(arn){var matched=arn.split(":");return{partition:matched[1],service:matched[2],region:matched[3],accountId:matched[4],resource:matched.slice(5).join(":")}},build:function(arnObject){if(void 0===arnObject.service||void 0===arnObject.region||void 0===arnObject.accountId||void 0===arnObject.resource)throw util.error(new Error("Input ARN object is invalid"));return"arn:"+(arnObject.partition||"aws")+":"+arnObject.service+":"+arnObject.region+":"+arnObject.accountId+":"+arnObject.resource}},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};module.exports=util}).call(this)}).call(this,require("_process"),require("timers").setImmediate)},{"../apis/metadata.json":9,"./core":27,_process:97,fs:91,timers:105,uuid:110}],84:[function(require,module,exports){var util=require("../util"),Shape=require("../model/shape");function DomXmlParser(){}function getElementByTagName(xml,tag){for(var elements=xml.getElementsByTagName(tag),i=0,iLen=elements.length;i0||noEmpty?xml.toString():""},module.exports=XmlBuilder},{"../util":83,"./xml-node":88,"./xml-text":89}],86:[function(require,module,exports){module.exports={escapeAttribute:function(value){return value.replace(/&/g,"&").replace(/'/g,"'").replace(//g,">").replace(/"/g,""")}}},{}],87:[function(require,module,exports){module.exports={escapeElement:function(value){return value.replace(/&/g,"&").replace(//g,">").replace(/\r/g," ").replace(/\n/g," ").replace(/\u0085/g,"…").replace(/\u2028/,"
")}}},{}],88:[function(require,module,exports){var escapeAttribute=require("./escape-attribute").escapeAttribute;function XmlNode(name,children){void 0===children&&(children=[]),this.name=name,this.children=children,this.attributes={}}XmlNode.prototype.addAttribute=function(name,value){return this.attributes[name]=value,this},XmlNode.prototype.addChildNode=function(child){return this.children.push(child),this},XmlNode.prototype.removeAttribute=function(name){return delete this.attributes[name],this},XmlNode.prototype.toString=function(){for(var hasChildren=Boolean(this.children.length),xmlText="<"+this.name,attributes=this.attributes,i=0,attributeNames=Object.keys(attributes);i"+this.children.map(function(c){return c.toString()}).join("")+"":"/>")},module.exports={XmlNode:XmlNode}},{"./escape-attribute":86}],89:[function(require,module,exports){var escapeElement=require("./escape-element").escapeElement;function XmlText(value){this.value=value}XmlText.prototype.toString=function(){return escapeElement(""+this.value)},module.exports={XmlText:XmlText}},{"./escape-element":87}],90:[function(require,module,exports){"use strict";exports.byteLength=function(b64){var lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1];return 3*(validLen+placeHoldersLen)/4-placeHoldersLen},exports.toByteArray=function(b64){var tmp,i,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Arr(function(b64,validLen,placeHoldersLen){return 3*(validLen+placeHoldersLen)/4-placeHoldersLen}(0,validLen,placeHoldersLen)),curByte=0,len=placeHoldersLen>0?validLen-4:validLen;for(i=0;i>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp;2===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[curByte++]=255&tmp);1===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp);return arr},exports.fromByteArray=function(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,parts=[],i=0,len2=len-extraBytes;ilen2?len2:i+16383));1===extraBytes?(tmp=uint8[len-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"="));return parts.join("")};for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var validLen=b64.indexOf("=");return-1===validLen&&(validLen=len),[validLen,validLen===len?0:4-validLen%4]}function encodeChunk(uint8,start,end){for(var tmp,num,output=[],i=start;i>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]);return output.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63},{}],91:[function(require,module,exports){},{}],92:[function(require,module,exports){(function(global,Buffer){(function(){"use strict";var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):byteOffset>2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset=+byteOffset,isNaN(byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var i,indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength&&(byteOffset=arrLength-valLength),i=byteOffset;i>=0;i--){for(var found=!0,j=0;jremaining&&(length=remaining):length=remaining;var strLen=string.length;if(strLen%2!=0)throw new TypeError("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end)switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:128==(192&(secondByte=buf[i+1]))&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>127&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return function(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);var res="",i=0;for(;ithis.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if((end>>>=0)<=(start>>>=0))return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}.apply(this,arguments)},Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||0===Buffer.compare(this,b)},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES;return this.length>0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),""},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(this===target)return 0;for(var x=(thisEnd>>>=0)-(thisStart>>>=0),y=(end>>>=0)-(start>>>=0),len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;iremaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;ilen)&&(end=len);for(var out="",i=start;ilength)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,0,offset,4),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,0,offset,8),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}Buffer.prototype.slice=function(start,end){var newBuf,len=this.length;if((start=~~start)<0?(start+=len)<0&&(start=0):start>len&&(start=len),(end=void 0===end?len:~~end)<0?(end+=len)<0&&(end=0):end>len&&(end=len),end0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return val>=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){(value=+value,offset|=0,byteLength|=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0);var mul=1,i=0;for(this[offset]=255&value;++i=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,end=void 0===end?this.length:end>>>0,val||(val=0),"number"==typeof val)for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function base64ToBytes(str){return base64.toByteArray(function(str){if((str=function(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}(str).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;str.length%4!=0;)str+="=";return str}(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0!==window?window:{},require("buffer").Buffer)},{"base64-js":90,buffer:92,ieee754:94,isarray:95}],93:[function(require,module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if("number"!=typeof n||n<0||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if((er=arguments[1])instanceof Error)throw er;var err=new Error('Uncaught, unspecified "error" event. ('+er+")");throw err.context=er,err}if(isUndefined(handler=this._events[type]))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),len=(listeners=handler.slice()).length,i=0;i0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(length=(list=this._events[type]).length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(isFunction(listeners=this._events[type]))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){return this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],94:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),(value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias))*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],95:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return"[object Array]"==toString.call(arr)}},{}],96:[function(require,module,exports){!function(exports){"use strict";function isArray(obj){return null!==obj&&"[object Array]"===Object.prototype.toString.call(obj)}function isObject(obj){return null!==obj&&"[object Object]"===Object.prototype.toString.call(obj)}function strictDeepEqual(first,second){if(first===second)return!0;if(Object.prototype.toString.call(first)!==Object.prototype.toString.call(second))return!1;if(!0===isArray(first)){if(first.length!==second.length)return!1;for(var i=0;i":!0,"=":!0,"!":!0},skipChars={" ":!0,"\t":!0,"\n":!0};function isNum(ch){return ch>="0"&&ch<="9"||"-"===ch}function Lexer(){}Lexer.prototype={tokenize:function(stream){var start,identifier,token,ch,tokens=[];for(this._current=0;this._current="a"&&ch<="z"||ch>="A"&&ch<="Z"||"_"===ch)start=this._current,identifier=this._consumeUnquotedIdentifier(stream),tokens.push({type:"UnquotedIdentifier",value:identifier,start:start});else if(void 0!==basicTokens[stream[this._current]])tokens.push({type:basicTokens[stream[this._current]],value:stream[this._current],start:this._current}),this._current++;else if(isNum(stream[this._current]))token=this._consumeNumber(stream),tokens.push(token);else if("["===stream[this._current])token=this._consumeLBracket(stream),tokens.push(token);else if('"'===stream[this._current])start=this._current,identifier=this._consumeQuotedIdentifier(stream),tokens.push({type:"QuotedIdentifier",value:identifier,start:start});else if("'"===stream[this._current])start=this._current,identifier=this._consumeRawStringLiteral(stream),tokens.push({type:"Literal",value:identifier,start:start});else if("`"===stream[this._current]){start=this._current;var literal=this._consumeLiteral(stream);tokens.push({type:"Literal",value:literal,start:start})}else if(void 0!==operatorStartToken[stream[this._current]])tokens.push(this._consumeOperator(stream));else if(void 0!==skipChars[stream[this._current]])this._current++;else if("&"===stream[this._current])start=this._current,this._current++,"&"===stream[this._current]?(this._current++,tokens.push({type:"And",value:"&&",start:start})):tokens.push({type:"Expref",value:"&",start:start});else{if("|"!==stream[this._current]){var error=new Error("Unknown character:"+stream[this._current]);throw error.name="LexerError",error}start=this._current,this._current++,"|"===stream[this._current]?(this._current++,tokens.push({type:"Or",value:"||",start:start})):tokens.push({type:"Pipe",value:"|",start:start})}return tokens},_consumeUnquotedIdentifier:function(stream){var ch,start=this._current;for(this._current++;this._current="a"&&ch<="z"||ch>="A"&&ch<="Z"||ch>="0"&&ch<="9"||"_"===ch);)this._current++;return stream.slice(start,this._current)},_consumeQuotedIdentifier:function(stream){var start=this._current;this._current++;for(var maxLength=stream.length;'"'!==stream[this._current]&&this._current"===startingChar?"="===stream[this._current]?(this._current++,{type:"GTE",value:">=",start:start}):{type:"GT",value:">",start:start}:"="===startingChar&&"="===stream[this._current]?(this._current++,{type:"EQ",value:"==",start:start}):void 0},_consumeLiteral:function(stream){this._current++;for(var literal,start=this._current,maxLength=stream.length;"`"!==stream[this._current]&&this._current=0)return!0;if(["true","false","null"].indexOf(literalString)>=0)return!0;if(!("-0123456789".indexOf(literalString[0])>=0))return!1;try{return JSON.parse(literalString),!0}catch(ex){return!1}}};var bindingPower={};function Parser(){}function TreeInterpreter(runtime){this.runtime=runtime}function Runtime(interpreter){this._interpreter=interpreter,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[TYPE_NUMBER]}]},avg:{_func:this._functionAvg,_signature:[{types:[TYPE_ARRAY_NUMBER]}]},ceil:{_func:this._functionCeil,_signature:[{types:[TYPE_NUMBER]}]},contains:{_func:this._functionContains,_signature:[{types:[TYPE_STRING,TYPE_ARRAY]},{types:[TYPE_ANY]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[TYPE_STRING]},{types:[TYPE_STRING]}]},floor:{_func:this._functionFloor,_signature:[{types:[TYPE_NUMBER]}]},length:{_func:this._functionLength,_signature:[{types:[TYPE_STRING,TYPE_ARRAY,TYPE_OBJECT]}]},map:{_func:this._functionMap,_signature:[{types:[TYPE_EXPREF]},{types:[TYPE_ARRAY]}]},max:{_func:this._functionMax,_signature:[{types:[TYPE_ARRAY_NUMBER,TYPE_ARRAY_STRING]}]},merge:{_func:this._functionMerge,_signature:[{types:[TYPE_OBJECT],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[TYPE_ARRAY]},{types:[TYPE_EXPREF]}]},sum:{_func:this._functionSum,_signature:[{types:[TYPE_ARRAY_NUMBER]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[TYPE_STRING]},{types:[TYPE_STRING]}]},min:{_func:this._functionMin,_signature:[{types:[TYPE_ARRAY_NUMBER,TYPE_ARRAY_STRING]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[TYPE_ARRAY]},{types:[TYPE_EXPREF]}]},type:{_func:this._functionType,_signature:[{types:[TYPE_ANY]}]},keys:{_func:this._functionKeys,_signature:[{types:[TYPE_OBJECT]}]},values:{_func:this._functionValues,_signature:[{types:[TYPE_OBJECT]}]},sort:{_func:this._functionSort,_signature:[{types:[TYPE_ARRAY_STRING,TYPE_ARRAY_NUMBER]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[TYPE_ARRAY]},{types:[TYPE_EXPREF]}]},join:{_func:this._functionJoin,_signature:[{types:[TYPE_STRING]},{types:[TYPE_ARRAY_STRING]}]},reverse:{_func:this._functionReverse,_signature:[{types:[TYPE_STRING,TYPE_ARRAY]}]},to_array:{_func:this._functionToArray,_signature:[{types:[TYPE_ANY]}]},to_string:{_func:this._functionToString,_signature:[{types:[TYPE_ANY]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[TYPE_ANY]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[TYPE_ANY],variadic:!0}]}}}bindingPower.EOF=0,bindingPower.UnquotedIdentifier=0,bindingPower.QuotedIdentifier=0,bindingPower.Rbracket=0,bindingPower.Rparen=0,bindingPower.Comma=0,bindingPower.Rbrace=0,bindingPower.Number=0,bindingPower.Current=0,bindingPower.Expref=0,bindingPower.Pipe=1,bindingPower.Or=2,bindingPower.And=3,bindingPower.EQ=5,bindingPower.GT=5,bindingPower.LT=5,bindingPower.GTE=5,bindingPower.LTE=5,bindingPower.NE=5,bindingPower.Flatten=9,bindingPower.Star=20,bindingPower.Filter=21,bindingPower.Dot=40,bindingPower.Not=45,bindingPower.Lbrace=50,bindingPower.Lbracket=55,bindingPower.Lparen=60,Parser.prototype={parse:function(expression){this._loadTokens(expression),this.index=0;var ast=this.expression(0);if("EOF"!==this._lookahead(0)){var t=this._lookaheadToken(0),error=new Error("Unexpected token type: "+t.type+", value: "+t.value);throw error.name="ParserError",error}return ast},_loadTokens:function(expression){var tokens=(new Lexer).tokenize(expression);tokens.push({type:"EOF",value:"",start:expression.length}),this.tokens=tokens},expression:function(rbp){var leftToken=this._lookaheadToken(0);this._advance();for(var left=this.nud(leftToken),currentToken=this._lookahead(0);rbp=0?this.expression(rbp):"Lbracket"===lookahead?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===lookahead?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(rbp){var right;if(bindingPower[this._lookahead(0)]<10)right={type:"Identity"};else if("Lbracket"===this._lookahead(0))right=this.expression(rbp);else if("Filter"===this._lookahead(0))right=this.expression(rbp);else{if("Dot"!==this._lookahead(0)){var t=this._lookaheadToken(0),error=new Error("Sytanx error, unexpected token: "+t.value+"("+t.type+")");throw error.name="ParserError",error}this._match("Dot"),right=this._parseDotRHS(rbp)}return right},_parseMultiselectList:function(){for(var expressions=[];"Rbracket"!==this._lookahead(0);){var expression=this.expression(0);if(expressions.push(expression),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:expressions}},_parseMultiselectHash:function(){for(var keyToken,keyName,node,pairs=[],identifierTypes=["UnquotedIdentifier","QuotedIdentifier"];;){if(keyToken=this._lookaheadToken(0),identifierTypes.indexOf(keyToken.type)<0)throw new Error("Expecting an identifier token, got: "+keyToken.type);if(keyName=keyToken.value,this._advance(),this._match("Colon"),node={type:"KeyValuePair",name:keyName,value:this.expression(0)},pairs.push(node),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:pairs}}},TreeInterpreter.prototype={search:function(node,value){return this.visit(node,value)},visit:function(node,value){var matched,current,result,first,second,field,left,collected,i;switch(node.type){case"Field":return null===value?null:isObject(value)?void 0===(field=value[node.name])?null:field:null;case"Subexpression":for(result=this.visit(node.children[0],value),i=1;i0)for(i=start;istop;i+=step)result.push(value[i]);return result;case"Projection":var base=this.visit(node.children[0],value);if(!isArray(base))return null;for(collected=[],i=0;isecond;break;case"GTE":result=first>=second;break;case"LT":result=first=arrayLength&&(actualValue=step<0?arrayLength-1:arrayLength),actualValue}},Runtime.prototype={callFunction:function(name,resolvedArgs){var functionEntry=this.functionTable[name];if(void 0===functionEntry)throw new Error("Unknown function: "+name+"()");return this._validateArgs(name,resolvedArgs,functionEntry._signature),functionEntry._func.call(this,resolvedArgs)},_validateArgs:function(name,args,signature){var pluralized,currentSpec,actualType,typeMatched;if(signature[signature.length-1].variadic){if(args.length=0;i--)reversedStr+=originalStr[i];return reversedStr}var reversedArray=resolvedArgs[0].slice(0);return reversedArray.reverse(),reversedArray},_functionAbs:function(resolvedArgs){return Math.abs(resolvedArgs[0])},_functionCeil:function(resolvedArgs){return Math.ceil(resolvedArgs[0])},_functionAvg:function(resolvedArgs){for(var sum=0,inputArray=resolvedArgs[0],i=0;i=0},_functionFloor:function(resolvedArgs){return Math.floor(resolvedArgs[0])},_functionLength:function(resolvedArgs){return isObject(resolvedArgs[0])?Object.keys(resolvedArgs[0]).length:resolvedArgs[0].length},_functionMap:function(resolvedArgs){for(var mapped=[],interpreter=this._interpreter,exprefNode=resolvedArgs[0],elements=resolvedArgs[1],i=0;i0){if(this._getTypeName(resolvedArgs[0][0])===TYPE_NUMBER)return Math.max.apply(Math,resolvedArgs[0]);for(var elements=resolvedArgs[0],maxElement=elements[0],i=1;i0){if(this._getTypeName(resolvedArgs[0][0])===TYPE_NUMBER)return Math.min.apply(Math,resolvedArgs[0]);for(var elements=resolvedArgs[0],minElement=elements[0],i=1;iexprB?1:exprAmaxNumber&&(maxNumber=current,maxRecord=resolvedArray[i]);return maxRecord},_functionMinBy:function(resolvedArgs){for(var minRecord,current,exprefNode=resolvedArgs[1],resolvedArray=resolvedArgs[0],keyFunction=this.createKeyFunction(exprefNode,[TYPE_NUMBER,TYPE_STRING]),minNumber=1/0,i=0;i1)for(var i=1;i= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode;function error(type){throw RangeError(errors[type])}function map(array,fn){for(var length=array.length,result=[];length--;)result[length]=fn(array[length]);return result}function mapDomain(string,fn){var parts=string.split("@"),result="";return parts.length>1&&(result=parts[0]+"@",string=parts[1]),result+map((string=string.replace(regexSeparators,".")).split("."),fn).join(".")}function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter=55296&&value<=56319&&counter65535&&(output+=stringFromCharCode((value-=65536)>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value)}).join("")}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((0!=flag)<<5)}function adapt(delta,numPoints,firstTime){var k=0;for(delta=firstTime?floor(delta/damp):delta>>1,delta+=floor(delta/numPoints);delta>baseMinusTMin*tMax>>1;k+=base)delta=floor(delta/baseMinusTMin);return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var out,basic,j,index,oldi,w,k,digit,t,baseMinusT,codePoint,output=[],inputLength=input.length,i=0,n=initialN,bias=initialBias;for((basic=input.lastIndexOf(delimiter))<0&&(basic=0),j=0;j=128&&error("not-basic"),output.push(input.charCodeAt(j));for(index=basic>0?basic+1:0;index=inputLength&&error("invalid-input"),((digit=(codePoint=input.charCodeAt(index++))-48<10?codePoint-22:codePoint-65<26?codePoint-65:codePoint-97<26?codePoint-97:base)>=base||digit>floor((maxInt-i)/w))&&error("overflow"),i+=digit*w,!(digit<(t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias));k+=base)w>floor(maxInt/(baseMinusT=base-t))&&error("overflow"),w*=baseMinusT;bias=adapt(i-oldi,out=output.length+1,0==oldi),floor(i/out)>maxInt-n&&error("overflow"),n+=floor(i/out),i%=out,output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,inputLength,handledCPCountPlusOne,baseMinusT,qMinusT,output=[];for(inputLength=(input=ucs2decode(input)).length,n=initialN,delta=0,bias=initialBias,j=0;j=n&¤tValuefloor((maxInt-delta)/(handledCPCountPlusOne=handledCPCount+1))&&error("overflow"),delta+=(m-n)*handledCPCountPlusOne,n=m,j=0;jmaxInt&&error("overflow"),currentValue==n){for(q=delta,k=base;!(q<(t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias));k+=base)qMinusT=q-t,baseMinusT=base-t,output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0))),q=floor(qMinusT/baseMinusT);output.push(stringFromCharCode(digitToBasic(q,0))),bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength),delta=0,++handledCPCount}++delta,++n}return output.join("")}if(punycode={version:"1.3.2",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:function(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})},toUnicode:function(input){return mapDomain(input,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return punycode});else if(freeExports&&freeModule)if(module.exports==freeExports)freeModule.exports=punycode;else for(key in punycode)punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);else root.punycode=punycode}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0!==window?window:{})},{}],99:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&",eq=eq||"=";var obj={};if("string"!=typeof qs||0===qs.length)return obj;var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;options&&"number"==typeof options.maxKeys&&(maxKeys=options.maxKeys);var len=qs.length;maxKeys>0&&len>maxKeys&&(len=maxKeys);for(var i=0;i=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)}},{}],100:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){return sep=sep||"&",eq=eq||"=",null===obj&&(obj=void 0),"object"==typeof obj?map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;return isArray(obj[k])?map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep):ks+encodeURIComponent(stringifyPrimitive(obj[k]))}).join(sep):name?encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj)):""};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)};function map(xs,f){if(xs.map)return xs.map(f);for(var res=[],i=0;i0&&len>maxKeys&&(len=maxKeys);for(var i=0;i=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?Array.isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj}},{}],103:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){return sep=sep||"&",eq=eq||"=",null===obj&&(obj=void 0),"object"==typeof obj?Object.keys(obj).map(function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;return Array.isArray(obj[k])?obj[k].map(function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep):ks+encodeURIComponent(stringifyPrimitive(obj[k]))}).join(sep):name?encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj)):""}},{}],104:[function(require,module,exports){arguments[4][101][0].apply(exports,arguments)},{"./decode":102,"./encode":103,dup:101}],105:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require("process/browser.js").nextTick,apply=Function.prototype.apply,slice=Array.prototype.slice,immediateIds={},nextImmediateId=0;function Timeout(id,clearFn){this._id=id,this._clearFn=clearFn}exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId),item._idleTimeout=msecs},exports.unenroll=function(item){clearTimeout(item._idleTimeoutId),item._idleTimeout=-1},exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;msecs>=0&&(item._idleTimeoutId=setTimeout(function(){item._onTimeout&&item._onTimeout()},msecs))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(fn){var id=nextImmediateId++,args=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[id]=!0,nextTick(function(){immediateIds[id]&&(args?fn.apply(null,args):fn.call(null),exports.clearImmediate(id))}),id},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(id){delete immediateIds[id]}}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":97,timers:105}],106:[function(require,module,exports){var punycode=require("punycode");function Url(){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}exports.parse=urlParse,exports.resolve=function(source,relative){return urlParse(source,!1,!0).resolve(relative)},exports.resolveObject=function(source,relative){return source?urlParse(source,!1,!0).resolveObject(relative):relative},exports.format=function(obj){isString(obj)&&(obj=urlParse(obj));return obj instanceof Url?obj.format():Url.prototype.format.call(obj)},exports.Url=Url;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,unwise=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnamePartPattern=/^[a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&isObject(url)&&url instanceof Url)return url;var u=new Url;return u.parse(url,parseQueryString,slashesDenoteHost),u}function isString(arg){return"string"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isNull(arg){return null===arg}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!isString(url))throw new TypeError("Parameter 'url' must be a string, not "+typeof url);var rest=url;rest=rest.trim();var proto=protocolPattern.exec(rest);if(proto){var lowerProto=(proto=proto[0]).toLowerCase();this.protocol=lowerProto,rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes="//"===rest.substr(0,2);!slashes||proto&&hostlessProtocol[proto]||(rest=rest.substr(2),this.slashes=!0)}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){for(var auth,atSign,hostEnd=-1,i=0;i127?newpart+="x":newpart+=part[j];if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i),notHost=hostparts.slice(i+1),bit=part.match(hostnamePartStart);bit&&(validParts.push(bit[1]),notHost.unshift(bit[2])),notHost.length&&(rest="/"+notHost.join(".")+rest),this.hostname=validParts.join(".");break}}}if(this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),!ipv6Hostname){var domainArray=this.hostname.split("."),newOut=[];for(i=0;i0)&&result.host.split("@"))&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift());return result.search=relative.search,result.query=relative.query,isNull(result.pathname)&&isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.href=result.format(),result}if(!srcPath.length)return result.pathname=null,result.search?result.path="/"+result.search:result.path=null,result.href=result.format(),result;for(var last=srcPath.slice(-1)[0],hasTrailingSlash=(result.host||relative.host)&&("."===last||".."===last)||""===last,up=0,i=srcPath.length;i>=0;i--)"."==(last=srcPath[i])?srcPath.splice(i,1):".."===last?(srcPath.splice(i,1),up++):up&&(srcPath.splice(i,1),up--);if(!mustEndAbs&&!removeAllDots)for(;up--;up)srcPath.unshift("..");!mustEndAbs||""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0)||srcPath.unshift(""),hasTrailingSlash&&"/"!==srcPath.join("/").substr(-1)&&srcPath.push("");var authInHost,isAbsolute=""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0);psychotic&&(result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"",(authInHost=!!(result.host&&result.host.indexOf("@")>0)&&result.host.split("@"))&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift()));return(mustEndAbs=mustEndAbs||result.host&&srcPath.length)&&!isAbsolute&&srcPath.unshift(""),srcPath.length?result.pathname=srcPath.join("/"):(result.pathname=null,result.path=null),isNull(result.pathname)&&isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.auth=relative.auth||result.auth,result.slashes=result.slashes||relative.slashes,result.href=result.format(),result},Url.prototype.parseHost=function(){var host=this.host,port=portPattern.exec(host);port&&(":"!==(port=port[0])&&(this.port=port.substr(1)),host=host.substr(0,host.length-port.length)),host&&(this.hostname=host)}},{punycode:98,querystring:101}],107:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],108:[function(require,module,exports){module.exports=function(arg){return arg&&"object"==typeof arg&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],109:[function(require,module,exports){(function(process,global){(function(){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){for(var objects=[],i=0;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}}),x=args[i];i=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str,styleType){return str}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=function(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=function(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var output,base="",array=!1,braces=["{","}"];(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value))&&(base=" [Function"+(value.name?": "+value.name:"")+"]");return isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0!==keys.length||array&&0!=value.length?recurseTimes<0?isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special"):(ctx.seen.push(value),output=array?function(ctx,value,recurseTimes,visibleKeys,keys){for(var output=[],i=0,l=value.length;i=0&&0,prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1];return braces[0]+base+" "+output.join(", ")+" "+braces[1]}(output,base,braces)):braces[0]+base+braces[1]}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if((desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]}).get?str=desc.set?ctx.stylize("[Getter/Setter]","special"):ctx.stylize("[Getter]","special"):desc.set&&(str=ctx.stylize("[Setter]","special")),hasOwnProperty(visibleKeys,key)||(name="["+key+"]"),str||(ctx.seen.indexOf(desc.value)<0?(str=isNull(recurseTimes)?formatValue(ctx,desc.value,null):formatValue(ctx,desc.value,recurseTimes-1)).indexOf("\n")>-1&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n")):str=ctx.stylize("[Circular]","special")),isUndefined(name)){if(array&&key.match(/^\d+$/))return str;(name=JSON.stringify(""+key)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),name=ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string"))}return name+": "+str}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isUndefined(arg){return void 0===arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}exports.debuglog=function(set){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),set=set.toUpperCase(),!debugs[set])if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]},exports.inspect=inspect,inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=function(arg){return null==arg},exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=function(arg){return"symbol"==typeof arg},exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=function(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||void 0===arg},exports.isBuffer=require("./support/isBuffer");var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}exports.log=function(){var d,time;console.log("%s - %s",(d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":"),[d.getDate(),months[d.getMonth()],time].join(" ")),exports.format.apply(exports,arguments))},exports.inherits=require("inherits"),exports._extend=function(origin,add){if(!add||!isObject(add))return origin;for(var keys=Object.keys(add),i=keys.length;i--;)origin[keys[i]]=add[keys[i]];return origin}}).call(this)}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0!==window?window:{})},{"./support/isBuffer":108,_process:97,inherits:107}],110:[function(require,module,exports){var v1=require("./v1"),v4=require("./v4"),uuid=v4;uuid.v1=v1,uuid.v4=v4,module.exports=uuid},{"./v1":113,"./v4":114}],111:[function(require,module,exports){for(var byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);module.exports=function(buf,offset){var i=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")}},{}],112:[function(require,module,exports){var getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);module.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);module.exports=function(){for(var r,i=0;i<16;i++)0==(3&i)&&(r=4294967296*Math.random()),rnds[i]=r>>>((3&i)<<3)&255;return rnds}}},{}],113:[function(require,module,exports){var _nodeId,_clockseq,rng=require("./lib/rng"),bytesToUuid=require("./lib/bytesToUuid"),_lastMSecs=0,_lastNSecs=0;module.exports=function(options,buf,offset){var i=buf&&offset||0,b=buf||[],node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){var seedBytes=rng();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}var msecs=void 0!==options.msecs?options.msecs:(new Date).getTime(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq;var tl=(1e4*(268435455&(msecs+=122192928e5))+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(var n=0;n<6;++n)b[i+n]=node[n];return buf||bytesToUuid(b)}},{"./lib/bytesToUuid":111,"./lib/rng":112}],114:[function(require,module,exports){var rng=require("./lib/rng"),bytesToUuid=require("./lib/bytesToUuid");module.exports=function(options,buf,offset){var i=buf&&offset||0;"string"==typeof options&&(buf="binary"===options?new Array(16):null,options=null);var rnds=(options=options||{}).random||(options.rng||rng)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(var ii=0;ii<16;++ii)buf[i+ii]=rnds[ii];return buf||bytesToUuid(rnds)}},{"./lib/bytesToUuid":111,"./lib/rng":112}],115:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var LRU_1=require("./utils/LRU"),CACHE_SIZE=1e3,EndpointCache=function(){function EndpointCache(maxSize){void 0===maxSize&&(maxSize=CACHE_SIZE),this.maxSize=maxSize,this.cache=new LRU_1.LRUCache(maxSize)}return Object.defineProperty(EndpointCache.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),EndpointCache.prototype.put=function(key,value){var keyString="string"!=typeof key?EndpointCache.getKeyString(key):key,endpointRecord=this.populateValue(value);this.cache.put(keyString,endpointRecord)},EndpointCache.prototype.get=function(key){var keyString="string"!=typeof key?EndpointCache.getKeyString(key):key,now=Date.now(),records=this.cache.get(keyString);if(records){for(var i=records.length-1;i>=0;i--){records[i].Expire-1});var viewStrings=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object DataView]"];module.exports={isEmptyData:function(data){return"string"==typeof data?0===data.length:0===data.byteLength},convertToBuffer:function(data){return"string"==typeof data&&(data=new Buffer(data,"utf8")),ArrayBuffer.isView(data)?new Uint8Array(data.buffer,data.byteOffset,data.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(data)}}},{"buffer/":92}],20:[function(require,module,exports){var hashUtils=require("./browserHashUtils");function Hmac(hashCtor,secret){this.hash=new hashCtor,this.outer=new hashCtor;var inner=function(hashCtor,secret){var input=hashUtils.convertToBuffer(secret);if(input.byteLength>hashCtor.BLOCK_SIZE){var bufferHash=new hashCtor;bufferHash.update(input),input=bufferHash.digest()}var buffer=new Uint8Array(hashCtor.BLOCK_SIZE);return buffer.set(input),buffer}(hashCtor,secret),outer=new Uint8Array(hashCtor.BLOCK_SIZE);outer.set(inner);for(var i=0;i>>32-s)+b&4294967295}function ff(a,b,c,d,x,s,t){return cmn(b&c|~b&d,a,b,x,s,t)}function gg(a,b,c,d,x,s,t){return cmn(b&d|c&~d,a,b,x,s,t)}function hh(a,b,c,d,x,s,t){return cmn(b^c^d,a,b,x,s,t)}function ii(a,b,c,d,x,s,t){return cmn(c^(b|~d),a,b,x,s,t)}module.exports=Md5,Md5.BLOCK_SIZE=BLOCK_SIZE,Md5.prototype.update=function(sourceData){if(hashUtils.isEmptyData(sourceData))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var data=hashUtils.convertToBuffer(sourceData),position=0,byteLength=data.byteLength;for(this.bytesHashed+=byteLength;byteLength>0;)this.buffer.setUint8(this.bufferLength++,data[position++]),byteLength--,this.bufferLength===BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0);return this},Md5.prototype.digest=function(encoding){if(!this.finished){var buffer=this.buffer,undecoratedLength=this.bufferLength,bitsHashed=8*this.bytesHashed;if(buffer.setUint8(this.bufferLength++,128),undecoratedLength%BLOCK_SIZE>=BLOCK_SIZE-8){for(var i=this.bufferLength;i>>0,!0),buffer.setUint32(BLOCK_SIZE-4,Math.floor(bitsHashed/4294967296),!0),this.hashBuffer(),this.finished=!0}var out=new DataView(new ArrayBuffer(16));for(i=0;i<4;i++)out.setUint32(4*i,this.state[i],!0);var buff=new Buffer(out.buffer,out.byteOffset,out.byteLength);return encoding?buff.toString(encoding):buff},Md5.prototype.hashBuffer=function(){var buffer=this.buffer,state=this.state,a=state[0],b=state[1],c=state[2],d=state[3];a=ff(a,b,c,d,buffer.getUint32(0,!0),7,3614090360),d=ff(d,a,b,c,buffer.getUint32(4,!0),12,3905402710),c=ff(c,d,a,b,buffer.getUint32(8,!0),17,606105819),b=ff(b,c,d,a,buffer.getUint32(12,!0),22,3250441966),a=ff(a,b,c,d,buffer.getUint32(16,!0),7,4118548399),d=ff(d,a,b,c,buffer.getUint32(20,!0),12,1200080426),c=ff(c,d,a,b,buffer.getUint32(24,!0),17,2821735955),b=ff(b,c,d,a,buffer.getUint32(28,!0),22,4249261313),a=ff(a,b,c,d,buffer.getUint32(32,!0),7,1770035416),d=ff(d,a,b,c,buffer.getUint32(36,!0),12,2336552879),c=ff(c,d,a,b,buffer.getUint32(40,!0),17,4294925233),b=ff(b,c,d,a,buffer.getUint32(44,!0),22,2304563134),a=ff(a,b,c,d,buffer.getUint32(48,!0),7,1804603682),d=ff(d,a,b,c,buffer.getUint32(52,!0),12,4254626195),c=ff(c,d,a,b,buffer.getUint32(56,!0),17,2792965006),a=gg(a,b=ff(b,c,d,a,buffer.getUint32(60,!0),22,1236535329),c,d,buffer.getUint32(4,!0),5,4129170786),d=gg(d,a,b,c,buffer.getUint32(24,!0),9,3225465664),c=gg(c,d,a,b,buffer.getUint32(44,!0),14,643717713),b=gg(b,c,d,a,buffer.getUint32(0,!0),20,3921069994),a=gg(a,b,c,d,buffer.getUint32(20,!0),5,3593408605),d=gg(d,a,b,c,buffer.getUint32(40,!0),9,38016083),c=gg(c,d,a,b,buffer.getUint32(60,!0),14,3634488961),b=gg(b,c,d,a,buffer.getUint32(16,!0),20,3889429448),a=gg(a,b,c,d,buffer.getUint32(36,!0),5,568446438),d=gg(d,a,b,c,buffer.getUint32(56,!0),9,3275163606),c=gg(c,d,a,b,buffer.getUint32(12,!0),14,4107603335),b=gg(b,c,d,a,buffer.getUint32(32,!0),20,1163531501),a=gg(a,b,c,d,buffer.getUint32(52,!0),5,2850285829),d=gg(d,a,b,c,buffer.getUint32(8,!0),9,4243563512),c=gg(c,d,a,b,buffer.getUint32(28,!0),14,1735328473),a=hh(a,b=gg(b,c,d,a,buffer.getUint32(48,!0),20,2368359562),c,d,buffer.getUint32(20,!0),4,4294588738),d=hh(d,a,b,c,buffer.getUint32(32,!0),11,2272392833),c=hh(c,d,a,b,buffer.getUint32(44,!0),16,1839030562),b=hh(b,c,d,a,buffer.getUint32(56,!0),23,4259657740),a=hh(a,b,c,d,buffer.getUint32(4,!0),4,2763975236),d=hh(d,a,b,c,buffer.getUint32(16,!0),11,1272893353),c=hh(c,d,a,b,buffer.getUint32(28,!0),16,4139469664),b=hh(b,c,d,a,buffer.getUint32(40,!0),23,3200236656),a=hh(a,b,c,d,buffer.getUint32(52,!0),4,681279174),d=hh(d,a,b,c,buffer.getUint32(0,!0),11,3936430074),c=hh(c,d,a,b,buffer.getUint32(12,!0),16,3572445317),b=hh(b,c,d,a,buffer.getUint32(24,!0),23,76029189),a=hh(a,b,c,d,buffer.getUint32(36,!0),4,3654602809),d=hh(d,a,b,c,buffer.getUint32(48,!0),11,3873151461),c=hh(c,d,a,b,buffer.getUint32(60,!0),16,530742520),a=ii(a,b=hh(b,c,d,a,buffer.getUint32(8,!0),23,3299628645),c,d,buffer.getUint32(0,!0),6,4096336452),d=ii(d,a,b,c,buffer.getUint32(28,!0),10,1126891415),c=ii(c,d,a,b,buffer.getUint32(56,!0),15,2878612391),b=ii(b,c,d,a,buffer.getUint32(20,!0),21,4237533241),a=ii(a,b,c,d,buffer.getUint32(48,!0),6,1700485571),d=ii(d,a,b,c,buffer.getUint32(12,!0),10,2399980690),c=ii(c,d,a,b,buffer.getUint32(40,!0),15,4293915773),b=ii(b,c,d,a,buffer.getUint32(4,!0),21,2240044497),a=ii(a,b,c,d,buffer.getUint32(32,!0),6,1873313359),d=ii(d,a,b,c,buffer.getUint32(60,!0),10,4264355552),c=ii(c,d,a,b,buffer.getUint32(24,!0),15,2734768916),b=ii(b,c,d,a,buffer.getUint32(52,!0),21,1309151649),a=ii(a,b,c,d,buffer.getUint32(16,!0),6,4149444226),d=ii(d,a,b,c,buffer.getUint32(44,!0),10,3174756917),c=ii(c,d,a,b,buffer.getUint32(8,!0),15,718787259),b=ii(b,c,d,a,buffer.getUint32(36,!0),21,3951481745),state[0]=a+state[0]&4294967295,state[1]=b+state[1]&4294967295,state[2]=c+state[2]&4294967295,state[3]=d+state[3]&4294967295}},{"./browserHashUtils":19,"buffer/":92}],22:[function(require,module,exports){var Buffer=require("buffer/").Buffer,hashUtils=require("./browserHashUtils");new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function Sha1(){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}module.exports=Sha1,Sha1.BLOCK_SIZE=64,Sha1.prototype.update=function(data){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(hashUtils.isEmptyData(data))return this;var length=(data=hashUtils.convertToBuffer(data)).length;this.totalLength+=8*length;for(var i=0;i14||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 s=24;s>=0;s-=8)this.write(this.totalLength>>s);var out=new Buffer(20),outView=new DataView(out.buffer);return outView.setUint32(0,this.h0,!1),outView.setUint32(4,this.h1,!1),outView.setUint32(8,this.h2,!1),outView.setUint32(12,this.h3,!1),outView.setUint32(16,this.h4,!1),encoding?out.toString(encoding):out},Sha1.prototype.processBlock=function(){for(var i=16;i<80;i++){var w=this.block[i-3]^this.block[i-8]^this.block[i-14]^this.block[i-16];this.block[i]=w<<1|w>>>31}var f,k,a=this.h0,b=this.h1,c=this.h2,d=this.h3,e=this.h4;for(i=0;i<80;i++){i<20?(f=d^b&(c^d),k=1518500249):i<40?(f=b^c^d,k=1859775393):i<60?(f=b&c|d&(b|c),k=2400959708):(f=b^c^d,k=3395469782);var temp=(a<<5|a>>>27)+f+e+k+(0|this.block[i]);e=d,d=c,c=b<<30|b>>>2,b=a,a=temp}for(this.h0=this.h0+a|0,this.h1=this.h1+b|0,this.h2=this.h2+c|0,this.h3=this.h3+d|0,this.h4=this.h4+e|0,this.offset=0,i=0;i<16;i++)this.block[i]=0}},{"./browserHashUtils":19,"buffer/":92}],23:[function(require,module,exports){var Buffer=require("buffer/").Buffer,hashUtils=require("./browserHashUtils"),KEY=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]),MAX_HASHABLE_LENGTH=Math.pow(2,53)-1;function Sha256(){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}module.exports=Sha256,Sha256.BLOCK_SIZE=64,Sha256.prototype.update=function(data){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(hashUtils.isEmptyData(data))return this;var position=0,byteLength=(data=hashUtils.convertToBuffer(data)).byteLength;if(this.bytesHashed+=byteLength,8*this.bytesHashed>MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;byteLength>0;)this.buffer[this.bufferLength++]=data[position++],byteLength--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},Sha256.prototype.digest=function(encoding){if(!this.finished){var bitsHashed=8*this.bytesHashed,bufferView=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),undecoratedLength=this.bufferLength;if(bufferView.setUint8(this.bufferLength++,128),undecoratedLength%64>=56){for(var i=this.bufferLength;i<64;i++)bufferView.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<56;i++)bufferView.setUint8(i,0);bufferView.setUint32(56,Math.floor(bitsHashed/4294967296),!0),bufferView.setUint32(60,bitsHashed),this.hashBuffer(),this.finished=!0}var out=new Buffer(32);for(i=0;i<8;i++)out[4*i]=this.state[i]>>>24&255,out[4*i+1]=this.state[i]>>>16&255,out[4*i+2]=this.state[i]>>>8&255,out[4*i+3]=this.state[i]>>>0&255;return encoding?out.toString(encoding):out},Sha256.prototype.hashBuffer=function(){for(var buffer=this.buffer,state=this.state,state0=state[0],state1=state[1],state2=state[2],state3=state[3],state4=state[4],state5=state[5],state6=state[6],state7=state[7],i=0;i<64;i++){if(i<16)this.temp[i]=(255&buffer[4*i])<<24|(255&buffer[4*i+1])<<16|(255&buffer[4*i+2])<<8|255&buffer[4*i+3];else{var u=this.temp[i-2],t1_1=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,t2_1=((u=this.temp[i-15])>>>7|u<<25)^(u>>>18|u<<14)^u>>>3;this.temp[i]=(t1_1+this.temp[i-7]|0)+(t2_1+this.temp[i-16]|0)}var t1=(((state4>>>6|state4<<26)^(state4>>>11|state4<<21)^(state4>>>25|state4<<7))+(state4&state5^~state4&state6)|0)+(state7+(KEY[i]+this.temp[i]|0)|0)|0,t2=((state0>>>2|state0<<30)^(state0>>>13|state0<<19)^(state0>>>22|state0<<10))+(state0&state1^state0&state2^state1&state2)|0;state7=state6,state6=state5,state5=state4,state4=state3+t1|0,state3=state2,state2=state1,state1=state0,state0=t1+t2|0}state[0]+=state0,state[1]+=state1,state[2]+=state2,state[3]+=state3,state[4]+=state4,state[5]+=state5,state[6]+=state6,state[7]+=state7}},{"./browserHashUtils":19,"buffer/":92}],24:[function(require,module,exports){(function(process){(function(){var util=require("./util");util.crypto.lib=require("./browserCryptoLib"),util.Buffer=require("buffer/").Buffer,util.url=require("url/"),util.querystring=require("querystring/"),util.realClock=require("./realclock/browserClock"),util.environment="js",util.createEventStream=require("./event-stream/buffered-create-event-stream").createEventStream,util.isBrowser=function(){return!0},util.isNode=function(){return!1};var AWS=require("./core");if(module.exports=AWS,require("./credentials"),require("./credentials/credential_provider_chain"),require("./credentials/temporary_credentials"),require("./credentials/chainable_temporary_credentials"),require("./credentials/web_identity_credentials"),require("./credentials/cognito_identity_credentials"),require("./credentials/saml_credentials"),AWS.XML.Parser=require("./xml/browser_parser"),require("./http/xhr"),void 0===process)var process={browser:!0}}).call(this)}).call(this,require("_process"))},{"./browserCryptoLib":18,"./core":27,"./credentials":28,"./credentials/chainable_temporary_credentials":29,"./credentials/cognito_identity_credentials":30,"./credentials/credential_provider_chain":31,"./credentials/saml_credentials":32,"./credentials/temporary_credentials":33,"./credentials/web_identity_credentials":34,"./event-stream/buffered-create-event-stream":36,"./http/xhr":44,"./realclock/browserClock":61,"./util":83,"./xml/browser_parser":84,_process:97,"buffer/":92,"querystring/":104,"url/":106}],25:[function(require,module,exports){var PromisesDependency,AWS=require("./core");require("./credentials"),require("./credentials/credential_provider_chain"),AWS.Config=AWS.util.inherit({constructor:function(options){void 0===options&&(options={}),options=this.extractCredentials(options),AWS.util.each.call(this,this.keys,function(key,value){this.set(key,options[key],value)})},getCredentials:function(callback){var err,self=this;function finish(err){callback(err,err?null:self.credentials)}function credError(msg,err){return new AWS.util.error(err||new Error,{code:"CredentialsError",message:msg,name:"CredentialsError"})}self.credentials?"function"==typeof self.credentials.get?self.credentials.get(function(err){err&&(err=credError("Could not load credentials from "+self.credentials.constructor.name,err)),finish(err)}):(err=null,self.credentials.accessKeyId&&self.credentials.secretAccessKey||(err=credError("Missing credentials")),finish(err)):self.credentialProvider?self.credentialProvider.resolve(function(err,creds){err&&(err=credError("Could not load credentials from any providers",err)),self.credentials=creds,finish(err)}):finish(credError("No credentials to load"))},update:function(options,allowUnknownKeys){allowUnknownKeys=allowUnknownKeys||!1,options=this.extractCredentials(options),AWS.util.each.call(this,options,function(key,value){(allowUnknownKeys||Object.prototype.hasOwnProperty.call(this.keys,key)||AWS.Service.hasService(key))&&this.set(key,value)})},loadFromPath:function(path){this.clear();var options=JSON.parse(AWS.util.readFileSync(path)),fileSystemCreds=new AWS.FileSystemCredentials(path),chain=new AWS.CredentialProviderChain;return chain.providers.unshift(fileSystemCreds),chain.resolve(function(err,creds){if(err)throw err;options.credentials=creds}),this.constructor(options),this},clear:function(){AWS.util.each.call(this,this.keys,function(key){delete this[key]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(property,value,defaultValue){void 0===value?(void 0===defaultValue&&(defaultValue=this.keys[property]),this[property]="function"==typeof defaultValue?defaultValue.call(this):defaultValue):"httpOptions"===property&&this[property]?this[property]=AWS.util.merge(this[property],value):this[property]=value},keys:{credentials:null,credentialProvider:null,region:null,logger:null,apiVersions:{},apiVersion:null,endpoint:void 0,httpOptions:{timeout:12e4},maxRetries:void 0,maxRedirects:10,paramValidation:!0,sslEnabled:!0,s3ForcePathStyle:!1,s3BucketEndpoint:!1,s3DisableBodySigning:!0,s3UsEast1RegionalEndpoint:"legacy",s3UseArnRegion:void 0,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0,retryDelayOptions:{},useAccelerateEndpoint:!1,clientSideMonitoring:!1,endpointDiscoveryEnabled:void 0,endpointCacheSize:1e3,hostPrefixEnabled:!0,stsRegionalEndpoints:"legacy"},extractCredentials:function(options){return options.accessKeyId&&options.secretAccessKey&&((options=AWS.util.copy(options)).credentials=new AWS.Credentials(options)),options},setPromisesDependency:function(dep){PromisesDependency=dep,null===dep&&"function"==typeof Promise&&(PromisesDependency=Promise);var constructors=[AWS.Request,AWS.Credentials,AWS.CredentialProviderChain];AWS.S3&&(constructors.push(AWS.S3),AWS.S3.ManagedUpload&&constructors.push(AWS.S3.ManagedUpload)),AWS.util.addPromises(constructors,PromisesDependency)},getPromisesDependency:function(){return PromisesDependency}}),AWS.config=new AWS.Config},{"./core":27,"./credentials":28,"./credentials/credential_provider_chain":31}],26:[function(require,module,exports){(function(process){(function(){var AWS=require("./core");function validateRegionalEndpointsFlagValue(configValue,errorOptions){if("string"==typeof configValue){if(["legacy","regional"].indexOf(configValue.toLowerCase())>=0)return configValue.toLowerCase();throw AWS.util.error(new Error,errorOptions)}}module.exports=function(originalConfig,options){var resolved;if((originalConfig=originalConfig||{})[options.clientConfig]&&(resolved=validateRegionalEndpointsFlagValue(originalConfig[options.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+options.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+originalConfig[options.clientConfig]+'".'})))return resolved;if(!AWS.util.isNode())return resolved;if(Object.prototype.hasOwnProperty.call(process.env,options.env)&&(resolved=validateRegionalEndpointsFlagValue(process.env[options.env],{code:"InvalidEnvironmentalVariable",message:"invalid "+options.env+' environmental variable. Expect "legacy" or "regional". Got "'+process.env[options.env]+'".'})))return resolved;var profile={};try{profile=AWS.util.getProfilesFromSharedConfig(AWS.util.iniLoader)[process.env.AWS_PROFILE||AWS.util.defaultProfile]}catch(e){}return profile&&Object.prototype.hasOwnProperty.call(profile,options.sharedConfig)&&(resolved=validateRegionalEndpointsFlagValue(profile[options.sharedConfig],{code:"InvalidConfiguration",message:"invalid "+options.sharedConfig+' profile config. Expect "legacy" or "regional". Got "'+profile[options.sharedConfig]+'".'})),resolved}}).call(this)}).call(this,require("_process"))},{"./core":27,_process:97}],27:[function(require,module,exports){var AWS={util:require("./util")};({}).toString(),module.exports=AWS,AWS.util.update(AWS,{VERSION:"2.906.0",Signers:{},Protocol:{Json:require("./protocol/json"),Query:require("./protocol/query"),Rest:require("./protocol/rest"),RestJson:require("./protocol/rest_json"),RestXml:require("./protocol/rest_xml")},XML:{Builder:require("./xml/builder"),Parser:null},JSON:{Builder:require("./json/builder"),Parser:require("./json/parser")},Model:{Api:require("./model/api"),Operation:require("./model/operation"),Shape:require("./model/shape"),Paginator:require("./model/paginator"),ResourceWaiter:require("./model/resource_waiter")},apiLoader:require("./api_loader"),EndpointCache:require("../vendor/endpoint-cache").EndpointCache}),require("./sequential_executor"),require("./service"),require("./config"),require("./http"),require("./event_listeners"),require("./request"),require("./response"),require("./resource_waiter"),require("./signers/request_signer"),require("./param_validator"),AWS.events=new AWS.SequentialExecutor,AWS.util.memoizedProperty(AWS,"endpointCache",function(){return new AWS.EndpointCache(AWS.config.endpointCacheSize)},!0)},{"../vendor/endpoint-cache":115,"./api_loader":17,"./config":25,"./event_listeners":42,"./http":43,"./json/builder":45,"./json/parser":46,"./model/api":47,"./model/operation":49,"./model/paginator":50,"./model/resource_waiter":51,"./model/shape":52,"./param_validator":53,"./protocol/json":55,"./protocol/query":56,"./protocol/rest":57,"./protocol/rest_json":58,"./protocol/rest_xml":59,"./request":64,"./resource_waiter":65,"./response":66,"./sequential_executor":68,"./service":69,"./signers/request_signer":75,"./util":83,"./xml/builder":85}],28:[function(require,module,exports){var AWS=require("./core");AWS.Credentials=AWS.util.inherit({constructor:function(){if(AWS.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof arguments[0]){var creds=arguments[0].credentials||arguments[0];this.accessKeyId=creds.accessKeyId,this.secretAccessKey=creds.secretAccessKey,this.sessionToken=creds.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var currentTime=AWS.util.date.getDate().getTime(),adjustedTime=new Date(currentTime+1e3*this.expiryWindow);return!!(this.expireTime&&adjustedTime>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(callback){var self=this;this.needsRefresh()?this.refresh(function(err){err||(self.expired=!1),callback&&callback(err)}):callback&&callback()},refresh:function(callback){this.expired=!1,callback()},coalesceRefresh:function(callback,sync){var self=this;1===self.refreshCallbacks.push(callback)&&self.load(function(err){AWS.util.arrayEach(self.refreshCallbacks,function(callback){sync?callback(err):AWS.util.defer(function(){callback(err)})}),self.refreshCallbacks.length=0})},load:function(callback){callback()}}),AWS.Credentials.addPromisesToClass=function(PromiseDependency){this.prototype.getPromise=AWS.util.promisifyMethod("get",PromiseDependency),this.prototype.refreshPromise=AWS.util.promisifyMethod("refresh",PromiseDependency)},AWS.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},AWS.util.addPromises(AWS.Credentials)},{"./core":27}],29:[function(require,module,exports){var AWS=require("../core"),STS=require("../../clients/sts");AWS.ChainableTemporaryCredentials=AWS.util.inherit(AWS.Credentials,{constructor:function(options){AWS.Credentials.call(this),options=options||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var params=AWS.util.copy(options.params)||{};if(params.RoleArn&&(params.RoleSessionName=params.RoleSessionName||"temporary-credentials"),params.SerialNumber){if(!options.tokenCodeFn||"function"!=typeof options.tokenCodeFn)throw new AWS.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=options.tokenCodeFn}var config=AWS.util.merge({params:params,credentials:options.masterCredentials||AWS.config.credentials},options.stsConfig||{});this.service=new STS(config)},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this,operation=self.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(err,tokenCode){var params={};err?callback(err):(tokenCode&&(params.TokenCode=tokenCode),self.service[operation](params,function(err,data){err||self.service.credentialsFrom(data,self),callback(err)}))})},getTokenCode:function(callback){var self=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(err,token){if(err){var message=err;return err instanceof Error&&(message=err.message),void callback(AWS.util.error(new Error("Error fetching MFA token: "+message),{code:self.errorCode}))}callback(null,token)}):callback(null)}})},{"../../clients/sts":16,"../core":27}],30:[function(require,module,exports){var AWS=require("../core"),CognitoIdentity=require("../../clients/cognitoidentity"),STS=require("../../clients/sts");AWS.CognitoIdentityCredentials=AWS.util.inherit(AWS.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(params,clientConfig){AWS.Credentials.call(this),this.expired=!0,this.params=params,this.data=null,this._identityId=null,this._clientConfig=AWS.util.copy(clientConfig||{}),this.loadCachedId();var self=this;Object.defineProperty(this,"identityId",{get:function(){return self.loadCachedId(),self._identityId||self.params.IdentityId},set:function(identityId){self._identityId=identityId}})},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this;self.createClients(),self.data=null,self._identityId=null,self.getId(function(err){err?(self.clearIdOnNotAuthorized(err),callback(err)):self.params.RoleArn?self.getCredentialsFromSTS(callback):self.getCredentialsForIdentity(callback)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var poolId=this.params.IdentityPoolId,loginId=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+poolId+loginId],delete this.storage[this.localStorageKey.providers+poolId+loginId]},clearIdOnNotAuthorized:function(err){"NotAuthorizedException"==err.code&&this.clearCachedId()},getId:function(callback){var self=this;if("string"==typeof self.params.IdentityId)return callback(null,self.params.IdentityId);self.cognito.getId(function(err,data){!err&&data.IdentityId?(self.params.IdentityId=data.IdentityId,callback(null,data.IdentityId)):callback(err)})},loadCredentials:function(data,credentials){data&&credentials&&(credentials.expired=!1,credentials.accessKeyId=data.Credentials.AccessKeyId,credentials.secretAccessKey=data.Credentials.SecretKey,credentials.sessionToken=data.Credentials.SessionToken,credentials.expireTime=data.Credentials.Expiration)},getCredentialsForIdentity:function(callback){var self=this;self.cognito.getCredentialsForIdentity(function(err,data){err?self.clearIdOnNotAuthorized(err):(self.cacheId(data),self.data=data,self.loadCredentials(self.data,self)),callback(err)})},getCredentialsFromSTS:function(callback){var self=this;self.cognito.getOpenIdToken(function(err,data){err?(self.clearIdOnNotAuthorized(err),callback(err)):(self.cacheId(data),self.params.WebIdentityToken=data.Token,self.webIdentityCredentials.refresh(function(webErr){webErr||(self.data=self.webIdentityCredentials.data,self.sts.credentialsFrom(self.data,self)),callback(webErr)}))})},loadCachedId:function(){if(AWS.util.isBrowser()&&!this.params.IdentityId){var id=this.getStorage("id");if(id&&this.params.Logins){var actualProviders=Object.keys(this.params.Logins);0!==(this.getStorage("providers")||"").split(",").filter(function(n){return-1!==actualProviders.indexOf(n)}).length&&(this.params.IdentityId=id)}else id&&(this.params.IdentityId=id)}},createClients:function(){var clientConfig=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new AWS.WebIdentityCredentials(this.params,clientConfig),!this.cognito){var cognitoConfig=AWS.util.merge({},clientConfig);cognitoConfig.params=this.params,this.cognito=new CognitoIdentity(cognitoConfig)}this.sts=this.sts||new STS(clientConfig)},cacheId:function(data){this._identityId=data.IdentityId,this.params.IdentityId=this._identityId,AWS.util.isBrowser()&&(this.setStorage("id",data.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(key){return this.storage[this.localStorageKey[key]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(key,val){try{this.storage[this.localStorageKey[key]+this.params.IdentityPoolId+(this.params.LoginId||"")]=val}catch(_){}},storage:function(){try{var storage=AWS.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return storage["aws.test-storage"]="foobar",delete storage["aws.test-storage"],storage}catch(_){return{}}}()})},{"../../clients/cognitoidentity":15,"../../clients/sts":16,"../core":27}],31:[function(require,module,exports){var AWS=require("../core");AWS.CredentialProviderChain=AWS.util.inherit(AWS.Credentials,{constructor:function(providers){this.providers=providers||AWS.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(callback){var self=this;if(0===self.providers.length)return callback(new Error("No providers")),self;if(1===self.resolveCallbacks.push(callback)){var index=0,providers=self.providers.slice(0);!function resolveNext(err,creds){if(!err&&creds||index===providers.length)return AWS.util.arrayEach(self.resolveCallbacks,function(callback){callback(err,creds)}),void(self.resolveCallbacks.length=0);var provider=providers[index++];(creds="function"==typeof provider?provider.call():provider).get?creds.get(function(getErr){resolveNext(getErr,getErr?null:creds)}):resolveNext(null,creds)}()}return self}}),AWS.CredentialProviderChain.defaultProviders=[],AWS.CredentialProviderChain.addPromisesToClass=function(PromiseDependency){this.prototype.resolvePromise=AWS.util.promisifyMethod("resolve",PromiseDependency)},AWS.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},AWS.util.addPromises(AWS.CredentialProviderChain)},{"../core":27}],32:[function(require,module,exports){var AWS=require("../core"),STS=require("../../clients/sts");AWS.SAMLCredentials=AWS.util.inherit(AWS.Credentials,{constructor:function(params){AWS.Credentials.call(this),this.expired=!0,this.params=params},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this;self.createClients(),self.service.assumeRoleWithSAML(function(err,data){err||self.service.credentialsFrom(data,self),callback(err)})},createClients:function(){this.service=this.service||new STS({params:this.params})}})},{"../../clients/sts":16,"../core":27}],33:[function(require,module,exports){var AWS=require("../core"),STS=require("../../clients/sts");AWS.TemporaryCredentials=AWS.util.inherit(AWS.Credentials,{constructor:function(params,masterCredentials){AWS.Credentials.call(this),this.loadMasterCredentials(masterCredentials),this.expired=!0,this.params=params||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this;self.createClients(),self.masterCredentials.get(function(){self.service.config.credentials=self.masterCredentials,(self.params.RoleArn?self.service.assumeRole:self.service.getSessionToken).call(self.service,function(err,data){err||self.service.credentialsFrom(data,self),callback(err)})})},loadMasterCredentials:function(masterCredentials){for(this.masterCredentials=masterCredentials||AWS.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;"function"!=typeof this.masterCredentials.get&&(this.masterCredentials=new AWS.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new STS({params:this.params})}})},{"../../clients/sts":16,"../core":27}],34:[function(require,module,exports){var AWS=require("../core"),STS=require("../../clients/sts");AWS.WebIdentityCredentials=AWS.util.inherit(AWS.Credentials,{constructor:function(params,clientConfig){AWS.Credentials.call(this),this.expired=!0,this.params=params,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=AWS.util.copy(clientConfig||{})},refresh:function(callback){this.coalesceRefresh(callback||AWS.util.fn.callback)},load:function(callback){var self=this;self.createClients(),self.service.assumeRoleWithWebIdentity(function(err,data){self.data=null,err||(self.data=data,self.service.credentialsFrom(data,self)),callback(err)})},createClients:function(){if(!this.service){var stsConfig=AWS.util.merge({},this._clientConfig);stsConfig.params=this.params,this.service=new STS(stsConfig)}}})},{"../../clients/sts":16,"../core":27}],35:[function(require,module,exports){(function(process){(function(){var AWS=require("./core"),util=require("./util"),endpointDiscoveryEnabledEnvs=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function getCacheKey(request){var service=request.service,api=service.api||{},identifiers=(api.operations,{});return service.config.region&&(identifiers.region=service.config.region),api.serviceId&&(identifiers.serviceId=api.serviceId),service.config.credentials.accessKeyId&&(identifiers.accessKeyId=service.config.credentials.accessKeyId),identifiers}function marshallCustomIdentifiers(request,shape){var identifiers={};return function marshallCustomIdentifiersHelper(result,params,shape){shape&&null!=params&&"structure"===shape.type&&shape.required&&shape.required.length>0&&util.arrayEach(shape.required,function(name){var memberShape=shape.members[name];if(!0===memberShape.endpointDiscoveryId){var locationName=memberShape.isLocationName?memberShape.name:name;result[locationName]=String(params[name])}else marshallCustomIdentifiersHelper(result,params[name],memberShape)})}(identifiers,request.params,shape),identifiers}function optionalDiscoverEndpoint(request){var service=request.service,api=service.api,operationModel=api.operations?api.operations[request.operation]:void 0,identifiers=marshallCustomIdentifiers(request,operationModel?operationModel.input:void 0),cacheKey=getCacheKey(request);Object.keys(identifiers).length>0&&(cacheKey=util.update(cacheKey,identifiers),operationModel&&(cacheKey.operation=operationModel.name));var endpoints=AWS.endpointCache.get(cacheKey);if(!endpoints||1!==endpoints.length||""!==endpoints[0].Address)if(endpoints&&endpoints.length>0)request.httpRequest.updateEndpoint(endpoints[0].Address);else{var endpointRequest=service.makeRequest(api.endpointOperation,{Operation:operationModel.name,Identifiers:identifiers});addApiVersionHeader(endpointRequest),endpointRequest.removeListener("validate",AWS.EventListeners.Core.VALIDATE_PARAMETERS),endpointRequest.removeListener("retry",AWS.EventListeners.Core.RETRY_CHECK),AWS.endpointCache.put(cacheKey,[{Address:"",CachePeriodInMinutes:1}]),endpointRequest.send(function(err,data){data&&data.Endpoints?AWS.endpointCache.put(cacheKey,data.Endpoints):err&&AWS.endpointCache.put(cacheKey,[{Address:"",CachePeriodInMinutes:1}])})}}var requestQueue={};function requiredDiscoverEndpoint(request,done){var service=request.service,api=service.api,operationModel=api.operations?api.operations[request.operation]:void 0,inputShape=operationModel?operationModel.input:void 0,identifiers=marshallCustomIdentifiers(request,inputShape),cacheKey=getCacheKey(request);Object.keys(identifiers).length>0&&(cacheKey=util.update(cacheKey,identifiers),operationModel&&(cacheKey.operation=operationModel.name));var cacheKeyStr=AWS.EndpointCache.getKeyString(cacheKey),endpoints=AWS.endpointCache.get(cacheKeyStr);if(endpoints&&1===endpoints.length&&""===endpoints[0].Address)return requestQueue[cacheKeyStr]||(requestQueue[cacheKeyStr]=[]),void requestQueue[cacheKeyStr].push({request:request,callback:done});if(endpoints&&endpoints.length>0)request.httpRequest.updateEndpoint(endpoints[0].Address),done();else{var endpointRequest=service.makeRequest(api.endpointOperation,{Operation:operationModel.name,Identifiers:identifiers});endpointRequest.removeListener("validate",AWS.EventListeners.Core.VALIDATE_PARAMETERS),addApiVersionHeader(endpointRequest),AWS.endpointCache.put(cacheKeyStr,[{Address:"",CachePeriodInMinutes:60}]),endpointRequest.send(function(err,data){if(err){if(request.response.error=util.error(err,{retryable:!1}),AWS.endpointCache.remove(cacheKey),requestQueue[cacheKeyStr]){var pendingRequests=requestQueue[cacheKeyStr];util.arrayEach(pendingRequests,function(requestContext){requestContext.request.response.error=util.error(err,{retryable:!1}),requestContext.callback()}),delete requestQueue[cacheKeyStr]}}else if(data&&(AWS.endpointCache.put(cacheKeyStr,data.Endpoints),request.httpRequest.updateEndpoint(data.Endpoints[0].Address),requestQueue[cacheKeyStr])){pendingRequests=requestQueue[cacheKeyStr];util.arrayEach(pendingRequests,function(requestContext){requestContext.request.httpRequest.updateEndpoint(data.Endpoints[0].Address),requestContext.callback()}),delete requestQueue[cacheKeyStr]}done()})}}function addApiVersionHeader(endpointRequest){var apiVersion=endpointRequest.service.api.apiVersion;apiVersion&&!endpointRequest.httpRequest.headers["x-amz-api-version"]&&(endpointRequest.httpRequest.headers["x-amz-api-version"]=apiVersion)}function invalidateCachedEndpoints(response){var error=response.error,httpResponse=response.httpResponse;if(error&&("InvalidEndpointException"===error.code||421===httpResponse.statusCode)){var request=response.request,operations=request.service.api.operations||{},identifiers=marshallCustomIdentifiers(request,operations[request.operation]?operations[request.operation].input:void 0),cacheKey=getCacheKey(request);Object.keys(identifiers).length>0&&(cacheKey=util.update(cacheKey,identifiers),operations[request.operation]&&(cacheKey.operation=operations[request.operation].name)),AWS.endpointCache.remove(cacheKey)}}function isFalsy(value){return["false","0"].indexOf(value)>=0}module.exports={discoverEndpoint:function(request,done){var service=request.service||{};if(function(client){if(client._originalConfig&&client._originalConfig.endpoint&&!0===client._originalConfig.endpointDiscoveryEnabled)throw util.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var svcConfig=AWS.config[client.serviceIdentifier]||{};return Boolean(AWS.config.endpoint||svcConfig.endpoint||client._originalConfig&&client._originalConfig.endpoint)}(service)||request.isPresigned())return done();var operationModel=(service.api.operations||{})[request.operation],isEndpointDiscoveryRequired=operationModel?operationModel.endpointDiscoveryRequired:"NULL",isEnabled=function(request){var service=request.service||{};if(void 0!==service.config.endpointDiscoveryEnabled)return service.config.endpointDiscoveryEnabled;if(!util.isBrowser()){for(var i=0;i-1&&(bytes[i]++,0===bytes[i]);i--);}Int64.fromNumber=function(number){if(number>0x8000000000000000||number<-0x8000000000000000)throw new Error(number+" is too large (or, if negative, too small) to represent as an Int64");for(var bytes=new Uint8Array(8),i=7,remaining=Math.abs(Math.round(number));i>-1&&remaining>0;i--,remaining/=256)bytes[i]=remaining;return number<0&&negate(bytes),new Int64(bytes)},Int64.prototype.valueOf=function(){var bytes=this.bytes.slice(0),negative=128&bytes[0];return negative&&negate(bytes),parseInt(bytes.toString("hex"),16)*(negative?-1:1)},Int64.prototype.toString=function(){return String(this.valueOf())},module.exports={Int64:Int64}},{"../core":27}],39:[function(require,module,exports){var parseMessage=require("./parse-message").parseMessage;module.exports={parseEvent:function(parser,message,shape){var parsedMessage=parseMessage(message),messageType=parsedMessage.headers[":message-type"];if(messageType){if("error"===messageType.value)throw function(message){var errorCode=message.headers[":error-code"],errorMessage=message.headers[":error-message"],error=new Error(errorMessage.value||errorMessage);return error.code=error.name=errorCode.value||errorCode,error}(parsedMessage);if("event"!==messageType.value)return}var eventType=parsedMessage.headers[":event-type"],eventModel=shape.members[eventType.value];if(eventModel){var result={},eventPayloadMemberName=eventModel.eventPayloadMemberName;if(eventPayloadMemberName){var payloadShape=eventModel.members[eventPayloadMemberName];"binary"===payloadShape.type?result[eventPayloadMemberName]=parsedMessage.body:result[eventPayloadMemberName]=parser.parse(parsedMessage.body.toString(),payloadShape)}for(var eventHeaderNames=eventModel.eventHeaderMemberNames,i=0;i=0)return req.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",done();AWS.util.computeSha256(body,function(err,sha){err?done(err):(req.httpRequest.headers["X-Amz-Content-Sha256"]=sha,done())})}else done()}}),add("SET_CONTENT_LENGTH","afterBuild",function(req){var authtype=function(req){if(!req.service.api.operations)return"";var operation=req.service.api.operations[req.operation];return operation?operation.authtype:""}(req),payloadMember=AWS.util.getRequestPayloadShape(req);if(void 0===req.httpRequest.headers["Content-Length"])try{var length=AWS.util.string.byteLength(req.httpRequest.body);req.httpRequest.headers["Content-Length"]=length}catch(err){if(payloadMember&&payloadMember.isStreaming){if(payloadMember.requiresLength)throw err;if(authtype.indexOf("unsigned-body")>=0)return void(req.httpRequest.headers["Transfer-Encoding"]="chunked");throw err}throw err}}),add("SET_HTTP_HOST","afterBuild",function(req){req.httpRequest.headers.Host=req.httpRequest.endpoint.host}),add("RESTART","restart",function(){var err=this.response.error;err&&err.retryable&&(this.httpRequest=new AWS.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=600?this.emit("sign",[this],function(err){err?done(err):executeSend()}):executeSend()}),add("HTTP_HEADERS","httpHeaders",function(statusCode,headers,resp,statusMessage){resp.httpResponse.statusCode=statusCode,resp.httpResponse.statusMessage=statusMessage,resp.httpResponse.headers=headers,resp.httpResponse.body=AWS.util.buffer.toBuffer(""),resp.httpResponse.buffers=[],resp.httpResponse.numBytes=0;var dateHeader=headers.date||headers.Date,service=resp.request.service;if(dateHeader){var serverTime=Date.parse(dateHeader);service.config.correctClockSkew&&service.isClockSkewed(serverTime)&&service.applyClockOffset(serverTime)}}),add("HTTP_DATA","httpData",function(chunk,resp){if(chunk){if(AWS.util.isNode()){resp.httpResponse.numBytes+=chunk.length;var total=resp.httpResponse.headers["content-length"],progress={loaded:resp.httpResponse.numBytes,total:total};resp.request.emit("httpDownloadProgress",[progress,resp])}resp.httpResponse.buffers.push(AWS.util.buffer.toBuffer(chunk))}}),add("HTTP_DONE","httpDone",function(resp){if(resp.httpResponse.buffers&&resp.httpResponse.buffers.length>0){var body=AWS.util.buffer.concat(resp.httpResponse.buffers);resp.httpResponse.body=body}delete resp.httpResponse.numBytes,delete resp.httpResponse.buffers}),add("FINALIZE_ERROR","retry",function(resp){resp.httpResponse.statusCode&&(resp.error.statusCode=resp.httpResponse.statusCode,void 0===resp.error.retryable&&(resp.error.retryable=this.service.retryableError(resp.error,this)))}),add("INVALIDATE_CREDENTIALS","retry",function(resp){if(resp.error)switch(resp.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":resp.error.retryable=!0,resp.request.service.config.credentials.expired=!0}}),add("EXPIRED_SIGNATURE","retry",function(resp){var err=resp.error;err&&"string"==typeof err.code&&"string"==typeof err.message&&err.code.match(/Signature/)&&err.message.match(/expired/)&&(resp.error.retryable=!0)}),add("CLOCK_SKEWED","retry",function(resp){resp.error&&this.service.clockSkewError(resp.error)&&this.service.config.correctClockSkew&&(resp.error.retryable=!0)}),add("REDIRECT","retry",function(resp){resp.error&&resp.error.statusCode>=300&&resp.error.statusCode<400&&resp.httpResponse.headers.location&&(this.httpRequest.endpoint=new AWS.Endpoint(resp.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,resp.error.redirect=!0,resp.error.retryable=!0)}),add("RETRY_CHECK","retry",function(resp){resp.error&&(resp.error.redirect&&resp.redirectCount=0?(resp.error=null,setTimeout(done,delay)):done()})}),CorePost:(new SequentialExecutor).addNamedListeners(function(add){add("EXTRACT_REQUEST_ID","extractData",AWS.util.extractRequestId),add("EXTRACT_REQUEST_ID","extractError",AWS.util.extractRequestId),add("ENOTFOUND_ERROR","httpError",function(err){if("NetworkingError"===err.code&&function(err){return"ENOTFOUND"===err.errno||"number"==typeof err.errno&&"function"==typeof AWS.util.getSystemErrorName&&["EAI_NONAME","EAI_NODATA"].indexOf(AWS.util.getSystemErrorName(err.errno)>=0)}(err)){var message="Inaccessible host: `"+err.hostname+"'. This service may not be available in the `"+err.region+"' region.";this.response.error=AWS.util.error(new Error(message),{code:"UnknownEndpoint",region:err.region,hostname:err.hostname,retryable:!0,originalError:err})}})}),Logger:(new SequentialExecutor).addNamedListeners(function(add){add("LOG_REQUEST","complete",function(resp){var req=resp.request,logger=req.service.config.logger;if(logger){var line=function(){var delta=(resp.request.service.getSkewCorrectedDate().getTime()-req.startTime.getTime())/1e3,ansi=!!logger.isTTY,status=resp.httpResponse.statusCode,censoredParams=req.params;req.service.api.operations&&req.service.api.operations[req.operation]&&req.service.api.operations[req.operation].input&&(censoredParams=function filterSensitiveLog(inputShape,shape){if(!shape)return shape;if(inputShape.isSensitive)return"***SensitiveInformation***";switch(inputShape.type){case"structure":var struct={};return AWS.util.each(shape,function(subShapeName,subShape){Object.prototype.hasOwnProperty.call(inputShape.members,subShapeName)?struct[subShapeName]=filterSensitiveLog(inputShape.members[subShapeName],subShape):struct[subShapeName]=subShape}),struct;case"list":var list=[];return AWS.util.arrayEach(shape,function(subShape,index){list.push(filterSensitiveLog(inputShape.member,subShape))}),list;case"map":var map={};return AWS.util.each(shape,function(key,value){map[key]=filterSensitiveLog(inputShape.value,value)}),map;default:return shape}}(req.service.api.operations[req.operation].input,req.params));var params=require("util").inspect(censoredParams,!0,null),message="";return ansi&&(message+=""),message+="[AWS "+req.service.serviceIdentifier+" "+status,message+=" "+delta.toString()+"s "+resp.retryCount+" retries]",ansi&&(message+=""),message+=" "+AWS.util.string.lowerFirst(req.operation),message+="("+params+")",ansi&&(message+=""),message}();"function"==typeof logger.log?logger.log(line):"function"==typeof logger.write&&logger.write(line+"\n")}})}),Json:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/json");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)}),Rest:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/rest");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)}),RestJson:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/rest_json");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)}),RestXml:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/rest_xml");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)}),Query:(new SequentialExecutor).addNamedListeners(function(add){var svc=require("./protocol/query");add("BUILD","build",svc.buildRequest),add("EXTRACT_DATA","extractData",svc.extractData),add("EXTRACT_ERROR","extractError",svc.extractError)})}},{"./core":27,"./discover_endpoint":35,"./protocol/json":55,"./protocol/query":56,"./protocol/rest":57,"./protocol/rest_json":58,"./protocol/rest_xml":59,"./sequential_executor":68,util:109}],43:[function(require,module,exports){var AWS=require("./core"),inherit=AWS.util.inherit;AWS.Endpoint=inherit({constructor:function(endpoint,config){if(AWS.util.hideProperties(this,["slashes","auth","hash","search","query"]),null==endpoint)throw new Error("Invalid endpoint: "+endpoint);if("string"!=typeof endpoint)return AWS.util.copy(endpoint);endpoint.match(/^http/)||(endpoint=((config&&void 0!==config.sslEnabled?config.sslEnabled:AWS.config.sslEnabled)?"https":"http")+"://"+endpoint);AWS.util.update(this,AWS.util.urlParse(endpoint)),this.port?this.port=parseInt(this.port,10):this.port="https:"===this.protocol?443:80}}),AWS.HttpRequest=inherit({constructor:function(endpoint,region){endpoint=new AWS.Endpoint(endpoint),this.method="POST",this.path=endpoint.path||"/",this.headers={},this.body="",this.endpoint=endpoint,this.region=region,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=AWS.util.userAgent()},getUserAgentHeaderName:function(){return(AWS.util.isBrowser()?"X-Amz-":"")+"User-Agent"},appendToUserAgent:function(agentPartial){"string"==typeof agentPartial&&agentPartial&&(this._userAgent+=" "+agentPartial),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var query=this.path.split("?",2)[1];return query?(query=AWS.util.queryStringParse(query),AWS.util.queryParamsToString(query)):""},updateEndpoint:function(endpointStr){var newEndpoint=new AWS.Endpoint(endpointStr);this.endpoint=newEndpoint,this.path=newEndpoint.path||"/",this.headers.Host&&(this.headers.Host=newEndpoint.host)}}),AWS.HttpResponse=inherit({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}}),AWS.HttpClient=inherit({}),AWS.HttpClient.getInstance=function(){return void 0===this.singleton&&(this.singleton=new this),this.singleton}},{"./core":27}],44:[function(require,module,exports){var AWS=require("../core"),EventEmitter=require("events").EventEmitter;require("../http"),AWS.XHRGoogleClient=AWS.util.inherit({handleRequest:function(httpRequest,httpOptions,callback,errCallback){var endpoint=httpRequest.endpoint,emitter=new EventEmitter,href=endpoint.protocol+"//"+endpoint.hostname;80!==endpoint.port&&443!==endpoint.port&&(href+=":"+endpoint.port),href+=httpRequest.path,callback(emitter);var headers={};AWS.util.each(httpRequest.headers,function(key,value){"Content-Length"!==key&&"User-Agent"!==key&&"Host"!==key&&(headers[key]=value)});httpOptions.xhrWithCredentials;try{var options={method:httpRequest.method,contentType:httpRequest.headers["Content-Type"],headers:headers,muteHttpExceptions:!0,payload:httpRequest.body},response=UrlFetchApp.fetch(href,options),responseCode=response.getResponseCode(),responseText=response.getContentText();if(responseCode/100!=2)throw Error(responseText);emitter.statusCode=responseCode,emitter.headers=this.parseHeaders(response.getHeaders()),emitter.emit("headers",emitter.statusCode,emitter.headers),this.finishRequest(response.getBlob(),emitter)}catch(err){Logger.log(err),errCallback(AWS.util.error(new Error("Network Failure"),{code:"NetworkingError"}))}return emitter},parseHeaders:function(rawHeaders){return Object.fromEntries(Object.entries(rawHeaders).map(([k,v])=>[k.toLowerCase(),v]))},finishRequest:function(blob,emitter){var buffer;if("text/plain"!==blob.getContentType()){var ab=blob.getBytes();buffer=new AWS.util.Buffer(ab.length);for(var view=new Uint8Array(ab),i=0;i=this.HEADERS_RECEIVED&&!headersEmitted&&(emitter.statusCode=xhr.status,emitter.headers=self.parseHeaders(xhr.getAllResponseHeaders()),emitter.emit("headers",emitter.statusCode,emitter.headers,xhr.statusText),headersEmitted=!0),this.readyState===this.DONE&&self.finishRequest(xhr,emitter)},!1),xhr.upload.addEventListener("progress",function(evt){emitter.emit("sendProgress",evt)}),xhr.addEventListener("progress",function(evt){emitter.emit("receiveProgress",evt)},!1),xhr.addEventListener("timeout",function(){errCallback(AWS.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),xhr.addEventListener("error",function(){errCallback(AWS.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),xhr.addEventListener("abort",function(){errCallback(AWS.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))},!1),callback(emitter),xhr.open(httpRequest.method,href,!1!==httpOptions.xhrAsync),AWS.util.each(httpRequest.headers,function(key,value){"Content-Length"!==key&&"User-Agent"!==key&&"Host"!==key&&xhr.setRequestHeader(key,value)}),httpOptions.timeout&&!1!==httpOptions.xhrAsync&&(xhr.timeout=httpOptions.timeout),httpOptions.xhrWithCredentials&&(xhr.withCredentials=!0);try{xhr.responseType="arraybuffer"}catch(e){}try{httpRequest.body?xhr.send(httpRequest.body):xhr.send()}catch(err){if(!httpRequest.body||"object"!=typeof httpRequest.body.buffer)throw err;xhr.send(httpRequest.body.buffer)}return emitter},parseHeaders:function(rawHeaders){var headers={};return AWS.util.arrayEach(rawHeaders.split(/\r?\n/),function(line){var key=line.split(":",1)[0],value=line.substring(key.length+2);key.length>0&&(headers[key.toLowerCase()]=value)}),headers},finishRequest:function(xhr,emitter){var buffer;if("arraybuffer"===xhr.responseType&&xhr.response){var ab=xhr.response;buffer=new AWS.util.Buffer(ab.byteLength);for(var view=new Uint8Array(ab),i=0;i-1?value||"":value,this.isJsonValue?JSON.parse(value):value&&"function"==typeof value.toString?value.toString():value},this.toWireFormat=function(value){return this.isJsonValue?JSON.stringify(value):value}}function BinaryShape(){Shape.apply(this,arguments),this.toType=function(value){var buf=util.base64.decode(value);if(this.isSensitive&&util.isNode()&&"function"==typeof util.Buffer.alloc){var secureBuf=util.Buffer.alloc(buf.length,buf);buf.fill(0),buf=secureBuf}return buf},this.toWireFormat=util.base64.encode}function Base64Shape(){BinaryShape.apply(this,arguments)}function BooleanShape(){Shape.apply(this,arguments),this.toType=function(value){return"boolean"==typeof value?value:null==value?null:"true"===value}}Shape.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"},Shape.types={structure:StructureShape,list:ListShape,map:MapShape,boolean:BooleanShape,timestamp:function(shape){var self=this;if(Shape.apply(this,arguments),shape.timestampFormat)property(this,"timestampFormat",shape.timestampFormat);else if(self.isTimestampFormatSet&&this.timestampFormat)property(this,"timestampFormat",this.timestampFormat);else if("header"===this.location)property(this,"timestampFormat","rfc822");else if("querystring"===this.location)property(this,"timestampFormat","iso8601");else if(this.api)switch(this.api.protocol){case"json":case"rest-json":property(this,"timestampFormat","unixTimestamp");break;case"rest-xml":case"query":case"ec2":property(this,"timestampFormat","iso8601")}this.toType=function(value){return null==value?null:"function"==typeof value.toUTCString?value:"string"==typeof value||"number"==typeof value?util.date.parseTimestamp(value):null},this.toWireFormat=function(value){return util.date.format(value,self.timestampFormat)}},float:function(){Shape.apply(this,arguments),this.toType=function(value){return null==value?null:parseFloat(value)},this.toWireFormat=this.toType},integer:function(){Shape.apply(this,arguments),this.toType=function(value){return null==value?null:parseInt(value,10)},this.toWireFormat=this.toType},string:StringShape,base64:Base64Shape,binary:BinaryShape},Shape.resolve=function(shape,options){if(shape.shape){var refShape=options.api.shapes[shape.shape];if(!refShape)throw new Error("Cannot find shape reference: "+shape.shape);return refShape}return null},Shape.create=function(shape,options,memberName){if(shape.isShape)return shape;var refShape=Shape.resolve(shape,options);if(refShape){var filteredKeys=Object.keys(shape);options.documentation||(filteredKeys=filteredKeys.filter(function(name){return!name.match(/documentation/)}));var InlineShape=function(){refShape.constructor.call(this,shape,options,memberName)};return InlineShape.prototype=refShape,new InlineShape}shape.type||(shape.members?shape.type="structure":shape.member?shape.type="list":shape.key?shape.type="map":shape.type="string");var origType=shape.type;if(Shape.normalizedTypes[shape.type]&&(shape.type=Shape.normalizedTypes[shape.type]),Shape.types[shape.type])return new Shape.types[shape.type](shape,options,memberName);throw new Error("Unrecognized shape type: "+origType)},Shape.shapes={StructureShape:StructureShape,ListShape:ListShape,MapShape:MapShape,StringShape:StringShape,BooleanShape:BooleanShape,Base64Shape:Base64Shape},module.exports=Shape},{"../util":83,"./collection":48}],53:[function(require,module,exports){var AWS=require("./core");AWS.ParamValidator=AWS.util.inherit({constructor:function(validation){!0!==validation&&void 0!==validation||(validation={min:!0}),this.validation=validation},validate:function(shape,params,context){if(this.errors=[],this.validateMember(shape,params||{},context||"params"),this.errors.length>1){var msg=this.errors.join("\n* ");throw msg="There were "+this.errors.length+" validation errors:\n* "+msg,AWS.util.error(new Error(msg),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(code,message){this.errors.push(AWS.util.error(new Error(message),{code:code}))},validateStructure:function(shape,params,context){var paramName;this.validateType(params,context,["object"],"structure");for(var i=0;shape.required&&i= 1, but found "'+value+'" for '+context)},validatePattern:function(shape,value,context){this.validation.pattern&&void 0!==shape.pattern&&(new RegExp(shape.pattern).test(value)||this.fail("PatternMatchError",'Provided value "'+value+'" does not match regex pattern /'+shape.pattern+"/ for "+context))},validateRange:function(shape,value,context,descriptor){this.validation.min&&void 0!==shape.min&&value= "+shape.min+", but found "+value+" for "+context),this.validation.max&&void 0!==shape.max&&value>shape.max&&this.fail("MaxRangeError","Expected "+descriptor+" <= "+shape.max+", but found "+value+" for "+context)},validateEnum:function(shape,value,context){this.validation.enum&&void 0!==shape.enum&&-1===shape.enum.indexOf(value)&&this.fail("EnumError","Found string value of "+value+", but expected "+shape.enum.join("|")+" for "+context)},validateType:function(value,context,acceptedTypes,type){if(null==value)return!1;for(var foundInvalidType=!1,i=0;i63)throw util.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!hostPattern.test(label))throw AWS.util.error(new Error,{code:"ValidationError",message:label+" is not hostname compatible."})})}var endpoint,prefix;return request}}},{"../core":27,"../util":83}],55:[function(require,module,exports){var util=require("../util"),JsonBuilder=require("../json/builder"),JsonParser=require("../json/parser"),populateHostPrefix=require("./helpers").populateHostPrefix;module.exports={buildRequest:function(req){var httpRequest=req.httpRequest,api=req.service.api,target=api.targetPrefix+"."+api.operations[req.operation].name,version=api.jsonVersion||"1.0",input=api.operations[req.operation].input,builder=new JsonBuilder;1===version&&(version="1.0"),httpRequest.body=builder.build(req.params||{},input),httpRequest.headers["Content-Type"]="application/x-amz-json-"+version,httpRequest.headers["X-Amz-Target"]=target,populateHostPrefix(req)},extractError:function(resp){var error={},httpResponse=resp.httpResponse;if(error.code=httpResponse.headers["x-amzn-errortype"]||"UnknownError","string"==typeof error.code&&(error.code=error.code.split(":")[0]),httpResponse.body.length>0)try{var e=JSON.parse(httpResponse.body.toString()),code=e.__type||e.code||e.Code;code&&(error.code=code.split("#").pop()),"RequestEntityTooLarge"===error.code?error.message="Request body must be less than 1 MB":error.message=e.message||e.Message||null}catch(e){error.statusCode=httpResponse.statusCode,error.message=httpResponse.statusMessage}else error.statusCode=httpResponse.statusCode,error.message=httpResponse.statusCode.toString();resp.error=util.error(new Error,error)},extractData:function(resp){var body=resp.httpResponse.body.toString()||"{}";if(!1===resp.request.service.config.convertResponseTypes)resp.data=JSON.parse(body);else{var shape=resp.request.service.api.operations[resp.request.operation].output||{},parser=new JsonParser;resp.data=parser.parse(body,shape)}}}},{"../json/builder":45,"../json/parser":46,"../util":83,"./helpers":54}],56:[function(require,module,exports){var AWS=require("../core"),util=require("../util"),QueryParamSerializer=require("../query/query_param_serializer"),Shape=require("../model/shape"),populateHostPrefix=require("./helpers").populateHostPrefix;module.exports={buildRequest:function(req){var operation=req.service.api.operations[req.operation],httpRequest=req.httpRequest;httpRequest.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",httpRequest.params={Version:req.service.api.apiVersion,Action:operation.name},(new QueryParamSerializer).serialize(req.params,operation.input,function(name,value){httpRequest.params[name]=value}),httpRequest.body=util.queryParamsToString(httpRequest.params),populateHostPrefix(req)},extractError:function(resp){var data,body=resp.httpResponse.body.toString();if(body.match("=0?"&":"?";var parts=[];util.arrayEach(Object.keys(queryString).sort(),function(key){Array.isArray(queryString[key])||(queryString[key]=[queryString[key]]);for(var i=0;i0){var data=(parser=new AWS.XML.Parser).parse(body.toString(),output);util.update(resp.data,data)}}}},{"../core":27,"../util":83,"./rest":57}],60:[function(require,module,exports){var util=require("../util");function QueryParamSerializer(){}function ucfirst(shape){return shape.isQueryName||"ec2"!==shape.api.protocol?shape.name:shape.name[0].toUpperCase()+shape.name.substr(1)}function serializeStructure(prefix,struct,rules,fn){util.each(rules.members,function(name,member){var value=struct[name];if(null!=value){var memberName=ucfirst(member);serializeMember(memberName=prefix?prefix+"."+memberName:memberName,value,member,fn)}})}function serializeMember(name,value,rules,fn){null!=value&&("structure"===rules.type?serializeStructure(name,value,rules,fn):"list"===rules.type?function(name,list,rules,fn){var memberRules=rules.member||{};0!==list.length?util.arrayEach(list,function(v,n){var suffix="."+(n+1);if("ec2"===rules.api.protocol)suffix+="";else if(rules.flattened){if(memberRules.name){var parts=name.split(".");parts.pop(),parts.push(ucfirst(memberRules)),name=parts.join(".")}}else suffix="."+(memberRules.name?memberRules.name:"member")+suffix;serializeMember(name+suffix,v,memberRules,fn)}):fn.call(this,name,null)}(name,value,rules,fn):"map"===rules.type?function(name,map,rules,fn){var i=1;util.each(map,function(key,value){var position=(rules.flattened?".":".entry.")+i+++".",keyName=position+(rules.key.name||"key"),valueName=position+(rules.value.name||"value");serializeMember(name+keyName,key,rules.key,fn),serializeMember(name+valueName,value,rules.value,fn)})}(name,value,rules,fn):fn(name,rules.toWireFormat(value).toString()))}QueryParamSerializer.prototype.serialize=function(params,shape,fn){serializeStructure("",params,shape,fn)},module.exports=QueryParamSerializer},{"../util":83}],61:[function(require,module,exports){module.exports={now:function(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}}},{}],62:[function(require,module,exports){var util=require("./util"),regionConfig=require("./region_config_data.json");function applyConfig(service,config){util.each(config,function(key,value){"globalEndpoint"!==key&&(void 0!==service.config[key]&&null!==service.config[key]||(service.config[key]=value))})}module.exports={configureEndpoint:function(service){for(var keys=function(service){var region=service.config.region,regionPrefix=function(region){if(!region)return null;var parts=region.split("-");return parts.length<3?null:parts.slice(0,parts.length-2).join("-")+"-*"}(region),endpointPrefix=service.api.endpointPrefix;return[[region,endpointPrefix],[regionPrefix,endpointPrefix],[region,"*"],[regionPrefix,"*"],["*",endpointPrefix],["*","*"]].map(function(item){return item[0]&&item[1]?item.join("/"):null})}(service),i=0;i=0){shouldCheckContentLength=!0;var receivedLen=0}var checkContentLengthAndEmit=function(){shouldCheckContentLength&&receivedLen!==expectedLen?stream.emit("error",AWS.util.error(new Error("Stream content length mismatch. Received "+receivedLen+" of "+expectedLen+" bytes."),{code:"StreamContentLengthMismatch"})):2===AWS.HttpClient.streamsApiVersion?stream.end():stream.emit("end")},httpStream=resp.httpResponse.createUnbufferedStream();if(2===AWS.HttpClient.streamsApiVersion)if(shouldCheckContentLength){var lengthAccumulator=new streams.PassThrough;lengthAccumulator._write=function(chunk){return chunk&&chunk.length&&(receivedLen+=chunk.length),streams.PassThrough.prototype._write.apply(this,arguments)},lengthAccumulator.on("end",checkContentLengthAndEmit),stream.on("error",function(err){shouldCheckContentLength=!1,httpStream.unpipe(lengthAccumulator),lengthAccumulator.emit("end"),lengthAccumulator.end()}),httpStream.pipe(lengthAccumulator).pipe(stream,{end:!1})}else httpStream.pipe(stream);else shouldCheckContentLength&&httpStream.on("data",function(arg){arg&&arg.length&&(receivedLen+=arg.length)}),httpStream.on("data",function(arg){stream.emit("data",arg)}),httpStream.on("end",checkContentLengthAndEmit);httpStream.on("error",function(err){shouldCheckContentLength=!1,stream.emit("error",err)})}}),stream},emitEvent:function(eventName,args,done){"function"==typeof args&&(done=args,args=null),done||(done=function(){}),args||(args=this.eventParameters(eventName,this.response)),AWS.SequentialExecutor.prototype.emit.call(this,eventName,args,function(err){err&&(this.response.error=err),done.call(this,err)})},eventParameters:function(eventName){switch(eventName){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(expires,callback){return callback||"function"!=typeof expires||(callback=expires,expires=null),(new AWS.Signers.Presign).sign(this.toGet(),expires,callback)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",AWS.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",AWS.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(request){request.httpRequest.method="GET",request.httpRequest.path=request.service.endpoint.path+"?"+request.httpRequest.body,request.httpRequest.body="",delete request.httpRequest.headers["Content-Length"],delete request.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),AWS.Request.addPromisesToClass=function(PromiseDependency){this.prototype.promise=function(){var self=this;return this.httpRequest.appendToUserAgent("promise"),new PromiseDependency(function(resolve,reject){self.on("complete",function(resp){resp.error?reject(resp.error):resolve(Object.defineProperty(resp.data||{},"$response",{value:resp}))}),self.runTo()})}},AWS.Request.deletePromisesFromClass=function(){delete this.prototype.promise},AWS.util.addPromises(AWS.Request),AWS.util.mixin(AWS.Request,AWS.SequentialExecutor)}).call(this)}).call(this,require("_process"))},{"./core":27,"./state_machine":82,_process:97,jmespath:96}],65:[function(require,module,exports){var AWS=require("./core"),inherit=AWS.util.inherit,jmespath=require("jmespath");function CHECK_ACCEPTORS(resp){var waiter=resp.request._waiter,acceptors=waiter.config.acceptors,acceptorMatched=!1,state="retry";acceptors.forEach(function(acceptor){if(!acceptorMatched){var matcher=waiter.matchers[acceptor.matcher];matcher&&matcher(resp,acceptor.expected,acceptor.argument)&&(acceptorMatched=!0,state=acceptor.state)}}),!acceptorMatched&&resp.error&&(state="failure"),"success"===state?waiter.setSuccess(resp):waiter.setError(resp,"retry"===state)}AWS.ResourceWaiter=inherit({constructor:function(service,state){this.service=service,this.state=state,this.loadWaiterConfig(this.state)},service:null,state:null,config:null,matchers:{path:function(resp,expected,argument){try{var result=jmespath.search(resp.data,argument)}catch(err){return!1}return jmespath.strictDeepEqual(result,expected)},pathAll:function(resp,expected,argument){try{var results=jmespath.search(resp.data,argument)}catch(err){return!1}Array.isArray(results)||(results=[results]);var numResults=results.length;if(!numResults)return!1;for(var ind=0;ind=1&&self.doneParts===self.numParts&&self.finishMultiPart()}))}runFill&&self.fillQueue.call(self)},abort:function(){!0===this.isDoneChunking&&1===this.totalPartNumbers&&this.singlePart?this.singlePart.abort():this.cleanup(AWS.util.error(new Error("Request aborted by user"),{code:"RequestAbortedError",retryable:!1}))},validateBody:function(){if(this.body=this.service.config.params.Body,"string"==typeof this.body)this.body=AWS.util.buffer.toBuffer(this.body);else if(!this.body)throw new Error("params.Body is required");this.sliceFn=AWS.util.arraySliceFn(this.body)},bindServiceObject:function(params){params=params||{};if(this.service){var service=this.service,config=AWS.util.copy(service.config);config.signatureVersion=service.getSignatureVersion(),this.service=new service.constructor.__super__(config),this.service.config.params=AWS.util.merge(this.service.config.params||{},params),Object.defineProperty(this.service,"_originalConfig",{get:function(){return service._originalConfig},enumerable:!1,configurable:!0})}else this.service=new AWS.S3({params:params})},adjustTotalBytes:function(){try{this.totalBytes=byteLength(this.body)}catch(e){}if(this.totalBytes){var newPartSize=Math.ceil(this.totalBytes/this.maxTotalParts);newPartSize>this.partSize&&(this.partSize=newPartSize)}else this.totalBytes=void 0},isDoneChunking:!1,partPos:0,totalChunkedBytes:0,totalUploadedBytes:0,totalBytes:void 0,numParts:0,totalPartNumbers:0,activeParts:0,doneParts:0,parts:null,completeInfo:null,failed:!1,multipartReq:null,partBuffers:null,partBufferLength:0,fillBuffer:function(){var bodyLen=byteLength(this.body);if(0===bodyLen)return this.isDoneChunking=!0,this.numParts=1,void this.nextChunk(this.body);for(;this.activeParts=this.queueSize)){var buf=this.body.read(this.partSize-this.partBufferLength)||this.body.read();if(buf&&(this.partBuffers.push(buf),this.partBufferLength+=buf.length,this.totalChunkedBytes+=buf.length),this.partBufferLength>=this.partSize){var pbuf=1===this.partBuffers.length?this.partBuffers[0]:Buffer.concat(this.partBuffers);if(this.partBuffers=[],this.partBufferLength=0,pbuf.length>this.partSize){var rest=pbuf.slice(this.partSize);this.partBuffers.push(rest),this.partBufferLength+=rest.length,pbuf=pbuf.slice(0,this.partSize)}this.nextChunk(pbuf)}this.isDoneChunking&&!this.isDoneSending&&(pbuf=1===this.partBuffers.length?this.partBuffers[0]:Buffer.concat(this.partBuffers),this.partBuffers=[],this.partBufferLength=0,this.totalBytes=this.totalChunkedBytes,this.isDoneSending=!0,(0===this.numParts||pbuf.length>0)&&(this.numParts++,this.nextChunk(pbuf))),this.body.read(0)}},nextChunk:function(chunk){var self=this;if(self.failed)return null;var partNumber=++self.totalPartNumbers;if(self.isDoneChunking&&1===partNumber){var params={Body:chunk};this.tags&&(params.Tagging=this.getTaggingHeader());var req=self.service.putObject(params);return req._managedUpload=self,req.on("httpUploadProgress",self.progress).send(self.finishSinglePart),self.singlePart=req,null}if(self.service.config.params.ContentMD5){var err=AWS.util.error(new Error("The Content-MD5 you specified is invalid for multi-part uploads."),{code:"InvalidDigest",retryable:!1});return self.cleanup(err),null}if(self.completeInfo[partNumber]&&null!==self.completeInfo[partNumber].ETag)return null;self.activeParts++,self.service.config.params.UploadId?self.uploadPart(chunk,partNumber):self.multipartReq?self.queueChunks(chunk,partNumber):(self.multipartReq=self.service.createMultipartUpload(),self.multipartReq.on("success",function(resp){self.service.config.params.UploadId=resp.data.UploadId,self.multipartReq=null}),self.queueChunks(chunk,partNumber),self.multipartReq.on("error",function(err){self.cleanup(err)}),self.multipartReq.send())},getTaggingHeader:function(){for(var kvPairStrings=[],i=0;i-1&&listeners.splice(position,1)}return this},removeAllListeners:function(eventName){return eventName?delete this._events[eventName]:this._events={},this},emit:function(eventName,eventArgs,doneCallback){doneCallback||(doneCallback=function(){});var listeners=this.listeners(eventName),count=listeners.length;return this.callListeners(listeners,eventArgs,doneCallback),count>0},callListeners:function(listeners,args,doneCallback,prevError){var self=this,error=prevError||null;function callNextListener(err){if(err&&(error=AWS.util.error(error||new Error,err),self._haltHandlersOnError))return doneCallback.call(self,error);self.callListeners(listeners,args,doneCallback,error)}for(;listeners.length>0;){var listener=listeners.shift();if(listener._isAsync)return void listener.apply(self,args.concat([callNextListener]));try{listener.apply(self,args)}catch(err){error=AWS.util.error(error||new Error,err)}if(error&&self._haltHandlersOnError)return void doneCallback.call(self,error)}doneCallback.call(self,error)},addListeners:function(listeners){var self=this;return listeners._events&&(listeners=listeners._events),AWS.util.each(listeners,function(event,callbacks){"function"==typeof callbacks&&(callbacks=[callbacks]),AWS.util.arrayEach(callbacks,function(callback){self.on(event,callback)})}),self},addNamedListener:function(name,eventName,callback,toHead){return this[name]=callback,this.addListener(eventName,callback,toHead),this},addNamedAsyncListener:function(name,eventName,callback,toHead){return callback._isAsync=!0,this.addNamedListener(name,eventName,callback,toHead)},addNamedListeners:function(callback){var self=this;return callback(function(){self.addNamedListener.apply(self,arguments)},function(){self.addNamedAsyncListener.apply(self,arguments)}),this}}),AWS.SequentialExecutor.prototype.addListener=AWS.SequentialExecutor.prototype.on,module.exports=AWS.SequentialExecutor},{"./core":27}],69:[function(require,module,exports){(function(process){(function(){var AWS=require("./core"),Api=require("./model/api"),regionConfig=require("./region_config"),inherit=AWS.util.inherit,clientCount=0;AWS.Service=inherit({constructor:function(config){if(!this.loadServiceClass)throw AWS.util.error(new Error,"Service must be constructed with `new' operator");var ServiceClass=this.loadServiceClass(config||{});if(ServiceClass){var originalConfig=AWS.util.copy(config),svc=new ServiceClass(config);return Object.defineProperty(svc,"_originalConfig",{get:function(){return originalConfig},enumerable:!1,configurable:!0}),svc._clientId=++clientCount,svc}this.initialize(config)},initialize:function(config){var svcConfig=AWS.config[this.serviceIdentifier];if(this.config=new AWS.Config(AWS.config),svcConfig&&this.config.update(svcConfig,!0),config&&this.config.update(config,!0),this.validateService(),this.config.endpoint||regionConfig.configureEndpoint(this),this.config.endpoint=this.endpointFromTemplate(this.config.endpoint),this.setEndpoint(this.config.endpoint),AWS.SequentialExecutor.call(this),AWS.Service.addDefaultMonitoringListeners(this),(this.config.clientSideMonitoring||AWS.Service._clientSideMonitoring)&&this.publisher){var publisher=this.publisher;this.addNamedListener("PUBLISH_API_CALL","apiCall",function(event){process.nextTick(function(){publisher.eventHandler(event)})}),this.addNamedListener("PUBLISH_API_ATTEMPT","apiCallAttempt",function(event){process.nextTick(function(){publisher.eventHandler(event)})})}},validateService:function(){},loadServiceClass:function(serviceConfig){var config=serviceConfig;if(AWS.util.isEmpty(this.api)){if(config.apiConfig)return AWS.Service.defineServiceApi(this.constructor,config.apiConfig);if(this.constructor.services){(config=new AWS.Config(AWS.config)).update(serviceConfig,!0);var version=config.apiVersions[this.constructor.serviceIdentifier];return version=version||config.apiVersion,this.getLatestServiceClass(version)}return null}return null},getLatestServiceClass:function(version){return version=this.getLatestServiceVersion(version),null===this.constructor.services[version]&&AWS.Service.defineServiceApi(this.constructor,version),this.constructor.services[version]},getLatestServiceVersion:function(version){if(!this.constructor.services||0===this.constructor.services.length)throw new Error("No services defined on "+this.constructor.serviceIdentifier);if(version?AWS.util.isType(version,Date)&&(version=AWS.util.date.iso8601(version).split("T")[0]):version="latest",Object.hasOwnProperty(this.constructor.services,version))return version;for(var keys=Object.keys(this.constructor.services).sort(),selectedVersion=null,i=keys.length-1;i>=0;i--)if("*"!==keys[i][keys[i].length-1]&&(selectedVersion=keys[i]),keys[i].substr(0,10)<=version)return selectedVersion;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+version+"'")},api:{},defaultRetryCount:3,customizeRequests:function(callback){if(callback){if("function"!=typeof callback)throw new Error("Invalid callback type '"+typeof callback+"' provided in customizeRequests");this.customRequestHandler=callback}else this.customRequestHandler=null},makeRequest:function(operation,params,callback){if("function"==typeof params&&(callback=params,params=null),params=params||{},this.config.params){var rules=this.api.operations[operation];rules&&(params=AWS.util.copy(params),AWS.util.each(this.config.params,function(key,value){rules.input.members[key]&&(void 0!==params[key]&&null!==params[key]||(params[key]=value))}))}var request=new AWS.Request(this,operation,params);return this.addAllRequestListeners(request),this.attachMonitoringEmitter(request),callback&&request.send(callback),request},makeUnauthenticatedRequest:function(operation,params,callback){"function"==typeof params&&(callback=params,params={});var request=this.makeRequest(operation,params).toUnauthenticated();return callback?request.send(callback):request},waitFor:function(state,params,callback){return new AWS.ResourceWaiter(this,state).wait(params,callback)},addAllRequestListeners:function(request){for(var list=[AWS.events,AWS.EventListeners.Core,this.serviceInterface(),AWS.EventListeners.CorePost],i=0;i299?(error.code&&(monitoringEvent.FinalAwsException=error.code),error.message&&(monitoringEvent.FinalAwsExceptionMessage=error.message)):((error.code||error.name)&&(monitoringEvent.FinalSdkException=error.code||error.name),error.message&&(monitoringEvent.FinalSdkExceptionMessage=error.message))}return monitoringEvent},apiAttemptEvent:function(request){var api=request.service.api.operations[request.operation],monitoringEvent={Type:"ApiCallAttempt",Api:api?api.name:request.operation,Version:1,Service:request.service.api.serviceId||request.service.api.endpointPrefix,Fqdn:request.httpRequest.endpoint.hostname,UserAgent:request.httpRequest.getUserAgent()},response=request.response;return response.httpResponse.statusCode&&(monitoringEvent.HttpStatusCode=response.httpResponse.statusCode),!request._unAuthenticated&&request.service.config.credentials&&request.service.config.credentials.accessKeyId&&(monitoringEvent.AccessKey=request.service.config.credentials.accessKeyId),response.httpResponse.headers?(request.httpRequest.headers["x-amz-security-token"]&&(monitoringEvent.SessionToken=request.httpRequest.headers["x-amz-security-token"]),response.httpResponse.headers["x-amzn-requestid"]&&(monitoringEvent.XAmznRequestId=response.httpResponse.headers["x-amzn-requestid"]),response.httpResponse.headers["x-amz-request-id"]&&(monitoringEvent.XAmzRequestId=response.httpResponse.headers["x-amz-request-id"]),response.httpResponse.headers["x-amz-id-2"]&&(monitoringEvent.XAmzId2=response.httpResponse.headers["x-amz-id-2"]),monitoringEvent):monitoringEvent},attemptFailEvent:function(request){var monitoringEvent=this.apiAttemptEvent(request),response=request.response,error=response.error;return response.httpResponse.statusCode>299?(error.code&&(monitoringEvent.AwsException=error.code),error.message&&(monitoringEvent.AwsExceptionMessage=error.message)):((error.code||error.name)&&(monitoringEvent.SdkException=error.code||error.name),error.message&&(monitoringEvent.SdkExceptionMessage=error.message)),monitoringEvent},attachMonitoringEmitter:function(request){var attemptTimestamp,attemptStartRealTime,attemptLatency,callStartRealTime,region,callTimestamp,attemptCount=0,self=this;request.on("validate",function(){callStartRealTime=AWS.util.realClock.now(),callTimestamp=Date.now()},!0),request.on("sign",function(){attemptStartRealTime=AWS.util.realClock.now(),attemptTimestamp=Date.now(),region=request.httpRequest.region,attemptCount++},!0),request.on("validateResponse",function(){attemptLatency=Math.round(AWS.util.realClock.now()-attemptStartRealTime)}),request.addNamedListener("API_CALL_ATTEMPT","success",function(){var apiAttemptEvent=self.apiAttemptEvent(request);apiAttemptEvent.Timestamp=attemptTimestamp,apiAttemptEvent.AttemptLatency=attemptLatency>=0?attemptLatency:0,apiAttemptEvent.Region=region,self.emit("apiCallAttempt",[apiAttemptEvent])}),request.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",function(){var apiAttemptEvent=self.attemptFailEvent(request);apiAttemptEvent.Timestamp=attemptTimestamp,attemptLatency=attemptLatency||Math.round(AWS.util.realClock.now()-attemptStartRealTime),apiAttemptEvent.AttemptLatency=attemptLatency>=0?attemptLatency:0,apiAttemptEvent.Region=region,self.emit("apiCallAttempt",[apiAttemptEvent])}),request.addNamedListener("API_CALL","complete",function(){var apiCallEvent=self.apiCallEvent(request);if(apiCallEvent.AttemptCount=attemptCount,!(apiCallEvent.AttemptCount<=0)){apiCallEvent.Timestamp=callTimestamp;var latency=Math.round(AWS.util.realClock.now()-callStartRealTime);apiCallEvent.Latency=latency>=0?latency:0;var response=request.response;response.error&&response.error.retryable&&"number"==typeof response.retryCount&&"number"==typeof response.maxRetries&&response.retryCount>=response.maxRetries&&(apiCallEvent.MaxRetriesExceeded=1),self.emit("apiCall",[apiCallEvent])}})},setupRequestListeners:function(request){},getSigningName:function(){return this.api.signingName||this.api.endpointPrefix},getSignerClass:function(request){var version,operation=null,authtype="";request&&(authtype=(operation=(request.service.api.operations||{})[request.operation]||null)?operation.authtype:"");return version=this.config.signatureVersion?this.config.signatureVersion:"v4"===authtype||"v4-unsigned-body"===authtype?"v4":this.api.signatureVersion,AWS.Signers.RequestSigner.getVersion(version)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return AWS.EventListeners.Query;case"json":return AWS.EventListeners.Json;case"rest-json":return AWS.EventListeners.RestJson;case"rest-xml":return AWS.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(resp){return resp.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(retryCount,err){return AWS.util.calculateRetryDelay(retryCount,this.config.retryDelayOptions,err)},retryableError:function(error){return!!this.timeoutError(error)||(!!this.networkingError(error)||(!!this.expiredCredentialsError(error)||(!!this.throttledError(error)||error.statusCode>=500)))},networkingError:function(error){return"NetworkingError"===error.code},timeoutError:function(error){return"TimeoutError"===error.code},expiredCredentialsError:function(error){return"ExpiredTokenException"===error.code},clockSkewError:function(error){switch(error.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(newServerTime){newServerTime&&(this.config.systemClockOffset=newServerTime-Date.now())},isClockSkewed:function(newServerTime){if(newServerTime)return Math.abs(this.getSkewCorrectedDate().getTime()-newServerTime)>=3e5},throttledError:function(error){if(429===error.statusCode)return!0;switch(error.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(endpoint){if("string"!=typeof endpoint)return endpoint;var e=endpoint;return e=(e=(e=e.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(endpoint){this.endpoint=new AWS.Endpoint(endpoint,this.config)},paginationConfig:function(operation,throwException){var paginator=this.api.operations[operation].paginator;if(!paginator){if(throwException){var e=new Error;throw AWS.util.error(e,"No pagination configuration for "+operation)}return null}return paginator}}),AWS.util.update(AWS.Service,{defineMethods:function(svc){AWS.util.each(svc.prototype.api.operations,function(method){svc.prototype[method]||("none"===svc.prototype.api.operations[method].authtype?svc.prototype[method]=function(params,callback){return this.makeUnauthenticatedRequest(method,params,callback)}:svc.prototype[method]=function(params,callback){return this.makeRequest(method,params,callback)})})},defineService:function(serviceIdentifier,versions,features){AWS.Service._serviceMap[serviceIdentifier]=!0,Array.isArray(versions)||(features=versions,versions=[]);var svc=inherit(AWS.Service,features||{});if("string"==typeof serviceIdentifier){AWS.Service.addVersions(svc,versions);var identifier=svc.serviceIdentifier||serviceIdentifier;svc.serviceIdentifier=identifier}else svc.prototype.api=serviceIdentifier,AWS.Service.defineMethods(svc);if(AWS.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&AWS.util.clientSideMonitoring){var Publisher=AWS.util.clientSideMonitoring.Publisher,publisherConfig=(0,AWS.util.clientSideMonitoring.configProvider)();this.prototype.publisher=new Publisher(publisherConfig),publisherConfig.enabled&&(AWS.Service._clientSideMonitoring=!0)}return AWS.SequentialExecutor.call(svc.prototype),AWS.Service.addDefaultMonitoringListeners(svc.prototype),svc},addVersions:function(svc,versions){Array.isArray(versions)||(versions=[versions]),svc.services=svc.services||{};for(var i=0;i1&&(msg="Multiple configuration errors:\n"+messages.join("\n")),msg)throw AWS.util.error(new Error,{name:"InvalidEndpoint",message:msg})},shouldDisableBodySigning:function(request){var signerClass=this.getSignerClass();return!0===this.config.s3DisableBodySigning&&signerClass===AWS.Signers.V4&&"https:"===request.httpRequest.endpoint.protocol},setupRequestListeners:function(request){if(request.addListener("validate",this.validateScheme),request.addListener("validate",this.validateBucketName,!0),request.addListener("validate",this.optInUsEast1RegionalEndpoint,!0),request.removeListener("validate",AWS.EventListeners.Core.VALIDATE_REGION),request.addListener("build",this.addContentType),request.addListener("build",this.computeContentMd5),request.addListener("build",this.computeSseCustomerKeyMd5),request.addListener("build",this.populateURI),request.addListener("afterBuild",this.addExpect100Continue),request.addListener("extractError",this.extractError),request.addListener("extractData",AWS.util.hoistPayloadMember),request.addListener("extractData",this.extractData),request.addListener("extractData",this.extractErrorFrom200Response),request.addListener("beforePresign",this.prepareSignedUrl),this.shouldDisableBodySigning(request)&&(request.removeListener("afterBuild",AWS.EventListeners.Core.COMPUTE_SHA256),request.addListener("afterBuild",this.disableBodySigning)),"createBucket"!==request.operation&&s3util.isArnInParam(request,"Bucket"))return request._parsedArn=AWS.util.ARN.parse(request.params.Bucket),request.removeListener("validate",this.validateBucketName),request.removeListener("build",this.populateURI),"s3"===request._parsedArn.service?(request.addListener("validate",s3util.validateS3AccessPointArn),request.addListener("validate",this.validateArnResourceType)):"s3-outposts"===request._parsedArn.service&&(request.addListener("validate",s3util.validateOutpostsAccessPointArn),request.addListener("validate",s3util.validateOutpostsArn)),request.addListener("validate",s3util.validateArnRegion),request.addListener("validate",s3util.validateArnAccount),request.addListener("validate",s3util.validateArnService),request.addListener("build",this.populateUriFromAccessPointArn),void request.addListener("build",s3util.validatePopulateUriFromArn);request.addListener("validate",this.validateBucketEndpoint),request.addListener("validate",this.correctBucketRegionFromCache),request.onAsync("extractError",this.requestBucketRegion),AWS.util.isBrowser()&&request.onAsync("retry",this.reqRegionForNetworkingError)},validateScheme:function(req){var params=req.params,scheme=req.httpRequest.endpoint.protocol;if((params.SSECustomerKey||params.CopySourceSSECustomerKey)&&"https:"!==scheme){throw AWS.util.error(new Error,{code:"ConfigError",message:"Cannot send SSE keys over HTTP. Set 'sslEnabled'to 'true' in your configuration"})}},validateBucketEndpoint:function(req){if(!req.params.Bucket&&req.service.config.s3BucketEndpoint){throw AWS.util.error(new Error,{code:"ConfigError",message:"Cannot send requests to root API with `s3BucketEndpoint` set."})}},validateArnResourceType:function(req){var resource=req._parsedArn.resource;if(0!==resource.indexOf("accesspoint:")&&0!==resource.indexOf("accesspoint/"))throw AWS.util.error(new Error,{code:"InvalidARN",message:"ARN resource should begin with 'accesspoint/'"})},validateBucketName:function(req){var signatureVersion=req.service.getSignatureVersion(req),bucket=req.params&&req.params.Bucket,key=req.params&&req.params.Key,slashIndex=bucket&&bucket.indexOf("/");if(bucket&&slashIndex>=0)if("string"==typeof key&&slashIndex>0){req.params=AWS.util.copy(req.params);var prefix=bucket.substr(slashIndex+1)||"";req.params.Key=prefix+"/"+key,req.params.Bucket=bucket.substr(0,slashIndex)}else if("v4"===signatureVersion){var msg="Bucket names cannot contain forward slashes. Bucket: "+bucket;throw AWS.util.error(new Error,{code:"InvalidBucket",message:msg})}},isValidAccelerateOperation:function(operation){return-1===["createBucket","deleteBucket","listBuckets"].indexOf(operation)},optInUsEast1RegionalEndpoint:function(req){var service=req.service,config=service.config;if(config.s3UsEast1RegionalEndpoint=resolveRegionalEndpointsFlag(service._originalConfig,{env:"AWS_S3_US_EAST_1_REGIONAL_ENDPOINT",sharedConfig:"s3_us_east_1_regional_endpoint",clientConfig:"s3UsEast1RegionalEndpoint"}),!(service._originalConfig||{}).endpoint&&"us-east-1"===req.httpRequest.region&&"regional"===config.s3UsEast1RegionalEndpoint&&req.httpRequest.endpoint.hostname.indexOf("s3.amazonaws.com")>=0){var insertPoint=config.endpoint.indexOf(".amazonaws.com");regionalEndpoint=config.endpoint.substring(0,insertPoint)+".us-east-1"+config.endpoint.substring(insertPoint),req.httpRequest.updateEndpoint(regionalEndpoint)}},populateURI:function(req){var httpRequest=req.httpRequest,b=req.params.Bucket,service=req.service,endpoint=httpRequest.endpoint;if(b&&!service.pathStyleBucketName(b)){service.config.useAccelerateEndpoint&&service.isValidAccelerateOperation(req.operation)?service.config.useDualstack?endpoint.hostname=b+".s3-accelerate.dualstack.amazonaws.com":endpoint.hostname=b+".s3-accelerate.amazonaws.com":service.config.s3BucketEndpoint||(endpoint.hostname=b+"."+endpoint.hostname);var port=endpoint.port;endpoint.host=80!==port&&443!==port?endpoint.hostname+":"+endpoint.port:endpoint.hostname,httpRequest.virtualHostedBucket=b,service.removeVirtualHostedBucketFromPath(req)}},removeVirtualHostedBucketFromPath:function(req){var httpRequest=req.httpRequest,bucket=httpRequest.virtualHostedBucket;if(bucket&&httpRequest.path){if(req.params&&req.params.Key){var encodedS3Key="/"+AWS.util.uriEscapePath(req.params.Key);if(0===httpRequest.path.indexOf(encodedS3Key)&&(httpRequest.path.length===encodedS3Key.length||"?"===httpRequest.path[encodedS3Key.length]))return}httpRequest.path=httpRequest.path.replace(new RegExp("/"+bucket),""),"/"!==httpRequest.path[0]&&(httpRequest.path="/"+httpRequest.path)}},populateUriFromAccessPointArn:function(req){var accessPointArn=req._parsedArn,isOutpostArn="s3-outposts"===accessPointArn.service,isObjectLambdaArn="s3-object-lambda"===accessPointArn.service,outpostsSuffix=isOutpostArn?"."+accessPointArn.outpostId:"",serviceName=isOutpostArn?"s3-outposts":"s3-accesspoint",dualStackSuffix=!isOutpostArn&&req.service.config.useDualstack?".dualstack":"",endpoint=req.httpRequest.endpoint,dnsSuffix=regionUtil.getEndpointSuffix(accessPointArn.region),useArnRegion=req.service.config.s3UseArnRegion;if(endpoint.hostname=[accessPointArn.accessPoint+"-"+accessPointArn.accountId+outpostsSuffix,serviceName+dualStackSuffix,useArnRegion?accessPointArn.region:req.service.config.region,dnsSuffix].join("."),isObjectLambdaArn){serviceName="s3-object-lambda";var accesspointName=accessPointArn.resource.split("/")[1];endpoint.hostname=[accesspointName+"-"+accessPointArn.accountId,serviceName,useArnRegion?accessPointArn.region:req.service.config.region,dnsSuffix].join(".")}endpoint.host=endpoint.hostname;var encodedArn=AWS.util.uriEscape(req.params.Bucket),path=req.httpRequest.path;req.httpRequest.path=path.replace(new RegExp("/"+encodedArn),""),"/"!==req.httpRequest.path[0]&&(req.httpRequest.path="/"+req.httpRequest.path),req.httpRequest.region=accessPointArn.region},addExpect100Continue:function(req){var len=req.httpRequest.headers["Content-Length"];AWS.util.isNode()&&(len>=1048576||req.params.Body instanceof AWS.util.stream.Stream)&&(req.httpRequest.headers.Expect="100-continue")},addContentType:function(req){var httpRequest=req.httpRequest;if("GET"!==httpRequest.method&&"HEAD"!==httpRequest.method){httpRequest.headers["Content-Type"]||(httpRequest.headers["Content-Type"]="application/octet-stream");var contentType=httpRequest.headers["Content-Type"];if(AWS.util.isBrowser())if("string"!=typeof httpRequest.body||contentType.match(/;\s*charset=/)){httpRequest.headers["Content-Type"]=contentType.replace(/(;\s*charset=)(.+)$/,function(_,prefix,charsetName){return prefix+charsetName.toUpperCase()})}else{httpRequest.headers["Content-Type"]+="; charset=UTF-8"}}else delete httpRequest.headers["Content-Type"]},computableChecksumOperations:{putBucketCors:!0,putBucketLifecycle:!0,putBucketLifecycleConfiguration:!0,putBucketTagging:!0,deleteObjects:!0,putBucketReplication:!0,putObjectLegalHold:!0,putObjectRetention:!0,putObjectLockConfiguration:!0},willComputeChecksums:function(req){if(this.computableChecksumOperations[req.operation])return!0;if(!this.config.computeChecksums)return!1;if(!AWS.util.Buffer.isBuffer(req.httpRequest.body)&&"string"!=typeof req.httpRequest.body)return!1;var rules=req.service.api.operations[req.operation].input.members;return!(!req.service.shouldDisableBodySigning(req)||Object.prototype.hasOwnProperty.call(req.httpRequest.headers,"presigned-expires")||!rules.ContentMD5||req.params.ContentMD5)||!(req.service.getSignerClass(req)===AWS.Signers.V4&&rules.ContentMD5&&!rules.ContentMD5.required)&&(!(!rules.ContentMD5||req.params.ContentMD5)||void 0)},computeContentMd5:function(req){if(req.service.willComputeChecksums(req)){var md5=AWS.util.crypto.md5(req.httpRequest.body,"base64");req.httpRequest.headers["Content-MD5"]=md5}},computeSseCustomerKeyMd5:function(req){AWS.util.each({SSECustomerKey:"x-amz-server-side-encryption-customer-key-MD5",CopySourceSSECustomerKey:"x-amz-copy-source-server-side-encryption-customer-key-MD5"},function(key,header){if(req.params[key]){var value=AWS.util.crypto.md5(req.params[key],"base64");req.httpRequest.headers[header]=value}})},pathStyleBucketName:function(bucketName){return!!this.config.s3ForcePathStyle||!this.config.s3BucketEndpoint&&(!s3util.dnsCompatibleBucketName(bucketName)||!(!this.config.sslEnabled||!bucketName.match(/\./)))},extractErrorFrom200Response:function(resp){if(operationsWith200StatusCodeError[resp.request.operation]){var httpResponse=resp.httpResponse;if(httpResponse.body&&httpResponse.body.toString().match(""))throw resp.data=null,(this.service?this.service:this).extractError(resp),resp.error;if(!httpResponse.body||!httpResponse.body.toString().match(/<[\w_]/))throw resp.data=null,AWS.util.error(new Error,{code:"InternalError",message:"S3 aborted request"})}},retryableError:function(error,request){return!(!operationsWith200StatusCodeError[request.operation]||200!==error.statusCode)||(!request._requestRegionForBucket||!request.service.bucketRegionCache[request._requestRegionForBucket])&&(!(!error||"RequestTimeout"!==error.code)||(error&&-1!=regionRedirectErrorCodes.indexOf(error.code)&&error.region&&error.region!=request.httpRequest.region?(request.httpRequest.region=error.region,301===error.statusCode&&request.service.updateReqBucketRegion(request),!0):AWS.Service.prototype.retryableError.call(this,error,request)))},updateReqBucketRegion:function(request,region){var httpRequest=request.httpRequest;if("string"==typeof region&®ion.length&&(httpRequest.region=region),httpRequest.endpoint.host.match(/s3(?!-accelerate).*\.amazonaws\.com$/)){var service=request.service,s3Config=service.config,s3BucketEndpoint=s3Config.s3BucketEndpoint;s3BucketEndpoint&&delete s3Config.s3BucketEndpoint;var newConfig=AWS.util.copy(s3Config);delete newConfig.endpoint,newConfig.region=httpRequest.region,httpRequest.endpoint=new AWS.S3(newConfig).endpoint,service.populateURI(request),s3Config.s3BucketEndpoint=s3BucketEndpoint,httpRequest.headers.Host=httpRequest.endpoint.host,"validate"===request._asm.currentState&&(request.removeListener("build",service.populateURI),request.addListener("build",service.removeVirtualHostedBucketFromPath))}},extractData:function(resp){var req=resp.request;if("getBucketLocation"===req.operation){var match=resp.httpResponse.body.toString().match(/>(.+)<\/Location/);delete resp.data._,resp.data.LocationConstraint=match?match[1]:""}var bucket=req.params.Bucket||null;if("deleteBucket"!==req.operation||"string"!=typeof bucket||resp.error){var region=(resp.httpResponse.headers||{})["x-amz-bucket-region"]||null;if(!region&&"createBucket"===req.operation&&!resp.error){var createBucketConfiguration=req.params.CreateBucketConfiguration;region=createBucketConfiguration?"EU"===createBucketConfiguration.LocationConstraint?"eu-west-1":createBucketConfiguration.LocationConstraint:"us-east-1"}region&&bucket&®ion!==req.service.bucketRegionCache[bucket]&&(req.service.bucketRegionCache[bucket]=region)}else req.service.clearBucketRegionCache(bucket);req.service.extractRequestIds(resp)},extractError:function(resp){var cachedRegion,codes={304:"NotModified",403:"Forbidden",400:"BadRequest",404:"NotFound"},req=resp.request,code=resp.httpResponse.statusCode,body=resp.httpResponse.body||"",region=(resp.httpResponse.headers||{})["x-amz-bucket-region"]||null,bucket=req.params.Bucket||null,bucketRegionCache=req.service.bucketRegionCache;if(region&&bucket&®ion!==bucketRegionCache[bucket]&&(bucketRegionCache[bucket]=region),codes[code]&&0===body.length)bucket&&!region&&(cachedRegion=bucketRegionCache[bucket]||null)!==req.httpRequest.region&&(region=cachedRegion),resp.error=AWS.util.error(new Error,{code:codes[code],message:null,region:region});else{var data=(new AWS.XML.Parser).parse(body.toString());data.Region&&!region?(region=data.Region,bucket&®ion!==bucketRegionCache[bucket]&&(bucketRegionCache[bucket]=region)):!bucket||region||data.Region||(cachedRegion=bucketRegionCache[bucket]||null)!==req.httpRequest.region&&(region=cachedRegion),resp.error=AWS.util.error(new Error,{code:data.Code||code,message:data.Message||null,region:region})}req.service.extractRequestIds(resp)},requestBucketRegion:function(resp,done){var error=resp.error,req=resp.request,bucket=req.params.Bucket||null;if(!error||!bucket||error.region||"listObjects"===req.operation||AWS.util.isNode()&&"headBucket"===req.operation||400===error.statusCode&&"headObject"!==req.operation||-1===regionRedirectErrorCodes.indexOf(error.code))return done();var reqOperation=AWS.util.isNode()?"headBucket":"listObjects",reqParams={Bucket:bucket};"listObjects"===reqOperation&&(reqParams.MaxKeys=0);var regionReq=req.service[reqOperation](reqParams);regionReq._requestRegionForBucket=bucket,regionReq.send(function(){var region=req.service.bucketRegionCache[bucket]||null;error.region=region,done()})},reqRegionForNetworkingError:function(resp,done){if(!AWS.util.isBrowser())return done();var error=resp.error,request=resp.request,bucket=request.params.Bucket;if(!error||"NetworkingError"!==error.code||!bucket||"us-east-1"===request.httpRequest.region)return done();var service=request.service,bucketRegionCache=service.bucketRegionCache,cachedRegion=bucketRegionCache[bucket]||null;if(cachedRegion&&cachedRegion!==request.httpRequest.region)service.updateReqBucketRegion(request,cachedRegion),done();else if(s3util.dnsCompatibleBucketName(bucket))if(request.httpRequest.virtualHostedBucket){var getRegionReq=service.listObjects({Bucket:bucket,MaxKeys:0});service.updateReqBucketRegion(getRegionReq,"us-east-1"),getRegionReq._requestRegionForBucket=bucket,getRegionReq.send(function(){var region=service.bucketRegionCache[bucket]||null;region&®ion!==request.httpRequest.region&&service.updateReqBucketRegion(request,region),done()})}else done();else service.updateReqBucketRegion(request,"us-east-1"),"us-east-1"!==bucketRegionCache[bucket]&&(bucketRegionCache[bucket]="us-east-1"),done()},bucketRegionCache:{},clearBucketRegionCache:function(buckets){var bucketRegionCache=this.bucketRegionCache;buckets?"string"==typeof buckets&&(buckets=[buckets]):buckets=Object.keys(bucketRegionCache);for(var i=0;i=0||regionFromArn.indexOf("fips")>=0)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"ARN endpoint is not compatible with FIPS region"});if(!useArnRegion&®ionFromArn!==clientRegion)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"Configured region conflicts with access point region"});if(useArnRegion&®ionUtil.getEndpointSuffix(regionFromArn)!==regionUtil.getEndpointSuffix(clientRegion))throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"Configured region and access point region not in same partition"});if(req.service.config.useAccelerateEndpoint)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"useAccelerateEndpoint config is not supported with access point ARN"});if("s3-outposts"===req._parsedArn.service&&req.service.config.useDualstack)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"useDualstack config is not supported with outposts access point ARN"})},loadUseArnRegionConfig:function(req){var envName="AWS_S3_USE_ARN_REGION",configName="s3_use_arn_region",useArnRegion=!0,originalConfig=req.service._originalConfig||{};if(void 0!==req.service.config.s3UseArnRegion)return req.service.config.s3UseArnRegion;if(void 0!==originalConfig.s3UseArnRegion)useArnRegion=!0===originalConfig.s3UseArnRegion;else if(AWS.util.isNode())if(process.env[envName]){var value=process.env[envName].trim().toLowerCase();if(["false","true"].indexOf(value)<0)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:envName+" only accepts true or false. Got "+process.env[envName],retryable:!1});useArnRegion="true"===value}else{var profile={};try{profile=AWS.util.getProfilesFromSharedConfig(AWS.util.iniLoader)[process.env.AWS_PROFILE||AWS.util.defaultProfile]}catch(e){}if(profile[configName]){if(["false","true"].indexOf(profile[configName].trim().toLowerCase())<0)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:configName+" only accepts true or false. Got "+profile[configName],retryable:!1});useArnRegion="true"===profile[configName].trim().toLowerCase()}}return req.service.config.s3UseArnRegion=useArnRegion,useArnRegion},validatePopulateUriFromArn:function(req){if(req.service._originalConfig&&req.service._originalConfig.endpoint)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"Custom endpoint is not compatible with access point ARN"});if(req.service.config.s3ForcePathStyle)throw AWS.util.error(new Error,{code:"InvalidConfiguration",message:"Cannot construct path-style endpoint with access point"})},dnsCompatibleBucketName:function(bucketName){var b=bucketName,domain=new RegExp(/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/),ipAddress=new RegExp(/(\d+\.){3}\d+/),dots=new RegExp(/\.\./);return!(!b.match(domain)||b.match(ipAddress)||b.match(dots))}};module.exports=s3util}).call(this)}).call(this,require("_process"))},{"../core":27,"../region_config":62,_process:97}],73:[function(require,module,exports){var AWS=require("../core"),resolveRegionalEndpointsFlag=require("../config_regional_endpoint");AWS.util.update(AWS.STS.prototype,{credentialsFrom:function(data,credentials){return data?(credentials||(credentials=new AWS.TemporaryCredentials),credentials.expired=!1,credentials.accessKeyId=data.Credentials.AccessKeyId,credentials.secretAccessKey=data.Credentials.SecretAccessKey,credentials.sessionToken=data.Credentials.SessionToken,credentials.expireTime=data.Credentials.Expiration,credentials):null},assumeRoleWithWebIdentity:function(params,callback){return this.makeUnauthenticatedRequest("assumeRoleWithWebIdentity",params,callback)},assumeRoleWithSAML:function(params,callback){return this.makeUnauthenticatedRequest("assumeRoleWithSAML",params,callback)},setupRequestListeners:function(request){request.addListener("validate",this.optInRegionalEndpoint,!0)},optInRegionalEndpoint:function(req){var service=req.service,config=service.config;if(config.stsRegionalEndpoints=resolveRegionalEndpointsFlag(service._originalConfig,{env:"AWS_STS_REGIONAL_ENDPOINTS",sharedConfig:"sts_regional_endpoints",clientConfig:"stsRegionalEndpoints"}),"regional"===config.stsRegionalEndpoints&&service.isGlobalEndpoint){if(!config.region)throw AWS.util.error(new Error,{code:"ConfigError",message:"Missing region in config"});var insertPoint=config.endpoint.indexOf(".amazonaws.com"),regionalEndpoint=config.endpoint.substring(0,insertPoint)+"."+config.region+config.endpoint.substring(insertPoint);req.httpRequest.updateEndpoint(regionalEndpoint),req.httpRequest.region=config.region}}})},{"../config_regional_endpoint":26,"../core":27}],74:[function(require,module,exports){var AWS=require("../core"),inherit=AWS.util.inherit,expiresHeader="presigned-expires";function signedUrlBuilder(request){var expires=request.httpRequest.headers[expiresHeader],signerClass=request.service.getSignerClass(request);if(delete request.httpRequest.headers["User-Agent"],delete request.httpRequest.headers["X-Amz-User-Agent"],signerClass===AWS.Signers.V4){if(expires>604800){throw AWS.util.error(new Error,{code:"InvalidExpiryTime",message:"Presigning does not support expiry time greater than a week with SigV4 signing.",retryable:!1})}request.httpRequest.headers[expiresHeader]=expires}else{if(signerClass!==AWS.Signers.S3)throw AWS.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});var now=request.service?request.service.getSkewCorrectedDate():AWS.util.date.getDate();request.httpRequest.headers[expiresHeader]=parseInt(AWS.util.date.unixTimestamp(now)+expires,10).toString()}}function signedUrlSigner(request){var endpoint=request.httpRequest.endpoint,parsedUrl=AWS.util.urlParse(request.httpRequest.path),queryParams={};parsedUrl.search&&(queryParams=AWS.util.queryStringParse(parsedUrl.search.substr(1)));var auth=request.httpRequest.headers.Authorization.split(" ");if("AWS"===auth[0])auth=auth[1].split(":"),queryParams.Signature=auth.pop(),queryParams.AWSAccessKeyId=auth.join(":"),AWS.util.each(request.httpRequest.headers,function(key,value){key===expiresHeader&&(key="Expires"),0===key.indexOf("x-amz-meta-")&&(delete queryParams[key],key=key.toLowerCase()),queryParams[key]=value}),delete request.httpRequest.headers[expiresHeader],delete queryParams.Authorization,delete queryParams.Host;else if("AWS4-HMAC-SHA256"===auth[0]){auth.shift();var signature=auth.join(" ").match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];queryParams["X-Amz-Signature"]=signature,delete queryParams.Expires}endpoint.pathname=parsedUrl.pathname,endpoint.search=AWS.util.queryParamsToString(queryParams)}AWS.Signers.Presign=inherit({sign:function(request,expireTime,callback){if(request.httpRequest.headers[expiresHeader]=expireTime||3600,request.on("build",signedUrlBuilder),request.on("sign",signedUrlSigner),request.removeListener("afterBuild",AWS.EventListeners.Core.SET_CONTENT_LENGTH),request.removeListener("afterBuild",AWS.EventListeners.Core.COMPUTE_SHA256),request.emit("beforePresign",[request]),!callback){if(request.build(),request.response.error)throw request.response.error;return AWS.util.urlFormat(request.httpRequest.endpoint)}request.build(function(){this.response.error?callback(this.response.error):callback(null,AWS.util.urlFormat(request.httpRequest.endpoint))})}}),module.exports=AWS.Signers.Presign},{"../core":27}],75:[function(require,module,exports){var AWS=require("../core"),inherit=AWS.util.inherit;AWS.Signers.RequestSigner=inherit({constructor:function(request){this.request=request},setServiceClientId:function(id){this.serviceClientId=id},getServiceClientId:function(){return this.serviceClientId}}),AWS.Signers.RequestSigner.getVersion=function(version){switch(version){case"v2":return AWS.Signers.V2;case"v3":return AWS.Signers.V3;case"s3v4":case"v4":return AWS.Signers.V4;case"s3":return AWS.Signers.S3;case"v3https":return AWS.Signers.V3Https}throw new Error("Unknown signing version "+version)},require("./v2"),require("./v3"),require("./v3https"),require("./v4"),require("./s3"),require("./presign")},{"../core":27,"./presign":74,"./s3":76,"./v2":77,"./v3":78,"./v3https":79,"./v4":80}],76:[function(require,module,exports){var AWS=require("../core"),inherit=AWS.util.inherit;AWS.Signers.S3=inherit(AWS.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(credentials,date){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=AWS.util.date.rfc822(date)),credentials.sessionToken&&(this.request.headers["x-amz-security-token"]=credentials.sessionToken);var signature=this.sign(credentials.secretAccessKey,this.stringToSign()),auth="AWS "+credentials.accessKeyId+":"+signature;this.request.headers.Authorization=auth},stringToSign:function(){var r=this.request,parts=[];parts.push(r.method),parts.push(r.headers["Content-MD5"]||""),parts.push(r.headers["Content-Type"]||""),parts.push(r.headers["presigned-expires"]||"");var headers=this.canonicalizedAmzHeaders();return headers&&parts.push(headers),parts.push(this.canonicalizedResource()),parts.join("\n")},canonicalizedAmzHeaders:function(){var amzHeaders=[];AWS.util.each(this.request.headers,function(name){name.match(/^x-amz-/i)&&amzHeaders.push(name)}),amzHeaders.sort(function(a,b){return a.toLowerCase()=0?"&":"?";this.request.path+=sep+AWS.util.queryParamsToString(qs)},authorization:function(credentials,datetime){var parts=[],credString=this.credentialString(datetime);return parts.push(this.algorithm+" Credential="+credentials.accessKeyId+"/"+credString),parts.push("SignedHeaders="+this.signedHeaders()),parts.push("Signature="+this.signature(credentials,datetime)),parts.join(", ")},signature:function(credentials,datetime){var signingKey=v4Credentials.getSigningKey(credentials,datetime.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return AWS.util.crypto.hmac(signingKey,this.stringToSign(datetime),"hex")},stringToSign:function(datetime){var parts=[];return parts.push("AWS4-HMAC-SHA256"),parts.push(datetime),parts.push(this.credentialString(datetime)),parts.push(this.hexEncodedHash(this.canonicalString())),parts.join("\n")},canonicalString:function(){var parts=[],pathname=this.request.pathname();return"s3"!==this.serviceName&&"s3v4"!==this.signatureVersion&&(pathname=AWS.util.uriEscapePath(pathname)),parts.push(this.request.method),parts.push(pathname),parts.push(this.request.search()),parts.push(this.canonicalHeaders()+"\n"),parts.push(this.signedHeaders()),parts.push(this.hexEncodedBodyHash()),parts.join("\n")},canonicalHeaders:function(){var headers=[];AWS.util.each.call(this,this.request.headers,function(key,item){headers.push([key,item])}),headers.sort(function(a,b){return a[0].toLowerCase()50&&delete cachedSecret[cacheQueue.shift()]),signingKey},emptyCache:function(){cachedSecret={},cacheQueue=[]}}},{"../core":27}],82:[function(require,module,exports){function AcceptorStateMachine(states,state){this.currentState=state||null,this.states=states||{}}AcceptorStateMachine.prototype.runTo=function(finalState,done,bindObject,inputError){"function"==typeof finalState&&(inputError=bindObject,bindObject=done,done=finalState,finalState=null);var self=this,state=self.states[self.currentState];state.fn.call(bindObject||self,inputError,function(err){if(err){if(!state.fail)return done?done.call(bindObject,err):null;self.currentState=state.fail}else{if(!state.accept)return done?done.call(bindObject):null;self.currentState=state.accept}if(self.currentState===finalState)return done?done.call(bindObject,err):null;self.runTo(finalState,done,bindObject,err)})},AcceptorStateMachine.prototype.addState=function(name,acceptState,failState,fn){return"function"==typeof acceptState?(fn=acceptState,acceptState=null,failState=null):"function"==typeof failState&&(fn=failState,failState=null),this.currentState||(this.currentState=name),this.states[name]={accept:acceptState,fail:failState,fn:fn},this},module.exports=AcceptorStateMachine},{}],83:[function(require,module,exports){(function(process,setImmediate){(function(){var AWS,util={environment:"nodejs",engine:function(){if(util.isBrowser()&&"undefined"!=typeof navigator)return navigator.userAgent;var engine=process.platform+"/"+process.version;return process.env.AWS_EXECUTION_ENV&&(engine+=" exec-env/"+process.env.AWS_EXECUTION_ENV),engine},userAgent:function(){var name=util.environment,agent="aws-sdk-"+name+"/"+require("./core").VERSION;return"nodejs"===name&&(agent+=" "+util.engine()),agent},uriEscape:function(string){var output=encodeURIComponent(string);return output=(output=output.replace(/[^A-Za-z0-9_.~\-%]+/g,escape)).replace(/[*]/g,function(ch){return"%"+ch.charCodeAt(0).toString(16).toUpperCase()})},uriEscapePath:function(string){var parts=[];return util.arrayEach(string.split("/"),function(part){parts.push(util.uriEscape(part))}),parts.join("/")},urlParse:function(url){return util.url.parse(url)},urlFormat:function(url){return util.url.format(url)},queryStringParse:function(qs){return util.querystring.parse(qs)},queryParamsToString:function(params){var items=[],escape=util.uriEscape,sortedKeys=Object.keys(params).sort();return util.arrayEach(sortedKeys,function(name){var value=params[name],ename=escape(name),result=ename+"=";if(Array.isArray(value)){var vals=[];util.arrayEach(value,function(item){vals.push(escape(item))}),result=ename+"="+vals.sort().join("&"+ename+"=")}else null!=value&&(result=ename+"="+escape(value));items.push(result)}),items.join("&")},readFileSync:function(path){return util.isBrowser()?null:require("fs").readFileSync(path,"utf-8")},base64:{encode:function(string){if("number"==typeof string)throw util.error(new Error("Cannot base64 encode number "+string));return null==string?string:util.buffer.toBuffer(string).toString("base64")},decode:function(string){if("number"==typeof string)throw util.error(new Error("Cannot base64 decode number "+string));return null==string?string:util.buffer.toBuffer(string,"base64")}},buffer:{toBuffer:function(data,encoding){return"function"==typeof util.Buffer.from&&util.Buffer.from!==Uint8Array.from?util.Buffer.from(data,encoding):new util.Buffer(data,encoding)},alloc:function(size,fill,encoding){if("number"!=typeof size)throw new Error("size passed to alloc must be a number.");if("function"==typeof util.Buffer.alloc)return util.Buffer.alloc(size,fill,encoding);var buf=new util.Buffer(size);return void 0!==fill&&"function"==typeof buf.fill&&buf.fill(fill,void 0,void 0,encoding),buf},toStream:function(buffer){util.Buffer.isBuffer(buffer)||(buffer=util.buffer.toBuffer(buffer));var readable=new util.stream.Readable,pos=0;return readable._read=function(size){if(pos>=buffer.length)return readable.push(null);var end=pos+size;end>buffer.length&&(end=buffer.length),readable.push(buffer.slice(pos,end)),pos=end},readable},concat:function(buffers){var buffer,i,length=0,offset=0;for(i=0;i>>8^tbl[255&(crc^data.readUInt8(i))]}return(-1^crc)>>>0},hmac:function(key,string,digest,fn){return digest||(digest="binary"),"buffer"===digest&&(digest=void 0),fn||(fn="sha256"),"string"==typeof string&&(string=util.buffer.toBuffer(string)),util.crypto.lib.createHmac(fn,key).update(string).digest(digest)},md5:function(data,digest,callback){return util.crypto.hash("md5",data,digest,callback)},sha256:function(data,digest,callback){return util.crypto.hash("sha256",data,digest,callback)},hash:function(algorithm,data,digest,callback){var hash=util.crypto.createHash(algorithm);digest||(digest="binary"),"buffer"===digest&&(digest=void 0),"string"==typeof data&&(data=util.buffer.toBuffer(data));var sliceFn=util.arraySliceFn(data),isBuffer=util.Buffer.isBuffer(data);if(util.isBrowser()&&"undefined"!=typeof ArrayBuffer&&data&&data.buffer instanceof ArrayBuffer&&(isBuffer=!0),callback&&"object"==typeof data&&"function"==typeof data.on&&!isBuffer)data.on("data",function(chunk){hash.update(chunk)}),data.on("error",function(err){callback(err)}),data.on("end",function(){callback(null,hash.digest(digest))});else{if(!callback||!sliceFn||isBuffer||"undefined"==typeof FileReader){util.isBrowser()&&"object"==typeof data&&!isBuffer&&(data=new util.Buffer(new Uint8Array(data)));var out=hash.update(data).digest(digest);return callback&&callback(null,out),out}var index=0,reader=new FileReader;reader.onerror=function(){callback(new Error("Failed to read data."))},reader.onload=function(){var buf=new util.Buffer(new Uint8Array(reader.result));hash.update(buf),index+=buf.length,reader._continueReading()},reader._continueReading=function(){if(index>=data.size)callback(null,hash.digest(digest));else{var back=index+524288;back>data.size&&(back=data.size),reader.readAsArrayBuffer(sliceFn.call(data,index,back))}},reader._continueReading()}},toHex:function(data){for(var out=[],i=0;i=3e5,!1),AWS.config.isClockSkewed},applyClockOffset:function(serverTime){serverTime&&(AWS.config.systemClockOffset=serverTime-(new Date).getTime())},extractRequestId:function(resp){var requestId=resp.httpResponse.headers["x-amz-request-id"]||resp.httpResponse.headers["x-amzn-requestid"];!requestId&&resp.data&&resp.data.ResponseMetadata&&(requestId=resp.data.ResponseMetadata.RequestId),requestId&&(resp.requestId=requestId),resp.error&&(resp.error.requestId=requestId)},addPromises:function(constructors,PromiseDependency){var deletePromises=!1;void 0===PromiseDependency&&AWS&&AWS.config&&(PromiseDependency=AWS.config.getPromisesDependency()),void 0===PromiseDependency&&"undefined"!=typeof Promise&&(PromiseDependency=Promise),"function"!=typeof PromiseDependency&&(deletePromises=!0),Array.isArray(constructors)||(constructors=[constructors]);for(var ind=0;ind=0)return retryCount++,void setTimeout(sendRequest,delay+(err.retryAfter||0))}cb(err)},sendRequest=function(){var data="";http.handleRequest(httpRequest,httpOptions,function(httpResponse){httpResponse.on("data",function(chunk){data+=chunk.toString()}),httpResponse.on("end",function(){var statusCode=httpResponse.statusCode;if(statusCode<300)cb(null,data);else{var retryAfter=1e3*parseInt(httpResponse.headers["retry-after"],10)||0,err=util.error(new Error,{statusCode:statusCode,retryable:statusCode>=500||429===statusCode});retryAfter&&err.retryable&&(err.retryAfter=retryAfter),errCallback(err)}})},errCallback)};AWS.util.defer(sendRequest)},uuid:{v4:function(){return require("uuid").v4()}},convertPayloadToString:function(resp){var req=resp.request,operation=req.operation,rules=req.service.api.operations[operation].output||{};rules.payload&&resp.data[rules.payload]&&(resp.data[rules.payload]=resp.data[rules.payload].toString())},defer:function(callback){"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick(callback):"function"==typeof setImmediate?setImmediate(callback):setTimeout(callback,0)},getRequestPayloadShape:function(req){var operations=req.service.api.operations;if(operations){var operation=(operations||{})[req.operation];if(operation&&operation.input&&operation.input.payload)return operation.input.members[operation.input.payload]}},getProfilesFromSharedConfig:function(iniLoader,filename){var profiles={},profilesFromConfig={};if(process.env[util.configOptInEnv])profilesFromConfig=iniLoader.loadFrom({isConfig:!0,filename:process.env[util.sharedConfigFileEnv]});var profilesFromCreds={};try{profilesFromCreds=iniLoader.loadFrom({filename:filename||process.env[util.configOptInEnv]&&process.env[util.sharedCredentialsFileEnv]})}catch(error){if(!process.env[util.configOptInEnv])throw error}for(var i=0,profileNames=Object.keys(profilesFromConfig);i=6},parse:function(arn){var matched=arn.split(":");return{partition:matched[1],service:matched[2],region:matched[3],accountId:matched[4],resource:matched.slice(5).join(":")}},build:function(arnObject){if(void 0===arnObject.service||void 0===arnObject.region||void 0===arnObject.accountId||void 0===arnObject.resource)throw util.error(new Error("Input ARN object is invalid"));return"arn:"+(arnObject.partition||"aws")+":"+arnObject.service+":"+arnObject.region+":"+arnObject.accountId+":"+arnObject.resource}},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};module.exports=util}).call(this)}).call(this,require("_process"),require("timers").setImmediate)},{"../apis/metadata.json":9,"./core":27,_process:97,fs:91,timers:105,uuid:110}],84:[function(require,module,exports){var util=require("../util"),Shape=require("../model/shape");function DomXmlParser(){}function getElementByTagName(xml,tag){for(var elements=xml.getElementsByTagName(tag),i=0,iLen=elements.length;i0||noEmpty?xml.toString():""},module.exports=XmlBuilder},{"../util":83,"./xml-node":88,"./xml-text":89}],86:[function(require,module,exports){module.exports={escapeAttribute:function(value){return value.replace(/&/g,"&").replace(/'/g,"'").replace(//g,">").replace(/"/g,""")}}},{}],87:[function(require,module,exports){module.exports={escapeElement:function(value){return value.replace(/&/g,"&").replace(//g,">").replace(/\r/g," ").replace(/\n/g," ").replace(/\u0085/g,"…").replace(/\u2028/,"
")}}},{}],88:[function(require,module,exports){var escapeAttribute=require("./escape-attribute").escapeAttribute;function XmlNode(name,children){void 0===children&&(children=[]),this.name=name,this.children=children,this.attributes={}}XmlNode.prototype.addAttribute=function(name,value){return this.attributes[name]=value,this},XmlNode.prototype.addChildNode=function(child){return this.children.push(child),this},XmlNode.prototype.removeAttribute=function(name){return delete this.attributes[name],this},XmlNode.prototype.toString=function(){for(var hasChildren=Boolean(this.children.length),xmlText="<"+this.name,attributes=this.attributes,i=0,attributeNames=Object.keys(attributes);i"+this.children.map(function(c){return c.toString()}).join("")+"":"/>")},module.exports={XmlNode:XmlNode}},{"./escape-attribute":86}],89:[function(require,module,exports){var escapeElement=require("./escape-element").escapeElement;function XmlText(value){this.value=value}XmlText.prototype.toString=function(){return escapeElement(""+this.value)},module.exports={XmlText:XmlText}},{"./escape-element":87}],90:[function(require,module,exports){"use strict";exports.byteLength=function(b64){var lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1];return 3*(validLen+placeHoldersLen)/4-placeHoldersLen},exports.toByteArray=function(b64){var tmp,i,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Arr(function(b64,validLen,placeHoldersLen){return 3*(validLen+placeHoldersLen)/4-placeHoldersLen}(0,validLen,placeHoldersLen)),curByte=0,len=placeHoldersLen>0?validLen-4:validLen;for(i=0;i>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp;2===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[curByte++]=255&tmp);1===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp);return arr},exports.fromByteArray=function(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,parts=[],i=0,len2=len-extraBytes;ilen2?len2:i+16383));1===extraBytes?(tmp=uint8[len-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"="));return parts.join("")};for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var validLen=b64.indexOf("=");return-1===validLen&&(validLen=len),[validLen,validLen===len?0:4-validLen%4]}function encodeChunk(uint8,start,end){for(var tmp,num,output=[],i=start;i>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]);return output.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63},{}],91:[function(require,module,exports){},{}],92:[function(require,module,exports){(function(global,Buffer){(function(){"use strict";var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):byteOffset>2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset=+byteOffset,isNaN(byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var i,indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength&&(byteOffset=arrLength-valLength),i=byteOffset;i>=0;i--){for(var found=!0,j=0;jremaining&&(length=remaining):length=remaining;var strLen=string.length;if(strLen%2!=0)throw new TypeError("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end)switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:128==(192&(secondByte=buf[i+1]))&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>127&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return function(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);var res="",i=0;for(;ithis.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if((end>>>=0)<=(start>>>=0))return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}.apply(this,arguments)},Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||0===Buffer.compare(this,b)},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES;return this.length>0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),""},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(this===target)return 0;for(var x=(thisEnd>>>=0)-(thisStart>>>=0),y=(end>>>=0)-(start>>>=0),len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;iremaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;ilen)&&(end=len);for(var out="",i=start;ilength)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,0,offset,4),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,0,offset,8),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}Buffer.prototype.slice=function(start,end){var newBuf,len=this.length;if((start=~~start)<0?(start+=len)<0&&(start=0):start>len&&(start=len),(end=void 0===end?len:~~end)<0?(end+=len)<0&&(end=0):end>len&&(end=len),end0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return val>=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){(value=+value,offset|=0,byteLength|=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0);var mul=1,i=0;for(this[offset]=255&value;++i=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,end=void 0===end?this.length:end>>>0,val||(val=0),"number"==typeof val)for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function base64ToBytes(str){return base64.toByteArray(function(str){if((str=function(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}(str).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;str.length%4!=0;)str+="=";return str}(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0!==window?window:{},require("buffer").Buffer)},{"base64-js":90,buffer:92,ieee754:94,isarray:95}],93:[function(require,module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if("number"!=typeof n||n<0||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if((er=arguments[1])instanceof Error)throw er;var err=new Error('Uncaught, unspecified "error" event. ('+er+")");throw err.context=er,err}if(isUndefined(handler=this._events[type]))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),len=(listeners=handler.slice()).length,i=0;i0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(length=(list=this._events[type]).length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(isFunction(listeners=this._events[type]))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){return this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],94:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),(value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias))*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],95:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return"[object Array]"==toString.call(arr)}},{}],96:[function(require,module,exports){!function(exports){"use strict";function isArray(obj){return null!==obj&&"[object Array]"===Object.prototype.toString.call(obj)}function isObject(obj){return null!==obj&&"[object Object]"===Object.prototype.toString.call(obj)}function strictDeepEqual(first,second){if(first===second)return!0;if(Object.prototype.toString.call(first)!==Object.prototype.toString.call(second))return!1;if(!0===isArray(first)){if(first.length!==second.length)return!1;for(var i=0;i":!0,"=":!0,"!":!0},skipChars={" ":!0,"\t":!0,"\n":!0};function isNum(ch){return ch>="0"&&ch<="9"||"-"===ch}function Lexer(){}Lexer.prototype={tokenize:function(stream){var start,identifier,token,ch,tokens=[];for(this._current=0;this._current="a"&&ch<="z"||ch>="A"&&ch<="Z"||"_"===ch)start=this._current,identifier=this._consumeUnquotedIdentifier(stream),tokens.push({type:"UnquotedIdentifier",value:identifier,start:start});else if(void 0!==basicTokens[stream[this._current]])tokens.push({type:basicTokens[stream[this._current]],value:stream[this._current],start:this._current}),this._current++;else if(isNum(stream[this._current]))token=this._consumeNumber(stream),tokens.push(token);else if("["===stream[this._current])token=this._consumeLBracket(stream),tokens.push(token);else if('"'===stream[this._current])start=this._current,identifier=this._consumeQuotedIdentifier(stream),tokens.push({type:"QuotedIdentifier",value:identifier,start:start});else if("'"===stream[this._current])start=this._current,identifier=this._consumeRawStringLiteral(stream),tokens.push({type:"Literal",value:identifier,start:start});else if("`"===stream[this._current]){start=this._current;var literal=this._consumeLiteral(stream);tokens.push({type:"Literal",value:literal,start:start})}else if(void 0!==operatorStartToken[stream[this._current]])tokens.push(this._consumeOperator(stream));else if(void 0!==skipChars[stream[this._current]])this._current++;else if("&"===stream[this._current])start=this._current,this._current++,"&"===stream[this._current]?(this._current++,tokens.push({type:"And",value:"&&",start:start})):tokens.push({type:"Expref",value:"&",start:start});else{if("|"!==stream[this._current]){var error=new Error("Unknown character:"+stream[this._current]);throw error.name="LexerError",error}start=this._current,this._current++,"|"===stream[this._current]?(this._current++,tokens.push({type:"Or",value:"||",start:start})):tokens.push({type:"Pipe",value:"|",start:start})}return tokens},_consumeUnquotedIdentifier:function(stream){var ch,start=this._current;for(this._current++;this._current="a"&&ch<="z"||ch>="A"&&ch<="Z"||ch>="0"&&ch<="9"||"_"===ch);)this._current++;return stream.slice(start,this._current)},_consumeQuotedIdentifier:function(stream){var start=this._current;this._current++;for(var maxLength=stream.length;'"'!==stream[this._current]&&this._current"===startingChar?"="===stream[this._current]?(this._current++,{type:"GTE",value:">=",start:start}):{type:"GT",value:">",start:start}:"="===startingChar&&"="===stream[this._current]?(this._current++,{type:"EQ",value:"==",start:start}):void 0},_consumeLiteral:function(stream){this._current++;for(var literal,start=this._current,maxLength=stream.length;"`"!==stream[this._current]&&this._current=0)return!0;if(["true","false","null"].indexOf(literalString)>=0)return!0;if(!("-0123456789".indexOf(literalString[0])>=0))return!1;try{return JSON.parse(literalString),!0}catch(ex){return!1}}};var bindingPower={};function Parser(){}function TreeInterpreter(runtime){this.runtime=runtime}function Runtime(interpreter){this._interpreter=interpreter,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[TYPE_NUMBER]}]},avg:{_func:this._functionAvg,_signature:[{types:[TYPE_ARRAY_NUMBER]}]},ceil:{_func:this._functionCeil,_signature:[{types:[TYPE_NUMBER]}]},contains:{_func:this._functionContains,_signature:[{types:[TYPE_STRING,TYPE_ARRAY]},{types:[TYPE_ANY]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[TYPE_STRING]},{types:[TYPE_STRING]}]},floor:{_func:this._functionFloor,_signature:[{types:[TYPE_NUMBER]}]},length:{_func:this._functionLength,_signature:[{types:[TYPE_STRING,TYPE_ARRAY,TYPE_OBJECT]}]},map:{_func:this._functionMap,_signature:[{types:[TYPE_EXPREF]},{types:[TYPE_ARRAY]}]},max:{_func:this._functionMax,_signature:[{types:[TYPE_ARRAY_NUMBER,TYPE_ARRAY_STRING]}]},merge:{_func:this._functionMerge,_signature:[{types:[TYPE_OBJECT],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[TYPE_ARRAY]},{types:[TYPE_EXPREF]}]},sum:{_func:this._functionSum,_signature:[{types:[TYPE_ARRAY_NUMBER]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[TYPE_STRING]},{types:[TYPE_STRING]}]},min:{_func:this._functionMin,_signature:[{types:[TYPE_ARRAY_NUMBER,TYPE_ARRAY_STRING]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[TYPE_ARRAY]},{types:[TYPE_EXPREF]}]},type:{_func:this._functionType,_signature:[{types:[TYPE_ANY]}]},keys:{_func:this._functionKeys,_signature:[{types:[TYPE_OBJECT]}]},values:{_func:this._functionValues,_signature:[{types:[TYPE_OBJECT]}]},sort:{_func:this._functionSort,_signature:[{types:[TYPE_ARRAY_STRING,TYPE_ARRAY_NUMBER]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[TYPE_ARRAY]},{types:[TYPE_EXPREF]}]},join:{_func:this._functionJoin,_signature:[{types:[TYPE_STRING]},{types:[TYPE_ARRAY_STRING]}]},reverse:{_func:this._functionReverse,_signature:[{types:[TYPE_STRING,TYPE_ARRAY]}]},to_array:{_func:this._functionToArray,_signature:[{types:[TYPE_ANY]}]},to_string:{_func:this._functionToString,_signature:[{types:[TYPE_ANY]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[TYPE_ANY]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[TYPE_ANY],variadic:!0}]}}}bindingPower.EOF=0,bindingPower.UnquotedIdentifier=0,bindingPower.QuotedIdentifier=0,bindingPower.Rbracket=0,bindingPower.Rparen=0,bindingPower.Comma=0,bindingPower.Rbrace=0,bindingPower.Number=0,bindingPower.Current=0,bindingPower.Expref=0,bindingPower.Pipe=1,bindingPower.Or=2,bindingPower.And=3,bindingPower.EQ=5,bindingPower.GT=5,bindingPower.LT=5,bindingPower.GTE=5,bindingPower.LTE=5,bindingPower.NE=5,bindingPower.Flatten=9,bindingPower.Star=20,bindingPower.Filter=21,bindingPower.Dot=40,bindingPower.Not=45,bindingPower.Lbrace=50,bindingPower.Lbracket=55,bindingPower.Lparen=60,Parser.prototype={parse:function(expression){this._loadTokens(expression),this.index=0;var ast=this.expression(0);if("EOF"!==this._lookahead(0)){var t=this._lookaheadToken(0),error=new Error("Unexpected token type: "+t.type+", value: "+t.value);throw error.name="ParserError",error}return ast},_loadTokens:function(expression){var tokens=(new Lexer).tokenize(expression);tokens.push({type:"EOF",value:"",start:expression.length}),this.tokens=tokens},expression:function(rbp){var leftToken=this._lookaheadToken(0);this._advance();for(var left=this.nud(leftToken),currentToken=this._lookahead(0);rbp=0?this.expression(rbp):"Lbracket"===lookahead?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===lookahead?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(rbp){var right;if(bindingPower[this._lookahead(0)]<10)right={type:"Identity"};else if("Lbracket"===this._lookahead(0))right=this.expression(rbp);else if("Filter"===this._lookahead(0))right=this.expression(rbp);else{if("Dot"!==this._lookahead(0)){var t=this._lookaheadToken(0),error=new Error("Sytanx error, unexpected token: "+t.value+"("+t.type+")");throw error.name="ParserError",error}this._match("Dot"),right=this._parseDotRHS(rbp)}return right},_parseMultiselectList:function(){for(var expressions=[];"Rbracket"!==this._lookahead(0);){var expression=this.expression(0);if(expressions.push(expression),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:expressions}},_parseMultiselectHash:function(){for(var keyToken,keyName,node,pairs=[],identifierTypes=["UnquotedIdentifier","QuotedIdentifier"];;){if(keyToken=this._lookaheadToken(0),identifierTypes.indexOf(keyToken.type)<0)throw new Error("Expecting an identifier token, got: "+keyToken.type);if(keyName=keyToken.value,this._advance(),this._match("Colon"),node={type:"KeyValuePair",name:keyName,value:this.expression(0)},pairs.push(node),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:pairs}}},TreeInterpreter.prototype={search:function(node,value){return this.visit(node,value)},visit:function(node,value){var matched,current,result,first,second,field,left,collected,i;switch(node.type){case"Field":return null===value?null:isObject(value)?void 0===(field=value[node.name])?null:field:null;case"Subexpression":for(result=this.visit(node.children[0],value),i=1;i0)for(i=start;istop;i+=step)result.push(value[i]);return result;case"Projection":var base=this.visit(node.children[0],value);if(!isArray(base))return null;for(collected=[],i=0;isecond;break;case"GTE":result=first>=second;break;case"LT":result=first=arrayLength&&(actualValue=step<0?arrayLength-1:arrayLength),actualValue}},Runtime.prototype={callFunction:function(name,resolvedArgs){var functionEntry=this.functionTable[name];if(void 0===functionEntry)throw new Error("Unknown function: "+name+"()");return this._validateArgs(name,resolvedArgs,functionEntry._signature),functionEntry._func.call(this,resolvedArgs)},_validateArgs:function(name,args,signature){var pluralized,currentSpec,actualType,typeMatched;if(signature[signature.length-1].variadic){if(args.length=0;i--)reversedStr+=originalStr[i];return reversedStr}var reversedArray=resolvedArgs[0].slice(0);return reversedArray.reverse(),reversedArray},_functionAbs:function(resolvedArgs){return Math.abs(resolvedArgs[0])},_functionCeil:function(resolvedArgs){return Math.ceil(resolvedArgs[0])},_functionAvg:function(resolvedArgs){for(var sum=0,inputArray=resolvedArgs[0],i=0;i=0},_functionFloor:function(resolvedArgs){return Math.floor(resolvedArgs[0])},_functionLength:function(resolvedArgs){return isObject(resolvedArgs[0])?Object.keys(resolvedArgs[0]).length:resolvedArgs[0].length},_functionMap:function(resolvedArgs){for(var mapped=[],interpreter=this._interpreter,exprefNode=resolvedArgs[0],elements=resolvedArgs[1],i=0;i0){if(this._getTypeName(resolvedArgs[0][0])===TYPE_NUMBER)return Math.max.apply(Math,resolvedArgs[0]);for(var elements=resolvedArgs[0],maxElement=elements[0],i=1;i0){if(this._getTypeName(resolvedArgs[0][0])===TYPE_NUMBER)return Math.min.apply(Math,resolvedArgs[0]);for(var elements=resolvedArgs[0],minElement=elements[0],i=1;iexprB?1:exprAmaxNumber&&(maxNumber=current,maxRecord=resolvedArray[i]);return maxRecord},_functionMinBy:function(resolvedArgs){for(var minRecord,current,exprefNode=resolvedArgs[1],resolvedArray=resolvedArgs[0],keyFunction=this.createKeyFunction(exprefNode,[TYPE_NUMBER,TYPE_STRING]),minNumber=1/0,i=0;i1)for(var i=1;i= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode;function error(type){throw RangeError(errors[type])}function map(array,fn){for(var length=array.length,result=[];length--;)result[length]=fn(array[length]);return result}function mapDomain(string,fn){var parts=string.split("@"),result="";return parts.length>1&&(result=parts[0]+"@",string=parts[1]),result+map((string=string.replace(regexSeparators,".")).split("."),fn).join(".")}function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter=55296&&value<=56319&&counter65535&&(output+=stringFromCharCode((value-=65536)>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value)}).join("")}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((0!=flag)<<5)}function adapt(delta,numPoints,firstTime){var k=0;for(delta=firstTime?floor(delta/damp):delta>>1,delta+=floor(delta/numPoints);delta>baseMinusTMin*tMax>>1;k+=base)delta=floor(delta/baseMinusTMin);return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var out,basic,j,index,oldi,w,k,digit,t,baseMinusT,codePoint,output=[],inputLength=input.length,i=0,n=initialN,bias=initialBias;for((basic=input.lastIndexOf(delimiter))<0&&(basic=0),j=0;j=128&&error("not-basic"),output.push(input.charCodeAt(j));for(index=basic>0?basic+1:0;index=inputLength&&error("invalid-input"),((digit=(codePoint=input.charCodeAt(index++))-48<10?codePoint-22:codePoint-65<26?codePoint-65:codePoint-97<26?codePoint-97:base)>=base||digit>floor((maxInt-i)/w))&&error("overflow"),i+=digit*w,!(digit<(t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias));k+=base)w>floor(maxInt/(baseMinusT=base-t))&&error("overflow"),w*=baseMinusT;bias=adapt(i-oldi,out=output.length+1,0==oldi),floor(i/out)>maxInt-n&&error("overflow"),n+=floor(i/out),i%=out,output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,inputLength,handledCPCountPlusOne,baseMinusT,qMinusT,output=[];for(inputLength=(input=ucs2decode(input)).length,n=initialN,delta=0,bias=initialBias,j=0;j=n&¤tValuefloor((maxInt-delta)/(handledCPCountPlusOne=handledCPCount+1))&&error("overflow"),delta+=(m-n)*handledCPCountPlusOne,n=m,j=0;jmaxInt&&error("overflow"),currentValue==n){for(q=delta,k=base;!(q<(t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias));k+=base)qMinusT=q-t,baseMinusT=base-t,output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0))),q=floor(qMinusT/baseMinusT);output.push(stringFromCharCode(digitToBasic(q,0))),bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength),delta=0,++handledCPCount}++delta,++n}return output.join("")}if(punycode={version:"1.3.2",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:function(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})},toUnicode:function(input){return mapDomain(input,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return punycode});else if(freeExports&&freeModule)if(module.exports==freeExports)freeModule.exports=punycode;else for(key in punycode)punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);else root.punycode=punycode}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0!==window?window:{})},{}],99:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&",eq=eq||"=";var obj={};if("string"!=typeof qs||0===qs.length)return obj;var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;options&&"number"==typeof options.maxKeys&&(maxKeys=options.maxKeys);var len=qs.length;maxKeys>0&&len>maxKeys&&(len=maxKeys);for(var i=0;i=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)}},{}],100:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){return sep=sep||"&",eq=eq||"=",null===obj&&(obj=void 0),"object"==typeof obj?map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;return isArray(obj[k])?map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep):ks+encodeURIComponent(stringifyPrimitive(obj[k]))}).join(sep):name?encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj)):""};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)};function map(xs,f){if(xs.map)return xs.map(f);for(var res=[],i=0;i0&&len>maxKeys&&(len=maxKeys);for(var i=0;i=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?Array.isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj}},{}],103:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){return sep=sep||"&",eq=eq||"=",null===obj&&(obj=void 0),"object"==typeof obj?Object.keys(obj).map(function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;return Array.isArray(obj[k])?obj[k].map(function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep):ks+encodeURIComponent(stringifyPrimitive(obj[k]))}).join(sep):name?encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj)):""}},{}],104:[function(require,module,exports){arguments[4][101][0].apply(exports,arguments)},{"./decode":102,"./encode":103,dup:101}],105:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require("process/browser.js").nextTick,apply=Function.prototype.apply,slice=Array.prototype.slice,immediateIds={},nextImmediateId=0;function Timeout(id,clearFn){this._id=id,this._clearFn=clearFn}exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId),item._idleTimeout=msecs},exports.unenroll=function(item){clearTimeout(item._idleTimeoutId),item._idleTimeout=-1},exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;msecs>=0&&(item._idleTimeoutId=setTimeout(function(){item._onTimeout&&item._onTimeout()},msecs))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(fn){var id=nextImmediateId++,args=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[id]=!0,nextTick(function(){immediateIds[id]&&(args?fn.apply(null,args):fn.call(null),exports.clearImmediate(id))}),id},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(id){delete immediateIds[id]}}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":97,timers:105}],106:[function(require,module,exports){var punycode=require("punycode");function Url(){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}exports.parse=urlParse,exports.resolve=function(source,relative){return urlParse(source,!1,!0).resolve(relative)},exports.resolveObject=function(source,relative){return source?urlParse(source,!1,!0).resolveObject(relative):relative},exports.format=function(obj){isString(obj)&&(obj=urlParse(obj));return obj instanceof Url?obj.format():Url.prototype.format.call(obj)},exports.Url=Url;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,unwise=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnamePartPattern=/^[a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&isObject(url)&&url instanceof Url)return url;var u=new Url;return u.parse(url,parseQueryString,slashesDenoteHost),u}function isString(arg){return"string"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isNull(arg){return null===arg}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!isString(url))throw new TypeError("Parameter 'url' must be a string, not "+typeof url);var rest=url;rest=rest.trim();var proto=protocolPattern.exec(rest);if(proto){var lowerProto=(proto=proto[0]).toLowerCase();this.protocol=lowerProto,rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes="//"===rest.substr(0,2);!slashes||proto&&hostlessProtocol[proto]||(rest=rest.substr(2),this.slashes=!0)}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){for(var auth,atSign,hostEnd=-1,i=0;i127?newpart+="x":newpart+=part[j];if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i),notHost=hostparts.slice(i+1),bit=part.match(hostnamePartStart);bit&&(validParts.push(bit[1]),notHost.unshift(bit[2])),notHost.length&&(rest="/"+notHost.join(".")+rest),this.hostname=validParts.join(".");break}}}if(this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),!ipv6Hostname){var domainArray=this.hostname.split("."),newOut=[];for(i=0;i0)&&result.host.split("@"))&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift());return result.search=relative.search,result.query=relative.query,isNull(result.pathname)&&isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.href=result.format(),result}if(!srcPath.length)return result.pathname=null,result.search?result.path="/"+result.search:result.path=null,result.href=result.format(),result;for(var last=srcPath.slice(-1)[0],hasTrailingSlash=(result.host||relative.host)&&("."===last||".."===last)||""===last,up=0,i=srcPath.length;i>=0;i--)"."==(last=srcPath[i])?srcPath.splice(i,1):".."===last?(srcPath.splice(i,1),up++):up&&(srcPath.splice(i,1),up--);if(!mustEndAbs&&!removeAllDots)for(;up--;up)srcPath.unshift("..");!mustEndAbs||""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0)||srcPath.unshift(""),hasTrailingSlash&&"/"!==srcPath.join("/").substr(-1)&&srcPath.push("");var authInHost,isAbsolute=""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0);psychotic&&(result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"",(authInHost=!!(result.host&&result.host.indexOf("@")>0)&&result.host.split("@"))&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift()));return(mustEndAbs=mustEndAbs||result.host&&srcPath.length)&&!isAbsolute&&srcPath.unshift(""),srcPath.length?result.pathname=srcPath.join("/"):(result.pathname=null,result.path=null),isNull(result.pathname)&&isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.auth=relative.auth||result.auth,result.slashes=result.slashes||relative.slashes,result.href=result.format(),result},Url.prototype.parseHost=function(){var host=this.host,port=portPattern.exec(host);port&&(":"!==(port=port[0])&&(this.port=port.substr(1)),host=host.substr(0,host.length-port.length)),host&&(this.hostname=host)}},{punycode:98,querystring:101}],107:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],108:[function(require,module,exports){module.exports=function(arg){return arg&&"object"==typeof arg&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],109:[function(require,module,exports){(function(process,global){(function(){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){for(var objects=[],i=0;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}}),x=args[i];i=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str,styleType){return str}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=function(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=function(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var output,base="",array=!1,braces=["{","}"];(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value))&&(base=" [Function"+(value.name?": "+value.name:"")+"]");return isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0!==keys.length||array&&0!=value.length?recurseTimes<0?isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special"):(ctx.seen.push(value),output=array?function(ctx,value,recurseTimes,visibleKeys,keys){for(var output=[],i=0,l=value.length;i=0&&0,prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1];return braces[0]+base+" "+output.join(", ")+" "+braces[1]}(output,base,braces)):braces[0]+base+braces[1]}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if((desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]}).get?str=desc.set?ctx.stylize("[Getter/Setter]","special"):ctx.stylize("[Getter]","special"):desc.set&&(str=ctx.stylize("[Setter]","special")),hasOwnProperty(visibleKeys,key)||(name="["+key+"]"),str||(ctx.seen.indexOf(desc.value)<0?(str=isNull(recurseTimes)?formatValue(ctx,desc.value,null):formatValue(ctx,desc.value,recurseTimes-1)).indexOf("\n")>-1&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n")):str=ctx.stylize("[Circular]","special")),isUndefined(name)){if(array&&key.match(/^\d+$/))return str;(name=JSON.stringify(""+key)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),name=ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string"))}return name+": "+str}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isUndefined(arg){return void 0===arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}exports.debuglog=function(set){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),set=set.toUpperCase(),!debugs[set])if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]},exports.inspect=inspect,inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=function(arg){return null==arg},exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=function(arg){return"symbol"==typeof arg},exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=function(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||void 0===arg},exports.isBuffer=require("./support/isBuffer");var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}exports.log=function(){var d,time;console.log("%s - %s",(d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":"),[d.getDate(),months[d.getMonth()],time].join(" ")),exports.format.apply(exports,arguments))},exports.inherits=require("inherits"),exports._extend=function(origin,add){if(!add||!isObject(add))return origin;for(var keys=Object.keys(add),i=keys.length;i--;)origin[keys[i]]=add[keys[i]];return origin}}).call(this)}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0!==window?window:{})},{"./support/isBuffer":108,_process:97,inherits:107}],110:[function(require,module,exports){var v1=require("./v1"),v4=require("./v4"),uuid=v4;uuid.v1=v1,uuid.v4=v4,module.exports=uuid},{"./v1":113,"./v4":114}],111:[function(require,module,exports){for(var byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);module.exports=function(buf,offset){var i=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")}},{}],112:[function(require,module,exports){var getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);module.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);module.exports=function(){for(var r,i=0;i<16;i++)0==(3&i)&&(r=4294967296*Math.random()),rnds[i]=r>>>((3&i)<<3)&255;return rnds}}},{}],113:[function(require,module,exports){var _nodeId,_clockseq,rng=require("./lib/rng"),bytesToUuid=require("./lib/bytesToUuid"),_lastMSecs=0,_lastNSecs=0;module.exports=function(options,buf,offset){var i=buf&&offset||0,b=buf||[],node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){var seedBytes=rng();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}var msecs=void 0!==options.msecs?options.msecs:(new Date).getTime(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq;var tl=(1e4*(268435455&(msecs+=122192928e5))+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(var n=0;n<6;++n)b[i+n]=node[n];return buf||bytesToUuid(b)}},{"./lib/bytesToUuid":111,"./lib/rng":112}],114:[function(require,module,exports){var rng=require("./lib/rng"),bytesToUuid=require("./lib/bytesToUuid");module.exports=function(options,buf,offset){var i=buf&&offset||0;"string"==typeof options&&(buf="binary"===options?new Array(16):null,options=null);var rnds=(options=options||{}).random||(options.rng||rng)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(var ii=0;ii<16;++ii)buf[i+ii]=rnds[ii];return buf||bytesToUuid(rnds)}},{"./lib/bytesToUuid":111,"./lib/rng":112}],115:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var LRU_1=require("./utils/LRU"),CACHE_SIZE=1e3,EndpointCache=function(){function EndpointCache(maxSize){void 0===maxSize&&(maxSize=CACHE_SIZE),this.maxSize=maxSize,this.cache=new LRU_1.LRUCache(maxSize)}return Object.defineProperty(EndpointCache.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),EndpointCache.prototype.put=function(key,value){var keyString="string"!=typeof key?EndpointCache.getKeyString(key):key,endpointRecord=this.populateValue(value);this.cache.put(keyString,endpointRecord)},EndpointCache.prototype.get=function(key){var keyString="string"!=typeof key?EndpointCache.getKeyString(key):key,now=Date.now(),records=this.cache.get(keyString);if(records){for(var i=records.length-1;i>=0;i--){records[i].Expire