diff --git a/nuxeo-core-binarymanager-s3-web-ui/pom.xml b/nuxeo-core-binarymanager-s3-web-ui/pom.xml new file mode 100644 index 0000000..89cee5c --- /dev/null +++ b/nuxeo-core-binarymanager-s3-web-ui/pom.xml @@ -0,0 +1,15 @@ + + 4.0.0 + + + org.nuxeo.ecm.core + nuxeo-core-binarymanager-cloud + 10.1-SNAPSHOT + ../pom.xml + + + nuxeo-core-binarymanager-s3-web-ui + Nuxeo S3 Upload Provider for Web UI + Nuxeo Core S3 Upload Provider for Web UI + + diff --git a/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/META-INF/MANIFEST.MF b/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d77ce04 --- /dev/null +++ b/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.nuxeo.ecm.core.storage.binarymanager.s3.webui;singleton:=true +Nuxeo-Component: OSGI-INF/nuxeo-s3-direct-upload-webresources-contrib.xml diff --git a/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/OSGI-INF/deployment-fragment.xml b/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/OSGI-INF/deployment-fragment.xml new file mode 100644 index 0000000..ed20e83 --- /dev/null +++ b/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/OSGI-INF/deployment-fragment.xml @@ -0,0 +1,11 @@ + + + + + + + web/nuxeo.war/** + + + + diff --git a/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/OSGI-INF/nuxeo-s3-direct-upload-webresources-contrib.xml b/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/OSGI-INF/nuxeo-s3-direct-upload-webresources-contrib.xml new file mode 100644 index 0000000..4cef553 --- /dev/null +++ b/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/OSGI-INF/nuxeo-s3-direct-upload-webresources-contrib.xml @@ -0,0 +1,21 @@ + + + + + org.nuxeo.web.ui.resources + + + + /ui/nuxeo-s3-direct-upload/nuxeo-s3-direct-upload.html + + + + + + + nuxeo-s3-direct-upload.html + + + + + diff --git a/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/web/nuxeo.war/ui/nuxeo-s3-direct-upload/aws-sdk-2.201.0.min.js b/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/web/nuxeo.war/ui/nuxeo-s3-direct-upload/aws-sdk-2.201.0.min.js new file mode 100644 index 0000000..d6f021c --- /dev/null +++ b/nuxeo-core-binarymanager-s3-web-ui/src/main/resources/web/nuxeo.war/ui/nuxeo-s3-direct-upload/aws-sdk-2.201.0.min.js @@ -0,0 +1,10 @@ +_xamzrequire=function(){function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof _xamzrequire&&_xamzrequire;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return i(r||e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof _xamzrequire&&_xamzrequire,s=0;s0||n?o.root().toString():""},t.exports=n},{"../util":261,xmlbuilder:181}],253:[function(e,t,r){var n=e("../core"),i=n.util.inherit;n.Signers.RequestSigner=i({constructor:function(e){this.request=e},setServiceClientId:function(e){this.serviceClientId=e},getServiceClientId:function(){return this.serviceClientId}}),n.Signers.RequestSigner.getVersion=function(e){switch(e){case"v2":return n.Signers.V2;case"v3":return n.Signers.V3;case"v4":return n.Signers.V4;case"s3":return n.Signers.S3;case"v3https":return n.Signers.V3Https}throw new Error("Unknown signing version "+e)},e("./v2"),e("./v3"),e("./v3https"),e("./v4"),e("./s3"),e("./presign")},{"../core":194,"./presign":252,"./s3":254,"./v2":255,"./v3":256,"./v3https":257,"./v4":258}],258:[function(e,t,r){var n=e("../core"),i=e("./v4_credentials"),o=n.util.inherit;n.Signers.V4=o(n.Signers.RequestSigner,{constructor:function(e,t,r){n.Signers.RequestSigner.call(this,e),this.serviceName=t,r=r||{},this.signatureCache="boolean"!=typeof r.signatureCache||r.signatureCache,this.operation=r.operation},algorithm:"AWS4-HMAC-SHA256",addAuthorization:function(e,t){var r=n.util.date.iso8601(t).replace(/[:\-]|\.\d{3}/g,"");this.isPresigned()?this.updateForPresigned(e,r):this.addHeaders(e,r),this.request.headers.Authorization=this.authorization(e,r)},addHeaders:function(e,t){this.request.headers["X-Amz-Date"]=t,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken)},updateForPresigned:function(e,t){var r=this.credentialString(t),i={"X-Amz-Date":t,"X-Amz-Algorithm":this.algorithm,"X-Amz-Credential":e.accessKeyId+"/"+r,"X-Amz-Expires":this.request.headers["presigned-expires"],"X-Amz-SignedHeaders":this.signedHeaders()};e.sessionToken&&(i["X-Amz-Security-Token"]=e.sessionToken),this.request.headers["Content-Type"]&&(i["Content-Type"]=this.request.headers["Content-Type"]),this.request.headers["Content-MD5"]&&(i["Content-MD5"]=this.request.headers["Content-MD5"]),this.request.headers["Cache-Control"]&&(i["Cache-Control"]=this.request.headers["Cache-Control"]),n.util.each.call(this,this.request.headers,function(e,t){if("presigned-expires"!==e&&this.isSignableHeader(e)){var r=e.toLowerCase();0===r.indexOf("x-amz-meta-")?i[r]=t:0===r.indexOf("x-amz-")&&(i[e]=t)}});var o=this.request.path.indexOf("?")>=0?"&":"?";this.request.path+=o+n.util.queryParamsToString(i)},authorization:function(e,t){var r=[],n=this.credentialString(t);return r.push(this.algorithm+" Credential="+e.accessKeyId+"/"+n),r.push("SignedHeaders="+this.signedHeaders()),r.push("Signature="+this.signature(e,t)),r.join(", ")},signature:function(e,t){var r=i.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return n.util.crypto.hmac(r,this.stringToSign(t),"hex")},stringToSign:function(e){var t=[];return t.push("AWS4-HMAC-SHA256"),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")},canonicalString:function(){var e=[],t=this.request.pathname();return"s3"!==this.serviceName&&(t=n.util.uriEscapePath(t)),e.push(this.request.method),e.push(t),e.push(this.request.search()),e.push(this.canonicalHeaders()+"\n"),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")},canonicalHeaders:function(){var e=[];n.util.each.call(this,this.request.headers,function(t,r){e.push([t,r])}),e.sort(function(e,t){return e[0].toLowerCase()50&&delete i[o.shift()]),p},emptyCache:function(){i={},o=[]}}},{"../core":194}],257:[function(e,t,r){var n=e("../core"),i=n.util.inherit;e("./v3"),n.Signers.V3Https=i(n.Signers.V3,{authorization:function(e){return"AWS3-HTTPS AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,Signature="+this.signature(e)},stringToSign:function(){return this.request.headers["X-Amz-Date"]}}),t.exports=n.Signers.V3Https},{"../core":194,"./v3":256}],256:[function(e,t,r){var n=e("../core"),i=n.util.inherit;n.Signers.V3=i(n.Signers.RequestSigner,{addAuthorization:function(e,t){var r=n.util.date.rfc822(t);this.request.headers["X-Amz-Date"]=r,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken),this.request.headers["X-Amzn-Authorization"]=this.authorization(e,r)},authorization:function(e){return"AWS3 AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,SignedHeaders="+this.signedHeaders()+",Signature="+this.signature(e)},signedHeaders:function(){var e=[];return n.util.arrayEach(this.headersToSign(),function(t){e.push(t.toLowerCase())}),e.sort().join(";")},canonicalHeaders:function(){var e=this.request.headers,t=[];return n.util.arrayEach(this.headersToSign(),function(r){t.push(r.toLowerCase().trim()+":"+String(e[r]).trim())}),t.sort().join("\n")+"\n"},headersToSign:function(){var e=[];return n.util.each(this.request.headers,function(t){("Host"===t||"Content-Encoding"===t||t.match(/^X-Amz/i))&&e.push(t)}),e},signature:function(e){return n.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push("/"),e.push(""),e.push(this.canonicalHeaders()),e.push(this.request.body),n.util.crypto.sha256(e.join("\n"))}}),t.exports=n.Signers.V3},{"../core":194}],255:[function(e,t,r){var n=e("../core"),i=n.util.inherit;n.Signers.V2=i(n.Signers.RequestSigner,{addAuthorization:function(e,t){t||(t=n.util.date.getDate());var r=this.request;r.params.Timestamp=n.util.date.iso8601(t),r.params.SignatureVersion="2",r.params.SignatureMethod="HmacSHA256",r.params.AWSAccessKeyId=e.accessKeyId,e.sessionToken&&(r.params.SecurityToken=e.sessionToken),delete r.params.Signature,r.params.Signature=this.signature(e),r.body=n.util.queryParamsToString(r.params),r.headers["Content-Length"]=r.body.length},signature:function(e){return n.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push(this.request.endpoint.host.toLowerCase()),e.push(this.request.pathname()),e.push(n.util.queryParamsToString(this.request.params)),e.join("\n")}}),t.exports=n.Signers.V2},{"../core":194}],254:[function(e,t,r){var n=e("../core"),i=n.util.inherit;n.Signers.S3=i(n.Signers.RequestSigner,{subResources:{acl:1,accelerate:1,analytics:1,cors:1,lifecycle:1,delete:1,inventory:1,location:1,logging:1,metrics:1,notification:1,partNumber:1,policy:1,requestPayment:1,replication:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(e,t){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=n.util.date.rfc822(t)),e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken);var r=this.sign(e.secretAccessKey,this.stringToSign()),i="AWS "+e.accessKeyId+":"+r;this.request.headers.Authorization=i},stringToSign:function(){var e=this.request,t=[];t.push(e.method),t.push(e.headers["Content-MD5"]||""),t.push(e.headers["Content-Type"]||""),t.push(e.headers["presigned-expires"]||"");var r=this.canonicalizedAmzHeaders();return r&&t.push(r),t.push(this.canonicalizedResource()),t.join("\n")},canonicalizedAmzHeaders:function(){var e=[];n.util.each(this.request.headers,function(t){t.match(/^x-amz-/i)&&e.push(t)}),e.sort(function(e,t){return e.toLowerCase()604800){throw o.util.error(new Error,{code:"InvalidExpiryTime",message:"Presigning does not support expiry time greater than a week with SigV4 signing.",retryable:!1})}e.httpRequest.headers[a]=t}else{if(r!==o.Signers.S3)throw o.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});var n=e.service?e.service.getSkewCorrectedDate():o.util.date.getDate();e.httpRequest.headers[a]=parseInt(o.util.date.unixTimestamp(n)+t,10).toString()}}function i(e){var t=e.httpRequest.endpoint,r=o.util.urlParse(e.httpRequest.path),n={};r.search&&(n=o.util.queryStringParse(r.search.substr(1)));var i=e.httpRequest.headers.Authorization.split(" ");if("AWS"===i[0])i=i[1].split(":"),n.AWSAccessKeyId=i[0],n.Signature=i[1],o.util.each(e.httpRequest.headers,function(e,t){e===a&&(e="Expires"),0===e.indexOf("x-amz-meta-")&&(delete n[e],e=e.toLowerCase()),n[e]=t}),delete e.httpRequest.headers[a],delete n.Authorization,delete n.Host;else if("AWS4-HMAC-SHA256"===i[0]){i.shift();var s=i.join(" "),u=s.match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];n["X-Amz-Signature"]=u,delete n.Expires}t.pathname=r.pathname,t.search=o.util.queryParamsToString(n)}var o=e("../core"),s=o.util.inherit,a="presigned-expires";o.Signers.Presign=s({sign:function(e,t,r){if(e.httpRequest.headers[a]=t||3600,e.on("build",n),e.on("sign",i),e.removeListener("afterBuild",o.EventListeners.Core.SET_CONTENT_LENGTH),e.removeListener("afterBuild",o.EventListeners.Core.COMPUTE_SHA256),e.emit("beforePresign",[e]),!r){if(e.build(),e.response.error)throw e.response.error;return o.util.urlFormat(e.httpRequest.endpoint)}e.build(function(){this.response.error?r(this.response.error):r(null,o.util.urlFormat(e.httpRequest.endpoint))})}}),t.exports=o.Signers.Presign},{"../core":194}],234:[function(e,t,r){var n=e("./core"),i=e("./model/api"),o=e("./region_config"),s=n.util.inherit,a=0;n.Service=s({constructor:function(e){if(!this.loadServiceClass)throw n.util.error(new Error,"Service must be constructed with `new' operator");var t=this.loadServiceClass(e||{});if(t){var r=n.util.copy(e),i=new t(e);return Object.defineProperty(i,"_originalConfig",{get:function(){return r},enumerable:!1,configurable:!0}),i._clientId=++a,i}this.initialize(e)},initialize:function(e){var t=n.config[this.serviceIdentifier];this.config=new n.Config(n.config),t&&this.config.update(t,!0),e&&this.config.update(e,!0),this.validateService(),this.config.endpoint||o(this),this.config.endpoint=this.endpointFromTemplate(this.config.endpoint),this.setEndpoint(this.config.endpoint)},validateService:function(){},loadServiceClass:function(e){var t=e;if(n.util.isEmpty(this.api)){if(t.apiConfig)return n.Service.defineServiceApi(this.constructor,t.apiConfig);if(this.constructor.services){t=new n.Config(n.config),t.update(e,!0);var r=t.apiVersions[this.constructor.serviceIdentifier];return r=r||t.apiVersion,this.getLatestServiceClass(r)}return null}return null},getLatestServiceClass:function(e){return e=this.getLatestServiceVersion(e),null===this.constructor.services[e]&&n.Service.defineServiceApi(this.constructor,e),this.constructor.services[e]},getLatestServiceVersion:function(e){if(!this.constructor.services||0===this.constructor.services.length)throw new Error("No services defined on "+this.constructor.serviceIdentifier);if(e?n.util.isType(e,Date)&&(e=n.util.date.iso8601(e).split("T")[0]):e="latest",Object.hasOwnProperty(this.constructor.services,e))return e;for(var t=Object.keys(this.constructor.services).sort(),r=null,i=t.length-1;i>=0;i--)if("*"!==t[i][t[i].length-1]&&(r=t[i]),t[i].substr(0,10)<=e)return r;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+e+"'")},api:{},defaultRetryCount:3,customizeRequests:function(e){if(e){if("function"!=typeof e)throw new Error("Invalid callback type '"+typeof e+"' provided in customizeRequests");this.customRequestHandler=e}else this.customRequestHandler=null},makeRequest:function(e,t,r){if("function"==typeof t&&(r=t,t=null),t=t||{},this.config.params){var i=this.api.operations[e];i&&(t=n.util.copy(t),n.util.each(this.config.params,function(e,r){i.input.members[e]&&(void 0!==t[e]&&null!==t[e]||(t[e]=r))}))}var o=new n.Request(this,e,t);return this.addAllRequestListeners(o),r&&o.send(r),o},makeUnauthenticatedRequest:function(e,t,r){"function"==typeof t&&(r=t,t={});var n=this.makeRequest(e,t).toUnauthenticated();return r?n.send(r):n},waitFor:function(e,t,r){return new n.ResourceWaiter(this,e).wait(t,r)},addAllRequestListeners:function(e){for(var t=[n.events,n.EventListeners.Core,this.serviceInterface(),n.EventListeners.CorePost],r=0;r=500)))},networkingError:function(e){return"NetworkingError"===e.code},timeoutError:function(e){return"TimeoutError"===e.code},expiredCredentialsError:function(e){return"ExpiredTokenException"===e.code},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return Math.abs(this.getSkewCorrectedDate().getTime()-e)>=3e4},throttledError:function(e){switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":return!0;default:return!1}},endpointFromTemplate:function(e){if("string"!=typeof e)return e;var t=e;return t=t.replace(/\{service\}/g,this.api.endpointPrefix),t=t.replace(/\{region\}/g,this.config.region),t=t.replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(e){this.endpoint=new n.Endpoint(e,this.config)},paginationConfig:function(e,t){var r=this.api.operations[e].paginator;if(!r){if(t){var i=new Error;throw n.util.error(i,"No pagination configuration for "+e)}return null}return r}}),n.util.update(n.Service,{defineMethods:function(e){n.util.each(e.prototype.api.operations,function(t){if(!e.prototype[t]){"none"===e.prototype.api.operations[t].authtype?e.prototype[t]=function(e,r){return this.makeUnauthenticatedRequest(t,e,r)}:e.prototype[t]=function(e,r){return this.makeRequest(t,e,r)}}})},defineService:function(e,t,r){n.Service._serviceMap[e]=!0,Array.isArray(t)||(r=t,t=[]);var i=s(n.Service,r||{});if("string"==typeof e){n.Service.addVersions(i,t);var o=i.serviceIdentifier||e;i.serviceIdentifier=o}else i.prototype.api=e,n.Service.defineMethods(i);return i},addVersions:function(e,t){Array.isArray(t)||(t=[t]),e.services=e.services||{};for(var r=0;r=0){u=!0;var c=0}var l=function(){u&&c!==a?i.emit("error",n.util.error(new Error("Stream content length mismatch. Received "+c+" of "+a+" bytes."),{code:"StreamContentLengthMismatch"})):2===n.HttpClient.streamsApiVersion?i.end():i.emit("end")},h=s.httpResponse.createUnbufferedStream();if(2===n.HttpClient.streamsApiVersion)if(u){var f=new e.PassThrough;f._write=function(t){return t&&t.length&&(c+=t.length),e.PassThrough.prototype._write.apply(this,arguments)},f.on("end",l),i.on("error",function(e){u=!1,h.unpipe(f),f.emit("end"),f.end()}),h.pipe(f).pipe(i,{end:!1})}else h.pipe(i);else u&&h.on("data",function(e){e&&e.length&&(c+=e.length)}),h.on("data",function(e){i.emit("data",e)}),h.on("end",l);h.on("error",function(e){u=!1,i.emit("error",e)})}}),i},emitEvent:function(e,t,r){"function"==typeof t&&(r=t,t=null),r||(r=function(){}),t||(t=this.eventParameters(e,this.response)),n.SequentialExecutor.prototype.emit.call(this,e,t,function(e){e&&(this.response.error=e),r.call(this,e)})},eventParameters:function(e){switch(e){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(e,t){return t||"function"!=typeof e||(t=e,e=null),(new n.Signers.Presign).sign(this.toGet(),e,t)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this.removeListener("validate",n.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",n.EventListeners.Core.SIGN),this},toGet:function(){return"query"!==this.service.api.protocol&&"ec2"!==this.service.api.protocol||(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(e){e.httpRequest.method="GET",e.httpRequest.path=e.service.endpoint.path+"?"+e.httpRequest.body,e.httpRequest.body="",delete e.httpRequest.headers["Content-Length"],delete e.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),n.Request.addPromisesToClass=function(e){this.prototype.promise=function(){var t=this;return this.httpRequest.appendToUserAgent("promise"),new e(function(e,r){t.on("complete",function(t){t.error?r(t.error):e(Object.defineProperty(t.data||{},"$response",{value:t}))}),t.runTo()})}},n.Request.deletePromisesFromClass=function(){delete this.prototype.promise},n.util.addPromises(n.Request),n.util.mixin(n.Request,n.SequentialExecutor)}).call(this,e("_process"))},{"./core":194,"./state_machine":260,_process:148,jmespath:7}],260:[function(e,t,r){function n(e,t){this.currentState=t||null,this.states=e||{}}n.prototype.runTo=function(e,t,r,n){"function"==typeof e&&(n=r,r=t,t=e,e=null);var i=this,o=i.states[i.currentState];o.fn.call(r||i,n,function(n){if(n){if(!o.fail)return t?t.call(r,n):null;i.currentState=o.fail}else{if(!o.accept)return t?t.call(r):null;i.currentState=o.accept}if(i.currentState===e)return t?t.call(r,n):null;i.runTo(e,t,r,n)})},n.prototype.addState=function(e,t,r,n){return"function"==typeof t?(n=t,t=null,r=null):"function"==typeof r&&(n=r,r=null),this.currentState||(this.currentState=e),this.states[e]={accept:t,fail:r,fn:n},this},t.exports=n},{}],218:[function(e,t,r){var n=e("./core");n.ParamValidator=n.util.inherit({constructor:function(e){!0!==e&&void 0!==e||(e={min:!0}),this.validation=e},validate:function(e,t,r){if(this.errors=[],this.validateMember(e,t||{},r||"params"),this.errors.length>1){var i=this.errors.join("\n* ");throw i="There were "+this.errors.length+" validation errors:\n* "+i,n.util.error(new Error(i),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(e,t){this.errors.push(n.util.error(new Error(t),{code:e}))},validateStructure:function(e,t,r){this.validateType(t,r,["object"],"structure");for(var n,i=0;e.required&&i= "+e.min+", but found "+t+" for "+r),this.validation.max&&void 0!==e.max&&t>e.max&&this.fail("MaxRangeError","Expected "+n+" <= "+e.max+", but found "+t+" for "+r)},validateEnum:function(e,t,r){this.validation.enum&&void 0!==e.enum&&-1===e.enum.indexOf(t)&&this.fail("EnumError","Found string value of "+t+", but expected "+e.enum.join("|")+" for "+r)},validateType:function(e,t,r,i){if(null===e||void 0===e)return!1;for(var o=!1,s=0;s=0)return e.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",t();i.util.computeSha256(o,function(r,n){r?t(r):(e.httpRequest.headers["X-Amz-Content-Sha256"]=n,t())})}else t()}}),e("SET_CONTENT_LENGTH","afterBuild",function(e){var t=n(e);if(void 0===e.httpRequest.headers["Content-Length"]&&-1===t.indexOf("unsigned-body")){var r=i.util.string.byteLength(e.httpRequest.body);e.httpRequest.headers["Content-Length"]=r}}),e("SET_HTTP_HOST","afterBuild",function(e){e.httpRequest.headers.Host=e.httpRequest.endpoint.host}),e("RESTART","restart",function(){var e=this.response.error;e&&e.retryable&&(this.httpRequest=new i.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=600?this.emit("sign",[this],function(e){e?t(e):s()}):s()}),e("HTTP_HEADERS","httpHeaders",function(e,t,r,n){r.httpResponse.statusCode=e,r.httpResponse.statusMessage=n,r.httpResponse.headers=t,r.httpResponse.body=new i.util.Buffer(""),r.httpResponse.buffers=[],r.httpResponse.numBytes=0;var o=t.date||t.Date,s=r.request.service;if(o){var a=Date.parse(o);s.config.correctClockSkew&&s.isClockSkewed(a)&&s.applyClockOffset(a)}}),e("HTTP_DATA","httpData",function(e,t){if(e){if(i.util.isNode()){t.httpResponse.numBytes+=e.length;var r=t.httpResponse.headers["content-length"],n={loaded:t.httpResponse.numBytes,total:r};t.request.emit("httpDownloadProgress",[n,t])}t.httpResponse.buffers.push(new i.util.Buffer(e))}}),e("HTTP_DONE","httpDone",function(e){if(e.httpResponse.buffers&&e.httpResponse.buffers.length>0){var t=i.util.buffer.concat(e.httpResponse.buffers);e.httpResponse.body=t}delete e.httpResponse.numBytes,delete e.httpResponse.buffers}),e("FINALIZE_ERROR","retry",function(e){e.httpResponse.statusCode&&(e.error.statusCode=e.httpResponse.statusCode,void 0===e.error.retryable&&(e.error.retryable=this.service.retryableError(e.error,this)))}),e("INVALIDATE_CREDENTIALS","retry",function(e){if(e.error)switch(e.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":e.error.retryable=!0,e.request.service.config.credentials.expired=!0}}),e("EXPIRED_SIGNATURE","retry",function(e){var t=e.error;t&&"string"==typeof t.code&&"string"==typeof t.message&&t.code.match(/Signature/)&&t.message.match(/expired/)&&(e.error.retryable=!0)}),e("CLOCK_SKEWED","retry",function(e){e.error&&this.service.clockSkewError(e.error)&&this.service.config.correctClockSkew&&(e.error.retryable=!0)}),e("REDIRECT","retry",function(e){e.error&&e.error.statusCode>=300&&e.error.statusCode<400&&e.httpResponse.headers.location&&(this.httpRequest.endpoint=new i.Endpoint(e.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,e.error.redirect=!0,e.error.retryable=!0)}),e("RETRY_CHECK","retry",function(e){e.error&&(e.error.redirect&&e.redirectCount-1&&r.splice(i,1)}return this},removeAllListeners:function(e){return e?delete this._events[e]:this._events={},this},emit:function(e,t,r){r||(r=function(){});var n=this.listeners(e),i=n.length;return this.callListeners(n,t,r),i>0},callListeners:function(e,t,r,i){function o(i){if(i&&(a=n.util.error(a||new Error,i),s._haltHandlersOnError))return r.call(s,a);s.callListeners(e,t,r,a)}for(var s=this,a=i||null;e.length>0;){var u=e.shift();if(u._isAsync)return void u.apply(s,t.concat([o]));try{u.apply(s,t)}catch(e){a=n.util.error(a||new Error,e)}if(a&&s._haltHandlersOnError)return void r.call(s,a)}r.call(s,a)},addListeners:function(e){var t=this;return e._events&&(e=e._events),n.util.each(e,function(e,r){"function"==typeof r&&(r=[r]),n.util.arrayEach(r,function(r){t.on(e,r)})}),t},addNamedListener:function(e,t,r){return this[e]=r,this.addListener(t,r),this},addNamedAsyncListener:function(e,t,r){return r._isAsync=!0,this.addNamedListener(e,t,r)},addNamedListeners:function(e){var t=this;return e(function(){t.addNamedListener.apply(t,arguments)},function(){t.addNamedAsyncListener.apply(t,arguments)}),this}}),n.SequentialExecutor.prototype.addListener=n.SequentialExecutor.prototype.on,t.exports=n.SequentialExecutor},{"./core":194}],224:[function(e,t,r){function n(e){var t=e.service.api.operations[e.operation].input,r=new a.XML.Builder,n=e.params,i=t.payload;if(i){var o=t.members[i];if(void 0===(n=n[i]))return;if("structure"===o.type){var s=o.name;e.httpRequest.body=r.toXML(n,o,s,!0)}else e.httpRequest.body=n}else e.httpRequest.body=r.toXML(n,t,t.name||t.shape||u.string.upperFirst(e.operation)+"Request")}function i(e){c.buildRequest(e),["GET","HEAD"].indexOf(e.httpRequest.method)<0&&n(e)}function o(e){c.extractError(e);var t;try{t=(new a.XML.Parser).parse(e.httpResponse.body.toString())}catch(r){t={Code:e.httpResponse.statusCode,Message:e.httpResponse.statusMessage}}t.Errors&&(t=t.Errors),t.Error&&(t=t.Error),t.Code?e.error=u.error(new Error,{code:t.Code,message:t.Message}):e.error=u.error(new Error,{code:e.httpResponse.statusCode,message:null})}function s(e){c.extractData(e);var t,r=e.request,n=e.httpResponse.body,i=r.service.api.operations[r.operation],o=i.output,s=o.payload;if(s){var l=o.members[s];"structure"===l.type?(t=new a.XML.Parser,e.data[s]=t.parse(n.toString(),l)):"binary"===l.type||l.isStreaming?e.data[s]=n:e.data[s]=l.toType(n)}else if(n.length>0){t=new a.XML.Parser;var h=t.parse(n.toString(),o);u.update(e.data,h)}}var a=e("../core"),u=e("../util"),c=e("./rest");t.exports={buildRequest:i,extractError:o,extractData:s}},{"../core":194,"../util":261,"./rest":222}],223:[function(e,t,r){function n(e){var t=new h,r=e.service.api.operations[e.operation].input;if(r.payload){var n={},o=r.members[r.payload];if(void 0===(n=e.params[r.payload]))return;"structure"===o.type?(e.httpRequest.body=t.build(n,o),i(e)):(e.httpRequest.body=n,("binary"===o.type||o.isStreaming)&&i(e,!0))}else e.httpRequest.body=t.build(e.params,r),i(e)}function i(e,t){var r=e.service.api.operations[e.operation];r.input;if(!e.httpRequest.headers["Content-Type"]){var n=t?"binary/octet-stream":"application/json";e.httpRequest.headers["Content-Type"]=n}}function o(e){c.buildRequest(e),["GET","HEAD","DELETE"].indexOf(e.httpRequest.method)<0&&n(e)}function s(e){l.extractError(e)}function a(e){c.extractData(e);var t=e.request,r=t.service.api.operations[t.operation].output||{};if(r.payload){var n=r.members[r.payload],i=e.httpResponse.body;if("structure"===n.type||"list"===n.type){var o=new f;e.data[r.payload]=o.parse(i,n)}else"binary"===n.type||n.isStreaming?e.data[r.payload]=i:e.data[r.payload]=n.toType(i)}else{var s=e.data;l.extractData(e),e.data=u.merge(s,e.data)}}var u=e("../util"),c=e("./rest"),l=e("./json"),h=e("../json/builder"),f=e("../json/parser");t.exports={buildRequest:o,extractError:s,extractData:a}},{"../json/builder":210,"../json/parser":211,"../util":261,"./json":220,"./rest":222}],222:[function(e,t,r){function n(e){e.httpRequest.method=e.service.api.operations[e.operation].httpMethod}function i(e,t,r,n){var i=[e,t].join("/");i=i.replace(/\/+/g,"/");var o={},s=!1;if(l.each(r.members,function(e,t){var r=n[e];if(null!==r&&void 0!==r)if("uri"===t.location){var a=new RegExp("\\{"+t.name+"(\\+)?\\}");i=i.replace(a,function(e,t){return(t?l.uriEscapePath:l.uriEscape)(String(r))})}else"querystring"===t.location&&(s=!0,"list"===t.type?o[t.name]=r.map(function(e){return l.uriEscape(String(e))}):"map"===t.type?l.each(r,function(e,t){Array.isArray(t)?o[e]=t.map(function(e){return l.uriEscape(String(e))}):o[e]=l.uriEscape(String(t))}):o[t.name]=l.uriEscape(String(r)))}),s){i+=i.indexOf("?")>=0?"&":"?";var a=[];l.arrayEach(Object.keys(o).sort(),function(e){Array.isArray(o[e])||(o[e]=[o[e]]);for(var t=0;t-1?t||"":t,this.isJsonValue?JSON.parse(t):t&&"function"==typeof t.toString?t.toString():t},this.toWireFormat=function(e){return this.isJsonValue?JSON.stringify(e):e}}function f(){o.apply(this,arguments),this.toType=function(e){return null===e||void 0===e?null:parseFloat(e)},this.toWireFormat=this.toType}function p(){o.apply(this,arguments),this.toType=function(e){return null===e||void 0===e?null:parseInt(e,10)},this.toWireFormat=this.toType}function d(){o.apply(this,arguments),this.toType=g.base64.decode,this.toWireFormat=g.base64.encode}function y(){d.apply(this,arguments)}function v(){o.apply(this,arguments),this.toType=function(e){return"boolean"==typeof e?e:null===e||void 0===e?null:"true"===e}}var m=e("./collection"),g=e("../util");o.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"},o.types={structure:a,list:u,map:c,boolean:v,timestamp:l,float:f,integer:p,string:h,base64:y,binary:d},o.resolve=function(e,t){if(e.shape){var r=t.api.shapes[e.shape];if(!r)throw new Error("Cannot find shape reference: "+e.shape);return r}return null},o.create=function(e,t,r){if(e.isShape)return e;var n=o.resolve(e,t);if(n){var i=Object.keys(e);t.documentation||(i=i.filter(function(e){return!e.match(/documentation/)}));var s=function(){n.constructor.call(this,e,t,r)};return s.prototype=n,new s}e.type||(e.members?e.type="structure":e.member?e.type="list":e.key?e.type="map":e.type="string");var a=e.type;if(o.normalizedTypes[e.type]&&(e.type=o.normalizedTypes[e.type]),o.types[e.type])return new o.types[e.type](e,t,r);throw new Error("Unrecognized shape type: "+a)},o.shapes={StructureShape:a,ListShape:u,MapShape:c,StringShape:h,BooleanShape:v,Base64Shape:y},t.exports=o},{"../util":261,"./collection":213}],213:[function(e,t,r){function n(e,t,r,n){o(this,n(e),function(){return r(e,t)})}function i(e,t,r,i){i=i||String;var o=this;for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&n.call(o,s,e[s],r,i)}var o=e("../util").memoizedProperty;t.exports=i},{"../util":261}],220:[function(e,t,r){function n(e){var t=e.httpRequest,r=e.service.api,n=r.targetPrefix+"."+r.operations[e.operation].name,i=r.jsonVersion||"1.0",o=r.operations[e.operation].input,s=new a;1===i&&(i="1.0"),t.body=s.build(e.params||{},o),t.headers["Content-Type"]="application/x-amz-json-"+i,t.headers["X-Amz-Target"]=n}function i(e){var t={},r=e.httpResponse;if(t.code=r.headers["x-amzn-errortype"]||"UnknownError","string"==typeof t.code&&(t.code=t.code.split(":")[0]),r.body.length>0)try{var n=JSON.parse(r.body.toString());(n.__type||n.code)&&(t.code=(n.__type||n.code).split("#").pop()),"RequestEntityTooLarge"===t.code?t.message="Request body must be less than 1 MB":t.message=n.message||n.Message||null}catch(n){t.statusCode=r.statusCode,t.message=r.statusMessage}else t.statusCode=r.statusCode,t.message=r.statusCode.toString();e.error=s.error(new Error,t)}function o(e){var t=e.httpResponse.body.toString()||"{}";if(!1===e.request.service.config.convertResponseTypes)e.data=JSON.parse(t);else{var r=e.request.service.api.operations[e.request.operation],n=r.output||{},i=new u;e.data=i.parse(t,n)}}var s=e("../util"),a=e("../json/builder"),u=e("../json/parser");t.exports={buildRequest:n,extractError:i,extractData:o}},{"../json/builder":210,"../json/parser":211,"../util":261}],211:[function(e,t,r){function n(){}function i(e,t){if(t&&void 0!==e)switch(t.type){case"structure":return o(e,t);case"map":return a(e,t);case"list":return s(e,t);default:return u(e,t)}}function o(e,t){if(null!=e){var r={},n=t.members;return c.each(n,function(t,n){var o=n.isLocationName?n.name:t;if(Object.prototype.hasOwnProperty.call(e,o)){var s=e[o],a=i(s,n);void 0!==a&&(r[t]=a)}}),r}}function s(e,t){if(null!=e){var r=[];return c.arrayEach(e,function(e){var n=i(e,t.member);void 0===n?r.push(null):r.push(n)}),r}}function a(e,t){if(null!=e){var r={};return c.each(e,function(e,n){var o=i(n,t.value);r[e]=void 0===o?null:o}),r}}function u(e,t){return t.toType(e)}var c=e("../util");n.prototype.parse=function(e,t){return i(JSON.parse(e),t)},t.exports=n},{"../util":261}],210:[function(e,t,r){function n(){}function i(e,t){if(t&&void 0!==e&&null!==e)switch(t.type){case"structure":return o(e,t);case"map":return a(e,t);case"list":return s(e,t);default:return u(e,t)}}function o(e,t){var r={};return c.each(e,function(e,n){var o=t.members[e];if(o){if("body"!==o.location)return;var s=o.isLocationName?o.name:e,a=i(n,o);void 0!==a&&(r[s]=a)}}),r}function s(e,t){var r=[];return c.arrayEach(e,function(e){var n=i(e,t.member);void 0!==n&&r.push(n)}),r}function a(e,t){var r={};return c.each(e,function(e,n){var o=i(n,t.value);void 0!==o&&(r[e]=o)}),r}function u(e,t){return t.toWireFormat(e)}var c=e("../util");n.prototype.build=function(e,t){return JSON.stringify(i(e,t))},t.exports=n},{"../util":261}],261:[function(e,t,r){(function(r){var n,i={environment:"nodejs",engine:function(){if(i.isBrowser()&&"undefined"!=typeof navigator)return navigator.userAgent;var e=r.platform+"/"+r.version;return r.env.AWS_EXECUTION_ENV&&(e+=" exec-env/"+r.env.AWS_EXECUTION_ENV),e},userAgent:function(){var t=i.environment,r="aws-sdk-"+t+"/"+e("./core").VERSION;return"nodejs"===t&&(r+=" "+i.engine()),r},isBrowser:function(){return r&&r.browser},isNode:function(){return!i.isBrowser()},uriEscape:function(e){var t=encodeURIComponent(e);return t=t.replace(/[^A-Za-z0-9_.~\-%]+/g,escape),t=t.replace(/[*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},uriEscapePath:function(e){var t=[];return i.arrayEach(e.split("/"),function(e){t.push(i.uriEscape(e))}),t.join("/")},urlParse:function(e){return i.url.parse(e)},urlFormat:function(e){return i.url.format(e)},queryStringParse:function(e){return i.querystring.parse(e)},queryParamsToString:function(e){var t=[],r=i.uriEscape,n=Object.keys(e).sort();return i.arrayEach(n,function(n){var o=e[n],s=r(n),a=s+"=";if(Array.isArray(o)){var u=[];i.arrayEach(o,function(e){u.push(r(e))}),a=s+"="+u.sort().join("&"+s+"=")}else void 0!==o&&null!==o&&(a=s+"="+r(o));t.push(a)}),t.join("&")},readFileSync:function(t){return i.isBrowser()?null:e("fs").readFileSync(t,"utf-8")},base64:{encode:function(e){if("number"==typeof e)throw i.error(new Error("Cannot base64 encode number "+e));return null===e||void 0===e?e:("function"==typeof i.Buffer.from&&i.Buffer.from!==Uint8Array.from?i.Buffer.from(e):new i.Buffer(e)).toString("base64")},decode:function(e){if("number"==typeof e)throw i.error(new Error("Cannot base64 decode number "+e));return null===e||void 0===e?e:"function"==typeof i.Buffer.from&&i.Buffer.from!==Uint8Array.from?i.Buffer.from(e,"base64"):new i.Buffer(e,"base64")}},buffer:{toStream:function(e){i.Buffer.isBuffer(e)||(e=new i.Buffer(e));var t=new i.stream.Readable,r=0;return t._read=function(n){if(r>=e.length)return t.push(null);var i=r+n;i>e.length&&(i=e.length),t.push(e.slice(r,i)),r=i},t},concat:function(e){var t,r=0,n=0,o=null;for(t=0;t>>8^t[255&(r^e.readUInt8(n))]}return(-1^r)>>>0},hmac:function(e,t,r,n){return r||(r="binary"),"buffer"===r&&(r=void 0),n||(n="sha256"),"string"==typeof t&&(t=new i.Buffer(t)),i.crypto.lib.createHmac(n,e).update(t).digest(r)},md5:function(e,t,r){return i.crypto.hash("md5",e,t,r)},sha256:function(e,t,r){return i.crypto.hash("sha256",e,t,r)},hash:function(e,t,r,n){var o=i.crypto.createHash(e);r||(r="binary"),"buffer"===r&&(r=void 0),"string"==typeof t&&(t=new i.Buffer(t));var s=i.arraySliceFn(t),a=i.Buffer.isBuffer(t);if(i.isBrowser()&&"undefined"!=typeof ArrayBuffer&&t&&t.buffer instanceof ArrayBuffer&&(a=!0),n&&"object"==typeof t&&"function"==typeof t.on&&!a)t.on("data",function(e){o.update(e)}),t.on("error",function(e){n(e)}),t.on("end",function(){n(null,o.digest(r))});else{if(!n||!s||a||"undefined"==typeof FileReader){i.isBrowser()&&"object"==typeof t&&!a&&(t=new i.Buffer(new Uint8Array(t)));var u=o.update(t).digest(r);return n&&n(null,u),u}var c=0,l=new FileReader;l.onerror=function(){n(new Error("Failed to read data."))},l.onload=function(){var e=new i.Buffer(new Uint8Array(l.result));o.update(e),c+=e.length,l._continueReading()},l._continueReading=function(){if(c>=t.size)return void n(null,o.digest(r));var e=c+524288;e>t.size&&(e=t.size),l.readAsArrayBuffer(s.call(t,c,e))},l._continueReading()}},toHex:function(e){for(var t=[],r=0;r=3e5,!1),n.config.isClockSkewed},applyClockOffset:function(e){e&&(n.config.systemClockOffset=e-(new Date).getTime())},extractRequestId:function(e){var t=e.httpResponse.headers["x-amz-request-id"]||e.httpResponse.headers["x-amzn-requestid"];!t&&e.data&&e.data.ResponseMetadata&&(t=e.data.ResponseMetadata.RequestId),t&&(e.requestId=t),e.error&&(e.error.requestId=t)},addPromises:function(e,t){if(void 0===t&&n&&n.config&&(t=n.config.getPromisesDependency()),void 0===t&&"undefined"!=typeof Promise&&(t=Promise),"function"!=typeof t)var r=!0;Array.isArray(e)||(e=[e]);for(var i=0;i=500||429===n});o&&s.retryable&&(s.retryAfter=o),u(s)}})},u)};n.util.defer(c)},uuid:{v4:function(){return e("uuid").v4()}},convertPayloadToString:function(e){var t=e.request,r=t.operation,n=t.service.api.operations[r].output||{};n.payload&&e.data[n.payload]&&(e.data[n.payload]=e.data[n.payload].toString())},defer:function(e){"object"==typeof r&&"function"==typeof r.nextTick?r.nextTick(e):"function"==typeof setImmediate?setImmediate(e):setTimeout(e,0)},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};t.exports=i}).call(this,e("_process"))},{"../apis/metadata.json":182,"./core":194,_process:148,fs:2,uuid:160}],193:[function(e,t,r){var n=e("./core");e("./credentials"),e("./credentials/credential_provider_chain");var i;n.Config=n.util.inherit({constructor:function(e){void 0===e&&(e={}),e=this.extractCredentials(e),n.util.each.call(this,this.keys,function(t,r){this.set(t,e[t],r)})},getCredentials:function(e){function t(t){e(t,t?null:i.credentials)}function r(e,t){return new n.util.error(t||new Error,{code:"CredentialsError",message:e,name:"CredentialsError"})}var i=this;i.credentials?"function"==typeof i.credentials.get?function(){i.credentials.get(function(e){e&&(e=r("Could not load credentials from "+i.credentials.constructor.name,e)),t(e)})}():function(){var e=null;i.credentials.accessKeyId&&i.credentials.secretAccessKey||(e=r("Missing credentials")),t(e)}():i.credentialProvider?i.credentialProvider.resolve(function(e,n){e&&(e=r("Could not load credentials from any providers",e)),i.credentials=n,t(e)}):t(r("No credentials to load"))},update:function(e,t){t=t||!1,e=this.extractCredentials(e),n.util.each.call(this,e,function(e,r){(t||Object.prototype.hasOwnProperty.call(this.keys,e)||n.Service.hasService(e))&&this.set(e,r)})},loadFromPath:function(e){this.clear();var t=JSON.parse(n.util.readFileSync(e)),r=new n.FileSystemCredentials(e),i=new n.CredentialProviderChain;return i.providers.unshift(r),i.resolve(function(e,r){if(e)throw e;t.credentials=r}),this.constructor(t),this},clear:function(){n.util.each.call(this,this.keys,function(e){delete this[e]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(e,t,r){void 0===t?(void 0===r&&(r=this.keys[e]),this[e]="function"==typeof r?r.call(this):r):"httpOptions"===e&&this[e]?this[e]=n.util.merge(this[e],t):this[e]=t},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,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0,retryDelayOptions:{},useAccelerateEndpoint:!1},extractCredentials:function(e){return e.accessKeyId&&e.secretAccessKey&&(e=n.util.copy(e),e.credentials=new n.Credentials(e)),e},setPromisesDependency:function(e){i=e,null===e&&"function"==typeof Promise&&(i=Promise);var t=[n.Request,n.Credentials,n.CredentialProviderChain];n.S3&&n.S3.ManagedUpload&&t.push(n.S3.ManagedUpload),n.util.addPromises(t,i)},getPromisesDependency:function(){return i}}),n.config=new n.Config},{"./core":194,"./credentials":195,"./credentials/credential_provider_chain":197}],197:[function(e,t,r){var n=e("../core");n.CredentialProviderChain=n.util.inherit(n.Credentials,{constructor:function(e){this.providers=e||n.CredentialProviderChain.defaultProviders.slice(0)},resolve:function(e){function t(i,o){if(!i&&o||r===n.length)return void e(i,o);var s=n[r++];o="function"==typeof s?s.call():s,o.get?o.get(function(e){t(e,e?null:o)}):t(null,o)}if(0===this.providers.length)return e(new Error("No providers")),this;var r=0,n=this.providers.slice(0);return t(),this}}),n.CredentialProviderChain.defaultProviders=[],n.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=n.util.promisifyMethod("resolve",e)},n.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},n.util.addPromises(n.CredentialProviderChain)},{"../core":194}],195:[function(e,t,r){var n=e("./core");n.Credentials=n.util.inherit({constructor:function(){if(n.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,1===arguments.length&&"object"==typeof arguments[0]){var e=arguments[0].credentials||arguments[0];this.accessKeyId=e.accessKeyId,this.secretAccessKey=e.secretAccessKey,this.sessionToken=e.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var e=n.util.date.getDate().getTime(),t=new Date(e+1e3*this.expiryWindow);return!!(this.expireTime&&t>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(e){var t=this;this.needsRefresh()?this.refresh(function(r){r||(t.expired=!1),e&&e(r)}):e&&e()},refresh:function(e){this.expired=!1,e()}}),n.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=n.util.promisifyMethod("get",e),this.prototype.refreshPromise=n.util.promisifyMethod("refresh",e)},n.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},n.util.addPromises(n.Credentials)},{"./core":194}],183:[function(e,t,r){function n(e,t){if(!n.services.hasOwnProperty(e))throw new Error("InvalidService: Failed to load api for "+e);return n.services[e][t]}n.services={},t.exports=n},{}],182:[function(e,t,r){t.exports={acm:{name:"ACM",cors:!0},apigateway:{name:"APIGateway",cors:!0},applicationautoscaling:{prefix:"application-autoscaling",name:"ApplicationAutoScaling",cors:!0},appstream:{name:"AppStream"},autoscaling:{name:"AutoScaling",cors:!0},batch:{name:"Batch"},budgets:{name:"Budgets"},clouddirectory:{name:"CloudDirectory"},cloudformation:{name:"CloudFormation",cors:!0},cloudfront:{name:"CloudFront",versions:["2013-05-12*","2013-11-11*","2014-05-31*","2014-10-21*","2014-11-06*","2015-04-17*","2015-07-27*","2015-09-17*","2016-01-13*","2016-01-28*","2016-08-01*","2016-08-20*","2016-09-07*","2016-09-29*","2016-11-25*"],cors:!0},cloudhsm:{name:"CloudHSM",cors:!0},cloudsearch:{name:"CloudSearch"},cloudsearchdomain:{name:"CloudSearchDomain"},cloudtrail:{name:"CloudTrail",cors:!0},cloudwatch:{prefix:"monitoring",name:"CloudWatch",cors:!0},cloudwatchevents:{prefix:"events",name:"CloudWatchEvents",versions:["2014-02-03*"],cors:!0},cloudwatchlogs:{prefix:"logs",name:"CloudWatchLogs",cors:!0},codebuild:{name:"CodeBuild"},codecommit:{name:"CodeCommit",cors:!0},codedeploy:{name:"CodeDeploy",cors:!0},codepipeline:{name:"CodePipeline",cors:!0},cognitoidentity:{prefix:"cognito-identity",name:"CognitoIdentity",cors:!0},cognitoidentityserviceprovider:{prefix:"cognito-idp",name:"CognitoIdentityServiceProvider",cors:!0},cognitosync:{prefix:"cognito-sync",name:"CognitoSync",cors:!0},configservice:{prefix:"config",name:"ConfigService",cors:!0},cur:{name:"CUR",cors:!0},datapipeline:{name:"DataPipeline"},devicefarm:{name:"DeviceFarm",cors:!0},directconnect:{name:"DirectConnect",cors:!0},directoryservice:{prefix:"ds",name:"DirectoryService"},discovery:{name:"Discovery"},dms:{name:"DMS"},dynamodb:{name:"DynamoDB",cors:!0},dynamodbstreams:{prefix:"streams.dynamodb",name:"DynamoDBStreams",cors:!0},ec2:{name:"EC2",versions:["2013-06-15*","2013-10-15*","2014-02-01*","2014-05-01*","2014-06-15*","2014-09-01*","2014-10-01*","2015-03-01*","2015-04-15*","2015-10-01*","2016-04-01*","2016-09-15*"],cors:!0},ecr:{name:"ECR",cors:!0},ecs:{name:"ECS",cors:!0},efs:{prefix:"elasticfilesystem",name:"EFS",cors:!0},elasticache:{name:"ElastiCache",versions:["2012-11-15*","2014-03-24*","2014-07-15*","2014-09-30*"],cors:!0},elasticbeanstalk:{name:"ElasticBeanstalk",cors:!0},elb:{prefix:"elasticloadbalancing",name:"ELB",cors:!0},elbv2:{prefix:"elasticloadbalancingv2",name:"ELBv2",cors:!0},emr:{prefix:"elasticmapreduce",name:"EMR",cors:!0},es:{name:"ES"},elastictranscoder:{name:"ElasticTranscoder",cors:!0},firehose:{name:"Firehose",cors:!0},gamelift:{name:"GameLift",cors:!0},glacier:{name:"Glacier"},health:{name:"Health"},iam:{name:"IAM"},importexport:{name:"ImportExport"},inspector:{name:"Inspector",versions:["2015-08-18*"],cors:!0},iot:{name:"Iot",cors:!0},iotdata:{prefix:"iot-data",name:"IotData",cors:!0},kinesis:{name:"Kinesis",cors:!0},kinesisanalytics:{name:"KinesisAnalytics"},kms:{name:"KMS",cors:!0},lambda:{name:"Lambda",cors:!0},lexruntime:{prefix:"runtime.lex",name:"LexRuntime",cors:!0},lightsail:{name:"Lightsail"},machinelearning:{name:"MachineLearning",cors:!0},marketplacecommerceanalytics:{name:"MarketplaceCommerceAnalytics",cors:!0},marketplacemetering:{prefix:"meteringmarketplace",name:"MarketplaceMetering"},mturk:{prefix:"mturk-requester",name:"MTurk",cors:!0},mobileanalytics:{name:"MobileAnalytics",cors:!0},opsworks:{name:"OpsWorks",cors:!0},opsworkscm:{name:"OpsWorksCM"},organizations:{name:"Organizations"},pinpoint:{name:"Pinpoint"},polly:{name:"Polly",cors:!0},rds:{name:"RDS",versions:["2014-09-01*"],cors:!0},redshift:{name:"Redshift",cors:!0},rekognition:{name:"Rekognition",cors:!0},resourcegroupstaggingapi:{name:"ResourceGroupsTaggingAPI"},route53:{name:"Route53",cors:!0},route53domains:{name:"Route53Domains",cors:!0},s3:{name:"S3",dualstackAvailable:!0,cors:!0},servicecatalog:{name:"ServiceCatalog",cors:!0},ses:{prefix:"email",name:"SES",cors:!0},shield:{name:"Shield"},simpledb:{prefix:"sdb",name:"SimpleDB"},sms:{name:"SMS"},snowball:{name:"Snowball"},sns:{name:"SNS",cors:!0},sqs:{name:"SQS",cors:!0},ssm:{name:"SSM",cors:!0},storagegateway:{name:"StorageGateway",cors:!0},stepfunctions:{prefix:"states",name:"StepFunctions"},sts:{name:"STS",cors:!0},support:{name:"Support"},swf:{name:"SWF"},xray:{name:"XRay"},waf:{name:"WAF",cors:!0},wafregional:{prefix:"waf-regional",name:"WAFRegional"},workdocs:{name:"WorkDocs",cors:!0},workspaces:{name:"WorkSpaces"},codestar:{name:"CodeStar"}, +lexmodelbuildingservice:{prefix:"lex-models",name:"LexModelBuildingService",cors:!0},marketplaceentitlementservice:{prefix:"entitlement.marketplace",name:"MarketplaceEntitlementService"},athena:{name:"Athena"},greengrass:{name:"Greengrass"},dax:{name:"DAX"},migrationhub:{prefix:"AWSMigrationHub",name:"MigrationHub"},cloudhsmv2:{name:"CloudHSMV2"},glue:{name:"Glue"},mobile:{name:"Mobile"},pricing:{name:"Pricing"},costexplorer:{prefix:"ce",name:"CostExplorer"},mediaconvert:{name:"MediaConvert"},medialive:{name:"MediaLive"},mediapackage:{name:"MediaPackage"},mediastore:{name:"MediaStore"},mediastoredata:{prefix:"mediastore-data",name:"MediaStoreData"},appsync:{name:"AppSync"},guardduty:{name:"GuardDuty"},mq:{name:"MQ"},comprehend:{name:"Comprehend"},iotjobsdataplane:{prefix:"iot-jobs-data",name:"IoTJobsDataPlane"},kinesisvideoarchivedmedia:{prefix:"kinesis-video-archived-media",name:"KinesisVideoArchivedMedia"},kinesisvideomedia:{prefix:"kinesis-video-media",name:"KinesisVideoMedia"},kinesisvideo:{name:"KinesisVideo"},sagemakerruntime:{prefix:"runtime.sagemaker",name:"SageMakerRuntime"},sagemaker:{name:"SageMaker"},translate:{name:"Translate"},resourcegroups:{prefix:"resource-groups",name:"ResourceGroups"},alexaforbusiness:{name:"AlexaForBusiness"},cloud9:{name:"Cloud9"},serverlessapplicationrepository:{prefix:"serverlessrepo",name:"ServerlessApplicationRepository"},servicediscovery:{name:"ServiceDiscovery"},workmail:{name:"WorkMail"},autoscalingplans:{prefix:"autoscaling-plans",name:"AutoScalingPlans"},transcribeservice:{prefix:"transcribe",name:"TranscribeService"}}},{}],181:[function(e,t,r){(function(){var r,n;n=e("lodash/assign"),r=e("./XMLBuilder"),t.exports.create=function(e,t,i,o){return o=n({},t,i,o),new r(e,o).root()}}).call(this)},{"./XMLBuilder":166,"lodash/assign":123}],166:[function(e,t,r){(function(){var r,n;n=e("./XMLStringifier"),e("./XMLDeclaration"),e("./XMLDocType"),r=e("./XMLElement"),t.exports=function(){function e(e,t){var i,o;if(null==e)throw new Error("Root element needs a name");null==t&&(t={}),this.options=t,this.stringify=new n(t),o=new r(this,"doc"),i=o.element(e),i.isRoot=!0,i.documentObject=this,this.rootObject=i,t.headless||(i.declaration(t),null==t.pubID&&null==t.sysID||i.doctype(t))}return e.prototype.root=function(){return this.rootObject},e.prototype.end=function(e){return this.toString(e)},e.prototype.toString=function(e){var t,r,n,i,o,s;return r=(null!=e?e.pretty:void 0)||!1,null!=(i=null!=e?e.indent:void 0)?i:" ",null!=(o=null!=e?e.offset:void 0)?o:0,t=null!=(s=null!=e?e.newline:void 0)?s:"\n",n="",null!=this.xmldec&&(n+=this.xmldec.toString(e)),null!=this.doctype&&(n+=this.doctype.toString(e)),n+=this.rootObject.toString(e),r&&n.slice(-t.length)===t&&(n=n.slice(0,-t.length)),n},e}()}).call(this)},{"./XMLDeclaration":173,"./XMLDocType":174,"./XMLElement":175,"./XMLStringifier":179}],179:[function(e,t,r){(function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},r={}.hasOwnProperty;t.exports=function(){function t(t){this.assertLegalChar=e(this.assertLegalChar,this);var n,i,o;this.allowSurrogateChars=null!=t?t.allowSurrogateChars:void 0,this.noDoubleEncoding=null!=t?t.noDoubleEncoding:void 0,i=(null!=t?t.stringify:void 0)||{};for(n in i)r.call(i,n)&&(o=i[n],this[n]=o)}return t.prototype.eleName=function(e){return e=""+e||"",this.assertLegalChar(e)},t.prototype.eleText=function(e){return e=""+e||"",this.assertLegalChar(this.elEscape(e))},t.prototype.cdata=function(e){if(e=""+e||"",e.match(/]]>/))throw new Error("Invalid CDATA text: "+e);return this.assertLegalChar(e)},t.prototype.comment=function(e){if(e=""+e||"",e.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+e);return this.assertLegalChar(e)},t.prototype.raw=function(e){return""+e||""},t.prototype.attName=function(e){return""+e||""},t.prototype.attValue=function(e){return e=""+e||"",this.attEscape(e)},t.prototype.insTarget=function(e){return""+e||""},t.prototype.insValue=function(e){if(e=""+e||"",e.match(/\?>/))throw new Error("Invalid processing instruction value: "+e);return e},t.prototype.xmlVersion=function(e){if(e=""+e||"",!e.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+e);return e},t.prototype.xmlEncoding=function(e){if(e=""+e||"",!e.match(/^[A-Za-z](?:[A-Za-z0-9._-]|-)*$/))throw new Error("Invalid encoding: "+e);return e},t.prototype.xmlStandalone=function(e){return e?"yes":"no"},t.prototype.dtdPubID=function(e){return""+e||""},t.prototype.dtdSysID=function(e){return""+e||""},t.prototype.dtdElementValue=function(e){return""+e||""},t.prototype.dtdAttType=function(e){return""+e||""},t.prototype.dtdAttDefault=function(e){return null!=e?""+e||"":e},t.prototype.dtdEntityValue=function(e){return""+e||""},t.prototype.dtdNData=function(e){return""+e||""},t.prototype.convertAttKey="@",t.prototype.convertPIKey="?",t.prototype.convertTextKey="#text",t.prototype.convertCDataKey="#cdata",t.prototype.convertCommentKey="#comment",t.prototype.convertRawKey="#raw",t.prototype.assertLegalChar=function(e){var t,r;if(t=this.allowSurrogateChars?/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/:/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/,r=e.match(t))throw new Error("Invalid character ("+r+") in string: "+e+" at index "+r.index);return e},t.prototype.elEscape=function(e){var t;return t=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,e.replace(t,"&").replace(//g,">").replace(/\r/g," ")},t.prototype.attEscape=function(e){var t;return t=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,e.replace(t,"&").replace(/",y&&(v+=p);else if(y&&1===this.children.length&&null!=this.children[0].value)v+=">",v+=this.children[0].value,v+="",v+=p;else{for(v+=">",y&&(v+=p),x=this.children,u=0,h=x.length;u",y&&(v+=p)}return v},t.prototype.att=function(e,t){return this.attribute(e,t)},t.prototype.ins=function(e,t){return this.instruction(e,t)},t.prototype.a=function(e,t){return this.attribute(e,t)},t.prototype.i=function(e,t){return this.instruction(e,t)},t}(n)}).call(this)},{"./XMLAttribute":165,"./XMLNode":176,"./XMLProcessingInstruction":177,"lodash/create":125,"lodash/every":127,"lodash/isFunction":136,"lodash/isObject":138}],174:[function(e,t,r){(function(){var r,n,i,o,s,a,u,c;e("lodash/create"),c=e("lodash/isObject"),r=e("./XMLCData"),n=e("./XMLComment"),i=e("./XMLDTDAttList"),s=e("./XMLDTDEntity"),o=e("./XMLDTDElement"),a=e("./XMLDTDNotation"),u=e("./XMLProcessingInstruction"),t.exports=function(){function e(e,t,r){var n,i;this.documentObject=e,this.stringify=this.documentObject.stringify,this.children=[],c(t)&&(n=t,t=n.pubID,r=n.sysID),null==r&&(i=[t,r],r=i[0],t=i[1]),null!=t&&(this.pubID=this.stringify.dtdPubID(t)),null!=r&&(this.sysID=this.stringify.dtdSysID(r))}return e.prototype.element=function(e,t){var r;return r=new o(this,e,t),this.children.push(r),this},e.prototype.attList=function(e,t,r,n,o){var s;return s=new i(this,e,t,r,n,o),this.children.push(s),this},e.prototype.entity=function(e,t){var r;return r=new s(this,!1,e,t),this.children.push(r),this},e.prototype.pEntity=function(e,t){var r;return r=new s(this,!0,e,t),this.children.push(r),this},e.prototype.notation=function(e,t){var r;return r=new a(this,e,t),this.children.push(r),this},e.prototype.cdata=function(e){var t;return t=new r(this,e),this.children.push(t),this},e.prototype.comment=function(e){var t;return t=new n(this,e),this.children.push(t),this},e.prototype.instruction=function(e,t){var r;return r=new u(this,e,t),this.children.push(r),this},e.prototype.root=function(){return this.documentObject.root()},e.prototype.document=function(){return this.documentObject},e.prototype.toString=function(e,t){var r,n,i,o,s,a,u,c,l,h,f,p,d;if(u=(null!=e?e.pretty:void 0)||!1,i=null!=(l=null!=e?e.indent:void 0)?l:" ",a=null!=(h=null!=e?e.offset:void 0)?h:0,s=null!=(f=null!=e?e.newline:void 0)?f:"\n",t||(t=0),d=new Array(t+a+1).join(i),c="",u&&(c+=d),c+="0){for(c+=" [",u&&(c+=s),p=this.children,n=0,o=p.length;n",o&&(s+=n),s},e}()}).call(this)},{"lodash/create":125}],169:[function(e,t,r){(function(){e("lodash/create"),t.exports=function(){function e(e,t,r,n,i,o){if(this.stringify=e.stringify,null==t)throw new Error("Missing DTD element name");if(null==r)throw new Error("Missing DTD attribute name");if(!n)throw new Error("Missing DTD attribute type");if(!i)throw new Error("Missing DTD attribute default");if(0!==i.indexOf("#")&&(i="#"+i),!i.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");if(o&&!i.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT");this.elementName=this.stringify.eleName(t),this.attributeName=this.stringify.attName(r),this.attributeType=this.stringify.dtdAttType(n),this.defaultValue=this.stringify.dtdAttDefault(o),this.defaultValueType=i}return e.prototype.toString=function(e,t){var r,n,i,o,s,a,u,c,l;return o=(null!=e?e.pretty:void 0)||!1,r=null!=(a=null!=e?e.indent:void 0)?a:" ",i=null!=(u=null!=e?e.offset:void 0)?u:0,n=null!=(c=null!=e?e.newline:void 0)?c:"\n",t||(t=0),l=new Array(t+i+1).join(r),s="",o&&(s+=l),s+="",o&&(s+=n),s},e}()}).call(this)},{"lodash/create":125}],168:[function(e,t,r){(function(){var r,n,i=function(e,t){function r(){this.constructor=e}for(var n in t)o.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},o={}.hasOwnProperty;n=e("lodash/create"),r=e("./XMLNode"),t.exports=function(e){function t(e,r){if(t.__super__.constructor.call(this,e),null==r)throw new Error("Missing comment text");this.text=this.stringify.comment(r)}return i(t,e),t.prototype.clone=function(){return n(t.prototype,this)},t.prototype.toString=function(e,t){var r,n,i,o,s,a,u,c,l;return o=(null!=e?e.pretty:void 0)||!1,r=null!=(a=null!=e?e.indent:void 0)?a:" ",i=null!=(u=null!=e?e.offset:void 0)?u:0,n=null!=(c=null!=e?e.newline:void 0)?c:"\n",t||(t=0),l=new Array(t+i+1).join(r),s="",o&&(s+=l),s+="\x3c!-- "+this.text+" --\x3e",o&&(s+=n),s},t}(r)}).call(this)},{"./XMLNode":176,"lodash/create":125}],167:[function(e,t,r){(function(){var r,n,i=function(e,t){function r(){this.constructor=e}for(var n in t)o.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},o={}.hasOwnProperty;n=e("lodash/create"),r=e("./XMLNode"),t.exports=function(e){function t(e,r){if(t.__super__.constructor.call(this,e),null==r)throw new Error("Missing CDATA text");this.text=this.stringify.cdata(r)}return i(t,e),t.prototype.clone=function(){return n(t.prototype,this)},t.prototype.toString=function(e,t){var r,n,i,o,s,a,u,c,l;return o=(null!=e?e.pretty:void 0)||!1,r=null!=(a=null!=e?e.indent:void 0)?a:" ",i=null!=(u=null!=e?e.offset:void 0)?u:0,n=null!=(c=null!=e?e.newline:void 0)?c:"\n",t||(t=0),l=new Array(t+i+1).join(r),s="",o&&(s+=l),s+="",o&&(s+=n),s},t}(r)}).call(this)},{"./XMLNode":176,"lodash/create":125}],165:[function(e,t,r){(function(){var r;r=e("lodash/create"),t.exports=function(){function e(e,t,r){if(this.stringify=e.stringify,null==t)throw new Error("Missing attribute name of element "+e.name);if(null==r)throw new Error("Missing attribute value for attribute "+t+" of element "+e.name);this.name=this.stringify.attName(t),this.value=this.stringify.attValue(r)}return e.prototype.clone=function(){return r(e.prototype,this)},e.prototype.toString=function(e,t){return" "+this.name+'="'+this.value+'"'},e}()}).call(this)},{"lodash/create":125}],160:[function(e,t,r){var n=e("./v1"),i=e("./v4"),o=i;o.v1=n,o.v4=i,t.exports=o},{"./v1":163,"./v4":164}],164:[function(e,t,r){function n(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[n+a]=s[a];return t||o(s)}var i=e("./lib/rng"),o=e("./lib/bytesToUuid");t.exports=n},{"./lib/bytesToUuid":161,"./lib/rng":162}],163:[function(e,t,r){function n(e,t,r){var n=t&&r||0,i=t||[];e=e||{};var s=void 0!==e.clockseq?e.clockseq:u,h=void 0!==e.msecs?e.msecs:(new Date).getTime(),f=void 0!==e.nsecs?e.nsecs:l+1,p=h-c+(f-l)/1e4;if(p<0&&void 0===e.clockseq&&(s=s+1&16383),(p<0||h>c)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,l=f,u=s,h+=122192928e5;var d=(1e4*(268435455&h)+f)%4294967296;i[n++]=d>>>24&255,i[n++]=d>>>16&255,i[n++]=d>>>8&255,i[n++]=255&d;var y=h/4294967296*1e4&268435455;i[n++]=y>>>8&255,i[n++]=255&y,i[n++]=y>>>24&15|16,i[n++]=y>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var v=e.node||a,m=0;m<6;++m)i[n+m]=v[m];return t||o(i)}var i=e("./lib/rng"),o=e("./lib/bytesToUuid"),s=i(),a=[1|s[0],s[1],s[2],s[3],s[4],s[5]],u=16383&(s[6]<<8|s[7]),c=0,l=0;t.exports=n},{"./lib/bytesToUuid":161,"./lib/rng":162}],162:[function(e,t,r){(function(e){var r,n=e.crypto||e.msCrypto;if(n&&n.getRandomValues){var i=new Uint8Array(16);r=function(){return n.getRandomValues(i),i}}if(!r){var o=new Array(16);r=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],161:[function(e,t,r){function n(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}for(var i=[],o=0;o<256;++o)i[o]=(o+256).toString(16).substr(1);t.exports=n},{}],159:[function(e,t,r){(function(t,n){function i(e,t){var n={seen:[],stylize:s};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(t)?n.showHidden=t:t&&r._extend(n,t),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),u(n,e,n.depth)}function o(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function s(e,t){return e}function a(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function u(e,t,n){if(e.customInspect&&t&&C(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return b(i)||(i=u(e,i,n)),i}var o=c(e,t);if(o)return o;var s=Object.keys(t),y=a(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),A(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(t);if(0===s.length){if(C(t)){var v=t.name?": "+t.name:"";return e.stylize("[Function"+v+"]","special")}if(x(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(A(t))return l(t)}var m="",g=!1,_=["{","}"];if(d(t)&&(g=!0,_=["[","]"]),C(t)){m=" [Function"+(t.name?": "+t.name:"")+"]"}if(x(t)&&(m=" "+RegExp.prototype.toString.call(t)),S(t)&&(m=" "+Date.prototype.toUTCString.call(t)),A(t)&&(m=" "+l(t)),0===s.length&&(!g||0==t.length))return _[0]+m+_[1];if(n<0)return x(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var w;return w=g?h(e,t,n,y,s):s.map(function(r){return f(e,t,n,y,r,g)}),e.seen.pop(),p(w,m,_)}function c(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return g(t)?e.stylize(""+t,"number"):y(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),w(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e,t,r){var n=0;return e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function d(e){return Array.isArray(e)}function y(e){return"boolean"==typeof e}function v(e){return null===e}function m(e){return null==e}function g(e){return"number"==typeof e}function b(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function w(e){return void 0===e}function x(e){return E(e)&&"[object RegExp]"===R(e)}function E(e){return"object"==typeof e&&null!==e}function S(e){return E(e)&&"[object Date]"===R(e)}function A(e){return E(e)&&("[object Error]"===R(e)||e instanceof Error)}function C(e){return"function"==typeof e}function T(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function R(e){return Object.prototype.toString.call(e)}function I(e){return e<10?"0"+e.toString(10):e.toString(10)}function L(){var e=new Date,t=[I(e.getHours()),I(e.getMinutes()),I(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var k=/%[sdj%]/g;r.format=function(e){if(!b(e)){for(var t=[],r=0;r=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),a=n[r];r1)for(var r=1;r1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=e.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),t=Object(t);++n0){if(++t>=i)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var i=800,o=16,s=Date.now;t.exports=n},{}],53:[function(e,t,r){var n=e("./constant"),i=e("./_defineProperty"),o=e("./identity"),s=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:o;t.exports=s},{"./_defineProperty":64,"./constant":124,"./identity":130}],124:[function(e,t,r){function n(e){return function(){return e}}t.exports=n},{}],108:[function(e,t,r){function n(e,t,r){return t=o(void 0===t?e.length-1:t,0),function(){for(var n=arguments,s=-1,a=o(n.length-t,0),u=Array(a);++sf))return!1;var d=l.get(e);if(d&&l.get(t))return d==t;var y=-1,v=!0,m=r&u?new i:void 0;for(l.set(e,t),l.set(t,e);++y-1&&e%1==0&&e<=i}var i=9007199254740991;t.exports=n},{}],134:[function(e,t,r){var n=e("./_root"),i=e("./stubFalse"),o="object"==typeof r&&r&&!r.nodeType&&r,s=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=s&&s.exports===o,u=a?n.Buffer:void 0,c=u?u.isBuffer:void 0,l=c||i;t.exports=l},{"./_root":109,"./stubFalse":146}],146:[function(e,t,r){function n(){return!1}t.exports=n},{}],132:[function(e,t,r){var n=Array.isArray;t.exports=n},{}],131:[function(e,t,r){var n=e("./_baseIsArguments"),i=e("./isObjectLike"),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return i(e)&&s.call(e,"callee")&&!a.call(e,"callee")};t.exports=u},{"./_baseIsArguments":40,"./isObjectLike":139}],40:[function(e,t,r){function n(e){return o(e)&&i(e)==s}var i=e("./_baseGetTag"),o=e("./isObjectLike"),s="[object Arguments]";t.exports=n},{"./_baseGetTag":38,"./isObjectLike":139}],139:[function(e,t,r){function n(e){return null!=e&&"object"==typeof e}t.exports=n},{}],83:[function(e,t,r){function n(e,t){var r=typeof e;return!!(t=null==t?i:t)&&("number"==r||"symbol"!=r&&o.test(e))&&e>-1&&e%1==0&&e-1}var i=e("./_assocIndexOf");t.exports=n},{"./_assocIndexOf":28}],92:[function(e,t,r){function n(e){var t=this.__data__,r=i(t,e);return r<0?void 0:t[r][1]}var i=e("./_assocIndexOf");t.exports=n},{"./_assocIndexOf":28}],91:[function(e,t,r){function n(e){var t=this.__data__,r=i(t,e);return!(r<0)&&(r==t.length-1?t.pop():s.call(t,r,1),--this.size,!0)}var i=e("./_assocIndexOf"),o=Array.prototype,s=o.splice;t.exports=n},{"./_assocIndexOf":28}],28:[function(e,t,r){function n(e,t){for(var r=e.length;r--;)if(i(e[r][0],t))return r;return-1}var i=e("./eq");t.exports=n},{"./eq":126}],126:[function(e,t,r){function n(e,t){return e===t||e!==e&&t!==t}t.exports=n},{}],90:[function(e,t,r){function n(){this.__data__=[],this.size=0}t.exports=n},{}],9:[function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e}function a(e){return e>="0"&&e<="9"||"-"===e}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e}function c(){}function l(){}function h(e){this.runtime=e}function f(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[m]}]},avg:{_func:this._functionAvg,_signature:[{types:[E]}]},ceil:{_func:this._functionCeil,_signature:[{types:[m]}]},contains:{_func:this._functionContains,_signature:[{types:[b,_]},{types:[g]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[b]},{types:[b]}]},floor:{_func:this._functionFloor,_signature:[{types:[m]}]},length:{_func:this._functionLength,_signature:[{types:[b,_,w]}]},map:{_func:this._functionMap,_signature:[{types:[x]},{types:[_]}]},max:{_func:this._functionMax,_signature:[{types:[E,S]}]},merge:{_func:this._functionMerge,_signature:[{types:[w],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[_]},{types:[x]}]},sum:{_func:this._functionSum,_signature:[{types:[E]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[b]},{types:[b]}]},min:{_func:this._functionMin,_signature:[{types:[E,S]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[_]},{types:[x]}]},type:{_func:this._functionType,_signature:[{types:[g]}]},keys:{_func:this._functionKeys,_signature:[{types:[w]}]},values:{_func:this._functionValues,_signature:[{types:[w]}]},sort:{_func:this._functionSort,_signature:[{types:[S,E]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[_]},{types:[x]}]},join:{_func:this._functionJoin,_signature:[{types:[b]},{types:[S]}]},reverse:{_func:this._functionReverse,_signature:[{types:[b,_]}]},to_array:{_func:this._functionToArray,_signature:[{types:[g]}]},to_string:{_func:this._functionToString,_signature:[{types:[g]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[g]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[g],variadic:!0}]}}}function p(e){return(new l).parse(e)}function d(e){return(new c).tokenize(e)}function y(e,t){var r=new l,n=new f,i=new h(n);n._interpreter=i;var o=r.parse(t);return i.search(o,e)}var v;v="function"==typeof String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.match(/^\s*(.*)/)[1]};var m=0,g=1,b=2,_=3,w=4,x=6,E=8,S=9,A={".":"Dot","*":"Star",",":"Comma",":":"Colon","{":"Lbrace","}":"Rbrace","]":"Rbracket","(":"Lparen",")":"Rparen","@":"Current"},C={"<":!0,">":!0,"=":!0,"!":!0},T={" ":!0,"\t":!0,"\n":!0};c.prototype={tokenize:function(e){var t=[];this._current=0;for(var r,n,i;this._current"===r?"="===e[this._current]?(this._current++,{type:"GTE",value:">=",start:t}):{type:"GT",value:">",start:t}:"="===r&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,r=this._current,n=e.length;"`"!==e[this._current]&&this._current=0)return!0;if(r.indexOf(e)>=0)return!0;if(!(n.indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var R={};R.EOF=0,R.UnquotedIdentifier=0,R.QuotedIdentifier=0,R.Rbracket=0,R.Rparen=0,R.Comma=0,R.Rbrace=0,R.Number=0,R.Current=0,R.Expref=0,R.Pipe=1,R.Or=2,R.And=3,R.EQ=5,R.GT=5,R.LT=5,R.GTE=5,R.LTE=5,R.NE=5,R.Flatten=9,R.Star=20,R.Filter=21,R.Dot=40,R.Not=45,R.Lbrace=50,R.Lbracket=55,R.Lparen=60,l.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if("EOF"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Unexpected token type: "+r.type+", value: "+r.value);throw n.name="ParserError",n}return t},_loadTokens:function(e){var t=new c,r=t.tokenize(e);r.push({type:"EOF",value:"",start:e.length}),this.tokens=r},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var r=this.nud(t),n=this._lookahead(0);e=0?this.expression(e):"Lbracket"===t?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===t?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(R[this._lookahead(0)]<10)t={type:"Identity"};else if("Lbracket"===this._lookahead(0))t=this.expression(e);else if("Filter"===this._lookahead(0))t=this.expression(e);else{if("Dot"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+r.value+"("+r.type+")");throw n.name="ParserError",n}this._match("Dot"),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];"Rbracket"!==this._lookahead(0);){var t=this.expression(0);if(e.push(t),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,r,n,i=[],o=["UnquotedIdentifier","QuotedIdentifier"];;){if(e=this._lookaheadToken(0),o.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match("Colon"),r=this.expression(0),n={type:"KeyValuePair",name:t,value:r},i.push(n),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:i}}},h.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,s){var a,u,c,l,h,f,p,d,y;switch(e.type){case"Field":return null===s?null:r(s)?(f=s[e.name],void 0===f?null:f):null;case"Subexpression":for(c=this.visit(e.children[0],s),y=1;y0)for(y=b;y<_;y+=w)c.push(s[y]);else for(y=b;y>_;y+=w)c.push(s[y]);return c;case"Projection":var x=this.visit(e.children[0],s);if(!t(x))return null;for(d=[],y=0;yh;break;case"GTE":c=l>=h;break;case"LT":c=l=e&&(t=r<0?e-1:e),t}},f.prototype={callFunction:function(e,t){var r=this.functionTable[e];if(void 0===r)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,r._signature),r._func.call(this,t)},_validateArgs:function(e,t,r){var n;if(r[r.length-1].variadic){if(t.length=0;n--)r+=t[n];return r}var i=e[0].slice(0);return i.reverse(),i},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,r=e[0],n=0;n=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return r(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],r=this._interpreter,n=e[0],i=e[1],o=0;o0){if(this._getTypeName(e[0][0])===m)return Math.max.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;n0){if(this._getTypeName(e[0][0])===m)return Math.min.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;na?1:ss&&(s=r,t=i[a]);return t},_functionMinBy:function(e){for(var t,r,n=e[1],i=e[0],o=this.createKeyFunction(n,[m,b]),s=1/0,a=0;a=this.HEADERS_RECEIVED&&!h&&(u.statusCode=l.status,u.headers=s.parseHeaders(l.getAllResponseHeaders()),u.emit("headers",u.statusCode,u.headers,l.statusText),h=!0),this.readyState===this.DONE&&s.finishRequest(l,u)},!1),l.upload.addEventListener("progress",function(e){u.emit("sendProgress",e)}),l.addEventListener("progress",function(e){u.emit("receiveProgress",e)},!1),l.addEventListener("timeout",function(){o(n.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),l.addEventListener("error",function(){o(n.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),l.addEventListener("abort",function(){o(n.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))},!1),r(u),l.open(e.method,c,!1!==t.xhrAsync),n.util.each(e.headers,function(e,t){"Content-Length"!==e&&"User-Agent"!==e&&"Host"!==e&&l.setRequestHeader(e,t)}),t.timeout&&!1!==t.xhrAsync&&(l.timeout=t.timeout),t.xhrWithCredentials&&(l.withCredentials=!0);try{l.responseType="arraybuffer"}catch(e){}try{e.body?l.send(e.body):l.send()}catch(t){if(!e.body||"object"!=typeof e.body.buffer)throw t;l.send(e.body.buffer)}return u},parseHeaders:function(e){var t={};return n.util.arrayEach(e.split(/\r?\n/),function(e){var r=e.split(":",1)[0],n=e.substring(r.length+2);r.length>0&&(t[r.toLowerCase()]=n)}),t},finishRequest:function(e,t){var r;if("arraybuffer"===e.responseType&&e.response){var i=e.response;r=new n.util.Buffer(i.byteLength);for(var o=new Uint8Array(i),s=0;sa)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},n.prototype.digest=function(e){if(!this.finished){var t=8*this.bytesHashed,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(r.setUint8(this.bufferLength++,128),n%64>=56){for(var o=this.bufferLength;o<64;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<56;o++)r.setUint8(o,0);r.setUint32(56,Math.floor(t/4294967296),!0),r.setUint32(60,t),this.hashBuffer(),this.finished=!0}for(var s=new i(32),o=0;o<8;o++)s[4*o]=this.state[o]>>>24&255,s[4*o+1]=this.state[o]>>>16&255,s[4*o+2]=this.state[o]>>>8&255,s[4*o+3]=this.state[o]>>>0&255;return e?s.toString(e):s},n.prototype.hashBuffer=function(){for(var e=this,t=e.buffer,r=e.state,n=r[0],i=r[1],o=r[2],a=r[3],u=r[4],c=r[5],l=r[6],h=r[7],f=0;f<64;f++){if(f<16)this.temp[f]=(255&t[4*f])<<24|(255&t[4*f+1])<<16|(255&t[4*f+2])<<8|255&t[4*f+3];else{var p=this.temp[f-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var y=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(d+this.temp[f-7]|0)+(y+this.temp[f-16]|0)}var v=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&c^~u&l)|0)+(h+(s[f]+this.temp[f]|0)|0)|0,m=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;h=l,l=c,c=u,u=a+v|0,a=o,o=i,i=n,n=v+m|0}r[0]+=n,r[1]+=i,r[2]+=o,r[3]+=a,r[4]+=u,r[5]+=c,r[6]+=l,r[7]+=h}},{"./browserHashUtils":186,"buffer/":3}],189:[function(e,t,r){function n(){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}var i=e("buffer/").Buffer,o=e("./browserHashUtils");new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);t.exports=n,n.BLOCK_SIZE=64,n.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(o.isEmptyData(e))return this;e=o.convertToBuffer(e);var t=e.length;this.totalLength+=8*t;for(var r=0;r14||14===this.offset&&this.shift<24)&&this.processBlock(),this.offset=14,this.shift=24,this.write(0),this.write(0),this.write(this.totalLength>0xffffffffff?this.totalLength/1099511627776:0),this.write(this.totalLength>4294967295?this.totalLength/4294967296:0);for(var t=24;t>=0;t-=8)this.write(this.totalLength>>t);var r=new i(20),n=new DataView(r.buffer);return n.setUint32(0,this.h0,!1),n.setUint32(4,this.h1,!1),n.setUint32(8,this.h2,!1),n.setUint32(12,this.h3,!1),n.setUint32(16,this.h4,!1),e?r.toString(e):r},n.prototype.processBlock=function(){for(var e=16;e<80;e++){var t=this.block[e-3]^this.block[e-8]^this.block[e-14]^this.block[e-16];this.block[e]=t<<1|t>>>31}var r,n,i=this.h0,o=this.h1,s=this.h2,a=this.h3,u=this.h4;for(e=0;e<80;e++){e<20?(r=a^o&(s^a),n=1518500249):e<40?(r=o^s^a,n=1859775393):e<60?(r=o&s|a&(o|s),n=2400959708):(r=o^s^a,n=3395469782);var c=(i<<5|i>>>27)+r+u+n+(0|this.block[e]);u=a,a=s,s=o<<30|o>>>2,o=i,i=c}for(this.h0=this.h0+i|0,this.h1=this.h1+o|0,this.h2=this.h2+s|0,this.h3=this.h3+a|0,this.h4=this.h4+u|0,this.offset=0,e=0;e<16;e++)this.block[e]=0}},{"./browserHashUtils":186,"buffer/":3}],188:[function(e,t,r){function n(){this.state=[1732584193,4023233417,2562383102,271733878],this.buffer=new DataView(new ArrayBuffer(h)),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}function i(e,t,r,n,i,o){return((t=(t+e&4294967295)+(n+o&4294967295)&4294967295)<>>32-i)+r&4294967295}function o(e,t,r,n,o,s,a){return i(t&r|~t&n,e,t,o,s,a)}function s(e,t,r,n,o,s,a){return i(t&n|r&~n,e,t,o,s,a)}function a(e,t,r,n,o,s,a){return i(t^r^n,e,t,o,s,a)}function u(e,t,r,n,o,s,a){return i(r^(t|~n),e,t,o,s,a)}var c=e("./browserHashUtils"),l=e("buffer/").Buffer,h=64;t.exports=n,n.BLOCK_SIZE=h,n.prototype.update=function(e){if(c.isEmptyData(e))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=c.convertToBuffer(e),r=0,n=t.byteLength;for(this.bytesHashed+=n;n>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),n--,this.bufferLength===h&&(this.hashBuffer(),this.bufferLength=0);return this},n.prototype.digest=function(e){if(!this.finished){var t=this,r=t.buffer,n=t.bufferLength,i=t.bytesHashed,o=8*i;if(r.setUint8(this.bufferLength++,128),n%h>=h-8){for(var s=this.bufferLength;s>>0,!0),r.setUint32(h-4,Math.floor(o/4294967296),!0),this.hashBuffer(),this.finished=!0}for(var a=new DataView(new ArrayBuffer(16)),s=0;s<4;s++)a.setUint32(4*s,this.state[s],!0);var u=new l(a.buffer,a.byteOffset,a.byteLength);return e?u.toString(e):u},n.prototype.hashBuffer=function(){var e=this,t=e.buffer,r=e.state,n=r[0],i=r[1],c=r[2],l=r[3];n=o(n,i,c,l,t.getUint32(0,!0),7,3614090360),l=o(l,n,i,c,t.getUint32(4,!0),12,3905402710),c=o(c,l,n,i,t.getUint32(8,!0),17,606105819),i=o(i,c,l,n,t.getUint32(12,!0),22,3250441966),n=o(n,i,c,l,t.getUint32(16,!0),7,4118548399),l=o(l,n,i,c,t.getUint32(20,!0),12,1200080426),c=o(c,l,n,i,t.getUint32(24,!0),17,2821735955),i=o(i,c,l,n,t.getUint32(28,!0),22,4249261313),n=o(n,i,c,l,t.getUint32(32,!0),7,1770035416),l=o(l,n,i,c,t.getUint32(36,!0),12,2336552879),c=o(c,l,n,i,t.getUint32(40,!0),17,4294925233),i=o(i,c,l,n,t.getUint32(44,!0),22,2304563134),n=o(n,i,c,l,t.getUint32(48,!0),7,1804603682),l=o(l,n,i,c,t.getUint32(52,!0),12,4254626195),c=o(c,l,n,i,t.getUint32(56,!0),17,2792965006),i=o(i,c,l,n,t.getUint32(60,!0),22,1236535329),n=s(n,i,c,l,t.getUint32(4,!0),5,4129170786),l=s(l,n,i,c,t.getUint32(24,!0),9,3225465664),c=s(c,l,n,i,t.getUint32(44,!0),14,643717713),i=s(i,c,l,n,t.getUint32(0,!0),20,3921069994),n=s(n,i,c,l,t.getUint32(20,!0),5,3593408605),l=s(l,n,i,c,t.getUint32(40,!0),9,38016083),c=s(c,l,n,i,t.getUint32(60,!0),14,3634488961),i=s(i,c,l,n,t.getUint32(16,!0),20,3889429448),n=s(n,i,c,l,t.getUint32(36,!0),5,568446438),l=s(l,n,i,c,t.getUint32(56,!0),9,3275163606),c=s(c,l,n,i,t.getUint32(12,!0),14,4107603335),i=s(i,c,l,n,t.getUint32(32,!0),20,1163531501),n=s(n,i,c,l,t.getUint32(52,!0),5,2850285829),l=s(l,n,i,c,t.getUint32(8,!0),9,4243563512),c=s(c,l,n,i,t.getUint32(28,!0),14,1735328473),i=s(i,c,l,n,t.getUint32(48,!0),20,2368359562),n=a(n,i,c,l,t.getUint32(20,!0),4,4294588738),l=a(l,n,i,c,t.getUint32(32,!0),11,2272392833),c=a(c,l,n,i,t.getUint32(44,!0),16,1839030562),i=a(i,c,l,n,t.getUint32(56,!0),23,4259657740),n=a(n,i,c,l,t.getUint32(4,!0),4,2763975236),l=a(l,n,i,c,t.getUint32(16,!0),11,1272893353),c=a(c,l,n,i,t.getUint32(28,!0),16,4139469664),i=a(i,c,l,n,t.getUint32(40,!0),23,3200236656),n=a(n,i,c,l,t.getUint32(52,!0),4,681279174),l=a(l,n,i,c,t.getUint32(0,!0),11,3936430074),c=a(c,l,n,i,t.getUint32(12,!0),16,3572445317),i=a(i,c,l,n,t.getUint32(24,!0),23,76029189),n=a(n,i,c,l,t.getUint32(36,!0),4,3654602809),l=a(l,n,i,c,t.getUint32(48,!0),11,3873151461),c=a(c,l,n,i,t.getUint32(60,!0),16,530742520),i=a(i,c,l,n,t.getUint32(8,!0),23,3299628645),n=u(n,i,c,l,t.getUint32(0,!0),6,4096336452),l=u(l,n,i,c,t.getUint32(28,!0),10,1126891415),c=u(c,l,n,i,t.getUint32(56,!0),15,2878612391),i=u(i,c,l,n,t.getUint32(20,!0),21,4237533241),n=u(n,i,c,l,t.getUint32(48,!0),6,1700485571),l=u(l,n,i,c,t.getUint32(12,!0),10,2399980690),c=u(c,l,n,i,t.getUint32(40,!0),15,4293915773),i=u(i,c,l,n,t.getUint32(4,!0),21,2240044497),n=u(n,i,c,l,t.getUint32(32,!0),6,1873313359),l=u(l,n,i,c,t.getUint32(60,!0),10,4264355552),c=u(c,l,n,i,t.getUint32(24,!0),15,2734768916),i=u(i,c,l,n,t.getUint32(52,!0),21,1309151649),n=u(n,i,c,l,t.getUint32(16,!0),6,4149444226),l=u(l,n,i,c,t.getUint32(44,!0),10,3174756917),c=u(c,l,n,i,t.getUint32(8,!0),15,718787259),i=u(i,c,l,n,t.getUint32(36,!0),21,3951481745),r[0]=n+r[0]&4294967295,r[1]=i+r[1]&4294967295,r[2]=c+r[2]&4294967295,r[3]=l+r[3]&4294967295}},{"./browserHashUtils":186,"buffer/":3}],187:[function(e,t,r){function n(e,t){this.hash=new e,this.outer=new e;var r=i(e,t),n=new Uint8Array(e.BLOCK_SIZE);n.set(r);for(var o=0;oe.BLOCK_SIZE){var n=new e;n.update(r),r=n.digest()}var i=new Uint8Array(e.BLOCK_SIZE);return i.set(r),i}var o=e("./browserHashUtils");t.exports=n,n.prototype.update=function(e){if(o.isEmptyData(e)||this.error)return this;try{this.hash.update(o.convertToBuffer(e))}catch(e){this.error=e}return this},n.prototype.digest=function(e){return this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest(e)}},{"./browserHashUtils":186}],186:[function(e,t,r){function n(e){return"string"==typeof e?0===e.length:0===e.byteLength}function i(e){return"string"==typeof e&&(e=new o(e,"utf8")),ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}var o=e("buffer/").Buffer;"undefined"!=typeof ArrayBuffer&&void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return s.indexOf(Object.prototype.toString.call(e))>-1});var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object DataView]"];t.exports={isEmptyData:n,convertToBuffer:i}},{"buffer/":3}],156:[function(e,t,r){function n(){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}function i(e,t,r){if(e&&c(e)&&e instanceof n)return e;var i=new n;return i.parse(e,t,r),i}function o(e){return u(e)&&(e=i(e)),e instanceof n?e.format():n.prototype.format.call(e)}function s(e,t){return i(e,!1,!0).resolve(t)}function a(e,t){return e?i(e,!1,!0).resolveObject(t):t}function u(e){return"string"==typeof e}function c(e){return"object"==typeof e&&null!==e}function l(e){return null===e}function h(e){return null==e}var f=e("punycode");r.parse=i,r.resolve=s,r.resolveObject=a,r.format=o,r.Url=n;var p=/^([a-z0-9.+-]+:)/i,d=/:[0-9]*$/,y=["<",">",'"',"`"," ","\r","\n","\t"],v=["{","}","|","\\","^","`"].concat(y),m=["'"].concat(v),g=["%","/","?",";","#"].concat(m),b=["/","?","#"],_=/^[a-z0-9A-Z_-]{0,63}$/,w=/^([a-z0-9A-Z_-]{0,63})(.*)$/,x={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},S={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=e("querystring");n.prototype.parse=function(e,t,r){if(!u(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e;n=n.trim();var i=p.exec(n);if(i){i=i[0];var o=i.toLowerCase();this.protocol=o,n=n.substr(i.length)}if(r||i||n.match(/^\/\/[^@\/]+@[^@\/]+/)){var s="//"===n.substr(0,2);!s||i&&E[i]||(n=n.substr(2),this.slashes=!0)}if(!E[i]&&(s||i&&!S[i])){for(var a=-1,c=0;c127?R+="x":R+=T[I];if(!R.match(_)){var O=v.slice(0,c),k=v.slice(c+1),j=T.match(w);j&&(O.push(j[1]),k.unshift(j[2])),k.length&&(n="/"+k.join(".")+n),this.hostname=O.join(".");break}}}if(this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),!y){for(var P=this.hostname.split("."),D=[],c=0;c0)&&r.host.split("@");v&&(r.auth=v.shift(),r.host=r.hostname=v.shift())}return r.search=e.search,r.query=e.query,l(r.pathname)&&l(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!d.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var m=d.slice(-1)[0],g=(r.host||e.host)&&("."===m||".."===m)||""===m,b=0,_=d.length;_>=0;_--)m=d[_],"."==m?d.splice(_,1):".."===m?(d.splice(_,1),b++):b&&(d.splice(_,1),b--);if(!f&&!p)for(;b--;b)d.unshift("..");!f||""===d[0]||d[0]&&"/"===d[0].charAt(0)||d.unshift(""),g&&"/"!==d.join("/").substr(-1)&&d.push("");var w=""===d[0]||d[0]&&"/"===d[0].charAt(0);if(y){r.hostname=r.host=w?"":d.length?d.shift():"";var v=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");v&&(r.auth=v.shift(),r.host=r.hostname=v.shift())}return f=f||r.host&&d.length,f&&!w&&d.unshift(""),d.length?r.pathname=d.join("/"):(r.pathname=null,r.path=null),l(r.pathname)&&l(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var e=this.host,t=d.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{punycode:149,querystring:152}],155:[function(e,t,r){arguments[4][152][0].apply(r,arguments)},{"./decode":153,"./encode":154,dup:152}],154:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,i){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(i){var o=encodeURIComponent(n(i))+r;return Array.isArray(e[i])?e[i].map(function(e){return o+encodeURIComponent(n(e))}).join(t):o+encodeURIComponent(n(e[i]))}).join(t):i?encodeURIComponent(n(i))+r+encodeURIComponent(n(e)):""}},{}],153:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,i){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var s=/\+/g;e=e.split(t);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var u=e.length;a>0&&u>a&&(u=a);for(var c=0;c=0?(l=d.substr(0,y),h=d.substr(y+1)):(l=d,h=""),f=decodeURIComponent(l),p=decodeURIComponent(h),n(o,f)?Array.isArray(o[f])?o[f].push(p):o[f]=[o[f],p]:o[f]=p}return o}},{}],152:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode"),r.encode=r.stringify=e("./encode")},{"./decode":150,"./encode":151}],151:[function(e,t,r){"use strict";function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n0&&c>u&&(c=u);for(var l=0;l=0?(h=y.substr(0,v),f=y.substr(v+1)):(h=y,f=""),p=decodeURIComponent(h),d=decodeURIComponent(f),n(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],149:[function(e,t,r){(function(e){!function(n){function i(e){throw RangeError(j[e])}function o(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function s(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(k,"."),n+o(e.split("."),t).join(".")}function a(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(e-=65536,t+=q(e>>>10&1023|55296),e=56320|1023&e),t+=q(e)}).join("")}function c(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:x}function l(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function h(e,t,r){var n=0;for(e=r?D(e/C):e>>1,e+=D(e/t);e>P*S>>1;n+=x)e=D(e/P);return D(n+(P+1)*e/(e+A))}function f(e){var t,r,n,o,s,a,l,f,p,d,y=[],v=e.length,m=0,g=R,b=T;for(r=e.lastIndexOf(I),r<0&&(r=0),n=0;n=128&&i("not-basic"),y.push(e.charCodeAt(n));for(o=r>0?r+1:0;o=v&&i("invalid-input"),f=c(e.charCodeAt(o++)),(f>=x||f>D((w-m)/a))&&i("overflow"),m+=f*a,p=l<=b?E:l>=b+S?S:l-b,!(fD(w/d)&&i("overflow"),a*=d;t=y.length+1,b=h(m-s,t,0==s),D(m/t)>w-g&&i("overflow"),g+=D(m/t),m%=t,y.splice(m++,0,g)}return u(y)}function p(e){var t,r,n,o,s,u,c,f,p,d,y,v,m,g,b,_=[];for(e=a(e),v=e.length,t=R,r=0,s=T,u=0;u=t&&yD((w-r)/m)&&i("overflow"),r+=(c-t)*m,t=c,u=0;uw&&i("overflow"),y==t){for(f=r,p=x;d=p<=s?E:p>=s+S?S:p-s,!(f= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=x-E,D=Math.floor,q=String.fromCharCode;if(b={version:"1.3.2",ucs2:{decode:a,encode:u},decode:f,encode:p,toASCII:y,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return b});else if(v&&m)if(t.exports==v)m.exports=b;else for(_ in b)b.hasOwnProperty(_)&&(v[_]=b[_]);else n.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0} +function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,o,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(r=this._events[e],a(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),r.apply(this,o)}else if(s(r))for(o=Array.prototype.slice.call(arguments,1),c=r.slice(),n=c.length,u=0;u0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,t){var r,n,o,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],o=r.length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(a=o;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){n=a;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],i(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],3:[function(e,t,r){(function(t){"use strict";function n(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(n)return V(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return L(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:_(e,t,r,n,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):_(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(e,t,r,n,i){function o(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}var c;if(i){var l=-1;for(c=r;ca&&(r=a-u),c=r;c>=0;c--){for(var h=!0,f=0;fi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var u,c,l,h;switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(h=(31&o)<<6|63&u)>127&&(s=h);break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(h=(15&o)<<12|(63&u)<<6|63&c)>2047&&(h<55296||h>57343)&&(s=h);break;case 4:u=e[i+1],c=e[i+2],l=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(h=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&h<1114112&&(s=h)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return I(n)}function I(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function q(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function M(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function U(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,i){return i||U(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,r,n,23,4),r+4}function B(e,t,r,n,i){return i||U(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,r,n,52,8),r+8}function F(e){if(e=H(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function H(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function z(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){for(var t=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function W(e){return J.toByteArray(F(e))}function G(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Y(e){return e!==e}var J=e("base64-js"),$=e("ieee754"),Z=e("isarray");r.Buffer=o,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),r.kMaxLength=n(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,r){return s(null,e,t,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,r){return u(null,e,t,r)},o.allocUnsafe=function(e){return c(null,e)},o.allocUnsafeSlow=function(e){return c(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},o.prototype.compare=function(e,t,r,n,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,a=r-t,u=Math.min(s,a),c=this.slice(n,i),l=e.slice(t,r),h=0;hi)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return E(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),$.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),$.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),$.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),$.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;s>1,l=-7,h=r?i-1:0,f=r?-1:1,p=e[t+h];for(h+=f,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+h>=1?f/u:f*Math.pow(2,1-h),t*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},{}],1:[function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-n(e)}function o(e){var t,r,i,o,s,a=e.length;o=n(e),s=new h(3*a/4-o),r=o>0?a-4:a;var u=0;for(t=0;t>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=l[e.charCodeAt(t)]<<2|l[e.charCodeAt(t+1)]>>4,s[u++]=255&i):1===o&&(i=l[e.charCodeAt(t)]<<10|l[e.charCodeAt(t+1)]<<4|l[e.charCodeAt(t+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}function s(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function a(e,t,r){for(var n,i=[],o=t;ou?u:s+16383));return 1===n?(t=e[r-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="="),o.push(i),o.join("")}r.byteLength=i,r.toByteArray=o,r.fromByteArray=u;for(var c=[],l=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=f.length;p1&&(e="Multiple configuration errors:\n"+t.join("\n")),e)throw i.util.error(new Error,{name:"InvalidEndpoint",message:e})},shouldDisableBodySigning:function(e){var t=this.getSignerClass();return!0===this.config.s3DisableBodySigning&&t===i.Signers.V4&&"https:"===e.httpRequest.endpoint.protocol},setupRequestListeners:function(e){e.addListener("validate",this.validateScheme),e.addListener("validate",this.validateBucketEndpoint),e.addListener("validate",this.correctBucketRegionFromCache),e.addListener("validate",this.validateBucketName),e.addListener("build",this.addContentType),e.addListener("build",this.populateURI),e.addListener("build",this.computeContentMd5),e.addListener("build",this.computeSseCustomerKeyMd5),e.addListener("afterBuild",this.addExpect100Continue),e.removeListener("validate",i.EventListeners.Core.VALIDATE_REGION),e.addListener("extractError",this.extractError),e.onAsync("extractError",this.requestBucketRegion),e.addListener("extractData",this.extractData),e.addListener("extractData",i.util.hoistPayloadMember),e.addListener("beforePresign",this.prepareSignedUrl),i.util.isBrowser()&&e.onAsync("retry",this.reqRegionForNetworkingError),this.shouldDisableBodySigning(e)&&(e.removeListener("afterBuild",i.EventListeners.Core.COMPUTE_SHA256),e.addListener("afterBuild",this.disableBodySigning))},validateScheme:function(e){var t=e.params,r=e.httpRequest.endpoint.protocol;if((t.SSECustomerKey||t.CopySourceSSECustomerKey)&&"https:"!==r)throw i.util.error(new Error,{code:"ConfigError",message:"Cannot send SSE keys over HTTP. Set 'sslEnabled'to 'true' in your configuration"})},validateBucketEndpoint:function(e){if(!e.params.Bucket&&e.service.config.s3BucketEndpoint){throw i.util.error(new Error,{code:"ConfigError",message:"Cannot send requests to root API with `s3BucketEndpoint` set."})}},validateBucketName:function(e){if("v4"===e.service.getSignatureVersion(e)){var t=e.params&&e.params.Bucket,r=e.params&&e.params.Key,n=t&&t.indexOf("/");if(t&&n>=0){if("string"!=typeof r){var a="Bucket names cannot contain forward slashes. Bucket: "+t;throw i.util.error(new Error,{code:"InvalidBucket",message:a})}e.params=i.util.copy(e.params);var o=t.substr(n+1)||"";e.params.Key=o+"/"+r,e.params.Bucket=t.substr(0,n)}}},isValidAccelerateOperation:function(e){return-1===["createBucket","deleteBucket","listBuckets"].indexOf(e)},populateURI:function(e){var t=e.httpRequest,r=e.params.Bucket,i=e.service,n=t.endpoint;if(r&&!i.pathStyleBucketName(r)){i.config.useAccelerateEndpoint&&i.isValidAccelerateOperation(e.operation)?i.config.useDualstack?n.hostname=r+".s3-accelerate.dualstack.amazonaws.com":n.hostname=r+".s3-accelerate.amazonaws.com":i.config.s3BucketEndpoint||(n.hostname=r+"."+n.hostname);var a=n.port;n.host=80!==a&&443!==a?n.hostname+":"+n.port:n.hostname,t.virtualHostedBucket=r,i.removeVirtualHostedBucketFromPath(e)}},removeVirtualHostedBucketFromPath:function(e){var t=e.httpRequest,r=t.virtualHostedBucket;r&&t.path&&(t.path=t.path.replace(new RegExp("/"+r),""),"/"!==t.path[0]&&(t.path="/"+t.path))},addExpect100Continue:function(e){var t=e.httpRequest.headers["Content-Length"];i.util.isNode()&&t>=1048576&&(e.httpRequest.headers.Expect="100-continue")},addContentType:function(e){var t=e.httpRequest;if("GET"===t.method||"HEAD"===t.method)return void delete t.headers["Content-Type"];t.headers["Content-Type"]||(t.headers["Content-Type"]="application/octet-stream");var r=t.headers["Content-Type"];if(i.util.isBrowser())if("string"!=typeof t.body||r.match(/;\s*charset=/)){var n=function(e,t,r){return t+r.toUpperCase()};t.headers["Content-Type"]=r.replace(/(;\s*charset=)(.+)$/,n)}else{t.headers["Content-Type"]+="; charset=UTF-8"}},computableChecksumOperations:{putBucketCors:!0,putBucketLifecycle:!0,putBucketLifecycleConfiguration:!0,putBucketTagging:!0,deleteObjects:!0,putBucketReplication:!0},willComputeChecksums:function(e){if(this.computableChecksumOperations[e.operation])return!0;if(!this.config.computeChecksums)return!1;if(!i.util.Buffer.isBuffer(e.httpRequest.body)&&"string"!=typeof e.httpRequest.body)return!1;var t=e.service.api.operations[e.operation].input.members;return!(!e.service.shouldDisableBodySigning(e)||Object.prototype.hasOwnProperty.call(e.httpRequest.headers,"presigned-expires")||!t.ContentMD5||e.params.ContentMD5)||!(e.service.getSignerClass(e)===i.Signers.V4&&t.ContentMD5&&!t.ContentMD5.required)&&(!(!t.ContentMD5||e.params.ContentMD5)||void 0)},computeContentMd5:function(e){if(e.service.willComputeChecksums(e)){var t=i.util.crypto.md5(e.httpRequest.body,"base64");e.httpRequest.headers["Content-MD5"]=t}},computeSseCustomerKeyMd5:function(e){var t={SSECustomerKey:"x-amz-server-side-encryption-customer-key-MD5",CopySourceSSECustomerKey:"x-amz-copy-source-server-side-encryption-customer-key-MD5"};i.util.each(t,function(t,r){if(e.params[t]){var n=i.util.crypto.md5(e.params[t],"base64");e.httpRequest.headers[r]=n}})},pathStyleBucketName:function(e){return!!this.config.s3ForcePathStyle||!this.config.s3BucketEndpoint&&(!this.dnsCompatibleBucketName(e)||!(!this.config.sslEnabled||!e.match(/\./)))},dnsCompatibleBucketName:function(e){var t=e,r=new RegExp(/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/),i=new RegExp(/(\d+\.){3}\d+/),n=new RegExp(/\.\./);return!(!t.match(r)||t.match(i)||t.match(n))},successfulResponse:function(e){var t=e.request,r=e.httpResponse;return(!a[t.operation]||!r.body.toString().match(""))&&r.statusCode<300},retryableError:function(e,t){return!(!a[t.operation]||200!==e.statusCode)||(!t._requestRegionForBucket||!t.service.bucketRegionCache[t._requestRegionForBucket])&&(!(!e||"RequestTimeout"!==e.code)||(e&&-1!=o.indexOf(e.code)&&e.region&&e.region!=t.httpRequest.region?(t.httpRequest.region=e.region,301===e.statusCode&&t.service.updateReqBucketRegion(t),!0):i.Service.prototype.retryableError.call(this,e,t)))},updateReqBucketRegion:function(e,t){var r=e.httpRequest;if("string"==typeof t&&t.length&&(r.region=t),r.endpoint.host.match(/s3(?!-accelerate).*\.amazonaws\.com$/)){var n=e.service,a=n.config,o=a.s3BucketEndpoint;o&&delete a.s3BucketEndpoint;var s=i.util.copy(a);delete s.endpoint,s.region=r.region,r.endpoint=new i.S3(s).endpoint,n.populateURI(e),a.s3BucketEndpoint=o,r.headers.Host=r.endpoint.host,"validate"===e._asm.currentState&&(e.removeListener("build",n.populateURI),e.addListener("build",n.removeVirtualHostedBucketFromPath))}},extractData:function(e){var t=e.request;if("getBucketLocation"===t.operation){var r=e.httpResponse.body.toString().match(/>(.+)<\/Location/);delete e.data._,e.data.LocationConstraint=r?r[1]:""}var i=t.params.Bucket||null;if("deleteBucket"!==t.operation||"string"!=typeof i||e.error){var n=e.httpResponse.headers||{},a=n["x-amz-bucket-region"]||null;if(!a&&"createBucket"===t.operation&&!e.error){var o=t.params.CreateBucketConfiguration;a=o?"EU"===o.LocationConstraint?"eu-west-1":o.LocationConstraint:"us-east-1"}a&&i&&a!==t.service.bucketRegionCache[i]&&(t.service.bucketRegionCache[i]=a)}else t.service.clearBucketRegionCache(i);t.service.extractRequestIds(e)},extractError:function(e){var t={304:"NotModified",403:"Forbidden",400:"BadRequest",404:"NotFound"},r=e.request,n=e.httpResponse.statusCode,a=e.httpResponse.body||"",o=e.httpResponse.headers||{},s=o["x-amz-bucket-region"]||null,u=r.params.Bucket||null,c=r.service.bucketRegionCache;s&&u&&s!==c[u]&&(c[u]=s);var l;if(t[n]&&0===a.length)u&&!s&&(l=c[u]||null)!==r.httpRequest.region&&(s=l),e.error=i.util.error(new Error,{code:t[n],message:null,region:s});else{var p=(new i.XML.Parser).parse(a.toString());p.Region&&!s?(s=p.Region,u&&s!==c[u]&&(c[u]=s)):!u||s||p.Region||(l=c[u]||null)!==r.httpRequest.region&&(s=l),e.error=i.util.error(new Error,{code:p.Code||n,message:p.Message||null,region:s})}r.service.extractRequestIds(e)},requestBucketRegion:function(e,t){var r=e.error,n=e.request,a=n.params.Bucket||null;if(!r||!a||r.region||"listObjects"===n.operation||i.util.isNode()&&"headBucket"===n.operation||400===r.statusCode&&"headObject"!==n.operation||-1===o.indexOf(r.code))return t();var s=i.util.isNode()?"headBucket":"listObjects",u={Bucket:a};"listObjects"===s&&(u.MaxKeys=0);var c=n.service[s](u);c._requestRegionForBucket=a,c.send(function(){var e=n.service.bucketRegionCache[a]||null;r.region=e,t()})},reqRegionForNetworkingError:function(e,t){if(!i.util.isBrowser())return t();var r=e.error,n=e.request,a=n.params.Bucket;if(!r||"NetworkingError"!==r.code||!a||"us-east-1"===n.httpRequest.region)return t();var o=n.service,s=o.bucketRegionCache,u=s[a]||null;if(u&&u!==n.httpRequest.region)o.updateReqBucketRegion(n,u),t();else if(o.dnsCompatibleBucketName(a))if(n.httpRequest.virtualHostedBucket){var c=o.listObjects({Bucket:a,MaxKeys:0});o.updateReqBucketRegion(c,"us-east-1"),c._requestRegionForBucket=a,c.send(function(){var e=o.bucketRegionCache[a]||null;e&&e!==n.httpRequest.region&&o.updateReqBucketRegion(n,e),t()})}else t();else o.updateReqBucketRegion(n,"us-east-1"),"us-east-1"!==s[a]&&(s[a]="us-east-1"),t()},bucketRegionCache:{},clearBucketRegionCache:function(e){var t=this.bucketRegionCache;e?"string"==typeof e&&(e=[e]):e=Object.keys(t);for(var r=0;r=1&&t.doneParts===t.numParts&&t.finishMultiPart()}))}r&&t.fillQueue.call(t)},abort:function(){this.cleanup(i.util.error(new Error("Request aborted by user"),{code:"RequestAbortedError",retryable:!1}))},validateBody:function(){var e=this;if(e.body=e.service.config.params.Body,"string"==typeof e.body)e.body=new i.util.Buffer(e.body);else if(!e.body)throw new Error("params.Body is required");e.sliceFn=i.util.arraySliceFn(e.body)},bindServiceObject:function(e){e=e||{};var t=this;if(t.service){var r=t.service,n=i.util.copy(r.config);n.signatureVersion=r.getSignatureVersion(),t.service=new r.constructor.__super__(n),t.service.config.params=i.util.merge(t.service.config.params||{},e)}else t.service=new i.S3({params:e})},adjustTotalBytes:function(){var e=this;try{e.totalBytes=n(e.body)}catch(e){}if(e.totalBytes){var t=Math.ceil(e.totalBytes/e.maxTotalParts);t>e.partSize&&(e.partSize=t)}else e.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 e=this,t=n(e.body);if(0===t)return e.isDoneChunking=!0,e.numParts=1,void e.nextChunk(e.body);for(;e.activeParts=e.queueSize)){var t=e.body.read(e.partSize-e.partBufferLength)||e.body.read();if(t&&(e.partBuffers.push(t),e.partBufferLength+=t.length,e.totalChunkedBytes+=t.length),e.partBufferLength>=e.partSize){var r=1===e.partBuffers.length?e.partBuffers[0]:a.concat(e.partBuffers);if(e.partBuffers=[],e.partBufferLength=0,r.length>e.partSize){var i=r.slice(e.partSize);e.partBuffers.push(i),e.partBufferLength+=i.length,r=r.slice(0,e.partSize)}e.nextChunk(r)}e.isDoneChunking&&!e.isDoneSending&&(r=1===e.partBuffers.length?e.partBuffers[0]:a.concat(e.partBuffers),e.partBuffers=[],e.partBufferLength=0,e.totalBytes=e.totalChunkedBytes,e.isDoneSending=!0,(0===e.numParts||r.length>0)&&(e.numParts++,e.nextChunk(r))),e.body.read(0)}},nextChunk:function(e){var t=this;if(t.failed)return null;var r=++t.totalPartNumbers;if(t.isDoneChunking&&1===r){var n={Body:e};this.tags&&(n.Tagging=this.getTaggingHeader());var a=t.service.putObject(n);return a._managedUpload=t,a.on("httpUploadProgress",t.progress).send(t.finishSinglePart),null}if(t.service.config.params.ContentMD5){var o=i.util.error(new Error("The Content-MD5 you specified is invalid for multi-part uploads."),{code:"InvalidDigest",retryable:!1});return t.cleanup(o),null}if(t.completeInfo[r]&&null!==t.completeInfo[r].ETag)return null;t.activeParts++,t.service.config.params.UploadId?t.uploadPart(e,r):t.multipartReq?t.queueChunks(e,r):(t.multipartReq=t.service.createMultipartUpload(),t.multipartReq.on("success",function(e){t.service.config.params.UploadId=e.data.UploadId,t.multipartReq=null}),t.queueChunks(e,r),t.multipartReq.on("error",function(e){t.cleanup(e)}),t.multipartReq.send())},getTaggingHeader:function(){for(var e=[],t=0;t + + + diff --git a/pom.xml b/pom.xml index 2d6f4d8..be8a5b9 100644 --- a/pom.xml +++ b/pom.xml @@ -14,6 +14,7 @@ nuxeo-core-binarymanager-common nuxeo-core-binarymanager-s3 + nuxeo-core-binarymanager-s3-web-ui nuxeo-core-binarymanager-azure nuxeo-core-binarymanager-jclouds