Description: "vdx (qs-1l08fnr1l)"
Metadata:
  cfn-lint:
    config:
      ignore_checks:
        - "I1022"
      ignore_checks_reasons:
        I1022: "This template is generated by AWS CDK and if they use Fn:Join over
          Fn::Sub we're not going to stop them."
  AWS::CloudFormation::Interface:
    ParameterGroups:
      - Label:
          default: "User Management (Amazon Cognito)"
        Parameters:
          - "FirstAdministratorEmail"
      - Label:
          default: "Reporting"
        Parameters:
          - "LogToCloudwatch"
          - "LogToS3Bucket"
          - "EnableTelemetry"
      - Label:
          default: "Amazon Connect"
        Parameters:
          - "ConnectInstance"
    ParameterLabels:
      FirstAdministratorEmail:
        default: "What is the email address for the first administrator?"
      LogToCloudwatch:
        default: "Log events to CloudWatch?"
      LogToS3Bucket:
        default: "Log events to an S3 Bucket?"
      EnableTelemetry:
        default: "Enable telemetry?"
      ConnectInstance:
        default: "What is the Instance ID for the Amazon Connect instance used by this
          Vocaldex install?"
Parameters:
  FirstAdministratorEmail:
    Type: "String"
    AllowedPattern: "^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,})$"
    ConstraintDescription: "Must be a valid email address."
    Description: "This will be the username for the first administrator account. The
      link to the admin UI will be sent here."
  LogToCloudwatch:
    Type: "String"
    Default: "true"
    AllowedValues:
      - "true"
      - "false"
    Description: "Log application and flow events (lookups, offers, connections) to
      CloudWatch. Logs can be viewed in the AWS Console and custom metrics can
      be created."
  LogToS3Bucket:
    Type: "String"
    Default: "false"
    AllowedValues:
      - "true"
      - "false"
    Description: "Log application and flow events (lookups, offers, connections) to
      an S3 Bucket. For use by AWS Athena or similar."
  EnableTelemetry:
    Type: "String"
    Default: "true"
    AllowedValues:
      - "true"
      - "false"
    Description: "Send anonymized event data to ASA Solutions in order to improve
      the application. No personally identifiable information is sent. All
      identifiers besides your AWS Account ID are encrypted."
  ConnectInstance:
    Type: "String"
    AllowedPattern: "^[a-z0-9-]{8}-[a-z0-9-]{4}-[a-z0-9-]{4}-[a-z0-9-]{4}-[a-z0-9-]{12}$"
    ConstraintDescription: "Get the ID from the ARN, but do not provide the full ARN."
    Description: "This is the last part of the ARN, after the 'instance/' part."
Conditions:
  CreateCloudWatchLogsDestination:
    Fn::Equals:
      - Ref: "LogToCloudwatch"
      - "true"
  CreateS3LogsDestination:
    Fn::Equals:
      - Ref: "LogToS3Bucket"
      - "true"
Resources:
  CognitoUserPoolsmsRole738960F0:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Condition:
              StringEquals:
                sts:ExternalId: "VocaldexCognitoUserPoolAEFC0E03"
            Effect: "Allow"
            Principal:
              Service: "cognito-idp.amazonaws.com"
        Version: "2012-10-17"
      Policies:
        - PolicyDocument:
            Statement:
              - Action: "sns:Publish"
                Effect: "Allow"
                Resource: "*"
            Version: "2012-10-17"
          PolicyName: "sns-publish"
    Metadata:
      cfn-lint:
        config:
          ignore_checks:
            - "EIAMPolicyWildcardResource"
          ignore_checks_reasons:
            EIAMPolicyWildcardResource: "This is the policy generated by CDK."
  CognitoUserPool279BBD48:
    Type: "AWS::Cognito::UserPool"
    Properties:
      AccountRecoverySetting:
        RecoveryMechanisms:
          - Name: "verified_email"
            Priority: 1
      AdminCreateUserConfig:
        AllowAdminCreateUserOnly: true
        InviteMessageTemplate:
          EmailMessage:
            Fn::Join:
              - ""
              - - "

                  \            <!DOCTYPE html>

                  \            <html>

                  \            <head>

                  \            <title>Vocaldex by ASA Solutions</title>

                  \            </head>

                  \            <body>

                  \           \ 

                  \            <p>Hello {username},</p>

                  \           \ 

                  \            <p>Your Vocaldex account is ready to use!</p>

                  \           \ 

                  \            <p>The admin portal is available at <a
                  href=\"https://"
                - Fn::GetAtt:
                    - "UiDistribution1123DB5B"
                    - "DomainName"
                - "/\">https://"
                - Fn::GetAtt:
                    - "UiDistribution1123DB5B"
                    - "DomainName"
                - "/</a>.</p>

                  \           \ 

                  \            <p>

                  \            <b>Username:</b> {username}<br>

                  \            <b>Temporary Password:</b> {####}

                  \            </p>

                  \           \ 

                  \            <p>Thanks,<br>

                  \            ASA Solutions</p>

                  \            </body>

                  \            </html>

                  \        "
          EmailSubject: "Vocaldex: Your account is ready!"
      AutoVerifiedAttributes:
        - "email"
      EmailConfiguration:
        EmailSendingAccount: "COGNITO_DEFAULT"
      EmailVerificationMessage: "Your Vocaldex verification code is {####}"
      EmailVerificationSubject: "Vocaldex: Verify your email address"
      EnabledMfas:
        - "SMS_MFA"
      MfaConfiguration: "OPTIONAL"
      SmsConfiguration:
        ExternalId: "VocaldexCognitoUserPoolAEFC0E03"
        SnsCallerArn:
          Fn::GetAtt:
            - "CognitoUserPoolsmsRole738960F0"
            - "Arn"
      SmsVerificationMessage: "The verification code to your new account is {####}"
      UsernameAttributes:
        - "email"
        - "phone_number"
      VerificationMessageTemplate:
        DefaultEmailOption: "CONFIRM_WITH_CODE"
        EmailMessage: "Your Vocaldex verification code is {####}"
        EmailSubject: "Vocaldex: Verify your email address"
        SmsMessage: "The verification code to your new account is {####}"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  CognitoUserPoolUserPoolClient1E6BF456:
    Type: "AWS::Cognito::UserPoolClient"
    Properties:
      AllowedOAuthFlows:
        - "implicit"
        - "code"
      AllowedOAuthFlowsUserPoolClient: true
      AllowedOAuthScopes:
        - "email"
        - "openid"
        - "profile"
      CallbackURLs:
        - "https://example.com"
      ExplicitAuthFlows:
        - "ALLOW_USER_PASSWORD_AUTH"
        - "ALLOW_USER_SRP_AUTH"
        - "ALLOW_REFRESH_TOKEN_AUTH"
      PreventUserExistenceErrors: "ENABLED"
      SupportedIdentityProviders:
        - "COGNITO"
      UserPoolId:
        Ref: "CognitoUserPool279BBD48"
  CognitoAdminGroupF94B9931:
    Type: "AWS::Cognito::UserPoolGroup"
    Properties:
      GroupName: "Administrators"
      UserPoolId:
        Ref: "CognitoUserPool279BBD48"
  CognitoInstanceGroup25B59EFE:
    Type: "AWS::Cognito::UserPoolGroup"
    Properties:
      GroupName:
        Ref: "ConnectInstance"
      UserPoolId:
        Ref: "CognitoUserPool279BBD48"
  CognitoFirstAdministrator4B2BAA46:
    Type: "AWS::Cognito::UserPoolUser"
    Properties:
      DesiredDeliveryMediums:
        - "EMAIL"
      UserAttributes:
        - Name: "email"
          Value:
            Ref: "FirstAdministratorEmail"
        - Name: "email_verified"
          Value: "true"
        - Name: "name"
          Value: "Vocaldex Administrator"
      UserPoolId:
        Ref: "CognitoUserPool279BBD48"
      Username:
        Ref: "FirstAdministratorEmail"
      ValidationData: []
    DependsOn:
      - "UiConfiguratorLambda6CE847B2"
  CognitoFirstAdminGroupAdmin843DAE74:
    Type: "AWS::Cognito::UserPoolUserToGroupAttachment"
    Properties:
      GroupName:
        Ref: "CognitoAdminGroupF94B9931"
      UserPoolId:
        Ref: "CognitoUserPool279BBD48"
      Username:
        Ref: "FirstAdministratorEmail"
    DependsOn:
      - "CognitoFirstAdministrator4B2BAA46"
  CognitoFirstAdminGroupInstanceD1C2C989:
    Type: "AWS::Cognito::UserPoolUserToGroupAttachment"
    Properties:
      GroupName:
        Ref: "CognitoInstanceGroup25B59EFE"
      UserPoolId:
        Ref: "CognitoUserPool279BBD48"
      Username:
        Ref: "FirstAdministratorEmail"
    DependsOn:
      - "CognitoFirstAdministrator4B2BAA46"
  DdbDestinations37B2F70F:
    Type: "AWS::DynamoDB::GlobalTable"
    Properties:
      AttributeDefinitions:
        - AttributeName: "DestinationId"
          AttributeType: "S"
      BillingMode: "PAY_PER_REQUEST"
      KeySchema:
        - AttributeName: "DestinationId"
          KeyType: "HASH"
      Replicas:
        - Region:
            Ref: "AWS::Region"
      SSESpecification:
        SSEEnabled: false
      StreamSpecification:
        StreamViewType: "NEW_AND_OLD_IMAGES"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  DdbDirectories26458382:
    Type: "AWS::DynamoDB::GlobalTable"
    Properties:
      AttributeDefinitions:
        - AttributeName: "DirectoryId"
          AttributeType: "S"
      BillingMode: "PAY_PER_REQUEST"
      KeySchema:
        - AttributeName: "DirectoryId"
          KeyType: "HASH"
      Replicas:
        - Region:
            Ref: "AWS::Region"
      SSESpecification:
        SSEEnabled: false
      StreamSpecification:
        StreamViewType: "NEW_AND_OLD_IMAGES"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  DdbMemberships1A816D0C:
    Type: "AWS::DynamoDB::GlobalTable"
    Properties:
      AttributeDefinitions:
        - AttributeName: "DestinationId"
          AttributeType: "S"
        - AttributeName: "DirectoryId"
          AttributeType: "S"
      BillingMode: "PAY_PER_REQUEST"
      GlobalSecondaryIndexes:
        - IndexName: "DirectoryIdIndex"
          KeySchema:
            - AttributeName: "DirectoryId"
              KeyType: "HASH"
          Projection:
            ProjectionType: "ALL"
      KeySchema:
        - AttributeName: "DestinationId"
          KeyType: "HASH"
        - AttributeName: "DirectoryId"
          KeyType: "RANGE"
      Replicas:
        - GlobalSecondaryIndexes:
            - IndexName: "DirectoryIdIndex"
          Region:
            Ref: "AWS::Region"
      SSESpecification:
        SSEEnabled: false
      StreamSpecification:
        StreamViewType: "NEW_AND_OLD_IMAGES"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  ReportingCloudWatchLogGroupE545A28A:
    Type: "AWS::Logs::LogGroup"
    Properties:
      LogGroupName:
        Fn::Join:
          - ""
          - - "/asasolutions.vdx/"
            - Fn::Join:
                - ""
                - Fn::Split:
                    - "-"
                    - Ref: "ConnectInstance"
            - "-"
            - Fn::Select:
                - 4
                - Fn::Split:
                    - "-"
                    - Fn::Select:
                        - 2
                        - Fn::Split:
                            - "/"
                            - Ref: "AWS::StackId"
      RetentionInDays: 365
    UpdateReplacePolicy: "Retain"
    DeletionPolicy: "Retain"
    Condition: "CreateCloudWatchLogsDestination"
  ReportingS3BucketD452F6BB:
    Type: "AWS::S3::Bucket"
    Properties:
      BucketName:
        Fn::Join:
          - ""
          - - "asasolutions.vdx-"
            - Fn::Join:
                - ""
                - Fn::Split:
                    - "-"
                    - Ref: "ConnectInstance"
            - "-"
            - Fn::Select:
                - 4
                - Fn::Split:
                    - "-"
                    - Fn::Select:
                        - 2
                        - Fn::Split:
                            - "/"
                            - Ref: "AWS::StackId"
    UpdateReplacePolicy: "Retain"
    DeletionPolicy: "Retain"
    Condition: "CreateS3LogsDestination"
  ReportingEventBus79921D7B:
    Type: "AWS::Events::EventBus"
    Properties:
      Name:
        Fn::Join:
          - ""
          - - Ref: "AWS::StackName"
            - "-"
            - Ref: "ConnectInstance"
  ReportingEventLambdaServiceRole239EDAD9:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ReportingEventLambdaServiceRoleDefaultPolicy1125F1C4:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "events:PutEvents"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "ReportingEventBus79921D7B"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "ReportingEventLambdaServiceRoleDefaultPolicy1125F1C4"
      Roles:
        - Ref: "ReportingEventLambdaServiceRole239EDAD9"
    Metadata:
      cfn-lint:
        config:
          ignore_checks:
            - "EIAMPolicyWildcardResource"
          ignore_checks_reasons:
            EIAMPolicyWildcardResource: "This is the IAM policy generated by the CDK Construct."
  ReportingEventLambdaABCA090A:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var U=Object.create;var
                y=Object.defineProperty;var
                R=Object.getOwnPropertyDescriptor;var
                A=Object.getOwnPropertyNames;var
                G=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var
                F=(e,o)=>{for(var t in
                o)y(e,t,{get:o[t],enumerable:!0})},w=(e,o,t,n)=>{if(o&&"
              - "typeof o==\"object\"||typeof o==\"function\")for(let a of
                A(o))!M.call(e,a)&&a!==t&&"
              - "y(e,a,{get:()=>o[a],enumerable:!(n=R(o,a))||n.enumerable});ret\
                urn e};var
                S=(e,o,t)=>(t=e!=null?U(G(e)):{},w(o||!e||!e.__esModule?y(t,\"d\
                efault\",{value:e,"
              - "enumerable:!0}):t,e)),j=e=>w(y({},\"__esModule\",{value:!0}),e\
                );var
                $={};F($,{_attributeExistsAndUsable:()=>I,_buildCloudWatchCreat\
                eStreamInput:()=>T,"
              - "_buildCloudWatchPutLogInput:()=>_,_buildRemoteSubmission:()=>L\
                ,_buildS3Input:()=>P,"
              - "_getLogData:()=>c,_logEventToCloudWatch:()=>N,_logEventToRemot\
                e:()=>k,_logEventToS3:()=>B,"
              - "_resendCloudFormationEvent:()=>O,handler:()=>W});module.export\
                s=j($);var v=S(require(\"@aws-sdk/client-s3\"),1),"
              - "f=require(\"@aws-sdk/client-cloudformation\"),g=S(require(\"@a\
                ws-sdk/client-cloudwatch-logs\"),1),"
              - "x=require(\"@aws-sdk/client-eventbridge\");var b=(e,o=0)=>{let
                t=3735928559^o,n=1103547991^o;for(let a=0,r;a<e.length;a++)r="
              - "e.charCodeAt(a),t=Math.imul(t^r,2654435761),n=Math.imul(n^r,15\
                97334677);return t="
              - "Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,326648990\
                9),n=Math.imul(n^n>>>"
              - "16,2246822507),n^=Math.imul(t^t>>>13,3266489909),(4294967296*(\
                2097151&n)+(t>>>0))."
              - "toString(16)};var u=e=>btoa(JSON.stringify(e)),m=(...e)=>{};var
                W=async(e,o)=>{m(e,u(e));try{if(e.source==\"aws.cloudformation\
                \")await O(e,{eventBridgeBusName:process."
              - "env.EVENTBRIDGE_BUS_NAME});else{let
                t=N(e,{loggingEnabled:process.env.CLOUDWATCH_LOGGING_ENABLED,"
              - "logGroupName:process.env.CLOUDWATCH_LOG_GROUP_NAME}).catch(r=>\
                r),n=B(e,{loggingEnabled:process."
              - "env.S3_LOGGING_ENABLED,bucketName:process.env.S3_LOGGING_BUCKE\
                T_NAME}).catch(r=>r),"
              - "a=k(e,{telemetryEnabled:process.env.TELEMETRY_ENABLED}).catch(\
                r=>r);Promise.allSettled("
              - "[await t,await n,await
                a]).catch(r=>r)}}catch{console.error({eventId:\"not provid\\"
              - "ed\",detailType:\"not provided\",data:\"Unhandled error during
                when processing the e\\"
              - "vent. For data privacy purposes, no further details are
                provided.\"})}},I=(e,o)=>e&&"
              - "e!==null&&e!==void
                0&&e.hasOwnProperty(o)&&e[o]&&e[o]!==null&&e[o]!==void
                0,T=(e,o)=>{"
              - "let t=new
                Date(e.time).toLocaleDateString(\"en-ZA\"),n=\"\";if(e.detail.h\
                asOwnProperty("
              - "\"contactId\")){let{contactId:r}=e.detail;r&&r.length>0&&(n=`$\
                {t}/contact-${r}`)}else"
              - "n=`${t}/${e[\"detail-type\"]}`;return{logGroupName:o,logStream\
                Name:n}},_=(e,o)=>{let{"
              - "logGroupName:t,logStreamName:n}=o;return{logGroupName:t,logStr\
                eamName:n,logEvents:["
              - "{message:JSON.stringify(e.detail),timestamp:new
                Date(e.time).getTime()}]}},L=(e,o)=>{"
              - "let
                t=[\"cloudformationStatus\",\"adminUiUrl\",\"source\",\"deploye\
                dAccountId\",\"eventTy\\"
              - "pe\",\"connectInstanceId\",\"cognitoUsersTotal\",\"destination\
                sTotal\",\"directoriesTota\\"
              - "l\",\"membershipsTotal\"],n=[\"contactId\",\"destinationId\",\
                \"directoryId\",\"lookupAttem\\"
              - "pt\",\"yesNoAttempt\",\"routingDecision\",\"destinationOrphans\
                \",\"directoryOrphans\",\"me\\"
              - "mbershipDestinationWeight\",\"membershipDirectoryWeight\"],r=[\
                \"Heartbeat\",\"Deploy\","
              - "\"LookupOffer\",\"LookupNotFound\",\"LookupMatch\",\"Snapshot\
                \"].includes(e.detail.eventType),"
              - "d=o!==void
                0&&o===\"true\",s=[];if(s=s.concat(d||r?t:[]),s=s.concat(d?n:[]\
                ),s.length==="
              - "0)return;let
                l={accountId:e.account,\"detail-type\":e[\"detail-type\"],sourc\
                e:e.source};"
              - "return
                s.forEach(i=>{if(e.detail.hasOwnProperty(i)&&!i.toLowerCase().i\
                ncludes(\"n\\"
              - "ame\")){let
                p=e.detail[i];i.endsWith(\"Id\")&&i!==\"accountId\"&&(p=b(p)),l\
                [i]=p}}),JSON."
              - "stringify(l)},P=(e,o)=>{let n=`${new
                Date(e.time).toLocaleDateString(\"en-ZA\")}/${e."
              - "id}.json`;return{Bucket:o,Key:n,Body:JSON.stringify(e.detail),\
                ContentType:\"appli\\"
              - "cation/json\"}},c=(e,o,t)=>{let n=I(o,\"id\")?o.id:\"event id
                unknown\",a=I(o,\"detail\\"
              - "-type\")?o[\"detail-type\"]:\"detail type
                unknown\";return{service:e,eventId:n,detailType:a,"
              - "data:t}},N=async(e,o)=>{try{let{logGroupName:t,loggingEnabled:\
                n}=o;if(!n||n!==\"t\\"
              - "rue\")return Promise.reject();if(!t||t==\"\")return
                console.error(c(\"cloudwatch\",e,"
              - "\"No CloudWatch log group name
                provided.\")),Promise.reject();let a=new
                g.CloudWatchLogsClient,"
              - "r=T(e,t),d=new g.CreateLogStreamCommand(r);try{let p=await
                a.send(d);console.log("
              - "c(\"cloudwatch:stream\",e,p))}catch(p){let
                h=p;if(h.name!==\"ResourceAlreadyExistsE\\"
              - "xception\")return
                console.error(c(\"cloudwatch:stream\",e,`Unhandled error during
                C\\"
              - "loudWatch log stream creation:
                ${h.message}`)),Promise.reject()}let s=_(e,r);m(\"\\"
              - "_logEventToCloudWatch\",s,u(s));let l=new
                g.PutLogEventsCommand(s),i=await a.send("
              - "l);return Promise.resolve()}catch{return
                console.error(c(\"cloudwatch\",e,\"Unhandl\\"
              - "ed error during logging attempt. For data privacy purposes, no
                further details a\\"
              - "re
                provided.\")),Promise.reject()}},k=async(e,o)=>{try{let{telemet\
                ryEnabled:t}=o,"
              - "n=\"https://control.prod.vocaldex.asasolutions.com/api/IngestV1\
                \";if(!n||n==\"\")return console."
              - "error(c(\"metrics\",e,\"Deploy is broken, contact
                support.\")),Promise.reject();let a=L("
              - "e,t);if(!a)return
                Promise.reject();m(\"_logEventToRemote\",a,u(a));let
                r,d=!1;try{"
              - "r=await
                fetch(n,{method:\"POST\",headers:{\"Content-Type\":\"applicatio\
                n/json\"},body:a}),"
              - "d=r.ok}catch(l){r=l}let
                s={status:r.status,statusText:r.statusText,url:b(n)};return d?"
              - "(m(\"_logEventToRemote:success\",s,u(s)),Promise.resolve()):(m(\
                \"_logEventToRemote:\\"
              - "failure\",r,u(r)),console.error(c(\"metrics\",e,s)),Promise.re\
                ject())}catch{return console."
              - "error(c(\"metrics\",e,\"Unhandled error during submission. For
                data privacy purpose\\"
              - "s, no further details are
                provided.\")),Promise.reject()}},B=async(e,o)=>{let{bucketName:\
                t,"
              - "loggingEnabled:n}=o;try{if(!n||n!==\"true\")return
                Promise.reject();if(!t||t==\"\")return console."
              - "error(c(\"s3\",e,\"Deploy is broken, contact
                support.\")),Promise.reject();let a=P(e,"
              - "t);m(\"_logEventToS3\",a,u(a));let r=new v.S3Client,d=new
                v.PutObjectCommand(a),s=await r."
              - "send(d);return Promise.resolve()}catch(a){let r=\"Unhandled
                error during S3 loggi\\"
              - "ng attempt. For data privacy purposes, no further details are
                provided.\";try{a.name==="
              - "\"NoSuchBucket\"&&(r=`Cannot log to S3, bucket '${t}' does not
                exist.`)}catch{}return console."
              - "error(c(\"s3\",e,r)),Promise.reject()}},O=async(e,o)=>{let{eve\
                ntBridgeBusName:t}=o;"
              - "if(!t||t==\"\"){console.error(c(\"cloudformation\",e,\"No
                EventBridge bus name provid\\"
              - "ed for CloudFormation event.\"));return}let
                n;try{let[l,i,p]=e.detail[\"stack-id\"]."
              - "split(\"/\");if(i&&i.length>0){let h=new
                f.CloudFormationClient,D={StackName:i};m("
              - "\"cfnInput\",D,u(D));let E=await h.send(new
                f.DescribeStacksCommand(D));if(m(\"cfnR\\"
              - "esponse\",E,u(E)),E.Stacks&&E.Stacks.length>0){let
                C=E.Stacks[0];C.Outputs&&C.Outputs."
              - "length>0&&(n=C.Outputs?.find(V=>V.OutputKey===\"AdminUiUrl\")?\
                .OutputValue)}}}catch(l){"
              - "console.error(c(\"cloudformation\",e,`Error fetching
                CloudFormation stack: ${l.message}`))}"
              - "let a=new
                x.EventBridgeClient,r={cloudformationStatus:e.detail[\"status-d\
                etails\"]."
              - "status,eventType:\"Deploy\",accountId:e.account};n&&(r.adminUi\
                Url=n);let s={Entries:["
              - "{Detail:JSON.stringify(r),DetailType:\"Vocaldex Infrastructure
                Event\",EventBusName:t,"
              - "Source:\"com.asasolutions.vocaldex\"}]};try{let l=await
                a.send(new x.PutEventsCommand("
              - "s))}catch(l){console.error(c(\"cloudformation\",e,`Error
                resending CloudFormation \\"
              - "event: ${l.message}`))}};"
      Description: "v1.1.2 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          CLOUDWATCH_LOGGING_ENABLED:
            Ref: "LogToCloudwatch"
          CLOUDWATCH_LOG_GROUP_NAME:
            Fn::If:
              - "CreateCloudWatchLogsDestination"
              - Ref: "ReportingCloudWatchLogGroupE545A28A"
              - Ref: "AWS::NoValue"
          EVENTBRIDGE_AWS_REGION:
            Ref: "AWS::Region"
          EVENTBRIDGE_BUS_NAME:
            Ref: "ReportingEventBus79921D7B"
          S3_LOGGING_ENABLED:
            Ref: "LogToS3Bucket"
          S3_LOGGING_BUCKET_NAME:
            Fn::If:
              - "CreateS3LogsDestination"
              - Ref: "ReportingS3BucketD452F6BB"
              - Ref: "AWS::NoValue"
          TELEMETRY_ENABLED:
            Ref: "EnableTelemetry"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      LoggingConfig:
        LogFormat: "JSON"
      Role:
        Fn::GetAtt:
          - "ReportingEventLambdaServiceRole239EDAD9"
          - "Arn"
      Runtime: "nodejs20.x"
      Timeout: 10
    DependsOn:
      - "ReportingEventLambdaServiceRoleDefaultPolicy1125F1C4"
  ReportingEventLambdaCloudformationPolicy38B8B8B8:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "cloudformation:DescribeStacks"
            Effect: "Allow"
            Resource:
              - Fn::Join:
                  - ""
                  - - "arn:aws:cloudformation:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":stack/"
                    - Ref: "AWS::StackName"
                    - "/*"
              - Ref: "AWS::StackId"
        Version: "2012-10-17"
      PolicyName: "ReportingEventLambdaCloudformationPolicy38B8B8B8"
      Roles:
        - Ref: "ReportingEventLambdaServiceRole239EDAD9"
  ReportingBucketPolicy17A9B503:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "s3:PutObject"
            Effect: "Allow"
            Resource:
              - Fn::If:
                  - "CreateS3LogsDestination"
                  - Fn::GetAtt:
                      - "ReportingS3BucketD452F6BB"
                      - "Arn"
                  - Ref: "AWS::NoValue"
              - Fn::If:
                  - "CreateS3LogsDestination"
                  - Fn::Join:
                      - ""
                      - - Fn::GetAtt:
                            - "ReportingS3BucketD452F6BB"
                            - "Arn"
                        - "/*"
                  - Ref: "AWS::NoValue"
        Version: "2012-10-17"
      PolicyName: "ReportingBucketPolicy"
      Roles:
        - Ref: "ReportingEventLambdaServiceRole239EDAD9"
    Condition: "CreateS3LogsDestination"
  ReportingLogGroupPolicy8E6EDA8A:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "logs:CreateLogStream"
              - "logs:PutLogEvents"
            Effect: "Allow"
            Resource:
              Fn::If:
                - "CreateCloudWatchLogsDestination"
                - Fn::GetAtt:
                    - "ReportingCloudWatchLogGroupE545A28A"
                    - "Arn"
                - Ref: "AWS::NoValue"
        Version: "2012-10-17"
      PolicyName: "ReportingLogGroupPolicy"
      Roles:
        - Ref: "ReportingEventLambdaServiceRole239EDAD9"
    Condition: "CreateCloudWatchLogsDestination"
  ReportingSnapshotLambdaServiceRoleF72F64B4:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ReportingSnapshotLambdaServiceRoleDefaultPolicy61612593:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:Query"
              - "dynamodb:Scan"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbDestinations37B2F70F"
                  - "Arn"
              - Fn::GetAtt:
                  - "DdbDirectories26458382"
                  - "Arn"
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:BatchWriteItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DeleteItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:PutItem"
              - "dynamodb:Query"
              - "dynamodb:Scan"
              - "dynamodb:UpdateItem"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbMemberships1A816D0C"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DdbMemberships1A816D0C"
                        - "Arn"
                    - "/index/*"
          - Action: "events:PutEvents"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "ReportingEventBus79921D7B"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "ReportingSnapshotLambdaServiceRoleDefaultPolicy61612593"
      Roles:
        - Ref: "ReportingSnapshotLambdaServiceRoleF72F64B4"
  ReportingSnapshotLambdaC62B141A:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var _=Object.defineProperty;var
                F=Object.getOwnPropertyDescriptor;var
                G=Object.getOwnPropertyNames;var
                H=Object.prototype.hasOwnProperty;var z=(t,e)=>{for(var r in
                e)_(t,r,{get:e[r],enumerable:!0})},J=(t,e,r,s)=>{if(e&&"
              - "typeof e==\"object\"||typeof e==\"function\")for(let o of
                G(e))!H.call(t,o)&&o!==r&&"
              - "_(t,o,{get:()=>e[o],enumerable:!(s=F(e,o))||s.enumerable});ret\
                urn t};var q=t=>J(_({},\"__esModule\",{value:!0}),t);var
                rt={};z(rt,{_cleanupLostMemberships:()=>Y,_getCognitoUsersCount\
                :()=>k,_getCountFromDdbItems:()=>I,"
              - "_getCountsContext:()=>M,_getDdbTableContents:()=>D,_getMembers\
                hipDestinationWeight:()=>P,"
              - "_getMembershipDirectoryWeight:()=>B,_getOrphanCounts:()=>j,_ge\
                tRawData:()=>L,_getWeightsByKey:()=>$,"
              - "_handleLostMemberships:()=>U,_isolateLostMemberships:()=>K,_pa\
                rseCountsContext:()=>W,"
              - "_sendEvent:()=>V,handler:()=>et});module.exports=q(rt);var
                T=require(\"@aws-sdk/client-dynamodb\"),"
              - "C=require(\"@aws-sdk/client-eventbridge\"),E=require(\"@aws-sd\
                k/lib-dynamodb\");function y(t){var e=String(t);if(e===\"[object
                Object]\")try{e=JSON.stringify(t)}catch{}"
              - "return e}var Q=function(){function t(){}return
                t.prototype.isSome=function(){return!1},t."
              - "prototype.isNone=function(){return!0},t.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){"
              - "return e},t.prototype.expect=function(e){throw new
                Error(\"\".concat(e))},t.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},t.prototype.map=function(e){"
              - "return this},t.prototype.mapOr=function(e,r){return
                e},t.prototype.mapOrElse=function(e,r){"
              - "return e()},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){"
              - "return e()},t.prototype.andThen=function(e){return
                this},t.prototype.toResult=function(e){"
              - "return
                f(e)},t.prototype.toString=function(){return\"None\"},t.prototy\
                pe.toAsyncOption="
              - "function(){return new b(g)},t}(),g=new Q;Object.freeze(g);var
                X=function(){function t(e){"
              - "if(!(this instanceof t))return new t(e);this.value=e}return
                t.prototype.isSome=function(){"
              - "return!0},t.prototype.isNone=function(){return!1},t.prototype[\
                Symbol.iterator]=function(){"
              - "var e=Object(this.value);return Symbol.iterator in
                e?e[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){return this.value},"
              - "t.prototype.expect=function(e){return
                this.value},t.prototype.unwrap=function(){"
              - "return this.value},t.prototype.map=function(e){return
                v(e(this.value))},t.prototype."
              - "mapOr=function(e,r){return
                r(this.value)},t.prototype.mapOrElse=function(e,r){return r("
              - "this.value)},t.prototype.or=function(e){return
                this},t.prototype.orElse=function(e){"
              - "return this},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.toResult="
              - "function(e){return
                l(this.value)},t.prototype.toAsyncOption=function(){return new
                b("
              - "this)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype.toString="
              - "function(){return\"Some(\".concat(y(this.value),\")\")},t.EMPT\
                Y=new t(void 0),t}(),v=X,"
              - "N;(function(t){function e(){for(var
                o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];"
              - "for(var a=[],u=0,p=o;u<p.length;u++){var
                i=p[u];if(i.isSome())a.push(i.value);else"
              - "return i}return v(a)}t.all=e;function r(){for(var
                o=[],n=0;n<arguments.length;n++)"
              - "o[n]=arguments[n];for(var a=0,u=o;a<u.length;a++){var
                p=u[a];if(p.isSome())return p}"
              - "return g}t.any=r;function s(o){return o instanceof
                v||o===g}t.isOption=s})(N||(N="
              - "{}));var Z=function(){function t(e){if(!(this instanceof
                t))return new t(e);this.error="
              - "e;var r=new Error().stack.split(`"
              - "`).slice(2);r&&r.length>0&&r[0].includes(\"ErrImpl\")&&r.shift\
                (),this._stack=r.join("
              - "`"
              - "`)}return
                t.prototype.isOk=function(){return!1},t.prototype.isErr=functio\
                n(){return!0},"
              - "t.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "t.prototype.else=function(e){return
                e},t.prototype.unwrapOr=function(e){return e},"
              - "t.prototype.expect=function(e){throw new Error(\"\".concat(e,\"
                - Error: \").concat("
              - "y(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.expect\
                Err=function(e){return this."
              - "error},t.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "y(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.unwrap\
                Err=function(){return this."
              - "error},t.prototype.map=function(e){return
                this},t.prototype.andThen=function(e){"
              - "return this},t.prototype.mapErr=function(e){return new
                f(e(this.error))},t.prototype."
              - "mapOr=function(e,r){return
                e},t.prototype.mapOrElse=function(e,r){return e(this."
              - "error)},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){return e("
              - "this.error)},t.prototype.toOption=function(){return
                g},t.prototype.toString=function(){"
              - "return\"Err(\".concat(y(this.error),\")\")},Object.definePrope\
                rty(t.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),t.prot\
                otype.toAsyncResult="
              - "function(){return new w(this)},t.EMPTY=new t(void 0),t}();var
                f=Z,tt=function(){function t(e){if(!(this instanceof t))return
                new t(e);this."
              - "value=e}return
                t.prototype.isOk=function(){return!0},t.prototype.isErr=functio\
                n(){"
              - "return!1},t.prototype[Symbol.iterator]=function(){var
                e=Object(this.value);return Symbol."
              - "iterator in
                e?e[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "t.prototype.else=function(e){return
                this.value},t.prototype.unwrapOr=function(e){"
              - "return this.value},t.prototype.expect=function(e){return
                this.value},t.prototype."
              - "expectErr=function(e){throw new
                Error(e)},t.prototype.unwrap=function(){return this."
              - "value},t.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "y(this.value)),{cause:this.value})},t.prototype.map=function(e\
                ){return new l(e(this."
              - "value))},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.mapErr="
              - "function(e){return this},t.prototype.mapOr=function(e,r){return
                r(this.value)},t."
              - "prototype.mapOrElse=function(e,r){return
                r(this.value)},t.prototype.or=function(e){"
              - "return this},t.prototype.orElse=function(e){return
                this},t.prototype.toOption=function(){"
              - "return v(this.value)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype."
              - "toString=function(){return\"Ok(\".concat(y(this.value),\")\")}\
                ,t.prototype.toAsyncResult="
              - "function(){return new w(this)},t.EMPTY=new t(void 0),t}();var
                l=tt,A;(function(t){function e(){for(var
                a=[],u=0;u<arguments.length;u++)a[u]="
              - "arguments[u];for(var p=[],i=0,c=a;i<c.length;i++){var
                m=c[i];if(m.isOk())p.push("
              - "m.value);else return m}return new l(p)}t.all=e;function
                r(){for(var a=[],u=0;u<arguments."
              - "length;u++)a[u]=arguments[u];for(var
                p=[],i=0,c=a;i<c.length;i++){var m=c[i];if(m."
              - "isOk())return m;p.push(m.error)}return new
                f(p)}t.any=r;function s(a){try{return new l("
              - "a())}catch(u){return new f(u)}}t.wrap=s;function
                o(a){try{return a().then(function(u){"
              - "return new l(u)}).catch(function(u){return new
                f(u)})}catch(u){return Promise.resolve("
              - "new f(u))}}t.wrapAsync=o;function n(a){return a instanceof f||a
                instanceof l}t.isResult="
              - "n})(A||(A={}));var O=function(t,e,r,s){function o(n){return n
                instanceof r?n:new r(function(a){"
              - "a(n)})}return new(r||(r=Promise))(function(n,a){function
                u(c){try{i(s.next(c))}catch(m){"
              - "a(m)}}function p(c){try{i(s.throw(c))}catch(m){a(m)}}function
                i(c){c.done?n(c.value):"
              - "o(c.value).then(u,p)}i((s=s.apply(t,e||[])).next())})},R=funct\
                ion(t,e){var r={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},s,o,n,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(c){return p([i,c])}}function p(i){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(r="
              - "0)),r;)try{if(s=1,o&&(n=i[0]&2?o.return:i[0]?o.throw||((n=o.re\
                turn)&&n.call(o),0):"
              - "o.next)&&!(n=n.call(o,i[1])).done)return
                n;switch(o=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:"
              - "n=i;break;case 4:return r.label++,{value:i[1],done:!1};case
                5:r.label++,o=i[1],i="
              - "[0];continue;case
                7:i=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue\
                }if(i[0]===3&&(!n||"
              - "i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label\
                <n[1]){r.label=n[1],"
              - "n=i;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(i);break\
                }n[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}i=e.call(t,r)}catch(c){i=[6,c],o=0}final\
                ly{s=n=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},w=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var r=this;return this."
              - "thenInternal(function(s){return O(r,void 0,void
                0,function(){var o;return R(this,"
              - "function(n){return s.isErr()?[2,s]:(o=e(s.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(e){var r=this;return
                this.thenInternal(function(s){return O("
              - "r,void 0,void 0,function(){var o;return
                R(this,function(n){switch(n.label){case 0:"
              - "return s.isErr()?[2,s]:(o=l,[4,e(s.value)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.mapErr=function(e){var r=this;return
                this.thenInternal(function(s){return O("
              - "r,void 0,void 0,function(){var o;return
                R(this,function(n){switch(n.label){case 0:"
              - "return s.isOk()?[2,s]:(o=f,[4,e(s.error)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var r=this;return
                this.thenInternal(function(s){return O(r,void 0,"
              - "void 0,function(){var o;return R(this,function(n){return
                s.isOk()?[2,s]:(o=e(s.error),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toOption=function(){return
                new b("
              - "this.promise.then(function(e){return
                e.toOption()}))},t.prototype.thenInternal=function(e){"
              - "return new t(this.promise.then(e))},t}();var
                S=function(t,e,r,s){function o(n){return n instanceof r?n:new
                r(function(a){"
              - "a(n)})}return new(r||(r=Promise))(function(n,a){function
                u(c){try{i(s.next(c))}catch(m){"
              - "a(m)}}function p(c){try{i(s.throw(c))}catch(m){a(m)}}function
                i(c){c.done?n(c.value):"
              - "o(c.value).then(u,p)}i((s=s.apply(t,e||[])).next())})},x=funct\
                ion(t,e){var r={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},s,o,n,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(c){return p([i,c])}}function p(i){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(r="
              - "0)),r;)try{if(s=1,o&&(n=i[0]&2?o.return:i[0]?o.throw||((n=o.re\
                turn)&&n.call(o),0):"
              - "o.next)&&!(n=n.call(o,i[1])).done)return
                n;switch(o=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:"
              - "n=i;break;case 4:return r.label++,{value:i[1],done:!1};case
                5:r.label++,o=i[1],i="
              - "[0];continue;case
                7:i=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue\
                }if(i[0]===3&&(!n||"
              - "i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label\
                <n[1]){r.label=n[1],"
              - "n=i;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(i);break\
                }n[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}i=e.call(t,r)}catch(c){i=[6,c],o=0}final\
                ly{s=n=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},b=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var r=this;return this."
              - "thenInternal(function(s){return S(r,void 0,void
                0,function(){var o;return x(this,"
              - "function(n){return s.isNone()?[2,s]:(o=e(s.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(e){var r=this;return
                this.thenInternal(function(s){return S("
              - "r,void 0,void 0,function(){var o;return
                x(this,function(n){switch(n.label){case 0:"
              - "return s.isNone()?[2,s]:(o=v,[4,e(s.value)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var r=this;return
                this.thenInternal(function(s){return S(r,void 0,"
              - "void 0,function(){var o;return x(this,function(n){return
                s.isSome()?[2,s]:(o=e(),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toResult=function(e){return
                new w("
              - "this.promise.then(function(r){return
                r.toResult(e)}))},t.prototype.thenInternal="
              - "function(e){return new t(this.promise.then(e))},t}();var
                d=t=>btoa(JSON.stringify(t)),h=(...t)=>{};var
                et=async(t,e)=>{let r=\"snapshot.handler\";try{h(`${r}::received
                event:`,t,d(t)),"
              - "h(`${r}::received context:`,e,d(e));let s=await
                M(),o=W(s),n=await V(o);if(n.isErr())"
              - "throw n.error;console.debug(`${r}::Success`)}catch(s){let
                o=s;console.error(`${r}\\"
              - "::Error`,o,d(o))}},k=async()=>{let
                t=\"snapshot._getCognitoUsers\";console.debug(`${t}\\"
              - "::Start`);try{return f(new Error(`${t}::Not
                implemented`))}catch(e){return console."
              - "error(`${t}::Error`,e,d(e)),f(e)}},L=async()=>{let
                t=\"snapshot._getRawData\";console."
              - "debug(`${t}::Start`);let e=new
                T.DynamoDBClient({}),r=E.DynamoDBDocumentClient.from("
              - "e),s=f(new Error(`${t}:destinations::LOGIC ERROR: This should
                be overwritten bef\\"
              - "ore you see
                it.`)),o={destinationsResult:s,directoriesResult:s,membershipsR\
                esult:s},"
              - "n=await
                D(r,process.env.DDB_TABLE_DESTINATION);n.isErr()?o.destinations\
                Result=n:"
              - "n.value?o.destinationsResult=l(n.value):o.destinationsResult=l\
                ([]);let a=await D("
              - "r,process.env.DDB_TABLE_DIRECTORY);a.isErr()?o.directoriesResu\
                lt=a:a.value?o.directoriesResult="
              - "l(a.value):o.directoriesResult=l([]);let u=await
                D(r,process.env.DDB_TABLE_MEMBERSHIP);"
              - "return
                u.isErr()?o.membershipsResult=u:u.value?o.membershipsResult=l(u\
                .value):o."
              - "membershipsResult=l([]),console.debug(`${t}::Output`,o),o},M=a\
                sync()=>{let t=\"sn\\"
              - "apshot._getCounts\";console.debug(`${t}::Start`);try{let e=new
                T.DynamoDBClient({}),"
              - "r=E.DynamoDBDocumentClient.from(e),s=await L(),o=await
                U(r,s),n=j(o),{destinationsResult:a,"
              - "directoriesResult:u,membershipsResult:p}=o;return
                l({cognitoUsersTotal:await k(),"
              - "destinationsTotal:I(a),directoriesTotal:I(u),membershipsTotal:\
                I(p),destinationOrphans:n."
              - "isOk()?n.value.destinationOrphans:n,directoryOrphans:n.isOk()?\
                n.value.directoryOrphans:"
              - "n,membershipDestinationWeight:P(p),membershipDirectoryWeight:B\
                (p)})}catch(e){return console."
              - "error(`${t}::Error`,e,d(e)),f(e)}},D=async(t,e,r)=>{let
                s=\"snapshot._getAllTable\\"
              - "Records\";if(e)h(`${s}::${e}`);else return f(new
                Error(`${s}::Couldn't process, t\\"
              - "ableName was undefined`));try{let
                o=[],n={TableName:e};if(r){let u={},p=[];r.forEach("
              - "(i,c)=>{u[`#A${c}`]=i,p.push(`#A${c}`)}),n.ProjectionExpressio\
                n=p.join(\", \"),n.ExpressionAttributeNames="
              - "u}let
                a;do{a&&(n.ExclusiveStartKey=a),h(`${s}::ScanCommandInput`,n);l\
                et u=await t."
              - "send(new
                E.ScanCommand(n));console.debug(`${s}::ScanCommandOutput`,u,d(u\
                )),h(`${s}\\"
              - "::ScanCommandOutput`,u),u.Items?(h(`${s}::Adding
                ${u.Items.length} items to coll\\"
              - "ection...`),o.push(...u.Items)):h(`${s}::No items
                found...`),u.LastEvaluatedKey?"
              - "(h(`${s}::LastEvaluatedKey found
                ...`),a=u.LastEvaluatedKey):(h(`${s}:: this was\\"
              - " the last group of data ...`),a=void 0)}while(a);return
                l(o)}catch(o){return console."
              - "error(`${s}::Error`,o,d(o)),f(o)}},I=t=>{let
                e=\"snapshot._getCountFromDdbItems\";"
              - "return t.isErr()?(h(`${e}::passing through
                error...`),t):t.value?l(t.value.length):"
              - "(h(`${e}::result.value is undefined, returning
                0...`),l(0))},P=t=>{let e=\"snapsh\\"
              - "ot._getMembershipDestinationWeight\";return
                t.isErr()?(h(`${e}::passing through e\\"
              - "rror...`),t):t.value?$(t.value,\"DestinationId\"):l([])},B=t=>\
                {let e=\"snapshot._ge\\"
              - "tMembershipDirectoryWeight\";return t.isErr()?(h(`${e}::passing
                through error...`),"
              - "t):t.value?$(t.value,\"DirectoryId\"):l([])},j=t=>{let
                e=\"snapshot._getOrphanCount\\"
              - "s\",{destinationsResult:r,directoriesResult:s,membershipsResul\
                t:o}=t;console.debug("
              - "`${e}::input`,{destinationsResult:r,directoriesResult:s,member\
                shipsResult:o});try{"
              - "let n=new Set,a=new
                Set,u=r.isOk()&&r.value;u&&r.value.forEach(c=>{n.add(c.Destinat\
                ionId)});"
              - "let p=s.isOk()&&s.value;return
                p&&s.value.forEach(c=>{a.add(c.DirectoryId)}),console."
              - "debug(`${e}::destinationIds:populated`,[...n].join(\"
                \")),console.debug(`${e}::di\\"
              - "rectoryIds:populated`,[...a].join(\"
                \")),o.isOk()&&o.value&&o.value.forEach(c=>{console."
              - "log(`${e}::membership:removing
                destination`,c.DestinationId),n.delete(c.DestinationId),"
              - "console.log(`${e}::membership:removing
                directory`,c.DirectoryId),a.delete(c.DirectoryId)}),"
              - "console.debug(`${e}::destinationIds:remaining`,[...n].join(\"
                \")),console.debug(`${e}\\"
              - "::directoryIds:remaining`,[...a].join(\"
                \")),l({destinationOrphans:u?l(n.size):f("
              - "new Error(`${e}::Destination list was
                undefined`)),directoryOrphans:p?l(a.size):"
              - "f(new Error(`${e}::Directories list was
                undefined`))})}catch(n){return console.error("
              - "`${e}::Error`,n,d(n)),f(n)}},$=(t,e)=>{try{let r={};return
                t.forEach(s=>{let o=s[e];"
              - "r[o]||(r[o]=[]),r[o].push(s.id)}),l(Object.keys(r).map(s=>r[s]\
                .length).sort((s,o)=>o-"
              - "s))}catch(r){return f(r)}},W=t=>{let
                e=\"snapshot._parseCountsContext\";if(t.isErr())"
              - "return h(`${e}::passing through
                error...`),t;try{console.debug(`${e}::input`,t,d("
              - "t));let r=t.value,s={};return Object.keys(r).forEach(o=>{let
                n=r[o];n.isOk()?s[o]="
              - "n.value:(console.error(`${e}::Could get metric '${o}' because
                of error:`,n.error),"
              - "s[o]=-1)}),l(s)}catch(r){return
                console.error(`${e}::Error`,r,d(r)),f(r)}},V=async t=>{"
              - "let e=\"snapshot._sendEvent\";if(t.isErr())return
                h(`${e}::passing through error..\\"
              - ".`),t;h(`${e}::input`,t.value,d(t.value));try{let
                r=t.value,s=new C.EventBridgeClient("
              - "{}),o=process.env.EVENTBRIDGE_BUS_NAME;if(!o)return f(new
                Error(`${e}::Event bus\\"
              - " name was undefined`));let
                n={...r,eventType:\"Snapshot\",accountId:process.env.AWS_ACCOUN\
                T_ID,"
              - "connectInstanceId:process.env.CONNECT_INSTANCE_ID||\"UNKNOWN\"\
                },u={Entries:[{Detail:JSON."
              - "stringify(n),DetailType:\"Vocaldex Infrastructure
                Event\",EventBusName:o,Source:\"c\\"
              - "om.asasolutions.vocaldex\"}]};h(`${e}::PutEventsCommandInput`,\
                u);let p=await s.send("
              - "new C.PutEventsCommand(u));return
                h(`${e}::PutEventsCommandOutput`,p),l(p)}catch(r){"
              - "return
                console.error(`${e}::Error`,r,d(r)),f(r)}},U=async(t,e)=>{let
                r=\"snapshot\\"
              - "._handleLostMemberships\";console.debug(`${r}::Start`);let
                s=K(e),o=await Y(t,s);"
              - "return console.log(`${r}::Success`,o),o},K=t=>{let
                e=\"lost-memberships._getLostM\\"
              - "emberships\";if(t.membershipsResult.isErr())return
                console.error(`${e}:membershuo\\"
              - "s::error--can't process
                anything`,t.membershipsResult.error,d(t.membershipsResult."
              - "error)),{...t,lostMemberships:[]};if((t.membershipsResult.valu\
                e||[]).length===0)"
              - "return console.debug(`${e}:memberships::empty--no lost
                memberships`),{...t,lostMemberships:[]};"
              - "t.destinationsResult.isErr()&&console.error(`${e}:destinations\
                ::error--can't pro\\"
              - "cess in
                full`,t.destinationsResult.error,d(t.destinationsResult.error))\
                ;let s=t."
              - "destinationsResult.isOk()?t.destinationsResult.value.map(u=>u.\
                DestinationId):[];"
              - "t.directoriesResult.isErr()&&console.error(`${e}:directories::\
                error--can't proce\\"
              - "ss in
                full`,t.directoriesResult.error,d(t.directoriesResult.error));l\
                et o=t.directoriesResult."
              - "isOk()?t.directoriesResult.value.map(u=>u.DirectoryId):[],n=[]\
                ,a=[];return t.membershipsResult."
              - "value.forEach(u=>{let{DestinationId:p,DirectoryId:i}=u;s.lengt\
                h>0&&!s.includes(p)||"
              - "o.length>0&&!o.includes(i)?n.push({DestinationId:p,DirectoryId\
                :i}):a.push(u)}),{"
              - "destinationsResult:t.destinationsResult,directoriesResult:t.di\
                rectoriesResult,membershipsResult:l("
              - "a),lostMemberships:n}},Y=async(t,e)=>{let
                r=\"snapshot._cleanupLostMemberships\",{"
              - "destinationsResult:s,directoriesResult:o,membershipsResult:n,l\
                ostMemberships:a}=e,"
              - "u={destinationsResult:s,directoriesResult:o,membershipsResult:\
                n};if(a.length===0)"
              - "return console.debug(`${r}::No lost memberships to
                cleanup`),u;let p=a.map(async i=>{"
              - "try{let
                c={TableName:process.env.DDB_TABLE_MEMBERSHIP,Key:i};console.de\
                bug(`${r}\\"
              - "::Deleting`,c);let m=await t.send(new
                E.DeleteCommand(c));return console.debug(`${r}\\"
              - "::Success`,m),Promise.resolve()}catch(c){return
                console.error(`${r}::Error`,c,d("
              - "c)),Promise.resolve()}});return console.debug(`${r}::Waiting
                for all deletes to \\"
              - "run ...`),await Promise.all(p),console.debug(`${r}::All deletes
                ran!`),u};"
      Description: "v1.1.2 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          CONNECT_INSTANCE_ID:
            Ref: "ConnectInstance"
          DDB_TABLE_DESTINATION:
            Ref: "DdbDestinations37B2F70F"
          DDB_TABLE_DIRECTORY:
            Ref: "DdbDirectories26458382"
          DDB_TABLE_MEMBERSHIP:
            Ref: "DdbMemberships1A816D0C"
          EVENTBRIDGE_BUS_NAME:
            Ref: "ReportingEventBus79921D7B"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ReportingSnapshotLambdaServiceRoleF72F64B4"
          - "Arn"
      Runtime: "nodejs20.x"
      Timeout: 30
    DependsOn:
      - "ReportingSnapshotLambdaServiceRoleDefaultPolicy61612593"
  ReportingEventBusRule3802608B:
    Type: "AWS::Events::Rule"
    Properties:
      EventBusName:
        Ref: "ReportingEventBus79921D7B"
      EventPattern:
        source:
          - "com.asasolutions.vocaldex"
          - "aws.cloudformation"
      State: "ENABLED"
      Targets:
        - Arn:
            Fn::GetAtt:
              - "ReportingEventLambdaABCA090A"
              - "Arn"
          Id: "Target0"
  ReportingEventBusRuleAllowEventRuleVocaldexReportingEventLambdaD9B60B05C1322C2F:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ReportingEventLambdaABCA090A"
          - "Arn"
      Principal: "events.amazonaws.com"
      SourceArn:
        Fn::GetAtt:
          - "ReportingEventBusRule3802608B"
          - "Arn"
  ReportingSnapshotSchedule725FC228:
    Type: "AWS::Scheduler::Schedule"
    Properties:
      FlexibleTimeWindow:
        Mode: "OFF"
      ScheduleExpression: "cron(0 * * * ? *)"
      ScheduleExpressionTimezone: "Etc/UTC"
      State: "ENABLED"
      Target:
        Arn:
          Fn::GetAtt:
            - "ReportingSnapshotLambdaC62B141A"
            - "Arn"
        RetryPolicy:
          MaximumEventAgeInSeconds: 86400
          MaximumRetryAttempts: 185
        RoleArn:
          Fn::GetAtt:
            - "SchedulerRoleForTarget1441a743A31888"
            - "Arn"
  ReportingCloudFormationTrigger4D57BF25:
    Type: "AWS::Events::Rule"
    Properties:
      EventPattern:
        source:
          - "aws.cloudformation"
        detail-type:
          - "CloudFormation Stack Status Change"
        detail:
          stack-id:
            - Ref: "AWS::StackId"
          status-details.status:
            - "CREATE_IN_PROGRESS"
            - "CREATE_COMPLETE"
            - "CREATE_FAILED"
            - "UPDATE_COMPLETE"
            - "UPDATE_FAILED"
            - "UPDATE_IN_PROGRESS"
            - "UPDATE_ROLLBACK_COMPLETE"
            - "DELETE_IN_PROGRESS"
            - "DELETE_COMPLETE"
      State: "ENABLED"
      Targets:
        - Arn:
            Fn::GetAtt:
              - "ReportingEventBus79921D7B"
              - "Arn"
          Id: "Target0"
          RoleArn:
            Fn::GetAtt:
              - "ReportingCloudFormationTriggerEventsRoleF2310194"
              - "Arn"
  ReportingCloudFormationTriggerEventsRoleF2310194:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "events.amazonaws.com"
        Version: "2012-10-17"
  ReportingCloudFormationTriggerEventsRoleDefaultPolicy95F50578:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "events:PutEvents"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "ReportingEventBus79921D7B"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "ReportingCloudFormationTriggerEventsRoleDefaultPolicy95F50578"
      Roles:
        - Ref: "ReportingCloudFormationTriggerEventsRoleF2310194"
  SchedulerRoleForTarget1441a743A31888:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Condition:
              StringEquals:
                aws:SourceAccount:
                  Ref: "AWS::AccountId"
            Effect: "Allow"
            Principal:
              Service: "scheduler.amazonaws.com"
        Version: "2012-10-17"
  SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "lambda:InvokeFunction"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "ReportingSnapshotLambdaC62B141A"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "ReportingSnapshotLambdaC62B141A"
                        - "Arn"
                    - ":*"
        Version: "2012-10-17"
      PolicyName: "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD"
      Roles:
        - Ref: "SchedulerRoleForTarget1441a743A31888"
  ConnectDestinationInfoLambdaServiceRole1F578483:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ConnectDestinationInfoLambdaServiceRoleDefaultPolicy0D2B382C:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:Query"
              - "dynamodb:Scan"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "DdbDestinations37B2F70F"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "ConnectDestinationInfoLambdaServiceRoleDefaultPolicy0D2B382C"
      Roles:
        - Ref: "ConnectDestinationInfoLambdaServiceRole1F578483"
  ConnectDestinationInfoLambda52428FA8:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var I=Object.defineProperty;var
                B=Object.getOwnPropertyDescriptor;var
                G=Object.getOwnPropertyNames;var
                j=Object.prototype.hasOwnProperty;var P=(t,r)=>{for(var e in
                r)I(t,e,{get:r[e],enumerable:!0})},M=(t,r,e,u)=>{if(r&&"
              - "typeof r==\"object\"||typeof r==\"function\")for(let i of
                G(r))!j.call(t,i)&&i!==e&&"
              - "I(t,i,{get:()=>r[i],enumerable:!(u=B(r,i))||u.enumerable});ret\
                urn t};var V=t=>M(I({},\"__esModule\",{value:!0}),t);var
                W={};P(W,{client:()=>$,docClient:()=>L,handler:()=>H});module.e\
                xports=V(W);var b=require(\"@aws-sdk/lib-dynamodb\"),"
              - "C=require(\"@aws-sdk/client-dynamodb\");function m(t){var
                r=String(t);if(r===\"[object
                Object]\")try{r=JSON.stringify(t)}catch{}"
              - "return r}var F=function(){function t(){}return
                t.prototype.isSome=function(){return!1},t."
              - "prototype.isNone=function(){return!0},t.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(r){"
              - "return r},t.prototype.expect=function(r){throw new
                Error(\"\".concat(r))},t.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},t.prototype.map=function(r){"
              - "return this},t.prototype.mapOr=function(r,e){return
                r},t.prototype.mapOrElse=function(r,e){"
              - "return r()},t.prototype.or=function(r){return
                r},t.prototype.orElse=function(r){"
              - "return r()},t.prototype.andThen=function(r){return
                this},t.prototype.toResult=function(r){"
              - "return
                l(r)},t.prototype.toString=function(){return\"None\"},t.prototy\
                pe.toAsyncOption="
              - "function(){return new d(v)},t}(),v=new F;Object.freeze(v);var
                Y=function(){function t(r){"
              - "if(!(this instanceof t))return new t(r);this.value=r}return
                t.prototype.isSome=function(){"
              - "return!0},t.prototype.isNone=function(){return!1},t.prototype[\
                Symbol.iterator]=function(){"
              - "var r=Object(this.value);return Symbol.iterator in
                r?r[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(r){return this.value},"
              - "t.prototype.expect=function(r){return
                this.value},t.prototype.unwrap=function(){"
              - "return this.value},t.prototype.map=function(r){return
                y(r(this.value))},t.prototype."
              - "mapOr=function(r,e){return
                e(this.value)},t.prototype.mapOrElse=function(r,e){return e("
              - "this.value)},t.prototype.or=function(r){return
                this},t.prototype.orElse=function(r){"
              - "return this},t.prototype.andThen=function(r){return
                r(this.value)},t.prototype.toResult="
              - "function(r){return
                h(this.value)},t.prototype.toAsyncOption=function(){return new
                d("
              - "this)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype.toString="
              - "function(){return\"Some(\".concat(m(this.value),\")\")},t.EMPT\
                Y=new t(void 0),t}(),y=Y,"
              - "T;(function(t){function r(){for(var
                i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];"
              - "for(var s=[],c=0,p=i;c<p.length;c++){var
                o=p[c];if(o.isSome())s.push(o.value);else"
              - "return o}return y(s)}t.all=r;function e(){for(var
                i=[],n=0;n<arguments.length;n++)"
              - "i[n]=arguments[n];for(var s=0,c=i;s<c.length;s++){var
                p=c[s];if(p.isSome())return p}"
              - "return v}t.any=e;function u(i){return i instanceof
                y||i===v}t.isOption=u})(T||(T="
              - "{}));var z=function(){function t(r){if(!(this instanceof
                t))return new t(r);this.error="
              - "r;var e=new Error().stack.split(`"
              - "`).slice(2);e&&e.length>0&&e[0].includes(\"ErrImpl\")&&e.shift\
                (),this._stack=e.join("
              - "`"
              - "`)}return
                t.prototype.isOk=function(){return!1},t.prototype.isErr=functio\
                n(){return!0},"
              - "t.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "t.prototype.else=function(r){return
                r},t.prototype.unwrapOr=function(r){return r},"
              - "t.prototype.expect=function(r){throw new Error(\"\".concat(r,\"
                - Error: \").concat("
              - "m(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.expect\
                Err=function(r){return this."
              - "error},t.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "m(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.unwrap\
                Err=function(){return this."
              - "error},t.prototype.map=function(r){return
                this},t.prototype.andThen=function(r){"
              - "return this},t.prototype.mapErr=function(r){return new
                l(r(this.error))},t.prototype."
              - "mapOr=function(r,e){return
                r},t.prototype.mapOrElse=function(r,e){return r(this."
              - "error)},t.prototype.or=function(r){return
                r},t.prototype.orElse=function(r){return r("
              - "this.error)},t.prototype.toOption=function(){return
                v},t.prototype.toString=function(){"
              - "return\"Err(\".concat(m(this.error),\")\")},Object.definePrope\
                rty(t.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),t.prot\
                otype.toAsyncResult="
              - "function(){return new w(this)},t.EMPTY=new t(void 0),t}();var
                l=z,J=function(){function t(r){if(!(this instanceof t))return
                new t(r);this."
              - "value=r}return
                t.prototype.isOk=function(){return!0},t.prototype.isErr=functio\
                n(){"
              - "return!1},t.prototype[Symbol.iterator]=function(){var
                r=Object(this.value);return Symbol."
              - "iterator in
                r?r[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "t.prototype.else=function(r){return
                this.value},t.prototype.unwrapOr=function(r){"
              - "return this.value},t.prototype.expect=function(r){return
                this.value},t.prototype."
              - "expectErr=function(r){throw new
                Error(r)},t.prototype.unwrap=function(){return this."
              - "value},t.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "m(this.value)),{cause:this.value})},t.prototype.map=function(r\
                ){return new h(r(this."
              - "value))},t.prototype.andThen=function(r){return
                r(this.value)},t.prototype.mapErr="
              - "function(r){return this},t.prototype.mapOr=function(r,e){return
                e(this.value)},t."
              - "prototype.mapOrElse=function(r,e){return
                e(this.value)},t.prototype.or=function(r){"
              - "return this},t.prototype.orElse=function(r){return
                this},t.prototype.toOption=function(){"
              - "return y(this.value)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype."
              - "toString=function(){return\"Ok(\".concat(m(this.value),\")\")}\
                ,t.prototype.toAsyncResult="
              - "function(){return new w(this)},t.EMPTY=new t(void 0),t}();var
                h=J,N;(function(t){function r(){for(var
                s=[],c=0;c<arguments.length;c++)s[c]="
              - "arguments[c];for(var p=[],o=0,a=s;o<a.length;o++){var
                f=a[o];if(f.isOk())p.push("
              - "f.value);else return f}return new h(p)}t.all=r;function
                e(){for(var s=[],c=0;c<arguments."
              - "length;c++)s[c]=arguments[c];for(var
                p=[],o=0,a=s;o<a.length;o++){var f=a[o];if(f."
              - "isOk())return f;p.push(f.error)}return new
                l(p)}t.any=e;function u(s){try{return new h("
              - "s())}catch(c){return new l(c)}}t.wrap=u;function
                i(s){try{return s().then(function(c){"
              - "return new h(c)}).catch(function(c){return new
                l(c)})}catch(c){return Promise.resolve("
              - "new l(c))}}t.wrapAsync=i;function n(s){return s instanceof l||s
                instanceof h}t.isResult="
              - "n})(N||(N={}));var g=function(t,r,e,u){function i(n){return n
                instanceof e?n:new e(function(s){"
              - "s(n)})}return new(e||(e=Promise))(function(n,s){function
                c(a){try{o(u.next(a))}catch(f){"
              - "s(f)}}function p(a){try{o(u.throw(a))}catch(f){s(f)}}function
                o(a){a.done?n(a.value):"
              - "i(a.value).then(c,p)}o((u=u.apply(t,r||[])).next())})},E=funct\
                ion(t,r){var e={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},u,i,n,s;return s="
              - "{next:c(0),throw:c(1),return:c(2)},typeof
                Symbol==\"function\"&&(s[Symbol.iterator]="
              - "function(){return this}),s;function c(o){return
                function(a){return p([o,a])}}function p(o){"
              - "if(u)throw new TypeError(\"Generator is already
                executing.\");for(;s&&(s=0,o[0]&&(e="
              - "0)),e;)try{if(u=1,i&&(n=o[0]&2?i.return:o[0]?i.throw||((n=i.re\
                turn)&&n.call(i),0):"
              - "i.next)&&!(n=n.call(i,o[1])).done)return
                n;switch(i=0,n&&(o=[o[0]&2,n.value]),o[0]){case 0:case 1:"
              - "n=o;break;case 4:return e.label++,{value:o[1],done:!1};case
                5:e.label++,i=o[1],o="
              - "[0];continue;case
                7:o=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue\
                }if(o[0]===3&&(!n||"
              - "o[1]>n[0]&&o[1]<n[3])){e.label=o[1];break}if(o[0]===6&&e.label\
                <n[1]){e.label=n[1],"
              - "n=o;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(o);break\
                }n[2]&&e.ops.pop(),"
              - "e.trys.pop();continue}o=r.call(t,e)}catch(a){o=[6,a],i=0}final\
                ly{u=n=0}if(o[0]&5)"
              - "throw o[1];return{value:o[0]?o[1]:void
                0,done:!0}}},w=function(){function t(r){this."
              - "promise=Promise.resolve(r)}return
                t.prototype.andThen=function(r){var e=this;return this."
              - "thenInternal(function(u){return g(e,void 0,void
                0,function(){var i;return E(this,"
              - "function(n){return u.isErr()?[2,u]:(i=r(u.value),[2,i
                instanceof t?i.promise:i])})})})},"
              - "t.prototype.map=function(r){var e=this;return
                this.thenInternal(function(u){return g("
              - "e,void 0,void 0,function(){var i;return
                E(this,function(n){switch(n.label){case 0:"
              - "return u.isErr()?[2,u]:(i=h,[4,r(u.value)]);case
                1:return[2,i.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.mapErr=function(r){var e=this;return
                this.thenInternal(function(u){return g("
              - "e,void 0,void 0,function(){var i;return
                E(this,function(n){switch(n.label){case 0:"
              - "return u.isOk()?[2,u]:(i=l,[4,r(u.error)]);case
                1:return[2,i.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.or=function(r){return this.orElse(function(){return
                r})},t.prototype."
              - "orElse=function(r){var e=this;return
                this.thenInternal(function(u){return g(e,void 0,"
              - "void 0,function(){var i;return E(this,function(n){return
                u.isOk()?[2,u]:(i=r(u.error),"
              - "[2,i instanceof
                t?i.promise:i])})})})},t.prototype.toOption=function(){return
                new d("
              - "this.promise.then(function(r){return
                r.toOption()}))},t.prototype.thenInternal=function(r){"
              - "return new t(this.promise.then(r))},t}();var
                x=function(t,r,e,u){function i(n){return n instanceof e?n:new
                e(function(s){"
              - "s(n)})}return new(e||(e=Promise))(function(n,s){function
                c(a){try{o(u.next(a))}catch(f){"
              - "s(f)}}function p(a){try{o(u.throw(a))}catch(f){s(f)}}function
                o(a){a.done?n(a.value):"
              - "i(a.value).then(c,p)}o((u=u.apply(t,r||[])).next())})},_=funct\
                ion(t,r){var e={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},u,i,n,s;return s="
              - "{next:c(0),throw:c(1),return:c(2)},typeof
                Symbol==\"function\"&&(s[Symbol.iterator]="
              - "function(){return this}),s;function c(o){return
                function(a){return p([o,a])}}function p(o){"
              - "if(u)throw new TypeError(\"Generator is already
                executing.\");for(;s&&(s=0,o[0]&&(e="
              - "0)),e;)try{if(u=1,i&&(n=o[0]&2?i.return:o[0]?i.throw||((n=i.re\
                turn)&&n.call(i),0):"
              - "i.next)&&!(n=n.call(i,o[1])).done)return
                n;switch(i=0,n&&(o=[o[0]&2,n.value]),o[0]){case 0:case 1:"
              - "n=o;break;case 4:return e.label++,{value:o[1],done:!1};case
                5:e.label++,i=o[1],o="
              - "[0];continue;case
                7:o=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue\
                }if(o[0]===3&&(!n||"
              - "o[1]>n[0]&&o[1]<n[3])){e.label=o[1];break}if(o[0]===6&&e.label\
                <n[1]){e.label=n[1],"
              - "n=o;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(o);break\
                }n[2]&&e.ops.pop(),"
              - "e.trys.pop();continue}o=r.call(t,e)}catch(a){o=[6,a],i=0}final\
                ly{u=n=0}if(o[0]&5)"
              - "throw o[1];return{value:o[0]?o[1]:void
                0,done:!0}}},d=function(){function t(r){this."
              - "promise=Promise.resolve(r)}return
                t.prototype.andThen=function(r){var e=this;return this."
              - "thenInternal(function(u){return x(e,void 0,void
                0,function(){var i;return _(this,"
              - "function(n){return u.isNone()?[2,u]:(i=r(u.value),[2,i
                instanceof t?i.promise:i])})})})},"
              - "t.prototype.map=function(r){var e=this;return
                this.thenInternal(function(u){return x("
              - "e,void 0,void 0,function(){var i;return
                _(this,function(n){switch(n.label){case 0:"
              - "return u.isNone()?[2,u]:(i=y,[4,r(u.value)]);case
                1:return[2,i.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.or=function(r){return this.orElse(function(){return
                r})},t.prototype."
              - "orElse=function(r){var e=this;return
                this.thenInternal(function(u){return x(e,void 0,"
              - "void 0,function(){var i;return _(this,function(n){return
                u.isSome()?[2,u]:(i=r(),"
              - "[2,i instanceof
                t?i.promise:i])})})})},t.prototype.toResult=function(r){return
                new w("
              - "this.promise.then(function(e){return
                e.toResult(r)}))},t.prototype.thenInternal="
              - "function(r){return new t(this.promise.then(r))},t}();var
                O=t=>btoa(JSON.stringify(t)),S=(...t)=>{};var
                A=10,D=(t,r,e)=>{let
                u=\"api.validation.validateIdValue\";try{if(typeof e!=\"st\\"
              - "ring\"||e.length!=A){let i=`:${r} is malformed: '${e}'`;return
                S(`${t}:${u}::${i}`),"
              - "l({message:`resources.${r}.validation.invalid`,detail:`The ${r}
                must be a string\\"
              - " of length ${A}: '${e}'`,errorSource:\"CLIENT\"})}else return
                h(e)}catch(i){let n=typeof i=="
              - "\"string\"?new
                Error(i):i,s={message:\"internalServerError\",detail:n.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:n};return
                console.error(`${u}::error`,s,O(s)),l(s)}};var k=(t,r)=>{let
                e=\"util.getEnvOrDefault\";try{let u;return
                process.env.hasOwnProperty("
              - "t)&&process.env[t]?u=process.env[t]:u=r,u}catch(u){let
                n=`${e}::unexpected excep\\"
              - "tion:${u.message}`;throw new Error(n)}};var
                U={region:k(\"DDB_AWS_REGION\",\"us-east-1\")},R={DESTINATION:p\
                rocess.env.DDB_TABLE_DESTINATION};"
              - "if(!R.DESTINATION)throw new Error(\"DDB_TABLE_DESTINATION not
                set\");var $=new C.DynamoDBClient("
              - "U),L=b.DynamoDBDocumentClient.from($),H=async(t,r,e)=>{let
                u=\"index.handler\";(!process."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${u}::Received even\\"
              - "t`,JSON.stringify(t),t);let
                i=\"DestinationId\",n=t.Details.Parameters.dNameLookup,"
              - "s=R.DESTINATION,c=D(u,i,n);if(c.isErr()){let
                p=c.error;console.error(`${u}::vali\\"
              - "dateResult`,p,O(p)),e(new Error(p.message),void 0)}try{let
                p={TableName:s,Key:{[i]:n}};"
              - "console.debug(`${u}::GetCommandInput`,p);let o=await L.send(new
                b.GetCommand(p));"
              - "if(console.debug(`${u}::result`,o),!o.Item)throw new
                Error(`Item not found in ${s}\\"
              - " for ${i}
                ${n}`);if(console.debug(`${u}::result.Item`,o.Item),!o.Item.has\
                OwnProperty("
              - "i)){let f=`${u}::${i} not found in result.Item`;throw
                console.error(f,o),new Error("
              - "f)}let
                a={GuiName:o.Item.GuiName||\"\",VuiName:o.Item.VuiName||\"\",Ex\
                ternalTarget:o."
              - "Item.AmazonConnect.ExternalTarget||\"\",InternalTarget:o.Item.\
                AmazonConnect.InternalTarget||"
              - "\"\"};a.hasGuiName=a.GuiName.length>0?\"yes\":\"no\",a.hasVuiN\
                ame=a.VuiName.length>0?\"\\"
              - "yes\":\"no\",a.hasExternalTarget=a.ExternalTarget.length>0?\"y\
                es\":\"no\",a.hasInternalTarget="
              - "a.InternalTarget.length>0?\"yes\":\"no\",e(null,a)}catch(p){let
                a=`${u}::oops:${p.message}`;"
              - "throw new Error(a)}};"
      Description: "v1.0.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          CONNECT_AWS_REGION:
            Ref: "AWS::Region"
          CONNECT_INSTANCE_ID:
            Ref: "ConnectInstance"
          DDB_TABLE_DESTINATION:
            Ref: "DdbDestinations37B2F70F"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ConnectDestinationInfoLambdaServiceRole1F578483"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn:
      - "ConnectDestinationInfoLambdaServiceRoleDefaultPolicy0D2B382C"
  ConnectDestinationInfoLambdaDestinationInfoLambdaResourcePolicyAD6491A9:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ConnectDestinationInfoLambda52428FA8"
          - "Arn"
      Principal: "connect.amazonaws.com"
      SourceAccount:
        Ref: "AWS::AccountId"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:aws:connect:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":instance/"
            - Ref: "ConnectInstance"
  ConnectDestinationInfoLambdaIntegration0753BFF1:
    Type: "AWS::Connect::IntegrationAssociation"
    Properties:
      InstanceId:
        Fn::Join:
          - ""
          - - "arn:aws:connect:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":instance/"
            - Ref: "ConnectInstance"
      IntegrationArn:
        Fn::GetAtt:
          - "ConnectDestinationInfoLambda52428FA8"
          - "Arn"
      IntegrationType: "LAMBDA_FUNCTION"
  ConnectEventsLambdaServiceRole3BA8FFD5:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ConnectEventsLambdaServiceRoleDefaultPolicy976EDE38:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "events:PutEvents"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "ReportingEventBus79921D7B"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "ConnectEventsLambdaServiceRoleDefaultPolicy976EDE38"
      Roles:
        - Ref: "ConnectEventsLambdaServiceRole3BA8FFD5"
  ConnectEventsLambdaCAE22488:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var L=Object.defineProperty;var
                G=Object.getOwnPropertyDescriptor;var
                j=Object.getOwnPropertyNames;var
                K=Object.prototype.hasOwnProperty;var W=(t,e)=>{for(var n in
                e)L(t,n,{get:e[n],enumerable:!0})},J=(t,e,n,s)=>{if(e&&"
              - "typeof e==\"object\"||typeof e==\"function\")for(let i of
                j(e))!K.call(t,i)&&i!==n&&"
              - "L(t,i,{get:()=>e[i],enumerable:!(s=G(e,i))||s.enumerable});ret\
                urn t};var Y=t=>J(L({},\"__esModule\",{value:!0}),t);var
                st={};W(st,{_getEventBusDetails:()=>P,_getEventBusEntry:()=>F,_\
                runner:()=>M,"
              - "ebClient:()=>D,handler:()=>it});module.exports=Y(st);var
                C=require(\"@aws-sdk/client-eventbridge\");var
                g=require(\"@aws-sdk/client-license-manager\");var
                S=t=>t.invokedFunctionArn.split(\":\")[4],O=t=>btoa(JSON.string\
                ify(t)),h=(...t)=>{};var
                q=\"entitlement.broken.redeployApp\",z=\"entitlement.missing\",\
                k=async t=>{let e=\"\\"
              - "doLicenseCheck\";try{let
                n=\"6cf9s66w3t0z1qdjuijuoc6ah\",s=\"186272575067\",r={region:pr\
                ocess."
              - "env.AWS_REGION||\"us-east-1\"},u=new
                g.LicenseManagerClient(r),c={Filters:[{Name:\"\\"
              - "ProductSKU\",Values:[n]},{Name:\"Status\",Values:[\"AVAILABLE\
                \"]}]},p,o=!1;t==s?(p=new g.ListLicensesCommand("
              - "c),o=!0):p=new
                g.ListReceivedLicensesCommand(c),h(`${e}::getting
                licenses`,{callerAwsAccountId:t,"
              - "seller:s,input:c,command:p});let a=await
                u.send(p);console.debug(O(a));let l=a.Licenses||"
              - "[];return o&&(h(`${e}::filtering beneficiary because
                seller=account`),l=l.filter("
              - "v=>v.Beneficiary?.includes(`:${t}:`)),h(O(l))),X(a)&&(l=l.filt\
                er(v=>v.Issuer?.KeyFingerprint?."
              - "startsWith(`aws:${s}:`)),h(O(l)),l.length>0)?H(l[0].Beneficiar\
                y):I(z)}catch(n){let s=n;"
              - "if((s.name||\"\")===\"AuthorizationException\")return
                I(q);if((s.name||\"\")===\"Access\\"
              - "DeniedException\")return I(s.message);{let i=`${e}::unexpected
                exception:${s.message}`;"
              - "return
                h(i,s,O(s)),Q(s)}}},H=t=>({status:\"LICENSE_FOUND\",data:t}),Q=\
                t=>({status:\"\\"
              - "LOOKUP_ERROR\",data:t instanceof
                Error?t.message:t}),I=t=>({status:\"LICENSE_MISSI\\"
              - "NG\",data:t}),X=t=>{let
                e=\"checkLicenses.isValid\";if((t.Licenses||[]).length==0)return
                h("
              - "`${e}::No active subscription found in AWS Marketplace`),!1;let
                n=t.Licenses[0];"
              - "if((n.Entitlements||[]).length==0)return h(`${e}::No
                entitlement found on Licens\\"
              - "e`),!1;let s=n.Entitlements[0];return
                s.Value!==\"Enabled\"?(h(`${e}::Entitlement \\"
              - "not enabled:
                ${s.Value}`),!1):n.Status!==\"AVAILABLE\"&&n.Status!==\"ACTIVE\
                \"?(h(`${e}\\"
              - "::License not available or active:
                ${n.Status}`),!1):!0};function y(t){var
                e=String(t);if(e===\"[object
                Object]\")try{e=JSON.stringify(t)}catch{}"
              - "return e}var Z=function(){function t(){}return
                t.prototype.isSome=function(){return!1},t."
              - "prototype.isNone=function(){return!0},t.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){"
              - "return e},t.prototype.expect=function(e){throw new
                Error(\"\".concat(e))},t.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},t.prototype.map=function(e){"
              - "return this},t.prototype.mapOr=function(e,n){return
                e},t.prototype.mapOrElse=function(e,n){"
              - "return e()},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){"
              - "return e()},t.prototype.andThen=function(e){return
                this},t.prototype.toResult=function(e){"
              - "return
                d(e)},t.prototype.toString=function(){return\"None\"},t.prototy\
                pe.toAsyncOption="
              - "function(){return new x(w)},t}(),w=new Z;Object.freeze(w);var
                tt=function(){function t(e){"
              - "if(!(this instanceof t))return new t(e);this.value=e}return
                t.prototype.isSome=function(){"
              - "return!0},t.prototype.isNone=function(){return!1},t.prototype[\
                Symbol.iterator]=function(){"
              - "var e=Object(this.value);return Symbol.iterator in
                e?e[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){return this.value},"
              - "t.prototype.expect=function(e){return
                this.value},t.prototype.unwrap=function(){"
              - "return this.value},t.prototype.map=function(e){return
                E(e(this.value))},t.prototype."
              - "mapOr=function(e,n){return
                n(this.value)},t.prototype.mapOrElse=function(e,n){return n("
              - "this.value)},t.prototype.or=function(e){return
                this},t.prototype.orElse=function(e){"
              - "return this},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.toResult="
              - "function(e){return
                m(this.value)},t.prototype.toAsyncOption=function(){return new
                x("
              - "this)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype.toString="
              - "function(){return\"Some(\".concat(y(this.value),\")\")},t.EMPT\
                Y=new t(void 0),t}(),E=tt,"
              - "B;(function(t){function e(){for(var
                i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];"
              - "for(var u=[],c=0,p=i;c<p.length;c++){var
                o=p[c];if(o.isSome())u.push(o.value);else"
              - "return o}return E(u)}t.all=e;function n(){for(var
                i=[],r=0;r<arguments.length;r++)"
              - "i[r]=arguments[r];for(var u=0,c=i;u<c.length;u++){var
                p=c[u];if(p.isSome())return p}"
              - "return w}t.any=n;function s(i){return i instanceof
                E||i===w}t.isOption=s})(B||(B="
              - "{}));var et=function(){function t(e){if(!(this instanceof
                t))return new t(e);this.error="
              - "e;var n=new Error().stack.split(`"
              - "`).slice(2);n&&n.length>0&&n[0].includes(\"ErrImpl\")&&n.shift\
                (),this._stack=n.join("
              - "`"
              - "`)}return
                t.prototype.isOk=function(){return!1},t.prototype.isErr=functio\
                n(){return!0},"
              - "t.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "t.prototype.else=function(e){return
                e},t.prototype.unwrapOr=function(e){return e},"
              - "t.prototype.expect=function(e){throw new Error(\"\".concat(e,\"
                - Error: \").concat("
              - "y(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.expect\
                Err=function(e){return this."
              - "error},t.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "y(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.unwrap\
                Err=function(){return this."
              - "error},t.prototype.map=function(e){return
                this},t.prototype.andThen=function(e){"
              - "return this},t.prototype.mapErr=function(e){return new
                d(e(this.error))},t.prototype."
              - "mapOr=function(e,n){return
                e},t.prototype.mapOrElse=function(e,n){return e(this."
              - "error)},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){return e("
              - "this.error)},t.prototype.toOption=function(){return
                w},t.prototype.toString=function(){"
              - "return\"Err(\".concat(y(this.error),\")\")},Object.definePrope\
                rty(t.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),t.prot\
                otype.toAsyncResult="
              - "function(){return new b(this)},t.EMPTY=new t(void 0),t}();var
                d=et,nt=function(){function t(e){if(!(this instanceof t))return
                new t(e);this."
              - "value=e}return
                t.prototype.isOk=function(){return!0},t.prototype.isErr=functio\
                n(){"
              - "return!1},t.prototype[Symbol.iterator]=function(){var
                e=Object(this.value);return Symbol."
              - "iterator in
                e?e[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "t.prototype.else=function(e){return
                this.value},t.prototype.unwrapOr=function(e){"
              - "return this.value},t.prototype.expect=function(e){return
                this.value},t.prototype."
              - "expectErr=function(e){throw new
                Error(e)},t.prototype.unwrap=function(){return this."
              - "value},t.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "y(this.value)),{cause:this.value})},t.prototype.map=function(e\
                ){return new m(e(this."
              - "value))},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.mapErr="
              - "function(e){return this},t.prototype.mapOr=function(e,n){return
                n(this.value)},t."
              - "prototype.mapOrElse=function(e,n){return
                n(this.value)},t.prototype.or=function(e){"
              - "return this},t.prototype.orElse=function(e){return
                this},t.prototype.toOption=function(){"
              - "return E(this.value)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype."
              - "toString=function(){return\"Ok(\".concat(y(this.value),\")\")}\
                ,t.prototype.toAsyncResult="
              - "function(){return new b(this)},t.EMPTY=new t(void 0),t}();var
                m=nt,V;(function(t){function e(){for(var
                u=[],c=0;c<arguments.length;c++)u[c]="
              - "arguments[c];for(var p=[],o=0,a=u;o<a.length;o++){var
                l=a[o];if(l.isOk())p.push("
              - "l.value);else return l}return new m(p)}t.all=e;function
                n(){for(var u=[],c=0;c<arguments."
              - "length;c++)u[c]=arguments[c];for(var
                p=[],o=0,a=u;o<a.length;o++){var l=a[o];if(l."
              - "isOk())return l;p.push(l.error)}return new
                d(p)}t.any=n;function s(u){try{return new m("
              - "u())}catch(c){return new d(c)}}t.wrap=s;function
                i(u){try{return u().then(function(c){"
              - "return new m(c)}).catch(function(c){return new
                d(c)})}catch(c){return Promise.resolve("
              - "new d(c))}}t.wrapAsync=i;function r(u){return u instanceof d||u
                instanceof m}t.isResult="
              - "r})(V||(V={}));var _=function(t,e,n,s){function i(r){return r
                instanceof n?r:new n(function(u){"
              - "u(r)})}return new(n||(n=Promise))(function(r,u){function
                c(a){try{o(s.next(a))}catch(l){"
              - "u(l)}}function p(a){try{o(s.throw(a))}catch(l){u(l)}}function
                o(a){a.done?r(a.value):"
              - "i(a.value).then(c,p)}o((s=s.apply(t,e||[])).next())})},N=funct\
                ion(t,e){var n={label:0,"
              - "sent:function(){if(r[0]&1)throw r[1];return
                r[1]},trys:[],ops:[]},s,i,r,u;return u="
              - "{next:c(0),throw:c(1),return:c(2)},typeof
                Symbol==\"function\"&&(u[Symbol.iterator]="
              - "function(){return this}),u;function c(o){return
                function(a){return p([o,a])}}function p(o){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;u&&(u=0,o[0]&&(n="
              - "0)),n;)try{if(s=1,i&&(r=o[0]&2?i.return:o[0]?i.throw||((r=i.re\
                turn)&&r.call(i),0):"
              - "i.next)&&!(r=r.call(i,o[1])).done)return
                r;switch(i=0,r&&(o=[o[0]&2,r.value]),o[0]){case 0:case 1:"
              - "r=o;break;case 4:return n.label++,{value:o[1],done:!1};case
                5:n.label++,i=o[1],o="
              - "[0];continue;case
                7:o=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r="
              - "r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){n=0;continue\
                }if(o[0]===3&&(!r||"
              - "o[1]>r[0]&&o[1]<r[3])){n.label=o[1];break}if(o[0]===6&&n.label\
                <r[1]){n.label=r[1],"
              - "r=o;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(o);break\
                }r[2]&&n.ops.pop(),"
              - "n.trys.pop();continue}o=e.call(t,n)}catch(a){o=[6,a],i=0}final\
                ly{s=r=0}if(o[0]&5)"
              - "throw o[1];return{value:o[0]?o[1]:void
                0,done:!0}}},b=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var n=this;return this."
              - "thenInternal(function(s){return _(n,void 0,void
                0,function(){var i;return N(this,"
              - "function(r){return s.isErr()?[2,s]:(i=e(s.value),[2,i
                instanceof t?i.promise:i])})})})},"
              - "t.prototype.map=function(e){var n=this;return
                this.thenInternal(function(s){return _("
              - "n,void 0,void 0,function(){var i;return
                N(this,function(r){switch(r.label){case 0:"
              - "return s.isErr()?[2,s]:(i=m,[4,e(s.value)]);case
                1:return[2,i.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.mapErr=function(e){var n=this;return
                this.thenInternal(function(s){return _("
              - "n,void 0,void 0,function(){var i;return
                N(this,function(r){switch(r.label){case 0:"
              - "return s.isOk()?[2,s]:(i=d,[4,e(s.error)]);case
                1:return[2,i.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var n=this;return
                this.thenInternal(function(s){return _(n,void 0,"
              - "void 0,function(){var i;return N(this,function(r){return
                s.isOk()?[2,s]:(i=e(s.error),"
              - "[2,i instanceof
                t?i.promise:i])})})})},t.prototype.toOption=function(){return
                new x("
              - "this.promise.then(function(e){return
                e.toOption()}))},t.prototype.thenInternal=function(e){"
              - "return new t(this.promise.then(e))},t}();var
                T=function(t,e,n,s){function i(r){return r instanceof n?r:new
                n(function(u){"
              - "u(r)})}return new(n||(n=Promise))(function(r,u){function
                c(a){try{o(s.next(a))}catch(l){"
              - "u(l)}}function p(a){try{o(s.throw(a))}catch(l){u(l)}}function
                o(a){a.done?r(a.value):"
              - "i(a.value).then(c,p)}o((s=s.apply(t,e||[])).next())})},R=funct\
                ion(t,e){var n={label:0,"
              - "sent:function(){if(r[0]&1)throw r[1];return
                r[1]},trys:[],ops:[]},s,i,r,u;return u="
              - "{next:c(0),throw:c(1),return:c(2)},typeof
                Symbol==\"function\"&&(u[Symbol.iterator]="
              - "function(){return this}),u;function c(o){return
                function(a){return p([o,a])}}function p(o){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;u&&(u=0,o[0]&&(n="
              - "0)),n;)try{if(s=1,i&&(r=o[0]&2?i.return:o[0]?i.throw||((r=i.re\
                turn)&&r.call(i),0):"
              - "i.next)&&!(r=r.call(i,o[1])).done)return
                r;switch(i=0,r&&(o=[o[0]&2,r.value]),o[0]){case 0:case 1:"
              - "r=o;break;case 4:return n.label++,{value:o[1],done:!1};case
                5:n.label++,i=o[1],o="
              - "[0];continue;case
                7:o=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r="
              - "r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){n=0;continue\
                }if(o[0]===3&&(!r||"
              - "o[1]>r[0]&&o[1]<r[3])){n.label=o[1];break}if(o[0]===6&&n.label\
                <r[1]){n.label=r[1],"
              - "r=o;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(o);break\
                }r[2]&&n.ops.pop(),"
              - "n.trys.pop();continue}o=e.call(t,n)}catch(a){o=[6,a],i=0}final\
                ly{s=r=0}if(o[0]&5)"
              - "throw o[1];return{value:o[0]?o[1]:void
                0,done:!0}}},x=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var n=this;return this."
              - "thenInternal(function(s){return T(n,void 0,void
                0,function(){var i;return R(this,"
              - "function(r){return s.isNone()?[2,s]:(i=e(s.value),[2,i
                instanceof t?i.promise:i])})})})},"
              - "t.prototype.map=function(e){var n=this;return
                this.thenInternal(function(s){return T("
              - "n,void 0,void 0,function(){var i;return
                R(this,function(r){switch(r.label){case 0:"
              - "return s.isNone()?[2,s]:(i=E,[4,e(s.value)]);case
                1:return[2,i.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var n=this;return
                this.thenInternal(function(s){return T(n,void 0,"
              - "void 0,function(){var i;return R(this,function(r){return
                s.isSome()?[2,s]:(i=e(),"
              - "[2,i instanceof
                t?i.promise:i])})})})},t.prototype.toResult=function(e){return
                new b("
              - "this.promise.then(function(n){return
                n.toResult(e)}))},t.prototype.thenInternal="
              - "function(e){return new t(this.promise.then(e))},t}();var
                A=(t,e)=>{let n=\"util.getEnvOrDefault\";try{let s;return
                process.env.hasOwnProperty("
              - "t)&&process.env[t]?s=process.env[t]:s=e,s}catch(s){let
                r=`${n}::unexpected excep\\"
              - "tion:${s.message}`;throw new Error(r)}};var
                rt={region:A(\"EVENTBRIDGE_AWS_REGION\",\"us-east-1\")},ot=A(\"\
                EVENTBRIDGE_BUS_NA\\"
              - "ME\",\"default\"),D=new
                C.EventBridgeClient(rt),it=async(t,e,n)=>{let s=\"index.hand\\"
              - "ler\";(!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")\
                &&console.debug(`${s}\\"
              - "::Received event`,JSON.stringify(t),t);let i,r;try{r=await
                M(t,e)}catch(u){i=u;let c=`${s}\\"
              - "::oops:${i.message}`;console.error(c,i)}finally{console.debug(\
                `${s}::callbackErr\\"
              - "or`,i),console.debug(`${s}::callbackResult`,r),n(i,r)}},P=(t,e\
                )=>{let n=\"index.g\\"
              - "etEventDimensions\";console.debug(`${n}::connectData`,t),conso\
                le.debug(`${n}::par\\"
              - "ameters`,e);let
                s=[\"directoryId\",\"directoryName\",\"eventType\"],i=[\"destin\
                ationId\","
              - "\"destinationName\",\"lookupAttempt\",\"yesNoAttempt\"],r,u={}\
                ;[...s,...i].forEach(f=>{"
              - "e.hasOwnProperty(f)&&e[f]!==void
                0&&e[f]!==null?f===\"eventType\"?r=e[f]:f.toLowerCase()."
              - "endsWith(\"attempt\")?typeof
                e[f]==\"string\"?u[f]=e[f].length:typeof e[f]==\"number\"?"
              - "u[f]=e[f]:console.error(`${n}::${f} has unexpected type:
                ${typeof e[f]}`):u[f]=e[f]:"
              - "f in s?console.error(`${n}::${f} not found in event
                parameters`):console.debug(`${n}\\"
              - "::${f} not found in event
                parameters`)}),r=r||\"UNKNOWN\";let[c,p,o,a,l]=t.InstanceARN."
              - "split(\":\"),[v,U]=t.InstanceARN.split(\"/\"),$={...u,accountI\
                d:l,channel:t.Channel,"
              - "connectInstanceId:U,contactId:t.ContactId,eventType:r,region:a\
                ,source:\"ConnectMo\\"
              - "dule\"};return console.debug(`${n}::output`,$),$},F=(t,e)=>{let
                n=\"index.getEvent\\"
              - "BusItem\",s={EventBusName:ot,Source:\"com.asasolutions.vocaldex\
                \",DetailType:\"Vocal\\"
              - "dex Application Event\"},i=P(t,e);return
                s.Detail=JSON.stringify(i),console.debug("
              - "`${n}::output`,s),s},M=async(t,e)=>{if(!t.Name||t.Name!==\"Con\
                tactFlowEvent\"){let l=`\\"
              - "Unsupported event type: ${t.Name}`;throw new Error(l)}let
                n=t.Details.ContactData,"
              - "s=t.Details.Parameters,i=F(n,s),r={Entries:[i]};try{console.de\
                bug(\"entryInput\",r);"
              - "let l=await D.send(new
                C.PutEventsCommand(r));console.debug(\"entryResponse\",l)}catch\
                (l){"
              - "let v=`Error sending event to EventBridge:
                ${l.message}`;console.error(v,l)}let u=i,"
              - "c=JSON.parse(u.Detail);if(c.eventType!==\"Arrived\")return{};c\
                .eventType=\"NotLicen\\"
              - "sed\";let p=S(e),o=await
                k(S(e));o.status==\"LOOKUP_ERROR\"?(console.error(o.data),"
              - "c.eventType=\"GraceLicensed\"):o.status==\"LICENSE_MISSING\"?(\
                console.error(o.data),"
              - "c.eventType=\"NotLicensed\"):o.status==\"LICENSE_FOUND\"&&o.da\
                ta.includes(`:${p}:`)&&"
              - "(c.eventType=\"IsLicensed\");let
                a={Entries:[{...u,Detail:JSON.stringify(c)}]};try{"
              - "console.debug(\"entitlementInput\",a);let l=await D.send(new
                C.PutEventsCommand(a));"
              - "console.debug(\"entitlementResponse\",l)}catch(l){let v=`Error
                sending entitlement\\"
              - " event to EventBridge:
                ${l.message}`;console.error(v,l)}finally{if(c.eventType=="
              - "\"NotLicensed\")throw new Error(\"Not entitled to use
                Vocaldex\");return{}}};"
      Description: "v1.0.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          AWS_ACCOUNT_ID:
            Ref: "AWS::AccountId"
          EVENTBRIDGE_AWS_REGION:
            Ref: "AWS::Region"
          EVENTBRIDGE_BUS_NAME:
            Ref: "ReportingEventBus79921D7B"
          PRODUCT_CODE: "6cf9s66w3t0z1qdjuijuoc6ah"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ConnectEventsLambdaServiceRole3BA8FFD5"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn:
      - "ConnectEventsLambdaServiceRoleDefaultPolicy976EDE38"
  ConnectEventsLambdaEventsLambdaResourcePolicyB404D22F:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ConnectEventsLambdaCAE22488"
          - "Arn"
      Principal: "connect.amazonaws.com"
      SourceAccount:
        Ref: "AWS::AccountId"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:aws:connect:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":instance/"
            - Ref: "ConnectInstance"
  ConnectEventsLambdaListReceivedLicensesRoleEF54B985:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "license-manager:ListLicenses"
              - "license-manager:ListReceivedLicenses"
            Effect: "Allow"
            Resource: "*"
        Version: "2012-10-17"
      PolicyName: "ConnectEventsLambdaListReceivedLicensesRoleEF54B985"
      Roles:
        - Ref: "ConnectEventsLambdaServiceRole3BA8FFD5"
  ConnectEventsLambdaIntegration049E8072:
    Type: "AWS::Connect::IntegrationAssociation"
    Properties:
      InstanceId:
        Fn::Join:
          - ""
          - - "arn:aws:connect:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":instance/"
            - Ref: "ConnectInstance"
      IntegrationArn:
        Fn::GetAtt:
          - "ConnectEventsLambdaCAE22488"
          - "Arn"
      IntegrationType: "LAMBDA_FUNCTION"
  ConnectRoutingLambdaServiceRole209397CE:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ConnectRoutingLambdaServiceRoleDefaultPolicyF326684D:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "events:PutEvents"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "ReportingEventBus79921D7B"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "ConnectRoutingLambdaServiceRoleDefaultPolicyF326684D"
      Roles:
        - Ref: "ConnectRoutingLambdaServiceRole209397CE"
  ConnectRoutingLambdaD0DD651C:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var C=Object.defineProperty;var
                D=Object.getOwnPropertyDescriptor;var
                $=Object.getOwnPropertyNames;var
                U=Object.prototype.hasOwnProperty;var V=(t,n)=>{for(var e in
                n)C(t,e,{get:n[e],enumerable:!0})},F=(t,n,e,i)=>{if(n&&"
              - "typeof n==\"object\"||typeof n==\"function\")for(let o of
                $(n))!U.call(t,o)&&o!==e&&"
              - "C(t,o,{get:()=>n[o],enumerable:!(i=D(n,o))||i.enumerable});ret\
                urn t};var L=t=>F(C({},\"__esModule\",{value:!0}),t);var
                q={};V(q,{_getEventDimensions:()=>N,_runner:()=>A,handler:()=>W\
                });module.exports="
              - "L(q);var x=require(\"@aws-sdk/client-connect\");function
                y(t){var n=String(t);if(n===\"[object
                Object]\")try{n=JSON.stringify(t)}catch{}"
              - "return n}var B=function(){function t(){}return
                t.prototype.isSome=function(){return!1},t."
              - "prototype.isNone=function(){return!0},t.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(n){"
              - "return n},t.prototype.expect=function(n){throw new
                Error(\"\".concat(n))},t.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},t.prototype.map=function(n){"
              - "return this},t.prototype.mapOr=function(n,e){return
                n},t.prototype.mapOrElse=function(n,e){"
              - "return n()},t.prototype.or=function(n){return
                n},t.prototype.orElse=function(n){"
              - "return n()},t.prototype.andThen=function(n){return
                this},t.prototype.toResult=function(n){"
              - "return
                f(n)},t.prototype.toString=function(){return\"None\"},t.prototy\
                pe.toAsyncOption="
              - "function(){return new g(d)},t}(),d=new B;Object.freeze(d);var
                P=function(){function t(n){"
              - "if(!(this instanceof t))return new t(n);this.value=n}return
                t.prototype.isSome=function(){"
              - "return!0},t.prototype.isNone=function(){return!1},t.prototype[\
                Symbol.iterator]=function(){"
              - "var n=Object(this.value);return Symbol.iterator in
                n?n[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(n){return this.value},"
              - "t.prototype.expect=function(n){return
                this.value},t.prototype.unwrap=function(){"
              - "return this.value},t.prototype.map=function(n){return
                m(n(this.value))},t.prototype."
              - "mapOr=function(n,e){return
                e(this.value)},t.prototype.mapOrElse=function(n,e){return e("
              - "this.value)},t.prototype.or=function(n){return
                this},t.prototype.orElse=function(n){"
              - "return this},t.prototype.andThen=function(n){return
                n(this.value)},t.prototype.toResult="
              - "function(n){return
                h(this.value)},t.prototype.toAsyncOption=function(){return new
                g("
              - "this)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype.toString="
              - "function(){return\"Some(\".concat(y(this.value),\")\")},t.EMPT\
                Y=new t(void 0),t}(),m=P,"
              - "T;(function(t){function n(){for(var
                o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];"
              - "for(var a=[],u=0,l=o;u<l.length;u++){var
                s=l[u];if(s.isSome())a.push(s.value);else"
              - "return s}return m(a)}t.all=n;function e(){for(var
                o=[],r=0;r<arguments.length;r++)"
              - "o[r]=arguments[r];for(var a=0,u=o;a<u.length;a++){var
                l=u[a];if(l.isSome())return l}"
              - "return d}t.any=e;function i(o){return o instanceof
                m||o===d}t.isOption=i})(T||(T="
              - "{}));var j=function(){function t(n){if(!(this instanceof
                t))return new t(n);this.error="
              - "n;var e=new Error().stack.split(`"
              - "`).slice(2);e&&e.length>0&&e[0].includes(\"ErrImpl\")&&e.shift\
                (),this._stack=e.join("
              - "`"
              - "`)}return
                t.prototype.isOk=function(){return!1},t.prototype.isErr=functio\
                n(){return!0},"
              - "t.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "t.prototype.else=function(n){return
                n},t.prototype.unwrapOr=function(n){return n},"
              - "t.prototype.expect=function(n){throw new Error(\"\".concat(n,\"
                - Error: \").concat("
              - "y(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.expect\
                Err=function(n){return this."
              - "error},t.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "y(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.unwrap\
                Err=function(){return this."
              - "error},t.prototype.map=function(n){return
                this},t.prototype.andThen=function(n){"
              - "return this},t.prototype.mapErr=function(n){return new
                f(n(this.error))},t.prototype."
              - "mapOr=function(n,e){return
                n},t.prototype.mapOrElse=function(n,e){return n(this."
              - "error)},t.prototype.or=function(n){return
                n},t.prototype.orElse=function(n){return n("
              - "this.error)},t.prototype.toOption=function(){return
                d},t.prototype.toString=function(){"
              - "return\"Err(\".concat(y(this.error),\")\")},Object.definePrope\
                rty(t.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),t.prot\
                otype.toAsyncResult="
              - "function(){return new v(this)},t.EMPTY=new t(void 0),t}();var
                f=j,M=function(){function t(n){if(!(this instanceof t))return
                new t(n);this."
              - "value=n}return
                t.prototype.isOk=function(){return!0},t.prototype.isErr=functio\
                n(){"
              - "return!1},t.prototype[Symbol.iterator]=function(){var
                n=Object(this.value);return Symbol."
              - "iterator in
                n?n[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "t.prototype.else=function(n){return
                this.value},t.prototype.unwrapOr=function(n){"
              - "return this.value},t.prototype.expect=function(n){return
                this.value},t.prototype."
              - "expectErr=function(n){throw new
                Error(n)},t.prototype.unwrap=function(){return this."
              - "value},t.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "y(this.value)),{cause:this.value})},t.prototype.map=function(n\
                ){return new h(n(this."
              - "value))},t.prototype.andThen=function(n){return
                n(this.value)},t.prototype.mapErr="
              - "function(n){return this},t.prototype.mapOr=function(n,e){return
                e(this.value)},t."
              - "prototype.mapOrElse=function(n,e){return
                e(this.value)},t.prototype.or=function(n){"
              - "return this},t.prototype.orElse=function(n){return
                this},t.prototype.toOption=function(){"
              - "return m(this.value)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype."
              - "toString=function(){return\"Ok(\".concat(y(this.value),\")\")}\
                ,t.prototype.toAsyncResult="
              - "function(){return new v(this)},t.EMPTY=new t(void 0),t}();var
                h=M,I;(function(t){function n(){for(var
                a=[],u=0;u<arguments.length;u++)a[u]="
              - "arguments[u];for(var l=[],s=0,c=a;s<c.length;s++){var
                p=c[s];if(p.isOk())l.push("
              - "p.value);else return p}return new h(l)}t.all=n;function
                e(){for(var a=[],u=0;u<arguments."
              - "length;u++)a[u]=arguments[u];for(var
                l=[],s=0,c=a;s<c.length;s++){var p=c[s];if(p."
              - "isOk())return p;l.push(p.error)}return new
                f(l)}t.any=e;function i(a){try{return new h("
              - "a())}catch(u){return new f(u)}}t.wrap=i;function
                o(a){try{return a().then(function(u){"
              - "return new h(u)}).catch(function(u){return new
                f(u)})}catch(u){return Promise.resolve("
              - "new f(u))}}t.wrapAsync=o;function r(a){return a instanceof f||a
                instanceof h}t.isResult="
              - "r})(I||(I={}));var w=function(t,n,e,i){function o(r){return r
                instanceof e?r:new e(function(a){"
              - "a(r)})}return new(e||(e=Promise))(function(r,a){function
                u(c){try{s(i.next(c))}catch(p){"
              - "a(p)}}function l(c){try{s(i.throw(c))}catch(p){a(p)}}function
                s(c){c.done?r(c.value):"
              - "o(c.value).then(u,l)}s((i=i.apply(t,n||[])).next())})},E=funct\
                ion(t,n){var e={label:0,"
              - "sent:function(){if(r[0]&1)throw r[1];return
                r[1]},trys:[],ops:[]},i,o,r,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(s){return
                function(c){return l([s,c])}}function l(s){"
              - "if(i)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,s[0]&&(e="
              - "0)),e;)try{if(i=1,o&&(r=s[0]&2?o.return:s[0]?o.throw||((r=o.re\
                turn)&&r.call(o),0):"
              - "o.next)&&!(r=r.call(o,s[1])).done)return
                r;switch(o=0,r&&(s=[s[0]&2,r.value]),s[0]){case 0:case 1:"
              - "r=s;break;case 4:return e.label++,{value:s[1],done:!1};case
                5:e.label++,o=s[1],s="
              - "[0];continue;case
                7:s=e.ops.pop(),e.trys.pop();continue;default:if(r=e.trys,!(r="
              - "r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){e=0;continue\
                }if(s[0]===3&&(!r||"
              - "s[1]>r[0]&&s[1]<r[3])){e.label=s[1];break}if(s[0]===6&&e.label\
                <r[1]){e.label=r[1],"
              - "r=s;break}if(r&&e.label<r[2]){e.label=r[2],e.ops.push(s);break\
                }r[2]&&e.ops.pop(),"
              - "e.trys.pop();continue}s=n.call(t,e)}catch(c){s=[6,c],o=0}final\
                ly{i=r=0}if(s[0]&5)"
              - "throw s[1];return{value:s[0]?s[1]:void
                0,done:!0}}},v=function(){function t(n){this."
              - "promise=Promise.resolve(n)}return
                t.prototype.andThen=function(n){var e=this;return this."
              - "thenInternal(function(i){return w(e,void 0,void
                0,function(){var o;return E(this,"
              - "function(r){return i.isErr()?[2,i]:(o=n(i.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(n){var e=this;return
                this.thenInternal(function(i){return w("
              - "e,void 0,void 0,function(){var o;return
                E(this,function(r){switch(r.label){case 0:"
              - "return i.isErr()?[2,i]:(o=h,[4,n(i.value)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.mapErr=function(n){var e=this;return
                this.thenInternal(function(i){return w("
              - "e,void 0,void 0,function(){var o;return
                E(this,function(r){switch(r.label){case 0:"
              - "return i.isOk()?[2,i]:(o=f,[4,n(i.error)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.or=function(n){return this.orElse(function(){return
                n})},t.prototype."
              - "orElse=function(n){var e=this;return
                this.thenInternal(function(i){return w(e,void 0,"
              - "void 0,function(){var o;return E(this,function(r){return
                i.isOk()?[2,i]:(o=n(i.error),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toOption=function(){return
                new g("
              - "this.promise.then(function(n){return
                n.toOption()}))},t.prototype.thenInternal=function(n){"
              - "return new t(this.promise.then(n))},t}();var
                b=function(t,n,e,i){function o(r){return r instanceof e?r:new
                e(function(a){"
              - "a(r)})}return new(e||(e=Promise))(function(r,a){function
                u(c){try{s(i.next(c))}catch(p){"
              - "a(p)}}function l(c){try{s(i.throw(c))}catch(p){a(p)}}function
                s(c){c.done?r(c.value):"
              - "o(c.value).then(u,l)}s((i=i.apply(t,n||[])).next())})},O=funct\
                ion(t,n){var e={label:0,"
              - "sent:function(){if(r[0]&1)throw r[1];return
                r[1]},trys:[],ops:[]},i,o,r,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(s){return
                function(c){return l([s,c])}}function l(s){"
              - "if(i)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,s[0]&&(e="
              - "0)),e;)try{if(i=1,o&&(r=s[0]&2?o.return:s[0]?o.throw||((r=o.re\
                turn)&&r.call(o),0):"
              - "o.next)&&!(r=r.call(o,s[1])).done)return
                r;switch(o=0,r&&(s=[s[0]&2,r.value]),s[0]){case 0:case 1:"
              - "r=s;break;case 4:return e.label++,{value:s[1],done:!1};case
                5:e.label++,o=s[1],s="
              - "[0];continue;case
                7:s=e.ops.pop(),e.trys.pop();continue;default:if(r=e.trys,!(r="
              - "r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){e=0;continue\
                }if(s[0]===3&&(!r||"
              - "s[1]>r[0]&&s[1]<r[3])){e.label=s[1];break}if(s[0]===6&&e.label\
                <r[1]){e.label=r[1],"
              - "r=s;break}if(r&&e.label<r[2]){e.label=r[2],e.ops.push(s);break\
                }r[2]&&e.ops.pop(),"
              - "e.trys.pop();continue}s=n.call(t,e)}catch(c){s=[6,c],o=0}final\
                ly{i=r=0}if(s[0]&5)"
              - "throw s[1];return{value:s[0]?s[1]:void
                0,done:!0}}},g=function(){function t(n){this."
              - "promise=Promise.resolve(n)}return
                t.prototype.andThen=function(n){var e=this;return this."
              - "thenInternal(function(i){return b(e,void 0,void
                0,function(){var o;return O(this,"
              - "function(r){return i.isNone()?[2,i]:(o=n(i.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(n){var e=this;return
                this.thenInternal(function(i){return b("
              - "e,void 0,void 0,function(){var o;return
                O(this,function(r){switch(r.label){case 0:"
              - "return i.isNone()?[2,i]:(o=m,[4,n(i.value)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.or=function(n){return this.orElse(function(){return
                n})},t.prototype."
              - "orElse=function(n){var e=this;return
                this.thenInternal(function(i){return b(e,void 0,"
              - "void 0,function(){var o;return O(this,function(r){return
                i.isSome()?[2,i]:(o=n(),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toResult=function(n){return
                new v("
              - "this.promise.then(function(e){return
                e.toResult(n)}))},t.prototype.thenInternal="
              - "function(n){return new t(this.promise.then(n))},t}();var
                _=(t,n)=>{let e=\"util.getEnvOrDefault\";try{let i;return
                process.env.hasOwnProperty("
              - "t)&&process.env[t]?i=process.env[t]:i=n,i}catch(i){let
                r=`${e}::unexpected excep\\"
              - "tion:${i.message}`;throw new Error(r)}};var
                G={region:_(\"CONNECT_AWS_REGION\",\"us-east-1\")},Y=new
                x.ConnectClient(G),H=t=>{"
              - "console.debug(\"context.assesExternalTarget::parameters\",t);l\
                et e=t.ExternalTarget;"
              - "return{Exists:!!e&&e.length>0,Value:e}},J=async(t,n)=>{let
                e=\"context.assesInter\\"
              - "nalTarget\",i=t.InternalTarget||\"\",o={Exists:!!i&&i.length>0\
                ,Value:i};if(!o.Exists)"
              - "console.debug(`${e}::parameters.InternalTarget is missing or
                empty`);else{let r={"
              - "InstanceId:n,Filters:{Agents:[i]}};console.debug(`${e}::userSt\
                atusInput`,r);let a=await Y."
              - "send(new
                x.GetCurrentUserDataCommand(r));console.debug(`${e}::userStatus\
                Response`,"
              - "a);let{UserDataList:u}=a;u&&u.length>0&&(o.UserData=u[0])}retu\
                rn o},z=t=>{let n=\"\\"
              - "context.assesInternalTargetChannels\",e={ChatExists:!1,VoiceEx\
                ists:!1};if(!t.Exists||"
              - "!t.UserData)return console.debug(`${n}::Exists is false or
                UserData is undefined`),"
              - "e;let{MaxSlotsByChannel:i}=t.UserData;if(!i)return
                console.debug(`${n}::UserData\\"
              - " does not have
                MaxSlotsByChannel`),e;let{CHAT:o,VOICE:r}=i;return
                e.ChatExists=(o||"
              - "0)>0,e.VoiceExists=(r||0)>0,e},S=async(t,n)=>{let
                e=\"context.getContext\";console."
              - "debug(`${e}::parameters`,t),console.debug(`${e}::dimensions`,n\
                );let i=await J(t,"
              - "n.Instance),o=H(t),r=!0,a=!0,u=!0,l=z(i),s={SourceChannel:n.Ch\
                annel,Targets:{Internal:i,"
              - "External:o},Channels:{Chat:{Exists:l.ChatExists,Enabled:r,Valu\
                e:i.Value||\"\"},Voice:{"
              - "Exists:l.VoiceExists,Enabled:a,Value:i.Value||\"\"},External:{\
                Exists:o.Exists,Enabled:u,"
              - "Value:o.Value||\"\"}}};return
                console.debug(`${e}::output`,s),s};var R=async(t,n)=>{let
                e=\"decision.makeDecision\";console.debug(`${e}::parameters`,"
              - "t),console.debug(`${e}::dimensions`,n);let i=await
                S(t,n),o=\"\";switch(i.SourceChannel){case\"\\"
              - "CHAT\":o=\"Chat\";break;case\"VOICE\":o=\"Voice\";break;defaul\
                t:throw new Error(`Unsupp\\"
              - "orted channel: ${t.Channel}`)}let
                r=o==\"Voice\"?\"External\":void 0,a=k(i,o,r),u=\"\";"
              - "return
                a&&(u=i.Channels[a].Value),{Channel:a||\"UNROUTEABLE\",Target:u\
                }},k=(t,n,e)=>{"
              - "if(n)return
                t.Channels[n].Exists&&t.Channels[n].Enabled?n:k(t,e,void 0)};var
                W=async(t,n,e)=>{let
                i=\"index.handler\";(!process.env.NODE_ENV||process.env.NODE_EN\
                V!=="
              - "\"test\")&&console.debug(`${i}::Received
                event`,JSON.stringify(t),t);let o,r;try{r="
              - "await A(t)}catch(a){o=a;let
                u=`${i}::oops:${o.message}`;console.error(u,o)}finally{"
              - "console.debug(`${i}::callbackError`,o),console.debug(`${i}::ca\
                llbackResult`,r),e("
              - "o,r)}},N=(t,n)=>{let
                e=\"index.getEventDimensions\";console.debug(`${e}::details`,"
              - "t),console.debug(`${e}::parameters`,n);let{AwsRegion:i,Channel\
                :o,ContactId:r,InstanceARN:a}=t,"
              - "{DestinationName:u,DestinationId:l}=n,[s,c]=a.split(\"/\"),p={\
                Channel:o,ContactId:r,"
              - "DestinationName:u,DestinationId:l,Instance:c,Region:i||\"\"};r\
                eturn console.debug("
              - "`${e}::output`,p),p},A=async
                t=>{if(!t.Name||t.Name!==\"ContactFlowEvent\"){let r=`\\"
              - "Unsupported event type: ${t.Name}`;throw new Error(r)}let
                n=t.Details.ContactData,"
              - "e=t.Details.Parameters,i=N(n,e);return await R(e,i)};"
      Description: "v0.0.2 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          CONNECT_AWS_REGION:
            Ref: "AWS::Region"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ConnectRoutingLambdaServiceRole209397CE"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn:
      - "ConnectRoutingLambdaServiceRoleDefaultPolicyF326684D"
  ConnectRoutingLambdaRoutingLambdaResourcePolicy6D0B32CA:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ConnectRoutingLambdaD0DD651C"
          - "Arn"
      Principal: "connect.amazonaws.com"
      SourceAccount:
        Ref: "AWS::AccountId"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:aws:connect:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":instance/"
            - Ref: "ConnectInstance"
  ConnectAmazonConnectUserDataC1C3B772:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "connect:GetCurrentUserData"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:connect:"
                  - Ref: "AWS::Region"
                  - ":"
                  - Ref: "AWS::AccountId"
                  - ":instance/"
                  - Ref: "ConnectInstance"
        Version: "2012-10-17"
      PolicyName: "ConnectAmazonConnectUserDataC1C3B772"
      Roles:
        - Ref: "ConnectRoutingLambdaServiceRole209397CE"
  ConnectRoutingLambdaIntegration22102B80:
    Type: "AWS::Connect::IntegrationAssociation"
    Properties:
      InstanceId:
        Fn::Join:
          - ""
          - - "arn:aws:connect:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":instance/"
            - Ref: "ConnectInstance"
      IntegrationArn:
        Fn::GetAtt:
          - "ConnectRoutingLambdaD0DD651C"
          - "Arn"
      IntegrationType: "LAMBDA_FUNCTION"
  DirMgmtDdbStreamLambdaServiceRoleB6B2D55F:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  DirMgmtDdbStreamLambdaServiceRoleDefaultPolicy4E0B7BF0:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:BatchWriteItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DeleteItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:PutItem"
              - "dynamodb:Query"
              - "dynamodb:Scan"
              - "dynamodb:UpdateItem"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbDestinations37B2F70F"
                  - "Arn"
              - Fn::GetAtt:
                  - "DdbDirectories26458382"
                  - "Arn"
              - Fn::GetAtt:
                  - "DdbMemberships1A816D0C"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DdbMemberships1A816D0C"
                        - "Arn"
                    - "/index/*"
          - Action:
              - "dynamodb:DescribeStream"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:ListStreams"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbDestinations37B2F70F"
                  - "StreamArn"
              - Fn::GetAtt:
                  - "DdbDirectories26458382"
                  - "StreamArn"
              - Fn::GetAtt:
                  - "DdbMemberships1A816D0C"
                  - "StreamArn"
          - Action: "lambda:InvokeFunction"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DirMgmtCfnPublishLambdaF639239A"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DirMgmtCfnPublishLambdaF639239A"
                        - "Arn"
                    - ":*"
        Version: "2012-10-17"
      PolicyName: "DirMgmtDdbStreamLambdaServiceRoleDefaultPolicy4E0B7BF0"
      Roles:
        - Ref: "DirMgmtDdbStreamLambdaServiceRoleB6B2D55F"
  DirMgmtDdbStreamLambdaEC07F0B7:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var M=Object.defineProperty;var
                re=Object.getOwnPropertyDescriptor;var
                te=Object.getOwnPropertyNames;var
                ne=Object.prototype.hasOwnProperty;var oe=(e,r)=>{for(var t in
                r)M(e,t,{get:r[t],enumerable:!0})},se=(e,r,t,n)=>{if(r&&"
              - "typeof r==\"object\"||typeof r==\"function\")for(let o of
                te(r))!ne.call(e,o)&&o!==t&&"
              - "M(e,o,{get:()=>r[o],enumerable:!(n=re(r,o))||n.enumerable});re\
                turn e};var ie=e=>se(M({},\"__esModule\",{value:!0}),e);var
                Re={};oe(Re,{_dispatchRecord:()=>H,_processDirectoryRecord:()=>\
                X,_processMembershipRecord:()=>Z,"
              - "_requestStackChange:()=>L,_validateRecord:()=>ee,handler:()=>I\
                e});module.exports="
              - "ie(Re);var
                $=require(\"@aws-sdk/client-sfn\"),x=require(\"@aws-sdk/client-\
                lambda\"),"
              - "z=require(\"@aws-sdk/util-arn-parser\"),S=require(\"@aws-sdk/u\
                til-dynamodb\");function g(e){var r=String(e);if(r===\"[object
                Object]\")try{r=JSON.stringify(e)}catch{}"
              - "return r}var ae=function(){function e(){}return
                e.prototype.isSome=function(){return!1},e."
              - "prototype.isNone=function(){return!0},e.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(r){"
              - "return r},e.prototype.expect=function(r){throw new
                Error(\"\".concat(r))},e.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},e.prototype.map=function(r){"
              - "return this},e.prototype.mapOr=function(r,t){return
                r},e.prototype.mapOrElse=function(r,t){"
              - "return r()},e.prototype.or=function(r){return
                r},e.prototype.orElse=function(r){"
              - "return r()},e.prototype.andThen=function(r){return
                this},e.prototype.toResult=function(r){"
              - "return
                m(r)},e.prototype.toString=function(){return\"None\"},e.prototy\
                pe.toAsyncOption="
              - "function(){return new D(E)},e}(),E=new ae;Object.freeze(E);var
                ue=function(){function e(r){"
              - "if(!(this instanceof e))return new e(r);this.value=r}return
                e.prototype.isSome=function(){"
              - "return!0},e.prototype.isNone=function(){return!1},e.prototype[\
                Symbol.iterator]=function(){"
              - "var r=Object(this.value);return Symbol.iterator in
                r?r[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(r){return this.value},"
              - "e.prototype.expect=function(r){return
                this.value},e.prototype.unwrap=function(){"
              - "return this.value},e.prototype.map=function(r){return
                h(r(this.value))},e.prototype."
              - "mapOr=function(r,t){return
                t(this.value)},e.prototype.mapOrElse=function(r,t){return t("
              - "this.value)},e.prototype.or=function(r){return
                this},e.prototype.orElse=function(r){"
              - "return this},e.prototype.andThen=function(r){return
                r(this.value)},e.prototype.toResult="
              - "function(r){return
                y(this.value)},e.prototype.toAsyncOption=function(){return new
                D("
              - "this)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype.toString="
              - "function(){return\"Some(\".concat(g(this.value),\")\")},e.EMPT\
                Y=new e(void 0),e}(),h=ue,"
              - "U;(function(e){function r(){for(var
                o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];"
              - "for(var a=[],u=0,c=o;u<c.length;u++){var
                i=c[u];if(i.isSome())a.push(i.value);else"
              - "return i}return h(a)}e.all=r;function t(){for(var
                o=[],s=0;s<arguments.length;s++)"
              - "o[s]=arguments[s];for(var a=0,u=o;a<u.length;a++){var
                c=u[a];if(c.isSome())return c}"
              - "return E}e.any=t;function n(o){return o instanceof
                h||o===E}e.isOption=n})(U||(U="
              - "{}));var ce=function(){function e(r){if(!(this instanceof
                e))return new e(r);this.error="
              - "r;var t=new Error().stack.split(`"
              - "`).slice(2);t&&t.length>0&&t[0].includes(\"ErrImpl\")&&t.shift\
                (),this._stack=t.join("
              - "`"
              - "`)}return
                e.prototype.isOk=function(){return!1},e.prototype.isErr=functio\
                n(){return!0},"
              - "e.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "e.prototype.else=function(r){return
                r},e.prototype.unwrapOr=function(r){return r},"
              - "e.prototype.expect=function(r){throw new Error(\"\".concat(r,\"
                - Error: \").concat("
              - "g(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.expect\
                Err=function(r){return this."
              - "error},e.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "g(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.unwrap\
                Err=function(){return this."
              - "error},e.prototype.map=function(r){return
                this},e.prototype.andThen=function(r){"
              - "return this},e.prototype.mapErr=function(r){return new
                m(r(this.error))},e.prototype."
              - "mapOr=function(r,t){return
                r},e.prototype.mapOrElse=function(r,t){return r(this."
              - "error)},e.prototype.or=function(r){return
                r},e.prototype.orElse=function(r){return r("
              - "this.error)},e.prototype.toOption=function(){return
                E},e.prototype.toString=function(){"
              - "return\"Err(\".concat(g(this.error),\")\")},Object.definePrope\
                rty(e.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),e.prot\
                otype.toAsyncResult="
              - "function(){return new v(this)},e.EMPTY=new e(void 0),e}();var
                m=ce,pe=function(){function e(r){if(!(this instanceof e))return
                new e(r);this."
              - "value=r}return
                e.prototype.isOk=function(){return!0},e.prototype.isErr=functio\
                n(){"
              - "return!1},e.prototype[Symbol.iterator]=function(){var
                r=Object(this.value);return Symbol."
              - "iterator in
                r?r[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "e.prototype.else=function(r){return
                this.value},e.prototype.unwrapOr=function(r){"
              - "return this.value},e.prototype.expect=function(r){return
                this.value},e.prototype."
              - "expectErr=function(r){throw new
                Error(r)},e.prototype.unwrap=function(){return this."
              - "value},e.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "g(this.value)),{cause:this.value})},e.prototype.map=function(r\
                ){return new y(r(this."
              - "value))},e.prototype.andThen=function(r){return
                r(this.value)},e.prototype.mapErr="
              - "function(r){return this},e.prototype.mapOr=function(r,t){return
                t(this.value)},e."
              - "prototype.mapOrElse=function(r,t){return
                t(this.value)},e.prototype.or=function(r){"
              - "return this},e.prototype.orElse=function(r){return
                this},e.prototype.toOption=function(){"
              - "return h(this.value)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype."
              - "toString=function(){return\"Ok(\".concat(g(this.value),\")\")}\
                ,e.prototype.toAsyncResult="
              - "function(){return new v(this)},e.EMPTY=new e(void 0),e}();var
                y=pe,j;(function(e){function r(){for(var
                a=[],u=0;u<arguments.length;u++)a[u]="
              - "arguments[u];for(var c=[],i=0,p=a;i<p.length;i++){var
                d=p[i];if(d.isOk())c.push("
              - "d.value);else return d}return new y(c)}e.all=r;function
                t(){for(var a=[],u=0;u<arguments."
              - "length;u++)a[u]=arguments[u];for(var
                c=[],i=0,p=a;i<p.length;i++){var d=p[i];if(d."
              - "isOk())return d;c.push(d.error)}return new
                m(c)}e.any=t;function n(a){try{return new y("
              - "a())}catch(u){return new m(u)}}e.wrap=n;function
                o(a){try{return a().then(function(u){"
              - "return new y(u)}).catch(function(u){return new
                m(u)})}catch(u){return Promise.resolve("
              - "new m(u))}}e.wrapAsync=o;function s(a){return a instanceof m||a
                instanceof y}e.isResult="
              - "s})(j||(j={}));var O=function(e,r,t,n){function o(s){return s
                instanceof t?s:new t(function(a){"
              - "a(s)})}return new(t||(t=Promise))(function(s,a){function
                u(p){try{i(n.next(p))}catch(d){"
              - "a(d)}}function c(p){try{i(n.throw(p))}catch(d){a(d)}}function
                i(p){p.done?s(p.value):"
              - "o(p.value).then(u,c)}i((n=n.apply(e,r||[])).next())})},k=funct\
                ion(e,r){var t={label:0,"
              - "sent:function(){if(s[0]&1)throw s[1];return
                s[1]},trys:[],ops:[]},n,o,s,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(p){return c([i,p])}}function c(i){"
              - "if(n)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(t="
              - "0)),t;)try{if(n=1,o&&(s=i[0]&2?o.return:i[0]?o.throw||((s=o.re\
                turn)&&s.call(o),0):"
              - "o.next)&&!(s=s.call(o,i[1])).done)return
                s;switch(o=0,s&&(i=[i[0]&2,s.value]),i[0]){case 0:case 1:"
              - "s=i;break;case 4:return t.label++,{value:i[1],done:!1};case
                5:t.label++,o=i[1],i="
              - "[0];continue;case
                7:i=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s="
              - "s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){t=0;continue\
                }if(i[0]===3&&(!s||"
              - "i[1]>s[0]&&i[1]<s[3])){t.label=i[1];break}if(i[0]===6&&t.label\
                <s[1]){t.label=s[1],"
              - "s=i;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(i);break\
                }s[2]&&t.ops.pop(),"
              - "t.trys.pop();continue}i=r.call(e,t)}catch(p){i=[6,p],o=0}final\
                ly{n=s=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},v=function(){function e(r){this."
              - "promise=Promise.resolve(r)}return
                e.prototype.andThen=function(r){var t=this;return this."
              - "thenInternal(function(n){return O(t,void 0,void
                0,function(){var o;return k(this,"
              - "function(s){return n.isErr()?[2,n]:(o=r(n.value),[2,o
                instanceof e?o.promise:o])})})})},"
              - "e.prototype.map=function(r){var t=this;return
                this.thenInternal(function(n){return O("
              - "t,void 0,void 0,function(){var o;return
                k(this,function(s){switch(s.label){case 0:"
              - "return n.isErr()?[2,n]:(o=y,[4,r(n.value)]);case
                1:return[2,o.apply(void 0,[s.sent()])]}})})})},"
              - "e.prototype.mapErr=function(r){var t=this;return
                this.thenInternal(function(n){return O("
              - "t,void 0,void 0,function(){var o;return
                k(this,function(s){switch(s.label){case 0:"
              - "return n.isOk()?[2,n]:(o=m,[4,r(n.error)]);case
                1:return[2,o.apply(void 0,[s.sent()])]}})})})},"
              - "e.prototype.or=function(r){return this.orElse(function(){return
                r})},e.prototype."
              - "orElse=function(r){var t=this;return
                this.thenInternal(function(n){return O(t,void 0,"
              - "void 0,function(){var o;return k(this,function(s){return
                n.isOk()?[2,n]:(o=r(n.error),"
              - "[2,o instanceof
                e?o.promise:o])})})})},e.prototype.toOption=function(){return
                new D("
              - "this.promise.then(function(r){return
                r.toOption()}))},e.prototype.thenInternal=function(r){"
              - "return new e(this.promise.then(r))},e}();var
                T=function(e,r,t,n){function o(s){return s instanceof t?s:new
                t(function(a){"
              - "a(s)})}return new(t||(t=Promise))(function(s,a){function
                u(p){try{i(n.next(p))}catch(d){"
              - "a(d)}}function c(p){try{i(n.throw(p))}catch(d){a(d)}}function
                i(p){p.done?s(p.value):"
              - "o(p.value).then(u,c)}i((n=n.apply(e,r||[])).next())})},_=funct\
                ion(e,r){var t={label:0,"
              - "sent:function(){if(s[0]&1)throw s[1];return
                s[1]},trys:[],ops:[]},n,o,s,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(p){return c([i,p])}}function c(i){"
              - "if(n)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(t="
              - "0)),t;)try{if(n=1,o&&(s=i[0]&2?o.return:i[0]?o.throw||((s=o.re\
                turn)&&s.call(o),0):"
              - "o.next)&&!(s=s.call(o,i[1])).done)return
                s;switch(o=0,s&&(i=[i[0]&2,s.value]),i[0]){case 0:case 1:"
              - "s=i;break;case 4:return t.label++,{value:i[1],done:!1};case
                5:t.label++,o=i[1],i="
              - "[0];continue;case
                7:i=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s="
              - "s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){t=0;continue\
                }if(i[0]===3&&(!s||"
              - "i[1]>s[0]&&i[1]<s[3])){t.label=i[1];break}if(i[0]===6&&t.label\
                <s[1]){t.label=s[1],"
              - "s=i;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(i);break\
                }s[2]&&t.ops.pop(),"
              - "t.trys.pop();continue}i=r.call(e,t)}catch(p){i=[6,p],o=0}final\
                ly{n=s=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},D=function(){function e(r){this."
              - "promise=Promise.resolve(r)}return
                e.prototype.andThen=function(r){var t=this;return this."
              - "thenInternal(function(n){return T(t,void 0,void
                0,function(){var o;return _(this,"
              - "function(s){return n.isNone()?[2,n]:(o=r(n.value),[2,o
                instanceof e?o.promise:o])})})})},"
              - "e.prototype.map=function(r){var t=this;return
                this.thenInternal(function(n){return T("
              - "t,void 0,void 0,function(){var o;return
                _(this,function(s){switch(s.label){case 0:"
              - "return n.isNone()?[2,n]:(o=h,[4,r(n.value)]);case
                1:return[2,o.apply(void 0,[s.sent()])]}})})})},"
              - "e.prototype.or=function(r){return this.orElse(function(){return
                r})},e.prototype."
              - "orElse=function(r){var t=this;return
                this.thenInternal(function(n){return T(t,void 0,"
              - "void 0,function(){var o;return _(this,function(s){return
                n.isSome()?[2,n]:(o=r(),"
              - "[2,o instanceof
                e?o.promise:o])})})})},e.prototype.toResult=function(r){return
                new v("
              - "this.promise.then(function(t){return
                t.toResult(r)}))},e.prototype.thenInternal="
              - "function(r){return new e(this.promise.then(r))},e}();var
                J=require(\"@aws-sdk/lib-dynamodb\");var
                l=e=>btoa(JSON.stringify(e)),f=(...e)=>{};var
                Y=require(\"@aws-sdk/client-lambda\"),ye=require(\"@aws-sdk/lib\
                -dynamodb\");var q=require(\"@aws-sdk/lib-dynamodb\");var
                W=require(\"@aws-sdk/client-dynamodb\"),G=require(\"@aws-sdk/li\
                b-dynamodb\");var
                F={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.en\
                v.DDB_AWS_REGION&&"
              - "(F.region=process.env.DDB_AWS_REGION);var
                I=G.DynamoDBDocumentClient.from(new W.DynamoDBClient("
              - "F),{marshallOptions:{removeUndefinedValues:!0}});var
                R=(e,r)=>{let
                t=\"api.aws-dynamodb.util.vdxMarshallWithTable\";f(`${t}::input\
                `,"
              - "{dataType:e,props:r},l({dataType:e,props:r}));let
                n={},{pkValue:o,skValue:s}=r,a=C();"
              - "if(a.isErr())return f(`${t}::error`,a.error.message),a;let
                u=a.value;if(e===\"des\\"
              - "tinations\"&&o){let
                c=\"\";n.pkName=\"DestinationId\",n.pkValue=`${c}${o}`,n.tableN\
                ame="
              - "u.Destinations}else if(e===\"directories\"&&o){let
                c=\"\";n.pkName=\"DirectoryId\",n.pkValue="
              - "`${c}${o}`,n.tableName=u.Directories}else
                if(e===\"memberships\"&&(o||s)){let c=\"\","
              - "i=\"\";o&&(n.pkName=\"DestinationId\",n.pkValue=`${c}${o}`),s&\
                &(n.skIndex=\"Directory\\"
              - "IdIndex\",n.skName=\"DirectoryId\",n.skValue=`${i}${s}`),n.tab\
                leName=u.Memberships}else{"
              - "let c={message:\"internalServerError\",detail:`Invalid
                dataType: ${e} or both key \\"
              - "values missing: ${o}, ${s}`,errorSource:\"SERVER\"};return
                console.error(`${t}::er\\"
              - "ror`,c),m(c)}return f(`${t}::output`,n,l(n)),y(n)};var
                C=()=>{function
                e(t){if(process.env[t]&&(process.env[t]||\"\").length>0)return
                y("
              - "process.env[t]);{let
                n={message:\"internalServerError\",detail:`${t} not
                set`,errorSource:\"\\"
              - "SERVER\"};return console.error(n),m(n)}}let
                r={Destinations:\"\",Directories:\"\",Memberships:\"\"};"
              - "if(process.env.NODE_ENV===\"test\")console.debug(\"NODE_ENV=te\
                st, setting TABLES to\\"
              - " test
                values\"),r.Destinations=\"aws-connect-directory_destinations\"\
                ,r.Directories="
              - "\"aws-connect-directory_directories\",r.Memberships=\"aws-conn\
                ect-directory_members\\"
              - "hips\";else{let
                t=e(\"DDB_TABLE_DESTINATION\");if(t.isErr())return
                t;r.Destinations="
              - "t.value;let n=e(\"DDB_TABLE_DIRECTORY\");if(n.isErr())return
                n;r.Directories=n.value;"
              - "let o=e(\"DDB_TABLE_MEMBERSHIP\");if(o.isErr())return
                o;r.Memberships=o.value}return y("
              - "r)};var V=async(e,r,t={})=>{let
                n=\"api.aws-dynamodb.getDestDirRecordById\";console.debug("
              - "`${n}::input`,{dataType:e,id:r,props:t});let
                o=t.errWhenNone||!1;try{let s=R(e,{"
              - "pkValue:r});if(s.isErr())return
                s;let{pkName:a,pkValue:u,skName:c,skValue:i,tableName:p}=s."
              - "value,d={TableName:p};if(a&&u)d.Key={[a]:u};else return
                m({message:\"internalServ\\"
              - "erError\",errorSource:\"SERVER\"});c&&i&&(d.Key[c]=i),f(`${n}:\
                :GetCommandInput`,d);"
              - "let b=await I.send(new
                q.GetCommand(d));f(`${n}::GetCommandOutput`,b);let{Item:A}=b;"
              - "if(!A&&o){let B=\"Item not found\";throw f(`${n}:`,B,l(b)),new
                Error(`${n}: ${B}`)}"
              - "return console.debug(`${n}::outputting`,A),y(A)}catch(s){let
                a=typeof s==\"string\"?"
              - "new
                Error(s):s,u={message:\"internalServerError\",detail:a.message,\
                errorSource:\"SE\\"
              - "RVER\",originalError:a};return
                console.error(`${n}::error`,u,l(u)),m(u)}};var
                w=require(\"@aws-sdk/lib-dynamodb\");var Q=e=>{let
                r=\"api.aws-dynamodb.directories.calculateDirectoryStatus\",t=\
                \"UNKNO\\"
              - "WN\";try{let n=e.Metadata;if(n){let o=n.LastBuildAttempt?new
                Date(n.LastBuildAttempt)."
              - "getTime():0,s=n.LastBuildFailure?new
                Date(n.LastBuildFailure).getTime():0,a=n.LastBuildSuccess?"
              - "new
                Date(n.LastBuildSuccess).getTime():0,u=n.LastBuildableEvent?new
                Date(n.LastBuildableEvent)."
              - "getTime():0,c=n.IsBroken??!1,i=n.IsBuilt??!1,p=n.IsLicenseErro\
                r??!1,d=n.IsRollingBack??"
              - "!1,b=a>s?a:s;p?t=\"LICENSE_ERROR\":d?i?t=\"STOPPING_UPDATE\":t=\
                \"STOPPING_BUILD\":c?t="
              - "\"NEEDS_REPAIR\":u>o?t=\"ASSESSING\":o>b?i?t=\"UPDATING\":t=\"\
                BUILDING\":a>s?t=\"IN_SYNC\":"
              - "o==0?t=\"UNKNOWN\":i?t=\"OUT_OF_SYNC\":t=\"NOT_BUILT\"}}catch(\
                n){let o=n,s=`${r}::unex\\"
              - "pected
                exception:${o.message}`;console.error(s,o,l(o))}finally{return
                t}},N=async(e,r={})=>he("
              - "await V(\"directories\",e,r));var ge=e=>{let r=e;return
                r&&(r.Metadata||(r.Metadata={}),r.Metadata.DirectoryStatus="
              - "Q(r)),r},he=e=>e.isErr()?e:y(ge(e.value));var
                P=async(e,r,t)=>{try{console.debug(`${e}:_awsCommandWithLogging\
                ::Input`,t.input,"
              - "l(t.input));let n=await r.send(t);return
                console.debug(`${e}:_awsCommandWithLogg\\"
              - "ing::Output`,n,l(n)),Promise.resolve()}catch(n){let o=n;return
                console.error(`${e}\\"
              - ":_awsCommandWithLogging::Error`,n,l(n),l(o)),Promise.resolve()\
                }};var De=new $.SFNClient({}),ve=new x.LambdaClient({}),Ie=async
                e=>{let r=\"handler\";"
              - "f(`${r}::Received
                event`,e,l(e));try{console.log(`${r}::Received
                ${e.Records.length}\\"
              - " records`,e,l(e));let t=e.Records.flatMap(n=>{let
                o=ee(n);return o.isErr()?(console."
              - "error(`${r}::Error validating record:
                ${o.error.message}`,o.error,l(o.error)),[Promise."
              - "resolve()]):[H(o.value).catch(s=>s)]});f(`${r}::Tasks`,t,l(t))\
                ,await Promise.allSettled("
              - "t).catch(n=>n),f(`${r}::Finished processing
                event(?)`)}catch(t){console.error(`${r}\\"
              - "::Error processing event`,t,l(e))}},H=async e=>{let
                r=\"_dispatchRecord\",{model:t,"
              - "action:n,data:o}=e;switch(t){case\"Membership\":return
                Z(n,o);case\"Directory\":return X("
              - "n,o);case\"Destination\":return f(`${r}::We don't process
                destinations anymore.`,o),"
              - "[Promise.resolve()];default:return
                console.error(`${r}::Unsupported record model\\"
              - " '${t}'`,l(e)),[Promise.resolve()]}},X=async(e,r)=>{let
                t=\"_processDirectoryReco\\"
              - "rd\";f(`${t}::Processing Directory record`,r,l(r));let
                n=!1;if(e===\"INSERT\"||e==="
              - "\"REMOVE\")n=!0;else if(e!==\"MODIFY\")return
                console.error(`${t}::Unsupported actio\\"
              - "n
                '${e}'`,l(r)),[Promise.resolve()];let{DirectoryId:o}=r.Keys;ret\
                urn n?(console."
              - "log(`${t}::Requesting stack change
                ...`,r,l(r)),(o||\"\").length===0?(console.error("
              - "`${t}::Missing DirectoryId`,l(r)),[Promise.resolve()]):await
                L(o)):(console.log("
              - "`${t}::No stack change
                needed`),[Promise.resolve()])},Z=async(e,r)=>{let t=\"_pro\\"
              - "cessMembershipRecord\";f(`${t}::Processing Membership
                record`,r,l(r));let n=!1;if(e==="
              - "\"INSERT\"||e===\"REMOVE\")n=!0;else if(e!==\"MODIFY\")return
                console.error(`${t}::Uns\\"
              - "upported action
                '${e}'`,l(r)),[Promise.resolve()];if(e===\"MODIFY\"){let{NewIma\
                ge:o,"
              - "OldImage:s}=r,a=JSON.stringify((s.Synonyms||[]).sort()),u=JSON\
                .stringify((o.Synonyms||"
              - "[]).sort());f(`${t}::Old Synonyms`,a),f(`${t}::New
                Synonyms`,u),a!==u&&(n=!0)}if(n){"
              - "console.log(`${t}::Requesting stack change
                ...`,r,l(r));let{DirectoryId:o}=r.Keys;"
              - "return!o||(o||\"\").length===0?(console.error(`${t}::Missing
                DirectoryId`,l(r)),[Promise."
              - "resolve()]):await L(o)}else return console.log(`${t}::No stack
                change needed`),["
              - "Promise.resolve()]},L=async(e,r)=>{let
                t=\"_requestStackChange\";f(`${t}::input`,{"
              - "directoryId:e,stateMachineArn:r});try{if(!r){let n=await
                N(e);f(`${t}::Directory`,"
              - "n),r=n.StateMachineArn}if(r){console.log(`${t}::Need to update
                Cloudformation st\\"
              - "ack for ${e}`);let n={stateMachineArn:r};return[await
                P(t,De,new $.StartExecutionCommand("
              - "n))]}else{console.log(`${t}::Need to create Cloudformation
                stack for ${e}`);let{"
              - "UPDATE_DIRECTORY_CLOUDFORMATION_LAMBDA_ARN:n}=process.env;if(!\
                n)return console.error("
              - "`${t}::Missing
                UPDATE_DIRECTORY_CLOUDFORMATION_LAMBDA_ARN`),[Promise.resolve()\
                ];"
              - "let
                o={FunctionName:process.env.UPDATE_DIRECTORY_CLOUDFORMATION_LAM\
                BDA_ARN,InvocationType:\"\\"
              - "Event\",Payload:JSON.stringify({DirectoryId:e})};return[await
                P(t,ve,new x.InvokeCommand("
              - "o))]}}catch(n){let o=n;return console.error(`DirectoryId:
                ${e}`,`${t}:Error`,`er\\"
              - "ror: ${l(n)}`,`e: ${l(o)}`),[Promise.resolve()]}},ee=e=>{let
                r=\"_validateRecord\";"
              - "try{let{eventSourceARN:t,dynamodb:n}=e;if(!t||(t||\"\").length\
                ==0)return m({message:\"\\"
              - "Event is missing ARN\",location:r,record:e});let
                o=(0,z.parse)(t);if(o.service!=="
              - "\"dynamodb\")return m({message:`Event is not for DynamoDB;
                service is ${o.service}`,"
              - "location:r,record:e});if(n){if(!n.Keys)return
                m({message:\"DynamoDB event missing\\"
              - " Keys section??\",location:r,record:e})}else return
                m({message:\"Event is supposed\\"
              - "ly for DynamoDB but is missing dynamodb
                section\",location:r,record:e});let[s,a]=o."
              - "resource.split(\"/\");if(s!==\"table\")return
                m({message:`Unsupported object type ${s}\\"
              - " for ${o.resource}`,location:r,record:e});let
                u,c=C().unwrap();switch(a){case c."
              - "Destinations:u=\"Destination\";break;case
                c.Directories:u=\"Directory\";break;case c."
              - "Memberships:u=\"Membership\";break;default:return
                m({message:`Unsupported resource\\"
              - " ${o.resource}`,location:r,record:e})}let
                i={Keys:(0,S.unmarshall)(n.Keys),OldImage:n."
              - "OldImage?(0,S.unmarshall)(n.OldImage):{},NewImage:n.NewImage?(\
                0,S.unmarshall)(n."
              - "NewImage):{}};return
                y({model:u,action:e.eventName,data:i})}catch(t){let n=t;return
                m("
              - "{message:n.message,location:r,record:e,error:n})}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          DDB_TABLE_MEMBERSHIP:
            Ref: "DdbMemberships1A816D0C"
          DDB_TABLE_DESTINATION:
            Ref: "DdbDestinations37B2F70F"
          DDB_TABLE_DIRECTORY:
            Ref: "DdbDirectories26458382"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
          UPDATE_DIRECTORY_CLOUDFORMATION_LAMBDA_ARN:
            Fn::GetAtt:
              - "DirMgmtCfnPublishLambdaF639239A"
              - "Arn"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "DirMgmtDdbStreamLambdaServiceRoleB6B2D55F"
          - "Arn"
      Runtime: "nodejs20.x"
      Timeout: 10
    DependsOn:
      - "DirMgmtDdbStreamLambdaServiceRoleDefaultPolicy4E0B7BF0"
  DirMgmtDdbStreamLambdaDynamoDBEventSourceVocaldexDdbDestinationsCCA434DF02F9D0B7:
    Type: "AWS::Lambda::EventSourceMapping"
    Properties:
      BatchSize: 1000
      EventSourceArn:
        Fn::GetAtt:
          - "DdbDestinations37B2F70F"
          - "StreamArn"
      FunctionName:
        Ref: "DirMgmtDdbStreamLambdaEC07F0B7"
      MaximumBatchingWindowInSeconds: 10
      StartingPosition: "LATEST"
  DirMgmtDdbStreamLambdaDynamoDBEventSourceVocaldexDdbDirectories1675D440597C9460:
    Type: "AWS::Lambda::EventSourceMapping"
    Properties:
      BatchSize: 1000
      EventSourceArn:
        Fn::GetAtt:
          - "DdbDirectories26458382"
          - "StreamArn"
      FunctionName:
        Ref: "DirMgmtDdbStreamLambdaEC07F0B7"
      MaximumBatchingWindowInSeconds: 10
      StartingPosition: "LATEST"
  DirMgmtDdbStreamLambdaDynamoDBEventSourceVocaldexDdbMemberships63ED1E46230E92E3:
    Type: "AWS::Lambda::EventSourceMapping"
    Properties:
      BatchSize: 1000
      EventSourceArn:
        Fn::GetAtt:
          - "DdbMemberships1A816D0C"
          - "StreamArn"
      FunctionName:
        Ref: "DirMgmtDdbStreamLambdaEC07F0B7"
      MaximumBatchingWindowInSeconds: 10
      StartingPosition: "LATEST"
  DirMgmtUpdateDirectoryStepFunctionsPolicy0795BBA8:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "states:StartExecution"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:states:"
                  - Ref: "AWS::Region"
                  - ":"
                  - Ref: "AWS::AccountId"
                  - ":stateMachine:Vocaldex--"
                  - Ref: "ConnectInstance"
                  - "--*"
        Version: "2012-10-17"
      PolicyName: "DirMgmtUpdateDirectoryStepFunctionsPolicy0795BBA8"
      Roles:
        - Ref: "DirMgmtDdbStreamLambdaServiceRoleB6B2D55F"
  DirMgmtS3Bucket0F4D3D00:
    Type: "AWS::S3::Bucket"
    Properties:
      BucketName:
        Fn::Join:
          - ""
          - - "asa.vdx.assets-"
            - Fn::Join:
                - ""
                - Fn::Split:
                    - "-"
                    - Ref: "ConnectInstance"
            - "-"
            - Fn::Select:
                - 4
                - Fn::Split:
                    - "-"
                    - Fn::Select:
                        - 2
                        - Fn::Split:
                            - "/"
                            - Ref: "AWS::StackId"
      Tags:
        - Key: "aws-cdk:auto-delete-objects"
          Value: "true"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  DirMgmtS3BucketPolicy7F272BB3:
    Type: "AWS::S3::BucketPolicy"
    Properties:
      Bucket:
        Ref: "DirMgmtS3Bucket0F4D3D00"
      PolicyDocument:
        Statement:
          - Action:
              - "s3:DeleteObject*"
              - "s3:GetBucket*"
              - "s3:List*"
              - "s3:PutBucketPolicy"
            Effect: "Allow"
            Principal:
              AWS:
                Fn::GetAtt:
                  - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092"
                  - "Arn"
            Resource:
              - Fn::GetAtt:
                  - "DirMgmtS3Bucket0F4D3D00"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DirMgmtS3Bucket0F4D3D00"
                        - "Arn"
                    - "/*"
        Version: "2012-10-17"
    Metadata:
      cfn-lint:
        config:
          ignore_checks:
            - "E9101"
            - "EIAMPolicyActionWildcard"
            - "EIAMPolicyWildcardResource"
          ignore_checks_reasons:
            E9101: "'abort' may be intepreted as a biased term; but it's the name of the
              operation."
            EIAMPolicyActionWildcard: "This is the IAM statement generated by CDK 'grantReadWrite'."
            EIAMPolicyWildcardResource: "This is the IAM statement generated by the CDK Construct."
  DirMgmtS3BucketAutoDeleteObjectsCustomResource1A6AC661:
    Type: "Custom::S3AutoDeleteObjects"
    Properties:
      ServiceToken:
        Fn::GetAtt:
          - "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F"
          - "Arn"
      BucketName:
        Ref: "DirMgmtS3Bucket0F4D3D00"
    DependsOn:
      - "DirMgmtS3BucketPolicy7F272BB3"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  DirMgmtCfnListenerLambdaServiceRole863457B1:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  DirMgmtCfnListenerLambdaServiceRoleDefaultPolicy94FBFB3A:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "s3:Abort*"
              - "s3:DeleteObject*"
              - "s3:GetBucket*"
              - "s3:GetObject*"
              - "s3:List*"
              - "s3:PutObject"
              - "s3:PutObjectLegalHold"
              - "s3:PutObjectRetention"
              - "s3:PutObjectTagging"
              - "s3:PutObjectVersionTagging"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DirMgmtS3Bucket0F4D3D00"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DirMgmtS3Bucket0F4D3D00"
                        - "Arn"
                    - "/*"
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:BatchWriteItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DeleteItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:PutItem"
              - "dynamodb:Query"
              - "dynamodb:Scan"
              - "dynamodb:UpdateItem"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "DdbDirectories26458382"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "DirMgmtCfnListenerLambdaServiceRoleDefaultPolicy94FBFB3A"
      Roles:
        - Ref: "DirMgmtCfnListenerLambdaServiceRole863457B1"
    Metadata:
      cfn-lint:
        config:
          ignore_checks:
            - "E9101"
            - "EIAMPolicyActionWildcard"
            - "EIAMPolicyWildcardResource"
          ignore_checks_reasons:
            E9101: "'abort' may be intepreted as a biased term; but it's the name of the
              operation."
            EIAMPolicyActionWildcard: "This is the IAM statement generated by CDK 'grantReadWrite'."
            EIAMPolicyWildcardResource: "This policy document matches what the IAM console
              created, even with the ARNs we specified."
  DirMgmtCfnListenerLambda8E584A49:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var be=Object.create;var
                L=Object.defineProperty;var
                De=Object.getOwnPropertyDescriptor;var
                ve=Object.getOwnPropertyNames;var
                Ie=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var
                ke=(e,r)=>{for(var t in
                r)L(e,t,{get:r[t],enumerable:!0})},ee=(e,r,t,n)=>{if(r&&"
              - "typeof r==\"object\"||typeof r==\"function\")for(let s of
                ve(r))!Re.call(e,s)&&s!==t&&"
              - "L(e,s,{get:()=>r[s],enumerable:!(n=De(r,s))||n.enumerable});re\
                turn e};var
                Ce=(e,r,t)=>(t=e!=null?be(Ie(e)):{},ee(r||!e||!e.__esModule?L(t,\
                \"default\",{value:e,"
              - "enumerable:!0}):t,e)),Oe=e=>ee(L({},\"__esModule\",{value:!0})\
                ,e);var
                Fe={};ke(Fe,{_handleCreateComplete:()=>le,_removeTemplate:()=>p\
                e,_setDirectoryInfo:()=>je,"
              - "handler:()=>Ue});module.exports=Oe(Fe);var
                j=Ce(require(\"@aws-sdk/client-cloudformation\"),1),"
              - "F=require(\"@aws-sdk/client-s3\");var
                ce=require(\"@aws-sdk/lib-dynamodb\");var
                p=e=>btoa(JSON.stringify(e)),y=(...e)=>{};function b(e){var
                r=String(e);if(r===\"[object
                Object]\")try{r=JSON.stringify(e)}catch{}"
              - "return r}var we=function(){function e(){}return
                e.prototype.isSome=function(){return!1},e."
              - "prototype.isNone=function(){return!0},e.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(r){"
              - "return r},e.prototype.expect=function(r){throw new
                Error(\"\".concat(r))},e.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},e.prototype.map=function(r){"
              - "return this},e.prototype.mapOr=function(r,t){return
                r},e.prototype.mapOrElse=function(r,t){"
              - "return r()},e.prototype.or=function(r){return
                r},e.prototype.orElse=function(r){"
              - "return r()},e.prototype.andThen=function(r){return
                this},e.prototype.toResult=function(r){"
              - "return
                f(r)},e.prototype.toString=function(){return\"None\"},e.prototy\
                pe.toAsyncOption="
              - "function(){return new A(C)},e}(),C=new we;Object.freeze(C);var
                Se=function(){function e(r){"
              - "if(!(this instanceof e))return new e(r);this.value=r}return
                e.prototype.isSome=function(){"
              - "return!0},e.prototype.isNone=function(){return!1},e.prototype[\
                Symbol.iterator]=function(){"
              - "var r=Object(this.value);return Symbol.iterator in
                r?r[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(r){return this.value},"
              - "e.prototype.expect=function(r){return
                this.value},e.prototype.unwrap=function(){"
              - "return this.value},e.prototype.map=function(r){return
                v(r(this.value))},e.prototype."
              - "mapOr=function(r,t){return
                t(this.value)},e.prototype.mapOrElse=function(r,t){return t("
              - "this.value)},e.prototype.or=function(r){return
                this},e.prototype.orElse=function(r){"
              - "return this},e.prototype.andThen=function(r){return
                r(this.value)},e.prototype.toResult="
              - "function(r){return
                d(this.value)},e.prototype.toAsyncOption=function(){return new
                A("
              - "this)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype.toString="
              - "function(){return\"Some(\".concat(b(this.value),\")\")},e.EMPT\
                Y=new e(void 0),e}(),v=Se,"
              - "re;(function(e){function r(){for(var
                s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];"
              - "for(var a=[],u=0,c=s;u<c.length;u++){var
                i=c[u];if(i.isSome())a.push(i.value);else"
              - "return i}return v(a)}e.all=r;function t(){for(var
                s=[],o=0;o<arguments.length;o++)"
              - "s[o]=arguments[o];for(var a=0,u=s;a<u.length;a++){var
                c=u[a];if(c.isSome())return c}"
              - "return C}e.any=t;function n(s){return s instanceof
                v||s===C}e.isOption=n})(re||(re="
              - "{}));var Ne=function(){function e(r){if(!(this instanceof
                e))return new e(r);this.error="
              - "r;var t=new Error().stack.split(`"
              - "`).slice(2);t&&t.length>0&&t[0].includes(\"ErrImpl\")&&t.shift\
                (),this._stack=t.join("
              - "`"
              - "`)}return
                e.prototype.isOk=function(){return!1},e.prototype.isErr=functio\
                n(){return!0},"
              - "e.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "e.prototype.else=function(r){return
                r},e.prototype.unwrapOr=function(r){return r},"
              - "e.prototype.expect=function(r){throw new Error(\"\".concat(r,\"
                - Error: \").concat("
              - "b(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.expect\
                Err=function(r){return this."
              - "error},e.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "b(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.unwrap\
                Err=function(){return this."
              - "error},e.prototype.map=function(r){return
                this},e.prototype.andThen=function(r){"
              - "return this},e.prototype.mapErr=function(r){return new
                f(r(this.error))},e.prototype."
              - "mapOr=function(r,t){return
                r},e.prototype.mapOrElse=function(r,t){return r(this."
              - "error)},e.prototype.or=function(r){return
                r},e.prototype.orElse=function(r){return r("
              - "this.error)},e.prototype.toOption=function(){return
                C},e.prototype.toString=function(){"
              - "return\"Err(\".concat(b(this.error),\")\")},Object.definePrope\
                rty(e.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),e.prot\
                otype.toAsyncResult="
              - "function(){return new $(this)},e.EMPTY=new e(void 0),e}();var
                f=Ne,Ae=function(){function e(r){if(!(this instanceof e))return
                new e(r);this."
              - "value=r}return
                e.prototype.isOk=function(){return!0},e.prototype.isErr=functio\
                n(){"
              - "return!1},e.prototype[Symbol.iterator]=function(){var
                r=Object(this.value);return Symbol."
              - "iterator in
                r?r[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "e.prototype.else=function(r){return
                this.value},e.prototype.unwrapOr=function(r){"
              - "return this.value},e.prototype.expect=function(r){return
                this.value},e.prototype."
              - "expectErr=function(r){throw new
                Error(r)},e.prototype.unwrap=function(){return this."
              - "value},e.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "b(this.value)),{cause:this.value})},e.prototype.map=function(r\
                ){return new d(r(this."
              - "value))},e.prototype.andThen=function(r){return
                r(this.value)},e.prototype.mapErr="
              - "function(r){return this},e.prototype.mapOr=function(r,t){return
                t(this.value)},e."
              - "prototype.mapOrElse=function(r,t){return
                t(this.value)},e.prototype.or=function(r){"
              - "return this},e.prototype.orElse=function(r){return
                this},e.prototype.toOption=function(){"
              - "return v(this.value)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype."
              - "toString=function(){return\"Ok(\".concat(b(this.value),\")\")}\
                ,e.prototype.toAsyncResult="
              - "function(){return new $(this)},e.EMPTY=new e(void 0),e}();var
                d=Ae,te;(function(e){function r(){for(var
                a=[],u=0;u<arguments.length;u++)a[u]="
              - "arguments[u];for(var c=[],i=0,l=a;i<l.length;i++){var
                m=l[i];if(m.isOk())c.push("
              - "m.value);else return m}return new d(c)}e.all=r;function
                t(){for(var a=[],u=0;u<arguments."
              - "length;u++)a[u]=arguments[u];for(var
                c=[],i=0,l=a;i<l.length;i++){var m=l[i];if(m."
              - "isOk())return m;c.push(m.error)}return new
                f(c)}e.any=t;function n(a){try{return new d("
              - "a())}catch(u){return new f(u)}}e.wrap=n;function
                s(a){try{return a().then(function(u){"
              - "return new d(u)}).catch(function(u){return new
                f(u)})}catch(u){return Promise.resolve("
              - "new f(u))}}e.wrapAsync=s;function o(a){return a instanceof f||a
                instanceof d}e.isResult="
              - "o})(te||(te={}));var P=function(e,r,t,n){function s(o){return o
                instanceof t?o:new t(function(a){"
              - "a(o)})}return new(t||(t=Promise))(function(o,a){function
                u(l){try{i(n.next(l))}catch(m){"
              - "a(m)}}function c(l){try{i(n.throw(l))}catch(m){a(m)}}function
                i(l){l.done?o(l.value):"
              - "s(l.value).then(u,c)}i((n=n.apply(e,r||[])).next())})},B=funct\
                ion(e,r){var t={label:0,"
              - "sent:function(){if(o[0]&1)throw o[1];return
                o[1]},trys:[],ops:[]},n,s,o,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(l){return c([i,l])}}function c(i){"
              - "if(n)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(t="
              - "0)),t;)try{if(n=1,s&&(o=i[0]&2?s.return:i[0]?s.throw||((o=s.re\
                turn)&&o.call(s),0):"
              - "s.next)&&!(o=o.call(s,i[1])).done)return
                o;switch(s=0,o&&(i=[i[0]&2,o.value]),i[0]){case 0:case 1:"
              - "o=i;break;case 4:return t.label++,{value:i[1],done:!1};case
                5:t.label++,s=i[1],i="
              - "[0];continue;case
                7:i=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o="
              - "o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){t=0;continue\
                }if(i[0]===3&&(!o||"
              - "i[1]>o[0]&&i[1]<o[3])){t.label=i[1];break}if(i[0]===6&&t.label\
                <o[1]){t.label=o[1],"
              - "o=i;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(i);break\
                }o[2]&&t.ops.pop(),"
              - "t.trys.pop();continue}i=r.call(e,t)}catch(l){i=[6,l],s=0}final\
                ly{n=o=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},$=function(){function e(r){this."
              - "promise=Promise.resolve(r)}return
                e.prototype.andThen=function(r){var t=this;return this."
              - "thenInternal(function(n){return P(t,void 0,void
                0,function(){var s;return B(this,"
              - "function(o){return n.isErr()?[2,n]:(s=r(n.value),[2,s
                instanceof e?s.promise:s])})})})},"
              - "e.prototype.map=function(r){var t=this;return
                this.thenInternal(function(n){return P("
              - "t,void 0,void 0,function(){var s;return
                B(this,function(o){switch(o.label){case 0:"
              - "return n.isErr()?[2,n]:(s=d,[4,r(n.value)]);case
                1:return[2,s.apply(void 0,[o.sent()])]}})})})},"
              - "e.prototype.mapErr=function(r){var t=this;return
                this.thenInternal(function(n){return P("
              - "t,void 0,void 0,function(){var s;return
                B(this,function(o){switch(o.label){case 0:"
              - "return n.isOk()?[2,n]:(s=f,[4,r(n.error)]);case
                1:return[2,s.apply(void 0,[o.sent()])]}})})})},"
              - "e.prototype.or=function(r){return this.orElse(function(){return
                r})},e.prototype."
              - "orElse=function(r){var t=this;return
                this.thenInternal(function(n){return P(t,void 0,"
              - "void 0,function(){var s;return B(this,function(o){return
                n.isOk()?[2,n]:(s=r(n.error),"
              - "[2,s instanceof
                e?s.promise:s])})})})},e.prototype.toOption=function(){return
                new A("
              - "this.promise.then(function(r){return
                r.toOption()}))},e.prototype.thenInternal=function(r){"
              - "return new e(this.promise.then(r))},e}();var
                K=function(e,r,t,n){function s(o){return o instanceof t?o:new
                t(function(a){"
              - "a(o)})}return new(t||(t=Promise))(function(o,a){function
                u(l){try{i(n.next(l))}catch(m){"
              - "a(m)}}function c(l){try{i(n.throw(l))}catch(m){a(m)}}function
                i(l){l.done?o(l.value):"
              - "s(l.value).then(u,c)}i((n=n.apply(e,r||[])).next())})},q=funct\
                ion(e,r){var t={label:0,"
              - "sent:function(){if(o[0]&1)throw o[1];return
                o[1]},trys:[],ops:[]},n,s,o,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(l){return c([i,l])}}function c(i){"
              - "if(n)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(t="
              - "0)),t;)try{if(n=1,s&&(o=i[0]&2?s.return:i[0]?s.throw||((o=s.re\
                turn)&&o.call(s),0):"
              - "s.next)&&!(o=o.call(s,i[1])).done)return
                o;switch(s=0,o&&(i=[i[0]&2,o.value]),i[0]){case 0:case 1:"
              - "o=i;break;case 4:return t.label++,{value:i[1],done:!1};case
                5:t.label++,s=i[1],i="
              - "[0];continue;case
                7:i=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o="
              - "o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){t=0;continue\
                }if(i[0]===3&&(!o||"
              - "i[1]>o[0]&&i[1]<o[3])){t.label=i[1];break}if(i[0]===6&&t.label\
                <o[1]){t.label=o[1],"
              - "o=i;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(i);break\
                }o[2]&&t.ops.pop(),"
              - "t.trys.pop();continue}i=r.call(e,t)}catch(l){i=[6,l],s=0}final\
                ly{n=o=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},A=function(){function e(r){this."
              - "promise=Promise.resolve(r)}return
                e.prototype.andThen=function(r){var t=this;return this."
              - "thenInternal(function(n){return K(t,void 0,void
                0,function(){var s;return q(this,"
              - "function(o){return n.isNone()?[2,n]:(s=r(n.value),[2,s
                instanceof e?s.promise:s])})})})},"
              - "e.prototype.map=function(r){var t=this;return
                this.thenInternal(function(n){return K("
              - "t,void 0,void 0,function(){var s;return
                q(this,function(o){switch(o.label){case 0:"
              - "return n.isNone()?[2,n]:(s=v,[4,r(n.value)]);case
                1:return[2,s.apply(void 0,[o.sent()])]}})})})},"
              - "e.prototype.or=function(r){return this.orElse(function(){return
                r})},e.prototype."
              - "orElse=function(r){var t=this;return
                this.thenInternal(function(n){return K(t,void 0,"
              - "void 0,function(){var s;return q(this,function(o){return
                n.isSome()?[2,n]:(s=r(),"
              - "[2,s instanceof
                e?s.promise:s])})})})},e.prototype.toResult=function(r){return
                new $("
              - "this.promise.then(function(t){return
                t.toResult(r)}))},e.prototype.thenInternal="
              - "function(r){return new e(this.promise.then(r))},e}();var
                ae=require(\"@aws-sdk/client-lambda\"),J=require(\"@aws-sdk/lib\
                -dynamodb\");var $e=require(\"@aws-sdk/lib-dynamodb\");var
                ne=require(\"@aws-sdk/client-dynamodb\"),oe=require(\"@aws-sdk/\
                lib-dynamodb\");var
                se={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.e\
                nv.DDB_AWS_REGION&&"
              - "(se.region=process.env.DDB_AWS_REGION);var
                I=oe.DynamoDBDocumentClient.from(new ne.DynamoDBClient("
              - "se),{marshallOptions:{removeUndefinedValues:!0}}),V=(e,r=\"SET
                \")=>{let t=\"api.aw\\"
              - "s-dynamodb.util.getUpdateExpression\",n=[],s={};for(let[a,u]of
                Object.entries(e))"
              - "if(y(`${t}`,a,u),a==\"Metadata\")for(let[c,i]of
                Object.entries(u))y(`${t}::${a}.`,"
              - "c,i),n.push(`${a}.${c} =
                :${a}${c}`),s[`:${a}${c}`]=i;else{let{expression:c,value:i}=u;"
              - "c&&i?(n.push(`${a} = :${c}`),s[`:${a}`]=i):(n.push(`${a} =
                :${a}`),s[`:${a}`]=u)}"
              - "let o={UpdateExpression:`${r}${n.join(\",
                \")}`,ExpressionAttributeValues:s};return y("
              - "\"api.aws-dynamodb.util.getUpdateExpression::output\",o,p(o)),\
                o},R=(e,r)=>{let t=\"\\"
              - "api.aws-dynamodb.util.vdxMarshallWithTable\";y(`${t}::input`,{\
                dataType:e,props:r},"
              - "p({dataType:e,props:r}));let
                n={},{pkValue:s,skValue:o}=r,a=ie();if(a.isErr())return y("
              - "`${t}::error`,a.error.message),a;let
                u=a.value;if(e===\"destinations\"&&s){let c=\"\";"
              - "n.pkName=\"DestinationId\",n.pkValue=`${c}${s}`,n.tableName=u.\
                Destinations}else if(e==="
              - "\"directories\"&&s){let
                c=\"\";n.pkName=\"DirectoryId\",n.pkValue=`${c}${s}`,n.tableNam\
                e="
              - "u.Directories}else if(e===\"memberships\"&&(s||o)){let
                c=\"\",i=\"\";s&&(n.pkName=\"Des\\"
              - "tinationId\",n.pkValue=`${c}${s}`),o&&(n.skIndex=\"DirectoryId\
                Index\",n.skName=\"Dir\\"
              - "ectoryId\",n.skValue=`${i}${o}`),n.tableName=u.Memberships}els\
                e{let c={message:\"i\\"
              - "nternalServerError\",detail:`Invalid dataType: ${e} or both key
                values missing: ${s}\\"
              - ", ${o}`,errorSource:\"SERVER\"};return
                console.error(`${t}::error`,c),f(c)}return y("
              - "`${t}::output`,n,p(n)),d(n)},U=e=>{if(!e)return d(e);let
                r=Q([e]);return r.isErr()?"
              - "r:!r.value||r.value.length===0?d(void
                0):d(r.value[0])},Q=e=>{let r=\"api.aws-dyn\\"
              - "amodb.util.vdxUnmarshallMany\";console.log(`${r}::data`,e,p(e)\
                );try{if(!e||e.length==="
              - "0)return d(e);let
                t=e.flatMap(n=>{if(!n)return[];let{pk:s,sk:o,...a}=n,u={};return
                s?"
              - "(s.startsWith(\"DIR#\")?u.DirectoryId=s.substring(4):s.startsW\
                ith(\"DEST#\")&&(u.DestinationId="
              - "s.substring(5),o?.startsWith(\"DIR#\")&&(u.DirectoryId=o.subst\
                ring(4))),Object.keys("
              - "u).length>0?u={...u,...a}:console.error(\"vdxUnMarshallMany:er\
                ror::couldn't compr\\"
              - "ehend item, skipping I guess??\",n,p(n))):u=n,[u]});return
                console.log(`${r}::out\\"
              - "put`,t,p(t)),d(t)}catch(t){let n=typeof t==\"string\"?new
                Error(t):t,s={message:\"i\\"
              - "nternalServerError\",detail:n.message,errorSource:\"SERVER\",o\
                riginalError:n};return console."
              - "error(`${r}::error`,s,p(s)),f(s)}},ie=()=>{function
                e(t){if(process.env[t]&&(process."
              - "env[t]||\"\").length>0)return d(process.env[t]);{let
                n={message:\"internalServerErr\\"
              - "or\",detail:`${t} not set`,errorSource:\"SERVER\"};return
                console.error(n),f(n)}}let r={"
              - "Destinations:\"\",Directories:\"\",Memberships:\"\"};if(proces\
                s.env.NODE_ENV===\"test\")"
              - "console.debug(\"NODE_ENV=test, setting TABLES to test
                values\"),r.Destinations=\"aw\\"
              - "s-connect-directory_destinations\",r.Directories=\"aws-connect\
                -directory_directori\\"
              - "es\",r.Memberships=\"aws-connect-directory_memberships\";else{\
                let t=e(\"DDB_TABLE_DE\\"
              - "STINATION\");if(t.isErr())return t;r.Destinations=t.value;let
                n=e(\"DDB_TABLE_DIRE\\"
              - "CTORY\");if(n.isErr())return n;r.Directories=n.value;let
                s=e(\"DDB_TABLE_MEMBERSHI\\"
              - "P\");if(s.isErr())return s;r.Memberships=s.value}return
                d(r)};var O=require(\"@aws-sdk/lib-dynamodb\");var
                Y=async(e,r={})=>Te(\"directories\",e,r);var
                Te=async(e,r,t={})=>{let
                n=\"api.aws-dynamodb.memberships._getMembershipRecor\\"
              - "dsByDestDirId\";console.log(`${n}::input`,{dataType:e,id:r,pro\
                ps:t});let s=t.errWhenNone||"
              - "!1;try{let o={};e==\"directories\"?o.skValue=r:o.pkValue=r;let
                a=R(\"memberships\",o);"
              - "if(a.isErr())return
                a;let{pkName:u,pkValue:c,skIndex:i,skName:l,skValue:m,tableName\
                :k}=a."
              - "value,E={};if(u&&c&&(E.KeyConditionExpression=`${u} =
                :pk`,E.ExpressionAttributeValues="
              - "{\":pk\":c}),l&&m&&(E.KeyConditionExpression=`${l} =
                :sk`,E.ExpressionAttributeValues="
              - "{\":sk\":m},i&&(E.IndexName=i)),Object.keys(E).length===0)retu\
                rn f({message:\"inter\\"
              - "nalServerError\",errorSource:\"SERVER\"});E.TableName=k,y(`${n\
                }::QueryCommandInput`,"
              - "E);let g=await I.send(new
                O.QueryCommand(E));y(`${n}::QueryCommandResponse`,g,p("
              - "g));let{Items:x}=g;if(!x&&s){let w=\"No items found\";throw
                y(`${n}:`,w,p(g)),new Error("
              - "`${n}: ${w}`)}let M=Q(x);return
                console.debug(`${n}::output`,M),M}catch(o){let a=typeof o=="
              - "\"string\"?new
                Error(o):o,u={message:\"internalServerError\",detail:a.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:a};return
                console.error(`${n}::error`,u,p(u)),f(u)}};var ue=e=>{let
                r=\"api.aws-dynamodb.directories.calculateDirectoryStatus\",t=\
                \"UNKN\\"
              - "OWN\";try{let n=e.Metadata;if(n){let s=n.LastBuildAttempt?new
                Date(n.LastBuildAttempt)."
              - "getTime():0,o=n.LastBuildFailure?new
                Date(n.LastBuildFailure).getTime():0,a=n.LastBuildSuccess?"
              - "new
                Date(n.LastBuildSuccess).getTime():0,u=n.LastBuildableEvent?new
                Date(n.LastBuildableEvent)."
              - "getTime():0,c=n.IsBroken??!1,i=n.IsBuilt??!1,l=n.IsLicenseErro\
                r??!1,m=n.IsRollingBack??"
              - "!1,k=a>o?a:o;l?t=\"LICENSE_ERROR\":m?i?t=\"STOPPING_UPDATE\":t=\
                \"STOPPING_BUILD\":c?t="
              - "\"NEEDS_REPAIR\":u>s?t=\"ASSESSING\":s>k?i?t=\"UPDATING\":t=\"\
                BUILDING\":a>o?t=\"IN_SYNC\":"
              - "s==0?t=\"UNKNOWN\":i?t=\"OUT_OF_SYNC\":t=\"NOT_BUILT\"}}catch(\
                n){let s=n,o=`${r}::unex\\"
              - "pected
                exception:${s.message}`;console.error(o,s,p(s))}finally{return
                t}};var h=async(e,r)=>{let t=new Date().toISOString();return
                Object.keys(r).forEach("
              - "n=>{(r[n]===void
                0||r[n]===null)&&(n.startsWith(\"Last\")?r[n]=t:delete
                r[n])}),await T("
              - "{DirectoryId:e,Metadata:r},{updateLastModified:!1})};var
                T=async(e,r={})=>{let
                t=\"api.aws-dynamodb.directories.updateDirectory\";console."
              - "log(`${t}::input`,{directoryItem:e,props:r});let{expressionOpt\
                ions:n={},updateLastModified:s=!0}=r,"
              - "o=Be(e);if(o.isErr())return
                o;let{DirectoryId:a,Description:u}=e;try{if(u){let _=await Y("
              - "a);if(_.isErr())return _;if(_.value){let
                me=_.value.map(W=>W.DestinationId).map("
              - "async W=>{try{let
                D=R(\"memberships\",{pkValue:W,skValue:a});if(D.isErr())return
                D;"
              - "let{pkName:N,pkValue:de,skName:fe,skValue:ye,tableName:he}=D.v\
                alue,{UpdateExpression:Ee,"
              - "ExpressionAttributeValues:ge}=V({DirectoryName:u,LastModifiedD\
                ateTime:new Date()."
              - "toISOString()}),X={TableName:he,Key:{[N]:de,[fe]:ye},UpdateExp\
                ression:Ee,ExpressionAttributeValues:ge,"
              - "ReturnValues:\"ALL_NEW\"};y(`${t}::updateMembershipCommand`,X)\
                ;let Z=await I.send("
              - "new J.UpdateCommand(X));return
                y(`${t}::updateMembershipResult`,Z),Promise.resolve("
              - "Z)}catch(D){let N=typeof D==\"string\"?new Error(D):D;return
                console.error(`${t}::\\"
              - "updateMembershipError`,N,p(N)),Promise.resolve(N)}}),We=await
                Promise.allSettled("
              - "me)}}let c=R(\"directories\",{pkValue:a});if(c.isErr())return
                c;let{pkName:i,pkValue:l,"
              - "tableName:m}=c.value,{DirectoryId:k,...E}=e,g=E;g.Metadata||(g\
                .Metadata={}),s&&(g."
              - "Metadata.LastModifiedDateTime=new
                Date().toISOString()),g.Metadata.DirectoryStatus&&"
              - "delete
                g.Metadata.DirectoryStatus;let{UpdateExpression:x,ExpressionAtt\
                ributeValues:M}=V("
              - "{...g}),w={ReturnValues:\"ALL_NEW\",...n,TableName:m,Key:{[i]:\
                l},UpdateExpression:x,"
              - "ExpressionAttributeValues:M};y(`${t}::updateDirectoryCommand`,\
                w);let H=await I.send("
              - "new
                J.UpdateCommand(w));y(`${t}::updateDirectoryResult`,H);let{Attr\
                ibutes:G}=H,z=G&&"
              - "Pe(G);console.debug(`${t}::outputting`,z);let S=U(z);return
                console.log(`${t}::o\\"
              - "utput`,S),S.isErr()?S:S.value?d(S.value):f({message:\"notFound\
                \",detail:`No Direct\\"
              - "ory found with DirectoryId:
                ${a}`,errorSource:\"CLIENT\"})}catch(c){let i=typeof c=="
              - "\"string\"?new
                Error(c):c,l={message:\"internalServerError\",detail:i.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:i};return
                console.error(`${t}::error`,l,p(l)),f(l)}},Pe=e=>{"
              - "let r=e;return
                r&&(r.Metadata||(r.Metadata={}),r.Metadata.DirectoryStatus=ue(r\
                )),"
              - "r};var Be=e=>{let
                r=\"api.aws-dynamodb.directories._checkRequiredDirectoryAttribu\
                tes\","
              - "{DirectoryId:t}=e,n;return t?n=d(void
                0):n=f({message:\"resource.directories.vali\\"
              - "dation.missingDirectoryId\",errorSource:\"CLIENT\"}),n.isErr()\
                &&console.error(`${r}\\"
              - "::error`,n.error.message,e,p(e)),n};var
                Ue=async(e,r)=>{console.log(\"Received event:
                \",JSON.stringify(e,null,2),p(e)),"
              - "console.log(\"Received context:
                \",JSON.stringify(r,null,2),p(r));let[t,n,s]=e.detail[\"\\"
              - "stack-id\"].split(\"/\"),[o,a,u]=n.split(\"--\"),c=[];switch(e\
                .detail[\"status-details\"]."
              - "status){case\"CREATE_IN_PROGRESS\":c.push(h(u,{IsBroken:!1,Las\
                tBuildAttempt:e.time}));"
              - "break;case\"CREATE_FAILED\":c.push(h(u,{IsRollingBack:!1,LastB\
                uildFailure:e.time}));"
              - "break;case\"CREATE_COMPLETE\":c.push(h(u,{IsBuilt:!0}),le(u,e)\
                );break;case\"ROLLBAC\\"
              - "K_IN_PROGRESS\":c.push(h(u,{IsRollingBack:!0,LastBuildFailure:\
                e.time}));break;case\"\\"
              - "ROLLBACK_FAILED\":c.push(h(u,{IsRollingBack:!1,LastBuildFailur\
                e:e.time}));break;case\"\\"
              - "ROLLBACK_COMPLETE\":c.push(h(u,{IsRollingBack:!1,LastBuildFail\
                ure:e.time}));break;case\"\\"
              - "DELETE_IN_PROGRESS\":c.push(pe(n));break;case\"DELETE_FAILED\"\
                :break;case\"DELETE_CO\\"
              - "MPLETE\":break;case\"UPDATE_IN_PROGRESS\":c.push(h(u,{IsBroken\
                :!1,LastBuildAttempt:e."
              - "time}));break;case\"UPDATE_COMPLETE_CLEANUP_IN_PROGRESS\":brea\
                k;case\"UPDATE_COMPLE\\"
              - "TE\":c.push(h(u,{LastBuildSuccess:e.time}));break;case\"UPDATE\
                _ROLLBACK_IN_PROGRES\\"
              - "S\":c.push(h(u,{IsRollingBack:!0,LastBuildFailure:e.time}));br\
                eak;case\"UPDATE_ROL\\"
              - "LBACK_FAILED\":c.push(h(u,{IsRollingBack:!1,LastBuildFailure:e\
                .time}));break;case\"\\"
              - "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS\":break;case\"UPD\
                ATE_ROLLBACK_COMPLET\\"
              - "E\":c.push(h(u,{IsRollingBack:!1,LastBuildFailure:e.time}));br\
                eak;case\"REVIEW_IN_\\"
              - "PROGRESS\":break;default:console.log(\"Unknown status\")}await
                Promise.allSettled(c)."
              - "catch(i=>{console.error(\"Error processing
                tasks\",i)})},le=async(e,r)=>{let t=\"_h\\"
              - "andleCreateComplete\";try{let n=new
                j.CloudFormationClient({}),s={StackName:r.detail[\"\\"
              - "stack-id\"]},o=await n.send(new
                j.DescribeStacksCommand(s));console.debug(`${t}::\\"
              - "describeStackOutput`,o,p(o));let a=o.Stacks?.[0];if(!a)return
                console.error(`${t}\\"
              - "::No stack found for ${e}`),Promise.resolve();let
                u=a.Outputs;if(!u)return console."
              - "error(`${t}::No outputs found for ${e}`),Promise.resolve();let
                c=u.find(k=>k.OutputKey==="
              - "\"StateMachineArn\");if(!c)return console.error(`${t}::No
                StateMachineArn Output f\\"
              - "ound for ${e}`),Promise.resolve();let
                i=c.OutputValue,l=!1,m={};return i?m={StateMachineArn:i}:"
              - "(console.error(`${t}::StateMachineArn Output has no value for
                ${e}`),l=!0),T({DirectoryId:e,"
              - "IsBroken:l,Metadata:{LastModifiedDateTime:new
                Date().toISOString(),LastBuildSuccess:r."
              - "time,...m}})}catch(n){let s=n;return console.error(`${t}::Error
                working with Dir\\"
              - "ectory
                ${e}`,`e:${p(s)}`,`event:${p(r)}`),Promise.resolve()}finally{co\
                nsole.debug("
              - "`${t}::Finished with ${e}`)}},je=async e=>{let
                r=\"_setDirectoryInfo\";console.debug("
              - "`${r}::Working with ${e.DirectoryId}`,e,p(e));let t=await
                T(e);return console.debug("
              - "`${r}::Finished with
                ${e.DirectoryId}`,t,p(t)),Promise.resolve()},pe=async e=>{let
                r=\"\\"
              - "_removeTemplate\";try{let t=new
                F.S3Client({}),n=process.env.CFN_ASSETS_BUCKET;if(!n)"
              - "throw new Error(\"CFN_ASSETS_BUCKET not set\");let
                s=`templates/${e}.json`,o={Bucket:n,"
              - "Key:s};y(`${r}::s3Input`,o,p(o));let a=await t.send(new
                F.DeleteObjectCommand(o));"
              - "return
                y(`${r}::s3output`,a,p(a)),Promise.resolve()}catch(t){let
                n=t;return console."
              - "error(`${r}::s3error`,n.message,n,p(n)),Promise.resolve()}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          CFN_ASSETS_BUCKET:
            Ref: "DirMgmtS3Bucket0F4D3D00"
          CONNECT_INSTANCE_ARN:
            Fn::Join:
              - ""
              - - "arn:aws:connect:"
                - Ref: "AWS::Region"
                - ":"
                - Ref: "AWS::AccountId"
                - ":instance/"
                - Ref: "ConnectInstance"
          DDB_TABLE_DESTINATION:
            Ref: "DdbDestinations37B2F70F"
          DDB_TABLE_DIRECTORY:
            Ref: "DdbDirectories26458382"
          DDB_TABLE_MEMBERSHIP:
            Ref: "DdbMemberships1A816D0C"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "DirMgmtCfnListenerLambdaServiceRole863457B1"
          - "Arn"
      Runtime: "nodejs20.x"
      Timeout: 300
    DependsOn:
      - "DirMgmtCfnListenerLambdaServiceRoleDefaultPolicy94FBFB3A"
  DirMgmtUpdateDirectoryCfnListenerCloudformationPolicy959179DF:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "cloudformation:DescribeStacks"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:cloudformation:"
                  - Ref: "AWS::Region"
                  - ":"
                  - Ref: "AWS::AccountId"
                  - ":stack/VocaldexDirectory--"
                  - Ref: "ConnectInstance"
                  - "--*/*"
        Version: "2012-10-17"
      PolicyName: "DirMgmtUpdateDirectoryCfnListenerCloudformationPolicy959179DF"
      Roles:
        - Ref: "DirMgmtCfnListenerLambdaServiceRole863457B1"
  DirMgmtCloudFormationTriggerDACEAF53:
    Type: "AWS::Events::Rule"
    Properties:
      EventPattern:
        source:
          - "aws.cloudformation"
        detail-type:
          - "CloudFormation Stack Status Change"
        detail:
          stack-id:
            - prefix:
                Fn::Join:
                  - ""
                  - - "arn:aws:cloudformation:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":stack/VocaldexDirectory--"
                    - Ref: "ConnectInstance"
                    - "--"
      State: "ENABLED"
      Targets:
        - Arn:
            Fn::GetAtt:
              - "DirMgmtCfnListenerLambda8E584A49"
              - "Arn"
          Id: "Target0"
  DirMgmtCloudFormationTriggerAllowEventRuleVocaldexDirMgmtCfnListenerLambda661327735FB1381C:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "DirMgmtCfnListenerLambda8E584A49"
          - "Arn"
      Principal: "events.amazonaws.com"
      SourceArn:
        Fn::GetAtt:
          - "DirMgmtCloudFormationTriggerDACEAF53"
          - "Arn"
  DirMgmtCfnPublishLambdaServiceRoleED5968D2:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  DirMgmtCfnPublishLambdaServiceRoleDefaultPolicy7FDF9EBC:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:BatchWriteItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DeleteItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:PutItem"
              - "dynamodb:Query"
              - "dynamodb:Scan"
              - "dynamodb:UpdateItem"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "DdbDirectories26458382"
                - "Arn"
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:Query"
              - "dynamodb:Scan"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbMemberships1A816D0C"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DdbMemberships1A816D0C"
                        - "Arn"
                    - "/index/*"
          - Action:
              - "s3:Abort*"
              - "s3:DeleteObject*"
              - "s3:GetBucket*"
              - "s3:GetObject*"
              - "s3:List*"
              - "s3:PutObject"
              - "s3:PutObjectLegalHold"
              - "s3:PutObjectRetention"
              - "s3:PutObjectTagging"
              - "s3:PutObjectVersionTagging"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DirMgmtS3Bucket0F4D3D00"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DirMgmtS3Bucket0F4D3D00"
                        - "Arn"
                    - "/*"
        Version: "2012-10-17"
      PolicyName: "DirMgmtCfnPublishLambdaServiceRoleDefaultPolicy7FDF9EBC"
      Roles:
        - Ref: "DirMgmtCfnPublishLambdaServiceRoleED5968D2"
    Metadata:
      cfn-lint:
        config:
          ignore_checks:
            - "EIAMPolicyActionWildcard"
          ignore_checks_reasons:
            EIAMPolicyActionWildcard: "This is the IAM statement generated by CDK 'grantReadWrite'."
  DirMgmtCfnPublishLambdaF639239A:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var We=Object.create;var
                ne=Object.defineProperty;var
                Ke=Object.getOwnPropertyDescriptor;var
                Ge=Object.getOwnPropertyNames;var
                je=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty;var
                qe=(e,t)=>{for(var r in
                t)ne(e,r,{get:t[r],enumerable:!0})},he=(e,t,r,o)=>{if(t&&"
              - "typeof t==\"object\"||typeof t==\"function\")for(let i of
                Ge(t))!Je.call(e,i)&&i!==r&&"
              - "ne(e,i,{get:()=>t[i],enumerable:!(o=Ke(t,i))||o.enumerable});r\
                eturn e};var
                Ye=(e,t,r)=>(r=e!=null?We(je(e)):{},he(t||!e||!e.__esModule?ne(\
                r,\"default\",{"
              - "value:e,enumerable:!0}):r,e)),ze=e=>he(ne({},\"__esModule\",{v\
                alue:!0}),e);var
                pt={};qe(pt,{handler:()=>dt});module.exports=ze(pt);var
                h=Ye(require(\"@aws-sdk/client-cloudformation\"),1),"
              - "de=require(\"@aws-sdk/client-s3\"),pe=require(\"@aws-sdk/clien\
                t-sfn\");var Me=require(\"@aws-sdk/lib-dynamodb\");var
                Ie=e=>e.invokedFunctionArn.split(\":\")[4],d=e=>btoa(JSON.strin\
                gify(e)),m=(...e)=>{};function C(e){var
                t=String(e);if(t===\"[object
                Object]\")try{t=JSON.stringify(e)}catch{}"
              - "return t}var He=function(){function e(){}return
                e.prototype.isSome=function(){return!1},e."
              - "prototype.isNone=function(){return!0},e.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(t){"
              - "return t},e.prototype.expect=function(t){throw new
                Error(\"\".concat(t))},e.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},e.prototype.map=function(t){"
              - "return this},e.prototype.mapOr=function(t,r){return
                t},e.prototype.mapOrElse=function(t,r){"
              - "return t()},e.prototype.or=function(t){return
                t},e.prototype.orElse=function(t){"
              - "return t()},e.prototype.andThen=function(t){return
                this},e.prototype.toResult=function(t){"
              - "return
                E(t)},e.prototype.toString=function(){return\"None\"},e.prototy\
                pe.toAsyncOption="
              - "function(){return new z(U)},e}(),U=new He;Object.freeze(U);var
                Qe=function(){function e(t){"
              - "if(!(this instanceof e))return new e(t);this.value=t}return
                e.prototype.isSome=function(){"
              - "return!0},e.prototype.isNone=function(){return!1},e.prototype[\
                Symbol.iterator]=function(){"
              - "var t=Object(this.value);return Symbol.iterator in
                t?t[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(t){return this.value},"
              - "e.prototype.expect=function(t){return
                this.value},e.prototype.unwrap=function(){"
              - "return this.value},e.prototype.map=function(t){return
                M(t(this.value))},e.prototype."
              - "mapOr=function(t,r){return
                r(this.value)},e.prototype.mapOrElse=function(t,r){return r("
              - "this.value)},e.prototype.or=function(t){return
                this},e.prototype.orElse=function(t){"
              - "return this},e.prototype.andThen=function(t){return
                t(this.value)},e.prototype.toResult="
              - "function(t){return
                f(this.value)},e.prototype.toAsyncOption=function(){return new
                z("
              - "this)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype.toString="
              - "function(){return\"Some(\".concat(C(this.value),\")\")},e.EMPT\
                Y=new e(void 0),e}(),M=Qe,"
              - "Ne;(function(e){function t(){for(var
                i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];"
              - "for(var s=[],c=0,l=i;c<l.length;c++){var
                a=l[c];if(a.isSome())s.push(a.value);else"
              - "return a}return M(s)}e.all=t;function r(){for(var
                i=[],n=0;n<arguments.length;n++)"
              - "i[n]=arguments[n];for(var s=0,c=i;s<c.length;s++){var
                l=c[s];if(l.isSome())return l}"
              - "return U}e.any=r;function o(i){return i instanceof
                M||i===U}e.isOption=o})(Ne||(Ne="
              - "{}));var Ze=function(){function e(t){if(!(this instanceof
                e))return new e(t);this.error="
              - "t;var r=new Error().stack.split(`"
              - "`).slice(2);r&&r.length>0&&r[0].includes(\"ErrImpl\")&&r.shift\
                (),this._stack=r.join("
              - "`"
              - "`)}return
                e.prototype.isOk=function(){return!1},e.prototype.isErr=functio\
                n(){return!0},"
              - "e.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "e.prototype.else=function(t){return
                t},e.prototype.unwrapOr=function(t){return t},"
              - "e.prototype.expect=function(t){throw new Error(\"\".concat(t,\"
                - Error: \").concat("
              - "C(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.expect\
                Err=function(t){return this."
              - "error},e.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "C(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.unwrap\
                Err=function(){return this."
              - "error},e.prototype.map=function(t){return
                this},e.prototype.andThen=function(t){"
              - "return this},e.prototype.mapErr=function(t){return new
                E(t(this.error))},e.prototype."
              - "mapOr=function(t,r){return
                t},e.prototype.mapOrElse=function(t,r){return t(this."
              - "error)},e.prototype.or=function(t){return
                t},e.prototype.orElse=function(t){return t("
              - "this.error)},e.prototype.toOption=function(){return
                U},e.prototype.toString=function(){"
              - "return\"Err(\".concat(C(this.error),\")\")},Object.definePrope\
                rty(e.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),e.prot\
                otype.toAsyncResult="
              - "function(){return new H(this)},e.EMPTY=new e(void 0),e}();var
                E=Ze,Xe=function(){function e(t){if(!(this instanceof e))return
                new e(t);this."
              - "value=t}return
                e.prototype.isOk=function(){return!0},e.prototype.isErr=functio\
                n(){"
              - "return!1},e.prototype[Symbol.iterator]=function(){var
                t=Object(this.value);return Symbol."
              - "iterator in
                t?t[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "e.prototype.else=function(t){return
                this.value},e.prototype.unwrapOr=function(t){"
              - "return this.value},e.prototype.expect=function(t){return
                this.value},e.prototype."
              - "expectErr=function(t){throw new
                Error(t)},e.prototype.unwrap=function(){return this."
              - "value},e.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "C(this.value)),{cause:this.value})},e.prototype.map=function(t\
                ){return new f(t(this."
              - "value))},e.prototype.andThen=function(t){return
                t(this.value)},e.prototype.mapErr="
              - "function(t){return this},e.prototype.mapOr=function(t,r){return
                r(this.value)},e."
              - "prototype.mapOrElse=function(t,r){return
                r(this.value)},e.prototype.or=function(t){"
              - "return this},e.prototype.orElse=function(t){return
                this},e.prototype.toOption=function(){"
              - "return M(this.value)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype."
              - "toString=function(){return\"Ok(\".concat(C(this.value),\")\")}\
                ,e.prototype.toAsyncResult="
              - "function(){return new H(this)},e.EMPTY=new e(void 0),e}();var
                f=Xe,Re;(function(e){function t(){for(var
                s=[],c=0;c<arguments.length;c++)s[c]="
              - "arguments[c];for(var l=[],a=0,p=s;a<p.length;a++){var
                u=p[a];if(u.isOk())l.push("
              - "u.value);else return u}return new f(l)}e.all=t;function
                r(){for(var s=[],c=0;c<arguments."
              - "length;c++)s[c]=arguments[c];for(var
                l=[],a=0,p=s;a<p.length;a++){var u=p[a];if(u."
              - "isOk())return u;l.push(u.error)}return new
                E(l)}e.any=r;function o(s){try{return new f("
              - "s())}catch(c){return new E(c)}}e.wrap=o;function
                i(s){try{return s().then(function(c){"
              - "return new f(c)}).catch(function(c){return new
                E(c)})}catch(c){return Promise.resolve("
              - "new E(c))}}e.wrapAsync=i;function n(s){return s instanceof E||s
                instanceof f}e.isResult="
              - "n})(Re||(Re={}));var ie=function(e,t,r,o){function i(n){return
                n instanceof r?n:new r(function(s){"
              - "s(n)})}return new(r||(r=Promise))(function(n,s){function
                c(p){try{a(o.next(p))}catch(u){"
              - "s(u)}}function l(p){try{a(o.throw(p))}catch(u){s(u)}}function
                a(p){p.done?n(p.value):"
              - "i(p.value).then(c,l)}a((o=o.apply(e,t||[])).next())})},ae=func\
                tion(e,t){var r={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},o,i,n,s;return s="
              - "{next:c(0),throw:c(1),return:c(2)},typeof
                Symbol==\"function\"&&(s[Symbol.iterator]="
              - "function(){return this}),s;function c(a){return
                function(p){return l([a,p])}}function l(a){"
              - "if(o)throw new TypeError(\"Generator is already
                executing.\");for(;s&&(s=0,a[0]&&(r="
              - "0)),r;)try{if(o=1,i&&(n=a[0]&2?i.return:a[0]?i.throw||((n=i.re\
                turn)&&n.call(i),0):"
              - "i.next)&&!(n=n.call(i,a[1])).done)return
                n;switch(i=0,n&&(a=[a[0]&2,n.value]),a[0]){case 0:case 1:"
              - "n=a;break;case 4:return r.label++,{value:a[1],done:!1};case
                5:r.label++,i=a[1],a="
              - "[0];continue;case
                7:a=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(a[0]===6||a[0]===2)){r=0;continue\
                }if(a[0]===3&&(!n||"
              - "a[1]>n[0]&&a[1]<n[3])){r.label=a[1];break}if(a[0]===6&&r.label\
                <n[1]){r.label=n[1],"
              - "n=a;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(a);break\
                }n[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}a=t.call(e,r)}catch(p){a=[6,p],i=0}final\
                ly{o=n=0}if(a[0]&5)"
              - "throw a[1];return{value:a[0]?a[1]:void
                0,done:!0}}},H=function(){function e(t){this."
              - "promise=Promise.resolve(t)}return
                e.prototype.andThen=function(t){var r=this;return this."
              - "thenInternal(function(o){return ie(r,void 0,void
                0,function(){var i;return ae(this,"
              - "function(n){return o.isErr()?[2,o]:(i=t(o.value),[2,i
                instanceof e?i.promise:i])})})})},"
              - "e.prototype.map=function(t){var r=this;return
                this.thenInternal(function(o){return ie("
              - "r,void 0,void 0,function(){var i;return
                ae(this,function(n){switch(n.label){case 0:"
              - "return o.isErr()?[2,o]:(i=f,[4,t(o.value)]);case
                1:return[2,i.apply(void 0,[n.sent()])]}})})})},"
              - "e.prototype.mapErr=function(t){var r=this;return
                this.thenInternal(function(o){return ie("
              - "r,void 0,void 0,function(){var i;return
                ae(this,function(n){switch(n.label){case 0:"
              - "return o.isOk()?[2,o]:(i=E,[4,t(o.error)]);case
                1:return[2,i.apply(void 0,[n.sent()])]}})})})},"
              - "e.prototype.or=function(t){return this.orElse(function(){return
                t})},e.prototype."
              - "orElse=function(t){var r=this;return
                this.thenInternal(function(o){return ie(r,void 0,"
              - "void 0,function(){var i;return ae(this,function(n){return
                o.isOk()?[2,o]:(i=t(o."
              - "error),[2,i instanceof
                e?i.promise:i])})})})},e.prototype.toOption=function(){return
                new z("
              - "this.promise.then(function(t){return
                t.toOption()}))},e.prototype.thenInternal=function(t){"
              - "return new e(this.promise.then(t))},e}();var
                ye=function(e,t,r,o){function i(n){return n instanceof r?n:new
                r(function(s){"
              - "s(n)})}return new(r||(r=Promise))(function(n,s){function
                c(p){try{a(o.next(p))}catch(u){"
              - "s(u)}}function l(p){try{a(o.throw(p))}catch(u){s(u)}}function
                a(p){p.done?n(p.value):"
              - "i(p.value).then(c,l)}a((o=o.apply(e,t||[])).next())})},fe=func\
                tion(e,t){var r={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},o,i,n,s;return s="
              - "{next:c(0),throw:c(1),return:c(2)},typeof
                Symbol==\"function\"&&(s[Symbol.iterator]="
              - "function(){return this}),s;function c(a){return
                function(p){return l([a,p])}}function l(a){"
              - "if(o)throw new TypeError(\"Generator is already
                executing.\");for(;s&&(s=0,a[0]&&(r="
              - "0)),r;)try{if(o=1,i&&(n=a[0]&2?i.return:a[0]?i.throw||((n=i.re\
                turn)&&n.call(i),0):"
              - "i.next)&&!(n=n.call(i,a[1])).done)return
                n;switch(i=0,n&&(a=[a[0]&2,n.value]),a[0]){case 0:case 1:"
              - "n=a;break;case 4:return r.label++,{value:a[1],done:!1};case
                5:r.label++,i=a[1],a="
              - "[0];continue;case
                7:a=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(a[0]===6||a[0]===2)){r=0;continue\
                }if(a[0]===3&&(!n||"
              - "a[1]>n[0]&&a[1]<n[3])){r.label=a[1];break}if(a[0]===6&&r.label\
                <n[1]){r.label=n[1],"
              - "n=a;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(a);break\
                }n[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}a=t.call(e,r)}catch(p){a=[6,p],i=0}final\
                ly{o=n=0}if(a[0]&5)"
              - "throw a[1];return{value:a[0]?a[1]:void
                0,done:!0}}},z=function(){function e(t){this."
              - "promise=Promise.resolve(t)}return
                e.prototype.andThen=function(t){var r=this;return this."
              - "thenInternal(function(o){return ye(r,void 0,void
                0,function(){var i;return fe(this,"
              - "function(n){return o.isNone()?[2,o]:(i=t(o.value),[2,i
                instanceof e?i.promise:i])})})})},"
              - "e.prototype.map=function(t){var r=this;return
                this.thenInternal(function(o){return ye("
              - "r,void 0,void 0,function(){var i;return
                fe(this,function(n){switch(n.label){case 0:"
              - "return o.isNone()?[2,o]:(i=M,[4,t(o.value)]);case
                1:return[2,i.apply(void 0,[n.sent()])]}})})})},"
              - "e.prototype.or=function(t){return this.orElse(function(){return
                t})},e.prototype."
              - "orElse=function(t){var r=this;return
                this.thenInternal(function(o){return ye(r,void 0,"
              - "void 0,function(){var i;return fe(this,function(n){return
                o.isSome()?[2,o]:(i=t(),"
              - "[2,i instanceof
                e?i.promise:i])})})})},e.prototype.toResult=function(t){return
                new H("
              - "this.promise.then(function(r){return
                r.toResult(t)}))},e.prototype.thenInternal="
              - "function(t){return new e(this.promise.then(t))},e}();var
                ve=require(\"@aws-sdk/client-lambda\"),ge=require(\"@aws-sdk/li\
                b-dynamodb\");var xe=require(\"@aws-sdk/lib-dynamodb\");var
                Le=require(\"@aws-sdk/client-dynamodb\"),Te=require(\"@aws-sdk/\
                lib-dynamodb\");var
                Ce={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.e\
                nv.DDB_AWS_REGION&&"
              - "(Ce.region=process.env.DDB_AWS_REGION);var
                D=Te.DynamoDBDocumentClient.from(new Le.DynamoDBClient("
              - "Ce),{marshallOptions:{removeUndefinedValues:!0}}),se=(e,t=\"SET
                \")=>{let r=\"api.a\\"
              - "ws-dynamodb.util.getUpdateExpression\",o=[],i={};for(let[s,c]of
                Object.entries(e))"
              - "if(m(`${r}`,s,c),s==\"Metadata\")for(let[l,a]of
                Object.entries(c))m(`${r}::${s}.`,"
              - "l,a),o.push(`${s}.${l} =
                :${s}${l}`),i[`:${s}${l}`]=a;else{let{expression:l,value:a}=c;"
              - "l&&a?(o.push(`${s} = :${l}`),i[`:${s}`]=a):(o.push(`${s} =
                :${s}`),i[`:${s}`]=c)}"
              - "let n={UpdateExpression:`${t}${o.join(\",
                \")}`,ExpressionAttributeValues:i};return m("
              - "\"api.aws-dynamodb.util.getUpdateExpression::output\",n,d(n)),\
                n},x=(e,t)=>{let r=\"\\"
              - "api.aws-dynamodb.util.vdxMarshallWithTable\";m(`${r}::input`,{\
                dataType:e,props:t},"
              - "d({dataType:e,props:t}));let
                o={},{pkValue:i,skValue:n}=t,s=De();if(s.isErr())return m("
              - "`${r}::error`,s.error.message),s;let
                c=s.value;if(e===\"destinations\"&&i){let l=\"\";"
              - "o.pkName=\"DestinationId\",o.pkValue=`${l}${i}`,o.tableName=c.\
                Destinations}else if(e==="
              - "\"directories\"&&i){let
                l=\"\";o.pkName=\"DirectoryId\",o.pkValue=`${l}${i}`,o.tableNam\
                e="
              - "c.Directories}else if(e===\"memberships\"&&(i||n)){let
                l=\"\",a=\"\";i&&(o.pkName=\"Des\\"
              - "tinationId\",o.pkValue=`${l}${i}`),n&&(o.skIndex=\"DirectoryId\
                Index\",o.skName=\"Dir\\"
              - "ectoryId\",o.skValue=`${a}${n}`),o.tableName=c.Memberships}els\
                e{let l={message:\"i\\"
              - "nternalServerError\",detail:`Invalid dataType: ${e} or both key
                values missing: ${i}\\"
              - ", ${n}`,errorSource:\"SERVER\"};return
                console.error(`${r}::error`,l),E(l)}return m("
              - "`${r}::output`,o,d(o)),f(o)},ce=e=>{if(!e)return f(e);let
                t=Ee([e]);return t.isErr()?"
              - "t:!t.value||t.value.length===0?f(void
                0):f(t.value[0])},Ee=e=>{let t=\"api.aws-dy\\"
              - "namodb.util.vdxUnmarshallMany\";console.log(`${t}::data`,e,d(e\
                ));try{if(!e||e.length==="
              - "0)return f(e);let
                r=e.flatMap(o=>{if(!o)return[];let{pk:i,sk:n,...s}=o,c={};return
                i?"
              - "(i.startsWith(\"DIR#\")?c.DirectoryId=i.substring(4):i.startsW\
                ith(\"DEST#\")&&(c.DestinationId="
              - "i.substring(5),n?.startsWith(\"DIR#\")&&(c.DirectoryId=n.subst\
                ring(4))),Object.keys("
              - "c).length>0?c={...c,...s}:console.error(\"vdxUnMarshallMany:er\
                ror::couldn't compr\\"
              - "ehend item, skipping I guess??\",o,d(o))):c=o,[c]});return
                console.log(`${t}::out\\"
              - "put`,r,d(r)),f(r)}catch(r){let o=typeof r==\"string\"?new
                Error(r):r,i={message:\"i\\"
              - "nternalServerError\",detail:o.message,errorSource:\"SERVER\",o\
                riginalError:o};return console."
              - "error(`${t}::error`,i,d(i)),E(i)}},De=()=>{function
                e(r){if(process.env[r]&&(process."
              - "env[r]||\"\").length>0)return f(process.env[r]);{let
                o={message:\"internalServerErr\\"
              - "or\",detail:`${r} not set`,errorSource:\"SERVER\"};return
                console.error(o),E(o)}}let t={"
              - "Destinations:\"\",Directories:\"\",Memberships:\"\"};if(proces\
                s.env.NODE_ENV===\"test\")"
              - "console.debug(\"NODE_ENV=test, setting TABLES to test
                values\"),t.Destinations=\"aw\\"
              - "s-connect-directory_destinations\",t.Directories=\"aws-connect\
                -directory_directori\\"
              - "es\",t.Memberships=\"aws-connect-directory_memberships\";else{\
                let r=e(\"DDB_TABLE_DE\\"
              - "STINATION\");if(r.isErr())return r;t.Destinations=r.value;let
                o=e(\"DDB_TABLE_DIRE\\"
              - "CTORY\");if(o.isErr())return o;t.Directories=o.value;let
                i=e(\"DDB_TABLE_MEMBERSHI\\"
              - "P\");if(i.isErr())return i;t.Memberships=i.value}return
                f(t)};var Ae=async(e,t,r={})=>{let
                o=\"api.aws-dynamodb.getDestDirRecordById\";console.debug("
              - "`${o}::input`,{dataType:e,id:t,props:r});let
                i=r.errWhenNone||!1;try{let n=x(e,{"
              - "pkValue:t});if(n.isErr())return
                n;let{pkName:s,pkValue:c,skName:l,skValue:a,tableName:p}=n."
              - "value,u={TableName:p};if(s&&c)u.Key={[s]:c};else return
                E({message:\"internalServ\\"
              - "erError\",errorSource:\"SERVER\"});l&&a&&(u.Key[l]=a),m(`${o}:\
                :GetCommandInput`,u);"
              - "let g=await D.send(new
                xe.GetCommand(u));m(`${o}::GetCommandOutput`,g);let{Item:A}=g;"
              - "if(!A&&i){let b=\"Item not found\";throw m(`${o}:`,b,d(g)),new
                Error(`${o}: ${b}`)}"
              - "return console.debug(`${o}::outputting`,A),f(A)}catch(n){let
                s=typeof n==\"string\"?"
              - "new
                Error(n):n,c={message:\"internalServerError\",detail:s.message,\
                errorSource:\"SE\\"
              - "RVER\",originalError:s};return
                console.error(`${o}::error`,c,d(c)),E(c)}};var
                W=require(\"@aws-sdk/lib-dynamodb\");var
                Q=async(e,t={})=>et(\"directories\",e,t);var
                et=async(e,t,r={})=>{let
                o=\"api.aws-dynamodb.memberships._getMembershipRecor\\"
              - "dsByDestDirId\";console.log(`${o}::input`,{dataType:e,id:t,pro\
                ps:r});let i=r.errWhenNone||"
              - "!1;try{let n={};e==\"directories\"?n.skValue=t:n.pkValue=t;let
                s=x(\"memberships\",n);"
              - "if(s.isErr())return
                s;let{pkName:c,pkValue:l,skIndex:a,skName:p,skValue:u,tableName\
                :g}=s."
              - "value,A={};if(c&&l&&(A.KeyConditionExpression=`${c} =
                :pk`,A.ExpressionAttributeValues="
              - "{\":pk\":l}),p&&u&&(A.KeyConditionExpression=`${p} =
                :sk`,A.ExpressionAttributeValues="
              - "{\":sk\":u},a&&(A.IndexName=a)),Object.keys(A).length===0)retu\
                rn E({message:\"inter\\"
              - "nalServerError\",errorSource:\"SERVER\"});A.TableName=g,m(`${o\
                }::QueryCommandInput`,"
              - "A);let b=await D.send(new
                W.QueryCommand(A));m(`${o}::QueryCommandResponse`,b,d("
              - "b));let{Items:k}=b;if(!k&&i){let N=\"No items found\";throw
                m(`${o}:`,N,d(b)),new Error("
              - "`${o}: ${N}`)}let I=Ee(k);return
                console.debug(`${o}::output`,I),I}catch(n){let s=typeof n=="
              - "\"string\"?new
                Error(n):n,c={message:\"internalServerError\",detail:s.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:s};return
                console.error(`${o}::error`,c,d(c)),E(c)}};var ke=e=>{let
                t=\"api.aws-dynamodb.directories.calculateDirectoryStatus\",r=\
                \"UNKN\\"
              - "OWN\";try{let o=e.Metadata;if(o){let i=o.LastBuildAttempt?new
                Date(o.LastBuildAttempt)."
              - "getTime():0,n=o.LastBuildFailure?new
                Date(o.LastBuildFailure).getTime():0,s=o.LastBuildSuccess?"
              - "new
                Date(o.LastBuildSuccess).getTime():0,c=o.LastBuildableEvent?new
                Date(o.LastBuildableEvent)."
              - "getTime():0,l=o.IsBroken??!1,a=o.IsBuilt??!1,p=o.IsLicenseErro\
                r??!1,u=o.IsRollingBack??"
              - "!1,g=s>n?s:n;p?r=\"LICENSE_ERROR\":u?a?r=\"STOPPING_UPDATE\":r=\
                \"STOPPING_BUILD\":l?r="
              - "\"NEEDS_REPAIR\":c>i?r=\"ASSESSING\":i>g?a?r=\"UPDATING\":r=\"\
                BUILDING\":s>n?r=\"IN_SYNC\":"
              - "i==0?r=\"UNKNOWN\":a?r=\"OUT_OF_SYNC\":r=\"NOT_BUILT\"}}catch(\
                o){let i=o,n=`${t}::unex\\"
              - "pected
                exception:${i.message}`;console.error(n,i,d(i))}finally{return
                r}},ue=async(e,t={})=>ot("
              - "await Ae(\"directories\",e,t)),le=async(e,t)=>{let r=new
                Date().toISOString();return Object."
              - "keys(t).forEach(o=>{(t[o]===void
                0||t[o]===null)&&(o.startsWith(\"Last\")?t[o]=r:delete t[o])}),"
              - "await
                Pe({DirectoryId:e,Metadata:t},{updateLastModified:!1})};var
                Pe=async(e,t={})=>{let
                r=\"api.aws-dynamodb.directories.updateDirectory\";console."
              - "log(`${r}::input`,{directoryItem:e,props:t});let{expressionOpt\
                ions:o={},updateLastModified:i=!0}=t,"
              - "n=nt(e);if(n.isErr())return
                n;let{DirectoryId:s,Description:c}=e;try{if(c){let $=await Q("
              - "s);if($.isErr())return $;if($.value){let
                w=$.value.map(j=>j.DestinationId).map(async j=>{"
              - "try{let
                R=x(\"memberships\",{pkValue:j,skValue:s});if(R.isErr())return
                R;let{pkName:L,"
              - "pkValue:me,skName:J,skValue:ee,tableName:q}=R.value,{UpdateExp\
                ression:te,ExpressionAttributeValues:re}=se("
              - "{DirectoryName:c,LastModifiedDateTime:new
                Date().toISOString()}),V={TableName:q,"
              - "Key:{[L]:me,[J]:ee},UpdateExpression:te,ExpressionAttributeVal\
                ues:re,ReturnValues:\"\\"
              - "ALL_NEW\"};m(`${r}::updateMembershipCommand`,V);let y=await
                D.send(new ge.UpdateCommand("
              - "V));return
                m(`${r}::updateMembershipResult`,y),Promise.resolve(y)}catch(R)\
                {let L=typeof R=="
              - "\"string\"?new Error(R):R;return
                console.error(`${r}::updateMembershipError`,L,d(L)),"
              - "Promise.resolve(L)}}),T=await Promise.allSettled(w)}}let
                l=x(\"directories\",{pkValue:s});"
              - "if(l.isErr())return
                l;let{pkName:a,pkValue:p,tableName:u}=l.value,{DirectoryId:g,"
              - "...A}=e,b=A;b.Metadata||(b.Metadata={}),i&&(b.Metadata.LastMod\
                ifiedDateTime=new Date()."
              - "toISOString()),b.Metadata.DirectoryStatus&&delete
                b.Metadata.DirectoryStatus;let{"
              - "UpdateExpression:k,ExpressionAttributeValues:I}=se({...b}),N={\
                ReturnValues:\"ALL_\\"
              - "NEW\",...o,TableName:u,Key:{[a]:p},UpdateExpression:k,Expressi\
                onAttributeValues:I};"
              - "m(`${r}::updateDirectoryCommand`,N);let Z=await D.send(new
                ge.UpdateCommand(N));"
              - "m(`${r}::updateDirectoryResult`,Z);let{Attributes:G}=Z,X=G&&we\
                (G);console.debug("
              - "`${r}::outputting`,X);let P=ce(X);return
                console.log(`${r}::output`,P),P.isErr()?"
              - "P:P.value?f(P.value):E({message:\"notFound\",detail:`No
                Directory found with Direc\\"
              - "toryId: ${s}`,errorSource:\"CLIENT\"})}catch(l){let a=typeof
                l==\"string\"?new Error("
              - "l):l,p={message:\"internalServerError\",detail:a.message,error\
                Source:\"SERVER\",originalError:a};"
              - "return console.error(`${r}::error`,p,d(p)),E(p)}},we=e=>{let
                t=e;return t&&(t.Metadata||"
              - "(t.Metadata={}),t.Metadata.DirectoryStatus=ke(t)),t},ot=e=>e.i\
                sErr()?e:f(we(e.value)),"
              - "nt=e=>{let
                t=\"api.aws-dynamodb.directories._checkRequiredDirectoryAttribu\
                tes\",{DirectoryId:r}=e,"
              - "o;return r?o=f(void
                0):o=E({message:\"resource.directories.validation.missingDire\\"
              - "ctoryId\",errorSource:\"CLIENT\"}),o.isErr()&&console.error(`$\
                {t}::error`,o.error.message,"
              - "e,d(e)),o};var
                K=require(\"@aws-sdk/client-license-manager\");var
                at=\"entitlement.broken.redeployApp\",st=\"entitlement.missing\
                \",Oe=async e=>{let t=\"\\"
              - "doLicenseCheck\";try{let
                r=\"6cf9s66w3t0z1qdjuijuoc6ah\",o=\"186272575067\",n={region:pr\
                ocess."
              - "env.AWS_REGION||\"us-east-1\"},s=new
                K.LicenseManagerClient(n),c={Filters:[{Name:\"\\"
              - "ProductSKU\",Values:[r]},{Name:\"Status\",Values:[\"AVAILABLE\
                \"]}]},l,a=!1;e==o?(l=new K.ListLicensesCommand("
              - "c),a=!0):l=new
                K.ListReceivedLicensesCommand(c),m(`${t}::getting
                licenses`,{callerAwsAccountId:e,"
              - "seller:o,input:c,command:l});let p=await
                s.send(l);console.debug(d(p));let u=p.Licenses||"
              - "[];return a&&(m(`${t}::filtering beneficiary because
                seller=account`),u=u.filter("
              - "g=>g.Beneficiary?.includes(`:${e}:`)),m(d(u))),lt(p)&&(u=u.fil\
                ter(g=>g.Issuer?.KeyFingerprint?."
              - "startsWith(`aws:${o}:`)),m(d(u)),u.length>0)?ct(u[0].Beneficia\
                ry):be(st)}catch(r){"
              - "let o=r;if((o.name||\"\")===\"AuthorizationException\")return
                be(at);if((o.name||\"\")==="
              - "\"AccessDeniedException\")return be(o.message);{let
                i=`${t}::unexpected exception:${o."
              - "message}`;return
                m(i,o,d(o)),ut(o)}}},ct=e=>({status:\"LICENSE_FOUND\",data:e}),\
                ut=e=>({"
              - "status:\"LOOKUP_ERROR\",data:e instanceof
                Error?e.message:e}),be=e=>({status:\"LICE\\"
              - "NSE_MISSING\",data:e}),lt=e=>{let
                t=\"checkLicenses.isValid\";if((e.Licenses||[]).length=="
              - "0)return m(`${t}::No active subscription found in AWS
                Marketplace`),!1;let r=e.Licenses[0];"
              - "if((r.Entitlements||[]).length==0)return m(`${t}::No
                entitlement found on Licens\\"
              - "e`),!1;let o=r.Entitlements[0];return
                o.Value!==\"Enabled\"?(m(`${t}::Entitlement \\"
              - "not enabled:
                ${o.Value}`),!1):r.Status!==\"AVAILABLE\"&&r.Status!==\"ACTIVE\
                \"?(m(`${t}\\"
              - "::License not available or active: ${r.Status}`),!1):!0};var
                $e=async(e,t,r)=>{try{console.debug(`${e}:_awsCommandWithLoggin\
                g::Input`,r.input,"
              - "d(r.input));let o=await t.send(r);return
                console.debug(`${e}:_awsCommandWithLogg\\"
              - "ing::Output`,o,d(o)),Promise.resolve()}catch(o){let i=o;return
                console.error(`${e}\\"
              - ":_awsCommandWithLogging::Error`,o,d(o),d(i)),Promise.resolve()\
                }};var
                O={Parameters:{DirectoryId:{Type:\"String\",AllowedPattern:\"^(\
                [a-zA-Z0-9]{10})\\"
              - "$\",ConstraintDescription:\"A 10-character alphanumeric
                string.\",Description:\"The \\"
              - "directory
                ID.\"},DirectoryName:{Type:\"String\",AllowedPattern:\"^.{1,200\
                }$\",Description:\"\\"
              - "The directory
                Name.\"},ConnectInstanceArn:{Type:\"String\",AllowedPattern:\"^\
                arn:aws\\"
              - ":connect:[-a-z]+[0-9]+:[0-9]{12}:instance/[a-z0-9-]{8}-[a-z0-9\
                -]{4}-[a-z0-9-]{4}\\"
              - "-[a-z0-9-]{4}-[a-z0-9-]{12}$\",Description:\"The Connect
                Instance ARN.\"},LambdaArnBotBuild:{"
              - "Type:\"String\",AllowedPattern:\"^arn:aws:lambda:[-a-z]+[0-9]+\
                :[0-9]{12}:function:[\\"
              - "a-zA-Z0-9-_]+$\",Description:\"The Bot Building Lambda Function
                ARN.\"},LambdaArnConnectDestinationInfo:{"
              - "Type:\"String\",AllowedPattern:\"^arn:aws:lambda:[-a-z]+[0-9]+\
                :[0-9]{12}:function:[\\"
              - "a-zA-Z0-9-_]+$\",Description:\"The Connect Destination Info
                Lambda Function ARN.\"},"
              - "LambdaArnConnectEvents:{Type:\"String\",AllowedPattern:\"^arn:\
                aws:lambda:[-a-z]+[0-\\"
              - "9]+:[0-9]{12}:function:[a-zA-Z0-9-_]+$\",Description:\"The
                Connect Events Lambda F\\"
              - "unction
                ARN.\"},LambdaArnConnectRouting:{Type:\"String\",AllowedPattern:\
                \"^arn:aws:l\\"
              - "ambda:[-a-z]+[0-9]+:[0-9]{12}:function:[a-zA-Z0-9-_]+$\",Descr\
                iption:\"The Connect\\"
              - " Routing Lambda Function
                ARN.\"},TimeoutBeforeBuild:{Type:\"Number\",Default:30,Descript\
                ion:\"\\"
              - "After each change is seen, how many seconds to wait for more
                changes before buil\\"
              - "ding the
                bot.\"},ParentStackArn:{Type:\"String\",AllowedPattern:\"^arn:a\
                ws:cloudform\\"
              - "ation:[-a-z]+[0-9]+:[0-9]{12}:stack/[a-zA-Z0-9-]+/[a-z0-9-]{8}\
                -[a-z0-9-]{4}-[a-z\\"
              - "0-9-]{4}-[a-z0-9-]{4}-[a-z0-9-]{12}$\",Description:\"The ARN of
                the Vocaldex app s\\"
              - "tack we're part
                of.\"}},Resources:{AutoSyncRoleB111CBF7:{Type:\"AWS::IAM::Role\
                \",Properties:{"
              - "AssumeRolePolicyDocument:{Statement:[{Action:\"sts:AssumeRole\
                \",Effect:\"Allow\",Principal:{"
              - "Service:\"states.amazonaws.com\"}}],Version:\"2012-10-17\"},Po\
                licies:[{PolicyDocument:{"
              - "Statement:[{Action:[\"iam:AttachRolePolicy\",\"iam:CreateRole\
                \",\"iam:DeleteRole\",\"ia\\"
              - "m:DeleteRolePolicy\",\"iam:DetachRolePolicy\",\"iam:GetRole\",\
                \"iam:GetRolePolicy\",\"ia\\"
              - "m:ListAttachedRolePolicies\",\"iam:ListRolePolicies\",\"iam:Pa\
                ssRole\",\"iam:PutRolePo\\"
              - "licy\",\"iam:TagRole\",\"iam:UntagRole\",\"iam:UpdateAssumeRol\
                ePolicy\",\"iam:UpdateRole\"],"
              - "Effect:\"Allow\",Resource:{\"Fn::Join\":[\"\",[\"arn:aws:iam::\
                \",{Ref:\"AWS::AccountId\"},"
              - "\":role/*\"]]}},{Action:[\"cloudformation:ContinueUpdateRollba\
                ck\",\"cloudformation:C\\"
              - "reateStack\",\"cloudformation:DeleteStack\",\"cloudformation:D\
                escribeStacks\",\"cloudf\\"
              - "ormation:RollbackStack\",\"cloudformation:TagResource\",\"clou\
                dformation:UpdateStack\","
              - "\"cloudformation:UpdateTerminationProtection\"],Effect:\"Allow\
                \",Resource:[{\"Fn::Joi\\"
              - "n\":[\"\",[\"arn:aws:cloudformation:\",{Ref:\"AWS::Region\"},\
                \":\",{Ref:\"AWS::AccountId\"},"
              - "\":changeSet/*/*\"]]},{\"Fn::Join\":[\"\",[\"arn:aws:cloudform\
                ation:\",{Ref:\"AWS::Region\"},"
              - "\":\",{Ref:\"AWS::AccountId\"},\":stack/VocaldexDirectory--\",{\
                \"Fn::Select\":[1,{\"Fn::S\\"
              - "plit\":[\"/\",{Ref:\"ConnectInstanceArn\"}]}]},\"--*/*\"]]},{\
                \"Fn::Join\":[\"\",[\"arn:aws:c\\"
              - "loudformation:\",{Ref:\"AWS::Region\"},\":\",{Ref:\"AWS::Accou\
                ntId\"},\":stackset/*:*\"]]}]},"
              - "{Action:[\"cloudformation:ListStacks\",\"cloudformation:Update\
                GeneratedTemplate\"],Effect:\"\\"
              - "Allow\",Resource:{\"Fn::Join\":[\"\",[\"arn:aws:cloudformation:\
                \",{Ref:\"AWS::Region\"},\"\\"
              - ":\",{Ref:\"AWS::AccountId\"},\":stack/VocaldexDirectory--\",{\
                \"Fn::Select\":[1,{\"Fn::Sp\\"
              - "lit\":[\"/\",{Ref:\"ConnectInstanceArn\"}]}]},\"--*/*\"]]}},{A\
                ction:[\"connect:Associate\\"
              - "Bot\",\"connect:CreateContactFlowModule\",\"connect:DeleteCont\
                actFlowModule\",\"connec\\"
              - "t:DisassociateBot\",\"connect:ListBots\",\"connect:TagResource\
                \",\"connect:UntagResour\\"
              - "ce\",\"connect:UpdateContactFlowModuleContent\",\"connect:Upda\
                teContactFlowModuleMet\\"
              - "adata\",\"iam:AttachRolePolicy\",\"iam:CreateServiceLinkedRole\
                \",\"iam:PutRolePolicy\","
              - "\"lex:CreateResourcePolicy\",\"lex:DeleteResourcePolicy\",\"le\
                x:DescribeBotAlias\",\"le\\"
              - "x:UpdateResourcePolicy\"],Effect:\"Allow\",Resource:[{\"Fn::Jo\
                in\":[\"\",[\"arn:aws:conn\\"
              - "ect:\",{Ref:\"AWS::Region\"},\":\",{Ref:\"AWS::AccountId\"},\"\
                :instance/\",{\"Fn::Select\":["
              - "1,{\"Fn::Split\":[\"/\",{Ref:\"ConnectInstanceArn\"}]}]},\"/fl\
                ow-module/*\"]]},{\"Fn::Joi\\"
              - "n\":[\"\",[\"arn:aws:connect:\",{Ref:\"AWS::Region\"},\":\",{R\
                ef:\"AWS::AccountId\"},\":inst\\"
              - "ance/\",{\"Fn::Select\":[1,{\"Fn::Split\":[\"/\",{Ref:\"Connec\
                tInstanceArn\"}]}]}]]},{\"Fn\\"
              - "::Join\":[\"\",[\"arn:aws:iam::\",{Ref:\"AWS::AccountId\"},\":\
                role/*\"]]},{\"Fn::Join\":[\"\","
              - "[\"arn:aws:lex:\",{Ref:\"AWS::Region\"},\":\",{Ref:\"AWS::Acco\
                untId\"},\":bot-alias/Vocal\\"
              - "dex_\",{\"Fn::Select\":[1,{\"Fn::Split\":[\"/\",{Ref:\"Connect\
                InstanceArn\"}]}]},\"_*/*\"]]},"
              - "{\"Fn::Join\":[\"\",[\"arn:aws:lex:\",{Ref:\"AWS::Region\"},\":\
                \",{Ref:\"AWS::AccountId\"},\"\\"
              - ":bot/Vocaldex_\",{\"Fn::Select\":[1,{\"Fn::Split\":[\"/\",{Ref:\
                \"ConnectInstanceArn\"}]}]},"
              - "\"_*\"]]}]},{Action:[\"events:DeleteRule\",\"events:DescribeRu\
                le\",\"events:ListTargets\\"
              - "ByRule\",\"events:PutRule\",\"events:PutTargets\",\"events:Rem\
                oveTargets\",\"events:TagR\\"
              - "esource\",\"events:UntagResource\"],Effect:\"Allow\",Resource:\
                [{\"Fn::Join\":[\"\",[\"arn:\\"
              - "aws:events:\",{Ref:\"AWS::Region\"},\":\",{Ref:\"AWS::AccountId\
                \"},\":event-bus/*\"]]},{\"\\"
              - "Fn::Join\":[\"\",[\"arn:aws:events:\",{Ref:\"AWS::Region\"},\":\
                \",{Ref:\"AWS::AccountId\"},"
              - "\":rule/*\"]]},{\"Fn::Join\":[\"\",[\"arn:aws:events:\",{Ref:\
                \"AWS::Region\"},\":\",{Ref:\"AW\\"
              - "S::AccountId\"},\":rule/VocaldexDirectory-*\"]]}]},{Action:[\"\
                kms:CreateGrant\",\"kms:\\"
              - "Decrypt\",\"kms:DescribeKey\",\"kms:Encrypt\"],Effect:\"Allow\
                \",Resource:{\"Fn::Join\":[\"\","
              - "[\"arn:aws:kms:\",{Ref:\"AWS::Region\"},\":\",{Ref:\"AWS::Acco\
                untId\"},\":key/*\"]]}},{Action:["
              - "\"lambda:AddPermission\",\"lambda:CreateAlias\",\"lambda:Creat\
                eFunction\",\"lambda:Dele\\"
              - "teAlias\",\"lambda:DeleteFunction\",\"lambda:GetAlias\",\"lamb\
                da:GetFunction\",\"lambda:\\"
              - "GetFunctionCodeSigningConfig\",\"lambda:GetPolicy\",\"lambda:G\
                etRuntimeManagementCon\\"
              - "fig\",\"lambda:PublishVersion\",\"lambda:PutRuntimeManagementC\
                onfig\",\"lambda:RemoveP\\"
              - "ermission\",\"lambda:TagResource\",\"lambda:UntagResource\",\"\
                lambda:UpdateAlias\",\"lam\\"
              - "bda:UpdateFunctionCode\",\"lambda:UpdateFunctionConfiguration\
                \"],Effect:\"Allow\",Resource:{"
              - "\"Fn::Join\":[\"\",[\"arn:aws:lambda:\",{Ref:\"AWS::Region\"},\
                \":\",{Ref:\"AWS::AccountId\"},"
              - "\":function:*\"]]}},{Action:[\"lex:BuildBotLocale\",\"lex:Crea\
                teBot\",\"lex:CreateBotAl\\"
              - "ias\",\"lex:CreateBotLocale\",\"lex:CreateBotVersion\",\"lex:C\
                reateCustomVocabulary\",\"\\"
              - "lex:CreateIntent\",\"lex:CreateResourcePolicy\",\"lex:CreateSl\
                ot\",\"lex:CreateSlotTyp\\"
              - "e\",\"lex:DeleteBot\",\"lex:DeleteBotAlias\",\"lex:DeleteBotCh\
                annel\",\"lex:DeleteBotLoc\\"
              - "ale\",\"lex:DeleteBotVersion\",\"lex:DeleteCustomVocabulary\",\
                \"lex:DeleteIntent\",\"lex\\"
              - ":DeleteResourcePolicy\",\"lex:DeleteSlot\",\"lex:DeleteSlotType\
                \",\"lex:DeleteTestSet\","
              - "\"lex:DescribeBot\",\"lex:DescribeBotAlias\",\"lex:DescribeBot\
                Locale\",\"lex:DescribeBo\\"
              - "tVersion\",\"lex:DescribeImport\",\"lex:ListBotLocales\",\"lex\
                :StartImport\",\"lex:TagRe\\"
              - "source\",\"lex:UntagResource\",\"lex:UpdateBot\",\"lex:UpdateB\
                otAlias\",\"lex:UpdateBotL\\"
              - "ocale\",\"lex:UpdateCustomVocabulary\",\"lex:UpdateIntent\",\"\
                lex:UpdateResourcePolicy\","
              - "\"lex:UpdateSlot\",\"lex:UpdateSlotType\",\"lex:UpdateTestSet\
                \"],Effect:\"Allow\",Resource:["
              - "{\"Fn::Join\":[\"\",[\"arn:aws:lex:\",{Ref:\"AWS::Region\"},\":\
                \",{Ref:\"AWS::AccountId\"},\"\\"
              - ":bot-alias/*\"]]},{\"Fn::Join\":[\"\",[\"arn:aws:lex:\",{Ref:\
                \"AWS::Region\"},\":\",{Ref:\"A\\"
              - "WS::AccountId\"},\":bot/*\"]]},{\"Fn::Join\":[\"\",[\"arn:aws:\
                lex:\",{Ref:\"AWS::Region\"},"
              - "\":\",{Ref:\"AWS::AccountId\"},\":test-set/*\"]]}]},{Action:[\
                \"lex:CreateTestSet\",\"lex:\\"
              - "CreateUploadUrl\",\"lex:ListBots\"],Effect:\"Allow\",Resource:\
                \"*\"},{Action:\"logs:Crea\\"
              - "teLogGroup\",Effect:\"Allow\",Resource:{\"Fn::Join\":[\"\",[\"\
                arn:aws:logs:\",{Ref:\"AWS::\\"
              - "Region\"},\":\",{Ref:\"AWS::AccountId\"},\":log-group:*\"]]}},\
                {Action:\"logs:CreateLogSt\\"
              - "ream\",Effect:\"Allow\",Resource:{\"Fn::Join\":[\"\",[\"arn:aw\
                s:logs:\",{Ref:\"AWS::Region\"},"
              - "\":\",{Ref:\"AWS::AccountId\"},\":log-group:*:log-stream:*\"]]\
                }},{Action:[\"states:Crea\\"
              - "teStateMachine\",\"states:DeleteStateMachine\",\"states:Descri\
                beStateMachine\",\"state\\"
              - "s:PublishStateMachineVersion\",\"states:TagResource\",\"states\
                :UntagResource\",\"state\\"
              - "s:UpdateStateMachine\"],Effect:\"Allow\",Resource:[{\"Fn::Join\
                \":[\"\",[\"arn:aws:states\\"
              - ":\",{Ref:\"AWS::Region\"},\":\",{Ref:\"AWS::AccountId\"},\":ac\
                tivity:*\"]]},{\"Fn::Join\":["
              - "\"\",[\"arn:aws:states:\",{Ref:\"AWS::Region\"},\":\",{Ref:\"A\
                WS::AccountId\"},\":stateMach\\"
              - "ine:*\"]]}]}],Version:\"2012-10-17\"},PolicyName:\"TeardownPol\
                icy\"}]}},AutoSyncRoleDefaultPolicy09B77A1F:{"
              - "Type:\"AWS::IAM::Policy\",Properties:{PolicyDocument:{Statemen\
                t:[{Action:\"cloudfor\\"
              - "mation:DeleteStack\",Effect:\"Allow\",Resource:\"*\"},{Action:\
                \"lambda:InvokeFunction\","
              - "Effect:\"Allow\",Resource:[{\"Fn::Join\":[\"\",[{Ref:\"LambdaA\
                rnBotBuild\"},\":*\"]]},{Ref:\"\\"
              - "LambdaArnBotBuild\"}]}],Version:\"2012-10-17\"},PolicyName:\"A\
                utoSyncRoleDefaultPoli\\"
              - "cy09B77A1F\",Roles:[{Ref:\"AutoSyncRoleB111CBF7\"}]}},AutoSync\
                MachineFFDAA169:{Type:\"\\"
              - "AWS::StepFunctions::StateMachine\",Properties:{DefinitionStrin\
                g:{\"Fn::Join\":[\"\",["
              - "`{\"StartAt\":\"WhatStatus?\",\"States\":{\"WhatStatus?\":{\"T\
                ype\":\"Choice\",\"Choices\":[{\"\\"
              - "Variable\":\"$.detail['status-details'].status\",\"StringEquals\
                \":\"DELETE_IN_PROGRESS\\"
              - "\",\"Next\":\"DeleteStack\"},{\"Variable\":\"$.detail['status-\
                details'].status\",\"StringE\\"
              - "quals\":\"UPDATE_COMPLETE\",\"Next\":\"AutoSyncLambdaInvocation\
                \"}],\"Default\":\"Unhandle\\"
              - "dState\"},\"UnhandledState\":{\"Type\":\"Succeed\"},\"DeleteSt\
                ack\":{\"Next\":\"DeleteFinish\\"
              - "ed\",\"Type\":\"Task\",\"Resource\":\"arn:`,{Ref:\"AWS::Partit\
                ion\"},':states:::aws-sdk:cl\\"
              - "oudformation:deleteStack\",\"Parameters\":{\"StackName\":\"',{\
                Ref:\"AWS::StackName\"},'\"\\"
              - "}},\"DeleteFinished\":{\"Type\":\"Succeed\"},\"AutoSyncLambdaI\
                nvocation\":{\"Next\":\"Updat\\"
              - "eFinished\",\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecut\
                ionTimeoutException\",\"La\\"
              - "mbda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda\
                .SdkClientException\"],\\"
              - "\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"\
                Type\":\"Task\",\"Resource\":\"\\"
              - "arn:',{Ref:\"AWS::Partition\"},':states:::lambda:invoke\",\"Pa\
                rameters\":{\"FunctionNa\\"
              - "me\":\"',{Ref:\"LambdaArnBotBuild\"},'\",\"Payload\":{\"Direct\
                oryId\":\"',{Ref:\"DirectoryI\\"
              - "d\"},'\"},\"InvocationType\":\"Event\"}},\"UpdateFinished\":{\
                \"Type\":\"Succeed\"}}}']]},RoleArn:{"
              - "\"Fn::GetAtt\":[\"AutoSyncRoleB111CBF7\",\"Arn\"]},StateMachin\
                eName:{\"Fn::Join\":[\"\",[{"
              - "\"Fn::Join\":[\"--\",[\"Vocaldex\",{\"Fn::Select\":[1,{\"Fn::S\
                plit\":[\"/\",{Ref:\"ConnectIns\\"
              - "tanceArn\"}]}]},{Ref:\"DirectoryId\"}]]},\"-Sync\"]]}},Depends\
                On:[\"AutoSyncRoleDefaul\\"
              - "tPolicy09B77A1F\"],UpdateReplacePolicy:\"Delete\",DeletionPoli\
                cy:\"Delete\"},AutoSyncMachineEventsRole1F95835C:{"
              - "Type:\"AWS::IAM::Role\",Properties:{AssumeRolePolicyDocument:{\
                Statement:[{Action:\"\\"
              - "sts:AssumeRole\",Effect:\"Allow\",Principal:{Service:\"events.\
                amazonaws.com\"}}],Version:\"\\"
              - "2012-10-17\"}}},AutoSyncMachineEventsRoleDefaultPolicy744E4F8B\
                :{Type:\"AWS::IAM::P\\"
              - "olicy\",Properties:{PolicyDocument:{Statement:[{Action:\"state\
                s:StartExecution\",Effect:\"\\"
              - "Allow\",Resource:{Ref:\"AutoSyncMachineFFDAA169\"}}],Version:\
                \"2012-10-17\"},PolicyName:\"\\"
              - "AutoSyncMachineEventsRoleDefaultPolicy744E4F8B\",Roles:[{Ref:\
                \"AutoSyncMachineEven\\"
              - "tsRole1F95835C\"}]}},CloudFormationTriggerC07B0381:{Type:\"AWS\
                ::Events::Rule\",Properties:{"
              - "EventPattern:{source:[\"aws.cloudformation\"],\"detail-type\":[\
                \"CloudFormation Stack\\"
              - " Status
                Change\"],detail:{\"stack-id\":[{Ref:\"ParentStackArn\"}],\"sta\
                tus-details.sta\\"
              - "tus\":[\"DELETE_IN_PROGRESS\",\"UPDATE_COMPLETE\"]}},State:\"E\
                NABLED\",Targets:[{Arn:{Ref:\"\\"
              - "AutoSyncMachineFFDAA169\"},Id:\"Target0\",RoleArn:{\"Fn::GetAtt\
                \":[\"AutoSyncMachineEv\\"
              - "entsRole1F95835C\",\"Arn\"]}}]}},VocaldexStateMachineRole5FB0A\
                555:{Type:\"AWS::IAM::\\"
              - "Role\",Properties:{AssumeRolePolicyDocument:{Statement:[{Actio\
                n:\"sts:AssumeRole\","
              - "Effect:\"Allow\",Principal:{Service:\"states.amazonaws.com\"}}\
                ],Version:\"2012-10-17\"}}},"
              - "VocaldexStateMachineRoleDefaultPolicyE15BAA10:{Type:\"AWS::IAM\
                ::Policy\",Properties:{"
              - "PolicyDocument:{Statement:[{Action:\"states:ListExecutions\",E\
                ffect:\"Allow\",Resource:\"\\"
              - "*\"},{Action:\"lambda:InvokeFunction\",Effect:\"Allow\",Resour\
                ce:[{\"Fn::Join\":[\"\",[{Ref:\"\\"
              - "LambdaArnBotBuild\"},\":*\"]]},{Ref:\"LambdaArnBotBuild\"}]}],\
                Version:\"2012-10-17\"},PolicyName:\"\\"
              - "VocaldexStateMachineRoleDefaultPolicyE15BAA10\",Roles:[{Ref:\"\
                VocaldexStateMachine\\"
              - "Role5FB0A555\"}]}},VocaldexStateMachine01FF5711:{Type:\"AWS::S\
                tepFunctions::StateM\\"
              - "achine\",Properties:{DefinitionString:{\"Fn::Join\":[\"\",['{\
                \"StartAt\":\"Wait\",\"States\\"
              - "\":{\"Wait\":{\"Type\":\"Wait\",\"Seconds\":',{Ref:\"TimeoutBe\
                foreBuild\"},',\"Next\":\"ListEx\\"
              - "ecutions\"},\"ListExecutions\":{\"Next\":\"Should
                Build?\",\"Type\":\"Task\",\"ResultSelecto\\"
              - "r\":{\"count.$\":\"States.ArrayLength($.Executions)\"},\"Resou\
                rce\":\"arn:',{Ref:\"AWS::P\\"
              - "artition\"},':states:::aws-sdk:sfn:listExecutions\",\"Paramete\
                rs\":{\"StateMachineArn\\"
              - ".$\":\"$$.StateMachine.Id\",\"StatusFilter\":\"RUNNING\"}},\"S\
                hould Build?\":{\"Type\":\"Cho\\"
              - "ice\",\"Choices\":[{\"Variable\":\"$.count\",\"NumericEquals\"\
                :1,\"Next\":\"BuildBotLambdaIn\\"
              - "vocation\"}],\"Default\":\"Finished\"},\"Finished\":{\"Type\":\
                \"Succeed\"},\"BuildBotLambdaI\\"
              - "nvocation\":{\"Next\":\"Finished\",\"Retry\":[{\"ErrorEquals\"\
                :[\"Lambda.ClientExecutionTi\\"
              - "meoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambd\
                aException\",\"Lambda.Sd\\"
              - "kClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"\
                BackoffRate\":2}],\"Type\":\\"
              - "\"Task\",\"Resource\":\"arn:',{Ref:\"AWS::Partition\"},':state\
                s:::lambda:invoke\",\"Param\\"
              - "eters\":{\"FunctionName\":\"',{Ref:\"LambdaArnBotBuild\"},'\",\
                \"Payload\":{\"DirectoryId\":\\"
              - "\"',{Ref:\"DirectoryId\"},'\"},\"InvocationType\":\"Event\"}}}\
                }']]},RoleArn:{\"Fn::GetAtt\":["
              - "\"VocaldexStateMachineRole5FB0A555\",\"Arn\"]},StateMachineNam\
                e:{\"Fn::Join\":[\"\",[{\"F\\"
              - "n::Join\":[\"--\",[\"Vocaldex\",{\"Fn::Select\":[1,{\"Fn::Split\
                \":[\"/\",{Ref:\"ConnectInsta\\"
              - "nceArn\"}]}]},{Ref:\"DirectoryId\"}]]},\"-Directory\"]]}},Depe\
                ndsOn:[\"VocaldexStateMa\\"
              - "chineRoleDefaultPolicyE15BAA10\"],UpdateReplacePolicy:\"Delete\
                \",DeletionPolicy:\"De\\"
              - "lete\"},LexRoleD3586196:{Type:\"AWS::IAM::Role\",Properties:{A\
                ssumeRolePolicyDocument:{"
              - "Statement:[{Action:\"sts:AssumeRole\",Effect:\"Allow\",Princip\
                al:{Service:\"lexv2.ama\\"
              - "zonaws.com\"}}],Version:\"2012-10-17\"},Path:\"/\"}},LexPolicy\
                1AC3FF80:{Type:\"AWS::IA\\"
              - "M::Policy\",Properties:{PolicyDocument:{Statement:[{Action:[\"\
                comprehend:DetectSen\\"
              - "timent\",\"polly:SynthesizeSpeech\"],Effect:\"Allow\",Resource:\
                \"*\"}],Version:\"2012-10\\"
              - "-17\"},PolicyName:\"LexPolicy\",Roles:[{Ref:\"LexRoleD3586196\
                \"}]}},VocaldexLexBot:{Type:\"\\"
              - "AWS::Lex::Bot\",Properties:{AutoBuildBotLocales:!0,BotLocales:\
                [{Intents:[{DialogCodeHook:{"
              - "Enabled:!1},InitialResponseSetting:{InitialResponse:{AllowInte\
                rrupt:!0,MessageGroupsList:["
              - "{Message:{PlainTextMessage:{Value:\"One moment,
                please\"}}}]},NextStep:{DialogAction:{"
              - "SlotToElicit:\"dNameLookup\",Type:\"ElicitSlot\"},Intent:{}}},\
                Name:\"getContact\",SampleUtterances:["
              - "{Utterance:\"Directory\"},{Utterance:\"{dNameLookup}\"},{Utter\
                ance:\"I want to reach \\"
              - "{dNameLookup}\"}],SlotPriorities:[{Priority:1,SlotName:\"dName\
                Lookup\"}],Slots:[{MultipleValuesSetting:{"
              - "AllowMultipleValues:!1},Name:\"dNameLookup\",SlotTypeName:\"dN\
                ameLookup\",ValueElicitationSetting:{"
              - "PromptSpecification:{AllowInterrupt:!0,MaxRetries:4,MessageGro\
                upsList:[{Message:{"
              - "PlainTextMessage:{Value:\"What is the name for the person you
                would like to reach\\"
              - "?\"}}}]},SlotConstraint:\"Required\"}}]},{DialogCodeHook:{Enab\
                led:!1},InitialResponseSetting:{"
              - "CodeHook:{EnableCodeHookInvocation:!0,IsActive:!0,PostCodeHook\
                Specification:{FailureNextStep:{"
              - "DialogAction:{Type:\"EndConversation\"}},SuccessNextStep:{Dial\
                ogAction:{Type:\"EndC\\"
              - "onversation\"}},TimeoutNextStep:{DialogAction:{Type:\"EndConve\
                rsation\"}}}},NextStep:{"
              - "DialogAction:{Type:\"InvokeDialogCodeHook\"}}},Name:\"Yes\",Sa\
                mpleUtterances:[{Utterance:\"\\"
              - "yes\"},{Utterance:\"yeah\"},{Utterance:\"yes,
                please\"},{Utterance:\"sure\"},{Utterance:\"\\"
              - "ok\"},{Utterance:\"okay\"},{Utterance:\"cool\"},{Utterance:\"a\
                ffirmative\"},{Utterance:\"\\"
              - "of
                course\"},{Utterance:\"definitely\"},{Utterance:\"certainly\"},\
                {Utterance:\"indeed\"},"
              - "{Utterance:\"you bet\"},{Utterance:\"without a
                doubt\"},{Utterance:\"correct\"},{Utterance:\"\\"
              - "that's
                correct\"}]},{DialogCodeHook:{Enabled:!1},InitialResponseSettin\
                g:{CodeHook:{"
              - "EnableCodeHookInvocation:!0,IsActive:!0,PostCodeHookSpecificat\
                ion:{FailureNextStep:{"
              - "DialogAction:{Type:\"EndConversation\"}},SuccessNextStep:{Dial\
                ogAction:{Type:\"EndC\\"
              - "onversation\"}},TimeoutNextStep:{DialogAction:{Type:\"EndConve\
                rsation\"}}}},NextStep:{"
              - "DialogAction:{Type:\"InvokeDialogCodeHook\"}}},Name:\"No\",Sam\
                pleUtterances:[{Utterance:\"\\"
              - "No\"},{Utterance:\"nope\"},{Utterance:\"nah\"},{Utterance:\"no
                thanks\"},{Utterance:\"no\\"
              - ", thanks\"},{Utterance:\"no, thank you\"},{Utterance:\"not a
                chance\"},{Utterance:\"ne\\"
              - "gative\"},{Utterance:\"definitely
                not\"},{Utterance:\"sorry\"},{Utterance:\"not at all\"},"
              - "{Utterance:\"hell no\"},{Utterance:\"heck
                no\"}]},{DialogCodeHook:{Enabled:!1},InitialResponseSetting:{"
              - "CodeHook:{EnableCodeHookInvocation:!0,IsActive:!0,PostCodeHook\
                Specification:{FailureNextStep:{"
              - "DialogAction:{Type:\"EndConversation\"}},SuccessNextStep:{Dial\
                ogAction:{Type:\"EndC\\"
              - "onversation\"}},TimeoutNextStep:{DialogAction:{Type:\"EndConve\
                rsation\"}}}},NextStep:{"
              - "DialogAction:{Type:\"InvokeDialogCodeHook\"}}},Name:\"Fallback\
                Intent\",ParentIntentSignature:\"\\"
              - "AMAZON.FallbackIntent\"}],LocaleId:\"en_US\",NluConfidenceThre\
                shold:.4,SlotTypes:[{"
              - "Description:\"Resolves a destination name to the Vocaldex
                ID\",Name:\"dNameLookup\","
              - "SlotTypeValues:[{SampleValue:{Value:\"init\"},Synonyms:[{Value:\
                \"a1b2c3d4e5f6g7h8i9\\"
              - "j0\"}]}],ValueSelectionSetting:{AdvancedRecognitionSetting:{Au\
                dioRecognitionStrategy:\"\\"
              - "UseSlotValuesAsCustomVocabulary\"},ResolutionStrategy:\"TOP_RE\
                SOLUTION\"}}],VoiceSettings:{"
              - "Engine:\"neural\",VoiceId:\"Ivy\"}}],DataPrivacy:{ChildDirecte\
                d:!1},Description:{\"Fn\\"
              - "::Join\":[\"\",[\"Vocaldex '\",{Ref:\"DirectoryName\"},\"'
                Directory\"]]},IdleSessionTTLInSeconds:300,"
              - "Name:{\"Fn::Join\":[\"_\",[\"Vocaldex\",{\"Fn::Select\":[1,{\"\
                Fn::Split\":[\"/\",{Ref:\"Conne\\"
              - "ctInstanceArn\"}]}]},{Ref:\"DirectoryId\"}]]},RoleArn:{\"Fn::G\
                etAtt\":[\"LexRoleD35861\\"
              - "96\",\"Arn\"]}}},VocaldexLexBotVersion:{Type:\"AWS::Lex::BotVe\
                rsion\",Properties:{BotId:{"
              - "Ref:\"VocaldexLexBot\"},BotVersionLocaleSpecification:[{BotVer\
                sionLocaleDetails:{SourceBotVersion:\"\\"
              - "DRAFT\"},LocaleId:\"en_US\"}]},DependsOn:[]},VocaldexLexBotAli\
                as:{Type:\"AWS::Lex::B\\"
              - "otAlias\",Properties:{BotAliasLocaleSettings:[{BotAliasLocaleS\
                etting:{Enabled:!0},"
              - "LocaleId:\"en_US\"}],BotAliasName:\"active\",BotId:{Ref:\"Voca\
                ldexLexBot\"},BotVersion:{"
              - "\"Fn::Select\":[1,{\"Fn::Split\":[\"|\",{Ref:\"VocaldexLexBotV\
                ersion\"}]}]},SentimentAnalysisSettings:{"
              - "DetectSentiment:!1}},DependsOn:[]},VocaldexConnectIntegrationB\
                ot:{Type:\"AWS::Con\\"
              - "nect::IntegrationAssociation\",Properties:{InstanceId:{Ref:\"C\
                onnectInstanceArn\"},"
              - "IntegrationArn:{\"Fn::GetAtt\":[\"VocaldexLexBotAlias\",\"Arn\
                \"]},IntegrationType:\"LEX\\"
              - "_BOT\"}},VocaldexConnectModule:{Type:\"AWS::Connect::ContactFl\
                owModule\",Properties:{"
              - "Content:{\"Fn::Join\":[\"\",['{\"Version\":\"2019-10-30\",\"St\
                artAction\":\"Enable Logging\"\\"
              - ",\"Metadata\":{\"entryPointPosition\":{\"x\":-1012.8,\"y\":-12\
                04.8},\"ActionMetadata\":{\"S\\"
              - "et Logging
                Keys\":{\"position\":{\"x\":-868,\"y\":-888},\"isFriendlyName\"\
                :true,\"dynamicP\\"
              - "arams\":[]},\"Set Vocaldex
                Context\":{\"position\":{\"x\":-871.2,\"y\":-660},\"isFriendlyN\
                \\"
              - "ame\":true,\"dynamicParams\":[]},\"78d32efd-3a08-4c8d-a9b6-674\
                5be0e5b95\":{\"position\"\\"
              - ":{\"x\":1856,\"y\":-826.4}},\"Check Lex
                ARN\":{\"position\":{\"x\":94.4,\"y\":-1483.2},\"isFr\\"
              - "iendlyName\":true,\"conditions\":[],\"conditionMetadata\":[{\"\
                id\":\"c6cb5980-577f-4e9a-\\"
              - "af2a-c98f3f4f2921\",\"operator\":{\"name\":\"Starts
                with\",\"value\":\"StartsWith\",\"shortD\\"
              - "isplay\":\"starts
                with\"},\"value\":\"arn:aws:lex:\"}]},\"12763fe9-52e0-4b56-9e7c\
                -57d626\\"
              - "7ea5e3\":{\"position\":{\"x\":340.8,\"y\":-896}},\"Loop Fail
                Out Prompt\":{\"position\":{\"x\\"
              - "\":103.2,\"y\":-952},\"isFriendlyName\":true},\"Retry Lookup
                Prompt\":{\"position\":{\"x\":\\"
              - "1292.8,\"y\":-1259.2},\"isFriendlyName\":true},\"Error Return
                Prompt\":{\"position\":{\"x\\"
              - "\":1586.4,\"y\":-873.6},\"isFriendlyName\":true},\"Initial
                Loop\":{\"position\":{\"x\":-196\\"
              - ",\"y\":-1057.6},\"isFriendlyName\":true},\"Lookup Retry
                Prompt\":{\"position\":{\"x\":4091\\"
              - ".2,\"y\":-345.6},\"isFriendlyName\":true},\"3a106662-1f93-4fae\
                -a136-1943d5020cf8\":{\"p\\"
              - "osition\":{\"x\":5596,\"y\":-956.8}},\"ec0460d1-e556-45c4-82a2\
                -3a41a3cd552b\":{\"positio\\"
              - "n\":{\"x\":5971.2,\"y\":-1012}},\"3580553f-e91e-4fdf-9181-2417\
                e77d6254\":{\"position\":{\"\\"
              - "x\":7516,\"y\":-226.4},\"parameters\":{\"TimeLimitSeconds\":{\
                \"unit\":1}},\"timeoutUnit\":{\\"
              - "\"display\":\"Seconds\",\"value\":\"second\"}},\"4dfcb359-dec5\
                -4266-be3d-a59e6a723a11\":{\"\\"
              - "position\":{\"x\":7827.2,\"y\":-162.4}},\"d3071ee8-a045-4443-b\
                85d-bad5db4560c4\":{\"posi\\"
              - "tion\":{\"x\":7606.4,\"y\":-684}},\"Event Logging - Lookup
                Match | Transfer Out\":{\"pos\\"
              - "ition\":{\"x\":7212,\"y\":-779.2},\"isFriendlyName\":true,\"pa\
                rameters\":{\"LambdaFunction\\"
              - "ARN\":{\"useDynamic\":true},\"LambdaInvocationAttributes\":{\"\
                directoryId\":{\"useDynami\\"
              - "c\":true}}},\"dynamicMetadata\":{\"directoryId\":true,\"direct\
                oryName\":false,\"eventTyp\\"
              - "e\":false},\"useDynamic\":true},\"Check for External
                Number\":{\"position\":{\"x\":6177.6\\"
              - ",\"y\":-753.6},\"isFriendlyName\":true,\"conditions\":[],\"con\
                ditionMetadata\":[{\"id\":\"4\\"
              - "057e464-e16d-4adf-883d-aa8feedbbd4a\",\"operator\":{\"name\":\
                \"Starts with\",\"value\":\"S\\"
              - "tartsWith\",\"shortDisplay\":\"starts
                with\"},\"value\":\"+1\"},{\"id\":\"6963ceda-f33f-483c\\"
              - "-9250-12bd25b046c0\",\"operator\":{\"name\":\"Equals\",\"value\
                \":\"Equals\",\"shortDisplay\":\\"
              - "\"=\"},\"value\":\"CHAT\"}]},\"Unreachable
                Prompt\":{\"position\":{\"x\":7190.4,\"y\":-289.6},\\"
              - "\"isFriendlyName\":true},\"dbcd1335-443d-42ba-ab44-60aec594cfc2\
                \":{\"position\":{\"x\":6\\"
              - "821.6,\"y\":-784.8},\"parameters\":{\"ThirdPartyPhoneNumber\":{\
                \"useDynamic\":true}}},\"E\\"
              - "vent Logging - Lookkup Miss |
                Unreachable\":{\"position\":{\"x\":6808.8,\"y\":-344.8},\"\\"
              - "isFriendlyName\":true,\"parameters\":{\"LambdaFunctionARN\":{\
                \"useDynamic\":true},\"Lamb\\"
              - "daInvocationAttributes\":{\"directoryId\":{\"useDynamic\":true\
                }}},\"dynamicMetadata\":{\\"
              - "\"directoryId\":true,\"directoryName\":false,\"eventType\":fal\
                se},\"useDynamic\":true},\"\\"
              - "Check for Internal
                Contact\":{\"position\":{\"x\":4696,\"y\":-605.6},\"isFriendlyN\
                ame\":t\\"
              - "rue,\"conditions\":[],\"conditionMetadata\":[{\"id\":\"5b9105a\
                e-006d-485c-a2e6-6d8652c5\\"
              - "d6f6\",\"operator\":{\"name\":\"Contains\",\"value\":\"Contains\
                \",\"shortDisplay\":\"contains\"\\"
              - "},\"value\":\"-\"}]},\"Set Internal
                Queue\":{\"position\":{\"x\":5284.8,\"y\":-846.4},\"isFri\\"
              - "endlyName\":true,\"parameters\":{\"AgentId\":{\"useDynamic\":t\
                rue}},\"useDynamic\":true},\\"
              - "\"Event Logging - Lookup Match |
                Internal\":{\"position\":{\"x\":4993.6,\"y\":-841.6},\"i\\"
              - "sFriendlyName\":true,\"parameters\":{\"LambdaFunctionARN\":{\"\
                useDynamic\":true},\"Lambd\\"
              - "aInvocationAttributes\":{\"directoryId\":{\"useDynamic\":true}\
                }},\"dynamicMetadata\":{\"\\"
              - "directoryId\":true,\"directoryName\":false,\"eventType\":false\
                },\"useDynamic\":true},\"0\\"
              - "db06349-2cfc-4de2-994d-ec8caa861cfe\":{\"position\":{\"x\":442\
                4.8,\"y\":-642.4},\"parame\\"
              - "ters\":{\"TimeLimitSeconds\":{\"unit\":1}},\"timeoutUnit\":{\"\
                display\":\"Seconds\",\"value\"\\"
              - ":\"second\"}},\"Lookup Retry
                Loop\":{\"position\":{\"x\":3819.2,\"y\":-344.8},\"isFriendlyN\
                \\"
              - "ame\":true},\"Event Logging - Lookup
                Miss\":{\"position\":{\"x\":3484.8,\"y\":-490.4},\"is\\"
              - "FriendlyName\":true,\"parameters\":{\"LambdaFunctionARN\":{\"u\
                seDynamic\":true},\"Lambda\\"
              - "InvocationAttributes\":{\"directoryId\":{\"useDynamic\":true}}\
                },\"dynamicMetadata\":{\"d\\"
              - "irectoryId\":true,\"directoryName\":false,\"eventType\":false},\
                \"useDynamic\":true},\"Ch\\"
              - "eck Channel
                Type\":{\"position\":{\"x\":2108.8,\"y\":-1484.8},\"isFriendlyN\
                ame\":true,\"co\\"
              - "nditions\":[],\"conditionMetadata\":[{\"id\":\"11109bc5-452f-4\
                423-b9eb-41a5d7b9f07e\",\"\\"
              - "operator\":{\"name\":\"Equals\",\"value\":\"Equals\",\"shortDi\
                splay\":\"=\"},\"value\":\"CHAT\"}]\\"
              - "},\"Event Logging - Lookup | Contact
                Info\":{\"position\":{\"x\":1804.8,\"y\":-1551.2},\"\\"
              - "isFriendlyName\":true,\"parameters\":{\"LambdaFunctionARN\":{\
                \"useDynamic\":true},\"Lamb\\"
              - "daInvocationAttributes\":{\"directoryId\":{\"useDynamic\":true\
                },\"destinationName\":{\"u\\"
              - "seDynamic\":true},\"destinationId\":{\"useDynamic\":true}}},\"\
                dynamicMetadata\":{\"direc\\"
              - "toryId\":true,\"directoryName\":false,\"eventType\":false,\"de\
                stinationName\":true,\"des\\"
              - "tinationId\":true},\"useDynamic\":true},\"Set Contact
                Information\":{\"position\":{\"x\":\\"
              - "1504,\"y\":-1655.2},\"isFriendlyName\":true,\"parameters\":{\"\
                Attributes\":{\"vocaldex_de\\"
              - "stinationId\":{\"useDynamic\":true}}},\"dynamicParams\":[\"voc\
                aldex_destinationId\"]},\"\\"
              - "Directory Lookup -
                Lambda\":{\"position\":{\"x\":1185.6,\"y\":-1587.2},\"isFriendl\
                yName\"\\"
              - ":true,\"parameters\":{\"LambdaFunctionARN\":{\"useDynamic\":tr\
                ue},\"LambdaInvocationAtt\\"
              - "ributes\":{\"dNameLookup\":{\"useDynamic\":true}}},\"dynamicMe\
                tadata\":{\"dNameLookup\":t\\"
              - "rue},\"useDynamic\":true},\"Retry Lookup
                Loop\":{\"position\":{\"x\":1064,\"y\":-1247.2},\"\\"
              - "isFriendlyName\":true},\"Set
                Directory\":{\"position\":{\"x\":-512.8,\"y\":-1283.2},\"isFr\\"
              - "iendlyName\":true,\"dynamicParams\":[]},\"Entry
                Prompt\":{\"position\":{\"x\":-495.2,\"y\":\\"
              - "-731.2},\"isFriendlyName\":true},\"Get
                Directory\":{\"position\":{\"x\":-498.4,\"y\":-1048\\"
              - ".8},\"isFriendlyName\":true,\"parameters\":{\"LambdaFunctionARN\
                \":{\"useDynamic\":true},\\"
              - "\"LambdaInvocationAttributes\":{\"directoryId\":{\"useDynamic\
                \":true}}},\"dynamicMetada\\"
              - "ta\":{\"directoryId\":true,\"directoryName\":false,\"eventType\
                \":false},\"useDynamic\":tr\\"
              - "ue},\"Set Application
                Tag\":{\"position\":{\"x\":-873.6,\"y\":-1095.2},\"isFriendlyNa\
                me\":\\"
              - "true},\"Enable
                Logging\":{\"position\":{\"x\":-872.8,\"y\":-1263.2},\"isFriend\
                lyName\":tru\\"
              - "e},\"Set Lookup
                Attempts\":{\"position\":{\"x\":415.2,\"y\":-1568.8},\"isFriend\
                lyName\":tr\\"
              - "ue,\"dynamicParams\":[]},\"Event Logging -
                Lookup\":{\"position\":{\"x\":951.2,\"y\":-1563\\"
              - ".2},\"isFriendlyName\":true,\"parameters\":{\"LambdaFunctionARN\
                \":{\"useDynamic\":true},\\"
              - "\"LambdaInvocationAttributes\":{\"directoryId\":{\"useDynamic\
                \":true}}},\"dynamicMetada\\"
              - "ta\":{\"directoryId\":true,\"directoryName\":false,\"eventType\
                \":false,\"lookupAttempt\":\\"
              - "false},\"useDynamic\":true},\"Event Logging - Lookup
                Error\":{\"position\":{\"x\":791.2,\\"
              - "\"y\":-1248},\"isFriendlyName\":true,\"parameters\":{\"LambdaF\
                unctionARN\":{\"useDynamic\"\\"
              - ":true},\"LambdaInvocationAttributes\":{\"directoryId\":{\"useD\
                ynamic\":true}}},\"dynami\\"
              - "cMetadata\":{\"directoryId\":true,\"directoryName\":false,\"ev\
                entType\":false,\"lookupAt\\"
              - "tempt\":false},\"useDynamic\":true},\"Directory -
                Lex\":{\"position\":{\"x\":688,\"y\":-156\\"
              - "8.8},\"isFriendlyName\":true,\"parameters\":{\"LexV2Bot\":{\"A\
                liasArn\":{\"useDynamic\":tr\\"
              - "ue,\"useLexBotDropdown\":false,\"lexV2BotName\":\"ASA-POC-DApp\
                \"}}},\"useDynamicLexBotA\\"
              - "rn\":true,\"lexV2BotName\":\"ASA-POC-DApp\",\"conditionMetadata\
                \":[]},\"Set Contact Info\\"
              - "rmation for
                Chat\":{\"position\":{\"x\":2482.4,\"y\":-1435.2},\"isFriendlyN\
                ame\":true,\"dy\\"
              - "namicParams\":[]},\"Set Contact Information for
                Voice\":{\"position\":{\"x\":2468.8,\"y\"\\"
              - ":-1224},\"isFriendlyName\":true,\"dynamicParams\":[]},\"Event
                Logging - Yes No | Yes\"\\"
              - ":{\"position\":{\"x\":3264.8,\"y\":-740.8},\"isFriendlyName\":\
                true,\"parameters\":{\"Lambda\\"
              - "FunctionARN\":{\"useDynamic\":true},\"LambdaInvocationAttribut\
                es\":{\"directoryId\":{\"u\\"
              - "seDynamic\":true}}},\"dynamicMetadata\":{\"directoryId\":true,\
                \"directoryName\":false,\"\\"
              - "eventType\":false},\"useDynamic\":true},\"Event Logging - Yes
                No | No\":{\"position\":{\\"
              - "\"x\":3259.2,\"y\":-550.4},\"isFriendlyName\":true,\"parameters\
                \":{\"LambdaFunctionARN\":{\\"
              - "\"useDynamic\":true},\"LambdaInvocationAttributes\":{\"directo\
                ryId\":{\"useDynamic\":tru\\"
              - "e}}},\"dynamicMetadata\":{\"directoryId\":true,\"directoryName\
                \":false,\"eventType\":fal\\"
              - "se},\"useDynamic\":true},\"Yes No Fail
                Prompt\":{\"position\":{\"x\":3412.8,\"y\":-224},\"i\\"
              - "sFriendlyName\":true},\"Event Logging - Yes No |
                Error\":{\"position\":{\"x\":3025.6,\"y\\"
              - "\":-234.4},\"isFriendlyName\":true,\"parameters\":{\"LambdaFun\
                ctionARN\":{\"useDynamic\":\\"
              - "true},\"LambdaInvocationAttributes\":{\"directoryId\":{\"useDy\
                namic\":true}}},\"dynamic\\"
              - "Metadata\":{\"directoryId\":true,\"directoryName\":false,\"eve\
                ntType\":false},\"useDynam\\"
              - "ic\":true},\"Confirm Transfer -
                Lex\":{\"position\":{\"x\":2983.2,\"y\":-644.8},\"isFriend\\"
              - "lyName\":true,\"parameters\":{\"LexV2Bot\":{\"AliasArn\":{\"us\
                eDynamic\":true,\"useLexBotD\\"
              - "ropdown\":false}}},\"useDynamicLexBotArn\":true,\"lexV2BotName\
                \":\"\",\"conditionMetadat\\"
              - "a\":[{\"id\":\"6b970d9c-f636-4be3-9287-6621da676d21\",\"operat\
                or\":{\"name\":\"Equals\",\"va\\"
              - "lue\":\"Equals\",\"shortDisplay\":\"=\"},\"value\":\"Yes\"},{\
                \"id\":\"ac9ce06d-cea5-41b4-88ac-\\"
              - "2642dfe4e69d\",\"operator\":{\"name\":\"Equals\",\"value\":\"E\
                quals\",\"shortDisplay\":\"=\"},\"\\"
              - "value\":\"No\"}]},\"Event Logging - Lookup
                Offer\":{\"position\":{\"x\":4102.4,\"y\":-672.8\\"
              - "},\"isFriendlyName\":true,\"parameters\":{\"LambdaFunctionARN\
                \":{\"useDynamic\":true},\"L\\"
              - "ambdaInvocationAttributes\":{\"directoryId\":{\"useDynamic\":t\
                rue}}},\"dynamicMetadata\\"
              - "\":{\"directoryId\":true,\"directoryName\":false,\"eventType\"\
                :false},\"useDynamic\":true\\"
              - "},\"Event Logging - Lookup
                Match\":{\"position\":{\"x\":3504,\"y\":-729.6},\"isFriendlyNa\
                \\"
              - "me\":true,\"parameters\":{\"LambdaFunctionARN\":{\"useDynamic\
                \":true},\"LambdaInvocation\\"
              - "Attributes\":{\"directoryId\":{\"useDynamic\":true}}},\"dynami\
                cMetadata\":{\"directoryId\\"
              - "\":true,\"directoryName\":false,\"eventType\":false},\"useDyna\
                mic\":true},\"Transfer To \\"
              - "Prompt\":{\"position\":{\"x\":3796.8,\"y\":-704.8},\"isFriendl\
                yName\":true}},\"Annotations\\"
              - "\":[],\"name\":\"Vocaldex: CMS Supportt\",\"description\":\"CMS
                Supportt (5j9m6qzgn4)\",\"\\"
              - "status\":\"published\",\"hash\":{}},\"Actions\":[{\"Parameters\
                \":{\"Attributes\":{\"LoggingP\\"
              - "ath\":\"$.Attributes.LoggingPath VocalDex-Voice |
                \",\"lookupAttempt\":\"$.Attributes.\\"
              - "lookupAttempt\"},\"TargetContact\":\"Current\"},\"Identifier\":\
                \"Set Logging Keys\",\"Type\\"
              - "\":\"UpdateContactAttributes\",\"Transitions\":{\"NextAction\":\
                \"Set Vocaldex Context\",\"\\"
              - "Errors\":[{\"NextAction\":\"Set Vocaldex
                Context\",\"ErrorType\":\"NoMatchingError\"}]}},\\"
              - "{\"Parameters\":{\"Attributes\":{\"ConnectEventsLambda\":\"',{\
                Ref:\"LambdaArnConnectEven\\"
              - "ts\"},'\",\"ConnectDestInfoLambda\":\"',{Ref:\"LambdaArnConnec\
                tDestinationInfo\"},'\",\"V\\"
              - "ocaldexBot\":\"',{\"Fn::GetAtt\":[\"VocaldexLexBotAlias\",\"Arn\
                \"]},`\"},\"TargetContact\":\\"
              - "\"Current\"},\"Identifier\":\"Set Vocaldex
                Context\",\"Type\":\"UpdateContactAttributes\",\\"
              - "\"Transitions\":{\"NextAction\":\"Set
                Directory\",\"Errors\":[{\"NextAction\":\"Set Directo\\"
              - "ry\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{},\
                \"Identifier\":\"78d32efd-3a\\"
              - "08-4c8d-a9b6-6745be0e5b95\",\"Type\":\"EndFlowModuleExecution\
                \",\"Transitions\":{}},{\"P\\"
              - "arameters\":{\"ComparisonValue\":\"$.Attributes.VocaldexBot\"},\
                \"Identifier\":\"Check Le\\"
              - "x
                ARN\",\"Type\":\"Compare\",\"Transitions\":{\"NextAction\":\"Er\
                ror Return Prompt\",\"Condi\\"
              - "tions\":[{\"NextAction\":\"Set Lookup
                Attempts\",\"Condition\":{\"Operator\":\"TextStartsW\\"
              - "ith\",\"Operands\":[\"arn:aws:lex:\"]}}],\"Errors\":[{\"NextAc\
                tion\":\"Error Return Prompt\\"
              - "\",\"ErrorType\":\"NoMatchingCondition\"}]}},{\"Parameters\":{\
                },\"Identifier\":\"12763fe9-\\"
              - "52e0-4b56-9e7c-57d6267ea5e3\",\"Type\":\"EndFlowModuleExecution\
                \",\"Transitions\":{}},{\\"
              - "\"Parameters\":{\"Text\":\"I'm sorry that I was unable to help
                you find anyone today.\\"
              - "  Let me take you back to the main menu.
                \"},\"Identifier\":\"Loop Fail Out Prompt\",\\"
              - "\"Type\":\"MessageParticipant\",\"Transitions\":{\"NextAction\
                \":\"12763fe9-52e0-4b56-9e7c\\"
              - "-57d6267ea5e3\",\"Errors\":[{\"NextAction\":\"12763fe9-52e0-4b\
                56-9e7c-57d6267ea5e3\",\"E\\"
              - "rrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{\"Text\":\
                \"I'm sorry, I was unable t\\"
              - "o find anyone with that name.  Let's try that
                again.\"},\"Identifier\":\"Retry Looku\\"
              - "p
                Prompt\",\"Type\":\"MessageParticipant\",\"Transitions\":{\"Nex\
                tAction\":\"Initial Loop\"\\"
              - ",\"Errors\":[{\"NextAction\":\"Initial
                Loop\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Para\\"
              - "meters\":{\"Text\":\"I'm sorry, an error has occurred.  Please
                try again in a few mo\\"
              - "ments.\"},\"Identifier\":\"Error Return
                Prompt\",\"Type\":\"MessageParticipant\",\"Transit\\"
              - "ions\":{\"NextAction\":\"78d32efd-3a08-4c8d-a9b6-6745be0e5b95\
                \",\"Errors\":[{\"NextActio\\"
              - "n\":\"78d32efd-3a08-4c8d-a9b6-6745be0e5b95\",\"ErrorType\":\"N\
                oMatchingError\"}]}},{\"Pa\\"
              - "rameters\":{\"LoopCount\":\"3\"},\"Identifier\":\"Initial
                Loop\",\"Type\":\"Loop\",\"Transitio\\"
              - "ns\":{\"NextAction\":\"Loop Fail Out
                Prompt\",\"Conditions\":[{\"NextAction\":\"Check Lex \\"
              - "ARN\",\"Condition\":{\"Operator\":\"Equals\",\"Operands\":[\"C\
                ontinueLooping\"]}},{\"NextAct\\"
              - "ion\":\"Loop Fail Out
                Prompt\",\"Condition\":{\"Operator\":\"Equals\",\"Operands\":[\
                \"DoneLo\\"
              - "oping\"]}}]}},{\"Parameters\":{\"Text\":\"No worries!  Let's
                try this again.\"},\"Identi\\"
              - "fier\":\"Lookup Retry
                Prompt\",\"Type\":\"MessageParticipant\",\"Transitions\":{\"Nex\
                tActi\\"
              - "on\":\"Initial Loop\",\"Errors\":[{\"NextAction\":\"Initial
                Loop\",\"ErrorType\":\"NoMatchin\\"
              - "gError\"}]}},{\"Parameters\":{\"MetricType\":\"NumberOfAgentsA\
                vailable\"},\"Identifier\":\\"
              - "\"3a106662-1f93-4fae-a136-1943d5020cf8\",\"Type\":\"CheckMetri\
                cData\",\"Transitions\":{\"\\"
              - "NextAction\":\"dbcd1335-443d-42ba-ab44-60aec594cfc2\",\"Condit\
                ions\":[{\"NextAction\":\"\\"
              - "ec0460d1-e556-45c4-82a2-3a41a3cd552b\",\"Condition\":{\"Operat\
                or\":\"NumberGreaterThan\\"
              - "\",\"Operands\":[\"0\"]}}],\"Errors\":[{\"NextAction\":\"dbcd1\
                335-443d-42ba-ab44-60aec594c\\"
              - "fc2\",\"ErrorType\":\"NoMatchingCondition\"},{\"NextAction\":\
                \"dbcd1335-443d-42ba-ab44-6\\"
              - "0aec594cfc2\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Paramet\
                ers\":{},\"Identifier\":\"ec\\"
              - "0460d1-e556-45c4-82a2-3a41a3cd552b\",\"Type\":\"TransferContac\
                tToQueue\",\"Transitions\\"
              - "\":{\"NextAction\":\"Check for External
                Number\",\"Errors\":[{\"NextAction\":\"Check for E\\"
              - "xternal
                Number\",\"ErrorType\":\"QueueAtCapacity\"},{\"NextAction\":\"C\
                heck for External\\"
              - "
                Number\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{\
                \"TimeLimitSeconds\":\"5\"\\"
              - "},\"Identifier\":\"3580553f-e91e-4fdf-9181-2417e77d6254\",\"Ty\
                pe\":\"Wait\",\"Transitions\\"
              - "\":{\"NextAction\":\"4dfcb359-dec5-4266-be3d-a59e6a723a11\",\"\
                Conditions\":[{\"NextActio\\"
              - "n\":\"4dfcb359-dec5-4266-be3d-a59e6a723a11\",\"Condition\":{\"\
                Operator\":\"Equals\",\"Oper\\"
              - "ands\":[\"WaitCompleted\"]}}],\"Errors\":[{\"NextAction\":\"4d\
                fcb359-dec5-4266-be3d-a59e\\"
              - "6a723a11\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\
                \":{},\"Identifier\":\"4dfcb\\"
              - "359-dec5-4266-be3d-a59e6a723a11\",\"Type\":\"EndFlowModuleExec\
                ution\",\"Transitions\":{\\"
              - "}},{\"Parameters\":{},\"Identifier\":\"d3071ee8-a045-4443-b85d\
                -bad5db4560c4\",\"Type\":\"\\"
              - "DisconnectParticipant\",\"Transitions\":{}},{\"Parameters\":{\
                \"LambdaFunctionARN\":\"$.A\\"
              - "ttributes.ConnectEventsLambda\",\"InvocationTimeLimitSeconds\":\
                \"3\",\"LambdaInvocatio\\"
              - "nAttributes\":{\"directoryId\":\"$.Attributes.directoryId\",\"\
                directoryName\":\"$.Attrib\\"
              - "utes.directoryName\",\"eventType\":\"LookupMatch\"},\"Response\
                Validation\":{\"ResponseTy\\"
              - "pe\":\"JSON\"}},\"Identifier\":\"Event Logging - Lookup Match |
                Transfer Out\",\"Type\":\"\\"
              - "InvokeLambdaFunction\",\"Transitions\":{\"NextAction\":\"d3071\
                ee8-a045-4443-b85d-bad5d\\"
              - "b4560c4\",\"Errors\":[{\"NextAction\":\"d3071ee8-a045-4443-b85\
                d-bad5db4560c4\",\"ErrorTy\\"
              - "pe\":\"NoMatchingError\"}]}},{\"Parameters\":{\"ComparisonValue\
                \":\"$.Attributes.vocalde\\"
              - "x_externalPhone\"},\"Identifier\":\"Check for External
                Number\",\"Type\":\"Compare\",\"Tra\\"
              - "nsitions\":{\"NextAction\":\"Event Logging - Lookkup Miss |
                Unreachable\",\"Conditions\\"
              - "\":[{\"NextAction\":\"dbcd1335-443d-42ba-ab44-60aec594cfc2\",\
                \"Condition\":{\"Operator\":\\"
              - "\"TextStartsWith\",\"Operands\":[\"+1\"]}},{\"NextAction\":\"E\
                vent Logging - Lookkup Miss\\"
              - " |
                Unreachable\",\"Condition\":{\"Operator\":\"Equals\",\"Operands\
                \":[\"CHAT\"]}}],\"Errors\"\\"
              - ":[{\"NextAction\":\"Event Logging - Lookkup Miss |
                Unreachable\",\"ErrorType\":\"NoMatc\\"
              - "hingCondition\"}]}},{\"Parameters\":{\"Text\":\"Unfortunately,
                this contact is current\\"
              - "ly unreachable by our system.  Please try contacting them using
                other means. $.A\\"
              - "ttributes.voiceSSMLsil5\"},\"Identifier\":\"Unreachable
                Prompt\",\"Type\":\"MessageParti\\"
              - "cipant\",\"Transitions\":{\"NextAction\":\"3580553f-e91e-4fdf-\
                9181-2417e77d6254\",\"Erro\\"
              - "rs\":[{\"NextAction\":\"3580553f-e91e-4fdf-9181-2417e77d6254\",\
                \"ErrorType\":\"NoMatchin\\"
              - "gError\"}]}},{\"Parameters\":{\"ThirdPartyPhoneNumber\":\"$.At\
                tributes.vocaldex_extern\\"
              - "alPhone\",\"ThirdPartyConnectionTimeLimitSeconds\":\"30\",\"Co\
                ntinueFlowExecution\":\"Tr\\"
              - "ue\"},\"Identifier\":\"dbcd1335-443d-42ba-ab44-60aec594cfc2\",\
                \"Type\":\"TransferPartici\\"
              - "pantToThirdParty\",\"Transitions\":{\"NextAction\":\"Event
                Logging - Lookup Match | Tr\\"
              - "ansfer Out\",\"Errors\":[{\"NextAction\":\"Event Logging -
                Lookkup Miss | Unreachable\"\\"
              - ",\"ErrorType\":\"CallFailed\"},{\"NextAction\":\"Event Logging
                - Lookkup Miss | Unreach\\"
              - "able\",\"ErrorType\":\"ConnectionTimeLimitExceeded\"},{\"NextA\
                ction\":\"Event Logging - \\"
              - "Lookkup Miss |
                Unreachable\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Paramete\
                rs\":{\"La\\"
              - "mbdaFunctionARN\":\"$.Attributes.ConnectEventsLambda\",\"Invoc\
                ationTimeLimitSeconds\"\\"
              - ":\"3\",\"LambdaInvocationAttributes\":{\"directoryId\":\"$.Att\
                ributes.directoryId\",\"dir\\"
              - "ectoryName\":\"$.Attributes.directoryName\",\"eventType\":\"Lo\
                okupMiss\"},\"ResponseVali\\"
              - "dation\":{\"ResponseType\":\"JSON\"}},\"Identifier\":\"Event
                Logging - Lookkup Miss | Un\\"
              - "reachable\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\":{\
                \"NextAction\":\"Unreachabl\\"
              - "e Prompt\",\"Errors\":[{\"NextAction\":\"Unreachable
                Prompt\",\"ErrorType\":\"NoMatchingEr\\"
              - "ror\"}]}},{\"Parameters\":{\"ComparisonValue\":\"$.Attributes.\
                vocaldex_internalPhone\"}\\"
              - ",\"Identifier\":\"Check for Internal
                Contact\",\"Type\":\"Compare\",\"Transitions\":{\"Next\\"
              - "Action\":\"Check for External
                Number\",\"Conditions\":[{\"NextAction\":\"Event Logging -\\"
              - " Lookup Match |
                Internal\",\"Condition\":{\"Operator\":\"TextContains\",\"Opera\
                nds\":[\"-\"\\"
              - "]}}],\"Errors\":[{\"NextAction\":\"Check for External
                Number\",\"ErrorType\":\"NoMatching\\"
              - "Condition\"}]}},{\"Parameters\":{\"AgentId\":\"$.Attributes.vo\
                caldex_internalPhone\"},\"\\"
              - "Identifier\":\"Set Internal
                Queue\",\"Type\":\"UpdateContactTargetQueue\",\"Transitions\"\\"
              - ":{\"NextAction\":\"3a106662-1f93-4fae-a136-1943d5020cf8\",\"Er\
                rors\":[{\"NextAction\":\"C\\"
              - "heck for External
                Number\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{\
                \"Lamb\\"
              - "daFunctionARN\":\"$.Attributes.ConnectEventsLambda\",\"Invocat\
                ionTimeLimitSeconds\":\"\\"
              - "3\",\"LambdaInvocationAttributes\":{\"directoryId\":\"$.Attrib\
                utes.directoryId\",\"direc\\"
              - "toryName\":\"$.Attributes.directoryName\",\"eventType\":\"Look\
                upMatch\"},\"ResponseValid\\"
              - "ation\":{\"ResponseType\":\"JSON\"}},\"Identifier\":\"Event
                Logging - Lookup Match | Int\\"
              - "ernal\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\":{\"N\
                extAction\":\"Set Internal Q\\"
              - "ueue\",\"Errors\":[{\"NextAction\":\"Set Internal
                Queue\",\"ErrorType\":\"NoMatchingError\"\\"
              - "}]}},{\"Parameters\":{\"TimeLimitSeconds\":\"2\"},\"Identifier\
                \":\"0db06349-2cfc-4de2-994\\"
              - "d-ec8caa861cfe\",\"Type\":\"Wait\",\"Transitions\":{\"NextActi\
                on\":\"Check for Internal Co\\"
              - "ntact\",\"Conditions\":[{\"NextAction\":\"Check for Internal
                Contact\",\"Condition\":{\"Op\\"
              - "erator\":\"Equals\",\"Operands\":[\"WaitCompleted\"]}}],\"Erro\
                rs\":[{\"NextAction\":\"Check \\"
              - "for Internal
                Contact\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\"\
                :{\"LoopCoun\\"
              - "t\":\"3\"},\"Identifier\":\"Lookup Retry
                Loop\",\"Type\":\"Loop\",\"Transitions\":{\"NextActio\\"
              - "n\":\"Initial Loop\",\"Conditions\":[{\"NextAction\":\"Lookup
                Retry Prompt\",\"Condition\":\\"
              - "{\"Operator\":\"Equals\",\"Operands\":[\"ContinueLooping\"]}},{\
                \"NextAction\":\"Initial Loo\\"
              - "p\",\"Condition\":{\"Operator\":\"Equals\",\"Operands\":[\"Don\
                eLooping\"]}}]}},{\"Parameters\\"
              - "\":{\"LambdaFunctionARN\":\"$.Attributes.ConnectEventsLambda\",\
                \"InvocationTimeLimitSe\\"
              - "conds\":\"3\",\"LambdaInvocationAttributes\":{\"directoryId\":\
                \"$.Attributes.directoryId\\"
              - "\",\"directoryName\":\"$.Attributes.directoryName\",\"eventType\
                \":\"LookupMiss\"},\"Respon\\"
              - "seValidation\":{\"ResponseType\":\"JSON\"}},\"Identifier\":\"E\
                vent Logging - Lookup Miss\\"
              - "\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\":{\"NextAc\
                tion\":\"Lookup Retry Loop\",\\"
              - "\"Errors\":[{\"NextAction\":\"Lookup Retry
                Loop\",\"ErrorType\":\"NoMatchingError\"}]}},{\"\\"
              - "Parameters\":{\"ComparisonValue\":\"$.Channel\"},\"Identifier\
                \":\"Check Channel Type\",\"T\\"
              - "ype\":\"Compare\",\"Transitions\":{\"NextAction\":\"Set Contact
                Information for Voice\",\"\\"
              - "Conditions\":[{\"NextAction\":\"Set Contact Information for
                Chat\",\"Condition\":{\"Oper\\"
              - "ator\":\"Equals\",\"Operands\":[\"CHAT\"]}}],\"Errors\":[{\"Ne\
                xtAction\":\"Set Contact Infor\\"
              - "mation for
                Voice\",\"ErrorType\":\"NoMatchingCondition\"}]}},{\"Parameters\
                \":{\"LambdaFu\\"
              - "nctionARN\":\"$.Attributes.ConnectEventsLambda\",\"InvocationT\
                imeLimitSeconds\":\"3\",\"\\"
              - "LambdaInvocationAttributes\":{\"directoryId\":\"$.Attributes.d\
                irectoryId\",\"directory\\"
              - "Name\":\"$.Attributes.directoryName\",\"eventType\":\"LexLookup\
                \",\"destinationName\":\"$.\\"
              - "Attributes.vocaldex_guiName\",\"destinationId\":\"$.Attributes\
                .vocaldex_destinationI\\"
              - "d\"},\"ResponseValidation\":{\"ResponseType\":\"JSON\"}},\"Ide\
                ntifier\":\"Event Logging - \\"
              - "Lookup | Contact
                Info\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\":{\"Nex\
                tAction\"\\"
              - ":\"Check Channel Type\",\"Errors\":[{\"NextAction\":\"Check
                Channel Type\",\"ErrorType\":\"\\"
              - "NoMatchingError\"}]}},{\"Parameters\":{\"Attributes\":{\"vocal\
                dex_externalPhone\":\"$.Ex\\"
              - "ternal.ExternalTarget\",\"vocaldex_internalPhone\":\"$.Externa\
                l.InternalTarget\",\"voc\\"
              - "aldex_guiName\":\"$.External.GuiName\",\"vocaldex_vuiName\":\"\
                $.External.VuiName\",\"voc\\"
              - "aldex_destinationId\":\"$.Lex.Slots.dNameLookup\"},\"TargetCon\
                tact\":\"Current\"},\"Iden\\"
              - "tifier\":\"Set Contact
                Information\",\"Type\":\"UpdateContactAttributes\",\"Transitions\
                \"\\"
              - ":{\"NextAction\":\"Event Logging - Lookup | Contact
                Info\",\"Errors\":[{\"NextAction\":\"\\"
              - "Error Return
                Prompt\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{\
                \"LambdaFun\\"
              - "ctionARN\":\"$.Attributes.ConnectDestInfoLambda\",\"Invocation\
                TimeLimitSeconds\":\"3\",\\"
              - "\"LambdaInvocationAttributes\":{\"dNameLookup\":\"$.Lex.Slots.\
                dNameLookup\"},\"Response\\"
              - "Validation\":{\"ResponseType\":\"JSON\"}},\"Identifier\":\"Dir\
                ectory Lookup - Lambda\",\"T\\"
              - "ype\":\"InvokeLambdaFunction\",\"Transitions\":{\"NextAction\":\
                \"Set Contact Information\\"
              - "\",\"Errors\":[{\"NextAction\":\"Retry Lookup
                Loop\",\"ErrorType\":\"NoMatchingError\"}]}},\\"
              - "{\"Parameters\":{\"LoopCount\":\"2\"},\"Identifier\":\"Retry
                Lookup Loop\",\"Type\":\"Loop\",\"\\"
              - "Transitions\":{\"NextAction\":\"Initial
                Loop\",\"Conditions\":[{\"NextAction\":\"Retry Loo\\"
              - "kup
                Prompt\",\"Condition\":{\"Operator\":\"Equals\",\"Operands\":[\
                \"ContinueLooping\"]}},{\"\\"
              - "NextAction\":\"Initial
                Loop\",\"Condition\":{\"Operator\":\"Equals\",\"Operands\":[\"D\
                oneLoo\\"
              - "ping\"]}}]}},{\"Parameters\":{\"Attributes\":{\"directoryId\":\
                \"`,{Ref:\"DirectoryId\"},'\"\\"
              - ",\"directoryName\":\"',{Ref:\"DirectoryName\"},`\"},\"TargetCo\
                ntact\":\"Current\"},\"Identi\\"
              - "fier\":\"Set
                Directory\",\"Type\":\"UpdateContactAttributes\",\"Transitions\
                \":{\"NextActio\\"
              - "n\":\"Get Directory\",\"Errors\":[{\"NextAction\":\"Get
                Directory\",\"ErrorType\":\"NoMatchi\\"
              - "ngError\"}]}},{\"Parameters\":{\"SSML\":\"You've reached the
                company directory, powere\\"
              - "d by Vocal Dex.\"},\"Identifier\":\"Entry
                Prompt\",\"Type\":\"MessageParticipant\",\"Trans\\"
              - "itions\":{\"NextAction\":\"Initial
                Loop\",\"Errors\":[{\"NextAction\":\"Initial Loop\",\"Err\\"
              - "orType\":\"NoMatchingError\"}]}},{\"Parameters\":{\"LambdaFunc\
                tionARN\":\"$.Attributes.C\\"
              - "onnectEventsLambda\",\"InvocationTimeLimitSeconds\":\"3\",\"La\
                mbdaInvocationAttributes\\"
              - "\":{\"directoryId\":\"$.Attributes.directoryId\",\"directoryNa\
                me\":\"$.Attributes.direct\\"
              - "oryName\",\"eventType\":\"Arrived\"},\"ResponseValidation\":{\
                \"ResponseType\":\"JSON\"}},\"I\\"
              - "dentifier\":\"Get
                Directory\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\":{\
                \"NextAct\\"
              - "ion\":\"Entry Prompt\",\"Errors\":[{\"NextAction\":\"Entry
                Prompt\",\"ErrorType\":\"NoMatchi\\"
              - "ngError\"}]}},{\"Parameters\":{\"Tags\":{\"ASA_Solutions_Appli\
                cation\":\"VocalDex\"}},\"Id\\"
              - "entifier\":\"Set Application
                Tag\",\"Type\":\"TagContact\",\"Transitions\":{\"NextAction\":\
                \\"
              - "\"Set Logging Keys\",\"Errors\":[{\"NextAction\":\"Set Logging
                Keys\",\"ErrorType\":\"NoMat\\"
              - "chingError\"}]}},{\"Parameters\":{\"FlowLoggingBehavior\":\"En\
                abled\"},\"Identifier\":\"En\\"
              - "able
                Logging\",\"Type\":\"UpdateFlowLoggingBehavior\",\"Transitions\
                \":{\"NextAction\":\"Se\\"
              - "t Application
                Tag\"}},{\"Parameters\":{\"Attributes\":{\"lookupAttempt\":\"I$\
                .Attributes\\"
              - ".lookupAttempt\"},\"TargetContact\":\"Current\"},\"Identifier\
                \":\"Set Lookup Attempts\",\"\\"
              - "Type\":\"UpdateContactAttributes\",\"Transitions\":{\"NextActi\
                on\":\"Directory - Lex\",\"E\\"
              - "rrors\":[{\"NextAction\":\"Directory -
                Lex\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Para\\"
              - "meters\":{\"LambdaFunctionARN\":\"$.Attributes.ConnectEventsLa\
                mbda\",\"InvocationTimeL\\"
              - "imitSeconds\":\"3\",\"LambdaInvocationAttributes\":{\"director\
                yId\":\"$.Attributes.direc\\"
              - "toryId\",\"directoryName\":\"$.Attributes.directoryName\",\"ev\
                entType\":\"LexLookup\",\"lo\\"
              - "okupAttempt\":\"$.Attributes.lookupAttempt\"},\"ResponseValida\
                tion\":{\"ResponseType\":\\"
              - "\"JSON\"}},\"Identifier\":\"Event Logging -
                Lookup\",\"Type\":\"InvokeLambdaFunction\",\"Tr\\"
              - "ansitions\":{\"NextAction\":\"Directory Lookup -
                Lambda\",\"Errors\":[{\"NextAction\":\"Di\\"
              - "rectory Lookup -
                Lambda\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{\
                \"Lambd\\"
              - "aFunctionARN\":\"$.Attributes.ConnectEventsLambda\",\"Invocati\
                onTimeLimitSeconds\":\"3\\"
              - "\",\"LambdaInvocationAttributes\":{\"directoryId\":\"$.Attribu\
                tes.directoryId\",\"direct\\"
              - "oryName\":\"$.Attributes.directoryName\",\"eventType\":\"LexLo\
                okupError\",\"lookupAttemp\\"
              - "t\":\"$.Attributes.lookupAttempt\"},\"ResponseValidation\":{\"\
                ResponseType\":\"JSON\"}},\"\\"
              - "Identifier\":\"Event Logging - Lookup
                Error\",\"Type\":\"InvokeLambdaFunction\",\"Transi\\"
              - "tions\":{\"NextAction\":\"Retry Lookup
                Loop\",\"Errors\":[{\"NextAction\":\"Retry Lookup L\\"
              - "oop\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{\
                \"SSML\":\"Please give the na\\"
              - "me of the person you'd like to reach.
                $.Attributes.voiceSSMLsil5\",\"LexV2Bot\":{\"A\\"
              - "liasArn\":\"$.Attributes.VocaldexBot\"}},\"Identifier\":\"Dire\
                ctory - Lex\",\"Type\":\"Con\\"
              - "nectParticipantWithLexBot\",\"Transitions\":{\"NextAction\":\"\
                Event Logging - Lookup E\\"
              - "rror\",\"Errors\":[{\"NextAction\":\"Event Logging -
                Lookup\",\"ErrorType\":\"NoMatchingCo\\"
              - "ndition\"},{\"NextAction\":\"Event Logging - Lookup
                Error\",\"ErrorType\":\"NoMatchingEr\\"
              - "ror\"}]}},{\"Parameters\":{\"Attributes\":{\"ContactName\":\"$\
                .Attributes.vocaldex_guiNa\\"
              - "me\",\"vocaldex_externalPhone\":\"CHAT\"},\"TargetContact\":\"\
                Current\"},\"Identifier\":\"Se\\"
              - "t Contact Information for
                Chat\",\"Type\":\"UpdateContactAttributes\",\"Transitions\":{\\"
              - "\"NextAction\":\"Confirm Transfer -
                Lex\",\"Errors\":[{\"NextAction\":\"Error Return Prom\\"
              - "pt\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{\"\
                Attributes\":{\"ContactName\"\\"
              - ":\"$.Attributes.vocaldex_vuiName\",\"voiceSSMLsil5\":\"<break
                time=\\\\\"5s\\\\\"/>\"},\"Target\\"
              - "Contact\":\"Current\"},\"Identifier\":\"Set Contact Information
                for Voice\",\"Type\":\"Upd\\"
              - "ateContactAttributes\",\"Transitions\":{\"NextAction\":\"Confi\
                rm Transfer - Lex\",\"Erro\\"
              - "rs\":[{\"NextAction\":\"Error Return
                Prompt\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Par\\"
              - "ameters\":{\"LambdaFunctionARN\":\"$.Attributes.ConnectEventsL\
                ambda\",\"InvocationTime\\"
              - "LimitSeconds\":\"3\",\"LambdaInvocationAttributes\":{\"directo\
                ryId\":\"$.Attributes.dire\\"
              - "ctoryId\",\"directoryName\":\"$.Attributes.directoryName\",\"e\
                ventType\":\"LexYesNo\"},\"R\\"
              - "esponseValidation\":{\"ResponseType\":\"JSON\"}},\"Identifier\
                \":\"Event Logging - Yes No\\"
              - " |
                Yes\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\":{\"Next\
                Action\":\"Event Logging\\"
              - " - Lookup Match\",\"Errors\":[{\"NextAction\":\"Event Logging -
                Lookup Match\",\"ErrorTy\\"
              - "pe\":\"NoMatchingError\"}]}},{\"Parameters\":{\"LambdaFunction\
                ARN\":\"$.Attributes.Conne\\"
              - "ctEventsLambda\",\"InvocationTimeLimitSeconds\":\"3\",\"Lambda\
                InvocationAttributes\":{\"\\"
              - "directoryId\":\"$.Attributes.directoryId\",\"directoryName\":\
                \"$.Attributes.directoryN\\"
              - "ame\",\"eventType\":\"LexYesNo\"},\"ResponseValidation\":{\"Re\
                sponseType\":\"JSON\"}},\"Iden\\"
              - "tifier\":\"Event Logging - Yes No |
                No\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\\"
              - "\":{\"NextAction\":\"Event Logging - Lookup
                Miss\",\"Errors\":[{\"NextAction\":\"Event Log\\"
              - "ging - Lookup
                Miss\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\":{\
                \"Text\":\"I'm\\"
              - " sorry, I didn't get that.\"},\"Identifier\":\"Yes No Fail
                Prompt\",\"Type\":\"MessagePa\\"
              - "rticipant\",\"Transitions\":{\"NextAction\":\"Confirm Transfer
                - Lex\",\"Errors\":[{\"Next\\"
              - "Action\":\"Confirm Transfer -
                Lex\",\"ErrorType\":\"NoMatchingError\"}]}},{\"Parameters\"\\"
              - ":{\"LambdaFunctionARN\":\"$.Attributes.ConnectEventsLambda\",\
                \"InvocationTimeLimitSec\\"
              - "onds\":\"3\",\"LambdaInvocationAttributes\":{\"directoryId\":\
                \"$.Attributes.directoryId\"\\"
              - ",\"directoryName\":\"$.Attributes.directoryName\",\"eventType\
                \":\"LexYesNoError\"},\"Resp\\"
              - "onseValidation\":{\"ResponseType\":\"JSON\"}},\"Identifier\":\
                \"Event Logging - Yes No | \\"
              - "Error\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\":{\"N\
                extAction\":\"Yes No Fail Pr\\"
              - "ompt\",\"Errors\":[{\"NextAction\":\"Yes No Fail
                Prompt\",\"ErrorType\":\"NoMatchingError\"\\"
              - "}]}},{\"Parameters\":{\"SSML\":\"You would like to be
                transferred to $.Attributes.Con\\"
              - "tactName,
                correct?\",\"LexV2Bot\":{\"AliasArn\":\"$.Attributes.VocaldexBot\
                \"}},\"Identif\\"
              - "ier\":\"Confirm Transfer -
                Lex\",\"Type\":\"ConnectParticipantWithLexBot\",\"Transitions\\"
              - "\":{\"NextAction\":\"Event Logging - Yes No |
                Error\",\"Conditions\":[{\"NextAction\":\"Ev\\"
              - "ent Logging - Yes No |
                Yes\",\"Condition\":{\"Operator\":\"Equals\",\"Operands\":[\"Yes\
                \"]}\\"
              - "},{\"NextAction\":\"Event Logging - Yes No |
                No\",\"Condition\":{\"Operator\":\"Equals\",\"\\"
              - "Operands\":[\"No\"]}}],\"Errors\":[{\"NextAction\":\"Yes No
                Fail Prompt\",\"ErrorType\":\"No\\"
              - "MatchingCondition\"},{\"NextAction\":\"Event Logging - Yes No |
                Error\",\"ErrorType\":\"\\"
              - "NoMatchingError\"}]}},{\"Parameters\":{\"LambdaFunctionARN\":\
                \"$.Attributes.ConnectEve\\"
              - "ntsLambda\",\"InvocationTimeLimitSeconds\":\"3\",\"LambdaInvoc\
                ationAttributes\":{\"direc\\"
              - "toryId\":\"$.Attributes.directoryId\",\"directoryName\":\"$.At\
                tributes.directoryName\",\\"
              - "\"eventType\":\"LookupOffer\"},\"ResponseValidation\":{\"Respo\
                nseType\":\"JSON\"}},\"Identi\\"
              - "fier\":\"Event Logging - Lookup
                Offer\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\"\\"
              - ":{\"NextAction\":\"0db06349-2cfc-4de2-994d-ec8caa861cfe\",\"Er\
                rors\":[{\"NextAction\":\"0\\"
              - "db06349-2cfc-4de2-994d-ec8caa861cfe\",\"ErrorType\":\"NoMatchi\
                ngError\"}]}},{\"Paramet\\"
              - "ers\":{\"LambdaFunctionARN\":\"$.Attributes.ConnectEventsLambda\
                \",\"InvocationTimeLimi\\"
              - "tSeconds\":\"3\",\"LambdaInvocationAttributes\":{\"directoryId\
                \":\"$.Attributes.director\\"
              - "yId\",\"directoryName\":\"$.Attributes.directoryName\",\"event\
                Type\":\"LookupMatch\"},\"Re\\"
              - "sponseValidation\":{\"ResponseType\":\"JSON\"}},\"Identifier\":\
                \"Event Logging - Lookup \\"
              - "Match\",\"Type\":\"InvokeLambdaFunction\",\"Transitions\":{\"N\
                extAction\":\"Transfer To Pr\\"
              - "ompt\",\"Errors\":[{\"NextAction\":\"Transfer To
                Prompt\",\"ErrorType\":\"NoMatchingError\"\\"
              - "}]}},{\"Parameters\":{\"SSML\":\"Sure thing!  \\\\nLet me try
                to connect you with $.Attr\\"
              - "ibutes.ContactName.\\\\n$.Attributes.voiceSSMLsil5\"},\"Identi\
                fier\":\"Transfer To Prom\\"
              - "pt\",\"Type\":\"MessageParticipant\",\"Transitions\":{\"NextAc\
                tion\":\"Event Logging - Loo\\"
              - "kup Offer\",\"Errors\":[{\"NextAction\":\"Event Logging -
                Lookup Offer\",\"ErrorType\":\"N\\"
              - "oMatchingError\"}]}}],\"Settings\":{\"InputParameters\":[],\"O\
                utputParameters\":[],\"Tra\\"
              - "nsitions\":[{\"DisplayName\":\"Success\",\"ReferenceName\":\"S\
                uccess\",\"Description\":\"\"},\\"
              - "{\"DisplayName\":\"Error\",\"ReferenceName\":\"Error\",\"Descr\
                iption\":\"\"}]}}`]]},Description:{"
              - "\"Fn::Join\":[\"\",[{Ref:\"DirectoryName\"},\"
                (\",{Ref:\"DirectoryId\"},\")\"]]},InstanceArn:{"
              - "Ref:\"ConnectInstanceArn\"},Name:{\"Fn::Join\":[\"\",[\"Vocald\
                ex: \",{Ref:\"DirectoryName\"}]]}},"
              - "DependsOn:[]}},Outputs:{StateMachineArn:{Value:{Ref:\"Vocaldex\
                StateMachine01FF571\\"
              - "1\"}},VocaldexLexBotIdOutput:{Value:{Ref:\"VocaldexLexBot\"}},\
                VocaldexLexBotVersionOutput:{"
              - "Value:{Ref:\"VocaldexLexBotVersion\"}}}};var{CONNECT_INSTANCE_\
                ARN:Se,CONNECT_LAMBDA_DESTINFO_ARN:Fe,CONNECT_LAMBDA_EVENTS_ARN\
                :Ve,"
              - "CONNECT_LAMBDA_ROUTING_ARN:_e,VOCALDEX_STACK_ARN:Be,VOCALDEX_S\
                TACK_NAME:Ue}=process."
              - "env,v=new h.CloudFormationClient({}),dt=async(e,t)=>{let
                r=\"handler\";if(m(`${r}:\\"
              - ":invoked`,{event:e,context:t},d({event:e,context:t})),Se)if(Fe\
                )if(Ve)if(_e)if(Be){"
              - "if(!Ue)throw new Error(\"VOCALDEX_STACK_NAME not set\")}else
                throw new Error(\"VOCA\\"
              - "LDEX_STACK_ARN not set\");else throw new
                Error(\"CONNECT_LAMBDA_ROUTING_ARN not se\\"
              - "t\");else throw new Error(\"CONNECT_LAMBDA_EVENTS_ARN not
                set\");else throw new Error("
              - "\"CONNECT_LAMBDA_DESTINFO_ARN not set\");else throw new
                Error(\"CONNECT_INSTANCE_AR\\"
              - "N not set\");try{let o=Ie(t),i=await
                Oe(o),n;try{if(i.status==\"LOOKUP_ERROR\")console."
              - "error(`GRACE_MODE::${i.data}`);else{if(i.status==\"LICENSE_MIS\
                SING\")throw new Error("
              - "i.data);if(i.status==\"LICENSE_FOUND\"&&!i.data.includes(`:${o\
                }:`))throw new Error("
              - "\"Entitlement check
                failed\")}}catch(y){n=y}let{DirectoryId:s}=e,c=e.ForceRebuild??"
              - "!1,[l,a]=Se.split(\":instance/\"),p=`VocaldexDirectory--${a}--\
                ${s}`;console.debug("
              - "`${r}::stackName`,p);let u,g=await ue(s);if(g.isErr())throw
                console.log(`${r}::d\\"
              - "irectoryResult:error`,g.error,d(g.error)),new
                Error(g.error.message);let A=g.value,"
              - "b;console.debug(`${r}::directoryRecord`,A,d(A));let
                k=\"\",I,N;if(!A)u=\"DELETE_STA\\"
              - "CK\";else{let y=!!n;if(A.Metadata.IsLicenseError!==y&&await
                le(e.DirectoryId,{IsLicenseError:y}),"
              - "n)throw
                console.error(`${r}::licenseError`,n,d(n)),n;b=A.Metadata.State\
                MachineArn;"
              - "try{k=A.Description||\"\",N={StackName:p};let S=await
                v.send(new h.DescribeStacksCommand("
              - "N));console.log(`${r}::describeStackOutput`,S,d(S));let{Stacks\
                :_}=S;if(_&&_.length>"
              - "0){let B=_[0];if(B){if(!B.StackStatus)throw new
                Error(\"StackStatus doesn't exist\\"
              - "??\")}else throw new Error(\"Stack not
                found\");I=B.StackStatus}}catch(S){console.error("
              - "`${r}::describeStack:error`,S,d(S))}}let
                Z=[\"DELETE_FAILED\",\"DELETE_IN_PROGRESS\","
              - "\"REVIEW_IN_PROGRESS\",\"ROLLBACK_IN_PROGRESS\",\"UPDATE_ROLLB\
                ACK_FAILED\"],G=[\"CREATE\\"
              - "_FAILED\",\"DELETE_COMPLETE\",\"ROLLBACK_COMPLETE\"],X=[],P=[\
                \"UPDATE_COMPLETE_CLEANUP\\"
              - "_IN_PROGRESS\",\"UPDATE_IN_PROGRESS\",\"UPDATE_ROLLBACK_COMPLE\
                TE_CLEANUP_IN_PROGRESS\","
              - "\"UPDATE_ROLLBACK_IN_PROGRESS\"],$=[\"CREATE_COMPLETE\",\"UPDA\
                TE_COMPLETE\",\"UPDATE_RO\\"
              - "LLBACK_COMPLETE\"];if(!u)if(!I)u=\"CREATE_STACK\";else
                if(c)u=\"REBUILD_STACK\";else if(P."
              - "includes(I))u=\"RESUBMIT_TASK\";else
                if(Z.includes(I))u=\"DROP_TASK\";else if(G.includes("
              - "I))u=\"REBUILD_STACK\";else
                if(X.includes(I))u=\"REPAIR_STACK\";else if($.includes(I))"
              - "u=\"UPDATE_STACK\";else throw console.error(`${r}::Unknown
                stack status`,I),new Error("
              - "`Unknown stack status:
                ${I}`);if(console.debug(`${r}::action`,u),u==\"RESUBMIT_TA\\"
              - "SK\"&&!b&&(console.error(`${r}::can't resubmit task without
                stateMachineArn`),u=\"\\"
              - "DROP_TASK\"),u==\"DROP_TASK\")return;if(u==\"RESUBMIT_TASK\"){\
                let y={stateMachineArn:b};"
              - "await $e(r,new pe.SFNClient({}),new
                pe.StartExecutionCommand(y));return}else if(u=="
              - "\"DELETE_STACK\"){let y={StackName:p};await v.send(new
                h.DeleteStackCommand(y));return}else{"
              - "if(u==\"REPAIR_STACK\")throw new Error(\"REPAIR_STACK not
                implemented\");if(u==\"REBU\\"
              - "ILD_STACK\"){if(!N)throw new Error(\"LOGIC ERROR: action is
                REBUILD_STACK but desc\\"
              - "ribeStackInput is undefined, this should be
                impossible\");try{let y={};if(c&&I==\"\\"
              - "DELETE_FAILED\"){let oe=await v.send(new
                h.ListStackResourcesCommand(N));console."
              - "log(`${r}::listResourcesResponse`,oe,d(oe)),oe.StackResourceSu\
                mmaries&&(y.RetainResources="
              - "oe.StackResourceSummaries.filter(Y=>Y.ResourceStatus==\"CREATE\
                _FAILED\"||Y.ResourceStatus=="
              - "\"DELETE_FAILED\"||Y.ResourceStatus==\"DELETE_SKIPPED\").map(Y\
                =>Y.LogicalResourceId))}"
              - "let
                S={...N,...y};console.log(`${r}::deleteStackInput`,S,d(S));let
                _=await v.send("
              - "new
                h.DeleteStackCommand(S));console.log(`${r}::deleteStackOutput`,\
                _,d(_));let B=await h.waitUntilStackDeleteComplete("
              - "{client:v,maxWaitTime:60*60*1e3},N);console.log(`${r}::waitFor\
                Delete`,B,d(B)),console."
              - "log(`${r}::Stack deleted
                successfully`)}catch(y){console.error(`${r}::deleteStac\\"
              - "k:error`,y,d(y)),console.log(\"Will try to rebuild the stack
                anyway but it will p\\"
              - "robably fail\")}}else
                if(!(u==\"CREATE_STACK\"||u==\"UPDATE_STACK\"))throw new Error("
              - "`Unknown action: ${u}`)}let F=await Q(s);if(F.isErr())throw
                console.log(`${r}::m\\"
              - "embershipsResult:error`,F.error,d(F.error)),new
                Error(F.error.message);let w=F.value||"
              - "[];w.length===0&&w.push({DestinationId:a,Synonyms:[a]});let
                T;try{let y=await v."
              - "send(new
                h.DescribeStacksCommand({StackName:Ue}));console.log(`${r}::voc\
                aldexSta\\"
              - "ckOutput`,y,d(y)),y.Stacks&&y.Stacks.length>0&&(T=y.Stacks[0].\
                Tags||[])}catch{T="
              - "[]}console.debug(`${r}::tags`,T,d(T)),console.debug(`${r}::mem\
                bershipRecords`,w,"
              - "d(w)),O.Resources.VocaldexLexBot.Properties.BotLocales[0].Slot\
                Types[0].SlotTypeValues="
              - "w.map(y=>({SampleValue:{Value:y.DestinationId},Synonyms:y.Syno\
                nyms.map(S=>({Value:S}))})),"
              - "Object.keys(O.Resources).forEach(y=>{let{Type:S}=O.Resources[y\
                ];S===\"AWS::Connec\\"
              - "t::ContactFlowModule\"||S===\"AWS::StepFunctions::StateMachine\
                \"?O.Resources[y].Properties."
              - "Tags=T:S===\"AWS::Lex::Bot\"&&(O.Resources[y].Properties.BotTa\
                gs=T)});let j=new Date()."
              - "toISOString().split(\".\")[0].replace(/[^0-9TZ]/g,\"\"),R=JSON\
                .stringify(O).replace("
              - "/VocaldexLexBotVersion/g,`VocaldexLexBotVersion${j}Z`);console\
                .debug(`${r}::temp\\"
              - "lateBody`,R,d(R),d(JSON.parse(R)));let
                L=[{ParameterKey:\"ConnectInstanceArn\",ParameterValue:Se},"
              - "{ParameterKey:\"DirectoryId\",ParameterValue:s},{ParameterKey:\
                \"DirectoryName\",ParameterValue:k},"
              - "{ParameterKey:\"LambdaArnBotBuild\",ParameterValue:t.invokedFu\
                nctionArn},{ParameterKey:\"\\"
              - "LambdaArnConnectDestinationInfo\",ParameterValue:Fe},{Paramete\
                rKey:\"LambdaArnConn\\"
              - "ectEvents\",ParameterValue:Ve},{ParameterKey:\"LambdaArnConnec\
                tRouting\",ParameterValue:_e},"
              - "{ParameterKey:\"ParentStackArn\",ParameterValue:Be}];console.d\
                ebug(`${r}::paramete\\"
              - "rs`,L,d(L));let me=new
                de.S3Client({}),J=process.env.CFN_ASSETS_BUCKET;if(!J)throw new
                Error("
              - "\"CFN_ASSETS_BUCKET not set\");let
                ee=`templates/${p}.json`,q={Body:R,Bucket:J,Key:ee};"
              - "m(`${r}::s3Input`,q,d(q));let te=await me.send(new
                de.PutObjectCommand(q));m(`${r}\\"
              - "::s3output`,te,d(te));let
                re={Capabilities:[\"CAPABILITY_NAMED_IAM\"],Parameters:L,"
              - "StackName:p,Tags:T,TemplateURL:`https://${J}.s3.amazonaws.com/\
                ${ee}`},V;if(u==\"C\\"
              - "REATE_STACK\"||u==\"REBUILD_STACK\")V=await v.send(new
                h.CreateStackCommand(re));else if(u=="
              - "\"UPDATE_STACK\")V=await v.send(new
                h.UpdateStackCommand(re));else throw new Error("
              - "`Unknown action:
                ${u}`);console.log(`${r}::response`,V);return}catch(o){console."
              - "error(`${r}::Error processing event`,o,d(o),d(e))}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          AWS_ACCOUNT_ID:
            Ref: "AWS::AccountId"
          CFN_ASSETS_BUCKET:
            Ref: "DirMgmtS3Bucket0F4D3D00"
          CONNECT_INSTANCE_ARN:
            Fn::Join:
              - ""
              - - "arn:aws:connect:"
                - Ref: "AWS::Region"
                - ":"
                - Ref: "AWS::AccountId"
                - ":instance/"
                - Ref: "ConnectInstance"
          CONNECT_LAMBDA_DESTINFO_ARN:
            Fn::GetAtt:
              - "ConnectDestinationInfoLambda52428FA8"
              - "Arn"
          CONNECT_LAMBDA_EVENTS_ARN:
            Fn::GetAtt:
              - "ConnectEventsLambdaCAE22488"
              - "Arn"
          CONNECT_LAMBDA_ROUTING_ARN:
            Fn::GetAtt:
              - "ConnectRoutingLambdaD0DD651C"
              - "Arn"
          DDB_TABLE_DESTINATION:
            Ref: "DdbDestinations37B2F70F"
          DDB_TABLE_DIRECTORY:
            Ref: "DdbDirectories26458382"
          DDB_TABLE_MEMBERSHIP:
            Ref: "DdbMemberships1A816D0C"
          PRODUCT_CODE: "6cf9s66w3t0z1qdjuijuoc6ah"
          VOCALDEX_STACK_ARN:
            Ref: "AWS::StackId"
          VOCALDEX_STACK_NAME: "Vocaldex"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "DirMgmtCfnPublishLambdaServiceRoleED5968D2"
          - "Arn"
      Runtime: "nodejs20.x"
      Timeout: 300
    DependsOn:
      - "DirMgmtCfnPublishLambdaServiceRoleDefaultPolicy7FDF9EBC"
  DirMgmtUpdateDirectoryCfnStackCloudformationPolicy2E2D7DF9:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "iam:AttachRolePolicy"
              - "iam:CreateRole"
              - "iam:DeleteRole"
              - "iam:DeleteRolePolicy"
              - "iam:DetachRolePolicy"
              - "iam:GetRole"
              - "iam:GetRolePolicy"
              - "iam:ListAttachedRolePolicies"
              - "iam:ListRolePolicies"
              - "iam:PassRole"
              - "iam:PutRolePolicy"
              - "iam:TagRole"
              - "iam:UntagRole"
              - "iam:UpdateAssumeRolePolicy"
              - "iam:UpdateRole"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:iam::"
                  - Ref: "AWS::AccountId"
                  - ":role/*"
          - Action:
              - "cloudformation:ContinueUpdateRollback"
              - "cloudformation:CreateStack"
              - "cloudformation:DeleteStack"
              - "cloudformation:DescribeStacks"
              - "cloudformation:RollbackStack"
              - "cloudformation:TagResource"
              - "cloudformation:UpdateStack"
              - "cloudformation:UpdateTerminationProtection"
            Effect: "Allow"
            Resource:
              - Fn::Join:
                  - ""
                  - - "arn:aws:cloudformation:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":changeSet/*/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:cloudformation:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":stack/VocaldexDirectory--"
                    - Ref: "ConnectInstance"
                    - "--*/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:cloudformation:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":stackset/*:*"
          - Action:
              - "cloudformation:ListStacks"
              - "cloudformation:UpdateGeneratedTemplate"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:cloudformation:"
                  - Ref: "AWS::Region"
                  - ":"
                  - Ref: "AWS::AccountId"
                  - ":stack/VocaldexDirectory--"
                  - Ref: "ConnectInstance"
                  - "--*/*"
          - Action:
              - "connect:AssociateBot"
              - "connect:CreateContactFlowModule"
              - "connect:DeleteContactFlowModule"
              - "connect:DisassociateBot"
              - "connect:ListBots"
              - "connect:TagResource"
              - "connect:UntagResource"
              - "connect:UpdateContactFlowModuleContent"
              - "connect:UpdateContactFlowModuleMetadata"
              - "iam:AttachRolePolicy"
              - "iam:CreateServiceLinkedRole"
              - "iam:PutRolePolicy"
              - "lex:CreateResourcePolicy"
              - "lex:DeleteResourcePolicy"
              - "lex:DescribeBotAlias"
              - "lex:UpdateResourcePolicy"
            Effect: "Allow"
            Resource:
              - Fn::Join:
                  - ""
                  - - "arn:aws:connect:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":instance/"
                    - Ref: "ConnectInstance"
                    - "/flow-module/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:connect:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":instance/"
                    - Ref: "ConnectInstance"
              - Fn::Join:
                  - ""
                  - - "arn:aws:iam::"
                    - Ref: "AWS::AccountId"
                    - ":role/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:lex:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":bot-alias/Vocaldex_"
                    - Ref: "ConnectInstance"
                    - "_*/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:lex:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":bot/Vocaldex_"
                    - Ref: "ConnectInstance"
                    - "_*"
          - Action:
              - "events:DeleteRule"
              - "events:DescribeRule"
              - "events:ListTargetsByRule"
              - "events:PutRule"
              - "events:PutTargets"
              - "events:RemoveTargets"
              - "events:TagResource"
              - "events:UntagResource"
            Effect: "Allow"
            Resource:
              - Fn::Join:
                  - ""
                  - - "arn:aws:events:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":event-bus/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:events:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":rule/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:events:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":rule/VocaldexDirectory-*"
          - Action:
              - "kms:CreateGrant"
              - "kms:Decrypt"
              - "kms:DescribeKey"
              - "kms:Encrypt"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:kms:"
                  - Ref: "AWS::Region"
                  - ":"
                  - Ref: "AWS::AccountId"
                  - ":key/*"
          - Action:
              - "lambda:AddPermission"
              - "lambda:CreateAlias"
              - "lambda:CreateFunction"
              - "lambda:DeleteAlias"
              - "lambda:DeleteFunction"
              - "lambda:GetAlias"
              - "lambda:GetFunction"
              - "lambda:GetFunctionCodeSigningConfig"
              - "lambda:GetPolicy"
              - "lambda:GetRuntimeManagementConfig"
              - "lambda:PublishVersion"
              - "lambda:PutRuntimeManagementConfig"
              - "lambda:RemovePermission"
              - "lambda:TagResource"
              - "lambda:UntagResource"
              - "lambda:UpdateAlias"
              - "lambda:UpdateFunctionCode"
              - "lambda:UpdateFunctionConfiguration"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:lambda:"
                  - Ref: "AWS::Region"
                  - ":"
                  - Ref: "AWS::AccountId"
                  - ":function:*"
          - Action:
              - "lex:BuildBotLocale"
              - "lex:CreateBot"
              - "lex:CreateBotAlias"
              - "lex:CreateBotLocale"
              - "lex:CreateBotVersion"
              - "lex:CreateCustomVocabulary"
              - "lex:CreateIntent"
              - "lex:CreateResourcePolicy"
              - "lex:CreateSlot"
              - "lex:CreateSlotType"
              - "lex:DeleteBot"
              - "lex:DeleteBotAlias"
              - "lex:DeleteBotChannel"
              - "lex:DeleteBotLocale"
              - "lex:DeleteBotVersion"
              - "lex:DeleteCustomVocabulary"
              - "lex:DeleteIntent"
              - "lex:DeleteResourcePolicy"
              - "lex:DeleteSlot"
              - "lex:DeleteSlotType"
              - "lex:DeleteTestSet"
              - "lex:DescribeBot"
              - "lex:DescribeBotAlias"
              - "lex:DescribeBotLocale"
              - "lex:DescribeBotVersion"
              - "lex:DescribeImport"
              - "lex:ListBotLocales"
              - "lex:StartImport"
              - "lex:TagResource"
              - "lex:UntagResource"
              - "lex:UpdateBot"
              - "lex:UpdateBotAlias"
              - "lex:UpdateBotLocale"
              - "lex:UpdateCustomVocabulary"
              - "lex:UpdateIntent"
              - "lex:UpdateResourcePolicy"
              - "lex:UpdateSlot"
              - "lex:UpdateSlotType"
              - "lex:UpdateTestSet"
            Effect: "Allow"
            Resource:
              - Fn::Join:
                  - ""
                  - - "arn:aws:lex:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":bot-alias/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:lex:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":bot/*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:lex:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":test-set/*"
          - Action:
              - "lex:CreateTestSet"
              - "lex:CreateUploadUrl"
              - "lex:ListBots"
            Effect: "Allow"
            Resource: "*"
          - Action: "logs:CreateLogGroup"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:logs:"
                  - Ref: "AWS::Region"
                  - ":"
                  - Ref: "AWS::AccountId"
                  - ":log-group:*"
          - Action: "logs:CreateLogStream"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:logs:"
                  - Ref: "AWS::Region"
                  - ":"
                  - Ref: "AWS::AccountId"
                  - ":log-group:*:log-stream:*"
          - Action:
              - "states:CreateStateMachine"
              - "states:DeleteStateMachine"
              - "states:DescribeStateMachine"
              - "states:PublishStateMachineVersion"
              - "states:TagResource"
              - "states:UntagResource"
              - "states:UpdateStateMachine"
            Effect: "Allow"
            Resource:
              - Fn::Join:
                  - ""
                  - - "arn:aws:states:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":activity:*"
              - Fn::Join:
                  - ""
                  - - "arn:aws:states:"
                    - Ref: "AWS::Region"
                    - ":"
                    - Ref: "AWS::AccountId"
                    - ":stateMachine:*"
        Version: "2012-10-17"
      PolicyName: "DirMgmtUpdateDirectoryCfnStackCloudformationPolicy2E2D7DF9"
      Roles:
        - Ref: "DirMgmtCfnPublishLambdaServiceRoleED5968D2"
    Metadata:
      cfn-lint:
        config:
          ignore_checks:
            - "EIAMPolicyWildcardResource"
          ignore_checks_reasons:
            EIAMPolicyWildcardResource: "This policy document matches what the IAM console
              created, even with the ARNs we specified."
  DirMgmtCheckLicenseLambdaListReceivedLicensesRole9892E93D:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action: "cloudformation:ListStackResources"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:cloudformation:*:"
                  - Ref: "AWS::AccountId"
                  - ":stack/*/*"
          - Action:
              - "license-manager:ListLicenses"
              - "license-manager:ListReceivedLicenses"
            Effect: "Allow"
            Resource: "*"
        Version: "2012-10-17"
      PolicyName: "DirMgmtCheckLicenseLambdaListReceivedLicensesRole9892E93D"
      Roles:
        - Ref: "DirMgmtCfnPublishLambdaServiceRoleED5968D2"
  CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
      ManagedPolicyArns:
        - Fn::Sub: "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExec\
            utionRole"
  CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var
                I=Object.create,i=Object.defineProperty,w=Object.getOwnProperty\
                Descriptor,P=Object.getOwnPropertyNames,A=Object.getPrototypeOf\
                ,L=Object.prototype.hasOwnProperty,k=(e,t)=>{for(var o in
                t)i(e,o,{get:t[o],enumerable:!0})},d=(e,t,o,n)=>{if(t&&typeof
                t==\"object\"||typeof t==\"function\")for(let s of
                P(t))!L.call(e,s)&&s!==o&&i(e,s,{get:()=>t[s],enumerable:!(n=w(\
                t,s))||n.enumerable});return
                e},l=(e,t,o)=>(o=e!=null?I(A(e)):{},d(t||!e||!e.__esModule?i(o,\
                \"default\",{value:e,enumerable:!0}):o,e)),B=e=>d(i({},\"__esMo\
                dule\",{value:!0}),e),q={};k(q,{autoDeleteHandler:()=>S,handler\
                :()=>_}),module.exports=B(q);var
                h=require(\"@aws-sdk/client-s3\"),y=l(require(\"https\")),m=l(r\
                equire(\"url\")),a={sendHttpRequest:b,log:O,includeStackTraces:\
                !0,userHandlerIndex:\"./index\"},p=\"AWSCDK::CustomResourceProv\
                iderFramework::CREATE_FAILED\",D=\"AWSCDK::CustomResourceProvid\
                erFramework::MISSING_PHYSICAL_ID\";function R(e){return
                async(t,o)=>{let
                n={...t,ResponseURL:\"...\"};if(a.log(JSON.stringify(n,void
                0,2)),t.RequestType===\"Delete\"&&t.PhysicalResourceId===p){a.l\
                og(\"ignoring DELETE event caused by a failed CREATE
                event\"),await u(\"SUCCESS\",t);return}try{let s=await
                e(n,o),r=T(t,s);await u(\"SUCCESS\",r)}catch(s){let
                r={...t,Reason:a.includeStackTraces?s.stack:s.message};r.Physic\
                alResourceId||(t.RequestType===\"Create\"?(a.log(\"CREATE
                failed, responding with a marker physical resource id so that
                the subsequent DELETE will be
                ignored\"),r.PhysicalResourceId=p):a.log(`ERROR: Malformed
                event. \"PhysicalResourceId\" is required:
                ${JSON.stringify(t)}`)),await u(\"FAILED\",r)}}}function
                T(e,t={}){let
                o=t.PhysicalResourceId??e.PhysicalResourceId??e.RequestId;if(e.\
                RequestType===\"Delete\"&&o!==e.PhysicalResourceId)throw new
                Error(`DELETE: cannot change the physical resource ID from
                \"${e.PhysicalResourceId}\" to \"${t.PhysicalResourceId}\"
                during deletion`);return{...e,...t,PhysicalResourceId:o}}async
                function u(e,t){let
                o={Status:e,Reason:t.Reason??e,StackId:t.StackId,RequestId:t.Re\
                questId,PhysicalResourceId:t.PhysicalResourceId||D,LogicalResou\
                rceId:t.LogicalResourceId,NoEcho:t.NoEcho,Data:t.Data},n=m.pars\
                e(t.ResponseURL),s=`${n.protocol}//${n.hostname}/${n.pathname}?\
                ***`;a.log(\"submit response to cloudformation\",s,o);let
                r=JSON.stringify(o),C={hostname:n.hostname,path:n.path,method:\
                \"PUT\",headers:{\"content-type\":\"\",\"content-length\":Buffe\
                r.byteLength(r,\"utf8\")}};await
                x({attempts:5,sleep:1e3},a.sendHttpRequest)(C,r)}async function
                b(e,t){return new Promise((o,n)=>{try{let
                s=y.request(e,r=>{r.resume(),!r.statusCode||r.statusCode>=400?n\
                (new Error(`Unsuccessful HTTP response:
                ${r.statusCode}`)):o()});s.on(\"error\",n),s.write(t),s.end()}c\
                atch(s){n(s)}})}function O(e,...t){console.log(e,...t)}function
                x(e,t){return async(...o)=>{let
                n=e.attempts,s=e.sleep;for(;;)try{return await
                t(...o)}catch(r){if(n--<=0)throw r;await
                H(Math.floor(Math.random()*s)),s*=2}}}async function H(e){return
                new Promise(t=>setTimeout(t,e))}var
                g=\"aws-cdk:auto-delete-objects\",F=JSON.stringify({Version:\"2\
                012-10-17\",Statement:[]}),c=new h.S3({}),_=R(S);async function
                S(e){switch(e.RequestType){case\"Create\":return;case\"Update\"\
                :return U(e);case\"Delete\":return
                E(e.ResourceProperties?.BucketName)}}async function U(e){let
                t=e,o=t.OldResourceProperties?.BucketName,n=t.ResourcePropertie\
                s?.BucketName;if(n!=null&&o!=null&&n!==o)return E(o)}async
                function N(e){try{let t=(await
                c.getBucketPolicy({Bucket:e}))?.Policy??F,o=JSON.parse(t);o.Sta\
                tement.push({Principal:\"*\",Effect:\"Deny\",Action:[\"s3:PutOb\
                ject\"],Resource:[`arn:aws:s3:::${e}/*`]}),await
                c.putBucketPolicy({Bucket:e,Policy:JSON.stringify(o)})}catch(t)\
                {if(t.name===\"NoSuchBucket\")throw t;console.log(`Could not set
                new object deny policy on bucket '${e}' prior to
                deletion.`)}}async function f(e){let t=await
                c.listObjectVersions({Bucket:e}),o=[...t.Versions??[],...t.Dele\
                teMarkers??[]];if(o.length===0)return;let
                n=o.map(s=>({Key:s.Key,VersionId:s.VersionId}));await
                c.deleteObjects({Bucket:e,Delete:{Objects:n}}),t?.IsTruncated&&\
                await f(e)}async function E(e){if(!e)throw new Error(\"No
                BucketName was provided.\");try{if(!await
                W(e)){console.log(`Bucket does not have '${g}' tag, skipping
                cleaning.`);return}await N(e),await
                f(e)}catch(t){if(t.name===\"NoSuchBucket\"){console.log(`Bucket
                '${e}' does not exist.`);return}throw t}}async function
                W(e){return(await
                c.getBucketTagging({Bucket:e})).TagSet?.some(o=>o.Key===g&&o.Va\
                lue===\"true\")}"
      Timeout: 900
      MemorySize: 128
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092"
          - "Arn"
      Runtime: "nodejs18.x"
      Description:
        Fn::Join:
          - ""
          - - "Lambda function for auto-deleting objects in "
            - Ref: "DirMgmtS3Bucket0F4D3D00"
            - " S3 bucket."
    DependsOn: []
  ApiCognitoUsersLambdaServiceRole5215BE82:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ApiCognitoUsersLambdaServiceRoleDefaultPolicy7B59424C:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "cognito-idp:AdminAddUserToGroup"
              - "cognito-idp:AdminCreateUser"
              - "cognito-idp:AdminDeleteUser"
              - "cognito-idp:AdminDisableUser"
              - "cognito-idp:AdminEnableUser"
              - "cognito-idp:AdminGetUser"
              - "cognito-idp:AdminRemoveUserFromGroup"
              - "cognito-idp:AdminSetUserPassword"
              - "cognito-idp:AdminUpdateUserAttributes"
              - "cognito-idp:ListUsers"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "CognitoUserPool279BBD48"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "ApiCognitoUsersLambdaServiceRoleDefaultPolicy7B59424C"
      Roles:
        - Ref: "ApiCognitoUsersLambdaServiceRole5215BE82"
  ApiCognitoUsersLambdaBEE7102E:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var L=Object.defineProperty;var
                lt=Object.getOwnPropertyDescriptor;var
                gt=Object.getOwnPropertyNames;var
                Ct=Object.prototype.hasOwnProperty;var ft=(e,t)=>{for(var o in
                t)L(e,o,{get:t[o],enumerable:!0})},yt=(e,t,o,s)=>{if(t&&"
              - "typeof t==\"object\"||typeof t==\"function\")for(let r of
                gt(t))!Ct.call(e,r)&&r!==o&&"
              - "L(e,r,{get:()=>t[r],enumerable:!(s=lt(t,r))||s.enumerable});re\
                turn e};var Et=e=>yt(L({},\"__esModule\",{value:!0}),e);var
                St={};ft(St,{cognitoAttributesFormat:()=>A,cognitoUsers:()=>mt,\
                handler:()=>Tt,"
              - "parseCognitoUser:()=>T});module.exports=Et(St);function
                h(e){var t=String(e);if(t===\"[object
                Object]\")try{t=JSON.stringify(e)}catch{}"
              - "return t}var At=function(){function e(){}return
                e.prototype.isSome=function(){return!1},e."
              - "prototype.isNone=function(){return!0},e.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(t){"
              - "return t},e.prototype.expect=function(t){throw new
                Error(\"\".concat(t))},e.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},e.prototype.map=function(t){"
              - "return this},e.prototype.mapOr=function(t,o){return
                t},e.prototype.mapOrElse=function(t,o){"
              - "return t()},e.prototype.or=function(t){return
                t},e.prototype.orElse=function(t){"
              - "return t()},e.prototype.andThen=function(t){return
                this},e.prototype.toResult=function(t){"
              - "return
                d(t)},e.prototype.toString=function(){return\"None\"},e.prototy\
                pe.toAsyncOption="
              - "function(){return new U(R)},e}(),R=new At;Object.freeze(R);var
                ht=function(){function e(t){"
              - "if(!(this instanceof e))return new e(t);this.value=t}return
                e.prototype.isSome=function(){"
              - "return!0},e.prototype.isNone=function(){return!1},e.prototype[\
                Symbol.iterator]=function(){"
              - "var t=Object(this.value);return Symbol.iterator in
                t?t[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(t){return this.value},"
              - "e.prototype.expect=function(t){return
                this.value},e.prototype.unwrap=function(){"
              - "return this.value},e.prototype.map=function(t){return
                O(t(this.value))},e.prototype."
              - "mapOr=function(t,o){return
                o(this.value)},e.prototype.mapOrElse=function(t,o){return o("
              - "this.value)},e.prototype.or=function(t){return
                this},e.prototype.orElse=function(t){"
              - "return this},e.prototype.andThen=function(t){return
                t(this.value)},e.prototype.toResult="
              - "function(t){return
                m(this.value)},e.prototype.toAsyncOption=function(){return new
                U("
              - "this)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype.toString="
              - "function(){return\"Some(\".concat(h(this.value),\")\")},e.EMPT\
                Y=new e(void 0),e}(),O=ht,"
              - "H;(function(e){function t(){for(var
                r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];"
              - "for(var a=[],u=0,c=r;u<c.length;u++){var
                i=c[u];if(i.isSome())a.push(i.value);else"
              - "return i}return O(a)}e.all=t;function o(){for(var
                r=[],n=0;n<arguments.length;n++)"
              - "r[n]=arguments[n];for(var a=0,u=r;a<u.length;a++){var
                c=u[a];if(c.isSome())return c}"
              - "return R}e.any=o;function s(r){return r instanceof
                O||r===R}e.isOption=s})(H||(H="
              - "{}));var Ot=function(){function e(t){if(!(this instanceof
                e))return new e(t);this.error="
              - "t;var o=new Error().stack.split(`"
              - "`).slice(2);o&&o.length>0&&o[0].includes(\"ErrImpl\")&&o.shift\
                (),this._stack=o.join("
              - "`"
              - "`)}return
                e.prototype.isOk=function(){return!1},e.prototype.isErr=functio\
                n(){return!0},"
              - "e.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "e.prototype.else=function(t){return
                t},e.prototype.unwrapOr=function(t){return t},"
              - "e.prototype.expect=function(t){throw new Error(\"\".concat(t,\"
                - Error: \").concat("
              - "h(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.expect\
                Err=function(t){return this."
              - "error},e.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "h(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.unwrap\
                Err=function(){return this."
              - "error},e.prototype.map=function(t){return
                this},e.prototype.andThen=function(t){"
              - "return this},e.prototype.mapErr=function(t){return new
                d(t(this.error))},e.prototype."
              - "mapOr=function(t,o){return
                t},e.prototype.mapOrElse=function(t,o){return t(this."
              - "error)},e.prototype.or=function(t){return
                t},e.prototype.orElse=function(t){return t("
              - "this.error)},e.prototype.toOption=function(){return
                R},e.prototype.toString=function(){"
              - "return\"Err(\".concat(h(this.error),\")\")},Object.definePrope\
                rty(e.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),e.prot\
                otype.toAsyncResult="
              - "function(){return new P(this)},e.EMPTY=new e(void 0),e}();var
                d=Ot,xt=function(){function e(t){if(!(this instanceof e))return
                new e(t);this."
              - "value=t}return
                e.prototype.isOk=function(){return!0},e.prototype.isErr=functio\
                n(){"
              - "return!1},e.prototype[Symbol.iterator]=function(){var
                t=Object(this.value);return Symbol."
              - "iterator in
                t?t[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "e.prototype.else=function(t){return
                this.value},e.prototype.unwrapOr=function(t){"
              - "return this.value},e.prototype.expect=function(t){return
                this.value},e.prototype."
              - "expectErr=function(t){throw new
                Error(t)},e.prototype.unwrap=function(){return this."
              - "value},e.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "h(this.value)),{cause:this.value})},e.prototype.map=function(t\
                ){return new m(t(this."
              - "value))},e.prototype.andThen=function(t){return
                t(this.value)},e.prototype.mapErr="
              - "function(t){return this},e.prototype.mapOr=function(t,o){return
                o(this.value)},e."
              - "prototype.mapOrElse=function(t,o){return
                o(this.value)},e.prototype.or=function(t){"
              - "return this},e.prototype.orElse=function(t){return
                this},e.prototype.toOption=function(){"
              - "return O(this.value)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype."
              - "toString=function(){return\"Ok(\".concat(h(this.value),\")\")}\
                ,e.prototype.toAsyncResult="
              - "function(){return new P(this)},e.EMPTY=new e(void 0),e}();var
                m=xt,J;(function(e){function t(){for(var
                a=[],u=0;u<arguments.length;u++)a[u]="
              - "arguments[u];for(var c=[],i=0,p=a;i<p.length;i++){var
                l=p[i];if(l.isOk())c.push("
              - "l.value);else return l}return new m(c)}e.all=t;function
                o(){for(var a=[],u=0;u<arguments."
              - "length;u++)a[u]=arguments[u];for(var
                c=[],i=0,p=a;i<p.length;i++){var l=p[i];if(l."
              - "isOk())return l;c.push(l.error)}return new
                d(c)}e.any=o;function s(a){try{return new m("
              - "a())}catch(u){return new d(u)}}e.wrap=s;function
                r(a){try{return a().then(function(u){"
              - "return new m(u)}).catch(function(u){return new
                d(u)})}catch(u){return Promise.resolve("
              - "new d(u))}}e.wrapAsync=r;function n(a){return a instanceof d||a
                instanceof m}e.isResult="
              - "n})(J||(J={}));var S=function(e,t,o,s){function r(n){return n
                instanceof o?n:new o(function(a){"
              - "a(n)})}return new(o||(o=Promise))(function(n,a){function
                u(p){try{i(s.next(p))}catch(l){"
              - "a(l)}}function c(p){try{i(s.throw(p))}catch(l){a(l)}}function
                i(p){p.done?n(p.value):"
              - "r(p.value).then(u,c)}i((s=s.apply(e,t||[])).next())})},$=funct\
                ion(e,t){var o={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},s,r,n,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(p){return c([i,p])}}function c(i){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(o="
              - "0)),o;)try{if(s=1,r&&(n=i[0]&2?r.return:i[0]?r.throw||((n=r.re\
                turn)&&n.call(r),0):"
              - "r.next)&&!(n=n.call(r,i[1])).done)return
                n;switch(r=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:"
              - "n=i;break;case 4:return o.label++,{value:i[1],done:!1};case
                5:o.label++,r=i[1],i="
              - "[0];continue;case
                7:i=o.ops.pop(),o.trys.pop();continue;default:if(n=o.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){o=0;continue\
                }if(i[0]===3&&(!n||"
              - "i[1]>n[0]&&i[1]<n[3])){o.label=i[1];break}if(i[0]===6&&o.label\
                <n[1]){o.label=n[1],"
              - "n=i;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(i);break\
                }n[2]&&o.ops.pop(),"
              - "o.trys.pop();continue}i=t.call(e,o)}catch(p){i=[6,p],r=0}final\
                ly{s=n=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},P=function(){function e(t){this."
              - "promise=Promise.resolve(t)}return
                e.prototype.andThen=function(t){var o=this;return this."
              - "thenInternal(function(s){return S(o,void 0,void
                0,function(){var r;return $(this,"
              - "function(n){return s.isErr()?[2,s]:(r=t(s.value),[2,r
                instanceof e?r.promise:r])})})})},"
              - "e.prototype.map=function(t){var o=this;return
                this.thenInternal(function(s){return S("
              - "o,void 0,void 0,function(){var r;return
                $(this,function(n){switch(n.label){case 0:"
              - "return s.isErr()?[2,s]:(r=m,[4,t(s.value)]);case
                1:return[2,r.apply(void 0,[n.sent()])]}})})})},"
              - "e.prototype.mapErr=function(t){var o=this;return
                this.thenInternal(function(s){return S("
              - "o,void 0,void 0,function(){var r;return
                $(this,function(n){switch(n.label){case 0:"
              - "return s.isOk()?[2,s]:(r=d,[4,t(s.error)]);case
                1:return[2,r.apply(void 0,[n.sent()])]}})})})},"
              - "e.prototype.or=function(t){return this.orElse(function(){return
                t})},e.prototype."
              - "orElse=function(t){var o=this;return
                this.thenInternal(function(s){return S(o,void 0,"
              - "void 0,function(){var r;return $(this,function(n){return
                s.isOk()?[2,s]:(r=t(s.error),"
              - "[2,r instanceof
                e?r.promise:r])})})})},e.prototype.toOption=function(){return
                new U("
              - "this.promise.then(function(t){return
                t.toOption()}))},e.prototype.thenInternal=function(t){"
              - "return new e(this.promise.then(t))},e}();var
                V=function(e,t,o,s){function r(n){return n instanceof o?n:new
                o(function(a){"
              - "a(n)})}return new(o||(o=Promise))(function(n,a){function
                u(p){try{i(s.next(p))}catch(l){"
              - "a(l)}}function c(p){try{i(s.throw(p))}catch(l){a(l)}}function
                i(p){p.done?n(p.value):"
              - "r(p.value).then(u,c)}i((s=s.apply(e,t||[])).next())})},k=funct\
                ion(e,t){var o={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},s,r,n,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(p){return c([i,p])}}function c(i){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(o="
              - "0)),o;)try{if(s=1,r&&(n=i[0]&2?r.return:i[0]?r.throw||((n=r.re\
                turn)&&n.call(r),0):"
              - "r.next)&&!(n=n.call(r,i[1])).done)return
                n;switch(r=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:"
              - "n=i;break;case 4:return o.label++,{value:i[1],done:!1};case
                5:o.label++,r=i[1],i="
              - "[0];continue;case
                7:i=o.ops.pop(),o.trys.pop();continue;default:if(n=o.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){o=0;continue\
                }if(i[0]===3&&(!n||"
              - "i[1]>n[0]&&i[1]<n[3])){o.label=i[1];break}if(i[0]===6&&o.label\
                <n[1]){o.label=n[1],"
              - "n=i;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(i);break\
                }n[2]&&o.ops.pop(),"
              - "o.trys.pop();continue}i=t.call(e,o)}catch(p){i=[6,p],r=0}final\
                ly{s=n=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},U=function(){function e(t){this."
              - "promise=Promise.resolve(t)}return
                e.prototype.andThen=function(t){var o=this;return this."
              - "thenInternal(function(s){return V(o,void 0,void
                0,function(){var r;return k(this,"
              - "function(n){return s.isNone()?[2,s]:(r=t(s.value),[2,r
                instanceof e?r.promise:r])})})})},"
              - "e.prototype.map=function(t){var o=this;return
                this.thenInternal(function(s){return V("
              - "o,void 0,void 0,function(){var r;return
                k(this,function(n){switch(n.label){case 0:"
              - "return s.isNone()?[2,s]:(r=O,[4,t(s.value)]);case
                1:return[2,r.apply(void 0,[n.sent()])]}})})})},"
              - "e.prototype.or=function(t){return this.orElse(function(){return
                t})},e.prototype."
              - "orElse=function(t){var o=this;return
                this.thenInternal(function(s){return V(o,void 0,"
              - "void 0,function(){var r;return k(this,function(n){return
                s.isSome()?[2,s]:(r=t(),"
              - "[2,r instanceof
                e?r.promise:r])})})})},e.prototype.toResult=function(t){return
                new P("
              - "this.promise.then(function(o){return
                o.toResult(t)}))},e.prototype.thenInternal="
              - "function(t){return new e(this.promise.then(t))},e}();var
                B=(e,t,o,s=1)=>t.filter(r=>Object.values(r).some(n=>typeof
                n==\"object\"&&s<o?"
              - "B(e,[n],o,s+1).length>0:n.toString().toLowerCase().includes(e.\
                toLowerCase()))),v=e=>{"
              - "let
                t=e.model,o=e.dataTotalCount||0,s=e.dataStart||0,r=e.dataEnd||0\
                ;return`${t} ${s}\\"
              - "-${r}/${o}`},j=(e,t,o,s={})=>{let
                r=\"util.doFilterResults\";try{if(t.isErr()||t.value."
              - "data===void 0)return
                t;if(console.debug(`${r}::input`,t.value.data),t.value.data!=="
              - "void
                0&&o.queryStringParameters&&o.queryStringParameters.hasOwnPrope\
                rty(\"filter\")){"
              - "let
                n=JSON.parse(o.queryStringParameters.filter);if(n.hasOwnPropert\
                y(\"q\")){let a=n."
              - "q,u=3;t.value.data=B(a,t.value.data,u)}else
                t.value.data=t.value.data.filter(a=>Object."
              - "entries(n).every(([u,c])=>{let
                i=s.hasOwnProperty(u)?s[u]:u;return Array.isArray("
              - "c)?c.includes(a[i]):a[i]===c}))}return
                console.debug(`${r}::output`,t.value.data),"
              - "t}catch(n){let u=`${e}:${r}::unexpected
                exception:${n.message}`;return console.error("
              - "u,n),t}},Y=(e,t,o)=>{let
                s=\"util.doRangeResults\";try{if(t.isErr()||t.value.data==="
              - "void 0)return
                t;if(t.value.dataTotalCount=t.value.data.length,t.value.data!==\
                void 0)"
              - "if(o.queryStringParameters&&o.queryStringParameters.hasOwnProp\
                erty(\"range\")){let["
              - "r,n]=JSON.parse(o.queryStringParameters.range);t.value.dataSta\
                rt=r,t.value.dataEnd="
              - "Math.min(t.value.data.length,r+n),t.value.data=t.value.data.sl\
                ice(r,r+n+1)}else t."
              - "value.dataStart=0,t.value.dataEnd=t.value.data.length||0;return
                t}catch(r){let a=`${e}\\"
              - ":${s}::unexpected exception:${r.message}`;return
                console.error(a,r),d({statusCode:500,"
              - "body:a})}},W=(e,t,o)=>{let
                s=\"util.doSortResults\";try{if(t.isErr())return t;if(t."
              - "value.data!==void
                0&&o.queryStringParameters&&o.queryStringParameters.hasOwnPrope\
                rty("
              - "\"sort\")){let[r,n]=JSON.parse(o.queryStringParameters.sort),a=\
                \"ASC\";switch(n){case\"\\"
              - "NONE\":a=\"NONE\";break;case\"DESC\":a=\"DESC\";break;case\"ASC\
                \":default:a=\"ASC\";break}let u=Rt("
              - "t.value.data,r,a);t.value.data=u}return t}catch(r){let
                a=`${e}:${s}::unexpected \\"
              - "exception:${r.message}`;return
                console.error(a,r),d({statusCode:500,body:a})}};var
                Rt=(e,t,o=\"ASC\")=>{let
                s=\"util.sortResults\";try{if(o===\"NONE\")return e;let r=o==="
              - "\"ASC\"?1:-1,n=(a,u)=>{let c=a[t],i=u[t];return
                c===i?0:(c>i?1:-1)*r};return e.slice()."
              - "sort(n)}catch(r){let a=`${s}::unexpected
                exception:${r.message}`;throw console.error("
              - "a,r),r}};var wt=e=>{let
                t=\"util.getEventWithoutApiInPath\";try{let
                o=\"/api/\",s=\"/\";return{"
              - "...e,__originalEvent:e,rawPath:e.rawPath.replace(o,s),routeKey\
                :e.routeKey.replace("
              - "o,s),requestContext:{...e.requestContext,http:{...e.requestCon\
                text.http,path:e.requestContext."
              - "http.path.replace(o,s)},routeKey:e.requestContext.routeKey.rep\
                lace(o,s)}}}catch(o){"
              - "let r=`${t}::unexpected exception:${o.message}`;throw new
                Error(r)}},M=(e,t,o)=>{"
              - "let
                s=\"util.getPathParameter\";try{if(o.pathParameters)if(o.pathPa\
                rameters.hasOwnProperty("
              - "t)){if(o.pathParameters[t]===void 0)throw new
                Error(`event.pathParameters[${t}] \\"
              - "exists but is undefined`);return m(o.pathParameters[t])}else
                throw new Error(`ev\\"
              - "ent.pathParameters does not have property ${t}`);else throw new
                Error(\"event.pat\\"
              - "hParameters is undefined\")}catch(r){let
                a=`${e}:${s}::${r.message}`;return console."
              - "error(a,r),d({statusCode:400,body:a})}},_=e=>{let
                t=\"util.getRequestBody\";try{if(e."
              - "body){if(typeof e.body!=\"string\")throw new Error(\"event.body
                is not a string\");{"
              - "let o;return
                e.isBase64Encoded?(o=Buffer.from(e.body,\"base64\").toString(\"\
                utf8\"),"
              - "console.debug(`${t}::event.body`,e.body),console.debug(`${t}::\
                body`,o)):o=e.body,"
              - "m(o)}}else throw new Error(\"event.body is
                undefined\")}catch(o){let s=o,r=`${t}::${s."
              - "message}`;return console.error(r,o),d(s.message)}},f=e=>{let
                t=\"util.getStandard\\"
              - "Response\";try{if(e.isErr())return e.error;let
                o=e.value;console.debug(`${t}::inp\\"
              - "ut`,o);let
                r={destinations:\"DestinationId\",directories:\"DirectoryId\",m\
                emberships:\"\\"
              - "MembershipId\",connectUsers:\"Id\",cognitoUsers:\"Username\"}[\
                o.model];console.debug("
              - "`${t}::idKey`,r);let
                n,a,u={};switch(o.action){case\"Create\":n=201,a={...o.data[0],"
              - "id:`${o.data[0][r]}`};break;case\"CreateUser\":n=201,a={...o.d\
                ata[0],id:`${o.data[0][r]}`};"
              - "break;case\"RetrieveBatchGet\":n=200,a=o.data?.map(c=>({...c,i\
                d:`${c[r]}`})),u[\"Co\\"
              - "ntent-Range\"]=v(o);break;case\"RetrieveGet\":n=200,a={...o.da\
                ta[0],id:`${o.data[0][r]}`};"
              - "break;case\"RetrieveQuery\":n=200,a=o.data?.map(c=>({...c,id:`\
                ${c[r]}`})),u[\"Conte\\"
              - "nt-Range\"]=v(o);break;case\"RetrieveScan\":n=200,a=o.data?.ma\
                p(c=>({...c,id:`${c[r]}`})),"
              - "u[\"Content-Range\"]=v(o);break;case\"Update\":n=200,a={...o.d\
                ata[0],id:`${o.data[0][r]}`};"
              - "break;case\"UpdateUser\":n=200,a={...o.data[0],id:`${o.data[0]\
                [r]}`};break;case\"De\\"
              - "lete\":n=204,a=\"\";break;case\"AdminDeleteUser\":n=204,a=\"\"\
                ;break;case\"DescribeUser\":"
              - "n=200,a={...o.data[0],id:`${o.data[0][r]}`};break;case\"AdminG\
                etUser\":n=200,a={...o."
              - "data[0],id:`${o.data[0][r]}`};break;case\"ListUsers\":n=200,a=\
                o.data?.map(c=>({...c,"
              - "id:`${c[r]}`})),u[\"Content-Range\"]=v(o);break;default:throw
                new Error(`${t}::une\\"
              - "xpected
                action::${JSON.stringify(o)}`)}return{statusCode:n,body:JSON.st\
                ringify(a),"
              - "headers:u}}catch(o){let s=o;throw
                console.error(`${t}::unexpected exception:${s."
              - "message}`,o),new Error(s.message)}},x=async(e,t,o,s)=>{try{let
                r=`${e}::handleRe\\"
              - "quest`,n=wt(t),a=null;try{(!process.env.NODE_ENV||process.env.\
                NODE_ENV!==\"test\")&&"
              - "console.debug(`${r}::Received
                event`,JSON.stringify(n),n),n.routeKey in s?a=await s[n."
              - "routeKey](n,o):(console.log(`${r}::Didn't find '${n.routeKey}'
                in route map: ${JSON."
              - "stringify(s)}}`),a={statusCode:500,body:`${r}::${n.routeKey}:R\
                outing map incorre\\"
              - "ct`})}catch(u){let
                c=u;console.error(`${r}::error:${c.message}`,u),a={statusCode:5\
                00,"
              - "body:c.message}}finally{a||(a={statusCode:500,body:`${r}::Route
                dispatch failed`});"
              - "try{let u=JSON.parse(a.body)}catch{let
                u=a;u.body=JSON.stringify(u.body),a=u}finally{"
              - "try{(!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&\
                console.info(`${r}::${n."
              - "routeKey}::result`,a,btoa(JSON.stringify(a)))}catch(u){console\
                .error(`${r}::${n."
              - "routeKey}::result::error`,u,a)}return a}}}catch(r){return
                console.error(`handler\\"
              - "::error:${r.message}`,r),{statusCode:500,body:JSON.stringify({\
                message:\"Something\\"
              - " has gone very wrong.\"})}}},E=(e,t,o)=>{let
                s=\"util.validateRouteTestAware\";try{"
              - "return
                o.routeKey!==t?d({statusCode:500,body:`${e}:${s}::Routing map
                incorrect`}):"
              - "process.env.NODE_ENV&&process.env.NODE_ENV===\"test\"?d({statu\
                sCode:200,body:`${e}\\"
              - ":${s}::jest ${t}`}):m(\"\")}catch(r){let
                a=`${e}:${s}::::unexpected exception:${r."
              - "message}`;throw new Error(a)}};var
                g=require(\"@aws-sdk/client-cognito-identity-provider\");var
                w={},It=()=>(w&&w.hasOwnProperty(\"region\")||(process.env.hasO\
                wnProperty(\"COG\\"
              - "NITO_AWS_REGION\")&&process.env.COGNITO_AWS_REGION?w={region:p\
                rocess.env.COGNITO_AWS_REGION}:"
              - "w={region:\"us-east-1\"}),w),b=\"\",N=()=>{if(!(b&&b.length>0)\
                )if(process.env.hasOwnProperty("
              - "\"COGNITO_USER_POOLID\")&&process.env.COGNITO_USER_POOLID)b=pr\
                ocess.env.COGNITO_USER_POOLID,"
              - "console.debug(\"lib.congnito.getUserPoolId:: setting
                userPoolId\",b);else throw\"La\\"
              - "mbda environment variable COGNITO_USER_POOLID must be
                set\";return b},I=new g.CognitoIdentityProviderClient("
              - "It()),z=e=>{let
                t=\"cognito.makeCognitoUsersRetrieveManyCommand\";try{let
                s={model:\"\\"
              - "cognitoUsers\",action:\"ListUsers\",input:{UserPoolId:N()}};re\
                turn m(s)}catch(o){let r=`${e}\\"
              - ":${t}::unexpected exception:${o.message}`;throw new
                Error(r)}},D=(e,t,o)=>{let s=\"\\"
              - "cognito.makeCognitoUsersRetrieveOneCommand\";try{console.debug\
                (`${e}:${s}::event`,"
              - "t);let r=M(e,o,t),n;if(r.isErr())return r;n=r.value;let
                u={model:\"cognitoUsers\","
              - "action:\"AdminGetUser\",input:{UserPoolId:N(),Username:n}};ret\
                urn m(u)}catch(r){let a=`${e}\\"
              - ":${s}::unexpected exception:${r.message}`;throw new
                Error(a)}},Z=(e,t)=>{let o=\"\\"
              - "cognito.makeCognitoUsersUpdateOneCommand\";try{let
                r={model:\"cognitoUsers\",action:\"\\"
              - "UpdateUser\",input:{UserPoolId:N(),Username:t.Username,UserAtt\
                ributes:t.Attributes}};"
              - "return m(r)}catch(s){let n=`${e}:${o}::unexpected
                exception:${s.message}`;throw new Error("
              - "n)}},tt=(e,t)=>{let
                o=\"cognito.makeCognitoUsersCreateCommand\";try{let
                r={model:\"\\"
              - "cognitoUsers\",action:\"CreateUser\",input:{UserPoolId:N(),Use\
                rname:t.Username,UserAttributes:t."
              - "Attributes}};return m(r)}catch(s){let n=`${e}:${o}::unexpected
                exception:${s.message}`;"
              - "throw new Error(n)}},et=(e,t,o)=>{let
                s=\"cognito.makeCognitoUsersDeleteOneComman\\"
              - "d\";try{console.debug(`${e}:${s}::event`,t);let
                r=M(e,o,t),n;if(r.isErr())return r;"
              - "n=r.value;let
                u={model:\"cognitoUsers\",action:\"AdminDeleteUser\",input:{Use\
                rPoolId:N(),"
              - "Username:n}};return m(u)}catch(r){let a=`${e}:${s}::unexpected
                exception:${r.message}`;"
              - "throw new Error(a)}},rt=async(e,t)=>{if(t.isErr())return t;let
                o=t.value,s=\"cogn\\"
              - "ito.runCognitoUsersRetrieveMany\";try{let
                r=o.input;console.debug(`${e}:${s}::inp\\"
              - "ut`,r);let n=[],a=\"\",u;do
                a.length>0&&(r.PaginationToken=a),a=\"\",console.debug(`${e}\\"
              - ":${s}::input`,r),u=await I.send(new
                g.ListUsersCommand(r)),console.debug(`${e}:${s}\\"
              - "::response`,u,btoa(JSON.stringify(u))),u.PaginationToken&&(a=u\
                .PaginationToken),"
              - "u.Users&&(n=n.concat(u.Users));while(a.length>0);return
                console.debug(`${e}:${s}\\"
              - "::userData`,n),m({...o,data:n,output:u})}catch(r){let
                a=`${e}:${s}::${r.message}`;"
              - "return
                console.error(a,r),d({statusCode:500,body:a})}},G=async(e,t)=>{\
                if(t.isErr())"
              - "return t;let
                o=t.value,s=\"cognito.runCognitoUsersRetrieveOne\";try{console.\
                debug("
              - "`${e}:${s}::command.input`,o.input);let r=await I.send(new
                g.AdminGetUserCommand("
              - "o.input));console.debug(`${e}:${s}::result`,r);let n=r;delete
                n.$metadata;let a={"
              - "...o,data:[n],output:r};return
                console.debug(`${e}:${s}::output`,a),m(a)}catch(r){"
              - "let a=`${e}:${s}::${r.message}`;return console.error(a,r),r
                instanceof g.UserNotFoundException?"
              - "d({statusCode:404,body:a}):d({statusCode:500,body:a})}},ot=asy\
                nc(e,t)=>{if(t.isErr())"
              - "return t;let
                o=t.value,s=\"cognito.runCognitoUsersDeleteOne\";try{console.de\
                bug(`${e}\\"
              - ":${s}::command.input`,o.input);let r=await I.send(new
                g.AdminDeleteUserCommand(o."
              - "input));console.debug(`${e}:${s}::result`,r);let
                n={...o,output:r};return console."
              - "debug(`${e}:${s}::output`,n),m(n)}catch(r){let
                a=`${e}:${s}::${r.message}`;return console."
              - "error(a,r),r instanceof
                g.UserNotFoundException?d({statusCode:404,body:a}):d({statusCod\
                e:500,"
              - "body:a})}},nt=async(e,t)=>{if(t.isErr())return t;let
                o=t.value,s=\"cognito.runCog\\"
              - "nitoUsersUpdateOne\";try{console.debug(`${e}:${s}::command.inp\
                ut`,o.input);let r=await I."
              - "send(new
                g.AdminUpdateUserAttributesCommand(o.input));console.debug(`${e\
                }:${s}::\\"
              - "result`,r);let
                n=JSON.parse(JSON.stringify(o.input)),a={...o,data:[n],output:r\
                };"
              - "return console.debug(`${e}:${s}::output`,a),m(a)}catch(r){let
                a=`${e}:${s}::${r."
              - "message}`;return
                console.error(a,r),d({statusCode:500,body:a})}},st=async(e,t)=>\
                {"
              - "if(t.isErr())return t;let
                o=t.value,s=\"cognito.runCognitoUsersCreate\";try{console."
              - "debug(`${e}:${s}::command.input`,o.input);let r=await
                I.send(new g.AdminCreateUserCommand("
              - "o.input));console.debug(`${e}:${s}::result`,r);let
                n={...o,data:[r.User],output:r};"
              - "return console.debug(`${e}:${s}::output`,n),m(n)}catch(r){let
                a=`${e}:${s}::${r."
              - "message}`;return
                console.error(a,r),d({statusCode:500,body:a})}};var
                at=async(e,t)=>{let
                o=\"aws-cognito.runCognitoUsersAddToGroup\";try{console.debug("
              - "`${e}:${o}::commandInput`,t);let s=await I.send(new
                g.AdminAddUserToGroupCommand("
              - "t));return console.debug(`${e}:${o}::result`,s),m(void
                0)}catch(s){let r=s;return console."
              - "error(`${e}:${o}::error`,r),d({message:\"resources.cognitoUser\
                s.validation.fatalE\\"
              - "rror\",detail:r.message,errorSource:\"SERVER\",originalError:r\
                })}};var Ut=async e=>{let
                t=\"cognitoUsers.get\",o=\"cognitoUsers\";(!process.env.NODE_EN\
                V||"
              - "process.env.NODE_ENV!==\"test\")&&console.debug(`${t}::Received
                event`,JSON.stringify("
              - "e),e);let s=E(t,`GET /${o}`,e);if(s.isErr())return s.error;let
                r,n;e.queryStringParameters&&"
              - "e.queryStringParameters.filter&&(r=JSON.parse(e.queryStringPar\
                ameters.filter),console."
              - "debug(`${t}::filter`,r)),r?r.hasOwnProperty(\"q\")?n=\"SCAN_SE\
                ARCH\":r.hasOwnProperty("
              - "\"id\")||r.hasOwnProperty(\"Id\")||r.hasOwnProperty(\"Destinat\
                ionId\")?n=\"BATCH_GET\":n="
              - "\"SCAN_EXACT\":n=\"SCAN_ALL\",console.debug(`${t}::queryFilter\
                Mode`,n);let a,u=z(o),"
              - "c=await rt(t,u);n===\"SCAN_ALL\"?a=c:a=j(t,c,e);let
                i=A(t,a),p=W(t,i,e),l=Y(t,p,e);"
              - "return f(l)};var it={\"GET /cognitoUsers\":Ut};var Pt=async
                e=>{let
                t=\"cognitoUsers.getId\",o=\"cognitoUsers\",s=\"Id\";(!process.\
                env."
              - "NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(`${t\
                }::Received event`,JSON."
              - "stringify(e),e);let r=E(t,`GET
                /${o}/{${s}}`,e);if(r.isErr())return r.error;let n=D("
              - "t,e,s),a=await G(t,n),u=A(t,a);return f(u)};var ut={\"GET
                /cognitoUsers/{Id}\":Pt};var vt=async e=>{let
                t=\"cognitoUsers.deleteId\",o=\"cognitoUsers\",s=\"Id\";(!proce\
                ss."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${t}::Received even\\"
              - "t`,JSON.stringify(e),e);let r=E(t,`DELETE
                /${o}/{${s}}`,e);if(r.isErr())return r."
              - "error;let n=et(t,e,s),a=await ot(t,n);return f(a)};var
                ct={\"DELETE /cognitoUsers/{Id}\":vt};var bt=async e=>{let
                t=\"cognitoUsers.putId\",o=\"cognitoUsers\",s=\"Id\";(!process.\
                env."
              - "NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(`${t\
                }::Received event`,JSON."
              - "stringify(e),e);let r=E(t,`PUT
                /${o}/{${s}}`,e);if(r.isErr())return r.error;let n=T("
              - "_(e));if(n.isErr())return n.error;let
                a=n.value,u=Z(o,a),c=await nt(t,u);if(c.isErr())"
              - "return f(c);let i=D(t,e,s),p=await G(t,i),l=A(t,p);return
                f(l)};var pt={\"PUT /cognitoUsers/{Id}\":bt};var Nt=async
                e=>{let
                t=\"cognitoUsers.post\",o=\"cognitoUsers\";(!process.env.NODE_E\
                NV||"
              - "process.env.NODE_ENV!==\"test\")&&console.debug(`${t}::Received
                event`,JSON.stringify("
              - "e),e);let s=E(t,`POST /${o}`,e);if(s.isErr())return s.error;let
                r=T(_(e),{requireUsername:!1,"
              - "reguireAttributes:!1});if(r.isErr())return r.error;let
                n=r.value;n.Username.length=="
              - "0&&(n.Username=n.User.email);let a=tt(o,n),u=await
                st(t,a);if(u.isErr())return f("
              - "u);let
                c=[\"Administrators\"],i=process.env.CONNECT_INSTANCE_ID;i&&c.p\
                ush(i),c.forEach("
              - "async l=>{let
                F={UserPoolId:process.env.COGNITO_USER_POOL_ID,Username:n.Usern\
                ame,"
              - "GroupName:l};console.debug(`${t}::Adding user to group`,F);let
                $t=await at(t,F)});"
              - "let p=A(t,u);return f(p)};var dt={\"POST
                /cognitoUsers\":Nt};var Tt=async(e,t)=>await
                x(\"cognitoUsers\",e,t,{...mt.routes}),T=(e,t={})=>{if(e."
              - "isErr())return e;let
                o=\"cognitoUsers.parseCognitoUser\";try{let
                s=JSON.parse(e.value);"
              - "if(!s.User.email||typeof
                s.User.email!=\"string\"||s.User.email.length==0)throw new
                Error("
              - "\"email is required\");if(!s.User.name||typeof
                s.User.name!=\"string\"||s.User.name."
              - "length==0)throw new Error(\"name is
                required\");if((!s.Username||typeof s.Username!="
              - "\"string\"||s.Username.length==0)&&(t.requireUsername??!0))thr\
                ow new Error(\"Userna\\"
              - "me is
                required\");if(!s.hasOwnProperty(\"Attributes\")&&(t.reguireAtt\
                ributes??!0))throw new Error("
              - "\"Attributes is
                required\");s.hasOwnProperty(\"Attributes\")||(s.Attributes=[])\
                ,s.Attributes="
              - "s.Attributes.filter(n=>n.Name!=\"sub\"),s.Attributes.push({Nam\
                e:\"name\",Value:s.User."
              - "name}),s.Attributes.push({Name:\"email\",Value:s.User.email});\
                let r={Username:s.Username,"
              - "User:s.User,Attributes:s.Attributes};return m(r)}catch(s){let
                n=`${o}::${s.message}`;"
              - "return
                console.error(n,s),d({statusCode:400,body:n})}},A=(e,t)=>{let
                o=\"cognito.\\"
              - "cognitoAttributesFormat\";try{if(t.isErr())return t;let
                s=t.value;return s.data&&"
              - "s.data.forEach(r=>{if(r.hasOwnProperty(\"UserAttributes\")&&(r\
                .Attributes=r.UserAttributes,"
              - "delete r.UserAttributes),r.hasOwnProperty(\"Attributes\")){let
                n={},a=[];r.Attributes."
              - "forEach(c=>{c.Name&&c.Name!==\"undefined\"&&([\"name\",\"email\
                \"].includes(c.Name)?n[c."
              - "Name]=c.Value:a.push(c))}),r.User=n,r.Attributes=a}}),m(s)}cat\
                ch(s){let n=`${e}:${o}\\"
              - "::${s.message}`;return
                console.error(n,s),d({statusCode:500,body:n})}},mt={routes:{"
              - "...it,...pt,...ut,...dt,...ct}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          COGNITO_USER_POOLID:
            Ref: "CognitoUserPool279BBD48"
          CONNECT_INSTANCE_ID:
            Ref: "ConnectInstance"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ApiCognitoUsersLambdaServiceRole5215BE82"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn:
      - "ApiCognitoUsersLambdaServiceRoleDefaultPolicy7B59424C"
  ApiCognitoUserRpcLambdaServiceRoleA1605B39:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ApiCognitoUserRpcLambdaServiceRoleDefaultPolicy579C262E:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "cognito-idp:AdminAddUserToGroup"
              - "cognito-idp:AdminCreateUser"
              - "cognito-idp:AdminDeleteUser"
              - "cognito-idp:AdminDisableUser"
              - "cognito-idp:AdminEnableUser"
              - "cognito-idp:AdminGetUser"
              - "cognito-idp:AdminSetUserPassword"
              - "cognito-idp:AdminUpdateUserAttributes"
              - "cognito-idp:ListUsers"
            Effect: "Allow"
            Resource:
              Fn::GetAtt:
                - "CognitoUserPool279BBD48"
                - "Arn"
        Version: "2012-10-17"
      PolicyName: "ApiCognitoUserRpcLambdaServiceRoleDefaultPolicy579C262E"
      Roles:
        - Ref: "ApiCognitoUserRpcLambdaServiceRoleA1605B39"
  ApiCognitoUserRpcLambda6E542BFD:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var v=Object.defineProperty;var
                B=Object.getOwnPropertyDescriptor;var
                j=Object.getOwnPropertyNames;var
                W=Object.prototype.hasOwnProperty;var Y=(t,e)=>{for(var r in
                e)v(t,r,{get:e[r],enumerable:!0})},Q=(t,e,r,s)=>{if(e&&"
              - "typeof e==\"object\"||typeof e==\"function\")for(let n of
                j(e))!W.call(t,n)&&n!==r&&"
              - "v(t,n,{get:()=>e[n],enumerable:!(s=B(e,n))||s.enumerable});ret\
                urn t};var K=t=>Q(v({},\"__esModule\",{value:!0}),t);var
                ct={};Y(ct,{cognitoClient:()=>b,cognitoUser:()=>F,handler:()=>n\
                t});module.exports="
              - "K(ct);var
                y=require(\"@aws-sdk/client-cognito-identity-provider\");functi\
                on f(t){var e=String(t);if(e===\"[object
                Object]\")try{e=JSON.stringify(t)}catch{}"
              - "return e}var X=function(){function t(){}return
                t.prototype.isSome=function(){return!1},t."
              - "prototype.isNone=function(){return!0},t.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){"
              - "return e},t.prototype.expect=function(e){throw new
                Error(\"\".concat(e))},t.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},t.prototype.map=function(e){"
              - "return this},t.prototype.mapOr=function(e,r){return
                e},t.prototype.mapOrElse=function(e,r){"
              - "return e()},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){"
              - "return e()},t.prototype.andThen=function(e){return
                this},t.prototype.toResult=function(e){"
              - "return
                m(e)},t.prototype.toString=function(){return\"None\"},t.prototy\
                pe.toAsyncOption="
              - "function(){return new A(O)},t}(),O=new X;Object.freeze(O);var
                z=function(){function t(e){"
              - "if(!(this instanceof t))return new t(e);this.value=e}return
                t.prototype.isSome=function(){"
              - "return!0},t.prototype.isNone=function(){return!1},t.prototype[\
                Symbol.iterator]=function(){"
              - "var e=Object(this.value);return Symbol.iterator in
                e?e[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){return this.value},"
              - "t.prototype.expect=function(e){return
                this.value},t.prototype.unwrap=function(){"
              - "return this.value},t.prototype.map=function(e){return
                E(e(this.value))},t.prototype."
              - "mapOr=function(e,r){return
                r(this.value)},t.prototype.mapOrElse=function(e,r){return r("
              - "this.value)},t.prototype.or=function(e){return
                this},t.prototype.orElse=function(e){"
              - "return this},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.toResult="
              - "function(e){return
                l(this.value)},t.prototype.toAsyncOption=function(){return new
                A("
              - "this)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype.toString="
              - "function(){return\"Some(\".concat(f(this.value),\")\")},t.EMPT\
                Y=new t(void 0),t}(),E=z,"
              - "D;(function(t){function e(){for(var
                n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];"
              - "for(var i=[],u=0,d=n;u<d.length;u++){var
                a=d[u];if(a.isSome())i.push(a.value);else"
              - "return a}return E(i)}t.all=e;function r(){for(var
                n=[],o=0;o<arguments.length;o++)"
              - "n[o]=arguments[o];for(var i=0,u=n;i<u.length;i++){var
                d=u[i];if(d.isSome())return d}"
              - "return O}t.any=r;function s(n){return n instanceof
                E||n===O}t.isOption=s})(D||(D="
              - "{}));var Z=function(){function t(e){if(!(this instanceof
                t))return new t(e);this.error="
              - "e;var r=new Error().stack.split(`"
              - "`).slice(2);r&&r.length>0&&r[0].includes(\"ErrImpl\")&&r.shift\
                (),this._stack=r.join("
              - "`"
              - "`)}return
                t.prototype.isOk=function(){return!1},t.prototype.isErr=functio\
                n(){return!0},"
              - "t.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "t.prototype.else=function(e){return
                e},t.prototype.unwrapOr=function(e){return e},"
              - "t.prototype.expect=function(e){throw new Error(\"\".concat(e,\"
                - Error: \").concat("
              - "f(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.expect\
                Err=function(e){return this."
              - "error},t.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "f(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.unwrap\
                Err=function(){return this."
              - "error},t.prototype.map=function(e){return
                this},t.prototype.andThen=function(e){"
              - "return this},t.prototype.mapErr=function(e){return new
                m(e(this.error))},t.prototype."
              - "mapOr=function(e,r){return
                e},t.prototype.mapOrElse=function(e,r){return e(this."
              - "error)},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){return e("
              - "this.error)},t.prototype.toOption=function(){return
                O},t.prototype.toString=function(){"
              - "return\"Err(\".concat(f(this.error),\")\")},Object.definePrope\
                rty(t.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),t.prot\
                otype.toAsyncResult="
              - "function(){return new I(this)},t.EMPTY=new t(void 0),t}();var
                m=Z,tt=function(){function t(e){if(!(this instanceof t))return
                new t(e);this."
              - "value=e}return
                t.prototype.isOk=function(){return!0},t.prototype.isErr=functio\
                n(){"
              - "return!1},t.prototype[Symbol.iterator]=function(){var
                e=Object(this.value);return Symbol."
              - "iterator in
                e?e[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "t.prototype.else=function(e){return
                this.value},t.prototype.unwrapOr=function(e){"
              - "return this.value},t.prototype.expect=function(e){return
                this.value},t.prototype."
              - "expectErr=function(e){throw new
                Error(e)},t.prototype.unwrap=function(){return this."
              - "value},t.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "f(this.value)),{cause:this.value})},t.prototype.map=function(e\
                ){return new l(e(this."
              - "value))},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.mapErr="
              - "function(e){return this},t.prototype.mapOr=function(e,r){return
                r(this.value)},t."
              - "prototype.mapOrElse=function(e,r){return
                r(this.value)},t.prototype.or=function(e){"
              - "return this},t.prototype.orElse=function(e){return
                this},t.prototype.toOption=function(){"
              - "return E(this.value)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype."
              - "toString=function(){return\"Ok(\".concat(f(this.value),\")\")}\
                ,t.prototype.toAsyncResult="
              - "function(){return new I(this)},t.EMPTY=new t(void 0),t}();var
                l=tt,G;(function(t){function e(){for(var
                i=[],u=0;u<arguments.length;u++)i[u]="
              - "arguments[u];for(var d=[],a=0,c=i;a<c.length;a++){var
                p=c[a];if(p.isOk())d.push("
              - "p.value);else return p}return new l(d)}t.all=e;function
                r(){for(var i=[],u=0;u<arguments."
              - "length;u++)i[u]=arguments[u];for(var
                d=[],a=0,c=i;a<c.length;a++){var p=c[a];if(p."
              - "isOk())return p;d.push(p.error)}return new
                m(d)}t.any=r;function s(i){try{return new l("
              - "i())}catch(u){return new m(u)}}t.wrap=s;function
                n(i){try{return i().then(function(u){"
              - "return new l(u)}).catch(function(u){return new
                m(u)})}catch(u){return Promise.resolve("
              - "new m(u))}}t.wrapAsync=n;function o(i){return i instanceof m||i
                instanceof l}t.isResult="
              - "o})(G||(G={}));var U=function(t,e,r,s){function n(o){return o
                instanceof r?o:new r(function(i){"
              - "i(o)})}return new(r||(r=Promise))(function(o,i){function
                u(c){try{a(s.next(c))}catch(p){"
              - "i(p)}}function d(c){try{a(s.throw(c))}catch(p){i(p)}}function
                a(c){c.done?o(c.value):"
              - "n(c.value).then(u,d)}a((s=s.apply(t,e||[])).next())})},P=funct\
                ion(t,e){var r={label:0,"
              - "sent:function(){if(o[0]&1)throw o[1];return
                o[1]},trys:[],ops:[]},s,n,o,i;return i="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(i[Symbol.iterator]="
              - "function(){return this}),i;function u(a){return
                function(c){return d([a,c])}}function d(a){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;i&&(i=0,a[0]&&(r="
              - "0)),r;)try{if(s=1,n&&(o=a[0]&2?n.return:a[0]?n.throw||((o=n.re\
                turn)&&o.call(n),0):"
              - "n.next)&&!(o=o.call(n,a[1])).done)return
                o;switch(n=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:"
              - "o=a;break;case 4:return r.label++,{value:a[1],done:!1};case
                5:r.label++,n=a[1],a="
              - "[0];continue;case
                7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o="
              - "o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue\
                }if(a[0]===3&&(!o||"
              - "a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label\
                <o[1]){r.label=o[1],"
              - "o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break\
                }o[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}a=e.call(t,r)}catch(c){a=[6,c],n=0}final\
                ly{s=o=0}if(a[0]&5)"
              - "throw a[1];return{value:a[0]?a[1]:void
                0,done:!0}}},I=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var r=this;return this."
              - "thenInternal(function(s){return U(r,void 0,void
                0,function(){var n;return P(this,"
              - "function(o){return s.isErr()?[2,s]:(n=e(s.value),[2,n
                instanceof t?n.promise:n])})})})},"
              - "t.prototype.map=function(e){var r=this;return
                this.thenInternal(function(s){return U("
              - "r,void 0,void 0,function(){var n;return
                P(this,function(o){switch(o.label){case 0:"
              - "return s.isErr()?[2,s]:(n=l,[4,e(s.value)]);case
                1:return[2,n.apply(void 0,[o.sent()])]}})})})},"
              - "t.prototype.mapErr=function(e){var r=this;return
                this.thenInternal(function(s){return U("
              - "r,void 0,void 0,function(){var n;return
                P(this,function(o){switch(o.label){case 0:"
              - "return s.isOk()?[2,s]:(n=m,[4,e(s.error)]);case
                1:return[2,n.apply(void 0,[o.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var r=this;return
                this.thenInternal(function(s){return U(r,void 0,"
              - "void 0,function(){var n;return P(this,function(o){return
                s.isOk()?[2,s]:(n=e(s.error),"
              - "[2,n instanceof
                t?n.promise:n])})})})},t.prototype.toOption=function(){return
                new A("
              - "this.promise.then(function(e){return
                e.toOption()}))},t.prototype.thenInternal=function(e){"
              - "return new t(this.promise.then(e))},t}();var
                N=function(t,e,r,s){function n(o){return o instanceof r?o:new
                r(function(i){"
              - "i(o)})}return new(r||(r=Promise))(function(o,i){function
                u(c){try{a(s.next(c))}catch(p){"
              - "i(p)}}function d(c){try{a(s.throw(c))}catch(p){i(p)}}function
                a(c){c.done?o(c.value):"
              - "n(c.value).then(u,d)}a((s=s.apply(t,e||[])).next())})},S=funct\
                ion(t,e){var r={label:0,"
              - "sent:function(){if(o[0]&1)throw o[1];return
                o[1]},trys:[],ops:[]},s,n,o,i;return i="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(i[Symbol.iterator]="
              - "function(){return this}),i;function u(a){return
                function(c){return d([a,c])}}function d(a){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;i&&(i=0,a[0]&&(r="
              - "0)),r;)try{if(s=1,n&&(o=a[0]&2?n.return:a[0]?n.throw||((o=n.re\
                turn)&&o.call(n),0):"
              - "n.next)&&!(o=o.call(n,a[1])).done)return
                o;switch(n=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:"
              - "o=a;break;case 4:return r.label++,{value:a[1],done:!1};case
                5:r.label++,n=a[1],a="
              - "[0];continue;case
                7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o="
              - "o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue\
                }if(a[0]===3&&(!o||"
              - "a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label\
                <o[1]){r.label=o[1],"
              - "o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break\
                }o[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}a=e.call(t,r)}catch(c){a=[6,c],n=0}final\
                ly{s=o=0}if(a[0]&5)"
              - "throw a[1];return{value:a[0]?a[1]:void
                0,done:!0}}},A=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var r=this;return this."
              - "thenInternal(function(s){return N(r,void 0,void
                0,function(){var n;return S(this,"
              - "function(o){return s.isNone()?[2,s]:(n=e(s.value),[2,n
                instanceof t?n.promise:n])})})})},"
              - "t.prototype.map=function(e){var r=this;return
                this.thenInternal(function(s){return N("
              - "r,void 0,void 0,function(){var n;return
                S(this,function(o){switch(o.label){case 0:"
              - "return s.isNone()?[2,s]:(n=E,[4,e(s.value)]);case
                1:return[2,n.apply(void 0,[o.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var r=this;return
                this.thenInternal(function(s){return N(r,void 0,"
              - "void 0,function(){var n;return S(this,function(o){return
                s.isSome()?[2,s]:(n=e(),"
              - "[2,n instanceof
                t?n.promise:n])})})})},t.prototype.toResult=function(e){return
                new I("
              - "this.promise.then(function(r){return
                r.toResult(e)}))},t.prototype.thenInternal="
              - "function(e){return new t(this.promise.then(e))},t}();var
                rt=t=>{let e=\"util.getEventWithoutApiInPath\";try{let
                r=\"/api/\",s=\"/\";return{"
              - "...t,__originalEvent:t,rawPath:t.rawPath.replace(r,s),routeKey\
                :t.routeKey.replace("
              - "r,s),requestContext:{...t.requestContext,http:{...t.requestCon\
                text.http,path:t.requestContext."
              - "http.path.replace(r,s)},routeKey:t.requestContext.routeKey.rep\
                lace(r,s)}}}catch(r){"
              - "let n=`${e}::unexpected exception:${r.message}`;throw new
                Error(n)}},T=(t,e,r)=>{"
              - "let
                s=\"util.getPathParameter\";try{if(r.pathParameters)if(r.pathPa\
                rameters.hasOwnProperty("
              - "e)){if(r.pathParameters[e]===void 0)throw new
                Error(`event.pathParameters[${e}] \\"
              - "exists but is undefined`);return l(r.pathParameters[e])}else
                throw new Error(`ev\\"
              - "ent.pathParameters does not have property ${e}`);else throw new
                Error(\"event.pat\\"
              - "hParameters is undefined\")}catch(n){let
                i=`${t}:${s}::${n.message}`;return console."
              - "error(i,n),m({statusCode:400,body:i})}};var
                L=async(t,e,r,s)=>{try{let
                n=`${t}::handleRequest`,o=rt(e),i=null;try{(!process."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${n}::Received even\\"
              - "t`,JSON.stringify(o),o),o.routeKey in s?i=await
                s[o.routeKey](o,r):(console.log("
              - "`${n}::Didn't find '${o.routeKey}' in route map:
                ${JSON.stringify(s)}}`),i={statusCode:500,"
              - "body:`${n}::${o.routeKey}:Routing map incorrect`})}catch(u){let
                d=u;console.error("
              - "`${n}::error:${d.message}`,u),i={statusCode:500,body:d.message\
                }}finally{i||(i={statusCode:500,"
              - "body:`${n}::Route dispatch failed`});try{let
                u=JSON.parse(i.body)}catch{let u=i;"
              - "u.body=JSON.stringify(u.body),i=u}finally{try{(!process.env.NO\
                DE_ENV||process.env."
              - "NODE_ENV!==\"test\")&&console.info(`${n}::${o.routeKey}::resul\
                t`,i,btoa(JSON.stringify("
              - "i)))}catch(u){console.error(`${n}::${o.routeKey}::result::erro\
                r`,u,i)}return i}}}catch(n){"
              - "return
                console.error(`handler::error:${n.message}`,n),{statusCode:500,\
                body:JSON."
              - "stringify({message:\"Something has gone very
                wrong.\"})}}},V=(t,e,r)=>{let s=\"util\\"
              - ".validateRouteTestAware\";try{return
                r.routeKey!==e?m({statusCode:500,body:`${t}:${s}\\"
              - "::Routing map
                incorrect`}):process.env.NODE_ENV&&process.env.NODE_ENV===\"test\
                \"?m("
              - "{statusCode:200,body:`${t}:${s}::jest
                ${e}`}):l(\"\")}catch(n){let i=`${t}:${s}:::\\"
              - ":unexpected exception:${n.message}`;throw new Error(i)}};var
                g=require(\"@aws-sdk/client-cognito-identity-provider\");var
                h={},ot=()=>(h&&h.hasOwnProperty(\"region\")||(process.env.hasO\
                wnProperty(\"COG\\"
              - "NITO_AWS_REGION\")&&process.env.COGNITO_AWS_REGION?h={region:p\
                rocess.env.COGNITO_AWS_REGION}:"
              - "h={region:\"us-east-1\"}),h);var $=new
                g.CognitoIdentityProviderClient(ot());var M=async(t,e)=>{let
                r=\"aws-cognito.resetUserPasswordByEmail\",{userPoolId:s,userna\
                me:n}=e,"
              - "o=e.usernameAttr||\"email\",i={UserPoolId:s,Username:n};try{co\
                nsole.debug(`${t}:${r}\\"
              - "::AdminGetUserCommand:input`,i);let u=await $.send(new
                g.AdminGetUserCommand(i));"
              - "console.debug(`${t}:${r}::AdminGetUserCommand:result`,u);let
                d=u.UserAttributes?."
              - "find(p=>p.Name===o)?.Value;if(d)if(u.UserStatus===\"FORCE_CHAN\
                GE_PASSWORD\")console."
              - "debug(`${t}:${r}::User is already in FORCE_CHANGE_PASSWORD
                state`);else{console."
              - "debug(`${t}:${r}::Need to reset user password / create
                FORCE_CHANGE_PASSWORD sta\\"
              - "te`);let
                p=(Math.random().toString(36)+Math.random().toString(36).toUppe\
                rCase())."
              - "split(\"\").sort(function(){return
                .5-Math.random()}).join(\"\"),J={...i,Password:p,"
              - "Permanent:!1};console.debug(`${t}:${r}:AdminSetUserPasswordCom\
                mand:input`,u);let H=await $."
              - "send(new
                g.AdminSetUserPasswordCommand(J));console.debug(`${t}:${r}::Adm\
                inSetUse\\"
              - "rPasswordCommand:result`,H)}else return
                console.debug(`${t}:${r}::User doesn't h\\"
              - "ave email, this should not be possible.
                Stopping.`),m({message:\"resources.cognit\\"
              - "oUsers.validation.fatalError\",detail:\"The user was found but
                does not have an 'e\\"
              - "mail' attribute, which means the AWS Cognito user record is
                broken. Try deleting\\"
              - " and recreating the user.\",errorSource:\"SERVER\"});let
                a={DesiredDeliveryMediums:["
              - "\"EMAIL\"],MessageAction:\"RESEND\",UserPoolId:s,Username:d};c\
                onsole.debug(`${t}:${r}\\"
              - "::Creating and emailing new random/temporary password by
                invoking AdminCreateUse\\"
              - "rCommand...`),console.debug(`${t}:${r}::AdminCreateUserCommand\
                :input`,a);let c=await $."
              - "send(new g.AdminCreateUserCommand(a));return
                console.debug(`${t}:${r}::AdminCrea\\"
              - "teUserCommand:result`,c),l(void 0)}catch(u){let d=u;return
                console.error(`${t}:${r}\\"
              - "::error`,d),m({message:\"resources.cognitoUsers.validation.fat\
                alError\",detail:d.message,"
              - "errorSource:\"SERVER\",originalError:d})}};var
                _={};process.env.hasOwnProperty(\"COGNITO_AWS_REGION\")&&proces\
                s.env.COGNITO_AWS_REGION?"
              - "_={region:process.env.COGNITO_AWS_REGION}:_={region:\"us-east-1\
                \"};var w=\"\";process."
              - "env.hasOwnProperty(\"COGNITO_USER_POOLID\")&&process.env.COGNI\
                TO_USER_POOLID&&(w=process."
              - "env.COGNITO_USER_POOLID||\"\");var b=new
                y.CognitoIdentityProviderClient(_),nt=async(t,e)=>await L("
              - "\"cognitoUserRpc\",t,e,{...F.routes}),q=async(t,e)=>{let
                r=\"cognitoUser.post\";try{"
              - "if((!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&(\
                console.debug(`${r}:\\"
              - ":Received
                event`,JSON.stringify(t),t),w.length===0))throw\"Broken Deploy:
                process\\"
              - ".env.COGNITO_USER_POOLID has no value.\";let s=V(r,\"POST
                /cognitoUser/{usecase}\","
              - "t);if(s.isErr())return s.error;let
                n=\"usecase\",o=T(r,n,t),i;if(o.isErr())return{"
              - "statusCode:400,body:`${o.error}`};switch(i=o.value,console.deb\
                ug(`${r}:usecase::`,"
              - "n,i),i){case\"disableUser\":return
                it(t,e);case\"enableUser\":return ut(t,e);case\"se\\"
              - "tUserPassword\":return at(t,e);case\"resetUserPassword\":return
                st(t,e)}return{statusCode:404,"
              - "body:`/${i} endpoint mapping not
                found`}}catch(s){return{statusCode:500,body:JSON."
              - "stringify(`${r}: ${s}`)}}},st=async(t,e)=>{let
                r=\"cognitoUser.postResetSetUserPa\\"
              - "ssword\";if(console.debug(`${r}::input`,t),t.body===void
                0)throw new Error(\"Reque\\"
              - "st body is undefined\");let
                s=JSON.parse(t.body);if(!s.Username||typeof s.Username!="
              - "\"string\"||s.Username.length==0)throw new Error(\"Username is
                required\");try{let n=await M("
              - "r,{userPoolId:w,username:s.Username});if(console.debug(`${r}::\
                resetUserPasswordC\\"
              - "ommandResult`,n),n.isErr())return{statusCode:n.error.errorSour\
                ce==\"CLIENT\"?400:500,"
              - "body:JSON.stringify(n.error)}}catch(n){let
                o={};n&&n.hasOwnProperty(\"message\")&&"
              - "(o.additionalInfo=n.message);let i={...n,...o};return
                console.debug(`${r}::reset\\"
              - "UserPasswordCommandResult:error`,i),{statusCode:500,body:JSON.\
                stringify(i)}}return{"
              - "statusCode:204,body:\"\"}},at=async(t,e)=>{let
                r=\"cognitoUser.postSetUserPassword\";"
              - "if(t.body===void 0)throw new Error(\"Request body is
                undefined\");let s=JSON.parse("
              - "t.body);if(!s.Username||typeof
                s.Username!=\"string\"||s.Username.length==0)throw new Error("
              - "\"Username is requried\");if(!s.password||typeof
                s.password!=\"string\"||s.password."
              - "length==0)throw new Error(\"password is requried\");let
                n={UserPoolId:w,Username:s."
              - "Username,Password:s.password,Permanent:!0};try{console.debug(`\
                ${r}::setUserPassw\\"
              - "ordCommandInput`,{...n,Password:`Redacted[${n.Password.length}\
                ]`});let o=await b."
              - "send(new
                y.AdminSetUserPasswordCommand(n));console.debug(`${r}::setUserP\
                asswordC\\"
              - "ommandResult`,o)}catch(o){return{statusCode:500,body:JSON.stri\
                ngify(o)}}return{statusCode:204,"
              - "body:\"\"}},it=async(t,e)=>{let
                r=\"cognitoUser.postDisableUser\";if(console.log(`${r}\\"
              - "::input`,t),t.body===void 0)throw new Error(\"Request body is
                undefined\");let s=JSON."
              - "parse(t.body);if(!s.Username||typeof
                s.Username!=\"string\"||s.Username.length==0)"
              - "throw new Error(\"Username is requried\");let
                n={UserPoolId:w,Username:s.Username};"
              - "try{let o=await b.send(new
                y.AdminDisableUserCommand(n));console.log(`${r}::disa\\"
              - "bleUserCommandResult`,o)}catch(o){return{statusCode:500,body:J\
                SON.stringify(o)}}"
              - "return{statusCode:204,body:\"\"}},ut=async(t,e)=>{let
                r=\"cognitoUser.postEnableUse\\"
              - "r\";if(console.debug(`${r}::input`,t),t.body===void 0)throw new
                Error(\"Request bo\\"
              - "dy is undefined\");let
                s=JSON.parse(t.body);if(!s.Username||typeof s.Username!=\"s\\"
              - "tring\"||s.Username.length==0)throw new Error(\"Username is
                requried\");let n={UserPoolId:w,"
              - "Username:s.Username};try{let o=await b.send(new
                y.AdminEnableUserCommand(n));console."
              - "debug(`${r}::enableUserCommandResult`,o)}catch(o){return{statu\
                sCode:500,body:JSON."
              - "stringify(o)}}return{statusCode:204,body:\"\"}},F={handlers:{p\
                ost:q},routes:{\"POST\\"
              - " /cognitoUser/{usecase}\":q}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          COGNITO_USER_POOLID:
            Ref: "CognitoUserPool279BBD48"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ApiCognitoUserRpcLambdaServiceRoleA1605B39"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn:
      - "ApiCognitoUserRpcLambdaServiceRoleDefaultPolicy579C262E"
  ApiConnectUsersLambdaServiceRole1E7C6B5A:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ApiConnectUsersLambdaF0F730FD:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var T=Object.defineProperty;var
                rt=Object.getOwnPropertyDescriptor;var
                nt=Object.getOwnPropertyNames;var
                ot=Object.prototype.hasOwnProperty;var st=(e,t)=>{for(var n in
                t)T(e,n,{get:t[n],enumerable:!0})},at=(e,t,n,a)=>{if(t&&"
              - "typeof t==\"object\"||typeof t==\"function\")for(let o of
                nt(t))!ot.call(e,o)&&o!==n&&"
              - "T(e,o,{get:()=>t[o],enumerable:!(a=rt(t,o))||a.enumerable});re\
                turn e};var it=e=>at(T({},\"__esModule\",{value:!0}),e);var
                gt={};st(gt,{connectUsers:()=>et,handler:()=>ht});module.export\
                s=it(gt);function E(e){var t=String(e);if(t===\"[object
                Object]\")try{t=JSON.stringify(e)}catch{}"
              - "return t}var ut=function(){function e(){}return
                e.prototype.isSome=function(){return!1},e."
              - "prototype.isNone=function(){return!0},e.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(t){"
              - "return t},e.prototype.expect=function(t){throw new
                Error(\"\".concat(t))},e.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},e.prototype.map=function(t){"
              - "return this},e.prototype.mapOr=function(t,n){return
                t},e.prototype.mapOrElse=function(t,n){"
              - "return t()},e.prototype.or=function(t){return
                t},e.prototype.orElse=function(t){"
              - "return t()},e.prototype.andThen=function(t){return
                this},e.prototype.toResult=function(t){"
              - "return
                l(t)},e.prototype.toString=function(){return\"None\"},e.prototy\
                pe.toAsyncOption="
              - "function(){return new x(h)},e}(),h=new ut;Object.freeze(h);var
                ct=function(){function e(t){"
              - "if(!(this instanceof e))return new e(t);this.value=t}return
                e.prototype.isSome=function(){"
              - "return!0},e.prototype.isNone=function(){return!1},e.prototype[\
                Symbol.iterator]=function(){"
              - "var t=Object(this.value);return Symbol.iterator in
                t?t[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},e.prototype.unwrapOr=function(t){return this.value},"
              - "e.prototype.expect=function(t){return
                this.value},e.prototype.unwrap=function(){"
              - "return this.value},e.prototype.map=function(t){return
                C(t(this.value))},e.prototype."
              - "mapOr=function(t,n){return
                n(this.value)},e.prototype.mapOrElse=function(t,n){return n("
              - "this.value)},e.prototype.or=function(t){return
                this},e.prototype.orElse=function(t){"
              - "return this},e.prototype.andThen=function(t){return
                t(this.value)},e.prototype.toResult="
              - "function(t){return
                d(this.value)},e.prototype.toAsyncOption=function(){return new
                x("
              - "this)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype.toString="
              - "function(){return\"Some(\".concat(E(this.value),\")\")},e.EMPT\
                Y=new e(void 0),e}(),C=ct,"
              - "U;(function(e){function t(){for(var
                o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];"
              - "for(var s=[],i=0,c=o;i<c.length;i++){var
                u=c[i];if(u.isSome())s.push(u.value);else"
              - "return u}return C(s)}e.all=t;function n(){for(var
                o=[],r=0;r<arguments.length;r++)"
              - "o[r]=arguments[r];for(var s=0,i=o;s<i.length;s++){var
                c=i[s];if(c.isSome())return c}"
              - "return h}e.any=n;function a(o){return o instanceof
                C||o===h}e.isOption=a})(U||(U="
              - "{}));var pt=function(){function e(t){if(!(this instanceof
                e))return new e(t);this.error="
              - "t;var n=new Error().stack.split(`"
              - "`).slice(2);n&&n.length>0&&n[0].includes(\"ErrImpl\")&&n.shift\
                (),this._stack=n.join("
              - "`"
              - "`)}return
                e.prototype.isOk=function(){return!1},e.prototype.isErr=functio\
                n(){return!0},"
              - "e.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "e.prototype.else=function(t){return
                t},e.prototype.unwrapOr=function(t){return t},"
              - "e.prototype.expect=function(t){throw new Error(\"\".concat(t,\"
                - Error: \").concat("
              - "E(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.expect\
                Err=function(t){return this."
              - "error},e.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "E(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},e.prototype.unwrap\
                Err=function(){return this."
              - "error},e.prototype.map=function(t){return
                this},e.prototype.andThen=function(t){"
              - "return this},e.prototype.mapErr=function(t){return new
                l(t(this.error))},e.prototype."
              - "mapOr=function(t,n){return
                t},e.prototype.mapOrElse=function(t,n){return t(this."
              - "error)},e.prototype.or=function(t){return
                t},e.prototype.orElse=function(t){return t("
              - "this.error)},e.prototype.toOption=function(){return
                h},e.prototype.toString=function(){"
              - "return\"Err(\".concat(E(this.error),\")\")},Object.definePrope\
                rty(e.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),e.prot\
                otype.toAsyncResult="
              - "function(){return new O(this)},e.EMPTY=new e(void 0),e}();var
                l=pt,lt=function(){function e(t){if(!(this instanceof e))return
                new e(t);this."
              - "value=t}return
                e.prototype.isOk=function(){return!0},e.prototype.isErr=functio\
                n(){"
              - "return!1},e.prototype[Symbol.iterator]=function(){var
                t=Object(this.value);return Symbol."
              - "iterator in
                t?t[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "e.prototype.else=function(t){return
                this.value},e.prototype.unwrapOr=function(t){"
              - "return this.value},e.prototype.expect=function(t){return
                this.value},e.prototype."
              - "expectErr=function(t){throw new
                Error(t)},e.prototype.unwrap=function(){return this."
              - "value},e.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "E(this.value)),{cause:this.value})},e.prototype.map=function(t\
                ){return new d(t(this."
              - "value))},e.prototype.andThen=function(t){return
                t(this.value)},e.prototype.mapErr="
              - "function(t){return this},e.prototype.mapOr=function(t,n){return
                n(this.value)},e."
              - "prototype.mapOrElse=function(t,n){return
                n(this.value)},e.prototype.or=function(t){"
              - "return this},e.prototype.orElse=function(t){return
                this},e.prototype.toOption=function(){"
              - "return C(this.value)},e.prototype.safeUnwrap=function(){return
                this.value},e.prototype."
              - "toString=function(){return\"Ok(\".concat(E(this.value),\")\")}\
                ,e.prototype.toAsyncResult="
              - "function(){return new O(this)},e.EMPTY=new e(void 0),e}();var
                d=lt,D;(function(e){function t(){for(var
                s=[],i=0;i<arguments.length;i++)s[i]="
              - "arguments[i];for(var c=[],u=0,p=s;u<p.length;u++){var
                f=p[u];if(f.isOk())c.push("
              - "f.value);else return f}return new d(c)}e.all=t;function
                n(){for(var s=[],i=0;i<arguments."
              - "length;i++)s[i]=arguments[i];for(var
                c=[],u=0,p=s;u<p.length;u++){var f=p[u];if(f."
              - "isOk())return f;c.push(f.error)}return new
                l(c)}e.any=n;function a(s){try{return new d("
              - "s())}catch(i){return new l(i)}}e.wrap=a;function
                o(s){try{return s().then(function(i){"
              - "return new d(i)}).catch(function(i){return new
                l(i)})}catch(i){return Promise.resolve("
              - "new l(i))}}e.wrapAsync=o;function r(s){return s instanceof l||s
                instanceof d}e.isResult="
              - "r})(D||(D={}));var R=function(e,t,n,a){function o(r){return r
                instanceof n?r:new n(function(s){"
              - "s(r)})}return new(n||(n=Promise))(function(r,s){function
                i(p){try{u(a.next(p))}catch(f){"
              - "s(f)}}function c(p){try{u(a.throw(p))}catch(f){s(f)}}function
                u(p){p.done?r(p.value):"
              - "o(p.value).then(i,c)}u((a=a.apply(e,t||[])).next())})},v=funct\
                ion(e,t){var n={label:0,"
              - "sent:function(){if(r[0]&1)throw r[1];return
                r[1]},trys:[],ops:[]},a,o,r,s;return s="
              - "{next:i(0),throw:i(1),return:i(2)},typeof
                Symbol==\"function\"&&(s[Symbol.iterator]="
              - "function(){return this}),s;function i(u){return
                function(p){return c([u,p])}}function c(u){"
              - "if(a)throw new TypeError(\"Generator is already
                executing.\");for(;s&&(s=0,u[0]&&(n="
              - "0)),n;)try{if(a=1,o&&(r=u[0]&2?o.return:u[0]?o.throw||((r=o.re\
                turn)&&r.call(o),0):"
              - "o.next)&&!(r=r.call(o,u[1])).done)return
                r;switch(o=0,r&&(u=[u[0]&2,r.value]),u[0]){case 0:case 1:"
              - "r=u;break;case 4:return n.label++,{value:u[1],done:!1};case
                5:n.label++,o=u[1],u="
              - "[0];continue;case
                7:u=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r="
              - "r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){n=0;continue\
                }if(u[0]===3&&(!r||"
              - "u[1]>r[0]&&u[1]<r[3])){n.label=u[1];break}if(u[0]===6&&n.label\
                <r[1]){n.label=r[1],"
              - "r=u;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(u);break\
                }r[2]&&n.ops.pop(),"
              - "n.trys.pop();continue}u=t.call(e,n)}catch(p){u=[6,p],o=0}final\
                ly{a=r=0}if(u[0]&5)"
              - "throw u[1];return{value:u[0]?u[1]:void
                0,done:!0}}},O=function(){function e(t){this."
              - "promise=Promise.resolve(t)}return
                e.prototype.andThen=function(t){var n=this;return this."
              - "thenInternal(function(a){return R(n,void 0,void
                0,function(){var o;return v(this,"
              - "function(r){return a.isErr()?[2,a]:(o=t(a.value),[2,o
                instanceof e?o.promise:o])})})})},"
              - "e.prototype.map=function(t){var n=this;return
                this.thenInternal(function(a){return R("
              - "n,void 0,void 0,function(){var o;return
                v(this,function(r){switch(r.label){case 0:"
              - "return a.isErr()?[2,a]:(o=d,[4,t(a.value)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "e.prototype.mapErr=function(t){var n=this;return
                this.thenInternal(function(a){return R("
              - "n,void 0,void 0,function(){var o;return
                v(this,function(r){switch(r.label){case 0:"
              - "return a.isOk()?[2,a]:(o=l,[4,t(a.error)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "e.prototype.or=function(t){return this.orElse(function(){return
                t})},e.prototype."
              - "orElse=function(t){var n=this;return
                this.thenInternal(function(a){return R(n,void 0,"
              - "void 0,function(){var o;return v(this,function(r){return
                a.isOk()?[2,a]:(o=t(a.error),"
              - "[2,o instanceof
                e?o.promise:o])})})})},e.prototype.toOption=function(){return
                new x("
              - "this.promise.then(function(t){return
                t.toOption()}))},e.prototype.thenInternal=function(t){"
              - "return new e(this.promise.then(t))},e}();var
                S=function(e,t,n,a){function o(r){return r instanceof n?r:new
                n(function(s){"
              - "s(r)})}return new(n||(n=Promise))(function(r,s){function
                i(p){try{u(a.next(p))}catch(f){"
              - "s(f)}}function c(p){try{u(a.throw(p))}catch(f){s(f)}}function
                u(p){p.done?r(p.value):"
              - "o(p.value).then(i,c)}u((a=a.apply(e,t||[])).next())})},P=funct\
                ion(e,t){var n={label:0,"
              - "sent:function(){if(r[0]&1)throw r[1];return
                r[1]},trys:[],ops:[]},a,o,r,s;return s="
              - "{next:i(0),throw:i(1),return:i(2)},typeof
                Symbol==\"function\"&&(s[Symbol.iterator]="
              - "function(){return this}),s;function i(u){return
                function(p){return c([u,p])}}function c(u){"
              - "if(a)throw new TypeError(\"Generator is already
                executing.\");for(;s&&(s=0,u[0]&&(n="
              - "0)),n;)try{if(a=1,o&&(r=u[0]&2?o.return:u[0]?o.throw||((r=o.re\
                turn)&&r.call(o),0):"
              - "o.next)&&!(r=r.call(o,u[1])).done)return
                r;switch(o=0,r&&(u=[u[0]&2,r.value]),u[0]){case 0:case 1:"
              - "r=u;break;case 4:return n.label++,{value:u[1],done:!1};case
                5:n.label++,o=u[1],u="
              - "[0];continue;case
                7:u=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r="
              - "r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){n=0;continue\
                }if(u[0]===3&&(!r||"
              - "u[1]>r[0]&&u[1]<r[3])){n.label=u[1];break}if(u[0]===6&&n.label\
                <r[1]){n.label=r[1],"
              - "r=u;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(u);break\
                }r[2]&&n.ops.pop(),"
              - "n.trys.pop();continue}u=t.call(e,n)}catch(p){u=[6,p],o=0}final\
                ly{a=r=0}if(u[0]&5)"
              - "throw u[1];return{value:u[0]?u[1]:void
                0,done:!0}}},x=function(){function e(t){this."
              - "promise=Promise.resolve(t)}return
                e.prototype.andThen=function(t){var n=this;return this."
              - "thenInternal(function(a){return S(n,void 0,void
                0,function(){var o;return P(this,"
              - "function(r){return a.isNone()?[2,a]:(o=t(a.value),[2,o
                instanceof e?o.promise:o])})})})},"
              - "e.prototype.map=function(t){var n=this;return
                this.thenInternal(function(a){return S("
              - "n,void 0,void 0,function(){var o;return
                P(this,function(r){switch(r.label){case 0:"
              - "return a.isNone()?[2,a]:(o=C,[4,t(a.value)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "e.prototype.or=function(t){return this.orElse(function(){return
                t})},e.prototype."
              - "orElse=function(t){var n=this;return
                this.thenInternal(function(a){return S(n,void 0,"
              - "void 0,function(){var o;return P(this,function(r){return
                a.isSome()?[2,a]:(o=t(),"
              - "[2,o instanceof
                e?o.promise:o])})})})},e.prototype.toResult=function(t){return
                new O("
              - "this.promise.then(function(n){return
                n.toResult(t)}))},e.prototype.thenInternal="
              - "function(t){return new e(this.promise.then(t))},e}();var
                L=e=>btoa(JSON.stringify(e)),V=(...e)=>{};var
                k=10,G=(e,t,n)=>{let
                a=\"api.validation.validateIdValue\";try{if(typeof n!=\"st\\"
              - "ring\"||n.length!=k){let o=`:${t} is malformed: '${n}'`;return
                V(`${e}:${a}::${o}`),"
              - "l({message:`resources.${t}.validation.invalid`,detail:`The ${t}
                must be a string\\"
              - " of length ${k}: '${n}'`,errorSource:\"CLIENT\"})}else return
                d(n)}catch(o){let r=typeof o=="
              - "\"string\"?new
                Error(o):o,s={message:\"internalServerError\",detail:r.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:r};return
                console.error(`${a}::error`,s,L(s)),l(s)}};var
                M=(e,t,n,a=1)=>t.filter(o=>Object.values(o).some(r=>typeof
                r==\"object\"&&a<n?"
              - "M(e,[r],n,a+1).length>0:r.toString().toLowerCase().includes(e.\
                toLowerCase()))),w=e=>{"
              - "let
                t=e.model,n=e.dataTotalCount||0,a=e.dataStart||0,o=e.dataEnd||0\
                ;return`${t} ${a}\\"
              - "-${o}/${n}`},q=(e,t,n,a={})=>{let
                o=\"util.doFilterResults\";try{if(t.isErr()||t.value."
              - "data===void 0)return
                t;if(console.debug(`${o}::input`,t.value.data),t.value.data!=="
              - "void
                0&&n.queryStringParameters&&n.queryStringParameters.hasOwnPrope\
                rty(\"filter\")){"
              - "let
                r=JSON.parse(n.queryStringParameters.filter);if(r.hasOwnPropert\
                y(\"q\")){let s=r."
              - "q,i=3;t.value.data=M(s,t.value.data,i)}else
                t.value.data=t.value.data.filter(s=>Object."
              - "entries(r).every(([i,c])=>{let
                u=a.hasOwnProperty(i)?a[i]:i;return Array.isArray("
              - "c)?c.includes(s[u]):s[u]===c}))}return
                console.debug(`${o}::output`,t.value.data),"
              - "t}catch(r){let i=`${e}:${o}::unexpected
                exception:${r.message}`;return console.error("
              - "i,r),t}},H=(e,t,n)=>{let
                a=\"util.doRangeResults\";try{if(t.isErr()||t.value.data==="
              - "void 0)return
                t;if(t.value.dataTotalCount=t.value.data.length,t.value.data!==\
                void 0)"
              - "if(n.queryStringParameters&&n.queryStringParameters.hasOwnProp\
                erty(\"range\")){let["
              - "o,r]=JSON.parse(n.queryStringParameters.range);t.value.dataSta\
                rt=o,t.value.dataEnd="
              - "Math.min(t.value.data.length,o+r),t.value.data=t.value.data.sl\
                ice(o,o+r+1)}else t."
              - "value.dataStart=0,t.value.dataEnd=t.value.data.length||0;return
                t}catch(o){let s=`${e}\\"
              - ":${a}::unexpected exception:${o.message}`;return
                console.error(s,o),l({statusCode:500,"
              - "body:s})}},F=(e,t,n)=>{let
                a=\"util.doSortResults\";try{if(t.isErr())return t;if(t."
              - "value.data!==void
                0&&n.queryStringParameters&&n.queryStringParameters.hasOwnPrope\
                rty("
              - "\"sort\")){let[o,r]=JSON.parse(n.queryStringParameters.sort),s=\
                \"ASC\";switch(r){case\"\\"
              - "NONE\":s=\"NONE\";break;case\"DESC\":s=\"DESC\";break;case\"ASC\
                \":default:s=\"ASC\";break}let i=dt("
              - "t.value.data,o,s);t.value.data=i}return t}catch(o){let
                s=`${e}:${a}::unexpected \\"
              - "exception:${o.message}`;return
                console.error(s,o),l({statusCode:500,body:s})}};var
                dt=(e,t,n=\"ASC\")=>{let
                a=\"util.sortResults\";try{if(n===\"NONE\")return e;let o=n==="
              - "\"ASC\"?1:-1,r=(s,i)=>{let c=s[t],u=i[t];return
                c===u?0:(c>u?1:-1)*o};return e.slice()."
              - "sort(r)}catch(o){let s=`${a}::unexpected
                exception:${o.message}`;throw console.error("
              - "s,o),o}};var ft=(e,t)=>{let
                n=400,a=500,o=!1;t&&(n=t.clientErrorCode||n,a=t.serverErrorCode\
                ||"
              - "a,o=t.includeOriginalError||o);let r=e,s=r.errorSource;delete
                r.errorSource,!o&&"
              - "r.hasOwnProperty(\"originalError\")&&delete r.originalError;let
                i={statusCode:s==\"\\"
              - "CLIENT\"?n:a,body:JSON.stringify(r)};return
                console.log(\"getErrorResponse::output\","
              - "i),i},B=(e,t,n,a=!0)=>{let
                o=\"util.getIdValueFromEvent\";try{if(n.hasOwnProperty("
              - "t)){if(typeof n[t]!=\"string\"||n[t]===void
                0||n[t]===null)throw new Error(`${t} v\\"
              - "alue unusable`);{let r=n[t];if(a){let
                s=G(e,t,r);if(s.isErr())return l(ft(s.error))}"
              - "return d(r)}}else throw new Error(`item missing
                ${t}`)}catch(r){let i=r.message;"
              - "return
                console.error(`${e}:${o}::${i}`,r),l({statusCode:400,body:i})}}\
                ,mt=e=>{let t=\"\\"
              - "util.getEventWithoutApiInPath\";try{let
                n=\"/api/\",a=\"/\";return{...e,__originalEvent:e,"
              - "rawPath:e.rawPath.replace(n,a),routeKey:e.routeKey.replace(n,a\
                ),requestContext:{"
              - "...e.requestContext,http:{...e.requestContext.http,path:e.requ\
                estContext.http.path."
              - "replace(n,a)},routeKey:e.requestContext.routeKey.replace(n,a)}\
                }}catch(n){let o=`${t}\\"
              - "::unexpected exception:${n.message}`;throw new
                Error(o)}},j=(e,t,n)=>{let a=\"uti\\"
              - "l.getPathParameter\";try{if(n.pathParameters)if(n.pathParamete\
                rs.hasOwnProperty(t)){"
              - "if(n.pathParameters[t]===void 0)throw new
                Error(`event.pathParameters[${t}] exis\\"
              - "ts but is undefined`);return d(n.pathParameters[t])}else throw
                new Error(`event.\\"
              - "pathParameters does not have property ${t}`);else throw new
                Error(\"event.pathPar\\"
              - "ameters is undefined\")}catch(o){let
                s=`${e}:${a}::${o.message}`;return console.error("
              - "s,o),l({statusCode:400,body:s})}};var I=e=>{let
                t=\"util.getStandardResponse\";try{if(e.isErr())return
                e.error;let n=e."
              - "value;console.debug(`${t}::input`,n);let
                o={destinations:\"DestinationId\",directories:\"\\"
              - "DirectoryId\",memberships:\"MembershipId\",connectUsers:\"Id\"\
                ,cognitoUsers:\"Username\"}[n."
              - "model];console.debug(`${t}::idKey`,o);let
                r,s,i={};switch(n.action){case\"Create\":"
              - "r=201,s={...n.data[0],id:`${n.data[0][o]}`};break;case\"Create\
                User\":r=201,s={...n."
              - "data[0],id:`${n.data[0][o]}`};break;case\"RetrieveBatchGet\":r\
                =200,s=n.data?.map(c=>({"
              - "...c,id:`${c[o]}`})),i[\"Content-Range\"]=w(n);break;case\"Ret\
                rieveGet\":r=200,s={...n."
              - "data[0],id:`${n.data[0][o]}`};break;case\"RetrieveQuery\":r=20\
                0,s=n.data?.map(c=>({"
              - "...c,id:`${c[o]}`})),i[\"Content-Range\"]=w(n);break;case\"Ret\
                rieveScan\":r=200,s=n."
              - "data?.map(c=>({...c,id:`${c[o]}`})),i[\"Content-Range\"]=w(n);\
                break;case\"Update\":r="
              - "200,s={...n.data[0],id:`${n.data[0][o]}`};break;case\"UpdateUs\
                er\":r=200,s={...n.data[0],"
              - "id:`${n.data[0][o]}`};break;case\"Delete\":r=204,s=\"\";break;\
                case\"AdminDeleteUser\":"
              - "r=204,s=\"\";break;case\"DescribeUser\":r=200,s={...n.data[0],\
                id:`${n.data[0][o]}`};"
              - "break;case\"AdminGetUser\":r=200,s={...n.data[0],id:`${n.data[\
                0][o]}`};break;case\"\\"
              - "ListUsers\":r=200,s=n.data?.map(c=>({...c,id:`${c[o]}`})),i[\"\
                Content-Range\"]=w(n);"
              - "break;default:throw new Error(`${t}::unexpected
                action::${JSON.stringify(n)}`)}return{"
              - "statusCode:r,body:JSON.stringify(s),headers:i}}catch(n){let
                a=n;throw console.error("
              - "`${t}::unexpected exception:${a.message}`,n),new
                Error(a.message)}},A=async(e,t,n,a)=>{"
              - "try{let
                o=`${e}::handleRequest`,r=mt(t),s=null;try{(!process.env.NODE_E\
                NV||process."
              - "env.NODE_ENV!==\"test\")&&console.debug(`${o}::Received
                event`,JSON.stringify(r),r),"
              - "r.routeKey in a?s=await
                a[r.routeKey](r,n):(console.log(`${o}::Didn't find '${r."
              - "routeKey}' in route map:
                ${JSON.stringify(a)}}`),s={statusCode:500,body:`${o}::${r."
              - "routeKey}:Routing map incorrect`})}catch(i){let
                c=i;console.error(`${o}::error:${c."
              - "message}`,i),s={statusCode:500,body:c.message}}finally{s||(s={\
                statusCode:500,body:`${o}\\"
              - "::Route dispatch failed`});try{let
                i=JSON.parse(s.body)}catch{let i=s;i.body=JSON."
              - "stringify(i.body),s=i}finally{try{(!process.env.NODE_ENV||proc\
                ess.env.NODE_ENV!=="
              - "\"test\")&&console.info(`${o}::${r.routeKey}::result`,s,btoa(J\
                SON.stringify(s)))}catch(i){"
              - "console.error(`${o}::${r.routeKey}::result::error`,i,s)}return
                s}}}catch(o){return console."
              - "error(`handler::error:${o.message}`,o),{statusCode:500,body:JS\
                ON.stringify({message:\"\\"
              - "Something has gone very wrong.\"})}}},N=(e,t,n)=>{let
                a=\"util.validateRouteTestAw\\"
              - "are\";try{return
                n.routeKey!==t?l({statusCode:500,body:`${e}:${a}::Routing map
                in\\"
              - "correct`}):process.env.NODE_ENV&&process.env.NODE_ENV===\"test\
                \"?l({statusCode:200,"
              - "body:`${e}:${a}::jest ${t}`}):d(\"\")}catch(o){let
                s=`${e}:${a}::::unexpected exce\\"
              - "ption:${o.message}`;throw new Error(s)}};var
                g=require(\"@aws-sdk/client-connect\");var
                _={};process.env.hasOwnProperty(\"CONNECT_AWS_REGION\")&&proces\
                s.env.CONNECT_AWS_REGION?"
              - "_={region:process.env.CONNECT_AWS_REGION}:_={region:\"us-east-1\
                \"};var $;if(process."
              - "env.hasOwnProperty(\"CONNECT_INSTANCE_ID\")&&process.env.CONNE\
                CT_INSTANCE_ID)$=process."
              - "env.CONNECT_INSTANCE_ID;else
                if(process.env.NODE_ENV!==\"test\")throw new Error(\"L\\"
              - "ambda environment variable CONNECT_INSTANCE_ID must be
                set\");var Q=new g.ConnectClient("
              - "_),W=e=>{let
                t=\"connect.makeConnectUsersRetrieveManyCommand\";try{return
                d({model:\"\\"
              - "connectUsers\",action:\"ListUsers\",input:{InstanceId:$}})}cat\
                ch(n){let o=`${e}:${t}\\"
              - "::unexpected exception:${n.message}`;throw new
                Error(o)}},K=(e,t,n)=>{let a=\"con\\"
              - "nect.makeConnectUsersRetrieveOneCommand\";try{console.debug(`$\
                {e}:${a}::event`,t);"
              - "let o=j(e,n,t),r;return
                o.isErr()?o:(r=o.value,d({model:\"connectUsers\",action:\"D\\"
              - "escribeUser\",input:{InstanceId:$,UserId:r}}))}catch(o){let
                s=`${e}:${a}::unexpec\\"
              - "ted exception:${o.message}`;throw new
                Error(s)}},X=async(e,t)=>{if(t.isErr())return t;"
              - "let n=t.value,a=\"connect.runConnectUsersRetrieveMany\";try{let
                o=n.input,r=[],s=\"\","
              - "i;do
                s.length>0&&(o.NextToken=s),s=\"\",console.debug(`${e}:${a}::in\
                put`,o),i=await Q."
              - "send(new
                g.ListUsersCommand(o)),console.debug(`${e}:${a}::response`,i,bt\
                oa(JSON."
              - "stringify(i))),i.NextToken&&(s=i.NextToken),i.UserSummaryList&\
                &(r=r.concat(i.UserSummaryList));while(s."
              - "length>0);return
                console.debug(`${e}:${a}::userSummary`,r),d({...n,data:r,output\
                :i})}catch(o){"
              - "let s=`${e}:${a}::${o.message}`;return
                console.error(s,o),l({statusCode:500,body:s})}},"
              - "z=async(e,t,n)=>{if(t.isErr())return t;let
                a=t.value,o=\"connect.runConnectUsersR\\"
              - "etrieveOne\";try{console.debug(`${e}:${o}::command.input`,a.in\
                put);let r=await Q."
              - "send(new
                g.DescribeUserCommand(a.input));if(console.debug(`${e}:${o}::re\
                sult`,r),"
              - "!r.User||!r.User.Id)return l({statusCode:404,body:\"Not
                found\"});if(console.debug("
              - "`${e}:${o}::result.User`,r.User),!r.User.hasOwnProperty(n)){let
                i=`${e}:${o}::${n}\\"
              - " not found in result.User`;return
                console.error(i,r),l({statusCode:500,body:i})}"
              - "let s={...a,data:[r.User],output:r};return
                console.debug(`${e}:${o}::output`,s),"
              - "d(s)}catch(r){let i=`${e}:${o}::${r.message}`;return
                console.error(i,r),l({statusCode:500,"
              - "body:i})}};var Et=async e=>{let
                t=\"connectUsers.get\",n=\"connectUsers\";(!process.env.NODE_EN\
                V||"
              - "process.env.NODE_ENV!==\"test\")&&console.debug(`${t}::Received
                event`,JSON.stringify("
              - "e),e);let a=N(t,`GET /${n}`,e);if(a.isErr())return a.error;let
                o,r;e.queryStringParameters&&"
              - "e.queryStringParameters.filter&&(o=JSON.parse(e.queryStringPar\
                ameters.filter),console."
              - "debug(`${t}::filter`,o)),o?o.hasOwnProperty(\"q\")?r=\"SCAN_SE\
                ARCH\":o.hasOwnProperty("
              - "\"id\")||o.hasOwnProperty(\"Id\")||o.hasOwnProperty(\"Destinat\
                ionId\")?r=\"BATCH_GET\":r="
              - "\"SCAN_EXACT\":r=\"SCAN_ALL\",console.debug(`${t}::queryFilter\
                Mode`,r);let s,i=W(n),"
              - "c=await X(t,i);r===\"SCAN_ALL\"?s=c:s=q(t,c,e,{id:\"Id\"});let
                u=F(t,s,e),p=H(t,u,e);"
              - "return I(p)};var Z={\"GET /connectUsers\":Et};var Ct=async
                e=>{let
                t=\"connectUsers.getId\",n=\"connectUsers\",a=\"Id\";(!process.\
                env."
              - "NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(`${t\
                }::Received event`,JSON."
              - "stringify(e),e);let o=N(t,`GET
                /${n}/{${a}}`,e);if(o.isErr())return o.error;let r=B("
              - "t,a,e.pathParameters);if(r.isErr())return r.error;let
                s=K(t,e,a),i=await z(t,s,a);"
              - "return I(i)};var tt={\"GET /connectUsers/{UserId}\":Ct};var
                ht=async(e,t)=>await
                A(\"connectUsers\",e,t,et.routes),et={routes:{...Z,...tt}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          CONNECT_REGION:
            Ref: "AWS::Region"
          CONNECT_INSTANCE_ID:
            Ref: "ConnectInstance"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ApiConnectUsersLambdaServiceRole1E7C6B5A"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn: []
  ApiAmazonConnectGetUsersED5C4BBC:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "connect:DescribeUser"
              - "connect:ListUsers"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:aws:connect:"
                  - Ref: "AWS::Region"
                  - ":*:instance/"
                  - Ref: "ConnectInstance"
        Version: "2012-10-17"
      PolicyName: "ApiAmazonConnectGetUsersED5C4BBC"
      Roles:
        - Ref: "ApiConnectUsersLambdaServiceRole1E7C6B5A"
  ApiDestinationsLambdaServiceRole05DF04F8:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ApiDestinationsLambdaServiceRoleDefaultPolicy9C7933DE:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:BatchWriteItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DeleteItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:PutItem"
              - "dynamodb:Query"
              - "dynamodb:Scan"
              - "dynamodb:UpdateItem"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbDestinations37B2F70F"
                  - "Arn"
              - Fn::GetAtt:
                  - "DdbMemberships1A816D0C"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DdbMemberships1A816D0C"
                        - "Arn"
                    - "/index/*"
        Version: "2012-10-17"
      PolicyName: "ApiDestinationsLambdaServiceRoleDefaultPolicy9C7933DE"
      Roles:
        - Ref: "ApiDestinationsLambdaServiceRole05DF04F8"
  ApiDestinationsLambdaBABF64D8:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var me=Object.defineProperty;var
                lt=Object.getOwnPropertyDescriptor;var
                yt=Object.getOwnPropertyNames;var
                ft=Object.prototype.hasOwnProperty;var Et=(r,e)=>{for(var t in
                e)me(r,t,{get:e[t],enumerable:!0})},gt=(r,e,t,o)=>{if(e&&"
              - "typeof e==\"object\"||typeof e==\"function\")for(let n of
                yt(e))!ft.call(r,n)&&n!==t&&"
              - "me(r,n,{get:()=>e[n],enumerable:!(o=lt(e,n))||o.enumerable});r\
                eturn r};var bt=r=>gt(me({},\"__esModule\",{value:!0}),r);var
                Ft={};Et(Ft,{destinations:()=>at,handler:()=>jt,parseDestinatio\
                n:()=>ee});module."
              - "exports=bt(Ft);function _(r){var e=String(r);if(e===\"[object
                Object]\")try{e=JSON.stringify(r)}catch{}"
              - "return e}var Ct=function(){function r(){}return
                r.prototype.isSome=function(){return!1},r."
              - "prototype.isNone=function(){return!0},r.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},r.prototype.unwrapOr=function(e){"
              - "return e},r.prototype.expect=function(e){throw new
                Error(\"\".concat(e))},r.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},r.prototype.map=function(e){"
              - "return this},r.prototype.mapOr=function(e,t){return
                e},r.prototype.mapOrElse=function(e,t){"
              - "return e()},r.prototype.or=function(e){return
                e},r.prototype.orElse=function(e){"
              - "return e()},r.prototype.andThen=function(e){return
                this},r.prototype.toResult=function(e){"
              - "return
                p(e)},r.prototype.toString=function(){return\"None\"},r.prototy\
                pe.toAsyncOption="
              - "function(){return new H(U)},r}(),U=new Ct;Object.freeze(U);var
                ht=function(){function r(e){"
              - "if(!(this instanceof r))return new r(e);this.value=e}return
                r.prototype.isSome=function(){"
              - "return!0},r.prototype.isNone=function(){return!1},r.prototype[\
                Symbol.iterator]=function(){"
              - "var e=Object(this.value);return Symbol.iterator in
                e?e[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},r.prototype.unwrapOr=function(e){return this.value},"
              - "r.prototype.expect=function(e){return
                this.value},r.prototype.unwrap=function(){"
              - "return this.value},r.prototype.map=function(e){return
                V(e(this.value))},r.prototype."
              - "mapOr=function(e,t){return
                t(this.value)},r.prototype.mapOrElse=function(e,t){return t("
              - "this.value)},r.prototype.or=function(e){return
                this},r.prototype.orElse=function(e){"
              - "return this},r.prototype.andThen=function(e){return
                e(this.value)},r.prototype.toResult="
              - "function(e){return
                d(this.value)},r.prototype.toAsyncOption=function(){return new
                H("
              - "this)},r.prototype.safeUnwrap=function(){return
                this.value},r.prototype.toString="
              - "function(){return\"Some(\".concat(_(this.value),\")\")},r.EMPT\
                Y=new r(void 0),r}(),V=ht,"
              - "ve;(function(r){function e(){for(var
                n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];"
              - "for(var a=[],i=0,c=n;i<c.length;i++){var
                u=c[i];if(u.isSome())a.push(u.value);else"
              - "return u}return V(a)}r.all=e;function t(){for(var
                n=[],s=0;s<arguments.length;s++)"
              - "n[s]=arguments[s];for(var a=0,i=n;a<i.length;a++){var
                c=i[a];if(c.isSome())return c}"
              - "return U}r.any=t;function o(n){return n instanceof
                V||n===U}r.isOption=o})(ve||(ve="
              - "{}));var It=function(){function r(e){if(!(this instanceof
                r))return new r(e);this.error="
              - "e;var t=new Error().stack.split(`"
              - "`).slice(2);t&&t.length>0&&t[0].includes(\"ErrImpl\")&&t.shift\
                (),this._stack=t.join("
              - "`"
              - "`)}return
                r.prototype.isOk=function(){return!1},r.prototype.isErr=functio\
                n(){return!0},"
              - "r.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "r.prototype.else=function(e){return
                e},r.prototype.unwrapOr=function(e){return e},"
              - "r.prototype.expect=function(e){throw new Error(\"\".concat(e,\"
                - Error: \").concat("
              - "_(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},r.prototype.expect\
                Err=function(e){return this."
              - "error},r.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "_(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},r.prototype.unwrap\
                Err=function(){return this."
              - "error},r.prototype.map=function(e){return
                this},r.prototype.andThen=function(e){"
              - "return this},r.prototype.mapErr=function(e){return new
                p(e(this.error))},r.prototype."
              - "mapOr=function(e,t){return
                e},r.prototype.mapOrElse=function(e,t){return e(this."
              - "error)},r.prototype.or=function(e){return
                e},r.prototype.orElse=function(e){return e("
              - "this.error)},r.prototype.toOption=function(){return
                U},r.prototype.toString=function(){"
              - "return\"Err(\".concat(_(this.error),\")\")},Object.definePrope\
                rty(r.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),r.prot\
                otype.toAsyncResult="
              - "function(){return new K(this)},r.EMPTY=new r(void 0),r}();var
                p=It,Rt=function(){function r(e){if(!(this instanceof r))return
                new r(e);this."
              - "value=e}return
                r.prototype.isOk=function(){return!0},r.prototype.isErr=functio\
                n(){"
              - "return!1},r.prototype[Symbol.iterator]=function(){var
                e=Object(this.value);return Symbol."
              - "iterator in
                e?e[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "r.prototype.else=function(e){return
                this.value},r.prototype.unwrapOr=function(e){"
              - "return this.value},r.prototype.expect=function(e){return
                this.value},r.prototype."
              - "expectErr=function(e){throw new
                Error(e)},r.prototype.unwrap=function(){return this."
              - "value},r.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "_(this.value)),{cause:this.value})},r.prototype.map=function(e\
                ){return new d(e(this."
              - "value))},r.prototype.andThen=function(e){return
                e(this.value)},r.prototype.mapErr="
              - "function(e){return this},r.prototype.mapOr=function(e,t){return
                t(this.value)},r."
              - "prototype.mapOrElse=function(e,t){return
                t(this.value)},r.prototype.or=function(e){"
              - "return this},r.prototype.orElse=function(e){return
                this},r.prototype.toOption=function(){"
              - "return V(this.value)},r.prototype.safeUnwrap=function(){return
                this.value},r.prototype."
              - "toString=function(){return\"Ok(\".concat(_(this.value),\")\")}\
                ,r.prototype.toAsyncResult="
              - "function(){return new K(this)},r.EMPTY=new r(void 0),r}();var
                d=Rt,Ne;(function(r){function e(){for(var
                a=[],i=0;i<arguments.length;i++)a[i]="
              - "arguments[i];for(var c=[],u=0,m=a;u<m.length;u++){var
                l=m[u];if(l.isOk())c.push("
              - "l.value);else return l}return new d(c)}r.all=e;function
                t(){for(var a=[],i=0;i<arguments."
              - "length;i++)a[i]=arguments[i];for(var
                c=[],u=0,m=a;u<m.length;u++){var l=m[u];if(l."
              - "isOk())return l;c.push(l.error)}return new
                p(c)}r.any=t;function o(a){try{return new d("
              - "a())}catch(i){return new p(i)}}r.wrap=o;function
                n(a){try{return a().then(function(i){"
              - "return new d(i)}).catch(function(i){return new
                p(i)})}catch(i){return Promise.resolve("
              - "new p(i))}}r.wrapAsync=n;function s(a){return a instanceof p||a
                instanceof d}r.isResult="
              - "s})(Ne||(Ne={}));var te=function(r,e,t,o){function n(s){return
                s instanceof t?s:new t(function(a){"
              - "a(s)})}return new(t||(t=Promise))(function(s,a){function
                i(m){try{u(o.next(m))}catch(l){"
              - "a(l)}}function c(m){try{u(o.throw(m))}catch(l){a(l)}}function
                u(m){m.done?s(m.value):"
              - "n(m.value).then(i,c)}u((o=o.apply(r,e||[])).next())})},re=func\
                tion(r,e){var t={label:0,"
              - "sent:function(){if(s[0]&1)throw s[1];return
                s[1]},trys:[],ops:[]},o,n,s,a;return a="
              - "{next:i(0),throw:i(1),return:i(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function i(u){return
                function(m){return c([u,m])}}function c(u){"
              - "if(o)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,u[0]&&(t="
              - "0)),t;)try{if(o=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.re\
                turn)&&s.call(n),0):"
              - "n.next)&&!(s=s.call(n,u[1])).done)return
                s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:"
              - "s=u;break;case 4:return t.label++,{value:u[1],done:!1};case
                5:t.label++,n=u[1],u="
              - "[0];continue;case
                7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s="
              - "s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue\
                }if(u[0]===3&&(!s||"
              - "u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label\
                <s[1]){t.label=s[1],"
              - "s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break\
                }s[2]&&t.ops.pop(),"
              - "t.trys.pop();continue}u=e.call(r,t)}catch(m){u=[6,m],n=0}final\
                ly{o=s=0}if(u[0]&5)"
              - "throw u[1];return{value:u[0]?u[1]:void
                0,done:!0}}},K=function(){function r(e){this."
              - "promise=Promise.resolve(e)}return
                r.prototype.andThen=function(e){var t=this;return this."
              - "thenInternal(function(o){return te(t,void 0,void
                0,function(){var n;return re(this,"
              - "function(s){return o.isErr()?[2,o]:(n=e(o.value),[2,n
                instanceof r?n.promise:n])})})})},"
              - "r.prototype.map=function(e){var t=this;return
                this.thenInternal(function(o){return te("
              - "t,void 0,void 0,function(){var n;return
                re(this,function(s){switch(s.label){case 0:"
              - "return o.isErr()?[2,o]:(n=d,[4,e(o.value)]);case
                1:return[2,n.apply(void 0,[s.sent()])]}})})})},"
              - "r.prototype.mapErr=function(e){var t=this;return
                this.thenInternal(function(o){return te("
              - "t,void 0,void 0,function(){var n;return
                re(this,function(s){switch(s.label){case 0:"
              - "return o.isOk()?[2,o]:(n=p,[4,e(o.error)]);case
                1:return[2,n.apply(void 0,[s.sent()])]}})})})},"
              - "r.prototype.or=function(e){return this.orElse(function(){return
                e})},r.prototype."
              - "orElse=function(e){var t=this;return
                this.thenInternal(function(o){return te(t,void 0,"
              - "void 0,function(){var n;return re(this,function(s){return
                o.isOk()?[2,o]:(n=e(o."
              - "error),[2,n instanceof
                r?n.promise:n])})})})},r.prototype.toOption=function(){return
                new H("
              - "this.promise.then(function(e){return
                e.toOption()}))},r.prototype.thenInternal=function(e){"
              - "return new r(this.promise.then(e))},r}();var
                pe=function(r,e,t,o){function n(s){return s instanceof t?s:new
                t(function(a){"
              - "a(s)})}return new(t||(t=Promise))(function(s,a){function
                i(m){try{u(o.next(m))}catch(l){"
              - "a(l)}}function c(m){try{u(o.throw(m))}catch(l){a(l)}}function
                u(m){m.done?s(m.value):"
              - "n(m.value).then(i,c)}u((o=o.apply(r,e||[])).next())})},de=func\
                tion(r,e){var t={label:0,"
              - "sent:function(){if(s[0]&1)throw s[1];return
                s[1]},trys:[],ops:[]},o,n,s,a;return a="
              - "{next:i(0),throw:i(1),return:i(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function i(u){return
                function(m){return c([u,m])}}function c(u){"
              - "if(o)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,u[0]&&(t="
              - "0)),t;)try{if(o=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.re\
                turn)&&s.call(n),0):"
              - "n.next)&&!(s=s.call(n,u[1])).done)return
                s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:"
              - "s=u;break;case 4:return t.label++,{value:u[1],done:!1};case
                5:t.label++,n=u[1],u="
              - "[0];continue;case
                7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s="
              - "s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue\
                }if(u[0]===3&&(!s||"
              - "u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label\
                <s[1]){t.label=s[1],"
              - "s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break\
                }s[2]&&t.ops.pop(),"
              - "t.trys.pop();continue}u=e.call(r,t)}catch(m){u=[6,m],n=0}final\
                ly{o=s=0}if(u[0]&5)"
              - "throw u[1];return{value:u[0]?u[1]:void
                0,done:!0}}},H=function(){function r(e){this."
              - "promise=Promise.resolve(e)}return
                r.prototype.andThen=function(e){var t=this;return this."
              - "thenInternal(function(o){return pe(t,void 0,void
                0,function(){var n;return de(this,"
              - "function(s){return o.isNone()?[2,o]:(n=e(o.value),[2,n
                instanceof r?n.promise:n])})})})},"
              - "r.prototype.map=function(e){var t=this;return
                this.thenInternal(function(o){return pe("
              - "t,void 0,void 0,function(){var n;return
                de(this,function(s){switch(s.label){case 0:"
              - "return o.isNone()?[2,o]:(n=V,[4,e(o.value)]);case
                1:return[2,n.apply(void 0,[s.sent()])]}})})})},"
              - "r.prototype.or=function(e){return this.orElse(function(){return
                e})},r.prototype."
              - "orElse=function(e){var t=this;return
                this.thenInternal(function(o){return pe(t,void 0,"
              - "void 0,function(){var n;return de(this,function(s){return
                o.isSome()?[2,o]:(n=e(),"
              - "[2,n instanceof
                r?n.promise:n])})})})},r.prototype.toResult=function(e){return
                new K("
              - "this.promise.then(function(t){return
                t.toResult(e)}))},r.prototype.thenInternal="
              - "function(e){return new r(this.promise.then(e))},r}();var
                y=r=>btoa(JSON.stringify(r)),f=(...r)=>{};var
                ne=10,Ae=(r,e,t)=>{let
                o=\"api.validation.validateIdValue\";try{if(typeof t!=\"\\"
              - "string\"||t.length!=ne){let n=`:${e} is malformed:
                '${t}'`;return f(`${r}:${o}::${n}`),"
              - "p({message:`resources.${e}.validation.invalid`,detail:`The ${e}
                must be a string\\"
              - " of length ${ne}: '${t}'`,errorSource:\"CLIENT\"})}else return
                d(t)}catch(n){let s=typeof n=="
              - "\"string\"?new
                Error(n):n,a={message:\"internalServerError\",detail:s.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:s};return
                console.error(`${o}::error`,a,y(a)),p(a)}};var
                $e=(r,e,t,o=1)=>e.filter(n=>Object.values(n).some(s=>typeof
                s==\"object\"&&o<t?"
              - "$e(r,[s],t,o+1).length>0:s.toString().toLowerCase().includes(r\
                .toLowerCase()))),"
              - "J=r=>{let
                e=r.model,t=r.dataTotalCount||0,o=r.dataStart||0,n=r.dataEnd||0\
                ;return`${e}\\"
              - " ${o}-${n}/${t}`},Te=(r,e,t,o={})=>{let
                n=\"util.doFilterResults\";try{if(e.isErr()||"
              - "e.value.data===void 0)return
                e;if(console.debug(`${n}::input`,e.value.data),e.value."
              - "data!==void
                0&&t.queryStringParameters&&t.queryStringParameters.hasOwnPrope\
                rty(\"\\"
              - "filter\")){let
                s=JSON.parse(t.queryStringParameters.filter);if(s.hasOwnPropert\
                y(\"\\"
              - "q\")){let a=s.q,i=3;e.value.data=$e(a,e.value.data,i)}else
                e.value.data=e.value.data."
              - "filter(a=>Object.entries(s).every(([i,c])=>{let
                u=o.hasOwnProperty(i)?o[i]:i;return Array."
              - "isArray(c)?c.includes(a[u]):a[u]===c}))}return
                console.debug(`${n}::output`,e.value."
              - "data),e}catch(s){let i=`${r}:${n}::unexpected
                exception:${s.message}`;return console."
              - "error(i,s),e}},Se=(r,e,t)=>{let
                o=\"util.doRangeResults\";try{if(e.isErr()||e.value."
              - "data===void 0)return
                e;if(e.value.dataTotalCount=e.value.data.length,e.value.data!=="
              - "void
                0)if(t.queryStringParameters&&t.queryStringParameters.hasOwnPro\
                perty(\"range\")){"
              - "let[n,s]=JSON.parse(t.queryStringParameters.range);e.value.dat\
                aStart=n,e.value.dataEnd="
              - "Math.min(e.value.data.length,n+s),e.value.data=e.value.data.sl\
                ice(n,n+s+1)}else e."
              - "value.dataStart=0,e.value.dataEnd=e.value.data.length||0;return
                e}catch(n){let a=`${r}\\"
              - ":${o}::unexpected exception:${n.message}`;return
                console.error(a,n),p({statusCode:500,"
              - "body:a})}},Pe=(r,e,t)=>{let
                o=\"util.doSortResults\";try{if(e.isErr())return e;if(e."
              - "value.data!==void
                0&&t.queryStringParameters&&t.queryStringParameters.hasOwnPrope\
                rty("
              - "\"sort\")){let[n,s]=JSON.parse(t.queryStringParameters.sort),a=\
                \"ASC\";switch(s){case\"\\"
              - "NONE\":a=\"NONE\";break;case\"DESC\":a=\"DESC\";break;case\"ASC\
                \":default:a=\"ASC\";break}let i=Dt("
              - "e.value.data,n,a);e.value.data=i}return e}catch(n){let
                a=`${r}:${o}::unexpected \\"
              - "exception:${n.message}`;return
                console.error(a,n),p({statusCode:500,body:a})}},ke=()=>{"
              - "let
                r=\"util.generateItemId\";try{return((Date.now()+Math.floor(Mat\
                h.pow(10,12)+Math."
              - "random()*9*Math.pow(10,12)))*100).toString(36)}catch(e){let
                o=`${r}::unexpected \\"
              - "exception:${e.message}`;throw new
                Error(o)}},Dt=(r,e,t=\"ASC\")=>{let o=\"util.sort\\"
              - "Results\";try{if(t===\"NONE\")return r;let
                n=t===\"ASC\"?1:-1,s=(a,i)=>{let c=a[e],u=i[e];"
              - "return c===u?0:(c>u?1:-1)*n};return
                r.slice().sort(s)}catch(n){let a=`${o}::unex\\"
              - "pected exception:${n.message}`;throw console.error(a,n),n}};var
                le=(r,e)=>{let
                t=400,o=500,n=!1;e&&(t=e.clientErrorCode||t,o=e.serverErrorCode\
                ||"
              - "o,n=e.includeOriginalError||n);let s=r,a=s.errorSource;delete
                s.errorSource,!n&&"
              - "s.hasOwnProperty(\"originalError\")&&delete s.originalError;let
                i={statusCode:a==\"\\"
              - "CLIENT\"?t:o,body:JSON.stringify(s)};return
                console.log(\"getErrorResponse::output\","
              - "i),i},B=(r,e,t,o=!0)=>{let
                n=\"util.getIdValueFromEvent\";try{if(t.hasOwnProperty("
              - "e)){if(typeof t[e]!=\"string\"||t[e]===void
                0||t[e]===null)throw new Error(`${e} v\\"
              - "alue unusable`);{let s=t[e];if(o){let
                a=Ae(r,e,s);if(a.isErr())return p(le(a.error))}"
              - "return d(s)}}else throw new Error(`item missing
                ${e}`)}catch(s){let i=s.message;"
              - "return
                console.error(`${r}:${n}::${i}`,s),p({statusCode:400,body:i})}}\
                ,Ot=r=>{let e=\"\\"
              - "util.getEventWithoutApiInPath\";try{let
                t=\"/api/\",o=\"/\";return{...r,__originalEvent:r,"
              - "rawPath:r.rawPath.replace(t,o),routeKey:r.routeKey.replace(t,o\
                ),requestContext:{"
              - "...r.requestContext,http:{...r.requestContext.http,path:r.requ\
                estContext.http.path."
              - "replace(t,o)},routeKey:r.requestContext.routeKey.replace(t,o)}\
                }}catch(t){let n=`${e}\\"
              - "::unexpected exception:${t.message}`;throw new
                Error(n)}},Ve=(r,e,t)=>{let o=\"ut\\"
              - "il.getPathParameter\";try{if(t.pathParameters)if(t.pathParamet\
                ers.hasOwnProperty("
              - "e)){if(t.pathParameters[e]===void 0)throw new
                Error(`event.pathParameters[${e}] \\"
              - "exists but is undefined`);return d(t.pathParameters[e])}else
                throw new Error(`ev\\"
              - "ent.pathParameters does not have property ${e}`);else throw new
                Error(\"event.pat\\"
              - "hParameters is undefined\")}catch(n){let
                a=`${r}:${o}::${n.message}`;return console."
              - "error(a,n),p({statusCode:400,body:a})}},oe=r=>{let
                e=\"util.getRequestBody\";try{if(r."
              - "body){if(typeof r.body!=\"string\")throw new Error(\"event.body
                is not a string\");{"
              - "let t;return
                r.isBase64Encoded?(t=Buffer.from(r.body,\"base64\").toString(\"\
                utf8\"),"
              - "console.debug(`${e}::event.body`,r.body),console.debug(`${e}::\
                body`,t)):t=r.body,"
              - "d(t)}}else throw new Error(\"event.body is
                undefined\")}catch(t){let o=t,n=`${e}::${o."
              - "message}`;return console.error(n,t),p(o.message)}},A=r=>{let
                e=\"util.getStandard\\"
              - "Response\";try{if(r.isErr())return r.error;let
                t=r.value;console.debug(`${e}::inp\\"
              - "ut`,t);let
                n={destinations:\"DestinationId\",directories:\"DirectoryId\",m\
                emberships:\"\\"
              - "MembershipId\",connectUsers:\"Id\",cognitoUsers:\"Username\"}[\
                t.model];console.debug("
              - "`${e}::idKey`,n);let
                s,a,i={};switch(t.action){case\"Create\":s=201,a={...t.data[0],"
              - "id:`${t.data[0][n]}`};break;case\"CreateUser\":s=201,a={...t.d\
                ata[0],id:`${t.data[0][n]}`};"
              - "break;case\"RetrieveBatchGet\":s=200,a=t.data?.map(c=>({...c,i\
                d:`${c[n]}`})),i[\"Co\\"
              - "ntent-Range\"]=J(t);break;case\"RetrieveGet\":s=200,a={...t.da\
                ta[0],id:`${t.data[0][n]}`};"
              - "break;case\"RetrieveQuery\":s=200,a=t.data?.map(c=>({...c,id:`\
                ${c[n]}`})),i[\"Conte\\"
              - "nt-Range\"]=J(t);break;case\"RetrieveScan\":s=200,a=t.data?.ma\
                p(c=>({...c,id:`${c[n]}`})),"
              - "i[\"Content-Range\"]=J(t);break;case\"Update\":s=200,a={...t.d\
                ata[0],id:`${t.data[0][n]}`};"
              - "break;case\"UpdateUser\":s=200,a={...t.data[0],id:`${t.data[0]\
                [n]}`};break;case\"De\\"
              - "lete\":s=204,a=\"\";break;case\"AdminDeleteUser\":s=204,a=\"\"\
                ;break;case\"DescribeUser\":"
              - "s=200,a={...t.data[0],id:`${t.data[0][n]}`};break;case\"AdminG\
                etUser\":s=200,a={...t."
              - "data[0],id:`${t.data[0][n]}`};break;case\"ListUsers\":s=200,a=\
                t.data?.map(c=>({...c,"
              - "id:`${c[n]}`})),i[\"Content-Range\"]=J(t);break;default:throw
                new Error(`${e}::une\\"
              - "xpected
                action::${JSON.stringify(t)}`)}return{statusCode:s,body:JSON.st\
                ringify(a),"
              - "headers:i}}catch(t){let o=t;throw
                console.error(`${e}::unexpected exception:${o."
              - "message}`,t),new Error(o.message)}},G=async(r,e,t,o)=>{try{let
                n=`${r}::handleRe\\"
              - "quest`,s=Ot(e),a=null;try{(!process.env.NODE_ENV||process.env.\
                NODE_ENV!==\"test\")&&"
              - "console.debug(`${n}::Received
                event`,JSON.stringify(s),s),s.routeKey in o?a=await o[s."
              - "routeKey](s,t):(console.log(`${n}::Didn't find '${s.routeKey}'
                in route map: ${JSON."
              - "stringify(o)}}`),a={statusCode:500,body:`${n}::${s.routeKey}:R\
                outing map incorre\\"
              - "ct`})}catch(i){let
                c=i;console.error(`${n}::error:${c.message}`,i),a={statusCode:5\
                00,"
              - "body:c.message}}finally{a||(a={statusCode:500,body:`${n}::Route
                dispatch failed`});"
              - "try{let i=JSON.parse(a.body)}catch{let
                i=a;i.body=JSON.stringify(i.body),a=i}finally{"
              - "try{(!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&\
                console.info(`${n}::${s."
              - "routeKey}::result`,a,btoa(JSON.stringify(a)))}catch(i){console\
                .error(`${n}::${s."
              - "routeKey}::result::error`,i,a)}return a}}}catch(n){return
                console.error(`handler\\"
              - "::error:${n.message}`,n),{statusCode:500,body:JSON.stringify({\
                message:\"Something\\"
              - " has gone very wrong.\"})}}},$=(r,e,t)=>{let
                o=\"util.validateRouteTestAware\";try{"
              - "return
                t.routeKey!==e?p({statusCode:500,body:`${r}:${o}::Routing map
                incorrect`}):"
              - "process.env.NODE_ENV&&process.env.NODE_ENV===\"test\"?p({statu\
                sCode:200,body:`${r}\\"
              - ":${o}::jest ${e}`}):d(\"\")}catch(n){let
                a=`${r}:${o}::::unexpected exception:${n."
              - "message}`;throw new Error(a)}};var
                Y=require(\"@aws-sdk/client-dynamodb\"),T=require(\"@aws-sdk/li\
                b-dynamodb\"),fe=require(\"@aws-sdk/util-dynamodb\");var
                ye=(r,e)=>{let t=\"util.getEnvOrDefault\";try{let o;return
                process.env.hasOwnProperty("
              - "r)&&process.env[r]?o=process.env[r]:o=e,o}catch(o){let
                s=`${t}::unexpected excep\\"
              - "tion:${o.message}`;throw new Error(s)}},q=r=>{let
                e=\"util.getTableName\";try{switch(r){case\"\\"
              - "destinations\":return
                d(ye(\"DDB_TABLE_DESTINATION\",\"aws-connect-directory_destina\
                \\"
              - "tions\"));case\"directories\":return
                d(ye(\"DDB_TABLE_DIRECTORY\",\"aws-connect-direct\\"
              - "ory_directories\"));case\"memberships\":return
                d(ye(\"DDB_TABLE_MEMBERSHIP\",\"aws-con\\"
              - "nect-directory_memberships\"));default:return p(`getTableName:
                tableName ${r} not\\"
              - " supported`)}}catch(t){let n=`${e}::unexpected
                exception:${t.message}`;throw new Error("
              - "n)}};var
                Le={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.e\
                nv.DDB_AWS_REGION&&"
              - "(Le={region:process.env.DDB_AWS_REGION});var wt=new
                Y.DynamoDBClient(Le),z=T.DynamoDBDocumentClient."
              - "from(wt,{marshallOptions:{removeUndefinedValues:!0}}),Ge=(r,e,\
                t,o)=>{let n=\"dyna\\"
              - "mo.makeDdbCreateCommand\";try{console.debug(`${e}:${n}::item`,\
                o);let s,a=q(r);if(a."
              - "isErr())return p({statusCode:500,body:a.error});s=a.value;let
                i={TableName:s,Item:o,"
              - "Expected:{[t]:{Exists:!1}}};return
                d({model:r,table:s,action:\"Create\",input:i})}catch(s){"
              - "let i=`${e}:${n}::unexpected exception:${s.message}`;throw new
                Error(i)}},se=(r,e,t,o)=>{"
              - "let
                n=\"dynamo.makeDdbDeleteCommand\";try{console.debug(`${e}:${n}`\
                ,t,o);let s,a=q("
              - "r);if(a.isErr())return
                p({statusCode:500,body:a.error});s=a.value;let i={TableName:s,"
              - "Key:{[t]:o},Expected:{[t]:{Exists:!0,Value:o}}};return
                d({model:r,table:s,action:\"\\"
              - "Delete\",input:i})}catch(s){let i=`${e}:${n}::unexpected
                exception:${s.message}`;"
              - "throw new Error(i)}},ae=r=>{let
                e=\"dynamo.makeDdbRetrieveManyCommand\";try{console."
              - "debug(`${e}::table`,r);let t,o=q(r);return
                o.isErr()?p({statusCode:500,body:o.error}):"
              - "(t=o.value,d({model:r,table:t,action:\"RetrieveScan\",input:{T\
                ableName:t}}))}catch(t){"
              - "let n=`${e}::unexpected exception:${t.message}`;throw new
                Error(n)}},Ue=r=>{let e=\"\\"
              - "dynamo.makeDdbRetrieveManyBatchCommand\";try{console.debug(`${\
                e}::table`,r);let t,"
              - "o=q(r);if(o.isErr())return
                p({statusCode:500,body:o.error});t=o.value;let
                n={RequestItems:{"
              - "[t]:{Keys:[]}}};return
                d({model:r,table:t,action:\"RetrieveBatchGet\",input:n})}catch(\
                t){"
              - "let n=`${e}::unexpected exception:${t.message}`;throw new
                Error(n)}};var Be=(r,e,t,o)=>{let
                n=\"dynamo.makeDdbRetrieveOneCommand\";try{console.debug(`${e}\
                \\"
              - ":${n}::event`,t);let s,a=q(r);if(a.isErr())return
                p({statusCode:500,body:a.error});"
              - "s=a.value;let i=Ve(e,o,t),c;if(i.isErr())return i;c=i.value;let
                u={TableName:s,Key:{"
              - "[o]:c}};return
                d({model:r,table:s,action:\"RetrieveGet\",input:u})}catch(s){let
                i=`${e}\\"
              - ":${n}::unexpected exception:${s.message}`;throw new
                Error(i)}};var
                qe=async(r,e)=>vt(`${r}:dynamo.runDdbCreateItem`,e),ie=async(r,\
                e)=>{if(e.isErr())"
              - "return e;let
                t=e.value,o=\"dynamo.runDdbDeleteItem\";try{console.debug(`${r}\
                :${o}:\\"
              - ":command.input`,t.input);let n=await z.send(new
                T.DeleteCommand(t.input));return console."
              - "debug(`${r}:${o}::result`,n),d({...t,output:n})}catch(n){let
                s=n,a,i;return s.message==="
              - "\"The conditional request failed\"?(a=404,i=\"Not
                found\"):(a=500,i=`${r}:${o}::${s."
              - "message}`,console.error(i,n)),p({statusCode:a,body:i})}},ue=as\
                ync(r,e)=>{if(e.isErr())"
              - "return e;let
                t=e.value,o=\"dynamo.runDdbRetrieveMany\";try{console.debug(`${\
                r}:${o}\\"
              - "::command.input`,t.input);let n=await z.send(new
                Y.ScanCommand(t.input));return console."
              - "debug(`${r}:${o}::result`,n),n.Items?(console.debug(`${r}:${o}\
                ::result.Items`,n."
              - "Items),d({...t,data:n.Items.map(s=>(0,fe.unmarshall)(s)),outpu\
                t:n})):(console.error("
              - "`${r}:${o}::result.Items is
                undefined`,n),p({statusCode:500,body:\"Unexpected dat\\"
              - "abase response\"}))}catch(n){let
                a=`${r}:${o}::${n.message}`;return console.error("
              - "a,n),p({statusCode:500,body:a})}};var
                je=async(r,e)=>{if(e.isErr())return e;let
                t=e.value,o=\"dynamo.runDdbRetrieve\\"
              - "ManyBatch\";try{console.debug(`${r}:${o}::command.input`,t.inp\
                ut);let n=await z.send("
              - "new T.BatchGetCommand(t.input));return
                console.debug(`${r}:${o}::result`,n),n.Responses?"
              - "(console.debug(`${r}:${o}::result.Responses`,n.Responses),n.Re\
                sponses.hasOwnProperty("
              - "t.table)?t.data=n.Responses[t.table].map(s=>{try{return(0,fe.u\
                nmarshall)(s)}catch{"
              - "return
                s}}):t.data=[],d({...t,output:n})):(console.error(`${r}:${o}::r\
                esult.Resp\\"
              - "onses is undefined`,n),p({statusCode:500,body:\"Unexpected
                database response\"}))}catch(n){"
              - "let a=`${r}:${o}::${n.message}`;return
                console.error(a,n),p({statusCode:500,body:a})}},"
              - "Fe=async(r,e,t)=>{if(e.isErr())return e;let
                o=e.value,n=\"dynamo.runDdbRetrieveOn\\"
              - "e\";try{console.debug(`${r}:${n}::command.input`,o.input);let
                s=await z.send(new T.GetCommand("
              - "o.input));if(console.debug(`${r}:${n}::result`,s),!s.Item)retu\
                rn p({statusCode:404,"
              - "body:\"Not
                found\"});if(console.debug(`${r}:${n}::result.Item`,s.Item),!s.\
                Item.hasOwnProperty("
              - "t)){let i=`${r}:${n}::${t} not found in result.Item`;return
                console.error(i,s),p("
              - "{statusCode:500,body:i})}let
                a={...o,data:[s.Item],output:s};return console.debug("
              - "`${r}:${n}::output`,a),d(a)}catch(s){let
                i=`${r}:${n}::${s.message}`;return console."
              - "error(i,s),p({statusCode:500,body:i})}},vt=async(r,e)=>{if(e.i\
                sErr())return e;let t=e."
              - "value,o=\"dynamo._ddbPutCommand\";try{console.debug(`${r}:${o}\
                ::command.input`,t.input);"
              - "let n=await z.send(new T.PutCommand(t.input));return
                console.debug(`${r}:${o}::r\\"
              - "esult`,n),d({...t,data:[t.input.Item],output:n})}catch(n){let
                s=n,a,i;return s.message==="
              - "\"The conditional request failed\"?(a=404,i=\"Not
                found\"):(a=500,i=`${r}:${o}::${s."
              - "message}`,console.error(i,n)),p({statusCode:a,body:i})}};var
                Nt=async r=>{let
                e=\"destinations.get\",t=\"destinations\";(!process.env.NODE_EN\
                V||"
              - "process.env.NODE_ENV!==\"test\")&&console.debug(`${e}::Received
                event`,JSON.stringify("
              - "r),r);let o=$(e,`GET /${t}`,r);if(o.isErr())return o.error;let
                n,s;r.queryStringParameters&&"
              - "r.queryStringParameters.filter&&(n=JSON.parse(r.queryStringPar\
                ameters.filter),console."
              - "debug(`${e}::filter`,n)),n?n.hasOwnProperty(\"q\")?s=\"SCAN_SE\
                ARCH\":n.hasOwnProperty("
              - "\"id\")||n.hasOwnProperty(\"Id\")||n.hasOwnProperty(\"Destinat\
                ionId\")?s=\"BATCH_GET\":s="
              - "\"SCAN_EXACT\":s=\"SCAN_ALL\",console.debug(`${e}::queryFilter\
                Mode`,s);let a;if(s==="
              - "\"BATCH_GET\"){let u=Ue(t);if(u.isErr())return
                u.error;console.log(`${e}::getBatch\\"
              - "Command(1)`,u.value,btoa(JSON.stringify(u.value)));let
                m=\"DestinationId\";n.hasOwnProperty("
              - "m)||(n.hasOwnProperty(\"Id\")?m=\"Id\":n.hasOwnProperty(\"id\"\
                )&&(m=\"id\"));let l=u.value."
              - "input;l.hasOwnProperty(\"RequestItems\")?l.RequestItems===void
                0?l.RequestItems={}:"
              - "l.RequestItems.hasOwnProperty(u.value.table)||l.RequestItems[u\
                .value.table]:l.RequestItems="
              - "{};for(let g of
                n[m])l.RequestItems[u.value.table].Keys.push({DestinationId:g})\
                ;"
              - "u.value.input=l,console.log(`${e}::getBatchCommand(2)`,u.value\
                ,btoa(JSON.stringify("
              - "u.value))),a=await je(e,u)}else{let u=ae(t),m=await
                ue(e,u);s===\"SCAN_ALL\"?a=m:a="
              - "Te(e,m,r)}let i=Pe(e,a,r),c=Se(e,i,r);return A(c)};var
                Qe={\"GET /destinations\":Nt};var At=async r=>{let
                e=\"destinations.getId\",t=\"destinations\",o=\"DestinationId\"\
                ;(!process."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${e}::Received even\\"
              - "t`,JSON.stringify(r),r);let n=$(e,`GET
                /${t}/{${o}}`,r);if(n.isErr())return n.error;"
              - "let s=B(e,o,r.pathParameters);if(s.isErr())return s.error;let
                a=Be(t,e,r,o),i=await Fe("
              - "e,a,o);return A(i)};var We={\"GET
                /destinations/{DestinationId}\":At};var
                He=require(\"@aws-sdk/util-dynamodb\");var Ke=async r=>{let
                e=\"util.deleteMembershipsForItem\",t,o;if(r.hasOwnProperty(\"\
                \\"
              - "DestinationId\")&&r.DestinationId!==void
                0&&(t=\"DestinationId\",o=r.DestinationId),"
              - "r.hasOwnProperty(\"DirectoryId\")&&r.DirectoryId!==void
                0&&(t=\"DirectoryId\",o=r.DirectoryId),"
              - "t===void 0)throw new Error(`${e}::lookupKey is undefined, which
                should be imposs\\"
              - "ible`);if(o===void 0)throw new Error(`${e}::lookupValue is
                undefined, which shou\\"
              - "ld be impossible`);let
                n=ae(\"memberships\");if(n.isErr())return n;let s={...n.value."
              - "input,FilterExpression:\"#Id =
                :Id\",ExpressionAttributeNames:{\"#Id\":t},ExpressionAttributeV\
                alues:{"
              - "\":Id\":(0,He.marshall)(o)}};console.debug(`${e}::getMembershi\
                psCommand:input`,s,JSON."
              - "stringify(s)),n.value.input=s;let a=await
                ue(e,n);if(a.isErr())return a;let i=a."
              - "value;console.log(`${e}::memberships`,i);let
                c=[];if(i.hasOwnProperty(\"data\")){let u=se("
              - "\"memberships\",e,t,\"\");if(u.isErr())return u;let
                m=u.value.input;(!m.hasOwnProperty("
              - "\"Key\")||m.Key===void
                0)&&(m.Key={}),m.hasOwnProperty(\"Expected\")&&delete
                m.Expected,"
              - "console.log(`${e}::input before
                loop`,JSON.stringify(m));for(let l of i.data){m."
              - "Key.DestinationId=l.DestinationId,m.Key.DirectoryId=l.Director\
                yId,u.value.input="
              - "m,console.log(`${e}::Cascading delete of
                membership`,m,JSON.stringify(m));let g=await ie("
              - "e,u);g.isErr()&&c.push(g.error)}}return
                c.length===0?d([]):p({statusCode:207,body:JSON."
              - "stringify({message:\"Requested deletion succeeded, but
                Memberships delete cascade\\"
              - " returned errors\",errors:c})})};var Tt=async r=>{let
                e=\"destinations.deleteId\",t=\"destinations\",o=\"DestinationId\
                \";"
              - "(!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&cons\
                ole.debug(`${e}::Rec\\"
              - "eived event`,JSON.stringify(r),r);let n=$(e,`DELETE
                /${t}/{${o}}`,r);if(n.isErr())"
              - "return n.error;let
                s=B(e,o,r.pathParameters);if(s.isErr())return s.error;let a=s."
              - "value,i=se(t,e,o,a),c=await ie(e,i);if(c.isErr())return
                c.error;let u=await Ke({"
              - "DestinationId:a});return u.isErr()?u.error:A(c)};var
                Je={\"DELETE /destinations/{DestinationId}\":Tt};var
                Z=require(\"@aws-sdk/lib-dynamodb\");var
                tt=require(\"@aws-sdk/client-lambda\"),he=require(\"@aws-sdk/li\
                b-dynamodb\");var St=require(\"@aws-sdk/lib-dynamodb\");var
                Ye=require(\"@aws-sdk/client-dynamodb\"),ze=require(\"@aws-sdk/\
                lib-dynamodb\");var
                Xe={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.e\
                nv.DDB_AWS_REGION&&"
              - "(Xe.region=process.env.DDB_AWS_REGION);var
                S=ze.DynamoDBDocumentClient.from(new Ye.DynamoDBClient("
              - "Xe),{marshallOptions:{removeUndefinedValues:!0}}),j=(r,e=\"SET
                \")=>{let t=\"api.aw\\"
              - "s-dynamodb.util.getUpdateExpression\",o=[],n={};for(let[a,i]of
                Object.entries(r))"
              - "if(f(`${t}`,a,i),a==\"Metadata\")for(let[c,u]of
                Object.entries(i))f(`${t}::${a}.`,"
              - "c,u),o.push(`${a}.${c} =
                :${a}${c}`),n[`:${a}${c}`]=u;else{let{expression:c,value:u}=i;"
              - "c&&u?(o.push(`${a} = :${c}`),n[`:${a}`]=u):(o.push(`${a} =
                :${a}`),n[`:${a}`]=i)}"
              - "let s={UpdateExpression:`${e}${o.join(\",
                \")}`,ExpressionAttributeValues:n};return f("
              - "\"api.aws-dynamodb.util.getUpdateExpression::output\",s,y(s)),\
                s},P=(r,e)=>{let t=\"\\"
              - "api.aws-dynamodb.util.vdxMarshallWithTable\";f(`${t}::input`,{\
                dataType:r,props:e},"
              - "y({dataType:r,props:e}));let
                o={},{pkValue:n,skValue:s}=e,a=Ze();if(a.isErr())return f("
              - "`${t}::error`,a.error.message),a;let
                i=a.value;if(r===\"destinations\"&&n){let c=\"\";"
              - "o.pkName=\"DestinationId\",o.pkValue=`${c}${n}`,o.tableName=i.\
                Destinations}else if(r==="
              - "\"directories\"&&n){let
                c=\"\";o.pkName=\"DirectoryId\",o.pkValue=`${c}${n}`,o.tableNam\
                e="
              - "i.Directories}else if(r===\"memberships\"&&(n||s)){let
                c=\"\",u=\"\";n&&(o.pkName=\"Des\\"
              - "tinationId\",o.pkValue=`${c}${n}`),s&&(o.skIndex=\"DirectoryId\
                Index\",o.skName=\"Dir\\"
              - "ectoryId\",o.skValue=`${u}${s}`),o.tableName=i.Memberships}els\
                e{let c={message:\"i\\"
              - "nternalServerError\",detail:`Invalid dataType: ${r} or both key
                values missing: ${n}\\"
              - ", ${s}`,errorSource:\"SERVER\"};return
                console.error(`${t}::error`,c),p(c)}return f("
              - "`${t}::output`,o,y(o)),d(o)},X=r=>{if(!r)return d(r);let
                e=Ee([r]);return e.isErr()?"
              - "e:!e.value||e.value.length===0?d(void
                0):d(e.value[0])},Ee=r=>{let e=\"api.aws-dy\\"
              - "namodb.util.vdxUnmarshallMany\";console.log(`${e}::data`,r,y(r\
                ));try{if(!r||r.length==="
              - "0)return d(r);let
                t=r.flatMap(o=>{if(!o)return[];let{pk:n,sk:s,...a}=o,i={};return
                n?"
              - "(n.startsWith(\"DIR#\")?i.DirectoryId=n.substring(4):n.startsW\
                ith(\"DEST#\")&&(i.DestinationId="
              - "n.substring(5),s?.startsWith(\"DIR#\")&&(i.DirectoryId=s.subst\
                ring(4))),Object.keys("
              - "i).length>0?i={...i,...a}:console.error(\"vdxUnMarshallMany:er\
                ror::couldn't compr\\"
              - "ehend item, skipping I guess??\",o,y(o))):i=o,[i]});return
                console.log(`${e}::out\\"
              - "put`,t,y(t)),d(t)}catch(t){let o=typeof t==\"string\"?new
                Error(t):t,n={message:\"i\\"
              - "nternalServerError\",detail:o.message,errorSource:\"SERVER\",o\
                riginalError:o};return console."
              - "error(`${e}::error`,n,y(n)),p(n)}},Ze=()=>{function
                r(t){if(process.env[t]&&(process."
              - "env[t]||\"\").length>0)return d(process.env[t]);{let
                o={message:\"internalServerErr\\"
              - "or\",detail:`${t} not set`,errorSource:\"SERVER\"};return
                console.error(o),p(o)}}let e={"
              - "Destinations:\"\",Directories:\"\",Memberships:\"\"};if(proces\
                s.env.NODE_ENV===\"test\")"
              - "console.debug(\"NODE_ENV=test, setting TABLES to test
                values\"),e.Destinations=\"aw\\"
              - "s-connect-directory_destinations\",e.Directories=\"aws-connect\
                -directory_directori\\"
              - "es\",e.Memberships=\"aws-connect-directory_memberships\";else{\
                let t=r(\"DDB_TABLE_DE\\"
              - "STINATION\");if(t.isErr())return t;e.Destinations=t.value;let
                o=r(\"DDB_TABLE_DIRE\\"
              - "CTORY\");if(o.isErr())return o;e.Directories=o.value;let
                n=r(\"DDB_TABLE_MEMBERSHI\\"
              - "P\");if(n.isErr())return n;e.Memberships=n.value}return
                d(e)};var F=require(\"@aws-sdk/lib-dynamodb\");var
                ge=async(r,e={})=>et(\"destinations\",r,e),be=async(r,e={})=>et(\
                \"directories\","
              - "r,e);var et=async(r,e,t={})=>{let
                o=\"api.aws-dynamodb.memberships._getMembershipRecor\\"
              - "dsByDestDirId\";console.log(`${o}::input`,{dataType:r,id:e,pro\
                ps:t});let n=t.errWhenNone||"
              - "!1;try{let s={};r==\"directories\"?s.skValue=e:s.pkValue=e;let
                a=P(\"memberships\",s);"
              - "if(a.isErr())return
                a;let{pkName:i,pkValue:c,skIndex:u,skName:m,skValue:l,tableName\
                :g}=a."
              - "value,E={};if(i&&c&&(E.KeyConditionExpression=`${i} =
                :pk`,E.ExpressionAttributeValues="
              - "{\":pk\":c}),m&&l&&(E.KeyConditionExpression=`${m} =
                :sk`,E.ExpressionAttributeValues="
              - "{\":sk\":l},u&&(E.IndexName=u)),Object.keys(E).length===0)retu\
                rn p({message:\"inter\\"
              - "nalServerError\",errorSource:\"SERVER\"});E.TableName=g,f(`${o\
                }::QueryCommandInput`,"
              - "E);let h=await S.send(new
                F.QueryCommand(E));f(`${o}::QueryCommandResponse`,h,y("
              - "h));let{Items:x}=h;if(!x&&n){let R=\"No items found\";throw
                f(`${o}:`,R,y(h)),new Error("
              - "`${o}: ${R}`)}let w=Ee(x);return
                console.debug(`${o}::output`,w),w}catch(s){let a=typeof s=="
              - "\"string\"?new
                Error(s):s,i={message:\"internalServerError\",detail:a.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:a};return
                console.error(`${o}::error`,i,y(i)),p(i)}};var rt=r=>{let
                e=\"api.aws-dynamodb.directories.calculateDirectoryStatus\",t=\
                \"UNKN\\"
              - "OWN\";try{let o=r.Metadata;if(o){let n=o.LastBuildAttempt?new
                Date(o.LastBuildAttempt)."
              - "getTime():0,s=o.LastBuildFailure?new
                Date(o.LastBuildFailure).getTime():0,a=o.LastBuildSuccess?"
              - "new
                Date(o.LastBuildSuccess).getTime():0,i=o.LastBuildableEvent?new
                Date(o.LastBuildableEvent)."
              - "getTime():0,c=o.IsBroken??!1,u=o.IsBuilt??!1,m=o.IsLicenseErro\
                r??!1,l=o.IsRollingBack??"
              - "!1,g=a>s?a:s;m?t=\"LICENSE_ERROR\":l?u?t=\"STOPPING_UPDATE\":t=\
                \"STOPPING_BUILD\":c?t="
              - "\"NEEDS_REPAIR\":i>n?t=\"ASSESSING\":n>g?u?t=\"UPDATING\":t=\"\
                BUILDING\":a>s?t=\"IN_SYNC\":"
              - "n==0?t=\"UNKNOWN\":u?t=\"OUT_OF_SYNC\":t=\"NOT_BUILT\"}}catch(\
                o){let n=o,s=`${e}::unex\\"
              - "pected
                exception:${n.message}`;console.error(s,n,y(n))}finally{return
                t}};var Ie=async(r,e)=>{let t=new Date().toISOString();return
                Object.keys(e).forEach("
              - "o=>{(e[o]===void
                0||e[o]===null)&&(o.startsWith(\"Last\")?e[o]=t:delete
                e[o])}),await nt("
              - "{DirectoryId:r,Metadata:e},{updateLastModified:!1})};var
                nt=async(r,e={})=>{let
                t=\"api.aws-dynamodb.directories.updateDirectory\";console."
              - "log(`${t}::input`,{directoryItem:r,props:e});let{expressionOpt\
                ions:o={},updateLastModified:n=!0}=e,"
              - "s=Vt(r);if(s.isErr())return
                s;let{DirectoryId:a,Description:i}=r;try{if(i){let I=await be("
              - "a);if(I.isErr())return I;if(I.value){let
                k=I.value.map(ce=>ce.DestinationId).map("
              - "async ce=>{try{let
                M=P(\"memberships\",{pkValue:ce,skValue:a});if(M.isErr())return
                M;"
              - "let{pkName:W,pkValue:it,skName:ut,skValue:ct,tableName:mt}=M.v\
                alue,{UpdateExpression:pt,"
              - "ExpressionAttributeValues:dt}=j({DirectoryName:i,LastModifiedD\
                ateTime:new Date()."
              - "toISOString()}),xe={TableName:mt,Key:{[W]:it,[ut]:ct},UpdateEx\
                pression:pt,ExpressionAttributeValues:dt,"
              - "ReturnValues:\"ALL_NEW\"};f(`${t}::updateMembershipCommand`,xe\
                );let we=await S.send("
              - "new he.UpdateCommand(xe));return
                f(`${t}::updateMembershipResult`,we),Promise.resolve("
              - "we)}catch(M){let W=typeof M==\"string\"?new Error(M):M;return
                console.error(`${t}:\\"
              - ":updateMembershipError`,W,y(W)),Promise.resolve(W)}}),Qt=await
                Promise.allSettled("
              - "k)}}let c=P(\"directories\",{pkValue:a});if(c.isErr())return
                c;let{pkName:u,pkValue:m,"
              - "tableName:l}=c.value,{DirectoryId:g,...E}=r,h=E;h.Metadata||(h\
                .Metadata={}),n&&(h."
              - "Metadata.LastModifiedDateTime=new
                Date().toISOString()),h.Metadata.DirectoryStatus&&"
              - "delete
                h.Metadata.DirectoryStatus;let{UpdateExpression:x,ExpressionAtt\
                ributeValues:w}=j("
              - "{...h}),R={ReturnValues:\"ALL_NEW\",...o,TableName:l,Key:{[u]:\
                m},UpdateExpression:x,"
              - "ExpressionAttributeValues:w};f(`${t}::updateDirectoryCommand`,\
                R);let D=await S.send("
              - "new
                he.UpdateCommand(R));f(`${t}::updateDirectoryResult`,D);let{Att\
                ributes:v}=D,"
              - "O=v&&Mt(v);console.debug(`${t}::outputting`,O);let
                b=X(O);return console.log(`${t}\\"
              - "::output`,b),b.isErr()?b:b.value?d(b.value):p({message:\"notFo\
                und\",detail:`No Dir\\"
              - "ectory found with DirectoryId:
                ${a}`,errorSource:\"CLIENT\"})}catch(c){let u=typeof c=="
              - "\"string\"?new
                Error(c):c,m={message:\"internalServerError\",detail:u.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:u};return
                console.error(`${t}::error`,m,y(m)),p(m)}},Mt=r=>{"
              - "let e=r;return
                e&&(e.Metadata||(e.Metadata={}),e.Metadata.DirectoryStatus=rt(e\
                )),"
              - "e};var Vt=r=>{let
                e=\"api.aws-dynamodb.directories._checkRequiredDirectoryAttribu\
                tes\","
              - "{DirectoryId:t}=r,o;return t?o=d(void
                0):o=p({message:\"resource.directories.vali\\"
              - "dation.missingDirectoryId\",errorSource:\"CLIENT\"}),o.isErr()\
                &&console.error(`${e}\\"
              - "::error`,o.error.message,r,y(r)),o};var Ce=async r=>{let
                e=\"api.aws-dynamodb.destinations.checkDestinationSynonymCon\\"
              - "flicts\",{caller:t,destinationId:o,directories:n,synonyms:s}=r\
                ;try{console.log(`${t}\\"
              - ":${e}::props`,r);let a=[],i={};s.forEach((l,g)=>{let
                E=`:synonym${g}`;a.push(`co\\"
              - "ntains(Synonyms, ${E})`),i[E]=l});let
                c=n.filter(l=>l.trim().length>0).flatMap(async l=>{"
              - "let
                g=[],E=P(\"memberships\",{pkValue:o,skValue:l});if(E.isErr())re\
                turn console.error("
              - "`${t}:${e}::tableInfoResult -- falling back to return no
                conflicts for destinati\\"
              - "on ${o} and directory ${l} because of
                error:`,E,y(E)),[];let{skIndex:h,pkName:x,"
              - "pkValue:w,skName:R,skValue:D,tableName:v}=E.value;if(!h||!x||!\
                w||!R||!D)return console."
              - "error(`${t}:${e}::tableInfoResult -- falling back to return no
                conflicts for des\\"
              - "tination ${o} and directory ${l} because didn't get all
                required values, got thi\\"
              - "s instead:`,E.value),[];try{let
                O={TableName:v,IndexName:h,KeyConditions:{[R]:{ComparisonOperat\
                or:\"\\"
              - "EQ\",AttributeValueList:[D]}},FilterExpression:`(NOT ${x} =
                :pk) AND (${a.join(\" \\"
              - "OR
                \")})`,ExpressionAttributeValues:{\":pk\":w,...i}};f(`${t}:${e}\
                ::queryCommandInp\\"
              - "ut`,O,y(O));let b=await S.send(new
                Z.QueryCommand(O));f(`${t}:${e}::queryCommand\\"
              - "Result`,b,y(b)),b.Items?(f(`${t}:${e}::queryCommandResult.Item\
                s`,b.Items,y(b.Items)),"
              - "g=b.Items.map(I=>({DestinationId:I.DestinationId,DestinationNa\
                me:I.DestinationName,"
              - "DirectoryName:I.DirectoryName,ConflictSynonyms:I.Synonyms.filt\
                er(Q=>s.includes(Q))}))):"
              - "f(`${t}:${e}::queryCommandResult.Items is undefined, returning
                empty list`)}catch(O){"
              - "let
                I=`${t}:${e}::${O.message}`;console.error(I,O)}finally{return
                f(`${t}:${e}::\\"
              - "oneDirectoryOutput`,g,y(g)),Promise.resolve(g)}});f(`${t}:${e}\
                ::promises`,c,y(c));"
              - "let u=await Promise.all(c);f(`${t}:${e}::resolved`,u,y(u));let
                m=u.flat();return console."
              - "log(`${t}:${e}::output`,m,y(m)),d(m)}catch(a){let
                i=a,c=`${t}:${e}::${i.message}`;"
              - "return
                console.error(c,a),p({message:\"internalServerError\",detail:i.\
                message,errorSource:\"\\"
              - "SERVER\",originalError:i})}};var Re=async(r,e)=>{let
                t=\"api.aws-dynamodb.destinations.updateDestination\";console."
              - "log(`${t}::input`,{destinationItem:r,props:e});let
                o=Lt(r);if(o.isErr())return o;"
              - "let{DestinationId:n,Synonyms:s}=r;try{let a=await
                ge(n);if(a.isErr())return a;if(a."
              - "value){let
                v=a.value.map(k=>k.DirectoryId),O=s.map(k=>k.Value),b=await
                Ce({caller:t,"
              - "destinationId:n,directories:v,synonyms:O});if(b.isErr())return
                b;if(b.value.length>"
              - "0)return
                p({message:\"resources.memberships.validation.duplicateSynonyms\
                AcrossDir\\"
              - "ectories\",data:b.value,errorSource:\"CLIENT\"});let
                I=v.flatMap(async k=>[Gt(t,k),"
              - "Ut(t,k,r)]),Q=await Promise.allSettled(I)}let
                i=P(\"destinations\",{pkValue:n});if(i."
              - "isErr())return
                i;let{pkName:c,pkValue:u,tableName:m}=i.value,{DestinationId:l,\
                ...g}=r,"
              - "{UpdateExpression:E,ExpressionAttributeValues:h}=j({...g,LastM\
                odifiedDateTime:new Date()."
              - "toISOString()}),x={TableName:m,Key:{[c]:u},UpdateExpression:E,\
                ExpressionAttributeValues:h,"
              - "ReturnValues:\"ALL_NEW\"};f(`${t}::updateDestinationCommand`,x\
                );let w=await S.send("
              - "new
                Z.UpdateCommand(x));f(`${t}::updateDestinationResult`,w);let{At\
                tributes:R}=w;"
              - "console.debug(`${t}::outputting`,R);let D=X(R);return
                console.log(`${t}::output`,"
              - "D),D.isErr()?D:D.value?d(D.value):p({message:\"notFound\",deta\
                il:`No Destination f\\"
              - "ound with DestinationId:
                ${n}`,errorSource:\"CLIENT\"})}catch(a){let i=typeof a==\"\\"
              - "string\"?new
                Error(a):a,c={message:\"internalServerError\",detail:i.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:i};return
                console.error(`${t}::error`,c,y(c)),p(c)}},Lt=r=>{"
              - "let
                e=\"api.aws-dynamodb.destinations._checkRequiredDestinationAttr\
                ibutes\",{DestinationId:t}=r,"
              - "o;return t?o=d(void
                0):o=p({message:\"resource.destinations.validation.missingDes\\"
              - "tinationId\",errorSource:\"CLIENT\"}),o.isErr()&&console.error\
                (`${e}::error`,o.error."
              - "message,r,y(r)),o},Gt=async(r,e)=>{let
                t=`${r}:setDirectoryLastBuildableEvent`,o=await Ie("
              - "e,{LastBuildableEvent:void 0});return
                o.isErr()?(console.error(`${t}::updateDire\\"
              - "ctoryError`,o,y(o)),Promise.resolve(o.error)):Promise.resolve(\
                o.value)},Ut=async(r,e,t)=>{"
              - "let
                o=`${r}:updateMembership`;try{let{DestinationId:n,Description:s\
                ,Synonyms:a,GuiName:i,"
              - "VuiName:c,AmazonConnect:u}=t,m=a.map(Q=>Q.Value),{ExternalTarg\
                et:l,InternalTarget:g}=u,"
              - "E=P(\"memberships\",{pkValue:n,skValue:e});if(E.isErr())return
                E.error;let{pkName:h,"
              - "pkValue:x,skName:w,skValue:R,tableName:D}=E.value,{UpdateExpre\
                ssion:v,ExpressionAttributeValues:O}=j("
              - "{DestinationName:s,Synonyms:m,DestinationGuiName:i,Destination\
                VuiName:c,InternalTarget:g||"
              - "\"\",ExternalTarget:l||\"\",InternalTargetExists:!!g,ExternalT\
                argetExists:!!l,InternalTargetEnabled:!!g,"
              - "ExternalTargetEnabled:!!l,LastModifiedDateTime:new
                Date().toISOString()}),b={TableName:D,"
              - "Key:{[h]:x,[w]:R},UpdateExpression:v,ExpressionAttributeValues\
                :O,ReturnValues:\"A\\"
              - "LL_NEW\"};f(`${o}::updateMembershipCommand`,b);let I=await
                S.send(new Z.UpdateCommand("
              - "b));return
                f(`${o}::updateMembershipResult`,I),Promise.resolve(I)}catch(n)\
                {let s=typeof n=="
              - "\"string\"?new
                Error(n):n,a={message:\"internalServerError\",detail:s.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:s};return
                console.error(`${o}::updateMembershipError`,a,y("
              - "a)),Promise.resolve(a)}};var
                De=\"destinations\",Oe=\"DestinationId\",Bt=async r=>{let
                e=\"destinations.putId\";"
              - "(!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&cons\
                ole.log(`${e}::Recei\\"
              - "ved event`,JSON.stringify(r),r);let t=$(e,`PUT
                /${De}/{${Oe}}`,r);if(t.isErr())return t."
              - "error;let o=B(e,Oe,r.pathParameters);if(o.isErr())return
                o.error;let n=o.value,s=ee("
              - "oe(r));if(s.isErr())return
                s.error;if(s.value.DestinationId!=n){let u=\"resources\\"
              - ".destinations.validation.endpointPayloadMismatch\";return
                console.error(`${e}::${u}`),"
              - "{statusCode:400,body:u}}let a={...s.value},i=await
                Re(a,{});if(i.isErr())return le("
              - "i.error);f(`${e}::output`,i.value,y(i.value));let
                c={model:De,table:\"Destination\\"
              - "s\",input:{TableName:\"lol\",Key:{pk:\"a\"}},action:\"Update\"\
                ,data:[i.value]};return A("
              - "d(c))};var ot={[`PUT /${De}/{${Oe}}`]:Bt};var qt=async r=>{let
                e=\"destinations.post\",t=\"destinations\",o=\"DestinationId\";\
                (!process."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${e}::Received even\\"
              - "t`,JSON.stringify(r),r);let n=$(e,`POST
                /${t}`,r);if(n.isErr())return n.error;let s=ee("
              - "oe(r));if(s.isErr())return s.error;let
                a=s.value;a[o]=ke(),a.LastModifiedDateTime="
              - "new Date().toISOString();let i=Ge(t,e,o,a),c=await
                qe(e,i);return A(c)};var st={\"POST /destinations\":qt};var
                jt=async(r,e)=>await
                G(\"destinations\",r,e,{...at.routes}),ee=r=>{if(r.isErr())"
              - "return r;let e=\"destinations.parseDestination\";try{let
                t=JSON.parse(r.value),o=!0,"
              - "n=!0;if(!t.GuiName||typeof
                t.GuiName!=\"string\"||t.GuiName.length==0)throw new Error("
              - "\"GuiName is required\");if(!t.VuiName||typeof
                t.VuiName!=\"string\"||t.VuiName.length=="
              - "0)throw new Error(\"VuiName is
                required\");if(!t.Description||typeof t.Description!="
              - "\"string\")throw new Error(\"Description is
                required\");if(!t.AmazonConnect||typeof t."
              - "AmazonConnect!=\"object\")throw new Error(\"Amazon Connect
                targets are required\");if(!t."
              - "AmazonConnect.InternalTarget||typeof
                t.AmazonConnect.InternalTarget!=\"string\"||t."
              - "AmazonConnect.InternalTarget.length==0)o=!1;else
                if(!t.AmazonConnect.ExternalTarget||"
              - "typeof
                t.AmazonConnect.ExternalTarget!=\"string\"||t.AmazonConnect.Ext\
                ernalTarget."
              - "length==0)n=!1;else
                if(o||n){if(!t.Synonyms||!Array.isArray(t.Synonyms)||t.Synonyms\
                ."
              - "length==0)throw new Error(\"Synonyms are required\")}else throw
                new Error(\"At leas\\"
              - "t one of InternalTarget,ExternalTarget is required\");for(let i
                of t.Synonyms)if(i."
              - "hasOwnProperty(\"Value\")){if(!i.Value||typeof
                i.Value!=\"string\"||i.Value.length=="
              - "0)throw new Error(\"Synonym.Value is required\")}else throw new
                Error(\"Synonyms mu\\"
              - "st be in form { Value: string }\");let
                s=\"\";if(t.DestinationId){if(typeof t.DestinationId!="
              - "\"string\")throw new Error(\"DestinationId must be a
                string\");if(t.DestinationId.length!="
              - "ne)throw new Error(\"DestinationId must be ${ITEM_ID_SIZE}
                characters\");s=t.DestinationId}"
              - "let
                a={DestinationId:s,LastModifiedDateTime:\"\",GuiName:t.GuiName,\
                VuiName:t.VuiName,"
              - "Description:t.Description,AmazonConnect:{InternalTarget:t.Amaz\
                onConnect.InternalTarget,"
              - "ExternalTarget:t.AmazonConnect.ExternalTarget},Synonyms:t.Syno\
                nyms};return d(a)}catch(t){"
              - "let n=`${e}::${t.message}`;return
                console.error(n,t),p({statusCode:400,body:n})}},"
              - "at={routes:{...Qe,...ot,...We,...st,...Je}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          DDB_TABLE_DESTINATION:
            Ref: "DdbDestinations37B2F70F"
          DDB_TABLE_DIRECTORY:
            Ref: "DdbDirectories26458382"
          DDB_TABLE_MEMBERSHIP:
            Ref: "DdbMemberships1A816D0C"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ApiDestinationsLambdaServiceRole05DF04F8"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn:
      - "ApiDestinationsLambdaServiceRoleDefaultPolicy9C7933DE"
  ApiDirectoriesLambdaServiceRoleC3789FAF:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ApiDirectoriesLambdaServiceRoleDefaultPolicyDDF45229:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:BatchWriteItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DeleteItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:PutItem"
              - "dynamodb:Query"
              - "dynamodb:Scan"
              - "dynamodb:UpdateItem"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbDirectories26458382"
                  - "Arn"
              - Fn::GetAtt:
                  - "DdbMemberships1A816D0C"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DdbMemberships1A816D0C"
                        - "Arn"
                    - "/index/*"
          - Action: "lambda:InvokeFunction"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DirMgmtCfnPublishLambdaF639239A"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DirMgmtCfnPublishLambdaF639239A"
                        - "Arn"
                    - ":*"
        Version: "2012-10-17"
      PolicyName: "ApiDirectoriesLambdaServiceRoleDefaultPolicyDDF45229"
      Roles:
        - Ref: "ApiDirectoriesLambdaServiceRoleC3789FAF"
  ApiDirectoriesLambda04D7F3F1:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var me=Object.defineProperty;var
                mt=Object.getOwnPropertyDescriptor;var
                dt=Object.getOwnPropertyNames;var
                pt=Object.prototype.hasOwnProperty;var lt=(t,e)=>{for(var r in
                e)me(t,r,{get:e[r],enumerable:!0})},yt=(t,e,r,s)=>{if(e&&"
              - "typeof e==\"object\"||typeof e==\"function\")for(let o of
                dt(e))!pt.call(t,o)&&o!==r&&"
              - "me(t,o,{get:()=>e[o],enumerable:!(s=mt(e,o))||s.enumerable});r\
                eturn t};var ft=t=>yt(me({},\"__esModule\",{value:!0}),t);var
                jt={};lt(jt,{addDirectoryStatus:()=>$,directories:()=>rt,handle\
                r:()=>qt,parseDirectory:()=>F});"
              - "module.exports=ft(jt);function x(t){var
                e=String(t);if(e===\"[object
                Object]\")try{e=JSON.stringify(t)}catch{}"
              - "return e}var Et=function(){function t(){}return
                t.prototype.isSome=function(){return!1},t."
              - "prototype.isNone=function(){return!0},t.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){"
              - "return e},t.prototype.expect=function(e){throw new
                Error(\"\".concat(e))},t.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},t.prototype.map=function(e){"
              - "return this},t.prototype.mapOr=function(e,r){return
                e},t.prototype.mapOrElse=function(e,r){"
              - "return e()},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){"
              - "return e()},t.prototype.andThen=function(e){return
                this},t.prototype.toResult=function(e){"
              - "return
                d(e)},t.prototype.toString=function(){return\"None\"},t.prototy\
                pe.toAsyncOption="
              - "function(){return new G(T)},t}(),T=new Et;Object.freeze(T);var
                gt=function(){function t(e){"
              - "if(!(this instanceof t))return new t(e);this.value=e}return
                t.prototype.isSome=function(){"
              - "return!0},t.prototype.isNone=function(){return!1},t.prototype[\
                Symbol.iterator]=function(){"
              - "var e=Object(this.value);return Symbol.iterator in
                e?e[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){return this.value},"
              - "t.prototype.expect=function(e){return
                this.value},t.prototype.unwrap=function(){"
              - "return this.value},t.prototype.map=function(e){return
                A(e(this.value))},t.prototype."
              - "mapOr=function(e,r){return
                r(this.value)},t.prototype.mapOrElse=function(e,r){return r("
              - "this.value)},t.prototype.or=function(e){return
                this},t.prototype.orElse=function(e){"
              - "return this},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.toResult="
              - "function(e){return
                p(this.value)},t.prototype.toAsyncOption=function(){return new
                G("
              - "this)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype.toString="
              - "function(){return\"Some(\".concat(x(this.value),\")\")},t.EMPT\
                Y=new t(void 0),t}(),A=gt,"
              - "ve;(function(t){function e(){for(var
                o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];"
              - "for(var a=[],i=0,c=o;i<c.length;i++){var
                u=c[i];if(u.isSome())a.push(u.value);else"
              - "return u}return A(a)}t.all=e;function r(){for(var
                o=[],n=0;n<arguments.length;n++)"
              - "o[n]=arguments[n];for(var a=0,i=o;a<i.length;a++){var
                c=i[a];if(c.isSome())return c}"
              - "return T}t.any=r;function s(o){return o instanceof
                A||o===T}t.isOption=s})(ve||(ve="
              - "{}));var bt=function(){function t(e){if(!(this instanceof
                t))return new t(e);this.error="
              - "e;var r=new Error().stack.split(`"
              - "`).slice(2);r&&r.length>0&&r[0].includes(\"ErrImpl\")&&r.shift\
                (),this._stack=r.join("
              - "`"
              - "`)}return
                t.prototype.isOk=function(){return!1},t.prototype.isErr=functio\
                n(){return!0},"
              - "t.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "t.prototype.else=function(e){return
                e},t.prototype.unwrapOr=function(e){return e},"
              - "t.prototype.expect=function(e){throw new Error(\"\".concat(e,\"
                - Error: \").concat("
              - "x(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.expect\
                Err=function(e){return this."
              - "error},t.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "x(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.unwrap\
                Err=function(){return this."
              - "error},t.prototype.map=function(e){return
                this},t.prototype.andThen=function(e){"
              - "return this},t.prototype.mapErr=function(e){return new
                d(e(this.error))},t.prototype."
              - "mapOr=function(e,r){return
                e},t.prototype.mapOrElse=function(e,r){return e(this."
              - "error)},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){return e("
              - "this.error)},t.prototype.toOption=function(){return
                T},t.prototype.toString=function(){"
              - "return\"Err(\".concat(x(this.error),\")\")},Object.definePrope\
                rty(t.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),t.prot\
                otype.toAsyncResult="
              - "function(){return new U(this)},t.EMPTY=new t(void 0),t}();var
                d=bt,Ct=function(){function t(e){if(!(this instanceof t))return
                new t(e);this."
              - "value=e}return
                t.prototype.isOk=function(){return!0},t.prototype.isErr=functio\
                n(){"
              - "return!1},t.prototype[Symbol.iterator]=function(){var
                e=Object(this.value);return Symbol."
              - "iterator in
                e?e[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "t.prototype.else=function(e){return
                this.value},t.prototype.unwrapOr=function(e){"
              - "return this.value},t.prototype.expect=function(e){return
                this.value},t.prototype."
              - "expectErr=function(e){throw new
                Error(e)},t.prototype.unwrap=function(){return this."
              - "value},t.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "x(this.value)),{cause:this.value})},t.prototype.map=function(e\
                ){return new p(e(this."
              - "value))},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.mapErr="
              - "function(e){return this},t.prototype.mapOr=function(e,r){return
                r(this.value)},t."
              - "prototype.mapOrElse=function(e,r){return
                r(this.value)},t.prototype.or=function(e){"
              - "return this},t.prototype.orElse=function(e){return
                this},t.prototype.toOption=function(){"
              - "return A(this.value)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype."
              - "toString=function(){return\"Ok(\".concat(x(this.value),\")\")}\
                ,t.prototype.toAsyncResult="
              - "function(){return new U(this)},t.EMPTY=new t(void 0),t}();var
                p=Ct,we;(function(t){function e(){for(var
                a=[],i=0;i<arguments.length;i++)a[i]="
              - "arguments[i];for(var c=[],u=0,m=a;u<m.length;u++){var
                l=m[u];if(l.isOk())c.push("
              - "l.value);else return l}return new p(c)}t.all=e;function
                r(){for(var a=[],i=0;i<arguments."
              - "length;i++)a[i]=arguments[i];for(var
                c=[],u=0,m=a;u<m.length;u++){var l=m[u];if(l."
              - "isOk())return l;c.push(l.error)}return new
                d(c)}t.any=r;function s(a){try{return new p("
              - "a())}catch(i){return new d(i)}}t.wrap=s;function
                o(a){try{return a().then(function(i){"
              - "return new p(i)}).catch(function(i){return new
                d(i)})}catch(i){return Promise.resolve("
              - "new d(i))}}t.wrapAsync=o;function n(a){return a instanceof d||a
                instanceof p}t.isResult="
              - "n})(we||(we={}));var K=function(t,e,r,s){function o(n){return n
                instanceof r?n:new r(function(a){"
              - "a(n)})}return new(r||(r=Promise))(function(n,a){function
                i(m){try{u(s.next(m))}catch(l){"
              - "a(l)}}function c(m){try{u(s.throw(m))}catch(l){a(l)}}function
                u(m){m.done?n(m.value):"
              - "o(m.value).then(i,c)}u((s=s.apply(t,e||[])).next())})},J=funct\
                ion(t,e){var r={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},s,o,n,a;return a="
              - "{next:i(0),throw:i(1),return:i(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function i(u){return
                function(m){return c([u,m])}}function c(u){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,u[0]&&(r="
              - "0)),r;)try{if(s=1,o&&(n=u[0]&2?o.return:u[0]?o.throw||((n=o.re\
                turn)&&n.call(o),0):"
              - "o.next)&&!(n=n.call(o,u[1])).done)return
                n;switch(o=0,n&&(u=[u[0]&2,n.value]),u[0]){case 0:case 1:"
              - "n=u;break;case 4:return r.label++,{value:u[1],done:!1};case
                5:r.label++,o=u[1],u="
              - "[0];continue;case
                7:u=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(u[0]===6||u[0]===2)){r=0;continue\
                }if(u[0]===3&&(!n||"
              - "u[1]>n[0]&&u[1]<n[3])){r.label=u[1];break}if(u[0]===6&&r.label\
                <n[1]){r.label=n[1],"
              - "n=u;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(u);break\
                }n[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}u=e.call(t,r)}catch(m){u=[6,m],o=0}final\
                ly{s=n=0}if(u[0]&5)"
              - "throw u[1];return{value:u[0]?u[1]:void
                0,done:!0}}},U=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var r=this;return this."
              - "thenInternal(function(s){return K(r,void 0,void
                0,function(){var o;return J(this,"
              - "function(n){return s.isErr()?[2,s]:(o=e(s.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(e){var r=this;return
                this.thenInternal(function(s){return K("
              - "r,void 0,void 0,function(){var o;return
                J(this,function(n){switch(n.label){case 0:"
              - "return s.isErr()?[2,s]:(o=p,[4,e(s.value)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.mapErr=function(e){var r=this;return
                this.thenInternal(function(s){return K("
              - "r,void 0,void 0,function(){var o;return
                J(this,function(n){switch(n.label){case 0:"
              - "return s.isOk()?[2,s]:(o=d,[4,e(s.error)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var r=this;return
                this.thenInternal(function(s){return K(r,void 0,"
              - "void 0,function(){var o;return J(this,function(n){return
                s.isOk()?[2,s]:(o=e(s.error),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toOption=function(){return
                new G("
              - "this.promise.then(function(e){return
                e.toOption()}))},t.prototype.thenInternal=function(e){"
              - "return new t(this.promise.then(e))},t}();var
                de=function(t,e,r,s){function o(n){return n instanceof r?n:new
                r(function(a){"
              - "a(n)})}return new(r||(r=Promise))(function(n,a){function
                i(m){try{u(s.next(m))}catch(l){"
              - "a(l)}}function c(m){try{u(s.throw(m))}catch(l){a(l)}}function
                u(m){m.done?n(m.value):"
              - "o(m.value).then(i,c)}u((s=s.apply(t,e||[])).next())})},pe=func\
                tion(t,e){var r={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},s,o,n,a;return a="
              - "{next:i(0),throw:i(1),return:i(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function i(u){return
                function(m){return c([u,m])}}function c(u){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,u[0]&&(r="
              - "0)),r;)try{if(s=1,o&&(n=u[0]&2?o.return:u[0]?o.throw||((n=o.re\
                turn)&&n.call(o),0):"
              - "o.next)&&!(n=n.call(o,u[1])).done)return
                n;switch(o=0,n&&(u=[u[0]&2,n.value]),u[0]){case 0:case 1:"
              - "n=u;break;case 4:return r.label++,{value:u[1],done:!1};case
                5:r.label++,o=u[1],u="
              - "[0];continue;case
                7:u=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(u[0]===6||u[0]===2)){r=0;continue\
                }if(u[0]===3&&(!n||"
              - "u[1]>n[0]&&u[1]<n[3])){r.label=u[1];break}if(u[0]===6&&r.label\
                <n[1]){r.label=n[1],"
              - "n=u;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(u);break\
                }n[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}u=e.call(t,r)}catch(m){u=[6,m],o=0}final\
                ly{s=n=0}if(u[0]&5)"
              - "throw u[1];return{value:u[0]?u[1]:void
                0,done:!0}}},G=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var r=this;return this."
              - "thenInternal(function(s){return de(r,void 0,void
                0,function(){var o;return pe(this,"
              - "function(n){return s.isNone()?[2,s]:(o=e(s.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(e){var r=this;return
                this.thenInternal(function(s){return de("
              - "r,void 0,void 0,function(){var o;return
                pe(this,function(n){switch(n.label){case 0:"
              - "return s.isNone()?[2,s]:(o=A,[4,e(s.value)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var r=this;return
                this.thenInternal(function(s){return de(r,void 0,"
              - "void 0,function(){var o;return pe(this,function(n){return
                s.isSome()?[2,s]:(o=e(),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toResult=function(e){return
                new U("
              - "this.promise.then(function(r){return
                r.toResult(e)}))},t.prototype.thenInternal="
              - "function(e){return new t(this.promise.then(e))},t}();var
                y=t=>btoa(JSON.stringify(t)),f=(...t)=>{};var
                Y=10,Ne=(t,e,r)=>{let
                s=\"api.validation.validateIdValue\";try{if(typeof r!=\"s\\"
              - "tring\"||r.length!=Y){let o=`:${e} is malformed: '${r}'`;return
                f(`${t}:${s}::${o}`),"
              - "d({message:`resources.${e}.validation.invalid`,detail:`The ${e}
                must be a string\\"
              - " of length ${Y}: '${r}'`,errorSource:\"CLIENT\"})}else return
                p(r)}catch(o){let n=typeof o=="
              - "\"string\"?new
                Error(o):o,a={message:\"internalServerError\",detail:n.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:n};return
                console.error(`${s}::error`,a,y(a)),d(a)}};var
                Ae=(t,e,r,s=1)=>e.filter(o=>Object.values(o).some(n=>typeof
                n==\"object\"&&s<r?"
              - "Ae(t,[n],r,s+1).length>0:n.toString().toLowerCase().includes(t\
                .toLowerCase()))),"
              - "B=t=>{let
                e=t.model,r=t.dataTotalCount||0,s=t.dataStart||0,o=t.dataEnd||0\
                ;return`${e}\\"
              - " ${s}-${o}/${r}`},$e=(t,e,r,s={})=>{let
                o=\"util.doFilterResults\";try{if(e.isErr()||"
              - "e.value.data===void 0)return
                e;if(console.debug(`${o}::input`,e.value.data),e.value."
              - "data!==void
                0&&r.queryStringParameters&&r.queryStringParameters.hasOwnPrope\
                rty(\"\\"
              - "filter\")){let
                n=JSON.parse(r.queryStringParameters.filter);if(n.hasOwnPropert\
                y(\"\\"
              - "q\")){let a=n.q,i=3;e.value.data=Ae(a,e.value.data,i)}else
                e.value.data=e.value.data."
              - "filter(a=>Object.entries(n).every(([i,c])=>{let
                u=s.hasOwnProperty(i)?s[i]:i;return Array."
              - "isArray(c)?c.includes(a[u]):a[u]===c}))}return
                console.debug(`${o}::output`,e.value."
              - "data),e}catch(n){let i=`${t}:${o}::unexpected
                exception:${n.message}`;return console."
              - "error(i,n),e}},Pe=(t,e,r)=>{let
                s=\"util.doRangeResults\";try{if(e.isErr()||e.value."
              - "data===void 0)return
                e;if(e.value.dataTotalCount=e.value.data.length,e.value.data!=="
              - "void
                0)if(r.queryStringParameters&&r.queryStringParameters.hasOwnPro\
                perty(\"range\")){"
              - "let[o,n]=JSON.parse(r.queryStringParameters.range);e.value.dat\
                aStart=o,e.value.dataEnd="
              - "Math.min(e.value.data.length,o+n),e.value.data=e.value.data.sl\
                ice(o,o+n+1)}else e."
              - "value.dataStart=0,e.value.dataEnd=e.value.data.length||0;return
                e}catch(o){let a=`${t}\\"
              - ":${s}::unexpected exception:${o.message}`;return
                console.error(a,o),d({statusCode:500,"
              - "body:a})}},Se=(t,e,r)=>{let
                s=\"util.doSortResults\";try{if(e.isErr())return e;if(e."
              - "value.data!==void
                0&&r.queryStringParameters&&r.queryStringParameters.hasOwnPrope\
                rty("
              - "\"sort\")){let[o,n]=JSON.parse(r.queryStringParameters.sort),a=\
                \"ASC\";switch(n){case\"\\"
              - "NONE\":a=\"NONE\";break;case\"DESC\":a=\"DESC\";break;case\"ASC\
                \":default:a=\"ASC\";break}let i=It("
              - "e.value.data,o,a);e.value.data=i}return e}catch(o){let
                a=`${t}:${s}::unexpected \\"
              - "exception:${o.message}`;return
                console.error(a,o),d({statusCode:500,body:a})}},Te=()=>{"
              - "let
                t=\"util.generateItemId\";try{return((Date.now()+Math.floor(Mat\
                h.pow(10,12)+Math."
              - "random()*9*Math.pow(10,12)))*100).toString(36)}catch(e){let
                s=`${t}::unexpected \\"
              - "exception:${e.message}`;throw new
                Error(s)}},It=(t,e,r=\"ASC\")=>{let s=\"util.sort\\"
              - "Results\";try{if(r===\"NONE\")return t;let
                o=r===\"ASC\"?1:-1,n=(a,i)=>{let c=a[e],u=i[e];"
              - "return c===u?0:(c>u?1:-1)*o};return
                t.slice().sort(n)}catch(o){let a=`${s}::unex\\"
              - "pected exception:${o.message}`;throw console.error(a,o),o}};var
                le=(t,e)=>{let
                r=400,s=500,o=!1;e&&(r=e.clientErrorCode||r,s=e.serverErrorCode\
                ||"
              - "s,o=e.includeOriginalError||o);let n=t,a=n.errorSource;delete
                n.errorSource,!o&&"
              - "n.hasOwnProperty(\"originalError\")&&delete n.originalError;let
                i={statusCode:a==\"\\"
              - "CLIENT\"?r:s,body:JSON.stringify(n)};return
                console.log(\"getErrorResponse::output\","
              - "i),i},v=(t,e,r,s=!0)=>{let
                o=\"util.getIdValueFromEvent\";try{if(r.hasOwnProperty("
              - "e)){if(typeof r[e]!=\"string\"||r[e]===void
                0||r[e]===null)throw new Error(`${e} v\\"
              - "alue unusable`);{let n=r[e];if(s){let
                a=Ne(t,e,n);if(a.isErr())return d(le(a.error))}"
              - "return p(n)}}else throw new Error(`item missing
                ${e}`)}catch(n){let i=n.message;"
              - "return
                console.error(`${t}:${o}::${i}`,n),d({statusCode:400,body:i})}}\
                ,ht=t=>{let e=\"\\"
              - "util.getEventWithoutApiInPath\";try{let
                r=\"/api/\",s=\"/\";return{...t,__originalEvent:t,"
              - "rawPath:t.rawPath.replace(r,s),routeKey:t.routeKey.replace(r,s\
                ),requestContext:{"
              - "...t.requestContext,http:{...t.requestContext.http,path:t.requ\
                estContext.http.path."
              - "replace(r,s)},routeKey:t.requestContext.routeKey.replace(r,s)}\
                }}catch(r){let o=`${e}\\"
              - "::unexpected exception:${r.message}`;throw new
                Error(o)}},_e=(t,e,r)=>{let s=\"ut\\"
              - "il.getPathParameter\";try{if(r.pathParameters)if(r.pathParamet\
                ers.hasOwnProperty("
              - "e)){if(r.pathParameters[e]===void 0)throw new
                Error(`event.pathParameters[${e}] \\"
              - "exists but is undefined`);return p(r.pathParameters[e])}else
                throw new Error(`ev\\"
              - "ent.pathParameters does not have property ${e}`);else throw new
                Error(\"event.pat\\"
              - "hParameters is undefined\")}catch(o){let
                a=`${t}:${s}::${o.message}`;return console."
              - "error(a,o),d({statusCode:400,body:a})}},Z=t=>{let
                e=\"util.getRequestBody\";try{if(t."
              - "body){if(typeof t.body!=\"string\")throw new Error(\"event.body
                is not a string\");{"
              - "let r;return
                t.isBase64Encoded?(r=Buffer.from(t.body,\"base64\").toString(\"\
                utf8\"),"
              - "console.debug(`${e}::event.body`,t.body),console.debug(`${e}::\
                body`,r)):r=t.body,"
              - "p(r)}}else throw new Error(\"event.body is
                undefined\")}catch(r){let s=r,o=`${e}::${s."
              - "message}`;return console.error(o,r),d(s.message)}},R=t=>{let
                e=\"util.getStandard\\"
              - "Response\";try{if(t.isErr())return t.error;let
                r=t.value;console.debug(`${e}::inp\\"
              - "ut`,r);let
                o={destinations:\"DestinationId\",directories:\"DirectoryId\",m\
                emberships:\"\\"
              - "MembershipId\",connectUsers:\"Id\",cognitoUsers:\"Username\"}[\
                r.model];console.debug("
              - "`${e}::idKey`,o);let
                n,a,i={};switch(r.action){case\"Create\":n=201,a={...r.data[0],"
              - "id:`${r.data[0][o]}`};break;case\"CreateUser\":n=201,a={...r.d\
                ata[0],id:`${r.data[0][o]}`};"
              - "break;case\"RetrieveBatchGet\":n=200,a=r.data?.map(c=>({...c,i\
                d:`${c[o]}`})),i[\"Co\\"
              - "ntent-Range\"]=B(r);break;case\"RetrieveGet\":n=200,a={...r.da\
                ta[0],id:`${r.data[0][o]}`};"
              - "break;case\"RetrieveQuery\":n=200,a=r.data?.map(c=>({...c,id:`\
                ${c[o]}`})),i[\"Conte\\"
              - "nt-Range\"]=B(r);break;case\"RetrieveScan\":n=200,a=r.data?.ma\
                p(c=>({...c,id:`${c[o]}`})),"
              - "i[\"Content-Range\"]=B(r);break;case\"Update\":n=200,a={...r.d\
                ata[0],id:`${r.data[0][o]}`};"
              - "break;case\"UpdateUser\":n=200,a={...r.data[0],id:`${r.data[0]\
                [o]}`};break;case\"De\\"
              - "lete\":n=204,a=\"\";break;case\"AdminDeleteUser\":n=204,a=\"\"\
                ;break;case\"DescribeUser\":"
              - "n=200,a={...r.data[0],id:`${r.data[0][o]}`};break;case\"AdminG\
                etUser\":n=200,a={...r."
              - "data[0],id:`${r.data[0][o]}`};break;case\"ListUsers\":n=200,a=\
                r.data?.map(c=>({...c,"
              - "id:`${c[o]}`})),i[\"Content-Range\"]=B(r);break;default:throw
                new Error(`${e}::une\\"
              - "xpected
                action::${JSON.stringify(r)}`)}return{statusCode:n,body:JSON.st\
                ringify(a),"
              - "headers:i}}catch(r){let s=r;throw
                console.error(`${e}::unexpected exception:${s."
              - "message}`,r),new Error(s.message)}},w=async(t,e,r,s)=>{try{let
                o=`${t}::handleRe\\"
              - "quest`,n=ht(e),a=null;try{(!process.env.NODE_ENV||process.env.\
                NODE_ENV!==\"test\")&&"
              - "console.debug(`${o}::Received
                event`,JSON.stringify(n),n),n.routeKey in s?a=await s[n."
              - "routeKey](n,r):(console.log(`${o}::Didn't find '${n.routeKey}'
                in route map: ${JSON."
              - "stringify(s)}}`),a={statusCode:500,body:`${o}::${n.routeKey}:R\
                outing map incorre\\"
              - "ct`})}catch(i){let
                c=i;console.error(`${o}::error:${c.message}`,i),a={statusCode:5\
                00,"
              - "body:c.message}}finally{a||(a={statusCode:500,body:`${o}::Route
                dispatch failed`});"
              - "try{let i=JSON.parse(a.body)}catch{let
                i=a;i.body=JSON.stringify(i.body),a=i}finally{"
              - "try{(!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&\
                console.info(`${o}::${n."
              - "routeKey}::result`,a,btoa(JSON.stringify(a)))}catch(i){console\
                .error(`${o}::${n."
              - "routeKey}::result::error`,i,a)}return a}}}catch(o){return
                console.error(`handler\\"
              - "::error:${o.message}`,o),{statusCode:500,body:JSON.stringify({\
                message:\"Something\\"
              - " has gone very wrong.\"})}}},C=(t,e,r)=>{let
                s=\"util.validateRouteTestAware\";try{"
              - "return
                r.routeKey!==e?d({statusCode:500,body:`${t}:${s}::Routing map
                incorrect`}):"
              - "process.env.NODE_ENV&&process.env.NODE_ENV===\"test\"?d({statu\
                sCode:200,body:`${t}\\"
              - ":${s}::jest ${e}`}):p(\"\")}catch(o){let
                a=`${t}:${s}::::unexpected exception:${o."
              - "message}`;throw new Error(a)}};var
                q=require(\"@aws-sdk/client-dynamodb\"),D=require(\"@aws-sdk/li\
                b-dynamodb\"),fe=require(\"@aws-sdk/util-dynamodb\");var
                ye=(t,e)=>{let r=\"util.getEnvOrDefault\";try{let s;return
                process.env.hasOwnProperty("
              - "t)&&process.env[t]?s=process.env[t]:s=e,s}catch(s){let
                n=`${r}::unexpected excep\\"
              - "tion:${s.message}`;throw new Error(n)}},k=t=>{let
                e=\"util.getTableName\";try{switch(t){case\"\\"
              - "destinations\":return
                p(ye(\"DDB_TABLE_DESTINATION\",\"aws-connect-directory_destina\
                \\"
              - "tions\"));case\"directories\":return
                p(ye(\"DDB_TABLE_DIRECTORY\",\"aws-connect-direct\\"
              - "ory_directories\"));case\"memberships\":return
                p(ye(\"DDB_TABLE_MEMBERSHIP\",\"aws-con\\"
              - "nect-directory_memberships\"));default:return d(`getTableName:
                tableName ${t} not\\"
              - " supported`)}}catch(r){let o=`${e}::unexpected
                exception:${r.message}`;throw new Error("
              - "o)}};var
                Me={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.e\
                nv.DDB_AWS_REGION&&"
              - "(Me={region:process.env.DDB_AWS_REGION});var Dt=new
                q.DynamoDBClient(Me),j=D.DynamoDBDocumentClient."
              - "from(Dt,{marshallOptions:{removeUndefinedValues:!0}}),Ve=(t,e,\
                r,s)=>{let o=\"dyna\\"
              - "mo.makeDdbCreateCommand\";try{console.debug(`${e}:${o}::item`,\
                s);let n,a=k(t);if(a."
              - "isErr())return d({statusCode:500,body:a.error});n=a.value;let
                i={TableName:n,Item:s,"
              - "Expected:{[r]:{Exists:!1}}};return
                p({model:t,table:n,action:\"Create\",input:i})}catch(n){"
              - "let i=`${e}:${o}::unexpected exception:${n.message}`;throw new
                Error(i)}},z=(t,e,r,s)=>{"
              - "let
                o=\"dynamo.makeDdbDeleteCommand\";try{console.debug(`${e}:${o}`\
                ,r,s);let n,a=k("
              - "t);if(a.isErr())return
                d({statusCode:500,body:a.error});n=a.value;let i={TableName:n,"
              - "Key:{[r]:s},Expected:{[r]:{Exists:!0,Value:s}}};return
                p({model:t,table:n,action:\"\\"
              - "Delete\",input:i})}catch(n){let i=`${e}:${o}::unexpected
                exception:${n.message}`;"
              - "throw new Error(i)}},ee=t=>{let
                e=\"dynamo.makeDdbRetrieveManyCommand\";try{console."
              - "debug(`${e}::table`,t);let r,s=k(t);return
                s.isErr()?d({statusCode:500,body:s.error}):"
              - "(r=s.value,p({model:t,table:r,action:\"RetrieveScan\",input:{T\
                ableName:r}}))}catch(r){"
              - "let o=`${e}::unexpected exception:${r.message}`;throw new
                Error(o)}},Le=t=>{let e=\"\\"
              - "dynamo.makeDdbRetrieveManyBatchCommand\";try{console.debug(`${\
                e}::table`,t);let r,"
              - "s=k(t);if(s.isErr())return
                d({statusCode:500,body:s.error});r=s.value;let
                o={RequestItems:{"
              - "[r]:{Keys:[]}}};return
                p({model:t,table:r,action:\"RetrieveBatchGet\",input:o})}catch(\
                r){"
              - "let o=`${e}::unexpected exception:${r.message}`;throw new
                Error(o)}};var Ge=(t,e,r,s)=>{let
                o=\"dynamo.makeDdbRetrieveOneCommand\";try{console.debug(`${e}\
                \\"
              - ":${o}::event`,r);let n,a=k(t);if(a.isErr())return
                d({statusCode:500,body:a.error});"
              - "n=a.value;let i=_e(e,s,r),c;if(i.isErr())return i;c=i.value;let
                u={TableName:n,Key:{"
              - "[s]:c}};return
                p({model:t,table:n,action:\"RetrieveGet\",input:u})}catch(n){let
                i=`${e}\\"
              - ":${o}::unexpected exception:${n.message}`;throw new
                Error(i)}};var
                Ue=async(t,e)=>Ot(`${t}:dynamo.runDdbCreateItem`,e),te=async(t,\
                e)=>{if(e.isErr())"
              - "return e;let
                r=e.value,s=\"dynamo.runDdbDeleteItem\";try{console.debug(`${t}\
                :${s}:\\"
              - ":command.input`,r.input);let o=await j.send(new
                D.DeleteCommand(r.input));return console."
              - "debug(`${t}:${s}::result`,o),p({...r,output:o})}catch(o){let
                n=o,a,i;return n.message==="
              - "\"The conditional request failed\"?(a=404,i=\"Not
                found\"):(a=500,i=`${t}:${s}::${n."
              - "message}`,console.error(i,o)),d({statusCode:a,body:i})}},re=as\
                ync(t,e)=>{if(e.isErr())"
              - "return e;let
                r=e.value,s=\"dynamo.runDdbRetrieveMany\";try{console.debug(`${\
                t}:${s}\\"
              - "::command.input`,r.input);let o=await j.send(new
                q.ScanCommand(r.input));return console."
              - "debug(`${t}:${s}::result`,o),o.Items?(console.debug(`${t}:${s}\
                ::result.Items`,o."
              - "Items),p({...r,data:o.Items.map(n=>(0,fe.unmarshall)(n)),outpu\
                t:o})):(console.error("
              - "`${t}:${s}::result.Items is
                undefined`,o),d({statusCode:500,body:\"Unexpected dat\\"
              - "abase response\"}))}catch(o){let
                a=`${t}:${s}::${o.message}`;return console.error("
              - "a,o),d({statusCode:500,body:a})}};var
                Be=async(t,e)=>{if(e.isErr())return e;let
                r=e.value,s=\"dynamo.runDdbRetrieve\\"
              - "ManyBatch\";try{console.debug(`${t}:${s}::command.input`,r.inp\
                ut);let o=await j.send("
              - "new D.BatchGetCommand(r.input));return
                console.debug(`${t}:${s}::result`,o),o.Responses?"
              - "(console.debug(`${t}:${s}::result.Responses`,o.Responses),o.Re\
                sponses.hasOwnProperty("
              - "r.table)?r.data=o.Responses[r.table].map(n=>{try{return(0,fe.u\
                nmarshall)(n)}catch{"
              - "return
                n}}):r.data=[],p({...r,output:o})):(console.error(`${t}:${s}::r\
                esult.Resp\\"
              - "onses is undefined`,o),d({statusCode:500,body:\"Unexpected
                database response\"}))}catch(o){"
              - "let a=`${t}:${s}::${o.message}`;return
                console.error(a,o),d({statusCode:500,body:a})}},"
              - "qe=async(t,e,r)=>{if(e.isErr())return e;let
                s=e.value,o=\"dynamo.runDdbRetrieveOn\\"
              - "e\";try{console.debug(`${t}:${o}::command.input`,s.input);let
                n=await j.send(new D.GetCommand("
              - "s.input));if(console.debug(`${t}:${o}::result`,n),!n.Item)retu\
                rn d({statusCode:404,"
              - "body:\"Not
                found\"});if(console.debug(`${t}:${o}::result.Item`,n.Item),!n.\
                Item.hasOwnProperty("
              - "r)){let i=`${t}:${o}::${r} not found in result.Item`;return
                console.error(i,n),d("
              - "{statusCode:500,body:i})}let
                a={...s,data:[n.Item],output:n};return console.debug("
              - "`${t}:${o}::output`,a),p(a)}catch(n){let
                i=`${t}:${o}::${n.message}`;return console."
              - "error(i,n),d({statusCode:500,body:i})}},Ot=async(t,e)=>{if(e.i\
                sErr())return e;let r=e."
              - "value,s=\"dynamo._ddbPutCommand\";try{console.debug(`${t}:${s}\
                ::command.input`,r.input);"
              - "let o=await j.send(new D.PutCommand(r.input));return
                console.debug(`${t}:${s}::r\\"
              - "esult`,o),p({...r,data:[r.input.Item],output:o})}catch(o){let
                n=o,a,i;return n.message==="
              - "\"The conditional request failed\"?(a=404,i=\"Not
                found\"):(a=500,i=`${t}:${s}::${n."
              - "message}`,console.error(i,o)),d({statusCode:a,body:i})}};var
                xt=async t=>{let
                e=\"directories.get\",r=\"directories\";(!process.env.NODE_ENV|\
                |"
              - "process.env.NODE_ENV!==\"test\")&&console.debug(`${e}::Received
                event`,JSON.stringify("
              - "t),t);let s=C(e,`GET /${r}`,t);if(s.isErr())return s.error;let
                o,n;t.queryStringParameters&&"
              - "t.queryStringParameters.filter&&(o=JSON.parse(t.queryStringPar\
                ameters.filter),console."
              - "debug(`${e}::filter`,o)),o?o.hasOwnProperty(\"q\")?n=\"SCAN_SE\
                ARCH\":o.hasOwnProperty("
              - "\"id\")||o.hasOwnProperty(\"Id\")||o.hasOwnProperty(\"Director\
                yId\")?n=\"BATCH_GET\":n=\"\\"
              - "SCAN_EXACT\":n=\"SCAN_ALL\",console.debug(`${e}::queryFilterMo\
                de`,n);let a;if(n===\"\\"
              - "BATCH_GET\"){let m=Le(r);if(m.isErr())return
                m.error;console.log(`${e}::getBatchC\\"
              - "ommand(1)`,m.value,btoa(JSON.stringify(m.value)));let
                l=\"DirectoryId\";o.hasOwnProperty("
              - "l)||(o.hasOwnProperty(\"Id\")?l=\"Id\":o.hasOwnProperty(\"id\"\
                )&&(l=\"id\"));let g=m.value."
              - "input;g.hasOwnProperty(\"RequestItems\")?g.RequestItems===void
                0?g.RequestItems={}:"
              - "g.RequestItems.hasOwnProperty(m.value.table)||g.RequestItems[m\
                .value.table]:g.RequestItems="
              - "{};for(let b of
                o[l])g.RequestItems[m.value.table].Keys.push({DirectoryId:b});m\
                ."
              - "value.input=g,console.log(`${e}::getBatchCommand(2)`,m.value,b\
                toa(JSON.stringify("
              - "m.value))),a=await Be(e,m)}else{let m=ee(r),l=await
                re(e,m);n===\"SCAN_ALL\"?a=l:a="
              - "$e(e,l,t)}let i=Se(e,a,t),c=Pe(e,i,t),u=$(c);return R(u)};var
                je={\"GET /directories\":xt};var vt=async t=>{let
                e=\"directories.getId\",r=\"directories\",s=\"DirectoryId\";(!p\
                rocess."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${e}::Received even\\"
              - "t`,JSON.stringify(t),t);let o=C(e,`GET
                /${r}/{${s}}`,t);if(o.isErr())return o.error;"
              - "let n=v(e,s,t.pathParameters);if(n.isErr())return n.error;let
                a=Ge(r,e,t,s),i=await qe("
              - "e,a,s),c=$(i);return R(c)};var Fe={\"GET
                /directories/{DirectoryId}\":vt};var
                Qe=require(\"@aws-sdk/util-dynamodb\");var He=async t=>{let
                e=\"util.deleteMembershipsForItem\",r,s;if(t.hasOwnProperty(\"\
                \\"
              - "DestinationId\")&&t.DestinationId!==void
                0&&(r=\"DestinationId\",s=t.DestinationId),"
              - "t.hasOwnProperty(\"DirectoryId\")&&t.DirectoryId!==void
                0&&(r=\"DirectoryId\",s=t.DirectoryId),"
              - "r===void 0)throw new Error(`${e}::lookupKey is undefined, which
                should be imposs\\"
              - "ible`);if(s===void 0)throw new Error(`${e}::lookupValue is
                undefined, which shou\\"
              - "ld be impossible`);let
                o=ee(\"memberships\");if(o.isErr())return o;let n={...o.value."
              - "input,FilterExpression:\"#Id =
                :Id\",ExpressionAttributeNames:{\"#Id\":r},ExpressionAttributeV\
                alues:{"
              - "\":Id\":(0,Qe.marshall)(s)}};console.debug(`${e}::getMembershi\
                psCommand:input`,n,JSON."
              - "stringify(n)),o.value.input=n;let a=await
                re(e,o);if(a.isErr())return a;let i=a."
              - "value;console.log(`${e}::memberships`,i);let
                c=[];if(i.hasOwnProperty(\"data\")){let u=z("
              - "\"memberships\",e,r,\"\");if(u.isErr())return u;let
                m=u.value.input;(!m.hasOwnProperty("
              - "\"Key\")||m.Key===void
                0)&&(m.Key={}),m.hasOwnProperty(\"Expected\")&&delete
                m.Expected,"
              - "console.log(`${e}::input before
                loop`,JSON.stringify(m));for(let l of i.data){m."
              - "Key.DestinationId=l.DestinationId,m.Key.DirectoryId=l.Director\
                yId,u.value.input="
              - "m,console.log(`${e}::Cascading delete of
                membership`,m,JSON.stringify(m));let g=await te("
              - "e,u);g.isErr()&&c.push(g.error)}}return
                c.length===0?p([]):d({statusCode:207,body:JSON."
              - "stringify({message:\"Requested deletion succeeded, but
                Memberships delete cascade\\"
              - " returned errors\",errors:c})})};var Nt=async t=>{let
                e=\"directories.deleteId\",r=\"directories\",s=\"DirectoryId\";\
                (!process."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${e}::Received even\\"
              - "t`,JSON.stringify(t),t);let o=C(e,`DELETE
                /${r}/{${s}}`,t);if(o.isErr())return o."
              - "error;let n=v(e,s,t.pathParameters);if(n.isErr())return
                n.error;let a=n.value,i=z("
              - "r,e,s,a),c=await te(e,i),u=await He({DirectoryId:a});return
                u.isErr()?u.error:R("
              - "c)};var We={\"DELETE /directories/{DirectoryId}\":Nt};var
                Ze=require(\"@aws-sdk/lib-dynamodb\");var
                se=require(\"@aws-sdk/client-lambda\"),be=require(\"@aws-sdk/li\
                b-dynamodb\");var At=require(\"@aws-sdk/lib-dynamodb\");var
                Ke=require(\"@aws-sdk/client-dynamodb\"),Je=require(\"@aws-sdk/\
                lib-dynamodb\");var
                Ye={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.e\
                nv.DDB_AWS_REGION&&"
              - "(Ye.region=process.env.DDB_AWS_REGION);var
                P=Je.DynamoDBDocumentClient.from(new Ke.DynamoDBClient("
              - "Ye),{marshallOptions:{removeUndefinedValues:!0}}),oe=(t,e=\"SET
                \")=>{let r=\"api.a\\"
              - "ws-dynamodb.util.getUpdateExpression\",s=[],o={};for(let[a,i]of
                Object.entries(t))"
              - "if(f(`${r}`,a,i),a==\"Metadata\")for(let[c,u]of
                Object.entries(i))f(`${r}::${a}.`,"
              - "c,u),s.push(`${a}.${c} =
                :${a}${c}`),o[`:${a}${c}`]=u;else{let{expression:c,value:u}=i;"
              - "c&&u?(s.push(`${a} = :${c}`),o[`:${a}`]=u):(s.push(`${a} =
                :${a}`),o[`:${a}`]=i)}"
              - "let n={UpdateExpression:`${e}${s.join(\",
                \")}`,ExpressionAttributeValues:o};return f("
              - "\"api.aws-dynamodb.util.getUpdateExpression::output\",n,y(n)),\
                n},S=(t,e)=>{let r=\"\\"
              - "api.aws-dynamodb.util.vdxMarshallWithTable\";f(`${r}::input`,{\
                dataType:t,props:e},"
              - "y({dataType:t,props:e}));let
                s={},{pkValue:o,skValue:n}=e,a=Xe();if(a.isErr())return f("
              - "`${r}::error`,a.error.message),a;let
                i=a.value;if(t===\"destinations\"&&o){let c=\"\";"
              - "s.pkName=\"DestinationId\",s.pkValue=`${c}${o}`,s.tableName=i.\
                Destinations}else if(t==="
              - "\"directories\"&&o){let
                c=\"\";s.pkName=\"DirectoryId\",s.pkValue=`${c}${o}`,s.tableNam\
                e="
              - "i.Directories}else if(t===\"memberships\"&&(o||n)){let
                c=\"\",u=\"\";o&&(s.pkName=\"Des\\"
              - "tinationId\",s.pkValue=`${c}${o}`),n&&(s.skIndex=\"DirectoryId\
                Index\",s.skName=\"Dir\\"
              - "ectoryId\",s.skValue=`${u}${n}`),s.tableName=i.Memberships}els\
                e{let c={message:\"i\\"
              - "nternalServerError\",detail:`Invalid dataType: ${t} or both key
                values missing: ${o}\\"
              - ", ${n}`,errorSource:\"SERVER\"};return
                console.error(`${r}::error`,c),d(c)}return f("
              - "`${r}::output`,s,y(s)),p(s)},ne=t=>{if(!t)return p(t);let
                e=Ee([t]);return e.isErr()?"
              - "e:!e.value||e.value.length===0?p(void
                0):p(e.value[0])},Ee=t=>{let e=\"api.aws-dy\\"
              - "namodb.util.vdxUnmarshallMany\";console.log(`${e}::data`,t,y(t\
                ));try{if(!t||t.length==="
              - "0)return p(t);let
                r=t.flatMap(s=>{if(!s)return[];let{pk:o,sk:n,...a}=s,i={};return
                o?"
              - "(o.startsWith(\"DIR#\")?i.DirectoryId=o.substring(4):o.startsW\
                ith(\"DEST#\")&&(i.DestinationId="
              - "o.substring(5),n?.startsWith(\"DIR#\")&&(i.DirectoryId=n.subst\
                ring(4))),Object.keys("
              - "i).length>0?i={...i,...a}:console.error(\"vdxUnMarshallMany:er\
                ror::couldn't compr\\"
              - "ehend item, skipping I guess??\",s,y(s))):i=s,[i]});return
                console.log(`${e}::out\\"
              - "put`,r,y(r)),p(r)}catch(r){let s=typeof r==\"string\"?new
                Error(r):r,o={message:\"i\\"
              - "nternalServerError\",detail:s.message,errorSource:\"SERVER\",o\
                riginalError:s};return console."
              - "error(`${e}::error`,o,y(o)),d(o)}},Xe=()=>{function
                t(r){if(process.env[r]&&(process."
              - "env[r]||\"\").length>0)return p(process.env[r]);{let
                s={message:\"internalServerErr\\"
              - "or\",detail:`${r} not set`,errorSource:\"SERVER\"};return
                console.error(s),d(s)}}let e={"
              - "Destinations:\"\",Directories:\"\",Memberships:\"\"};if(proces\
                s.env.NODE_ENV===\"test\")"
              - "console.debug(\"NODE_ENV=test, setting TABLES to test
                values\"),e.Destinations=\"aw\\"
              - "s-connect-directory_destinations\",e.Directories=\"aws-connect\
                -directory_directori\\"
              - "es\",e.Memberships=\"aws-connect-directory_memberships\";else{\
                let r=t(\"DDB_TABLE_DE\\"
              - "STINATION\");if(r.isErr())return r;e.Destinations=r.value;let
                s=t(\"DDB_TABLE_DIRE\\"
              - "CTORY\");if(s.isErr())return s;e.Directories=s.value;let
                o=t(\"DDB_TABLE_MEMBERSHI\\"
              - "P\");if(o.isErr())return o;e.Memberships=o.value}return
                p(e)};var _=require(\"@aws-sdk/lib-dynamodb\");var
                ge=async(t,e={})=>$t(\"directories\",t,e);var
                $t=async(t,e,r={})=>{let
                s=\"api.aws-dynamodb.memberships._getMembershipRecor\\"
              - "dsByDestDirId\";console.log(`${s}::input`,{dataType:t,id:e,pro\
                ps:r});let o=r.errWhenNone||"
              - "!1;try{let n={};t==\"directories\"?n.skValue=e:n.pkValue=e;let
                a=S(\"memberships\",n);"
              - "if(a.isErr())return
                a;let{pkName:i,pkValue:c,skIndex:u,skName:m,skValue:l,tableName\
                :g}=a."
              - "value,b={};if(i&&c&&(b.KeyConditionExpression=`${i} =
                :pk`,b.ExpressionAttributeValues="
              - "{\":pk\":c}),m&&l&&(b.KeyConditionExpression=`${m} =
                :sk`,b.ExpressionAttributeValues="
              - "{\":sk\":l},u&&(b.IndexName=u)),Object.keys(b).length===0)retu\
                rn d({message:\"inter\\"
              - "nalServerError\",errorSource:\"SERVER\"});b.TableName=g,f(`${s\
                }::QueryCommandInput`,"
              - "b);let I=await P.send(new
                _.QueryCommand(b));f(`${s}::QueryCommandResponse`,I,y("
              - "I));let{Items:Q}=I;if(!Q&&o){let M=\"No items found\";throw
                f(`${s}:`,M,y(I)),new Error("
              - "`${s}: ${M}`)}let H=Ee(Q);return
                console.debug(`${s}::output`,H),H}catch(n){let a=typeof n=="
              - "\"string\"?new
                Error(n):n,i={message:\"internalServerError\",detail:a.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:a};return
                console.error(`${s}::error`,i,y(i)),d(i)}};var ae=t=>{let
                e=\"api.aws-dynamodb.directories.calculateDirectoryStatus\",r=\
                \"UNKN\\"
              - "OWN\";try{let s=t.Metadata;if(s){let o=s.LastBuildAttempt?new
                Date(s.LastBuildAttempt)."
              - "getTime():0,n=s.LastBuildFailure?new
                Date(s.LastBuildFailure).getTime():0,a=s.LastBuildSuccess?"
              - "new
                Date(s.LastBuildSuccess).getTime():0,i=s.LastBuildableEvent?new
                Date(s.LastBuildableEvent)."
              - "getTime():0,c=s.IsBroken??!1,u=s.IsBuilt??!1,m=s.IsLicenseErro\
                r??!1,l=s.IsRollingBack??"
              - "!1,g=a>n?a:n;m?r=\"LICENSE_ERROR\":l?u?r=\"STOPPING_UPDATE\":r=\
                \"STOPPING_BUILD\":c?r="
              - "\"NEEDS_REPAIR\":i>o?r=\"ASSESSING\":o>g?u?r=\"UPDATING\":r=\"\
                BUILDING\":a>n?r=\"IN_SYNC\":"
              - "o==0?r=\"UNKNOWN\":u?r=\"OUT_OF_SYNC\":r=\"NOT_BUILT\"}}catch(\
                s){let o=s,n=`${e}::unex\\"
              - "pected
                exception:${o.message}`;console.error(n,o,y(o))}finally{return
                r}};var ie=async(t,e={})=>{let
                r=\"api.aws-dynamodb.directories.rebuildDirectory\";console."
              - "log(`${r}::input`,{directoryId:t,props:e});let{forceRebuild:s=\
                !1}=e;try{let o={FunctionName:process."
              - "env.UPDATE_DIRECTORY_CLOUDFORMATION_LAMBDA_ARN,InvocationType:\
                \"Event\",Payload:JSON."
              - "stringify({DirectoryId:t,ForceRebuild:s})};f(`${r}::InvokeComm\
                andInput`,o);let n=await new se.LambdaClient()."
              - "send(new se.InvokeCommand(o));return
                f(`${r}::InvokeCommandOutput`,n),p(void 0)}catch(o){"
              - "let n=o;console.error(`${r}::error`,n,y(n));let
                a={message:\"internalServerError\","
              - "detail:n.message,errorSource:\"SERVER\",originalError:n};return
                d(a)}},Ce=async(t,e={})=>{"
              - "let
                r=\"api.aws-dynamodb.directories.updateDirectory\";console.log(\
                `${r}::input`,{"
              - "directoryItem:t,props:e});let{expressionOptions:s={},updateLas\
                tModified:o=!0}=e,"
              - "n=Mt(t);if(n.isErr())return
                n;let{DirectoryId:a,Description:i}=t;try{if(i){let W=await ge("
              - "a);if(W.isErr())return W;if(W.value){let
                ot=W.value.map(ce=>ce.DestinationId).map("
              - "async ce=>{try{let
                N=S(\"memberships\",{pkValue:ce,skValue:a});if(N.isErr())return
                N;"
              - "let{pkName:L,pkValue:nt,skName:st,skValue:at,tableName:it}=N.v\
                alue,{UpdateExpression:ut,"
              - "ExpressionAttributeValues:ct}=oe({DirectoryName:i,LastModified\
                DateTime:new Date()."
              - "toISOString()}),Oe={TableName:it,Key:{[L]:nt,[st]:at},UpdateEx\
                pression:ut,ExpressionAttributeValues:ct,"
              - "ReturnValues:\"ALL_NEW\"};f(`${r}::updateMembershipCommand`,Oe\
                );let xe=await P.send("
              - "new be.UpdateCommand(Oe));return
                f(`${r}::updateMembershipResult`,xe),Promise.resolve("
              - "xe)}catch(N){let L=typeof N==\"string\"?new Error(N):N;return
                console.error(`${r}:\\"
              - ":updateMembershipError`,L,y(L)),Promise.resolve(L)}}),Qt=await
                Promise.allSettled("
              - "ot)}}let c=S(\"directories\",{pkValue:a});if(c.isErr())return
                c;let{pkName:u,pkValue:m,"
              - "tableName:l}=c.value,{DirectoryId:g,...b}=t,I=b;I.Metadata||(I\
                .Metadata={}),o&&(I."
              - "Metadata.LastModifiedDateTime=new
                Date().toISOString()),I.Metadata.DirectoryStatus&&"
              - "delete
                I.Metadata.DirectoryStatus;let{UpdateExpression:Q,ExpressionAtt\
                ributeValues:H}=oe("
              - "{...I}),M={ReturnValues:\"ALL_NEW\",...s,TableName:l,Key:{[u]:\
                m},UpdateExpression:Q,"
              - "ExpressionAttributeValues:H};f(`${r}::updateDirectoryCommand`,\
                M);let Re=await P."
              - "send(new
                be.UpdateCommand(M));f(`${r}::updateDirectoryResult`,Re);let{At\
                tributes:ue}=Re,"
              - "De=ue&&_t(ue);console.debug(`${r}::outputting`,De);let
                V=ne(De);return console.log("
              - "`${r}::output`,V),V.isErr()?V:V.value?p(V.value):d({message:\"\
                notFound\",detail:`N\\"
              - "o Directory found with DirectoryId:
                ${a}`,errorSource:\"CLIENT\"})}catch(c){let u=typeof c=="
              - "\"string\"?new
                Error(c):c,m={message:\"internalServerError\",detail:u.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:u};return
                console.error(`${r}::error`,m,y(m)),d(m)}},_t=t=>{"
              - "let e=t;return
                e&&(e.Metadata||(e.Metadata={}),e.Metadata.DirectoryStatus=ae(e\
                )),"
              - "e};var Mt=t=>{let
                e=\"api.aws-dynamodb.directories._checkRequiredDirectoryAttribu\
                tes\","
              - "{DirectoryId:r}=t,s;return r?s=p(void
                0):s=d({message:\"resource.directories.vali\\"
              - "dation.missingDirectoryId\",errorSource:\"CLIENT\"}),s.isErr()\
                &&console.error(`${e}\\"
              - "::error`,s.error.message,t,y(t)),s};var
                Ie=\"directories\",he=\"DirectoryId\",Gt=async t=>{let
                e=\"directories.putId\";(!process."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.log(`$\
                {e}::Received event`,"
              - "JSON.stringify(t),t);let r=C(e,`PUT
                /${Ie}/{${he}}`,t);if(r.isErr())return r.error;"
              - "let s=v(e,he,t.pathParameters);if(s.isErr())return s.error;let
                o=s.value,n=F(Z(t));"
              - "if(n.isErr())return n.error;if(n.value.DirectoryId!=o){let
                u=\"resources.director\\"
              - "ies.validation.endpointPayloadMismatch\";return
                console.error(`${e}::${u}`),{statusCode:400,"
              - "body:u}}let a={...n.value},i=await Ce(a);if(i.isErr())return
                le(i.error);f(`${e}\\"
              - "::output`,i.value,y(i.value));let
                c={model:Ie,table:\"Directories\",input:{TableName:\"\\"
              - "lol\",Key:{pk:\"a\"}},action:\"Update\",data:[i.value]};return
                R(p(c))};var ze={[`PUT /${Ie}/{${he}}`]:Gt};var Ut=async t=>{let
                e=\"directories.post\",r=\"directories\",s=\"DirectoryId\";(!pr\
                ocess."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${e}::Received even\\"
              - "t`,JSON.stringify(t),t);let o=C(e,`POST
                /${r}`,t);if(o.isErr())return o.error;let n=F("
              - "Z(t));if(n.isErr())return n.error;let
                a=n.value;a[s]=Te(),a.Metadata={LastModifiedDateTime:new
                Date()."
              - "toISOString()};let i=Ve(r,e,s,a),c=await Ue(e,i),u=$(c);return
                R(u)};var et={\"POST /directories\":Ut};var Bt=async(t,e)=>{let
                r=\"directories.rpcPostId\",s=\"directories\",o=\"DirectoryId\"\
                ;"
              - "(!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&cons\
                ole.debug(`${r}::Rec\\"
              - "eived event`,JSON.stringify(t),t);let n=C(r,`POST
                /${s}/{${o}}/{action}`,t);if(n."
              - "isErr())return n.error;let
                a=v(r,o,t.pathParameters);if(a.isErr())return a.error;"
              - "let
                i=a.value,c;switch(t.pathParameters?.action){case\"rebuild\":c=\
                await ie(i);break;case\"\\"
              - "rebuildForce\":c=await
                ie(i,{forceRebuild:!0});break;default:console.error(`${r}:\\"
              - ":Invalid action`,t.pathParameters?.action)}let u;return
                c?c.isErr()?u={statusCode:500,"
              - "body:c.error.message}:u={statusCode:204,body:\"\"}:u={statusCo\
                de:400,body:`Invalid\\"
              - " action: ${t.pathParameters?.action}`},u};var tt={\"POST
                /directories/{DirectoryId}/{action}\":Bt};var
                qt=async(t,e)=>await
                w(\"directories\",t,e,{...rt.routes}),$=t=>{let e=t;if(e."
              - "isErr())return e;let r=e.value;return
                r&&r.data&&(r.data=r.data.map(s=>(s.Metadata||"
              - "(s.Metadata={}),s.Metadata.DirectoryStatus=ae(s),s))),p(r)},F=\
                t=>{if(t.isErr())return t;"
              - "let e=\"directories.parseDestination\";try{let
                r=JSON.parse(t.value);if(!r.GuiName||"
              - "typeof r.GuiName!=\"string\"||r.GuiName.length==0)throw new
                Error(\"GuiName is requ\\"
              - "ired\");if(!r.VuiName||typeof
                r.VuiName!=\"string\"||r.VuiName.length==0)throw new Error("
              - "\"VuiName is required\");if(!r.Description||typeof
                r.Description!=\"string\")throw new Error("
              - "\"Description is required\");let
                s=\"\";if(r.DirectoryId){if(typeof r.DirectoryId!=\"\\"
              - "string\")throw new Error(\"DirectoryId must be a
                string\");if(r.DirectoryId.length!="
              - "Y)throw new Error(\"DirectoryId must be ${ITEM_ID_SIZE}
                characters\");s=r.DirectoryId}"
              - "let
                o={DirectoryId:s,GuiName:r.GuiName,VuiName:r.VuiName,Descriptio\
                n:r.Description};"
              - "return p(o)}catch(r){let o=`${e}::${r.message}`;return
                console.error(o,r),d({statusCode:400,"
              - "body:o})}},rt={routes:{...je,...ze,...Fe,...et,...We,...tt}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          DDB_TABLE_DESTINATION:
            Ref: "DdbDestinations37B2F70F"
          DDB_TABLE_DIRECTORY:
            Ref: "DdbDirectories26458382"
          DDB_TABLE_MEMBERSHIP:
            Ref: "DdbMemberships1A816D0C"
          UPDATE_DIRECTORY_CLOUDFORMATION_LAMBDA_ARN:
            Fn::GetAtt:
              - "DirMgmtCfnPublishLambdaF639239A"
              - "Arn"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ApiDirectoriesLambdaServiceRoleC3789FAF"
          - "Arn"
      Runtime: "nodejs20.x"
      Timeout: 30
    DependsOn:
      - "ApiDirectoriesLambdaServiceRoleDefaultPolicyDDF45229"
  ApiCheckLicenseLambdaServiceRoleB914B2D9:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ApiCheckLicenseLambda95B67792:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var A=Object.defineProperty;var
                M=Object.getOwnPropertyDescriptor;var
                F=Object.getOwnPropertyNames;var
                q=Object.prototype.hasOwnProperty;var H=(t,e)=>{for(var n in
                e)A(t,n,{get:e[n],enumerable:!0})},B=(t,e,n,s)=>{if(e&&"
              - "typeof e==\"object\"||typeof e==\"function\")for(let o of
                F(e))!q.call(t,o)&&o!==n&&"
              - "A(t,o,{get:()=>e[o],enumerable:!(s=M(e,o))||s.enumerable});ret\
                urn t};var Y=t=>B(A({},\"__esModule\",{value:!0}),t);var
                ot={};H(ot,{checkLicense:()=>U,handler:()=>nt});module.exports=\
                Y(ot);function m(t){var e=String(t);if(e===\"[object
                Object]\")try{e=JSON.stringify(t)}catch{}"
              - "return e}var J=function(){function t(){}return
                t.prototype.isSome=function(){return!1},t."
              - "prototype.isNone=function(){return!0},t.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){"
              - "return e},t.prototype.expect=function(e){throw new
                Error(\"\".concat(e))},t.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},t.prototype.map=function(e){"
              - "return this},t.prototype.mapOr=function(e,n){return
                e},t.prototype.mapOrElse=function(e,n){"
              - "return e()},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){"
              - "return e()},t.prototype.andThen=function(e){return
                this},t.prototype.toResult=function(e){"
              - "return
                f(e)},t.prototype.toString=function(){return\"None\"},t.prototy\
                pe.toAsyncOption="
              - "function(){return new x(C)},t}(),C=new J;Object.freeze(C);var
                j=function(){function t(e){"
              - "if(!(this instanceof t))return new t(e);this.value=e}return
                t.prototype.isSome=function(){"
              - "return!0},t.prototype.isNone=function(){return!1},t.prototype[\
                Symbol.iterator]=function(){"
              - "var e=Object(this.value);return Symbol.iterator in
                e?e[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){return this.value},"
              - "t.prototype.expect=function(e){return
                this.value},t.prototype.unwrap=function(){"
              - "return this.value},t.prototype.map=function(e){return
                g(e(this.value))},t.prototype."
              - "mapOr=function(e,n){return
                n(this.value)},t.prototype.mapOrElse=function(e,n){return n("
              - "this.value)},t.prototype.or=function(e){return
                this},t.prototype.orElse=function(e){"
              - "return this},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.toResult="
              - "function(e){return
                E(this.value)},t.prototype.toAsyncOption=function(){return new
                x("
              - "this)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype.toString="
              - "function(){return\"Some(\".concat(m(this.value),\")\")},t.EMPT\
                Y=new t(void 0),t}(),g=j,"
              - "_;(function(t){function e(){for(var
                o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];"
              - "for(var a=[],u=0,p=o;u<p.length;u++){var
                i=p[u];if(i.isSome())a.push(i.value);else"
              - "return i}return g(a)}t.all=e;function n(){for(var
                o=[],r=0;r<arguments.length;r++)"
              - "o[r]=arguments[r];for(var a=0,u=o;a<u.length;a++){var
                p=u[a];if(p.isSome())return p}"
              - "return C}t.any=n;function s(o){return o instanceof
                g||o===C}t.isOption=s})(_||(_="
              - "{}));var K=function(){function t(e){if(!(this instanceof
                t))return new t(e);this.error="
              - "e;var n=new Error().stack.split(`"
              - "`).slice(2);n&&n.length>0&&n[0].includes(\"ErrImpl\")&&n.shift\
                (),this._stack=n.join("
              - "`"
              - "`)}return
                t.prototype.isOk=function(){return!1},t.prototype.isErr=functio\
                n(){return!0},"
              - "t.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "t.prototype.else=function(e){return
                e},t.prototype.unwrapOr=function(e){return e},"
              - "t.prototype.expect=function(e){throw new Error(\"\".concat(e,\"
                - Error: \").concat("
              - "m(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.expect\
                Err=function(e){return this."
              - "error},t.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "m(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.unwrap\
                Err=function(){return this."
              - "error},t.prototype.map=function(e){return
                this},t.prototype.andThen=function(e){"
              - "return this},t.prototype.mapErr=function(e){return new
                f(e(this.error))},t.prototype."
              - "mapOr=function(e,n){return
                e},t.prototype.mapOrElse=function(e,n){return e(this."
              - "error)},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){return e("
              - "this.error)},t.prototype.toOption=function(){return
                C},t.prototype.toString=function(){"
              - "return\"Err(\".concat(m(this.error),\")\")},Object.definePrope\
                rty(t.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),t.prot\
                otype.toAsyncResult="
              - "function(){return new v(this)},t.EMPTY=new t(void 0),t}();var
                f=K,Q=function(){function t(e){if(!(this instanceof t))return
                new t(e);this."
              - "value=e}return
                t.prototype.isOk=function(){return!0},t.prototype.isErr=functio\
                n(){"
              - "return!1},t.prototype[Symbol.iterator]=function(){var
                e=Object(this.value);return Symbol."
              - "iterator in
                e?e[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "t.prototype.else=function(e){return
                this.value},t.prototype.unwrapOr=function(e){"
              - "return this.value},t.prototype.expect=function(e){return
                this.value},t.prototype."
              - "expectErr=function(e){throw new
                Error(e)},t.prototype.unwrap=function(){return this."
              - "value},t.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "m(this.value)),{cause:this.value})},t.prototype.map=function(e\
                ){return new E(e(this."
              - "value))},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.mapErr="
              - "function(e){return this},t.prototype.mapOr=function(e,n){return
                n(this.value)},t."
              - "prototype.mapOrElse=function(e,n){return
                n(this.value)},t.prototype.or=function(e){"
              - "return this},t.prototype.orElse=function(e){return
                this},t.prototype.toOption=function(){"
              - "return g(this.value)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype."
              - "toString=function(){return\"Ok(\".concat(m(this.value),\")\")}\
                ,t.prototype.toAsyncResult="
              - "function(){return new v(this)},t.EMPTY=new t(void 0),t}();var
                E=Q,P;(function(t){function e(){for(var
                a=[],u=0;u<arguments.length;u++)a[u]="
              - "arguments[u];for(var p=[],i=0,c=a;i<c.length;i++){var
                l=c[i];if(l.isOk())p.push("
              - "l.value);else return l}return new E(p)}t.all=e;function
                n(){for(var a=[],u=0;u<arguments."
              - "length;u++)a[u]=arguments[u];for(var
                p=[],i=0,c=a;i<c.length;i++){var l=c[i];if(l."
              - "isOk())return l;p.push(l.error)}return new
                f(p)}t.any=n;function s(a){try{return new E("
              - "a())}catch(u){return new f(u)}}t.wrap=s;function
                o(a){try{return a().then(function(u){"
              - "return new E(u)}).catch(function(u){return new
                f(u)})}catch(u){return Promise.resolve("
              - "new f(u))}}t.wrapAsync=o;function r(a){return a instanceof f||a
                instanceof E}t.isResult="
              - "r})(P||(P={}));var w=function(t,e,n,s){function o(r){return r
                instanceof n?r:new n(function(a){"
              - "a(r)})}return new(n||(n=Promise))(function(r,a){function
                u(c){try{i(s.next(c))}catch(l){"
              - "a(l)}}function p(c){try{i(s.throw(c))}catch(l){a(l)}}function
                i(c){c.done?r(c.value):"
              - "o(c.value).then(u,p)}i((s=s.apply(t,e||[])).next())})},R=funct\
                ion(t,e){var n={label:0,"
              - "sent:function(){if(r[0]&1)throw r[1];return
                r[1]},trys:[],ops:[]},s,o,r,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(c){return p([i,c])}}function p(i){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(n="
              - "0)),n;)try{if(s=1,o&&(r=i[0]&2?o.return:i[0]?o.throw||((r=o.re\
                turn)&&r.call(o),0):"
              - "o.next)&&!(r=r.call(o,i[1])).done)return
                r;switch(o=0,r&&(i=[i[0]&2,r.value]),i[0]){case 0:case 1:"
              - "r=i;break;case 4:return n.label++,{value:i[1],done:!1};case
                5:n.label++,o=i[1],i="
              - "[0];continue;case
                7:i=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r="
              - "r.length>0&&r[r.length-1])&&(i[0]===6||i[0]===2)){n=0;continue\
                }if(i[0]===3&&(!r||"
              - "i[1]>r[0]&&i[1]<r[3])){n.label=i[1];break}if(i[0]===6&&n.label\
                <r[1]){n.label=r[1],"
              - "r=i;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(i);break\
                }r[2]&&n.ops.pop(),"
              - "n.trys.pop();continue}i=e.call(t,n)}catch(c){i=[6,c],o=0}final\
                ly{s=r=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},v=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var n=this;return this."
              - "thenInternal(function(s){return w(n,void 0,void
                0,function(){var o;return R(this,"
              - "function(r){return s.isErr()?[2,s]:(o=e(s.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(e){var n=this;return
                this.thenInternal(function(s){return w("
              - "n,void 0,void 0,function(){var o;return
                R(this,function(r){switch(r.label){case 0:"
              - "return s.isErr()?[2,s]:(o=E,[4,e(s.value)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.mapErr=function(e){var n=this;return
                this.thenInternal(function(s){return w("
              - "n,void 0,void 0,function(){var o;return
                R(this,function(r){switch(r.label){case 0:"
              - "return s.isOk()?[2,s]:(o=f,[4,e(s.error)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var n=this;return
                this.thenInternal(function(s){return w(n,void 0,"
              - "void 0,function(){var o;return R(this,function(r){return
                s.isOk()?[2,s]:(o=e(s.error),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toOption=function(){return
                new x("
              - "this.promise.then(function(e){return
                e.toOption()}))},t.prototype.thenInternal=function(e){"
              - "return new t(this.promise.then(e))},t}();var
                N=function(t,e,n,s){function o(r){return r instanceof n?r:new
                n(function(a){"
              - "a(r)})}return new(n||(n=Promise))(function(r,a){function
                u(c){try{i(s.next(c))}catch(l){"
              - "a(l)}}function p(c){try{i(s.throw(c))}catch(l){a(l)}}function
                i(c){c.done?r(c.value):"
              - "o(c.value).then(u,p)}i((s=s.apply(t,e||[])).next())})},S=funct\
                ion(t,e){var n={label:0,"
              - "sent:function(){if(r[0]&1)throw r[1];return
                r[1]},trys:[],ops:[]},s,o,r,a;return a="
              - "{next:u(0),throw:u(1),return:u(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function u(i){return
                function(c){return p([i,c])}}function p(i){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,i[0]&&(n="
              - "0)),n;)try{if(s=1,o&&(r=i[0]&2?o.return:i[0]?o.throw||((r=o.re\
                turn)&&r.call(o),0):"
              - "o.next)&&!(r=r.call(o,i[1])).done)return
                r;switch(o=0,r&&(i=[i[0]&2,r.value]),i[0]){case 0:case 1:"
              - "r=i;break;case 4:return n.label++,{value:i[1],done:!1};case
                5:n.label++,o=i[1],i="
              - "[0];continue;case
                7:i=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r="
              - "r.length>0&&r[r.length-1])&&(i[0]===6||i[0]===2)){n=0;continue\
                }if(i[0]===3&&(!r||"
              - "i[1]>r[0]&&i[1]<r[3])){n.label=i[1];break}if(i[0]===6&&n.label\
                <r[1]){n.label=r[1],"
              - "r=i;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(i);break\
                }r[2]&&n.ops.pop(),"
              - "n.trys.pop();continue}i=e.call(t,n)}catch(c){i=[6,c],o=0}final\
                ly{s=r=0}if(i[0]&5)"
              - "throw i[1];return{value:i[0]?i[1]:void
                0,done:!0}}},x=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var n=this;return this."
              - "thenInternal(function(s){return N(n,void 0,void
                0,function(){var o;return S(this,"
              - "function(r){return s.isNone()?[2,s]:(o=e(s.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(e){var n=this;return
                this.thenInternal(function(s){return N("
              - "n,void 0,void 0,function(){var o;return
                S(this,function(r){switch(r.label){case 0:"
              - "return s.isNone()?[2,s]:(o=g,[4,e(s.value)]);case
                1:return[2,o.apply(void 0,[r.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var n=this;return
                this.thenInternal(function(s){return N(n,void 0,"
              - "void 0,function(){var o;return S(this,function(r){return
                s.isSome()?[2,s]:(o=e(),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toResult=function(e){return
                new v("
              - "this.promise.then(function(n){return
                n.toResult(e)}))},t.prototype.thenInternal="
              - "function(e){return new t(this.promise.then(e))},t}();var
                b=t=>t.invokedFunctionArn.split(\":\")[4],h=t=>btoa(JSON.string\
                ify(t)),d=(...t)=>{};var X=t=>{let
                e=\"util.getEventWithoutApiInPath\";try{let
                n=\"/api/\",s=\"/\";return{...t,"
              - "__originalEvent:t,rawPath:t.rawPath.replace(n,s),routeKey:t.ro\
                uteKey.replace(n,s),"
              - "requestContext:{...t.requestContext,http:{...t.requestContext.\
                http,path:t.requestContext."
              - "http.path.replace(n,s)},routeKey:t.requestContext.routeKey.rep\
                lace(n,s)}}}catch(n){"
              - "let o=`${e}::unexpected exception:${n.message}`;throw new
                Error(o)}};var $=async(t,e,n,s)=>{try{let
                o=`${t}::handleRequest`,r=X(e),a=null;try{(!process."
              - "env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&console.debug(\
                `${o}::Received even\\"
              - "t`,JSON.stringify(r),r),r.routeKey in s?a=await
                s[r.routeKey](r,n):(console.log("
              - "`${o}::Didn't find '${r.routeKey}' in route map:
                ${JSON.stringify(s)}}`),a={statusCode:500,"
              - "body:`${o}::${r.routeKey}:Routing map incorrect`})}catch(u){let
                p=u;console.error("
              - "`${o}::error:${p.message}`,u),a={statusCode:500,body:p.message\
                }}finally{a||(a={statusCode:500,"
              - "body:`${o}::Route dispatch failed`});try{let
                u=JSON.parse(a.body)}catch{let u=a;"
              - "u.body=JSON.stringify(u.body),a=u}finally{try{(!process.env.NO\
                DE_ENV||process.env."
              - "NODE_ENV!==\"test\")&&console.info(`${o}::${r.routeKey}::resul\
                t`,a,btoa(JSON.stringify("
              - "a)))}catch(u){console.error(`${o}::${r.routeKey}::result::erro\
                r`,u,a)}return a}}}catch(o){"
              - "return
                console.error(`handler::error:${o.message}`,o),{statusCode:500,\
                body:JSON."
              - "stringify({message:\"Something has gone very
                wrong.\"})}}},D=(t,e,n)=>{let s=\"util\\"
              - ".validateRouteTestAware\";try{return
                n.routeKey!==e?f({statusCode:500,body:`${t}:${s}\\"
              - "::Routing map
                incorrect`}):process.env.NODE_ENV&&process.env.NODE_ENV===\"test\
                \"?f("
              - "{statusCode:200,body:`${t}:${s}::jest
                ${e}`}):E(\"\")}catch(o){let a=`${t}:${s}:::\\"
              - ":unexpected exception:${o.message}`;throw new Error(a)}};var
                O=require(\"@aws-sdk/client-license-manager\");var
                z=\"entitlement.broken.redeployApp\",Z=\"entitlement.missing\",\
                k=async t=>{let e=\"\\"
              - "doLicenseCheck\";try{let
                n=\"6cf9s66w3t0z1qdjuijuoc6ah\",s=\"186272575067\",r={region:pr\
                ocess."
              - "env.AWS_REGION||\"us-east-1\"},a=new
                O.LicenseManagerClient(r),u={Filters:[{Name:\"\\"
              - "ProductSKU\",Values:[n]},{Name:\"Status\",Values:[\"AVAILABLE\
                \"]}]},p,i=!1;t==s?(p=new O.ListLicensesCommand("
              - "u),i=!0):p=new
                O.ListReceivedLicensesCommand(u),d(`${e}::getting
                licenses`,{callerAwsAccountId:t,"
              - "seller:s,input:u,command:p});let c=await
                a.send(p);console.debug(h(c));let l=c.Licenses||"
              - "[];return i&&(d(`${e}::filtering beneficiary because
                seller=account`),l=l.filter("
              - "I=>I.Beneficiary?.includes(`:${t}:`)),d(h(l))),rt(c)&&(l=l.fil\
                ter(I=>I.Issuer?.KeyFingerprint?."
              - "startsWith(`aws:${s}:`)),d(h(l)),l.length>0)?tt(l[0].Beneficia\
                ry):T(Z)}catch(n){"
              - "let s=n;if((s.name||\"\")===\"AuthorizationException\")return
                T(z);if((s.name||\"\")==="
              - "\"AccessDeniedException\")return T(s.message);{let
                o=`${e}::unexpected exception:${s."
              - "message}`;return
                d(o,s,h(s)),et(s)}}},tt=t=>({status:\"LICENSE_FOUND\",data:t}),\
                et=t=>({"
              - "status:\"LOOKUP_ERROR\",data:t instanceof
                Error?t.message:t}),T=t=>({status:\"LICEN\\"
              - "SE_MISSING\",data:t}),rt=t=>{let
                e=\"checkLicenses.isValid\";if((t.Licenses||[]).length=="
              - "0)return d(`${e}::No active subscription found in AWS
                Marketplace`),!1;let n=t.Licenses[0];"
              - "if((n.Entitlements||[]).length==0)return d(`${e}::No
                entitlement found on Licens\\"
              - "e`),!1;let s=n.Entitlements[0];return
                s.Value!==\"Enabled\"?(d(`${e}::Entitlement \\"
              - "not enabled:
                ${s.Value}`),!1):n.Status!==\"AVAILABLE\"&&n.Status!==\"ACTIVE\
                \"?(d(`${e}\\"
              - "::License not available or active: ${n.Status}`),!1):!0};var
                nt=async(t,e)=>await
                $(\"checkLicense\",t,e,{...U.routes}),G=async(t,e)=>{let n=\"\\"
              - "checkLicense.get\";try{(!process.env.NODE_ENV||process.env.NOD\
                E_ENV!==\"test\")&&d("
              - "`${n}::Received event`,JSON.stringify(t),t);let s=D(n,\"GET
                /checkLicense\",t);if(s."
              - "isErr())return s.error;let o=b(e),r=await k(o);d(h(r));let
                a=500,u=null;return r."
              - "status==\"LOOKUP_ERROR\"?(a=500,u=r.data):r.status==\"LICENSE_\
                MISSING\"?(a=402,u=r.data):"
              - "r.status==\"LICENSE_FOUND\"&&r.data.includes(`:${o}:`)&&(a=204\
                ,u=\"\"),u==null&&(a=402,"
              - "u=\"entitlement.missing\"),{statusCode:a,body:u}}catch(s){retu\
                rn{statusCode:500,body:JSON."
              - "stringify(`${n}: ${s}`)}}},U={handlers:{get:G},routes:{\"GET
                /checkLicense\":G}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          AWS_ACCOUNT_ID:
            Ref: "AWS::AccountId"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ApiCheckLicenseLambdaServiceRoleB914B2D9"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn: []
  ApiCheckLicenseLambdaListReceivedLicensesRoleEFBB23CF:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "license-manager:ListLicenses"
              - "license-manager:ListReceivedLicenses"
            Effect: "Allow"
            Resource: "*"
        Version: "2012-10-17"
      PolicyName: "ApiCheckLicenseLambdaListReceivedLicensesRoleEFBB23CF"
      Roles:
        - Ref: "ApiCheckLicenseLambdaServiceRoleB914B2D9"
  ApiMembershipsLambdaServiceRole8A860401:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  ApiMembershipsLambdaServiceRoleDefaultPolicy02559B55:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:Query"
              - "dynamodb:Scan"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbDestinations37B2F70F"
                  - "Arn"
              - Fn::GetAtt:
                  - "DdbDirectories26458382"
                  - "Arn"
          - Action:
              - "dynamodb:BatchGetItem"
              - "dynamodb:BatchWriteItem"
              - "dynamodb:ConditionCheckItem"
              - "dynamodb:DeleteItem"
              - "dynamodb:DescribeTable"
              - "dynamodb:GetItem"
              - "dynamodb:GetRecords"
              - "dynamodb:GetShardIterator"
              - "dynamodb:PutItem"
              - "dynamodb:Query"
              - "dynamodb:Scan"
              - "dynamodb:UpdateItem"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "DdbMemberships1A816D0C"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "DdbMemberships1A816D0C"
                        - "Arn"
                    - "/index/*"
        Version: "2012-10-17"
      PolicyName: "ApiMembershipsLambdaServiceRoleDefaultPolicy02559B55"
      Roles:
        - Ref: "ApiMembershipsLambdaServiceRole8A860401"
  ApiMembershipsLambdaCB6878A1:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var z=Object.defineProperty;var
                Ke=Object.getOwnPropertyDescriptor;var
                Qe=Object.getOwnPropertyNames;var
                He=Object.prototype.hasOwnProperty;var Ye=(t,e)=>{for(var r in
                e)z(t,r,{get:e[r],enumerable:!0})},Je=(t,e,r,s)=>{if(e&&"
              - "typeof e==\"object\"||typeof e==\"function\")for(let o of
                Qe(e))!He.call(t,o)&&o!==r&&"
              - "z(t,o,{get:()=>e[o],enumerable:!(s=Ke(e,o))||s.enumerable});re\
                turn t};var Xe=t=>Je(z({},\"__esModule\",{value:!0}),t);var
                ht={};Ye(ht,{getIdsFromMembershipEvent:()=>B,handler:()=>bt,mem\
                berships:()=>Fe,"
              - "parseMembership:()=>me});module.exports=Xe(ht);function
                x(t){var e=String(t);if(e===\"[object
                Object]\")try{e=JSON.stringify(t)}catch{}"
              - "return e}var Ze=function(){function t(){}return
                t.prototype.isSome=function(){return!1},t."
              - "prototype.isNone=function(){return!0},t.prototype[Symbol.itera\
                tor]=function(){return{"
              - "next:function(){return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){"
              - "return e},t.prototype.expect=function(e){throw new
                Error(\"\".concat(e))},t.prototype."
              - "unwrap=function(){throw new Error(\"Tried to unwrap
                None\")},t.prototype.map=function(e){"
              - "return this},t.prototype.mapOr=function(e,r){return
                e},t.prototype.mapOrElse=function(e,r){"
              - "return e()},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){"
              - "return e()},t.prototype.andThen=function(e){return
                this},t.prototype.toResult=function(e){"
              - "return
                p(e)},t.prototype.toString=function(){return\"None\"},t.prototy\
                pe.toAsyncOption="
              - "function(){return new _(T)},t}(),T=new Ze;Object.freeze(T);var
                ze=function(){function t(e){"
              - "if(!(this instanceof t))return new t(e);this.value=e}return
                t.prototype.isSome=function(){"
              - "return!0},t.prototype.isNone=function(){return!1},t.prototype[\
                Symbol.iterator]=function(){"
              - "var e=Object(this.value);return Symbol.iterator in
                e?e[Symbol.iterator]():{next:function(){"
              - "return{done:!0,value:void
                0}}}},t.prototype.unwrapOr=function(e){return this.value},"
              - "t.prototype.expect=function(e){return
                this.value},t.prototype.unwrap=function(){"
              - "return this.value},t.prototype.map=function(e){return
                N(e(this.value))},t.prototype."
              - "mapOr=function(e,r){return
                r(this.value)},t.prototype.mapOrElse=function(e,r){return r("
              - "this.value)},t.prototype.or=function(e){return
                this},t.prototype.orElse=function(e){"
              - "return this},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.toResult="
              - "function(e){return
                l(this.value)},t.prototype.toAsyncOption=function(){return new
                _("
              - "this)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype.toString="
              - "function(){return\"Some(\".concat(x(this.value),\")\")},t.EMPT\
                Y=new t(void 0),t}(),N=ze,"
              - "pe;(function(t){function e(){for(var
                o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];"
              - "for(var a=[],i=0,c=o;i<c.length;i++){var
                u=c[i];if(u.isSome())a.push(u.value);else"
              - "return u}return N(a)}t.all=e;function r(){for(var
                o=[],n=0;n<arguments.length;n++)"
              - "o[n]=arguments[n];for(var a=0,i=o;a<i.length;a++){var
                c=i[a];if(c.isSome())return c}"
              - "return T}t.any=r;function s(o){return o instanceof
                N||o===T}t.isOption=s})(pe||(pe="
              - "{}));var et=function(){function t(e){if(!(this instanceof
                t))return new t(e);this.error="
              - "e;var r=new Error().stack.split(`"
              - "`).slice(2);r&&r.length>0&&r[0].includes(\"ErrImpl\")&&r.shift\
                (),this._stack=r.join("
              - "`"
              - "`)}return
                t.prototype.isOk=function(){return!1},t.prototype.isErr=functio\
                n(){return!0},"
              - "t.prototype[Symbol.iterator]=function(){return{next:function()\
                {return{done:!0,value:void 0}}}},"
              - "t.prototype.else=function(e){return
                e},t.prototype.unwrapOr=function(e){return e},"
              - "t.prototype.expect=function(e){throw new Error(\"\".concat(e,\"
                - Error: \").concat("
              - "x(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.expect\
                Err=function(e){return this."
              - "error},t.prototype.unwrap=function(){throw new Error(\"Tried to
                unwrap Error: \".concat("
              - "x(this.error),`"
              - "`).concat(this._stack),{cause:this.error})},t.prototype.unwrap\
                Err=function(){return this."
              - "error},t.prototype.map=function(e){return
                this},t.prototype.andThen=function(e){"
              - "return this},t.prototype.mapErr=function(e){return new
                p(e(this.error))},t.prototype."
              - "mapOr=function(e,r){return
                e},t.prototype.mapOrElse=function(e,r){return e(this."
              - "error)},t.prototype.or=function(e){return
                e},t.prototype.orElse=function(e){return e("
              - "this.error)},t.prototype.toOption=function(){return
                T},t.prototype.toString=function(){"
              - "return\"Err(\".concat(x(this.error),\")\")},Object.definePrope\
                rty(t.prototype,\"stack\","
              - "{get:function(){return\"\".concat(this,`"
              - "`).concat(this._stack)},enumerable:!1,configurable:!0}),t.prot\
                otype.toAsyncResult="
              - "function(){return new M(this)},t.EMPTY=new t(void 0),t}();var
                p=et,tt=function(){function t(e){if(!(this instanceof t))return
                new t(e);this."
              - "value=e}return
                t.prototype.isOk=function(){return!0},t.prototype.isErr=functio\
                n(){"
              - "return!1},t.prototype[Symbol.iterator]=function(){var
                e=Object(this.value);return Symbol."
              - "iterator in
                e?e[Symbol.iterator]():{next:function(){return{done:!0,value:vo\
                id 0}}}},"
              - "t.prototype.else=function(e){return
                this.value},t.prototype.unwrapOr=function(e){"
              - "return this.value},t.prototype.expect=function(e){return
                this.value},t.prototype."
              - "expectErr=function(e){throw new
                Error(e)},t.prototype.unwrap=function(){return this."
              - "value},t.prototype.unwrapErr=function(){throw new Error(\"Tried
                to unwrap Ok: \".concat("
              - "x(this.value)),{cause:this.value})},t.prototype.map=function(e\
                ){return new l(e(this."
              - "value))},t.prototype.andThen=function(e){return
                e(this.value)},t.prototype.mapErr="
              - "function(e){return this},t.prototype.mapOr=function(e,r){return
                r(this.value)},t."
              - "prototype.mapOrElse=function(e,r){return
                r(this.value)},t.prototype.or=function(e){"
              - "return this},t.prototype.orElse=function(e){return
                this},t.prototype.toOption=function(){"
              - "return N(this.value)},t.prototype.safeUnwrap=function(){return
                this.value},t.prototype."
              - "toString=function(){return\"Ok(\".concat(x(this.value),\")\")}\
                ,t.prototype.toAsyncResult="
              - "function(){return new M(this)},t.EMPTY=new t(void 0),t}();var
                l=tt,de;(function(t){function e(){for(var
                a=[],i=0;i<arguments.length;i++)a[i]="
              - "arguments[i];for(var c=[],u=0,m=a;u<m.length;u++){var
                d=m[u];if(d.isOk())c.push("
              - "d.value);else return d}return new l(c)}t.all=e;function
                r(){for(var a=[],i=0;i<arguments."
              - "length;i++)a[i]=arguments[i];for(var
                c=[],u=0,m=a;u<m.length;u++){var d=m[u];if(d."
              - "isOk())return d;c.push(d.error)}return new
                p(c)}t.any=r;function s(a){try{return new l("
              - "a())}catch(i){return new p(i)}}t.wrap=s;function
                o(a){try{return a().then(function(i){"
              - "return new l(i)}).catch(function(i){return new
                p(i)})}catch(i){return Promise.resolve("
              - "new p(i))}}t.wrapAsync=o;function n(a){return a instanceof p||a
                instanceof l}t.isResult="
              - "n})(de||(de={}));var Q=function(t,e,r,s){function o(n){return n
                instanceof r?n:new r(function(a){"
              - "a(n)})}return new(r||(r=Promise))(function(n,a){function
                i(m){try{u(s.next(m))}catch(d){"
              - "a(d)}}function c(m){try{u(s.throw(m))}catch(d){a(d)}}function
                u(m){m.done?n(m.value):"
              - "o(m.value).then(i,c)}u((s=s.apply(t,e||[])).next())})},H=funct\
                ion(t,e){var r={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},s,o,n,a;return a="
              - "{next:i(0),throw:i(1),return:i(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function i(u){return
                function(m){return c([u,m])}}function c(u){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,u[0]&&(r="
              - "0)),r;)try{if(s=1,o&&(n=u[0]&2?o.return:u[0]?o.throw||((n=o.re\
                turn)&&n.call(o),0):"
              - "o.next)&&!(n=n.call(o,u[1])).done)return
                n;switch(o=0,n&&(u=[u[0]&2,n.value]),u[0]){case 0:case 1:"
              - "n=u;break;case 4:return r.label++,{value:u[1],done:!1};case
                5:r.label++,o=u[1],u="
              - "[0];continue;case
                7:u=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(u[0]===6||u[0]===2)){r=0;continue\
                }if(u[0]===3&&(!n||"
              - "u[1]>n[0]&&u[1]<n[3])){r.label=u[1];break}if(u[0]===6&&r.label\
                <n[1]){r.label=n[1],"
              - "n=u;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(u);break\
                }n[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}u=e.call(t,r)}catch(m){u=[6,m],o=0}final\
                ly{s=n=0}if(u[0]&5)"
              - "throw u[1];return{value:u[0]?u[1]:void
                0,done:!0}}},M=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var r=this;return this."
              - "thenInternal(function(s){return Q(r,void 0,void
                0,function(){var o;return H(this,"
              - "function(n){return s.isErr()?[2,s]:(o=e(s.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(e){var r=this;return
                this.thenInternal(function(s){return Q("
              - "r,void 0,void 0,function(){var o;return
                H(this,function(n){switch(n.label){case 0:"
              - "return s.isErr()?[2,s]:(o=l,[4,e(s.value)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.mapErr=function(e){var r=this;return
                this.thenInternal(function(s){return Q("
              - "r,void 0,void 0,function(){var o;return
                H(this,function(n){switch(n.label){case 0:"
              - "return s.isOk()?[2,s]:(o=p,[4,e(s.error)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var r=this;return
                this.thenInternal(function(s){return Q(r,void 0,"
              - "void 0,function(){var o;return H(this,function(n){return
                s.isOk()?[2,s]:(o=e(s.error),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toOption=function(){return
                new _("
              - "this.promise.then(function(e){return
                e.toOption()}))},t.prototype.thenInternal=function(e){"
              - "return new t(this.promise.then(e))},t}();var
                ee=function(t,e,r,s){function o(n){return n instanceof r?n:new
                r(function(a){"
              - "a(n)})}return new(r||(r=Promise))(function(n,a){function
                i(m){try{u(s.next(m))}catch(d){"
              - "a(d)}}function c(m){try{u(s.throw(m))}catch(d){a(d)}}function
                u(m){m.done?n(m.value):"
              - "o(m.value).then(i,c)}u((s=s.apply(t,e||[])).next())})},te=func\
                tion(t,e){var r={label:0,"
              - "sent:function(){if(n[0]&1)throw n[1];return
                n[1]},trys:[],ops:[]},s,o,n,a;return a="
              - "{next:i(0),throw:i(1),return:i(2)},typeof
                Symbol==\"function\"&&(a[Symbol.iterator]="
              - "function(){return this}),a;function i(u){return
                function(m){return c([u,m])}}function c(u){"
              - "if(s)throw new TypeError(\"Generator is already
                executing.\");for(;a&&(a=0,u[0]&&(r="
              - "0)),r;)try{if(s=1,o&&(n=u[0]&2?o.return:u[0]?o.throw||((n=o.re\
                turn)&&n.call(o),0):"
              - "o.next)&&!(n=n.call(o,u[1])).done)return
                n;switch(o=0,n&&(u=[u[0]&2,n.value]),u[0]){case 0:case 1:"
              - "n=u;break;case 4:return r.label++,{value:u[1],done:!1};case
                5:r.label++,o=u[1],u="
              - "[0];continue;case
                7:u=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n="
              - "n.length>0&&n[n.length-1])&&(u[0]===6||u[0]===2)){r=0;continue\
                }if(u[0]===3&&(!n||"
              - "u[1]>n[0]&&u[1]<n[3])){r.label=u[1];break}if(u[0]===6&&r.label\
                <n[1]){r.label=n[1],"
              - "n=u;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(u);break\
                }n[2]&&r.ops.pop(),"
              - "r.trys.pop();continue}u=e.call(t,r)}catch(m){u=[6,m],o=0}final\
                ly{s=n=0}if(u[0]&5)"
              - "throw u[1];return{value:u[0]?u[1]:void
                0,done:!0}}},_=function(){function t(e){this."
              - "promise=Promise.resolve(e)}return
                t.prototype.andThen=function(e){var r=this;return this."
              - "thenInternal(function(s){return ee(r,void 0,void
                0,function(){var o;return te(this,"
              - "function(n){return s.isNone()?[2,s]:(o=e(s.value),[2,o
                instanceof t?o.promise:o])})})})},"
              - "t.prototype.map=function(e){var r=this;return
                this.thenInternal(function(s){return ee("
              - "r,void 0,void 0,function(){var o;return
                te(this,function(n){switch(n.label){case 0:"
              - "return s.isNone()?[2,s]:(o=N,[4,e(s.value)]);case
                1:return[2,o.apply(void 0,[n.sent()])]}})})})},"
              - "t.prototype.or=function(e){return this.orElse(function(){return
                e})},t.prototype."
              - "orElse=function(e){var r=this;return
                this.thenInternal(function(s){return ee(r,void 0,"
              - "void 0,function(){var o;return te(this,function(n){return
                s.isSome()?[2,s]:(o=e(),"
              - "[2,o instanceof
                t?o.promise:o])})})})},t.prototype.toResult=function(e){return
                new M("
              - "this.promise.then(function(r){return
                r.toResult(e)}))},t.prototype.thenInternal="
              - "function(e){return new t(this.promise.then(e))},t}();var
                y=t=>btoa(JSON.stringify(t)),g=(...t)=>{};var
                V=10,le=(t,e,r)=>{let
                s=\"api.validation.validateIdValue\";try{if(typeof r!=\"s\\"
              - "tring\"||r.length!=V){let o=`:${e} is malformed: '${r}'`;return
                g(`${t}:${s}::${o}`),"
              - "p({message:`resources.${e}.validation.invalid`,detail:`The ${e}
                must be a string\\"
              - " of length ${V}: '${r}'`,errorSource:\"CLIENT\"})}else return
                l(r)}catch(o){let n=typeof o=="
              - "\"string\"?new
                Error(o):o,a={message:\"internalServerError\",detail:n.message,\
                errorSource:\"\\"
              - "SERVER\",originalError:n};return
                console.error(`${s}::error`,a,y(a)),p(a)}};var
                ye=(t,e,r,s=1)=>e.filter(o=>Object.values(o).some(n=>typeof
                n==\"object\"&&s<r?"
              - "ye(t,[n],r,s+1).length>0:n.toString().toLowerCase().includes(t\
                .toLowerCase()))),"
              - "L=t=>{let
                e=t.model,r=t.dataTotalCount||0,s=t.dataStart||0,o=t.dataEnd||0\
                ;return`${e}\\"
              - " ${s}-${o}/${r}`},fe=(t,e,r,s={})=>{let
                o=\"util.doFilterResults\";try{if(e.isErr()||"
              - "e.value.data===void 0)return
                e;if(console.debug(`${o}::input`,e.value.data),e.value."
              - "data!==void
                0&&r.queryStringParameters&&r.queryStringParameters.hasOwnPrope\
                rty(\"\\"
              - "filter\")){let
                n=JSON.parse(r.queryStringParameters.filter);if(n.hasOwnPropert\
                y(\"\\"
              - "q\")){let a=n.q,i=3;e.value.data=ye(a,e.value.data,i)}else
                e.value.data=e.value.data."
              - "filter(a=>Object.entries(n).every(([i,c])=>{let
                u=s.hasOwnProperty(i)?s[i]:i;return Array."
              - "isArray(c)?c.includes(a[u]):a[u]===c}))}return
                console.debug(`${o}::output`,e.value."
              - "data),e}catch(n){let i=`${t}:${o}::unexpected
                exception:${n.message}`;return console."
              - "error(i,n),e}},Ee=(t,e,r)=>{let
                s=\"util.doRangeResults\";try{if(e.isErr()||e.value."
              - "data===void 0)return
                e;if(e.value.dataTotalCount=e.value.data.length,e.value.data!=="
              - "void
                0)if(r.queryStringParameters&&r.queryStringParameters.hasOwnPro\
                perty(\"range\")){"
              - "let[o,n]=JSON.parse(r.queryStringParameters.range);e.value.dat\
                aStart=o,e.value.dataEnd="
              - "Math.min(e.value.data.length,o+n),e.value.data=e.value.data.sl\
                ice(o,o+n+1)}else e."
              - "value.dataStart=0,e.value.dataEnd=e.value.data.length||0;return
                e}catch(o){let a=`${t}\\"
              - ":${s}::unexpected exception:${o.message}`;return
                console.error(a,o),p({statusCode:500,"
              - "body:a})}},ge=(t,e,r)=>{let
                s=\"util.doSortResults\";try{if(e.isErr())return e;if(e."
              - "value.data!==void
                0&&r.queryStringParameters&&r.queryStringParameters.hasOwnPrope\
                rty("
              - "\"sort\")){let[o,n]=JSON.parse(r.queryStringParameters.sort),a=\
                \"ASC\";switch(n){case\"\\"
              - "NONE\":a=\"NONE\";break;case\"DESC\":a=\"DESC\";break;case\"ASC\
                \":default:a=\"ASC\";break}let i=rt("
              - "e.value.data,o,a);e.value.data=i}return e}catch(o){let
                a=`${t}:${s}::unexpected \\"
              - "exception:${o.message}`;return
                console.error(a,o),p({statusCode:500,body:a})}};var
                rt=(t,e,r=\"ASC\")=>{let
                s=\"util.sortResults\";try{if(r===\"NONE\")return t;let o=r==="
              - "\"ASC\"?1:-1,n=(a,i)=>{let c=a[e],u=i[e];return
                c===u?0:(c>u?1:-1)*o};return t.slice()."
              - "sort(n)}catch(o){let a=`${s}::unexpected
                exception:${o.message}`;throw console.error("
              - "a,o),o}};var re=(t,e)=>{let
                r=400,s=500,o=!1;e&&(r=e.clientErrorCode||r,s=e.serverErrorCode\
                ||"
              - "s,o=e.includeOriginalError||o);let n=t,a=n.errorSource;delete
                n.errorSource,!o&&"
              - "n.hasOwnProperty(\"originalError\")&&delete n.originalError;let
                i={statusCode:a==\"\\"
              - "CLIENT\"?r:s,body:JSON.stringify(n)};return
                console.log(\"getErrorResponse::output\","
              - "i),i},Ce=(t,e,r,s=!0)=>{let
                o=\"util.getIdValueFromEvent\";try{if(r.hasOwnProperty("
              - "e)){if(typeof r[e]!=\"string\"||r[e]===void
                0||r[e]===null)throw new Error(`${e} v\\"
              - "alue unusable`);{let n=r[e];if(s){let
                a=le(t,e,n);if(a.isErr())return p(re(a.error))}"
              - "return l(n)}}else throw new Error(`item missing
                ${e}`)}catch(n){let i=n.message;"
              - "return
                console.error(`${t}:${o}::${i}`,n),p({statusCode:400,body:i})}}\
                ,ot=t=>{let e=\"\\"
              - "util.getEventWithoutApiInPath\";try{let
                r=\"/api/\",s=\"/\";return{...t,__originalEvent:t,"
              - "rawPath:t.rawPath.replace(r,s),routeKey:t.routeKey.replace(r,s\
                ),requestContext:{"
              - "...t.requestContext,http:{...t.requestContext.http,path:t.requ\
                estContext.http.path."
              - "replace(r,s)},routeKey:t.requestContext.routeKey.replace(r,s)}\
                }}catch(r){let o=`${e}\\"
              - "::unexpected exception:${r.message}`;throw new
                Error(o)}},Ie=(t,e,r)=>{let s=\"ut\\"
              - "il.getPathParameter\";try{if(r.pathParameters)if(r.pathParamet\
                ers.hasOwnProperty("
              - "e)){if(r.pathParameters[e]===void 0)throw new
                Error(`event.pathParameters[${e}] \\"
              - "exists but is undefined`);return l(r.pathParameters[e])}else
                throw new Error(`ev\\"
              - "ent.pathParameters does not have property ${e}`);else throw new
                Error(\"event.pat\\"
              - "hParameters is undefined\")}catch(o){let
                a=`${t}:${s}::${o.message}`;return console."
              - "error(a,o),p({statusCode:400,body:a})}},Re=t=>{let
                e=\"util.getRequestBody\";try{if(t."
              - "body){if(typeof t.body!=\"string\")throw new Error(\"event.body
                is not a string\");{"
              - "let r;return
                t.isBase64Encoded?(r=Buffer.from(t.body,\"base64\").toString(\"\
                utf8\"),"
              - "console.debug(`${e}::event.body`,t.body),console.debug(`${e}::\
                body`,r)):r=t.body,"
              - "l(r)}}else throw new Error(\"event.body is
                undefined\")}catch(r){let s=r,o=`${e}::${s."
              - "message}`;return console.error(o,r),p(s.message)}},O=t=>{let
                e=\"util.getStandard\\"
              - "Response\";try{if(t.isErr())return t.error;let
                r=t.value;console.debug(`${e}::inp\\"
              - "ut`,r);let
                o={destinations:\"DestinationId\",directories:\"DirectoryId\",m\
                emberships:\"\\"
              - "MembershipId\",connectUsers:\"Id\",cognitoUsers:\"Username\"}[\
                r.model];console.debug("
              - "`${e}::idKey`,o);let
                n,a,i={};switch(r.action){case\"Create\":n=201,a={...r.data[0],"
              - "id:`${r.data[0][o]}`};break;case\"CreateUser\":n=201,a={...r.d\
                ata[0],id:`${r.data[0][o]}`};"
              - "break;case\"RetrieveBatchGet\":n=200,a=r.data?.map(c=>({...c,i\
                d:`${c[o]}`})),i[\"Co\\"
              - "ntent-Range\"]=L(r);break;case\"RetrieveGet\":n=200,a={...r.da\
                ta[0],id:`${r.data[0][o]}`};"
              - "break;case\"RetrieveQuery\":n=200,a=r.data?.map(c=>({...c,id:`\
                ${c[o]}`})),i[\"Conte\\"
              - "nt-Range\"]=L(r);break;case\"RetrieveScan\":n=200,a=r.data?.ma\
                p(c=>({...c,id:`${c[o]}`})),"
              - "i[\"Content-Range\"]=L(r);break;case\"Update\":n=200,a={...r.d\
                ata[0],id:`${r.data[0][o]}`};"
              - "break;case\"UpdateUser\":n=200,a={...r.data[0],id:`${r.data[0]\
                [o]}`};break;case\"De\\"
              - "lete\":n=204,a=\"\";break;case\"AdminDeleteUser\":n=204,a=\"\"\
                ;break;case\"DescribeUser\":"
              - "n=200,a={...r.data[0],id:`${r.data[0][o]}`};break;case\"AdminG\
                etUser\":n=200,a={...r."
              - "data[0],id:`${r.data[0][o]}`};break;case\"ListUsers\":n=200,a=\
                r.data?.map(c=>({...c,"
              - "id:`${c[o]}`})),i[\"Content-Range\"]=L(r);break;default:throw
                new Error(`${e}::une\\"
              - "xpected
                action::${JSON.stringify(r)}`)}return{statusCode:n,body:JSON.st\
                ringify(a),"
              - "headers:i}}catch(r){let s=r;throw
                console.error(`${e}::unexpected exception:${s."
              - "message}`,r),new Error(s.message)}},S=async(t,e,r,s)=>{try{let
                o=`${t}::handleRe\\"
              - "quest`,n=ot(e),a=null;try{(!process.env.NODE_ENV||process.env.\
                NODE_ENV!==\"test\")&&"
              - "console.debug(`${o}::Received
                event`,JSON.stringify(n),n),n.routeKey in s?a=await s[n."
              - "routeKey](n,r):(console.log(`${o}::Didn't find '${n.routeKey}'
                in route map: ${JSON."
              - "stringify(s)}}`),a={statusCode:500,body:`${o}::${n.routeKey}:R\
                outing map incorre\\"
              - "ct`})}catch(i){let
                c=i;console.error(`${o}::error:${c.message}`,i),a={statusCode:5\
                00,"
              - "body:c.message}}finally{a||(a={statusCode:500,body:`${o}::Route
                dispatch failed`});"
              - "try{let i=JSON.parse(a.body)}catch{let
                i=a;i.body=JSON.stringify(i.body),a=i}finally{"
              - "try{(!process.env.NODE_ENV||process.env.NODE_ENV!==\"test\")&&\
                console.info(`${o}::${n."
              - "routeKey}::result`,a,btoa(JSON.stringify(a)))}catch(i){console\
                .error(`${o}::${n."
              - "routeKey}::result::error`,i,a)}return a}}}catch(o){return
                console.error(`handler\\"
              - "::error:${o.message}`,o),{statusCode:500,body:JSON.stringify({\
                message:\"Something\\"
              - " has gone very wrong.\"})}}},v=(t,e,r)=>{let
                s=\"util.validateRouteTestAware\";try{"
              - "return
                r.routeKey!==e?p({statusCode:500,body:`${t}:${s}::Routing map
                incorrect`}):"
              - "process.env.NODE_ENV&&process.env.NODE_ENV===\"test\"?p({statu\
                sCode:200,body:`${t}\\"
              - ":${s}::jest ${e}`}):l(\"\")}catch(o){let
                a=`${t}:${s}::::unexpected exception:${o."
              - "message}`;throw new Error(a)}};var
                U=require(\"@aws-sdk/client-dynamodb\"),w=require(\"@aws-sdk/li\
                b-dynamodb\"),De=require(\"@aws-sdk/util-dynamodb\");var
                oe=(t,e)=>{let r=\"util.getEnvOrDefault\";try{let s;return
                process.env.hasOwnProperty("
              - "t)&&process.env[t]?s=process.env[t]:s=e,s}catch(s){let
                n=`${r}::unexpected excep\\"
              - "tion:${s.message}`;throw new Error(n)}},Y=t=>{let
                e=\"util.getTableName\";try{switch(t){case\"\\"
              - "destinations\":return
                l(oe(\"DDB_TABLE_DESTINATION\",\"aws-connect-directory_destina\
                \\"
              - "tions\"));case\"directories\":return
                l(oe(\"DDB_TABLE_DIRECTORY\",\"aws-connect-direct\\"
              - "ory_directories\"));case\"memberships\":return
                l(oe(\"DDB_TABLE_MEMBERSHIP\",\"aws-con\\"
              - "nect-directory_memberships\"));default:return p(`getTableName:
                tableName ${t} not\\"
              - " supported`)}}catch(r){let o=`${e}::unexpected
                exception:${r.message}`;throw new Error("
              - "o)}};var
                xe={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.e\
                nv.DDB_AWS_REGION&&"
              - "(xe={region:process.env.DDB_AWS_REGION});var st=new
                U.DynamoDBClient(xe),ne=w.DynamoDBDocumentClient."
              - "from(st,{marshallOptions:{removeUndefinedValues:!0}});var
                Oe=(t,e,r,s)=>{let
                o=\"dynamo.makeDdbDeleteCommand\";try{console.debug(`${e}:${o}`\
                ,"
              - "r,s);let n,a=Y(t);if(a.isErr())return
                p({statusCode:500,body:a.error});n=a.value;"
              - "let
                i={TableName:n,Key:{[r]:s},Expected:{[r]:{Exists:!0,Value:s}}};\
                return l({model:t,"
              - "table:n,action:\"Delete\",input:i})}catch(n){let
                i=`${e}:${o}::unexpected exceptio\\"
              - "n:${n.message}`;throw new Error(i)}},ve=t=>{let
                e=\"dynamo.makeDdbRetrieveManyCom\\"
              - "mand\";try{console.debug(`${e}::table`,t);let r,s=Y(t);return
                s.isErr()?p({statusCode:500,"
              - "body:s.error}):(r=s.value,l({model:t,table:r,action:\"Retrieve\
                Scan\",input:{TableName:r}}))}catch(r){"
              - "let o=`${e}::unexpected exception:${r.message}`;throw new
                Error(o)}};var we=(t,e,r,s)=>{let
                o=\"dynamo.makeDdbRetrieveOneCommand\";try{console.debug(`${e}\
                \\"
              - ":${o}::event`,r);let n,a=Y(t);if(a.isErr())return
                p({statusCode:500,body:a.error});"
              - "n=a.value;let i=Ie(e,s,r),c;if(i.isErr())return i;c=i.value;let
                u={TableName:n,Key:{"
              - "[s]:c}};return
                l({model:t,table:n,action:\"RetrieveGet\",input:u})}catch(n){let
                i=`${e}\\"
              - ":${o}::unexpected exception:${n.message}`;throw new
                Error(i)}};var Ne=async(t,e)=>{if(e.isErr())return e;let
                r=e.value,s=\"dynamo.runDdbDeleteIt\\"
              - "em\";try{console.debug(`${t}:${s}::command.input`,r.input);let
                o=await ne.send(new w.DeleteCommand("
              - "r.input));return
                console.debug(`${t}:${s}::result`,o),l({...r,output:o})}catch(o\
                ){"
              - "let n=o,a,i;return n.message===\"The conditional request
                failed\"?(a=404,i=\"Not fo\\"
              - "und\"):(a=500,i=`${t}:${s}::${n.message}`,console.error(i,o)),\
                p({statusCode:a,body:i})}},"
              - "Ae=async(t,e)=>{if(e.isErr())return e;let
                r=e.value,s=\"dynamo.runDdbRetrieveMany\";"
              - "try{console.debug(`${t}:${s}::command.input`,r.input);let
                o=await ne.send(new U.ScanCommand("
              - "r.input));return
                console.debug(`${t}:${s}::result`,o),o.Items?(console.debug(`${\
                t}\\"
              - ":${s}::result.Items`,o.Items),l({...r,data:o.Items.map(n=>(0,D\
                e.unmarshall)(n)),"
              - "output:o})):(console.error(`${t}:${s}::result.Items is
                undefined`,o),p({statusCode:500,"
              - "body:\"Unexpected database response\"}))}catch(o){let
                a=`${t}:${s}::${o.message}`;"
              - "return console.error(a,o),p({statusCode:500,body:a})}};var
                $e=async(t,e,r)=>{if(e.isErr())return e;let
                s=e.value,o=\"dynamo.runDdbRetrie\\"
              - "veOne\";try{console.debug(`${t}:${o}::command.input`,s.input);\
                let n=await ne.send("
              - "new
                w.GetCommand(s.input));if(console.debug(`${t}:${o}::result`,n),\
                !n.Item)return p("
              - "{statusCode:404,body:\"Not
                found\"});if(console.debug(`${t}:${o}::result.Item`,n.Item),"
              - "!n.Item.hasOwnProperty(r)){let i=`${t}:${o}::${r} not found in
                result.Item`;return console."
              - "error(i,n),p({statusCode:500,body:i})}let
                a={...s,data:[n.Item],output:n};return console."
              - "debug(`${t}:${o}::output`,a),l(a)}catch(n){let
                i=`${t}:${o}::${n.message}`;return console."
              - "error(i,n),p({statusCode:500,body:i})}};var at=async t=>{let
                e=\"memberships.get\",r=\"memberships\";(!process.env.NODE_ENV|\
                |"
              - "process.env.NODE_ENV!==\"test\")&&console.debug(`${e}::event`,\
                t,btoa(JSON.stringify("
              - "t)));let s=v(e,`GET /${r}`,t);if(s.isErr())return s.error;let
                o=ve(r),n=await Ae("
              - "e,o),a=fe(e,n,t),i=ge(e,a,t),c=Ee(e,i,t),u;if(c.isErr())u=c;el\
                se{let m=c.value.data?."
              - "map(d=>({...d,MembershipId:`${d.DestinationId}-${d.DirectoryId\
                }`}));c.value.data="
              - "m,u=c}return O(u)};var Te={\"GET /memberships\":at};var
                it=async t=>{let
                e=\"memberships.getId\",r=\"memberships\",s=\"MembershipId\",o=\
                \"D\\"
              - "estinationId\",n=\"DirectoryId\";(!process.env.NODE_ENV||proce\
                ss.env.NODE_ENV!==\"te\\"
              - "st\")&&console.debug(`${e}::event`,t,btoa(JSON.stringify(t)));\
                let a=v(e,`GET /${r}\\"
              - "/{MembershipId}`,t);if(a.isErr())return a.error;let
                i=B(e,t.pathParameters);if(i."
              - "isErr())return
                i.error;console.debug(`${e}::idResult.value`,i.value);let[c,u]=\
                i."
              - "value;console.debug(`${e}::pathDestinationId`,c),console.debug\
                (`${e}::pathDirect\\"
              - "oryId`,u);let m=we(r,e,t,s);if(m.isErr())return
                m.error;console.debug(`${e}::get\\"
              - "Command.value`,m.value);let d=m.value.input;if(!d||d===void
                0||d===null)return{statusCode:500,"
              - "body:`${e}: getCommand.value.input is
                undefined`};if(console.debug(`${e}::input(\\"
              - "1/2)`,d),!d.Key||d.Key===void
                0||d.Key===null)return{statusCode:500,body:`${e}: \\"
              - "getCommand.value.input.Key is undefined`};delete
                d.Key[s],d.Key[o]=c,d.Key[n]=u,"
              - "console.debug(`${e}::input(2/2)`,d);let f=await
                $e(e,m,o);if(f.isErr())return f."
              - "error;console.debug(`${e}::commandResult`,f);let
                b=f.value.data?.map(h=>({...h,MembershipId:`${h."
              - "DestinationId}-${h.DirectoryId}`}));return
                console.debug(`${e}::outputWithIds`,b),"
              - "f.value.data=b,console.debug(`${e}::commandResult.value`,f.val\
                ue),O(f)};var Se={\"GET /memberships/{MembershipId}\":it};var
                ce=require(\"@aws-sdk/lib-dynamodb\");var
                Ge=require(\"@aws-sdk/client-lambda\"),pt=require(\"@aws-sdk/li\
                b-dynamodb\");var Le=require(\"@aws-sdk/lib-dynamodb\");var
                Pe=require(\"@aws-sdk/client-dynamodb\"),ke=require(\"@aws-sdk/\
                lib-dynamodb\");var
                _e={};process.env.hasOwnProperty(\"DDB_AWS_REGION\")&&process.e\
                nv.DDB_AWS_REGION&&"
              - "(_e.region=process.env.DDB_AWS_REGION);var
                A=ke.DynamoDBDocumentClient.from(new Pe.DynamoDBClient("
              - "_e),{marshallOptions:{removeUndefinedValues:!0}});var
                $=(t,e)=>{let
                r=\"api.aws-dynamodb.util.vdxMarshallWithTable\";g(`${r}::input\
                `,"
              - "{dataType:t,props:e},y({dataType:t,props:e}));let
                s={},{pkValue:o,skValue:n}=e,a=Ve();"
              - "if(a.isErr())return g(`${r}::error`,a.error.message),a;let
                i=a.value;if(t===\"des\\"
              - "tinations\"&&o){let
                c=\"\";s.pkName=\"DestinationId\",s.pkValue=`${c}${o}`,s.tableN\
                ame="
              - "i.Destinations}else if(t===\"directories\"&&o){let
                c=\"\";s.pkName=\"DirectoryId\",s.pkValue="
              - "`${c}${o}`,s.tableName=i.Directories}else
                if(t===\"memberships\"&&(o||n)){let c=\"\","
              - "u=\"\";o&&(s.pkName=\"DestinationId\",s.pkValue=`${c}${o}`),n&\
                &(s.skIndex=\"Directory\\"
              - "IdIndex\",s.skName=\"DirectoryId\",s.skValue=`${u}${n}`),s.tab\
                leName=i.Memberships}else{"
              - "let c={message:\"internalServerError\",detail:`Invalid
                dataType: ${t} or both key \\"
              - "values missing: ${o}, ${n}`,errorSource:\"SERVER\"};return
                console.error(`${r}::er\\"
              - "ror`,c),p(c)}return
                g(`${r}::output`,s,y(s)),l(s)},J=t=>{if(!t)return l(t);let
                e=Me("
              - "[t]);return e.isErr()?e:!e.value||e.value.length===0?l(void
                0):l(e.value[0])},Me=t=>{"
              - "let
                e=\"api.aws-dynamodb.util.vdxUnmarshallMany\";console.log(`${e}\
                ::data`,t,y(t));"
              - "try{if(!t||t.length===0)return l(t);let
                r=t.flatMap(s=>{if(!s)return[];let{pk:o,"
              - "sk:n,...a}=s,i={};return
                o?(o.startsWith(\"DIR#\")?i.DirectoryId=o.substring(4):o."
              - "startsWith(\"DEST#\")&&(i.DestinationId=o.substring(5),n?.star\
                tsWith(\"DIR#\")&&(i.DirectoryId="
              - "n.substring(4))),Object.keys(i).length>0?i={...i,...a}:console\
                .error(\"vdxUnMarsh\\"
              - "allMany:error::couldn't comprehend item, skipping I
                guess??\",s,y(s))):i=s,[i]});"
              - "return console.log(`${e}::output`,r,y(r)),l(r)}catch(r){let
                s=typeof r==\"string\"?"
              - "new
                Error(r):r,o={message:\"internalServerError\",detail:s.message,\
                errorSource:\"SE\\"
              - "RVER\",originalError:s};return
                console.error(`${e}::error`,o,y(o)),p(o)}},Ve=()=>{"
              - "function
                t(r){if(process.env[r]&&(process.env[r]||\"\").length>0)return
                l(process."
              - "env[r]);{let s={message:\"internalServerError\",detail:`${r}
                not set`,errorSource:\"\\"
              - "SERVER\"};return console.error(s),p(s)}}let
                e={Destinations:\"\",Directories:\"\",Memberships:\"\"};"
              - "if(process.env.NODE_ENV===\"test\")console.debug(\"NODE_ENV=te\
                st, setting TABLES to\\"
              - " test
                values\"),e.Destinations=\"aws-connect-directory_destinations\"\
                ,e.Directories="
              - "\"aws-connect-directory_directories\",e.Memberships=\"aws-conn\
                ect-directory_members\\"
              - "hips\";else{let
                r=t(\"DDB_TABLE_DESTINATION\");if(r.isErr())return
                r;e.Destinations="
              - "r.value;let s=t(\"DDB_TABLE_DIRECTORY\");if(s.isErr())return
                s;e.Directories=s.value;"
              - "let o=t(\"DDB_TABLE_MEMBERSHIP\");if(o.isErr())return
                o;e.Memberships=o.value}return l("
              - "e)};var X=async(t,e,r={})=>{let
                s=\"api.aws-dynamodb.getDestDirRecordById\";console.debug("
              - "`${s}::input`,{dataType:t,id:e,props:r});let
                o=r.errWhenNone||!1;try{let n=$(t,{"
              - "pkValue:e});if(n.isErr())return
                n;let{pkName:a,pkValue:i,skName:c,skValue:u,tableName:m}=n."
              - "value,d={TableName:m};if(a&&i)d.Key={[a]:i};else return
                p({message:\"internalServ\\"
              - "erError\",errorSource:\"SERVER\"});c&&u&&(d.Key[c]=u),g(`${s}:\
                :GetCommandInput`,d);"
              - "let f=await A.send(new
                Le.GetCommand(d));g(`${s}::GetCommandOutput`,f);let{Item:b}=f;"
              - "if(!b&&o){let h=\"Item not found\";throw g(`${s}:`,h,y(f)),new
                Error(`${s}: ${h}`)}"
              - "return console.debug(`${s}::outputting`,b),l(b)}catch(n){let
                a=typeof n==\"string\"?"
              - "new
                Error(n):n,i={message:\"internalServerError\",detail:a.message,\
                errorSource:\"SE\\"
              - "RVER\",originalError:a};return
                console.error(`${s}::error`,i,y(i)),p(i)}};var
                P=require(\"@aws-sdk/lib-dynamodb\");var se=async(t,e)=>{let
                r=\"api.aws-dynamodb.memberships.createMembership\";console."
              - "log(`${r}::input`,{membershipItem:t,props:e});let
                s=ut(t);if(s.isErr())return s;"
              - "let{DestinationId:o,DirectoryId:n,...a}=t;try{let i=await
                ue(o);if(i.isErr())return i;"
              - "if(!i.value)return
                p({message:\"resource.memberships.validation.destinationNotFou\
                \\"
              - "nd\",errorSource:\"CLIENT\"});let{Description:c,Synonyms:u}=i.\
                value,m=u.map(We=>We."
              - "Value),d=await
                ie({caller:r,destinationId:o,directories:[n],synonyms:m});if(d.\
                isErr())"
              - "return d;if(d.value.length>0)return
                p({message:\"resources.memberships.validation\\"
              - ".duplicateSynonymsAcrossDirectories\",data:d.value,errorSource:\
                \"CLIENT\"});let f=await ae("
              - "n);if(f.isErr())return f;if(!f.value)return
                p({message:\"resource.memberships.val\\"
              - "idation.directoryNotFound\",errorSource:\"CLIENT\"});let{Descr\
                iption:b}=f.value,h=$("
              - "\"memberships\",{pkValue:o,skValue:n});if(h.isErr())return
                h;let{pkName:j,pkValue:q,"
              - "skName:k,skValue:F,tableName:Z}=h.value,R={...a,DestinationNam\
                e:c,DirectoryName:b,"
              - "Synonyms:m,LastModifiedDateTime:new
                Date().toISOString()},C={TableName:Z,Item:{[j]:q,"
              - "[k]:F,...R},Expected:{[k]:{Exists:!1}},ReturnValues:\"NONE\"};\
                g(`${r}::PutCommandI\\"
              - "nput`,C);let D=await A.send(new
                P.PutCommand(C));g(`${r}::PutCommandOutput`,D);let W={"
              - "DestinationId:o,DirectoryId:n,...R};console.debug(`${r}::outpu\
                tting`,W);let K=J("
              - "W);return
                K.isErr()?K:K.value?l(K.value):p({message:\"internalServerError\
                \",errorSource:\"\\"
              - "SERVER\"})}catch(i){let c=typeof i==\"string\"?new
                Error(i):i,u={message:\"internalS\\"
              - "erverError\",detail:c.message,errorSource:\"SERVER\",originalE\
                rror:c};return console."
              - "error(`${r}::error`,u,y(u)),p(u)}};var ut=t=>{let
                e=\"api.aws-dynamodb.memberships._checkRequiredMembershipAttrib\
                ute\\"
              - "s\",{DestinationId:r,DirectoryId:s}=t,o;return r?s?o=l(void
                0):o=p({message:\"reso\\"
              - "urce.memberships.validation.missingDirectoryId\",errorSource:\
                \"CLIENT\"}):o=p({message:\"\\"
              - "resource.memberships.validation.missingDestinationId\",errorSo\
                urce:\"CLIENT\"}),o.isErr()&&"
              - "console.error(`${e}::error`,o.error.message,t,y(t)),o};var
                Ue=t=>{let
                e=\"api.aws-dynamodb.directories.calculateDirectoryStatus\",r=\
                \"UNKN\\"
              - "OWN\";try{let s=t.Metadata;if(s){let o=s.LastBuildAttempt?new
                Date(s.LastBuildAttempt)."
              - "getTime():0,n=s.LastBuildFailure?new
                Date(s.LastBuildFailure).getTime():0,a=s.LastBuildSuccess?"
              - "new
                Date(s.LastBuildSuccess).getTime():0,i=s.LastBuildableEvent?new
                Date(s.LastBuildableEvent)."
              - "getTime():0,c=s.IsBroken??!1,u=s.IsBuilt??!1,m=s.IsLicenseErro\
                r??!1,d=s.IsRollingBack??"
              - "!1,f=a>n?a:n;m?r=\"LICENSE_ERROR\":d?u?r=\"STOPPING_UPDATE\":r=\
                \"STOPPING_BUILD\":c?r="
              - "\"NEEDS_REPAIR\":i>o?r=\"ASSESSING\":o>f?u?r=\"UPDATING\":r=\"\
                BUILDING\":a>n?r=\"IN_SYNC\":"
              - "o==0?r=\"UNKNOWN\":u?r=\"OUT_OF_SYNC\":r=\"NOT_BUILT\"}}catch(\
                s){let o=s,n=`${e}::unex\\"
              - "pected
                exception:${o.message}`;console.error(n,o,y(o))}finally{return
                r}},ae=async(t,e={})=>lt("
              - "await X(\"directories\",t,e));var dt=t=>{let e=t;return
                e&&(e.Metadata||(e.Metadata={}),e.Metadata.DirectoryStatus="
              - "Ue(e)),e},lt=t=>t.isErr()?t:l(dt(t.value));var ie=async t=>{let
                e=\"api.aws-dynamodb.destinations.checkDestinationSynonymCon\\"
              - "flicts\",{caller:r,destinationId:s,directories:o,synonyms:n}=t\
                ;try{console.log(`${r}\\"
              - ":${e}::props`,t);let a=[],i={};n.forEach((d,f)=>{let
                b=`:synonym${f}`;a.push(`co\\"
              - "ntains(Synonyms, ${b})`),i[b]=d});let
                c=o.filter(d=>d.trim().length>0).flatMap(async d=>{"
              - "let
                f=[],b=$(\"memberships\",{pkValue:s,skValue:d});if(b.isErr())re\
                turn console.error("
              - "`${r}:${e}::tableInfoResult -- falling back to return no
                conflicts for destinati\\"
              - "on ${s} and directory ${d} because of
                error:`,b,y(b)),[];let{skIndex:h,pkName:j,"
              - "pkValue:q,skName:k,skValue:F,tableName:Z}=b.value;if(!h||!j||!\
                q||!k||!F)return console."
              - "error(`${r}:${e}::tableInfoResult -- falling back to return no
                conflicts for des\\"
              - "tination ${s} and directory ${d} because didn't get all
                required values, got thi\\"
              - "s instead:`,b.value),[];try{let
                R={TableName:Z,IndexName:h,KeyConditions:{[k]:{ComparisonOperat\
                or:\"\\"
              - "EQ\",AttributeValueList:[F]}},FilterExpression:`(NOT ${j} =
                :pk) AND (${a.join(\" \\"
              - "OR
                \")})`,ExpressionAttributeValues:{\":pk\":q,...i}};g(`${r}:${e}\
                ::queryCommandInp\\"
              - "ut`,R,y(R));let C=await A.send(new
                ce.QueryCommand(R));g(`${r}:${e}::queryComman\\"
              - "dResult`,C,y(C)),C.Items?(g(`${r}:${e}::queryCommandResult.Ite\
                ms`,C.Items,y(C.Items)),"
              - "f=C.Items.map(D=>({DestinationId:D.DestinationId,DestinationNa\
                me:D.DestinationName,"
              - "DirectoryName:D.DirectoryName,ConflictSynonyms:D.Synonyms.filt\
                er(W=>n.includes(W))}))):"
              - "g(`${r}:${e}::queryCommandResult.Items is undefined, returning
                empty list`)}catch(R){"
              - "let
                D=`${r}:${e}::${R.message}`;console.error(D,R)}finally{return
                g(`${r}:${e}::\\"
              - "oneDirectoryOutput`,f,y(f)),Promise.resolve(f)}});g(`${r}:${e}\
                ::promises`,c,y(c));"
              - "let u=await Promise.all(c);g(`${r}:${e}::resolved`,u,y(u));let
                m=u.flat();return console."
              - "log(`${r}:${e}::output`,m,y(m)),l(m)}catch(a){let
                i=a,c=`${r}:${e}::${i.message}`;"
              - "return
                console.error(c,a),p({message:\"internalServerError\",detail:i.\
                message,errorSource:\"\\"
              - "SERVER\",originalError:i})}},ue=async(t,e={})=>X(\"destinations\
                \",t,e);var Be=\"memberships\",Et=async t=>{let
                e=\"memberships.post\";(!process.env.NODE_ENV||"
              - "process.env.NODE_ENV!==\"test\")&&console.debug(`${e}::event`,\
                t,btoa(JSON.stringify("
              - "t)));let r=v(e,`POST /${Be}`,t);if(r.isErr())return r.error;let
                s=me(Re(t));if(s."
              - "isErr())return s.error;let
                o={...s.value,VoiceEnabled:s.value.VoiceEnabled??!0,ChatEnabled\
                :s."
              - "value.ChatEnabled??!0,ExternalEnabled:s.value.ExternalEnabled?\
                ?!0},n=await se(o,"
              - "{});if(n.isErr())return
                re(n.error);console.log(`${e}::output`,n.value,y(n.value));"
              - "let
                a={...n.value,MembershipId:`${o.DestinationId}-${o.DirectoryId}\
                `};return O(l("
              - "{model:Be,table:\"Memberships\",input:{TableName:\"lol\",Key:{\
                pk:\"a\"}},action:\"Creat\\"
              - "e\",data:[a]}))};var je={\"POST /memberships\":Et};var gt=async
                t=>{let
                e=\"memberships.deleteId\",r=\"memberships\",s=\"DestinationId\
                \","
              - "o=\"DirectoryId\";(!process.env.NODE_ENV||process.env.NODE_ENV\
                !==\"test\")&&console."
              - "debug(`${e}::event`,t,btoa(JSON.stringify(t)));let
                n=v(e,`DELETE /${r}/{Membersh\\"
              - "ipId}`,t);if(n.isErr())return n.error;let
                a=B(e,t.pathParameters);if(a.isErr())return a."
              - "error;let[i,c]=a.value,u=Oe(r,e,s,i);if(u.isErr())return
                u.error;let m=u.value.input;"
              - "if(!m||m===void 0||m===null)return{statusCode:500,body:`${e}:
                deleteCommand.valu\\"
              - "e.input is undefined`};if(!m.Key||m.Key===void
                0||m.Key===null)return{statusCode:500,"
              - "body:`${e}: deleteCommand.value.input.Key is
                undefined`};m.Key[o]=c,u.value.input="
              - "m;let d=await Ne(e,u);return O(d)};var qe={\"DELETE
                /memberships/{MembershipId}\":gt};var bt=async(t,e)=>await
                S(\"memberships\",t,e,Fe.routes),B=(t,e)=>{if(!e||e===void 0)"
              - "return p({statusCode:500,body:`${t}: pathParameters is
                undefined`});let s=Ce(t,\"\\"
              - "MembershipId\",e,!1);return
                s.isErr()?s:l(s.value.split(\"-\"))},me=t=>{if(t.isErr())"
              - "return t;let e=\"memberships._parseMembership\";try{let
                r=JSON.parse(t.value);if(!r."
              - "DestinationId||typeof
                r.DestinationId!=\"string\"||r.DestinationId.length==0)throw new
                Error("
              - "\"DestinationId is required\");if(!r.DirectoryId||typeof
                r.DirectoryId!=\"string\"||"
              - "r.DirectoryId.length==0)throw new Error(\"DestinationId is
                required\");let s=\"\";if(r."
              - "DirectoryId){if(typeof r.DestinationId!=\"string\")throw new
                Error(\"DestinationId \\"
              - "must be a string\");if(r.DestinationId.length!=V)throw new
                Error(\"DestinationId m\\"
              - "ust be ${ITEM_ID_SIZE} characters\");s=r.DestinationId}let
                o=\"\";if(r.DirectoryId){"
              - "if(typeof r.DirectoryId!=\"string\")throw new
                Error(\"DirectoryId must be a string\");"
              - "if(r.DirectoryId.length!=V)throw new Error(\"DirectoryId must
                be ${ITEM_ID_SIZE} \\"
              - "characters\");o=r.DirectoryId}return
                l({DestinationId:s,DirectoryId:o})}catch(r){"
              - "let o=`${e}::${r.message}`;return
                console.error(o,r),p({statusCode:400,body:o})}},"
              - "Fe={routes:{...Te,...je,...qe,...Se}};"
      Description: "v1.1.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          DDB_TABLE_DESTINATION:
            Ref: "DdbDestinations37B2F70F"
          DDB_TABLE_DIRECTORY:
            Ref: "DdbDirectories26458382"
          DDB_TABLE_MEMBERSHIP:
            Ref: "DdbMemberships1A816D0C"
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "ApiMembershipsLambdaServiceRole8A860401"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn:
      - "ApiMembershipsLambdaServiceRoleDefaultPolicy02559B55"
  ApiVocaldexApiGatewayDC476A64:
    Type: "AWS::ApiGatewayV2::Api"
    Properties:
      CorsConfiguration:
        AllowCredentials: false
        AllowHeaders:
          - "*"
        AllowMethods:
          - "*"
        AllowOrigins:
          - "*"
        ExposeHeaders:
          - "*"
          - "x-total-count"
        MaxAge: 0
      DisableExecuteApiEndpoint: false
      Name: "VocaldexApiGateway"
      ProtocolType: "HTTP"
  ApiVocaldexApiGatewayDefaultStageEB2C9F0D:
    Type: "AWS::ApiGatewayV2::Stage"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AutoDeploy: true
      StageName: "$default"
  ApiVocaldexApiGatewayGETapicognitoUsersCognitoUsersIntegration7DF9B578:
    Type: "AWS::ApiGatewayV2::Integration"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      IntegrationType: "AWS_PROXY"
      IntegrationUri:
        Fn::GetAtt:
          - "ApiCognitoUsersLambdaBEE7102E"
          - "Arn"
      PayloadFormatVersion: "2.0"
  ApiVocaldexApiGatewayGETapicognitoUsersCognitoUsersIntegrationPermission9471491E:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiCognitoUsersLambdaBEE7102E"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/cognitoUsers"
  ApiVocaldexApiGatewayGETapicognitoUsers9268D2E2:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/cognitoUsers"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapicognitoUsersCognitoUsersIntegration7DF9B578"
  ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9:
    Type: "AWS::ApiGatewayV2::Authorizer"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizerType: "JWT"
      IdentitySource:
        - "$request.header.Authorization"
      JwtConfiguration:
        Audience:
          - Ref: "CognitoUserPoolUserPoolClient1E6BF456"
        Issuer:
          Fn::Join:
            - ""
            - - "https://cognito-idp."
              - Ref: "AWS::Region"
              - ".amazonaws.com/"
              - Ref: "CognitoUserPool279BBD48"
      Name: "CognitoAuthorizer"
  ApiVocaldexApiGatewayPOSTapicognitoUsersCognitoUsersIntegrationPermission50F4EC1E:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiCognitoUsersLambdaBEE7102E"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/cognitoUsers"
  ApiVocaldexApiGatewayPOSTapicognitoUsers35FE14F2:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "POST /api/cognitoUsers"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapicognitoUsersCognitoUsersIntegration7DF9B578"
  ApiVocaldexApiGatewayDELETEapicognitoUsersIdCognitoUsersIntegrationPermission8418BD74:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiCognitoUsersLambdaBEE7102E"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/cognitoUsers/{Id}"
  ApiVocaldexApiGatewayDELETEapicognitoUsersId53D668B2:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "DELETE /api/cognitoUsers/{Id}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapicognitoUsersCognitoUsersIntegration7DF9B578"
  ApiVocaldexApiGatewayGETapicognitoUsersIdCognitoUsersIntegrationPermissionC26100E4:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiCognitoUsersLambdaBEE7102E"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/cognitoUsers/{Id}"
  ApiVocaldexApiGatewayGETapicognitoUsersId58AEFED7:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/cognitoUsers/{Id}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapicognitoUsersCognitoUsersIntegration7DF9B578"
  ApiVocaldexApiGatewayPUTapicognitoUsersIdCognitoUsersIntegrationPermission485DFABD:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiCognitoUsersLambdaBEE7102E"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/cognitoUsers/{Id}"
  ApiVocaldexApiGatewayPUTapicognitoUsersId2E7174CF:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "PUT /api/cognitoUsers/{Id}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapicognitoUsersCognitoUsersIntegration7DF9B578"
  ApiVocaldexApiGatewayPOSTapicognitoUserusecaseCognitoUserRpcIntegrationE263E79E:
    Type: "AWS::ApiGatewayV2::Integration"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      IntegrationType: "AWS_PROXY"
      IntegrationUri:
        Fn::GetAtt:
          - "ApiCognitoUserRpcLambda6E542BFD"
          - "Arn"
      PayloadFormatVersion: "2.0"
  ApiVocaldexApiGatewayPOSTapicognitoUserusecaseCognitoUserRpcIntegrationPermission90697272:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiCognitoUserRpcLambda6E542BFD"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/cognitoUser/{usecase}"
  ApiVocaldexApiGatewayPOSTapicognitoUserusecase1305A694:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "POST /api/cognitoUser/{usecase}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayPOSTapicognitoUserusecaseCognitoUserRpcIntegrationE2\
                63E79E"
  ApiVocaldexApiGatewayGETapiconnectUsersConnectUsersIntegration5F0C0CD3:
    Type: "AWS::ApiGatewayV2::Integration"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      IntegrationType: "AWS_PROXY"
      IntegrationUri:
        Fn::GetAtt:
          - "ApiConnectUsersLambdaF0F730FD"
          - "Arn"
      PayloadFormatVersion: "2.0"
  ApiVocaldexApiGatewayGETapiconnectUsersConnectUsersIntegrationPermissionD77D1932:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiConnectUsersLambdaF0F730FD"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/connectUsers"
  ApiVocaldexApiGatewayGETapiconnectUsers849F9DDC:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/connectUsers"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapiconnectUsersConnectUsersIntegration5F0C0CD3"
  ApiVocaldexApiGatewayGETapiconnectUsersIdConnectUsersIntegrationPermissionADF779F6:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiConnectUsersLambdaF0F730FD"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/connectUsers/{Id}"
  ApiVocaldexApiGatewayGETapiconnectUsersIdD837990B:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/connectUsers/{Id}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapiconnectUsersConnectUsersIntegration5F0C0CD3"
  ApiVocaldexApiGatewayGETapidestinationsDestinationsIntegration98A1D247:
    Type: "AWS::ApiGatewayV2::Integration"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      IntegrationType: "AWS_PROXY"
      IntegrationUri:
        Fn::GetAtt:
          - "ApiDestinationsLambdaBABF64D8"
          - "Arn"
      PayloadFormatVersion: "2.0"
  ApiVocaldexApiGatewayGETapidestinationsDestinationsIntegrationPermissionFD27CF2E:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDestinationsLambdaBABF64D8"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/destinations"
  ApiVocaldexApiGatewayGETapidestinations8C48AB09:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/destinations"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidestinationsDestinationsIntegration98A1D247"
  ApiVocaldexApiGatewayPOSTapidestinationsDestinationsIntegrationPermission3B590652:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDestinationsLambdaBABF64D8"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/destinations"
  ApiVocaldexApiGatewayPOSTapidestinations45139FA3:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "POST /api/destinations"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidestinationsDestinationsIntegration98A1D247"
  ApiVocaldexApiGatewayDELETEapidestinationsDestinationIdDestinationsIntegrationPermission7C4E84BC:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDestinationsLambdaBABF64D8"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/destinations/{DestinationId}"
  ApiVocaldexApiGatewayDELETEapidestinationsDestinationId9A835996:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "DELETE /api/destinations/{DestinationId}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidestinationsDestinationsIntegration98A1D247"
  ApiVocaldexApiGatewayGETapidestinationsDestinationIdDestinationsIntegrationPermission1C1DEB99:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDestinationsLambdaBABF64D8"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/destinations/{DestinationId}"
  ApiVocaldexApiGatewayGETapidestinationsDestinationId17FBD7DE:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/destinations/{DestinationId}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidestinationsDestinationsIntegration98A1D247"
  ApiVocaldexApiGatewayPUTapidestinationsDestinationIdDestinationsIntegrationPermission552EBCE0:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDestinationsLambdaBABF64D8"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/destinations/{DestinationId}"
  ApiVocaldexApiGatewayPUTapidestinationsDestinationId31225391:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "PUT /api/destinations/{DestinationId}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidestinationsDestinationsIntegration98A1D247"
  ApiVocaldexApiGatewayGETapidirectoriesDirectoriesIntegrationBC2520FF:
    Type: "AWS::ApiGatewayV2::Integration"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      IntegrationType: "AWS_PROXY"
      IntegrationUri:
        Fn::GetAtt:
          - "ApiDirectoriesLambda04D7F3F1"
          - "Arn"
      PayloadFormatVersion: "2.0"
  ApiVocaldexApiGatewayGETapidirectoriesDirectoriesIntegrationPermission0C50103B:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDirectoriesLambda04D7F3F1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/directories"
  ApiVocaldexApiGatewayGETapidirectories8388EEC6:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/directories"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidirectoriesDirectoriesIntegrationBC2520FF"
  ApiVocaldexApiGatewayPOSTapidirectoriesDirectoriesIntegrationPermissionEA5C4CC9:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDirectoriesLambda04D7F3F1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/directories"
  ApiVocaldexApiGatewayPOSTapidirectories9984D449:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "POST /api/directories"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidirectoriesDirectoriesIntegrationBC2520FF"
  ApiVocaldexApiGatewayDELETEapidirectoriesDirectoryIdDirectoriesIntegrationPermission0FDDB278:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDirectoriesLambda04D7F3F1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/directories/{DirectoryId}"
  ApiVocaldexApiGatewayDELETEapidirectoriesDirectoryId68923998:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "DELETE /api/directories/{DirectoryId}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidirectoriesDirectoriesIntegrationBC2520FF"
  ApiVocaldexApiGatewayGETapidirectoriesDirectoryIdDirectoriesIntegrationPermission59A01F4D:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDirectoriesLambda04D7F3F1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/directories/{DirectoryId}"
  ApiVocaldexApiGatewayGETapidirectoriesDirectoryId732EF1C0:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/directories/{DirectoryId}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidirectoriesDirectoriesIntegrationBC2520FF"
  ApiVocaldexApiGatewayPUTapidirectoriesDirectoryIdDirectoriesIntegrationPermission451B7D00:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDirectoriesLambda04D7F3F1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/directories/{DirectoryId}"
  ApiVocaldexApiGatewayPUTapidirectoriesDirectoryId2E944C78:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "PUT /api/directories/{DirectoryId}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidirectoriesDirectoriesIntegrationBC2520FF"
  ApiVocaldexApiGatewayPOSTapidirectoriesDirectoryIdactionDirectoriesIntegrationPermission23DBC1CB:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiDirectoriesLambda04D7F3F1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/directories/{DirectoryId}/{action}"
  ApiVocaldexApiGatewayPOSTapidirectoriesDirectoryIdactionDA292D1A:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "POST /api/directories/{DirectoryId}/{action}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapidirectoriesDirectoriesIntegrationBC2520FF"
  ApiVocaldexApiGatewayGETapicheckLicenseCheckLicenseIntegration2FFCD02F:
    Type: "AWS::ApiGatewayV2::Integration"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      IntegrationType: "AWS_PROXY"
      IntegrationUri:
        Fn::GetAtt:
          - "ApiCheckLicenseLambda95B67792"
          - "Arn"
      PayloadFormatVersion: "2.0"
  ApiVocaldexApiGatewayGETapicheckLicenseCheckLicenseIntegrationPermission8DB7F977:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiCheckLicenseLambda95B67792"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/checkLicense"
  ApiVocaldexApiGatewayGETapicheckLicense88F2BB97:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/checkLicense"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapicheckLicenseCheckLicenseIntegration2FFCD02F"
  ApiVocaldexApiGatewayGETapimembershipsMembershipsIntegration5A7B9DEF:
    Type: "AWS::ApiGatewayV2::Integration"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      IntegrationType: "AWS_PROXY"
      IntegrationUri:
        Fn::GetAtt:
          - "ApiMembershipsLambdaCB6878A1"
          - "Arn"
      PayloadFormatVersion: "2.0"
  ApiVocaldexApiGatewayGETapimembershipsMembershipsIntegrationPermissionC0A57775:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiMembershipsLambdaCB6878A1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/memberships"
  ApiVocaldexApiGatewayGETapimembershipsD3BA769A:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/memberships"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapimembershipsMembershipsIntegration5A7B9DEF"
  ApiVocaldexApiGatewayPOSTapimembershipsMembershipsIntegrationPermission96B8082C:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiMembershipsLambdaCB6878A1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/memberships"
  ApiVocaldexApiGatewayPOSTapimemberships0F5A8F75:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "POST /api/memberships"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapimembershipsMembershipsIntegration5A7B9DEF"
  ApiVocaldexApiGatewayDELETEapimembershipsMembershipIdMembershipsIntegrationPermission78BFD363:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiMembershipsLambdaCB6878A1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/memberships/{MembershipId}"
  ApiVocaldexApiGatewayDELETEapimembershipsMembershipId2F98C08C:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "DELETE /api/memberships/{MembershipId}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapimembershipsMembershipsIntegration5A7B9DEF"
  ApiVocaldexApiGatewayGETapimembershipsMembershipIdMembershipsIntegrationPermission774BAE2B:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName:
        Fn::GetAtt:
          - "ApiMembershipsLambdaCB6878A1"
          - "Arn"
      Principal: "apigateway.amazonaws.com"
      SourceArn:
        Fn::Join:
          - ""
          - - "arn:"
            - Ref: "AWS::Partition"
            - ":execute-api:"
            - Ref: "AWS::Region"
            - ":"
            - Ref: "AWS::AccountId"
            - ":"
            - Ref: "ApiVocaldexApiGatewayDC476A64"
            - "/*/*/api/memberships/{MembershipId}"
  ApiVocaldexApiGatewayGETapimembershipsMembershipIdAC48473C:
    Type: "AWS::ApiGatewayV2::Route"
    Properties:
      ApiId:
        Ref: "ApiVocaldexApiGatewayDC476A64"
      AuthorizationType: "JWT"
      AuthorizerId:
        Ref: "ApiVocaldexApiGatewayCognitoAuthorizer04A4DBF9"
      RouteKey: "GET /api/memberships/{MembershipId}"
      Target:
        Fn::Join:
          - ""
          - - "integrations/"
            - Ref: "ApiVocaldexApiGatewayGETapimembershipsMembershipsIntegration5A7B9DEF"
  UiBucket1AF1E1A8:
    Type: "AWS::S3::Bucket"
    Properties:
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              SSEAlgorithm: "AES256"
      OwnershipControls:
        Rules:
          - ObjectOwnership: "ObjectWriter"
      PublicAccessBlockConfiguration:
        BlockPublicAcls: false
        BlockPublicPolicy: false
        IgnorePublicAcls: false
        RestrictPublicBuckets: false
      Tags:
        - Key: "aws-cdk:cr-owned:f4ab420d"
          Value: "true"
      WebsiteConfiguration:
        ErrorDocument: "error.html"
        IndexDocument: "index.html"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  UiBucketPolicy9CAFB719:
    Type: "AWS::S3::BucketPolicy"
    Properties:
      Bucket:
        Ref: "UiBucket1AF1E1A8"
      PolicyDocument:
        Statement:
          - Action: "s3:GetObject"
            Condition:
              StringLike:
                aws:Referer:
                  - Fn::GetAtt:
                      - "UiBucket1AF1E1A8"
                      - "Arn"
                  - Fn::Join:
                      - ""
                      - - Fn::GetAtt:
                            - "UiBucket1AF1E1A8"
                            - "Arn"
                        - "/*"
            Effect: "Allow"
            Principal:
              AWS: "*"
            Resource:
              Fn::Join:
                - ""
                - - Fn::GetAtt:
                      - "UiBucket1AF1E1A8"
                      - "Arn"
                  - "/*"
        Version: "2012-10-17"
  UiDistribution1123DB5B:
    Type: "AWS::CloudFront::Distribution"
    Properties:
      DistributionConfig:
        CacheBehaviors:
          - AllowedMethods:
              - "GET"
              - "HEAD"
              - "OPTIONS"
              - "PUT"
              - "PATCH"
              - "POST"
              - "DELETE"
            CachePolicyId: "4135ea2d-6df8-44a3-9df3-4b5a84be39ad"
            Compress: true
            OriginRequestPolicyId: "b689b0a8-53d0-40ab-baf2-68738e2966ac"
            PathPattern: "/api/*"
            TargetOriginId: "api"
            ViewerProtocolPolicy: "redirect-to-https"
        Comment: "Vocaldex"
        DefaultCacheBehavior:
          CachePolicyId: "658327ea-f89d-4fab-a63d-7e88639e58f6"
          Compress: true
          TargetOriginId: "s3"
          ViewerProtocolPolicy: "allow-all"
        Enabled: true
        HttpVersion: "http2"
        IPV6Enabled: true
        Origins:
          - CustomOriginConfig:
              OriginProtocolPolicy: "http-only"
              OriginSSLProtocols:
                - "TLSv1.2"
            DomainName:
              Fn::Select:
                - 2
                - Fn::Split:
                    - "/"
                    - Fn::GetAtt:
                        - "UiBucket1AF1E1A8"
                        - "WebsiteURL"
            Id: "s3"
            OriginCustomHeaders:
              - HeaderName: "Referer"
                HeaderValue:
                  Fn::GetAtt:
                    - "UiBucket1AF1E1A8"
                    - "Arn"
          - CustomOriginConfig:
              OriginProtocolPolicy: "https-only"
              OriginSSLProtocols:
                - "TLSv1.2"
            DomainName:
              Fn::Join:
                - ""
                - - Ref: "ApiVocaldexApiGatewayDC476A64"
                  - ".execute-api."
                  - Ref: "AWS::Region"
                  - "."
                  - Ref: "AWS::URLSuffix"
            Id: "api"
        PriceClass: "PriceClass_100"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  UiPublishAwsCliLayerA79D2F27:
    Type: "AWS::Lambda::LayerVersion"
    Properties:
      Content:
        S3Bucket: "mp-saas-integrations"
        S3Key: "cfn-mp-ql-asa-solutions-vocaldex-enhanced-engagement/templates/asset.33\
          22b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip"
      Description: "/opt/awscli/aws"
  UiPublishCustomResource8AAA9618:
    Type: "Custom::CDKBucketDeployment"
    Properties:
      ServiceToken:
        Fn::GetAtt:
          - "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536"
          - "Arn"
      SourceBucketNames:
        - "mp-saas-integrations"
      SourceObjectKeys:
        - "cfn-mp-ql-asa-solutions-vocaldex-enhanced-engagement/templates/asset\
          .45992c2994f7f796da4d988c7d41e38564e61905651153de656fa084acc2279b.zip"
      DestinationBucketName:
        Ref: "UiBucket1AF1E1A8"
      Prune: true
      DistributionId:
        Ref: "UiDistribution1123DB5B"
      DestinationBucketArn:
        Fn::GetAtt:
          - "UiBucket1AF1E1A8"
          - "Arn"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  UiConfiguratorLambdaServiceRole7A409F60:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  UiConfiguratorLambdaServiceRoleDefaultPolicy8C508331:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "s3:Abort*"
              - "s3:DeleteObject*"
              - "s3:GetBucket*"
              - "s3:GetObject*"
              - "s3:List*"
              - "s3:PutObject"
              - "s3:PutObjectLegalHold"
              - "s3:PutObjectRetention"
              - "s3:PutObjectTagging"
              - "s3:PutObjectVersionTagging"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "UiPublishCustomResource8AAA9618"
                  - "DestinationBucketArn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "UiPublishCustomResource8AAA9618"
                        - "DestinationBucketArn"
                    - "/*"
          - Action: "cloudfront:CreateInvalidation"
            Effect: "Allow"
            Resource:
              Fn::Join:
                - ""
                - - "arn:"
                  - Ref: "AWS::Partition"
                  - ":cloudfront::"
                  - Ref: "AWS::AccountId"
                  - ":distribution/"
                  - Ref: "UiDistribution1123DB5B"
        Version: "2012-10-17"
      PolicyName: "UiConfiguratorLambdaServiceRoleDefaultPolicy8C508331"
      Roles:
        - Ref: "UiConfiguratorLambdaServiceRole7A409F60"
    Metadata:
      cfn-lint:
        config:
          ignore_checks:
            - "E9101"
            - "EIAMPolicyActionWildcard"
            - "EIAMPolicyWildcardResource"
          ignore_checks_reasons:
            E9101: "'abort' may be intepreted as a biased term; but it's the name of the
              operation."
            EIAMPolicyActionWildcard: "This is the policy generated by CDK."
            EIAMPolicyWildcardResource: "This is the policy generated by CDK."
  UiConfiguratorLambda6CE847B2:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var a=Object.defineProperty;var
                d=Object.getOwnPropertyDescriptor;var
                l=Object.getOwnPropertyNames;var
                u=Object.prototype.hasOwnProperty;var I=(n,t)=>{for(var i in
                t)a(n,i,{get:t[i],enumerable:!0})},p=(n,t,i,_)=>{if(t&&"
              - "typeof t==\"object\"||typeof t==\"function\")for(let o of
                l(t))!u.call(n,o)&&o!==i&&"
              - "a(n,o,{get:()=>t[o],enumerable:!(_=d(t,o))||_.enumerable});ret\
                urn n};var D=n=>p(a({},\"__esModule\",{value:!0}),n);var
                m={};I(m,{main:()=>f});module.exports=D(m);var
                C=require(\"@aws-sdk/client-cloudfront\"),"
              - "r=require(\"@aws-sdk/client-s3\"),T={};process.env.hasOwnPrope\
                rty(\"S3DEPLOY_AWS_RE\\"
              - "GION\")&&process.env.S3DEPLOY_AWS_REGION?T={region:process.env\
                .S3DEPLOY_AWS_REGION}:"
              - "T={region:\"us-east-1\"};var
                O={};process.env.hasOwnProperty(\"CLOUDFRONT_AWS_REGIO\\"
              - "N\")&&process.env.CLOUDFRONT_AWS_REGION?O={region:process.env.\
                CLOUDFRONT_AWS_REGION}:"
              - "O={region:\"us-east-1\"};var e={S3_BUCKET_NAME:void
                0,S3_OBJECT_KEY:void 0,S3_OBJECT_STORAGE_CLASS:\"\\"
              - "STANDARD\",S3_OBJECT_TAGGING:\"\",CLOUDFRONT_DISTRIBUTION_ID:v\
                oid 0};Object.keys(e)."
              - "forEach(n=>{if(process.env.hasOwnProperty(n)&&process.env[n])e\
                [n]=process.env[n];else if(n."
              - "startsWith(\"S3_OBJECT_METADATA_\")){e.S3_OBJECT_METADATA||(e.\
                S3_OBJECT_METADATA={});"
              - "let[t,...i]=e.S3_OBJECT_METADATA[n].split(\"=\");e.S3_OBJECT_M\
                ETADATA[t]=i.join(\"\")}});"
              - "Object.keys(e).forEach(n=>{if(e[n]===void 0)throw new
                Error(`Missing required en\\"
              - "vironment variable ${n}`)});var
                f=async(...n)=>{console.log(n);let t=new r.S3Client("
              - "T),i=new C.CloudFrontClient(O),_=`"
              - "window.__RUNTIME_CONFIG__ = {"
              - "${Object.keys(process.env).filter(s=>s.startsWith(\"REACT_APP_\
                \")||s==\"PUBLIC_URL\")."
              - "map(s=>`  ${s}: \"${process.env[s]}\",`).join(`"
              - "`)}"
              - "};"
              - "  `.trim(),o={Bucket:e.S3_BUCKET_NAME,Key:e.S3_OBJECT_KEY,Stor\
                ageClass:\"STANDARD\","
              - "Body:_};e.S3_OBJECT_METADATA&&Object.keys(e.S3_OBJECT_METADATA\
                ).length>0&&(o.Metadata="
              - "e.S3_OBJECT_METADATA),e.S3_OBJECT_TAGGING!==\"\"&&(o.Tagging=e\
                .S3_OBJECT_TAGGING);"
              - "let c=new
                r.PutObjectCommand(o),E={DistributionId:e.CLOUDFRONT_DISTRIBUTI\
                ON_ID,InvalidationBatch:{"
              - "CallerReference:`${Date.now()}`,Paths:{Quantity:1,Items:[`/${e\
                .S3_OBJECT_KEY}`]}}},"
              - "A=new C.CreateInvalidationCommand(E);try{let s=await
                t.send(c);console.log(s);let S=await i."
              - "send(A);console.log(S)}catch(s){console.error(s)}};"
      Description: "v1.0.1 git:b19c64544e81f2fc0ce4137ff7223fd03e17ec8f"
      Environment:
        Variables:
          AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
          CLOUDFRONT_DISTRIBUTION_ID:
            Ref: "UiDistribution1123DB5B"
          PUBLIC_URL:
            Fn::Join:
              - ""
              - - "https://"
                - Fn::GetAtt:
                    - "UiDistribution1123DB5B"
                    - "DomainName"
                - "/"
          REACT_APP_COGNITO_CLIENT_ID:
            Ref: "CognitoUserPoolUserPoolClient1E6BF456"
          REACT_APP_COGNITO_MODE: "local"
          REACT_APP_COGNITO_USER_POOL_ID:
            Ref: "CognitoUserPool279BBD48"
          REACT_APP_PKGJSON_VERSION: "v1.0.3"
          REACT_APP_VOCALDEX_API_ENDPOINT:
            Fn::Join:
              - ""
              - - "https://"
                - Fn::GetAtt:
                    - "UiDistribution1123DB5B"
                    - "DomainName"
                - "/api"
          S3_BUCKET_NAME:
            Ref: "UiBucket1AF1E1A8"
          S3_OBJECT_KEY: "env.js"
      Handler: "index.main"
      Role:
        Fn::GetAtt:
          - "UiConfiguratorLambdaServiceRole7A409F60"
          - "Arn"
      Runtime: "nodejs20.x"
    DependsOn:
      - "UiConfiguratorLambdaServiceRoleDefaultPolicy8C508331"
  UiConfiguratorLambdaCurrentVersion378F637F3c31a4e4cd9a2daf512ee81408383a85:
    Type: "AWS::Lambda::Version"
    Properties:
      FunctionName:
        Ref: "UiConfiguratorLambda6CE847B2"
  UiInvokeConfigurator171959872263680426DAE:
    Type: "Custom::Trigger"
    Properties:
      ServiceToken:
        Fn::GetAtt:
          - "AWSCDKTriggerCustomResourceProviderCustomResourceProviderHandler97\
            BECD91"
          - "Arn"
      HandlerArn:
        Ref: "UiConfiguratorLambdaCurrentVersion378F637F3c31a4e4cd9a2daf512ee81408383a8\
          5"
      InvocationType: "RequestResponse"
      Timeout: "120000"
      ExecuteOnHandlerChange: true
    DependsOn:
      - "UiPublishAwsCliLayerA79D2F27"
      - "UiPublishCustomResource8AAA9618"
    UpdateReplacePolicy: "Delete"
    DeletionPolicy: "Delete"
  CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: "AWS::Partition"
              - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
  CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - "s3:GetBucket*"
              - "s3:GetObject*"
              - "s3:List*"
            Effect: "Allow"
            Resource:
              - Fn::Join:
                  - ""
                  - - "arn:"
                    - Ref: "AWS::Partition"
                    - ":s3:::mp-saas-integrations"
              - Fn::Join:
                  - ""
                  - - "arn:"
                    - Ref: "AWS::Partition"
                    - ":s3:::mp-saas-integrations/*"
          - Action:
              - "s3:Abort*"
              - "s3:DeleteObject*"
              - "s3:GetBucket*"
              - "s3:GetObject*"
              - "s3:List*"
              - "s3:PutObject"
              - "s3:PutObjectLegalHold"
              - "s3:PutObjectRetention"
              - "s3:PutObjectTagging"
              - "s3:PutObjectVersionTagging"
            Effect: "Allow"
            Resource:
              - Fn::GetAtt:
                  - "UiBucket1AF1E1A8"
                  - "Arn"
              - Fn::Join:
                  - ""
                  - - Fn::GetAtt:
                        - "UiBucket1AF1E1A8"
                        - "Arn"
                    - "/*"
          - Action:
              - "cloudfront:CreateInvalidation"
              - "cloudfront:GetInvalidation"
            Effect: "Allow"
            Resource: "*"
        Version: "2012-10-17"
      PolicyName: "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRo\
        leDefaultPolicy88902FDF"
      Roles:
        - Ref: "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01\
            265"
    Metadata:
      cfn-lint:
        config:
          ignore_checks:
            - "E9101"
            - "EIAMPolicyActionWildcard"
            - "EIAMPolicyWildcardResource"
          ignore_checks_reasons:
            E9101: "'abort' may be intepreted as a biased term; but it's the name of the
              operation."
            EIAMPolicyActionWildcard: "This is the IAM statement generated by CDK 'grantReadWrite'."
            EIAMPolicyWildcardResource: "This is the IAM statement generated by the CDK Construct."
  CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "import contextlib"
              - "import json"
              - "import logging"
              - "import os"
              - "import shutil"
              - "import subprocess"
              - "import tempfile"
              - "from urllib.request import Request, urlopen"
              - "from uuid import uuid4"
              - "from zipfile import ZipFile"
              - "import boto3"
              - "logger = logging.getLogger()"
              - "logger.setLevel(logging.INFO)"
              - "cloudfront = boto3.client('cloudfront')"
              - "s3 = boto3.client('s3')"
              - "CFN_SUCCESS = \"SUCCESS\""
              - "CFN_FAILED = \"FAILED\""
              - "ENV_KEY_MOUNT_PATH = \"MOUNT_PATH\""
              - "ENV_KEY_SKIP_CLEANUP = \"SKIP_CLEANUP\""
              - "AWS_CLI_CONFIG_FILE = \"/tmp/aws_cli_config\""
              - "CUSTOM_RESOURCE_OWNER_TAG = \"aws-cdk:cr-owned\""
              - "os.putenv('AWS_CONFIG_FILE', AWS_CLI_CONFIG_FILE)"
              - "def handler(event, context):"
              - "    def cfn_error(message=None):"
              - "        if message:"
              - "            logger.error(\"| cfn_error: %s\" %
                message.encode())"
              - "        cfn_send(event, context, CFN_FAILED, reason=message,
                physicalResourceId=event.get('PhysicalResourceId', None))"
              - "    try:"
              - "        # We are not logging ResponseURL as this is a
                pre-signed S3 URL, and could be used to tamper"
              - "        # with the response CloudFormation sees from this
                Custom Resource execution."
              - "        logger.info({ key:value for (key, value) in
                event.items() if key != 'ResponseURL'})"
              - "        # cloudformation request type (create/update/delete)"
              - "        request_type = event['RequestType']"
              - "        # extract resource properties"
              - "        props = event['ResourceProperties']"
              - "        old_props = event.get('OldResourceProperties', {})"
              - "        physical_id = event.get('PhysicalResourceId', None)"
              - "        try:"
              - "            source_bucket_names = props['SourceBucketNames']"
              - "            source_object_keys  = props['SourceObjectKeys']"
              - "            source_markers      = props.get('SourceMarkers',
                None)"
              - "            dest_bucket_name    =
                props['DestinationBucketName']"
              - "            dest_bucket_prefix  =
                props.get('DestinationBucketKeyPrefix', '')"
              - "            extract             = props.get('Extract', 'true')
                == 'true'"
              - "            retain_on_delete    = props.get('RetainOnDelete',
                \"true\") == \"true\""
              - "            distribution_id     = props.get('DistributionId',
                '')"
              - "            user_metadata       = props.get('UserMetadata', {})"
              - "            system_metadata     = props.get('SystemMetadata',
                {})"
              - "            prune               = props.get('Prune',
                'true').lower() == 'true'"
              - "            exclude             = props.get('Exclude', [])"
              - "            include             = props.get('Include', [])"
              - "            sign_content        = props.get('SignContent',
                'false').lower() == 'true'"
              - "            # backwards compatibility - if \"SourceMarkers\" is
                not specified,"
              - "            # assume all sources have an empty market map"
              - "            if source_markers is None:"
              - "                source_markers = [{} for i in
                range(len(source_bucket_names))]"
              - "            default_distribution_path = dest_bucket_prefix"
              - "            if not default_distribution_path.endswith(\"/\"):"
              - "                default_distribution_path += \"/\""
              - "            if not default_distribution_path.startswith(\"/\"):"
              - "                default_distribution_path = \"/\" +
                default_distribution_path"
              - "            default_distribution_path += \"*\""
              - "            distribution_paths = props.get('DistributionPaths',
                [default_distribution_path])"
              - "        except KeyError as e:"
              - "            cfn_error(\"missing request resource property %s.
                props: %s\" % (str(e), props))"
              - "            return"
              - "        # configure aws cli options after resetting back to the
                defaults for each request"
              - "        if os.path.exists(AWS_CLI_CONFIG_FILE):"
              - "                os.remove(AWS_CLI_CONFIG_FILE)"
              - "        if sign_content:"
              - "                aws_command(\"configure\", \"set\",
                \"default.s3.payload_signing_enabled\", \"true\")"
              - "        # treat \"/\" as if no prefix was specified"
              - "        if dest_bucket_prefix == \"/\":"
              - "            dest_bucket_prefix = \"\""
              - "        s3_source_zips = list(map(lambda name, key:
                \"s3://%s/%s\" % (name, key), source_bucket_names,
                source_object_keys))"
              - "        s3_dest = \"s3://%s/%s\" % (dest_bucket_name,
                dest_bucket_prefix)"
              - "        old_s3_dest = \"s3://%s/%s\" %
                (old_props.get(\"DestinationBucketName\", \"\"),
                old_props.get(\"DestinationBucketKeyPrefix\", \"\"))"
              - "        # obviously this is not"
              - "        if old_s3_dest == \"s3:///\":"
              - "            old_s3_dest = None"
              - "        logger.info(\"| s3_dest: %s\" % s3_dest)"
              - "        logger.info(\"| old_s3_dest: %s\" % old_s3_dest)"
              - "        # if we are creating a new resource, allocate a
                physical id for it"
              - "        # otherwise, we expect physical id to be relayed by
                cloudformation"
              - "        if request_type == \"Create\":"
              - "            physical_id = \"aws.cdk.s3deployment.%s\" %
                str(uuid4())"
              - "        else:"
              - "            if not physical_id:"
              - "                cfn_error(\"invalid request: request type is
                '%s' but 'PhysicalResourceId' is not defined\" % request_type)"
              - "                return"
              - "        # delete or create/update (only if \"retain_on_delete\"
                is false)"
              - "        if request_type == \"Delete\" and not retain_on_delete:"
              - "            if not bucket_owned(dest_bucket_name,
                dest_bucket_prefix):"
              - "                aws_command(\"s3\", \"rm\", s3_dest,
                \"--recursive\")"
              - "        # if we are updating without retention and the
                destination changed, delete first"
              - "        if request_type == \"Update\" and not retain_on_delete
                and old_s3_dest != s3_dest:"
              - "            if not old_s3_dest:"
              - "                logger.warn(\"cannot delete old resource
                without old resource properties\")"
              - "                return"
              - "            aws_command(\"s3\", \"rm\", old_s3_dest,
                \"--recursive\")"
              - "        if request_type == \"Update\" or request_type ==
                \"Create\":"
              - "            s3_deploy(s3_source_zips, s3_dest, user_metadata,
                system_metadata, prune, exclude, include, source_markers,
                extract)"
              - "        if distribution_id:"
              - "            cloudfront_invalidate(distribution_id,
                distribution_paths)"
              - "        cfn_send(event, context, CFN_SUCCESS,
                physicalResourceId=physical_id, responseData={"
              - "            # Passing through the ARN sequences dependencees on
                the deployment"
              - "            'DestinationBucketArn':
                props.get('DestinationBucketArn'),"
              - "            'SourceObjectKeys': props.get('SourceObjectKeys'),"
              - "        })"
              - "    except KeyError as e:"
              - "        cfn_error(\"invalid request. Missing key %s\" % str(e))"
              - "    except Exception as e:"
              - "        logger.exception(e)"
              - "        cfn_error(str(e))"
              - "#-------------------------------------------------------------\
                --------------------------------------"
              - "# populate all files from s3_source_zips to a destination
                bucket"
              - "def s3_deploy(s3_source_zips, s3_dest, user_metadata,
                system_metadata, prune, exclude, include, source_markers,
                extract):"
              - "    # list lengths are equal"
              - "    if len(s3_source_zips) != len(source_markers):"
              - "        raise Exception(\"'source_markers' and 's3_source_zips'
                must be the same length\")"
              - "    # create a temporary working directory in /tmp or if
                enabled an attached efs volume"
              - "    if ENV_KEY_MOUNT_PATH in os.environ:"
              - "        workdir = os.getenv(ENV_KEY_MOUNT_PATH) + \"/\" +
                str(uuid4())"
              - "        os.mkdir(workdir)"
              - "    else:"
              - "        workdir = tempfile.mkdtemp()"
              - "    logger.info(\"| workdir: %s\" % workdir)"
              - "    # create a directory into which we extract the contents of
                the zip file"
              - "    contents_dir=os.path.join(workdir, 'contents')"
              - "    os.mkdir(contents_dir)"
              - "    try:"
              - "        # download the archive from the source and extract to
                \"contents\""
              - "        for i in range(len(s3_source_zips)):"
              - "            s3_source_zip = s3_source_zips[i]"
              - "            markers       = source_markers[i]"
              - "            if extract:"
              - "                archive=os.path.join(workdir, str(uuid4()))"
              - "                logger.info(\"archive: %s\" % archive)"
              - "                aws_command(\"s3\", \"cp\", s3_source_zip,
                archive)"
              - "                logger.info(\"| extracting archive to: %s\\n\"
                % contents_dir)"
              - "                logger.info(\"| markers: %s\" % markers)"
              - "                extract_and_replace_markers(archive,
                contents_dir, markers)"
              - "            else:"
              - "                logger.info(\"| copying archive to: %s\\n\" %
                contents_dir)"
              - "                aws_command(\"s3\", \"cp\", s3_source_zip,
                contents_dir)"
              - "        # sync from \"contents\" to destination"
              - "        s3_command = [\"s3\", \"sync\"]"
              - "        if prune:"
              - "          s3_command.append(\"--delete\")"
              - "        if exclude:"
              - "          for filter in exclude:"
              - "            s3_command.extend([\"--exclude\", filter])"
              - "        if include:"
              - "          for filter in include:"
              - "            s3_command.extend([\"--include\", filter])"
              - "        s3_command.extend([contents_dir, s3_dest])"
              - "        s3_command.extend(create_metadata_args(user_metadata,
                system_metadata))"
              - "        aws_command(*s3_command)"
              - "    finally:"
              - "        if not os.getenv(ENV_KEY_SKIP_CLEANUP):"
              - "            shutil.rmtree(workdir)"
              - "#-------------------------------------------------------------\
                --------------------------------------"
              - "# invalidate files in the CloudFront distribution edge caches"
              - "def cloudfront_invalidate(distribution_id, distribution_paths):"
              - "    invalidation_resp = cloudfront.create_invalidation("
              - "        DistributionId=distribution_id,"
              - "        InvalidationBatch={"
              - "            'Paths': {"
              - "                'Quantity': len(distribution_paths),"
              - "                'Items': distribution_paths"
              - "            },"
              - "            'CallerReference': str(uuid4()),"
              - "        })"
              - "    # by default, will wait up to 10 minutes"
              - "    cloudfront.get_waiter('invalidation_completed').wait("
              - "        DistributionId=distribution_id,"
              - "        Id=invalidation_resp['Invalidation']['Id'])"
              - "#-------------------------------------------------------------\
                --------------------------------------"
              - "# set metadata"
              - "def create_metadata_args(raw_user_metadata,
                raw_system_metadata):"
              - "    if len(raw_user_metadata) == 0 and len(raw_system_metadata)
                == 0:"
              - "        return []"
              - "    format_system_metadata_key = lambda k: k.lower()"
              - "    format_user_metadata_key = lambda k: k.lower()"
              - "    system_metadata = { format_system_metadata_key(k): v for k,
                v in raw_system_metadata.items() }"
              - "    user_metadata = { format_user_metadata_key(k): v for k, v
                in raw_user_metadata.items() }"
              - "    flatten = lambda l: [item for sublist in l for item in
                sublist]"
              - "    system_args = flatten([[f\"--{k}\", v] for k, v in
                system_metadata.items()])"
              - "    user_args = [\"--metadata\", json.dumps(user_metadata,
                separators=(',', ':'))] if len(user_metadata) > 0 else []"
              - "    return system_args + user_args + [\"--metadata-directive\",
                \"REPLACE\"]"
              - "#-------------------------------------------------------------\
                --------------------------------------"
              - "# executes an \"aws\" cli command"
              - "def aws_command(*args):"
              - "    aws=\"/opt/awscli/aws\" # from AwsCliLayer"
              - "    logger.info(\"| aws %s\" % ' '.join(args))"
              - "    subprocess.check_call([aws] + list(args))"
              - "#-------------------------------------------------------------\
                --------------------------------------"
              - "# sends a response to cloudformation"
              - "def cfn_send(event, context, responseStatus, responseData={},
                physicalResourceId=None, noEcho=False, reason=None):"
              - "    responseUrl = event['ResponseURL']"
              - "    responseBody = {}"
              - "    responseBody['Status'] = responseStatus"
              - "    responseBody['Reason'] = reason or ('See the details in
                CloudWatch Log Stream: ' + context.log_stream_name)"
              - "    responseBody['PhysicalResourceId'] = physicalResourceId or
                context.log_stream_name"
              - "    responseBody['StackId'] = event['StackId']"
              - "    responseBody['RequestId'] = event['RequestId']"
              - "    responseBody['LogicalResourceId'] =
                event['LogicalResourceId']"
              - "    responseBody['NoEcho'] = noEcho"
              - "    responseBody['Data'] = responseData"
              - "    body = json.dumps(responseBody)"
              - "    logger.info(\"| response body:\\n\" + body)"
              - "    headers = {"
              - "        'content-type' : '',"
              - "        'content-length' : str(len(body))"
              - "    }"
              - "    try:"
              - "        request = Request(responseUrl, method='PUT',
                data=bytes(body.encode('utf-8')), headers=headers)"
              - "        with contextlib.closing(urlopen(request)) as response:"
              - "          logger.info(\"| status code: \" + response.reason)"
              - "    except Exception as e:"
              - "        logger.error(\"| unable to send response to
                CloudFormation\")"
              - "        logger.exception(e)"
              - "#-------------------------------------------------------------\
                --------------------------------------"
              - "# check if bucket is owned by a custom resource"
              - "# if it is then we don't want to delete content"
              - "def bucket_owned(bucketName, keyPrefix):"
              - "    tag = CUSTOM_RESOURCE_OWNER_TAG"
              - "    if keyPrefix != \"\":"
              - "        tag = tag + ':' + keyPrefix"
              - "    try:"
              - "        request = s3.get_bucket_tagging("
              - "            Bucket=bucketName,"
              - "        )"
              - "        return any((x[\"Key\"].startswith(tag)) for x in
                request[\"TagSet\"])"
              - "    except Exception as e:"
              - "        logger.info(\"| error getting tags from bucket\")"
              - "        logger.exception(e)"
              - "        return False"
              - "# extract archive and replace markers in output files"
              - "def extract_and_replace_markers(archive, contents_dir,
                markers):"
              - "    with ZipFile(archive, \"r\") as zip:"
              - "        zip.extractall(contents_dir)"
              - "        # replace markers for this source"
              - "        for file in zip.namelist():"
              - "            file_path = os.path.join(contents_dir, file)"
              - "            if os.path.isdir(file_path): continue"
              - "            replace_markers(file_path, markers)"
              - "def replace_markers(filename, markers):"
              - "    # convert the dict of string markers to binary markers"
              - "    replace_tokens = dict([(k.encode('utf-8'),
                v.encode('utf-8')) for k, v in markers.items()])"
              - "    outfile = filename + '.new'"
              - "    with open(filename, 'rb') as fi, open(outfile, 'wb') as fo:"
              - "        for line in fi:"
              - "            for token in replace_tokens:"
              - "                line = line.replace(token,
                replace_tokens[token])"
              - "            fo.write(line)"
              - "    # # delete the original file and rename the new one to the
                original"
              - "    os.remove(filename)"
              - "    os.rename(outfile, filename)"
      Environment:
        Variables:
          AWS_CA_BUNDLE: "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"
      Handler: "index.handler"
      Layers:
        - Ref: "UiPublishAwsCliLayerA79D2F27"
      Role:
        Fn::GetAtt:
          - "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRo\
            le89A01265"
          - "Arn"
      Runtime: "python3.9"
      Timeout: 900
    DependsOn:
      - "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDe\
        faultPolicy88902FDF"
  AWSCDKTriggerCustomResourceProviderCustomResourceProviderRoleE18FAF0A:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "lambda.amazonaws.com"
      ManagedPolicyArns:
        - Fn::Sub: "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExec\
            utionRole"
      Policies:
        - PolicyName: "Inline"
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: "Allow"
                Action:
                  - "lambda:InvokeFunction"
                Resource:
                  - Fn::Join:
                      - ""
                      - - Fn::GetAtt:
                            - "UiConfiguratorLambda6CE847B2"
                            - "Arn"
                        - ":*"
  AWSCDKTriggerCustomResourceProviderCustomResourceProviderHandler97BECD91:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        ZipFile:
          Fn::Join:
            - "\n"
            - - "\"use strict\";var
                E=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var
                R=E((v,y)=>{\"use strict\";var
                c=Object.defineProperty,m=Object.getOwnPropertyDescriptor,"
              - "I=Object.getOwnPropertyNames,P=Object.prototype.hasOwnProperty\
                ,T=(e,r)=>{for(var s in r)"
              - "c(e,s,{get:r[s],enumerable:!0})},S=(e,r,s,o)=>{if(r&&typeof
                r==\"object\"||typeof r=="
              - "\"function\")for(let t of
                I(r))!P.call(e,t)&&t!==s&&c(e,t,{get:()=>r[t],enumerable:!(o="
              - "m(r,t))||o.enumerable});return
                e},C=e=>S(c({},\"__esModule\",{value:!0}),e),h={};T("
              - "h,{handler:()=>L,invoke:()=>p}),y.exports=C(h);var
                D=require(\"@aws-sdk/client-lambda\"),"
              - "b=require(\"@aws-sdk/node-http-handler\"),q=e=>{if(e)return new
                TextDecoder().decode("
              - "Buffer.from(e))},p=async(e,r,s)=>{let o=new
                D.Lambda({requestHandler:new b.NodeHttpHandler("
              - "{socketTimeout:s})}),t={FunctionName:e,InvocationType:r};conso\
                le.log({invokeRequest:t});"
              - "let a=0,n=5e3,i;for(;;)try{i=await
                o.invoke(t);break}catch(d){if(d.name===\"Acces\\"
              - "sDeniedException\"&&a<12){a++,await new
                Promise(w=>{setTimeout(w,n)});continue}throw d}"
              - "let u={...i,Payload:q(i.Payload)};return
                console.log({invokeResponse:u}),u};async function L(e){"
              - "if(console.log({...e,ResponseURL:\"...\"}),e.RequestType===\"D\
                elete\"){console.log(\"\\"
              - "not calling trigger on
                DELETE\");return}if(e.RequestType===\"Update\"&&e.ResourcePrope\
                rties."
              - "ExecuteOnHandlerChange===\"false\"){console.log(\"not calling
                trigger because Execu\\"
              - "teOnHandlerChange is false\");return}let
                r=e.ResourceProperties.HandlerArn;if(!r)"
              - "throw new Error('The \"HandlerArn\" property is required');let
                s=e.ResourceProperties."
              - "InvocationType,o=e.ResourceProperties.Timeout,t=parseInt(o);if\
                (isNaN(t))throw new Error("
              - "`The \"Timeout\" property with value ${o} is not parsable to a
                number`);let a=await p("
              - "r,s,t);if(a.StatusCode&&a.StatusCode>=400)throw new
                Error(`Trigger handler faile\\"
              - "d with status code ${a.StatusCode}`);if(a.FunctionError)throw
                new Error(A(a.Payload))}"
              - "function A(e){if(!e)return\"unknown handler
                error\";console.log(`Error payload: ${e}`);"
              - "try{let
                r=JSON.parse(e),s=[r.errorMessage,r.trace].filter(o=>o).join(`"
              - "`);return s.length>0?s:e}catch{return
                e}}});Object.defineProperty(exports,\"__esModule\",{value:!0}),\
                exports.withRetries=exports."
              - "handler=exports.external=void 0;var
                k=require(\"https\"),x=require(\"url\");exports."
              - "external={sendHttpRequest:N,log:M,includeStackTraces:!0,userHa\
                ndlerIndex:\"./inde\\"
              - "x\"};var
                f=\"AWSCDK::CustomResourceProviderFramework::CREATE_FAILED\",H=\
                \"AWSCDK::Cu\\"
              - "stomResourceProviderFramework::MISSING_PHYSICAL_ID\";async
                function O(e,r){let s={"
              - "...e,ResponseURL:\"...\"};if(exports.external.log(JSON.stringi\
                fy(s,void 0,2)),e.RequestType==="
              - "\"Delete\"&&e.PhysicalResourceId===f){exports.external.log(\"i\
                gnoring DELETE event \\"
              - "caused by a failed CREATE event\"),await
                l(\"SUCCESS\",e);return}try{let o=R().handler,"
              - "t=await o(s,r),a=_(e,t);await l(\"SUCCESS\",a)}catch(o){let
                t={...e,Reason:exports."
              - "external.includeStackTraces?o.stack:o.message};t.PhysicalResou\
                rceId||(e.RequestType==="
              - "\"Create\"?(exports.external.log(\"CREATE failed, responding
                with a marker physical\\"
              - " resource id so that the subsequent DELETE will be
                ignored\"),t.PhysicalResourceId="
              - "f):exports.external.log(`ERROR: Malformed event.
                \"PhysicalResourceId\" is require\\"
              - "d: ${JSON.stringify(e)}`)),await
                l(\"FAILED\",t)}}exports.handler=O;function _(e,r={}){"
              - "let
                s=r.PhysicalResourceId??e.PhysicalResourceId??e.RequestId;if(e.\
                RequestType==="
              - "\"Delete\"&&s!==e.PhysicalResourceId)throw new Error(`DELETE:
                cannot change the ph\\"
              - "ysical resource ID from \"${e.PhysicalResourceId}\" to
                \"${r.PhysicalResourceId}\" d\\"
              - "uring deletion`);return{...e,...r,PhysicalResourceId:s}}async
                function l(e,r){let s={"
              - "Status:e,Reason:r.Reason??e,StackId:r.StackId,RequestId:r.Requ\
                estId,PhysicalResourceId:r."
              - "PhysicalResourceId||H,LogicalResourceId:r.LogicalResourceId,No\
                Echo:r.NoEcho,Data:r."
              - "Data},o=x.parse(r.ResponseURL),t=`${o.protocol}//${o.hostname}\
                /${o.pathname}?***`;"
              - "exports.external.log(\"submit response to
                cloudformation\",t,s);let a=JSON.stringify("
              - "s),n={hostname:o.hostname,path:o.path,method:\"PUT\",headers:{\
                \"content-type\":\"\",\"c\\"
              - "ontent-length\":Buffer.byteLength(a,\"utf8\")}};await
                g({attempts:5,sleep:1e3},exports."
              - "external.sendHttpRequest)(n,a)}async function N(e,r){return new
                Promise((s,o)=>{"
              - "try{let
                t=k.request(e,a=>{a.resume(),!a.statusCode||a.statusCode>=400?o\
                (new Error("
              - "`Unsuccessful HTTP response:
                ${a.statusCode}`)):s()});t.on(\"error\",o),t.write(r),"
              - "t.end()}catch(t){o(t)}})}function
                M(e,...r){console.log(e,...r)}function g(e,r){"
              - "return async(...s)=>{let
                o=e.attempts,t=e.sleep;for(;;)try{return await
                r(...s)}catch(a){"
              - "if(o--<=0)throw a;await
                U(Math.floor(Math.random()*t)),t*=2}}}exports.withRetries="
              - "g;async function U(e){return new Promise(r=>setTimeout(r,e))}"
      Timeout: 900
      MemorySize: 128
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
          - "AWSCDKTriggerCustomResourceProviderCustomResourceProviderRoleE18FA\
            F0A"
          - "Arn"
      Runtime: "nodejs18.x"
    DependsOn: []
Outputs:
  ReportingLogGroup:
    Description: "The CloudWatch Log Group where logs are stored."
    Value:
      Ref: "ReportingCloudWatchLogGroupE545A28A"
    Condition: "CreateCloudWatchLogsDestination"
  ReportingS3Bucket:
    Description: "The S3 bucket where logs are stored."
    Value:
      Ref: "ReportingS3BucketD452F6BB"
    Condition: "CreateS3LogsDestination"
  AdminUiUrl:
    Description: "The Vocaldex UI"
    Value:
      Fn::Join:
        - ""
        - - "https://"
          - Fn::GetAtt:
              - "UiDistribution1123DB5B"
              - "DomainName"
          - "/"
