UNPKG

@sls-next/lambda-at-edge

Version:

Provides handlers that can be used in CloudFront Lambda@Edge to deploy next.js applications to the edge

1 lines 609 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./manifest.json"),a=require("crypto"),t=require("os"),i=require("path"),n=require("fs"),r=require("url"),p=require("buffer"),d=require("http"),o=require("https"),s=require("stream");require("http2");var l=require("process"),u=require("child_process"),m=require("util");require("perf_hooks");var c=require("punycode");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function v(e){if(e&&e.__esModule)return e;var a=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}})),a.default=e,Object.freeze(a)}require("zlib");var h=f(e),g=f(a),w=f(r),y=f(d),b=f(s),S=f(c),E=function(e,a){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])},E(e,a)};function _(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function t(){this.constructor=e}E(e,a),e.prototype=null===a?Object.create(a):(t.prototype=a.prototype,new t)}var T,N=function(){return N=Object.assign||function(e){for(var a,t=1,i=arguments.length;t<i;t++)for(var n in a=arguments[t])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e},N.apply(this,arguments)};function A(e,a){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&a.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)a.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(t[i[n]]=e[i[n]])}return t}function D(e,a,t,i){return new(t||(t=Promise))((function(n,r){function p(e){try{o(i.next(e))}catch(e){r(e)}}function d(e){try{o(i.throw(e))}catch(e){r(e)}}function o(e){var a;e.done?n(e.value):(a=e.value,a instanceof t?a:new t((function(e){e(a)}))).then(p,d)}o((i=i.apply(e,a||[])).next())}))}function C(e,a){var t,i,n,r,p={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:d(0),throw:d(1),return:d(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function d(r){return function(d){return function(r){if(t)throw new TypeError("Generator is already executing.");for(;p;)try{if(t=1,i&&(n=2&r[0]?i.return:r[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,r[1])).done)return n;switch(i=0,n&&(r=[2&r[0],n.value]),r[0]){case 0:case 1:n=r;break;case 4:return p.label++,{value:r[1],done:!1};case 5:p.label++,i=r[1],r=[0];continue;case 7:r=p.ops.pop(),p.trys.pop();continue;default:if(!(n=p.trys,(n=n.length>0&&n[n.length-1])||6!==r[0]&&2!==r[0])){p=0;continue}if(3===r[0]&&(!n||r[1]>n[0]&&r[1]<n[3])){p.label=r[1];break}if(6===r[0]&&p.label<n[1]){p.label=n[1],n=r;break}if(n&&p.label<n[2]){p.label=n[2],p.ops.push(r);break}n[2]&&p.ops.pop(),p.trys.pop();continue}r=a.call(e,p)}catch(e){r=[6,e],i=0}finally{t=n=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,d])}}}function x(e){var a="function"==typeof Symbol&&Symbol.iterator,t=a&&e[a],i=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(e,a){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var i,n,r=t.call(e),p=[];try{for(;(void 0===a||a-- >0)&&!(i=r.next()).done;)p.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}return p}function k(e,a,t){if(t||2===arguments.length)for(var i,n=0,r=a.length;n<r;n++)!i&&n in a||(i||(i=Array.prototype.slice.call(a,0,n)),i[n]=a[n]);return e.concat(i||Array.prototype.slice.call(a))}function R(e){return this instanceof R?(this.v=e,this):new R(e)}function V(e,a,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=t.apply(e,a||[]),r=[];return i={},p("next"),p("throw"),p("return"),i[Symbol.asyncIterator]=function(){return this},i;function p(e){n[e]&&(i[e]=function(a){return new Promise((function(t,i){r.push([e,a,t,i])>1||d(e,a)}))})}function d(e,a){try{(t=n[e](a)).value instanceof R?Promise.resolve(t.value.v).then(o,s):l(r[0][2],t)}catch(e){l(r[0][3],e)}var t}function o(e){d("next",e)}function s(e){d("throw",e)}function l(e,a){e(a),r.shift(),r.length&&d(r[0][0],r[0][1])}}function O(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a,t=e[Symbol.asyncIterator];return t?t.call(e):(e=x(e),a={},i("next"),i("throw"),i("return"),a[Symbol.asyncIterator]=function(){return this},a);function i(t){a[t]=e[t]&&function(a){return new Promise((function(i,n){(function(e,a,t,i){Promise.resolve(i).then((function(a){e({value:a,done:t})}),a)})(i,n,(a=e[t](a)).done,a.value)}))}}}!function(e){e.ENV="env",e.CONFIG="shared config entry"}(T||(T={}));var P=function(e,a,t){if(a in e){if("true"===e[a])return!0;if("false"===e[a])return!1;throw new Error("Cannot load "+t+' "'+a+'". Expected "true" or "false", got '+e[a]+".")}},I={environmentVariableSelector:function(e){return P(e,"AWS_S3_USE_ARN_REGION",T.ENV)},configFileSelector:function(e){return P(e,"s3_use_arn_region",T.CONFIG)},default:!1},M=function(){function e(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.substr(-1)?e.protocol+":":e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?"/"+e.path:e.path:"/"}return e.isInstance=function(e){if(!e)return!1;var a=e;return"method"in a&&"protocol"in a&&"hostname"in a&&"path"in a&&"object"==typeof a.query&&"object"==typeof a.headers},e.prototype.clone=function(){var a,t=new e(N(N({},this),{headers:N({},this.headers)}));return t.query&&(t.query=(a=t.query,Object.keys(a).reduce((function(e,t){var i,n=a[t];return N(N({},e),((i={})[t]=Array.isArray(n)?k([],L(n)):n,i))}),{}))),t},e}();var q=function(){function e(e){this.statusCode=e.statusCode,this.headers=e.headers||{},this.body=e.body}return e.isInstance=function(e){if(!e)return!1;var a=e;return"number"==typeof a.statusCode&&"object"==typeof a.headers},e}(),j=function(e){return"string"==typeof e&&0===e.indexOf("arn:")&&e.split(":").length>=6},z=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,F=/(\d+\.){3}\d+/,U=/\.\./,B=/\./,H=/^(.+\.)?s3(-fips)?(\.dualstack)?[.-]([a-z0-9-]+)\./,$=/^s3(-external-1)?\.amazonaws\.com$/,K=function(e){var a=e.match(H);return[a[4],e.replace(new RegExp("^"+a[0]),"")]},G=function(e,a){if(""===e)throw new Error("ARN region is empty");if(a.useFipsEndpoint){if(!a.allowFipsRegion)throw new Error("FIPS region is not supported");if(!X(e,a.clientRegion))throw new Error("Client FIPS region "+a.clientRegion+" doesn't match region "+e+" in ARN")}if(!a.useArnRegion&&!X(e,a.clientRegion||"")&&!X(e,a.clientSigningRegion||""))throw new Error("Region in ARN is incompatible, got "+e+" but expected "+a.clientRegion)},W=function(e){if(["s3-external-1","aws-global"].includes(e))throw new Error("Client region "+e+" is not regional")},X=function(e,a){return e===a},J=function(e,a){if(void 0===a&&(a={tlsCompatible:!0}),e.length>=64||!/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(e)||/(\d+\.){3}\d+/.test(e)||/[.-]{2}/.test(e)||(null==a?void 0:a.tlsCompatible)&&B.test(e))throw new Error("Invalid DNS label "+e)},Y=function(e){if(e)throw new Error("Dualstack endpoint is not supported with Outpost or Multi-region Access Point ARN.")},Q=function(e){return function(e){if(e.isCustomEndpoint){if(e.dualstackEndpoint)throw new Error("Dualstack endpoint is not supported with custom endpoint");if(e.accelerateEndpoint)throw new Error("Accelerate endpoint is not supported with custom endpoint")}}(e),function(e){return"string"==typeof e.bucketName}(e)?Z(e):ee(e)},Z=function(e){var a=e.accelerateEndpoint,t=void 0!==a&&a,i=e.clientRegion,n=e.baseHostname,r=e.bucketName,p=e.dualstackEndpoint,d=void 0!==p&&p;e.fipsEndpoint;var o,s=e.pathStyleEndpoint,l=void 0!==s&&s,u=e.tlsCompatible,m=void 0===u||u,c=e.isCustomEndpoint,f=L(void 0!==c&&c?[i,n]:(o=n,$.test(o)?["us-east-1","amazonaws.com"]:K(o)),2),v=f[0],h=f[1];return l||!function(e){return z.test(e)&&!F.test(e)&&!U.test(e)}(r)||m&&B.test(r)?{bucketEndpoint:!1,hostname:d?"s3.dualstack."+v+"."+h:n}:(t?n="s3-accelerate"+(d?".dualstack":"")+"."+h:d&&(n="s3.dualstack."+v+"."+h),{bucketEndpoint:!0,hostname:r+"."+n})},ee=function(e){var a,t=e.isCustomEndpoint,i=e.baseHostname,n=e.clientRegion,r=t?i:(a=i,$.test(a)?[a.replace(".amazonaws.com",""),"amazonaws.com"]:K(a))[1],p=e.pathStyleEndpoint,d=e.accelerateEndpoint,o=void 0!==d&&d;e.fipsEndpoint;var s=e.tlsCompatible,l=void 0===s||s,u=e.bucketName,m=e.clientPartition,c=void 0===m?"aws":m;!function(e){if(e.pathStyleEndpoint)throw new Error("Path-style S3 endpoint is not supported when bucket is an ARN");if(e.accelerateEndpoint)throw new Error("Accelerate endpoint is not supported when bucket is an ARN");if(!e.tlsCompatible)throw new Error("HTTPS is required when bucket is an ARN")}({pathStyleEndpoint:p,accelerateEndpoint:o,tlsCompatible:l});var f=u.service,v=u.partition,h=u.accountId,g=u.region,w=u.resource;!function(e){if("s3"!==e&&"s3-outposts"!==e&&"s3-object-lambda"!==e)throw new Error("Expect 's3' or 's3-outposts' or 's3-object-lambda' in ARN service component")}(f),function(e,a){if(e!==a.clientPartition)throw new Error('Partition in ARN is incompatible, got "'+e+'" but expected "'+a.clientPartition+'"')}(v,{clientPartition:c}),function(e){if(!/[0-9]{12}/.exec(e))throw new Error("Access point ARN accountID does not match regex '[0-9]{12}'")}(h);var y=function(e){var a=e.includes(":")?":":"/",t=L(e.split(a)),i=t[0],n=t.slice(1);if("accesspoint"===i){if(1!==n.length||""===n[0])throw new Error("Access Point ARN should have one resource accesspoint"+a+"{accesspointname}");return{accesspointName:n[0]}}if("outpost"===i){if(!n[0]||"accesspoint"!==n[1]||!n[2]||3!==n.length)throw new Error("Outpost ARN should have resource outpost"+a+"{outpostId}"+a+"accesspoint"+a+"{accesspointName}");var r=L(n,3),p=r[0];return r[1],{outpostId:p,accesspointName:r[2]}}throw new Error("ARN resource should begin with 'accesspoint"+a+"' or 'outpost"+a+"'")}(w),b=y.accesspointName,S=y.outpostId;return"s3-object-lambda"===f?ae(N(N({},e),{tlsCompatible:l,bucketName:u,accesspointName:b,hostnameSuffix:r})):""===g?te(N(N({},e),{clientRegion:n,mrapAlias:b,hostnameSuffix:r})):S?ie(N(N({},e),{clientRegion:n,outpostId:S,accesspointName:b,hostnameSuffix:r})):ne(N(N({},e),{clientRegion:n,accesspointName:b,hostnameSuffix:r}))},ae=function(e){var a=e.dualstackEndpoint,t=void 0!==a&&a,i=e.fipsEndpoint,n=void 0!==i&&i,r=e.tlsCompatible,p=void 0===r||r,d=e.useArnRegion,o=e.clientRegion,s=e.clientSigningRegion,l=void 0===s?o:s,u=e.accesspointName,m=e.bucketName,c=e.hostnameSuffix,f=m.accountId,v=m.region,h=m.service;W(o),G(v,{useArnRegion:d,clientRegion:o,clientSigningRegion:l,allowFipsRegion:!0,useFipsEndpoint:n}),Y(t);var g=u+"-"+f;return J(g,{tlsCompatible:p}),{bucketEndpoint:!0,hostname:g+"."+h+(n?"-fips":"")+"."+(d?v:o)+"."+c,signingRegion:d?v:l,signingService:h}},te=function(e){var a=e.disableMultiregionAccessPoints,t=e.dualstackEndpoint,i=void 0!==t&&t,n=e.isCustomEndpoint,r=e.mrapAlias,p=e.hostnameSuffix;if(!0===a)throw new Error("SDK is attempting to use a MRAP ARN. Please enable to feature.");return function(e){try{e.split(".").forEach((function(e){J(e)}))}catch(a){throw new Error('"'+e+'" is not a DNS compatible name.')}}(r),Y(i),{bucketEndpoint:!0,hostname:r+(n?"":".accesspoint.s3-global")+"."+p,signingRegion:"*"}},ie=function(e){var a=e.useArnRegion,t=e.clientRegion,i=e.clientSigningRegion,n=void 0===i?t:i,r=e.bucketName,p=e.outpostId,d=e.dualstackEndpoint,o=void 0!==d&&d,s=e.fipsEndpoint,l=void 0!==s&&s,u=e.tlsCompatible,m=void 0===u||u,c=e.accesspointName,f=e.isCustomEndpoint,v=e.hostnameSuffix;W(t),G(r.region,{useArnRegion:a,clientRegion:t,clientSigningRegion:n,useFipsEndpoint:l});var h=c+"-"+r.accountId;J(h,{tlsCompatible:m});var g=a?r.region:t,w=a?r.region:n;return function(e){if("s3-outposts"!==e)throw new Error("Expect 's3-posts' in Outpost ARN service component")}(r.service),J(p,{tlsCompatible:m}),Y(o),function(e){if(e)throw new Error("FIPS region is not supported with Outpost.")}(l),{bucketEndpoint:!0,hostname:h+"."+p+(f?"":".s3-outposts."+g)+"."+v,signingRegion:w,signingService:"s3-outposts"}},ne=function(e){var a=e.useArnRegion,t=e.clientRegion,i=e.clientSigningRegion,n=void 0===i?t:i,r=e.bucketName,p=e.dualstackEndpoint,d=void 0!==p&&p,o=e.fipsEndpoint,s=void 0!==o&&o,l=e.tlsCompatible,u=void 0===l||l,m=e.accesspointName,c=e.isCustomEndpoint,f=e.hostnameSuffix;W(t),G(r.region,{useArnRegion:a,clientRegion:t,clientSigningRegion:n,allowFipsRegion:!0,useFipsEndpoint:s});var v=m+"-"+r.accountId;J(v,{tlsCompatible:u});var h=a?r.region:t,g=a?r.region:n;return function(e){if("s3"!==e)throw new Error("Expect 's3' in Accesspoint ARN service component")}(r.service),{bucketEndpoint:!0,hostname:v+(c?"":".s3-accesspoint"+(s?"-fips":"")+(d?".dualstack":"")+"."+h)+"."+f,signingRegion:g}},re=function(e){return function(a,t){return function(i){return D(void 0,void 0,void 0,(function(){var n,r,p,d,o,s,l,u,m,c,f,v,h,g,w,y,b,S,E,_,T,A;return C(this,(function(D){switch(D.label){case 0:return n=i.input.Bucket,r=e.bucketEndpoint,p=i.request,M.isInstance(p)?e.bucketEndpoint?(p.hostname=n,[3,12]):[3,1]:[3,13];case 1:return j(n)?(d=function(e){var a=e.split(":");if(a.length<6||"arn"!==a[0])throw new Error("Malformed ARN");var t=L(a);return{partition:t[1],service:t[2],region:t[3],accountId:t[4],resource:t.slice(5).join(":")}}(n),[4,e.region()]):[3,8];case 2:return y=D.sent(),[4,e.useDualstackEndpoint()];case 3:return o=D.sent(),[4,e.useFipsEndpoint()];case 4:return s=D.sent(),[4,e.regionInfoProvider(y,{useDualstackEndpoint:o,useFipsEndpoint:s})];case 5:return l=D.sent()||{},u=l.partition,m=l.signingRegion,c=void 0===m?y:m,[4,e.useArnRegion()];case 6:return f=D.sent(),w=Q,A={bucketName:d,baseHostname:p.hostname,accelerateEndpoint:e.useAccelerateEndpoint,dualstackEndpoint:o,fipsEndpoint:s,pathStyleEndpoint:e.forcePathStyle,tlsCompatible:"https:"===p.protocol,useArnRegion:f,clientPartition:u,clientSigningRegion:c,clientRegion:y,isCustomEndpoint:e.isCustomEndpoint},[4,e.disableMultiregionAccessPoints()];case 7:return v=w.apply(void 0,[(A.disableMultiregionAccessPoints=D.sent(),A)]),_=v.hostname,T=v.bucketEndpoint,h=v.signingRegion,g=v.signingService,h&&h!==c&&(t.signing_region=h),g&&"s3"!==g&&(t.signing_service=g),p.hostname=_,r=T,[3,12];case 8:return[4,e.region()];case 9:return y=D.sent(),[4,e.useDualstackEndpoint()];case 10:return b=D.sent(),[4,e.useFipsEndpoint()];case 11:S=D.sent(),E=Q({bucketName:n,clientRegion:y,baseHostname:p.hostname,accelerateEndpoint:e.useAccelerateEndpoint,dualstackEndpoint:b,fipsEndpoint:S,pathStyleEndpoint:e.forcePathStyle,tlsCompatible:"https:"===p.protocol,isCustomEndpoint:e.isCustomEndpoint}),_=E.hostname,T=E.bucketEndpoint,p.hostname=_,r=T,D.label=12;case 12:r&&(p.path=p.path.replace(/^(\/)?[^\/]+/,""),""===p.path&&(p.path="/")),D.label=13;case 13:return[2,a(N(N({},i),{request:p}))]}}))}))}}},pe={tags:["BUCKET_ENDPOINT"],name:"bucketEndpointMiddleware",relation:"before",toMiddleware:"hostHeaderMiddleware",override:!0},de=function(e){return{applyToStack:function(a){a.addRelativeTo(re(e),pe)}}};var oe={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},se={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function le(e,a,t){return{applyToStack:function(i){i.add(function(e,a){return function(t,i){return function(i){return D(void 0,void 0,void 0,(function(){var n,r,p;return C(this,(function(d){switch(d.label){case 0:return[4,t(i)];case 1:n=d.sent().response,d.label=2;case 2:return d.trys.push([2,4,,5]),[4,a(n,e)];case 3:return r=d.sent(),[2,{response:n,output:r}];case 4:throw p=d.sent(),Object.assign(p,{$response:n});case 5:return[2]}}))}))}}}(e,t),oe),i.add(function(e,a){return function(t,i){return function(i){return D(void 0,void 0,void 0,(function(){var n;return C(this,(function(r){switch(r.label){case 0:return[4,a(i.input,e)];case 1:return n=r.sent(),[2,t(N(N({},i),{request:n}))]}}))}))}}}(e,a),se)}}}var ue=function(){var e=[],a=[],t=new Set,i=function(t){return e.forEach((function(e){t.add(e.middleware,N({},e))})),a.forEach((function(e){t.addRelativeTo(e.middleware,N({},e))})),t},n=function(e){var a=[];return e.before.forEach((function(e){0===e.before.length&&0===e.after.length?a.push(e):a.push.apply(a,k([],L(n(e))))})),a.push(e),e.after.reverse().forEach((function(e){0===e.before.length&&0===e.after.length?a.push(e):a.push.apply(a,k([],L(n(e))))})),a},r=function(){var t,i=[],r=[],p={};return e.forEach((function(e){var a=N(N({},e),{before:[],after:[]});a.name&&(p[a.name]=a),i.push(a)})),a.forEach((function(e){var a=N(N({},e),{before:[],after:[]});a.name&&(p[a.name]=a),r.push(a)})),r.forEach((function(e){if(e.toMiddleware){var a=p[e.toMiddleware];if(void 0===a)throw new Error(e.toMiddleware+" is not found when adding "+(e.name||"anonymous")+" middleware "+e.relation+" "+e.toMiddleware);"after"===e.relation&&a.after.push(e),"before"===e.relation&&a.before.push(e)}})),(t=i,t.sort((function(e,a){return me[a.step]-me[e.step]||ce[a.priority||"normal"]-ce[e.priority||"normal"]}))).map(n).reduce((function(e,a){return e.push.apply(e,k([],L(a))),e}),[]).map((function(e){return e.middleware}))},p={add:function(a,i){void 0===i&&(i={});var n=i.name,r=i.override,p=N({step:"initialize",priority:"normal",middleware:a},i);if(n){if(t.has(n)){if(!r)throw new Error("Duplicate middleware name '"+n+"'");var d=e.findIndex((function(e){return e.name===n})),o=e[d];if(o.step!==p.step||o.priority!==p.priority)throw new Error('"'+n+'" middleware with '+o.priority+" priority in "+o.step+" step cannot be overridden by same-name middleware with "+p.priority+" priority in "+p.step+" step.");e.splice(d,1)}t.add(n)}e.push(p)},addRelativeTo:function(e,i){var n=i.name,r=i.override,p=N({middleware:e},i);if(n){if(t.has(n)){if(!r)throw new Error("Duplicate middleware name '"+n+"'");var d=a.findIndex((function(e){return e.name===n})),o=a[d];if(o.toMiddleware!==p.toMiddleware||o.relation!==p.relation)throw new Error('"'+n+'" middleware '+o.relation+' "'+o.toMiddleware+'" middleware cannot be overridden by same-name middleware '+p.relation+' "'+p.toMiddleware+'" middleware.');a.splice(d,1)}t.add(n)}a.push(p)},clone:function(){return i(ue())},use:function(e){e.applyToStack(p)},remove:function(i){return"string"==typeof i?function(i){var n=!1,r=function(e){return!e.name||e.name!==i||(n=!0,t.delete(i),!1)};return e=e.filter(r),a=a.filter(r),n}(i):function(i){var n=!1,r=function(e){return e.middleware!==i||(n=!0,e.name&&t.delete(e.name),!1)};return e=e.filter(r),a=a.filter(r),n}(i)},removeByTag:function(i){var n=!1,r=function(e){var a=e.tags,r=e.name;return!a||!a.includes(i)||(r&&t.delete(r),n=!0,!1)};return e=e.filter(r),a=a.filter(r),n},concat:function(e){var a=i(ue());return a.use(e),a},applyToStack:i,resolve:function(e,a){var t,i;try{for(var n=x(r().reverse()),p=n.next();!p.done;p=n.next()){e=(0,p.value)(e,a)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}return e}};return p},me={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},ce={high:3,normal:2,low:1},fe=function(){function e(e){this.middlewareStack=ue(),this.config=e}return e.prototype.send=function(e,a,t){var i="function"!=typeof a?a:void 0,n="function"==typeof a?a:t,r=e.resolveMiddleware(this.middlewareStack,this.config,i);if(!n)return r(e).then((function(e){return e.output}));r(e).then((function(e){return n(null,e.output)}),(function(e){return n(e)})).catch((function(){}))},e.prototype.destroy=function(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()},e}(),ve=function(){this.middlewareStack=ue()},he="***SensitiveInformation***",ge=function(e){switch(e){case"true":return!0;case"false":return!1;default:throw new Error('Unable to parse boolean value "'+e+'"')}},we=Math.ceil(Math.pow(2,127)*(2-Math.pow(2,-23))),ye=function(e){var a=function(e){if(null!=e){if("number"==typeof e)return e;throw new TypeError("Expected number, got "+typeof e)}}(e);if(void 0!==a&&!Number.isNaN(a)&&a!==1/0&&a!==-1/0&&Math.abs(a)>we)throw new TypeError("Expected 32-bit float, got "+e);return a},be=function(e){if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError("Expected integer, got "+typeof e)}},Se=function(e){return Te(e,32)},Ee=function(e){return Te(e,16)},_e=function(e){return Te(e,8)},Te=function(e,a){var t=be(e);if(void 0!==t&&Ne(t,a)!==t)throw new TypeError("Expected "+a+"-bit integer, got "+e);return t},Ne=function(e,a){switch(a){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},Ae=function(e,a){if(null==e){if(a)throw new TypeError("Expected a non-null value for "+a);throw new TypeError("Expected a non-null value")}return e},De=function(e){if(null!=e){if("object"==typeof e&&!Array.isArray(e))return e;throw new TypeError("Expected object, got "+typeof e)}},Ce=function(e){if(null!=e){if("string"==typeof e)return e;throw new TypeError("Expected string, got "+typeof e)}},xe=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Le=function(e){var a=e.match(xe);if(null===a||a[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},ke=function(e){return Se("string"==typeof e?Le(e):e)},Re=function(e){return Ee("string"==typeof e?Le(e):e)},Ve=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Oe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Pe(e){var a=e.getUTCFullYear(),t=e.getUTCMonth(),i=e.getUTCDay(),n=e.getUTCDate(),r=e.getUTCHours(),p=e.getUTCMinutes(),d=e.getUTCSeconds(),o=r<10?"0"+r:""+r,s=p<10?"0"+p:""+p,l=d<10?"0"+d:""+d;return Ve[i]+", "+(n<10?"0"+n:""+n)+" "+Oe[t]+" "+a+" "+o+":"+s+":"+l+" GMT"}var Ie=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Me=function(e){if(null!=e){if("string"!=typeof e)throw new TypeError("RFC-3339 date-times must be expressed as strings");var a=Ie.exec(e);if(!a)throw new TypeError("Invalid RFC-3339 date-time value");var t=L(a,8);t[0];var i=t[1],n=t[2],r=t[3],p=t[4],d=t[5],o=t[6],s=t[7],l=Re(Ye(i)),u=Xe(n,"month",1,12),m=Xe(r,"day",1,31);return Ue(l,u,m,{hours:p,minutes:d,seconds:o,fractionalMilliseconds:s})}},qe=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),je=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),ze=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),Fe=function(e){if(null!=e){if("string"!=typeof e)throw new TypeError("RFC-7231 date-times must be expressed as strings");var a=qe.exec(e);if(a){var t=L(a,8);t[0];var i=t[1],n=t[2],r=t[3],p=t[4],d=t[5],o=t[6],s=t[7];return Ue(Re(Ye(r)),$e(n),Xe(i,"day",1,31),{hours:p,minutes:d,seconds:o,fractionalMilliseconds:s})}if(a=je.exec(e)){var l=L(a,8);l[0];i=l[1],n=l[2],r=l[3],p=l[4],d=l[5],o=l[6],s=l[7];return He(Ue(Be(r),$e(n),Xe(i,"day",1,31),{hours:p,minutes:d,seconds:o,fractionalMilliseconds:s}))}if(a=ze.exec(e)){var u=L(a,8);u[0];n=u[1],i=u[2],p=u[3],d=u[4],o=u[5],s=u[6],r=u[7];return Ue(Re(Ye(r)),$e(n),Xe(i.trimLeft(),"day",1,31),{hours:p,minutes:d,seconds:o,fractionalMilliseconds:s})}throw new TypeError("Invalid RFC-7231 date-time value")}},Ue=function(e,a,t,i){var n=a-1;return Ge(e,n,t),new Date(Date.UTC(e,n,t,Xe(i.hours,"hour",0,23),Xe(i.minutes,"minute",0,59),Xe(i.seconds,"seconds",0,60),Je(i.fractionalMilliseconds)))},Be=function(e){var a=(new Date).getUTCFullYear(),t=100*Math.floor(a/100)+Re(Ye(e));return t<a?t+100:t},He=function(e){return e.getTime()-(new Date).getTime()>15768e8?new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())):e},$e=function(e){var a=Oe.indexOf(e);if(a<0)throw new TypeError("Invalid month: "+e);return a+1},Ke=[31,28,31,30,31,30,31,31,30,31,30,31],Ge=function(e,a,t){var i=Ke[a];if(1===a&&We(e)&&(i=29),t>i)throw new TypeError("Invalid day for "+Oe[a]+" in "+e+": "+t)},We=function(e){return e%4==0&&(e%100!=0||e%400==0)},Xe=function(e,a,t,i){var n=function(e){return _e("string"==typeof e?Le(e):e)}(Ye(e));if(n<t||n>i)throw new TypeError(a+" must be between "+t+" and "+i+", inclusive");return n},Je=function(e){return null==e?0:1e3*function(e){return ye("string"==typeof e?Le(e):e)}("0."+e)},Ye=function(e){for(var a=0;a<e.length-1&&"0"===e.charAt(a);)a++;return 0===a?e:e.slice(a)},Qe=function(e){switch(e){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},Ze=function(e){function a(t){var i=e.call(this,t.message)||this;return Object.setPrototypeOf(i,a.prototype),i.name=t.name,i.$fault=t.$fault,i.$metadata=t.$metadata,i}return _(a,e),a}(Error),ea=function(e,a){void 0===a&&(a={}),Object.entries(a).filter((function(e){return void 0!==L(e,2)[1]})).forEach((function(a){var t=L(a,2),i=t[0],n=t[1];null!=e[i]&&""!==e[i]||(e[i]=n)}));var t=e.message||e.Message||"UnknownError";return e.message=t,delete e.Message,e};function aa(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}var ta=function(e){for(var a in e)e.hasOwnProperty(a)&&void 0!==e[a]["#text"]?e[a]=e[a]["#text"]:"object"==typeof e[a]&&null!==e[a]&&(e[a]=ta(e[a]));return e},ia=function(){var e=Object.getPrototypeOf(this).constructor,a=Function.bind.apply(String,k([null],L(arguments))),t=new a;return Object.setPrototypeOf(t,e.prototype),t};ia.prototype=Object.create(String.prototype,{constructor:{value:ia,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(ia,String),function(e){function a(){return null!==e&&e.apply(this,arguments)||this}_(a,e),a.prototype.deserializeJSON=function(){return JSON.parse(e.prototype.toString.call(this))},a.prototype.toJSON=function(){return e.prototype.toString.call(this)},a.fromObject=function(e){return e instanceof a?e:new a(e instanceof String||"string"==typeof e?e:JSON.stringify(e))}}(ia);var na,ra,pa,da,oa,sa,la,ua,ma,ca,fa,va,ha,ga,wa,ya,ba,Sa,Ea,_a,Ta,Na,Aa,Da,Ca,xa,La,ka,Ra,Va,Oa,Pa,Ia,Ma,qa,ja,za,Fa,Ua,Ba,Ha,$a,Ka,Ga,Wa,Xa,Ja,Ya,Qa,Za,et,at,tt,it,nt,rt,pt,dt,ot,st,lt,ut,mt,ct,ft,vt,ht,gt,wt,yt,bt,St,Et,_t,Tt,Nt,At,Dt,Ct,xt,Lt,kt,Rt,Vt,Ot,Pt,It,Mt,qt,jt,zt,Ft,Ut,Bt,Ht,$t,Kt,Gt,Wt,Xt,Jt,Yt,Qt,Zt,ei,ai,ti,ii,ni,ri,pi,di,oi,si,li,ui,mi,ci,fi,vi,hi,gi,wi,yi,bi,Si,Ei,_i,Ti,Ni,Ai,Di,Ci,xi,Li,ki,Ri,Vi,Oi,Pi,Ii,Mi,qi,ji,zi,Fi,Ui,Bi,Hi,$i,Ki,Gi,Wi,Xi,Ji,Yi=function(e){function a(t){var i=e.call(this,t)||this;return Object.setPrototypeOf(i,a.prototype),i}return _(a,e),a}(Ze);!function(e){e.filterSensitiveLog=function(e){return N({},e)}}(na||(na={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ra||(ra={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(pa||(pa={})),function(e){function a(t){var i=e.call(this,N({name:"NoSuchUpload",$fault:"client"},t))||this;return i.name="NoSuchUpload",i.$fault="client",Object.setPrototypeOf(i,a.prototype),i}_(a,e)}(Yi),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(da||(da={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(oa||(oa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(sa||(sa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(la||(la={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ua||(ua={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ma||(ma={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSEKMSKeyId&&{SSEKMSKeyId:he})}}(ca||(ca={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(fa||(fa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(va||(va={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSECustomerKey&&{SSECustomerKey:he})}}(ha||(ha={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ga||(ga={})),function(e){e.filterSensitiveLog=function(e){return N(N(N({},e),e.SSEKMSKeyId&&{SSEKMSKeyId:he}),e.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:he})}}(wa||(wa={})),function(e){e.CRC32="CRC32",e.CRC32C="CRC32C",e.SHA1="SHA1",e.SHA256="SHA256"}(ya||(ya={})),function(e){e.filterSensitiveLog=function(e){return N(N(N(N(N({},e),e.SSECustomerKey&&{SSECustomerKey:he}),e.SSEKMSKeyId&&{SSEKMSKeyId:he}),e.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:he}),e.CopySourceSSECustomerKey&&{CopySourceSSECustomerKey:he})}}(ba||(ba={})),function(e){function a(t){var i=e.call(this,N({name:"ObjectNotInActiveTierError",$fault:"client"},t))||this;return i.name="ObjectNotInActiveTierError",i.$fault="client",Object.setPrototypeOf(i,a.prototype),i}_(a,e)}(Yi),function(e){function a(t){var i=e.call(this,N({name:"BucketAlreadyExists",$fault:"client"},t))||this;return i.name="BucketAlreadyExists",i.$fault="client",Object.setPrototypeOf(i,a.prototype),i}_(a,e)}(Yi),function(e){function a(t){var i=e.call(this,N({name:"BucketAlreadyOwnedByYou",$fault:"client"},t))||this;return i.name="BucketAlreadyOwnedByYou",i.$fault="client",Object.setPrototypeOf(i,a.prototype),i}_(a,e)}(Yi),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Sa||(Sa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ea||(Ea={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(_a||(_a={})),function(e){e.filterSensitiveLog=function(e){return N(N(N({},e),e.SSEKMSKeyId&&{SSEKMSKeyId:he}),e.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:he})}}(Ta||(Ta={})),function(e){e.filterSensitiveLog=function(e){return N(N(N(N({},e),e.SSECustomerKey&&{SSECustomerKey:he}),e.SSEKMSKeyId&&{SSEKMSKeyId:he}),e.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:he})}}(Na||(Na={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Aa||(Aa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Da||(Da={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ca||(Ca={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(xa||(xa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(La||(La={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ka||(ka={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ra||(Ra={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Va||(Va={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Oa||(Oa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Pa||(Pa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ia||(Ia={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ma||(Ma={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(qa||(qa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ja||(ja={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(za||(za={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Fa||(Fa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ua||(Ua={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ba||(Ba={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ha||(Ha={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}($a||($a={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ka||(Ka={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ga||(Ga={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Wa||(Wa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Xa||(Xa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ja||(Ja={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ya||(Ya={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Qa||(Qa={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Za||(Za={})),(et||(et={})).filterSensitiveLog=function(e){return N({},e)},function(e){e.filterSensitiveLog=function(e){return N({},e)}}(at||(at={})),function(e){e.visit=function(e,a){return void 0!==e.Prefix?a.Prefix(e.Prefix):void 0!==e.Tag?a.Tag(e.Tag):void 0!==e.And?a.And(e.And):a._(e.$unknown[0],e.$unknown[1])},e.filterSensitiveLog=function(e){var a;return void 0!==e.Prefix?{Prefix:e.Prefix}:void 0!==e.Tag?{Tag:et.filterSensitiveLog(e.Tag)}:void 0!==e.And?{And:at.filterSensitiveLog(e.And)}:void 0!==e.$unknown?((a={})[e.$unknown[0]]="UNKNOWN",a):void 0}}(tt||(tt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(it||(it={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(nt||(nt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(rt||(rt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(pt||(pt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Filter&&{Filter:tt.filterSensitiveLog(e.Filter)})}}(dt||(dt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.AnalyticsConfiguration&&{AnalyticsConfiguration:dt.filterSensitiveLog(e.AnalyticsConfiguration)})}}(ot||(ot={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(st||(st={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(lt||(lt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ut||(ut={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(mt||(mt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.KMSMasterKeyID&&{KMSMasterKeyID:he})}}(ct||(ct={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.ApplyServerSideEncryptionByDefault&&{ApplyServerSideEncryptionByDefault:ct.filterSensitiveLog(e.ApplyServerSideEncryptionByDefault)})}}(ft||(ft={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Rules&&{Rules:e.Rules.map((function(e){return ft.filterSensitiveLog(e)}))})}}(vt||(vt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.ServerSideEncryptionConfiguration&&{ServerSideEncryptionConfiguration:vt.filterSensitiveLog(e.ServerSideEncryptionConfiguration)})}}(ht||(ht={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(gt||(gt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(wt||(wt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(yt||(yt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(bt||(bt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(St||(St={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Et||(Et={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(_t||(_t={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.KeyId&&{KeyId:he})}}(Tt||(Tt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Nt||(Nt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSEKMS&&{SSEKMS:Tt.filterSensitiveLog(e.SSEKMS)})}}(At||(At={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Encryption&&{Encryption:At.filterSensitiveLog(e.Encryption)})}}(Dt||(Dt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.S3BucketDestination&&{S3BucketDestination:Dt.filterSensitiveLog(e.S3BucketDestination)})}}(Ct||(Ct={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(xt||(xt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Lt||(Lt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Destination&&{Destination:Ct.filterSensitiveLog(e.Destination)})}}(kt||(kt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.InventoryConfiguration&&{InventoryConfiguration:kt.filterSensitiveLog(e.InventoryConfiguration)})}}(Rt||(Rt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Vt||(Vt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ot||(Ot={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Pt||(Pt={})),function(e){e.visit=function(e,a){return void 0!==e.Prefix?a.Prefix(e.Prefix):void 0!==e.Tag?a.Tag(e.Tag):void 0!==e.ObjectSizeGreaterThan?a.ObjectSizeGreaterThan(e.ObjectSizeGreaterThan):void 0!==e.ObjectSizeLessThan?a.ObjectSizeLessThan(e.ObjectSizeLessThan):void 0!==e.And?a.And(e.And):a._(e.$unknown[0],e.$unknown[1])},e.filterSensitiveLog=function(e){var a;return void 0!==e.Prefix?{Prefix:e.Prefix}:void 0!==e.Tag?{Tag:et.filterSensitiveLog(e.Tag)}:void 0!==e.ObjectSizeGreaterThan?{ObjectSizeGreaterThan:e.ObjectSizeGreaterThan}:void 0!==e.ObjectSizeLessThan?{ObjectSizeLessThan:e.ObjectSizeLessThan}:void 0!==e.And?{And:Pt.filterSensitiveLog(e.And)}:void 0!==e.$unknown?((a={})[e.$unknown[0]]="UNKNOWN",a):void 0}}(It||(It={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Mt||(Mt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(qt||(qt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(jt||(jt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Filter&&{Filter:It.filterSensitiveLog(e.Filter)})}}(zt||(zt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Rules&&{Rules:e.Rules.map((function(e){return zt.filterSensitiveLog(e)}))})}}(Ft||(Ft={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ut||(Ut={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Bt||(Bt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ht||(Ht={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}($t||($t={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Kt||(Kt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Gt||(Gt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Wt||(Wt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Xt||(Xt={})),function(e){e.visit=function(e,a){return void 0!==e.Prefix?a.Prefix(e.Prefix):void 0!==e.Tag?a.Tag(e.Tag):void 0!==e.AccessPointArn?a.AccessPointArn(e.AccessPointArn):void 0!==e.And?a.And(e.And):a._(e.$unknown[0],e.$unknown[1])},e.filterSensitiveLog=function(e){var a;return void 0!==e.Prefix?{Prefix:e.Prefix}:void 0!==e.Tag?{Tag:et.filterSensitiveLog(e.Tag)}:void 0!==e.AccessPointArn?{AccessPointArn:e.AccessPointArn}:void 0!==e.And?{And:Xt.filterSensitiveLog(e.And)}:void 0!==e.$unknown?((a={})[e.$unknown[0]]="UNKNOWN",a):void 0}}(Jt||(Jt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Filter&&{Filter:Jt.filterSensitiveLog(e.Filter)})}}(Yt||(Yt={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.MetricsConfiguration&&{MetricsConfiguration:Yt.filterSensitiveLog(e.MetricsConfiguration)})}}(Qt||(Qt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Zt||(Zt={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ei||(ei={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ai||(ai={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ti||(ti={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ii||(ii={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ni||(ni={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ri||(ri={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(pi||(pi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(di||(di={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(oi||(oi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(si||(si={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(li||(li={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ui||(ui={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(mi||(mi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ci||(ci={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(fi||(fi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(vi||(vi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(hi||(hi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(gi||(gi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(wi||(wi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(yi||(yi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(bi||(bi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Si||(Si={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ei||(Ei={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(_i||(_i={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ti||(Ti={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ni||(Ni={})),function(e){e.visit=function(e,a){return void 0!==e.Prefix?a.Prefix(e.Prefix):void 0!==e.Tag?a.Tag(e.Tag):void 0!==e.And?a.And(e.And):a._(e.$unknown[0],e.$unknown[1])},e.filterSensitiveLog=function(e){var a;return void 0!==e.Prefix?{Prefix:e.Prefix}:void 0!==e.Tag?{Tag:et.filterSensitiveLog(e.Tag)}:void 0!==e.And?{And:Ni.filterSensitiveLog(e.And)}:void 0!==e.$unknown?((a={})[e.$unknown[0]]="UNKNOWN",a):void 0}}(Ai||(Ai={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Di||(Di={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ci||(Ci={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(xi||(xi={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Filter&&{Filter:Ai.filterSensitiveLog(e.Filter)})}}(Li||(Li={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.Rules&&{Rules:e.Rules.map((function(e){return Li.filterSensitiveLog(e)}))})}}(ki||(ki={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.ReplicationConfiguration&&{ReplicationConfiguration:ki.filterSensitiveLog(e.ReplicationConfiguration)})}}(Ri||(Ri={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Vi||(Vi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Oi||(Oi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Pi||(Pi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ii||(Ii={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Mi||(Mi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(qi||(qi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ji||(ji={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(zi||(zi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Fi||(Fi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ui||(Ui={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Bi||(Bi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Hi||(Hi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}($i||($i={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ki||(Ki={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Gi||(Gi={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSEKMSKeyId&&{SSEKMSKeyId:he})}}(Wi||(Wi={})),function(e){e.ENABLED="ENABLED"}(Xi||(Xi={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSECustomerKey&&{SSECustomerKey:he})}}(Ji||(Ji={}));var Qi,Zi,en,an,tn,nn,rn,pn,dn,on,sn,ln,un,mn,cn,fn,vn,hn,gn,wn,yn,bn,Sn,En,_n,Tn,Nn,An,Dn,Cn,xn,Ln,kn,Rn,Vn,On,Pn,In,Mn,qn,jn,zn,Fn,Un,Bn,Hn,$n,Kn,Gn,Wn,Xn,Jn,Yn,Qn,Zn,er,ar,tr,ir,nr,rr,pr,dr,or,sr,lr,ur,mr,cr,fr,vr,hr,gr,wr,yr,br,Sr,Er,_r,Tr,Nr,Ar,Dr,Cr,xr,Lr,kr,Rr,Vr,Or=function(e){function a(t){var i=e.call(this,N({name:"InvalidObjectState",$fault:"client"},t))||this;return i.name="InvalidObjectState",i.$fault="client",Object.setPrototypeOf(i,a.prototype),i.StorageClass=t.StorageClass,i.AccessTier=t.AccessTier,i}return _(a,e),a}(Yi),Pr=function(e){function a(t){var i=e.call(this,N({name:"NoSuchKey",$fault:"client"},t))||this;return i.name="NoSuchKey",i.$fault="client",Object.setPrototypeOf(i,a.prototype),i}return _(a,e),a}(Yi);!function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Qi||(Qi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Zi||(Zi={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(en||(en={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(an||(an={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(tn||(tn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(nn||(nn={})),function(e){e.CHECKSUM="Checksum",e.ETAG="ETag",e.OBJECT_PARTS="ObjectParts",e.OBJECT_SIZE="ObjectSize",e.STORAGE_CLASS="StorageClass"}(rn||(rn={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSECustomerKey&&{SSECustomerKey:he})}}(pn||(pn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(dn||(dn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(on||(on={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(sn||(sn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ln||(ln={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(un||(un={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(mn||(mn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(cn||(cn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(fn||(fn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(vn||(vn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(hn||(hn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(gn||(gn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(wn||(wn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(yn||(yn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(bn||(bn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Sn||(Sn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(En||(En={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(_n||(_n={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Tn||(Tn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Nn||(Nn={})),function(e){function a(t){var i=e.call(this,N({name:"NotFound",$fault:"client"},t))||this;return i.name="NotFound",i.$fault="client",Object.setPrototypeOf(i,a.prototype),i}_(a,e)}(Yi),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSEKMSKeyId&&{SSEKMSKeyId:he})}}(An||(An={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSECustomerKey&&{SSECustomerKey:he})}}(Dn||(Dn={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.AnalyticsConfigurationList&&{AnalyticsConfigurationList:e.AnalyticsConfigurationList.map((function(e){return dt.filterSensitiveLog(e)}))})}}(Cn||(Cn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(xn||(xn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Ln||(Ln={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(kn||(kn={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.InventoryConfigurationList&&{InventoryConfigurationList:e.InventoryConfigurationList.map((function(e){return kt.filterSensitiveLog(e)}))})}}(Rn||(Rn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Vn||(Vn={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.MetricsConfigurationList&&{MetricsConfigurationList:e.MetricsConfigurationList.map((function(e){return Yt.filterSensitiveLog(e)}))})}}(On||(On={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Pn||(Pn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(In||(In={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Mn||(Mn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(qn||(qn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(jn||(jn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(zn||(zn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Fn||(Fn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Un||(Un={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Bn||(Bn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Hn||(Hn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}($n||($n={})),function(e){function a(t){var i=e.call(this,N({name:"NoSuchBucket",$fault:"client"},t))||this;return i.name="NoSuchBucket",i.$fault="client",Object.setPrototypeOf(i,a.prototype),i}_(a,e)}(Yi),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Kn||(Kn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Gn||(Gn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Wn||(Wn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Xn||(Xn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Jn||(Jn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Yn||(Yn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Qn||(Qn={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(Zn||(Zn={})),function(e){e.filterSensitiveLog=function(e){return N(N({},e),e.SSECustomerKey&&{SSECustomerKey:he})}}(er||(er={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(ar||(ar={})),function(e){e.filterSensitiveLog=function(e){return N({},e)}}(tr||(tr={})),function(e){e.filterSensit