@allthings/sdk 6.2.2 → 6.4.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).allthings={})}(this,(function(exports){"use strict";const getHttpHandlerExtensionConfiguration=e=>{let t=e.httpHandler;return{setHttpHandler(e){t=e},httpHandler:()=>t,updateHttpClientConfig(e,n){t.updateHttpClientConfig(e,n)},httpHandlerConfigs:()=>t.httpHandlerConfigs()}},resolveHttpHandlerRuntimeConfig=e=>({httpHandler:e.httpHandler()});var HttpAuthLocation,HttpApiKeyAuthLocation,EndpointURLScheme,AlgorithmId,FieldPosition;!function(e){e.HEADER="header",e.QUERY="query"}(HttpAuthLocation||(HttpAuthLocation={})),function(e){e.HEADER="header",e.QUERY="query"}(HttpApiKeyAuthLocation||(HttpApiKeyAuthLocation={})),function(e){e.HTTP="http",e.HTTPS="https"}(EndpointURLScheme||(EndpointURLScheme={})),function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"}(AlgorithmId||(AlgorithmId={})),function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"}(FieldPosition||(FieldPosition={}));const SMITHY_CONTEXT_KEY="__smithy_context";var IniSectionType,RequestHandlerProtocol;!function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"}(IniSectionType||(IniSectionType={})),function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"}(RequestHandlerProtocol||(RequestHandlerProtocol={}));class HttpRequest{constructor(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.slice(-1)?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const t=new HttpRequest({...e,headers:{...e.headers}});return t.query&&(t.query=cloneQuery(t.query)),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return HttpRequest.clone(this)}}function cloneQuery(e){return Object.keys(e).reduce(((t,n)=>{const r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}}),{})}class HttpResponse{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}function resolveHostHeaderConfig(e){return e}const hostHeaderMiddleware=e=>t=>async n=>{if(!HttpRequest.isInstance(n.request))return t(n);const{request:r}=n,{handlerProtocol:i=""}=e.requestHandler.metadata||{};if(i.indexOf("h2")>=0&&!r.headers[":authority"])delete r.headers.host,r.headers[":authority"]=r.hostname+(r.port?":"+r.port:"");else if(!r.headers.host){let e=r.hostname;null!=r.port&&(e+=`:${r.port}`),r.headers.host=e}return t(n)},hostHeaderMiddlewareOptions={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},getHostHeaderPlugin=e=>({applyToStack:t=>{t.add(hostHeaderMiddleware(e),hostHeaderMiddlewareOptions)}}),loggerMiddleware=()=>(e,t)=>async n=>{try{const r=await e(n),{clientName:i,commandName:s,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:u}=a,d=c??t.inputFilterSensitiveLog,l=u??t.outputFilterSensitiveLog,{$metadata:p,...m}=r.output;return o?.info?.({clientName:i,commandName:s,input:d(n.input),output:l(m),metadata:p}),r}catch(e){const{clientName:r,commandName:i,logger:s,dynamoDbDocumentClientOptions:o={}}=t,{overrideInputFilterSensitiveLog:a}=o,c=a??t.inputFilterSensitiveLog;throw s?.error?.({clientName:r,commandName:i,input:c(n.input),error:e,metadata:e.$metadata}),e}},loggerMiddlewareOptions={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},getLoggerPlugin=e=>({applyToStack:e=>{e.add(loggerMiddleware(),loggerMiddlewareOptions)}}),TRACE_ID_HEADER_NAME="X-Amzn-Trace-Id",ENV_LAMBDA_FUNCTION_NAME="AWS_LAMBDA_FUNCTION_NAME",ENV_TRACE_ID="_X_AMZN_TRACE_ID",recursionDetectionMiddleware=e=>t=>async n=>{const{request:r}=n;if(!HttpRequest.isInstance(r)||"node"!==e.runtime||r.headers.hasOwnProperty(TRACE_ID_HEADER_NAME))return t(n);const i=[][ENV_TRACE_ID],s=e=>"string"==typeof e&&e.length>0;return s([][ENV_LAMBDA_FUNCTION_NAME])&&s(i)&&(r.headers[TRACE_ID_HEADER_NAME]=i),t({...n,request:r})},addRecursionDetectionMiddlewareOptions={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},getRecursionDetectionPlugin=e=>({applyToStack:t=>{t.add(recursionDetectionMiddleware(e),addRecursionDetectionMiddlewareOptions)}});function resolveUserAgentConfig(e){return{...e,customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent}}const IP_V4_REGEX=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),isIpAddress=e=>IP_V4_REGEX.test(e)||e.startsWith("[")&&e.endsWith("]"),VALID_HOST_LABEL_REGEX=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),isValidHostLabel=(e,t=!1)=>{if(!t)return VALID_HOST_LABEL_REGEX.test(e);const n=e.split(".");for(const e of n)if(!isValidHostLabel(e))return!1;return!0},customEndpointFunctions={},debugId="endpoints";function toDebugString(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${toDebugString(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(toDebugString).join(", ")})`:JSON.stringify(e,null,2)}class EndpointError extends Error{constructor(e){super(e),this.name="EndpointError"}}const booleanEquals=(e,t)=>e===t,getAttrPathList=e=>{const t=e.split("."),n=[];for(const r of t){const t=r.indexOf("[");if(-1!==t){if(r.indexOf("]")!==r.length-1)throw new EndpointError(`Path: '${e}' does not end with ']'`);const i=r.slice(t+1,-1);if(Number.isNaN(parseInt(i)))throw new EndpointError(`Invalid array index: '${i}' in path: '${e}'`);0!==t&&n.push(r.slice(0,t)),n.push(i)}else n.push(r)}return n},getAttr=(e,t)=>getAttrPathList(t).reduce(((n,r)=>{if("object"!=typeof n)throw new EndpointError(`Index '${r}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(r)]:n[r]}),e),isSet=e=>null!=e,not=e=>!e,DEFAULT_PORTS={[EndpointURLScheme.HTTP]:80,[EndpointURLScheme.HTTPS]:443},parseURL=e=>{const t=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:n,protocol:r="",path:i="",query:s={}}=e,o=new URL(`${r}//${t}${n?`:${n}`:""}${i}`);return o.search=Object.entries(s).map((([e,t])=>`${e}=${t}`)).join("&"),o}return new URL(e)}catch(e){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:r,hostname:i,pathname:s,protocol:o,search:a}=t;if(a)return null;const c=o.slice(0,-1);if(!Object.values(EndpointURLScheme).includes(c))return null;const u=isIpAddress(i);return{scheme:c,authority:`${r}${n.includes(`${r}:${DEFAULT_PORTS[c]}`)||"string"==typeof e&&e.includes(`${r}:${DEFAULT_PORTS[c]}`)?`:${DEFAULT_PORTS[c]}`:""}`,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,isIp:u}},stringEquals=(e,t)=>e===t,substring=(e,t,n,r)=>t>=n||e.length<n?null:r?e.substring(e.length-n,e.length-t):e.substring(t,n),uriEncode=e=>encodeURIComponent(e).replace(/[!*'()]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),endpointFunctions={booleanEquals:booleanEquals,getAttr:getAttr,isSet:isSet,isValidHostLabel:isValidHostLabel,not:not,parseURL:parseURL,stringEquals:stringEquals,substring:substring,uriEncode:uriEncode},evaluateTemplate=(e,t)=>{const n=[],r={...t.endpointParams,...t.referenceRecord};let i=0;for(;i<e.length;){const t=e.indexOf("{",i);if(-1===t){n.push(e.slice(i));break}n.push(e.slice(i,t));const s=e.indexOf("}",t);if(-1===s){n.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[s+1]&&(n.push(e.slice(t+1,s)),i=s+2);const o=e.substring(t+1,s);if(o.includes("#")){const[e,t]=o.split("#");n.push(getAttr(r[e],t))}else n.push(r[o]);i=s+1}return n.join("")},getReferenceValue=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]),evaluateExpression=(e,t,n)=>{if("string"==typeof e)return evaluateTemplate(e,n);if(e.fn)return callFunction(e,n);if(e.ref)return getReferenceValue(e,n);throw new EndpointError(`'${t}': ${String(e)} is not a string, function or reference.`)},callFunction=({fn:e,argv:t},n)=>{const r=t.map((e=>["boolean","number"].includes(typeof e)?e:evaluateExpression(e,"arg",n))),i=e.split(".");return i[0]in customEndpointFunctions&&null!=i[1]?customEndpointFunctions[i[0]][i[1]](...r):endpointFunctions[e](...r)},evaluateCondition=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new EndpointError(`'${e}' is already defined in Reference Record.`);const r=callFunction(t,n);return n.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(t)} = ${toDebugString(r)}`),{result:""===r||!!r,...null!=e&&{toAssign:{name:e,value:r}}}},evaluateConditions=(e=[],t)=>{const n={};for(const r of e){const{result:e,toAssign:i}=evaluateCondition(r,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};i&&(n[i.name]=i.value,t.logger?.debug?.(`${debugId} assign: ${i.name} := ${toDebugString(i.value)}`))}return{result:!0,referenceRecord:n}},getEndpointHeaders=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:r.map((e=>{const r=evaluateExpression(e,"Header value entry",t);if("string"!=typeof r)throw new EndpointError(`Header '${n}' value '${r}' is not a string`);return r}))})),{}),getEndpointProperty=(e,t)=>{if(Array.isArray(e))return e.map((e=>getEndpointProperty(e,t)));switch(typeof e){case"string":return evaluateTemplate(e,t);case"object":if(null===e)throw new EndpointError(`Unexpected endpoint property: ${e}`);return getEndpointProperties(e,t);case"boolean":return e;default:throw new EndpointError("Unexpected endpoint property type: "+typeof e)}},getEndpointProperties=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:getEndpointProperty(r,t)})),{}),getEndpointUrl=(e,t)=>{const n=evaluateExpression(e,"Endpoint URL",t);if("string"==typeof n)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new EndpointError("Endpoint URL must be a string, got "+typeof n)},evaluateEndpointRule=(e,t)=>{const{conditions:n,endpoint:r}=e,{result:i,referenceRecord:s}=evaluateConditions(n,t);if(!i)return;const o={...t,referenceRecord:{...t.referenceRecord,...s}},{url:a,properties:c,headers:u}=r;return t.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(r)}`),{...null!=u&&{headers:getEndpointHeaders(u,o)},...null!=c&&{properties:getEndpointProperties(c,o)},url:getEndpointUrl(a,o)}},evaluateErrorRule=(e,t)=>{const{conditions:n,error:r}=e,{result:i,referenceRecord:s}=evaluateConditions(n,t);if(i)throw new EndpointError(evaluateExpression(r,"Error",{...t,referenceRecord:{...t.referenceRecord,...s}}))},evaluateTreeRule=(e,t)=>{const{conditions:n,rules:r}=e,{result:i,referenceRecord:s}=evaluateConditions(n,t);if(i)return evaluateRules(r,{...t,referenceRecord:{...t.referenceRecord,...s}})},evaluateRules=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=evaluateEndpointRule(n,t);if(e)return e}else if("error"===n.type)evaluateErrorRule(n,t);else{if("tree"!==n.type)throw new EndpointError(`Unknown endpoint rule: ${n}`);{const e=evaluateTreeRule(n,t);if(e)return e}}throw new EndpointError("Rules evaluation failed")},resolveEndpoint=(e,t)=>{const{endpointParams:n,logger:r}=t,{parameters:i,rules:s}=e;t.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(n)}`);const o=Object.entries(i).filter((([,e])=>null!=e.default)).map((([e,t])=>[e,t.default]));if(o.length>0)for(const[e,t]of o)n[e]=n[e]??t;const a=Object.entries(i).filter((([,e])=>e.required)).map((([e])=>e));for(const e of a)if(null==n[e])throw new EndpointError(`Missing required parameter: '${e}'`);const c=evaluateRules(s,{endpointParams:n,logger:r,referenceRecord:{}});if(t.endpointParams?.Endpoint)try{const e=new URL(t.endpointParams.Endpoint),{protocol:n,port:r}=e;c.url.protocol=n,c.url.port=r}catch(e){}return t.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(c)}`),c},isVirtualHostableS3Bucket=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!isVirtualHostableS3Bucket(t))return!1;return!0}return!!isValidHostLabel(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!isIpAddress(e)))},parseArn=e=>{const t=e.split(":");if(t.length<6)return null;const[n,r,i,s,o,...a]=t;return"arn"!==n||""===r||""===i||""===a[0]?null:{partition:r,service:i,region:s,accountId:o,resourceId:a[0].includes("/")?a[0].split("/"):a}},partitions=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],version$3="1.1";var partitionsInfo={partitions:partitions,version:version$3};let selectedPartitionsInfo=partitionsInfo;const partition=e=>{const{partitions:t}=selectedPartitionsInfo;for(const n of t){const{regions:t,outputs:r}=n;for(const[n,i]of Object.entries(t))if(n===e)return{...r,...i}}for(const n of t){const{regionRegex:t,outputs:r}=n;if(new RegExp(t).test(e))return{...r}}const n=t.find((e=>"aws"===e.id));if(!n)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...n.outputs}},awsEndpointFunctions={isVirtualHostableS3Bucket:isVirtualHostableS3Bucket,parseArn:parseArn,partition:partition};customEndpointFunctions.aws=awsEndpointFunctions;const USER_AGENT$1="user-agent",X_AMZ_USER_AGENT="x-amz-user-agent",SPACE=" ",UA_NAME_SEPARATOR="/",UA_NAME_ESCAPE_REGEX=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,UA_VALUE_ESCAPE_REGEX=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,UA_ESCAPE_CHAR="-",userAgentMiddleware=e=>(t,n)=>async r=>{const{request:i}=r;if(!HttpRequest.isInstance(i))return t(r);const{headers:s}=i,o=n?.userAgent?.map(escapeUserAgent)||[],a=(await e.defaultUserAgentProvider()).map(escapeUserAgent),c=e?.customUserAgent?.map(escapeUserAgent)||[],u=[].concat([...a,...o,...c]).join(SPACE),d=[...a.filter((e=>e.startsWith("aws-sdk-"))),...c].join(SPACE);return"browser"!==e.runtime?(d&&(s[X_AMZ_USER_AGENT]=s[X_AMZ_USER_AGENT]?`${s[USER_AGENT$1]} ${d}`:d),s[USER_AGENT$1]=u):s[X_AMZ_USER_AGENT]=u,t({...r,request:i})},escapeUserAgent=e=>{const t=e[0].split(UA_NAME_SEPARATOR).map((e=>e.replace(UA_NAME_ESCAPE_REGEX,UA_ESCAPE_CHAR))).join(UA_NAME_SEPARATOR),n=e[1]?.replace(UA_VALUE_ESCAPE_REGEX,UA_ESCAPE_CHAR),r=t.indexOf(UA_NAME_SEPARATOR),i=t.substring(0,r);let s=t.substring(r+1);return"api"===i&&(s=s.toLowerCase()),[i,s,n].filter((e=>e&&e.length>0)).reduce(((e,t,n)=>{switch(n){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}}),"")},getUserAgentMiddlewareOptions={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},getUserAgentPlugin=e=>({applyToStack:t=>{t.add(userAgentMiddleware(e),getUserAgentMiddlewareOptions)}});var SelectorType;!function(e){e.ENV="env",e.CONFIG="shared config entry"}(SelectorType||(SelectorType={}));const DEFAULT_USE_DUALSTACK_ENDPOINT=!1,DEFAULT_USE_FIPS_ENDPOINT=!1,getSmithyContext=e=>e[SMITHY_CONTEXT_KEY]||(e[SMITHY_CONTEXT_KEY]={}),normalizeProvider$1=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},isFipsRegion=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),getRealRegion=e=>isFipsRegion(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e,resolveRegionConfig=e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return{...e,region:async()=>{if("string"==typeof t)return getRealRegion(t);const e=await t();return getRealRegion(e)},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!isFipsRegion(e)||("function"!=typeof n?Promise.resolve(!!n):n())}}};function convertHttpAuthSchemesToMap(e){const t=new Map;for(const n of e)t.set(n.schemeId,n);return t}const httpAuthSchemeMiddleware=(e,t)=>(n,r)=>async i=>{const s=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,r,i.input)),o=convertHttpAuthSchemesToMap(e.httpAuthSchemes),a=getSmithyContext(r),c=[];for(const n of s){const i=o.get(n.schemeId);if(!i){c.push(`HttpAuthScheme \`${n.schemeId}\` was not enabled for this service.`);continue}const s=i.identityProvider(await t.identityProviderConfigProvider(e));if(!s){c.push(`HttpAuthScheme \`${n.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:u={},signingProperties:d={}}=n.propertiesExtractor?.(e,r)||{};n.identityProperties=Object.assign(n.identityProperties||{},u),n.signingProperties=Object.assign(n.signingProperties||{},d),a.selectedHttpAuthScheme={httpAuthOption:n,identity:await s(n.identityProperties),signer:i.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join("\n"));return n(i)},resolveParamsForS3=async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),isArnBucketName(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!isDnsCompatibleBucketName(t)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},DOMAIN_PATTERN=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,IP_ADDRESS_PATTERN=/(\d+\.){3}\d+/,DOTS_PATTERN=/\.\./,isDnsCompatibleBucketName=e=>DOMAIN_PATTERN.test(e)&&!IP_ADDRESS_PATTERN.test(e)&&!DOTS_PATTERN.test(e),isArnBucketName=e=>{const[t,n,r,,,i]=e.split(":"),s="arn"===t&&e.split(":").length>=6,o=Boolean(s&&n&&r&&i);if(s&&!o)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return o},createConfigValueProvider=(e,t,n)=>{const r=async()=>{const r=n[e]??n[t];return"function"==typeof r?r():r};return"credentialScope"===e||"CredentialScope"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.credentialScope??e?.CredentialScope}:"accountId"===e||"AccountId"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.accountId??e?.AccountId}:"endpoint"===e||"endpoint"===t?async()=>{const e=await r();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:n,port:r,path:i}=e;return`${t}//${n}${r?":"+r:""}${i}`}}return e}:r},getEndpointFromConfig=async e=>{};function parseQueryString(e){const t={};if(e=e.replace(/^\?/,""))for(const n of e.split("&")){let[e,r=null]=n.split("=");e=decodeURIComponent(e),r&&(r=decodeURIComponent(r)),e in t?Array.isArray(t[e])?t[e].push(r):t[e]=[t[e],r]:t[e]=r}return t}const parseUrl=e=>{if("string"==typeof e)return parseUrl(new URL(e));const{hostname:t,pathname:n,port:r,protocol:i,search:s}=e;let o;return s&&(o=parseQueryString(s)),{hostname:t,port:r?parseInt(r):void 0,protocol:i,path:n,query:o}},toEndpointV1=e=>"object"==typeof e?"url"in e?parseUrl(e.url):e:parseUrl(e),getEndpointFromInstructions=async(e,t,n,r)=>{if(!n.endpoint){const e=await getEndpointFromConfig(n.serviceId||"");e&&(n.endpoint=()=>Promise.resolve(toEndpointV1(e)))}const i=await resolveParams(e,t,n);if("function"!=typeof n.endpointProvider)throw new Error("config.endpointProvider is not set.");return n.endpointProvider(i,r)},resolveParams=async(e,t,n)=>{const r={},i=t?.getEndpointParameterInstructions?.()||{};for(const[t,s]of Object.entries(i))switch(s.type){case"staticContextParams":r[t]=s.value;break;case"contextParams":r[t]=e[s.name];break;case"clientContextParams":case"builtInParams":r[t]=await createConfigValueProvider(s.name,t,n)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return 0===Object.keys(i).length&&Object.assign(r,n),"s3"===String(n.serviceId).toLowerCase()&&await resolveParamsForS3(r),r},endpointMiddleware=({config:e,instructions:t})=>(n,r)=>async i=>{const s=await getEndpointFromInstructions(i.input,{getEndpointParameterInstructions:()=>t},{...e},r);r.endpointV2=s,r.authSchemes=s.properties?.authSchemes;const o=r.authSchemes?.[0];if(o){r.signing_region=o.signingRegion,r.signing_service=o.signingName;const e=getSmithyContext(r),t=e?.selectedHttpAuthScheme?.httpAuthOption;t&&(t.signingProperties=Object.assign(t.signingProperties||{},{signing_region:o.signingRegion,signingRegion:o.signingRegion,signing_service:o.signingName,signingName:o.signingName,signingRegionSet:o.signingRegionSet},o.properties))}return n({...i})},deserializerMiddleware=(e,t)=>n=>async r=>{const{response:i}=await n(r);try{return{response:i,output:await t(i,e)}}catch(e){if(Object.defineProperty(e,"$response",{value:i}),!("$metadata"in e)){const t="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";e.message+="\n "+t,void 0!==e.$responseBodyText&&e.$response&&(e.$response.body=e.$responseBodyText)}throw e}},serializerMiddleware=(e,t)=>(n,r)=>async i=>{const s=r.endpointV2?.url&&e.urlParser?async()=>e.urlParser(r.endpointV2.url):e.endpoint;if(!s)throw new Error("No valid endpoint provider available.");const o=await t(i.input,{...e,endpoint:s});return n({...i,request:o})},deserializerMiddlewareOption={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},serializerMiddlewareOption={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function getSerdePlugin(e,t,n){return{applyToStack:r=>{r.add(deserializerMiddleware(e,n),deserializerMiddlewareOption),r.add(serializerMiddleware(e,t),serializerMiddlewareOption)}}}const endpointMiddlewareOptions={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:serializerMiddlewareOption.name},getEndpointPlugin=(e,t)=>({applyToStack:n=>{n.addRelativeTo(endpointMiddleware({config:e,instructions:t}),endpointMiddlewareOptions)}}),resolveEndpointConfig=e=>{const t=e.tls??!0,{endpoint:n}=e,r=null!=n?async()=>toEndpointV1(await normalizeProvider$1(n)()):void 0,i=!!n;return{...e,endpoint:r,tls:t,isCustomEndpoint:i,useDualstackEndpoint:normalizeProvider$1(e.useDualstackEndpoint??!1),useFipsEndpoint:normalizeProvider$1(e.useFipsEndpoint??!1)}},httpAuthSchemeEndpointRuleSetMiddlewareOptions={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:endpointMiddlewareOptions.name},getHttpAuthSchemeEndpointRuleSetPlugin=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:r=>{r.addRelativeTo(httpAuthSchemeMiddleware(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),httpAuthSchemeEndpointRuleSetMiddlewareOptions)}});serializerMiddlewareOption.name;const defaultErrorHandler=e=>e=>{throw e},defaultSuccessHandler=(e,t)=>{},httpSigningMiddleware=e=>(e,t)=>async n=>{if(!HttpRequest.isInstance(n.request))return e(n);const r=getSmithyContext(t).selectedHttpAuthScheme;if(!r)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:i={}},identity:s,signer:o}=r,a=await e({...n,request:await o.sign(n.request,s,i)}).catch((o.errorHandler||defaultErrorHandler)(i));return(o.successHandler||defaultSuccessHandler)(a.response,i),a};var RETRY_MODES;!function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"}(RETRY_MODES||(RETRY_MODES={}));const DEFAULT_MAX_ATTEMPTS=3,DEFAULT_RETRY_MODE=RETRY_MODES.STANDARD,THROTTLING_ERROR_CODES=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],TRANSIENT_ERROR_CODES=["TimeoutError","RequestTimeout","RequestTimeoutException"],TRANSIENT_ERROR_STATUS_CODES=[500,502,503,504],NODEJS_TIMEOUT_ERROR_CODES=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],isClockSkewCorrectedError=e=>e.$metadata?.clockSkewCorrected,isThrottlingError=e=>429===e.$metadata?.httpStatusCode||THROTTLING_ERROR_CODES.includes(e.name)||1==e.$retryable?.throttling,isTransientError=e=>isClockSkewCorrectedError(e)||TRANSIENT_ERROR_CODES.includes(e.name)||NODEJS_TIMEOUT_ERROR_CODES.includes(e?.code||"")||TRANSIENT_ERROR_STATUS_CODES.includes(e.$metadata?.httpStatusCode||0),isServerError=e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!isTransientError(e)}return!1};class DefaultRateLimiter{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise((e=>setTimeout(e,t)))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),isThrottlingError(e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const n=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const DEFAULT_RETRY_DELAY_BASE=100,MAXIMUM_RETRY_DELAY=2e4,THROTTLING_RETRY_DELAY_BASE=500,INITIAL_RETRY_TOKENS=500,RETRY_COST=5,TIMEOUT_RETRY_COST=10,NO_RETRY_INCREMENT=1,INVOCATION_ID_HEADER="amz-sdk-invocation-id",REQUEST_HEADER="amz-sdk-request",getDefaultRetryBackoffStrategy=()=>{let e=DEFAULT_RETRY_DELAY_BASE;return{computeNextBackoffDelay:t=>Math.floor(Math.min(MAXIMUM_RETRY_DELAY,Math.random()*2**t*e)),setDelayBase:t=>{e=t}}},createDefaultRetryToken=({retryDelay:e,retryCount:t,retryCost:n})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(MAXIMUM_RETRY_DELAY,e),getRetryCost:()=>n});class StandardRetryStrategy{constructor(e){this.maxAttempts=e,this.mode=RETRY_MODES.STANDARD,this.capacity=INITIAL_RETRY_TOKENS,this.retryBackoffStrategy=getDefaultRetryBackoffStrategy(),this.maxAttemptsProvider="function"==typeof e?e:async()=>e}async acquireInitialRetryToken(e){return createDefaultRetryToken({retryDelay:DEFAULT_RETRY_DELAY_BASE,retryCount:0})}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts();if(this.shouldRetry(e,t,n)){const n=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===n?THROTTLING_RETRY_DELAY_BASE:DEFAULT_RETRY_DELAY_BASE);const r=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),i=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,r):r,s=this.getCapacityCost(n);return this.capacity-=s,createDefaultRetryToken({retryDelay:i,retryCount:e.getRetryCount()+1,retryCost:s})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(INITIAL_RETRY_TOKENS,this.capacity+(e.getRetryCost()??NO_RETRY_INCREMENT))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`),DEFAULT_MAX_ATTEMPTS}}shouldRetry(e,t,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return"TRANSIENT"===e?TIMEOUT_RETRY_COST:RETRY_COST}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class AdaptiveRetryStrategy{constructor(e,t){this.maxAttemptsProvider=e,this.mode=RETRY_MODES.ADAPTIVE;const{rateLimiter:n}=t??{};this.rateLimiter=n??new DefaultRateLimiter,this.standardRetryStrategy=new StandardRetryStrategy(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const byteToHex=[];for(let e=0;e<256;++e)byteToHex.push((e+256).toString(16).slice(1));function unsafeStringify(e,t=0){return byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+"-"+byteToHex[e[t+4]]+byteToHex[e[t+5]]+"-"+byteToHex[e[t+6]]+byteToHex[e[t+7]]+"-"+byteToHex[e[t+8]]+byteToHex[e[t+9]]+"-"+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]}const randomUUID="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var native={randomUUID:randomUUID};function v4(e,t,n){if(native.randomUUID&&!t&&!e)return native.randomUUID();const r=(e=e||{}).random||(e.rng||rng)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,unsafeStringify(r)}const asSdkError=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`),resolveRetryConfig=e=>{const{retryStrategy:t}=e,n=normalizeProvider$1(e.maxAttempts??DEFAULT_MAX_ATTEMPTS);return{...e,maxAttempts:n,retryStrategy:async()=>{if(t)return t;return await normalizeProvider$1(e.retryMode)()===RETRY_MODES.ADAPTIVE?new AdaptiveRetryStrategy(n):new StandardRetryStrategy(n)}}};class NoOpLogger{trace(){}debug(){}info(){}warn(){}error(){}}const getAllAliases=(e,t)=>{const n=[];if(e&&n.push(e),t)for(const e of t)n.push(e);return n},getMiddlewareNameWithAliases=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,constructStack=()=>{let e=[],t=[],n=!1;const r=new Set,i=n=>(e.forEach((e=>{n.add(e.middleware,{...e})})),t.forEach((e=>{n.addRelativeTo(e.middleware,{...e})})),n.identifyOnResolve?.(a.identifyOnResolve()),n),s=e=>{const t=[];return e.before.forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...s(e))})),t.push(e),e.after.reverse().forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...s(e))})),t},o=(n=!1)=>{const r=[],i=[],o={};e.forEach((e=>{const t={...e,before:[],after:[]};for(const e of getAllAliases(t.name,t.aliases))o[e]=t;r.push(t)})),t.forEach((e=>{const t={...e,before:[],after:[]};for(const e of getAllAliases(t.name,t.aliases))o[e]=t;i.push(t)})),i.forEach((e=>{if(e.toMiddleware){const t=o[e.toMiddleware];if(void 0===t){if(n)return;throw new Error(`${e.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}}));const a=(c=r,c.sort(((e,t)=>stepWeights[t.step]-stepWeights[e.step]||priorityWeights[t.priority||"normal"]-priorityWeights[e.priority||"normal"]))).map(s).reduce(((e,t)=>(e.push(...t),e)),[]);var c;return a},a={add:(t,n={})=>{const{name:i,override:s,aliases:o}=n,a={step:"initialize",priority:"normal",middleware:t,...n},c=getAllAliases(i,o);if(c.length>0){if(c.some((e=>r.has(e)))){if(!s)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(i,o)}'`);for(const t of c){const n=e.findIndex((e=>e.name===t||e.aliases?.some((e=>e===t))));if(-1===n)continue;const r=e[n];if(r.step!==a.step||a.priority!==r.priority)throw new Error(`"${getMiddlewareNameWithAliases(r.name,r.aliases)}" middleware with ${r.priority} priority in ${r.step} step cannot be overridden by "${getMiddlewareNameWithAliases(i,o)}" middleware with ${a.priority} priority in ${a.step} step.`);e.splice(n,1)}}for(const e of c)r.add(e)}e.push(a)},addRelativeTo:(e,n)=>{const{name:i,override:s,aliases:o}=n,a={middleware:e,...n},c=getAllAliases(i,o);if(c.length>0){if(c.some((e=>r.has(e)))){if(!s)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(i,o)}'`);for(const e of c){const n=t.findIndex((t=>t.name===e||t.aliases?.some((t=>t===e))));if(-1===n)continue;const r=t[n];if(r.toMiddleware!==a.toMiddleware||r.relation!==a.relation)throw new Error(`"${getMiddlewareNameWithAliases(r.name,r.aliases)}" middleware ${r.relation} "${r.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(i,o)}" middleware ${a.relation} "${a.toMiddleware}" middleware.`);t.splice(n,1)}}for(const e of c)r.add(e)}t.push(a)},clone:()=>i(constructStack()),use:e=>{e.applyToStack(a)},remove:n=>"string"==typeof n?(n=>{let i=!1;const s=e=>{const t=getAllAliases(e.name,e.aliases);if(t.includes(n)){i=!0;for(const e of t)r.delete(e);return!1}return!0};return e=e.filter(s),t=t.filter(s),i})(n):(n=>{let i=!1;const s=e=>{if(e.middleware===n){i=!0;for(const t of getAllAliases(e.name,e.aliases))r.delete(t);return!1}return!0};return e=e.filter(s),t=t.filter(s),i})(n),removeByTag:n=>{let i=!1;const s=e=>{const{tags:t,name:s,aliases:o}=e;if(t&&t.includes(n)){const e=getAllAliases(s,o);for(const t of e)r.delete(t);return i=!0,!1}return!0};return e=e.filter(s),t=t.filter(s),i},concat:e=>{const t=i(constructStack());return t.use(e),t.identifyOnResolve(n||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:i,identify:()=>o(!0).map((e=>{const t=e.step??e.relation+" "+e.toMiddleware;return getMiddlewareNameWithAliases(e.name,e.aliases)+" - "+t})),identifyOnResolve:e=>("boolean"==typeof e&&(n=e),n),resolve:(e,t)=>{for(const n of o().map((e=>e.middleware)).reverse())e=n(e,t);return n&&console.log(a.identify()),e}};return a},stepWeights={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},priorityWeights={high:3,normal:2,low:1};class Client{constructor(e){this.middlewareStack=constructStack(),this.config=e}send(e,t,n){const r="function"!=typeof t?t:void 0,i="function"==typeof t?t:n,s=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!i)return s(e).then((e=>e.output));s(e).then((e=>i(null,e.output)),(e=>i(e))).catch((()=>{}))}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}const alphabetByEncoding={},alphabetByValue=new Array(64);for(let e=0,t="A".charCodeAt(0),n="Z".charCodeAt(0);e+t<=n;e++){const n=String.fromCharCode(e+t);alphabetByEncoding[n]=e,alphabetByValue[e]=n}for(let e=0,t="a".charCodeAt(0),n="z".charCodeAt(0);e+t<=n;e++){const n=String.fromCharCode(e+t),r=e+26;alphabetByEncoding[n]=r,alphabetByValue[r]=n}for(let e=0;e<10;e++){alphabetByEncoding[e.toString(10)]=e+52;const t=e.toString(10),n=e+52;alphabetByEncoding[t]=n,alphabetByValue[n]=t}alphabetByEncoding["+"]=62,alphabetByValue[62]="+",alphabetByEncoding["/"]=63,alphabetByValue[63]="/";const bitsPerLetter=6,bitsPerByte=8,maxLetterValue=63,fromBase64=e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const n=new ArrayBuffer(t),r=new DataView(n);for(let t=0;t<e.length;t+=4){let n=0,i=0;for(let r=t,s=t+3;r<=s;r++)if("="!==e[r]){if(!(e[r]in alphabetByEncoding))throw new TypeError(`Invalid character ${e[r]} in base64 string.`);n|=alphabetByEncoding[e[r]]<<(s-r)*bitsPerLetter,i+=bitsPerLetter}else n>>=bitsPerLetter;const s=t/4*3;n>>=i%bitsPerByte;const o=Math.floor(i/bitsPerByte);for(let e=0;e<o;e++){const t=(o-e-1)*bitsPerByte;r.setUint8(s+e,(n&255<<t)>>t)}}return new Uint8Array(n)},fromUtf8$2=e=>(new TextEncoder).encode(e),toUint8Array=e=>"string"==typeof e?fromUtf8$2(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),toUtf8=e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function toBase64(e){let t;t="string"==typeof e?fromUtf8$2(e):e;const n="object"==typeof t&&"number"==typeof t.length,r="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!n&&!r)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let i="";for(let e=0;e<t.length;e+=3){let n=0,r=0;for(let i=e,s=Math.min(e+3,t.length);i<s;i++)n|=t[i]<<(s-i-1)*bitsPerByte,r+=bitsPerByte;const s=Math.ceil(r/bitsPerLetter);n<<=s*bitsPerLetter-r;for(let e=1;e<=s;e++){const t=(s-e)*bitsPerLetter;i+=alphabetByValue[(n&maxLetterValue<<t)>>t]}i+="==".slice(0,4-s)}return i}function transformToString(e,t="utf-8"){return"base64"===t?toBase64(e):toUtf8(e)}function transformFromString(e,t){return"base64"===t?Uint8ArrayBlobAdapter.mutate(fromBase64(e)):Uint8ArrayBlobAdapter.mutate(fromUtf8$2(e))}class Uint8ArrayBlobAdapter extends Uint8Array{static fromString(e,t="utf-8"){if("string"==typeof e)return transformFromString(e,t);throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,Uint8ArrayBlobAdapter.prototype),e}transformToString(e="utf-8"){return transformToString(this,e)}}const escapeUri=e=>encodeURIComponent(e).replace(/[!'()*]/g,hexEncode),hexEncode=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function buildQueryString(e){const t=[];for(let n of Object.keys(e).sort()){const r=e[n];if(n=escapeUri(n),Array.isArray(r))for(let e=0,i=r.length;e<i;e++)t.push(`${n}=${escapeUri(r[e])}`);else{let e=n;(r||"string"==typeof r)&&(e+=`=${escapeUri(r)}`),t.push(e)}}return t.join("&")}function requestTimeout(e=0){return new Promise(((t,n)=>{e&&setTimeout((()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",n(t)}),e)}))}const keepAliveSupport={supported:void 0};class FetchHttpHandler{static create(e){return"function"==typeof e?.handle?e:new FetchHttpHandler(e)}constructor(e){"function"==typeof e?this.configProvider=e().then((e=>e||{})):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===keepAliveSupport.supported&&(keepAliveSupport.supported=Boolean("undefined"!=typeof Request&&"keepalive"in new Request("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t}={}){this.config||(this.config=await this.configProvider);const n=this.config.requestTimeout,r=!0===this.config.keepAlive,i=this.config.credentials;if(t?.aborted){const e=new Error("Request aborted");return e.name="AbortError",Promise.reject(e)}let s=e.path;const o=buildQueryString(e.query||{});o&&(s+=`?${o}`),e.fragment&&(s+=`#${e.fragment}`);let a="";if(null!=e.username||null!=e.password){a=`${e.username??""}:${e.password??""}@`}const{port:c,method:u}=e,d=`${e.protocol}//${a}${e.hostname}${c?`:${c}`:""}${s}`,l="GET"===u||"HEAD"===u?void 0:e.body,p={body:l,headers:new Headers(e.headers),method:u,credentials:i};l&&(p.duplex="half"),"undefined"!=typeof AbortController&&(p.signal=t),keepAliveSupport.supported&&(p.keepalive=r);let m=()=>{};const h=new Request(d,p),f=[fetch(h).then((e=>{const t=e.headers,n={};for(const e of t.entries())n[e[0]]=e[1];return null!=e.body?{response:new HttpResponse({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}:e.blob().then((t=>({response:new HttpResponse({headers:n,reason:e.statusText,statusCode:e.status,body:t})})))})),requestTimeout(n)];return t&&f.push(new Promise(((e,n)=>{const r=()=>{const e=new Error("Request aborted");e.name="AbortError",n(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",r,{once:!0}),m=()=>e.removeEventListener("abort",r)}else t.onabort=r}))),Promise.race(f).finally(m)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((n=>(n[e]=t,n)))}httpHandlerConfigs(){return this.config??{}}}const streamCollector=e=>"function"==typeof Blob&&e instanceof Blob?collectBlob(e):collectStream(e);async function collectBlob(e){const t=await readToBase64(e),n=fromBase64(t);return new Uint8Array(n)}async function collectStream(e){const t=[],n=e.getReader();let r=!1,i=0;for(;!r;){const{done:e,value:s}=await n.read();s&&(t.push(s),i+=s.length),r=e}const s=new Uint8Array(i);let o=0;for(const e of t)s.set(e,o),o+=e.length;return s}function readToBase64(e){return new Promise(((t,n)=>{const r=new FileReader;r.onloadend=()=>{if(2!==r.readyState)return n(new Error("Reader aborted too early"));const e=r.result??"",i=e.indexOf(","),s=i>-1?i+1:e.length;t(e.substring(s))},r.onabort=()=>n(new Error("Read aborted")),r.onerror=()=>n(r.error),r.readAsDataURL(e)}))}const SHORT_TO_HEX={},HEX_TO_SHORT={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),SHORT_TO_HEX[e]=t,HEX_TO_SHORT[t]=e}function fromHex(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const r=e.slice(n,n+2).toLowerCase();if(!(r in HEX_TO_SHORT))throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`);t[n/2]=HEX_TO_SHORT[r]}return t}function toHex(e){let t="";for(let n=0;n<e.byteLength;n++)t+=SHORT_TO_HEX[e[n]];return t}const collectBody=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return Uint8ArrayBlobAdapter.mutate(e);if(!e)return Uint8ArrayBlobAdapter.mutate(new Uint8Array);const n=t.streamCollector(e);return Uint8ArrayBlobAdapter.mutate(await n)};class Command{constructor(){this.middlewareStack=constructStack()}static classBuilder(){return new ClassBuilder}resolveMiddlewareWithContext(e,t,n,{middlewareFn:r,clientName:i,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:a,smithyContext:c,additionalContext:u,CommandCtor:d}){for(const i of r.bind(this)(d,e,t,n))this.middlewareStack.use(i);const l=e.concat(this.middlewareStack),{logger:p}=t,m={logger:p,clientName:i,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:a,[SMITHY_CONTEXT_KEY]:{...c},...u},{requestHandler:h}=t;return l.resolve((e=>h.handle(e.request,n||{})),m)}}class ClassBuilder{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=(e=>e),t=(e=>e)){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let t;return t=class extends Command{static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=t??{},e._init(this)}resolveMiddleware(n,r,i){return this.resolveMiddlewareWithContext(n,r,i,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}const SENSITIVE_STRING="***SensitiveInformation***",expectNumber=e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&logger$1.warn(stackTraceWarning(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},expectLong=e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}},expectNonNull=(e,t)=>{if(null==e)throw new TypeError("Expected a non-null value");return e},expectString=e=>{if(null!=e){if("string"==typeof e)return e;if(["boolean","number","bigint"].includes(typeof e))return logger$1.warn(stackTraceWarning(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},strictParseDouble=e=>expectNumber("string"==typeof e?parseNumber(e):e),NUMBER_REGEX=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,parseNumber=e=>{const t=e.match(NUMBER_REGEX);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},stackTraceWarning=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter((e=>!e.includes("stackTraceWarning"))).join("\n"),logger$1={warn:console.warn},parseEpochTimestamp=e=>{if(null==e)return;let t;if("number"==typeof e)t=e;else{if("string"!=typeof e)throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");t=strictParseDouble(e)}if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(1e3*t))};class ServiceException extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,ServiceException.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const decorateServiceException=(e,t={})=>{Object.entries(t).filter((([,e])=>void 0!==e)).forEach((([t,n])=>{null!=e[t]&&""!==e[t]||(e[t]=n)}));const n=e.message||e.Message||"UnknownError";return e.message=n,delete e.Message,e},throwDefaultError$1=({output:e,parsedBody:t,exceptionCtor:n,errorCode:r})=>{const i=deserializeMetadata$1(e),s=i.httpStatusCode?i.httpStatusCode+"":void 0,o=new n({name:t?.code||t?.Code||r||s||"UnknownError",$fault:"client",$metadata:i});throw decorateServiceException(o,t)},withBaseException=e=>({output:t,parsedBody:n,errorCode:r})=>{throwDefaultError$1({output:t,parsedBody:n,exceptionCtor:e,errorCode:r})},deserializeMetadata$1=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),loadConfigsForDefaultMode=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{}}},getChecksumConfiguration=e=>{const t=[];for(const n in AlgorithmId){const r=AlgorithmId[n];void 0!==e[r]&&t.push({algorithmId:()=>r,checksumConstructor:()=>e[r]})}return{_checksumAlgorithms:t,addChecksumAlgorithm(e){this._checksumAlgorithms.push(e)},checksumAlgorithms(){return this._checksumAlgorithms}}},resolveChecksumRuntimeConfig=e=>{const t={};return e.checksumAlgorithms().forEach((e=>{t[e.algorithmId()]=e.checksumConstructor()})),t},getRetryConfiguration=e=>{let t=e.retryStrategy;return{setRetryStrategy(e){t=e},retryStrategy:()=>t}},resolveRetryRuntimeConfig=e=>{const t={};return t.retryStrategy=e.retryStrategy(),t},getDefaultExtensionConfiguration=e=>({...getChecksumConfiguration(e),...getRetryConfiguration(e)}),resolveDefaultRuntimeConfig=e=>({...resolveChecksumRuntimeConfig(e),...resolveRetryRuntimeConfig(e)}),StringWrapper=function(){const e=Object.getPrototypeOf(this).constructor,t=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(t,e.prototype),t};StringWrapper.prototype=Object.create(String.prototype,{constructor:{value:StringWrapper,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(StringWrapper,String);const take=(e,t)=>{const n={};for(const r in t)applyInstruction(n,e,t,r);return n},applyInstruction=(e,t,n,r)=>{if(null!==t){let i=n[r];"function"==typeof i&&(i=[,i]);const[s=nonNullish,o=pass,a=r]=i;return void(("function"==typeof s&&s(t[a])||"function"!=typeof s&&s)&&(e[r]=o(t[a])))}let[i,s]=n[r];if("function"==typeof s){let t;const n=void 0===i&&null!=(t=s()),o="function"==typeof i&&!!i(void 0)||"function"!=typeof i&&!!i;n?e[r]=t:o&&(e[r]=s())}else{const t=void 0===i&&null!=s,n="function"==typeof i&&!!i(s)||"function"!=typeof i&&!!i;(t||n)&&(e[r]=s)}},nonNullish=e=>null!=e,pass=e=>e,_json=e=>{if(null==e)return{};if(Array.isArray(e))return e.filter((e=>null!=e)).map(_json);if("object"==typeof e){const t={};for(const n of Object.keys(e))null!=e[n]&&(t[n]=_json(e[n]));return t}return e},isStreamingPayload=e=>e?.body instanceof ReadableStream,retryMiddleware=e=>(t,n)=>async r=>{let i=await e.retryStrategy();const s=await e.maxAttempts();if(!isRetryStrategyV2(i))return i?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(t,r);{let e=await i.acquireInitialRetryToken(n.partition_id),o=new Error,a=0,c=0;const{request:u}=r,d=HttpRequest.isInstance(u);for(d&&(u.headers[INVOCATION_ID_HEADER]=v4());;)try{d&&(u.headers[REQUEST_HEADER]=`attempt=${a+1}; max=${s}`);const{response:n,output:o}=await t(r);return i.recordSuccess(e),o.$metadata.attempts=a+1,o.$metadata.totalRetryDelay=c,{response:n,output:o}}catch(t){const r=getRetryErrorInfo(t);if(o=asSdkError(t),d&&isStreamingPayload(u))throw(n.logger instanceof NoOpLogger?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),o;try{e=await i.refreshRetryTokenForRetry(e,r)}catch(e){throw o.$metadata||(o.$metadata={}),o.$metadata.attempts=a+1,o.$metadata.totalRetryDelay=c,o}a=e.getRetryCount();const s=e.getRetryDelay();c+=s,await new Promise((e=>setTimeout(e,s)))}}},isRetryStrategyV2=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,getRetryErrorInfo=e=>{const t={error:e,errorType:getRetryErrorType(e)},n=getRetryAfterHint(e.$response);return n&&(t.retryAfterHint=n),t},getRetryErrorType=e=>isThrottlingError(e)?"THROTTLING":isTransientError(e)?"TRANSIENT":isServerError(e)?"SERVER_ERROR":"CLIENT_ERROR",retryMiddlewareOptions={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},getRetryPlugin=e=>({applyToStack:t=>{t.add(retryMiddleware(e),retryMiddlewareOptions)}}),getRetryAfterHint=e=>{if(!HttpResponse.isInstance(e))return;const t=Object.keys(e.headers).find((e=>"retry-after"===e.toLowerCase()));if(!t)return;const n=e.headers[t],r=Number(n);if(!Number.isNaN(r))return new Date(1e3*r);return new Date(n)},httpSigningMiddlewareOptions={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:retryMiddlewareOptions.name},getHttpSigningPlugin=e=>({applyToStack:e=>{e.addRelativeTo(httpSigningMiddleware(),httpSigningMiddlewareOptions)}});class DefaultIdentityProviderConfig{constructor(e){this.authSchemes=new Map;for(const[t,n]of Object.entries(e))void 0!==n&&this.authSchemes.set(t,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}const createIsIdentityExpiredFunction=e=>t=>doesIdentityRequireRefresh(t)&&t.expiration.getTime()-Date.now()<e,EXPIRATION_MS=3e5,isIdentityExpired=createIsIdentityExpiredFunction(EXPIRATION_MS),doesIdentityRequireRefresh=e=>void 0!==e.expiration,memoizeIdentityProvider=(e,t,n)=>{if(void 0===e)return;const r="function"!=typeof e?async()=>Promise.resolve(e):e;let i,s,o,a=!1;const c=async e=>{s||(s=r(e));try{i=await s,o=!0,a=!1}finally{s=void 0}return i};return void 0===t?async e=>(o&&!e?.forceRefresh||(i=await c(e)),i):async e=>(o&&!e?.forceRefresh||(i=await c(e)),a?i:n(i)?t(i)?(await c(e),i):i:(a=!0,i))},normalizeProvider=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},CONTENT_LENGTH_HEADER="content-length";function contentLengthMiddleware(e){return t=>async n=>{const r=n.request;if(HttpRequest.isInstance(r)){const{body:t,headers:n}=r;if(t&&-1===Object.keys(n).map((e=>e.toLowerCase())).indexOf(CONTENT_LENGTH_HEADER))try{const n=e(t);r.headers={...r.headers,[CONTENT_LENGTH_HEADER]:String(n)}}catch(e){}}return t({...n,request:r})}}const contentLengthMiddlewareOptions={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},getContentLengthPlugin=e=>({applyToStack:t=>{t.add(contentLengthMiddleware(e.bodyLengthChecker),contentLengthMiddlewareOptions)}}),getDateHeader=e=>HttpResponse.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,getSkewCorrectedDate=e=>new Date(Date.now()+e),isClockSkewed=(e,t)=>Math.abs(getSkewCorrectedDate(t).getTime()-e)>=3e5,getUpdatedSystemClockOffset=(e,t)=>{const n=Date.parse(e);return isClockSkewed(n,t)?n-Date.now():t},throwSigningPropertyError=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},validateSigningProperties=async e=>{const t=throwSigningPropertyError("context",e.context),n=throwSigningPropertyError("config",e.config),r=t.endpointV2?.properties?.authSchemes?.[0],i=throwSigningPropertyError("signer",n.signer),s=await i(r),o=e?.signingRegion,a=e?.signingName;return{config:n,signer:s,signingRegion:o,signingName:a}};class AwsSdkSigV4Signer{async sign(e,t,n){if(!HttpRequest.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const{config:r,signer:i,signingRegion:s,signingName:o}=await validateSigningProperties(n);return await i.sign(e,{signingDate:getSkewCorrectedDate(r.systemClockOffset),signingRegion:s,signingService:o})}errorHandler(e){return t=>{const n=t.ServerTime??getDateHeader(t.$response);if(n){const r=throwSigningPropertyError("config",e.config),i=r.systemClockOffset;r.systemClockOffset=getUpdatedSystemClockOffset(n,r.systemClockOffset);r.systemClockOffset!==i&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=getDateHeader(e);if(n){const e=throwSigningPropertyError("config",t.config);e.systemClockOffset=getUpdatedSystemClockOffset(n,e.systemClockOffset)}}}const ALGORITHM_QUERY_PARAM="X-Amz-Algorithm",CREDENTIAL_QUERY_PARAM="X-Amz-Credential",AMZ_DATE_QUERY_PARAM="X-Amz-Date",SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders",EXPIRES_QUERY_PARAM="X-Amz-Expires",SIGNATURE_QUERY_PARAM="X-Amz-Signature",TOKEN_QUERY_PARAM="X-Amz-Security-Token",AUTH_HEADER="authorization",AMZ_DATE_HEADER=AMZ_DATE_QUERY_PARAM.toLowerCase(),DATE_HEADER="date",GENERATED_HEADERS=[AUTH_HEADER,AMZ_DATE_HEADER,DATE_HEADER],SIGNATURE_HEADER=SIGNATURE_QUERY_PARAM.toLowerCase(),SHA256_HEADER="x-amz-content-sha256",TOKEN_HEADER=TOKEN_QUERY_PARAM.toLowerCase(),ALWAYS_UNSIGNABLE_HEADERS={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},PROXY_HEADER_PATTERN=/^proxy-/,SEC_HEADER_PATTERN=/^sec-/,ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256",EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD",UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD",MAX_CACHE_SIZE=50,KEY_TYPE_IDENTIFIER="aws4_request",MAX_PRESIGNED_TTL=604800,signingKeyCache={},cacheQueue=[],createScope=(e,t,n)=>`${e}/${t}/${n}/${KEY_TYPE_IDENTIFIER}`,getSigningKey=async(e,t,n,r,i)=>{const s=`${n}:${r}:${i}:${toHex(await hmac(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(s in signingKeyCache)return signingKeyCache[s];for(cacheQueue.push(s);cacheQueue.length>MAX_CACHE_SIZE;)delete signingKeyCache[cacheQueue.shift()];let o=`AWS4${t.secretAccessKey}`;for(const t of[n,r,i,KEY_TYPE_IDENTIFIER])o=await hmac(e,o,t);return signingKeyCache[s]=o},hmac=(e,t,n)=>{const r=new e(t);return r.update(toUint8Array(n)),r.digest()},getCanonicalHeaders=({headers:e},t,n)=>{const r={};for(const i of Object.keys(e).sort()){if(null==e[i])continue;const s=i.toLowerCase();(s in ALWAYS_UNSIGNABLE_HEADERS||t?.has(s)||PROXY_HEADER_PATTERN.test(s)||SEC_HEADER_PATTERN.test(s))&&(!n||n&&!n.has(s))||(r[s]=e[i].trim().replace(/\s+/g," "))}return r},getCanonicalQuery=({query:e={}})=>{const t=[],n={};for(const r of Object.keys(e).sort()){if(r.toLowerCase()===SIGNATURE_HEADER)continue;t.push(r);const i=e[r];"string"==typeof i?n[r]=`${escapeUri(r)}=${escapeUri(i)}`:Array.isArray(i)&&(n[r]=i.slice(0).reduce(((e,t)=>e.concat([`${escapeUri(r)}=${escapeUri(t)}`])),[]).sort().join("&"))}return t.map((e=>n[e])).filter((e=>e)).join("&")},isArrayBuffer=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),getPayloadHash=async({headers:e,body:t},n)=>{for(const t of Object.keys(e))if(t.toLowerCase()===SHA256_HEADER)return e[t];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||isArrayBuffer(t)){const e=new n;return e.update(toUint8Array(t)),toHex(await e.digest())}return UNSIGNED_PAYLOAD};class HeaderFormatter{format(e){const t=[];for(const n of Object.keys(e)){const r=fromUtf8$2(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}const n=new Uint8Array(t.reduce(((e,t)=>e+t.byteLength),0));let r=0;for(const e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case"binary":const i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);const s=new Uint8Array(i.buffer);return s.set(e.value,3),s;case"string":const o=fromUtf8$2(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(Int64.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!UUID_PATTERN.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(fromHex(e.value.replace(/\-/g,"")),1),d}}}var HEADER_VALUE_TYPE;!function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"}(HEADER_VALUE_TYPE||(HEADER_VALUE_TYPE={}));const UUID_PATTERN=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Int64{constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,r=Math.abs(Math.round(e));n>-1&&r>0;n--,r/=256)t[n]=r;return e<0&&negate(t),new Int64(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&negate(e),parseInt(toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function negate(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const hasHeader=(e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1},moveHeadersToQuery=(e,t={})=>{const{headers:n,query:r={}}=HttpRequest.clone(e);for(const e of Object.keys(n)){const i=e.toLowerCase();"x-amz-"!==i.slice(0,6)||t.unhoistableHeaders?.has(i)||(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}},prepareRequest=e=>{e=HttpRequest.clone(e);for(const t of Object.keys(e.headers))GENERATED_HEADERS.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},iso8601=e=>toDate(e).toISOString().replace(/\.\d{3}Z$/,"Z"),toDate=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class SignatureV4{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:s=!0}){this.headerFormatter=new HeaderFormatter,this.service=r,this.sha256=i,this.uriEscapePath=s,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=normalizeProvider$1(n),this.credentialProvider=normalizeProvider$1(t)}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:s,signableHeaders:o,signingRegion:a,signingService:c}=t,u=await this.credentialProvider();this.validateResolvedCredentials(u);const d=a??await this.regionProvider(),{longDate:l,shortDate:p}=formatDate(n);if(r>MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const m=createScope(p,d,c??this.service),h=moveHeadersToQuery(prepareRequest(e),{unhoistableHeaders:s});u.sessionToken&&(h.query[TOKEN_QUERY_PARAM]=u.sessionToken),h.query[ALGORITHM_QUERY_PARAM]=ALGORITHM_IDENTIFIER,h.query[CREDENTIAL_QUERY_PARAM]=`${u.accessKeyId}/${m}`,h.query[AMZ_DATE_QUERY_PARAM]=l,h.query[EXPIRES_QUERY_PARAM]=r.toString(10);const f=getCanonicalHeaders(h,i,o);return h.query[SIGNED_HEADERS_QUERY_PARAM]=getCanonicalHeaderList(f),h.query[SIGNATURE_QUERY_PARAM]=await this.getSignature(l,m,this.getSigningKey(u,d,p,c),this.createCanonicalRequest(h,f,await getPayloadHash(e,this.sha256))),h}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:i,signingService:s}){const o=i??await this.regionProvider(),{shortDate:a,longDate:c}=formatDate(n),u=createScope(a,o,s??this.service),d=await getPayloadHash({headers:{},body:t},this.sha256),l=new this.sha256;l.update(e);const p=toHex(await l.digest()),m=[EVENT_ALGORITHM_IDENTIFIER,c,u,r,p,d].join("\n");return this.signString(m,{signingDate:n,signingRegion:o,signingService:s})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:r,priorSignature:e.priorSignature}).then((t=>({message:e.message,signature:t})))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:r}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const s=n??await this.regionProvider(),{shortDate:o}=formatDate(t),a=new this.sha256(await this.getSigningKey(i,s,o,r));return a.update(toUint8Array(e)),toHex(await a.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:r,signingRegion:i,signingService:s}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const a=i??await this.regionProvider(),c=prepareRequest(e),{longDate:u,shortDate:d}=formatDate(t),l=createScope(d,a,s??this.service);c.headers[AMZ_DATE_HEADER]=u,o.sessionToken&&(c.headers[TOKEN_HEADER]=o.sessionToken);const p=await getPayloadHash(c,this.sha256);!hasHeader(SHA256_HEADER,c.headers)&&this.applyChecksum&&(c.headers[SHA256_HEADER]=p);const m=getCanonicalHeaders(c,r,n),h=await this.getSignature(u,l,this.getSigningKey(o,a,d,s),this.createCanonicalRequest(c,m,p));return c.headers[AUTH_HEADER]=`${ALGORITHM_IDENTIFIER} Credential=${o.accessKeyId}/${l}, SignedHeaders=${getCanonicalHeaderList(m)}, Signature=${h}`,c}createCanonicalRequest(e,t,n){const r=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${getCanonicalQuery(e)}\n${r.map((e=>`${e}:${t[e]}`)).join("\n")}\n\n${r.join(";")}\n${n}`}async createStringToSign(e,t,n){const r=new this.sha256;r.update(toUint8Array(n));const i=await r.digest();return`${ALGORITHM_IDENTIFIER}\n${e}\n${t}\n${toHex(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return escapeUri(n).replace(/%2F/g,"/")}return e}async getSignature(e,t,n,r){const i=await this.createStringToSign(e,t,r),s=new this.sha256(await n);return s.update(toUint8Array(i)),toHex(await s.digest())}getSigningKey(e,t,n,r){return getSigningKey(this.sha256,e,n,t,r||this.service)}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}}const formatDate=e=>{const t=iso8601(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}},getCanonicalHeaderList=e=>Object.keys(e).sort().join(";"),resolveAwsSdkSigV4Config=e=>{let t;e.credentials&&(t=memoizeIdentityProvider(e.credentials,isIdentityExpired,doesIdentityRequireRefresh)),t||(t=e.credentialDefaultProvider?normalizeProvider(e.credentialDefaultProvider(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:n=!0,systemClockOffset:r=e.systemClockOffset||0,sha256:i}=e;let s;return s=e.signer?normalizeProvider(e.signer):e.regionInfoProvider?()=>normalizeProvider(e.region)().then((async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t])).then((([r,s])=>{const{signingRegion:o,signingService:a}=r;e.signingRegion=e.signingRegion||o||s,e.signingName=e.signingName||a||e.serviceId;const c={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n};return new(e.signerConstructor||SignatureV4)(c)})):async r=>{const s=(r=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await normalizeProvider(e.region)(),properties:{}},r)).signingRegion,o=r.signingName;e.signingRegion=e.signingRegion||s,e.signingName=e.signingName||o||e.serviceId;const a={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n};return new(e.signerConstructor||SignatureV4)(a)},{...e,systemClockOffset:r,signingEscapePath:n,credentials:t,signer:s}},collectBodyString=(e,t)=>collectBody(e,t).then((e=>t.utf8Encoder(e))),parseJsonBody=(e,t)=>collectBodyString(e,t).then((e=>{if(e.length)try{return JSON.parse(e)}catch(t){throw"SyntaxError"===t?.name&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}return{}})),parseJsonErrorBody=async(e,t)=>{const n=await parseJsonBody(e,t);return n.message=n.message??n.Message,n},loadRestJsonErrorCode=(e,t)=>{const n=e=>{let t=e;return"number"==typeof t&&(t=t.toString()),t.indexOf(",")>=0&&(t=t.split(",")[0]),t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},r=(i=e.headers,s="x-amzn-errortype",Object.keys(i).find((e=>e.toLowerCase()===s.toLowerCase())));var i,s;return void 0!==r?n(e.headers[r]):void 0!==t.code?n(t.code):void 0!==t.__type?n(t.__type):void 0};var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const defaultSSMHttpAuthSchemeParametersProvider=async(e,t,n)=>({operation:getSmithyContext(t).operation,region:await normalizeProvider$1(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"ssm",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const defaultSSMHttpAuthSchemeProvider=e=>{const t=[];return e.operation,t.push(createAwsAuthSigv4HttpAuthOption(e)),t},resolveHttpAuthSchemeConfig=e=>({...resolveAwsSdkSigV4Config(e)}),resolveClientEndpointParameters=e=>({...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"ssm"}),commonParams={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},name="@aws-sdk/client-ssm",description="AWS SDK for JavaScript Ssm Client for Node.js, Browser and React Native",version$2="3.621.0",scripts={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-ssm","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo ssm"},main="./dist-cjs/index.js",types="./dist-types/index.d.ts",module="./dist-es/index.js",sideEffects=!1,dependencies={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.621.0","@aws-sdk/client-sts":"3.621.0","@aws-sdk/core":"3.621.0","@aws-sdk/credential-provider-node":"3.621.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.620.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.614.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.3.1","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.13","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.1.11","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.13","@smithy/util-defaults-mode-node":"^3.0.13","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.1.2",tslib:"^2.6.2",uuid:"^9.0.1"},devDependencies={"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96","@types/uuid":"^9.0.4",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines={node:">=16.0.0"},typesVersions={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files=["dist-*/**"],author={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license="Apache-2.0",browser$1={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},homepage="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-ssm",repository={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-ssm"};var packageInfo={name:name,description:description,version:version$2,scripts:scripts,main:main,types:types,module:module,sideEffects:sideEffects,dependencies:dependencies,devDependencies:devDependencies,engines:engines,typesVersions:typesVersions,files:files,author:author,license:license,browser:browser$1,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:homepage,repository:repository};const fromUtf8$1=e=>(new TextEncoder).encode(e);var fromUtf8="undefined"!=typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:fromUtf8$1;function convertToBuffer(e){return e instanceof Uint8Array?e:"string"==typeof e?fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function isEmptyData(e){return"string"==typeof e?0===e.length:0===e.byteLength}var SHA_256_HASH={name:"SHA-256"},SHA_256_HMAC_ALGO={name:"HMAC",hash:SHA_256_HASH},EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const fallbackWindow={};function locateWindow(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:fallbackWindow}var Sha256$2=function(){function e(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return e.prototype.update=function(e){if(!isEmptyData(e)){var t=convertToBuffer(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return locateWindow().crypto.subtle.sign(SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):isEmptyData(this.toHash)?Promise.resolve(EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return locateWindow().crypto.subtle.digest(SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&void 0!==this.secret&&(this.key=new Promise((function(t,n){locateWindow().crypto.subtle.importKey("raw",convertToBuffer(e.secret),SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))},e}();function __awaiter(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}function __generator(e,t){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;var BLOCK_SIZE=64,DIGEST_LENGTH=32,KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],MAX_HASHABLE_LENGTH=Math.pow(2,53)-1,RawSha256=function(){function e(){this.state=Int32Array.from(INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%BLOCK_SIZE>=BLOCK_SIZE-8){for(var r=this.bufferLength;r<BLOCK_SIZE;r++)t.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(r=this.bufferLength;r<BLOCK_SIZE-8;r++)t.setUint8(r,0);t.setUint32(BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var i=new Uint8Array(DIGEST_LENGTH);for(r=0;r<8;r++)i[4*r]=this.state[r]>>>24&255,i[4*r+1]=this.state[r]>>>16&255,i[4*r+2]=this.state[r]>>>8&255,i[4*r+3]=this.state[r]>>>0&255;return i},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],r=t[1],i=t[2],s=t[3],o=t[4],a=t[5],c=t[6],u=t[7],d=0;d<BLOCK_SIZE;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var l=this.temp[d-2],p=(l>>>17|l<<15)^(l>>>19|l<<13)^l>>>10,m=((l=this.temp[d-15])>>>7|l<<25)^(l>>>18|l<<14)^l>>>3;this.temp[d]=(p+this.temp[d-7]|0)+(m+this.temp[d-16]|0)}var h=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&a^~o&c)|0)+(u+(KEY[d]+this.temp[d]|0)|0)|0,f=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&r^n&i^r&i)|0;u=c,c=a,a=o,o=s+h|0,s=i,i=r,r=n,n=h+f|0}t[0]+=n,t[1]+=r,t[2]+=i,t[3]+=s,t[4]+=o,t[5]+=a,t[6]+=c,t[7]+=u},e}(),Sha256$1=function(){function e(e){this.secret=e,this.hash=new RawSha256,this.reset()}return e.prototype.update=function(e){if(!isEmptyData(e)&&!this.error)try{this.hash.update(convertToBuffer(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.digestSync()]}))}))},e.prototype.reset=function(){if(this.hash=new RawSha256,this.secret){this.outer=new RawSha256;var e=bufferFromSecret(this.secret),t=new Uint8Array(BLOCK_SIZE);t.set(e);for(var n=0;n<BLOCK_SIZE;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(n=0;n<e.byteLength;n++)e[n]=0}},e}();function bufferFromSecret(e){var t=convertToBuffer(e);if(t.byteLength>BLOCK_SIZE){var n=new RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(BLOCK_SIZE);return r.set(t),r}var subtleCryptoMethods=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function supportsWebCrypto(e){return!(!supportsSecureRandom(e)||"object"!=typeof e.crypto.subtle)&&supportsSubtleCrypto(e.crypto.subtle)}function supportsSecureRandom(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function supportsSubtleCrypto(e){return e&&subtleCryptoMethods.every((function(t){return"function"==typeof e[t]}))}var Sha256=function(){function e(e){supportsWebCrypto(locateWindow())?this.hash=new Sha256$2(e):this.hash=new Sha256$1(e)}return e.prototype.update=function(e,t){this.hash.update(convertToBuffer(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}(),es5={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),s=e.getVersionPrecision(n),o=Math.max(i,s),a=0,c=e.map([t,n],(function(t){var n=o-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=o-Math.min(i,s)),o-=1;o>=a;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===a)return 0;o-=1}else if(c[0][o]<c[1][o])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(s));var a=function(){var e=s[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=s.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},s=n(18);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return s.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return s.ENGINE_MAP}},{key:"OS_MAP",get:function(){return s.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return s.PLATFORMS_MAP}}],(n=null)&&o(t.prototype,n),r&&o(t,r),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=c(n(92)),i=c(n(93)),s=c(n(94)),o=c(n(95)),a=c(n(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},s=0;if(Object.keys(e).forEach((function(t){var o=e[t];"string"==typeof o?(i[t]=o,s+=1):"object"==typeof o&&(n[t]=o,r+=1)})),r>0){var o=Object.keys(n),c=a.default.find(o,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var d=a.default.find(o,(function(e){return t.isPlatform(e)}));if(d){var l=this.satisfies(n[d]);if(void 0!==l)return l}}if(s>0){var p=Object.keys(i),m=a.default.find(p,(function(e){return t.isBrowser(e,!0)}));if(void 0!==m)return this.compareVersion(i[m])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},s=/version\/(\d+(\.?_?\d+)+)/i,o=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=o,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},s=n(18),o=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:s.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:s.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:s.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:s.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:s.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:s.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.PlayStation4,version:t}}}];t.default=o,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},s=n(18),o=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];t.default=o,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},s=n(18),o=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:s.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:s.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:s.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:s.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:s.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:s.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=o,e.exports=t.default}})}(es5);var es5Exports=es5.exports,bowser=getDefaultExportFromCjs(es5Exports);const defaultUserAgent=({serviceId:e,clientVersion:t})=>async()=>{const n="undefined"!=typeof window&&window?.navigator?.userAgent?bowser.parse(window.navigator.userAgent):void 0,r=[["aws-sdk-js",t],["ua","2.0"],[`os/${n?.os?.name||"other"}`,n?.os?.version],["lang/js"],["md/browser",`${n?.browser?.name??"unknown"}_${n?.browser?.version??"unknown"}`]];return e&&r.push([`api/${e}`,t]),r},invalidProvider=e=>()=>Promise.reject(e),TEXT_ENCODER="function"==typeof TextEncoder?new TextEncoder:null,calculateBodyLength=e=>{if("string"==typeof e){if(TEXT_ENCODER)return TEXT_ENCODER.encode(e).byteLength;let t=e.length;for(let n=t-1;n>=0;n--){const r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&n--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)},u="required",v="fn",w="argv",x="ref",a=!0,b="isSet",c="booleanEquals",d="error",e="endpoint",f="tree",g="PartitionResult",h="getAttr",i={[u]:!1,type:"String"},j={[u]:!0,default:!1,type:"Boolean"},k={[x]:"Endpoint"},l={[v]:c,[w]:[{[x]:"UseFIPS"},!0]},m={[v]:c,[w]:[{[x]:"UseDualStack"},!0]},n={},o={[v]:h,[w]:[{[x]:g},"supportsFIPS"]},p={[x]:g},q={[v]:c,[w]:[!0,{[v]:h,[w]:[p,"supportsDualStack"]}]},r=[l],s=[m],t=[{[x]:"Region"}],_data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i},rules:[{conditions:[{[v]:b,[w]:[k]}],rules:[{conditions:r,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d},{conditions:s,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d},{endpoint:{url:k,properties:n,headers:n},type:e}],type:f},{conditions:[{[v]:b,[w]:t}],rules:[{conditions:[{[v]:"aws.partition",[w]:t,assign:g}],rules:[{conditions:[l,m],rules:[{conditions:[{[v]:c,[w]:[a,o]},q],rules:[{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d}],type:f},{conditions:r,rules:[{conditions:[{[v]:c,[w]:[o,a]}],rules:[{conditions:[{[v]:"stringEquals",[w]:[{[v]:h,[w]:[p,"name"]},"aws-us-gov"]}],endpoint:{url:"https://ssm.{Region}.amazonaws.com",properties:n,headers:n},type:e},{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS is enabled but this partition does not support FIPS",type:d}],type:f},{conditions:s,rules:[{conditions:[q],rules:[{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"DualStack is enabled but this partition does not support DualStack",type:d}],type:f},{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f}],type:f},{error:"Invalid Configuration: Missing Region",type:d}]},ruleSet=_data,defaultEndpointResolver=(e,t={})=>resolveEndpoint(ruleSet,{endpointParams:e,logger:t.logger});customEndpointFunctions.aws=awsEndpointFunctions;const getRuntimeConfig$1=e=>({apiVersion:"2014-11-06",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultSSMHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer}],logger:e?.logger??new NoOpLogger,serviceId:e?.serviceId??"SSM",urlParser:e?.urlParser??parseUrl,utf8Decoder:e?.utf8Decoder??fromUtf8$2,utf8Encoder:e?.utf8Encoder??toUtf8}),memoize=(e,t,n)=>{let r,i,s,o=!1;return async t=>(s&&!t?.forceRefresh||(r=await(async()=>{i||(i=e());try{r=await i,s=!0,o=!1}finally{i=void 0}return r})()),r)},DEFAULTS_MODE_OPTIONS=["in-region","cross-region","mobile","standard","legacy"],resolveDefaultsModeConfig=({defaultsMode:e}={})=>memoize((async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(isMobileBrowser()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${t}`)}})),isMobileBrowser=()=>{const e="undefined"!=typeof window&&window?.navigator?.userAgent?bowser.parse(window.navigator.userAgent):void 0,t=e?.platform?.type;return"tablet"===t||"mobile"===t},getRuntimeConfig=e=>{const t=resolveDefaultsModeConfig(e),n=()=>t().then(loadConfigsForDefaultMode),r=getRuntimeConfig$1(e);return{...r,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??defaultUserAgent({serviceId:r.serviceId,clientVersion:packageInfo.version}),maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS,region:e?.region??invalidProvider("Region is missing"),requestHandler:FetchHttpHandler.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE),sha256:e?.sha256??Sha256,streamCollector:e?.streamCollector??streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT))}},getAwsRegionExtensionConfiguration=e=>{let t=async()=>{if(void 0===e.region)throw new Error("Region is missing from runtimeConfig");const t=e.region;return"string"==typeof t?t:t()};return{setRegion(e){t=e},region:()=>t}},resolveAwsRegionExtensionConfiguration=e=>({region:e.region()}),getHttpAuthExtensionConfiguration=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}},resolveHttpAuthRuntimeConfig=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),asPartial=e=>e,resolveRuntimeExtensions=(e,t)=>{const n={...asPartial(getAwsRegionExtensionConfiguration(e)),...asPartial(getDefaultExtensionConfiguration(e)),...asPartial(getHttpHandlerExtensionConfiguration(e)),...asPartial(getHttpAuthExtensionConfiguration(e))};return t.forEach((e=>e.configure(n))),{...e,...resolveAwsRegionExtensionConfiguration(n),...resolveDefaultRuntimeConfig(n),...resolveHttpHandlerRuntimeConfig(n),...resolveHttpAuthRuntimeConfig(n)}};class SSMClient extends Client{constructor(...[e]){const t=getRuntimeConfig(e||{}),n=resolveClientEndpointParameters(t),r=resolveRegionConfig(n),i=resolveUserAgentConfig(resolveHostHeaderConfig(resolveEndpointConfig(r))),s=resolveRetryConfig(i),o=resolveHttpAuthSchemeConfig(s),a=resolveRuntimeExtensions(o,e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(getHostHeaderPlugin(this.config)),this.middlewareStack.use(getLoggerPlugin(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(getUserAgentPlugin(this.config)),this.middlewareStack.use(getRetryPlugin(this.config)),this.middlewareStack.use(getContentLengthPlugin(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:this.getDefaultHttpAuthSchemeParametersProvider(),identityProviderConfigProvider:this.getIdentityProviderConfigProvider()})),this.middlewareStack.use(getHttpSigningPlugin(this.config))}destroy(){super.destroy()}getDefaultHttpAuthSchemeParametersProvider(){return defaultSSMHttpAuthSchemeParametersProvider}getIdentityProviderConfigProvider(){return async e=>new DefaultIdentityProviderConfig({"aws.auth#sigv4":e.credentials})}}class SSMServiceException extends ServiceException{constructor(e){super(e),Object.setPrototypeOf(this,SSMServiceException.prototype)}}class InternalServerError extends SSMServiceException{constructor(e){super({name:"InternalServerError",$fault:"server",...e}),this.name="InternalServerError",this.$fault="server",Object.setPrototypeOf(this,InternalServerError.prototype),this.Message=e.Message}}class InvalidResourceId extends SSMServiceException{constructor(e){super({name:"InvalidResourceId",$fault:"client",...e}),this.name="InvalidResourceId",this.$fault="client",Object.setPrototypeOf(this,InvalidResourceId.prototype)}}class InvalidResourceType extends SSMServiceException{constructor(e){super({name:"InvalidResourceType",$fault:"client",...e}),this.name="InvalidResourceType",this.$fault="client",Object.setPrototypeOf(this,InvalidResourceType.prototype)}}class TooManyTagsError extends SSMServiceException{constructor(e){super({name:"TooManyTagsError",$fault:"client",...e}),this.name="TooManyTagsError",this.$fault="client",Object.setPrototypeOf(this,TooManyTagsError.prototype)}}class TooManyUpdates extends SSMServiceException{constructor(e){super({name:"TooManyUpdates",$fault:"client",...e}),this.name="TooManyUpdates",this.$fault="client",Object.setPrototypeOf(this,TooManyUpdates.prototype),this.Message=e.Message}}class AlreadyExistsException extends SSMServiceException{constructor(e){super({name:"AlreadyExistsException",$fault:"client",...e}),this.name="AlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,AlreadyExistsException.prototype),this.Message=e.Message}}class OpsItemConflictException extends SSMServiceException{constructor(e){super({name:"OpsItemConflictException",$fault:"client",...e}),this.name="OpsItemConflictException",this.$fault="client",Object.setPrototypeOf(this,OpsItemConflictException.prototype),this.Message=e.Message}}class OpsItemInvalidParameterException extends SSMServiceException{constructor(e){super({name:"OpsItemInvalidParameterException",$fault:"client",...e}),this.name="OpsItemInvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,OpsItemInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class OpsItemLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsItemLimitExceededException",$fault:"client",...e}),this.name="OpsItemLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsItemLimitExceededException.prototype),this.ResourceTypes=e.ResourceTypes,this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class OpsItemNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsItemNotFoundException",$fault:"client",...e}),this.name="OpsItemNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsItemNotFoundException.prototype),this.Message=e.Message}}class OpsItemRelatedItemAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsItemRelatedItemAlreadyExistsException",$fault:"client",...e}),this.name="OpsItemRelatedItemAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsItemRelatedItemAlreadyExistsException.prototype),this.Message=e.Message,this.ResourceUri=e.ResourceUri,this.OpsItemId=e.OpsItemId}}class DuplicateInstanceId extends SSMServiceException{constructor(e){super({name:"DuplicateInstanceId",$fault:"client",...e}),this.name="DuplicateInstanceId",this.$fault="client",Object.setPrototypeOf(this,DuplicateInstanceId.prototype)}}class InvalidCommandId extends SSMServiceException{constructor(e){super({name:"InvalidCommandId",$fault:"client",...e}),this.name="InvalidCommandId",this.$fault="client",Object.setPrototypeOf(this,InvalidCommandId.prototype)}}class InvalidInstanceId extends SSMServiceException{constructor(e){super({name:"InvalidInstanceId",$fault:"client",...e}),this.name="InvalidInstanceId",this.$fault="client",Object.setPrototypeOf(this,InvalidInstanceId.prototype),this.Message=e.Message}}class DoesNotExistException extends SSMServiceException{constructor(e){super({name:"DoesNotExistException",$fault:"client",...e}),this.name="DoesNotExistException",this.$fault="client",Object.setPrototypeOf(this,DoesNotExistException.prototype),this.Message=e.Message}}class InvalidParameters extends SSMServiceException{constructor(e){super({name:"InvalidParameters",$fault:"client",...e}),this.name="InvalidParameters",this.$fault="client",Object.setPrototypeOf(this,InvalidParameters.prototype),this.Message=e.Message}}class AssociationAlreadyExists extends SSMServiceException{constructor(e){super({name:"AssociationAlreadyExists",$fault:"client",...e}),this.name="AssociationAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,AssociationAlreadyExists.prototype)}}class AssociationLimitExceeded extends SSMServiceException{constructor(e){super({name:"AssociationLimitExceeded",$fault:"client",...e}),this.name="AssociationLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,AssociationLimitExceeded.prototype)}}class InvalidDocument extends SSMServiceException{constructor(e){super({name:"InvalidDocument",$fault:"client",...e}),this.name="InvalidDocument",this.$fault="client",Object.setPrototypeOf(this,InvalidDocument.prototype),this.Message=e.Message}}class InvalidDocumentVersion extends SSMServiceException{constructor(e){super({name:"InvalidDocumentVersion",$fault:"client",...e}),this.name="InvalidDocumentVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentVersion.prototype),this.Message=e.Message}}class InvalidOutputLocation extends SSMServiceException{constructor(e){super({name:"InvalidOutputLocation",$fault:"client",...e}),this.name="InvalidOutputLocation",this.$fault="client",Object.setPrototypeOf(this,InvalidOutputLocation.prototype)}}class InvalidSchedule extends SSMServiceException{constructor(e){super({name:"InvalidSchedule",$fault:"client",...e}),this.name="InvalidSchedule",this.$fault="client",Object.setPrototypeOf(this,InvalidSchedule.prototype),this.Message=e.Message}}class InvalidTag extends SSMServiceException{constructor(e){super({name:"InvalidTag",$fault:"client",...e}),this.name="InvalidTag",this.$fault="client",Object.setPrototypeOf(this,InvalidTag.prototype),this.Message=e.Message}}class InvalidTarget extends SSMServiceException{constructor(e){super({name:"InvalidTarget",$fault:"client",...e}),this.name="InvalidTarget",this.$fault="client",Object.setPrototypeOf(this,InvalidTarget.prototype),this.Message=e.Message}}class InvalidTargetMaps extends SSMServiceException{constructor(e){super({name:"InvalidTargetMaps",$fault:"client",...e}),this.name="InvalidTargetMaps",this.$fault="client",Object.setPrototypeOf(this,InvalidTargetMaps.prototype),this.Message=e.Message}}class UnsupportedPlatformType extends SSMServiceException{constructor(e){super({name:"UnsupportedPlatformType",$fault:"client",...e}),this.name="UnsupportedPlatformType",this.$fault="client",Object.setPrototypeOf(this,UnsupportedPlatformType.prototype),this.Message=e.Message}}class DocumentAlreadyExists extends SSMServiceException{constructor(e){super({name:"DocumentAlreadyExists",$fault:"client",...e}),this.name="DocumentAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,DocumentAlreadyExists.prototype),this.Message=e.Message}}class DocumentLimitExceeded extends SSMServiceException{constructor(e){super({name:"DocumentLimitExceeded",$fault:"client",...e}),this.name="DocumentLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,DocumentLimitExceeded.prototype),this.Message=e.Message}}class InvalidDocumentContent extends SSMServiceException{constructor(e){super({name:"InvalidDocumentContent",$fault:"client",...e}),this.name="InvalidDocumentContent",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentContent.prototype),this.Message=e.Message}}class InvalidDocumentSchemaVersion extends SSMServiceException{constructor(e){super({name:"InvalidDocumentSchemaVersion",$fault:"client",...e}),this.name="InvalidDocumentSchemaVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentSchemaVersion.prototype),this.Message=e.Message}}class MaxDocumentSizeExceeded extends SSMServiceException{constructor(e){super({name:"MaxDocumentSizeExceeded",$fault:"client",...e}),this.name="MaxDocumentSizeExceeded",this.$fault="client",Object.setPrototypeOf(this,MaxDocumentSizeExceeded.prototype),this.Message=e.Message}}class IdempotentParameterMismatch extends SSMServiceException{constructor(e){super({name:"IdempotentParameterMismatch",$fault:"client",...e}),this.name="IdempotentParameterMismatch",this.$fault="client",Object.setPrototypeOf(this,IdempotentParameterMismatch.prototype),this.Message=e.Message}}class ResourceLimitExceededException extends SSMServiceException{constructor(e){super({name:"ResourceLimitExceededException",$fault:"client",...e}),this.name="ResourceLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceLimitExceededException.prototype),this.Message=e.Message}}class OpsItemAccessDeniedException extends SSMServiceException{constructor(e){super({name:"OpsItemAccessDeniedException",$fault:"client",...e}),this.name="OpsItemAccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,OpsItemAccessDeniedException.prototype),this.Message=e.Message}}class OpsItemAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsItemAlreadyExistsException",$fault:"client",...e}),this.name="OpsItemAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsItemAlreadyExistsException.prototype),this.Message=e.Message,this.OpsItemId=e.OpsItemId}}class OpsMetadataAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsMetadataAlreadyExistsException",$fault:"client",...e}),this.name="OpsMetadataAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataAlreadyExistsException.prototype)}}class OpsMetadataInvalidArgumentException extends SSMServiceException{constructor(e){super({name:"OpsMetadataInvalidArgumentException",$fault:"client",...e}),this.name="OpsMetadataInvalidArgumentException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataInvalidArgumentException.prototype)}}class OpsMetadataLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsMetadataLimitExceededException",$fault:"client",...e}),this.name="OpsMetadataLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataLimitExceededException.prototype)}}class OpsMetadataTooManyUpdatesException extends SSMServiceException{constructor(e){super({name:"OpsMetadataTooManyUpdatesException",$fault:"client",...e}),this.name="OpsMetadataTooManyUpdatesException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataTooManyUpdatesException.prototype)}}class ResourceDataSyncAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncAlreadyExistsException",$fault:"client",...e}),this.name="ResourceDataSyncAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncAlreadyExistsException.prototype),this.SyncName=e.SyncName}}class ResourceDataSyncCountExceededException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncCountExceededException",$fault:"client",...e}),this.name="ResourceDataSyncCountExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncCountExceededException.prototype),this.Message=e.Message}}class ResourceDataSyncInvalidConfigurationException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncInvalidConfigurationException",$fault:"client",...e}),this.name="ResourceDataSyncInvalidConfigurationException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncInvalidConfigurationException.prototype),this.Message=e.Message}}class InvalidActivation extends SSMServiceException{constructor(e){super({name:"InvalidActivation",$fault:"client",...e}),this.name="InvalidActivation",this.$fault="client",Object.setPrototypeOf(this,InvalidActivation.prototype),this.Message=e.Message}}class InvalidActivationId extends SSMServiceException{constructor(e){super({name:"InvalidActivationId",$fault:"client",...e}),this.name="InvalidActivationId",this.$fault="client",Object.setPrototypeOf(this,InvalidActivationId.prototype),this.Message=e.Message}}class AssociationDoesNotExist extends SSMServiceException{constructor(e){super({name:"AssociationDoesNotExist",$fault:"client",...e}),this.name="AssociationDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,AssociationDoesNotExist.prototype),this.Message=e.Message}}class AssociatedInstances extends SSMServiceException{constructor(e){super({name:"AssociatedInstances",$fault:"client",...e}),this.name="AssociatedInstances",this.$fault="client",Object.setPrototypeOf(this,AssociatedInstances.prototype)}}class InvalidDocumentOperation extends SSMServiceException{constructor(e){super({name:"InvalidDocumentOperation",$fault:"client",...e}),this.name="InvalidDocumentOperation",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentOperation.prototype),this.Message=e.Message}}class InvalidDeleteInventoryParametersException extends SSMServiceException{constructor(e){super({name:"InvalidDeleteInventoryParametersException",$fault:"client",...e}),this.name="InvalidDeleteInventoryParametersException",this.$fault="client",Object.setPrototypeOf(this,InvalidDeleteInventoryParametersException.prototype),this.Message=e.Message}}class InvalidInventoryRequestException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryRequestException",$fault:"client",...e}),this.name="InvalidInventoryRequestException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryRequestException.prototype),this.Message=e.Message}}class InvalidOptionException extends SSMServiceException{constructor(e){super({name:"InvalidOptionException",$fault:"client",...e}),this.name="InvalidOptionException",this.$fault="client",Object.setPrototypeOf(this,InvalidOptionException.prototype),this.Message=e.Message}}class InvalidTypeNameException extends SSMServiceException{constructor(e){super({name:"InvalidTypeNameException",$fault:"client",...e}),this.name="InvalidTypeNameException",this.$fault="client",Object.setPrototypeOf(this,InvalidTypeNameException.prototype),this.Message=e.Message}}class OpsMetadataNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsMetadataNotFoundException",$fault:"client",...e}),this.name="OpsMetadataNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataNotFoundException.prototype)}}class ParameterNotFound extends SSMServiceException{constructor(e){super({name:"ParameterNotFound",$fault:"client",...e}),this.name="ParameterNotFound",this.$fault="client",Object.setPrototypeOf(this,ParameterNotFound.prototype)}}class ResourceInUseException extends SSMServiceException{constructor(e){super({name:"ResourceInUseException",$fault:"client",...e}),this.name="ResourceInUseException",this.$fault="client",Object.setPrototypeOf(this,ResourceInUseException.prototype),this.Message=e.Message}}class ResourceDataSyncNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncNotFoundException",$fault:"client",...e}),this.name="ResourceDataSyncNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncNotFoundException.prototype),this.SyncName=e.SyncName,this.SyncType=e.SyncType,this.Message=e.Message}}class MalformedResourcePolicyDocumentException extends SSMServiceException{constructor(e){super({name:"MalformedResourcePolicyDocumentException",$fault:"client",...e}),this.name="MalformedResourcePolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,MalformedResourcePolicyDocumentException.prototype),this.Message=e.Message}}class ResourceNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourceNotFoundException.prototype),this.Message=e.Message}}class ResourcePolicyConflictException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyConflictException",$fault:"client",...e}),this.name="ResourcePolicyConflictException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyConflictException.prototype),this.Message=e.Message}}class ResourcePolicyInvalidParameterException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyInvalidParameterException",$fault:"client",...e}),this.name="ResourcePolicyInvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class ResourcePolicyNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyNotFoundException",$fault:"client",...e}),this.name="ResourcePolicyNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyNotFoundException.prototype),this.Message=e.Message}}class TargetInUseException extends SSMServiceException{constructor(e){super({name:"TargetInUseException",$fault:"client",...e}),this.name="TargetInUseException",this.$fault="client",Object.setPrototypeOf(this,TargetInUseException.prototype),this.Message=e.Message}}class InvalidFilter extends SSMServiceException{constructor(e){super({name:"InvalidFilter",$fault:"client",...e}),this.name="InvalidFilter",this.$fault="client",Object.setPrototypeOf(this,InvalidFilter.prototype),this.Message=e.Message}}class InvalidNextToken extends SSMServiceException{constructor(e){super({name:"InvalidNextToken",$fault:"client",...e}),this.name="InvalidNextToken",this.$fault="client",Object.setPrototypeOf(this,InvalidNextToken.prototype),this.Message=e.Message}}class InvalidAssociationVersion extends SSMServiceException{constructor(e){super({name:"InvalidAssociationVersion",$fault:"client",...e}),this.name="InvalidAssociationVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidAssociationVersion.prototype),this.Message=e.Message}}class AssociationExecutionDoesNotExist extends SSMServiceException{constructor(e){super({name:"AssociationExecutionDoesNotExist",$fault:"client",...e}),this.name="AssociationExecutionDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,AssociationExecutionDoesNotExist.prototype),this.Message=e.Message}}class InvalidFilterKey extends SSMServiceException{constructor(e){super({name:"InvalidFilterKey",$fault:"client",...e}),this.name="InvalidFilterKey",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterKey.prototype)}}class InvalidFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidFilterValue",$fault:"client",...e}),this.name="InvalidFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterValue.prototype),this.Message=e.Message}}class AutomationExecutionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationExecutionNotFoundException",$fault:"client",...e}),this.name="AutomationExecutionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationExecutionNotFoundException.prototype),this.Message=e.Message}}class InvalidPermissionType extends SSMServiceException{constructor(e){super({name:"InvalidPermissionType",$fault:"client",...e}),this.name="InvalidPermissionType",this.$fault="client",Object.setPrototypeOf(this,InvalidPermissionType.prototype),this.Message=e.Message}}class UnsupportedOperatingSystem extends SSMServiceException{constructor(e){super({name:"UnsupportedOperatingSystem",$fault:"client",...e}),this.name="UnsupportedOperatingSystem",this.$fault="client",Object.setPrototypeOf(this,UnsupportedOperatingSystem.prototype),this.Message=e.Message}}class InvalidInstanceInformationFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidInstanceInformationFilterValue",$fault:"client",...e}),this.name="InvalidInstanceInformationFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidInstanceInformationFilterValue.prototype)}}class InvalidInstancePropertyFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidInstancePropertyFilterValue",$fault:"client",...e}),this.name="InvalidInstancePropertyFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidInstancePropertyFilterValue.prototype)}}class InvalidDeletionIdException extends SSMServiceException{constructor(e){super({name:"InvalidDeletionIdException",$fault:"client",...e}),this.name="InvalidDeletionIdException",this.$fault="client",Object.setPrototypeOf(this,InvalidDeletionIdException.prototype),this.Message=e.Message}}class InvalidFilterOption extends SSMServiceException{constructor(e){super({name:"InvalidFilterOption",$fault:"client",...e}),this.name="InvalidFilterOption",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterOption.prototype)}}class OpsItemRelatedItemAssociationNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsItemRelatedItemAssociationNotFoundException",$fault:"client",...e}),this.name="OpsItemRelatedItemAssociationNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsItemRelatedItemAssociationNotFoundException.prototype),this.Message=e.Message}}class InvalidDocumentType extends SSMServiceException{constructor(e){super({name:"InvalidDocumentType",$fault:"client",...e}),this.name="InvalidDocumentType",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentType.prototype),this.Message=e.Message}}class UnsupportedCalendarException extends SSMServiceException{constructor(e){super({name:"UnsupportedCalendarException",$fault:"client",...e}),this.name="UnsupportedCalendarException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedCalendarException.prototype),this.Message=e.Message}}class InvalidPluginName extends SSMServiceException{constructor(e){super({name:"InvalidPluginName",$fault:"client",...e}),this.name="InvalidPluginName",this.$fault="client",Object.setPrototypeOf(this,InvalidPluginName.prototype)}}class InvocationDoesNotExist extends SSMServiceException{constructor(e){super({name:"InvocationDoesNotExist",$fault:"client",...e}),this.name="InvocationDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,InvocationDoesNotExist.prototype)}}class UnsupportedFeatureRequiredException extends SSMServiceException{constructor(e){super({name:"UnsupportedFeatureRequiredException",$fault:"client",...e}),this.name="UnsupportedFeatureRequiredException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedFeatureRequiredException.prototype),this.Message=e.Message}}class InvalidAggregatorException extends SSMServiceException{constructor(e){super({name:"InvalidAggregatorException",$fault:"client",...e}),this.name="InvalidAggregatorException",this.$fault="client",Object.setPrototypeOf(this,InvalidAggregatorException.prototype),this.Message=e.Message}}class InvalidInventoryGroupException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryGroupException",$fault:"client",...e}),this.name="InvalidInventoryGroupException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryGroupException.prototype),this.Message=e.Message}}class InvalidResultAttributeException extends SSMServiceException{constructor(e){super({name:"InvalidResultAttributeException",$fault:"client",...e}),this.name="InvalidResultAttributeException",this.$fault="client",Object.setPrototypeOf(this,InvalidResultAttributeException.prototype),this.Message=e.Message}}class InvalidKeyId extends SSMServiceException{constructor(e){super({name:"InvalidKeyId",$fault:"client",...e}),this.name="InvalidKeyId",this.$fault="client",Object.setPrototypeOf(this,InvalidKeyId.prototype)}}class ParameterVersionNotFound extends SSMServiceException{constructor(e){super({name:"ParameterVersionNotFound",$fault:"client",...e}),this.name="ParameterVersionNotFound",this.$fault="client",Object.setPrototypeOf(this,ParameterVersionNotFound.prototype)}}class ServiceSettingNotFound extends SSMServiceException{constructor(e){super({name:"ServiceSettingNotFound",$fault:"client",...e}),this.name="ServiceSettingNotFound",this.$fault="client",Object.setPrototypeOf(this,ServiceSettingNotFound.prototype),this.Message=e.Message}}class ParameterVersionLabelLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterVersionLabelLimitExceeded",$fault:"client",...e}),this.name="ParameterVersionLabelLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterVersionLabelLimitExceeded.prototype)}}class DocumentPermissionLimit extends SSMServiceException{constructor(e){super({name:"DocumentPermissionLimit",$fault:"client",...e}),this.name="DocumentPermissionLimit",this.$fault="client",Object.setPrototypeOf(this,DocumentPermissionLimit.prototype),this.Message=e.Message}}class ComplianceTypeCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"ComplianceTypeCountLimitExceededException",$fault:"client",...e}),this.name="ComplianceTypeCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ComplianceTypeCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidItemContentException extends SSMServiceException{constructor(e){super({name:"InvalidItemContentException",$fault:"client",...e}),this.name="InvalidItemContentException",this.$fault="client",Object.setPrototypeOf(this,InvalidItemContentException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class ItemSizeLimitExceededException extends SSMServiceException{constructor(e){super({name:"ItemSizeLimitExceededException",$fault:"client",...e}),this.name="ItemSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ItemSizeLimitExceededException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class TotalSizeLimitExceededException extends SSMServiceException{constructor(e){super({name:"TotalSizeLimitExceededException",$fault:"client",...e}),this.name="TotalSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,TotalSizeLimitExceededException.prototype),this.Message=e.Message}}class CustomSchemaCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"CustomSchemaCountLimitExceededException",$fault:"client",...e}),this.name="CustomSchemaCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,CustomSchemaCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidInventoryItemContextException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryItemContextException",$fault:"client",...e}),this.name="InvalidInventoryItemContextException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryItemContextException.prototype),this.Message=e.Message}}class ItemContentMismatchException extends SSMServiceException{constructor(e){super({name:"ItemContentMismatchException",$fault:"client",...e}),this.name="ItemContentMismatchException",this.$fault="client",Object.setPrototypeOf(this,ItemContentMismatchException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class SubTypeCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"SubTypeCountLimitExceededException",$fault:"client",...e}),this.name="SubTypeCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,SubTypeCountLimitExceededException.prototype),this.Message=e.Message}}class UnsupportedInventoryItemContextException extends SSMServiceException{constructor(e){super({name:"UnsupportedInventoryItemContextException",$fault:"client",...e}),this.name="UnsupportedInventoryItemContextException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedInventoryItemContextException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class UnsupportedInventorySchemaVersionException extends SSMServiceException{constructor(e){super({name:"UnsupportedInventorySchemaVersionException",$fault:"client",...e}),this.name="UnsupportedInventorySchemaVersionException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedInventorySchemaVersionException.prototype),this.Message=e.Message}}class HierarchyLevelLimitExceededException extends SSMServiceException{constructor(e){super({name:"HierarchyLevelLimitExceededException",$fault:"client",...e}),this.name="HierarchyLevelLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,HierarchyLevelLimitExceededException.prototype)}}class HierarchyTypeMismatchException extends SSMServiceException{constructor(e){super({name:"HierarchyTypeMismatchException",$fault:"client",...e}),this.name="HierarchyTypeMismatchException",this.$fault="client",Object.setPrototypeOf(this,HierarchyTypeMismatchException.prototype)}}class IncompatiblePolicyException extends SSMServiceException{constructor(e){super({name:"IncompatiblePolicyException",$fault:"client",...e}),this.name="IncompatiblePolicyException",this.$fault="client",Object.setPrototypeOf(this,IncompatiblePolicyException.prototype)}}class InvalidAllowedPatternException extends SSMServiceException{constructor(e){super({name:"InvalidAllowedPatternException",$fault:"client",...e}),this.name="InvalidAllowedPatternException",this.$fault="client",Object.setPrototypeOf(this,InvalidAllowedPatternException.prototype)}}class InvalidPolicyAttributeException extends SSMServiceException{constructor(e){super({name:"InvalidPolicyAttributeException",$fault:"client",...e}),this.name="InvalidPolicyAttributeException",this.$fault="client",Object.setPrototypeOf(this,InvalidPolicyAttributeException.prototype)}}class InvalidPolicyTypeException extends SSMServiceException{constructor(e){super({name:"InvalidPolicyTypeException",$fault:"client",...e}),this.name="InvalidPolicyTypeException",this.$fault="client",Object.setPrototypeOf(this,InvalidPolicyTypeException.prototype)}}class ParameterAlreadyExists extends SSMServiceException{constructor(e){super({name:"ParameterAlreadyExists",$fault:"client",...e}),this.name="ParameterAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,ParameterAlreadyExists.prototype)}}class ParameterLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterLimitExceeded",$fault:"client",...e}),this.name="ParameterLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterLimitExceeded.prototype)}}class ParameterMaxVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterMaxVersionLimitExceeded",$fault:"client",...e}),this.name="ParameterMaxVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterMaxVersionLimitExceeded.prototype)}}class ParameterPatternMismatchException extends SSMServiceException{constructor(e){super({name:"ParameterPatternMismatchException",$fault:"client",...e}),this.name="ParameterPatternMismatchException",this.$fault="client",Object.setPrototypeOf(this,ParameterPatternMismatchException.prototype)}}class PoliciesLimitExceededException extends SSMServiceException{constructor(e){super({name:"PoliciesLimitExceededException",$fault:"client",...e}),this.name="PoliciesLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,PoliciesLimitExceededException.prototype)}}class UnsupportedParameterType extends SSMServiceException{constructor(e){super({name:"UnsupportedParameterType",$fault:"client",...e}),this.name="UnsupportedParameterType",this.$fault="client",Object.setPrototypeOf(this,UnsupportedParameterType.prototype)}}class ResourcePolicyLimitExceededException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyLimitExceededException",$fault:"client",...e}),this.name="ResourcePolicyLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyLimitExceededException.prototype),this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class FeatureNotAvailableException extends SSMServiceException{constructor(e){super({name:"FeatureNotAvailableException",$fault:"client",...e}),this.name="FeatureNotAvailableException",this.$fault="client",Object.setPrototypeOf(this,FeatureNotAvailableException.prototype),this.Message=e.Message}}class AutomationStepNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationStepNotFoundException",$fault:"client",...e}),this.name="AutomationStepNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationStepNotFoundException.prototype),this.Message=e.Message}}class InvalidAutomationSignalException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationSignalException",$fault:"client",...e}),this.name="InvalidAutomationSignalException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationSignalException.prototype),this.Message=e.Message}}class InvalidNotificationConfig extends SSMServiceException{constructor(e){super({name:"InvalidNotificationConfig",$fault:"client",...e}),this.name="InvalidNotificationConfig",this.$fault="client",Object.setPrototypeOf(this,InvalidNotificationConfig.prototype),this.Message=e.Message}}class InvalidOutputFolder extends SSMServiceException{constructor(e){super({name:"InvalidOutputFolder",$fault:"client",...e}),this.name="InvalidOutputFolder",this.$fault="client",Object.setPrototypeOf(this,InvalidOutputFolder.prototype)}}class InvalidRole extends SSMServiceException{constructor(e){super({name:"InvalidRole",$fault:"client",...e}),this.name="InvalidRole",this.$fault="client",Object.setPrototypeOf(this,InvalidRole.prototype),this.Message=e.Message}}class InvalidAssociation extends SSMServiceException{constructor(e){super({name:"InvalidAssociation",$fault:"client",...e}),this.name="InvalidAssociation",this.$fault="client",Object.setPrototypeOf(this,InvalidAssociation.prototype),this.Message=e.Message}}class AutomationDefinitionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionNotFoundException",$fault:"client",...e}),this.name="AutomationDefinitionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionNotFoundException.prototype),this.Message=e.Message}}class AutomationDefinitionVersionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionVersionNotFoundException",$fault:"client",...e}),this.name="AutomationDefinitionVersionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionVersionNotFoundException.prototype),this.Message=e.Message}}class AutomationExecutionLimitExceededException extends SSMServiceException{constructor(e){super({name:"AutomationExecutionLimitExceededException",$fault:"client",...e}),this.name="AutomationExecutionLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,AutomationExecutionLimitExceededException.prototype),this.Message=e.Message}}class InvalidAutomationExecutionParametersException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationExecutionParametersException",$fault:"client",...e}),this.name="InvalidAutomationExecutionParametersException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationExecutionParametersException.prototype),this.Message=e.Message}}const ParameterFilterSensitiveLog=e=>({...e,...e.Value&&{Value:SENSITIVE_STRING}}),GetParameterResultFilterSensitiveLog=e=>({...e,...e.Parameter&&{Parameter:ParameterFilterSensitiveLog(e.Parameter)}}),GetParametersResultFilterSensitiveLog=e=>({...e,...e.Parameters&&{Parameters:e.Parameters.map((e=>ParameterFilterSensitiveLog(e)))}});class AutomationDefinitionNotApprovedException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionNotApprovedException",$fault:"client",...e}),this.name="AutomationDefinitionNotApprovedException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionNotApprovedException.prototype),this.Message=e.Message}}class TargetNotConnected extends SSMServiceException{constructor(e){super({name:"TargetNotConnected",$fault:"client",...e}),this.name="TargetNotConnected",this.$fault="client",Object.setPrototypeOf(this,TargetNotConnected.prototype),this.Message=e.Message}}class InvalidAutomationStatusUpdateException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationStatusUpdateException",$fault:"client",...e}),this.name="InvalidAutomationStatusUpdateException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationStatusUpdateException.prototype),this.Message=e.Message}}class AssociationVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"AssociationVersionLimitExceeded",$fault:"client",...e}),this.name="AssociationVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,AssociationVersionLimitExceeded.prototype),this.Message=e.Message}}class InvalidUpdate extends SSMServiceException{constructor(e){super({name:"InvalidUpdate",$fault:"client",...e}),this.name="InvalidUpdate",this.$fault="client",Object.setPrototypeOf(this,InvalidUpdate.prototype),this.Message=e.Message}}class StatusUnchanged extends SSMServiceException{constructor(e){super({name:"StatusUnchanged",$fault:"client",...e}),this.name="StatusUnchanged",this.$fault="client",Object.setPrototypeOf(this,StatusUnchanged.prototype)}}class DocumentVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"DocumentVersionLimitExceeded",$fault:"client",...e}),this.name="DocumentVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,DocumentVersionLimitExceeded.prototype),this.Message=e.Message}}class DuplicateDocumentContent extends SSMServiceException{constructor(e){super({name:"DuplicateDocumentContent",$fault:"client",...e}),this.name="DuplicateDocumentContent",this.$fault="client",Object.setPrototypeOf(this,DuplicateDocumentContent.prototype),this.Message=e.Message}}class DuplicateDocumentVersionName extends SSMServiceException{constructor(e){super({name:"DuplicateDocumentVersionName",$fault:"client",...e}),this.name="DuplicateDocumentVersionName",this.$fault="client",Object.setPrototypeOf(this,DuplicateDocumentVersionName.prototype),this.Message=e.Message}}class OpsMetadataKeyLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsMetadataKeyLimitExceededException",$fault:"client",...e}),this.name="OpsMetadataKeyLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataKeyLimitExceededException.prototype)}}class ResourceDataSyncConflictException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncConflictException",$fault:"client",...e}),this.name="ResourceDataSyncConflictException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncConflictException.prototype),this.Message=e.Message}}const se_GetParameterCommand=async(e,t)=>{const n=sharedHeaders("GetParameter");let r;return r=JSON.stringify(_json(e)),buildHttpRpcRequest(t,n,"/",void 0,r)},se_GetParametersCommand=async(e,t)=>{const n=sharedHeaders("GetParameters");let r;return r=JSON.stringify(_json(e)),buildHttpRpcRequest(t,n,"/",void 0,r)},de_GetParameterCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody(e.body,t);let r={};r=de_GetParameterResult(n);return{$metadata:deserializeMetadata(e),...r}},de_GetParametersCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody(e.body,t);let r={};r=de_GetParametersResult(n);return{$metadata:deserializeMetadata(e),...r}},de_CommandError=async(e,t)=>{const n={...e,body:await parseJsonErrorBody(e.body,t)},r=loadRestJsonErrorCode(e,n.body);switch(r){case"InternalServerError":case"com.amazonaws.ssm#InternalServerError":throw await de_InternalServerErrorRes(n);case"InvalidResourceId":case"com.amazonaws.ssm#InvalidResourceId":throw await de_InvalidResourceIdRes(n);case"InvalidResourceType":case"com.amazonaws.ssm#InvalidResourceType":throw await de_InvalidResourceTypeRes(n);case"TooManyTagsError":case"com.amazonaws.ssm#TooManyTagsError":throw await de_TooManyTagsErrorRes(n);case"TooManyUpdates":case"com.amazonaws.ssm#TooManyUpdates":throw await de_TooManyUpdatesRes(n);case"OpsItemConflictException":case"com.amazonaws.ssm#OpsItemConflictException":throw await de_OpsItemConflictExceptionRes(n);case"OpsItemInvalidParameterException":case"com.amazonaws.ssm#OpsItemInvalidParameterException":throw await de_OpsItemInvalidParameterExceptionRes(n);case"OpsItemLimitExceededException":case"com.amazonaws.ssm#OpsItemLimitExceededException":throw await de_OpsItemLimitExceededExceptionRes(n);case"OpsItemNotFoundException":case"com.amazonaws.ssm#OpsItemNotFoundException":throw await de_OpsItemNotFoundExceptionRes(n);case"OpsItemRelatedItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemRelatedItemAlreadyExistsException":throw await de_OpsItemRelatedItemAlreadyExistsExceptionRes(n);case"DuplicateInstanceId":case"com.amazonaws.ssm#DuplicateInstanceId":throw await de_DuplicateInstanceIdRes(n);case"InvalidCommandId":case"com.amazonaws.ssm#InvalidCommandId":throw await de_InvalidCommandIdRes(n);case"InvalidInstanceId":case"com.amazonaws.ssm#InvalidInstanceId":throw await de_InvalidInstanceIdRes(n);case"DoesNotExistException":case"com.amazonaws.ssm#DoesNotExistException":throw await de_DoesNotExistExceptionRes(n);case"InvalidParameters":case"com.amazonaws.ssm#InvalidParameters":throw await de_InvalidParametersRes(n);case"AssociationAlreadyExists":case"com.amazonaws.ssm#AssociationAlreadyExists":throw await de_AssociationAlreadyExistsRes(n);case"AssociationLimitExceeded":case"com.amazonaws.ssm#AssociationLimitExceeded":throw await de_AssociationLimitExceededRes(n);case"InvalidDocument":case"com.amazonaws.ssm#InvalidDocument":throw await de_InvalidDocumentRes(n);case"InvalidDocumentVersion":case"com.amazonaws.ssm#InvalidDocumentVersion":throw await de_InvalidDocumentVersionRes(n);case"InvalidOutputLocation":case"com.amazonaws.ssm#InvalidOutputLocation":throw await de_InvalidOutputLocationRes(n);case"InvalidSchedule":case"com.amazonaws.ssm#InvalidSchedule":throw await de_InvalidScheduleRes(n);case"InvalidTag":case"com.amazonaws.ssm#InvalidTag":throw await de_InvalidTagRes(n);case"InvalidTarget":case"com.amazonaws.ssm#InvalidTarget":throw await de_InvalidTargetRes(n);case"InvalidTargetMaps":case"com.amazonaws.ssm#InvalidTargetMaps":throw await de_InvalidTargetMapsRes(n);case"UnsupportedPlatformType":case"com.amazonaws.ssm#UnsupportedPlatformType":throw await de_UnsupportedPlatformTypeRes(n);case"DocumentAlreadyExists":case"com.amazonaws.ssm#DocumentAlreadyExists":throw await de_DocumentAlreadyExistsRes(n);case"DocumentLimitExceeded":case"com.amazonaws.ssm#DocumentLimitExceeded":throw await de_DocumentLimitExceededRes(n);case"InvalidDocumentContent":case"com.amazonaws.ssm#InvalidDocumentContent":throw await de_InvalidDocumentContentRes(n);case"InvalidDocumentSchemaVersion":case"com.amazonaws.ssm#InvalidDocumentSchemaVersion":throw await de_InvalidDocumentSchemaVersionRes(n);case"MaxDocumentSizeExceeded":case"com.amazonaws.ssm#MaxDocumentSizeExceeded":throw await de_MaxDocumentSizeExceededRes(n);case"IdempotentParameterMismatch":case"com.amazonaws.ssm#IdempotentParameterMismatch":throw await de_IdempotentParameterMismatchRes(n);case"ResourceLimitExceededException":case"com.amazonaws.ssm#ResourceLimitExceededException":throw await de_ResourceLimitExceededExceptionRes(n);case"OpsItemAccessDeniedException":case"com.amazonaws.ssm#OpsItemAccessDeniedException":throw await de_OpsItemAccessDeniedExceptionRes(n);case"OpsItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemAlreadyExistsException":throw await de_OpsItemAlreadyExistsExceptionRes(n);case"OpsMetadataAlreadyExistsException":case"com.amazonaws.ssm#OpsMetadataAlreadyExistsException":throw await de_OpsMetadataAlreadyExistsExceptionRes(n);case"OpsMetadataInvalidArgumentException":case"com.amazonaws.ssm#OpsMetadataInvalidArgumentException":throw await de_OpsMetadataInvalidArgumentExceptionRes(n);case"OpsMetadataLimitExceededException":case"com.amazonaws.ssm#OpsMetadataLimitExceededException":throw await de_OpsMetadataLimitExceededExceptionRes(n);case"OpsMetadataTooManyUpdatesException":case"com.amazonaws.ssm#OpsMetadataTooManyUpdatesException":throw await de_OpsMetadataTooManyUpdatesExceptionRes(n);case"ResourceDataSyncAlreadyExistsException":case"com.amazonaws.ssm#ResourceDataSyncAlreadyExistsException":throw await de_ResourceDataSyncAlreadyExistsExceptionRes(n);case"ResourceDataSyncCountExceededException":case"com.amazonaws.ssm#ResourceDataSyncCountExceededException":throw await de_ResourceDataSyncCountExceededExceptionRes(n);case"ResourceDataSyncInvalidConfigurationException":case"com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(n);case"InvalidActivation":case"com.amazonaws.ssm#InvalidActivation":throw await de_InvalidActivationRes(n);case"InvalidActivationId":case"com.amazonaws.ssm#InvalidActivationId":throw await de_InvalidActivationIdRes(n);case"AssociationDoesNotExist":case"com.amazonaws.ssm#AssociationDoesNotExist":throw await de_AssociationDoesNotExistRes(n);case"AssociatedInstances":case"com.amazonaws.ssm#AssociatedInstances":throw await de_AssociatedInstancesRes(n);case"InvalidDocumentOperation":case"com.amazonaws.ssm#InvalidDocumentOperation":throw await de_InvalidDocumentOperationRes(n);case"InvalidDeleteInventoryParametersException":case"com.amazonaws.ssm#InvalidDeleteInventoryParametersException":throw await de_InvalidDeleteInventoryParametersExceptionRes(n);case"InvalidInventoryRequestException":case"com.amazonaws.ssm#InvalidInventoryRequestException":throw await de_InvalidInventoryRequestExceptionRes(n);case"InvalidOptionException":case"com.amazonaws.ssm#InvalidOptionException":throw await de_InvalidOptionExceptionRes(n);case"InvalidTypeNameException":case"com.amazonaws.ssm#InvalidTypeNameException":throw await de_InvalidTypeNameExceptionRes(n);case"OpsMetadataNotFoundException":case"com.amazonaws.ssm#OpsMetadataNotFoundException":throw await de_OpsMetadataNotFoundExceptionRes(n);case"ParameterNotFound":case"com.amazonaws.ssm#ParameterNotFound":throw await de_ParameterNotFoundRes(n);case"ResourceInUseException":case"com.amazonaws.ssm#ResourceInUseException":throw await de_ResourceInUseExceptionRes(n);case"ResourceDataSyncNotFoundException":case"com.amazonaws.ssm#ResourceDataSyncNotFoundException":throw await de_ResourceDataSyncNotFoundExceptionRes(n);case"MalformedResourcePolicyDocumentException":case"com.amazonaws.ssm#MalformedResourcePolicyDocumentException":throw await de_MalformedResourcePolicyDocumentExceptionRes(n);case"ResourceNotFoundException":case"com.amazonaws.ssm#ResourceNotFoundException":throw await de_ResourceNotFoundExceptionRes(n);case"ResourcePolicyConflictException":case"com.amazonaws.ssm#ResourcePolicyConflictException":throw await de_ResourcePolicyConflictExceptionRes(n);case"ResourcePolicyInvalidParameterException":case"com.amazonaws.ssm#ResourcePolicyInvalidParameterException":throw await de_ResourcePolicyInvalidParameterExceptionRes(n);case"ResourcePolicyNotFoundException":case"com.amazonaws.ssm#ResourcePolicyNotFoundException":throw await de_ResourcePolicyNotFoundExceptionRes(n);case"TargetInUseException":case"com.amazonaws.ssm#TargetInUseException":throw await de_TargetInUseExceptionRes(n);case"InvalidFilter":case"com.amazonaws.ssm#InvalidFilter":throw await de_InvalidFilterRes(n);case"InvalidNextToken":case"com.amazonaws.ssm#InvalidNextToken":throw await de_InvalidNextTokenRes(n);case"InvalidAssociationVersion":case"com.amazonaws.ssm#InvalidAssociationVersion":throw await de_InvalidAssociationVersionRes(n);case"AssociationExecutionDoesNotExist":case"com.amazonaws.ssm#AssociationExecutionDoesNotExist":throw await de_AssociationExecutionDoesNotExistRes(n);case"InvalidFilterKey":case"com.amazonaws.ssm#InvalidFilterKey":throw await de_InvalidFilterKeyRes(n);case"InvalidFilterValue":case"com.amazonaws.ssm#InvalidFilterValue":throw await de_InvalidFilterValueRes(n);case"AutomationExecutionNotFoundException":case"com.amazonaws.ssm#AutomationExecutionNotFoundException":throw await de_AutomationExecutionNotFoundExceptionRes(n);case"InvalidPermissionType":case"com.amazonaws.ssm#InvalidPermissionType":throw await de_InvalidPermissionTypeRes(n);case"UnsupportedOperatingSystem":case"com.amazonaws.ssm#UnsupportedOperatingSystem":throw await de_UnsupportedOperatingSystemRes(n);case"InvalidInstanceInformationFilterValue":case"com.amazonaws.ssm#InvalidInstanceInformationFilterValue":throw await de_InvalidInstanceInformationFilterValueRes(n);case"InvalidInstancePropertyFilterValue":case"com.amazonaws.ssm#InvalidInstancePropertyFilterValue":throw await de_InvalidInstancePropertyFilterValueRes(n);case"InvalidDeletionIdException":case"com.amazonaws.ssm#InvalidDeletionIdException":throw await de_InvalidDeletionIdExceptionRes(n);case"InvalidFilterOption":case"com.amazonaws.ssm#InvalidFilterOption":throw await de_InvalidFilterOptionRes(n);case"OpsItemRelatedItemAssociationNotFoundException":case"com.amazonaws.ssm#OpsItemRelatedItemAssociationNotFoundException":throw await de_OpsItemRelatedItemAssociationNotFoundExceptionRes(n);case"InvalidDocumentType":case"com.amazonaws.ssm#InvalidDocumentType":throw await de_InvalidDocumentTypeRes(n);case"UnsupportedCalendarException":case"com.amazonaws.ssm#UnsupportedCalendarException":throw await de_UnsupportedCalendarExceptionRes(n);case"InvalidPluginName":case"com.amazonaws.ssm#InvalidPluginName":throw await de_InvalidPluginNameRes(n);case"InvocationDoesNotExist":case"com.amazonaws.ssm#InvocationDoesNotExist":throw await de_InvocationDoesNotExistRes(n);case"UnsupportedFeatureRequiredException":case"com.amazonaws.ssm#UnsupportedFeatureRequiredException":throw await de_UnsupportedFeatureRequiredExceptionRes(n);case"InvalidAggregatorException":case"com.amazonaws.ssm#InvalidAggregatorException":throw await de_InvalidAggregatorExceptionRes(n);case"InvalidInventoryGroupException":case"com.amazonaws.ssm#InvalidInventoryGroupException":throw await de_InvalidInventoryGroupExceptionRes(n);case"InvalidResultAttributeException":case"com.amazonaws.ssm#InvalidResultAttributeException":throw await de_InvalidResultAttributeExceptionRes(n);case"InvalidKeyId":case"com.amazonaws.ssm#InvalidKeyId":throw await de_InvalidKeyIdRes(n);case"ParameterVersionNotFound":case"com.amazonaws.ssm#ParameterVersionNotFound":throw await de_ParameterVersionNotFoundRes(n);case"ServiceSettingNotFound":case"com.amazonaws.ssm#ServiceSettingNotFound":throw await de_ServiceSettingNotFoundRes(n);case"ParameterVersionLabelLimitExceeded":case"com.amazonaws.ssm#ParameterVersionLabelLimitExceeded":throw await de_ParameterVersionLabelLimitExceededRes(n);case"DocumentPermissionLimit":case"com.amazonaws.ssm#DocumentPermissionLimit":throw await de_DocumentPermissionLimitRes(n);case"ComplianceTypeCountLimitExceededException":case"com.amazonaws.ssm#ComplianceTypeCountLimitExceededException":throw await de_ComplianceTypeCountLimitExceededExceptionRes(n);case"InvalidItemContentException":case"com.amazonaws.ssm#InvalidItemContentException":throw await de_InvalidItemContentExceptionRes(n);case"ItemSizeLimitExceededException":case"com.amazonaws.ssm#ItemSizeLimitExceededException":throw await de_ItemSizeLimitExceededExceptionRes(n);case"TotalSizeLimitExceededException":case"com.amazonaws.ssm#TotalSizeLimitExceededException":throw await de_TotalSizeLimitExceededExceptionRes(n);case"CustomSchemaCountLimitExceededException":case"com.amazonaws.ssm#CustomSchemaCountLimitExceededException":throw await de_CustomSchemaCountLimitExceededExceptionRes(n);case"InvalidInventoryItemContextException":case"com.amazonaws.ssm#InvalidInventoryItemContextException":throw await de_InvalidInventoryItemContextExceptionRes(n);case"ItemContentMismatchException":case"com.amazonaws.ssm#ItemContentMismatchException":throw await de_ItemContentMismatchExceptionRes(n);case"SubTypeCountLimitExceededException":case"com.amazonaws.ssm#SubTypeCountLimitExceededException":throw await de_SubTypeCountLimitExceededExceptionRes(n);case"UnsupportedInventoryItemContextException":case"com.amazonaws.ssm#UnsupportedInventoryItemContextException":throw await de_UnsupportedInventoryItemContextExceptionRes(n);case"UnsupportedInventorySchemaVersionException":case"com.amazonaws.ssm#UnsupportedInventorySchemaVersionException":throw await de_UnsupportedInventorySchemaVersionExceptionRes(n);case"HierarchyLevelLimitExceededException":case"com.amazonaws.ssm#HierarchyLevelLimitExceededException":throw await de_HierarchyLevelLimitExceededExceptionRes(n);case"HierarchyTypeMismatchException":case"com.amazonaws.ssm#HierarchyTypeMismatchException":throw await de_HierarchyTypeMismatchExceptionRes(n);case"IncompatiblePolicyException":case"com.amazonaws.ssm#IncompatiblePolicyException":throw await de_IncompatiblePolicyExceptionRes(n);case"InvalidAllowedPatternException":case"com.amazonaws.ssm#InvalidAllowedPatternException":throw await de_InvalidAllowedPatternExceptionRes(n);case"InvalidPolicyAttributeException":case"com.amazonaws.ssm#InvalidPolicyAttributeException":throw await de_InvalidPolicyAttributeExceptionRes(n);case"InvalidPolicyTypeException":case"com.amazonaws.ssm#InvalidPolicyTypeException":throw await de_InvalidPolicyTypeExceptionRes(n);case"ParameterAlreadyExists":case"com.amazonaws.ssm#ParameterAlreadyExists":throw await de_ParameterAlreadyExistsRes(n);case"ParameterLimitExceeded":case"com.amazonaws.ssm#ParameterLimitExceeded":throw await de_ParameterLimitExceededRes(n);case"ParameterMaxVersionLimitExceeded":case"com.amazonaws.ssm#ParameterMaxVersionLimitExceeded":throw await de_ParameterMaxVersionLimitExceededRes(n);case"ParameterPatternMismatchException":case"com.amazonaws.ssm#ParameterPatternMismatchException":throw await de_ParameterPatternMismatchExceptionRes(n);case"PoliciesLimitExceededException":case"com.amazonaws.ssm#PoliciesLimitExceededException":throw await de_PoliciesLimitExceededExceptionRes(n);case"UnsupportedParameterType":case"com.amazonaws.ssm#UnsupportedParameterType":throw await de_UnsupportedParameterTypeRes(n);case"ResourcePolicyLimitExceededException":case"com.amazonaws.ssm#ResourcePolicyLimitExceededException":throw await de_ResourcePolicyLimitExceededExceptionRes(n);case"AlreadyExistsException":case"com.amazonaws.ssm#AlreadyExistsException":throw await de_AlreadyExistsExceptionRes(n);case"FeatureNotAvailableException":case"com.amazonaws.ssm#FeatureNotAvailableException":throw await de_FeatureNotAvailableExceptionRes(n);case"AutomationStepNotFoundException":case"com.amazonaws.ssm#AutomationStepNotFoundException":throw await de_AutomationStepNotFoundExceptionRes(n);case"InvalidAutomationSignalException":case"com.amazonaws.ssm#InvalidAutomationSignalException":throw await de_InvalidAutomationSignalExceptionRes(n);case"InvalidNotificationConfig":case"com.amazonaws.ssm#InvalidNotificationConfig":throw await de_InvalidNotificationConfigRes(n);case"InvalidOutputFolder":case"com.amazonaws.ssm#InvalidOutputFolder":throw await de_InvalidOutputFolderRes(n);case"InvalidRole":case"com.amazonaws.ssm#InvalidRole":throw await de_InvalidRoleRes(n);case"InvalidAssociation":case"com.amazonaws.ssm#InvalidAssociation":throw await de_InvalidAssociationRes(n);case"AutomationDefinitionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionNotFoundException":throw await de_AutomationDefinitionNotFoundExceptionRes(n);case"AutomationDefinitionVersionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionVersionNotFoundException":throw await de_AutomationDefinitionVersionNotFoundExceptionRes(n);case"AutomationExecutionLimitExceededException":case"com.amazonaws.ssm#AutomationExecutionLimitExceededException":throw await de_AutomationExecutionLimitExceededExceptionRes(n);case"InvalidAutomationExecutionParametersException":case"com.amazonaws.ssm#InvalidAutomationExecutionParametersException":throw await de_InvalidAutomationExecutionParametersExceptionRes(n);case"AutomationDefinitionNotApprovedException":case"com.amazonaws.ssm#AutomationDefinitionNotApprovedException":throw await de_AutomationDefinitionNotApprovedExceptionRes(n);case"TargetNotConnected":case"com.amazonaws.ssm#TargetNotConnected":throw await de_TargetNotConnectedRes(n);case"InvalidAutomationStatusUpdateException":case"com.amazonaws.ssm#InvalidAutomationStatusUpdateException":throw await de_InvalidAutomationStatusUpdateExceptionRes(n);case"AssociationVersionLimitExceeded":case"com.amazonaws.ssm#AssociationVersionLimitExceeded":throw await de_AssociationVersionLimitExceededRes(n);case"InvalidUpdate":case"com.amazonaws.ssm#InvalidUpdate":throw await de_InvalidUpdateRes(n);case"StatusUnchanged":case"com.amazonaws.ssm#StatusUnchanged":throw await de_StatusUnchangedRes(n);case"DocumentVersionLimitExceeded":case"com.amazonaws.ssm#DocumentVersionLimitExceeded":throw await de_DocumentVersionLimitExceededRes(n);case"DuplicateDocumentContent":case"com.amazonaws.ssm#DuplicateDocumentContent":throw await de_DuplicateDocumentContentRes(n);case"DuplicateDocumentVersionName":case"com.amazonaws.ssm#DuplicateDocumentVersionName":throw await de_DuplicateDocumentVersionNameRes(n);case"OpsMetadataKeyLimitExceededException":case"com.amazonaws.ssm#OpsMetadataKeyLimitExceededException":throw await de_OpsMetadataKeyLimitExceededExceptionRes(n);case"ResourceDataSyncConflictException":case"com.amazonaws.ssm#ResourceDataSyncConflictException":throw await de_ResourceDataSyncConflictExceptionRes(n);default:const t=n.body;return throwDefaultError({output:e,parsedBody:t,errorCode:r})}},de_AlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociatedInstancesRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociatedInstances({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationExecutionDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationExecutionDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionNotApprovedExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionNotApprovedException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionVersionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionVersionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationExecutionLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationExecutionLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationExecutionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationExecutionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationStepNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationStepNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ComplianceTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ComplianceTypeCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_CustomSchemaCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new CustomSchemaCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentPermissionLimitRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentPermissionLimit({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DoesNotExistExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DoesNotExistException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateDocumentContentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateDocumentContent({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateDocumentVersionNameRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateDocumentVersionName({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateInstanceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateInstanceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_FeatureNotAvailableExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new FeatureNotAvailableException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_HierarchyLevelLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new HierarchyLevelLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_HierarchyTypeMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new HierarchyTypeMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_IdempotentParameterMismatchRes=async(e,t)=>{const n=e.body,r=_json(n),i=new IdempotentParameterMismatch({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_IncompatiblePolicyExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new IncompatiblePolicyException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InternalServerErrorRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InternalServerError({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidActivationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidActivation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidActivationIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidActivationId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAggregatorExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAggregatorException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAllowedPatternExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAllowedPatternException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAssociationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAssociation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAssociationVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAssociationVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationExecutionParametersExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationExecutionParametersException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationSignalExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationSignalException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationStatusUpdateExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationStatusUpdateException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidCommandIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidCommandId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDeleteInventoryParametersExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDeleteInventoryParametersException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDeletionIdExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDeletionIdException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocument({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentContentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentContent({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentOperationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentOperation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentSchemaVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentSchemaVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilter({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterKeyRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterKey({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterOptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterOption({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstanceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstanceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstanceInformationFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstanceInformationFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstancePropertyFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstancePropertyFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryGroupExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryGroupException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryItemContextException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryRequestExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryRequestException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidItemContentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidItemContentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidKeyIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidKeyId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidNextTokenRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidNextToken({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidNotificationConfigRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidNotificationConfig({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOptionExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOptionException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOutputFolderRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOutputFolder({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOutputLocationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOutputLocation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidParametersRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidParameters({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPermissionTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPermissionType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPluginNameRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPluginName({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPolicyAttributeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPolicyAttributeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPolicyTypeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPolicyTypeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResourceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResourceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResourceTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResourceType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResultAttributeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResultAttributeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidRoleRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidRole({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidScheduleRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidSchedule({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTagRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTag({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTargetRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTarget({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTargetMapsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTargetMaps({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTypeNameExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTypeNameException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidUpdateRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidUpdate({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvocationDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvocationDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ItemContentMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ItemContentMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ItemSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ItemSizeLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_MalformedResourcePolicyDocumentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new MalformedResourcePolicyDocumentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_MaxDocumentSizeExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new MaxDocumentSizeExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemAccessDeniedExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemAccessDeniedException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemInvalidParameterException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemRelatedItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemRelatedItemAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemRelatedItemAssociationNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemRelatedItemAssociationNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataInvalidArgumentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataInvalidArgumentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataKeyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataKeyLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataTooManyUpdatesExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataTooManyUpdatesException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterMaxVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterMaxVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterPatternMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterPatternMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterVersionLabelLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterVersionLabelLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterVersionNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterVersionNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_PoliciesLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new PoliciesLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncCountExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncCountExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncInvalidConfigurationExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncInvalidConfigurationException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceInUseExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceInUseException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyInvalidParameterException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ServiceSettingNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ServiceSettingNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_StatusUnchangedRes=async(e,t)=>{const n=e.body,r=_json(n),i=new StatusUnchanged({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_SubTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new SubTypeCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TargetInUseExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TargetInUseException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TargetNotConnectedRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TargetNotConnected({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TooManyTagsErrorRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TooManyTagsError({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TooManyUpdatesRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TooManyUpdates({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TotalSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TotalSizeLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedCalendarExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedCalendarException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedFeatureRequiredExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedFeatureRequiredException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedInventoryItemContextException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedInventorySchemaVersionExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedInventorySchemaVersionException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedOperatingSystemRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedOperatingSystem({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedParameterTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedParameterType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedPlatformTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedPlatformType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_GetParameterResult=(e,t)=>take(e,{Parameter:e=>de_Parameter(e)}),de_GetParametersResult=(e,t)=>take(e,{InvalidParameters:_json,Parameters:e=>de_ParameterList(e)}),de_Parameter=(e,t)=>take(e,{ARN:expectString,DataType:expectString,LastModifiedDate:e=>expectNonNull(parseEpochTimestamp(expectNumber(e))),Name:expectString,Selector:expectString,SourceResult:expectString,Type:expectString,Value:expectString,Version:expectLong}),de_ParameterList=(e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>de_Parameter(e)));return n},deserializeMetadata=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),throwDefaultError=withBaseException(SSMServiceException),buildHttpRpcRequest=async(e,t,n,r,i)=>{const{hostname:s,protocol:o="https",port:a,path:c}=await e.endpoint(),u={protocol:o,hostname:s,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==i&&(u.body=i),new HttpRequest(u)};function sharedHeaders(e){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AmazonSSM.${e}`}}class GetParameterCommand extends(Command.classBuilder().ep({...commonParams}).m((function(e,t,n,r){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin(n,e.getEndpointParameterInstructions())]})).s("AmazonSSM","GetParameter",{}).n("SSMClient","GetParameterCommand").f(void 0,GetParameterResultFilterSensitiveLog).ser(se_GetParameterCommand).de(de_GetParameterCommand).build()){}class GetParametersCommand extends(Command.classBuilder().ep({...commonParams}).m((function(e,t,n,r){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin(n,e.getEndpointParameterInstructions())]})).s("AmazonSSM","GetParameters",{}).n("SSMClient","GetParametersCommand").f(void 0,GetParametersResultFilterSensitiveLog).ser(se_GetParametersCommand).de(de_GetParametersCommand).build()){}const version$1="6.2.2",REST_API_URL="https://api.allthings.me",OAUTH_URL="https://accounts.allthings.me",QUEUE_CONCURRENCY=void 0,QUEUE_DELAY=0,QUEUE_RESERVOIR=30,QUEUE_RESERVOIR_REFILL_INTERVAL=166,REQUEST_BACK_OFF_INTERVAL=200,REQUEST_MAX_RETRIES=50,DEFAULT_API_WRAPPER_OPTIONS={apiUrl:process.env.ALLTHINGS_REST_API_URL||REST_API_URL,clientId:process.env.ALLTHINGS_OAUTH_CLIENT_ID,clientSecret:process.env.ALLTHINGS_OAUTH_CLIENT_SECRET,oauthUrl:process.env.ALLTHINGS_OAUTH_URL||OAUTH_URL,password:process.env.ALLTHINGS_OAUTH_PASSWORD,requestBackOffInterval:REQUEST_BACK_OFF_INTERVAL,requestMaxRetries:REQUEST_MAX_RETRIES,scope:"user:profile",username:process.env.ALLTHINGS_OAUTH_USERNAME},USER_AGENT=`Allthings Node SDK REST Client/${version$1}`,DEFAULT_AWS_CONFIGURATION={region:"eu-central-2"};var __rest$5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const DEFAULT_CLIENT_CONFIG={clientConfig:DEFAULT_AWS_CONFIGURATION,onlyDefault:!1,prefix:process.env.SSM_PARAM_PATH},getSecrets=async(e,t,n,r)=>{var i,s;if(t.onlyDefault)return[r];try{const o=await e.send(new GetParametersCommand({Names:n.map((e=>`${t.prefix?t.prefix:""}${e}`)),WithDecryption:!0}));return null!==(s=null===(i=null==o?void 0:o.Parameters)||void 0===i?void 0:i.map((e=>{var t;return null!==(t=e.Value)&&void 0!==t?t:r})))&&void 0!==s?s:[r]}catch(e){return t.logger&&t.logger(e),[r]}},getSecret=async(e,t,n,r)=>{var i,s;if(t.onlyDefault)return r;try{const o=await e.send(new GetParameterCommand({Name:`${t.prefix?t.prefix:""}${n}`,WithDecryption:!0}));return null!==(s=null===(i=null==o?void 0:o.Parameter)||void 0===i?void 0:i.Value)&&void 0!==s?s:r}catch(e){return t.logger&&t.logger(e),r}},parameterStore=e=>{const t=Object.assign(Object.assign({},DEFAULT_CLIENT_CONFIG),e),{clientConfig:n}=t,r=__rest$5(t,["clientConfig"]),i=new SSMClient(n);return{getSecret:(e,t="")=>getSecret(i,r,e,t),getSecrets:(e,t="")=>getSecrets(i,r,e,t)}};function createTokenStore(e){const t=new Map(Object.entries(e||{}));return{get:e=>t.get(e),reset:()=>t.clear(),set:e=>Object.entries(e).forEach((([e,n])=>t.set(e,n)))}}var queryString={},strictUriEncode=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],decodeComponents(n),decodeComponents(r))}function decode(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(singleMatcher)||[],n=1;n<t.length;n++)t=(e=decodeComponents(t,n).join("")).match(singleMatcher)||[];return e}}function customDecodeURIComponent(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=multiMatcher.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=decode(n[0]);r!==n[0]&&(t[n[0]]=r)}n=multiMatcher.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),s=0;s<i.length;s++){var o=i[s];e=e.replace(new RegExp(o,"g"),t[o])}return e}var decodeUriComponent=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return customDecodeURIComponent(e)}},splitOnFirst=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},filterObj=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),s=0;s<r.length;s++){var o=r[s],a=e[o];(i?-1!==t.indexOf(o):t(o,a,e))&&(n[o]=a)}return n};!function(e){const t=strictUriEncode,n=decodeUriComponent,r=splitOnFirst,i=filterObj,s=Symbol("encodeFragmentIdentifier");function o(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}function c(e,t){return t.decode?n(e):e}function u(e){return Array.isArray(e)?e.sort():"object"==typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function d(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function l(e){const t=(e=d(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){o((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return(e,n,r)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),s="string"==typeof n&&!i&&c(n,e).includes(e.arrayFormatSeparator);n=s?c(n,e):n;const o=i||s?n.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===n?n:c(n,e);r[t]=o};case"bracket-separator":return(t,n,r)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(r[t]=n?c(n,e):n);const s=null===n?[]:n.split(e.arrayFormatSeparator).map((t=>c(t,e)));void 0!==r[t]?r[t]=[].concat(r[t],s):r[t]=s};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const s of e.split("&")){if(""===s)continue;let[e,o]=r(t.decode?s.replace(/\+/g," "):s,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?o:c(o,t),n(c(e,t),o,i)}for(const e of Object.keys(i)){const n=i[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=p(n[e],t);else i[e]=p(n,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const n=i[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=u(n):e[t]=n,e}),Object.create(null))}e.extract=l,e.parse=m,e.stringify=(e,t)=>{if(!e)return"";o((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[",i,"]"].join("")]:[...n,[a(t,e),"[",a(i,e),"]=",a(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[]"].join("")]:[...n,[a(t,e),"[]=",a(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),":list="].join("")]:[...n,[a(t,e),":list=",a(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[a(n,e),t,a(i,e)].join("")]:[[r,a(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,a(t,e)]:[...n,[a(t,e),"=",a(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const s=Object.keys(i);return!1!==t.sort&&s.sort(t.sort),s.map((n=>{const i=e[n];return void 0===i?"":null===i?a(n,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?a(n,t)+"[]":i.reduce(r(n),[]).join("&"):a(n,t)+"="+a(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,i]=r(e,"#");return Object.assign({url:n.split("?")[0]||"",query:m(l(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:c(i,t)}:{})},e.stringifyUrl=(t,n)=>{n=Object.assign({encode:!0,strict:!0,[s]:!0},n);const r=d(t.url).split("?")[0]||"",i=e.extract(t.url),o=e.parse(i,{sort:!1}),c=Object.assign(o,t.query);let u=e.stringify(c,n);u&&(u=`?${u}`);let l=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(t.url);return t.fragmentIdentifier&&(l=`#${n[s]?a(t.fragmentIdentifier,n):t.fragmentIdentifier}`),`${r}${u}${l}`},e.pick=(t,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[s]:!1},r);const{url:o,query:a,fragmentIdentifier:c}=e.parseUrl(t,r);return e.stringifyUrl({url:o,query:i(a,n),fragmentIdentifier:c},r)},e.exclude=(t,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return e.pick(t,i,r)}}(queryString);var querystring=getDefaultExportFromCjs(queryString);const RESPONSE_TYPE$1="code",GRANT_TYPE$3="authorization_code",castToAuthorizationRequestParams$1=e=>{const{redirectUri:t,clientId:n,scope:r,state:i}=e;if(!n)throw new Error('Missing required "clientId" parameter to perform authorization code grant redirect');if(!t)throw new Error('Missing required "redirectUri" parameter to perform authorization code grant redirect');return Object.assign(Object.assign({client_id:n,redirect_uri:t,response_type:RESPONSE_TYPE$1},r?{scope:r}:{}),i?{state:i}:{})},isEligibleForClientRedirect$1=e=>{try{return!!castToAuthorizationRequestParams$1(e)}catch(e){return!1}},getRedirectUrl$1=e=>`${e.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams$1(e),{skipEmptyString:!0,skipNull:!0})}`,castToTokenRequestParams$2=e=>{const{authorizationCode:t,redirectUri:n,clientId:r,clientSecret:i}=e;if(!r)throw new Error('Missing required "clientId" parameter to perform authorization code grant');if(!n)throw new Error('Missing required "redirectUri" parameter to perform authorization code grant');if(!t)throw new Error('Missing required "authorizationCode" parameter to perform authorization code grant');return Object.assign({client_id:r,code:t,grant_type:GRANT_TYPE$3,redirect_uri:n},i?{client_secret:i}:{})},isEligible$3=e=>{try{return!!castToTokenRequestParams$2(e)}catch(e){return!1}},requestToken$3=(e,t)=>e(castToTokenRequestParams$2(t));var browserPonyfill={exports:{}};!function(e,t){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==commonjsGlobal&&commonjsGlobal,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==n&&n,r="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,s="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in n,a="ArrayBuffer"in n;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};function d(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function m(e){this.map={},e instanceof m?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:s&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&s&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=h(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(y)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=f(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(x)}),this.json=function(){return this.text().then(JSON.parse)},this}m.prototype.append=function(e,t){e=d(e),t=l(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},m.prototype.delete=function(e){delete this.map[d(e)]},m.prototype.get=function(e){return e=d(e),this.has(e)?this.map[e]:null},m.prototype.has=function(e){return this.map.hasOwnProperty(d(e))},m.prototype.set=function(e,t){this.map[d(e)]=l(t)},m.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},m.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),p(e)},m.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},m.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),p(e)},i&&(m.prototype[Symbol.iterator]=m.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,i=(t=t||{}).body;if(e instanceof _){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new m(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new m(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),v.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function x(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function S(e,t){if(!(this instanceof S))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new m(t.headers),this.url=t.url||"",this._initBody(e)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},E.call(_.prototype),E.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var b=[301,302,303,307,308];S.redirect=function(e,t){if(-1===b.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function w(e,r){return new Promise((function(i,o){var c=new _(e,r);if(c.signal&&c.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}u.onload=function(){var e,t,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new m,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout((function(){i(new S(r,n))}),0)},u.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.onabort=function(){setTimeout((function(){o(new t.DOMException("Aborted","AbortError"))}),0)},u.open(c.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(c.url),!0),"include"===c.credentials?u.withCredentials=!0:"omit"===c.credentials&&(u.withCredentials=!1),"responseType"in u&&(s?u.responseType="blob":a&&c.headers.get("Content-Type")&&-1!==c.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof m?c.headers.forEach((function(e,t){u.setRequestHeader(t,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){u.setRequestHeader(e,l(r.headers[e]))})),c.signal&&(c.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&c.signal.removeEventListener("abort",d)}),u.send(void 0===c._bodyInit?null:c._bodyInit)}))}w.polyfill=!0,n.fetch||(n.fetch=w,n.Headers=m,n.Request=_,n.Response=S),t.Headers=m,t.Request=_,t.Response=S,t.fetch=w}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports,fetch$1=getDefaultExportFromCjs(browserPonyfillExports);const SUBSCRIPTIONS=process.env.DEBUG&&process.env.DEBUG.split(",").map((e=>e.trim()))||[];function makeLogger(e){return["log","info","warn","error"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:function(...t){return(SUBSCRIPTIONS.includes("*")||SUBSCRIPTIONS.includes(e)||SUBSCRIPTIONS.includes(e.toLocaleLowerCase()))&&console[n](`${e}:`,...t),!0}})),{})}const logger=makeLogger("OAuth Token Request"),makeFetchTokenRequester=e=>async t=>{try{const n=await fetch$1(e,{body:querystring.stringify(t,{skipEmptyString:!0,skipNull:!0}),cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded",accept:"application/json","user-agent":USER_AGENT},method:"POST",mode:"cors"});if(200!==n.status)throw n;const{access_token:r,refresh_token:i,expires_in:s}=await n.json();return{accessToken:r,expiresIn:s,refreshToken:i}}catch(e){if(!e.status)throw e;const t=`HTTP ${e.status} — ${e.statusText}`;throw logger.error(t,e.response),new Error(`HTTP ${e.status} — ${e.statusText}. Could not get token.`)}},GRANT_TYPE$2="refresh_token",castToTokenRequestParams$1=e=>{const{clientId:t,clientSecret:n,refreshToken:r,scope:i}=e;if(!t)throw new Error('Missing required "clientId" parameter to perform refresh token grant');if(!r)throw new Error('Missing required "refreshToken" parameter to perform refresh token grant');return Object.assign(Object.assign({client_id:t,grant_type:GRANT_TYPE$2,refresh_token:r},n?{client_secret:n}:{}),i?{scope:i}:{})},isEligible$2=e=>{try{return!!castToTokenRequestParams$1(e)}catch(e){return!1}},requestToken$2=(e,t)=>e(castToTokenRequestParams$1(t));async function requestAndSaveToStore(e,t){const n=await e();return t.set(n),n}const partial=(e,...t)=>(...n)=>e(...t,...n);async function until(e,t,n,r=0){const i=await t(n,r);return await e(i,r)?i:until(e,t,i,r+1)}function fnClearInterval(e){return clearInterval(e),!0}function pseudoRandomString(e=16){let t="";for(;t.length<e;)t+=Math.random().toString(36).substr(2);return t.substr(0,e)}async function del(e,t,n,r,i){return e("delete",t,{body:n,headers:i},r)}async function get(e,t,n,r,i){return e("get",t,{headers:i,query:n},r)}var __rest$4=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumGender,EnumUserType,EnumCommunicationPreferenceChannel,EnumUserPermissionRole,EnumUserPermissionObjectType;!function(e){e.female="female",e.male="male"}(EnumGender||(EnumGender={})),function(e){e.allthingsUser="allthings_user",e.allthingsContent="allthings_content",e.customer="customer",e.demoContent="demo_content",e.demoPublic="demo_public",e.partner="partner"}(EnumUserType||(EnumUserType={})),exports.EnumCommunicationPreferenceChannel=void 0,EnumCommunicationPreferenceChannel=exports.EnumCommunicationPreferenceChannel||(exports.EnumCommunicationPreferenceChannel={}),EnumCommunicationPreferenceChannel.push="push",EnumCommunicationPreferenceChannel.email="email",exports.EnumUserPermissionRole=void 0,EnumUserPermissionRole=exports.EnumUserPermissionRole||(exports.EnumUserPermissionRole={}),EnumUserPermissionRole.appAdmin="app-admin",EnumUserPermissionRole.appOwner="app-owner",EnumUserPermissionRole.articlesAgent="articles-agent",EnumUserPermissionRole.articlesViewOnly="articles-view-only",EnumUserPermissionRole.bookableAssetAgent="bookable-asset-agent",EnumUserPermissionRole.bookingAgent="booking-agent",EnumUserPermissionRole.cockpitManager="cockpit-manager",EnumUserPermissionRole.dataConnectorAdmin="data-connector-admin",EnumUserPermissionRole.documentAdmin="doc-admin",EnumUserPermissionRole.externalAgent="external-agent",EnumUserPermissionRole.globalOrgAdmin="global-org-admin",EnumUserPermissionRole.globalUserAdmin="global-user-admin",EnumUserPermissionRole.orgAdmin="org-admin",EnumUserPermissionRole.orgTeamManager="org-team-manager",EnumUserPermissionRole.pinboardAgent="pinboard-agent",EnumUserPermissionRole.platformOwner="platform-owner",EnumUserPermissionRole.qa="qa",EnumUserPermissionRole.serviceCenterAgent="service-center-agent",EnumUserPermissionRole.serviceCenterManager="service-center-manager",EnumUserPermissionRole.setup="setup",EnumUserPermissionRole.tenantManager="tenant-manager",exports.EnumUserPermissionObjectType=void 0,EnumUserPermissionObjectType=exports.EnumUserPermissionObjectType||(exports.EnumUserPermissionObjectType={}),EnumUserPermissionObjectType.app="App",EnumUserPermissionObjectType.group="Group",EnumUserPermissionObjectType.property="Property",EnumUserPermissionObjectType.unit="Unit";const remapUserResult=e=>{const{tenantIDs:t}=e,n=__rest$4(e,["tenantIDs"]);return Object.assign(Object.assign({},n),{tenantIds:t})},remapEmbeddedUser=e=>e.users?e.users.map(remapUserResult):[];async function userCreate(e,t,n,r){return e.post("/v1/users",Object.assign(Object.assign({},r),{creationContext:t,username:n}))}async function getUsers(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:s}=await e.get("/v1/users",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i.map(remapUserResult)},total:s}}async function getCurrentUser(e){return remapUserResult(await e.get("/v1/me"))}async function userGetById(e,t){return remapUserResult(await e.get(`/v1/users/${t}`))}async function userUpdateById(e,t,n){const{tenantIds:r}=n,i=__rest$4(n,["tenantIds"]);return remapUserResult(await e.patch(`/v1/users/${t}`,Object.assign(Object.assign({},i),{tenantIDs:r})))}async function userCreatePermission(e,t,n){const{objectId:r}=n,i=__rest$4(n,["objectId"]),s=await e.post(`/v1/users/${t}/permissions`,Object.assign(Object.assign({},i),{objectID:r})),{objectID:o}=s,a=__rest$4(s,["objectID"]);return Object.assign(Object.assign({},a),{objectId:o})}async function userCreatePermissionBatch(e,t,n){const{objectId:r,objectType:i,roles:s,startDate:o,endDate:a}=n,c={batch:s.map((e=>({endDate:a&&a.toISOString(),objectID:r,objectType:i,restrictions:[],role:e,startDate:o&&o.toISOString()})))};return!await e.post(`/v1/users/${t}/permissions`,c)}async function userGetPermissions(e,t){const{_embedded:{items:n}}=await e.get(`/v1/users/${t}/roles?limit=-1`);return n.map((e=>{var{objectID:t}=e,n=__rest$4(e,["objectID"]);return Object.assign(Object.assign({},n),{objectId:t})}))}async function userDeletePermission(e,t){return!await e.delete(`/v1/permissions/${t}`)}async function userGetUtilisationPeriods(e,t){const{_embedded:{items:n}}=await e.get(`/v1/users/${t}/utilisation-periods`);return n}async function userCheckInToUtilisationPeriod(e,t,n){const{email:r}=await e.userGetById(t);return e.utilisationPeriodCheckInUser(n,{email:r})}async function userGetByEmail(e,t,n=1,r=1e3){return e.getUsers(n,r,{email:t})}async function userChangePassword(e,t,n,r){return!await e.put(`/v1/users/${t}/password`,{currentPassword:n,plainPassword:r})}async function agentCreate(e,t,n,r,i,s,o){const a=await e.userCreate(t,r,Object.assign(Object.assign({},i),{type:EnumUserType.customer})),c=await e.post(`/v1/property-managers/${n}/users`,Object.assign({userID:a.id},o&&{externalAgentCompany:o}));return!((void 0===s||s)&&await e.post(`/v1/users/${a.id}/invitations`))&&Object.assign(Object.assign({},a),c)}async function agentCreatePermissions(e,t,n,r,i,s,o){return e.userCreatePermissionBatch(t,{endDate:o,objectId:n,objectType:r,restrictions:[],roles:i,startDate:s})}async function appCreate(e,t,n){return e.post(`/v1/users/${t}/apps`,Object.assign(Object.assign({availableLocales:{0:"de_DE"}},n),{siteUrl:n.siteUrl.replace("_","")}))}async function appGetById(e,t){return e.get(`/v1/apps/${t}`)}async function bookingGetById(e,t){return e.get(`/v1/bookings/${t}`)}async function bookingUpdateById(e,t,n){return e.patch(`/v1/bookings/${t}`,n)}async function bucketGet(e,t){return e.get(`/v1/buckets/${t}`)}async function bucketCreate(e,t){return e.post("/v1/buckets",{channels:t.channels,name:t.name})}async function bucketAddFile(e,t,n){return""===await e.post(`/v1/buckets/${t}/files`,{id:n})}async function bucketRemoveFile(e,t,n){return""===await e.delete(`/v1/buckets/${t}/files/${n}`)}async function bucketRemoveFilesInPath(e,t,n){return""===await e.delete(`/v1/buckets/${t}/files`,{folder:n.path})}const createManyFiles=async(e,t)=>await Promise.all(e.map((async e=>{try{return await t.fileCreate({file:e.content,name:e.filename})}catch(e){return e}})));async function createManyFilesSorted(e,t){const n=await createManyFiles(e,t);return{error:n.filter((e=>e instanceof Error)),success:n.filter((e=>!(e instanceof Error))).map((e=>e.id))}}async function conversationGetById(e,t){return e.get(`/v1/conversations/${t}`)}async function conversationCreateMessage(e,t,n){const r=`/v1/conversations/${t}/messages`,i=n.attachments&&n.attachments.length?{content:{description:n.body,files:(await createManyFilesSorted(n.attachments,e)).success},createdBy:n.createdBy,inputChannel:n.inputChannel,internal:!1,type:"file"}:{content:{content:n.body},createdBy:n.createdBy,inputChannel:n.inputChannel,type:"text"};return e.post(r,i)}async function fileCreate(e,t){return e.post("/v1/files",{formData:{file:[t.file,t.name],path:t.path||""}})}async function fileDelete(e,t){return""===await e.delete(`/v1/files/${t}`)}var __rest$3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};async function groupCreate(e,t,n){const{propertyManagerId:r}=n,i=__rest$3(n,["propertyManagerId"]);return e.post(`/v1/properties/${t}/groups`,Object.assign(Object.assign({},i),{propertyManagerID:r}))}async function groupGetById(e,t){const n=await e.get(`/v1/groups/${t}`),{propertyManagerID:r}=n,i=__rest$3(n,["propertyManagerID"]);return Object.assign(Object.assign({},i),{propertyManagerId:r})}async function groupUpdateById(e,t,n){return e.patch(`/v1/groups/${t}`,n)}async function getGroups(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:s}=await e.get("/v1/groups",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:s}}async function lookupIds(e,t,n){return e.post(`/v1/id-lookup/${t}/${n.resource}`,Object.assign(Object.assign({externalIds:"string"==typeof n.externalIds?[n.externalIds]:n.externalIds},n.parentId?{parentId:n.parentId}:{}),n.userType?{userType:n.userType}:{}))}function stringToDate(e){return new Date(Date.parse(e))}function dateToString(e){return e.toISOString()}var __rest$2=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumNotificationCategory,EnumNotificationType,EnumNotificationSettingsValue;function remapNotificationResult(e){var{createdAt:t,objectID:n,referencedObjectID:r}=e,i=__rest$2(e,["createdAt","objectID","referencedObjectID"]);return Object.assign({createdAt:stringToDate(t),objectId:n,referencedObjectId:r},i)}async function notificationsGetByUser(e,t,n=1,r=-1){const{_embedded:{items:i},total:s,metaData:o}=await e.get(`/v1/users/${t}/notifications?page=${n}&limit=${r}`);return{_embedded:{items:i.map(remapNotificationResult)},metaData:o,total:s}}async function notificationsUpdateReadByUser(e,t,n=new Date){return e.patch(`/v1/users/${t}/notifications`,{lastReadAt:dateToString(n)})}async function notificationUpdateRead(e,t){return remapNotificationResult(await e.patch(`/v1/notifications/${t}`,{read:!0}))}function remapKeys(e,t){return Object.entries(e).reduce(((e,n)=>Object.assign(Object.assign({},e),{[t(n[0])]:n[1]})),{})}function camelCaseToDash(e){return e.replace(/([A-Z])/g,(e=>`-${e[0].toLowerCase()}`))}function dashCaseToCamel(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}async function notificationSettingsUpdateByUser(e,t,n){const r=await e.patch(`/v1/users/${t}/notification-settings`,{notificationSettings:remapKeys(n,camelCaseToDash)});return remapKeys(r,dashCaseToCamel)}async function notificationSettingsResetByUser(e,t){return remapKeys(await e.delete(`/v1/users/${t}/notification-settings`),dashCaseToCamel)}async function propertyCreate(e,t,n){return e.post(`/v1/apps/${t}/properties`,n)}async function propertyGetById(e,t){return e.get(`/v1/properties/${t}`)}async function propertyUpdateById(e,t,n){return e.patch(`/v1/properties/${t}`,n)}async function getProperties(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:s}=await e.get("/v1/properties",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:s}}!function(e){e.events="events",e.hintsAndTips="hints-and-tips",e.lostAndFound="lost-and-found",e.localDeals="local-deals",e.localEvents="local-events",e.miscellaneous="miscellaneous",e.deals="deals",e.messages="messages",e.adminMessages="admin-messages",e.newThingsToGive="new-things-to-give",e.newThingsForSale="new-things-for-sale",e.surveys="surveys",e.supportOffer="support-offer",e.supportRequest="support-request",e.sustainability="sustainability",e.localServices="local-services",e.services="services",e.ticketDigestEmail="ticket-digest-email",e.appDigestEmail="app-digest-email",e.newFile="new-file"}(EnumNotificationCategory||(EnumNotificationCategory={})),function(e){e.clipboardThing="clipboard-thing",e.comment="comment",e.communityArticle="community-article",e.newFile="new-file",e.ticketComment="ticket-comment",e.welcomeNotification="welcome-notification"}(EnumNotificationType||(EnumNotificationType={})),function(e){e.never="never",e.immediately="immediately",e.daily="daily",e.weekly="weekly",e.biweekly="biweekly",e.monthly="monthly"}(EnumNotificationSettingsValue||(EnumNotificationSettingsValue={}));var __rest$1=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const remapRegistationCodeResult=e=>{const{tenantID:t}=e,n=__rest$1(e,["tenantID"]);return Object.assign(Object.assign({},n),{externalId:t})};async function registrationCodeCreate(e,t,n,r={permanent:!1}){const{externalId:i}=r,s=__rest$1(r,["externalId"]);return remapRegistationCodeResult(await e.post("/v1/registration-codes",Object.assign(Object.assign({code:t,utilisationPeriods:"string"==typeof n?[n]:n},i?{tenantID:i}:{}),s)))}async function registrationCodeUpdateById(e,t,n){return remapRegistationCodeResult(await e.patch(`/v1/registration-codes/${t}`,n))}async function registrationCodeGetById(e,t){return remapRegistationCodeResult(await e.get(`/v1/invitations/${t}`))}async function registrationCodeDelete(e,t){return""===await e.delete(`/v1/invitations/${t}`)}async function serviceProviderCreate(e,t){return e.post("/v1/service-providers",t)}async function serviceProviderGetById(e,t){return e.get(`/v1/service-providers/${t}`)}async function serviceProviderUpdateById(e,t,n){return e.patch(`/v1/service-providers/${t}`,n)}var ETicketStatus,ETrafficLightColor,EnumUnitObjectType,EnumUnitType,EnumUserRelationType;async function ticketGetById(e,t){return e.get(`/v1/tickets/${t}`)}async function ticketCreateOnUser(e,t,n,r){return e.post(`/v1/users/${t}/tickets`,Object.assign(Object.assign({},r),{files:r.files?(await createManyFilesSorted(r.files,e)).success:[],utilisationPeriod:n}))}async function ticketCreateOnServiceProvider(e,t,n){return e.post(`/v1/property-managers/${t}/tickets`,Object.assign(Object.assign({},n),{files:n.files?(await createManyFilesSorted(n.files,e)).success:[]}))}async function unitCreate(e,t,n){return e.post(`/v1/groups/${t}/units`,n)}async function unitGetById(e,t){return e.get(`/v1/units/${t}`)}async function unitUpdateById(e,t,n){return e.patch(`/v1/units/${t}`,n)}async function getUnits(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:s}=await e.get("/v1/units",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:s}}async function userRelationCreate(e,t,n){return e.post(`/v1/users/${t}/user-relations/${n.type}`,{ids:n.ids,level:n.level,readOnly:n.readOnly,role:n.role})}async function userRelationDelete(e,t,n){return e.delete(`/v1/users/${t}/user-relations/${n.type}`,{ids:n.ids,level:n.level,role:n.role})}async function userRelationsGetByUser(e,t){return e.get(`/v1/users/${t}/user-relations`)}!function(e){e.CLOSED="closed",e.WAITING_FOR_AGENT="waiting-for-agent",e.WAITING_FOR_CUSTOMER="waiting-for-customer",e.WAITING_FOR_EXTERNAL="waiting-for-external"}(ETicketStatus||(ETicketStatus={})),function(e){e.GREEN="green",e.RED="red",e.YELLOW="yellow"}(ETrafficLightColor||(ETrafficLightColor={})),exports.EnumUnitObjectType=void 0,EnumUnitObjectType=exports.EnumUnitObjectType||(exports.EnumUnitObjectType={}),EnumUnitObjectType.adjoiningRoom="adjoining-room",EnumUnitObjectType.advertisingSpace="advertising-space",EnumUnitObjectType.aerial="aerial",EnumUnitObjectType.apartmentBuilding="apartment-building",EnumUnitObjectType.atm="atm",EnumUnitObjectType.atmRoom="atm-room",EnumUnitObjectType.attic="attic",EnumUnitObjectType.atticFlat="attic-flat",EnumUnitObjectType.bank="bank",EnumUnitObjectType.basment="basment",EnumUnitObjectType.bikeShed="bike-shed",EnumUnitObjectType.buildingLaw="building-law",EnumUnitObjectType.cafeteria="cafeteria",EnumUnitObjectType.caretakerRoom="caretaker-room",EnumUnitObjectType.carport="carport",EnumUnitObjectType.cellar="cellar",EnumUnitObjectType.commercialProperty="commercial-property",EnumUnitObjectType.commonRoom="common-room",EnumUnitObjectType.deliveryZone="delivery-zone",EnumUnitObjectType.diverse="diverse",EnumUnitObjectType.doubleParkingSpace="double-parking-space",EnumUnitObjectType.engineeringRoom="engineering-room",EnumUnitObjectType.entertainment="entertainment",EnumUnitObjectType.environment="environment",EnumUnitObjectType.estate="estate",EnumUnitObjectType.fillingStation="filling-station",EnumUnitObjectType.fitnessCenter="fitness-center",EnumUnitObjectType.flat="flat",EnumUnitObjectType.freeZone="free-zone",EnumUnitObjectType.garage="garage",EnumUnitObjectType.garden="garden",EnumUnitObjectType.gardenFlat="garden-flat",EnumUnitObjectType.heatingFacilities="heating-facilities",EnumUnitObjectType.hotel="hotel",EnumUnitObjectType.incidentalRentalExpenses="incidental-rental-expenses",EnumUnitObjectType.industry="industry",EnumUnitObjectType.kiosk="kiosk",EnumUnitObjectType.kitchen="kitchen",EnumUnitObjectType.loft="loft",EnumUnitObjectType.machine="machine",EnumUnitObjectType.maisonette="maisonette",EnumUnitObjectType.medicalPractice="medical-practice",EnumUnitObjectType.mopedShed="moped-shed",EnumUnitObjectType.motorcycleParkingSpace="motorcycle-parking-space",EnumUnitObjectType.office="office",EnumUnitObjectType.oneFamilyHouse="one-family-house",EnumUnitObjectType.parkingBox="parking-box",EnumUnitObjectType.parkingGarage="parking-garage",EnumUnitObjectType.parkingSpace="parking-space",EnumUnitObjectType.parkingSpaces="parking-spaces",EnumUnitObjectType.penthouse="penthouse",EnumUnitObjectType.productionPlant="production-plant",EnumUnitObjectType.pub="pub",EnumUnitObjectType.publicArea="public-area",EnumUnitObjectType.restaurant="restaurant",EnumUnitObjectType.retirementHome="retirement-home",EnumUnitObjectType.salesFloor="sales-floor",EnumUnitObjectType.school="school",EnumUnitObjectType.shelter="shelter",EnumUnitObjectType.storage="storage",EnumUnitObjectType.store="store",EnumUnitObjectType.storeroom="storeroom",EnumUnitObjectType.studio="studio",EnumUnitObjectType.terrace="terrace",EnumUnitObjectType.toilets="toilets",EnumUnitObjectType.utilityRoom="utility-room",EnumUnitObjectType.variableParkingSpace="variable-parking-space",EnumUnitObjectType.variableRoom="variable-room",EnumUnitObjectType.visitorParkingSpace="visitor-parking-space",EnumUnitObjectType.workshop="workshop",exports.EnumUnitType=void 0,EnumUnitType=exports.EnumUnitType||(exports.EnumUnitType={}),EnumUnitType.rented="rented",EnumUnitType.owned="owned",exports.EnumUserRelationType=void 0,EnumUserRelationType=exports.EnumUserRelationType||(exports.EnumUserRelationType={}),EnumUserRelationType.isResponsible="is-responsible";var __rest=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumUtilisationPeriodType;async function utilisationPeriodCreate(e,t,n){const r=await e.post(`/v1/units/${t}/utilisation-periods`,n),{tenantIDs:i,_embedded:s}=r,o=__rest(r,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},o),{invitations:s.invitations.map(remapRegistationCodeResult),tenantIds:i,users:remapEmbeddedUser(s)})}async function utilisationPeriodGetById(e,t){const n=await e.get(`/v1/utilisation-periods/${t}`),{tenantIDs:r,_embedded:i}=n,s=__rest(n,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},s),{invitations:i.invitations.map(remapRegistationCodeResult),tenantIds:r,users:remapEmbeddedUser(i)})}async function utilisationPeriodUpdateById(e,t,n){const r=await e.patch(`/v1/utilisation-periods/${t}`,n),{tenantIDs:i,_embedded:s}=r,o=__rest(r,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},o),{invitations:s.invitations.map(remapRegistationCodeResult),tenantIds:i,users:remapEmbeddedUser(s)})}async function utilisationPeriodDelete(e,t){return!await e.delete(`/v1/utilisation-periods/${t}/soft`)}async function utilisationPeriodCheckInUser(e,t,n){return await e.post(`/v1/utilisation-periods/${t}/users`,{email:n.email})&&e.utilisationPeriodGetById(t)}async function utilisationPeriodCheckOutUser(e,t,n){return""===await e.delete(`/v1/utilisation-periods/${t}/users/${n}`)}async function utilisationPeriodAddRegistrationCode(e,t,n,r,i=!1){return e.post(`/v1/utilisation-periods/${t}/registration-codes`,{code:n,permanent:i,tenant:r})}async function patch(e,t,n,r,i){return e("patch",t,{body:n,headers:i},r)}async function post(e,t,n,r,i){return e("post",t,{body:n,headers:i},r)}async function put(e,t,n,r,i){return e("put",t,{body:n,headers:i},r)}exports.EnumUtilisationPeriodType=void 0,EnumUtilisationPeriodType=exports.EnumUtilisationPeriodType||(exports.EnumUtilisationPeriodType={}),EnumUtilisationPeriodType.tenant="tenant",EnumUtilisationPeriodType.ownership="ownership",EnumUtilisationPeriodType.vacant="vacant";var parser$3={},DLList$2;parser$3.load=function(e,t,n={}){var r,i,s;for(r in t)s=t[r],n[r]=null!=(i=e[r])?i:s;return n},parser$3.overwrite=function(e,t,n={}){var r,i;for(r in e)i=e[r],void 0!==t[r]&&(n[r]=i);return n},DLList$2=class{constructor(e,t){this.incr=e,this.decr=t,this._first=null,this._last=null,this.length=0}push(e){var t;this.length++,"function"==typeof this.incr&&this.incr(),t={value:e,prev:this._last,next:null},null!=this._last?(this._last.next=t,this._last=t):this._first=this._last=t}shift(){var e;if(null!=this._first)return this.length--,"function"==typeof this.decr&&this.decr(),e=this._first.value,null!=(this._first=this._first.next)?this._first.prev=null:this._last=null,e}first(){if(null!=this._first)return this._first.value}getArray(){var e,t,n;for(e=this._first,n=[];null!=e;)n.push((t=e,e=e.next,t.value));return n}forEachShift(e){var t;for(t=this.shift();null!=t;)e(t),t=this.shift()}debug(){var e,t,n,r,i;for(e=this._first,i=[];null!=e;)i.push((t=e,e=e.next,{value:t.value,prev:null!=(n=t.prev)?n.value:void 0,next:null!=(r=t.next)?r.value:void 0}));return i}};var DLList_1=DLList$2,Events$1;function asyncGeneratorStep$4(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$4(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep$4(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep$4(s,r,i,o,a,"throw",e)}o(void 0)}))}}Events$1=class{constructor(e){if(this.instance=e,this._events={},null!=this.instance.on||null!=this.instance.once||null!=this.instance.removeAllListeners)throw new Error("An Emitter already exists for this object");this.instance.on=(e,t)=>this._addListener(e,"many",t),this.instance.once=(e,t)=>this._addListener(e,"once",t),this.instance.removeAllListeners=(e=null)=>null!=e?delete this._events[e]:this._events={}}_addListener(e,t,n){var r;return null==(r=this._events)[e]&&(r[e]=[]),this._events[e].push({cb:n,status:t}),this.instance}listenerCount(e){return null!=this._events[e]?this._events[e].length:0}trigger(e,...t){var n=this;return _asyncToGenerator$4((function*(){var r,i;try{if("debug"!==e&&n.trigger("debug",`Event triggered: ${e}`,t),null==n._events[e])return;return n._events[e]=n._events[e].filter((function(e){return"none"!==e.status})),i=n._events[e].map(function(){var e=_asyncToGenerator$4((function*(e){var r,i;if("none"!==e.status){"once"===e.status&&(e.status="none");try{return"function"==typeof(null!=(i="function"==typeof e.cb?e.cb(...t):void 0)?i.then:void 0)?yield i:i}catch(e){return r=e,n.trigger("error",r),null}}}));return function(t){return e.apply(this,arguments)}}()),(yield Promise.all(i)).find((function(e){return null!=e}))}catch(e){return r=e,n.trigger("error",r),null}}))()}};var Events_1=Events$1,DLList$1,Events,Queues;DLList$1=DLList_1,Events=Events_1,Queues=class{constructor(e){this.Events=new Events(this),this._length=0,this._lists=function(){var t,n,r;for(r=[],t=1,n=e;1<=n?t<=n:t>=n;1<=n?++t:--t)r.push(new DLList$1((()=>this.incr()),(()=>this.decr())));return r}.call(this)}incr(){if(0==this._length++)return this.Events.trigger("leftzero")}decr(){if(0==--this._length)return this.Events.trigger("zero")}push(e){return this._lists[e.options.priority].push(e)}queued(e){return null!=e?this._lists[e].length:this._length}shiftAll(e){return this._lists.forEach((function(t){return t.forEachShift(e)}))}getFirst(e=this._lists){var t,n,r;for(t=0,n=e.length;t<n;t++)if((r=e[t]).length>0)return r;return[]}shiftLastFrom(e){return this.getFirst(this._lists.slice(e).reverse()).shift()}};var Queues_1=Queues,BottleneckError_1,hasRequiredBottleneckError,BottleneckError$3,DEFAULT_PRIORITY,Job,NUM_PRIORITIES,parser$2;function requireBottleneckError(){return hasRequiredBottleneckError?BottleneckError_1:(hasRequiredBottleneckError=1,e=class extends Error{},BottleneckError_1=e);var e}function asyncGeneratorStep$3(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$3(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep$3(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep$3(s,r,i,o,a,"throw",e)}o(void 0)}))}}NUM_PRIORITIES=10,DEFAULT_PRIORITY=5,parser$2=parser$3,BottleneckError$3=requireBottleneckError(),Job=class{constructor(e,t,n,r,i,s,o,a){this.task=e,this.args=t,this.rejectOnDrop=i,this.Events=s,this._states=o,this.Promise=a,this.options=parser$2.load(n,r),this.options.priority=this._sanitizePriority(this.options.priority),this.options.id===r.id&&(this.options.id=`${this.options.id}-${this._randomIndex()}`),this.promise=new this.Promise(((e,t)=>{this._resolve=e,this._reject=t})),this.retryCount=0}_sanitizePriority(e){var t;return(t=~~e!==e?DEFAULT_PRIORITY:e)<0?0:t>NUM_PRIORITIES-1?NUM_PRIORITIES-1:t}_randomIndex(){return Math.random().toString(36).slice(2)}doDrop({error:e,message:t="This job has been dropped by Bottleneck"}={}){return!!this._states.remove(this.options.id)&&(this.rejectOnDrop&&this._reject(null!=e?e:new BottleneckError$3(t)),this.Events.trigger("dropped",{args:this.args,options:this.options,task:this.task,promise:this.promise}),!0)}_assertStatus(e){var t;if((t=this._states.jobStatus(this.options.id))!==e&&("DONE"!==e||null!==t))throw new BottleneckError$3(`Invalid job status ${t}, expected ${e}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`)}doReceive(){return this._states.start(this.options.id),this.Events.trigger("received",{args:this.args,options:this.options})}doQueue(e,t){return this._assertStatus("RECEIVED"),this._states.next(this.options.id),this.Events.trigger("queued",{args:this.args,options:this.options,reachedHWM:e,blocked:t})}doRun(){return 0===this.retryCount?(this._assertStatus("QUEUED"),this._states.next(this.options.id)):this._assertStatus("EXECUTING"),this.Events.trigger("scheduled",{args:this.args,options:this.options})}doExecute(e,t,n,r){var i=this;return _asyncToGenerator$3((function*(){var s,o,a;0===i.retryCount?(i._assertStatus("RUNNING"),i._states.next(i.options.id)):i._assertStatus("EXECUTING"),o={args:i.args,options:i.options,retryCount:i.retryCount},i.Events.trigger("executing",o);try{if(a=yield null!=e?e.schedule(i.options,i.task,...i.args):i.task(...i.args),t())return i.doDone(o),yield r(i.options,o),i._assertStatus("DONE"),i._resolve(a)}catch(e){return s=e,i._onFailure(s,o,t,n,r)}}))()}doExpire(e,t,n){var r,i;return this._states.jobStatus("RUNNING"===this.options.id)&&this._states.next(this.options.id),this._assertStatus("EXECUTING"),i={args:this.args,options:this.options,retryCount:this.retryCount},r=new BottleneckError$3(`This job timed out after ${this.options.expiration} ms.`),this._onFailure(r,i,e,t,n)}_onFailure(e,t,n,r,i){var s=this;return _asyncToGenerator$3((function*(){var o,a;if(n())return null!=(o=yield s.Events.trigger("failed",e,t))?(a=~~o,s.Events.trigger("retry",`Retrying ${s.options.id} after ${a} ms`,t),s.retryCount++,r(a)):(s.doDone(t),yield i(s.options,t),s._assertStatus("DONE"),s._reject(e))}))()}doDone(e){return this._assertStatus("EXECUTING"),this._states.next(this.options.id),this.Events.trigger("done",e)}};var Job_1=Job,BottleneckError$2,LocalDatastore,parser$1;function asyncGeneratorStep$2(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$2(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep$2(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep$2(s,r,i,o,a,"throw",e)}o(void 0)}))}}parser$1=parser$3,BottleneckError$2=requireBottleneckError(),LocalDatastore=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.clientId=this.instance._randomIndex(),parser$1.load(n,n,this),this._nextRequest=this._lastReservoirRefresh=this._lastReservoirIncrease=Date.now(),this._running=0,this._done=0,this._unblockTime=0,this.ready=this.Promise.resolve(),this.clients={},this._startHeartbeat()}_startHeartbeat(){var e;return null==this.heartbeat&&(null!=this.storeOptions.reservoirRefreshInterval&&null!=this.storeOptions.reservoirRefreshAmount||null!=this.storeOptions.reservoirIncreaseInterval&&null!=this.storeOptions.reservoirIncreaseAmount)?"function"==typeof(e=this.heartbeat=setInterval((()=>{var e,t,n,r,i;if(r=Date.now(),null!=this.storeOptions.reservoirRefreshInterval&&r>=this._lastReservoirRefresh+this.storeOptions.reservoirRefreshInterval&&(this._lastReservoirRefresh=r,this.storeOptions.reservoir=this.storeOptions.reservoirRefreshAmount,this.instance._drainAll(this.computeCapacity())),null!=this.storeOptions.reservoirIncreaseInterval&&r>=this._lastReservoirIncrease+this.storeOptions.reservoirIncreaseInterval){var s=this.storeOptions;if(e=s.reservoirIncreaseAmount,n=s.reservoirIncreaseMaximum,i=s.reservoir,this._lastReservoirIncrease=r,(t=null!=n?Math.min(e,n-i):e)>0)return this.storeOptions.reservoir+=t,this.instance._drainAll(this.computeCapacity())}}),this.heartbeatInterval)).unref?e.unref():void 0:clearInterval(this.heartbeat)}__publish__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),t.instance.Events.trigger("message",e.toString())}))()}__disconnect__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),clearInterval(t.heartbeat),t.Promise.resolve()}))()}yieldLoop(e=0){return new this.Promise((function(t,n){return setTimeout(t,e)}))}computePenalty(){var e;return null!=(e=this.storeOptions.penalty)?e:15*this.storeOptions.minTime||5e3}__updateSettings__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),parser$1.overwrite(e,e,t.storeOptions),t._startHeartbeat(),t.instance._drainAll(t.computeCapacity()),!0}))()}__running__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e._running}))()}__queued__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e.instance.queued()}))()}__done__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e._done}))()}__groupCheck__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),t._nextRequest+t.timeout<e}))()}computeCapacity(){var e,t,n=this.storeOptions;return e=n.maxConcurrent,t=n.reservoir,null!=e&&null!=t?Math.min(e-this._running,t):null!=e?e-this._running:null!=t?t:null}conditionsCheck(e){var t;return null==(t=this.computeCapacity())||e<=t}__incrementReservoir__(e){var t=this;return _asyncToGenerator$2((function*(){var n;return yield t.yieldLoop(),n=t.storeOptions.reservoir+=e,t.instance._drainAll(t.computeCapacity()),n}))()}__currentReservoir__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e.storeOptions.reservoir}))()}isBlocked(e){return this._unblockTime>=e}check(e,t){return this.conditionsCheck(e)&&this._nextRequest-t<=0}__check__(e){var t=this;return _asyncToGenerator$2((function*(){var n;return yield t.yieldLoop(),n=Date.now(),t.check(e,n)}))()}__register__(e,t,n){var r=this;return _asyncToGenerator$2((function*(){var e,n;return yield r.yieldLoop(),e=Date.now(),r.conditionsCheck(t)?(r._running+=t,null!=r.storeOptions.reservoir&&(r.storeOptions.reservoir-=t),n=Math.max(r._nextRequest-e,0),r._nextRequest=e+n+r.storeOptions.minTime,{success:!0,wait:n,reservoir:r.storeOptions.reservoir}):{success:!1}}))()}strategyIsBlock(){return 3===this.storeOptions.strategy}__submit__(e,t){var n=this;return _asyncToGenerator$2((function*(){var r,i,s;if(yield n.yieldLoop(),null!=n.storeOptions.maxConcurrent&&t>n.storeOptions.maxConcurrent)throw new BottleneckError$2(`Impossible to add a job having a weight of ${t} to a limiter having a maxConcurrent setting of ${n.storeOptions.maxConcurrent}`);return i=Date.now(),s=null!=n.storeOptions.highWater&&e===n.storeOptions.highWater&&!n.check(t,i),(r=n.strategyIsBlock()&&(s||n.isBlocked(i)))&&(n._unblockTime=i+n.computePenalty(),n._nextRequest=n._unblockTime+n.storeOptions.minTime,n.instance._dropAllQueued()),{reachedHWM:s,blocked:r,strategy:n.storeOptions.strategy}}))()}__free__(e,t){var n=this;return _asyncToGenerator$2((function*(){return yield n.yieldLoop(),n._running-=t,n._done+=t,n.instance._drainAll(n.computeCapacity()),{running:n._running}}))()}};var LocalDatastore_1=LocalDatastore,Scripts={},require$$0={"blacklist_client.lua":"local blacklist = ARGV[num_static_argv + 1]\n\nif redis.call('zscore', client_last_seen_key, blacklist) then\n redis.call('zadd', client_last_seen_key, 0, blacklist)\nend\n\n\nreturn {}\n","check.lua":"local weight = tonumber(ARGV[num_static_argv + 1])\n\nlocal capacity = process_tick(now, false)['capacity']\nlocal nextRequest = tonumber(redis.call('hget', settings_key, 'nextRequest'))\n\nreturn conditions_check(capacity, weight) and nextRequest - now <= 0\n","conditions_check.lua":"local conditions_check = function (capacity, weight)\n return capacity == nil or weight <= capacity\nend\n","current_reservoir.lua":"return process_tick(now, false)['reservoir']\n","done.lua":"process_tick(now, false)\n\nreturn tonumber(redis.call('hget', settings_key, 'done'))\n","free.lua":"local index = ARGV[num_static_argv + 1]\n\nredis.call('zadd', job_expirations_key, 0, index)\n\nreturn process_tick(now, false)['running']\n","get_time.lua":"redis.replicate_commands()\n\nlocal get_time = function ()\n local time = redis.call('time')\n\n return tonumber(time[1]..string.sub(time[2], 1, 3))\nend\n","group_check.lua":"return not (redis.call('exists', settings_key) == 1)\n","heartbeat.lua":"process_tick(now, true)\n","increment_reservoir.lua":"local incr = tonumber(ARGV[num_static_argv + 1])\n\nredis.call('hincrby', settings_key, 'reservoir', incr)\n\nlocal reservoir = process_tick(now, true)['reservoir']\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn reservoir\n","init.lua":"local clear = tonumber(ARGV[num_static_argv + 1])\nlocal limiter_version = ARGV[num_static_argv + 2]\nlocal num_local_argv = num_static_argv + 2\n\nif clear == 1 then\n redis.call('del', unpack(KEYS))\nend\n\nif redis.call('exists', settings_key) == 0 then\n -- Create\n local args = {'hmset', settings_key}\n\n for i = num_local_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\n end\n\n redis.call(unpack(args))\n redis.call('hmset', settings_key,\n 'nextRequest', now,\n 'lastReservoirRefresh', now,\n 'lastReservoirIncrease', now,\n 'running', 0,\n 'done', 0,\n 'unblockTime', 0,\n 'capacityPriorityCounter', 0\n )\n\nelse\n -- Apply migrations\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'version'\n )\n local id = settings[1]\n local current_version = settings[2]\n\n if current_version ~= limiter_version then\n local version_digits = {}\n for k, v in string.gmatch(current_version, \"([^.]+)\") do\n table.insert(version_digits, tonumber(k))\n end\n\n -- 2.10.0\n if version_digits[2] < 10 then\n redis.call('hsetnx', settings_key, 'reservoirRefreshInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirRefreshAmount', '')\n redis.call('hsetnx', settings_key, 'lastReservoirRefresh', '')\n redis.call('hsetnx', settings_key, 'done', 0)\n redis.call('hset', settings_key, 'version', '2.10.0')\n end\n\n -- 2.11.1\n if version_digits[2] < 11 or (version_digits[2] == 11 and version_digits[3] < 1) then\n if redis.call('hstrlen', settings_key, 'lastReservoirRefresh') == 0 then\n redis.call('hmset', settings_key,\n 'lastReservoirRefresh', now,\n 'version', '2.11.1'\n )\n end\n end\n\n -- 2.14.0\n if version_digits[2] < 14 then\n local old_running_key = 'b_'..id..'_running'\n local old_executing_key = 'b_'..id..'_executing'\n\n if redis.call('exists', old_running_key) == 1 then\n redis.call('rename', old_running_key, job_weights_key)\n end\n if redis.call('exists', old_executing_key) == 1 then\n redis.call('rename', old_executing_key, job_expirations_key)\n end\n redis.call('hset', settings_key, 'version', '2.14.0')\n end\n\n -- 2.15.2\n if version_digits[2] < 15 or (version_digits[2] == 15 and version_digits[3] < 2) then\n redis.call('hsetnx', settings_key, 'capacityPriorityCounter', 0)\n redis.call('hset', settings_key, 'version', '2.15.2')\n end\n\n -- 2.17.0\n if version_digits[2] < 17 then\n redis.call('hsetnx', settings_key, 'clientTimeout', 10000)\n redis.call('hset', settings_key, 'version', '2.17.0')\n end\n\n -- 2.18.0\n if version_digits[2] < 18 then\n redis.call('hsetnx', settings_key, 'reservoirIncreaseInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseAmount', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseMaximum', '')\n redis.call('hsetnx', settings_key, 'lastReservoirIncrease', now)\n redis.call('hset', settings_key, 'version', '2.18.0')\n end\n\n end\n\n process_tick(now, false)\nend\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","process_tick.lua":"local process_tick = function (now, always_publish)\n\n local compute_capacity = function (maxConcurrent, running, reservoir)\n if maxConcurrent ~= nil and reservoir ~= nil then\n return math.min((maxConcurrent - running), reservoir)\n elseif maxConcurrent ~= nil then\n return maxConcurrent - running\n elseif reservoir ~= nil then\n return reservoir\n else\n return nil\n end\n end\n\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'running',\n 'reservoir',\n 'reservoirRefreshInterval',\n 'reservoirRefreshAmount',\n 'lastReservoirRefresh',\n 'reservoirIncreaseInterval',\n 'reservoirIncreaseAmount',\n 'reservoirIncreaseMaximum',\n 'lastReservoirIncrease',\n 'capacityPriorityCounter',\n 'clientTimeout'\n )\n local id = settings[1]\n local maxConcurrent = tonumber(settings[2])\n local running = tonumber(settings[3])\n local reservoir = tonumber(settings[4])\n local reservoirRefreshInterval = tonumber(settings[5])\n local reservoirRefreshAmount = tonumber(settings[6])\n local lastReservoirRefresh = tonumber(settings[7])\n local reservoirIncreaseInterval = tonumber(settings[8])\n local reservoirIncreaseAmount = tonumber(settings[9])\n local reservoirIncreaseMaximum = tonumber(settings[10])\n local lastReservoirIncrease = tonumber(settings[11])\n local capacityPriorityCounter = tonumber(settings[12])\n local clientTimeout = tonumber(settings[13])\n\n local initial_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n --\n -- Process 'running' changes\n --\n local expired = redis.call('zrangebyscore', job_expirations_key, '-inf', '('..now)\n\n if #expired > 0 then\n redis.call('zremrangebyscore', job_expirations_key, '-inf', '('..now)\n\n local flush_batch = function (batch, acc)\n local weights = redis.call('hmget', job_weights_key, unpack(batch))\n redis.call('hdel', job_weights_key, unpack(batch))\n local clients = redis.call('hmget', job_clients_key, unpack(batch))\n redis.call('hdel', job_clients_key, unpack(batch))\n\n -- Calculate sum of removed weights\n for i = 1, #weights do\n acc['total'] = acc['total'] + (tonumber(weights[i]) or 0)\n end\n\n -- Calculate sum of removed weights by client\n local client_weights = {}\n for i = 1, #clients do\n local removed = tonumber(weights[i]) or 0\n if removed > 0 then\n acc['client_weights'][clients[i]] = (acc['client_weights'][clients[i]] or 0) + removed\n end\n end\n end\n\n local acc = {\n ['total'] = 0,\n ['client_weights'] = {}\n }\n local batch_size = 1000\n\n -- Compute changes to Zsets and apply changes to Hashes\n for i = 1, #expired, batch_size do\n local batch = {}\n for j = i, math.min(i + batch_size - 1, #expired) do\n table.insert(batch, expired[j])\n end\n\n flush_batch(batch, acc)\n end\n\n -- Apply changes to Zsets\n if acc['total'] > 0 then\n redis.call('hincrby', settings_key, 'done', acc['total'])\n running = tonumber(redis.call('hincrby', settings_key, 'running', -acc['total']))\n end\n\n for client, weight in pairs(acc['client_weights']) do\n redis.call('zincrby', client_running_key, -weight, client)\n end\n end\n\n --\n -- Process 'reservoir' changes\n --\n local reservoirRefreshActive = reservoirRefreshInterval ~= nil and reservoirRefreshAmount ~= nil\n if reservoirRefreshActive and now >= lastReservoirRefresh + reservoirRefreshInterval then\n reservoir = reservoirRefreshAmount\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirRefresh', now\n )\n end\n\n local reservoirIncreaseActive = reservoirIncreaseInterval ~= nil and reservoirIncreaseAmount ~= nil\n if reservoirIncreaseActive and now >= lastReservoirIncrease + reservoirIncreaseInterval then\n local num_intervals = math.floor((now - lastReservoirIncrease) / reservoirIncreaseInterval)\n local incr = reservoirIncreaseAmount * num_intervals\n if reservoirIncreaseMaximum ~= nil then\n incr = math.min(incr, reservoirIncreaseMaximum - (reservoir or 0))\n end\n if incr > 0 then\n reservoir = (reservoir or 0) + incr\n end\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirIncrease', lastReservoirIncrease + (num_intervals * reservoirIncreaseInterval)\n )\n end\n\n --\n -- Clear unresponsive clients\n --\n local unresponsive = redis.call('zrangebyscore', client_last_seen_key, '-inf', (now - clientTimeout))\n local unresponsive_lookup = {}\n local terminated_clients = {}\n for i = 1, #unresponsive do\n unresponsive_lookup[unresponsive[i]] = true\n if tonumber(redis.call('zscore', client_running_key, unresponsive[i])) == 0 then\n table.insert(terminated_clients, unresponsive[i])\n end\n end\n if #terminated_clients > 0 then\n redis.call('zrem', client_running_key, unpack(terminated_clients))\n redis.call('hdel', client_num_queued_key, unpack(terminated_clients))\n redis.call('zrem', client_last_registered_key, unpack(terminated_clients))\n redis.call('zrem', client_last_seen_key, unpack(terminated_clients))\n end\n\n --\n -- Broadcast capacity changes\n --\n local final_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n if always_publish or (initial_capacity ~= nil and final_capacity == nil) then\n -- always_publish or was not unlimited, now unlimited\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n\n elseif initial_capacity ~= nil and final_capacity ~= nil and final_capacity > initial_capacity then\n -- capacity was increased\n -- send the capacity message to the limiter having the lowest number of running jobs\n -- the tiebreaker is the limiter having not registered a job in the longest time\n\n local lowest_concurrency_value = nil\n local lowest_concurrency_clients = {}\n local lowest_concurrency_last_registered = {}\n local client_concurrencies = redis.call('zrange', client_running_key, 0, -1, 'withscores')\n\n for i = 1, #client_concurrencies, 2 do\n local client = client_concurrencies[i]\n local concurrency = tonumber(client_concurrencies[i+1])\n\n if (\n lowest_concurrency_value == nil or lowest_concurrency_value == concurrency\n ) and (\n not unresponsive_lookup[client]\n ) and (\n tonumber(redis.call('hget', client_num_queued_key, client)) > 0\n ) then\n lowest_concurrency_value = concurrency\n table.insert(lowest_concurrency_clients, client)\n local last_registered = tonumber(redis.call('zscore', client_last_registered_key, client))\n table.insert(lowest_concurrency_last_registered, last_registered)\n end\n end\n\n if #lowest_concurrency_clients > 0 then\n local position = 1\n local earliest = lowest_concurrency_last_registered[1]\n\n for i,v in ipairs(lowest_concurrency_last_registered) do\n if v < earliest then\n position = i\n earliest = v\n end\n end\n\n local next_client = lowest_concurrency_clients[position]\n redis.call('publish', 'b_'..id,\n 'capacity-priority:'..(final_capacity or '')..\n ':'..next_client..\n ':'..capacityPriorityCounter\n )\n redis.call('hincrby', settings_key, 'capacityPriorityCounter', '1')\n else\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n end\n end\n\n return {\n ['capacity'] = final_capacity,\n ['running'] = running,\n ['reservoir'] = reservoir\n }\nend\n","queued.lua":"local clientTimeout = tonumber(redis.call('hget', settings_key, 'clientTimeout'))\nlocal valid_clients = redis.call('zrangebyscore', client_last_seen_key, (now - clientTimeout), 'inf')\nlocal client_queued = redis.call('hmget', client_num_queued_key, unpack(valid_clients))\n\nlocal sum = 0\nfor i = 1, #client_queued do\n sum = sum + tonumber(client_queued[i])\nend\n\nreturn sum\n","refresh_expiration.lua":"local refresh_expiration = function (now, nextRequest, groupTimeout)\n\n if groupTimeout ~= nil then\n local ttl = (nextRequest + groupTimeout) - now\n\n for i = 1, #KEYS do\n redis.call('pexpire', KEYS[i], ttl)\n end\n end\n\nend\n","refs.lua":"local settings_key = KEYS[1]\nlocal job_weights_key = KEYS[2]\nlocal job_expirations_key = KEYS[3]\nlocal job_clients_key = KEYS[4]\nlocal client_running_key = KEYS[5]\nlocal client_num_queued_key = KEYS[6]\nlocal client_last_registered_key = KEYS[7]\nlocal client_last_seen_key = KEYS[8]\n\nlocal now = tonumber(ARGV[1])\nlocal client = ARGV[2]\n\nlocal num_static_argv = 2\n","register.lua":"local index = ARGV[num_static_argv + 1]\nlocal weight = tonumber(ARGV[num_static_argv + 2])\nlocal expiration = tonumber(ARGV[num_static_argv + 3])\n\nlocal state = process_tick(now, false)\nlocal capacity = state['capacity']\nlocal reservoir = state['reservoir']\n\nlocal settings = redis.call('hmget', settings_key,\n 'nextRequest',\n 'minTime',\n 'groupTimeout'\n)\nlocal nextRequest = tonumber(settings[1])\nlocal minTime = tonumber(settings[2])\nlocal groupTimeout = tonumber(settings[3])\n\nif conditions_check(capacity, weight) then\n\n redis.call('hincrby', settings_key, 'running', weight)\n redis.call('hset', job_weights_key, index, weight)\n if expiration ~= nil then\n redis.call('zadd', job_expirations_key, now + expiration, index)\n end\n redis.call('hset', job_clients_key, index, client)\n redis.call('zincrby', client_running_key, weight, client)\n redis.call('hincrby', client_num_queued_key, client, -1)\n redis.call('zadd', client_last_registered_key, now, client)\n\n local wait = math.max(nextRequest - now, 0)\n local newNextRequest = now + wait + minTime\n\n if reservoir == nil then\n redis.call('hset', settings_key,\n 'nextRequest', newNextRequest\n )\n else\n reservoir = reservoir - weight\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'nextRequest', newNextRequest\n )\n end\n\n refresh_expiration(now, newNextRequest, groupTimeout)\n\n return {true, wait, reservoir}\n\nelse\n return {false}\nend\n","register_client.lua":"local queued = tonumber(ARGV[num_static_argv + 1])\n\n-- Could have been re-registered concurrently\nif not redis.call('zscore', client_last_seen_key, client) then\n redis.call('zadd', client_running_key, 0, client)\n redis.call('hset', client_num_queued_key, client, queued)\n redis.call('zadd', client_last_registered_key, 0, client)\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n\nreturn {}\n","running.lua":"return process_tick(now, false)['running']\n","submit.lua":"local queueLength = tonumber(ARGV[num_static_argv + 1])\nlocal weight = tonumber(ARGV[num_static_argv + 2])\n\nlocal capacity = process_tick(now, false)['capacity']\n\nlocal settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'highWater',\n 'nextRequest',\n 'strategy',\n 'unblockTime',\n 'penalty',\n 'minTime',\n 'groupTimeout'\n)\nlocal id = settings[1]\nlocal maxConcurrent = tonumber(settings[2])\nlocal highWater = tonumber(settings[3])\nlocal nextRequest = tonumber(settings[4])\nlocal strategy = tonumber(settings[5])\nlocal unblockTime = tonumber(settings[6])\nlocal penalty = tonumber(settings[7])\nlocal minTime = tonumber(settings[8])\nlocal groupTimeout = tonumber(settings[9])\n\nif maxConcurrent ~= nil and weight > maxConcurrent then\n return redis.error_reply('OVERWEIGHT:'..weight..':'..maxConcurrent)\nend\n\nlocal reachedHWM = (highWater ~= nil and queueLength == highWater\n and not (\n conditions_check(capacity, weight)\n and nextRequest - now <= 0\n )\n)\n\nlocal blocked = strategy == 3 and (reachedHWM or unblockTime >= now)\n\nif blocked then\n local computedPenalty = penalty\n if computedPenalty == nil then\n if minTime == 0 then\n computedPenalty = 5000\n else\n computedPenalty = 15 * minTime\n end\n end\n\n local newNextRequest = now + computedPenalty + minTime\n\n redis.call('hmset', settings_key,\n 'unblockTime', now + computedPenalty,\n 'nextRequest', newNextRequest\n )\n\n local clients_queued_reset = redis.call('hkeys', client_num_queued_key)\n local queued_reset = {}\n for i = 1, #clients_queued_reset do\n table.insert(queued_reset, clients_queued_reset[i])\n table.insert(queued_reset, 0)\n end\n redis.call('hmset', client_num_queued_key, unpack(queued_reset))\n\n redis.call('publish', 'b_'..id, 'blocked:')\n\n refresh_expiration(now, newNextRequest, groupTimeout)\nend\n\nif not blocked and not reachedHWM then\n redis.call('hincrby', client_num_queued_key, client, 1)\nend\n\nreturn {reachedHWM, blocked, strategy}\n","update_settings.lua":"local args = {'hmset', settings_key}\n\nfor i = num_static_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\nend\n\nredis.call(unpack(args))\n\nprocess_tick(now, true)\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","validate_client.lua":"if not redis.call('zscore', client_last_seen_key, client) then\n return redis.error_reply('UNKNOWN_CLIENT')\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n","validate_keys.lua":"if not (redis.call('exists', settings_key) == 1) then\n return redis.error_reply('SETTINGS_KEY_NOT_FOUND')\nend\n"},hasRequiredScripts,RedisConnection_1,hasRequiredRedisConnection,IORedisConnection_1,hasRequiredIORedisConnection,BottleneckError$1,IORedisConnection,RedisConnection,RedisDatastore,parser;function requireScripts(){return hasRequiredScripts||(hasRequiredScripts=1,function(e){var t,n,r;t={refs:(n=require$$0)["refs.lua"],validate_keys:n["validate_keys.lua"],validate_client:n["validate_client.lua"],refresh_expiration:n["refresh_expiration.lua"],process_tick:n["process_tick.lua"],conditions_check:n["conditions_check.lua"],get_time:n["get_time.lua"]},e.allKeys=function(e){return[`b_${e}_settings`,`b_${e}_job_weights`,`b_${e}_job_expirations`,`b_${e}_job_clients`,`b_${e}_client_running`,`b_${e}_client_num_queued`,`b_${e}_client_last_registered`,`b_${e}_client_last_seen`]},r={init:{keys:e.allKeys,headers:["process_tick"],refresh_expiration:!0,code:n["init.lua"]},group_check:{keys:e.allKeys,headers:[],refresh_expiration:!1,code:n["group_check.lua"]},register_client:{keys:e.allKeys,headers:["validate_keys"],refresh_expiration:!1,code:n["register_client.lua"]},blacklist_client:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["blacklist_client.lua"]},heartbeat:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["heartbeat.lua"]},update_settings:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["update_settings.lua"]},running:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["running.lua"]},queued:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["queued.lua"]},done:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["done.lua"]},check:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!1,code:n["check.lua"]},submit:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["submit.lua"]},register:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["register.lua"]},free:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["free.lua"]},current_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["current_reservoir.lua"]},increment_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["increment_reservoir.lua"]}},e.names=Object.keys(r),e.keys=function(e,t){return r[e].keys(t)},e.payload=function(e){var n;return n=r[e],Array.prototype.concat(t.refs,n.headers.map((function(e){return t[e]})),n.refresh_expiration?t.refresh_expiration:"",n.code).join("\n")}}(Scripts)),Scripts}function requireRedisConnection(){if(hasRequiredRedisConnection)return RedisConnection_1;function asyncGeneratorStep(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep(s,r,i,o,a,"throw",e)}o(void 0)}))}}var Events,RedisConnection,Scripts,parser;return hasRequiredRedisConnection=1,parser=parser$3,Events=Events_1,Scripts=requireScripts(),RedisConnection=function(){class RedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("redis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null==this.client&&(this.client=this.Redis.createClient(this.clientOptions)),this.subscriber=this.client.duplicate(),this.limiters={},this.shas={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then((()=>this._loadScripts())).then((()=>({client:this.client,subscriber:this.subscriber})))}_setup(e,t){return e.setMaxListeners(0),new this.Promise(((n,r)=>(e.on("error",(e=>this.Events.trigger("error",e))),t&&e.on("message",((e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0})),e.ready?n():e.once("ready",n))))}_loadScript(e){return new this.Promise(((t,n)=>{var r;return r=Scripts.payload(e),this.client.multi([["script","load",r]]).exec(((r,i)=>null!=r?n(r):(this.shas[e]=i[0],t(i[0]))))}))}_loadScripts(){return this.Promise.all(Scripts.names.map((e=>this._loadScript(e))))}__runCommand__(e){var t=this;return _asyncToGenerator((function*(){return yield t.ready,new t.Promise(((n,r)=>t.client.multi([e]).exec_atomic((function(e,t){return null!=e?r(e):n(t[0])}))))}))()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map((t=>new this.Promise(((n,r)=>{var i;return i=r=>{if(r===t)return this.subscriber.removeListener("subscribe",i),this.limiters[t]=e,n()},this.subscriber.on("subscribe",i),this.subscriber.subscribe(t)})))))}__removeLimiter__(e){var t=this;return this.Promise.all([e.channel(),e.channel_client()].map(function(){var e=_asyncToGenerator((function*(e){return t.terminated||(yield new t.Promise(((n,r)=>t.subscriber.unsubscribe(e,(function(t,i){return null!=t?r(t):i===e?n():void 0}))))),delete t.limiters[e]}));return function(t){return e.apply(this,arguments)}}()))}__scriptArgs__(e,t,n,r){var i;return i=Scripts.keys(e,t),[this.shas[e],i.length].concat(i,n,r)}__scriptFn__(e){return this.client.evalsha.bind(this.client)}disconnect(e=!0){var t,n,r,i;for(t=0,r=(i=Object.keys(this.limiters)).length;t<r;t++)n=i[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,this.client.end(e),this.subscriber.end(e),this.Promise.resolve()}}return RedisConnection.prototype.datastore="redis",RedisConnection.prototype.defaults={Redis:null,clientOptions:{},client:null,Promise:Promise,Events:null},RedisConnection}.call(void 0),RedisConnection_1=RedisConnection,RedisConnection_1}function requireIORedisConnection(){if(hasRequiredIORedisConnection)return IORedisConnection_1;function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep(s,r,i,o,a,"throw",e)}o(void 0)}))}}var Events,IORedisConnection,Scripts,parser;return hasRequiredIORedisConnection=1,parser=parser$3,Events=Events_1,Scripts=requireScripts(),IORedisConnection=function(){class IORedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("ioredis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null!=this.clusterNodes?(this.client=new this.Redis.Cluster(this.clusterNodes,this.clientOptions),this.subscriber=new this.Redis.Cluster(this.clusterNodes,this.clientOptions)):null!=this.client&&null==this.client.duplicate?this.subscriber=new this.Redis.Cluster(this.client.startupNodes,this.client.options):(null==this.client&&(this.client=new this.Redis(this.clientOptions)),this.subscriber=this.client.duplicate()),this.limiters={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then((()=>(this._loadScripts(),{client:this.client,subscriber:this.subscriber})))}_setup(e,t){return e.setMaxListeners(0),new this.Promise(((n,r)=>(e.on("error",(e=>this.Events.trigger("error",e))),t&&e.on("message",((e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0})),"ready"===e.status?n():e.once("ready",n))))}_loadScripts(){return Scripts.names.forEach((e=>this.client.defineCommand(e,{lua:Scripts.payload(e)})))}__runCommand__(e){var t=this;return _asyncToGenerator((function*(){yield t.ready;var n=_slicedToArray(yield t.client.pipeline([e]).exec(),1),r=_slicedToArray(n[0],2);return r[0],r[1]}))()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map((t=>new this.Promise(((n,r)=>this.subscriber.subscribe(t,(()=>(this.limiters[t]=e,n()))))))))}__removeLimiter__(e){var t=this;return[e.channel(),e.channel_client()].forEach(function(){var e=_asyncToGenerator((function*(e){return t.terminated||(yield t.subscriber.unsubscribe(e)),delete t.limiters[e]}));return function(t){return e.apply(this,arguments)}}())}__scriptArgs__(e,t,n,r){var i;return[(i=Scripts.keys(e,t)).length].concat(i,n,r)}__scriptFn__(e){return this.client[e].bind(this.client)}disconnect(e=!0){var t,n,r,i;for(t=0,r=(i=Object.keys(this.limiters)).length;t<r;t++)n=i[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,e?this.Promise.all([this.client.quit(),this.subscriber.quit()]):(this.client.disconnect(),this.subscriber.disconnect(),this.Promise.resolve())}}return IORedisConnection.prototype.datastore="ioredis",IORedisConnection.prototype.defaults={Redis:null,clientOptions:{},clusterNodes:null,client:null,Promise:Promise,Events:null},IORedisConnection}.call(void 0),IORedisConnection_1=IORedisConnection,IORedisConnection_1}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep$1(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$1(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep$1(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep$1(s,r,i,o,a,"throw",e)}o(void 0)}))}}parser=parser$3,BottleneckError$1=requireBottleneckError(),RedisConnection=requireRedisConnection(),IORedisConnection=requireIORedisConnection(),RedisDatastore=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.originalId=this.instance.id,this.clientId=this.instance._randomIndex(),parser.load(n,n,this),this.clients={},this.capacityPriorityCounters={},this.sharedConnection=null!=this.connection,null==this.connection&&(this.connection="redis"===this.instance.datastore?new RedisConnection({Redis:this.Redis,clientOptions:this.clientOptions,Promise:this.Promise,Events:this.instance.Events}):"ioredis"===this.instance.datastore?new IORedisConnection({Redis:this.Redis,clientOptions:this.clientOptions,clusterNodes:this.clusterNodes,Promise:this.Promise,Events:this.instance.Events}):void 0),this.instance.connection=this.connection,this.instance.datastore=this.connection.datastore,this.ready=this.connection.ready.then((e=>(this.clients=e,this.runScript("init",this.prepareInitSettings(this.clearDatastore))))).then((()=>this.connection.__addLimiter__(this.instance))).then((()=>this.runScript("register_client",[this.instance.queued()]))).then((()=>{var e;return"function"==typeof(e=this.heartbeat=setInterval((()=>this.runScript("heartbeat",[]).catch((e=>this.instance.Events.trigger("error",e)))),this.heartbeatInterval)).unref&&e.unref(),this.clients}))}__publish__(e){var t=this;return _asyncToGenerator$1((function*(){return(yield t.ready).client.publish(t.instance.channel(),`message:${e.toString()}`)}))()}onMessage(e,t){var n=this;return _asyncToGenerator$1((function*(){var e,r,i,s,o,a,c,u,d,l;try{c=t.indexOf(":");var p=[t.slice(0,c),t.slice(c+1)];if(i=p[1],"capacity"===(l=p[0]))return yield n.instance._drainAll(i.length>0?~~i:void 0);if("capacity-priority"===l){var m=_slicedToArray(i.split(":"),3);return d=m[0],u=m[1],r=m[2],e=d.length>0?~~d:void 0,u===n.clientId?(s=yield n.instance._drainAll(e),a=null!=e?e-(s||0):"",yield n.clients.client.publish(n.instance.channel(),`capacity-priority:${a}::${r}`)):""===u?(clearTimeout(n.capacityPriorityCounters[r]),delete n.capacityPriorityCounters[r],n.instance._drainAll(e)):n.capacityPriorityCounters[r]=setTimeout(_asyncToGenerator$1((function*(){var t;try{return delete n.capacityPriorityCounters[r],yield n.runScript("blacklist_client",[u]),yield n.instance._drainAll(e)}catch(e){return t=e,n.instance.Events.trigger("error",t)}})),1e3)}if("message"===l)return n.instance.Events.trigger("message",i);if("blocked"===l)return yield n.instance._dropAllQueued()}catch(e){return o=e,n.instance.Events.trigger("error",o)}}))()}__disconnect__(e){return clearInterval(this.heartbeat),this.sharedConnection?this.connection.__removeLimiter__(this.instance):this.connection.disconnect(e)}runScript(e,t){var n=this;return _asyncToGenerator$1((function*(){return"init"!==e&&"register_client"!==e&&(yield n.ready),new n.Promise(((r,i)=>{var s,o;return s=[Date.now(),n.clientId].concat(t),n.instance.Events.trigger("debug",`Calling Redis script: ${e}.lua`,s),o=n.connection.__scriptArgs__(e,n.originalId,s,(function(e,t){return null!=e?i(e):r(t)})),n.connection.__scriptFn__(e)(...o)})).catch((r=>"SETTINGS_KEY_NOT_FOUND"===r.message?"heartbeat"===e?n.Promise.resolve():n.runScript("init",n.prepareInitSettings(!1)).then((()=>n.runScript(e,t))):"UNKNOWN_CLIENT"===r.message?n.runScript("register_client",[n.instance.queued()]).then((()=>n.runScript(e,t))):n.Promise.reject(r)))}))()}prepareArray(e){var t,n,r,i;for(r=[],t=0,n=e.length;t<n;t++)i=e[t],r.push(null!=i?i.toString():"");return r}prepareObject(e){var t,n,r;for(n in t=[],e)r=e[n],t.push(n,null!=r?r.toString():"");return t}prepareInitSettings(e){var t;return(t=this.prepareObject(Object.assign({},this.storeOptions,{id:this.originalId,version:this.instance.version,groupTimeout:this.timeout,clientTimeout:this.clientTimeout}))).unshift(e?1:0,this.instance.version),t}convertBool(e){return!!e}__updateSettings__(e){var t=this;return _asyncToGenerator$1((function*(){return yield t.runScript("update_settings",t.prepareObject(e)),parser.overwrite(e,e,t.storeOptions)}))()}__running__(){return this.runScript("running",[])}__queued__(){return this.runScript("queued",[])}__done__(){return this.runScript("done",[])}__groupCheck__(){var e=this;return _asyncToGenerator$1((function*(){return e.convertBool(yield e.runScript("group_check",[]))}))()}__incrementReservoir__(e){return this.runScript("increment_reservoir",[e])}__currentReservoir__(){return this.runScript("current_reservoir",[])}__check__(e){var t=this;return _asyncToGenerator$1((function*(){return t.convertBool(yield t.runScript("check",t.prepareArray([e])))}))()}__register__(e,t,n){var r=this;return _asyncToGenerator$1((function*(){var i,s,o,a=_slicedToArray(yield r.runScript("register",r.prepareArray([e,t,n])),3);return s=a[0],o=a[1],i=a[2],{success:r.convertBool(s),wait:o,reservoir:i}}))()}__submit__(e,t){var n=this;return _asyncToGenerator$1((function*(){var r,i,s,o,a;try{var c=_slicedToArray(yield n.runScript("submit",n.prepareArray([e,t])),3);return o=c[0],r=c[1],a=c[2],{reachedHWM:n.convertBool(o),blocked:n.convertBool(r),strategy:a}}catch(e){if(0===(i=e).message.indexOf("OVERWEIGHT")){var u=_slicedToArray(i.message.split(":"),3);throw u[0],t=u[1],s=u[2],new BottleneckError$1(`Impossible to add a job having a weight of ${t} to a limiter having a maxConcurrent setting of ${s}`)}throw i}}))()}__free__(e,t){var n=this;return _asyncToGenerator$1((function*(){return{running:yield n.runScript("free",n.prepareArray([e]))}}))()}};var RedisDatastore_1=RedisDatastore,BottleneckError,States;BottleneckError=requireBottleneckError(),States=class{constructor(e){this.status=e,this._jobs={},this.counts=this.status.map((function(){return 0}))}next(e){var t,n;return n=(t=this._jobs[e])+1,null!=t&&n<this.status.length?(this.counts[t]--,this.counts[n]++,this._jobs[e]++):null!=t?(this.counts[t]--,delete this._jobs[e]):void 0}start(e){return this._jobs[e]=0,this.counts[0]++}remove(e){var t;return null!=(t=this._jobs[e])&&(this.counts[t]--,delete this._jobs[e]),null!=t}jobStatus(e){var t;return null!=(t=this.status[this._jobs[e]])?t:null}statusJobs(e){var t,n,r,i;if(null!=e){if((n=this.status.indexOf(e))<0)throw new BottleneckError(`status must be one of ${this.status.join(", ")}`);for(t in i=[],r=this._jobs)r[t]===n&&i.push(t);return i}return Object.keys(this._jobs)}statusCounts(){return this.counts.reduce(((e,t,n)=>(e[this.status[n]]=t,e)),{})}};var States_1=States,DLList,Sync;function asyncGeneratorStep(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep(s,r,i,o,a,"throw",e)}o(void 0)}))}}DLList=DLList_1,Sync=class{constructor(e,t){this.schedule=this.schedule.bind(this),this.name=e,this.Promise=t,this._running=0,this._queue=new DLList}isEmpty(){return 0===this._queue.length}_tryToRun(){var e=this;return _asyncToGenerator((function*(){var t,n,r,i,s,o,a;if(e._running<1&&e._queue.length>0){e._running++;var c=e._queue.shift();return a=c.task,t=c.args,s=c.resolve,i=c.reject,n=yield _asyncToGenerator((function*(){try{return o=yield a(...t),function(){return s(o)}}catch(e){return r=e,function(){return i(r)}}}))(),e._running--,e._tryToRun(),n()}}))()}schedule(e,...t){var n,r,i;return i=r=null,n=new this.Promise((function(e,t){return i=e,r=t})),this._queue.push({task:e,args:t,resolve:i,reject:r}),this._tryToRun(),n}};var Sync_1=Sync;const version="2.19.5";var require$$8={version:version},Group_1,hasRequiredGroup,Batcher_1,hasRequiredBatcher,Bottleneck_1,hasRequiredBottleneck;function requireGroup(){if(hasRequiredGroup)return Group_1;function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function t(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(i,s){var o=e.apply(n,r);function a(e){t(o,i,s,a,c,"next",e)}function c(e){t(o,i,s,a,c,"throw",e)}a(void 0)}))}}var r,i,s,o,a,c;return hasRequiredGroup=1,c=parser$3,r=Events_1,o=requireRedisConnection(),s=requireIORedisConnection(),a=requireScripts(),i=function(){class t{constructor(e={}){this.deleteKey=this.deleteKey.bind(this),this.limiterOptions=e,c.load(this.limiterOptions,this.defaults,this),this.Events=new r(this),this.instances={},this.Bottleneck=requireBottleneck(),this._startAutoCleanup(),this.sharedConnection=null!=this.connection,null==this.connection&&("redis"===this.limiterOptions.datastore?this.connection=new o(Object.assign({},this.limiterOptions,{Events:this.Events})):"ioredis"===this.limiterOptions.datastore&&(this.connection=new s(Object.assign({},this.limiterOptions,{Events:this.Events}))))}key(e=""){var t;return null!=(t=this.instances[e])?t:(()=>{var t;return t=this.instances[e]=new this.Bottleneck(Object.assign(this.limiterOptions,{id:`${this.id}-${e}`,timeout:this.timeout,connection:this.connection})),this.Events.trigger("created",t,e),t})()}deleteKey(e=""){var t=this;return n((function*(){var n,r;return r=t.instances[e],t.connection&&(n=yield t.connection.__runCommand__(["del",...a.allKeys(`${t.id}-${e}`)])),null!=r&&(delete t.instances[e],yield r.disconnect()),null!=r||n>0}))()}limiters(){var e,t,n,r;for(e in n=[],t=this.instances)r=t[e],n.push({key:e,limiter:r});return n}keys(){return Object.keys(this.instances)}clusterKeys(){var t=this;return n((function*(){var n,r,i,s,o,a,c;if(null==t.connection)return t.Promise.resolve(t.keys());for(o=[],n=null,c=`b_${t.id}-`.length,9;0!==n;){var u=e(yield t.connection.__runCommand__(["scan",null!=n?n:0,"match",`b_${t.id}-*_settings`,"count",1e4]),2);for(n=~~u[0],i=0,a=(r=u[1]).length;i<a;i++)s=r[i],o.push(s.slice(c,-9))}return o}))()}_startAutoCleanup(){var e,t=this;return clearInterval(this.interval),"function"==typeof(e=this.interval=setInterval(n((function*(){var e,n,r,i,s,o;for(n in s=Date.now(),i=[],r=t.instances){o=r[n];try{(yield o._store.__groupCheck__(s))?i.push(t.deleteKey(n)):i.push(void 0)}catch(t){e=t,i.push(o.Events.trigger("error",e))}}return i})),this.timeout/2)).unref?e.unref():void 0}updateSettings(e={}){if(c.overwrite(e,this.defaults,this),c.overwrite(e,e,this.limiterOptions),null!=e.timeout)return this._startAutoCleanup()}disconnect(e=!0){var t;if(!this.sharedConnection)return null!=(t=this.connection)?t.disconnect(e):void 0}}return t.prototype.defaults={timeout:3e5,connection:null,Promise:Promise,id:"group-key"},t}.call(void 0),Group_1=i}function requireBatcher(){return hasRequiredBatcher?Batcher_1:(hasRequiredBatcher=1,n=parser$3,t=Events_1,e=function(){class e{constructor(e={}){this.options=e,n.load(this.options,this.defaults,this),this.Events=new t(this),this._arr=[],this._resetPromise(),this._lastFlush=Date.now()}_resetPromise(){return this._promise=new this.Promise(((e,t)=>this._resolve=e))}_flush(){return clearTimeout(this._timeout),this._lastFlush=Date.now(),this._resolve(),this.Events.trigger("batch",this._arr),this._arr=[],this._resetPromise()}add(e){var t;return this._arr.push(e),t=this._promise,this._arr.length===this.maxSize?this._flush():null!=this.maxTime&&1===this._arr.length&&(this._timeout=setTimeout((()=>this._flush()),this.maxTime)),t}}return e.prototype.defaults={maxTime:null,maxSize:null,Promise:Promise},e}.call(void 0),Batcher_1=e);var e,t,n}function requireBottleneck(){if(hasRequiredBottleneck)return Bottleneck_1;function e(e,t){return r(e)||function(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}(e,t)||n()}function t(e){return r(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function r(e){if(Array.isArray(e))return e}function i(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,s){var o=e.apply(t,n);function a(e){i(o,r,s,a,c,"next",e)}function c(e){i(o,r,s,a,c,"throw",e)}a(void 0)}))}}hasRequiredBottleneck=1;var o,a,c,u,d,l,p,m,h,f=[].splice;return h=parser$3,d=Queues_1,c=Job_1,u=LocalDatastore_1,l=RedisDatastore_1,a=Events_1,p=States_1,m=Sync_1,o=function(){class n{constructor(e={},...t){var r,i;this._addToQueue=this._addToQueue.bind(this),this._validateOptions(e,t),h.load(e,this.instanceDefaults,this),this._queues=new d(10),this._scheduled={},this._states=new p(["RECEIVED","QUEUED","RUNNING","EXECUTING"].concat(this.trackDoneStatus?["DONE"]:[])),this._limiter=null,this.Events=new a(this),this._submitLock=new m("submit",this.Promise),this._registerLock=new m("register",this.Promise),i=h.load(e,this.storeDefaults,{}),this._store=function(){if("redis"===this.datastore||"ioredis"===this.datastore||null!=this.connection)return r=h.load(e,this.redisStoreDefaults,{}),new l(this,i,r);if("local"===this.datastore)return r=h.load(e,this.localStoreDefaults,{}),new u(this,i,r);throw new n.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`)}.call(this),this._queues.on("leftzero",(()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.ref?e.ref():void 0})),this._queues.on("zero",(()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.unref?e.unref():void 0}))}_validateOptions(e,t){if(null==e||"object"!=typeof e||0!==t.length)throw new n.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1.")}ready(){return this._store.ready}clients(){return this._store.clients}channel(){return`b_${this.id}`}channel_client(){return`b_${this.id}_${this._store.clientId}`}publish(e){return this._store.__publish__(e)}disconnect(e=!0){return this._store.__disconnect__(e)}chain(e){return this._limiter=e,this}queued(e){return this._queues.queued(e)}clusterQueued(){return this._store.__queued__()}empty(){return 0===this.queued()&&this._submitLock.isEmpty()}running(){return this._store.__running__()}done(){return this._store.__done__()}jobStatus(e){return this._states.jobStatus(e)}jobs(e){return this._states.statusJobs(e)}counts(){return this._states.statusCounts()}_randomIndex(){return Math.random().toString(36).slice(2)}check(e=1){return this._store.__check__(e)}_clearGlobalState(e){return null!=this._scheduled[e]&&(clearTimeout(this._scheduled[e].expiration),delete this._scheduled[e],!0)}_free(e,t,n,r){var i=this;return s((function*(){var t,s;try{if(s=(yield i._store.__free__(e,n.weight)).running,i.Events.trigger("debug",`Freed ${n.id}`,r),0===s&&i.empty())return i.Events.trigger("idle")}catch(e){return t=e,i.Events.trigger("error",t)}}))()}_run(e,t,n){var r,i,s;return t.doRun(),r=this._clearGlobalState.bind(this,e),s=this._run.bind(this,e,t),i=this._free.bind(this,e,t),this._scheduled[e]={timeout:setTimeout((()=>t.doExecute(this._limiter,r,s,i)),n),expiration:null!=t.options.expiration?setTimeout((function(){return t.doExpire(r,s,i)}),n+t.options.expiration):void 0,job:t}}_drainOne(e){return this._registerLock.schedule((()=>{var t,n,r,i,s;if(0===this.queued())return this.Promise.resolve(null);s=this._queues.getFirst();var o=r=s.first();return i=o.options,t=o.args,null!=e&&i.weight>e?this.Promise.resolve(null):(this.Events.trigger("debug",`Draining ${i.id}`,{args:t,options:i}),n=this._randomIndex(),this._store.__register__(n,i.weight,i.expiration).then((({success:e,wait:o,reservoir:a})=>{var c;return this.Events.trigger("debug",`Drained ${i.id}`,{success:e,args:t,options:i}),e?(s.shift(),(c=this.empty())&&this.Events.trigger("empty"),0===a&&this.Events.trigger("depleted",c),this._run(n,r,o),this.Promise.resolve(i.weight)):this.Promise.resolve(null)})))}))}_drainAll(e,t=0){return this._drainOne(e).then((n=>{var r;return null!=n?(r=null!=e?e-n:e,this._drainAll(r,t+n)):this.Promise.resolve(t)})).catch((e=>this.Events.trigger("error",e)))}_dropAllQueued(e){return this._queues.shiftAll((function(t){return t.doDrop({message:e})}))}stop(e={}){var t,r;return e=h.load(e,this.stopDefaults),r=e=>{var t;return t=()=>{var t;return(t=this._states.counts)[0]+t[1]+t[2]+t[3]===e},new this.Promise(((e,n)=>t()?e():this.on("done",(()=>{if(t())return this.removeAllListeners("done"),e()}))))},t=e.dropWaitingJobs?(this._run=function(t,n){return n.doDrop({message:e.dropErrorMessage})},this._drainOne=()=>this.Promise.resolve(null),this._registerLock.schedule((()=>this._submitLock.schedule((()=>{var t,n,i;for(t in n=this._scheduled)i=n[t],"RUNNING"===this.jobStatus(i.job.options.id)&&(clearTimeout(i.timeout),clearTimeout(i.expiration),i.job.doDrop({message:e.dropErrorMessage}));return this._dropAllQueued(e.dropErrorMessage),r(0)}))))):this.schedule({priority:9,weight:0},(()=>r(1))),this._receive=function(t){return t._reject(new n.prototype.BottleneckError(e.enqueueErrorMessage))},this.stop=()=>this.Promise.reject(new n.prototype.BottleneckError("stop() has already been called")),t}_addToQueue(e){var t=this;return s((function*(){var r,i,s,o,a,c,u;r=e.args,o=e.options;try{var d=yield t._store.__submit__(t.queued(),o.weight);a=d.reachedHWM,i=d.blocked,u=d.strategy}catch(n){return s=n,t.Events.trigger("debug",`Could not queue ${o.id}`,{args:r,options:o,error:s}),e.doDrop({error:s}),!1}return i?(e.doDrop(),!0):a&&(null!=(c=u===n.prototype.strategy.LEAK?t._queues.shiftLastFrom(o.priority):u===n.prototype.strategy.OVERFLOW_PRIORITY?t._queues.shiftLastFrom(o.priority+1):u===n.prototype.strategy.OVERFLOW?e:void 0)&&c.doDrop(),null==c||u===n.prototype.strategy.OVERFLOW)?(null==c&&e.doDrop(),a):(e.doQueue(a,i),t._queues.push(e),yield t._drainAll(),a)}))()}_receive(e){return null!=this._states.jobStatus(e.options.id)?(e._reject(new n.prototype.BottleneckError(`A job with the same id already exists (id=${e.options.id})`)),!1):(e.doReceive(),this._submitLock.schedule(this._addToQueue,e))}submit(...n){var r,i,s,o,a,u,d,l,p;"function"==typeof n[0]?(u=t(n),i=u[0],n=u.slice(1),d=e(f.call(n,-1),1),r=d[0],o=h.load({},this.jobDefaults)):(o=(l=t(n))[0],i=l[1],n=l.slice(2),p=e(f.call(n,-1),1),r=p[0],o=h.load(o,this.jobDefaults));return a=(...e)=>new this.Promise((function(t,n){return i(...e,(function(...e){return(null!=e[0]?n:t)(e)}))})),(s=new c(a,n,o,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise)).promise.then((function(e){return"function"==typeof r?r(...e):void 0})).catch((function(e){return Array.isArray(e)?"function"==typeof r?r(...e):void 0:"function"==typeof r?r(e):void 0})),this._receive(s)}schedule(...e){var n,r,i;if("function"==typeof e[0]){var s=t(e);i=s[0],e=s.slice(1),r={}}else{var o=t(e);r=o[0],i=o[1],e=o.slice(2)}return n=new c(i,e,r,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise),this._receive(n),n.promise}wrap(e){var t,n;return t=this.schedule.bind(this),(n=function(...n){return t(e.bind(this),...n)}).withOptions=function(n,...r){return t(n,e,...r)},n}updateSettings(e={}){var t=this;return s((function*(){return yield t._store.__updateSettings__(h.overwrite(e,t.storeDefaults)),h.overwrite(e,t.instanceDefaults,t),t}))()}currentReservoir(){return this._store.__currentReservoir__()}incrementReservoir(e=0){return this._store.__incrementReservoir__(e)}}return n.default=n,n.Events=a,n.version=n.prototype.version=require$$8.version,n.strategy=n.prototype.strategy={LEAK:1,OVERFLOW:2,OVERFLOW_PRIORITY:4,BLOCK:3},n.BottleneckError=n.prototype.BottleneckError=requireBottleneckError(),n.Group=n.prototype.Group=requireGroup(),n.RedisConnection=n.prototype.RedisConnection=requireRedisConnection(),n.IORedisConnection=n.prototype.IORedisConnection=requireIORedisConnection(),n.Batcher=n.prototype.Batcher=requireBatcher(),n.prototype.jobDefaults={priority:5,weight:1,expiration:null,id:"<no-id>"},n.prototype.storeDefaults={maxConcurrent:null,minTime:0,highWater:null,strategy:n.prototype.strategy.LEAK,penalty:null,reservoir:null,reservoirRefreshInterval:null,reservoirRefreshAmount:null,reservoirIncreaseInterval:null,reservoirIncreaseAmount:null,reservoirIncreaseMaximum:null},n.prototype.localStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:250},n.prototype.redisStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:5e3,clientTimeout:1e4,Redis:null,clientOptions:{},clusterNodes:null,clearDatastore:!1,connection:null},n.prototype.instanceDefaults={datastore:"local",connection:null,id:"<no-id>",rejectOnDrop:!0,trackDoneStatus:!1,Promise:Promise},n.prototype.stopDefaults={enqueueErrorMessage:"This limiter has been stopped and cannot accept new jobs.",dropWaitingJobs:!0,dropErrorMessage:"This limiter has been stopped."},n}.call(void 0),Bottleneck_1=o}var lib=requireBottleneck(),Bottleneck=getDefaultExportFromCjs(lib),browser="object"==typeof self?self.FormData:window.FormData,FormDataModule=getDefaultExportFromCjs(browser);const GRANT_TYPE$1="client_credentials",castClientOptionsToRequestParams=e=>{const{scope:t,clientId:n,clientSecret:r}=e;if(!n)throw new Error('Missing required "clientId" parameter to perform client credentials grant');if(!r)throw new Error('Missing required "clientSecret" parameter to perform client credentials grant');return Object.assign({client_id:n,client_secret:r,grant_type:GRANT_TYPE$1},t?{scope:t}:{})},isEligible$1=e=>{try{return!!castClientOptionsToRequestParams(e)}catch(e){return!1}},requestToken$1=(e,t)=>e(castClientOptionsToRequestParams(t)),RESPONSE_TYPE="token",castToAuthorizationRequestParams=e=>{const{clientId:t,scope:n,state:r,redirectUri:i}=e;if(!t)throw new Error('Missing required "clientId" parameter to perform implicit grant');return Object.assign(Object.assign({client_id:t,redirect_uri:i||window.location.href,response_type:RESPONSE_TYPE},n?{scope:n}:{}),r?{state:r}:{})},isEligibleForClientRedirect=e=>{try{return!!castToAuthorizationRequestParams(e)}catch(e){return!1}},getRedirectUrl=e=>`${e.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams(e),{skipEmptyString:!0,skipNull:!0})}`,GRANT_TYPE="password",castToTokenRequestParams=e=>{const{username:t,password:n,scope:r,clientId:i,clientSecret:s}=e;if(!i)throw new Error('Missing required "clientId" parameter to perform password grant');if(!t)throw new Error('Missing required "username" parameter to perform password grant');if(!n)throw new Error('Missing required "password" parameter to perform password grant');return Object.assign(Object.assign({client_id:i,grant_type:GRANT_TYPE,password:n,username:t},r?{scope:r}:{}),s?{client_secret:s}:{})},isEligible=e=>{try{return!!castToTokenRequestParams(e)}catch(e){return!1}},requestToken=(e,t)=>e(castToTokenRequestParams(t));async function maybeUpdateToken(e,t,n,r=!1){if(!r&&e.get("accessToken"))return;const i=Object.assign(Object.assign({},n),{refreshToken:e.get("refreshToken")});if(isEligible$2(i))return e.set(await requestToken$2(t,i));if(isEligible(n))return e.set(await requestToken(t,n));if("undefined"!=typeof window&&n.implicit){const t=querystring.parse(window.location.hash),r=t&&t.access_token;if(r)return window.history.replaceState({},"",window.location.href.split("#")[0]),e.set({accessToken:r});if(isEligibleForClientRedirect(n))return void(window.location.href=getRedirectUrl(n))}return!r&&isEligible$3(n)?e.set(await requestToken$3(t,n)):n.authorizationRedirect&&isEligibleForClientRedirect$1(n)?n.authorizationRedirect(getRedirectUrl$1(n)):isEligible$1(n)?e.set(await requestToken$1(t,n)):void 0}function sleep(e){return new Promise((t=>setTimeout((()=>t(!0)),e)))}const requestLogger=makeLogger("REST API Request"),responseLogger=makeLogger("REST API Response"),RETRYABLE_STATUS_CODES=[401,408,429,502,503,504],TOKEN_REFRESH_STATUS_CODES=[401],queue=new Bottleneck({maxConcurrent:QUEUE_CONCURRENCY,minTime:QUEUE_DELAY,reservoir:QUEUE_RESERVOIR}),refillIntervalSet=new Set;function isFormData(e){return void 0!==e&&void 0!==e.formData}function refillReservoir(){if(0===refillIntervalSet.size){const e=setInterval((async()=>{const t=await queue.currentReservoir();return queue.empty()&&0===await queue.running()&&t>10?await queue.incrementReservoir(1)&&fnClearInterval(e)&&refillIntervalSet.delete(e):t<QUEUE_RESERVOIR?queue.incrementReservoir(1):fnClearInterval(e)&&refillIntervalSet.delete(e)}),QUEUE_RESERVOIR_REFILL_INTERVAL);return refillIntervalSet.add(e)}return refillIntervalSet}async function makeResultFromResponse(e){return RETRYABLE_STATUS_CODES.includes(e.status)?e.clone():e.ok?"application/json"!==e.headers.get("content-type")&&204!==e.status?new Error(`Response content type was "${e.headers.get("content-type")}" but expected JSON`):{body:204===e.status?"":await e.json(),status:e.status}:new Error(`${e.status} ${e.statusText}\n\n${await e.text()}`)}function responseWasSuccessful(e){return!RETRYABLE_STATUS_CODES.includes(e.status)}function makeApiRequest(e,t,n,r,i,s,o){return async(a,c)=>{if(c>0){if(c>n.requestMaxRetries){const e=`Maximum number of retries reached while retrying ${a.method} request ${a.path}.`;throw requestLogger.error(e),new Error(e)}requestLogger.warn(`Warning: encountered ${a.status}. Retrying ${a.method} request ${a.path} (retry #${c}).`),await sleep(Math.ceil(Math.random()*n.requestBackOffInterval*2**c))}if(await maybeUpdateToken(e,t,n,c>0&&TOKEN_REFRESH_STATUS_CODES.includes(a.status)),!e.get("accessToken"))throw new Error("Unable to get OAuth2 access token.");try{return refillReservoir()&&await queue.schedule((async()=>{var t,a,c;const u=r.toUpperCase(),d=s&&s.query?(i.includes("?")?"&":"?")+querystring.stringify(s.query,{skipEmptyString:!0,skipNull:!0}):"",l=`${n.apiUrl}/api${i}${d}`,p=s&&s.body,m=isFormData(p),h=isFormData(p)?p.formData:{},f=Object.entries(h).reduce(((e,[t,n])=>(e.append.apply(e,[t].concat(n)),e)),new FormDataModule),y=Object.assign(Object.assign(Object.assign(Object.assign({accept:"application/json",authorization:`Bearer ${e.get("accessToken")}`,"X-Allthings-Caller":`${n.serviceName?n.serviceName:process.env.SEVICE_NAME?process.env.SEVICE_NAME:"unknown service name"} --- clientID ${null!==(c=null!==(a=null===(t=n.clientId)||void 0===t?void 0:t.split("_")[0])&&void 0!==a?a:n.clientId)&&void 0!==c?c:"no client id present"}`},m?{}:{"content-type":"application/json"}),"undefined"==typeof window&&"undefined"==typeof document&&{"user-agent":USER_AGENT}),s&&s.headers?s.headers:{}),m&&f.getHeaders?f.getHeaders():{});process.env.LOG_REQUEST&&console.log({sdkLogs:{method:u,url:l}}),requestLogger.log(u,l,{body:p,headers:y});const g={body:m?f:JSON.stringify(p)},E=await fetch$1(l,Object.assign({cache:"no-cache",credentials:"omit",headers:y,method:u,mode:"cors"},m||p?g:{})),v=await makeResultFromResponse(E);return responseLogger.log(u,l,v instanceof Error?{error:v}:{body:v.body,status:E.status}),v instanceof Error&&o?{body:v.message,status:E.status}:v}))}catch(e){return e}}}async function request(e,t,n,r,i,s,o){const a=await until(responseWasSuccessful,makeApiRequest(e,t,n,r,i,s,o));if(a instanceof Error)throw requestLogger.log("Request Error",a,s),a;return o?a:a.body}const API_METHODS=[agentCreate,agentCreatePermissions,appCreate,appGetById,bucketCreate,bucketAddFile,bucketRemoveFile,bucketRemoveFilesInPath,bucketGet,conversationGetById,conversationCreateMessage,fileCreate,fileDelete,notificationSettingsResetByUser,notificationSettingsUpdateByUser,groupCreate,groupGetById,groupUpdateById,getGroups,lookupIds,notificationsGetByUser,notificationUpdateRead,notificationsUpdateReadByUser,propertyCreate,propertyGetById,propertyUpdateById,getProperties,serviceProviderCreate,serviceProviderGetById,serviceProviderUpdateById,registrationCodeCreate,registrationCodeUpdateById,registrationCodeDelete,registrationCodeGetById,ticketCreateOnUser,ticketCreateOnServiceProvider,ticketGetById,unitCreate,unitGetById,unitUpdateById,getUnits,userCreate,userGetById,userUpdateById,userChangePassword,userCreatePermission,userCreatePermissionBatch,userGetPermissions,userDeletePermission,userCheckInToUtilisationPeriod,userGetUtilisationPeriods,userGetByEmail,getCurrentUser,getUsers,userRelationCreate,userRelationDelete,userRelationsGetByUser,utilisationPeriodCreate,utilisationPeriodDelete,utilisationPeriodGetById,utilisationPeriodUpdateById,utilisationPeriodCheckInUser,utilisationPeriodCheckOutUser,utilisationPeriodAddRegistrationCode,bookingUpdateById,bookingGetById];function restClient(e=DEFAULT_API_WRAPPER_OPTIONS){const t=Object.assign(Object.assign({},DEFAULT_API_WRAPPER_OPTIONS),e);if(void 0===t.apiUrl)throw new Error("API URL is undefined.");if(void 0===t.oauthUrl)throw new Error("OAuth2 URL is undefined.");if(!t.clientId&&!t.accessToken&&!t.tokenStore&&"undefined"==typeof window)throw new Error('Missing required "clientId" or "accessToken" parameter .');const n=makeFetchTokenRequester(`${t.oauthUrl}/oauth/token`),r=t.tokenStore||createTokenStore({accessToken:t.accessToken,refreshToken:t.refreshToken}),i=partial(request,r,n,t),s=partial(del,i),o=partial(get,i),a=partial(post,i),c=partial(patch,i),u=partial(put,i),d={authorizationCode:{getUri:(e=t.state||pseudoRandomString())=>partial(getRedirectUrl$1,Object.assign(Object.assign({},t),{state:e}))(),requestToken:e=>requestAndSaveToStore(partial(requestToken$3,n,Object.assign(Object.assign({},t),{authorizationCode:e||t.authorizationCode})),r)},generateState:pseudoRandomString,refreshToken:e=>requestAndSaveToStore(partial(requestToken$2,n,Object.assign(Object.assign({},t),{refreshToken:e||r.get("refreshToken")})),r)},l=API_METHODS.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:(...e)=>t(l,...e)})),{delete:s,get:o,oauth:d,options:t,patch:c,post:a,put:u});return l}var EnumResource,EnumCountryCode,EnumLocale,EnumTimezone,EnumServiceProviderType,EnumCommunicationMethodType,EnumInputChannel,EnumLookupUserType;exports.EnumResource=void 0,EnumResource=exports.EnumResource||(exports.EnumResource={}),EnumResource.group="group",EnumResource.property="property",EnumResource.serviceProvider="propertyManager",EnumResource.registrationCode="registrationCode",EnumResource.unit="unit",EnumResource.user="user",EnumResource.utilisationPeriod="utilisationPeriod",exports.EnumCountryCode=void 0,EnumCountryCode=exports.EnumCountryCode||(exports.EnumCountryCode={}),EnumCountryCode.CH="CH",EnumCountryCode.DE="DE",EnumCountryCode.FR="FR",EnumCountryCode.IT="IT",EnumCountryCode.NL="NL",EnumCountryCode.PT="PT",EnumCountryCode.US="US",exports.EnumLocale=void 0,EnumLocale=exports.EnumLocale||(exports.EnumLocale={}),EnumLocale.ch_de="ch_DE",EnumLocale.ch_fr="ch_FR",EnumLocale.ch_it="ch_it",EnumLocale.de_DE="de_DE",EnumLocale.it_IT="it_IT",EnumLocale.fr_FR="fr_FR",EnumLocale.pt_PT="pt_PT",EnumLocale.en_US="en_US",exports.EnumTimezone=void 0,EnumTimezone=exports.EnumTimezone||(exports.EnumTimezone={}),EnumTimezone.EuropeBerlin="Europe/Berlin",EnumTimezone.EuropeLondon="Europe/London",EnumTimezone.EuropeSofia="Europe/Sofia",EnumTimezone.EuropeZurich="Europe/Zurich",EnumTimezone.UTC="UTC",exports.EnumServiceProviderType=void 0,EnumServiceProviderType=exports.EnumServiceProviderType||(exports.EnumServiceProviderType={}),EnumServiceProviderType.propertyManager="property-manager",EnumServiceProviderType.craftspeople="craftspeople",exports.EnumCommunicationMethodType=void 0,EnumCommunicationMethodType=exports.EnumCommunicationMethodType||(exports.EnumCommunicationMethodType={}),EnumCommunicationMethodType.email="email",exports.EnumInputChannel=void 0,EnumInputChannel=exports.EnumInputChannel||(exports.EnumInputChannel={}),EnumInputChannel.APP="app",EnumInputChannel.COCKPIT="cockpit",EnumInputChannel.CRAFTSMEN="craftsmen",EnumInputChannel.EMAIL="email",EnumInputChannel.PHONE="phone",EnumInputChannel.WHATS_APP="whats_app",exports.EnumLookupUserType=void 0,EnumLookupUserType=exports.EnumLookupUserType||(exports.EnumLookupUserType={}),EnumLookupUserType.agent="agent",EnumLookupUserType.tenant="tenant",exports.DEFAULT_PARAMETER_STORE_CLIENT_CONFIG=DEFAULT_CLIENT_CONFIG,exports.createTokenStore=createTokenStore,exports.parameterStore=parameterStore,exports.restClient=restClient}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).allthings={})}(this,(function(exports){"use strict";const getHttpHandlerExtensionConfiguration=e=>{let t=e.httpHandler;return{setHttpHandler(e){t=e},httpHandler:()=>t,updateHttpClientConfig(e,n){t.updateHttpClientConfig(e,n)},httpHandlerConfigs:()=>t.httpHandlerConfigs()}},resolveHttpHandlerRuntimeConfig=e=>({httpHandler:e.httpHandler()});var HttpAuthLocation,HttpApiKeyAuthLocation,EndpointURLScheme,AlgorithmId,FieldPosition;!function(e){e.HEADER="header",e.QUERY="query"}(HttpAuthLocation||(HttpAuthLocation={})),function(e){e.HEADER="header",e.QUERY="query"}(HttpApiKeyAuthLocation||(HttpApiKeyAuthLocation={})),function(e){e.HTTP="http",e.HTTPS="https"}(EndpointURLScheme||(EndpointURLScheme={})),function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"}(AlgorithmId||(AlgorithmId={})),function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"}(FieldPosition||(FieldPosition={}));const SMITHY_CONTEXT_KEY="__smithy_context";var IniSectionType,RequestHandlerProtocol;!function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"}(IniSectionType||(IniSectionType={})),function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"}(RequestHandlerProtocol||(RequestHandlerProtocol={}));class HttpRequest{constructor(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.slice(-1)?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const t=new HttpRequest({...e,headers:{...e.headers}});return t.query&&(t.query=cloneQuery(t.query)),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return HttpRequest.clone(this)}}function cloneQuery(e){return Object.keys(e).reduce(((t,n)=>{const r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}}),{})}class HttpResponse{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}function resolveHostHeaderConfig(e){return e}const hostHeaderMiddleware=e=>t=>async n=>{if(!HttpRequest.isInstance(n.request))return t(n);const{request:r}=n,{handlerProtocol:i=""}=e.requestHandler.metadata||{};if(i.indexOf("h2")>=0&&!r.headers[":authority"])delete r.headers.host,r.headers[":authority"]=r.hostname+(r.port?":"+r.port:"");else if(!r.headers.host){let e=r.hostname;null!=r.port&&(e+=`:${r.port}`),r.headers.host=e}return t(n)},hostHeaderMiddlewareOptions={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},getHostHeaderPlugin=e=>({applyToStack:t=>{t.add(hostHeaderMiddleware(e),hostHeaderMiddlewareOptions)}}),loggerMiddleware=()=>(e,t)=>async n=>{try{const r=await e(n),{clientName:i,commandName:s,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:u}=a,d=c??t.inputFilterSensitiveLog,l=u??t.outputFilterSensitiveLog,{$metadata:p,...m}=r.output;return o?.info?.({clientName:i,commandName:s,input:d(n.input),output:l(m),metadata:p}),r}catch(e){const{clientName:r,commandName:i,logger:s,dynamoDbDocumentClientOptions:o={}}=t,{overrideInputFilterSensitiveLog:a}=o,c=a??t.inputFilterSensitiveLog;throw s?.error?.({clientName:r,commandName:i,input:c(n.input),error:e,metadata:e.$metadata}),e}},loggerMiddlewareOptions={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},getLoggerPlugin=e=>({applyToStack:e=>{e.add(loggerMiddleware(),loggerMiddlewareOptions)}}),TRACE_ID_HEADER_NAME="X-Amzn-Trace-Id",ENV_LAMBDA_FUNCTION_NAME="AWS_LAMBDA_FUNCTION_NAME",ENV_TRACE_ID="_X_AMZN_TRACE_ID",recursionDetectionMiddleware=e=>t=>async n=>{const{request:r}=n;if(!HttpRequest.isInstance(r)||"node"!==e.runtime||r.headers.hasOwnProperty(TRACE_ID_HEADER_NAME))return t(n);const i=[][ENV_TRACE_ID],s=e=>"string"==typeof e&&e.length>0;return s([][ENV_LAMBDA_FUNCTION_NAME])&&s(i)&&(r.headers[TRACE_ID_HEADER_NAME]=i),t({...n,request:r})},addRecursionDetectionMiddlewareOptions={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},getRecursionDetectionPlugin=e=>({applyToStack:t=>{t.add(recursionDetectionMiddleware(e),addRecursionDetectionMiddlewareOptions)}});function resolveUserAgentConfig(e){return{...e,customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent}}const IP_V4_REGEX=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),isIpAddress=e=>IP_V4_REGEX.test(e)||e.startsWith("[")&&e.endsWith("]"),VALID_HOST_LABEL_REGEX=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),isValidHostLabel=(e,t=!1)=>{if(!t)return VALID_HOST_LABEL_REGEX.test(e);const n=e.split(".");for(const e of n)if(!isValidHostLabel(e))return!1;return!0},customEndpointFunctions={},debugId="endpoints";function toDebugString(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${toDebugString(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(toDebugString).join(", ")})`:JSON.stringify(e,null,2)}class EndpointError extends Error{constructor(e){super(e),this.name="EndpointError"}}const booleanEquals=(e,t)=>e===t,getAttrPathList=e=>{const t=e.split("."),n=[];for(const r of t){const t=r.indexOf("[");if(-1!==t){if(r.indexOf("]")!==r.length-1)throw new EndpointError(`Path: '${e}' does not end with ']'`);const i=r.slice(t+1,-1);if(Number.isNaN(parseInt(i)))throw new EndpointError(`Invalid array index: '${i}' in path: '${e}'`);0!==t&&n.push(r.slice(0,t)),n.push(i)}else n.push(r)}return n},getAttr=(e,t)=>getAttrPathList(t).reduce(((n,r)=>{if("object"!=typeof n)throw new EndpointError(`Index '${r}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(r)]:n[r]}),e),isSet=e=>null!=e,not=e=>!e,DEFAULT_PORTS={[EndpointURLScheme.HTTP]:80,[EndpointURLScheme.HTTPS]:443},parseURL=e=>{const t=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:n,protocol:r="",path:i="",query:s={}}=e,o=new URL(`${r}//${t}${n?`:${n}`:""}${i}`);return o.search=Object.entries(s).map((([e,t])=>`${e}=${t}`)).join("&"),o}return new URL(e)}catch(e){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:r,hostname:i,pathname:s,protocol:o,search:a}=t;if(a)return null;const c=o.slice(0,-1);if(!Object.values(EndpointURLScheme).includes(c))return null;const u=isIpAddress(i);return{scheme:c,authority:`${r}${n.includes(`${r}:${DEFAULT_PORTS[c]}`)||"string"==typeof e&&e.includes(`${r}:${DEFAULT_PORTS[c]}`)?`:${DEFAULT_PORTS[c]}`:""}`,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,isIp:u}},stringEquals=(e,t)=>e===t,substring=(e,t,n,r)=>t>=n||e.length<n?null:r?e.substring(e.length-n,e.length-t):e.substring(t,n),uriEncode=e=>encodeURIComponent(e).replace(/[!*'()]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),endpointFunctions={booleanEquals:booleanEquals,getAttr:getAttr,isSet:isSet,isValidHostLabel:isValidHostLabel,not:not,parseURL:parseURL,stringEquals:stringEquals,substring:substring,uriEncode:uriEncode},evaluateTemplate=(e,t)=>{const n=[],r={...t.endpointParams,...t.referenceRecord};let i=0;for(;i<e.length;){const t=e.indexOf("{",i);if(-1===t){n.push(e.slice(i));break}n.push(e.slice(i,t));const s=e.indexOf("}",t);if(-1===s){n.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[s+1]&&(n.push(e.slice(t+1,s)),i=s+2);const o=e.substring(t+1,s);if(o.includes("#")){const[e,t]=o.split("#");n.push(getAttr(r[e],t))}else n.push(r[o]);i=s+1}return n.join("")},getReferenceValue=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]),evaluateExpression=(e,t,n)=>{if("string"==typeof e)return evaluateTemplate(e,n);if(e.fn)return callFunction(e,n);if(e.ref)return getReferenceValue(e,n);throw new EndpointError(`'${t}': ${String(e)} is not a string, function or reference.`)},callFunction=({fn:e,argv:t},n)=>{const r=t.map((e=>["boolean","number"].includes(typeof e)?e:evaluateExpression(e,"arg",n))),i=e.split(".");return i[0]in customEndpointFunctions&&null!=i[1]?customEndpointFunctions[i[0]][i[1]](...r):endpointFunctions[e](...r)},evaluateCondition=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new EndpointError(`'${e}' is already defined in Reference Record.`);const r=callFunction(t,n);return n.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(t)} = ${toDebugString(r)}`),{result:""===r||!!r,...null!=e&&{toAssign:{name:e,value:r}}}},evaluateConditions=(e=[],t)=>{const n={};for(const r of e){const{result:e,toAssign:i}=evaluateCondition(r,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};i&&(n[i.name]=i.value,t.logger?.debug?.(`${debugId} assign: ${i.name} := ${toDebugString(i.value)}`))}return{result:!0,referenceRecord:n}},getEndpointHeaders=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:r.map((e=>{const r=evaluateExpression(e,"Header value entry",t);if("string"!=typeof r)throw new EndpointError(`Header '${n}' value '${r}' is not a string`);return r}))})),{}),getEndpointProperty=(e,t)=>{if(Array.isArray(e))return e.map((e=>getEndpointProperty(e,t)));switch(typeof e){case"string":return evaluateTemplate(e,t);case"object":if(null===e)throw new EndpointError(`Unexpected endpoint property: ${e}`);return getEndpointProperties(e,t);case"boolean":return e;default:throw new EndpointError("Unexpected endpoint property type: "+typeof e)}},getEndpointProperties=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:getEndpointProperty(r,t)})),{}),getEndpointUrl=(e,t)=>{const n=evaluateExpression(e,"Endpoint URL",t);if("string"==typeof n)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new EndpointError("Endpoint URL must be a string, got "+typeof n)},evaluateEndpointRule=(e,t)=>{const{conditions:n,endpoint:r}=e,{result:i,referenceRecord:s}=evaluateConditions(n,t);if(!i)return;const o={...t,referenceRecord:{...t.referenceRecord,...s}},{url:a,properties:c,headers:u}=r;return t.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(r)}`),{...null!=u&&{headers:getEndpointHeaders(u,o)},...null!=c&&{properties:getEndpointProperties(c,o)},url:getEndpointUrl(a,o)}},evaluateErrorRule=(e,t)=>{const{conditions:n,error:r}=e,{result:i,referenceRecord:s}=evaluateConditions(n,t);if(i)throw new EndpointError(evaluateExpression(r,"Error",{...t,referenceRecord:{...t.referenceRecord,...s}}))},evaluateTreeRule=(e,t)=>{const{conditions:n,rules:r}=e,{result:i,referenceRecord:s}=evaluateConditions(n,t);if(i)return evaluateRules(r,{...t,referenceRecord:{...t.referenceRecord,...s}})},evaluateRules=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=evaluateEndpointRule(n,t);if(e)return e}else if("error"===n.type)evaluateErrorRule(n,t);else{if("tree"!==n.type)throw new EndpointError(`Unknown endpoint rule: ${n}`);{const e=evaluateTreeRule(n,t);if(e)return e}}throw new EndpointError("Rules evaluation failed")},resolveEndpoint=(e,t)=>{const{endpointParams:n,logger:r}=t,{parameters:i,rules:s}=e;t.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(n)}`);const o=Object.entries(i).filter((([,e])=>null!=e.default)).map((([e,t])=>[e,t.default]));if(o.length>0)for(const[e,t]of o)n[e]=n[e]??t;const a=Object.entries(i).filter((([,e])=>e.required)).map((([e])=>e));for(const e of a)if(null==n[e])throw new EndpointError(`Missing required parameter: '${e}'`);const c=evaluateRules(s,{endpointParams:n,logger:r,referenceRecord:{}});if(t.endpointParams?.Endpoint)try{const e=new URL(t.endpointParams.Endpoint),{protocol:n,port:r}=e;c.url.protocol=n,c.url.port=r}catch(e){}return t.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(c)}`),c},isVirtualHostableS3Bucket=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!isVirtualHostableS3Bucket(t))return!1;return!0}return!!isValidHostLabel(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!isIpAddress(e)))},ARN_DELIMITER=":",RESOURCE_DELIMITER="/",parseArn=e=>{const t=e.split(ARN_DELIMITER);if(t.length<6)return null;const[n,r,i,s,o,...a]=t;if("arn"!==n||""===r||""===i||""===a.join(ARN_DELIMITER))return null;return{partition:r,service:i,region:s,accountId:o,resourceId:a.map((e=>e.split(RESOURCE_DELIMITER))).flat()}},partitions=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],version$3="1.1";var partitionsInfo={partitions:partitions,version:version$3};let selectedPartitionsInfo=partitionsInfo;const partition=e=>{const{partitions:t}=selectedPartitionsInfo;for(const n of t){const{regions:t,outputs:r}=n;for(const[n,i]of Object.entries(t))if(n===e)return{...r,...i}}for(const n of t){const{regionRegex:t,outputs:r}=n;if(new RegExp(t).test(e))return{...r}}const n=t.find((e=>"aws"===e.id));if(!n)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...n.outputs}},awsEndpointFunctions={isVirtualHostableS3Bucket:isVirtualHostableS3Bucket,parseArn:parseArn,partition:partition};customEndpointFunctions.aws=awsEndpointFunctions;const USER_AGENT$1="user-agent",X_AMZ_USER_AGENT="x-amz-user-agent",SPACE=" ",UA_NAME_SEPARATOR="/",UA_NAME_ESCAPE_REGEX=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,UA_VALUE_ESCAPE_REGEX=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,UA_ESCAPE_CHAR="-",userAgentMiddleware=e=>(t,n)=>async r=>{const{request:i}=r;if(!HttpRequest.isInstance(i))return t(r);const{headers:s}=i,o=n?.userAgent?.map(escapeUserAgent)||[],a=(await e.defaultUserAgentProvider()).map(escapeUserAgent),c=e?.customUserAgent?.map(escapeUserAgent)||[],u=[].concat([...a,...o,...c]).join(SPACE),d=[...a.filter((e=>e.startsWith("aws-sdk-"))),...c].join(SPACE);return"browser"!==e.runtime?(d&&(s[X_AMZ_USER_AGENT]=s[X_AMZ_USER_AGENT]?`${s[USER_AGENT$1]} ${d}`:d),s[USER_AGENT$1]=u):s[X_AMZ_USER_AGENT]=u,t({...r,request:i})},escapeUserAgent=e=>{const t=e[0].split(UA_NAME_SEPARATOR).map((e=>e.replace(UA_NAME_ESCAPE_REGEX,UA_ESCAPE_CHAR))).join(UA_NAME_SEPARATOR),n=e[1]?.replace(UA_VALUE_ESCAPE_REGEX,UA_ESCAPE_CHAR),r=t.indexOf(UA_NAME_SEPARATOR),i=t.substring(0,r);let s=t.substring(r+1);return"api"===i&&(s=s.toLowerCase()),[i,s,n].filter((e=>e&&e.length>0)).reduce(((e,t,n)=>{switch(n){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}}),"")},getUserAgentMiddlewareOptions={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},getUserAgentPlugin=e=>({applyToStack:t=>{t.add(userAgentMiddleware(e),getUserAgentMiddlewareOptions)}});var SelectorType;!function(e){e.ENV="env",e.CONFIG="shared config entry"}(SelectorType||(SelectorType={}));const DEFAULT_USE_DUALSTACK_ENDPOINT=!1,DEFAULT_USE_FIPS_ENDPOINT=!1,getSmithyContext=e=>e[SMITHY_CONTEXT_KEY]||(e[SMITHY_CONTEXT_KEY]={}),normalizeProvider$1=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},isFipsRegion=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),getRealRegion=e=>isFipsRegion(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e,resolveRegionConfig=e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return{...e,region:async()=>{if("string"==typeof t)return getRealRegion(t);const e=await t();return getRealRegion(e)},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!isFipsRegion(e)||("function"!=typeof n?Promise.resolve(!!n):n())}}};function convertHttpAuthSchemesToMap(e){const t=new Map;for(const n of e)t.set(n.schemeId,n);return t}const httpAuthSchemeMiddleware=(e,t)=>(n,r)=>async i=>{const s=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,r,i.input)),o=convertHttpAuthSchemesToMap(e.httpAuthSchemes),a=getSmithyContext(r),c=[];for(const n of s){const i=o.get(n.schemeId);if(!i){c.push(`HttpAuthScheme \`${n.schemeId}\` was not enabled for this service.`);continue}const s=i.identityProvider(await t.identityProviderConfigProvider(e));if(!s){c.push(`HttpAuthScheme \`${n.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:u={},signingProperties:d={}}=n.propertiesExtractor?.(e,r)||{};n.identityProperties=Object.assign(n.identityProperties||{},u),n.signingProperties=Object.assign(n.signingProperties||{},d),a.selectedHttpAuthScheme={httpAuthOption:n,identity:await s(n.identityProperties),signer:i.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join("\n"));return n(i)},resolveParamsForS3=async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),isArnBucketName(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!isDnsCompatibleBucketName(t)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},DOMAIN_PATTERN=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,IP_ADDRESS_PATTERN=/(\d+\.){3}\d+/,DOTS_PATTERN=/\.\./,isDnsCompatibleBucketName=e=>DOMAIN_PATTERN.test(e)&&!IP_ADDRESS_PATTERN.test(e)&&!DOTS_PATTERN.test(e),isArnBucketName=e=>{const[t,n,r,,,i]=e.split(":"),s="arn"===t&&e.split(":").length>=6,o=Boolean(s&&n&&r&&i);if(s&&!o)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return o},createConfigValueProvider=(e,t,n)=>{const r=async()=>{const r=n[e]??n[t];return"function"==typeof r?r():r};return"credentialScope"===e||"CredentialScope"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.credentialScope??e?.CredentialScope}:"accountId"===e||"AccountId"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.accountId??e?.AccountId}:"endpoint"===e||"endpoint"===t?async()=>{const e=await r();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:n,port:r,path:i}=e;return`${t}//${n}${r?":"+r:""}${i}`}}return e}:r},getEndpointFromConfig=async e=>{};function parseQueryString(e){const t={};if(e=e.replace(/^\?/,""))for(const n of e.split("&")){let[e,r=null]=n.split("=");e=decodeURIComponent(e),r&&(r=decodeURIComponent(r)),e in t?Array.isArray(t[e])?t[e].push(r):t[e]=[t[e],r]:t[e]=r}return t}const parseUrl=e=>{if("string"==typeof e)return parseUrl(new URL(e));const{hostname:t,pathname:n,port:r,protocol:i,search:s}=e;let o;return s&&(o=parseQueryString(s)),{hostname:t,port:r?parseInt(r):void 0,protocol:i,path:n,query:o}},toEndpointV1=e=>"object"==typeof e?"url"in e?parseUrl(e.url):e:parseUrl(e),getEndpointFromInstructions=async(e,t,n,r)=>{if(!n.endpoint){const e=await getEndpointFromConfig(n.serviceId||"");e&&(n.endpoint=()=>Promise.resolve(toEndpointV1(e)))}const i=await resolveParams(e,t,n);if("function"!=typeof n.endpointProvider)throw new Error("config.endpointProvider is not set.");return n.endpointProvider(i,r)},resolveParams=async(e,t,n)=>{const r={},i=t?.getEndpointParameterInstructions?.()||{};for(const[t,s]of Object.entries(i))switch(s.type){case"staticContextParams":r[t]=s.value;break;case"contextParams":r[t]=e[s.name];break;case"clientContextParams":case"builtInParams":r[t]=await createConfigValueProvider(s.name,t,n)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return 0===Object.keys(i).length&&Object.assign(r,n),"s3"===String(n.serviceId).toLowerCase()&&await resolveParamsForS3(r),r},endpointMiddleware=({config:e,instructions:t})=>(n,r)=>async i=>{const s=await getEndpointFromInstructions(i.input,{getEndpointParameterInstructions:()=>t},{...e},r);r.endpointV2=s,r.authSchemes=s.properties?.authSchemes;const o=r.authSchemes?.[0];if(o){r.signing_region=o.signingRegion,r.signing_service=o.signingName;const e=getSmithyContext(r),t=e?.selectedHttpAuthScheme?.httpAuthOption;t&&(t.signingProperties=Object.assign(t.signingProperties||{},{signing_region:o.signingRegion,signingRegion:o.signingRegion,signing_service:o.signingName,signingName:o.signingName,signingRegionSet:o.signingRegionSet},o.properties))}return n({...i})},deserializerMiddleware=(e,t)=>n=>async r=>{const{response:i}=await n(r);try{return{response:i,output:await t(i,e)}}catch(e){if(Object.defineProperty(e,"$response",{value:i}),!("$metadata"in e)){const t="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";e.message+="\n "+t,void 0!==e.$responseBodyText&&e.$response&&(e.$response.body=e.$responseBodyText)}throw e}},serializerMiddleware=(e,t)=>(n,r)=>async i=>{const s=r.endpointV2?.url&&e.urlParser?async()=>e.urlParser(r.endpointV2.url):e.endpoint;if(!s)throw new Error("No valid endpoint provider available.");const o=await t(i.input,{...e,endpoint:s});return n({...i,request:o})},deserializerMiddlewareOption={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},serializerMiddlewareOption={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function getSerdePlugin(e,t,n){return{applyToStack:r=>{r.add(deserializerMiddleware(e,n),deserializerMiddlewareOption),r.add(serializerMiddleware(e,t),serializerMiddlewareOption)}}}const endpointMiddlewareOptions={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:serializerMiddlewareOption.name},getEndpointPlugin=(e,t)=>({applyToStack:n=>{n.addRelativeTo(endpointMiddleware({config:e,instructions:t}),endpointMiddlewareOptions)}}),resolveEndpointConfig=e=>{const t=e.tls??!0,{endpoint:n}=e,r=null!=n?async()=>toEndpointV1(await normalizeProvider$1(n)()):void 0,i=!!n;return{...e,endpoint:r,tls:t,isCustomEndpoint:i,useDualstackEndpoint:normalizeProvider$1(e.useDualstackEndpoint??!1),useFipsEndpoint:normalizeProvider$1(e.useFipsEndpoint??!1)}},httpAuthSchemeEndpointRuleSetMiddlewareOptions={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:endpointMiddlewareOptions.name},getHttpAuthSchemeEndpointRuleSetPlugin=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:r=>{r.addRelativeTo(httpAuthSchemeMiddleware(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),httpAuthSchemeEndpointRuleSetMiddlewareOptions)}});serializerMiddlewareOption.name;const defaultErrorHandler=e=>e=>{throw e},defaultSuccessHandler=(e,t)=>{},httpSigningMiddleware=e=>(e,t)=>async n=>{if(!HttpRequest.isInstance(n.request))return e(n);const r=getSmithyContext(t).selectedHttpAuthScheme;if(!r)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:i={}},identity:s,signer:o}=r,a=await e({...n,request:await o.sign(n.request,s,i)}).catch((o.errorHandler||defaultErrorHandler)(i));return(o.successHandler||defaultSuccessHandler)(a.response,i),a};var RETRY_MODES;!function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"}(RETRY_MODES||(RETRY_MODES={}));const DEFAULT_MAX_ATTEMPTS=3,DEFAULT_RETRY_MODE=RETRY_MODES.STANDARD,THROTTLING_ERROR_CODES=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],TRANSIENT_ERROR_CODES=["TimeoutError","RequestTimeout","RequestTimeoutException"],TRANSIENT_ERROR_STATUS_CODES=[500,502,503,504],NODEJS_TIMEOUT_ERROR_CODES=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],isClockSkewCorrectedError=e=>e.$metadata?.clockSkewCorrected,isThrottlingError=e=>429===e.$metadata?.httpStatusCode||THROTTLING_ERROR_CODES.includes(e.name)||1==e.$retryable?.throttling,isTransientError=e=>isClockSkewCorrectedError(e)||TRANSIENT_ERROR_CODES.includes(e.name)||NODEJS_TIMEOUT_ERROR_CODES.includes(e?.code||"")||TRANSIENT_ERROR_STATUS_CODES.includes(e.$metadata?.httpStatusCode||0),isServerError=e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!isTransientError(e)}return!1};class DefaultRateLimiter{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise((e=>setTimeout(e,t)))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),isThrottlingError(e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const n=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const DEFAULT_RETRY_DELAY_BASE=100,MAXIMUM_RETRY_DELAY=2e4,THROTTLING_RETRY_DELAY_BASE=500,INITIAL_RETRY_TOKENS=500,RETRY_COST=5,TIMEOUT_RETRY_COST=10,NO_RETRY_INCREMENT=1,INVOCATION_ID_HEADER="amz-sdk-invocation-id",REQUEST_HEADER="amz-sdk-request",getDefaultRetryBackoffStrategy=()=>{let e=DEFAULT_RETRY_DELAY_BASE;return{computeNextBackoffDelay:t=>Math.floor(Math.min(MAXIMUM_RETRY_DELAY,Math.random()*2**t*e)),setDelayBase:t=>{e=t}}},createDefaultRetryToken=({retryDelay:e,retryCount:t,retryCost:n})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(MAXIMUM_RETRY_DELAY,e),getRetryCost:()=>n});class StandardRetryStrategy{constructor(e){this.maxAttempts=e,this.mode=RETRY_MODES.STANDARD,this.capacity=INITIAL_RETRY_TOKENS,this.retryBackoffStrategy=getDefaultRetryBackoffStrategy(),this.maxAttemptsProvider="function"==typeof e?e:async()=>e}async acquireInitialRetryToken(e){return createDefaultRetryToken({retryDelay:DEFAULT_RETRY_DELAY_BASE,retryCount:0})}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts();if(this.shouldRetry(e,t,n)){const n=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===n?THROTTLING_RETRY_DELAY_BASE:DEFAULT_RETRY_DELAY_BASE);const r=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),i=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,r):r,s=this.getCapacityCost(n);return this.capacity-=s,createDefaultRetryToken({retryDelay:i,retryCount:e.getRetryCount()+1,retryCost:s})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(INITIAL_RETRY_TOKENS,this.capacity+(e.getRetryCost()??NO_RETRY_INCREMENT))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`),DEFAULT_MAX_ATTEMPTS}}shouldRetry(e,t,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return"TRANSIENT"===e?TIMEOUT_RETRY_COST:RETRY_COST}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class AdaptiveRetryStrategy{constructor(e,t){this.maxAttemptsProvider=e,this.mode=RETRY_MODES.ADAPTIVE;const{rateLimiter:n}=t??{};this.rateLimiter=n??new DefaultRateLimiter,this.standardRetryStrategy=new StandardRetryStrategy(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const byteToHex=[];for(let e=0;e<256;++e)byteToHex.push((e+256).toString(16).slice(1));function unsafeStringify(e,t=0){return byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+"-"+byteToHex[e[t+4]]+byteToHex[e[t+5]]+"-"+byteToHex[e[t+6]]+byteToHex[e[t+7]]+"-"+byteToHex[e[t+8]]+byteToHex[e[t+9]]+"-"+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]}const randomUUID="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var native={randomUUID:randomUUID};function v4(e,t,n){if(native.randomUUID&&!t&&!e)return native.randomUUID();const r=(e=e||{}).random||(e.rng||rng)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,unsafeStringify(r)}const asSdkError=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`),resolveRetryConfig=e=>{const{retryStrategy:t}=e,n=normalizeProvider$1(e.maxAttempts??DEFAULT_MAX_ATTEMPTS);return{...e,maxAttempts:n,retryStrategy:async()=>{if(t)return t;return await normalizeProvider$1(e.retryMode)()===RETRY_MODES.ADAPTIVE?new AdaptiveRetryStrategy(n):new StandardRetryStrategy(n)}}};class NoOpLogger{trace(){}debug(){}info(){}warn(){}error(){}}const getAllAliases=(e,t)=>{const n=[];if(e&&n.push(e),t)for(const e of t)n.push(e);return n},getMiddlewareNameWithAliases=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,constructStack=()=>{let e=[],t=[],n=!1;const r=new Set,i=n=>(e.forEach((e=>{n.add(e.middleware,{...e})})),t.forEach((e=>{n.addRelativeTo(e.middleware,{...e})})),n.identifyOnResolve?.(a.identifyOnResolve()),n),s=e=>{const t=[];return e.before.forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...s(e))})),t.push(e),e.after.reverse().forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...s(e))})),t},o=(n=!1)=>{const r=[],i=[],o={};e.forEach((e=>{const t={...e,before:[],after:[]};for(const e of getAllAliases(t.name,t.aliases))o[e]=t;r.push(t)})),t.forEach((e=>{const t={...e,before:[],after:[]};for(const e of getAllAliases(t.name,t.aliases))o[e]=t;i.push(t)})),i.forEach((e=>{if(e.toMiddleware){const t=o[e.toMiddleware];if(void 0===t){if(n)return;throw new Error(`${e.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}}));const a=(c=r,c.sort(((e,t)=>stepWeights[t.step]-stepWeights[e.step]||priorityWeights[t.priority||"normal"]-priorityWeights[e.priority||"normal"]))).map(s).reduce(((e,t)=>(e.push(...t),e)),[]);var c;return a},a={add:(t,n={})=>{const{name:i,override:s,aliases:o}=n,a={step:"initialize",priority:"normal",middleware:t,...n},c=getAllAliases(i,o);if(c.length>0){if(c.some((e=>r.has(e)))){if(!s)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(i,o)}'`);for(const t of c){const n=e.findIndex((e=>e.name===t||e.aliases?.some((e=>e===t))));if(-1===n)continue;const r=e[n];if(r.step!==a.step||a.priority!==r.priority)throw new Error(`"${getMiddlewareNameWithAliases(r.name,r.aliases)}" middleware with ${r.priority} priority in ${r.step} step cannot be overridden by "${getMiddlewareNameWithAliases(i,o)}" middleware with ${a.priority} priority in ${a.step} step.`);e.splice(n,1)}}for(const e of c)r.add(e)}e.push(a)},addRelativeTo:(e,n)=>{const{name:i,override:s,aliases:o}=n,a={middleware:e,...n},c=getAllAliases(i,o);if(c.length>0){if(c.some((e=>r.has(e)))){if(!s)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(i,o)}'`);for(const e of c){const n=t.findIndex((t=>t.name===e||t.aliases?.some((t=>t===e))));if(-1===n)continue;const r=t[n];if(r.toMiddleware!==a.toMiddleware||r.relation!==a.relation)throw new Error(`"${getMiddlewareNameWithAliases(r.name,r.aliases)}" middleware ${r.relation} "${r.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(i,o)}" middleware ${a.relation} "${a.toMiddleware}" middleware.`);t.splice(n,1)}}for(const e of c)r.add(e)}t.push(a)},clone:()=>i(constructStack()),use:e=>{e.applyToStack(a)},remove:n=>"string"==typeof n?(n=>{let i=!1;const s=e=>{const t=getAllAliases(e.name,e.aliases);if(t.includes(n)){i=!0;for(const e of t)r.delete(e);return!1}return!0};return e=e.filter(s),t=t.filter(s),i})(n):(n=>{let i=!1;const s=e=>{if(e.middleware===n){i=!0;for(const t of getAllAliases(e.name,e.aliases))r.delete(t);return!1}return!0};return e=e.filter(s),t=t.filter(s),i})(n),removeByTag:n=>{let i=!1;const s=e=>{const{tags:t,name:s,aliases:o}=e;if(t&&t.includes(n)){const e=getAllAliases(s,o);for(const t of e)r.delete(t);return i=!0,!1}return!0};return e=e.filter(s),t=t.filter(s),i},concat:e=>{const t=i(constructStack());return t.use(e),t.identifyOnResolve(n||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:i,identify:()=>o(!0).map((e=>{const t=e.step??e.relation+" "+e.toMiddleware;return getMiddlewareNameWithAliases(e.name,e.aliases)+" - "+t})),identifyOnResolve:e=>("boolean"==typeof e&&(n=e),n),resolve:(e,t)=>{for(const n of o().map((e=>e.middleware)).reverse())e=n(e,t);return n&&console.log(a.identify()),e}};return a},stepWeights={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},priorityWeights={high:3,normal:2,low:1};class Client{constructor(e){this.middlewareStack=constructStack(),this.config=e}send(e,t,n){const r="function"!=typeof t?t:void 0,i="function"==typeof t?t:n,s=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!i)return s(e).then((e=>e.output));s(e).then((e=>i(null,e.output)),(e=>i(e))).catch((()=>{}))}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}const alphabetByEncoding={},alphabetByValue=new Array(64);for(let e=0,t="A".charCodeAt(0),n="Z".charCodeAt(0);e+t<=n;e++){const n=String.fromCharCode(e+t);alphabetByEncoding[n]=e,alphabetByValue[e]=n}for(let e=0,t="a".charCodeAt(0),n="z".charCodeAt(0);e+t<=n;e++){const n=String.fromCharCode(e+t),r=e+26;alphabetByEncoding[n]=r,alphabetByValue[r]=n}for(let e=0;e<10;e++){alphabetByEncoding[e.toString(10)]=e+52;const t=e.toString(10),n=e+52;alphabetByEncoding[t]=n,alphabetByValue[n]=t}alphabetByEncoding["+"]=62,alphabetByValue[62]="+",alphabetByEncoding["/"]=63,alphabetByValue[63]="/";const bitsPerLetter=6,bitsPerByte=8,maxLetterValue=63,fromBase64=e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const n=new ArrayBuffer(t),r=new DataView(n);for(let t=0;t<e.length;t+=4){let n=0,i=0;for(let r=t,s=t+3;r<=s;r++)if("="!==e[r]){if(!(e[r]in alphabetByEncoding))throw new TypeError(`Invalid character ${e[r]} in base64 string.`);n|=alphabetByEncoding[e[r]]<<(s-r)*bitsPerLetter,i+=bitsPerLetter}else n>>=bitsPerLetter;const s=t/4*3;n>>=i%bitsPerByte;const o=Math.floor(i/bitsPerByte);for(let e=0;e<o;e++){const t=(o-e-1)*bitsPerByte;r.setUint8(s+e,(n&255<<t)>>t)}}return new Uint8Array(n)},fromUtf8$2=e=>(new TextEncoder).encode(e),toUint8Array=e=>"string"==typeof e?fromUtf8$2(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),toUtf8=e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function toBase64(e){let t;t="string"==typeof e?fromUtf8$2(e):e;const n="object"==typeof t&&"number"==typeof t.length,r="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!n&&!r)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let i="";for(let e=0;e<t.length;e+=3){let n=0,r=0;for(let i=e,s=Math.min(e+3,t.length);i<s;i++)n|=t[i]<<(s-i-1)*bitsPerByte,r+=bitsPerByte;const s=Math.ceil(r/bitsPerLetter);n<<=s*bitsPerLetter-r;for(let e=1;e<=s;e++){const t=(s-e)*bitsPerLetter;i+=alphabetByValue[(n&maxLetterValue<<t)>>t]}i+="==".slice(0,4-s)}return i}function transformToString(e,t="utf-8"){return"base64"===t?toBase64(e):toUtf8(e)}function transformFromString(e,t){return"base64"===t?Uint8ArrayBlobAdapter.mutate(fromBase64(e)):Uint8ArrayBlobAdapter.mutate(fromUtf8$2(e))}class Uint8ArrayBlobAdapter extends Uint8Array{static fromString(e,t="utf-8"){if("string"==typeof e)return transformFromString(e,t);throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,Uint8ArrayBlobAdapter.prototype),e}transformToString(e="utf-8"){return transformToString(this,e)}}const escapeUri=e=>encodeURIComponent(e).replace(/[!'()*]/g,hexEncode),hexEncode=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function buildQueryString(e){const t=[];for(let n of Object.keys(e).sort()){const r=e[n];if(n=escapeUri(n),Array.isArray(r))for(let e=0,i=r.length;e<i;e++)t.push(`${n}=${escapeUri(r[e])}`);else{let e=n;(r||"string"==typeof r)&&(e+=`=${escapeUri(r)}`),t.push(e)}}return t.join("&")}function requestTimeout(e=0){return new Promise(((t,n)=>{e&&setTimeout((()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",n(t)}),e)}))}const keepAliveSupport={supported:void 0};class FetchHttpHandler{static create(e){return"function"==typeof e?.handle?e:new FetchHttpHandler(e)}constructor(e){"function"==typeof e?this.configProvider=e().then((e=>e||{})):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===keepAliveSupport.supported&&(keepAliveSupport.supported=Boolean("undefined"!=typeof Request&&"keepalive"in new Request("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t}={}){this.config||(this.config=await this.configProvider);const n=this.config.requestTimeout,r=!0===this.config.keepAlive,i=this.config.credentials;if(t?.aborted){const e=new Error("Request aborted");return e.name="AbortError",Promise.reject(e)}let s=e.path;const o=buildQueryString(e.query||{});o&&(s+=`?${o}`),e.fragment&&(s+=`#${e.fragment}`);let a="";if(null!=e.username||null!=e.password){a=`${e.username??""}:${e.password??""}@`}const{port:c,method:u}=e,d=`${e.protocol}//${a}${e.hostname}${c?`:${c}`:""}${s}`,l="GET"===u||"HEAD"===u?void 0:e.body,p={body:l,headers:new Headers(e.headers),method:u,credentials:i};l&&(p.duplex="half"),"undefined"!=typeof AbortController&&(p.signal=t),keepAliveSupport.supported&&(p.keepalive=r);let m=()=>{};const h=new Request(d,p),f=[fetch(h).then((e=>{const t=e.headers,n={};for(const e of t.entries())n[e[0]]=e[1];return null!=e.body?{response:new HttpResponse({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}:e.blob().then((t=>({response:new HttpResponse({headers:n,reason:e.statusText,statusCode:e.status,body:t})})))})),requestTimeout(n)];return t&&f.push(new Promise(((e,n)=>{const r=()=>{const e=new Error("Request aborted");e.name="AbortError",n(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",r,{once:!0}),m=()=>e.removeEventListener("abort",r)}else t.onabort=r}))),Promise.race(f).finally(m)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((n=>(n[e]=t,n)))}httpHandlerConfigs(){return this.config??{}}}const streamCollector=e=>"function"==typeof Blob&&e instanceof Blob?collectBlob(e):collectStream(e);async function collectBlob(e){const t=await readToBase64(e),n=fromBase64(t);return new Uint8Array(n)}async function collectStream(e){const t=[],n=e.getReader();let r=!1,i=0;for(;!r;){const{done:e,value:s}=await n.read();s&&(t.push(s),i+=s.length),r=e}const s=new Uint8Array(i);let o=0;for(const e of t)s.set(e,o),o+=e.length;return s}function readToBase64(e){return new Promise(((t,n)=>{const r=new FileReader;r.onloadend=()=>{if(2!==r.readyState)return n(new Error("Reader aborted too early"));const e=r.result??"",i=e.indexOf(","),s=i>-1?i+1:e.length;t(e.substring(s))},r.onabort=()=>n(new Error("Read aborted")),r.onerror=()=>n(r.error),r.readAsDataURL(e)}))}const SHORT_TO_HEX={},HEX_TO_SHORT={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),SHORT_TO_HEX[e]=t,HEX_TO_SHORT[t]=e}function fromHex(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const r=e.slice(n,n+2).toLowerCase();if(!(r in HEX_TO_SHORT))throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`);t[n/2]=HEX_TO_SHORT[r]}return t}function toHex(e){let t="";for(let n=0;n<e.byteLength;n++)t+=SHORT_TO_HEX[e[n]];return t}const collectBody=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return Uint8ArrayBlobAdapter.mutate(e);if(!e)return Uint8ArrayBlobAdapter.mutate(new Uint8Array);const n=t.streamCollector(e);return Uint8ArrayBlobAdapter.mutate(await n)};class Command{constructor(){this.middlewareStack=constructStack()}static classBuilder(){return new ClassBuilder}resolveMiddlewareWithContext(e,t,n,{middlewareFn:r,clientName:i,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:a,smithyContext:c,additionalContext:u,CommandCtor:d}){for(const i of r.bind(this)(d,e,t,n))this.middlewareStack.use(i);const l=e.concat(this.middlewareStack),{logger:p}=t,m={logger:p,clientName:i,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:a,[SMITHY_CONTEXT_KEY]:{commandInstance:this,...c},...u},{requestHandler:h}=t;return l.resolve((e=>h.handle(e.request,n||{})),m)}}class ClassBuilder{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=e=>e,t=e=>e){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let t;return t=class extends Command{static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=t??{},e._init(this)}resolveMiddleware(n,r,i){return this.resolveMiddlewareWithContext(n,r,i,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}const SENSITIVE_STRING="***SensitiveInformation***",expectNumber=e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&logger$1.warn(stackTraceWarning(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},expectLong=e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}},expectNonNull=(e,t)=>{if(null==e)throw new TypeError("Expected a non-null value");return e},expectString=e=>{if(null!=e){if("string"==typeof e)return e;if(["boolean","number","bigint"].includes(typeof e))return logger$1.warn(stackTraceWarning(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},strictParseDouble=e=>expectNumber("string"==typeof e?parseNumber(e):e),NUMBER_REGEX=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,parseNumber=e=>{const t=e.match(NUMBER_REGEX);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},stackTraceWarning=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter((e=>!e.includes("stackTraceWarning"))).join("\n"),logger$1={warn:console.warn},parseEpochTimestamp=e=>{if(null==e)return;let t;if("number"==typeof e)t=e;else if("string"==typeof e)t=strictParseDouble(e);else{if("object"!=typeof e||1!==e.tag)throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");t=e.value}if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(1e3*t))};class ServiceException extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,ServiceException.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const decorateServiceException=(e,t={})=>{Object.entries(t).filter((([,e])=>void 0!==e)).forEach((([t,n])=>{null!=e[t]&&""!==e[t]||(e[t]=n)}));const n=e.message||e.Message||"UnknownError";return e.message=n,delete e.Message,e},throwDefaultError$1=({output:e,parsedBody:t,exceptionCtor:n,errorCode:r})=>{const i=deserializeMetadata$1(e),s=i.httpStatusCode?i.httpStatusCode+"":void 0,o=new n({name:t?.code||t?.Code||r||s||"UnknownError",$fault:"client",$metadata:i});throw decorateServiceException(o,t)},withBaseException=e=>({output:t,parsedBody:n,errorCode:r})=>{throwDefaultError$1({output:t,parsedBody:n,exceptionCtor:e,errorCode:r})},deserializeMetadata$1=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),loadConfigsForDefaultMode=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{}}},getChecksumConfiguration=e=>{const t=[];for(const n in AlgorithmId){const r=AlgorithmId[n];void 0!==e[r]&&t.push({algorithmId:()=>r,checksumConstructor:()=>e[r]})}return{_checksumAlgorithms:t,addChecksumAlgorithm(e){this._checksumAlgorithms.push(e)},checksumAlgorithms(){return this._checksumAlgorithms}}},resolveChecksumRuntimeConfig=e=>{const t={};return e.checksumAlgorithms().forEach((e=>{t[e.algorithmId()]=e.checksumConstructor()})),t},getRetryConfiguration=e=>{let t=e.retryStrategy;return{setRetryStrategy(e){t=e},retryStrategy:()=>t}},resolveRetryRuntimeConfig=e=>{const t={};return t.retryStrategy=e.retryStrategy(),t},getDefaultExtensionConfiguration=e=>({...getChecksumConfiguration(e),...getRetryConfiguration(e)}),resolveDefaultRuntimeConfig=e=>({...resolveChecksumRuntimeConfig(e),...resolveRetryRuntimeConfig(e)}),StringWrapper=function(){const e=Object.getPrototypeOf(this).constructor,t=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(t,e.prototype),t};StringWrapper.prototype=Object.create(String.prototype,{constructor:{value:StringWrapper,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(StringWrapper,String);const take=(e,t)=>{const n={};for(const r in t)applyInstruction(n,e,t,r);return n},applyInstruction=(e,t,n,r)=>{if(null!==t){let i=n[r];"function"==typeof i&&(i=[,i]);const[s=nonNullish,o=pass,a=r]=i;return void(("function"==typeof s&&s(t[a])||"function"!=typeof s&&s)&&(e[r]=o(t[a])))}let[i,s]=n[r];if("function"==typeof s){let t;const n=void 0===i&&null!=(t=s()),o="function"==typeof i&&!!i(void 0)||"function"!=typeof i&&!!i;n?e[r]=t:o&&(e[r]=s())}else{const t=void 0===i&&null!=s,n="function"==typeof i&&!!i(s)||"function"!=typeof i&&!!i;(t||n)&&(e[r]=s)}},nonNullish=e=>null!=e,pass=e=>e,_json=e=>{if(null==e)return{};if(Array.isArray(e))return e.filter((e=>null!=e)).map(_json);if("object"==typeof e){const t={};for(const n of Object.keys(e))null!=e[n]&&(t[n]=_json(e[n]));return t}return e},isStreamingPayload=e=>e?.body instanceof ReadableStream,retryMiddleware=e=>(t,n)=>async r=>{let i=await e.retryStrategy();const s=await e.maxAttempts();if(!isRetryStrategyV2(i))return i?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(t,r);{let e=await i.acquireInitialRetryToken(n.partition_id),o=new Error,a=0,c=0;const{request:u}=r,d=HttpRequest.isInstance(u);for(d&&(u.headers[INVOCATION_ID_HEADER]=v4());;)try{d&&(u.headers[REQUEST_HEADER]=`attempt=${a+1}; max=${s}`);const{response:n,output:o}=await t(r);return i.recordSuccess(e),o.$metadata.attempts=a+1,o.$metadata.totalRetryDelay=c,{response:n,output:o}}catch(t){const r=getRetryErrorInfo(t);if(o=asSdkError(t),d&&isStreamingPayload(u))throw(n.logger instanceof NoOpLogger?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),o;try{e=await i.refreshRetryTokenForRetry(e,r)}catch(e){throw o.$metadata||(o.$metadata={}),o.$metadata.attempts=a+1,o.$metadata.totalRetryDelay=c,o}a=e.getRetryCount();const s=e.getRetryDelay();c+=s,await new Promise((e=>setTimeout(e,s)))}}},isRetryStrategyV2=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,getRetryErrorInfo=e=>{const t={error:e,errorType:getRetryErrorType(e)},n=getRetryAfterHint(e.$response);return n&&(t.retryAfterHint=n),t},getRetryErrorType=e=>isThrottlingError(e)?"THROTTLING":isTransientError(e)?"TRANSIENT":isServerError(e)?"SERVER_ERROR":"CLIENT_ERROR",retryMiddlewareOptions={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},getRetryPlugin=e=>({applyToStack:t=>{t.add(retryMiddleware(e),retryMiddlewareOptions)}}),getRetryAfterHint=e=>{if(!HttpResponse.isInstance(e))return;const t=Object.keys(e.headers).find((e=>"retry-after"===e.toLowerCase()));if(!t)return;const n=e.headers[t],r=Number(n);if(!Number.isNaN(r))return new Date(1e3*r);return new Date(n)},httpSigningMiddlewareOptions={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:retryMiddlewareOptions.name},getHttpSigningPlugin=e=>({applyToStack:e=>{e.addRelativeTo(httpSigningMiddleware(),httpSigningMiddlewareOptions)}});class DefaultIdentityProviderConfig{constructor(e){this.authSchemes=new Map;for(const[t,n]of Object.entries(e))void 0!==n&&this.authSchemes.set(t,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}const createIsIdentityExpiredFunction=e=>t=>doesIdentityRequireRefresh(t)&&t.expiration.getTime()-Date.now()<e,EXPIRATION_MS=3e5,isIdentityExpired=createIsIdentityExpiredFunction(EXPIRATION_MS),doesIdentityRequireRefresh=e=>void 0!==e.expiration,memoizeIdentityProvider=(e,t,n)=>{if(void 0===e)return;const r="function"!=typeof e?async()=>Promise.resolve(e):e;let i,s,o,a=!1;const c=async e=>{s||(s=r(e));try{i=await s,o=!0,a=!1}finally{s=void 0}return i};return void 0===t?async e=>(o&&!e?.forceRefresh||(i=await c(e)),i):async e=>(o&&!e?.forceRefresh||(i=await c(e)),a?i:n(i)?t(i)?(await c(e),i):i:(a=!0,i))},normalizeProvider=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},CONTENT_LENGTH_HEADER="content-length";function contentLengthMiddleware(e){return t=>async n=>{const r=n.request;if(HttpRequest.isInstance(r)){const{body:t,headers:n}=r;if(t&&-1===Object.keys(n).map((e=>e.toLowerCase())).indexOf(CONTENT_LENGTH_HEADER))try{const n=e(t);r.headers={...r.headers,[CONTENT_LENGTH_HEADER]:String(n)}}catch(e){}}return t({...n,request:r})}}const contentLengthMiddlewareOptions={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},getContentLengthPlugin=e=>({applyToStack:t=>{t.add(contentLengthMiddleware(e.bodyLengthChecker),contentLengthMiddlewareOptions)}}),getDateHeader=e=>HttpResponse.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,getSkewCorrectedDate=e=>new Date(Date.now()+e),isClockSkewed=(e,t)=>Math.abs(getSkewCorrectedDate(t).getTime()-e)>=3e5,getUpdatedSystemClockOffset=(e,t)=>{const n=Date.parse(e);return isClockSkewed(n,t)?n-Date.now():t},throwSigningPropertyError=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},validateSigningProperties=async e=>{const t=throwSigningPropertyError("context",e.context),n=throwSigningPropertyError("config",e.config),r=t.endpointV2?.properties?.authSchemes?.[0],i=throwSigningPropertyError("signer",n.signer),s=await i(r),o=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:n,signer:s,signingRegion:o,signingRegionSet:a,signingName:c}};class AwsSdkSigV4Signer{async sign(e,t,n){if(!HttpRequest.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const r=await validateSigningProperties(n),{config:i,signer:s}=r;let{signingRegion:o,signingName:a}=r;const c=n.context;if(c?.authSchemes?.length){const[e,t]=c.authSchemes;"sigv4a"===e?.name&&"sigv4"===t?.name&&(o=t?.signingRegion??o,a=t?.signingName??a)}return await s.sign(e,{signingDate:getSkewCorrectedDate(i.systemClockOffset),signingRegion:o,signingService:a})}errorHandler(e){return t=>{const n=t.ServerTime??getDateHeader(t.$response);if(n){const r=throwSigningPropertyError("config",e.config),i=r.systemClockOffset;r.systemClockOffset=getUpdatedSystemClockOffset(n,r.systemClockOffset);r.systemClockOffset!==i&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=getDateHeader(e);if(n){const e=throwSigningPropertyError("config",t.config);e.systemClockOffset=getUpdatedSystemClockOffset(n,e.systemClockOffset)}}}const memoize=(e,t,n)=>{let r,i,s,o=!1;return async t=>(s&&!t?.forceRefresh||(r=await(async()=>{i||(i=e());try{r=await i,s=!0,o=!1}finally{i=void 0}return r})()),r)},ALGORITHM_QUERY_PARAM="X-Amz-Algorithm",CREDENTIAL_QUERY_PARAM="X-Amz-Credential",AMZ_DATE_QUERY_PARAM="X-Amz-Date",SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders",EXPIRES_QUERY_PARAM="X-Amz-Expires",SIGNATURE_QUERY_PARAM="X-Amz-Signature",TOKEN_QUERY_PARAM="X-Amz-Security-Token",AUTH_HEADER="authorization",AMZ_DATE_HEADER=AMZ_DATE_QUERY_PARAM.toLowerCase(),DATE_HEADER="date",GENERATED_HEADERS=[AUTH_HEADER,AMZ_DATE_HEADER,DATE_HEADER],SIGNATURE_HEADER=SIGNATURE_QUERY_PARAM.toLowerCase(),SHA256_HEADER="x-amz-content-sha256",TOKEN_HEADER=TOKEN_QUERY_PARAM.toLowerCase(),ALWAYS_UNSIGNABLE_HEADERS={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},PROXY_HEADER_PATTERN=/^proxy-/,SEC_HEADER_PATTERN=/^sec-/,ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256",EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD",UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD",MAX_CACHE_SIZE=50,KEY_TYPE_IDENTIFIER="aws4_request",MAX_PRESIGNED_TTL=604800,signingKeyCache={},cacheQueue=[],createScope=(e,t,n)=>`${e}/${t}/${n}/${KEY_TYPE_IDENTIFIER}`,getSigningKey=async(e,t,n,r,i)=>{const s=`${n}:${r}:${i}:${toHex(await hmac(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(s in signingKeyCache)return signingKeyCache[s];for(cacheQueue.push(s);cacheQueue.length>MAX_CACHE_SIZE;)delete signingKeyCache[cacheQueue.shift()];let o=`AWS4${t.secretAccessKey}`;for(const t of[n,r,i,KEY_TYPE_IDENTIFIER])o=await hmac(e,o,t);return signingKeyCache[s]=o},hmac=(e,t,n)=>{const r=new e(t);return r.update(toUint8Array(n)),r.digest()},getCanonicalHeaders=({headers:e},t,n)=>{const r={};for(const i of Object.keys(e).sort()){if(null==e[i])continue;const s=i.toLowerCase();(s in ALWAYS_UNSIGNABLE_HEADERS||t?.has(s)||PROXY_HEADER_PATTERN.test(s)||SEC_HEADER_PATTERN.test(s))&&(!n||n&&!n.has(s))||(r[s]=e[i].trim().replace(/\s+/g," "))}return r},getCanonicalQuery=({query:e={}})=>{const t=[],n={};for(const r of Object.keys(e).sort()){if(r.toLowerCase()===SIGNATURE_HEADER)continue;t.push(r);const i=e[r];"string"==typeof i?n[r]=`${escapeUri(r)}=${escapeUri(i)}`:Array.isArray(i)&&(n[r]=i.slice(0).reduce(((e,t)=>e.concat([`${escapeUri(r)}=${escapeUri(t)}`])),[]).sort().join("&"))}return t.map((e=>n[e])).filter((e=>e)).join("&")},isArrayBuffer=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),getPayloadHash=async({headers:e,body:t},n)=>{for(const t of Object.keys(e))if(t.toLowerCase()===SHA256_HEADER)return e[t];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||isArrayBuffer(t)){const e=new n;return e.update(toUint8Array(t)),toHex(await e.digest())}return UNSIGNED_PAYLOAD};class HeaderFormatter{format(e){const t=[];for(const n of Object.keys(e)){const r=fromUtf8$2(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}const n=new Uint8Array(t.reduce(((e,t)=>e+t.byteLength),0));let r=0;for(const e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case"binary":const i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);const s=new Uint8Array(i.buffer);return s.set(e.value,3),s;case"string":const o=fromUtf8$2(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(Int64.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!UUID_PATTERN.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(fromHex(e.value.replace(/\-/g,"")),1),d}}}var HEADER_VALUE_TYPE;!function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"}(HEADER_VALUE_TYPE||(HEADER_VALUE_TYPE={}));const UUID_PATTERN=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Int64{constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,r=Math.abs(Math.round(e));n>-1&&r>0;n--,r/=256)t[n]=r;return e<0&&negate(t),new Int64(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&negate(e),parseInt(toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function negate(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const hasHeader=(e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1},moveHeadersToQuery=(e,t={})=>{const{headers:n,query:r={}}=HttpRequest.clone(e);for(const e of Object.keys(n)){const i=e.toLowerCase();"x-amz-"!==i.slice(0,6)||t.unhoistableHeaders?.has(i)||(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}},prepareRequest=e=>{e=HttpRequest.clone(e);for(const t of Object.keys(e.headers))GENERATED_HEADERS.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},iso8601=e=>toDate(e).toISOString().replace(/\.\d{3}Z$/,"Z"),toDate=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class SignatureV4{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:s=!0}){this.headerFormatter=new HeaderFormatter,this.service=r,this.sha256=i,this.uriEscapePath=s,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=normalizeProvider$1(n),this.credentialProvider=normalizeProvider$1(t)}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:s,signableHeaders:o,signingRegion:a,signingService:c}=t,u=await this.credentialProvider();this.validateResolvedCredentials(u);const d=a??await this.regionProvider(),{longDate:l,shortDate:p}=formatDate(n);if(r>MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const m=createScope(p,d,c??this.service),h=moveHeadersToQuery(prepareRequest(e),{unhoistableHeaders:s});u.sessionToken&&(h.query[TOKEN_QUERY_PARAM]=u.sessionToken),h.query[ALGORITHM_QUERY_PARAM]=ALGORITHM_IDENTIFIER,h.query[CREDENTIAL_QUERY_PARAM]=`${u.accessKeyId}/${m}`,h.query[AMZ_DATE_QUERY_PARAM]=l,h.query[EXPIRES_QUERY_PARAM]=r.toString(10);const f=getCanonicalHeaders(h,i,o);return h.query[SIGNED_HEADERS_QUERY_PARAM]=getCanonicalHeaderList(f),h.query[SIGNATURE_QUERY_PARAM]=await this.getSignature(l,m,this.getSigningKey(u,d,p,c),this.createCanonicalRequest(h,f,await getPayloadHash(e,this.sha256))),h}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:i,signingService:s}){const o=i??await this.regionProvider(),{shortDate:a,longDate:c}=formatDate(n),u=createScope(a,o,s??this.service),d=await getPayloadHash({headers:{},body:t},this.sha256),l=new this.sha256;l.update(e);const p=toHex(await l.digest()),m=[EVENT_ALGORITHM_IDENTIFIER,c,u,r,p,d].join("\n");return this.signString(m,{signingDate:n,signingRegion:o,signingService:s})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:r,priorSignature:e.priorSignature}).then((t=>({message:e.message,signature:t})))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:r}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const s=n??await this.regionProvider(),{shortDate:o}=formatDate(t),a=new this.sha256(await this.getSigningKey(i,s,o,r));return a.update(toUint8Array(e)),toHex(await a.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:r,signingRegion:i,signingService:s}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const a=i??await this.regionProvider(),c=prepareRequest(e),{longDate:u,shortDate:d}=formatDate(t),l=createScope(d,a,s??this.service);c.headers[AMZ_DATE_HEADER]=u,o.sessionToken&&(c.headers[TOKEN_HEADER]=o.sessionToken);const p=await getPayloadHash(c,this.sha256);!hasHeader(SHA256_HEADER,c.headers)&&this.applyChecksum&&(c.headers[SHA256_HEADER]=p);const m=getCanonicalHeaders(c,r,n),h=await this.getSignature(u,l,this.getSigningKey(o,a,d,s),this.createCanonicalRequest(c,m,p));return c.headers[AUTH_HEADER]=`${ALGORITHM_IDENTIFIER} Credential=${o.accessKeyId}/${l}, SignedHeaders=${getCanonicalHeaderList(m)}, Signature=${h}`,c}createCanonicalRequest(e,t,n){const r=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${getCanonicalQuery(e)}\n${r.map((e=>`${e}:${t[e]}`)).join("\n")}\n\n${r.join(";")}\n${n}`}async createStringToSign(e,t,n){const r=new this.sha256;r.update(toUint8Array(n));const i=await r.digest();return`${ALGORITHM_IDENTIFIER}\n${e}\n${t}\n${toHex(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return escapeUri(n).replace(/%2F/g,"/")}return e}async getSignature(e,t,n,r){const i=await this.createStringToSign(e,t,r),s=new this.sha256(await n);return s.update(toUint8Array(i)),toHex(await s.digest())}getSigningKey(e,t,n,r){return getSigningKey(this.sha256,e,n,t,r||this.service)}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}}const formatDate=e=>{const t=iso8601(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}},getCanonicalHeaderList=e=>Object.keys(e).sort().join(";"),resolveAwsSdkSigV4Config=e=>{let t;e.credentials&&(t=memoizeIdentityProvider(e.credentials,isIdentityExpired,doesIdentityRequireRefresh)),t||(t=e.credentialDefaultProvider?normalizeProvider(e.credentialDefaultProvider(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:n=!0,systemClockOffset:r=e.systemClockOffset||0,sha256:i}=e;let s;return s=e.signer?normalizeProvider(e.signer):e.regionInfoProvider?()=>normalizeProvider(e.region)().then((async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t])).then((([r,s])=>{const{signingRegion:o,signingService:a}=r;e.signingRegion=e.signingRegion||o||s,e.signingName=e.signingName||a||e.serviceId;const c={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n};return new(e.signerConstructor||SignatureV4)(c)})):async r=>{const s=(r=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await normalizeProvider(e.region)(),properties:{}},r)).signingRegion,o=r.signingName;e.signingRegion=e.signingRegion||s,e.signingName=e.signingName||o||e.serviceId;const a={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n};return new(e.signerConstructor||SignatureV4)(a)},{...e,systemClockOffset:r,signingEscapePath:n,credentials:t,signer:s}},collectBodyString=(e,t)=>collectBody(e,t).then((e=>t.utf8Encoder(e))),parseJsonBody=(e,t)=>collectBodyString(e,t).then((e=>{if(e.length)try{return JSON.parse(e)}catch(t){throw"SyntaxError"===t?.name&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}return{}})),parseJsonErrorBody=async(e,t)=>{const n=await parseJsonBody(e,t);return n.message=n.message??n.Message,n},loadRestJsonErrorCode=(e,t)=>{const n=e=>{let t=e;return"number"==typeof t&&(t=t.toString()),t.indexOf(",")>=0&&(t=t.split(",")[0]),t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},r=(i=e.headers,s="x-amzn-errortype",Object.keys(i).find((e=>e.toLowerCase()===s.toLowerCase())));var i,s;return void 0!==r?n(e.headers[r]):void 0!==t.code?n(t.code):void 0!==t.__type?n(t.__type):void 0};var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const defaultSSMHttpAuthSchemeParametersProvider=async(e,t,n)=>({operation:getSmithyContext(t).operation,region:await normalizeProvider$1(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"ssm",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const defaultSSMHttpAuthSchemeProvider=e=>{const t=[];return e.operation,t.push(createAwsAuthSigv4HttpAuthOption(e)),t},resolveHttpAuthSchemeConfig=e=>({...resolveAwsSdkSigV4Config(e)}),resolveClientEndpointParameters=e=>({...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"ssm"}),commonParams={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},name="@aws-sdk/client-ssm",description="AWS SDK for JavaScript Ssm Client for Node.js, Browser and React Native",version$2="3.645.0",scripts={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-ssm","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo ssm"},main="./dist-cjs/index.js",types="./dist-types/index.d.ts",module="./dist-es/index.js",sideEffects=!1,dependencies={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.645.0","@aws-sdk/client-sts":"3.645.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.645.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.645.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.645.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.1.2",tslib:"^2.6.2",uuid:"^9.0.1"},devDependencies={"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96","@types/uuid":"^9.0.4",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines={node:">=16.0.0"},typesVersions={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files=["dist-*/**"],author={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license="Apache-2.0",browser$1={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},homepage="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-ssm",repository={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-ssm"};var packageInfo={name:name,description:description,version:version$2,scripts:scripts,main:main,types:types,module:module,sideEffects:sideEffects,dependencies:dependencies,devDependencies:devDependencies,engines:engines,typesVersions:typesVersions,files:files,author:author,license:license,browser:browser$1,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:homepage,repository:repository};const fromUtf8$1=e=>(new TextEncoder).encode(e);var fromUtf8="undefined"!=typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:fromUtf8$1;function convertToBuffer(e){return e instanceof Uint8Array?e:"string"==typeof e?fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function isEmptyData(e){return"string"==typeof e?0===e.length:0===e.byteLength}var SHA_256_HASH={name:"SHA-256"},SHA_256_HMAC_ALGO={name:"HMAC",hash:SHA_256_HASH},EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const fallbackWindow={};function locateWindow(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:fallbackWindow}var Sha256$2=function(){function e(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return e.prototype.update=function(e){if(!isEmptyData(e)){var t=convertToBuffer(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return locateWindow().crypto.subtle.sign(SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):isEmptyData(this.toHash)?Promise.resolve(EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return locateWindow().crypto.subtle.digest(SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&void 0!==this.secret&&(this.key=new Promise((function(t,n){locateWindow().crypto.subtle.importKey("raw",convertToBuffer(e.secret),SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))},e}();function __awaiter(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}function __generator(e,t){var n,r,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;var BLOCK_SIZE=64,DIGEST_LENGTH=32,KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],MAX_HASHABLE_LENGTH=Math.pow(2,53)-1,RawSha256=function(){function e(){this.state=Int32Array.from(INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%BLOCK_SIZE>=BLOCK_SIZE-8){for(var r=this.bufferLength;r<BLOCK_SIZE;r++)t.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(r=this.bufferLength;r<BLOCK_SIZE-8;r++)t.setUint8(r,0);t.setUint32(BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var i=new Uint8Array(DIGEST_LENGTH);for(r=0;r<8;r++)i[4*r]=this.state[r]>>>24&255,i[4*r+1]=this.state[r]>>>16&255,i[4*r+2]=this.state[r]>>>8&255,i[4*r+3]=this.state[r]>>>0&255;return i},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],r=t[1],i=t[2],s=t[3],o=t[4],a=t[5],c=t[6],u=t[7],d=0;d<BLOCK_SIZE;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var l=this.temp[d-2],p=(l>>>17|l<<15)^(l>>>19|l<<13)^l>>>10,m=((l=this.temp[d-15])>>>7|l<<25)^(l>>>18|l<<14)^l>>>3;this.temp[d]=(p+this.temp[d-7]|0)+(m+this.temp[d-16]|0)}var h=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&a^~o&c)|0)+(u+(KEY[d]+this.temp[d]|0)|0)|0,f=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&r^n&i^r&i)|0;u=c,c=a,a=o,o=s+h|0,s=i,i=r,r=n,n=h+f|0}t[0]+=n,t[1]+=r,t[2]+=i,t[3]+=s,t[4]+=o,t[5]+=a,t[6]+=c,t[7]+=u},e}(),Sha256$1=function(){function e(e){this.secret=e,this.hash=new RawSha256,this.reset()}return e.prototype.update=function(e){if(!isEmptyData(e)&&!this.error)try{this.hash.update(convertToBuffer(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.digestSync()]}))}))},e.prototype.reset=function(){if(this.hash=new RawSha256,this.secret){this.outer=new RawSha256;var e=bufferFromSecret(this.secret),t=new Uint8Array(BLOCK_SIZE);t.set(e);for(var n=0;n<BLOCK_SIZE;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(n=0;n<e.byteLength;n++)e[n]=0}},e}();function bufferFromSecret(e){var t=convertToBuffer(e);if(t.byteLength>BLOCK_SIZE){var n=new RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(BLOCK_SIZE);return r.set(t),r}var subtleCryptoMethods=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function supportsWebCrypto(e){return!(!supportsSecureRandom(e)||"object"!=typeof e.crypto.subtle)&&supportsSubtleCrypto(e.crypto.subtle)}function supportsSecureRandom(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function supportsSubtleCrypto(e){return e&&subtleCryptoMethods.every((function(t){return"function"==typeof e[t]}))}var Sha256=function(){function e(e){supportsWebCrypto(locateWindow())?this.hash=new Sha256$2(e):this.hash=new Sha256$1(e)}return e.prototype.update=function(e,t){this.hash.update(convertToBuffer(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}(),es5={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),s=e.getVersionPrecision(n),o=Math.max(i,s),a=0,c=e.map([t,n],(function(t){var n=o-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=o-Math.min(i,s)),o-=1;o>=a;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===a)return 0;o-=1}else if(c[0][o]<c[1][o])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(s));var a=function(){var e=s[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=s.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},s=n(18);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return s.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return s.ENGINE_MAP}},{key:"OS_MAP",get:function(){return s.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return s.PLATFORMS_MAP}}],(n=null)&&o(t.prototype,n),r&&o(t,r),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=c(n(92)),i=c(n(93)),s=c(n(94)),o=c(n(95)),a=c(n(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},s=0;if(Object.keys(e).forEach((function(t){var o=e[t];"string"==typeof o?(i[t]=o,s+=1):"object"==typeof o&&(n[t]=o,r+=1)})),r>0){var o=Object.keys(n),c=a.default.find(o,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var d=a.default.find(o,(function(e){return t.isPlatform(e)}));if(d){var l=this.satisfies(n[d]);if(void 0!==l)return l}}if(s>0){var p=Object.keys(i),m=a.default.find(p,(function(e){return t.isBrowser(e,!0)}));if(void 0!==m)return this.compareVersion(i[m])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},s=/version\/(\d+(\.?_?\d+)+)/i,o=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=o,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},s=n(18),o=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:s.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:s.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:s.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:s.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:s.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:s.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.PlayStation4,version:t}}}];t.default=o,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},s=n(18),o=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];t.default=o,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},s=n(18),o=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:s.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:s.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:s.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:s.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:s.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:s.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=o,e.exports=t.default}})}(es5);var es5Exports=es5.exports,bowser=getDefaultExportFromCjs(es5Exports);const defaultUserAgent=({serviceId:e,clientVersion:t})=>async()=>{const n="undefined"!=typeof window&&window?.navigator?.userAgent?bowser.parse(window.navigator.userAgent):void 0,r=[["aws-sdk-js",t],["ua","2.0"],[`os/${n?.os?.name||"other"}`,n?.os?.version],["lang/js"],["md/browser",`${n?.browser?.name??"unknown"}_${n?.browser?.version??"unknown"}`]];return e&&r.push([`api/${e}`,t]),r},invalidProvider=e=>()=>Promise.reject(e),TEXT_ENCODER="function"==typeof TextEncoder?new TextEncoder:null,calculateBodyLength=e=>{if("string"==typeof e){if(TEXT_ENCODER)return TEXT_ENCODER.encode(e).byteLength;let t=e.length;for(let n=t-1;n>=0;n--){const r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&n--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)},u="required",v="fn",w="argv",x="ref",a=!0,b="isSet",c="booleanEquals",d="error",e="endpoint",f="tree",g="PartitionResult",h="getAttr",i={[u]:!1,type:"String"},j={[u]:!0,default:!1,type:"Boolean"},k={[x]:"Endpoint"},l={[v]:c,[w]:[{[x]:"UseFIPS"},!0]},m={[v]:c,[w]:[{[x]:"UseDualStack"},!0]},n={},o={[v]:h,[w]:[{[x]:g},"supportsFIPS"]},p={[x]:g},q={[v]:c,[w]:[!0,{[v]:h,[w]:[p,"supportsDualStack"]}]},r=[l],s=[m],t=[{[x]:"Region"}],_data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i},rules:[{conditions:[{[v]:b,[w]:[k]}],rules:[{conditions:r,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d},{conditions:s,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d},{endpoint:{url:k,properties:n,headers:n},type:e}],type:f},{conditions:[{[v]:b,[w]:t}],rules:[{conditions:[{[v]:"aws.partition",[w]:t,assign:g}],rules:[{conditions:[l,m],rules:[{conditions:[{[v]:c,[w]:[a,o]},q],rules:[{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d}],type:f},{conditions:r,rules:[{conditions:[{[v]:c,[w]:[o,a]}],rules:[{conditions:[{[v]:"stringEquals",[w]:[{[v]:h,[w]:[p,"name"]},"aws-us-gov"]}],endpoint:{url:"https://ssm.{Region}.amazonaws.com",properties:n,headers:n},type:e},{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS is enabled but this partition does not support FIPS",type:d}],type:f},{conditions:s,rules:[{conditions:[q],rules:[{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"DualStack is enabled but this partition does not support DualStack",type:d}],type:f},{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f}],type:f},{error:"Invalid Configuration: Missing Region",type:d}]},ruleSet=_data,defaultEndpointResolver=(e,t={})=>resolveEndpoint(ruleSet,{endpointParams:e,logger:t.logger});customEndpointFunctions.aws=awsEndpointFunctions;const getRuntimeConfig$1=e=>({apiVersion:"2014-11-06",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultSSMHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer}],logger:e?.logger??new NoOpLogger,serviceId:e?.serviceId??"SSM",urlParser:e?.urlParser??parseUrl,utf8Decoder:e?.utf8Decoder??fromUtf8$2,utf8Encoder:e?.utf8Encoder??toUtf8}),DEFAULTS_MODE_OPTIONS=["in-region","cross-region","mobile","standard","legacy"],resolveDefaultsModeConfig=({defaultsMode:e}={})=>memoize((async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(isMobileBrowser()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${t}`)}})),isMobileBrowser=()=>{const e="undefined"!=typeof window&&window?.navigator?.userAgent?bowser.parse(window.navigator.userAgent):void 0,t=e?.platform?.type;return"tablet"===t||"mobile"===t},getRuntimeConfig=e=>{const t=resolveDefaultsModeConfig(e),n=()=>t().then(loadConfigsForDefaultMode),r=getRuntimeConfig$1(e);return{...r,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??defaultUserAgent({serviceId:r.serviceId,clientVersion:packageInfo.version}),maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS,region:e?.region??invalidProvider("Region is missing"),requestHandler:FetchHttpHandler.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE),sha256:e?.sha256??Sha256,streamCollector:e?.streamCollector??streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT))}},getAwsRegionExtensionConfiguration=e=>{let t=async()=>{if(void 0===e.region)throw new Error("Region is missing from runtimeConfig");const t=e.region;return"string"==typeof t?t:t()};return{setRegion(e){t=e},region:()=>t}},resolveAwsRegionExtensionConfiguration=e=>({region:e.region()}),getHttpAuthExtensionConfiguration=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}},resolveHttpAuthRuntimeConfig=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),asPartial=e=>e,resolveRuntimeExtensions=(e,t)=>{const n={...asPartial(getAwsRegionExtensionConfiguration(e)),...asPartial(getDefaultExtensionConfiguration(e)),...asPartial(getHttpHandlerExtensionConfiguration(e)),...asPartial(getHttpAuthExtensionConfiguration(e))};return t.forEach((e=>e.configure(n))),{...e,...resolveAwsRegionExtensionConfiguration(n),...resolveDefaultRuntimeConfig(n),...resolveHttpHandlerRuntimeConfig(n),...resolveHttpAuthRuntimeConfig(n)}};class SSMClient extends Client{constructor(...[e]){const t=getRuntimeConfig(e||{}),n=resolveUserAgentConfig(resolveClientEndpointParameters(t)),r=resolveRetryConfig(n),i=resolveHostHeaderConfig(resolveRegionConfig(r)),s=resolveEndpointConfig(i),o=resolveHttpAuthSchemeConfig(s),a=resolveRuntimeExtensions(o,e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(getUserAgentPlugin(this.config)),this.middlewareStack.use(getRetryPlugin(this.config)),this.middlewareStack.use(getContentLengthPlugin(this.config)),this.middlewareStack.use(getHostHeaderPlugin(this.config)),this.middlewareStack.use(getLoggerPlugin(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:defaultSSMHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async e=>new DefaultIdentityProviderConfig({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class SSMServiceException extends ServiceException{constructor(e){super(e),Object.setPrototypeOf(this,SSMServiceException.prototype)}}class InternalServerError extends SSMServiceException{constructor(e){super({name:"InternalServerError",$fault:"server",...e}),this.name="InternalServerError",this.$fault="server",Object.setPrototypeOf(this,InternalServerError.prototype),this.Message=e.Message}}class InvalidResourceId extends SSMServiceException{constructor(e){super({name:"InvalidResourceId",$fault:"client",...e}),this.name="InvalidResourceId",this.$fault="client",Object.setPrototypeOf(this,InvalidResourceId.prototype)}}class InvalidResourceType extends SSMServiceException{constructor(e){super({name:"InvalidResourceType",$fault:"client",...e}),this.name="InvalidResourceType",this.$fault="client",Object.setPrototypeOf(this,InvalidResourceType.prototype)}}class TooManyTagsError extends SSMServiceException{constructor(e){super({name:"TooManyTagsError",$fault:"client",...e}),this.name="TooManyTagsError",this.$fault="client",Object.setPrototypeOf(this,TooManyTagsError.prototype)}}class TooManyUpdates extends SSMServiceException{constructor(e){super({name:"TooManyUpdates",$fault:"client",...e}),this.name="TooManyUpdates",this.$fault="client",Object.setPrototypeOf(this,TooManyUpdates.prototype),this.Message=e.Message}}class AlreadyExistsException extends SSMServiceException{constructor(e){super({name:"AlreadyExistsException",$fault:"client",...e}),this.name="AlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,AlreadyExistsException.prototype),this.Message=e.Message}}class OpsItemConflictException extends SSMServiceException{constructor(e){super({name:"OpsItemConflictException",$fault:"client",...e}),this.name="OpsItemConflictException",this.$fault="client",Object.setPrototypeOf(this,OpsItemConflictException.prototype),this.Message=e.Message}}class OpsItemInvalidParameterException extends SSMServiceException{constructor(e){super({name:"OpsItemInvalidParameterException",$fault:"client",...e}),this.name="OpsItemInvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,OpsItemInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class OpsItemLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsItemLimitExceededException",$fault:"client",...e}),this.name="OpsItemLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsItemLimitExceededException.prototype),this.ResourceTypes=e.ResourceTypes,this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class OpsItemNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsItemNotFoundException",$fault:"client",...e}),this.name="OpsItemNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsItemNotFoundException.prototype),this.Message=e.Message}}class OpsItemRelatedItemAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsItemRelatedItemAlreadyExistsException",$fault:"client",...e}),this.name="OpsItemRelatedItemAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsItemRelatedItemAlreadyExistsException.prototype),this.Message=e.Message,this.ResourceUri=e.ResourceUri,this.OpsItemId=e.OpsItemId}}class DuplicateInstanceId extends SSMServiceException{constructor(e){super({name:"DuplicateInstanceId",$fault:"client",...e}),this.name="DuplicateInstanceId",this.$fault="client",Object.setPrototypeOf(this,DuplicateInstanceId.prototype)}}class InvalidCommandId extends SSMServiceException{constructor(e){super({name:"InvalidCommandId",$fault:"client",...e}),this.name="InvalidCommandId",this.$fault="client",Object.setPrototypeOf(this,InvalidCommandId.prototype)}}class InvalidInstanceId extends SSMServiceException{constructor(e){super({name:"InvalidInstanceId",$fault:"client",...e}),this.name="InvalidInstanceId",this.$fault="client",Object.setPrototypeOf(this,InvalidInstanceId.prototype),this.Message=e.Message}}class DoesNotExistException extends SSMServiceException{constructor(e){super({name:"DoesNotExistException",$fault:"client",...e}),this.name="DoesNotExistException",this.$fault="client",Object.setPrototypeOf(this,DoesNotExistException.prototype),this.Message=e.Message}}class InvalidParameters extends SSMServiceException{constructor(e){super({name:"InvalidParameters",$fault:"client",...e}),this.name="InvalidParameters",this.$fault="client",Object.setPrototypeOf(this,InvalidParameters.prototype),this.Message=e.Message}}class AssociationAlreadyExists extends SSMServiceException{constructor(e){super({name:"AssociationAlreadyExists",$fault:"client",...e}),this.name="AssociationAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,AssociationAlreadyExists.prototype)}}class AssociationLimitExceeded extends SSMServiceException{constructor(e){super({name:"AssociationLimitExceeded",$fault:"client",...e}),this.name="AssociationLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,AssociationLimitExceeded.prototype)}}class InvalidDocument extends SSMServiceException{constructor(e){super({name:"InvalidDocument",$fault:"client",...e}),this.name="InvalidDocument",this.$fault="client",Object.setPrototypeOf(this,InvalidDocument.prototype),this.Message=e.Message}}class InvalidDocumentVersion extends SSMServiceException{constructor(e){super({name:"InvalidDocumentVersion",$fault:"client",...e}),this.name="InvalidDocumentVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentVersion.prototype),this.Message=e.Message}}class InvalidOutputLocation extends SSMServiceException{constructor(e){super({name:"InvalidOutputLocation",$fault:"client",...e}),this.name="InvalidOutputLocation",this.$fault="client",Object.setPrototypeOf(this,InvalidOutputLocation.prototype)}}class InvalidSchedule extends SSMServiceException{constructor(e){super({name:"InvalidSchedule",$fault:"client",...e}),this.name="InvalidSchedule",this.$fault="client",Object.setPrototypeOf(this,InvalidSchedule.prototype),this.Message=e.Message}}class InvalidTag extends SSMServiceException{constructor(e){super({name:"InvalidTag",$fault:"client",...e}),this.name="InvalidTag",this.$fault="client",Object.setPrototypeOf(this,InvalidTag.prototype),this.Message=e.Message}}class InvalidTarget extends SSMServiceException{constructor(e){super({name:"InvalidTarget",$fault:"client",...e}),this.name="InvalidTarget",this.$fault="client",Object.setPrototypeOf(this,InvalidTarget.prototype),this.Message=e.Message}}class InvalidTargetMaps extends SSMServiceException{constructor(e){super({name:"InvalidTargetMaps",$fault:"client",...e}),this.name="InvalidTargetMaps",this.$fault="client",Object.setPrototypeOf(this,InvalidTargetMaps.prototype),this.Message=e.Message}}class UnsupportedPlatformType extends SSMServiceException{constructor(e){super({name:"UnsupportedPlatformType",$fault:"client",...e}),this.name="UnsupportedPlatformType",this.$fault="client",Object.setPrototypeOf(this,UnsupportedPlatformType.prototype),this.Message=e.Message}}class DocumentAlreadyExists extends SSMServiceException{constructor(e){super({name:"DocumentAlreadyExists",$fault:"client",...e}),this.name="DocumentAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,DocumentAlreadyExists.prototype),this.Message=e.Message}}class DocumentLimitExceeded extends SSMServiceException{constructor(e){super({name:"DocumentLimitExceeded",$fault:"client",...e}),this.name="DocumentLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,DocumentLimitExceeded.prototype),this.Message=e.Message}}class InvalidDocumentContent extends SSMServiceException{constructor(e){super({name:"InvalidDocumentContent",$fault:"client",...e}),this.name="InvalidDocumentContent",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentContent.prototype),this.Message=e.Message}}class InvalidDocumentSchemaVersion extends SSMServiceException{constructor(e){super({name:"InvalidDocumentSchemaVersion",$fault:"client",...e}),this.name="InvalidDocumentSchemaVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentSchemaVersion.prototype),this.Message=e.Message}}class MaxDocumentSizeExceeded extends SSMServiceException{constructor(e){super({name:"MaxDocumentSizeExceeded",$fault:"client",...e}),this.name="MaxDocumentSizeExceeded",this.$fault="client",Object.setPrototypeOf(this,MaxDocumentSizeExceeded.prototype),this.Message=e.Message}}class IdempotentParameterMismatch extends SSMServiceException{constructor(e){super({name:"IdempotentParameterMismatch",$fault:"client",...e}),this.name="IdempotentParameterMismatch",this.$fault="client",Object.setPrototypeOf(this,IdempotentParameterMismatch.prototype),this.Message=e.Message}}class ResourceLimitExceededException extends SSMServiceException{constructor(e){super({name:"ResourceLimitExceededException",$fault:"client",...e}),this.name="ResourceLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceLimitExceededException.prototype),this.Message=e.Message}}class OpsItemAccessDeniedException extends SSMServiceException{constructor(e){super({name:"OpsItemAccessDeniedException",$fault:"client",...e}),this.name="OpsItemAccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,OpsItemAccessDeniedException.prototype),this.Message=e.Message}}class OpsItemAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsItemAlreadyExistsException",$fault:"client",...e}),this.name="OpsItemAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsItemAlreadyExistsException.prototype),this.Message=e.Message,this.OpsItemId=e.OpsItemId}}class OpsMetadataAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsMetadataAlreadyExistsException",$fault:"client",...e}),this.name="OpsMetadataAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataAlreadyExistsException.prototype)}}class OpsMetadataInvalidArgumentException extends SSMServiceException{constructor(e){super({name:"OpsMetadataInvalidArgumentException",$fault:"client",...e}),this.name="OpsMetadataInvalidArgumentException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataInvalidArgumentException.prototype)}}class OpsMetadataLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsMetadataLimitExceededException",$fault:"client",...e}),this.name="OpsMetadataLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataLimitExceededException.prototype)}}class OpsMetadataTooManyUpdatesException extends SSMServiceException{constructor(e){super({name:"OpsMetadataTooManyUpdatesException",$fault:"client",...e}),this.name="OpsMetadataTooManyUpdatesException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataTooManyUpdatesException.prototype)}}class ResourceDataSyncAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncAlreadyExistsException",$fault:"client",...e}),this.name="ResourceDataSyncAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncAlreadyExistsException.prototype),this.SyncName=e.SyncName}}class ResourceDataSyncCountExceededException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncCountExceededException",$fault:"client",...e}),this.name="ResourceDataSyncCountExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncCountExceededException.prototype),this.Message=e.Message}}class ResourceDataSyncInvalidConfigurationException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncInvalidConfigurationException",$fault:"client",...e}),this.name="ResourceDataSyncInvalidConfigurationException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncInvalidConfigurationException.prototype),this.Message=e.Message}}class InvalidActivation extends SSMServiceException{constructor(e){super({name:"InvalidActivation",$fault:"client",...e}),this.name="InvalidActivation",this.$fault="client",Object.setPrototypeOf(this,InvalidActivation.prototype),this.Message=e.Message}}class InvalidActivationId extends SSMServiceException{constructor(e){super({name:"InvalidActivationId",$fault:"client",...e}),this.name="InvalidActivationId",this.$fault="client",Object.setPrototypeOf(this,InvalidActivationId.prototype),this.Message=e.Message}}class AssociationDoesNotExist extends SSMServiceException{constructor(e){super({name:"AssociationDoesNotExist",$fault:"client",...e}),this.name="AssociationDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,AssociationDoesNotExist.prototype),this.Message=e.Message}}class AssociatedInstances extends SSMServiceException{constructor(e){super({name:"AssociatedInstances",$fault:"client",...e}),this.name="AssociatedInstances",this.$fault="client",Object.setPrototypeOf(this,AssociatedInstances.prototype)}}class InvalidDocumentOperation extends SSMServiceException{constructor(e){super({name:"InvalidDocumentOperation",$fault:"client",...e}),this.name="InvalidDocumentOperation",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentOperation.prototype),this.Message=e.Message}}class InvalidDeleteInventoryParametersException extends SSMServiceException{constructor(e){super({name:"InvalidDeleteInventoryParametersException",$fault:"client",...e}),this.name="InvalidDeleteInventoryParametersException",this.$fault="client",Object.setPrototypeOf(this,InvalidDeleteInventoryParametersException.prototype),this.Message=e.Message}}class InvalidInventoryRequestException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryRequestException",$fault:"client",...e}),this.name="InvalidInventoryRequestException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryRequestException.prototype),this.Message=e.Message}}class InvalidOptionException extends SSMServiceException{constructor(e){super({name:"InvalidOptionException",$fault:"client",...e}),this.name="InvalidOptionException",this.$fault="client",Object.setPrototypeOf(this,InvalidOptionException.prototype),this.Message=e.Message}}class InvalidTypeNameException extends SSMServiceException{constructor(e){super({name:"InvalidTypeNameException",$fault:"client",...e}),this.name="InvalidTypeNameException",this.$fault="client",Object.setPrototypeOf(this,InvalidTypeNameException.prototype),this.Message=e.Message}}class OpsMetadataNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsMetadataNotFoundException",$fault:"client",...e}),this.name="OpsMetadataNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataNotFoundException.prototype)}}class ParameterNotFound extends SSMServiceException{constructor(e){super({name:"ParameterNotFound",$fault:"client",...e}),this.name="ParameterNotFound",this.$fault="client",Object.setPrototypeOf(this,ParameterNotFound.prototype)}}class ResourceInUseException extends SSMServiceException{constructor(e){super({name:"ResourceInUseException",$fault:"client",...e}),this.name="ResourceInUseException",this.$fault="client",Object.setPrototypeOf(this,ResourceInUseException.prototype),this.Message=e.Message}}class ResourceDataSyncNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncNotFoundException",$fault:"client",...e}),this.name="ResourceDataSyncNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncNotFoundException.prototype),this.SyncName=e.SyncName,this.SyncType=e.SyncType,this.Message=e.Message}}class MalformedResourcePolicyDocumentException extends SSMServiceException{constructor(e){super({name:"MalformedResourcePolicyDocumentException",$fault:"client",...e}),this.name="MalformedResourcePolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,MalformedResourcePolicyDocumentException.prototype),this.Message=e.Message}}class ResourceNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourceNotFoundException.prototype),this.Message=e.Message}}class ResourcePolicyConflictException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyConflictException",$fault:"client",...e}),this.name="ResourcePolicyConflictException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyConflictException.prototype),this.Message=e.Message}}class ResourcePolicyInvalidParameterException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyInvalidParameterException",$fault:"client",...e}),this.name="ResourcePolicyInvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class ResourcePolicyNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyNotFoundException",$fault:"client",...e}),this.name="ResourcePolicyNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyNotFoundException.prototype),this.Message=e.Message}}class TargetInUseException extends SSMServiceException{constructor(e){super({name:"TargetInUseException",$fault:"client",...e}),this.name="TargetInUseException",this.$fault="client",Object.setPrototypeOf(this,TargetInUseException.prototype),this.Message=e.Message}}class InvalidFilter extends SSMServiceException{constructor(e){super({name:"InvalidFilter",$fault:"client",...e}),this.name="InvalidFilter",this.$fault="client",Object.setPrototypeOf(this,InvalidFilter.prototype),this.Message=e.Message}}class InvalidNextToken extends SSMServiceException{constructor(e){super({name:"InvalidNextToken",$fault:"client",...e}),this.name="InvalidNextToken",this.$fault="client",Object.setPrototypeOf(this,InvalidNextToken.prototype),this.Message=e.Message}}class InvalidAssociationVersion extends SSMServiceException{constructor(e){super({name:"InvalidAssociationVersion",$fault:"client",...e}),this.name="InvalidAssociationVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidAssociationVersion.prototype),this.Message=e.Message}}class AssociationExecutionDoesNotExist extends SSMServiceException{constructor(e){super({name:"AssociationExecutionDoesNotExist",$fault:"client",...e}),this.name="AssociationExecutionDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,AssociationExecutionDoesNotExist.prototype),this.Message=e.Message}}class InvalidFilterKey extends SSMServiceException{constructor(e){super({name:"InvalidFilterKey",$fault:"client",...e}),this.name="InvalidFilterKey",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterKey.prototype)}}class InvalidFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidFilterValue",$fault:"client",...e}),this.name="InvalidFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterValue.prototype),this.Message=e.Message}}class AutomationExecutionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationExecutionNotFoundException",$fault:"client",...e}),this.name="AutomationExecutionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationExecutionNotFoundException.prototype),this.Message=e.Message}}class InvalidPermissionType extends SSMServiceException{constructor(e){super({name:"InvalidPermissionType",$fault:"client",...e}),this.name="InvalidPermissionType",this.$fault="client",Object.setPrototypeOf(this,InvalidPermissionType.prototype),this.Message=e.Message}}class UnsupportedOperatingSystem extends SSMServiceException{constructor(e){super({name:"UnsupportedOperatingSystem",$fault:"client",...e}),this.name="UnsupportedOperatingSystem",this.$fault="client",Object.setPrototypeOf(this,UnsupportedOperatingSystem.prototype),this.Message=e.Message}}class InvalidInstanceInformationFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidInstanceInformationFilterValue",$fault:"client",...e}),this.name="InvalidInstanceInformationFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidInstanceInformationFilterValue.prototype)}}class InvalidInstancePropertyFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidInstancePropertyFilterValue",$fault:"client",...e}),this.name="InvalidInstancePropertyFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidInstancePropertyFilterValue.prototype)}}class InvalidDeletionIdException extends SSMServiceException{constructor(e){super({name:"InvalidDeletionIdException",$fault:"client",...e}),this.name="InvalidDeletionIdException",this.$fault="client",Object.setPrototypeOf(this,InvalidDeletionIdException.prototype),this.Message=e.Message}}class InvalidFilterOption extends SSMServiceException{constructor(e){super({name:"InvalidFilterOption",$fault:"client",...e}),this.name="InvalidFilterOption",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterOption.prototype)}}class OpsItemRelatedItemAssociationNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsItemRelatedItemAssociationNotFoundException",$fault:"client",...e}),this.name="OpsItemRelatedItemAssociationNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsItemRelatedItemAssociationNotFoundException.prototype),this.Message=e.Message}}class InvalidDocumentType extends SSMServiceException{constructor(e){super({name:"InvalidDocumentType",$fault:"client",...e}),this.name="InvalidDocumentType",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentType.prototype),this.Message=e.Message}}class UnsupportedCalendarException extends SSMServiceException{constructor(e){super({name:"UnsupportedCalendarException",$fault:"client",...e}),this.name="UnsupportedCalendarException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedCalendarException.prototype),this.Message=e.Message}}class InvalidPluginName extends SSMServiceException{constructor(e){super({name:"InvalidPluginName",$fault:"client",...e}),this.name="InvalidPluginName",this.$fault="client",Object.setPrototypeOf(this,InvalidPluginName.prototype)}}class InvocationDoesNotExist extends SSMServiceException{constructor(e){super({name:"InvocationDoesNotExist",$fault:"client",...e}),this.name="InvocationDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,InvocationDoesNotExist.prototype)}}class UnsupportedFeatureRequiredException extends SSMServiceException{constructor(e){super({name:"UnsupportedFeatureRequiredException",$fault:"client",...e}),this.name="UnsupportedFeatureRequiredException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedFeatureRequiredException.prototype),this.Message=e.Message}}class InvalidAggregatorException extends SSMServiceException{constructor(e){super({name:"InvalidAggregatorException",$fault:"client",...e}),this.name="InvalidAggregatorException",this.$fault="client",Object.setPrototypeOf(this,InvalidAggregatorException.prototype),this.Message=e.Message}}class InvalidInventoryGroupException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryGroupException",$fault:"client",...e}),this.name="InvalidInventoryGroupException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryGroupException.prototype),this.Message=e.Message}}class InvalidResultAttributeException extends SSMServiceException{constructor(e){super({name:"InvalidResultAttributeException",$fault:"client",...e}),this.name="InvalidResultAttributeException",this.$fault="client",Object.setPrototypeOf(this,InvalidResultAttributeException.prototype),this.Message=e.Message}}class InvalidKeyId extends SSMServiceException{constructor(e){super({name:"InvalidKeyId",$fault:"client",...e}),this.name="InvalidKeyId",this.$fault="client",Object.setPrototypeOf(this,InvalidKeyId.prototype)}}class ParameterVersionNotFound extends SSMServiceException{constructor(e){super({name:"ParameterVersionNotFound",$fault:"client",...e}),this.name="ParameterVersionNotFound",this.$fault="client",Object.setPrototypeOf(this,ParameterVersionNotFound.prototype)}}class ServiceSettingNotFound extends SSMServiceException{constructor(e){super({name:"ServiceSettingNotFound",$fault:"client",...e}),this.name="ServiceSettingNotFound",this.$fault="client",Object.setPrototypeOf(this,ServiceSettingNotFound.prototype),this.Message=e.Message}}class ParameterVersionLabelLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterVersionLabelLimitExceeded",$fault:"client",...e}),this.name="ParameterVersionLabelLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterVersionLabelLimitExceeded.prototype)}}class DocumentPermissionLimit extends SSMServiceException{constructor(e){super({name:"DocumentPermissionLimit",$fault:"client",...e}),this.name="DocumentPermissionLimit",this.$fault="client",Object.setPrototypeOf(this,DocumentPermissionLimit.prototype),this.Message=e.Message}}class ComplianceTypeCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"ComplianceTypeCountLimitExceededException",$fault:"client",...e}),this.name="ComplianceTypeCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ComplianceTypeCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidItemContentException extends SSMServiceException{constructor(e){super({name:"InvalidItemContentException",$fault:"client",...e}),this.name="InvalidItemContentException",this.$fault="client",Object.setPrototypeOf(this,InvalidItemContentException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class ItemSizeLimitExceededException extends SSMServiceException{constructor(e){super({name:"ItemSizeLimitExceededException",$fault:"client",...e}),this.name="ItemSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ItemSizeLimitExceededException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class TotalSizeLimitExceededException extends SSMServiceException{constructor(e){super({name:"TotalSizeLimitExceededException",$fault:"client",...e}),this.name="TotalSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,TotalSizeLimitExceededException.prototype),this.Message=e.Message}}class CustomSchemaCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"CustomSchemaCountLimitExceededException",$fault:"client",...e}),this.name="CustomSchemaCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,CustomSchemaCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidInventoryItemContextException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryItemContextException",$fault:"client",...e}),this.name="InvalidInventoryItemContextException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryItemContextException.prototype),this.Message=e.Message}}class ItemContentMismatchException extends SSMServiceException{constructor(e){super({name:"ItemContentMismatchException",$fault:"client",...e}),this.name="ItemContentMismatchException",this.$fault="client",Object.setPrototypeOf(this,ItemContentMismatchException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class SubTypeCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"SubTypeCountLimitExceededException",$fault:"client",...e}),this.name="SubTypeCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,SubTypeCountLimitExceededException.prototype),this.Message=e.Message}}class UnsupportedInventoryItemContextException extends SSMServiceException{constructor(e){super({name:"UnsupportedInventoryItemContextException",$fault:"client",...e}),this.name="UnsupportedInventoryItemContextException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedInventoryItemContextException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class UnsupportedInventorySchemaVersionException extends SSMServiceException{constructor(e){super({name:"UnsupportedInventorySchemaVersionException",$fault:"client",...e}),this.name="UnsupportedInventorySchemaVersionException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedInventorySchemaVersionException.prototype),this.Message=e.Message}}class HierarchyLevelLimitExceededException extends SSMServiceException{constructor(e){super({name:"HierarchyLevelLimitExceededException",$fault:"client",...e}),this.name="HierarchyLevelLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,HierarchyLevelLimitExceededException.prototype)}}class HierarchyTypeMismatchException extends SSMServiceException{constructor(e){super({name:"HierarchyTypeMismatchException",$fault:"client",...e}),this.name="HierarchyTypeMismatchException",this.$fault="client",Object.setPrototypeOf(this,HierarchyTypeMismatchException.prototype)}}class IncompatiblePolicyException extends SSMServiceException{constructor(e){super({name:"IncompatiblePolicyException",$fault:"client",...e}),this.name="IncompatiblePolicyException",this.$fault="client",Object.setPrototypeOf(this,IncompatiblePolicyException.prototype)}}class InvalidAllowedPatternException extends SSMServiceException{constructor(e){super({name:"InvalidAllowedPatternException",$fault:"client",...e}),this.name="InvalidAllowedPatternException",this.$fault="client",Object.setPrototypeOf(this,InvalidAllowedPatternException.prototype)}}class InvalidPolicyAttributeException extends SSMServiceException{constructor(e){super({name:"InvalidPolicyAttributeException",$fault:"client",...e}),this.name="InvalidPolicyAttributeException",this.$fault="client",Object.setPrototypeOf(this,InvalidPolicyAttributeException.prototype)}}class InvalidPolicyTypeException extends SSMServiceException{constructor(e){super({name:"InvalidPolicyTypeException",$fault:"client",...e}),this.name="InvalidPolicyTypeException",this.$fault="client",Object.setPrototypeOf(this,InvalidPolicyTypeException.prototype)}}class ParameterAlreadyExists extends SSMServiceException{constructor(e){super({name:"ParameterAlreadyExists",$fault:"client",...e}),this.name="ParameterAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,ParameterAlreadyExists.prototype)}}class ParameterLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterLimitExceeded",$fault:"client",...e}),this.name="ParameterLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterLimitExceeded.prototype)}}class ParameterMaxVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterMaxVersionLimitExceeded",$fault:"client",...e}),this.name="ParameterMaxVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterMaxVersionLimitExceeded.prototype)}}class ParameterPatternMismatchException extends SSMServiceException{constructor(e){super({name:"ParameterPatternMismatchException",$fault:"client",...e}),this.name="ParameterPatternMismatchException",this.$fault="client",Object.setPrototypeOf(this,ParameterPatternMismatchException.prototype)}}class PoliciesLimitExceededException extends SSMServiceException{constructor(e){super({name:"PoliciesLimitExceededException",$fault:"client",...e}),this.name="PoliciesLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,PoliciesLimitExceededException.prototype)}}class UnsupportedParameterType extends SSMServiceException{constructor(e){super({name:"UnsupportedParameterType",$fault:"client",...e}),this.name="UnsupportedParameterType",this.$fault="client",Object.setPrototypeOf(this,UnsupportedParameterType.prototype)}}class ResourcePolicyLimitExceededException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyLimitExceededException",$fault:"client",...e}),this.name="ResourcePolicyLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyLimitExceededException.prototype),this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class FeatureNotAvailableException extends SSMServiceException{constructor(e){super({name:"FeatureNotAvailableException",$fault:"client",...e}),this.name="FeatureNotAvailableException",this.$fault="client",Object.setPrototypeOf(this,FeatureNotAvailableException.prototype),this.Message=e.Message}}class AutomationStepNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationStepNotFoundException",$fault:"client",...e}),this.name="AutomationStepNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationStepNotFoundException.prototype),this.Message=e.Message}}class InvalidAutomationSignalException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationSignalException",$fault:"client",...e}),this.name="InvalidAutomationSignalException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationSignalException.prototype),this.Message=e.Message}}class InvalidNotificationConfig extends SSMServiceException{constructor(e){super({name:"InvalidNotificationConfig",$fault:"client",...e}),this.name="InvalidNotificationConfig",this.$fault="client",Object.setPrototypeOf(this,InvalidNotificationConfig.prototype),this.Message=e.Message}}class InvalidOutputFolder extends SSMServiceException{constructor(e){super({name:"InvalidOutputFolder",$fault:"client",...e}),this.name="InvalidOutputFolder",this.$fault="client",Object.setPrototypeOf(this,InvalidOutputFolder.prototype)}}class InvalidRole extends SSMServiceException{constructor(e){super({name:"InvalidRole",$fault:"client",...e}),this.name="InvalidRole",this.$fault="client",Object.setPrototypeOf(this,InvalidRole.prototype),this.Message=e.Message}}class InvalidAssociation extends SSMServiceException{constructor(e){super({name:"InvalidAssociation",$fault:"client",...e}),this.name="InvalidAssociation",this.$fault="client",Object.setPrototypeOf(this,InvalidAssociation.prototype),this.Message=e.Message}}class AutomationDefinitionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionNotFoundException",$fault:"client",...e}),this.name="AutomationDefinitionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionNotFoundException.prototype),this.Message=e.Message}}class AutomationDefinitionVersionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionVersionNotFoundException",$fault:"client",...e}),this.name="AutomationDefinitionVersionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionVersionNotFoundException.prototype),this.Message=e.Message}}class AutomationExecutionLimitExceededException extends SSMServiceException{constructor(e){super({name:"AutomationExecutionLimitExceededException",$fault:"client",...e}),this.name="AutomationExecutionLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,AutomationExecutionLimitExceededException.prototype),this.Message=e.Message}}class InvalidAutomationExecutionParametersException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationExecutionParametersException",$fault:"client",...e}),this.name="InvalidAutomationExecutionParametersException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationExecutionParametersException.prototype),this.Message=e.Message}}const ParameterFilterSensitiveLog=e=>({...e,...e.Value&&{Value:SENSITIVE_STRING}}),GetParameterResultFilterSensitiveLog=e=>({...e,...e.Parameter&&{Parameter:ParameterFilterSensitiveLog(e.Parameter)}}),GetParametersResultFilterSensitiveLog=e=>({...e,...e.Parameters&&{Parameters:e.Parameters.map((e=>ParameterFilterSensitiveLog(e)))}});class AutomationDefinitionNotApprovedException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionNotApprovedException",$fault:"client",...e}),this.name="AutomationDefinitionNotApprovedException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionNotApprovedException.prototype),this.Message=e.Message}}class TargetNotConnected extends SSMServiceException{constructor(e){super({name:"TargetNotConnected",$fault:"client",...e}),this.name="TargetNotConnected",this.$fault="client",Object.setPrototypeOf(this,TargetNotConnected.prototype),this.Message=e.Message}}class InvalidAutomationStatusUpdateException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationStatusUpdateException",$fault:"client",...e}),this.name="InvalidAutomationStatusUpdateException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationStatusUpdateException.prototype),this.Message=e.Message}}class AssociationVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"AssociationVersionLimitExceeded",$fault:"client",...e}),this.name="AssociationVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,AssociationVersionLimitExceeded.prototype),this.Message=e.Message}}class InvalidUpdate extends SSMServiceException{constructor(e){super({name:"InvalidUpdate",$fault:"client",...e}),this.name="InvalidUpdate",this.$fault="client",Object.setPrototypeOf(this,InvalidUpdate.prototype),this.Message=e.Message}}class StatusUnchanged extends SSMServiceException{constructor(e){super({name:"StatusUnchanged",$fault:"client",...e}),this.name="StatusUnchanged",this.$fault="client",Object.setPrototypeOf(this,StatusUnchanged.prototype)}}class DocumentVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"DocumentVersionLimitExceeded",$fault:"client",...e}),this.name="DocumentVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,DocumentVersionLimitExceeded.prototype),this.Message=e.Message}}class DuplicateDocumentContent extends SSMServiceException{constructor(e){super({name:"DuplicateDocumentContent",$fault:"client",...e}),this.name="DuplicateDocumentContent",this.$fault="client",Object.setPrototypeOf(this,DuplicateDocumentContent.prototype),this.Message=e.Message}}class DuplicateDocumentVersionName extends SSMServiceException{constructor(e){super({name:"DuplicateDocumentVersionName",$fault:"client",...e}),this.name="DuplicateDocumentVersionName",this.$fault="client",Object.setPrototypeOf(this,DuplicateDocumentVersionName.prototype),this.Message=e.Message}}class OpsMetadataKeyLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsMetadataKeyLimitExceededException",$fault:"client",...e}),this.name="OpsMetadataKeyLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataKeyLimitExceededException.prototype)}}class ResourceDataSyncConflictException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncConflictException",$fault:"client",...e}),this.name="ResourceDataSyncConflictException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncConflictException.prototype),this.Message=e.Message}}const se_GetParameterCommand=async(e,t)=>{const n=sharedHeaders("GetParameter");let r;return r=JSON.stringify(_json(e)),buildHttpRpcRequest(t,n,"/",void 0,r)},se_GetParametersCommand=async(e,t)=>{const n=sharedHeaders("GetParameters");let r;return r=JSON.stringify(_json(e)),buildHttpRpcRequest(t,n,"/",void 0,r)},de_GetParameterCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody(e.body,t);let r={};r=de_GetParameterResult(n);return{$metadata:deserializeMetadata(e),...r}},de_GetParametersCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody(e.body,t);let r={};r=de_GetParametersResult(n);return{$metadata:deserializeMetadata(e),...r}},de_CommandError=async(e,t)=>{const n={...e,body:await parseJsonErrorBody(e.body,t)},r=loadRestJsonErrorCode(e,n.body);switch(r){case"InternalServerError":case"com.amazonaws.ssm#InternalServerError":throw await de_InternalServerErrorRes(n);case"InvalidResourceId":case"com.amazonaws.ssm#InvalidResourceId":throw await de_InvalidResourceIdRes(n);case"InvalidResourceType":case"com.amazonaws.ssm#InvalidResourceType":throw await de_InvalidResourceTypeRes(n);case"TooManyTagsError":case"com.amazonaws.ssm#TooManyTagsError":throw await de_TooManyTagsErrorRes(n);case"TooManyUpdates":case"com.amazonaws.ssm#TooManyUpdates":throw await de_TooManyUpdatesRes(n);case"OpsItemConflictException":case"com.amazonaws.ssm#OpsItemConflictException":throw await de_OpsItemConflictExceptionRes(n);case"OpsItemInvalidParameterException":case"com.amazonaws.ssm#OpsItemInvalidParameterException":throw await de_OpsItemInvalidParameterExceptionRes(n);case"OpsItemLimitExceededException":case"com.amazonaws.ssm#OpsItemLimitExceededException":throw await de_OpsItemLimitExceededExceptionRes(n);case"OpsItemNotFoundException":case"com.amazonaws.ssm#OpsItemNotFoundException":throw await de_OpsItemNotFoundExceptionRes(n);case"OpsItemRelatedItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemRelatedItemAlreadyExistsException":throw await de_OpsItemRelatedItemAlreadyExistsExceptionRes(n);case"DuplicateInstanceId":case"com.amazonaws.ssm#DuplicateInstanceId":throw await de_DuplicateInstanceIdRes(n);case"InvalidCommandId":case"com.amazonaws.ssm#InvalidCommandId":throw await de_InvalidCommandIdRes(n);case"InvalidInstanceId":case"com.amazonaws.ssm#InvalidInstanceId":throw await de_InvalidInstanceIdRes(n);case"DoesNotExistException":case"com.amazonaws.ssm#DoesNotExistException":throw await de_DoesNotExistExceptionRes(n);case"InvalidParameters":case"com.amazonaws.ssm#InvalidParameters":throw await de_InvalidParametersRes(n);case"AssociationAlreadyExists":case"com.amazonaws.ssm#AssociationAlreadyExists":throw await de_AssociationAlreadyExistsRes(n);case"AssociationLimitExceeded":case"com.amazonaws.ssm#AssociationLimitExceeded":throw await de_AssociationLimitExceededRes(n);case"InvalidDocument":case"com.amazonaws.ssm#InvalidDocument":throw await de_InvalidDocumentRes(n);case"InvalidDocumentVersion":case"com.amazonaws.ssm#InvalidDocumentVersion":throw await de_InvalidDocumentVersionRes(n);case"InvalidOutputLocation":case"com.amazonaws.ssm#InvalidOutputLocation":throw await de_InvalidOutputLocationRes(n);case"InvalidSchedule":case"com.amazonaws.ssm#InvalidSchedule":throw await de_InvalidScheduleRes(n);case"InvalidTag":case"com.amazonaws.ssm#InvalidTag":throw await de_InvalidTagRes(n);case"InvalidTarget":case"com.amazonaws.ssm#InvalidTarget":throw await de_InvalidTargetRes(n);case"InvalidTargetMaps":case"com.amazonaws.ssm#InvalidTargetMaps":throw await de_InvalidTargetMapsRes(n);case"UnsupportedPlatformType":case"com.amazonaws.ssm#UnsupportedPlatformType":throw await de_UnsupportedPlatformTypeRes(n);case"DocumentAlreadyExists":case"com.amazonaws.ssm#DocumentAlreadyExists":throw await de_DocumentAlreadyExistsRes(n);case"DocumentLimitExceeded":case"com.amazonaws.ssm#DocumentLimitExceeded":throw await de_DocumentLimitExceededRes(n);case"InvalidDocumentContent":case"com.amazonaws.ssm#InvalidDocumentContent":throw await de_InvalidDocumentContentRes(n);case"InvalidDocumentSchemaVersion":case"com.amazonaws.ssm#InvalidDocumentSchemaVersion":throw await de_InvalidDocumentSchemaVersionRes(n);case"MaxDocumentSizeExceeded":case"com.amazonaws.ssm#MaxDocumentSizeExceeded":throw await de_MaxDocumentSizeExceededRes(n);case"IdempotentParameterMismatch":case"com.amazonaws.ssm#IdempotentParameterMismatch":throw await de_IdempotentParameterMismatchRes(n);case"ResourceLimitExceededException":case"com.amazonaws.ssm#ResourceLimitExceededException":throw await de_ResourceLimitExceededExceptionRes(n);case"OpsItemAccessDeniedException":case"com.amazonaws.ssm#OpsItemAccessDeniedException":throw await de_OpsItemAccessDeniedExceptionRes(n);case"OpsItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemAlreadyExistsException":throw await de_OpsItemAlreadyExistsExceptionRes(n);case"OpsMetadataAlreadyExistsException":case"com.amazonaws.ssm#OpsMetadataAlreadyExistsException":throw await de_OpsMetadataAlreadyExistsExceptionRes(n);case"OpsMetadataInvalidArgumentException":case"com.amazonaws.ssm#OpsMetadataInvalidArgumentException":throw await de_OpsMetadataInvalidArgumentExceptionRes(n);case"OpsMetadataLimitExceededException":case"com.amazonaws.ssm#OpsMetadataLimitExceededException":throw await de_OpsMetadataLimitExceededExceptionRes(n);case"OpsMetadataTooManyUpdatesException":case"com.amazonaws.ssm#OpsMetadataTooManyUpdatesException":throw await de_OpsMetadataTooManyUpdatesExceptionRes(n);case"ResourceDataSyncAlreadyExistsException":case"com.amazonaws.ssm#ResourceDataSyncAlreadyExistsException":throw await de_ResourceDataSyncAlreadyExistsExceptionRes(n);case"ResourceDataSyncCountExceededException":case"com.amazonaws.ssm#ResourceDataSyncCountExceededException":throw await de_ResourceDataSyncCountExceededExceptionRes(n);case"ResourceDataSyncInvalidConfigurationException":case"com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(n);case"InvalidActivation":case"com.amazonaws.ssm#InvalidActivation":throw await de_InvalidActivationRes(n);case"InvalidActivationId":case"com.amazonaws.ssm#InvalidActivationId":throw await de_InvalidActivationIdRes(n);case"AssociationDoesNotExist":case"com.amazonaws.ssm#AssociationDoesNotExist":throw await de_AssociationDoesNotExistRes(n);case"AssociatedInstances":case"com.amazonaws.ssm#AssociatedInstances":throw await de_AssociatedInstancesRes(n);case"InvalidDocumentOperation":case"com.amazonaws.ssm#InvalidDocumentOperation":throw await de_InvalidDocumentOperationRes(n);case"InvalidDeleteInventoryParametersException":case"com.amazonaws.ssm#InvalidDeleteInventoryParametersException":throw await de_InvalidDeleteInventoryParametersExceptionRes(n);case"InvalidInventoryRequestException":case"com.amazonaws.ssm#InvalidInventoryRequestException":throw await de_InvalidInventoryRequestExceptionRes(n);case"InvalidOptionException":case"com.amazonaws.ssm#InvalidOptionException":throw await de_InvalidOptionExceptionRes(n);case"InvalidTypeNameException":case"com.amazonaws.ssm#InvalidTypeNameException":throw await de_InvalidTypeNameExceptionRes(n);case"OpsMetadataNotFoundException":case"com.amazonaws.ssm#OpsMetadataNotFoundException":throw await de_OpsMetadataNotFoundExceptionRes(n);case"ParameterNotFound":case"com.amazonaws.ssm#ParameterNotFound":throw await de_ParameterNotFoundRes(n);case"ResourceInUseException":case"com.amazonaws.ssm#ResourceInUseException":throw await de_ResourceInUseExceptionRes(n);case"ResourceDataSyncNotFoundException":case"com.amazonaws.ssm#ResourceDataSyncNotFoundException":throw await de_ResourceDataSyncNotFoundExceptionRes(n);case"MalformedResourcePolicyDocumentException":case"com.amazonaws.ssm#MalformedResourcePolicyDocumentException":throw await de_MalformedResourcePolicyDocumentExceptionRes(n);case"ResourceNotFoundException":case"com.amazonaws.ssm#ResourceNotFoundException":throw await de_ResourceNotFoundExceptionRes(n);case"ResourcePolicyConflictException":case"com.amazonaws.ssm#ResourcePolicyConflictException":throw await de_ResourcePolicyConflictExceptionRes(n);case"ResourcePolicyInvalidParameterException":case"com.amazonaws.ssm#ResourcePolicyInvalidParameterException":throw await de_ResourcePolicyInvalidParameterExceptionRes(n);case"ResourcePolicyNotFoundException":case"com.amazonaws.ssm#ResourcePolicyNotFoundException":throw await de_ResourcePolicyNotFoundExceptionRes(n);case"TargetInUseException":case"com.amazonaws.ssm#TargetInUseException":throw await de_TargetInUseExceptionRes(n);case"InvalidFilter":case"com.amazonaws.ssm#InvalidFilter":throw await de_InvalidFilterRes(n);case"InvalidNextToken":case"com.amazonaws.ssm#InvalidNextToken":throw await de_InvalidNextTokenRes(n);case"InvalidAssociationVersion":case"com.amazonaws.ssm#InvalidAssociationVersion":throw await de_InvalidAssociationVersionRes(n);case"AssociationExecutionDoesNotExist":case"com.amazonaws.ssm#AssociationExecutionDoesNotExist":throw await de_AssociationExecutionDoesNotExistRes(n);case"InvalidFilterKey":case"com.amazonaws.ssm#InvalidFilterKey":throw await de_InvalidFilterKeyRes(n);case"InvalidFilterValue":case"com.amazonaws.ssm#InvalidFilterValue":throw await de_InvalidFilterValueRes(n);case"AutomationExecutionNotFoundException":case"com.amazonaws.ssm#AutomationExecutionNotFoundException":throw await de_AutomationExecutionNotFoundExceptionRes(n);case"InvalidPermissionType":case"com.amazonaws.ssm#InvalidPermissionType":throw await de_InvalidPermissionTypeRes(n);case"UnsupportedOperatingSystem":case"com.amazonaws.ssm#UnsupportedOperatingSystem":throw await de_UnsupportedOperatingSystemRes(n);case"InvalidInstanceInformationFilterValue":case"com.amazonaws.ssm#InvalidInstanceInformationFilterValue":throw await de_InvalidInstanceInformationFilterValueRes(n);case"InvalidInstancePropertyFilterValue":case"com.amazonaws.ssm#InvalidInstancePropertyFilterValue":throw await de_InvalidInstancePropertyFilterValueRes(n);case"InvalidDeletionIdException":case"com.amazonaws.ssm#InvalidDeletionIdException":throw await de_InvalidDeletionIdExceptionRes(n);case"InvalidFilterOption":case"com.amazonaws.ssm#InvalidFilterOption":throw await de_InvalidFilterOptionRes(n);case"OpsItemRelatedItemAssociationNotFoundException":case"com.amazonaws.ssm#OpsItemRelatedItemAssociationNotFoundException":throw await de_OpsItemRelatedItemAssociationNotFoundExceptionRes(n);case"InvalidDocumentType":case"com.amazonaws.ssm#InvalidDocumentType":throw await de_InvalidDocumentTypeRes(n);case"UnsupportedCalendarException":case"com.amazonaws.ssm#UnsupportedCalendarException":throw await de_UnsupportedCalendarExceptionRes(n);case"InvalidPluginName":case"com.amazonaws.ssm#InvalidPluginName":throw await de_InvalidPluginNameRes(n);case"InvocationDoesNotExist":case"com.amazonaws.ssm#InvocationDoesNotExist":throw await de_InvocationDoesNotExistRes(n);case"UnsupportedFeatureRequiredException":case"com.amazonaws.ssm#UnsupportedFeatureRequiredException":throw await de_UnsupportedFeatureRequiredExceptionRes(n);case"InvalidAggregatorException":case"com.amazonaws.ssm#InvalidAggregatorException":throw await de_InvalidAggregatorExceptionRes(n);case"InvalidInventoryGroupException":case"com.amazonaws.ssm#InvalidInventoryGroupException":throw await de_InvalidInventoryGroupExceptionRes(n);case"InvalidResultAttributeException":case"com.amazonaws.ssm#InvalidResultAttributeException":throw await de_InvalidResultAttributeExceptionRes(n);case"InvalidKeyId":case"com.amazonaws.ssm#InvalidKeyId":throw await de_InvalidKeyIdRes(n);case"ParameterVersionNotFound":case"com.amazonaws.ssm#ParameterVersionNotFound":throw await de_ParameterVersionNotFoundRes(n);case"ServiceSettingNotFound":case"com.amazonaws.ssm#ServiceSettingNotFound":throw await de_ServiceSettingNotFoundRes(n);case"ParameterVersionLabelLimitExceeded":case"com.amazonaws.ssm#ParameterVersionLabelLimitExceeded":throw await de_ParameterVersionLabelLimitExceededRes(n);case"DocumentPermissionLimit":case"com.amazonaws.ssm#DocumentPermissionLimit":throw await de_DocumentPermissionLimitRes(n);case"ComplianceTypeCountLimitExceededException":case"com.amazonaws.ssm#ComplianceTypeCountLimitExceededException":throw await de_ComplianceTypeCountLimitExceededExceptionRes(n);case"InvalidItemContentException":case"com.amazonaws.ssm#InvalidItemContentException":throw await de_InvalidItemContentExceptionRes(n);case"ItemSizeLimitExceededException":case"com.amazonaws.ssm#ItemSizeLimitExceededException":throw await de_ItemSizeLimitExceededExceptionRes(n);case"TotalSizeLimitExceededException":case"com.amazonaws.ssm#TotalSizeLimitExceededException":throw await de_TotalSizeLimitExceededExceptionRes(n);case"CustomSchemaCountLimitExceededException":case"com.amazonaws.ssm#CustomSchemaCountLimitExceededException":throw await de_CustomSchemaCountLimitExceededExceptionRes(n);case"InvalidInventoryItemContextException":case"com.amazonaws.ssm#InvalidInventoryItemContextException":throw await de_InvalidInventoryItemContextExceptionRes(n);case"ItemContentMismatchException":case"com.amazonaws.ssm#ItemContentMismatchException":throw await de_ItemContentMismatchExceptionRes(n);case"SubTypeCountLimitExceededException":case"com.amazonaws.ssm#SubTypeCountLimitExceededException":throw await de_SubTypeCountLimitExceededExceptionRes(n);case"UnsupportedInventoryItemContextException":case"com.amazonaws.ssm#UnsupportedInventoryItemContextException":throw await de_UnsupportedInventoryItemContextExceptionRes(n);case"UnsupportedInventorySchemaVersionException":case"com.amazonaws.ssm#UnsupportedInventorySchemaVersionException":throw await de_UnsupportedInventorySchemaVersionExceptionRes(n);case"HierarchyLevelLimitExceededException":case"com.amazonaws.ssm#HierarchyLevelLimitExceededException":throw await de_HierarchyLevelLimitExceededExceptionRes(n);case"HierarchyTypeMismatchException":case"com.amazonaws.ssm#HierarchyTypeMismatchException":throw await de_HierarchyTypeMismatchExceptionRes(n);case"IncompatiblePolicyException":case"com.amazonaws.ssm#IncompatiblePolicyException":throw await de_IncompatiblePolicyExceptionRes(n);case"InvalidAllowedPatternException":case"com.amazonaws.ssm#InvalidAllowedPatternException":throw await de_InvalidAllowedPatternExceptionRes(n);case"InvalidPolicyAttributeException":case"com.amazonaws.ssm#InvalidPolicyAttributeException":throw await de_InvalidPolicyAttributeExceptionRes(n);case"InvalidPolicyTypeException":case"com.amazonaws.ssm#InvalidPolicyTypeException":throw await de_InvalidPolicyTypeExceptionRes(n);case"ParameterAlreadyExists":case"com.amazonaws.ssm#ParameterAlreadyExists":throw await de_ParameterAlreadyExistsRes(n);case"ParameterLimitExceeded":case"com.amazonaws.ssm#ParameterLimitExceeded":throw await de_ParameterLimitExceededRes(n);case"ParameterMaxVersionLimitExceeded":case"com.amazonaws.ssm#ParameterMaxVersionLimitExceeded":throw await de_ParameterMaxVersionLimitExceededRes(n);case"ParameterPatternMismatchException":case"com.amazonaws.ssm#ParameterPatternMismatchException":throw await de_ParameterPatternMismatchExceptionRes(n);case"PoliciesLimitExceededException":case"com.amazonaws.ssm#PoliciesLimitExceededException":throw await de_PoliciesLimitExceededExceptionRes(n);case"UnsupportedParameterType":case"com.amazonaws.ssm#UnsupportedParameterType":throw await de_UnsupportedParameterTypeRes(n);case"ResourcePolicyLimitExceededException":case"com.amazonaws.ssm#ResourcePolicyLimitExceededException":throw await de_ResourcePolicyLimitExceededExceptionRes(n);case"AlreadyExistsException":case"com.amazonaws.ssm#AlreadyExistsException":throw await de_AlreadyExistsExceptionRes(n);case"FeatureNotAvailableException":case"com.amazonaws.ssm#FeatureNotAvailableException":throw await de_FeatureNotAvailableExceptionRes(n);case"AutomationStepNotFoundException":case"com.amazonaws.ssm#AutomationStepNotFoundException":throw await de_AutomationStepNotFoundExceptionRes(n);case"InvalidAutomationSignalException":case"com.amazonaws.ssm#InvalidAutomationSignalException":throw await de_InvalidAutomationSignalExceptionRes(n);case"InvalidNotificationConfig":case"com.amazonaws.ssm#InvalidNotificationConfig":throw await de_InvalidNotificationConfigRes(n);case"InvalidOutputFolder":case"com.amazonaws.ssm#InvalidOutputFolder":throw await de_InvalidOutputFolderRes(n);case"InvalidRole":case"com.amazonaws.ssm#InvalidRole":throw await de_InvalidRoleRes(n);case"InvalidAssociation":case"com.amazonaws.ssm#InvalidAssociation":throw await de_InvalidAssociationRes(n);case"AutomationDefinitionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionNotFoundException":throw await de_AutomationDefinitionNotFoundExceptionRes(n);case"AutomationDefinitionVersionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionVersionNotFoundException":throw await de_AutomationDefinitionVersionNotFoundExceptionRes(n);case"AutomationExecutionLimitExceededException":case"com.amazonaws.ssm#AutomationExecutionLimitExceededException":throw await de_AutomationExecutionLimitExceededExceptionRes(n);case"InvalidAutomationExecutionParametersException":case"com.amazonaws.ssm#InvalidAutomationExecutionParametersException":throw await de_InvalidAutomationExecutionParametersExceptionRes(n);case"AutomationDefinitionNotApprovedException":case"com.amazonaws.ssm#AutomationDefinitionNotApprovedException":throw await de_AutomationDefinitionNotApprovedExceptionRes(n);case"TargetNotConnected":case"com.amazonaws.ssm#TargetNotConnected":throw await de_TargetNotConnectedRes(n);case"InvalidAutomationStatusUpdateException":case"com.amazonaws.ssm#InvalidAutomationStatusUpdateException":throw await de_InvalidAutomationStatusUpdateExceptionRes(n);case"AssociationVersionLimitExceeded":case"com.amazonaws.ssm#AssociationVersionLimitExceeded":throw await de_AssociationVersionLimitExceededRes(n);case"InvalidUpdate":case"com.amazonaws.ssm#InvalidUpdate":throw await de_InvalidUpdateRes(n);case"StatusUnchanged":case"com.amazonaws.ssm#StatusUnchanged":throw await de_StatusUnchangedRes(n);case"DocumentVersionLimitExceeded":case"com.amazonaws.ssm#DocumentVersionLimitExceeded":throw await de_DocumentVersionLimitExceededRes(n);case"DuplicateDocumentContent":case"com.amazonaws.ssm#DuplicateDocumentContent":throw await de_DuplicateDocumentContentRes(n);case"DuplicateDocumentVersionName":case"com.amazonaws.ssm#DuplicateDocumentVersionName":throw await de_DuplicateDocumentVersionNameRes(n);case"OpsMetadataKeyLimitExceededException":case"com.amazonaws.ssm#OpsMetadataKeyLimitExceededException":throw await de_OpsMetadataKeyLimitExceededExceptionRes(n);case"ResourceDataSyncConflictException":case"com.amazonaws.ssm#ResourceDataSyncConflictException":throw await de_ResourceDataSyncConflictExceptionRes(n);default:const t=n.body;return throwDefaultError({output:e,parsedBody:t,errorCode:r})}},de_AlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociatedInstancesRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociatedInstances({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationExecutionDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationExecutionDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionNotApprovedExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionNotApprovedException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionVersionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionVersionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationExecutionLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationExecutionLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationExecutionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationExecutionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationStepNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationStepNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ComplianceTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ComplianceTypeCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_CustomSchemaCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new CustomSchemaCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentPermissionLimitRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentPermissionLimit({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DoesNotExistExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DoesNotExistException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateDocumentContentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateDocumentContent({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateDocumentVersionNameRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateDocumentVersionName({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateInstanceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateInstanceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_FeatureNotAvailableExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new FeatureNotAvailableException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_HierarchyLevelLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new HierarchyLevelLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_HierarchyTypeMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new HierarchyTypeMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_IdempotentParameterMismatchRes=async(e,t)=>{const n=e.body,r=_json(n),i=new IdempotentParameterMismatch({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_IncompatiblePolicyExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new IncompatiblePolicyException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InternalServerErrorRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InternalServerError({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidActivationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidActivation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidActivationIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidActivationId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAggregatorExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAggregatorException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAllowedPatternExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAllowedPatternException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAssociationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAssociation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAssociationVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAssociationVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationExecutionParametersExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationExecutionParametersException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationSignalExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationSignalException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationStatusUpdateExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationStatusUpdateException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidCommandIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidCommandId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDeleteInventoryParametersExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDeleteInventoryParametersException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDeletionIdExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDeletionIdException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocument({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentContentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentContent({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentOperationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentOperation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentSchemaVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentSchemaVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilter({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterKeyRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterKey({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterOptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterOption({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstanceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstanceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstanceInformationFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstanceInformationFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstancePropertyFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstancePropertyFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryGroupExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryGroupException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryItemContextException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryRequestExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryRequestException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidItemContentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidItemContentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidKeyIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidKeyId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidNextTokenRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidNextToken({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidNotificationConfigRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidNotificationConfig({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOptionExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOptionException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOutputFolderRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOutputFolder({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOutputLocationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOutputLocation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidParametersRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidParameters({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPermissionTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPermissionType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPluginNameRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPluginName({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPolicyAttributeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPolicyAttributeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPolicyTypeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPolicyTypeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResourceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResourceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResourceTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResourceType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResultAttributeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResultAttributeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidRoleRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidRole({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidScheduleRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidSchedule({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTagRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTag({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTargetRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTarget({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTargetMapsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTargetMaps({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTypeNameExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTypeNameException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidUpdateRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidUpdate({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvocationDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvocationDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ItemContentMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ItemContentMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ItemSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ItemSizeLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_MalformedResourcePolicyDocumentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new MalformedResourcePolicyDocumentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_MaxDocumentSizeExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new MaxDocumentSizeExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemAccessDeniedExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemAccessDeniedException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemInvalidParameterException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemRelatedItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemRelatedItemAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemRelatedItemAssociationNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemRelatedItemAssociationNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataInvalidArgumentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataInvalidArgumentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataKeyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataKeyLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataTooManyUpdatesExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataTooManyUpdatesException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterMaxVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterMaxVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterPatternMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterPatternMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterVersionLabelLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterVersionLabelLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterVersionNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterVersionNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_PoliciesLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new PoliciesLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncCountExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncCountExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncInvalidConfigurationExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncInvalidConfigurationException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceInUseExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceInUseException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyInvalidParameterException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ServiceSettingNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ServiceSettingNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_StatusUnchangedRes=async(e,t)=>{const n=e.body,r=_json(n),i=new StatusUnchanged({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_SubTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new SubTypeCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TargetInUseExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TargetInUseException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TargetNotConnectedRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TargetNotConnected({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TooManyTagsErrorRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TooManyTagsError({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TooManyUpdatesRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TooManyUpdates({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TotalSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TotalSizeLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedCalendarExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedCalendarException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedFeatureRequiredExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedFeatureRequiredException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedInventoryItemContextException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedInventorySchemaVersionExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedInventorySchemaVersionException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedOperatingSystemRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedOperatingSystem({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedParameterTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedParameterType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedPlatformTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedPlatformType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_GetParameterResult=(e,t)=>take(e,{Parameter:e=>de_Parameter(e)}),de_GetParametersResult=(e,t)=>take(e,{InvalidParameters:_json,Parameters:e=>de_ParameterList(e)}),de_Parameter=(e,t)=>take(e,{ARN:expectString,DataType:expectString,LastModifiedDate:e=>expectNonNull(parseEpochTimestamp(expectNumber(e))),Name:expectString,Selector:expectString,SourceResult:expectString,Type:expectString,Value:expectString,Version:expectLong}),de_ParameterList=(e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>de_Parameter(e)));return n},deserializeMetadata=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),throwDefaultError=withBaseException(SSMServiceException),buildHttpRpcRequest=async(e,t,n,r,i)=>{const{hostname:s,protocol:o="https",port:a,path:c}=await e.endpoint(),u={protocol:o,hostname:s,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==i&&(u.body=i),new HttpRequest(u)};function sharedHeaders(e){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AmazonSSM.${e}`}}class GetParameterCommand extends(Command.classBuilder().ep({...commonParams}).m((function(e,t,n,r){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin(n,e.getEndpointParameterInstructions())]})).s("AmazonSSM","GetParameter",{}).n("SSMClient","GetParameterCommand").f(void 0,GetParameterResultFilterSensitiveLog).ser(se_GetParameterCommand).de(de_GetParameterCommand).build()){}class GetParametersCommand extends(Command.classBuilder().ep({...commonParams}).m((function(e,t,n,r){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin(n,e.getEndpointParameterInstructions())]})).s("AmazonSSM","GetParameters",{}).n("SSMClient","GetParametersCommand").f(void 0,GetParametersResultFilterSensitiveLog).ser(se_GetParametersCommand).de(de_GetParametersCommand).build()){}const version$1="6.4.0-dev.0",REST_API_URL="https://api.allthings.me",OAUTH_URL="https://accounts.allthings.me",QUEUE_CONCURRENCY=void 0,QUEUE_DELAY=0,QUEUE_RESERVOIR=30,QUEUE_RESERVOIR_REFILL_INTERVAL=166,REQUEST_BACK_OFF_INTERVAL=200,REQUEST_MAX_RETRIES=50,DEFAULT_API_WRAPPER_OPTIONS={apiUrl:process.env.ALLTHINGS_REST_API_URL||REST_API_URL,clientId:process.env.ALLTHINGS_OAUTH_CLIENT_ID,clientSecret:process.env.ALLTHINGS_OAUTH_CLIENT_SECRET,oauthUrl:process.env.ALLTHINGS_OAUTH_URL||OAUTH_URL,password:process.env.ALLTHINGS_OAUTH_PASSWORD,requestBackOffInterval:REQUEST_BACK_OFF_INTERVAL,requestMaxRetries:REQUEST_MAX_RETRIES,scope:"user:profile",username:process.env.ALLTHINGS_OAUTH_USERNAME},USER_AGENT=`Allthings Node SDK REST Client/${version$1}`,DEFAULT_AWS_CONFIGURATION={region:"eu-central-2"};var __rest$5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const DEFAULT_CLIENT_CONFIG={clientConfig:DEFAULT_AWS_CONFIGURATION,onlyDefault:!1,prefix:process.env.SSM_PARAM_PATH},getSecrets=async(e,t,n,r)=>{var i,s;if(t.onlyDefault)return[r];try{const o=await e.send(new GetParametersCommand({Names:n.map((e=>`${t.prefix?t.prefix:""}${e}`)),WithDecryption:!0}));return null!==(s=null===(i=null==o?void 0:o.Parameters)||void 0===i?void 0:i.map((e=>{var t;return null!==(t=e.Value)&&void 0!==t?t:r})))&&void 0!==s?s:[r]}catch(e){return t.logger&&t.logger(e),[r]}},getSecret=async(e,t,n,r)=>{var i,s;if(t.onlyDefault)return r;try{const o=await e.send(new GetParameterCommand({Name:`${t.prefix?t.prefix:""}${n}`,WithDecryption:!0}));return null!==(s=null===(i=null==o?void 0:o.Parameter)||void 0===i?void 0:i.Value)&&void 0!==s?s:r}catch(e){return t.logger&&t.logger(e),r}},parameterStore=e=>{const t=Object.assign(Object.assign({},DEFAULT_CLIENT_CONFIG),e),{clientConfig:n}=t,r=__rest$5(t,["clientConfig"]),i=new SSMClient(n);return{getSecret:(e,t="")=>getSecret(i,r,e,t),getSecrets:(e,t="")=>getSecrets(i,r,e,t)}};function createTokenStore(e){const t=new Map(Object.entries(e||{}));return{get:e=>t.get(e),reset:()=>t.clear(),set:e=>Object.entries(e).forEach((([e,n])=>t.set(e,n)))}}var queryString={},strictUriEncode=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],decodeComponents(n),decodeComponents(r))}function decode(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(singleMatcher)||[],n=1;n<t.length;n++)t=(e=decodeComponents(t,n).join("")).match(singleMatcher)||[];return e}}function customDecodeURIComponent(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=multiMatcher.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=decode(n[0]);r!==n[0]&&(t[n[0]]=r)}n=multiMatcher.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),s=0;s<i.length;s++){var o=i[s];e=e.replace(new RegExp(o,"g"),t[o])}return e}var decodeUriComponent=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return customDecodeURIComponent(e)}},splitOnFirst=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},filterObj=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),s=0;s<r.length;s++){var o=r[s],a=e[o];(i?-1!==t.indexOf(o):t(o,a,e))&&(n[o]=a)}return n};!function(e){const t=strictUriEncode,n=decodeUriComponent,r=splitOnFirst,i=filterObj,s=Symbol("encodeFragmentIdentifier");function o(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}function c(e,t){return t.decode?n(e):e}function u(e){return Array.isArray(e)?e.sort():"object"==typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function d(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function l(e){const t=(e=d(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){o((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return(e,n,r)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),s="string"==typeof n&&!i&&c(n,e).includes(e.arrayFormatSeparator);n=s?c(n,e):n;const o=i||s?n.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===n?n:c(n,e);r[t]=o};case"bracket-separator":return(t,n,r)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(r[t]=n?c(n,e):n);const s=null===n?[]:n.split(e.arrayFormatSeparator).map((t=>c(t,e)));void 0!==r[t]?r[t]=[].concat(r[t],s):r[t]=s};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const s of e.split("&")){if(""===s)continue;let[e,o]=r(t.decode?s.replace(/\+/g," "):s,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?o:c(o,t),n(c(e,t),o,i)}for(const e of Object.keys(i)){const n=i[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=p(n[e],t);else i[e]=p(n,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const n=i[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=u(n):e[t]=n,e}),Object.create(null))}e.extract=l,e.parse=m,e.stringify=(e,t)=>{if(!e)return"";o((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[",i,"]"].join("")]:[...n,[a(t,e),"[",a(i,e),"]=",a(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[]"].join("")]:[...n,[a(t,e),"[]=",a(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),":list="].join("")]:[...n,[a(t,e),":list=",a(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[a(n,e),t,a(i,e)].join("")]:[[r,a(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,a(t,e)]:[...n,[a(t,e),"=",a(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const s=Object.keys(i);return!1!==t.sort&&s.sort(t.sort),s.map((n=>{const i=e[n];return void 0===i?"":null===i?a(n,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?a(n,t)+"[]":i.reduce(r(n),[]).join("&"):a(n,t)+"="+a(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,i]=r(e,"#");return Object.assign({url:n.split("?")[0]||"",query:m(l(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:c(i,t)}:{})},e.stringifyUrl=(t,n)=>{n=Object.assign({encode:!0,strict:!0,[s]:!0},n);const r=d(t.url).split("?")[0]||"",i=e.extract(t.url),o=e.parse(i,{sort:!1}),c=Object.assign(o,t.query);let u=e.stringify(c,n);u&&(u=`?${u}`);let l=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(t.url);return t.fragmentIdentifier&&(l=`#${n[s]?a(t.fragmentIdentifier,n):t.fragmentIdentifier}`),`${r}${u}${l}`},e.pick=(t,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[s]:!1},r);const{url:o,query:a,fragmentIdentifier:c}=e.parseUrl(t,r);return e.stringifyUrl({url:o,query:i(a,n),fragmentIdentifier:c},r)},e.exclude=(t,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return e.pick(t,i,r)}}(queryString);var querystring=getDefaultExportFromCjs(queryString);const RESPONSE_TYPE$1="code",GRANT_TYPE$3="authorization_code",castToAuthorizationRequestParams$1=e=>{const{redirectUri:t,clientId:n,scope:r,state:i}=e;if(!n)throw new Error('Missing required "clientId" parameter to perform authorization code grant redirect');if(!t)throw new Error('Missing required "redirectUri" parameter to perform authorization code grant redirect');return Object.assign(Object.assign({client_id:n,redirect_uri:t,response_type:RESPONSE_TYPE$1},r?{scope:r}:{}),i?{state:i}:{})},isEligibleForClientRedirect$1=e=>{try{return!!castToAuthorizationRequestParams$1(e)}catch(e){return!1}},getRedirectUrl$1=e=>`${e.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams$1(e),{skipEmptyString:!0,skipNull:!0})}`,castToTokenRequestParams$2=e=>{const{authorizationCode:t,redirectUri:n,clientId:r,clientSecret:i}=e;if(!r)throw new Error('Missing required "clientId" parameter to perform authorization code grant');if(!n)throw new Error('Missing required "redirectUri" parameter to perform authorization code grant');if(!t)throw new Error('Missing required "authorizationCode" parameter to perform authorization code grant');return Object.assign({client_id:r,code:t,grant_type:GRANT_TYPE$3,redirect_uri:n},i?{client_secret:i}:{})},isEligible$3=e=>{try{return!!castToTokenRequestParams$2(e)}catch(e){return!1}},requestToken$3=(e,t)=>e(castToTokenRequestParams$2(t));var browserPonyfill={exports:{}};!function(e,t){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==commonjsGlobal&&commonjsGlobal,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==n&&n,r="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,s="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in n,a="ArrayBuffer"in n;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};function d(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function m(e){this.map={},e instanceof m?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:s&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&s&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=h(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(y)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=f(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(x)}),this.json=function(){return this.text().then(JSON.parse)},this}m.prototype.append=function(e,t){e=d(e),t=l(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},m.prototype.delete=function(e){delete this.map[d(e)]},m.prototype.get=function(e){return e=d(e),this.has(e)?this.map[e]:null},m.prototype.has=function(e){return this.map.hasOwnProperty(d(e))},m.prototype.set=function(e,t){this.map[d(e)]=l(t)},m.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},m.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),p(e)},m.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},m.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),p(e)},i&&(m.prototype[Symbol.iterator]=m.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,i=(t=t||{}).body;if(e instanceof _){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new m(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new m(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),v.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function x(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function S(e,t){if(!(this instanceof S))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new m(t.headers),this.url=t.url||"",this._initBody(e)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},E.call(_.prototype),E.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var b=[301,302,303,307,308];S.redirect=function(e,t){if(-1===b.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function w(e,r){return new Promise((function(i,o){var c=new _(e,r);if(c.signal&&c.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}u.onload=function(){var e,t,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new m,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout((function(){i(new S(r,n))}),0)},u.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.onabort=function(){setTimeout((function(){o(new t.DOMException("Aborted","AbortError"))}),0)},u.open(c.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(c.url),!0),"include"===c.credentials?u.withCredentials=!0:"omit"===c.credentials&&(u.withCredentials=!1),"responseType"in u&&(s?u.responseType="blob":a&&c.headers.get("Content-Type")&&-1!==c.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof m?c.headers.forEach((function(e,t){u.setRequestHeader(t,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){u.setRequestHeader(e,l(r.headers[e]))})),c.signal&&(c.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&c.signal.removeEventListener("abort",d)}),u.send(void 0===c._bodyInit?null:c._bodyInit)}))}w.polyfill=!0,n.fetch||(n.fetch=w,n.Headers=m,n.Request=_,n.Response=S),t.Headers=m,t.Request=_,t.Response=S,t.fetch=w}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports,fetch$1=getDefaultExportFromCjs(browserPonyfillExports);const SUBSCRIPTIONS=process.env.DEBUG&&process.env.DEBUG.split(",").map((e=>e.trim()))||[];function makeLogger(e){return["log","info","warn","error"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:function(...t){return(SUBSCRIPTIONS.includes("*")||SUBSCRIPTIONS.includes(e)||SUBSCRIPTIONS.includes(e.toLocaleLowerCase()))&&console[n](`${e}:`,...t),!0}})),{})}const logger=makeLogger("OAuth Token Request"),makeFetchTokenRequester=e=>async t=>{try{const n=await fetch$1(e,{body:querystring.stringify(t,{skipEmptyString:!0,skipNull:!0}),cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded",accept:"application/json","user-agent":USER_AGENT},method:"POST",mode:"cors"});if(200!==n.status)throw n;const{access_token:r,refresh_token:i,expires_in:s}=await n.json();return{accessToken:r,expiresIn:s,refreshToken:i}}catch(e){if(!e.status)throw e;const t=`HTTP ${e.status} — ${e.statusText}`;throw logger.error(t,e.response),new Error(`HTTP ${e.status} — ${e.statusText}. Could not get token.`)}},GRANT_TYPE$2="refresh_token",castToTokenRequestParams$1=e=>{const{clientId:t,clientSecret:n,refreshToken:r,scope:i}=e;if(!t)throw new Error('Missing required "clientId" parameter to perform refresh token grant');if(!r)throw new Error('Missing required "refreshToken" parameter to perform refresh token grant');return Object.assign(Object.assign({client_id:t,grant_type:GRANT_TYPE$2,refresh_token:r},n?{client_secret:n}:{}),i?{scope:i}:{})},isEligible$2=e=>{try{return!!castToTokenRequestParams$1(e)}catch(e){return!1}},requestToken$2=(e,t)=>e(castToTokenRequestParams$1(t));async function requestAndSaveToStore(e,t){const n=await e();return t.set(n),n}const partial=(e,...t)=>(...n)=>e(...t,...n);async function until(e,t,n,r=0){const i=await t(n,r);return await e(i,r)?i:until(e,t,i,r+1)}function fnClearInterval(e){return clearInterval(e),!0}function pseudoRandomString(e=16){let t="";for(;t.length<e;)t+=Math.random().toString(36).substr(2);return t.substr(0,e)}async function del(e,t,n,r,i){return e("delete",t,{body:n,headers:i},r)}async function get(e,t,n,r,i){return e("get",t,{headers:i,query:n},r)}var __rest$4=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumGender,EnumUserType,EnumCommunicationPreferenceChannel,EnumUserPermissionRole,EnumUserPermissionObjectType;!function(e){e.female="female",e.male="male"}(EnumGender||(EnumGender={})),function(e){e.allthingsUser="allthings_user",e.allthingsContent="allthings_content",e.customer="customer",e.demoContent="demo_content",e.demoPublic="demo_public",e.partner="partner"}(EnumUserType||(EnumUserType={})),exports.EnumCommunicationPreferenceChannel=void 0,EnumCommunicationPreferenceChannel=exports.EnumCommunicationPreferenceChannel||(exports.EnumCommunicationPreferenceChannel={}),EnumCommunicationPreferenceChannel.push="push",EnumCommunicationPreferenceChannel.email="email",exports.EnumUserPermissionRole=void 0,EnumUserPermissionRole=exports.EnumUserPermissionRole||(exports.EnumUserPermissionRole={}),EnumUserPermissionRole.appAdmin="app-admin",EnumUserPermissionRole.appOwner="app-owner",EnumUserPermissionRole.articlesAgent="articles-agent",EnumUserPermissionRole.articlesViewOnly="articles-view-only",EnumUserPermissionRole.bookableAssetAgent="bookable-asset-agent",EnumUserPermissionRole.bookingAgent="booking-agent",EnumUserPermissionRole.cockpitManager="cockpit-manager",EnumUserPermissionRole.dataConnectorAdmin="data-connector-admin",EnumUserPermissionRole.documentAdmin="doc-admin",EnumUserPermissionRole.externalAgent="external-agent",EnumUserPermissionRole.globalOrgAdmin="global-org-admin",EnumUserPermissionRole.globalUserAdmin="global-user-admin",EnumUserPermissionRole.orgAdmin="org-admin",EnumUserPermissionRole.orgTeamManager="org-team-manager",EnumUserPermissionRole.pinboardAgent="pinboard-agent",EnumUserPermissionRole.platformOwner="platform-owner",EnumUserPermissionRole.qa="qa",EnumUserPermissionRole.serviceCenterAgent="service-center-agent",EnumUserPermissionRole.serviceCenterManager="service-center-manager",EnumUserPermissionRole.setup="setup",EnumUserPermissionRole.tenantManager="tenant-manager",exports.EnumUserPermissionObjectType=void 0,EnumUserPermissionObjectType=exports.EnumUserPermissionObjectType||(exports.EnumUserPermissionObjectType={}),EnumUserPermissionObjectType.app="App",EnumUserPermissionObjectType.group="Group",EnumUserPermissionObjectType.property="Property",EnumUserPermissionObjectType.unit="Unit";const remapUserResult=e=>{const{tenantIDs:t}=e,n=__rest$4(e,["tenantIDs"]);return Object.assign(Object.assign({},n),{tenantIds:t})},remapEmbeddedUser=e=>e.users?e.users.map(remapUserResult):[];async function userCreate(e,t,n,r){return e.post("/v1/users",Object.assign(Object.assign({},r),{creationContext:t,username:n}))}async function getUsers(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:s}=await e.get("/v1/users",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i.map(remapUserResult)},total:s}}async function getCurrentUser(e){return remapUserResult(await e.get("/v1/me"))}async function userGetById(e,t){return remapUserResult(await e.get(`/v1/users/${t}`))}async function userUpdateById(e,t,n){const{tenantIds:r}=n,i=__rest$4(n,["tenantIds"]);return remapUserResult(await e.patch(`/v1/users/${t}`,Object.assign(Object.assign({},i),{tenantIDs:r})))}async function userCreatePermission(e,t,n){const{objectId:r}=n,i=__rest$4(n,["objectId"]),s=await e.post(`/v1/users/${t}/permissions`,Object.assign(Object.assign({},i),{objectID:r})),{objectID:o}=s,a=__rest$4(s,["objectID"]);return Object.assign(Object.assign({},a),{objectId:o})}async function userCreatePermissionBatch(e,t,n){const{objectId:r,objectType:i,roles:s,startDate:o,endDate:a}=n,c={batch:s.map((e=>({endDate:a&&a.toISOString(),objectID:r,objectType:i,restrictions:[],role:e,startDate:o&&o.toISOString()})))};return!await e.post(`/v1/users/${t}/permissions`,c)}async function userGetPermissions(e,t){const{_embedded:{items:n}}=await e.get(`/v1/users/${t}/roles?limit=-1`);return n.map((e=>{var{objectID:t}=e,n=__rest$4(e,["objectID"]);return Object.assign(Object.assign({},n),{objectId:t})}))}async function userDeletePermission(e,t){return!await e.delete(`/v1/permissions/${t}`)}async function userGetUtilisationPeriods(e,t){const{_embedded:{items:n}}=await e.get(`/v1/users/${t}/utilisation-periods`);return n}async function userCheckInToUtilisationPeriod(e,t,n){const{email:r}=await e.userGetById(t);return e.utilisationPeriodCheckInUser(n,{email:r})}async function userGetByEmail(e,t,n=1,r=1e3){return e.getUsers(n,r,{email:t})}async function userChangePassword(e,t,n,r){return!await e.put(`/v1/users/${t}/password`,{currentPassword:n,plainPassword:r})}async function agentCreate(e,t,n,r,i,s,o){const a=await e.userCreate(t,r,Object.assign(Object.assign({},i),{type:EnumUserType.customer})),c=await e.post(`/v1/property-managers/${n}/users`,Object.assign({userID:a.id},o&&{externalAgentCompany:o}));return!((void 0===s||s)&&await e.post(`/v1/users/${a.id}/invitations`))&&Object.assign(Object.assign({},a),c)}async function agentCreatePermissions(e,t,n,r,i,s,o){return e.userCreatePermissionBatch(t,{endDate:o,objectId:n,objectType:r,restrictions:[],roles:i,startDate:s})}async function appCreate(e,t,n){return e.post(`/v1/users/${t}/apps`,Object.assign(Object.assign({availableLocales:{0:"de_DE"}},n),{siteUrl:n.siteUrl.replace("_","")}))}async function appGetById(e,t){return e.get(`/v1/apps/${t}`)}async function bookingGetById(e,t){return e.get(`/v1/bookings/${t}`)}async function bookingUpdateById(e,t,n){return e.patch(`/v1/bookings/${t}`,n)}async function bucketGet(e,t){return e.get(`/v1/buckets/${t}`)}async function bucketCreate(e,t){return e.post("/v1/buckets",{channels:t.channels,name:t.name})}async function bucketAddFile(e,t,n){return""===await e.post(`/v1/buckets/${t}/files`,{id:n})}async function bucketRemoveFile(e,t,n){return""===await e.delete(`/v1/buckets/${t}/files/${n}`)}async function bucketRemoveFilesInPath(e,t,n){return""===await e.delete(`/v1/buckets/${t}/files`,{folder:n.path})}const createManyFiles=async(e,t)=>await Promise.all(e.map((async e=>{try{return await t.fileCreate({file:e.content,name:e.filename})}catch(e){return e}})));async function createManyFilesSorted(e,t){const n=await createManyFiles(e,t);return{error:n.filter((e=>e instanceof Error)),success:n.filter((e=>!(e instanceof Error))).map((e=>e.id))}}async function conversationGetById(e,t){return e.get(`/v1/conversations/${t}`)}async function conversationCreateMessage(e,t,n){const r=`/v1/conversations/${t}/messages`,i=n.attachments&&n.attachments.length?{content:{description:n.body,files:(await createManyFilesSorted(n.attachments,e)).success},createdBy:n.createdBy,inputChannel:n.inputChannel,internal:!1,type:"file"}:{content:{content:n.body},createdBy:n.createdBy,inputChannel:n.inputChannel,type:"text"};return e.post(r,i)}async function fileCreate(e,t){return e.post("/v1/files",{formData:{file:[t.file,t.name],path:t.path||""}})}async function fileDelete(e,t){return""===await e.delete(`/v1/files/${t}`)}var __rest$3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};async function groupCreate(e,t,n){const{propertyManagerId:r}=n,i=__rest$3(n,["propertyManagerId"]);return e.post(`/v1/properties/${t}/groups`,Object.assign(Object.assign({},i),{propertyManagerID:r}))}async function groupGetById(e,t){const n=await e.get(`/v1/groups/${t}`),{propertyManagerID:r}=n,i=__rest$3(n,["propertyManagerID"]);return Object.assign(Object.assign({},i),{propertyManagerId:r})}async function groupUpdateById(e,t,n){return e.patch(`/v1/groups/${t}`,n)}async function getGroups(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:s}=await e.get("/v1/groups",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:s}}async function lookupIds(e,t,n){return e.post(`/v1/id-lookup/${t}/${n.resource}`,Object.assign(Object.assign({externalIds:"string"==typeof n.externalIds?[n.externalIds]:n.externalIds},n.parentId?{parentId:n.parentId}:{}),n.userType?{userType:n.userType}:{}))}function stringToDate(e){return new Date(Date.parse(e))}function dateToString(e){return e.toISOString()}var __rest$2=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumNotificationCategory,EnumNotificationType,EnumNotificationSettingsValue;function remapNotificationResult(e){var{createdAt:t,objectID:n,referencedObjectID:r}=e,i=__rest$2(e,["createdAt","objectID","referencedObjectID"]);return Object.assign({createdAt:stringToDate(t),objectId:n,referencedObjectId:r},i)}async function notificationsGetByUser(e,t,n=1,r=-1){const{_embedded:{items:i},total:s,metaData:o}=await e.get(`/v1/users/${t}/notifications?page=${n}&limit=${r}`);return{_embedded:{items:i.map(remapNotificationResult)},metaData:o,total:s}}async function notificationsUpdateReadByUser(e,t,n=new Date){return e.patch(`/v1/users/${t}/notifications`,{lastReadAt:dateToString(n)})}async function notificationUpdateRead(e,t){return remapNotificationResult(await e.patch(`/v1/notifications/${t}`,{read:!0}))}function remapKeys(e,t){return Object.entries(e).reduce(((e,n)=>Object.assign(Object.assign({},e),{[t(n[0])]:n[1]})),{})}function camelCaseToDash(e){return e.replace(/([A-Z])/g,(e=>`-${e[0].toLowerCase()}`))}function dashCaseToCamel(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}async function notificationSettingsUpdateByUser(e,t,n){const r=await e.patch(`/v1/users/${t}/notification-settings`,{notificationSettings:remapKeys(n,camelCaseToDash)});return remapKeys(r,dashCaseToCamel)}async function notificationSettingsResetByUser(e,t){return remapKeys(await e.delete(`/v1/users/${t}/notification-settings`),dashCaseToCamel)}async function propertyCreate(e,t,n){return e.post(`/v1/apps/${t}/properties`,n)}async function propertyGetById(e,t){return e.get(`/v1/properties/${t}`)}async function propertyUpdateById(e,t,n){return e.patch(`/v1/properties/${t}`,n)}async function getProperties(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:s}=await e.get("/v1/properties",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:s}}!function(e){e.events="events",e.hintsAndTips="hints-and-tips",e.lostAndFound="lost-and-found",e.localDeals="local-deals",e.localEvents="local-events",e.miscellaneous="miscellaneous",e.deals="deals",e.messages="messages",e.adminMessages="admin-messages",e.newThingsToGive="new-things-to-give",e.newThingsForSale="new-things-for-sale",e.surveys="surveys",e.supportOffer="support-offer",e.supportRequest="support-request",e.sustainability="sustainability",e.localServices="local-services",e.services="services",e.ticketDigestEmail="ticket-digest-email",e.appDigestEmail="app-digest-email",e.newFile="new-file"}(EnumNotificationCategory||(EnumNotificationCategory={})),function(e){e.clipboardThing="clipboard-thing",e.comment="comment",e.communityArticle="community-article",e.newFile="new-file",e.ticketComment="ticket-comment",e.welcomeNotification="welcome-notification"}(EnumNotificationType||(EnumNotificationType={})),function(e){e.never="never",e.immediately="immediately",e.daily="daily",e.weekly="weekly",e.biweekly="biweekly",e.monthly="monthly"}(EnumNotificationSettingsValue||(EnumNotificationSettingsValue={}));var __rest$1=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const remapRegistationCodeResult=e=>{const{tenantID:t}=e,n=__rest$1(e,["tenantID"]);return Object.assign(Object.assign({},n),{externalId:t})};async function registrationCodeCreate(e,t,n,r={permanent:!1}){const{externalId:i}=r,s=__rest$1(r,["externalId"]);return remapRegistationCodeResult(await e.post("/v1/registration-codes",Object.assign(Object.assign({code:t,utilisationPeriods:"string"==typeof n?[n]:n},i?{tenantID:i}:{}),s)))}async function registrationCodeUpdateById(e,t,n){return remapRegistationCodeResult(await e.patch(`/v1/registration-codes/${t}`,n))}async function registrationCodeGetById(e,t){return remapRegistationCodeResult(await e.get(`/v1/invitations/${t}`))}async function registrationCodeDelete(e,t){return""===await e.delete(`/v1/invitations/${t}`)}async function serviceProviderCreate(e,t){return e.post("/v1/service-providers",t)}async function serviceProviderGetById(e,t){return e.get(`/v1/service-providers/${t}`)}async function serviceProviderUpdateById(e,t,n){return e.patch(`/v1/service-providers/${t}`,n)}var ETicketStatus,ETrafficLightColor,EnumUnitObjectType,EnumUnitType,EnumUserRelationType;async function ticketGetById(e,t){return e.get(`/v1/tickets/${t}`)}async function ticketCreateOnUser(e,t,n,r){return e.post(`/v1/users/${t}/tickets`,Object.assign(Object.assign({},r),{files:r.files?(await createManyFilesSorted(r.files,e)).success:[],utilisationPeriod:n}))}async function ticketCreateOnServiceProvider(e,t,n){return e.post(`/v1/property-managers/${t}/tickets`,Object.assign(Object.assign({},n),{files:n.files?(await createManyFilesSorted(n.files,e)).success:[]}))}async function unitCreate(e,t,n){return e.post(`/v1/groups/${t}/units`,n)}async function unitGetById(e,t){return e.get(`/v1/units/${t}`)}async function unitUpdateById(e,t,n){return e.patch(`/v1/units/${t}`,n)}async function getUnits(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:s}=await e.get("/v1/units",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:s}}async function userRelationCreate(e,t,n){return e.post(`/v1/users/${t}/user-relations/${n.type}`,{ids:n.ids,level:n.level,readOnly:n.readOnly,role:n.role})}async function userRelationDelete(e,t,n){return e.delete(`/v1/users/${t}/user-relations/${n.type}`,{ids:n.ids,level:n.level,role:n.role})}async function userRelationsGetByUser(e,t){return e.get(`/v1/users/${t}/user-relations`)}!function(e){e.CLOSED="closed",e.WAITING_FOR_AGENT="waiting-for-agent",e.WAITING_FOR_CUSTOMER="waiting-for-customer",e.WAITING_FOR_EXTERNAL="waiting-for-external"}(ETicketStatus||(ETicketStatus={})),function(e){e.GREEN="green",e.RED="red",e.YELLOW="yellow"}(ETrafficLightColor||(ETrafficLightColor={})),exports.EnumUnitObjectType=void 0,EnumUnitObjectType=exports.EnumUnitObjectType||(exports.EnumUnitObjectType={}),EnumUnitObjectType.adjoiningRoom="adjoining-room",EnumUnitObjectType.advertisingSpace="advertising-space",EnumUnitObjectType.aerial="aerial",EnumUnitObjectType.apartmentBuilding="apartment-building",EnumUnitObjectType.atm="atm",EnumUnitObjectType.atmRoom="atm-room",EnumUnitObjectType.attic="attic",EnumUnitObjectType.atticFlat="attic-flat",EnumUnitObjectType.bank="bank",EnumUnitObjectType.basment="basment",EnumUnitObjectType.bikeShed="bike-shed",EnumUnitObjectType.buildingLaw="building-law",EnumUnitObjectType.cafeteria="cafeteria",EnumUnitObjectType.caretakerRoom="caretaker-room",EnumUnitObjectType.carport="carport",EnumUnitObjectType.cellar="cellar",EnumUnitObjectType.commercialProperty="commercial-property",EnumUnitObjectType.commonRoom="common-room",EnumUnitObjectType.deliveryZone="delivery-zone",EnumUnitObjectType.diverse="diverse",EnumUnitObjectType.doubleParkingSpace="double-parking-space",EnumUnitObjectType.engineeringRoom="engineering-room",EnumUnitObjectType.entertainment="entertainment",EnumUnitObjectType.environment="environment",EnumUnitObjectType.estate="estate",EnumUnitObjectType.fillingStation="filling-station",EnumUnitObjectType.fitnessCenter="fitness-center",EnumUnitObjectType.flat="flat",EnumUnitObjectType.freeZone="free-zone",EnumUnitObjectType.garage="garage",EnumUnitObjectType.garden="garden",EnumUnitObjectType.gardenFlat="garden-flat",EnumUnitObjectType.heatingFacilities="heating-facilities",EnumUnitObjectType.hotel="hotel",EnumUnitObjectType.incidentalRentalExpenses="incidental-rental-expenses",EnumUnitObjectType.industry="industry",EnumUnitObjectType.kiosk="kiosk",EnumUnitObjectType.kitchen="kitchen",EnumUnitObjectType.loft="loft",EnumUnitObjectType.machine="machine",EnumUnitObjectType.maisonette="maisonette",EnumUnitObjectType.medicalPractice="medical-practice",EnumUnitObjectType.mopedShed="moped-shed",EnumUnitObjectType.motorcycleParkingSpace="motorcycle-parking-space",EnumUnitObjectType.office="office",EnumUnitObjectType.oneFamilyHouse="one-family-house",EnumUnitObjectType.parkingBox="parking-box",EnumUnitObjectType.parkingGarage="parking-garage",EnumUnitObjectType.parkingSpace="parking-space",EnumUnitObjectType.parkingSpaces="parking-spaces",EnumUnitObjectType.penthouse="penthouse",EnumUnitObjectType.productionPlant="production-plant",EnumUnitObjectType.pub="pub",EnumUnitObjectType.publicArea="public-area",EnumUnitObjectType.restaurant="restaurant",EnumUnitObjectType.retirementHome="retirement-home",EnumUnitObjectType.salesFloor="sales-floor",EnumUnitObjectType.school="school",EnumUnitObjectType.shelter="shelter",EnumUnitObjectType.storage="storage",EnumUnitObjectType.store="store",EnumUnitObjectType.storeroom="storeroom",EnumUnitObjectType.studio="studio",EnumUnitObjectType.terrace="terrace",EnumUnitObjectType.toilets="toilets",EnumUnitObjectType.utilityRoom="utility-room",EnumUnitObjectType.variableParkingSpace="variable-parking-space",EnumUnitObjectType.variableRoom="variable-room",EnumUnitObjectType.visitorParkingSpace="visitor-parking-space",EnumUnitObjectType.workshop="workshop",exports.EnumUnitType=void 0,EnumUnitType=exports.EnumUnitType||(exports.EnumUnitType={}),EnumUnitType.rented="rented",EnumUnitType.owned="owned",exports.EnumUserRelationType=void 0,EnumUserRelationType=exports.EnumUserRelationType||(exports.EnumUserRelationType={}),EnumUserRelationType.isResponsible="is-responsible";var __rest=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumUtilisationPeriodType;async function utilisationPeriodCreate(e,t,n){const r=await e.post(`/v1/units/${t}/utilisation-periods`,n),{tenantIDs:i,_embedded:s}=r,o=__rest(r,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},o),{invitations:s.invitations.map(remapRegistationCodeResult),tenantIds:i,users:remapEmbeddedUser(s)})}async function utilisationPeriodGetById(e,t){const n=await e.get(`/v1/utilisation-periods/${t}`),{tenantIDs:r,_embedded:i}=n,s=__rest(n,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},s),{invitations:i.invitations.map(remapRegistationCodeResult),tenantIds:r,users:remapEmbeddedUser(i)})}async function utilisationPeriodUpdateById(e,t,n){const r=await e.patch(`/v1/utilisation-periods/${t}`,n),{tenantIDs:i,_embedded:s}=r,o=__rest(r,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},o),{invitations:s.invitations.map(remapRegistationCodeResult),tenantIds:i,users:remapEmbeddedUser(s)})}async function utilisationPeriodDelete(e,t){return!await e.delete(`/v1/utilisation-periods/${t}/soft`)}async function utilisationPeriodCheckInUser(e,t,n){return await e.post(`/v1/utilisation-periods/${t}/users`,{email:n.email})&&e.utilisationPeriodGetById(t)}async function utilisationPeriodCheckOutUser(e,t,n){return""===await e.delete(`/v1/utilisation-periods/${t}/users/${n}`)}async function utilisationPeriodAddRegistrationCode(e,t,n,r,i=!1){return e.post(`/v1/utilisation-periods/${t}/registration-codes`,{code:n,permanent:i,tenant:r})}async function patch(e,t,n,r,i){return e("patch",t,{body:n,headers:i},r)}async function post(e,t,n,r,i){return e("post",t,{body:n,headers:i},r)}async function put(e,t,n,r,i){return e("put",t,{body:n,headers:i},r)}exports.EnumUtilisationPeriodType=void 0,EnumUtilisationPeriodType=exports.EnumUtilisationPeriodType||(exports.EnumUtilisationPeriodType={}),EnumUtilisationPeriodType.tenant="tenant",EnumUtilisationPeriodType.ownership="ownership",EnumUtilisationPeriodType.vacant="vacant";var parser$3={},DLList$2;parser$3.load=function(e,t,n={}){var r,i,s;for(r in t)s=t[r],n[r]=null!=(i=e[r])?i:s;return n},parser$3.overwrite=function(e,t,n={}){var r,i;for(r in e)i=e[r],void 0!==t[r]&&(n[r]=i);return n},DLList$2=class{constructor(e,t){this.incr=e,this.decr=t,this._first=null,this._last=null,this.length=0}push(e){var t;this.length++,"function"==typeof this.incr&&this.incr(),t={value:e,prev:this._last,next:null},null!=this._last?(this._last.next=t,this._last=t):this._first=this._last=t}shift(){var e;if(null!=this._first)return this.length--,"function"==typeof this.decr&&this.decr(),e=this._first.value,null!=(this._first=this._first.next)?this._first.prev=null:this._last=null,e}first(){if(null!=this._first)return this._first.value}getArray(){var e,t,n;for(e=this._first,n=[];null!=e;)n.push((t=e,e=e.next,t.value));return n}forEachShift(e){var t;for(t=this.shift();null!=t;)e(t),t=this.shift()}debug(){var e,t,n,r,i;for(e=this._first,i=[];null!=e;)i.push((t=e,e=e.next,{value:t.value,prev:null!=(n=t.prev)?n.value:void 0,next:null!=(r=t.next)?r.value:void 0}));return i}};var DLList_1=DLList$2,Events$1;function asyncGeneratorStep$4(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$4(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep$4(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep$4(s,r,i,o,a,"throw",e)}o(void 0)}))}}Events$1=class{constructor(e){if(this.instance=e,this._events={},null!=this.instance.on||null!=this.instance.once||null!=this.instance.removeAllListeners)throw new Error("An Emitter already exists for this object");this.instance.on=(e,t)=>this._addListener(e,"many",t),this.instance.once=(e,t)=>this._addListener(e,"once",t),this.instance.removeAllListeners=(e=null)=>null!=e?delete this._events[e]:this._events={}}_addListener(e,t,n){var r;return null==(r=this._events)[e]&&(r[e]=[]),this._events[e].push({cb:n,status:t}),this.instance}listenerCount(e){return null!=this._events[e]?this._events[e].length:0}trigger(e,...t){var n=this;return _asyncToGenerator$4((function*(){var r,i;try{if("debug"!==e&&n.trigger("debug",`Event triggered: ${e}`,t),null==n._events[e])return;return n._events[e]=n._events[e].filter((function(e){return"none"!==e.status})),i=n._events[e].map(function(){var e=_asyncToGenerator$4((function*(e){var r,i;if("none"!==e.status){"once"===e.status&&(e.status="none");try{return"function"==typeof(null!=(i="function"==typeof e.cb?e.cb(...t):void 0)?i.then:void 0)?yield i:i}catch(e){return r=e,n.trigger("error",r),null}}}));return function(t){return e.apply(this,arguments)}}()),(yield Promise.all(i)).find((function(e){return null!=e}))}catch(e){return r=e,n.trigger("error",r),null}}))()}};var Events_1=Events$1,DLList$1,Events,Queues;DLList$1=DLList_1,Events=Events_1,Queues=class{constructor(e){this.Events=new Events(this),this._length=0,this._lists=function(){var t,n,r;for(r=[],t=1,n=e;1<=n?t<=n:t>=n;1<=n?++t:--t)r.push(new DLList$1((()=>this.incr()),(()=>this.decr())));return r}.call(this)}incr(){if(0==this._length++)return this.Events.trigger("leftzero")}decr(){if(0==--this._length)return this.Events.trigger("zero")}push(e){return this._lists[e.options.priority].push(e)}queued(e){return null!=e?this._lists[e].length:this._length}shiftAll(e){return this._lists.forEach((function(t){return t.forEachShift(e)}))}getFirst(e=this._lists){var t,n,r;for(t=0,n=e.length;t<n;t++)if((r=e[t]).length>0)return r;return[]}shiftLastFrom(e){return this.getFirst(this._lists.slice(e).reverse()).shift()}};var Queues_1=Queues,BottleneckError_1,hasRequiredBottleneckError,BottleneckError$3,DEFAULT_PRIORITY,Job,NUM_PRIORITIES,parser$2;function requireBottleneckError(){return hasRequiredBottleneckError?BottleneckError_1:(hasRequiredBottleneckError=1,e=class extends Error{},BottleneckError_1=e);var e}function asyncGeneratorStep$3(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$3(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep$3(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep$3(s,r,i,o,a,"throw",e)}o(void 0)}))}}NUM_PRIORITIES=10,DEFAULT_PRIORITY=5,parser$2=parser$3,BottleneckError$3=requireBottleneckError(),Job=class{constructor(e,t,n,r,i,s,o,a){this.task=e,this.args=t,this.rejectOnDrop=i,this.Events=s,this._states=o,this.Promise=a,this.options=parser$2.load(n,r),this.options.priority=this._sanitizePriority(this.options.priority),this.options.id===r.id&&(this.options.id=`${this.options.id}-${this._randomIndex()}`),this.promise=new this.Promise(((e,t)=>{this._resolve=e,this._reject=t})),this.retryCount=0}_sanitizePriority(e){var t;return(t=~~e!==e?DEFAULT_PRIORITY:e)<0?0:t>NUM_PRIORITIES-1?NUM_PRIORITIES-1:t}_randomIndex(){return Math.random().toString(36).slice(2)}doDrop({error:e,message:t="This job has been dropped by Bottleneck"}={}){return!!this._states.remove(this.options.id)&&(this.rejectOnDrop&&this._reject(null!=e?e:new BottleneckError$3(t)),this.Events.trigger("dropped",{args:this.args,options:this.options,task:this.task,promise:this.promise}),!0)}_assertStatus(e){var t;if((t=this._states.jobStatus(this.options.id))!==e&&("DONE"!==e||null!==t))throw new BottleneckError$3(`Invalid job status ${t}, expected ${e}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`)}doReceive(){return this._states.start(this.options.id),this.Events.trigger("received",{args:this.args,options:this.options})}doQueue(e,t){return this._assertStatus("RECEIVED"),this._states.next(this.options.id),this.Events.trigger("queued",{args:this.args,options:this.options,reachedHWM:e,blocked:t})}doRun(){return 0===this.retryCount?(this._assertStatus("QUEUED"),this._states.next(this.options.id)):this._assertStatus("EXECUTING"),this.Events.trigger("scheduled",{args:this.args,options:this.options})}doExecute(e,t,n,r){var i=this;return _asyncToGenerator$3((function*(){var s,o,a;0===i.retryCount?(i._assertStatus("RUNNING"),i._states.next(i.options.id)):i._assertStatus("EXECUTING"),o={args:i.args,options:i.options,retryCount:i.retryCount},i.Events.trigger("executing",o);try{if(a=yield null!=e?e.schedule(i.options,i.task,...i.args):i.task(...i.args),t())return i.doDone(o),yield r(i.options,o),i._assertStatus("DONE"),i._resolve(a)}catch(e){return s=e,i._onFailure(s,o,t,n,r)}}))()}doExpire(e,t,n){var r,i;return this._states.jobStatus("RUNNING"===this.options.id)&&this._states.next(this.options.id),this._assertStatus("EXECUTING"),i={args:this.args,options:this.options,retryCount:this.retryCount},r=new BottleneckError$3(`This job timed out after ${this.options.expiration} ms.`),this._onFailure(r,i,e,t,n)}_onFailure(e,t,n,r,i){var s=this;return _asyncToGenerator$3((function*(){var o,a;if(n())return null!=(o=yield s.Events.trigger("failed",e,t))?(a=~~o,s.Events.trigger("retry",`Retrying ${s.options.id} after ${a} ms`,t),s.retryCount++,r(a)):(s.doDone(t),yield i(s.options,t),s._assertStatus("DONE"),s._reject(e))}))()}doDone(e){return this._assertStatus("EXECUTING"),this._states.next(this.options.id),this.Events.trigger("done",e)}};var Job_1=Job,BottleneckError$2,LocalDatastore,parser$1;function asyncGeneratorStep$2(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$2(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep$2(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep$2(s,r,i,o,a,"throw",e)}o(void 0)}))}}parser$1=parser$3,BottleneckError$2=requireBottleneckError(),LocalDatastore=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.clientId=this.instance._randomIndex(),parser$1.load(n,n,this),this._nextRequest=this._lastReservoirRefresh=this._lastReservoirIncrease=Date.now(),this._running=0,this._done=0,this._unblockTime=0,this.ready=this.Promise.resolve(),this.clients={},this._startHeartbeat()}_startHeartbeat(){var e;return null==this.heartbeat&&(null!=this.storeOptions.reservoirRefreshInterval&&null!=this.storeOptions.reservoirRefreshAmount||null!=this.storeOptions.reservoirIncreaseInterval&&null!=this.storeOptions.reservoirIncreaseAmount)?"function"==typeof(e=this.heartbeat=setInterval((()=>{var e,t,n,r,i;if(r=Date.now(),null!=this.storeOptions.reservoirRefreshInterval&&r>=this._lastReservoirRefresh+this.storeOptions.reservoirRefreshInterval&&(this._lastReservoirRefresh=r,this.storeOptions.reservoir=this.storeOptions.reservoirRefreshAmount,this.instance._drainAll(this.computeCapacity())),null!=this.storeOptions.reservoirIncreaseInterval&&r>=this._lastReservoirIncrease+this.storeOptions.reservoirIncreaseInterval){var s=this.storeOptions;if(e=s.reservoirIncreaseAmount,n=s.reservoirIncreaseMaximum,i=s.reservoir,this._lastReservoirIncrease=r,(t=null!=n?Math.min(e,n-i):e)>0)return this.storeOptions.reservoir+=t,this.instance._drainAll(this.computeCapacity())}}),this.heartbeatInterval)).unref?e.unref():void 0:clearInterval(this.heartbeat)}__publish__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),t.instance.Events.trigger("message",e.toString())}))()}__disconnect__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),clearInterval(t.heartbeat),t.Promise.resolve()}))()}yieldLoop(e=0){return new this.Promise((function(t,n){return setTimeout(t,e)}))}computePenalty(){var e;return null!=(e=this.storeOptions.penalty)?e:15*this.storeOptions.minTime||5e3}__updateSettings__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),parser$1.overwrite(e,e,t.storeOptions),t._startHeartbeat(),t.instance._drainAll(t.computeCapacity()),!0}))()}__running__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e._running}))()}__queued__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e.instance.queued()}))()}__done__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e._done}))()}__groupCheck__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),t._nextRequest+t.timeout<e}))()}computeCapacity(){var e,t,n=this.storeOptions;return e=n.maxConcurrent,t=n.reservoir,null!=e&&null!=t?Math.min(e-this._running,t):null!=e?e-this._running:null!=t?t:null}conditionsCheck(e){var t;return null==(t=this.computeCapacity())||e<=t}__incrementReservoir__(e){var t=this;return _asyncToGenerator$2((function*(){var n;return yield t.yieldLoop(),n=t.storeOptions.reservoir+=e,t.instance._drainAll(t.computeCapacity()),n}))()}__currentReservoir__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e.storeOptions.reservoir}))()}isBlocked(e){return this._unblockTime>=e}check(e,t){return this.conditionsCheck(e)&&this._nextRequest-t<=0}__check__(e){var t=this;return _asyncToGenerator$2((function*(){var n;return yield t.yieldLoop(),n=Date.now(),t.check(e,n)}))()}__register__(e,t,n){var r=this;return _asyncToGenerator$2((function*(){var e,n;return yield r.yieldLoop(),e=Date.now(),r.conditionsCheck(t)?(r._running+=t,null!=r.storeOptions.reservoir&&(r.storeOptions.reservoir-=t),n=Math.max(r._nextRequest-e,0),r._nextRequest=e+n+r.storeOptions.minTime,{success:!0,wait:n,reservoir:r.storeOptions.reservoir}):{success:!1}}))()}strategyIsBlock(){return 3===this.storeOptions.strategy}__submit__(e,t){var n=this;return _asyncToGenerator$2((function*(){var r,i,s;if(yield n.yieldLoop(),null!=n.storeOptions.maxConcurrent&&t>n.storeOptions.maxConcurrent)throw new BottleneckError$2(`Impossible to add a job having a weight of ${t} to a limiter having a maxConcurrent setting of ${n.storeOptions.maxConcurrent}`);return i=Date.now(),s=null!=n.storeOptions.highWater&&e===n.storeOptions.highWater&&!n.check(t,i),(r=n.strategyIsBlock()&&(s||n.isBlocked(i)))&&(n._unblockTime=i+n.computePenalty(),n._nextRequest=n._unblockTime+n.storeOptions.minTime,n.instance._dropAllQueued()),{reachedHWM:s,blocked:r,strategy:n.storeOptions.strategy}}))()}__free__(e,t){var n=this;return _asyncToGenerator$2((function*(){return yield n.yieldLoop(),n._running-=t,n._done+=t,n.instance._drainAll(n.computeCapacity()),{running:n._running}}))()}};var LocalDatastore_1=LocalDatastore,Scripts={},require$$0={"blacklist_client.lua":"local blacklist = ARGV[num_static_argv + 1]\n\nif redis.call('zscore', client_last_seen_key, blacklist) then\n redis.call('zadd', client_last_seen_key, 0, blacklist)\nend\n\n\nreturn {}\n","check.lua":"local weight = tonumber(ARGV[num_static_argv + 1])\n\nlocal capacity = process_tick(now, false)['capacity']\nlocal nextRequest = tonumber(redis.call('hget', settings_key, 'nextRequest'))\n\nreturn conditions_check(capacity, weight) and nextRequest - now <= 0\n","conditions_check.lua":"local conditions_check = function (capacity, weight)\n return capacity == nil or weight <= capacity\nend\n","current_reservoir.lua":"return process_tick(now, false)['reservoir']\n","done.lua":"process_tick(now, false)\n\nreturn tonumber(redis.call('hget', settings_key, 'done'))\n","free.lua":"local index = ARGV[num_static_argv + 1]\n\nredis.call('zadd', job_expirations_key, 0, index)\n\nreturn process_tick(now, false)['running']\n","get_time.lua":"redis.replicate_commands()\n\nlocal get_time = function ()\n local time = redis.call('time')\n\n return tonumber(time[1]..string.sub(time[2], 1, 3))\nend\n","group_check.lua":"return not (redis.call('exists', settings_key) == 1)\n","heartbeat.lua":"process_tick(now, true)\n","increment_reservoir.lua":"local incr = tonumber(ARGV[num_static_argv + 1])\n\nredis.call('hincrby', settings_key, 'reservoir', incr)\n\nlocal reservoir = process_tick(now, true)['reservoir']\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn reservoir\n","init.lua":"local clear = tonumber(ARGV[num_static_argv + 1])\nlocal limiter_version = ARGV[num_static_argv + 2]\nlocal num_local_argv = num_static_argv + 2\n\nif clear == 1 then\n redis.call('del', unpack(KEYS))\nend\n\nif redis.call('exists', settings_key) == 0 then\n -- Create\n local args = {'hmset', settings_key}\n\n for i = num_local_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\n end\n\n redis.call(unpack(args))\n redis.call('hmset', settings_key,\n 'nextRequest', now,\n 'lastReservoirRefresh', now,\n 'lastReservoirIncrease', now,\n 'running', 0,\n 'done', 0,\n 'unblockTime', 0,\n 'capacityPriorityCounter', 0\n )\n\nelse\n -- Apply migrations\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'version'\n )\n local id = settings[1]\n local current_version = settings[2]\n\n if current_version ~= limiter_version then\n local version_digits = {}\n for k, v in string.gmatch(current_version, \"([^.]+)\") do\n table.insert(version_digits, tonumber(k))\n end\n\n -- 2.10.0\n if version_digits[2] < 10 then\n redis.call('hsetnx', settings_key, 'reservoirRefreshInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirRefreshAmount', '')\n redis.call('hsetnx', settings_key, 'lastReservoirRefresh', '')\n redis.call('hsetnx', settings_key, 'done', 0)\n redis.call('hset', settings_key, 'version', '2.10.0')\n end\n\n -- 2.11.1\n if version_digits[2] < 11 or (version_digits[2] == 11 and version_digits[3] < 1) then\n if redis.call('hstrlen', settings_key, 'lastReservoirRefresh') == 0 then\n redis.call('hmset', settings_key,\n 'lastReservoirRefresh', now,\n 'version', '2.11.1'\n )\n end\n end\n\n -- 2.14.0\n if version_digits[2] < 14 then\n local old_running_key = 'b_'..id..'_running'\n local old_executing_key = 'b_'..id..'_executing'\n\n if redis.call('exists', old_running_key) == 1 then\n redis.call('rename', old_running_key, job_weights_key)\n end\n if redis.call('exists', old_executing_key) == 1 then\n redis.call('rename', old_executing_key, job_expirations_key)\n end\n redis.call('hset', settings_key, 'version', '2.14.0')\n end\n\n -- 2.15.2\n if version_digits[2] < 15 or (version_digits[2] == 15 and version_digits[3] < 2) then\n redis.call('hsetnx', settings_key, 'capacityPriorityCounter', 0)\n redis.call('hset', settings_key, 'version', '2.15.2')\n end\n\n -- 2.17.0\n if version_digits[2] < 17 then\n redis.call('hsetnx', settings_key, 'clientTimeout', 10000)\n redis.call('hset', settings_key, 'version', '2.17.0')\n end\n\n -- 2.18.0\n if version_digits[2] < 18 then\n redis.call('hsetnx', settings_key, 'reservoirIncreaseInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseAmount', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseMaximum', '')\n redis.call('hsetnx', settings_key, 'lastReservoirIncrease', now)\n redis.call('hset', settings_key, 'version', '2.18.0')\n end\n\n end\n\n process_tick(now, false)\nend\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","process_tick.lua":"local process_tick = function (now, always_publish)\n\n local compute_capacity = function (maxConcurrent, running, reservoir)\n if maxConcurrent ~= nil and reservoir ~= nil then\n return math.min((maxConcurrent - running), reservoir)\n elseif maxConcurrent ~= nil then\n return maxConcurrent - running\n elseif reservoir ~= nil then\n return reservoir\n else\n return nil\n end\n end\n\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'running',\n 'reservoir',\n 'reservoirRefreshInterval',\n 'reservoirRefreshAmount',\n 'lastReservoirRefresh',\n 'reservoirIncreaseInterval',\n 'reservoirIncreaseAmount',\n 'reservoirIncreaseMaximum',\n 'lastReservoirIncrease',\n 'capacityPriorityCounter',\n 'clientTimeout'\n )\n local id = settings[1]\n local maxConcurrent = tonumber(settings[2])\n local running = tonumber(settings[3])\n local reservoir = tonumber(settings[4])\n local reservoirRefreshInterval = tonumber(settings[5])\n local reservoirRefreshAmount = tonumber(settings[6])\n local lastReservoirRefresh = tonumber(settings[7])\n local reservoirIncreaseInterval = tonumber(settings[8])\n local reservoirIncreaseAmount = tonumber(settings[9])\n local reservoirIncreaseMaximum = tonumber(settings[10])\n local lastReservoirIncrease = tonumber(settings[11])\n local capacityPriorityCounter = tonumber(settings[12])\n local clientTimeout = tonumber(settings[13])\n\n local initial_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n --\n -- Process 'running' changes\n --\n local expired = redis.call('zrangebyscore', job_expirations_key, '-inf', '('..now)\n\n if #expired > 0 then\n redis.call('zremrangebyscore', job_expirations_key, '-inf', '('..now)\n\n local flush_batch = function (batch, acc)\n local weights = redis.call('hmget', job_weights_key, unpack(batch))\n redis.call('hdel', job_weights_key, unpack(batch))\n local clients = redis.call('hmget', job_clients_key, unpack(batch))\n redis.call('hdel', job_clients_key, unpack(batch))\n\n -- Calculate sum of removed weights\n for i = 1, #weights do\n acc['total'] = acc['total'] + (tonumber(weights[i]) or 0)\n end\n\n -- Calculate sum of removed weights by client\n local client_weights = {}\n for i = 1, #clients do\n local removed = tonumber(weights[i]) or 0\n if removed > 0 then\n acc['client_weights'][clients[i]] = (acc['client_weights'][clients[i]] or 0) + removed\n end\n end\n end\n\n local acc = {\n ['total'] = 0,\n ['client_weights'] = {}\n }\n local batch_size = 1000\n\n -- Compute changes to Zsets and apply changes to Hashes\n for i = 1, #expired, batch_size do\n local batch = {}\n for j = i, math.min(i + batch_size - 1, #expired) do\n table.insert(batch, expired[j])\n end\n\n flush_batch(batch, acc)\n end\n\n -- Apply changes to Zsets\n if acc['total'] > 0 then\n redis.call('hincrby', settings_key, 'done', acc['total'])\n running = tonumber(redis.call('hincrby', settings_key, 'running', -acc['total']))\n end\n\n for client, weight in pairs(acc['client_weights']) do\n redis.call('zincrby', client_running_key, -weight, client)\n end\n end\n\n --\n -- Process 'reservoir' changes\n --\n local reservoirRefreshActive = reservoirRefreshInterval ~= nil and reservoirRefreshAmount ~= nil\n if reservoirRefreshActive and now >= lastReservoirRefresh + reservoirRefreshInterval then\n reservoir = reservoirRefreshAmount\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirRefresh', now\n )\n end\n\n local reservoirIncreaseActive = reservoirIncreaseInterval ~= nil and reservoirIncreaseAmount ~= nil\n if reservoirIncreaseActive and now >= lastReservoirIncrease + reservoirIncreaseInterval then\n local num_intervals = math.floor((now - lastReservoirIncrease) / reservoirIncreaseInterval)\n local incr = reservoirIncreaseAmount * num_intervals\n if reservoirIncreaseMaximum ~= nil then\n incr = math.min(incr, reservoirIncreaseMaximum - (reservoir or 0))\n end\n if incr > 0 then\n reservoir = (reservoir or 0) + incr\n end\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirIncrease', lastReservoirIncrease + (num_intervals * reservoirIncreaseInterval)\n )\n end\n\n --\n -- Clear unresponsive clients\n --\n local unresponsive = redis.call('zrangebyscore', client_last_seen_key, '-inf', (now - clientTimeout))\n local unresponsive_lookup = {}\n local terminated_clients = {}\n for i = 1, #unresponsive do\n unresponsive_lookup[unresponsive[i]] = true\n if tonumber(redis.call('zscore', client_running_key, unresponsive[i])) == 0 then\n table.insert(terminated_clients, unresponsive[i])\n end\n end\n if #terminated_clients > 0 then\n redis.call('zrem', client_running_key, unpack(terminated_clients))\n redis.call('hdel', client_num_queued_key, unpack(terminated_clients))\n redis.call('zrem', client_last_registered_key, unpack(terminated_clients))\n redis.call('zrem', client_last_seen_key, unpack(terminated_clients))\n end\n\n --\n -- Broadcast capacity changes\n --\n local final_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n if always_publish or (initial_capacity ~= nil and final_capacity == nil) then\n -- always_publish or was not unlimited, now unlimited\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n\n elseif initial_capacity ~= nil and final_capacity ~= nil and final_capacity > initial_capacity then\n -- capacity was increased\n -- send the capacity message to the limiter having the lowest number of running jobs\n -- the tiebreaker is the limiter having not registered a job in the longest time\n\n local lowest_concurrency_value = nil\n local lowest_concurrency_clients = {}\n local lowest_concurrency_last_registered = {}\n local client_concurrencies = redis.call('zrange', client_running_key, 0, -1, 'withscores')\n\n for i = 1, #client_concurrencies, 2 do\n local client = client_concurrencies[i]\n local concurrency = tonumber(client_concurrencies[i+1])\n\n if (\n lowest_concurrency_value == nil or lowest_concurrency_value == concurrency\n ) and (\n not unresponsive_lookup[client]\n ) and (\n tonumber(redis.call('hget', client_num_queued_key, client)) > 0\n ) then\n lowest_concurrency_value = concurrency\n table.insert(lowest_concurrency_clients, client)\n local last_registered = tonumber(redis.call('zscore', client_last_registered_key, client))\n table.insert(lowest_concurrency_last_registered, last_registered)\n end\n end\n\n if #lowest_concurrency_clients > 0 then\n local position = 1\n local earliest = lowest_concurrency_last_registered[1]\n\n for i,v in ipairs(lowest_concurrency_last_registered) do\n if v < earliest then\n position = i\n earliest = v\n end\n end\n\n local next_client = lowest_concurrency_clients[position]\n redis.call('publish', 'b_'..id,\n 'capacity-priority:'..(final_capacity or '')..\n ':'..next_client..\n ':'..capacityPriorityCounter\n )\n redis.call('hincrby', settings_key, 'capacityPriorityCounter', '1')\n else\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n end\n end\n\n return {\n ['capacity'] = final_capacity,\n ['running'] = running,\n ['reservoir'] = reservoir\n }\nend\n","queued.lua":"local clientTimeout = tonumber(redis.call('hget', settings_key, 'clientTimeout'))\nlocal valid_clients = redis.call('zrangebyscore', client_last_seen_key, (now - clientTimeout), 'inf')\nlocal client_queued = redis.call('hmget', client_num_queued_key, unpack(valid_clients))\n\nlocal sum = 0\nfor i = 1, #client_queued do\n sum = sum + tonumber(client_queued[i])\nend\n\nreturn sum\n","refresh_expiration.lua":"local refresh_expiration = function (now, nextRequest, groupTimeout)\n\n if groupTimeout ~= nil then\n local ttl = (nextRequest + groupTimeout) - now\n\n for i = 1, #KEYS do\n redis.call('pexpire', KEYS[i], ttl)\n end\n end\n\nend\n","refs.lua":"local settings_key = KEYS[1]\nlocal job_weights_key = KEYS[2]\nlocal job_expirations_key = KEYS[3]\nlocal job_clients_key = KEYS[4]\nlocal client_running_key = KEYS[5]\nlocal client_num_queued_key = KEYS[6]\nlocal client_last_registered_key = KEYS[7]\nlocal client_last_seen_key = KEYS[8]\n\nlocal now = tonumber(ARGV[1])\nlocal client = ARGV[2]\n\nlocal num_static_argv = 2\n","register.lua":"local index = ARGV[num_static_argv + 1]\nlocal weight = tonumber(ARGV[num_static_argv + 2])\nlocal expiration = tonumber(ARGV[num_static_argv + 3])\n\nlocal state = process_tick(now, false)\nlocal capacity = state['capacity']\nlocal reservoir = state['reservoir']\n\nlocal settings = redis.call('hmget', settings_key,\n 'nextRequest',\n 'minTime',\n 'groupTimeout'\n)\nlocal nextRequest = tonumber(settings[1])\nlocal minTime = tonumber(settings[2])\nlocal groupTimeout = tonumber(settings[3])\n\nif conditions_check(capacity, weight) then\n\n redis.call('hincrby', settings_key, 'running', weight)\n redis.call('hset', job_weights_key, index, weight)\n if expiration ~= nil then\n redis.call('zadd', job_expirations_key, now + expiration, index)\n end\n redis.call('hset', job_clients_key, index, client)\n redis.call('zincrby', client_running_key, weight, client)\n redis.call('hincrby', client_num_queued_key, client, -1)\n redis.call('zadd', client_last_registered_key, now, client)\n\n local wait = math.max(nextRequest - now, 0)\n local newNextRequest = now + wait + minTime\n\n if reservoir == nil then\n redis.call('hset', settings_key,\n 'nextRequest', newNextRequest\n )\n else\n reservoir = reservoir - weight\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'nextRequest', newNextRequest\n )\n end\n\n refresh_expiration(now, newNextRequest, groupTimeout)\n\n return {true, wait, reservoir}\n\nelse\n return {false}\nend\n","register_client.lua":"local queued = tonumber(ARGV[num_static_argv + 1])\n\n-- Could have been re-registered concurrently\nif not redis.call('zscore', client_last_seen_key, client) then\n redis.call('zadd', client_running_key, 0, client)\n redis.call('hset', client_num_queued_key, client, queued)\n redis.call('zadd', client_last_registered_key, 0, client)\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n\nreturn {}\n","running.lua":"return process_tick(now, false)['running']\n","submit.lua":"local queueLength = tonumber(ARGV[num_static_argv + 1])\nlocal weight = tonumber(ARGV[num_static_argv + 2])\n\nlocal capacity = process_tick(now, false)['capacity']\n\nlocal settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'highWater',\n 'nextRequest',\n 'strategy',\n 'unblockTime',\n 'penalty',\n 'minTime',\n 'groupTimeout'\n)\nlocal id = settings[1]\nlocal maxConcurrent = tonumber(settings[2])\nlocal highWater = tonumber(settings[3])\nlocal nextRequest = tonumber(settings[4])\nlocal strategy = tonumber(settings[5])\nlocal unblockTime = tonumber(settings[6])\nlocal penalty = tonumber(settings[7])\nlocal minTime = tonumber(settings[8])\nlocal groupTimeout = tonumber(settings[9])\n\nif maxConcurrent ~= nil and weight > maxConcurrent then\n return redis.error_reply('OVERWEIGHT:'..weight..':'..maxConcurrent)\nend\n\nlocal reachedHWM = (highWater ~= nil and queueLength == highWater\n and not (\n conditions_check(capacity, weight)\n and nextRequest - now <= 0\n )\n)\n\nlocal blocked = strategy == 3 and (reachedHWM or unblockTime >= now)\n\nif blocked then\n local computedPenalty = penalty\n if computedPenalty == nil then\n if minTime == 0 then\n computedPenalty = 5000\n else\n computedPenalty = 15 * minTime\n end\n end\n\n local newNextRequest = now + computedPenalty + minTime\n\n redis.call('hmset', settings_key,\n 'unblockTime', now + computedPenalty,\n 'nextRequest', newNextRequest\n )\n\n local clients_queued_reset = redis.call('hkeys', client_num_queued_key)\n local queued_reset = {}\n for i = 1, #clients_queued_reset do\n table.insert(queued_reset, clients_queued_reset[i])\n table.insert(queued_reset, 0)\n end\n redis.call('hmset', client_num_queued_key, unpack(queued_reset))\n\n redis.call('publish', 'b_'..id, 'blocked:')\n\n refresh_expiration(now, newNextRequest, groupTimeout)\nend\n\nif not blocked and not reachedHWM then\n redis.call('hincrby', client_num_queued_key, client, 1)\nend\n\nreturn {reachedHWM, blocked, strategy}\n","update_settings.lua":"local args = {'hmset', settings_key}\n\nfor i = num_static_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\nend\n\nredis.call(unpack(args))\n\nprocess_tick(now, true)\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","validate_client.lua":"if not redis.call('zscore', client_last_seen_key, client) then\n return redis.error_reply('UNKNOWN_CLIENT')\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n","validate_keys.lua":"if not (redis.call('exists', settings_key) == 1) then\n return redis.error_reply('SETTINGS_KEY_NOT_FOUND')\nend\n"},hasRequiredScripts,RedisConnection_1,hasRequiredRedisConnection,IORedisConnection_1,hasRequiredIORedisConnection,BottleneckError$1,IORedisConnection,RedisConnection,RedisDatastore,parser;function requireScripts(){return hasRequiredScripts||(hasRequiredScripts=1,function(e){var t,n,r;t={refs:(n=require$$0)["refs.lua"],validate_keys:n["validate_keys.lua"],validate_client:n["validate_client.lua"],refresh_expiration:n["refresh_expiration.lua"],process_tick:n["process_tick.lua"],conditions_check:n["conditions_check.lua"],get_time:n["get_time.lua"]},e.allKeys=function(e){return[`b_${e}_settings`,`b_${e}_job_weights`,`b_${e}_job_expirations`,`b_${e}_job_clients`,`b_${e}_client_running`,`b_${e}_client_num_queued`,`b_${e}_client_last_registered`,`b_${e}_client_last_seen`]},r={init:{keys:e.allKeys,headers:["process_tick"],refresh_expiration:!0,code:n["init.lua"]},group_check:{keys:e.allKeys,headers:[],refresh_expiration:!1,code:n["group_check.lua"]},register_client:{keys:e.allKeys,headers:["validate_keys"],refresh_expiration:!1,code:n["register_client.lua"]},blacklist_client:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["blacklist_client.lua"]},heartbeat:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["heartbeat.lua"]},update_settings:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["update_settings.lua"]},running:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["running.lua"]},queued:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["queued.lua"]},done:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["done.lua"]},check:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!1,code:n["check.lua"]},submit:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["submit.lua"]},register:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["register.lua"]},free:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["free.lua"]},current_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["current_reservoir.lua"]},increment_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["increment_reservoir.lua"]}},e.names=Object.keys(r),e.keys=function(e,t){return r[e].keys(t)},e.payload=function(e){var n;return n=r[e],Array.prototype.concat(t.refs,n.headers.map((function(e){return t[e]})),n.refresh_expiration?t.refresh_expiration:"",n.code).join("\n")}}(Scripts)),Scripts}function requireRedisConnection(){if(hasRequiredRedisConnection)return RedisConnection_1;function asyncGeneratorStep(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep(s,r,i,o,a,"throw",e)}o(void 0)}))}}var Events,RedisConnection,Scripts,parser;return hasRequiredRedisConnection=1,parser=parser$3,Events=Events_1,Scripts=requireScripts(),RedisConnection=function(){class RedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("redis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null==this.client&&(this.client=this.Redis.createClient(this.clientOptions)),this.subscriber=this.client.duplicate(),this.limiters={},this.shas={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then((()=>this._loadScripts())).then((()=>({client:this.client,subscriber:this.subscriber})))}_setup(e,t){return e.setMaxListeners(0),new this.Promise(((n,r)=>(e.on("error",(e=>this.Events.trigger("error",e))),t&&e.on("message",((e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0})),e.ready?n():e.once("ready",n))))}_loadScript(e){return new this.Promise(((t,n)=>{var r;return r=Scripts.payload(e),this.client.multi([["script","load",r]]).exec(((r,i)=>null!=r?n(r):(this.shas[e]=i[0],t(i[0]))))}))}_loadScripts(){return this.Promise.all(Scripts.names.map((e=>this._loadScript(e))))}__runCommand__(e){var t=this;return _asyncToGenerator((function*(){return yield t.ready,new t.Promise(((n,r)=>t.client.multi([e]).exec_atomic((function(e,t){return null!=e?r(e):n(t[0])}))))}))()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map((t=>new this.Promise(((n,r)=>{var i;return i=r=>{if(r===t)return this.subscriber.removeListener("subscribe",i),this.limiters[t]=e,n()},this.subscriber.on("subscribe",i),this.subscriber.subscribe(t)})))))}__removeLimiter__(e){var t=this;return this.Promise.all([e.channel(),e.channel_client()].map(function(){var e=_asyncToGenerator((function*(e){return t.terminated||(yield new t.Promise(((n,r)=>t.subscriber.unsubscribe(e,(function(t,i){return null!=t?r(t):i===e?n():void 0}))))),delete t.limiters[e]}));return function(t){return e.apply(this,arguments)}}()))}__scriptArgs__(e,t,n,r){var i;return i=Scripts.keys(e,t),[this.shas[e],i.length].concat(i,n,r)}__scriptFn__(e){return this.client.evalsha.bind(this.client)}disconnect(e=!0){var t,n,r,i;for(t=0,r=(i=Object.keys(this.limiters)).length;t<r;t++)n=i[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,this.client.end(e),this.subscriber.end(e),this.Promise.resolve()}}return RedisConnection.prototype.datastore="redis",RedisConnection.prototype.defaults={Redis:null,clientOptions:{},client:null,Promise:Promise,Events:null},RedisConnection}.call(void 0),RedisConnection_1=RedisConnection,RedisConnection_1}function requireIORedisConnection(){if(hasRequiredIORedisConnection)return IORedisConnection_1;function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep(s,r,i,o,a,"throw",e)}o(void 0)}))}}var Events,IORedisConnection,Scripts,parser;return hasRequiredIORedisConnection=1,parser=parser$3,Events=Events_1,Scripts=requireScripts(),IORedisConnection=function(){class IORedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("ioredis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null!=this.clusterNodes?(this.client=new this.Redis.Cluster(this.clusterNodes,this.clientOptions),this.subscriber=new this.Redis.Cluster(this.clusterNodes,this.clientOptions)):null!=this.client&&null==this.client.duplicate?this.subscriber=new this.Redis.Cluster(this.client.startupNodes,this.client.options):(null==this.client&&(this.client=new this.Redis(this.clientOptions)),this.subscriber=this.client.duplicate()),this.limiters={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then((()=>(this._loadScripts(),{client:this.client,subscriber:this.subscriber})))}_setup(e,t){return e.setMaxListeners(0),new this.Promise(((n,r)=>(e.on("error",(e=>this.Events.trigger("error",e))),t&&e.on("message",((e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0})),"ready"===e.status?n():e.once("ready",n))))}_loadScripts(){return Scripts.names.forEach((e=>this.client.defineCommand(e,{lua:Scripts.payload(e)})))}__runCommand__(e){var t=this;return _asyncToGenerator((function*(){yield t.ready;var n=_slicedToArray(yield t.client.pipeline([e]).exec(),1),r=_slicedToArray(n[0],2);return r[0],r[1]}))()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map((t=>new this.Promise(((n,r)=>this.subscriber.subscribe(t,(()=>(this.limiters[t]=e,n()))))))))}__removeLimiter__(e){var t=this;return[e.channel(),e.channel_client()].forEach(function(){var e=_asyncToGenerator((function*(e){return t.terminated||(yield t.subscriber.unsubscribe(e)),delete t.limiters[e]}));return function(t){return e.apply(this,arguments)}}())}__scriptArgs__(e,t,n,r){var i;return[(i=Scripts.keys(e,t)).length].concat(i,n,r)}__scriptFn__(e){return this.client[e].bind(this.client)}disconnect(e=!0){var t,n,r,i;for(t=0,r=(i=Object.keys(this.limiters)).length;t<r;t++)n=i[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,e?this.Promise.all([this.client.quit(),this.subscriber.quit()]):(this.client.disconnect(),this.subscriber.disconnect(),this.Promise.resolve())}}return IORedisConnection.prototype.datastore="ioredis",IORedisConnection.prototype.defaults={Redis:null,clientOptions:{},clusterNodes:null,client:null,Promise:Promise,Events:null},IORedisConnection}.call(void 0),IORedisConnection_1=IORedisConnection,IORedisConnection_1}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep$1(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$1(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep$1(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep$1(s,r,i,o,a,"throw",e)}o(void 0)}))}}parser=parser$3,BottleneckError$1=requireBottleneckError(),RedisConnection=requireRedisConnection(),IORedisConnection=requireIORedisConnection(),RedisDatastore=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.originalId=this.instance.id,this.clientId=this.instance._randomIndex(),parser.load(n,n,this),this.clients={},this.capacityPriorityCounters={},this.sharedConnection=null!=this.connection,null==this.connection&&(this.connection="redis"===this.instance.datastore?new RedisConnection({Redis:this.Redis,clientOptions:this.clientOptions,Promise:this.Promise,Events:this.instance.Events}):"ioredis"===this.instance.datastore?new IORedisConnection({Redis:this.Redis,clientOptions:this.clientOptions,clusterNodes:this.clusterNodes,Promise:this.Promise,Events:this.instance.Events}):void 0),this.instance.connection=this.connection,this.instance.datastore=this.connection.datastore,this.ready=this.connection.ready.then((e=>(this.clients=e,this.runScript("init",this.prepareInitSettings(this.clearDatastore))))).then((()=>this.connection.__addLimiter__(this.instance))).then((()=>this.runScript("register_client",[this.instance.queued()]))).then((()=>{var e;return"function"==typeof(e=this.heartbeat=setInterval((()=>this.runScript("heartbeat",[]).catch((e=>this.instance.Events.trigger("error",e)))),this.heartbeatInterval)).unref&&e.unref(),this.clients}))}__publish__(e){var t=this;return _asyncToGenerator$1((function*(){return(yield t.ready).client.publish(t.instance.channel(),`message:${e.toString()}`)}))()}onMessage(e,t){var n=this;return _asyncToGenerator$1((function*(){var e,r,i,s,o,a,c,u,d,l;try{c=t.indexOf(":");var p=[t.slice(0,c),t.slice(c+1)];if(i=p[1],"capacity"===(l=p[0]))return yield n.instance._drainAll(i.length>0?~~i:void 0);if("capacity-priority"===l){var m=_slicedToArray(i.split(":"),3);return d=m[0],u=m[1],r=m[2],e=d.length>0?~~d:void 0,u===n.clientId?(s=yield n.instance._drainAll(e),a=null!=e?e-(s||0):"",yield n.clients.client.publish(n.instance.channel(),`capacity-priority:${a}::${r}`)):""===u?(clearTimeout(n.capacityPriorityCounters[r]),delete n.capacityPriorityCounters[r],n.instance._drainAll(e)):n.capacityPriorityCounters[r]=setTimeout(_asyncToGenerator$1((function*(){var t;try{return delete n.capacityPriorityCounters[r],yield n.runScript("blacklist_client",[u]),yield n.instance._drainAll(e)}catch(e){return t=e,n.instance.Events.trigger("error",t)}})),1e3)}if("message"===l)return n.instance.Events.trigger("message",i);if("blocked"===l)return yield n.instance._dropAllQueued()}catch(e){return o=e,n.instance.Events.trigger("error",o)}}))()}__disconnect__(e){return clearInterval(this.heartbeat),this.sharedConnection?this.connection.__removeLimiter__(this.instance):this.connection.disconnect(e)}runScript(e,t){var n=this;return _asyncToGenerator$1((function*(){return"init"!==e&&"register_client"!==e&&(yield n.ready),new n.Promise(((r,i)=>{var s,o;return s=[Date.now(),n.clientId].concat(t),n.instance.Events.trigger("debug",`Calling Redis script: ${e}.lua`,s),o=n.connection.__scriptArgs__(e,n.originalId,s,(function(e,t){return null!=e?i(e):r(t)})),n.connection.__scriptFn__(e)(...o)})).catch((r=>"SETTINGS_KEY_NOT_FOUND"===r.message?"heartbeat"===e?n.Promise.resolve():n.runScript("init",n.prepareInitSettings(!1)).then((()=>n.runScript(e,t))):"UNKNOWN_CLIENT"===r.message?n.runScript("register_client",[n.instance.queued()]).then((()=>n.runScript(e,t))):n.Promise.reject(r)))}))()}prepareArray(e){var t,n,r,i;for(r=[],t=0,n=e.length;t<n;t++)i=e[t],r.push(null!=i?i.toString():"");return r}prepareObject(e){var t,n,r;for(n in t=[],e)r=e[n],t.push(n,null!=r?r.toString():"");return t}prepareInitSettings(e){var t;return(t=this.prepareObject(Object.assign({},this.storeOptions,{id:this.originalId,version:this.instance.version,groupTimeout:this.timeout,clientTimeout:this.clientTimeout}))).unshift(e?1:0,this.instance.version),t}convertBool(e){return!!e}__updateSettings__(e){var t=this;return _asyncToGenerator$1((function*(){return yield t.runScript("update_settings",t.prepareObject(e)),parser.overwrite(e,e,t.storeOptions)}))()}__running__(){return this.runScript("running",[])}__queued__(){return this.runScript("queued",[])}__done__(){return this.runScript("done",[])}__groupCheck__(){var e=this;return _asyncToGenerator$1((function*(){return e.convertBool(yield e.runScript("group_check",[]))}))()}__incrementReservoir__(e){return this.runScript("increment_reservoir",[e])}__currentReservoir__(){return this.runScript("current_reservoir",[])}__check__(e){var t=this;return _asyncToGenerator$1((function*(){return t.convertBool(yield t.runScript("check",t.prepareArray([e])))}))()}__register__(e,t,n){var r=this;return _asyncToGenerator$1((function*(){var i,s,o,a=_slicedToArray(yield r.runScript("register",r.prepareArray([e,t,n])),3);return s=a[0],o=a[1],i=a[2],{success:r.convertBool(s),wait:o,reservoir:i}}))()}__submit__(e,t){var n=this;return _asyncToGenerator$1((function*(){var r,i,s,o,a;try{var c=_slicedToArray(yield n.runScript("submit",n.prepareArray([e,t])),3);return o=c[0],r=c[1],a=c[2],{reachedHWM:n.convertBool(o),blocked:n.convertBool(r),strategy:a}}catch(e){if(0===(i=e).message.indexOf("OVERWEIGHT")){var u=_slicedToArray(i.message.split(":"),3);throw u[0],t=u[1],s=u[2],new BottleneckError$1(`Impossible to add a job having a weight of ${t} to a limiter having a maxConcurrent setting of ${s}`)}throw i}}))()}__free__(e,t){var n=this;return _asyncToGenerator$1((function*(){return{running:yield n.runScript("free",n.prepareArray([e]))}}))()}};var RedisDatastore_1=RedisDatastore,BottleneckError,States;BottleneckError=requireBottleneckError(),States=class{constructor(e){this.status=e,this._jobs={},this.counts=this.status.map((function(){return 0}))}next(e){var t,n;return n=(t=this._jobs[e])+1,null!=t&&n<this.status.length?(this.counts[t]--,this.counts[n]++,this._jobs[e]++):null!=t?(this.counts[t]--,delete this._jobs[e]):void 0}start(e){return this._jobs[e]=0,this.counts[0]++}remove(e){var t;return null!=(t=this._jobs[e])&&(this.counts[t]--,delete this._jobs[e]),null!=t}jobStatus(e){var t;return null!=(t=this.status[this._jobs[e]])?t:null}statusJobs(e){var t,n,r,i;if(null!=e){if((n=this.status.indexOf(e))<0)throw new BottleneckError(`status must be one of ${this.status.join(", ")}`);for(t in i=[],r=this._jobs)r[t]===n&&i.push(t);return i}return Object.keys(this._jobs)}statusCounts(){return this.counts.reduce(((e,t,n)=>(e[this.status[n]]=t,e)),{})}};var States_1=States,DLList,Sync;function asyncGeneratorStep(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){asyncGeneratorStep(s,r,i,o,a,"next",e)}function a(e){asyncGeneratorStep(s,r,i,o,a,"throw",e)}o(void 0)}))}}DLList=DLList_1,Sync=class{constructor(e,t){this.schedule=this.schedule.bind(this),this.name=e,this.Promise=t,this._running=0,this._queue=new DLList}isEmpty(){return 0===this._queue.length}_tryToRun(){var e=this;return _asyncToGenerator((function*(){var t,n,r,i,s,o,a;if(e._running<1&&e._queue.length>0){e._running++;var c=e._queue.shift();return a=c.task,t=c.args,s=c.resolve,i=c.reject,n=yield _asyncToGenerator((function*(){try{return o=yield a(...t),function(){return s(o)}}catch(e){return r=e,function(){return i(r)}}}))(),e._running--,e._tryToRun(),n()}}))()}schedule(e,...t){var n,r,i;return i=r=null,n=new this.Promise((function(e,t){return i=e,r=t})),this._queue.push({task:e,args:t,resolve:i,reject:r}),this._tryToRun(),n}};var Sync_1=Sync;const version="2.19.5";var require$$8={version:version},Group_1,hasRequiredGroup,Batcher_1,hasRequiredBatcher,Bottleneck_1,hasRequiredBottleneck;function requireGroup(){if(hasRequiredGroup)return Group_1;function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function t(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(i,s){var o=e.apply(n,r);function a(e){t(o,i,s,a,c,"next",e)}function c(e){t(o,i,s,a,c,"throw",e)}a(void 0)}))}}var r,i,s,o,a,c;return hasRequiredGroup=1,c=parser$3,r=Events_1,o=requireRedisConnection(),s=requireIORedisConnection(),a=requireScripts(),i=function(){class t{constructor(e={}){this.deleteKey=this.deleteKey.bind(this),this.limiterOptions=e,c.load(this.limiterOptions,this.defaults,this),this.Events=new r(this),this.instances={},this.Bottleneck=requireBottleneck(),this._startAutoCleanup(),this.sharedConnection=null!=this.connection,null==this.connection&&("redis"===this.limiterOptions.datastore?this.connection=new o(Object.assign({},this.limiterOptions,{Events:this.Events})):"ioredis"===this.limiterOptions.datastore&&(this.connection=new s(Object.assign({},this.limiterOptions,{Events:this.Events}))))}key(e=""){var t;return null!=(t=this.instances[e])?t:(()=>{var t;return t=this.instances[e]=new this.Bottleneck(Object.assign(this.limiterOptions,{id:`${this.id}-${e}`,timeout:this.timeout,connection:this.connection})),this.Events.trigger("created",t,e),t})()}deleteKey(e=""){var t=this;return n((function*(){var n,r;return r=t.instances[e],t.connection&&(n=yield t.connection.__runCommand__(["del",...a.allKeys(`${t.id}-${e}`)])),null!=r&&(delete t.instances[e],yield r.disconnect()),null!=r||n>0}))()}limiters(){var e,t,n,r;for(e in n=[],t=this.instances)r=t[e],n.push({key:e,limiter:r});return n}keys(){return Object.keys(this.instances)}clusterKeys(){var t=this;return n((function*(){var n,r,i,s,o,a,c;if(null==t.connection)return t.Promise.resolve(t.keys());for(o=[],n=null,c=`b_${t.id}-`.length,9;0!==n;){var u=e(yield t.connection.__runCommand__(["scan",null!=n?n:0,"match",`b_${t.id}-*_settings`,"count",1e4]),2);for(n=~~u[0],i=0,a=(r=u[1]).length;i<a;i++)s=r[i],o.push(s.slice(c,-9))}return o}))()}_startAutoCleanup(){var e,t=this;return clearInterval(this.interval),"function"==typeof(e=this.interval=setInterval(n((function*(){var e,n,r,i,s,o;for(n in s=Date.now(),i=[],r=t.instances){o=r[n];try{(yield o._store.__groupCheck__(s))?i.push(t.deleteKey(n)):i.push(void 0)}catch(t){e=t,i.push(o.Events.trigger("error",e))}}return i})),this.timeout/2)).unref?e.unref():void 0}updateSettings(e={}){if(c.overwrite(e,this.defaults,this),c.overwrite(e,e,this.limiterOptions),null!=e.timeout)return this._startAutoCleanup()}disconnect(e=!0){var t;if(!this.sharedConnection)return null!=(t=this.connection)?t.disconnect(e):void 0}}return t.prototype.defaults={timeout:3e5,connection:null,Promise:Promise,id:"group-key"},t}.call(void 0),Group_1=i}function requireBatcher(){return hasRequiredBatcher?Batcher_1:(hasRequiredBatcher=1,n=parser$3,t=Events_1,e=function(){class e{constructor(e={}){this.options=e,n.load(this.options,this.defaults,this),this.Events=new t(this),this._arr=[],this._resetPromise(),this._lastFlush=Date.now()}_resetPromise(){return this._promise=new this.Promise(((e,t)=>this._resolve=e))}_flush(){return clearTimeout(this._timeout),this._lastFlush=Date.now(),this._resolve(),this.Events.trigger("batch",this._arr),this._arr=[],this._resetPromise()}add(e){var t;return this._arr.push(e),t=this._promise,this._arr.length===this.maxSize?this._flush():null!=this.maxTime&&1===this._arr.length&&(this._timeout=setTimeout((()=>this._flush()),this.maxTime)),t}}return e.prototype.defaults={maxTime:null,maxSize:null,Promise:Promise},e}.call(void 0),Batcher_1=e);var e,t,n}function requireBottleneck(){if(hasRequiredBottleneck)return Bottleneck_1;function e(e,t){return r(e)||function(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}(e,t)||n()}function t(e){return r(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function r(e){if(Array.isArray(e))return e}function i(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,s){var o=e.apply(t,n);function a(e){i(o,r,s,a,c,"next",e)}function c(e){i(o,r,s,a,c,"throw",e)}a(void 0)}))}}hasRequiredBottleneck=1;var o,a,c,u,d,l,p,m,h,f=[].splice;return h=parser$3,d=Queues_1,c=Job_1,u=LocalDatastore_1,l=RedisDatastore_1,a=Events_1,p=States_1,m=Sync_1,o=function(){class n{constructor(e={},...t){var r,i;this._addToQueue=this._addToQueue.bind(this),this._validateOptions(e,t),h.load(e,this.instanceDefaults,this),this._queues=new d(10),this._scheduled={},this._states=new p(["RECEIVED","QUEUED","RUNNING","EXECUTING"].concat(this.trackDoneStatus?["DONE"]:[])),this._limiter=null,this.Events=new a(this),this._submitLock=new m("submit",this.Promise),this._registerLock=new m("register",this.Promise),i=h.load(e,this.storeDefaults,{}),this._store=function(){if("redis"===this.datastore||"ioredis"===this.datastore||null!=this.connection)return r=h.load(e,this.redisStoreDefaults,{}),new l(this,i,r);if("local"===this.datastore)return r=h.load(e,this.localStoreDefaults,{}),new u(this,i,r);throw new n.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`)}.call(this),this._queues.on("leftzero",(()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.ref?e.ref():void 0})),this._queues.on("zero",(()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.unref?e.unref():void 0}))}_validateOptions(e,t){if(null==e||"object"!=typeof e||0!==t.length)throw new n.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1.")}ready(){return this._store.ready}clients(){return this._store.clients}channel(){return`b_${this.id}`}channel_client(){return`b_${this.id}_${this._store.clientId}`}publish(e){return this._store.__publish__(e)}disconnect(e=!0){return this._store.__disconnect__(e)}chain(e){return this._limiter=e,this}queued(e){return this._queues.queued(e)}clusterQueued(){return this._store.__queued__()}empty(){return 0===this.queued()&&this._submitLock.isEmpty()}running(){return this._store.__running__()}done(){return this._store.__done__()}jobStatus(e){return this._states.jobStatus(e)}jobs(e){return this._states.statusJobs(e)}counts(){return this._states.statusCounts()}_randomIndex(){return Math.random().toString(36).slice(2)}check(e=1){return this._store.__check__(e)}_clearGlobalState(e){return null!=this._scheduled[e]&&(clearTimeout(this._scheduled[e].expiration),delete this._scheduled[e],!0)}_free(e,t,n,r){var i=this;return s((function*(){var t,s;try{if(s=(yield i._store.__free__(e,n.weight)).running,i.Events.trigger("debug",`Freed ${n.id}`,r),0===s&&i.empty())return i.Events.trigger("idle")}catch(e){return t=e,i.Events.trigger("error",t)}}))()}_run(e,t,n){var r,i,s;return t.doRun(),r=this._clearGlobalState.bind(this,e),s=this._run.bind(this,e,t),i=this._free.bind(this,e,t),this._scheduled[e]={timeout:setTimeout((()=>t.doExecute(this._limiter,r,s,i)),n),expiration:null!=t.options.expiration?setTimeout((function(){return t.doExpire(r,s,i)}),n+t.options.expiration):void 0,job:t}}_drainOne(e){return this._registerLock.schedule((()=>{var t,n,r,i,s;if(0===this.queued())return this.Promise.resolve(null);s=this._queues.getFirst();var o=r=s.first();return i=o.options,t=o.args,null!=e&&i.weight>e?this.Promise.resolve(null):(this.Events.trigger("debug",`Draining ${i.id}`,{args:t,options:i}),n=this._randomIndex(),this._store.__register__(n,i.weight,i.expiration).then((({success:e,wait:o,reservoir:a})=>{var c;return this.Events.trigger("debug",`Drained ${i.id}`,{success:e,args:t,options:i}),e?(s.shift(),(c=this.empty())&&this.Events.trigger("empty"),0===a&&this.Events.trigger("depleted",c),this._run(n,r,o),this.Promise.resolve(i.weight)):this.Promise.resolve(null)})))}))}_drainAll(e,t=0){return this._drainOne(e).then((n=>{var r;return null!=n?(r=null!=e?e-n:e,this._drainAll(r,t+n)):this.Promise.resolve(t)})).catch((e=>this.Events.trigger("error",e)))}_dropAllQueued(e){return this._queues.shiftAll((function(t){return t.doDrop({message:e})}))}stop(e={}){var t,r;return e=h.load(e,this.stopDefaults),r=e=>{var t;return t=()=>{var t;return(t=this._states.counts)[0]+t[1]+t[2]+t[3]===e},new this.Promise(((e,n)=>t()?e():this.on("done",(()=>{if(t())return this.removeAllListeners("done"),e()}))))},t=e.dropWaitingJobs?(this._run=function(t,n){return n.doDrop({message:e.dropErrorMessage})},this._drainOne=()=>this.Promise.resolve(null),this._registerLock.schedule((()=>this._submitLock.schedule((()=>{var t,n,i;for(t in n=this._scheduled)i=n[t],"RUNNING"===this.jobStatus(i.job.options.id)&&(clearTimeout(i.timeout),clearTimeout(i.expiration),i.job.doDrop({message:e.dropErrorMessage}));return this._dropAllQueued(e.dropErrorMessage),r(0)}))))):this.schedule({priority:9,weight:0},(()=>r(1))),this._receive=function(t){return t._reject(new n.prototype.BottleneckError(e.enqueueErrorMessage))},this.stop=()=>this.Promise.reject(new n.prototype.BottleneckError("stop() has already been called")),t}_addToQueue(e){var t=this;return s((function*(){var r,i,s,o,a,c,u;r=e.args,o=e.options;try{var d=yield t._store.__submit__(t.queued(),o.weight);a=d.reachedHWM,i=d.blocked,u=d.strategy}catch(n){return s=n,t.Events.trigger("debug",`Could not queue ${o.id}`,{args:r,options:o,error:s}),e.doDrop({error:s}),!1}return i?(e.doDrop(),!0):a&&(null!=(c=u===n.prototype.strategy.LEAK?t._queues.shiftLastFrom(o.priority):u===n.prototype.strategy.OVERFLOW_PRIORITY?t._queues.shiftLastFrom(o.priority+1):u===n.prototype.strategy.OVERFLOW?e:void 0)&&c.doDrop(),null==c||u===n.prototype.strategy.OVERFLOW)?(null==c&&e.doDrop(),a):(e.doQueue(a,i),t._queues.push(e),yield t._drainAll(),a)}))()}_receive(e){return null!=this._states.jobStatus(e.options.id)?(e._reject(new n.prototype.BottleneckError(`A job with the same id already exists (id=${e.options.id})`)),!1):(e.doReceive(),this._submitLock.schedule(this._addToQueue,e))}submit(...n){var r,i,s,o,a,u,d,l,p;"function"==typeof n[0]?(u=t(n),i=u[0],n=u.slice(1),d=e(f.call(n,-1),1),r=d[0],o=h.load({},this.jobDefaults)):(o=(l=t(n))[0],i=l[1],n=l.slice(2),p=e(f.call(n,-1),1),r=p[0],o=h.load(o,this.jobDefaults));return a=(...e)=>new this.Promise((function(t,n){return i(...e,(function(...e){return(null!=e[0]?n:t)(e)}))})),(s=new c(a,n,o,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise)).promise.then((function(e){return"function"==typeof r?r(...e):void 0})).catch((function(e){return Array.isArray(e)?"function"==typeof r?r(...e):void 0:"function"==typeof r?r(e):void 0})),this._receive(s)}schedule(...e){var n,r,i;if("function"==typeof e[0]){var s=t(e);i=s[0],e=s.slice(1),r={}}else{var o=t(e);r=o[0],i=o[1],e=o.slice(2)}return n=new c(i,e,r,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise),this._receive(n),n.promise}wrap(e){var t,n;return t=this.schedule.bind(this),(n=function(...n){return t(e.bind(this),...n)}).withOptions=function(n,...r){return t(n,e,...r)},n}updateSettings(e={}){var t=this;return s((function*(){return yield t._store.__updateSettings__(h.overwrite(e,t.storeDefaults)),h.overwrite(e,t.instanceDefaults,t),t}))()}currentReservoir(){return this._store.__currentReservoir__()}incrementReservoir(e=0){return this._store.__incrementReservoir__(e)}}return n.default=n,n.Events=a,n.version=n.prototype.version=require$$8.version,n.strategy=n.prototype.strategy={LEAK:1,OVERFLOW:2,OVERFLOW_PRIORITY:4,BLOCK:3},n.BottleneckError=n.prototype.BottleneckError=requireBottleneckError(),n.Group=n.prototype.Group=requireGroup(),n.RedisConnection=n.prototype.RedisConnection=requireRedisConnection(),n.IORedisConnection=n.prototype.IORedisConnection=requireIORedisConnection(),n.Batcher=n.prototype.Batcher=requireBatcher(),n.prototype.jobDefaults={priority:5,weight:1,expiration:null,id:"<no-id>"},n.prototype.storeDefaults={maxConcurrent:null,minTime:0,highWater:null,strategy:n.prototype.strategy.LEAK,penalty:null,reservoir:null,reservoirRefreshInterval:null,reservoirRefreshAmount:null,reservoirIncreaseInterval:null,reservoirIncreaseAmount:null,reservoirIncreaseMaximum:null},n.prototype.localStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:250},n.prototype.redisStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:5e3,clientTimeout:1e4,Redis:null,clientOptions:{},clusterNodes:null,clearDatastore:!1,connection:null},n.prototype.instanceDefaults={datastore:"local",connection:null,id:"<no-id>",rejectOnDrop:!0,trackDoneStatus:!1,Promise:Promise},n.prototype.stopDefaults={enqueueErrorMessage:"This limiter has been stopped and cannot accept new jobs.",dropWaitingJobs:!0,dropErrorMessage:"This limiter has been stopped."},n}.call(void 0),Bottleneck_1=o}var lib=requireBottleneck(),Bottleneck=getDefaultExportFromCjs(lib),browser="object"==typeof self?self.FormData:window.FormData,FormDataModule=getDefaultExportFromCjs(browser);const GRANT_TYPE$1="client_credentials",castClientOptionsToRequestParams=e=>{const{scope:t,clientId:n,clientSecret:r}=e;if(!n)throw new Error('Missing required "clientId" parameter to perform client credentials grant');if(!r)throw new Error('Missing required "clientSecret" parameter to perform client credentials grant');return Object.assign({client_id:n,client_secret:r,grant_type:GRANT_TYPE$1},t?{scope:t}:{})},isEligible$1=e=>{try{return!!castClientOptionsToRequestParams(e)}catch(e){return!1}},requestToken$1=(e,t)=>e(castClientOptionsToRequestParams(t)),RESPONSE_TYPE="token",castToAuthorizationRequestParams=e=>{const{clientId:t,scope:n,state:r,redirectUri:i}=e;if(!t)throw new Error('Missing required "clientId" parameter to perform implicit grant');return Object.assign(Object.assign({client_id:t,redirect_uri:i||window.location.href,response_type:RESPONSE_TYPE},n?{scope:n}:{}),r?{state:r}:{})},isEligibleForClientRedirect=e=>{try{return!!castToAuthorizationRequestParams(e)}catch(e){return!1}},getRedirectUrl=e=>`${e.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams(e),{skipEmptyString:!0,skipNull:!0})}`,GRANT_TYPE="password",castToTokenRequestParams=e=>{const{username:t,password:n,scope:r,clientId:i,clientSecret:s}=e;if(!i)throw new Error('Missing required "clientId" parameter to perform password grant');if(!t)throw new Error('Missing required "username" parameter to perform password grant');if(!n)throw new Error('Missing required "password" parameter to perform password grant');return Object.assign(Object.assign({client_id:i,grant_type:GRANT_TYPE,password:n,username:t},r?{scope:r}:{}),s?{client_secret:s}:{})},isEligible=e=>{try{return!!castToTokenRequestParams(e)}catch(e){return!1}},requestToken=(e,t)=>e(castToTokenRequestParams(t));async function maybeUpdateToken(e,t,n,r=!1){if(!r&&e.get("accessToken"))return;const i=Object.assign(Object.assign({},n),{refreshToken:e.get("refreshToken")});if(isEligible$2(i))return e.set(await requestToken$2(t,i));if(isEligible(n))return e.set(await requestToken(t,n));if("undefined"!=typeof window&&n.implicit){const t=querystring.parse(window.location.hash),r=t&&t.access_token;if(r)return window.history.replaceState({},"",window.location.href.split("#")[0]),e.set({accessToken:r});if(isEligibleForClientRedirect(n))return void(window.location.href=getRedirectUrl(n))}return!r&&isEligible$3(n)?e.set(await requestToken$3(t,n)):n.authorizationRedirect&&isEligibleForClientRedirect$1(n)?n.authorizationRedirect(getRedirectUrl$1(n)):isEligible$1(n)?e.set(await requestToken$1(t,n)):void 0}function sleep(e){return new Promise((t=>setTimeout((()=>t(!0)),e)))}const requestLogger=makeLogger("REST API Request"),responseLogger=makeLogger("REST API Response"),RETRYABLE_STATUS_CODES=[401,408,429,502,503,504],TOKEN_REFRESH_STATUS_CODES=[401],queue=new Bottleneck({maxConcurrent:QUEUE_CONCURRENCY,minTime:QUEUE_DELAY,reservoir:QUEUE_RESERVOIR}),refillIntervalSet=new Set;function isFormData(e){return void 0!==e&&void 0!==e.formData}function refillReservoir(){if(0===refillIntervalSet.size){const e=setInterval((async()=>{const t=await queue.currentReservoir();return queue.empty()&&0===await queue.running()&&t>10?await queue.incrementReservoir(1)&&fnClearInterval(e)&&refillIntervalSet.delete(e):t<QUEUE_RESERVOIR?queue.incrementReservoir(1):fnClearInterval(e)&&refillIntervalSet.delete(e)}),QUEUE_RESERVOIR_REFILL_INTERVAL);return refillIntervalSet.add(e)}return refillIntervalSet}async function makeResultFromResponse(e){return RETRYABLE_STATUS_CODES.includes(e.status)?e.clone():e.ok?"application/json"!==e.headers.get("content-type")&&204!==e.status?new Error(`Response content type was "${e.headers.get("content-type")}" but expected JSON`):{body:204===e.status?"":await e.json(),status:e.status}:new Error(`${e.status} ${e.statusText}\n\n${await e.text()}`)}function responseWasSuccessful(e){return!RETRYABLE_STATUS_CODES.includes(e.status)}function makeApiRequest(e,t,n,r,i,s,o){return async(a,c)=>{if(c>0){if(c>n.requestMaxRetries){const e=`Maximum number of retries reached while retrying ${a.method} request ${a.path}.`;throw requestLogger.error(e),new Error(e)}requestLogger.warn(`Warning: encountered ${a.status}. Retrying ${a.method} request ${a.path} (retry #${c}).`),await sleep(Math.ceil(Math.random()*n.requestBackOffInterval*2**c))}await maybeUpdateToken(e,t,n,c>0&&TOKEN_REFRESH_STATUS_CODES.includes(a.status));const u=s&&s.query?(i.includes("?")?"&":"?")+querystring.stringify(s.query,{skipEmptyString:!0,skipNull:!0}):"",d=`${n.apiUrl}/api${i}${u}`;if(!e.get("accessToken"))throw new Error(`Unable to get OAuth2 access token. Error trying to call endpoint: ${d}`);try{return refillReservoir()&&await queue.schedule((async()=>{var t,i,a;const c=r.toUpperCase(),u=s&&s.body,l=isFormData(u),p=isFormData(u)?u.formData:{},m=Object.entries(p).reduce(((e,[t,n])=>(e.append.apply(e,[t].concat(n)),e)),new FormDataModule),h=Object.assign(Object.assign(Object.assign(Object.assign({accept:"application/json",authorization:`Bearer ${e.get("accessToken")}`,"X-Allthings-Caller":`${n.serviceName?n.serviceName:process.env.SEVICE_NAME?process.env.SEVICE_NAME:"unknown service name"} --- clientID ${null!==(a=null!==(i=null===(t=n.clientId)||void 0===t?void 0:t.split("_")[0])&&void 0!==i?i:n.clientId)&&void 0!==a?a:"no client id present"}`},l?{}:{"content-type":"application/json"}),"undefined"==typeof window&&"undefined"==typeof document&&{"user-agent":USER_AGENT}),s&&s.headers?s.headers:{}),l&&m.getHeaders?m.getHeaders():{});process.env.LOG_REQUEST&&console.log({sdkLogs:{method:c,url:d}}),requestLogger.log(c,d,{body:u,headers:h});const f={body:l?m:JSON.stringify(u)},y=await fetch$1(d,Object.assign({cache:"no-cache",credentials:"omit",headers:h,method:c,mode:"cors"},l||u?f:{})),g=await makeResultFromResponse(y);return responseLogger.log(c,d,g instanceof Error?{error:g}:{body:g.body,status:y.status}),g instanceof Error&&o?{body:g.message,status:y.status}:g}))}catch(e){return e}}}async function request(e,t,n,r,i,s,o){const a=await until(responseWasSuccessful,makeApiRequest(e,t,n,r,i,s,o));if(a instanceof Error)throw requestLogger.log("Request Error",a,s),a;return o?a:a.body}const API_METHODS=[agentCreate,agentCreatePermissions,appCreate,appGetById,bucketCreate,bucketAddFile,bucketRemoveFile,bucketRemoveFilesInPath,bucketGet,conversationGetById,conversationCreateMessage,fileCreate,fileDelete,notificationSettingsResetByUser,notificationSettingsUpdateByUser,groupCreate,groupGetById,groupUpdateById,getGroups,lookupIds,notificationsGetByUser,notificationUpdateRead,notificationsUpdateReadByUser,propertyCreate,propertyGetById,propertyUpdateById,getProperties,serviceProviderCreate,serviceProviderGetById,serviceProviderUpdateById,registrationCodeCreate,registrationCodeUpdateById,registrationCodeDelete,registrationCodeGetById,ticketCreateOnUser,ticketCreateOnServiceProvider,ticketGetById,unitCreate,unitGetById,unitUpdateById,getUnits,userCreate,userGetById,userUpdateById,userChangePassword,userCreatePermission,userCreatePermissionBatch,userGetPermissions,userDeletePermission,userCheckInToUtilisationPeriod,userGetUtilisationPeriods,userGetByEmail,getCurrentUser,getUsers,userRelationCreate,userRelationDelete,userRelationsGetByUser,utilisationPeriodCreate,utilisationPeriodDelete,utilisationPeriodGetById,utilisationPeriodUpdateById,utilisationPeriodCheckInUser,utilisationPeriodCheckOutUser,utilisationPeriodAddRegistrationCode,bookingUpdateById,bookingGetById];function restClient(e=DEFAULT_API_WRAPPER_OPTIONS){const t=Object.assign(Object.assign({},DEFAULT_API_WRAPPER_OPTIONS),e);if(void 0===t.apiUrl)throw new Error("API URL is undefined.");if(void 0===t.oauthUrl)throw new Error("OAuth2 URL is undefined.");if(!t.clientId&&!t.accessToken&&!t.tokenStore&&"undefined"==typeof window)throw new Error('Missing required "clientId" or "accessToken" parameter .');const n=makeFetchTokenRequester(`${t.oauthUrl}/oauth/token`),r=t.tokenStore||createTokenStore({accessToken:t.accessToken,refreshToken:t.refreshToken}),i=partial(request,r,n,t),s=partial(del,i),o=partial(get,i),a=partial(post,i),c=partial(patch,i),u=partial(put,i),d={authorizationCode:{getUri:(e=t.state||pseudoRandomString())=>partial(getRedirectUrl$1,Object.assign(Object.assign({},t),{state:e}))(),requestToken:e=>requestAndSaveToStore(partial(requestToken$3,n,Object.assign(Object.assign({},t),{authorizationCode:e||t.authorizationCode})),r)},generateState:pseudoRandomString,refreshToken:e=>requestAndSaveToStore(partial(requestToken$2,n,Object.assign(Object.assign({},t),{refreshToken:e||r.get("refreshToken")})),r)},l=API_METHODS.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:(...e)=>t(l,...e)})),{delete:s,get:o,oauth:d,options:t,patch:c,post:a,put:u});return l}var EnumResource,EnumCountryCode,EnumLocale,EnumTimezone,EnumServiceProviderType,EnumCommunicationMethodType,EnumInputChannel,EnumLookupUserType;exports.EnumResource=void 0,EnumResource=exports.EnumResource||(exports.EnumResource={}),EnumResource.group="group",EnumResource.property="property",EnumResource.serviceProvider="propertyManager",EnumResource.registrationCode="registrationCode",EnumResource.unit="unit",EnumResource.user="user",EnumResource.utilisationPeriod="utilisationPeriod",exports.EnumCountryCode=void 0,EnumCountryCode=exports.EnumCountryCode||(exports.EnumCountryCode={}),EnumCountryCode.CH="CH",EnumCountryCode.DE="DE",EnumCountryCode.FR="FR",EnumCountryCode.IT="IT",EnumCountryCode.NL="NL",EnumCountryCode.PT="PT",EnumCountryCode.US="US",exports.EnumLocale=void 0,EnumLocale=exports.EnumLocale||(exports.EnumLocale={}),EnumLocale.ch_de="ch_DE",EnumLocale.ch_fr="ch_FR",EnumLocale.ch_it="ch_it",EnumLocale.de_DE="de_DE",EnumLocale.it_IT="it_IT",EnumLocale.fr_FR="fr_FR",EnumLocale.pt_PT="pt_PT",EnumLocale.en_US="en_US",exports.EnumTimezone=void 0,EnumTimezone=exports.EnumTimezone||(exports.EnumTimezone={}),EnumTimezone.EuropeBerlin="Europe/Berlin",EnumTimezone.EuropeLondon="Europe/London",EnumTimezone.EuropeSofia="Europe/Sofia",EnumTimezone.EuropeZurich="Europe/Zurich",EnumTimezone.UTC="UTC",exports.EnumServiceProviderType=void 0,EnumServiceProviderType=exports.EnumServiceProviderType||(exports.EnumServiceProviderType={}),EnumServiceProviderType.propertyManager="property-manager",EnumServiceProviderType.craftspeople="craftspeople",exports.EnumCommunicationMethodType=void 0,EnumCommunicationMethodType=exports.EnumCommunicationMethodType||(exports.EnumCommunicationMethodType={}),EnumCommunicationMethodType.email="email",exports.EnumInputChannel=void 0,EnumInputChannel=exports.EnumInputChannel||(exports.EnumInputChannel={}),EnumInputChannel.APP="app",EnumInputChannel.COCKPIT="cockpit",EnumInputChannel.CRAFTSMEN="craftsmen",EnumInputChannel.EMAIL="email",EnumInputChannel.PHONE="phone",EnumInputChannel.WHATS_APP="whats_app",exports.EnumLookupUserType=void 0,EnumLookupUserType=exports.EnumLookupUserType||(exports.EnumLookupUserType={}),EnumLookupUserType.agent="agent",EnumLookupUserType.tenant="tenant",exports.DEFAULT_PARAMETER_STORE_CLIENT_CONFIG=DEFAULT_CLIENT_CONFIG,exports.createTokenStore=createTokenStore,exports.parameterStore=parameterStore,exports.restClient=restClient}));