fjall 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ const __fjbinDir = __fjdir(__fjfilename);
8
8
  process.env.FJALL_ASSETS_DIR = process.env.FJALL_ASSETS_DIR || __fjjoin(__fjbinDir, "assets");
9
9
  process.env.FJALL_BUNDLED = "1";
10
10
 
11
- var R9t=Object.create;var T7=Object.defineProperty;var D9t=Object.getOwnPropertyDescriptor;var O9t=Object.getOwnPropertyNames;var N9t=Object.getPrototypeOf,_9t=Object.prototype.hasOwnProperty;var At=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var Ee=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},er=(t,e)=>{for(var r in e)T7(t,r,{get:e[r],enumerable:!0})},F9e=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of O9t(e))!_9t.call(t,a)&&a!==r&&T7(t,a,{get:()=>e[a],enumerable:!(n=D9t(e,a))||n.enumerable});return t};var au=(t,e,r)=>(r=t!=null?R9t(N9t(t)):{},F9e(e||!t||!t.__esModule?T7(r,"default",{value:t,enumerable:!0}):r,t)),Ht=t=>F9e(T7({},"__esModule",{value:!0}),t);var zx,R7=w(()=>{zx={name:"@fjall/cli",version:"4.0.0",description:"Fjall CLI helper",private:!0,type:"module",bin:{fjall:"dist/src/cli.js"},files:["dist/"],scripts:{clean:"rm -rf ./dist ./dist.next ./sourcemaps","clean:node":"rm -rf ./node_modules","copy-files":'DEST="${DEST:-dist}"; find generators -type d -name files | while read dir; do mkdir -p "$DEST/$dir" && cp -R "$dir/"* "$DEST/$dir/"; done && cp -R src/proto "./$DEST/src/proto"',build:"rm -rf ./dist.next ./sourcemaps && npx tsc --outDir dist.next && DEST=dist.next npm run copy-files && node ../scripts/minify-dist.mjs dist.next && chmod +x ./dist.next/src/cli.js && rm -rf ./dist && mv ./dist.next ./dist",watch:"npm run build && npx tsc-watch","watch:only":'npx tsc-watch --onSuccess "npm run copy-files"',"fjall-cli":"node ./dist/src/cli.js",version:"npx tsx scripts/updateTemplateVersions.ts",format:'prettier --write "src/**/*.{ts,tsx,js,jsx,json}" "generators/**/*.{ts,tsx,js,jsx,json}"',"format:check":'prettier --check "src/**/*.{ts,tsx,js,jsx,json}" "generators/**/*.{ts,tsx,js,jsx,json}"',lint:"eslint src/ generators/","lint:fix":"eslint src/ generators/ --fix",typecheck:"tsc --noEmit","typecheck:tests":"tsc --noEmit --project tsconfig.test.json","typecheck:scripts":"tsc --noEmit --project tsconfig.scripts.json","typecheck:all":"npm run typecheck && npm run typecheck:tests && npm run typecheck:scripts",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","test:integration":"vitest run --config vitest.config.integration.ts","test:integration:watch":"vitest --config vitest.config.integration.ts","test:e2e":"vitest run --config vitest.e2e.config.ts","test:all":"npm run test && npm run test:integration && npm run test:e2e","test:setup":"node scripts/setupTestFixtures.mjs","test:payload-compat":"npx tsx scripts/testPayloadCompatibility.ts","test:payload-compat:e2e":"npx tsx scripts/testPayloadCompatibility.ts --e2e"},engines:{node:">=22.0.0"},author:"",license:"SEE LICENSE IN LICENSE",devDependencies:{"@eslint/js":"^10.0.1","@playwright/test":"^1.59.1","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/ejs":"^3.1.5","@types/js-yaml":"^4.0.9","@types/mime-types":"^3.0.1","@types/picomatch":"^4.0.3","@types/prompts":"^2.4.9","@types/proper-lockfile":"^4.1.4","@types/react":"^19.2.14","@types/tar-fs":"^2.0.4","@types/tar-stream":"^3.1.4","@typescript-eslint/eslint-plugin":"^8.59.1","@typescript-eslint/parser":"^8.59.1","@vitest/coverage-v8":"^4.1.5",eslint:"^10.2.1","eslint-plugin-fjall":"file:./eslint-rules","ink-testing-library":"^4.0.0",jsdom:"^29.1.0",prettier:"^3.8.3","react-dom":"^19.2.5","tsc-watch":"^7.2.0",tsx:"^4.21.0","typescript-eslint":"^8.59.1",vitest:"4.1.7"},dependencies:{"@aws-sdk/client-acm":"^3.1038.0","@aws-sdk/client-auto-scaling":"^3.1038.0","@aws-sdk/client-backup":"^3.1038.0","@aws-sdk/client-cloudformation":"^3.1038.0","@aws-sdk/client-cost-explorer":"^3.1038.0","@aws-sdk/client-ec2":"^3.1038.0","@aws-sdk/client-ecr":"^3.1038.0","@aws-sdk/client-ecs":"^3.1038.0","@aws-sdk/client-elasticache":"^3.1038.0","@aws-sdk/client-iam":"^3.1038.0","@aws-sdk/client-identitystore":"^3.1038.0","@aws-sdk/client-lambda":"^3.1038.0","@aws-sdk/client-organizations":"^3.1038.0","@aws-sdk/client-ram":"^3.1038.0","@aws-sdk/client-rds":"^3.1038.0","@aws-sdk/client-route-53":"^3.1038.0","@aws-sdk/client-s3":"^3.1038.0","@aws-sdk/client-secrets-manager":"^3.1038.0","@aws-sdk/client-ssm":"^3.1038.0","@aws-sdk/client-sso":"^3.1038.0","@aws-sdk/client-sso-admin":"^3.1038.0","@aws-sdk/client-sso-oidc":"^3.1038.0","@aws-sdk/client-sts":"^3.1038.0","@fjall/deploy-core":"^4.0.0","@fjall/generator":"^4.0.0","@fjall/util":"^4.0.0","@nx/devkit":"^23.0.0","@opennextjs/aws":"^4.0.3","@smithy/node-http-handler":"^4.6.1","@toon-format/toon":"^2.1.0","aws-cdk":"^2.1128.1",axios:"^1.15.2",chalk:"^5.6.2","cli-cursor":"^5.0.0",commander:"^15.0.0",ejs:"^6.0.1",ink:"^7.0.1","js-yaml":"^4.1.1","mime-types":"^3.0.2",open:"^11.0.0",ora:"^9.4.0",picomatch:"^4.0.4",prompts:"^2.4.2","proper-lockfile":"^4.1.2",protobufjs:"^8.0.3",react:"^19.2.5","tar-fs":"^3.1.2",typescript:"^6.0.3","update-check":"^1.5.4",zod:"^4.4.3"}}});function V9e(t){return t.success===!0}function z9e(t){return t.success===!1}function Ln(t){return{success:!0,data:t}}function mt(t){return{success:!1,error:t}}var U9t,D7,FS=w(()=>{"use strict";U9t=Object.defineProperty,D7=(t,e)=>U9t(t,"name",{value:e,configurable:!0});D7(V9e,"isSuccess");D7(z9e,"isFailure");D7(Ln,"success");D7(mt,"failure")});var ou,Gx,xO,Khe,Yhe,vh=w(()=>{"use strict";ou="DockerCli",Gx="DockerCli.buildx",xO="0.13.0",Khe="fjall",Yhe="docker"});function yr(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!Jhe.has(e.toUpperCase())))}function b(t){return t.replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[^"\\]|\\[\\nrt"])*?-----END [A-Z ]*PRIVATE KEY-----/g,"-----BEGIN [REDACTED] PRIVATE KEY-----...-----END [REDACTED] PRIVATE KEY-----").replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,"-----BEGIN [REDACTED] PRIVATE KEY-----...-----END [REDACTED] PRIVATE KEY-----").replace(/(\w+:\/\/[^:]+:)[^@]+(@)/gi,"$1***$2").replace(/(?<![a-zA-Z])(password|passwd|secret|api[_-]?key|token|auth|credential)([=:])["']?[^\s"']+/gi,"$1$2***").replace(/\b(ghu_|ghs_|ghp_|gho_|github_pat_)[A-Za-z0-9_]+/g,"$1***").replace(/\b(sk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,"$1_$2_***").replace(/\bwhsec_[A-Za-z0-9]{8,}/g,"whsec_***").replace(/(?<=Authorization:\s*Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"***").replace(/\b(AKIA|ASIA)[A-Z0-9]{12,}\b/g,"$1***").replace(/(?<=aws_secret_access_key\s*=\s*["']?|SecretAccessKey[=:]\s*|"(aws)?secretAccessKey":\s*"|"aws_secret_access_key":\s*")[A-Za-z0-9/+=]{40,}/gi,"***").replace(/(?<="(aws)?sessionToken":\s*"|"aws_session_token":\s*")[^"]+/gi,"***").replace(/(?<=aws_session_token\s*[=:]\s*["']?|SessionToken[=:]\s*["']?)[^\s"']+/gi,"***").replace(/(?<="(internal[Aa]piKey|fjallCallbackToken)":\s*")[^"]+/g,"***").replace(z9t,"$1***")}function Um(t){let e=[],r="",n=!1,a=!1,o=!1,s=!1;for(let i of t){if(o){r+=i,o=!1;continue}if(i==="\\"&&!n){o=!0;continue}if(i==="'"&&!a){n=!n,s=!0;continue}if(i==='"'&&!n){a=!a,s=!0;continue}if(i===" "&&!n&&!a){(r||s)&&(e.push(r),r="",s=!1);continue}r+=i}if(n||a)throw new Error(`Unbalanced ${n?"single":"double"} quote in command: ${t.slice(0,80)}`);if(o)throw new Error(`Trailing backslash in command: ${t.slice(0,80)}`);return(r||s)&&e.push(r),e}var V9t,Zhe,Jhe,G9e,z9t,su=w(()=>{"use strict";V9t=Object.defineProperty,Zhe=(t,e)=>V9t(t,"name",{value:e,configurable:!0}),Jhe=new Set(["NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_DEBUG","NODE_PRESERVE_SYMLINKS","LD_PRELOAD","LD_LIBRARY_PATH","LD_AUDIT","LD_BIND_NOW","DYLD_INSERT_LIBRARIES","DYLD_LIBRARY_PATH","DYLD_FRAMEWORK_PATH","PYTHONPATH","PYTHONSTARTUP","PERL5LIB","PERL5OPT","RUBYLIB","RUBYOPT","HOME","XDG_CONFIG_HOME","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","SHELL","BASH_ENV","ENV","ZDOTDIR"]);Zhe(yr,"filterDangerousEnvVars");G9e=/fjall_(?:ak|dk)_[A-Z2-7]{16}\.[A-Z2-7]{40}/,z9t=/(fjall_(?:ak|dk)_)[A-Z2-7]{16}\.[A-Z2-7]{40}/g;Zhe(b,"maskSensitiveOutput");Zhe(Um,"parseShellArgs")});function qo(t){let e=b(t.message),r=t.stderrTail;return r===void 0||r.length===0?e:`${e}
11
+ var R9t=Object.create;var T7=Object.defineProperty;var D9t=Object.getOwnPropertyDescriptor;var O9t=Object.getOwnPropertyNames;var N9t=Object.getPrototypeOf,_9t=Object.prototype.hasOwnProperty;var At=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var Ee=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},er=(t,e)=>{for(var r in e)T7(t,r,{get:e[r],enumerable:!0})},F9e=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of O9t(e))!_9t.call(t,a)&&a!==r&&T7(t,a,{get:()=>e[a],enumerable:!(n=D9t(e,a))||n.enumerable});return t};var au=(t,e,r)=>(r=t!=null?R9t(N9t(t)):{},F9e(e||!t||!t.__esModule?T7(r,"default",{value:t,enumerable:!0}):r,t)),Ht=t=>F9e(T7({},"__esModule",{value:!0}),t);var zx,R7=w(()=>{zx={name:"@fjall/cli",version:"4.1.0",description:"Fjall CLI helper",private:!0,type:"module",bin:{fjall:"dist/src/cli.js"},files:["dist/"],scripts:{clean:"rm -rf ./dist ./dist.next ./sourcemaps","clean:node":"rm -rf ./node_modules","copy-files":'DEST="${DEST:-dist}"; find generators -type d -name files | while read dir; do mkdir -p "$DEST/$dir" && cp -R "$dir/"* "$DEST/$dir/"; done && cp -R src/proto "./$DEST/src/proto"',build:"rm -rf ./dist.next ./sourcemaps && npx tsc --outDir dist.next && DEST=dist.next npm run copy-files && node ../scripts/minify-dist.mjs dist.next && chmod +x ./dist.next/src/cli.js && rm -rf ./dist && mv ./dist.next ./dist",watch:"npm run build && npx tsc-watch","watch:only":'npx tsc-watch --onSuccess "npm run copy-files"',"fjall-cli":"node ./dist/src/cli.js",version:"npx tsx scripts/updateTemplateVersions.ts",format:'prettier --write "src/**/*.{ts,tsx,js,jsx,json}" "generators/**/*.{ts,tsx,js,jsx,json}"',"format:check":'prettier --check "src/**/*.{ts,tsx,js,jsx,json}" "generators/**/*.{ts,tsx,js,jsx,json}"',lint:"eslint src/ generators/","lint:fix":"eslint src/ generators/ --fix",typecheck:"tsc --noEmit","typecheck:tests":"tsc --noEmit --project tsconfig.test.json","typecheck:scripts":"tsc --noEmit --project tsconfig.scripts.json","typecheck:all":"npm run typecheck && npm run typecheck:tests && npm run typecheck:scripts",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","test:integration":"vitest run --config vitest.config.integration.ts","test:integration:watch":"vitest --config vitest.config.integration.ts","test:e2e":"vitest run --config vitest.e2e.config.ts","test:all":"npm run test && npm run test:integration && npm run test:e2e","test:setup":"node scripts/setupTestFixtures.mjs","test:payload-compat":"npx tsx scripts/testPayloadCompatibility.ts","test:payload-compat:e2e":"npx tsx scripts/testPayloadCompatibility.ts --e2e"},engines:{node:">=22.0.0"},author:"",license:"SEE LICENSE IN LICENSE",devDependencies:{"@eslint/js":"^10.0.1","@playwright/test":"^1.59.1","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/ejs":"^3.1.5","@types/js-yaml":"^4.0.9","@types/mime-types":"^3.0.1","@types/picomatch":"^4.0.3","@types/prompts":"^2.4.9","@types/proper-lockfile":"^4.1.4","@types/react":"^19.2.14","@types/tar-fs":"^2.0.4","@types/tar-stream":"^3.1.4","@typescript-eslint/eslint-plugin":"^8.59.1","@typescript-eslint/parser":"^8.59.1","@vitest/coverage-v8":"^4.1.5",eslint:"^10.2.1","eslint-plugin-fjall":"file:./eslint-rules","ink-testing-library":"^4.0.0",jsdom:"^29.1.0",prettier:"^3.8.3","react-dom":"^19.2.5","tsc-watch":"^7.2.0",tsx:"^4.21.0","typescript-eslint":"^8.59.1",vitest:"4.1.7"},dependencies:{"@aws-sdk/client-acm":"^3.1038.0","@aws-sdk/client-auto-scaling":"^3.1038.0","@aws-sdk/client-backup":"^3.1038.0","@aws-sdk/client-cloudformation":"^3.1038.0","@aws-sdk/client-cost-explorer":"^3.1038.0","@aws-sdk/client-ec2":"^3.1038.0","@aws-sdk/client-ecr":"^3.1038.0","@aws-sdk/client-ecs":"^3.1038.0","@aws-sdk/client-elasticache":"^3.1038.0","@aws-sdk/client-iam":"^3.1038.0","@aws-sdk/client-identitystore":"^3.1038.0","@aws-sdk/client-lambda":"^3.1038.0","@aws-sdk/client-organizations":"^3.1038.0","@aws-sdk/client-ram":"^3.1038.0","@aws-sdk/client-rds":"^3.1038.0","@aws-sdk/client-route-53":"^3.1038.0","@aws-sdk/client-s3":"^3.1038.0","@aws-sdk/client-secrets-manager":"^3.1038.0","@aws-sdk/client-ssm":"^3.1038.0","@aws-sdk/client-sso":"^3.1038.0","@aws-sdk/client-sso-admin":"^3.1038.0","@aws-sdk/client-sso-oidc":"^3.1038.0","@aws-sdk/client-sts":"^3.1038.0","@fjall/deploy-core":"^4.1.0","@fjall/generator":"^4.1.0","@fjall/util":"^4.1.0","@nx/devkit":"^23.0.0","@opennextjs/aws":"^4.0.3","@smithy/node-http-handler":"^4.6.1","@toon-format/toon":"^2.1.0","aws-cdk":"^2.1128.1",axios:"^1.15.2",chalk:"^5.6.2","cli-cursor":"^5.0.0",commander:"^15.0.0",ejs:"^6.0.1",ink:"^7.0.1","js-yaml":"^4.1.1","mime-types":"^3.0.2",open:"^11.0.0",ora:"^9.4.0",picomatch:"^4.0.4",prompts:"^2.4.2","proper-lockfile":"^4.1.2",protobufjs:"^8.0.3",react:"^19.2.5","tar-fs":"^3.1.2",typescript:"^6.0.3","update-check":"^1.5.4",zod:"^4.4.3"}}});function V9e(t){return t.success===!0}function z9e(t){return t.success===!1}function Ln(t){return{success:!0,data:t}}function mt(t){return{success:!1,error:t}}var U9t,D7,FS=w(()=>{"use strict";U9t=Object.defineProperty,D7=(t,e)=>U9t(t,"name",{value:e,configurable:!0});D7(V9e,"isSuccess");D7(z9e,"isFailure");D7(Ln,"success");D7(mt,"failure")});var ou,Gx,xO,Khe,Yhe,vh=w(()=>{"use strict";ou="DockerCli",Gx="DockerCli.buildx",xO="0.13.0",Khe="fjall",Yhe="docker"});function yr(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!Jhe.has(e.toUpperCase())))}function b(t){return t.replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[^"\\]|\\[\\nrt"])*?-----END [A-Z ]*PRIVATE KEY-----/g,"-----BEGIN [REDACTED] PRIVATE KEY-----...-----END [REDACTED] PRIVATE KEY-----").replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,"-----BEGIN [REDACTED] PRIVATE KEY-----...-----END [REDACTED] PRIVATE KEY-----").replace(/(\w+:\/\/[^:]+:)[^@]+(@)/gi,"$1***$2").replace(/(?<![a-zA-Z])(password|passwd|secret|api[_-]?key|token|auth|credential)([=:])["']?[^\s"']+/gi,"$1$2***").replace(/\b(ghu_|ghs_|ghp_|gho_|github_pat_)[A-Za-z0-9_]+/g,"$1***").replace(/\b(sk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,"$1_$2_***").replace(/\bwhsec_[A-Za-z0-9]{8,}/g,"whsec_***").replace(/(?<=Authorization:\s*Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"***").replace(/\b(AKIA|ASIA)[A-Z0-9]{12,}\b/g,"$1***").replace(/(?<=aws_secret_access_key\s*=\s*["']?|SecretAccessKey[=:]\s*|"(aws)?secretAccessKey":\s*"|"aws_secret_access_key":\s*")[A-Za-z0-9/+=]{40,}/gi,"***").replace(/(?<="(aws)?sessionToken":\s*"|"aws_session_token":\s*")[^"]+/gi,"***").replace(/(?<=aws_session_token\s*[=:]\s*["']?|SessionToken[=:]\s*["']?)[^\s"']+/gi,"***").replace(/(?<="(internal[Aa]piKey|fjallCallbackToken)":\s*")[^"]+/g,"***").replace(z9t,"$1***")}function Um(t){let e=[],r="",n=!1,a=!1,o=!1,s=!1;for(let i of t){if(o){r+=i,o=!1;continue}if(i==="\\"&&!n){o=!0;continue}if(i==="'"&&!a){n=!n,s=!0;continue}if(i==='"'&&!n){a=!a,s=!0;continue}if(i===" "&&!n&&!a){(r||s)&&(e.push(r),r="",s=!1);continue}r+=i}if(n||a)throw new Error(`Unbalanced ${n?"single":"double"} quote in command: ${t.slice(0,80)}`);if(o)throw new Error(`Trailing backslash in command: ${t.slice(0,80)}`);return(r||s)&&e.push(r),e}var V9t,Zhe,Jhe,G9e,z9t,su=w(()=>{"use strict";V9t=Object.defineProperty,Zhe=(t,e)=>V9t(t,"name",{value:e,configurable:!0}),Jhe=new Set(["NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_DEBUG","NODE_PRESERVE_SYMLINKS","LD_PRELOAD","LD_LIBRARY_PATH","LD_AUDIT","LD_BIND_NOW","DYLD_INSERT_LIBRARIES","DYLD_LIBRARY_PATH","DYLD_FRAMEWORK_PATH","PYTHONPATH","PYTHONSTARTUP","PERL5LIB","PERL5OPT","RUBYLIB","RUBYOPT","HOME","XDG_CONFIG_HOME","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","SHELL","BASH_ENV","ENV","ZDOTDIR"]);Zhe(yr,"filterDangerousEnvVars");G9e=/fjall_(?:ak|dk)_[A-Z2-7]{16}\.[A-Z2-7]{40}/,z9t=/(fjall_(?:ak|dk)_)[A-Z2-7]{16}\.[A-Z2-7]{40}/g;Zhe(b,"maskSensitiveOutput");Zhe(Um,"parseShellArgs")});function qo(t){let e=b(t.message),r=t.stderrTail;return r===void 0||r.length===0?e:`${e}
12
12
  ${W9e}
13
13
  ${r.join(`
14
14
  `)}
@@ -99,7 +99,7 @@ ${K.hex("#D9622E").bold(`--- ${t} ---`)}`),Zn&&Zn.start())}function KZ(){return
99
99
  `);return{buffer:[],stream:a}}flush(){let e=this.flushBuffer(this.buffer,this.mainLogStream,this.mainLogPath);this.buffer=e.buffer,this.mainLogStream=e.stream;let r=this.flushBuffer(this.debugBuffer,this.debugLogStream,this.debugLogPath);this.debugBuffer=r.buffer,this.debugLogStream=r.stream}close(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.mainLogStream&&(this.mainLogStream.end(),this.mainLogStream=null),this.debugLogStream&&(this.debugLogStream.end(),this.debugLogStream=null),this.buffer=[],this.debugBuffer=[],this.initialised=!1,this.isClosing=!1}async closeAndFlush(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null);let e=[];this.mainLogStream&&(e.push(this.mainLogStream),this.mainLogStream=null),this.debugLogStream&&(e.push(this.debugLogStream),this.debugLogStream=null),this.buffer=[],this.debugBuffer=[],this.initialised=!1,await Promise.all(e.map(r=>new Promise(n=>{r.end(()=>n())}))),this.isClosing=!1}}});var cT,Od,bU=w(()=>{"use strict";cT={trace:0,debug:1,info:2,warn:3,error:4},Od={MAX_FILE_SIZE:10*1024*1024,MAX_FILES:5,MAX_BUFFER_SIZE:100,FLUSH_INTERVAL_MS:500,LOG_FILENAME:"fjall.jsonl",DEBUG_LOG_FILENAME:"fjall-debug.jsonl"}});import{join as KXt}from"path";import{homedir as YXt}from"os";function HA(){let t=process.env.FJALL_LOG_DIR;return t!==void 0&&t!==""?t:KXt(YXt(),".fjall","logs")}var HXt,qXt,EU=w(()=>{"use strict";HXt=Object.defineProperty,qXt=(t,e)=>HXt(t,"name",{value:e,configurable:!0});qXt(HA,"getDefaultLogDir")});import{createWriteStream as XXt,existsSync as QXt,mkdirSync as eQt}from"fs";import{join as HQe}from"path";var ZXt,JXt,AU,PAe=w(()=>{"use strict";bU();EU();ZXt=Object.defineProperty,JXt=(t,e)=>ZXt(t,"name",{value:e,configurable:!0}),AU=class{static{JXt(this,"DeploymentLoggerImpl")}mainLogger;appName;operationType;logStream=null;logPath;deploymentId;buffer=[];flushInterval=null;isClosing=!1;maxBufferSize=Od.MAX_BUFFER_SIZE;constructor(e,r,n){this.mainLogger=e,this.appName=r,this.operationType=n,this.deploymentId=`${n}-${Date.now()}`;let a=HA(),o=HQe(a,"deployments",r);QXt(o)||eQt(o,{recursive:!0});let s=new Date().toISOString().replace(/[:.]/g,"-"),i=`${n}-${s}.jsonl`;this.logPath=HQe(o,i);try{this.logStream=XXt(this.logPath,{flags:"a"}),this.flushInterval=setInterval(()=>this.flush(),Od.FLUSH_INTERVAL_MS),this.info("DeploymentLogger","Deployment logging initialised",{appName:r,operationType:n,deploymentId:this.deploymentId,logPath:this.logPath})}catch{}}log(e,r,n,a,o,s){if(this.isClosing)return;let i={timestamp:new Date().toISOString(),level:e,component:r,message:n,correlationId:this.deploymentId,...a&&Object.keys(a).length>0&&{data:a},...o&&{stackName:o},...s&&{phase:s}};this.buffer.push(i),this.mainLogger.logWithCorrelation(e,r,n,this.deploymentId,a,o,s),this.buffer.length>=this.maxBufferSize&&this.flush()}flush(){if(!(this.buffer.length===0||!this.logStream)){for(let e of this.buffer)this.logStream.write(JSON.stringify(e)+`
100
100
  `);this.buffer=[]}}info(e,r,n){this.log("info",e,r,n)}warn(e,r,n){this.log("warn",e,r,n)}error(e,r,n){this.log("error",e,r,n)}debug(e,r,n){this.log("debug",e,r,n)}stackEvent(e,r,n,a){this.log("info","StackDeployment",n,a,e,r)}dockerEvent(e,r){this.log("info","DockerOperation",e,{percentage:r})}ecsEvent(e,r,n){this.log("info","ECSDeployment",e,{percentage:r,taskCount:n})}close(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.logStream&&(this.logStream.end(),this.logStream=null),this.buffer=[],this.isClosing=!1}getLogPath(){return this.logPath}getDeploymentId(){return this.deploymentId}}});function Er(t){return t.replace(/[-_](.)/g,(e,r)=>r.toUpperCase()).replace(/^./,e=>e.toUpperCase())}function An(t){return t.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function YA(t){return An(t).replace(/-/g,"_")}function RAe(t){return An(t).replace(/-/g,"_").toUpperCase()}function Dp(t){return t.length===0?t:t.charAt(0).toUpperCase()+t.slice(1)}function wU(t){return t.split(".").join("")}function qA(t){return t.toLowerCase().replace(/[^a-z0-9]/g,"")}function DAe(t){let e=t.replace(new RegExp("\\P{ASCII}","gu"),"");return qA(e)===qA(t)&&qA(t)!==""}var tQt,KA,lT=w(()=>{"use strict";tQt=Object.defineProperty,KA=(t,e)=>tQt(t,"name",{value:e,configurable:!0});KA(Er,"toPascalCase");KA(An,"toKebab");KA(YA,"toValidDatabaseName");KA(RAe,"toScreamingSnake");KA(Dp,"capitalise");KA(wU,"getSafeZoneName");KA(qA,"accountConstructKey");KA(DAe,"hasAsciiStableConstructKey")});function Fa(t){return`${Er(t.split(".").join(""))}Domain`}function vN(t){return`${t}UsEast1Certificates`}function Do(t){let e=t.replace(/\./g,"-");return{hostedZoneId:`${e}-hosted-zone-id`,certificateArn:`${e}-certificate-arn`,usEast1CertificateArn:`${e}-us-east-1-certificate-arn`,delegationRoleArn:`${e}-delegation-role-arn`,nameservers:`${e}-nameservers`}}function OAe(t){return typeof t.hostedZoneId=="string"}var rQt,JZ,XZ,qQe,KQe=w(()=>{"use strict";lT();rQt=Object.defineProperty,JZ=(t,e)=>rQt(t,"name",{value:e,configurable:!0}),XZ="@";JZ(Fa,"getDomainStackName");JZ(vN,"getDomainUsEast1CertificatesStackName");qQe="full";JZ(Do,"getDomainExportNames");JZ(OAe,"isManagedDomainBinding")});var ly,YQe=w(()=>{"use strict";ly="backupVault"});var SN,ZA,ZQe=w(()=>{"use strict";SN="Approval token: ",ZA="Token: "});function uT(t){return`${Er(t)}ImageTag`}var nQt,aQt,JQe=w(()=>{"use strict";lT();nQt=Object.defineProperty,aQt=(t,e)=>nQt(t,"name",{value:e,configurable:!0});aQt(uT,"imageTagParameterName")});function NAe(t){let e=new Map;for(let r of t){let n=qA(r);if(n==="")return{kind:"empty-construct-key",name:r};let a=e.get(n);if(a!==void 0)return{kind:"duplicate-construct-key",name:r,existingName:a,constructKey:n};e.set(n,r)}return null}var oQt,sQt,XQe=w(()=>{"use strict";lT();oQt=Object.defineProperty,sQt=(t,e)=>oQt(t,"name",{value:e,configurable:!0});sQt(NAe,"findAccountNameCollision")});function mu(t){return`${t} is an opt-in region: it must be enabled in the AWS account (Account settings \u2192 Regions) before deployment will succeed.`}function JA(t){return Xs.find(e=>e.code===t)}function uy(t){let e=t.split("-");return e.length===3&&e[0]&&e[1]&&e[2]?`${e[0]}${e[1][0]}${e[2]}`:t}function _Ae(t){return pu.has(t)?uQt[t]??ht:t}function HS(t){if(!t)return;let e=cQt[t];if(e!==void 0)return _Ae(e);let r=t.split("/")[0];if(r===void 0)return;let n=lQt[r];return n===void 0?void 0:_Ae(n)}var iQt,CU,ht,xU,Xs,du,pu,cQt,lQt,uQt,QZ=w(()=>{"use strict";iQt=Object.defineProperty,CU=(t,e)=>iQt(t,"name",{value:e,configurable:!0}),ht="us-east-2",xU=10,Xs=Object.freeze([{code:"us-east-2",name:"US East",city:"Ohio",country:"USA",optIn:!1},{code:"us-west-2",name:"US West",city:"Oregon",country:"USA",optIn:!1},{code:"us-east-1",name:"US East",city:"N. Virginia",country:"USA",optIn:!1},{code:"eu-west-1",name:"EU West",city:"Ireland",country:"Ireland",optIn:!1},{code:"eu-central-1",name:"EU Central",city:"Frankfurt",country:"Germany",optIn:!1},{code:"ap-southeast-1",name:"Asia Pacific",city:"Singapore",country:"Singapore",optIn:!1},{code:"ap-northeast-1",name:"Asia Pacific",city:"Tokyo",country:"Japan",optIn:!1},{code:"ap-southeast-2",name:"Asia Pacific",city:"Sydney",country:"Australia",optIn:!1},{code:"us-west-1",name:"US West",city:"N. California",country:"USA",optIn:!1},{code:"ca-central-1",name:"Canada",city:"Central",country:"Canada",optIn:!1},{code:"af-south-1",name:"Africa",city:"Cape Town",country:"South Africa",optIn:!0},{code:"ap-east-1",name:"Asia Pacific",city:"Hong Kong",country:"Hong Kong",optIn:!0},{code:"ap-northeast-2",name:"Asia Pacific",city:"Seoul",country:"South Korea",optIn:!1},{code:"ap-northeast-3",name:"Asia Pacific",city:"Osaka",country:"Japan",optIn:!1},{code:"ap-south-1",name:"Asia Pacific",city:"Mumbai",country:"India",optIn:!1},{code:"ap-south-2",name:"Asia Pacific",city:"Hyderabad",country:"India",optIn:!0},{code:"ap-southeast-3",name:"Asia Pacific",city:"Jakarta",country:"Indonesia",optIn:!0},{code:"ap-southeast-4",name:"Asia Pacific",city:"Melbourne",country:"Australia",optIn:!0},{code:"eu-central-2",name:"EU Central",city:"Zurich",country:"Switzerland",optIn:!0},{code:"eu-north-1",name:"EU North",city:"Stockholm",country:"Sweden",optIn:!1},{code:"eu-south-1",name:"EU South",city:"Milan",country:"Italy",optIn:!0},{code:"eu-south-2",name:"EU South",city:"Spain",country:"Spain",optIn:!0},{code:"eu-west-2",name:"EU West",city:"London",country:"UK",optIn:!1},{code:"eu-west-3",name:"EU West",city:"Paris",country:"France",optIn:!1},{code:"me-central-1",name:"Middle East",city:"UAE",country:"UAE",optIn:!0},{code:"me-south-1",name:"Middle East",city:"Bahrain",country:"Bahrain",optIn:!0},{code:"sa-east-1",name:"South America",city:"S\xE3o Paulo",country:"Brazil",optIn:!1},{code:"ap-southeast-5",name:"Asia Pacific",city:"Kuala Lumpur",country:"Malaysia",optIn:!0},{code:"ap-southeast-6",name:"Asia Pacific",city:"Auckland",country:"New Zealand",optIn:!0},{code:"ap-southeast-7",name:"Asia Pacific",city:"Bangkok",country:"Thailand",optIn:!0},{code:"ap-east-2",name:"Asia Pacific",city:"Taipei",country:"Taiwan",optIn:!0},{code:"ca-west-1",name:"Canada West",city:"Calgary",country:"Canada",optIn:!0},{code:"il-central-1",name:"Israel",city:"Tel Aviv",country:"Israel",optIn:!0},{code:"mx-central-1",name:"Mexico",city:"Central",country:"Mexico",optIn:!0}]),du=Object.freeze(Xs.map(t=>t.code)),pu=new Set(Xs.filter(t=>t.optIn).map(t=>t.code));CU(mu,"optInRegionWarning");CU(JA,"getRegionInfo");CU(uy,"abbreviateRegion");cQt=Object.freeze({"Europe/London":"eu-west-2","Europe/Jersey":"eu-west-2","Europe/Guernsey":"eu-west-2","Europe/Isle_of_Man":"eu-west-2","Europe/Dublin":"eu-west-1","Europe/Paris":"eu-west-3","Europe/Berlin":"eu-central-1","Europe/Amsterdam":"eu-central-1","Europe/Brussels":"eu-central-1","Europe/Luxembourg":"eu-central-1","Europe/Vienna":"eu-central-1","Europe/Prague":"eu-central-1","Europe/Warsaw":"eu-central-1","Europe/Budapest":"eu-central-1","Europe/Zurich":"eu-central-2","Europe/Stockholm":"eu-north-1","Europe/Oslo":"eu-north-1","Europe/Copenhagen":"eu-north-1","Europe/Helsinki":"eu-north-1","Europe/Tallinn":"eu-north-1","Europe/Riga":"eu-north-1","Europe/Vilnius":"eu-north-1","Europe/Rome":"eu-south-1","Europe/Malta":"eu-south-1","Europe/Athens":"eu-south-1","Europe/Madrid":"eu-south-2","Europe/Lisbon":"eu-south-2","America/New_York":"us-east-1","America/Detroit":"us-east-1","America/Toronto":"ca-central-1","America/Montreal":"ca-central-1","America/Halifax":"ca-central-1","America/Winnipeg":"ca-central-1","America/Chicago":"us-east-2","America/Indiana/Indianapolis":"us-east-2","America/Mexico_City":"us-east-2","America/Denver":"us-west-2","America/Phoenix":"us-west-2","America/Edmonton":"us-west-2","America/Vancouver":"us-west-2","America/Los_Angeles":"us-west-1","America/Tijuana":"us-west-1","America/Sao_Paulo":"sa-east-1","America/Argentina/Buenos_Aires":"sa-east-1","America/Santiago":"sa-east-1","America/Montevideo":"sa-east-1","America/Lima":"sa-east-1","America/Bogota":"us-east-1","Asia/Tokyo":"ap-northeast-1","Asia/Seoul":"ap-northeast-2","Asia/Hong_Kong":"ap-east-1","Asia/Shanghai":"ap-east-1","Asia/Taipei":"ap-east-1","Asia/Macau":"ap-east-1","Asia/Singapore":"ap-southeast-1","Asia/Kuala_Lumpur":"ap-southeast-1","Asia/Bangkok":"ap-southeast-1","Asia/Ho_Chi_Minh":"ap-southeast-1","Asia/Manila":"ap-southeast-1","Asia/Jakarta":"ap-southeast-3","Asia/Kolkata":"ap-south-1","Asia/Calcutta":"ap-south-1","Asia/Karachi":"ap-south-1","Asia/Dhaka":"ap-south-1","Asia/Colombo":"ap-south-1","Asia/Dubai":"me-central-1","Asia/Muscat":"me-central-1","Asia/Qatar":"me-south-1","Asia/Bahrain":"me-south-1","Asia/Riyadh":"me-south-1","Asia/Kuwait":"me-south-1","Asia/Jerusalem":"me-south-1","Australia/Sydney":"ap-southeast-2","Australia/Brisbane":"ap-southeast-2","Australia/Canberra":"ap-southeast-2","Australia/Melbourne":"ap-southeast-4","Australia/Hobart":"ap-southeast-4","Australia/Adelaide":"ap-southeast-4","Pacific/Auckland":"ap-southeast-2","Pacific/Honolulu":"us-west-1","Africa/Johannesburg":"af-south-1","Africa/Casablanca":"eu-south-2","Africa/Cairo":"me-south-1","Indian/Maldives":"ap-south-1"}),lQt=Object.freeze({Europe:"eu-central-1",America:"us-east-1",Asia:"ap-southeast-1",Australia:"ap-southeast-2",Pacific:"ap-southeast-2",Africa:"af-south-1",Atlantic:"eu-west-1",Indian:"ap-south-1"}),uQt=Object.freeze({"af-south-1":"eu-west-1","ap-east-1":"ap-southeast-1","ap-southeast-3":"ap-southeast-1","ap-southeast-4":"ap-southeast-2","eu-central-2":"eu-central-1","eu-south-1":"eu-central-1","eu-south-2":"eu-west-3","me-central-1":"ap-south-1","me-south-1":"ap-south-1"});CU(_Ae,"toDeployableRegion");CU(HS,"suggestRegionForTimezone")});function eJ(t){return An(t).replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function $Ae(t,e){let r=eJ(t),n=eJ(e);return r===""?n:n===""?r:`${r}-${n}`}function MAe(t,e){let r=eJ(e);return r===""?t:`${t}-${r}`}function dT(t){let e=t.toLowerCase().split(/[-\s_]+/).filter(n=>n.length>0),r=e[e.length-1];if(r!==void 0&&LAe.has(r))return r}function pT(t){return`Account name must not end with a region code ("-${t}") \u2014 the region is added automatically when deploying. Remove the "-${t}" suffix.`}var dQt,TU,LAe,QQe=w(()=>{"use strict";QZ();lT();dQt=Object.defineProperty,TU=(t,e)=>dQt(t,"name",{value:e,configurable:!0});TU(eJ,"slugifyAccountName");TU($Ae,"defaultConnectedAccountName");TU(MAe,"suffixedAccountName");LAe=new Set(Xs.map(t=>uy(t.code)));TU(dT,"findTrailingRegionShortCode");TU(pT,"regionSuffixRejectionMessage")});function $r(t){return t instanceof Error?t:new Error(String(t))}function T(t){return t instanceof Error?t.message:typeof t=="string"?t:t&&typeof t=="object"&&"message"in t?String(t.message):"An unknown error occurred"}function kU(t,e){return!t||typeof t!="object"?!1:"code"in t&&t.code===e}function EN(t){if(!(!t||typeof t!="object")&&"code"in t&&typeof t.code=="string")return t.code}function mT(t){return t instanceof Error?t.stack:void 0}function IU(t){let e=T(t),r=EN(t);return r&&r!=="UNKNOWN_ERROR"?`[${r}] ${e}`:e}var pQt,bN,PU=w(()=>{"use strict";pQt=Object.defineProperty,bN=(t,e)=>pQt(t,"name",{value:e,configurable:!0});bN($r,"normaliseError");bN(T,"getErrorMessage");bN(kU,"hasErrorCode");bN(EN,"getErrorCode");bN(mT,"getErrorStack");bN(IU,"formatErrorString")});function kr(t){let e,r=!1;return()=>(r||(e=t(),r=!0),e)}var mQt,fQt,eet=w(()=>{"use strict";mQt=Object.defineProperty,fQt=(t,e)=>mQt(t,"name",{value:e,configurable:!0});fQt(kr,"singleton")});var hQt,gQt,Mt,tet=w(()=>{"use strict";hQt=Object.defineProperty,gQt=(t,e)=>hQt(t,"name",{value:e,configurable:!0}),Mt=gQt(t=>new Promise(e=>setTimeout(e,t)),"sleep")});async function Ch(t,e,r){let n=new Array(t.length);if(t.length===0)return n;let a=Math.max(1,Math.min(e,t.length)),o=0,s=ret(async()=>{for(;o<t.length;){let i=o++;try{let c=await r(t[i],i);n[i]={status:"fulfilled",value:c}}catch(c){n[i]={status:"rejected",reason:c}}}},"worker");return await Promise.all(Array.from({length:a},()=>s())),n}var yQt,ret,net=w(()=>{"use strict";yQt=Object.defineProperty,ret=(t,e)=>yQt(t,"name",{value:e,configurable:!0});ret(Ch,"mapSettledWithConcurrency")});function hT(t){return SQt.has(t)}function FAe(t){return hT(t)?RU[t]:t.charAt(0).toUpperCase()+t.slice(1)}function jAe(t){return EQt.has(t)}function UAe(t){return AQt.has(t)}function qS(t){return t===fu.ROOT?"organisation":t===fu.PLATFORM?"platform":"account"}function gT(t){return t==null||t===""||t===fu.ROOT?null:hT(t)?t:null}function dr(t){return t.tier??qS(t.environment)}var vQt,fT,Nd,RU,SQt,fu,DU,tJ,aet,bi,bQt,EQt,BAe,AQt,VAe=w(()=>{"use strict";Lt();vQt=Object.defineProperty,fT=(t,e)=>vQt(t,"name",{value:e,configurable:!0}),Nd=["production","staging","development","platform","compliance"],RU={production:"Production",staging:"Staging",development:"Development",platform:"Platform",compliance:"Compliance"},SQt=new Set(Nd);fT(hT,"isAccountStage");fu={ROOT:"root",PLATFORM:"platform"},DU=[...Nd,fu.ROOT];fT(FAe,"getEnvironmentLabel");tJ=["organisation","platform","account"],aet=h.enum(tJ),bi={ORGANISATION:"organisation",PLATFORM:"platform",ACCOUNT:"account"},bQt={[bi.ORGANISATION]:!0,[bi.PLATFORM]:!0,[bi.ACCOUNT]:!0},EQt=new Set(Object.keys(bQt));fT(jAe,"isAccountTier");BAe=tJ.filter(t=>t!==bi.ACCOUNT),AQt=new Set(BAe);fT(UAe,"isGovernanceTier");fT(qS,"environmentToTier");fT(gT,"stageFromWireEnvironment");fT(dr,"accountTier")});function dy(t){if(!t)return"compute";if(t.startsWith("Custom::"))return oet[t]??"compute";let e=oet[t];return e||zAe.add(t),e??"compute"}function CQt(){return new Set(zAe)}function xQt(){zAe.clear()}function AN(t){return TQt[t]??kQt}function dl(t){return IQt[t]||t.split("::").pop()||t}var wQt,OU,rJ,oet,zAe,TQt,kQt,IQt,GAe=w(()=>{"use strict";wQt=Object.defineProperty,OU=(t,e)=>wQt(t,"name",{value:e,configurable:!0}),rJ=["security","network","compute","database","storage","monitoring","dns","identity","bootstrap","events","registry","backup"],oet=Object.freeze({"AWS::IAM::Role":"security","AWS::IAM::Policy":"security","AWS::IAM::OIDCProvider":"security","AWS::EC2::SecurityGroup":"security","AWS::KMS::Key":"security","AWS::KMS::Alias":"security","AWS::EC2::VPC":"network","AWS::EC2::Subnet":"network","AWS::EC2::InternetGateway":"network","AWS::EC2::NatGateway":"network","AWS::EC2::RouteTable":"network","AWS::EC2::Route":"network","AWS::EC2::VPCGatewayAttachment":"network","AWS::EC2::SubnetRouteTableAssociation":"network","AWS::EC2::EIP":"network","AWS::ECS::Cluster":"compute","AWS::ECS::Service":"compute","AWS::ECS::TaskDefinition":"compute","AWS::Lambda::Function":"compute","AWS::ElasticLoadBalancingV2::LoadBalancer":"compute","AWS::ElasticLoadBalancingV2::TargetGroup":"compute","AWS::ElasticLoadBalancingV2::Listener":"compute","AWS::ElasticLoadBalancingV2::ListenerRule":"compute","AWS::RDS::DBInstance":"database","AWS::RDS::DBCluster":"database","AWS::SecretsManager::Secret":"database","AWS::S3::Bucket":"storage","AWS::S3::BucketPolicy":"storage","AWS::CloudTrail::Trail":"monitoring","AWS::CloudWatch::Alarm":"monitoring","AWS::Logs::LogGroup":"monitoring","AWS::Events::EventBus":"events","AWS::Events::Rule":"events","AWS::ECR::Repository":"registry","AWS::CodeBuild::Project":"registry","AWS::Route53::RecordSet":"dns","AWS::CertificateManager::Certificate":"dns","AWS::CloudFront::Distribution":"dns","AWS::Backup::BackupVault":"backup","AWS::Backup::BackupPlan":"backup","AWS::Backup::BackupSelection":"backup","AWS::SSO::PermissionSet":"identity","AWS::SSO::Assignment":"identity","AWS::Organizations::Account":"identity","AWS::CDK::Metadata":"compute","AWS::CloudFormation::CustomResource":"compute","AWS::CloudFormation::WaitCondition":"compute","AWS::CloudFormation::WaitConditionHandle":"compute"}),zAe=new Set;OU(dy,"categoriseResource");OU(CQt,"getUnmappedResourceTypes");OU(xQt,"clearUnmappedResourceTypes");TQt=Object.freeze({"AWS::EC2::NatGateway":120,"AWS::RDS::DBInstance":300,"AWS::RDS::DBCluster":300,"AWS::CloudFront::Distribution":300,"AWS::ECS::Service":180,"AWS::ElasticLoadBalancingV2::LoadBalancer":60,"AWS::EC2::SecurityGroup":10,"AWS::IAM::Role":15,"AWS::IAM::Policy":15,"AWS::IAM::OIDCProvider":10,"AWS::S3::Bucket":10,"AWS::S3::BucketPolicy":5,"AWS::Lambda::Function":30,"AWS::EC2::VPC":15,"AWS::EC2::Subnet":15,"AWS::EC2::InternetGateway":10,"AWS::EC2::RouteTable":5,"AWS::EC2::Route":5,"AWS::EC2::VPCGatewayAttachment":10,"AWS::EC2::SubnetRouteTableAssociation":5,"AWS::EC2::EIP":10,"AWS::ECS::Cluster":15,"AWS::ECS::TaskDefinition":10,"AWS::ElasticLoadBalancingV2::TargetGroup":10,"AWS::ElasticLoadBalancingV2::Listener":10,"AWS::ElasticLoadBalancingV2::ListenerRule":5,"AWS::SecretsManager::Secret":10,"AWS::Logs::LogGroup":5,"AWS::CloudWatch::Alarm":10,"AWS::CloudTrail::Trail":15,"AWS::Events::EventBus":5,"AWS::Events::Rule":5,"AWS::ECR::Repository":10,"AWS::Route53::RecordSet":30,"AWS::CertificateManager::Certificate":60,"AWS::KMS::Key":15,"AWS::KMS::Alias":5,"AWS::Backup::BackupVault":10,"AWS::Backup::BackupPlan":10,"AWS::Backup::BackupSelection":10,"AWS::SSO::PermissionSet":15,"AWS::SSO::Assignment":10,"AWS::Organizations::Account":60}),kQt=30;OU(AN,"getExpectedDuration");IQt=Object.freeze({"AWS::Lambda::Function":"Lambda Function","AWS::IAM::Role":"IAM Role","AWS::IAM::Policy":"IAM Policy","AWS::S3::Bucket":"S3 Bucket","AWS::DynamoDB::Table":"DynamoDB Table","AWS::EC2::Instance":"EC2 Instance","AWS::EC2::SecurityGroup":"Security Group","AWS::EC2::VPC":"VPC","AWS::EC2::Subnet":"Subnet","AWS::EC2::InternetGateway":"Internet Gateway","AWS::EC2::RouteTable":"Route Table","AWS::EC2::Route":"Route","AWS::ECS::Cluster":"ECS Cluster","AWS::ECS::Service":"ECS Service","AWS::ECS::TaskDefinition":"Task Definition","AWS::ElasticLoadBalancingV2::LoadBalancer":"Load Balancer","AWS::ElasticLoadBalancingV2::TargetGroup":"Target Group","AWS::ElasticLoadBalancingV2::Listener":"Listener","AWS::CloudFormation::Stack":"CloudFormation Stack","AWS::CDK::Metadata":"CDK Metadata","Custom::CDKBucketDeployment":"Bucket Deployment","AWS::SSM::Parameter":"SSM Parameter","AWS::CloudWatch::Alarm":"CloudWatch Alarm","AWS::Logs::LogGroup":"Log Group","AWS::ApiGateway::RestApi":"API Gateway","AWS::ApiGateway::Deployment":"API Deployment","AWS::ApiGateway::Stage":"API Stage","AWS::ApiGateway::Method":"API Method","AWS::ApiGateway::Resource":"API Resource","AWS::CloudFront::Distribution":"CloudFront Distribution","AWS::Route53::RecordSet":"Route53 Record","AWS::RDS::DBInstance":"RDS Instance","AWS::RDS::DBCluster":"RDS Cluster","AWS::SQS::Queue":"SQS Queue","AWS::SNS::Topic":"SNS Topic","AWS::Events::Rule":"EventBridge Rule","AWS::StepFunctions::StateMachine":"Step Function","AWS::EC2::NatGateway":"NAT Gateway","AWS::EC2::EIP":"Elastic IP","AWS::EC2::VPCGatewayAttachment":"Gateway Attachment","AWS::EC2::SubnetRouteTableAssociation":"Route Association","AWS::CloudTrail::Trail":"CloudTrail","AWS::IAM::OIDCProvider":"OIDC Provider","AWS::Events::EventBus":"Event Bus","AWS::Backup::BackupVault":"Backup Vault","AWS::Backup::BackupPlan":"Backup Plan","AWS::Backup::BackupSelection":"Backup Selection","AWS::SecretsManager::Secret":"Secret","AWS::KMS::Key":"KMS Key","AWS::KMS::Alias":"KMS Alias","AWS::ECR::Repository":"ECR Repository","AWS::CertificateManager::Certificate":"Certificate","AWS::ElasticLoadBalancingV2::ListenerRule":"Listener Rule","AWS::EC2::IPAM":"IPAM","AWS::EC2::IPAMPool":"IPAM Pool","AWS::EC2::IPAMPoolCidr":"IPAM Pool CIDR","Custom::ram":"RAM","Custom::ipamDelegateAdmin":"IPAM Delegate Admin","Custom::CostAllocationTags":"Cost Allocation Tags","Custom::ActivateOrganisationsAccess":"Activate Organisations Access","Custom::Organizations_TagResource":"Organisations Tag Resource","AWS::CloudFormation::CustomResource":"Custom Resource","AWS::CloudFormation::WaitCondition":"Wait Condition","AWS::CloudFormation::WaitConditionHandle":"Wait Condition Handle","AWS::SSO::PermissionSet":"SSO Permission Set","AWS::SSO::Assignment":"SSO Assignment","AWS::Organizations::Account":"Organisations Account","AWS::S3::BucketPolicy":"S3 Bucket Policy","AWS::CodeBuild::Project":"CodeBuild Project"});OU(dl,"getFriendlyResourceType")});function yT(t){if(!t)return null;let e=t.replace(/^(https?:\/\/)[^@]+@/,"$1"),r=e.match(OQt)??e.match(NQt)??t.match(_Qt);if(!r)return null;let[,n,a,o]=r;return!n||!a||!o?null:{provider:DQt[n]??"other",owner:a,repo:o,host:n}}var PQt,RQt,DQt,OQt,NQt,_Qt,set=w(()=>{"use strict";PQt=Object.defineProperty,RQt=(t,e)=>PQt(t,"name",{value:e,configurable:!0}),DQt={"github.com":"github","gitlab.com":"gitlab","bitbucket.org":"bitbucket"},OQt=/^https?:\/\/([^/]+)\/(.+?)\/([^/.]+?)(?:\.git)?$/,NQt=/^git@([^:]+):(.+?)\/([^/.]+?)(?:\.git)?$/,_Qt=/^ssh:\/\/[^@]+@([^:/]+)(?::\d+)?\/(.+?)\/([^/.]+?)(?:\.git)?$/;RQt(yT,"parseGitRemoteUrl")});var nJ,iet,aJ,oJ,sJ,cet=w(()=>{"use strict";nJ=["read","write","deploy","secrets:read","secrets:write","destroy","admin","applications:read","applications:deploy","deploy:oidc:mint","deploy:governance"],iet={read:"user",write:"user",deploy:"user","secrets:read":"user","secrets:write":"user",destroy:"user",admin:"admin","applications:read":"user","applications:deploy":"user","deploy:oidc:mint":"machine","deploy:governance":"machine"},aJ=nJ.filter(t=>iet[t]==="machine"),oJ="governance_scope_required",sJ=nJ.filter(t=>iet[t]==="user")});function vT(t){let e=[t.app];return t.lambda?e.push("lambda",t.lambda):(t.cluster&&e.push(t.cluster),t.service&&t.cluster&&e.push(t.service)),e}function Dc(t,e){let r=vT(t);return e&&r.push(e),"/"+r.join("/")}function YS(t){let e=t.split("/").filter(Boolean);if(e.length<2)return null;let r=e[e.length-1]??"",n={app:e[0]??""};return e.length>=4&&e[1]==="lambda"?n.lambda=e[2]:e.length>=3&&(n.cluster=e[1],e.length>=4&&(n.service=e[2])),{namespace:n,name:r}}function WAe(t){let e=YS(t);return e?Hm.safeParse(e.namespace).success&&Dc(e.namespace,e.name)===t:!1}function XA(t){let e={};for(let r of t.split(`
101
101
  `)){let n=r.trim();if(!n||n.startsWith("#"))continue;let a=n.replace(/^export\s+/,""),o=a.indexOf("=");if(o===-1)continue;let s=a.slice(0,o).trim();if(!Wm.test(s))continue;let i=a.slice(o+1);i.length>=2&&i.startsWith('"')&&i.endsWith('"')?e[s]=i.slice(1,-1).replace(/\\([\\"$`nr])/g,(c,l)=>l==="n"?`
102
- `:l==="r"?"\r":l):i.length>=2&&i.startsWith("'")&&i.endsWith("'")?e[s]=i.slice(1,-1):e[s]=i}return e}function _U(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var $Qt,wN,Wm,KS,CN,NU,uet,iJ,Hm,det=w(()=>{"use strict";Lt();$Qt=Object.defineProperty,wN=(t,e)=>$Qt(t,"name",{value:e,configurable:!0}),Wm=/^[a-zA-Z_][a-zA-Z0-9._-]*$/,KS="Secret name must start with a letter or underscore and contain only letters, numbers, underscores, hyphens, or periods",CN=/^[a-zA-Z][a-zA-Z0-9._-]*$/,NU="Must start with a letter and contain only letters, numbers, periods, hyphens, or underscores",uet=4096,iJ=h.string().regex(CN,NU),Hm=h.object({app:iJ.describe("Application name"),cluster:iJ.optional().describe("Cluster name"),service:iJ.optional().describe("Service name"),lambda:iJ.optional().describe("Lambda function name")}).strict().refine(t=>!(t.service&&!t.cluster),{message:"Cluster is required when service is specified"}).refine(t=>!(t.lambda&&(t.cluster||t.service)),{message:"Lambda is mutually exclusive with cluster and service"}).refine(t=>t.cluster!=="lambda",{message:'The cluster name "lambda" is reserved for lambda-scoped parameter paths'});wN(vT,"buildNamespaceParts");wN(Dc,"buildParameterPath");wN(YS,"parseParameterPath");wN(WAe,"isManageablePath");wN(XA,"parseDotEnv");wN(_U,"escapeDotEnvValue")});var $U,cJ,pet=w(()=>{"use strict";Lt();$U=h.object({awsAccountId:h.string(),accountName:h.string().nullable(),status:h.string(),role:h.string(),roleArn:h.string(),environment:h.string().optional(),connectedAt:h.string()}),cJ=h.object({accounts:h.array($U)})});function Ls(t){let e=[t.primaryRegion,...t.secondaryRegions??[],t.disasterRecoveryRegion].filter(r=>r!==void 0);return[...new Set(e)]}function xh(t){return t.environment??dr(t)}function Ei(t,e){return`${t.toLowerCase()}-${uy(e)}`}function Th(t,e){let r=[];for(let n of t){if(dr(n)==="organisation")continue;let a=xh(n);for(let o of e)r.push({name:Ei(n.name,o),accountName:n.name,accountId:n.id,environment:a,region:o})}return r.sort((n,a)=>{let o=n.environment.localeCompare(a.environment);if(o!==0)return o;let s=n.accountName.localeCompare(a.accountName);return s!==0?s:n.region.localeCompare(a.region)})}function Op(t){return Th(t.providerAccounts,Ls(t))}function LQt(t,e){if(e.length===0)return t;let r=new Set([t.primaryRegion,t.disasterRecoveryRegion].filter(Boolean)),n=e.filter(a=>!r.has(a));return{...t,secondaryRegions:n.length>0?n:void 0}}function _d(t,e){return t.find(r=>r.name===e)}var MQt,ST,met=w(()=>{"use strict";QZ();VAe();MQt=Object.defineProperty,ST=(t,e)=>MQt(t,"name",{value:e,configurable:!0});ST(Ls,"deriveRegionsFromOrgConfig");ST(xh,"environmentOrTier");ST(Ei,"generateTargetName");ST(Th,"deriveTargets");ST(Op,"deriveAllTargets");ST(LQt,"mergeSecondaryRegions");ST(_d,"findTarget")});function Ki(t,e){if(e!==void 0){if(e.trim()==="")throw new Error("buildAppConfigPath: container must be a non-empty string");return`${e}/fjall/${t}`}return`fjall/${t}`}var FQt,jQt,fet=w(()=>{"use strict";FQt=Object.defineProperty,jQt=(t,e)=>FQt(t,"name",{value:e,configurable:!0});jQt(Ki,"buildAppConfigPath")});function MU(t,e){let r=e?.excludedPathPrefixes,n=e?.excludedPathSegments,a=[];for(let o of t){if(!TN(o.path)||r&&get(o.path,r)||n&&yet(o.path,n))continue;let s=lJ(o.path);s!==null&&a.push({configPath:het(o.path),boundaryPath:s})}return a}function TN(t){return t===QA||t.endsWith(`/${QA}`)}function lJ(t){let e=t.split("/");for(let r=0;r<e.length-1;r++)if(e[r]===Np)return e.slice(0,r+1).join("/");return null}function het(t){return t.slice(0,-`/${QA}`.length)}function get(t,e){for(let r of e)if(t.startsWith(r))return!0;return!1}function yet(t,e){let r=t.split("/");for(let n=0;n<r.length-1;n++)if(e.has(r[n]))return!0;return!1}var BQt,xN,QA,Np,kN=w(()=>{"use strict";BQt=Object.defineProperty,xN=(t,e)=>BQt(t,"name",{value:e,configurable:!0}),QA="infrastructure.ts",Np="fjall";xN(MU,"findInfrastructurePaths");xN(TN,"isInfrastructureFile");xN(lJ,"findBoundaryPath");xN(het,"toConfigDir");xN(get,"hasExcludedPrefix");xN(yet,"hasExcludedSegment")});function LU(t){if(t.length===0)return null;let e=[];for(let n of t){let a=vet(n.boundaryPath);if(a===null)return null;e.push(a)}let r=bet(e);return r.length===0?null:r.join("/")}function vet(t){let e=t.split("/").filter(n=>n.length>0);if(e.length===0||e[e.length-1]!==Np)return null;let r=e.slice(0,e.length-1);return r.length===0?null:r}function bet(t){if(t.length===0)return[];let[e,...r]=t,n=[];for(let a=0;a<e.length;a+=1){let o=e[a];for(let s of r)if(s[a]!==o)return n;n.push(o)}return n}var UQt,HAe,Eet=w(()=>{"use strict";kN();UQt=Object.defineProperty,HAe=(t,e)=>UQt(t,"name",{value:e,configurable:!0});HAe(LU,"inferContainerFromCandidates");HAe(vet,"extractContainer");HAe(bet,"longestCommonPrefix")});function FU(t){return qAe.includes(t.toLowerCase())}function jU(t){return An(t).endsWith(KAe)}var VQt,Aet,qAe,uJ,KAe,dJ,wet=w(()=>{"use strict";lT();VQt=Object.defineProperty,Aet=(t,e)=>VQt(t,"name",{value:e,configurable:!0}),qAe=["fjall","organisation","platform","account","domain"],uJ="This application name is reserved for Fjall's organisation-tier infrastructure.";Aet(FU,"isReservedAppName");KAe="-cache",dJ="Application names ending in '-cache' are reserved for Fjall build-cache repositories.";Aet(jU,"hasReservedAppNameSuffix")});function xet(t){return{success:!0,data:t}}function BU(t){return{success:!1,error:t}}function bT(t,e,r){if(!t.startsWith(Cet))return BU(new Error(`expected sha256:... digest, got ${t.slice(0,32)}`));let n=t.slice(Cet.length);if(n.length<pJ)return BU(new Error(`digest hex payload too short (need >=${pJ} chars, got ${n.length})`));let a=e.trim();if(a==="")return BU(new Error("serviceName must be a non-empty string"));let o;if(r!==void 0){let c=r.trim();if(c==="")return BU(new Error("target, when supplied, must be a non-empty string; omit the argument instead"));o=c.toLowerCase()}let s=n.slice(0,pJ).toLowerCase(),i=o!==void 0?`${a.toLowerCase()}-${o}`:a.toLowerCase();return xet(`${i}-sha-${s}`)}var zQt,YAe,Cet,pJ,mJ,Tet=w(()=>{"use strict";zQt=Object.defineProperty,YAe=(t,e)=>zQt(t,"name",{value:e,configurable:!0});YAe(xet,"success");YAe(BU,"failure");Cet="sha256:",pJ=12,mJ=new RegExp(`-sha-[0-9a-f]{${pJ}}$`);YAe(bT,"deriveContentHashTag")});function pl(t,e){return`${t}${e}`}var GQt,WQt,ZAe,JAe,fJ,ew,IN,XAe,ket,Iet=w(()=>{"use strict";Lt();GQt=Object.defineProperty,WQt=(t,e)=>GQt(t,"name",{value:e,configurable:!0}),ZAe=["full","code-only","rollback","restart"],JAe=h.enum(ZAe),fJ=/^[a-zA-Z0-9._-]+$/,ew=h.string().min(1).max(128).regex(fJ),IN=h.object({serviceName:h.string().min(1),imageTag:ew,imageDigest:h.string().min(1).optional(),imageUri:h.string().min(1),ecrRepositoryArn:h.string().min(1).optional(),taskDefinitionArn:h.string().min(1).optional(),previousTaskDefinitionArn:h.string().min(1).optional(),functionArn:h.string().min(1).optional(),publishedVersion:h.string().min(1).optional()}).strict(),XAe=h.array(IN),ket=["TaskDefinition","PreviousTaskDefinition","ImageTag","ImageUri","EcrRepositoryArn","ImageDigest"];WQt(pl,"artefactOutputKey")});var QAe,UU,VU,ewe,twe,rwe,ET,zU,Pet,PN=w(()=>{"use strict";QAe="fjall-premigrate",UU="EXPECTED_SCHEMA_VERSION",VU="EXPECTED_SCHEMA_VERSION_TOOL",ewe="EXPECTED_CH_SCHEMA_VERSION",twe="SCHEMA_ADMIN_USER",rwe="SCHEMA_ADMIN_PASSWORD",ET=/^\d{14}_/,zU=/\.dev\.sql$/,Pet=/\.sql$/});var hJ,Ret=w(()=>{"use strict";hJ={"AWS::SecretsManager::Secret":"Name","AWS::SQS::Queue":"QueueName","AWS::SNS::Topic":"TopicName"}});function DN(t){return typeof t=="string"&&RN.has(t)}function py(t){return t!=null&&qQt.has(t)}var HQt,Det,_p,RN,hu,ZS,tw,qQt,AT,gJ=w(()=>{"use strict";HQt=Object.defineProperty,Det=(t,e)=>HQt(t,"name",{value:e,configurable:!0}),_p=["payload","nextjs","staticsite"],RN=new Set(_p);Det(DN,"isPatternType");hu={payload:{label:"Payload CMS",constructIdSuffix:"Payload",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!0},nextjs:{label:"Next.js",constructIdSuffix:"Nextjs",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!1},staticsite:{label:"Static site",constructIdSuffix:"StaticSite",artefact:"static-assets",stackPlacement:"cdn",deployable:!0}},ZS=_p.filter(t=>hu[t].deployable),tw=_p.filter(t=>hu[t].artefact==="opennext-lambda"),qQt=new Set(tw);Det(py,"isOpenNextPatternType");AT=["multipage","spa"]});function vJ(t){return`${yJ}@${t}`}function SJ(t){return`https://${t}`}function ON(t,e){let r=t.split("@");if(r.length!==2)return!1;let[n,a]=r;return n===void 0||n===""||a===void 0?!1:a.toLowerCase()===e.toLowerCase()}var KQt,nwe,yJ,awe=w(()=>{"use strict";KQt=Object.defineProperty,nwe=(t,e)=>KQt(t,"name",{value:e,configurable:!0}),yJ="noreply";nwe(vJ,"defaultFormsFromAddress");nwe(SJ,"defaultFormsCorsOrigin");nwe(ON,"isAddressAtDomain")});var owe,Oet,YQt,Net,_et,$et,Met=w(()=>{"use strict";Lt();owe=2,Oet="dev-substrate-params.json",YQt=h.object({devDomain:h.string().min(1),hostedZoneId:h.string().min(1).optional(),parentDomain:h.string().min(1).optional(),parentDelegationRoleArn:h.string().min(1).optional()}).strict().superRefine((t,e)=>{if(t.hostedZoneId!==void 0){t.parentDomain!==void 0&&e.addIssue({code:"custom",path:["parentDomain"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDomain \u2014 the adopted zone was already delegated; omit parentDomain"}),t.parentDelegationRoleArn!==void 0&&e.addIssue({code:"custom",path:["parentDelegationRoleArn"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDelegationRoleArn \u2014 the adopted zone was already delegated; omit parentDelegationRoleArn"});return}t.parentDelegationRoleArn!==void 0&&t.parentDomain===void 0&&e.addIssue({code:"custom",path:["parentDomain"],message:"parentDelegationRoleArn requires parentDomain \u2014 set parentDomain to the parent zone the DelegationRole belongs to"}),t.parentDomain!==void 0&&!t.devDomain.endsWith(`.${t.parentDomain}`)&&e.addIssue({code:"custom",path:["parentDomain"],message:"parentDomain must be a proper DNS suffix of devDomain \u2014 devDomain must end with `.<parentDomain>`"})}),Net={appId:h.string().min(1),appKebab:h.string().min(1),engineVersion:h.string().min(1).optional(),adoptSlotEcr:h.boolean().optional(),phase:h.enum(["zone","full"]).optional(),domain:YQt.optional()},_et=h.object(Net).strict(),$et=h.object({...Net,version:h.literal(owe),appName:h.string().min(1)}).strict().refine(t=>t.appName===`fjall-dev-${t.appKebab}`,{message:"appName must equal `fjall-dev-${appKebab}` (single-source identity)",path:["appName"]})});var Let,Fet=w(()=>{"use strict";Let=`#!/usr/bin/env node
102
+ `:l==="r"?"\r":l):i.length>=2&&i.startsWith("'")&&i.endsWith("'")?e[s]=i.slice(1,-1):e[s]=i}return e}function _U(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var $Qt,wN,Wm,KS,CN,NU,uet,iJ,Hm,det=w(()=>{"use strict";Lt();$Qt=Object.defineProperty,wN=(t,e)=>$Qt(t,"name",{value:e,configurable:!0}),Wm=/^[a-zA-Z_][a-zA-Z0-9._-]*$/,KS="Secret name must start with a letter or underscore and contain only letters, numbers, underscores, hyphens, or periods",CN=/^[a-zA-Z][a-zA-Z0-9._-]*$/,NU="Must start with a letter and contain only letters, numbers, periods, hyphens, or underscores",uet=4096,iJ=h.string().regex(CN,NU),Hm=h.object({app:iJ.describe("Application name"),cluster:iJ.optional().describe("Cluster name"),service:iJ.optional().describe("Service name"),lambda:iJ.optional().describe("Lambda function name")}).strict().refine(t=>!(t.service&&!t.cluster),{message:"Cluster is required when service is specified"}).refine(t=>!(t.lambda&&(t.cluster||t.service)),{message:"Lambda is mutually exclusive with cluster and service"}).refine(t=>t.cluster!=="lambda",{message:'The cluster name "lambda" is reserved for lambda-scoped parameter paths'});wN(vT,"buildNamespaceParts");wN(Dc,"buildParameterPath");wN(YS,"parseParameterPath");wN(WAe,"isManageablePath");wN(XA,"parseDotEnv");wN(_U,"escapeDotEnvValue")});var $U,cJ,pet=w(()=>{"use strict";Lt();$U=h.object({awsAccountId:h.string(),accountName:h.string().nullable(),status:h.string(),role:h.string(),roleArn:h.string(),environment:h.string().optional(),connectedAt:h.string()}),cJ=h.object({accounts:h.array($U)})});function Ls(t){let e=[t.primaryRegion,...t.secondaryRegions??[],t.disasterRecoveryRegion].filter(r=>r!==void 0);return[...new Set(e)]}function xh(t){return t.environment??dr(t)}function Ei(t,e){return`${t.toLowerCase()}-${uy(e)}`}function Th(t,e){let r=[];for(let n of t){if(dr(n)==="organisation")continue;let a=xh(n);for(let o of e)r.push({name:Ei(n.name,o),accountName:n.name,accountId:n.id,environment:a,region:o})}return r.sort((n,a)=>{let o=n.environment.localeCompare(a.environment);if(o!==0)return o;let s=n.accountName.localeCompare(a.accountName);return s!==0?s:n.region.localeCompare(a.region)})}function Op(t){return Th(t.providerAccounts,Ls(t))}function LQt(t,e){if(e.length===0)return t;let r=new Set([t.primaryRegion,t.disasterRecoveryRegion].filter(Boolean)),n=e.filter(a=>!r.has(a));return{...t,secondaryRegions:n.length>0?n:void 0}}function _d(t,e){return t.find(r=>r.name===e)}var MQt,ST,met=w(()=>{"use strict";QZ();VAe();MQt=Object.defineProperty,ST=(t,e)=>MQt(t,"name",{value:e,configurable:!0});ST(Ls,"deriveRegionsFromOrgConfig");ST(xh,"environmentOrTier");ST(Ei,"generateTargetName");ST(Th,"deriveTargets");ST(Op,"deriveAllTargets");ST(LQt,"mergeSecondaryRegions");ST(_d,"findTarget")});function Ki(t,e){if(e!==void 0){if(e.trim()==="")throw new Error("buildAppConfigPath: container must be a non-empty string");return`${e}/fjall/${t}`}return`fjall/${t}`}var FQt,jQt,fet=w(()=>{"use strict";FQt=Object.defineProperty,jQt=(t,e)=>FQt(t,"name",{value:e,configurable:!0});jQt(Ki,"buildAppConfigPath")});function MU(t,e){let r=e?.excludedPathPrefixes,n=e?.excludedPathSegments,a=[];for(let o of t){if(!TN(o.path)||r&&get(o.path,r)||n&&yet(o.path,n))continue;let s=lJ(o.path);s!==null&&a.push({configPath:het(o.path),boundaryPath:s})}return a}function TN(t){return t===QA||t.endsWith(`/${QA}`)}function lJ(t){let e=t.split("/");for(let r=0;r<e.length-1;r++)if(e[r]===Np)return e.slice(0,r+1).join("/");return null}function het(t){return t.slice(0,-`/${QA}`.length)}function get(t,e){for(let r of e)if(t.startsWith(r))return!0;return!1}function yet(t,e){let r=t.split("/");for(let n=0;n<r.length-1;n++)if(e.has(r[n]))return!0;return!1}var BQt,xN,QA,Np,kN=w(()=>{"use strict";BQt=Object.defineProperty,xN=(t,e)=>BQt(t,"name",{value:e,configurable:!0}),QA="infrastructure.ts",Np="fjall";xN(MU,"findInfrastructurePaths");xN(TN,"isInfrastructureFile");xN(lJ,"findBoundaryPath");xN(het,"toConfigDir");xN(get,"hasExcludedPrefix");xN(yet,"hasExcludedSegment")});function LU(t){if(t.length===0)return null;let e=[];for(let n of t){let a=vet(n.boundaryPath);if(a===null)return null;e.push(a)}let r=bet(e);return r.length===0?null:r.join("/")}function vet(t){let e=t.split("/").filter(n=>n.length>0);if(e.length===0||e[e.length-1]!==Np)return null;let r=e.slice(0,e.length-1);return r.length===0?null:r}function bet(t){if(t.length===0)return[];let[e,...r]=t,n=[];for(let a=0;a<e.length;a+=1){let o=e[a];for(let s of r)if(s[a]!==o)return n;n.push(o)}return n}var UQt,HAe,Eet=w(()=>{"use strict";kN();UQt=Object.defineProperty,HAe=(t,e)=>UQt(t,"name",{value:e,configurable:!0});HAe(LU,"inferContainerFromCandidates");HAe(vet,"extractContainer");HAe(bet,"longestCommonPrefix")});function FU(t){return qAe.includes(t.toLowerCase())}function jU(t){return An(t).endsWith(KAe)}var VQt,Aet,qAe,uJ,KAe,dJ,wet=w(()=>{"use strict";lT();VQt=Object.defineProperty,Aet=(t,e)=>VQt(t,"name",{value:e,configurable:!0}),qAe=["fjall","organisation","platform","account","domain"],uJ="This application name is reserved for Fjall's organisation-tier infrastructure.";Aet(FU,"isReservedAppName");KAe="-cache",dJ="Application names ending in '-cache' are reserved for Fjall build-cache repositories.";Aet(jU,"hasReservedAppNameSuffix")});function xet(t){return{success:!0,data:t}}function BU(t){return{success:!1,error:t}}function bT(t,e,r){if(!t.startsWith(Cet))return BU(new Error(`expected sha256:... digest, got ${t.slice(0,32)}`));let n=t.slice(Cet.length);if(n.length<pJ)return BU(new Error(`digest hex payload too short (need >=${pJ} chars, got ${n.length})`));let a=e.trim();if(a==="")return BU(new Error("serviceName must be a non-empty string"));let o;if(r!==void 0){let c=r.trim();if(c==="")return BU(new Error("target, when supplied, must be a non-empty string; omit the argument instead"));o=c.toLowerCase()}let s=n.slice(0,pJ).toLowerCase(),i=o!==void 0?`${a.toLowerCase()}-${o}`:a.toLowerCase();return xet(`${i}-sha-${s}`)}var zQt,YAe,Cet,pJ,mJ,Tet=w(()=>{"use strict";zQt=Object.defineProperty,YAe=(t,e)=>zQt(t,"name",{value:e,configurable:!0});YAe(xet,"success");YAe(BU,"failure");Cet="sha256:",pJ=12,mJ=new RegExp(`-sha-[0-9a-f]{${pJ}}$`);YAe(bT,"deriveContentHashTag")});function pl(t,e){return`${t}${e}`}var GQt,WQt,ZAe,JAe,fJ,ew,IN,XAe,ket,Iet=w(()=>{"use strict";Lt();GQt=Object.defineProperty,WQt=(t,e)=>GQt(t,"name",{value:e,configurable:!0}),ZAe=["full","code-only","rollback","restart"],JAe=h.enum(ZAe),fJ=/^[a-zA-Z0-9._-]+$/,ew=h.string().min(1).max(128).regex(fJ),IN=h.object({serviceName:h.string().min(1),imageTag:ew,imageDigest:h.string().min(1).optional(),imageUri:h.string().min(1),ecrRepositoryArn:h.string().min(1).optional(),taskDefinitionArn:h.string().min(1).optional(),previousTaskDefinitionArn:h.string().min(1).optional(),functionArn:h.string().min(1).optional(),publishedVersion:h.string().min(1).optional()}).strict(),XAe=h.array(IN),ket=["TaskDefinition","PreviousTaskDefinition","ImageTag","ImageUri","EcrRepositoryArn","ImageDigest"];WQt(pl,"artefactOutputKey")});var QAe,UU,VU,ewe,twe,rwe,ET,zU,Pet,PN=w(()=>{"use strict";QAe="fjall-premigrate",UU="EXPECTED_SCHEMA_VERSION",VU="EXPECTED_SCHEMA_VERSION_TOOL",ewe="EXPECTED_CH_SCHEMA_VERSION",twe="SCHEMA_ADMIN_USER",rwe="SCHEMA_ADMIN_PASSWORD",ET=/^\d{14}_/,zU=/\.dev\.sql$/,Pet=/\.sql$/});var hJ,Ret=w(()=>{"use strict";hJ={"AWS::SecretsManager::Secret":"Name","AWS::SQS::Queue":"QueueName","AWS::SNS::Topic":"TopicName"}});function DN(t){return typeof t=="string"&&RN.has(t)}function py(t){return t!=null&&qQt.has(t)}var HQt,Det,_p,RN,hu,ZS,tw,qQt,AT,gJ=w(()=>{"use strict";HQt=Object.defineProperty,Det=(t,e)=>HQt(t,"name",{value:e,configurable:!0}),_p=["payload","nextjs","staticsite"],RN=new Set(_p);Det(DN,"isPatternType");hu={payload:{label:"Payload CMS",constructIdSuffix:"Payload",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!0},nextjs:{label:"Next.js",constructIdSuffix:"Nextjs",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!1},staticsite:{label:"Static site",constructIdSuffix:"StaticSite",artefact:"static-assets",stackPlacement:"cdn",deployable:!0}},ZS=_p.filter(t=>hu[t].deployable),tw=_p.filter(t=>hu[t].artefact==="opennext-lambda"),qQt=new Set(tw);Det(py,"isOpenNextPatternType");AT=["multipage","spa"]});function vJ(t){return`${yJ}@${t}`}function SJ(t){return`https://${t}`}function ON(t,e){let r=t.split("@");if(r.length!==2)return!1;let[n,a]=r;return n===void 0||n===""||a===void 0?!1:a.toLowerCase()===e.toLowerCase()}var KQt,nwe,yJ,awe=w(()=>{"use strict";KQt=Object.defineProperty,nwe=(t,e)=>KQt(t,"name",{value:e,configurable:!0}),yJ="noreply";nwe(vJ,"defaultFormsFromAddress");nwe(SJ,"defaultFormsCorsOrigin");nwe(ON,"isAddressAtDomain")});var owe,Oet,YQt,Net,_et,$et,Met=w(()=>{"use strict";Lt();owe=2,Oet="dev-substrate-params.json",YQt=h.object({devDomain:h.string().min(1),hostedZoneId:h.string().min(1).optional(),parentDomain:h.string().min(1).optional(),parentDelegationRoleArn:h.string().min(1).optional()}).strict().superRefine((t,e)=>{if(t.hostedZoneId!==void 0){t.parentDomain!==void 0&&e.addIssue({code:"custom",path:["parentDomain"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDomain \u2014 the adopted zone was already delegated; omit parentDomain"}),t.parentDelegationRoleArn!==void 0&&e.addIssue({code:"custom",path:["parentDelegationRoleArn"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDelegationRoleArn \u2014 the adopted zone was already delegated; omit parentDelegationRoleArn"});return}t.parentDelegationRoleArn!==void 0&&t.parentDomain===void 0&&e.addIssue({code:"custom",path:["parentDomain"],message:"parentDelegationRoleArn requires parentDomain \u2014 set parentDomain to the parent zone the DelegationRole belongs to"}),t.parentDomain!==void 0&&!t.devDomain.endsWith(`.${t.parentDomain}`)&&e.addIssue({code:"custom",path:["parentDomain"],message:"parentDomain must be a proper DNS suffix of devDomain \u2014 devDomain must end with `.<parentDomain>`"})}),Net={appId:h.string().min(1),appKebab:h.string().min(1),engineVersion:h.string().min(1).optional(),adoptSlotEcr:h.boolean().optional(),adoptCacheEcr:h.boolean().optional(),phase:h.enum(["zone","full"]).optional(),domain:YQt.optional()},_et=h.object(Net).strict(),$et=h.object({...Net,version:h.literal(owe),appName:h.string().min(1)}).strict().refine(t=>t.appName===`fjall-dev-${t.appKebab}`,{message:"appName must equal `fjall-dev-${appKebab}` (single-source identity)",path:["appName"]})});var Let,Fet=w(()=>{"use strict";Let=`#!/usr/bin/env node
103
103
  import { readFileSync } from "node:fs";
104
104
 
105
105
  import { App } from "@fjall/components-infrastructure";
@@ -140,7 +140,7 @@ ${d}\r
140
140
  `)}d.push(null)}),d}async function sar(t,e){let r=0,n=[],a=t.getReader(),o=!1;for(;!o;){let{done:c,value:l}=await a.read();if(l&&(n.push(l),r+=l?.byteLength??0),r>=e)break;o=c}a.releaseLock();let s=new Uint8Array(Math.min(e,r)),i=0;for(let c of n){if(c.byteLength>s.byteLength-i){s.set(c.subarray(0,s.byteLength-i),i);break}else s.set(c,i);i+=c.length}return s}var iar=(t,e)=>gy(t)?sar(t,e):new Promise((r,n)=>{let a=new car;a.limit=e,t.pipe(a),t.on("error",o=>{a.end(),n(o)}),a.on("error",n),a.on("finish",function(){let o=ZJ(this.buffers);r(o)})}),car=class extends Irt{buffers=[];limit=1/0;bytesBuffered=0;_write(e,r,n){if(this.buffers.push(e),this.bytesBuffered+=e.byteLength??0,this.bytesBuffered>=this.limit){let a=this.bytesBuffered-this.limit,o=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=o.subarray(0,o.byteLength-a),this.emit("finish")}n()}},lar=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)},uar=async t=>JJ(t)?Jrt(t):Xrt(t);async function Jrt(t){return t.arrayBuffer().then(e=>new Uint8Array(e))}async function Xrt(t){let e=[],r=t.getReader(),n=0;for(;;){let{done:a,value:o}=await r.read();if(o&&(e.push(o),n+=o.length),a)break}return ZJ(e,n)}var xrt="The stream has already been transformed.",dar=t=>{if(!Trt(t)&&!gy(t)){let a=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${a}`)}let e=!1,r=async()=>{if(e)throw new Error(xrt);return e=!0,await uar(t)},n=a=>{if(typeof a.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
141
141
  If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return a.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async a=>{let o=await r();if(a==="base64")return Krt(o);if(a==="hex")return Brt(o);if(a===void 0||a==="utf8"||a==="utf-8")return lar(o);if(typeof TextDecoder=="function")return new TextDecoder(a).decode(o);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(xrt);if(e=!0,Trt(t))return n(t);if(gy(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},Trt=t=>typeof Blob=="function"&&t instanceof Blob,Qrt=t=>JJ(t)?Jrt(t):gy(t)?Xrt(t):new Promise((e,r)=>{let n=new Xwe,a=t;a.pipe(n),a.on("error",o=>{n.end(),r(o)}),n.on("error",r),n.on("finish",function(){let o=ZJ(this.bufferedBytes);e(o)})}),Xwe=class extends Irt{bufferedBytes=[];_write(e,r,n){this.bufferedBytes.push(e),n()}},krt="The stream has already been transformed.",par=t=>{if(!(t instanceof $N))try{return dar(t)}catch{let a=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${a}`)}let e=!1,r=async()=>{if(e)throw new Error(krt);return e=!0,await Qrt(t)};return Object.assign(t,{transformToByteArray:r,transformToString:async n=>{let a=await r();return n===void 0||Buffer.isEncoding(n)?LN(a.buffer,a.byteOffset,a.byteLength).toString(n):new TextDecoder(n).decode(a)},transformToWebStream:()=>{if(e)throw new Error(krt);if(t.readableFlowing!==null)throw new Error("The stream has been consumed by other callbacks.");if(typeof $N.toWeb!="function")throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return e=!0,$N.toWeb(t)}})};async function mar(t){return typeof t.stream=="function"&&(t=t.stream()),t.tee()}async function far(t){if(gy(t)||JJ(t))return mar(t);let e=new Ert,r=new Ert;return t.pipe(e),t.pipe(r),[e,r]}var Qwe=class extends Xrr(Drt,YJ,eCe,Rrt){},har=Wrr,ent=Qrr(har),gar=ent;xt.ChecksumStream=Hrt;xt.Hash=Zwe;xt.LazyJsonString=kT;xt.NumericValue=qJ;xt.Uint8ArrayBlobAdapter=Qwe;xt._parseEpochTimestamp=Unr;xt._parseRfc3339DateTimeWithOffset=Vnr;xt._parseRfc7231DateTime=znr;xt.calculateBodyLength=Knr;xt.concatBytes=ZJ;xt.copyDocumentWithTransform=enr;xt.createBufferedReadable=nar;xt.createChecksumStream=tar;xt.dateToUtcString=ynr;xt.deserializerMiddleware=Vrt;xt.deserializerMiddlewareOption=Grt;xt.expectBoolean=rnr;xt.expectByte=Kwe;xt.expectFloat32=WJ;xt.expectInt=anr;xt.expectInt32=Hwe;xt.expectLong=l4;xt.expectNonNull=snr;xt.expectNumber=c4;xt.expectObject=Ort;xt.expectShort=qwe;xt.expectString=inr;xt.expectUnion=cnr;xt.fromArrayBuffer=LN;xt.fromBase64=Rrt;xt.fromHex=qnr;xt.fromString=KJ;xt.fromUtf8=YJ;xt.generateIdempotencyToken=gar;xt.getAwsChunkedEncodingStream=oar;xt.getSerdePlugin=Ynr;xt.handleFloat=dnr;xt.headStream=iar;xt.isArrayBuffer=Prt;xt.isBlob=JJ;xt.isReadableStream=gy;xt.limitedParseDouble=nCe;xt.limitedParseFloat=pnr;xt.limitedParseFloat32=mnr;xt.logger=u4;xt.nv=Hnr;xt.parseBoolean=tnr;xt.parseEpochTimestamp=Tnr;xt.parseRfc3339DateTime=Snr;xt.parseRfc3339DateTimeWithOffset=Enr;xt.parseRfc7231DateTime=xnr;xt.quoteHeader=$nr;xt.sdkStreamMixin=par;xt.serializerMiddleware=zrt;xt.serializerMiddlewareOption=Wrt;xt.splitEvery=Gnr;xt.splitHeader=Wnr;xt.splitStream=far;xt.streamCollector=Qrt;xt.strictParseByte=Mrt;xt.strictParseDouble=rCe;xt.strictParseFloat=lnr;xt.strictParseFloat32=Nrt;xt.strictParseInt=fnr;xt.strictParseInt32=hnr;xt.strictParseLong=$rt;xt.strictParseShort=FN;xt.toBase64=eCe;xt.toHex=Brt;xt.toUint8Array=Urt;xt.toUtf8=Drt;xt.v4=ent});var dnt=Ee(yu=>{var{createReadStream:yar}=At("node:fs"),{Writable:Sar}=At("node:stream"),{toUint8Array:UN,concatBytes:bar}=XJ(),{createHash:p4,createHmac:Ear}=At("node:crypto"),tnt=At("node:zlib");async function snt(t,e,r=1024*1024){let n=t.size,a=0;for(;a<n;){let o=t.slice(a,Math.min(n,a+r));e(new Uint8Array(await o.arrayBuffer())),a+=o.size}}var Aar=async function(e,r){let n=new e;return await snt(r,a=>{n.update(a)}),n.digest()},eX=class extends Sar{hash;constructor(e,r){super(r),this.hash=e}_write(e,r,n){try{this.hash.update(UN(e))}catch(a){return n(a)}n()}},war=(t,e)=>new Promise((r,n)=>{if(!Car(e)){n(new Error("Unable to calculate hash for non-file streams."));return}let a=yar(e.path,{start:e.start,end:e.end}),o=new t,s=new eX(o);a.pipe(s),a.on("error",i=>{s.end(),n(i)}),s.on("error",n),s.on("finish",function(){o.digest().then(r).catch(n)})}),Car=t=>typeof t.path=="string",xar=(t,e)=>{if(e.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");let r=new t,n=new eX(r);return e.pipe(n),new Promise((a,o)=>{e.on("error",s=>{n.end(),o(s)}),n.on("error",o),n.on("finish",()=>{r.digest().then(a).catch(o)})})},tX=class{digestLength=16;state=Uint32Array.from(rnt);writeBuffer=new DataView(new ArrayBuffer(64));bufferLength=0;bytesHashed=0;update(e){let r=UN(e),n=0,a=r.byteLength;for(this.bytesHashed+=a;a>0;)this.writeBuffer.setUint8(this.bufferLength++,r[n++]),--a,this.bufferLength===64&&(cCe(this.state,this.writeBuffer),this.bufferLength=0)}async digest(){let e=Uint32Array.from(this.state),r=new DataView(this.writeBuffer.buffer.slice(0)),n=this.bufferLength,a=this.bytesHashed*8;if(r.setUint8(n++,128),this.bufferLength%64>=56){for(let i=n;i<64;++i)r.setUint8(i,0);cCe(e,r),n=0}for(let i=n;i<56;++i)r.setUint8(i,0);r.setUint32(56,a>>>0,!0),r.setUint32(60,Math.floor(a/2**32),!0),cCe(e,r);let o=new Uint8Array(16),s=new DataView(o.buffer);for(let i=0;i<4;++i)s.setUint32(i*4,e[i],!0);return o}reset(){this.state.set(rnt),this.writeBuffer=new DataView(new ArrayBuffer(64)),this.bufferLength=0,this.bytesHashed=0}},rnt=[1732584193,4023233417,2562383102,271733878],sw=4294967295,Tar=Uint8Array.of(7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21),kar=Array.from({length:64},(t,e)=>Math.abs(Math.sin(e+1))*2**32>>>0);function cCe(t,e){let r=t[0],n=t[1],a=t[2],o=t[3];for(let s=0;s<64;++s){let i,c;s<16?(i=n&a|~n&o,c=s):s<32?(i=o&n|a&~o,c=(5*s+1)%16):s<48?(i=n^a^o,c=(3*s+5)%16):(i=a^(n|~o),c=7*s%16);let l=e.getUint32(c*4,!0),u=o;o=a,a=n;let d=Tar[(s>>4)*4+(s&3)],p=(r+i&sw)+(l+kar[s]&sw)&sw;n=n+((p<<d|p>>>32-d)>>>0)&sw,r=u}t[0]=t[0]+r&sw,t[1]=t[1]+n&sw,t[2]=t[2]+a&sw,t[3]=t[3]+o&sw}var Iar=(()=>{try{return p4("md5"),!0}catch{return!1}})(),int=Iar?Par():tX;function Par(){return class{digestLength=16;hash=p4("md5");update(e){this.hash.update(UN(e))}async digest(){let e=this.hash.copy().digest();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=p4("md5")}}}var cnt=new Uint32Array(256);for(let t=0;t<256;++t){let e=t;for(let r=0;r<8;++r)e=e&1?3988292384^e>>>1:e>>>1;cnt[t]=e>>>0}var lCe=4294967295,rX=class{digestLength=4;checksum=lCe;update(e){for(let r=0;r<e.length;++r)this.checksum=this.checksum>>>8^cnt[(this.checksum^e[r])&255]}digestSync(){return(this.checksum^lCe)>>>0}async digest(){let e=this.digestSync(),r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!1),r}reset(){this.checksum=lCe}},nnt=typeof tnt.crc32=="function"?tnt.crc32:void 0,lnt=nnt?Rar(nnt):rX;function Rar(t){return class{digestLength=4;value=0;update(r){this.value=t(r,this.value)}digestSync(){return this.value>>>0}async digest(){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,this.digestSync(),!1),r}reset(){this.value=0}}}var Oc=64,ant=32,Dar=2**53-1,VN=class t{digestLength=ant;state=Int32Array.from(ont);w;buffer=new Uint8Array(64);bufferLength=0;bytesHashed=0;finished=!1;inner;outer;constructor(e){if(e){let r=t.normalizeKey(e);this.inner=new t,this.outer=new t;let{inner:n,outer:a}=this,o=new Uint8Array(Oc*2);for(let s=0;s<Oc;++s)o[s]=54^r[s],o[s+Oc]=92^r[s];n.update(o.subarray(0,Oc)),a.update(o.subarray(Oc))}}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.inner){this.inner.update(e);return}let r=UN(e),n=0,{byteLength:a}=r;if(this.bytesHashed+=a,this.bytesHashed*8>Dar)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;a>0;)this.buffer[this.bufferLength++]=r[n++],a--,this.bufferLength===Oc&&(this.hashBuffer(),this.bufferLength=0)}async digest(){let{inner:e,outer:r}=this;if(e&&r){if(this.finished)throw new Error("Attempted to digest an already finished HMAC.");this.finished=!0;let n=e.digestSync();return r.update(n),r.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(ont),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0}digestSync(){let e=this.state.slice(),r=this.buffer.slice(),n=this.bufferLength,a=this.bytesHashed*8,o=new DataView(r.buffer,r.byteOffset,r.byteLength);if(o.setUint8(n++,128),(n-1)%Oc>=Oc-8){for(let i=n;i<Oc;++i)o.setUint8(i,0);this.hashBufferWith(e,r),n=0}for(let i=n;i<Oc-8;++i)o.setUint8(i,0);o.setUint32(Oc-8,Math.floor(a/4294967296),!1),o.setUint32(Oc-4,a,!1),this.hashBufferWith(e,r);let s=new Uint8Array(ant);for(let i=0;i<8;++i)s[i*4]=e[i]>>>24&255,s[i*4+1]=e[i]>>>16&255,s[i*4+2]=e[i]>>>8&255,s[i*4+3]=e[i]>>>0&255;return s}static normalizeKey(e){let r=UN(e);if(r.byteLength>Oc){let n=new t;n.update(r);let a=n.digestSync(),o=new Uint8Array(Oc);return o.set(a),o}if(r.byteLength<Oc){let n=new Uint8Array(Oc);return n.set(r),n}return r}hashBuffer(){this.hashBufferWith(this.state,this.buffer)}hashBufferWith(e,r){let n=this.w??=new Int32Array(64),a=e[0],o=e[1],s=e[2],i=e[3],c=e[4],l=e[5],u=e[6],d=e[7];for(let p=0;p<Oc;++p){if(p<16)n[p]=(r[p*4]&255)<<24|(r[p*4+1]&255)<<16|(r[p*4+2]&255)<<8|r[p*4+3]&255;else{let g=n[p-2],v=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10;g=n[p-15];let S=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3;n[p]=(v+n[p-7]|0)+(S+n[p-16]|0)}let m=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&u)|0)+(d+(Oar[p]+n[p]|0)|0)|0,f=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&o^a&s^o&s)|0;d=u,u=l,l=c,c=i+m|0,i=s,s=o,o=a,a=m+f|0}e[0]+=a,e[1]+=o,e[2]+=s,e[3]+=i,e[4]+=c,e[5]+=l,e[6]+=u,e[7]+=d}},ont=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oar=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Nar=(()=>{try{return p4("sha256"),!0}catch{return!1}})(),unt=Nar?_ar():VN;function _ar(){return class{digestLength=32;secret;hash;isHmac;finished=!1;constructor(e){this.secret=e,this.isHmac=!!e,this.hash=this.createHash()}update(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");this.hash.update(e)}async digest(){let e;return this.isHmac?(this.finished=!0,e=this.hash.digest()):e=this.hash.copy().digest(),new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=this.createHash(),this.finished=!1}createHash(){return this.secret?Ear("sha256",$ar(this.secret)):p4("sha256")}}}function $ar(t){return typeof t=="string"?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):Buffer.from(t)}var{digest:Mar,sign:Lar,importKey:Far}=globalThis?.crypto?.subtle??{},QJ=typeof Mar=="function"&&typeof Lar=="function"&&typeof Far=="function"?globalThis.crypto.subtle:void 0,jar=8*1024*1024,uCe=class{digestLength=32;secret;pending=[];pendingBytes=0;fallback;finished=!1;constructor(e){e&&(this.secret=UN(e))}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.fallback){this.fallback.update(e);return}this.pending.push(e.slice()),this.pendingBytes+=e.byteLength,this.pendingBytes>=jar&&this.switchToFallback()}async digest(){if(this.fallback)return this.fallback.digest();if(this.secret&&this.finished)throw new Error("Attempted to digest an already finished HMAC.");let e=bar(this.pending);if(QJ){if(this.secret){this.finished=!0;let a=await QJ.importKey("raw",this.secret,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),o=await QJ.sign("HMAC",a,e);return new Uint8Array(o)}let n=await QJ.digest("SHA-256",e);return new Uint8Array(n)}let r=new VN(this.secret);return r.update(e),r.digest()}reset(){this.pending=[],this.pendingBytes=0,this.fallback=void 0,this.finished=!1}switchToFallback(){let e=new VN(this.secret);for(let r of this.pending)e.update(r);this.fallback=e,this.pending=[],this.pendingBytes=0}};yu.Crc32=lnt;yu.Crc32Js=rX;yu.Crc32Node=lnt;yu.Md5=int;yu.Md5Js=tX;yu.Md5Node=int;yu.Sha256=unt;yu.Sha256Js=VN;yu.Sha256Node=unt;yu.Sha256WebCrypto=uCe;yu.blobHasher=Aar;yu.blobReader=snt;yu.fileStreamHasher=war;yu.readableStreamHasher=xar});var ynt=Ee(Ai=>{var{Crc32:fnt}=dnt(),{toHex:zN,fromHex:Bar,toUtf8:Uar,fromUtf8:Var}=XJ(),{Readable:zar}=At("node:stream"),GN=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,a=Math.abs(Math.round(e));n>-1&&a>0;n--,a/=256)r[n]=a;return e<0&&pnt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&pnt(e),parseInt(zN(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function pnt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var nX=class{toUtf8;fromUtf8;constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let o of Object.keys(e)){let s=this.fromUtf8(o);r.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[o]))}let n=new Uint8Array(r.reduce((o,s)=>o+s.byteLength,0)),a=0;for(let o of r)n.set(o,a),a+=o.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?fs.boolTrue:fs.boolFalse]);case"byte":return Uint8Array.from([fs.byte,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,fs.short),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,fs.integer),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let a=new Uint8Array(9);return a[0]=fs.long,a.set(e.value.bytes,1),a;case"binary":let o=new DataView(new ArrayBuffer(3+e.value.byteLength));o.setUint8(0,fs.byteArray),o.setUint16(1,e.value.byteLength,!1);let s=new Uint8Array(o.buffer);return s.set(e.value,3),s;case"string":let i=this.fromUtf8(e.value),c=new DataView(new ArrayBuffer(3+i.byteLength));c.setUint8(0,fs.string),c.setUint16(1,i.byteLength,!1);let l=new Uint8Array(c.buffer);return l.set(i,3),l;case"timestamp":let u=new Uint8Array(9);return u[0]=fs.timestamp,u.set(GN.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!Xar.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=fs.uuid,d.set(Bar(e.value.replace(/-/g,"")),1),d}}parse(e){let r={},n=0;for(;n<e.byteLength;){let a=e.getUint8(n++),o=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,a));switch(n+=a,e.getUint8(n++)){case fs.boolTrue:r[o]={type:mnt,value:!0};break;case fs.boolFalse:r[o]={type:mnt,value:!1};break;case fs.byte:r[o]={type:Gar,value:e.getInt8(n++)};break;case fs.short:r[o]={type:War,value:e.getInt16(n,!1)},n+=2;break;case fs.integer:r[o]={type:Har,value:e.getInt32(n,!1)},n+=4;break;case fs.long:r[o]={type:qar,value:new GN(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case fs.byteArray:let s=e.getUint16(n,!1);n+=2,r[o]={type:Kar,value:new Uint8Array(e.buffer,e.byteOffset+n,s)},n+=s;break;case fs.string:let i=e.getUint16(n,!1);n+=2,r[o]={type:Yar,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,i))},n+=i;break;case fs.timestamp:r[o]={type:Zar,value:new Date(new GN(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case fs.uuid:let c=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,r[o]={type:Jar,value:`${zN(c.subarray(0,4))}-${zN(c.subarray(4,6))}-${zN(c.subarray(6,8))}-${zN(c.subarray(8,10))}-${zN(c.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}},fs;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(fs||(fs={}));var mnt="boolean",Gar="byte",War="short",Har="integer",qar="long",Kar="binary",Yar="string",Zar="timestamp",Jar="uuid",Xar=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,hnt=4,iw=hnt*2,IT=4,Qar=iw+IT*2;function eor({byteLength:t,byteOffset:e,buffer:r}){if(t<Qar)throw new Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,e,t),a=n.getUint32(0,!1);if(t!==a)throw new Error("Reported message length does not match received message length");let o=n.getUint32(hnt,!1),s=n.getUint32(iw,!1),i=n.getUint32(t-IT,!1),c=new fnt;if(c.update(new Uint8Array(r,e,iw)),s!==c.digestSync())throw new Error(`The prelude checksum specified in the message (${s}) does not match the calculated CRC32 checksum (${c.digestSync()})`);if(c.update(new Uint8Array(r,e+iw,t-(iw+IT))),i!==c.digestSync())throw new Error(`The message checksum (${c.digestSync()}) did not match the expected value of ${i}`);return{headers:new DataView(r,e+iw+IT,o),body:new Uint8Array(r,e+iw+IT+o,a-o-(iw+IT+IT))}}var aX=class{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,r){this.headerMarshaller=new nX(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let n=this.headerMarshaller.format(e),a=n.byteLength+r.byteLength+16,o=new Uint8Array(a),s=new DataView(o.buffer,o.byteOffset,o.byteLength),i=new fnt;return s.setUint32(0,a,!1),s.setUint32(4,n.byteLength,!1),i.update(o.subarray(0,8)),s.setUint32(8,i.digestSync(),!1),o.set(n,12),o.set(r,n.byteLength+12),i.update(o.subarray(8,a-4)),s.setUint32(a-4,i.digestSync(),!1),o}decode(e){let{headers:r,body:n}=eor(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}},oX=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}},sX=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}},iX=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}},cX=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}};function gnt(t){let e=0,r=0,n=null,a=null,o=i=>{if(typeof i!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+i);e=i,r=4,n=new Uint8Array(i),new DataView(n.buffer).setUint32(0,i,!1)},s=async function*(){let i=t[Symbol.asyncIterator]();for(;;){let{value:c,done:l}=await i.next();if(l){if(e)if(e===r)yield n;else throw new Error("Truncated event message received.");else return;return}let u=c.length,d=0;for(;d<u;){if(!n){let m=u-d;a||(a=new Uint8Array(4));let f=Math.min(4-r,m);if(a.set(c.slice(d,d+f),r),r+=f,d+=f,r<4)break;o(new DataView(a.buffer).getUint32(0,!1)),a=null}let p=Math.min(e-r,u-d);n.set(c.slice(d,d+p),r),r+=p,d+=p,e&&e===r&&(yield n,n=null,e=0,r=0)}}};return{[Symbol.asyncIterator]:s}}function tor(t,e){let r=pCe(e.deserializer,e.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let n of t){let a=e.eventStreamCodec.decode(n),o=await r(a);o!==void 0&&(yield o)}}}}function pCe(t,e){return async function(r){let{value:n}=r.headers[":message-type"];if(n==="error"){let a=new Error(r.headers[":error-message"].value||"UnknownError");throw a.name=r.headers[":error-code"].value,a}else if(n==="exception"){let a=r.headers[":exception-type"].value,o={[a]:r},s=await t(o);if(s.$unknown){let i=new Error(e(r.body));throw i.name=a,i}throw s[a]}else if(n==="event"){let a={[r.headers[":event-type"].value]:r},o=await t(a);return o.$unknown?void 0:o}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}var mCe=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new aX(e,r),this.utfEncoder=e}deserialize(e,r){let n=gnt(e);return new iX({messageStream:new oX({inputStream:n,decoder:this.eventStreamCodec}),deserializer:pCe(r,this.utfEncoder)})}serialize(e,r){return new sX({messageStream:new cX({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},ror=t=>new mCe(t),lX=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new mCe({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){let n=typeof e[Symbol.asyncIterator]=="function"?e:aor(e);return this.universalMarshaller.deserialize(n,r)}serialize(e,r){return zar.from(this.universalMarshaller.serialize(e,r))}},nor=t=>new lX(t);async function*aor(t){let e=!1,r=!1,n=new Array;for(t.on("error",a=>{if(e||(e=!0),a)throw a}),t.on("data",a=>{n.push(a)}),t.on("end",()=>{e=!0});!r;){let a=await new Promise(o=>setTimeout(()=>o(n.shift()),0));a&&(yield a),r=e&&n.length===0}}var oor=t=>({[Symbol.asyncIterator]:async function*(){let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)return;yield n}}finally{e.releaseLock()}}}),sor=t=>{let e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:n,value:a}=await e.next();if(n)return r.close();r.enqueue(a)}})},ior=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)}),dCe=class{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:r,deserializer:n,serdeContext:a,defaultContentType:o}){this.marshaller=e,this.serializer=r,this.deserializer=n,this.serdeContext=a,this.defaultContentType=o}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n}){let a=this.marshaller,o=r.getEventStreamMember(),s=r.getMemberSchema(o),i=this.serializer,c=this.defaultContentType,l=Symbol("initialRequestMarker"),u={async*[Symbol.asyncIterator](){if(n){let d={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:c}};i.write(r,n);let p=i.flush();yield{[l]:!0,headers:d,body:p}}for await(let d of e)yield d}};return a.serialize(u,d=>{if(d[l])return{headers:d.headers,body:d.body};let p="";for(let A in d)if(A!=="__type"){p=A;break}let{additionalHeaders:m,body:f,eventType:g,explicitPayloadContentType:v}=this.writeEventBody(p,s,d);return{headers:{":event-type":{type:"string",value:g},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:v??c},...m},body:f}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n}){let a=this.marshaller,o=r.getEventStreamMember(),i=r.getMemberSchema(o).getMemberSchemas(),c=Symbol("initialResponseMarker"),l=a.deserialize(e.body,async p=>{let m="";for(let g in p)if(g!=="__type"){m=g;break}let f=p[m].body;if(m==="initial-response"){let g=await this.deserializer.read(r,f);return delete g[o],{[c]:!0,...g}}else if(m in i){let g=i[m];if(g.isStructSchema()){let v={},S=!1;for(let[A,C]of g.structIterator()){let{eventHeader:x,eventPayload:k}=C.getMergedTraits();if(S=S||!!(x||k),k)C.isBlobSchema()?v[A]=f:C.isStringSchema()?v[A]=(this.serdeContext?.utf8Encoder??Uar)(f):C.isStructSchema()&&(v[A]=await this.deserializer.read(C,f));else if(x){let R=p[m].headers[A]?.value;R!=null&&(C.isNumericSchema()?R&&typeof R=="object"&&"bytes"in R?v[A]=BigInt(R.toString()):v[A]=Number(R):v[A]=R)}}if(S)return{[m]:v};if(f.byteLength===0)return{[m]:{}}}return{[m]:await this.deserializer.read(g,f)}}else return{$unknown:p}}),u=l[Symbol.asyncIterator](),d=await u.next();if(d.done)return l;if(d.value?.[c]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let p in d.value)n[p]=d.value[p]}return{async*[Symbol.asyncIterator](){for(d?.value?.[c]||(yield d.value);;){let{done:p,value:m}=await u.next();if(p)break;yield m}}}}writeEventBody(e,r,n){let a=this.serializer,o=e,s=null,i,c=r.getSchema()[4].includes(e),l={};if(c){let p=r.getMemberSchema(e);if(p.isStructSchema()){for(let[m,f]of p.structIterator()){let{eventHeader:g,eventPayload:v}=f.getMergedTraits();if(v)s=m;else if(g){let S=n[e][m],A="binary";f.isNumericSchema()?(-2)**31<=S&&S<=2**31-1?A="integer":A="long":f.isTimestampSchema()?A="timestamp":f.isStringSchema()?A="string":f.isBooleanSchema()&&(A="boolean"),S!=null&&(l[m]={type:A,value:S},delete n[e][m])}}if(s!==null){let m=p.getMemberSchema(s);m.isBlobSchema()?i="application/octet-stream":m.isStringSchema()&&(i="text/plain"),a.write(m,n[e][s])}else a.write(p,n[e])}else if(p.isUnitSchema())a.write(p,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[p,m]=n[e];o=p,a.write(15,m)}let u=a.flush()??new Uint8Array;return{body:typeof u=="string"?(this.serdeContext?.utf8Decoder??Var)(u):u,eventType:o,explicitPayloadContentType:i,additionalHeaders:l}}};Ai.EventStreamCodec=aX;Ai.EventStreamMarshaller=lX;Ai.EventStreamSerde=dCe;Ai.HeaderMarshaller=nX;Ai.Int64=GN;Ai.MessageDecoderStream=oX;Ai.MessageEncoderStream=sX;Ai.SmithyMessageDecoderStream=iX;Ai.SmithyMessageEncoderStream=cX;Ai.UniversalEventStreamMarshaller=mCe;Ai.eventStreamSerdeProvider=nor;Ai.getChunkedStream=gnt;Ai.getMessageUnmarshaller=pCe;Ai.getUnmarshalledStream=tor;Ai.iterableToReadableStream=sor;Ai.readableStreamToIterable=oor;Ai.resolveEventStreamSerdeConfig=ior;Ai.universalEventStreamSerdeProvider=ror});var Rnt=Ee(fa=>{var{Uint8ArrayBlobAdapter:fCe,sdkStreamMixin:cor,splitEvery:lor,splitHeader:Ent,fromBase64:vnt,_parseEpochTimestamp:uor,_parseRfc7231DateTime:dor,_parseRfc3339DateTimeWithOffset:por,LazyJsonString:Ant,NumericValue:mor,toUtf8:wnt,fromUtf8:hor,generateIdempotencyToken:gor,toBase64:Snt,dateToUtcString:yor,quoteHeader:vor}=XJ(),{TypeRegistry:Sor,NormalizedSchema:yy,translateTraits:Cnt}=ywe(),{HttpRequest:WN,HttpResponse:xnt,isValidHostname:Tnt}=rw(),{parseQueryString:bor,parseUrl:Eor}=rw();fa.HttpRequest=WN;fa.HttpResponse=xnt;fa.isValidHostname=Tnt;fa.parseQueryString=bor;fa.parseUrl=Eor;var{FieldPosition:Aor}=(Ih(),Ht(kh)),PT=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return fCe.mutate(t);if(!t)return fCe.mutate(new Uint8Array);let r=e.streamCollector(t);return fCe.mutate(await r)};function f4(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var RT=class{serdeContext;setSerdeContext(e){this.serdeContext=e}},h4=class extends RT{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=Sor.for(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return WN}getResponseType(){return xnt}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,r){if("url"in r){e.protocol=r.url.protocol,e.hostname=r.url.hostname,e.port=r.url.port?Number(r.url.port):void 0,e.path=r.url.pathname,e.fragment=r.url.hash||void 0,e.username=r.url.username||void 0,e.password=r.url.password||void 0,e.query||(e.query={});for(let[n,a]of r.url.searchParams.entries())e.query[n]=a;if(r.headers)for(let n in r.headers)e.headers[n]=r.headers[n].join(", ");return e}else{if(e.protocol=r.protocol,e.hostname=r.hostname,e.port=r.port?Number(r.port):void 0,e.path=r.path,e.query={...r.query},r.headers)for(let n in r.headers)e.headers[n]=r.headers[n];return e}}setHostPrefix(e,r,n){if(this.serdeContext?.disableHostPrefix)return;let a=yy.of(r.input),o=Cnt(r.traits??{});if(o.endpoint){let s=o.endpoint?.[0];if(typeof s=="string"){for(let[i,c]of a.structIterator()){if(!c.getMergedTraits().hostLabel)continue;let l=n[i];if(typeof l!="string")throw new Error(`@smithy/core/schema - ${i} in input must be a string as hostLabel.`);s=s.replace(`{${i}}`,l)}if(e.hostname=s+e.hostname,!Tnt(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:r}=ynt(),n=this.resolveEventStreamMarshaller(r);return new e({marshaller:n,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(e){let r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:e(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,n,a,o){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}},hCe=class extends h4{async serializeRequest(e,r,n){let a=r&&typeof r=="object"?r:{},o=this.serializer,s={},i={},c=await n.endpoint(),l=yy.of(e?.input),u=[],d=[],p=!1,m,f=new WN({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:s,headers:i,body:void 0});if(c){this.updateServiceEndpoint(f,c),this.setHostPrefix(f,e,a);let g=Cnt(e.traits);if(g.http){f.method=g.http[0];let[v,S]=g.http[1].split("?");f.path=="/"?f.path=v:f.path+=v;let A=new URLSearchParams(S??"");for(let[C,x]of A)s[C]=x}}for(let[g,v]of l.structIterator()){let S=v.getMergedTraits()??{},A=a[g];if(A==null&&!v.isIdempotencyToken()){if(S.httpLabel&&(f.path.includes(`{${g}+}`)||f.path.includes(`{${g}}`)))throw new Error(`No value provided for input HTTP label: ${g}.`);continue}if(S.httpPayload)v.isStreaming()?v.isStructSchema()?a[g]&&(m=await this.serializeEventStream({eventStream:a[g],requestSchema:l})):m=A:(o.write(v,A),m=o.flush());else if(S.httpLabel){o.write(v,A);let C=o.flush();f.path.includes(`{${g}+}`)?f.path=f.path.replace(`{${g}+}`,C.split("/").map(f4).join("/")):f.path.includes(`{${g}}`)&&(f.path=f.path.replace(`{${g}}`,f4(C)))}else if(S.httpHeader)o.write(v,A),i[S.httpHeader.toLowerCase()]=String(o.flush());else if(typeof S.httpPrefixHeaders=="string")for(let C in A){let x=A[C],k=S.httpPrefixHeaders+C;o.write([v.getValueSchema(),{httpHeader:k}],x),i[k.toLowerCase()]=o.flush()}else S.httpQuery||S.httpQueryParams?this.serializeQuery(v,A,s):(p=!0,u.push(g),d.push(v))}if(p&&a){let[g,v]=(l.getName(!0)??"#Unknown").split("#"),S=l.getSchema()[6],A=[3,g,v,l.getMergedTraits(),u,d,void 0];S?A[6]=S:A.pop(),o.write(A,a),m=o.flush()}return f.headers=i,f.query=s,f.body=m,f}serializeQuery(e,r,n){let a=this.serializer,o=e.getMergedTraits();if(o.httpQueryParams){for(let s in r)if(!(s in n)){let i=r[s],c=e.getValueSchema();Object.assign(c.getMergedTraits(),{...o,httpQuery:s,httpQueryParams:void 0}),this.serializeQuery(c,i,n)}return}if(e.isListSchema()){let s=!!e.getMergedTraits().sparse,i=[];for(let c of r){a.write([e.getValueSchema(),o],c);let l=a.flush();(s||l!==void 0)&&i.push(l)}n[o.httpQuery]=i}else a.write([e,o],r),n[o.httpQuery]=a.flush()}async deserializeResponse(e,r,n){let a=this.deserializer,o=yy.of(e.output),s={};if(n.statusCode>=300){let c=await PT(n.body,r);throw c.byteLength>0&&Object.assign(s,await a.read(15,c)),await this.handleError(e,r,n,s,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in n.headers){let l=n.headers[c];delete n.headers[c],n.headers[c.toLowerCase()]=l}let i=await this.deserializeHttpMessage(o,r,n,s);if(i.length){let c=await PT(n.body,r);if(c.byteLength>0){let l=await a.read(o,c);for(let u of i)l[u]!=null&&(s[u]=l[u])}}else i.discardResponseBody&&await PT(n.body,r);return s.$metadata=this.deserializeMetadata(n),s}async deserializeHttpMessage(e,r,n,a,o){let s;a instanceof Set?s=o:s=a;let i=!0,c=this.deserializer,l=yy.of(e),u=[];for(let[d,p]of l.structIterator()){let m=p.getMemberTraits();if(m.httpPayload){if(i=!1,p.isStreaming())p.isStructSchema()?s[d]=await this.deserializeEventStream({response:n,responseSchema:l}):s[d]=cor(n.body);else if(n.body){let g=await PT(n.body,r);g.byteLength>0&&(s[d]=await c.read(p,g))}}else if(m.httpHeader){let f=String(m.httpHeader).toLowerCase(),g=n.headers[f];if(g!=null)if(p.isListSchema()){let v=p.getValueSchema();v.getMergedTraits().httpHeader=f;let S;v.isTimestampSchema()&&v.getSchema()===4?S=lor(g,",",2):S=Ent(g);let A=[];for(let C of S)A.push(await c.read(v,C.trim()));s[d]=A}else s[d]=await c.read(p,g)}else if(m.httpPrefixHeaders!==void 0){s[d]={};for(let f in n.headers)if(f.startsWith(m.httpPrefixHeaders)){let g=n.headers[f],v=p.getValueSchema();v.getMergedTraits().httpHeader=f,s[d][f.slice(m.httpPrefixHeaders.length)]=await c.read(v,g)}}else m.httpResponseCode?s[d]=n.statusCode:u.push(d)}return u.discardResponseBody=i,u}},gCe=class extends h4{async serializeRequest(e,r,n){let a=this.serializer,o={},s={},i=await n.endpoint(),c=yy.of(e?.input),l=c.getSchema(),u,d=r&&typeof r=="object"?r:{},p=new WN({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:o,headers:s,body:void 0});if(i&&(this.updateServiceEndpoint(p,i),this.setHostPrefix(p,e,d)),d){let m=c.getEventStreamMember();if(m){if(d[m]){let f={};for(let[g,v]of c.structIterator())g!==m&&d[g]&&(a.write(v,d[g]),f[g]=a.flush());u=await this.serializeEventStream({eventStream:d[m],requestSchema:c,initialRequest:f})}}else a.write(l,d),u=a.flush()}return p.headers=Object.assign(p.headers,s),p.query=o,p.body=u,p.method="POST",p}async deserializeResponse(e,r,n){let a=this.deserializer,o=yy.of(e.output),s={};if(n.statusCode>=300){let c=await PT(n.body,r);throw c.byteLength>0&&Object.assign(s,await a.read(15,c)),await this.handleError(e,r,n,s,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let c in n.headers){let l=n.headers[c];delete n.headers[c],n.headers[c.toLowerCase()]=l}let i=o.getEventStreamMember();if(i)s[i]=await this.deserializeEventStream({response:n,responseSchema:o,initialResponseContainer:s});else{let c=await PT(n.body,r);c.byteLength>0&&Object.assign(s,await a.read(o,c))}return s.$metadata=this.deserializeMetadata(n),s}},knt=(t,e,r,n,a,o)=>{if(e!=null&&e[r]!==void 0){let s=n();if(s==null||s.length<=0)throw new Error("Empty value provided for input HTTP label: "+r+".");t=t.replace(a,o?s.split("/").map(i=>f4(i)).join("/"):f4(s))}else throw new Error("No value provided for input HTTP label: "+r+".");return t};function wor(t,e){return new uX(t,e)}var uX=class{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,r){this.input=e,this.context=r}async build(){let{hostname:e,protocol:r="https",port:n,path:a}=await this.context.endpoint();this.path=a;for(let o of this.resolvePathStack)o(this.path);return new WN({protocol:r,hostname:this.hostname||e,port:n,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(r=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,n,a){return this.resolvePathStack.push(o=>{this.path=knt(o,this.input,e,r,n,a)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}};function ECe(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:n,httpHeader:a,httpQuery:o}=t.getMergedTraits();return(e.httpBindings?typeof n=="string"||a?6:o||r?5:void 0:void 0)??e.timestampFormat.default}var dX=class extends RT{settings;constructor(e){super(),this.settings=e}read(e,r){let n=yy.of(e);if(n.isListSchema())return Ent(r).map(a=>this.read(n.getValueSchema(),a));if(n.isBlobSchema())return(this.serdeContext?.base64Decoder??vnt)(r);if(n.isTimestampSchema())switch(ECe(n,this.settings)){case 5:return por(r);case 6:return dor(r);case 7:return uor(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(n.isStringSchema()){let a=n.getMergedTraits().mediaType,o=r;if(a)return n.getMergedTraits().httpHeader&&(o=this.base64ToUtf8(o)),(a==="application/json"||a.endsWith("+json"))&&(o=Ant.from(o)),o}return n.isNumericSchema()?Number(r):n.isBigIntegerSchema()?BigInt(r):n.isBigDecimalSchema()?new mor(r,"bigDecimal"):n.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??wnt)((this.serdeContext?.base64Decoder??vnt)(e))}},yCe=class extends RT{codecDeserializer;stringDeserializer;constructor(e,r){super(),this.codecDeserializer=e,this.stringDeserializer=new dX(r)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,r){let n=yy.of(e),a=n.getMergedTraits(),o=this.serdeContext?.utf8Encoder??wnt;if(a.httpHeader||a.httpResponseCode)return this.stringDeserializer.read(n,o(r));if(a.httpPayload){if(n.isBlobSchema()){let s=this.serdeContext?.utf8Decoder??hor;return typeof r=="string"?s(r):r}else if(n.isStringSchema())return"byteLength"in r?o(r):r}return this.codecDeserializer.read(n,r)}},pX=class extends RT{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,r){let n=yy.of(e);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(n.isTimestampSchema()){if(!(r instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${r} when schema expected Date in ${n.getName(!0)}`);switch(ECe(n,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=yor(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(n.isBlobSchema()&&"byteLength"in r){this.stringBuffer=(this.serdeContext?.base64Encoder??Snt)(r);return}if(n.isListSchema()&&Array.isArray(r)){let s="";for(let i of r){this.write([n.getValueSchema(),n.getMergedTraits()],i);let c=this.flush(),l=n.getValueSchema().isTimestampSchema()?c:vor(c);s!==""&&(s+=", "),s+=l}this.stringBuffer=s;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":let a=n.getMergedTraits().mediaType,o=r;if(a&&((a==="application/json"||a.endsWith("+json"))&&(o=Ant.from(o)),n.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??Snt)(o.toString());return}this.stringBuffer=r;break;default:n.isIdempotencyToken()?this.stringBuffer=gor():this.stringBuffer=String(r)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}},vCe=class{codecSerializer;stringSerializer;buffer;constructor(e,r,n=new pX(r)){this.codecSerializer=e,this.stringSerializer=n}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,r){let n=yy.of(e),a=n.getMergedTraits();if(a.httpHeader||a.httpLabel||a.httpQuery){this.stringSerializer.write(n,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(n,r)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}},SCe=class{name;kind;values;constructor({name:e,kind:r=Aor.HEADER,values:n=[]}){this.name=e,this.kind=r,this.values=n}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}},bCe=class{entries={};encoding;constructor({fields:e=[],encoding:r="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}},Cor=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),xor=t=>({httpHandler:t.httpHandler()}),bnt="content-length";function Int(t){return e=>async r=>{let n=r.request;if(WN.isInstance(n)){let{body:a,headers:o}=n;if(a&&Object.keys(o).map(s=>s.toLowerCase()).indexOf(bnt)===-1)try{let s=t(a);n.headers={...n.headers,[bnt]:String(s)}}catch{}}return e({...r,request:n})}}var Pnt={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Tor=t=>({applyToStack:e=>{e.add(Int(t.bodyLengthChecker),Pnt)}}),m4=t=>encodeURIComponent(t).replace(/[!'()*]/g,kor),kor=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`,Ior=t=>t.split("/").map(m4).join("/");function Por(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=m4(r),Array.isArray(n))for(let a=0,o=n.length;a<o;a++)e.push(`${r}=${m4(n[a])}`);else{let a=r;(n||typeof n=="string")&&(a+=`=${m4(n)}`),e.push(a)}}return e.join("&")}fa.Field=SCe;fa.Fields=bCe;fa.FromStringShapeDeserializer=dX;fa.HttpBindingProtocol=hCe;fa.HttpInterceptingShapeDeserializer=yCe;fa.HttpInterceptingShapeSerializer=vCe;fa.HttpProtocol=h4;fa.RequestBuilder=uX;fa.RpcProtocol=gCe;fa.SerdeContext=RT;fa.ToStringShapeSerializer=pX;fa.buildQueryString=Por;fa.collectBody=PT;fa.contentLengthMiddleware=Int;fa.contentLengthMiddlewareOptions=Pnt;fa.determineTimestampFormat=ECe;fa.escapeUri=m4;fa.escapeUriPath=Ior;fa.extendedEncodeURIComponent=f4;fa.getContentLengthPlugin=Tor;fa.getHttpHandlerExtensionConfiguration=Cor;fa.requestBuilder=wor;fa.resolveHttpHandlerRuntimeConfig=xor;fa.resolvedPath=knt});function ACe(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let a=new Error("Request aborted");return a.name="AbortError",a.cause=e,a}let n=new Error(String(e));return n.name="AbortError",n}let r=new Error("Request aborted");return r.name="AbortError",r}var Dnt=w(()=>{});var Ont,Nnt=w(()=>{Ont=["ECONNRESET","EPIPE","ETIMEDOUT"]});var _nt,$nt=w(()=>{_nt=t=>{let e={};for(let r in t){let n=t[r];e[r]=Array.isArray(n)?n.join(","):n}return e}});import g4 from"node:https";var Mnt=w(()=>{});var Ko,DT=w(()=>{Ko={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)}});var Lnt,Fnt,jnt=w(()=>{DT();Lnt=1e3,Fnt=(t,e,r=0)=>{if(!r)return-1;let n=a=>{let o=Ko.setTimeout(()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-a),s=i=>{i?.connecting?i.on("connect",()=>{Ko.clearTimeout(o)}):Ko.clearTimeout(o)};t.socket?s(t.socket):t.on("socket",s)};return r<2e3?(n(0),0):Ko.setTimeout(n.bind(null,Lnt),Lnt)}});var Bnt,Unt=w(()=>{DT();Bnt=(t,e,r=0,n,a)=>r?Ko.setTimeout(()=>{let o=`@smithy/node-http-handler - [${n?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(n){let s=Object.assign(new Error(o),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(s),e(s)}else o+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",a?.warn?.(o)},r):-1});var Ror,Vnt,znt=w(()=>{DT();Ror=3e3,Vnt=(t,{keepAlive:e,keepAliveMsecs:r},n=Ror)=>{if(e!==!0)return-1;let a=()=>{t.socket?t.socket.setKeepAlive(e,r||0):t.on("socket",o=>{o.setKeepAlive(e,r||0)})};return n===0?(a(),0):Ko.setTimeout(a,n)}});var Gnt,Wnt,Hnt=w(()=>{DT();Gnt=3e3,Wnt=(t,e,r=0)=>{let n=a=>{let o=r-a,s=()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};t.socket?(t.socket.setTimeout(o,s),t.on("close",()=>t.socket?.removeListener("timeout",s))):t.setTimeout(o,s)};return 0<r&&r<6e3?(n(0),0):Ko.setTimeout(n.bind(null,r===0?0:Gnt),Gnt)}});import{Readable as Dor}from"node:stream";async function Knt(t,e,r=qnt,n=!1){let a=e.headers,o=a?a.Expect||a.expect:void 0,s=-1,i=!0;!n&&o==="100-continue"&&(i=await Promise.race([new Promise(c=>{s=Number(Ko.setTimeout(()=>c(!0),Math.max(qnt,r)))}),new Promise(c=>{t.on("continue",()=>{Ko.clearTimeout(s),c(!0)}),t.on("response",()=>{Ko.clearTimeout(s),c(!1)}),t.on("error",()=>{Ko.clearTimeout(s),c(!1)})})])),i&&Oor(t,e.body)}function Oor(t,e){if(e instanceof Dor){e.pipe(t);return}if(e){let r=Buffer.isBuffer(e);if(r||typeof e=="string"){r&&e.byteLength===0?t.end():t.end(e);return}let a=e;if(typeof a=="object"&&a.buffer&&typeof a.byteOffset=="number"&&typeof a.byteLength=="number"){t.end(Buffer.from(a.buffer,a.byteOffset,a.byteLength));return}t.end(Buffer.from(e));return}t.end()}var qnt,Ynt=w(()=>{DT();qnt=6e3});var fX,mX,Znt,Yo,Jnt=w(()=>{fX=au(Rnt());Dnt();Nnt();$nt();Mnt();jnt();Unt();znt();Hnt();DT();Ynt();Yo=class t{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new t(e)}static checkSocketUsage(e,r,n=console){let{sockets:a,requests:o,maxSockets:s}=e;if(typeof s!="number"||s===1/0||Date.now()-15e3<r)return r;if(a&&o)for(let c in a){let l=a[c]?.length??0,u=o[c]?.length??0;if(l>=s&&u>=2*s)return n?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${l} and ${u} additional requests are enqueued.
142
142
  See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
143
- or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(e){this.configProvider=new Promise((r,n)=>{typeof e=="function"?e().then(a=>{r(this.resolveDefaultConfig(a))}).catch(n):r(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:r,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let a=this.config,o=e.protocol==="https:";return!o&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((s,i)=>{let c,l=-1,u=-1,d=-1,p=-1,m=-1,f=()=>{Ko.clearTimeout(l),Ko.clearTimeout(u),Ko.clearTimeout(d),Ko.clearTimeout(p),Ko.clearTimeout(m)},g=async U=>{await c,f(),s(U)},v=async U=>{await c,f(),i(U)};if(r?.aborted){let U=ACe(r);v(U);return}let S=e.headers,A=S?(S.Expect??S.expect)==="100-continue":!1,C=o?a.httpsAgent:a.httpAgent;A&&!this.externalAgent&&(C=new(o?g4.Agent:mX)({keepAlive:!1,maxSockets:1/0})),l=Ko.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(C,this.socketWarningTimestamp,a.logger)},a.socketAcquisitionWarningTimeout??(a.requestTimeout??2e3)+(a.connectionTimeout??1e3));let x=e.query?(0,fX.buildQueryString)(e.query):"",k;if(e.username!=null||e.password!=null){let U=e.username??"",W=e.password??"";k=`${U}:${W}`}let R=e.path;x&&(R+=`?${x}`),e.fragment&&(R+=`#${e.fragment}`);let O=e.hostname??"";O[0]==="["&&O.endsWith("]")?O=e.hostname.slice(1,-1):O=e.hostname;let N={headers:e.headers,host:O,method:e.method,path:R,port:e.port,agent:C,auth:k},M=(o?g4.request:Znt)(N,U=>{let W=new fX.HttpResponse({statusCode:U.statusCode||-1,reason:U.statusMessage,headers:_nt(U.headers),body:U});g({response:W})});if(M.on("error",U=>{Ont.includes(U.code)?v(Object.assign(U,{name:"TimeoutError"})):v(U)}),r){let U=()=>{M.destroy();let W=ACe(r);v(W)};if(typeof r.addEventListener=="function"){let W=r;W.addEventListener("abort",U,{once:!0}),M.once("close",()=>W.removeEventListener("abort",U))}else r.onabort=U}let B=n??a.requestTimeout;u=Fnt(M,v,a.connectionTimeout),d=Bnt(M,v,B,a.throwOnRequestTimeout,a.logger??console),p=Wnt(M,v,a.socketTimeout);let j=N.agent;typeof j=="object"&&"keepAlive"in j&&(m=Vnt(M,{keepAlive:j.keepAlive,keepAliveMsecs:j.keepAliveMsecs})),c=Knt(M,e,B,this.externalAgent).catch(U=>(f(),i(U)))})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>({...n,[e]:r}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:r,connectionTimeout:n,socketTimeout:a,socketAcquisitionWarningTimeout:o,httpAgent:s,httpsAgent:i,throwOnRequestTimeout:c,logger:l}=e||{},u=!0,d=50;return{connectionTimeout:n,requestTimeout:r,socketTimeout:a,socketAcquisitionWarningTimeout:o,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let p=await import("node:http"),{Agent:m,request:f}=p.default??p;return Znt=f,mX=m,s instanceof mX||typeof s?.destroy=="function"?(this.externalAgent=!0,s):new mX({keepAlive:u,maxSockets:d,...s})},httpsAgent:i instanceof g4.Agent||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new g4.Agent({keepAlive:u,maxSockets:d,...i}),logger:l}}}});var QS=w(()=>{Jnt()});var y4,wCe=w(()=>{"use strict";y4=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_SECURITY_TOKEN","AWS_REGION","AWS_DEFAULT_REGION"]});var v4=w(()=>{"use strict";$()});function vy(t){return t.success===!0}function Wr(t){return t.success===!1}function E(t){return{success:!0,data:t}}function y(t){return{success:!1,error:t}}async function hX(t){try{let e=await t();return E(e)}catch(e){return y($r(e))}}function gX(t){try{let e=t();return E(e)}catch(e){return y($r(e))}}var Nor,HN,Jn=w(()=>{"use strict";v4();Nor=Object.defineProperty,HN=(t,e)=>Nor(t,"name",{value:e,configurable:!0});HN(vy,"isSuccess");HN(Wr,"isFailure");HN(E,"success");HN(y,"failure");HN(hX,"tryAsync");HN(gX,"trySync")});function yX(t){let e=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(t);if(!e)return;let r=e[1],n=e[2];if(r===void 0||n===void 0)return;let a=parseInt(r,10);if(!Number.isFinite(a)||a<1)return;let o=n==="minute"||n==="hour"||n==="day";if(!(o&&a!==1)&&!(!o&&a===1))return n==="minute"||n==="minutes"?{everyMs:a*6e4}:n==="hour"||n==="hours"?{everyMs:a*60*6e4}:{everyMs:a*24*60*6e4}}var _or,$or,Xnt,Mor,Ot,Qnt=w(()=>{"use strict";$();_or=Object.defineProperty,$or=(t,e)=>_or(t,"name",{value:e,configurable:!0}),Xnt=/^[a-zA-Z][a-zA-Z0-9-]*$/,Mor=CN.source.replace(/^\^|\$$/g,""),Ot=Object.freeze({IDENTIFIER:Xnt,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:Xnt,BUCKET_NAME:/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z][a-z0-9]*$/,DATABASE_NAME:/^[a-zA-Z][a-zA-Z0-9_]*$/,RESOURCE_TYPE:/^[a-z]+(:[a-z]+)?$/,SSM_PATH:new RegExp(`^(?:/${Mor})+$`),SECRET_NAME:Wm,SSM_COMPONENT:CN,EMAIL:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,DOCKER_IMAGE:/^[a-z0-9][a-z0-9._-]*[a-z0-9](:[a-z0-9._-]+)?$/,DOMAIN:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,HTTP_ORIGIN:/^https?:\/\/[a-z0-9.-]+(:\d+)?$/i,PASCAL_CASE:/^[A-Z][A-Za-z0-9]*$/,AWS_ACCOUNT_ID:/^\d{12}$/,VPC_ID:/^vpc-[a-z0-9]+$/,ROLE_ARN:/^arn:aws[a-zA-Z-]*:iam::\d{12}:role\/.+$/,CIDR:/^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/(3[0-2]|[12]?\d)$/,SCHEDULE_EXPRESSION:/^(rate\(1 (?:minute|hour|day)\)|rate\((?:[2-9]|[1-9]\d+) (?:minutes|hours|days)\)|cron\([^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+\))$/,LAMBDA_RUNTIME_IDENTIFIER:/^[A-Za-z0-9._-]+$/,ENV_VAR_NAME:/^[A-Za-z_][A-Za-z0-9_]*$/});$or(yX,"parseRateExpression")});var q,eat=w(()=>{"use strict";$();q=Object.freeze({IDENTIFIER:"Must start with a letter, contain only letters, numbers, and hyphens",NEW_APP_NAME:"Must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",IDENTIFIER_MIN_LENGTH:"Must be at least 2 characters",IDENTIFIER_NO_TRAILING_HYPHEN:"Must not end with a hyphen",IDENTIFIER_NO_CONSECUTIVE_HYPHENS:"Must not contain consecutive hyphens",RESOURCE_NAME:"Must start with a letter and contain only letters and numbers (PascalCase recommended)",ECS_SERVICE_NAME:"Service name must start with a letter and contain only letters, numbers, and hyphens",BUCKET_NAME:"Bucket name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",DATABASE_NAME:"Database name must start with a letter and contain only letters, numbers, and underscores",RESOURCE_TYPE:"Resource type must be in format 'category' or 'category:type'",SSM_PATH:"SSM path must start with / and contain valid namespace segments (e.g., /myapp/ApiCluster/service)",SECRET_NAME:KS,SSM_COMPONENT:NU,EMAIL:"Please enter a valid email address",DOMAIN:"Please enter a valid domain (e.g., cms.example.com)",DOCKER_IMAGE:"Invalid Docker image name format",REQUIRED:{APP_NAME:"Application name is required",RESOURCE_NAME:"Resource name is required",BUCKET_NAME:"Bucket name is required",SERVICE_NAME:"Service name is required",NETWORK_NAME:"Network name is required",DATABASE_NAME:"Database name is required",ORGANISATION_NAME:"Organisation name is required",EMAIL:"Email is required",NAME:"Name is required",USERNAME:"Username is required",CONTAINER_NAME:"Container name is required",GROUP:"Group is required",PATTERN_NAME:"Pattern name is required",SOURCE:"Source directory is required",BUILD_COMMAND:"Build command is required",OUTPUT_DIR:"Output directory is required",FORMS_TO:"Forms recipient address is required",ROUTING_PATH:"Routing path is required",RESOURCE_REFERENCE:"Resource reference is required",RESOURCE_TYPE:"Resource type is required",VARIANT:"Variant is required",SUBTYPE:"Subtype is required",DEPLOY_TARGET:"Deploy target is required",DESTROY_TARGET:"Destroy target is required"},MAX_LENGTH:{APP_NAME:"Application name must be 50 characters or less",RESOURCE_NAME:"Resource name must be 63 characters or less",BUCKET_NAME:"Bucket name must be 63 characters or less",SERVICE_NAME:"Service name must be 255 characters or less",NETWORK_NAME:"Network name must be 50 characters or less",DATABASE_NAME:"Database name must be 63 characters or less",ORGANISATION_NAME:"Organisation name must be 50 characters or less"},PORT:{INTEGER:"Port must be an integer",MIN:"Port must be at least 1",MAX:"Port cannot exceed 65535"},USERNAME:{MAX_LENGTH:"Username cannot exceed 63 characters"},LAMBDA:{MEMORY:{INTEGER:"Lambda memory must be an integer",MIN:"Memory must be at least 128 MB",MAX:"Memory cannot exceed 10240 MB",MULTIPLE:"Memory must be 128 MB or a multiple of 64 MB"},TIMEOUT:{INTEGER:"Timeout must be an integer",MIN:"Timeout must be at least 1 second",MAX:"Timeout cannot exceed 900 seconds"},RUNTIME:"Lambda runtime must contain only letters, digits, dots, underscores, or dashes (e.g. 'NODEJS_20_X' or 'nodejs20.x')"},ENV_VAR_NAME:"Environment variable names must start with a letter or underscore and contain only letters, digits, and underscores",PRIORITY:{INTEGER:"Priority must be an integer",MIN:"Priority must be at least 1",MAX:"Priority cannot exceed 50000"},CAPACITY:{MIN:{INTEGER:"Minimum capacity must be an integer",MIN_0:"Minimum capacity must be at least 0",MIN_1:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 100"},MAX:{INTEGER:"Maximum capacity must be an integer",MIN_0:"Maximum capacity must be at least 0",MIN_1:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 100"},DESIRED:{INTEGER:"Desired count must be an integer",MIN:"Desired count must be at least 0",MAX:"Desired count cannot exceed 100"},WARM_POOL_REQUIRED:"minCapacity 0 requires a warmPool \u2014 without it, new tasks wait 60-90s for a cold instance launch",WARM_POOL:{MIN_SIZE:{INTEGER:"Warm pool minSize must be an integer",MIN:"Warm pool minSize must be at least 0",MAX:"Warm pool minSize cannot exceed 100"},MIN_SIZE_EXCEEDS_MAX_CAPACITY:"warmPool.minSize cannot exceed maxCapacity \u2014 the warm pool cannot hold more instances than the ASG allows"}},MEMORY_LIMIT:{INTEGER:"Memory limit must be an integer",MIN_512:"Memory limit must be at least 512 MiB",MIN_128:"Memory limit must be at least 128 MiB",MAX:"Memory limit cannot exceed 30720 MiB"},DATABASE:{PORT:{INTEGER:"Database port must be an integer",MIN:"Database port must be at least 1024",MAX:"Database port cannot exceed 65535"},NAME:{REQUIRED:"Database name is required",MAX_LENGTH:"Database name must be 63 characters or less"}},BACKUP_RETENTION:{INTEGER:"Backup retention must be an integer",MIN:"Backup retention must be at least 1 day",MAX:"Backup retention cannot exceed 35 days"},SQS:{VISIBILITY_TIMEOUT:{INTEGER:"Visibility timeout must be an integer",MIN:"Visibility timeout must be at least 0 seconds",MAX:"Visibility timeout cannot exceed 43200 seconds (12 hours)"},RETENTION_PERIOD:{INTEGER:"Retention period must be an integer",MIN:"Retention period must be at least 60 seconds",MAX:"Retention period cannot exceed 1209600 seconds (14 days)"}},READER:{COUNT:{INTEGER:"Reader count must be an integer",MIN:"Reader count must be at least 0",MAX:"Reader count cannot exceed 15"}},IDENTIFIER_SUFFIX:{REQUIRED:"Identifier suffix is required when specified",MAX_LENGTH:"Identifier suffix cannot exceed 50 characters"},ROTATION:{INTEGER:"Rotation days must be an integer",MIN:"Rotation interval must be at least 1 day",MAX:"Rotation interval cannot exceed 365 days"},MAX_CONNECTIONS:{INTEGER:"Max connections must be an integer",MIN:"Max connections must be at least 1",MAX:"Max connections cannot exceed 100"},MONITORING_INTERVAL:{INTEGER:"Monitoring interval must be an integer",MIN:"Monitoring interval must be at least 0",MAX:"Monitoring interval cannot exceed 60 seconds",VALUES:"Monitoring interval must be 0, 1, 5, 10, 15, 30, or 60 seconds"},RETENTION_DAYS:{INTEGER:"Retention days must be an integer",MIN:"Retention days must be at least 1",MAX:"Retention days cannot exceed 365"},BATCH_SIZE:{INTEGER:"Batch size must be an integer",MIN:"Batch size must be at least 1",MAX:"Batch size cannot exceed 10000"},SERVICE:{UNIQUE_WITHIN_CLUSTER:"Service names must be unique within a cluster",MIN_REQUIRED:"At least one service is required",ROUTING_REQUIRED:"Multiple services with ports require routing config (path or host)"},PROXY_CONFIG:{MAX_IDLE_CONNECTIONS:{INTEGER:"Max idle connections must be an integer",MIN:"Max idle connections must be at least 0",MAX:"Max idle connections cannot exceed 100"},BORROW_TIMEOUT:{INTEGER:"Connection borrow timeout must be an integer",MIN:"Connection borrow timeout must be at least 1 second",MAX:"Connection borrow timeout cannot exceed 3600 seconds"}},MAX_AZS:{INTEGER:"Max AZs must be an integer",MIN:"Max AZs must be at least 1",MAX:"Max AZs cannot exceed 3"},BATCHING_WINDOW:{INTEGER:"Max batching window must be an integer",MIN:"Max batching window must be at least 0",MAX:"Max batching window cannot exceed 300 seconds"},HEALTH_CHECK:{INTERVAL:{INTEGER:"Health check interval must be an integer",MIN:"Health check interval must be at least 5 seconds",MAX:"Health check interval cannot exceed 300 seconds"},TIMEOUT:{INTEGER:"Health check timeout must be an integer",MIN:"Health check timeout must be at least 2 seconds",MAX:"Health check timeout cannot exceed 60 seconds"},RETRIES:{INTEGER:"Health check retries must be an integer",MIN:"Health check retries must be at least 1",MAX:"Health check retries cannot exceed 10"},START_PERIOD:{INTEGER:"Health check start period must be an integer",MIN:"Health check start period must be at least 0 seconds",MAX:"Health check start period cannot exceed 300 seconds"}},EPHEMERAL_STORAGE:{INTEGER:"Ephemeral storage size must be an integer",MIN:"Ephemeral storage size must be at least 512 MB",MAX:"Ephemeral storage size cannot exceed 10240 MB"},MAX_MESSAGE_SIZE:{INTEGER:"Max message size must be an integer",MIN:"Max message size must be at least 1024 bytes",MAX:"Max message size cannot exceed 262144 bytes (256 KB)"},CAPACITY_CONSTRAINT:{MIN_LTE_MAX:"minCapacity must be less than or equal to maxCapacity"},DIRECT_ACCESS:{NO_DOMAIN:"directAccess cannot be used with domain (no ALB for HTTPS)",NO_LOAD_BALANCER:"directAccess cannot be used with loadBalancer (mutually exclusive)"},GLOBAL_AURORA:{PRIMARY_REGION_REQUIRED:"primaryRegion is required for GlobalAurora databases"},NAT_GATEWAY:{INTEGER:"NAT gateway count must be an integer",MIN:"NAT gateway count must be at least 0",MAX:"NAT gateway count cannot exceed 3"},CIDR_MASK:{INTEGER:"CIDR mask must be an integer",MIN:"CIDR mask must be at least 16",MAX:"CIDR mask cannot exceed 28"},CPU:{INTEGER:"CPU must be an integer",MIN:"CPU must be at least 256 units",MAX:"CPU cannot exceed 4096 units"},KMS:{KEY_REQUIRED:"KMS key ARN is required when using KMS encryption"},READER_INSTANCES:{MAX:"Cannot have more than 15 reader instances",COUNT_OR_INSTANCES:"Cannot specify both 'count' and 'instances' - use one or the other"},GENERATOR_CAPACITY:{MIN:{MIN:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 1000"},MAX:{MIN:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 1000"}},INSTANCE_TYPE:"Unknown instance type. Common types include: t4g.micro, t4g.small, m5.large",ARCHITECTURE_MISMATCH:"Architecture mismatch between instance type and AMI",ALLOCATED_STORAGE:{INTEGER:"Allocated storage must be an integer",MIN:"Allocated storage must be at least 20 GB",MAX:"Allocated storage cannot exceed 65536 GB"},DLQ:{MAX_RECEIVE_COUNT:{INTEGER:"Max receive count must be an integer",MIN:"Max receive count must be at least 1",MAX:"Max receive count cannot exceed 1000"}},ALARM:{PERCENTAGE:{MIN:"Threshold must be at least 1%",MAX:"Threshold must be at most 100%"},FREE_STORAGE_GIB:{MIN:"Free storage threshold must be at least 1 GiB"}},REGION:"Invalid AWS region",PASCAL_CASE:"Resource name must start with an uppercase letter and contain only alphanumerics (PascalCase).",IMAGE_DOCKER_MUTEX:"image and docker are mutually exclusive",AWS_ACCOUNT_ID:"AWS account id must be exactly 12 digits (no hyphens)",VPC_ID:"VPC id must look like vpc-abc12345",ROLE_ARN:"Role ARN must have the form arn:aws:iam::<account-id>:role/<name>",CIDR:"CIDR must be in dotted-quad/prefix-length form (e.g. 10.0.0.0/16)",VPC_PEER:{MIN_REQUESTER_ACCOUNTS:"At least one requester account id is required",REGION_REQUIRED:"Peer region is required when specified",ROUTE_TABLE_ID_REQUIRED:"Route table id must not be empty"},SCHEDULE_EXPRESSION:"Schedule expression must be 'rate(N minute|minutes|hour|hours|day|days)' with N>=1, or 'cron(<6-field AWS expression>)'"})});var $p=w(()=>{"use strict";Qnt();eat()});function OT(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function KN(t){return du.includes(t)}function YN(t){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(t)}function ZN(t){if(!t)return qN.slice(0,3);let e=t.toLowerCase().split("-"),r=e[0],n=e.length>1?e[1]:"",a=[];return r&&n&&(a=du.filter(o=>o.startsWith(`${r}-${n}`))),a.length===0&&r&&(a=du.filter(o=>o.startsWith(`${r}-`))),a.length>0?a.slice(0,3):qN.slice(0,3)}function JN(t){if(KN(t))return!0;let e=ZN(t);return YN(t)?`Unknown region. Try: ${e.join(", ")}`:`Invalid format. Try: ${e.join(", ")}`}function b4(t){if(!t||t.trim()==="")return!0;let e=OT(t);for(let r of e){let n=JN(r);if(n!==!0)return n}return!0}function XN(t,e){return t.filter(r=>r!==e)}function CCe(t){return{label:t.city,value:t.code,description:t.optIn?`${t.code} \u2014 opt-in required`:t.code}}function vu(){return Xs.map(CCe)}function eb(t){return Xs.filter(e=>e.code!==t).map(CCe)}function $d(t){let e=Xs.find(r=>r.code===t);return e?e.city:t}function E4(t){return e=>{let r=OT(e);return XN(r,t)}}var Lor,qm,For,S4,qN,xCe=w(()=>{"use strict";$();$();Lor=Object.defineProperty,qm=(t,e)=>Lor(t,"name",{value:e,configurable:!0}),For=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],S4=Object.freeze(For.flatMap(t=>{let e=JA(t);return e?[e]:[]})),qN=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);qm(OT,"parseRegionList");qm(KN,"isValidRegion");qm(YN,"isValidRegionFormat");qm(ZN,"getSuggestions");qm(JN,"validateRegion");qm(b4,"validateRegionList");qm(XN,"filterDuplicateRegions");qm(CCe,"toRegionOption");qm(vu,"getRegionOptions");qm(eb,"getRegionOptionsExcluding");qm($d,"getRegionName");qm(E4,"createRegionFormatter")});var A4,TCe=w(()=>{"use strict";A4="4.0.0"});var w4,tb,Km,Su,Ym,QN,NT=w(()=>{"use strict";w4=["Aurora","Instance","GlobalAurora","ClickHouse"],tb=["FARGATE","FARGATE_SPOT","EC2"],Km=["standard","resilient","enterprise"],Su=["tinkerer","lightweight","standard","resilient","enterprise"],Ym="custom",QN=[...Su,Ym]});function Mp(t,e){return t.includes(e)}var jor,Bor,Uor,e_,_T,C4,t_,x4,kCe,r_,T4,k4,I4,vX,$T,cw,MT,P4,ICe,PCe,RCe,Vor,DCe,OCe,R4,D4,SX,bX,LT,NCe,zor,Gor,Md,Zm,_Ce,$Ce,MCe,FT,fl=w(()=>{"use strict";NT();NT();$();NT();NT();jor=Object.defineProperty,Bor=(t,e)=>jor(t,"name",{value:e,configurable:!0}),Uor=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),e_=["ecs","lambda","ec2"],_T=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),C4=["code","container"],t_=Object.freeze({CODE:"code",CONTAINER:"container"}),x4=["ARM_64","X86_64"],kCe="ARM_64",r_=["NONE","AWS_IAM"],T4=["public","internal"],k4=["CPU","MEMORY"],I4=["ARM","STANDARD"],vX=["Instance","Aurora"],$T=["postgresql","mysql"],cw=["foundation","compliance","hardened"],MT="FARGATE",P4=["t3.nano","t3.micro","t3.small","t3.medium","t3.large","t3.xlarge","t3.2xlarge","t3a.nano","t3a.micro","t3a.small","t3a.medium","t3a.large","t3a.xlarge","t3a.2xlarge","t4g.nano","t4g.micro","t4g.small","t4g.medium","t4g.large","t4g.xlarge","t4g.2xlarge","c5.large","c5.xlarge","c5.2xlarge","c5.4xlarge","c5.9xlarge","c5.12xlarge","c5.18xlarge","c5.24xlarge","c5a.large","c5a.xlarge","c5a.2xlarge","c5a.4xlarge","c5a.8xlarge","c5a.12xlarge","c5a.16xlarge","c5a.24xlarge","c6g.medium","c6g.large","c6g.xlarge","c6g.2xlarge","c6g.4xlarge","c6g.8xlarge","c6g.12xlarge","c6g.16xlarge","r5.large","r5.xlarge","r5.2xlarge","r5.4xlarge","r5.8xlarge","r5.12xlarge","r5.16xlarge","r5.24xlarge","r5a.large","r5a.xlarge","r5a.2xlarge","r5a.4xlarge","r5a.8xlarge","r5a.12xlarge","r5a.16xlarge","r5a.24xlarge","r6g.medium","r6g.large","r6g.xlarge","r6g.2xlarge","r6g.4xlarge","r6g.8xlarge","r6g.12xlarge","r6g.16xlarge","i3.large","i3.xlarge","i3.2xlarge","i3.4xlarge","i3.8xlarge","i3.16xlarge","p3.2xlarge","p3.8xlarge","p3.16xlarge","g4dn.xlarge","g4dn.2xlarge","g4dn.4xlarge","g4dn.8xlarge","g4dn.12xlarge","g4dn.16xlarge","m5.large","m5.xlarge","m5.2xlarge","m5.4xlarge","m5.8xlarge","m5.12xlarge","m5.16xlarge","m5.24xlarge","m5a.large","m5a.xlarge","m5a.2xlarge","m5a.4xlarge","m5a.8xlarge","m5a.12xlarge","m5a.16xlarge","m5a.24xlarge"],ICe=[0,1,5,10,15,30,60];Bor(Mp,"constIncludes");PCe=1,RCe=65535,Vor=Object.freeze({postgresql:5432,mysql:3306}),DCe=128,OCe=10240,R4=1,D4=900,SX=1,bX=1e3,LT=100,NCe=100,zor=1,Gor=!1,Md=3e3,Zm="t4g.micro",_Ce=30,$Ce=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],MCe=["standard","assets","upload","website"],FT=["AES256","KMS"]});function EX(t,e=Ot.IDENTIFIER,r=q.IDENTIFIER){return h.string().min(2,q.IDENTIFIER_MIN_LENGTH).max(50,t).regex(e,r).refine(n=>!n.endsWith("-"),{message:q.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(n=>!n.includes("--"),{message:q.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}function rb(t){return t.issues.map(e=>`${e.path.length>0?`${e.path.join(".")}: `:""}${e.message}`).join(`
143
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(e){this.configProvider=new Promise((r,n)=>{typeof e=="function"?e().then(a=>{r(this.resolveDefaultConfig(a))}).catch(n):r(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:r,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let a=this.config,o=e.protocol==="https:";return!o&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((s,i)=>{let c,l=-1,u=-1,d=-1,p=-1,m=-1,f=()=>{Ko.clearTimeout(l),Ko.clearTimeout(u),Ko.clearTimeout(d),Ko.clearTimeout(p),Ko.clearTimeout(m)},g=async U=>{await c,f(),s(U)},v=async U=>{await c,f(),i(U)};if(r?.aborted){let U=ACe(r);v(U);return}let S=e.headers,A=S?(S.Expect??S.expect)==="100-continue":!1,C=o?a.httpsAgent:a.httpAgent;A&&!this.externalAgent&&(C=new(o?g4.Agent:mX)({keepAlive:!1,maxSockets:1/0})),l=Ko.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(C,this.socketWarningTimestamp,a.logger)},a.socketAcquisitionWarningTimeout??(a.requestTimeout??2e3)+(a.connectionTimeout??1e3));let x=e.query?(0,fX.buildQueryString)(e.query):"",k;if(e.username!=null||e.password!=null){let U=e.username??"",W=e.password??"";k=`${U}:${W}`}let R=e.path;x&&(R+=`?${x}`),e.fragment&&(R+=`#${e.fragment}`);let O=e.hostname??"";O[0]==="["&&O.endsWith("]")?O=e.hostname.slice(1,-1):O=e.hostname;let N={headers:e.headers,host:O,method:e.method,path:R,port:e.port,agent:C,auth:k},M=(o?g4.request:Znt)(N,U=>{let W=new fX.HttpResponse({statusCode:U.statusCode||-1,reason:U.statusMessage,headers:_nt(U.headers),body:U});g({response:W})});if(M.on("error",U=>{Ont.includes(U.code)?v(Object.assign(U,{name:"TimeoutError"})):v(U)}),r){let U=()=>{M.destroy();let W=ACe(r);v(W)};if(typeof r.addEventListener=="function"){let W=r;W.addEventListener("abort",U,{once:!0}),M.once("close",()=>W.removeEventListener("abort",U))}else r.onabort=U}let B=n??a.requestTimeout;u=Fnt(M,v,a.connectionTimeout),d=Bnt(M,v,B,a.throwOnRequestTimeout,a.logger??console),p=Wnt(M,v,a.socketTimeout);let j=N.agent;typeof j=="object"&&"keepAlive"in j&&(m=Vnt(M,{keepAlive:j.keepAlive,keepAliveMsecs:j.keepAliveMsecs})),c=Knt(M,e,B,this.externalAgent).catch(U=>(f(),i(U)))})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>({...n,[e]:r}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:r,connectionTimeout:n,socketTimeout:a,socketAcquisitionWarningTimeout:o,httpAgent:s,httpsAgent:i,throwOnRequestTimeout:c,logger:l}=e||{},u=!0,d=50;return{connectionTimeout:n,requestTimeout:r,socketTimeout:a,socketAcquisitionWarningTimeout:o,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let p=await import("node:http"),{Agent:m,request:f}=p.default??p;return Znt=f,mX=m,s instanceof mX||typeof s?.destroy=="function"?(this.externalAgent=!0,s):new mX({keepAlive:u,maxSockets:d,...s})},httpsAgent:i instanceof g4.Agent||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new g4.Agent({keepAlive:u,maxSockets:d,...i}),logger:l}}}});var QS=w(()=>{Jnt()});var y4,wCe=w(()=>{"use strict";y4=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_SECURITY_TOKEN","AWS_REGION","AWS_DEFAULT_REGION"]});var v4=w(()=>{"use strict";$()});function vy(t){return t.success===!0}function Wr(t){return t.success===!1}function E(t){return{success:!0,data:t}}function y(t){return{success:!1,error:t}}async function hX(t){try{let e=await t();return E(e)}catch(e){return y($r(e))}}function gX(t){try{let e=t();return E(e)}catch(e){return y($r(e))}}var Nor,HN,Jn=w(()=>{"use strict";v4();Nor=Object.defineProperty,HN=(t,e)=>Nor(t,"name",{value:e,configurable:!0});HN(vy,"isSuccess");HN(Wr,"isFailure");HN(E,"success");HN(y,"failure");HN(hX,"tryAsync");HN(gX,"trySync")});function yX(t){let e=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(t);if(!e)return;let r=e[1],n=e[2];if(r===void 0||n===void 0)return;let a=parseInt(r,10);if(!Number.isFinite(a)||a<1)return;let o=n==="minute"||n==="hour"||n==="day";if(!(o&&a!==1)&&!(!o&&a===1))return n==="minute"||n==="minutes"?{everyMs:a*6e4}:n==="hour"||n==="hours"?{everyMs:a*60*6e4}:{everyMs:a*24*60*6e4}}var _or,$or,Xnt,Mor,Ot,Qnt=w(()=>{"use strict";$();_or=Object.defineProperty,$or=(t,e)=>_or(t,"name",{value:e,configurable:!0}),Xnt=/^[a-zA-Z][a-zA-Z0-9-]*$/,Mor=CN.source.replace(/^\^|\$$/g,""),Ot=Object.freeze({IDENTIFIER:Xnt,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:Xnt,BUCKET_NAME:/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z][a-z0-9]*$/,DATABASE_NAME:/^[a-zA-Z][a-zA-Z0-9_]*$/,RESOURCE_TYPE:/^[a-z]+(:[a-z]+)?$/,SSM_PATH:new RegExp(`^(?:/${Mor})+$`),SECRET_NAME:Wm,SSM_COMPONENT:CN,EMAIL:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,DOCKER_IMAGE:/^[a-z0-9][a-z0-9._-]*[a-z0-9](:[a-z0-9._-]+)?$/,DOMAIN:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,HTTP_ORIGIN:/^https?:\/\/[a-z0-9.-]+(:\d+)?$/i,PASCAL_CASE:/^[A-Z][A-Za-z0-9]*$/,AWS_ACCOUNT_ID:/^\d{12}$/,VPC_ID:/^vpc-[a-z0-9]+$/,ROLE_ARN:/^arn:aws[a-zA-Z-]*:iam::\d{12}:role\/.+$/,CIDR:/^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/(3[0-2]|[12]?\d)$/,SCHEDULE_EXPRESSION:/^(rate\(1 (?:minute|hour|day)\)|rate\((?:[2-9]|[1-9]\d+) (?:minutes|hours|days)\)|cron\([^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+\))$/,LAMBDA_RUNTIME_IDENTIFIER:/^[A-Za-z0-9._-]+$/,ENV_VAR_NAME:/^[A-Za-z_][A-Za-z0-9_]*$/});$or(yX,"parseRateExpression")});var q,eat=w(()=>{"use strict";$();q=Object.freeze({IDENTIFIER:"Must start with a letter, contain only letters, numbers, and hyphens",NEW_APP_NAME:"Must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",IDENTIFIER_MIN_LENGTH:"Must be at least 2 characters",IDENTIFIER_NO_TRAILING_HYPHEN:"Must not end with a hyphen",IDENTIFIER_NO_CONSECUTIVE_HYPHENS:"Must not contain consecutive hyphens",RESOURCE_NAME:"Must start with a letter and contain only letters and numbers (PascalCase recommended)",ECS_SERVICE_NAME:"Service name must start with a letter and contain only letters, numbers, and hyphens",BUCKET_NAME:"Bucket name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",DATABASE_NAME:"Database name must start with a letter and contain only letters, numbers, and underscores",RESOURCE_TYPE:"Resource type must be in format 'category' or 'category:type'",SSM_PATH:"SSM path must start with / and contain valid namespace segments (e.g., /myapp/ApiCluster/service)",SECRET_NAME:KS,SSM_COMPONENT:NU,EMAIL:"Please enter a valid email address",DOMAIN:"Please enter a valid domain (e.g., cms.example.com)",DOCKER_IMAGE:"Invalid Docker image name format",REQUIRED:{APP_NAME:"Application name is required",RESOURCE_NAME:"Resource name is required",BUCKET_NAME:"Bucket name is required",SERVICE_NAME:"Service name is required",NETWORK_NAME:"Network name is required",DATABASE_NAME:"Database name is required",ORGANISATION_NAME:"Organisation name is required",EMAIL:"Email is required",NAME:"Name is required",USERNAME:"Username is required",CONTAINER_NAME:"Container name is required",GROUP:"Group is required",PATTERN_NAME:"Pattern name is required",SOURCE:"Source directory is required",BUILD_COMMAND:"Build command is required",OUTPUT_DIR:"Output directory is required",FORMS_TO:"Forms recipient address is required",ROUTING_PATH:"Routing path is required",RESOURCE_REFERENCE:"Resource reference is required",RESOURCE_TYPE:"Resource type is required",VARIANT:"Variant is required",SUBTYPE:"Subtype is required",DEPLOY_TARGET:"Deploy target is required",DESTROY_TARGET:"Destroy target is required"},MAX_LENGTH:{APP_NAME:"Application name must be 50 characters or less",RESOURCE_NAME:"Resource name must be 63 characters or less",BUCKET_NAME:"Bucket name must be 63 characters or less",SERVICE_NAME:"Service name must be 255 characters or less",NETWORK_NAME:"Network name must be 50 characters or less",DATABASE_NAME:"Database name must be 63 characters or less",ORGANISATION_NAME:"Organisation name must be 50 characters or less"},PORT:{INTEGER:"Port must be an integer",MIN:"Port must be at least 1",MAX:"Port cannot exceed 65535"},USERNAME:{MAX_LENGTH:"Username cannot exceed 63 characters"},LAMBDA:{MEMORY:{INTEGER:"Lambda memory must be an integer",MIN:"Memory must be at least 128 MB",MAX:"Memory cannot exceed 10240 MB",MULTIPLE:"Memory must be 128 MB or a multiple of 64 MB"},TIMEOUT:{INTEGER:"Timeout must be an integer",MIN:"Timeout must be at least 1 second",MAX:"Timeout cannot exceed 900 seconds"},RUNTIME:"Lambda runtime must contain only letters, digits, dots, underscores, or dashes (e.g. 'NODEJS_20_X' or 'nodejs20.x')"},ENV_VAR_NAME:"Environment variable names must start with a letter or underscore and contain only letters, digits, and underscores",PRIORITY:{INTEGER:"Priority must be an integer",MIN:"Priority must be at least 1",MAX:"Priority cannot exceed 50000"},CAPACITY:{MIN:{INTEGER:"Minimum capacity must be an integer",MIN_0:"Minimum capacity must be at least 0",MIN_1:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 100"},MAX:{INTEGER:"Maximum capacity must be an integer",MIN_0:"Maximum capacity must be at least 0",MIN_1:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 100"},DESIRED:{INTEGER:"Desired count must be an integer",MIN:"Desired count must be at least 0",MAX:"Desired count cannot exceed 100"},WARM_POOL_REQUIRED:"minCapacity 0 requires a warmPool \u2014 without it, new tasks wait 60-90s for a cold instance launch",WARM_POOL:{MIN_SIZE:{INTEGER:"Warm pool minSize must be an integer",MIN:"Warm pool minSize must be at least 0",MAX:"Warm pool minSize cannot exceed 100"},MIN_SIZE_EXCEEDS_MAX_CAPACITY:"warmPool.minSize cannot exceed maxCapacity \u2014 the warm pool cannot hold more instances than the ASG allows"}},MEMORY_LIMIT:{INTEGER:"Memory limit must be an integer",MIN_512:"Memory limit must be at least 512 MiB",MIN_128:"Memory limit must be at least 128 MiB",MAX:"Memory limit cannot exceed 30720 MiB"},DATABASE:{PORT:{INTEGER:"Database port must be an integer",MIN:"Database port must be at least 1024",MAX:"Database port cannot exceed 65535"},NAME:{REQUIRED:"Database name is required",MAX_LENGTH:"Database name must be 63 characters or less"}},BACKUP_RETENTION:{INTEGER:"Backup retention must be an integer",MIN:"Backup retention must be at least 1 day",MAX:"Backup retention cannot exceed 35 days"},SQS:{VISIBILITY_TIMEOUT:{INTEGER:"Visibility timeout must be an integer",MIN:"Visibility timeout must be at least 0 seconds",MAX:"Visibility timeout cannot exceed 43200 seconds (12 hours)"},RETENTION_PERIOD:{INTEGER:"Retention period must be an integer",MIN:"Retention period must be at least 60 seconds",MAX:"Retention period cannot exceed 1209600 seconds (14 days)"}},READER:{COUNT:{INTEGER:"Reader count must be an integer",MIN:"Reader count must be at least 0",MAX:"Reader count cannot exceed 15"}},IDENTIFIER_SUFFIX:{REQUIRED:"Identifier suffix is required when specified",MAX_LENGTH:"Identifier suffix cannot exceed 50 characters"},ROTATION:{INTEGER:"Rotation days must be an integer",MIN:"Rotation interval must be at least 1 day",MAX:"Rotation interval cannot exceed 365 days"},MAX_CONNECTIONS:{INTEGER:"Max connections must be an integer",MIN:"Max connections must be at least 1",MAX:"Max connections cannot exceed 100"},MONITORING_INTERVAL:{INTEGER:"Monitoring interval must be an integer",MIN:"Monitoring interval must be at least 0",MAX:"Monitoring interval cannot exceed 60 seconds",VALUES:"Monitoring interval must be 0, 1, 5, 10, 15, 30, or 60 seconds"},RETENTION_DAYS:{INTEGER:"Retention days must be an integer",MIN:"Retention days must be at least 1",MAX:"Retention days cannot exceed 365"},BATCH_SIZE:{INTEGER:"Batch size must be an integer",MIN:"Batch size must be at least 1",MAX:"Batch size cannot exceed 10000"},SERVICE:{UNIQUE_WITHIN_CLUSTER:"Service names must be unique within a cluster",MIN_REQUIRED:"At least one service is required",ROUTING_REQUIRED:"Multiple services with ports require routing config (path or host)"},PROXY_CONFIG:{MAX_IDLE_CONNECTIONS:{INTEGER:"Max idle connections must be an integer",MIN:"Max idle connections must be at least 0",MAX:"Max idle connections cannot exceed 100"},BORROW_TIMEOUT:{INTEGER:"Connection borrow timeout must be an integer",MIN:"Connection borrow timeout must be at least 1 second",MAX:"Connection borrow timeout cannot exceed 3600 seconds"}},MAX_AZS:{INTEGER:"Max AZs must be an integer",MIN:"Max AZs must be at least 1",MAX:"Max AZs cannot exceed 3"},BATCHING_WINDOW:{INTEGER:"Max batching window must be an integer",MIN:"Max batching window must be at least 0",MAX:"Max batching window cannot exceed 300 seconds"},HEALTH_CHECK:{INTERVAL:{INTEGER:"Health check interval must be an integer",MIN:"Health check interval must be at least 5 seconds",MAX:"Health check interval cannot exceed 300 seconds"},TIMEOUT:{INTEGER:"Health check timeout must be an integer",MIN:"Health check timeout must be at least 2 seconds",MAX:"Health check timeout cannot exceed 60 seconds"},RETRIES:{INTEGER:"Health check retries must be an integer",MIN:"Health check retries must be at least 1",MAX:"Health check retries cannot exceed 10"},START_PERIOD:{INTEGER:"Health check start period must be an integer",MIN:"Health check start period must be at least 0 seconds",MAX:"Health check start period cannot exceed 300 seconds"}},EPHEMERAL_STORAGE:{INTEGER:"Ephemeral storage size must be an integer",MIN:"Ephemeral storage size must be at least 512 MB",MAX:"Ephemeral storage size cannot exceed 10240 MB"},MAX_MESSAGE_SIZE:{INTEGER:"Max message size must be an integer",MIN:"Max message size must be at least 1024 bytes",MAX:"Max message size cannot exceed 262144 bytes (256 KB)"},CAPACITY_CONSTRAINT:{MIN_LTE_MAX:"minCapacity must be less than or equal to maxCapacity"},DIRECT_ACCESS:{NO_DOMAIN:"directAccess cannot be used with domain (no ALB for HTTPS)",NO_LOAD_BALANCER:"directAccess cannot be used with loadBalancer (mutually exclusive)"},GLOBAL_AURORA:{PRIMARY_REGION_REQUIRED:"primaryRegion is required for GlobalAurora databases"},NAT_GATEWAY:{INTEGER:"NAT gateway count must be an integer",MIN:"NAT gateway count must be at least 0",MAX:"NAT gateway count cannot exceed 3"},CIDR_MASK:{INTEGER:"CIDR mask must be an integer",MIN:"CIDR mask must be at least 16",MAX:"CIDR mask cannot exceed 28"},CPU:{INTEGER:"CPU must be an integer",MIN:"CPU must be at least 256 units",MAX:"CPU cannot exceed 4096 units"},KMS:{KEY_REQUIRED:"KMS key ARN is required when using KMS encryption"},READER_INSTANCES:{MAX:"Cannot have more than 15 reader instances",COUNT_OR_INSTANCES:"Cannot specify both 'count' and 'instances' - use one or the other"},GENERATOR_CAPACITY:{MIN:{MIN:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 1000"},MAX:{MIN:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 1000"}},INSTANCE_TYPE:"Unknown instance type. Common types include: t4g.micro, t4g.small, m5.large",ARCHITECTURE_MISMATCH:"Architecture mismatch between instance type and AMI",ALLOCATED_STORAGE:{INTEGER:"Allocated storage must be an integer",MIN:"Allocated storage must be at least 20 GB",MAX:"Allocated storage cannot exceed 65536 GB"},DLQ:{MAX_RECEIVE_COUNT:{INTEGER:"Max receive count must be an integer",MIN:"Max receive count must be at least 1",MAX:"Max receive count cannot exceed 1000"}},ALARM:{PERCENTAGE:{MIN:"Threshold must be at least 1%",MAX:"Threshold must be at most 100%"},FREE_STORAGE_GIB:{MIN:"Free storage threshold must be at least 1 GiB"}},REGION:"Invalid AWS region",PASCAL_CASE:"Resource name must start with an uppercase letter and contain only alphanumerics (PascalCase).",IMAGE_DOCKER_MUTEX:"image and docker are mutually exclusive",AWS_ACCOUNT_ID:"AWS account id must be exactly 12 digits (no hyphens)",VPC_ID:"VPC id must look like vpc-abc12345",ROLE_ARN:"Role ARN must have the form arn:aws:iam::<account-id>:role/<name>",CIDR:"CIDR must be in dotted-quad/prefix-length form (e.g. 10.0.0.0/16)",VPC_PEER:{MIN_REQUESTER_ACCOUNTS:"At least one requester account id is required",REGION_REQUIRED:"Peer region is required when specified",ROUTE_TABLE_ID_REQUIRED:"Route table id must not be empty"},SCHEDULE_EXPRESSION:"Schedule expression must be 'rate(N minute|minutes|hour|hours|day|days)' with N>=1, or 'cron(<6-field AWS expression>)'"})});var $p=w(()=>{"use strict";Qnt();eat()});function OT(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function KN(t){return du.includes(t)}function YN(t){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(t)}function ZN(t){if(!t)return qN.slice(0,3);let e=t.toLowerCase().split("-"),r=e[0],n=e.length>1?e[1]:"",a=[];return r&&n&&(a=du.filter(o=>o.startsWith(`${r}-${n}`))),a.length===0&&r&&(a=du.filter(o=>o.startsWith(`${r}-`))),a.length>0?a.slice(0,3):qN.slice(0,3)}function JN(t){if(KN(t))return!0;let e=ZN(t);return YN(t)?`Unknown region. Try: ${e.join(", ")}`:`Invalid format. Try: ${e.join(", ")}`}function b4(t){if(!t||t.trim()==="")return!0;let e=OT(t);for(let r of e){let n=JN(r);if(n!==!0)return n}return!0}function XN(t,e){return t.filter(r=>r!==e)}function CCe(t){return{label:t.city,value:t.code,description:t.optIn?`${t.code} \u2014 opt-in required`:t.code}}function vu(){return Xs.map(CCe)}function eb(t){return Xs.filter(e=>e.code!==t).map(CCe)}function $d(t){let e=Xs.find(r=>r.code===t);return e?e.city:t}function E4(t){return e=>{let r=OT(e);return XN(r,t)}}var Lor,qm,For,S4,qN,xCe=w(()=>{"use strict";$();$();Lor=Object.defineProperty,qm=(t,e)=>Lor(t,"name",{value:e,configurable:!0}),For=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],S4=Object.freeze(For.flatMap(t=>{let e=JA(t);return e?[e]:[]})),qN=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);qm(OT,"parseRegionList");qm(KN,"isValidRegion");qm(YN,"isValidRegionFormat");qm(ZN,"getSuggestions");qm(JN,"validateRegion");qm(b4,"validateRegionList");qm(XN,"filterDuplicateRegions");qm(CCe,"toRegionOption");qm(vu,"getRegionOptions");qm(eb,"getRegionOptionsExcluding");qm($d,"getRegionName");qm(E4,"createRegionFormatter")});var A4,TCe=w(()=>{"use strict";A4="4.1.0"});var w4,tb,Km,Su,Ym,QN,NT=w(()=>{"use strict";w4=["Aurora","Instance","GlobalAurora","ClickHouse"],tb=["FARGATE","FARGATE_SPOT","EC2"],Km=["standard","resilient","enterprise"],Su=["tinkerer","lightweight","standard","resilient","enterprise"],Ym="custom",QN=[...Su,Ym]});function Mp(t,e){return t.includes(e)}var jor,Bor,Uor,e_,_T,C4,t_,x4,kCe,r_,T4,k4,I4,vX,$T,cw,MT,P4,ICe,PCe,RCe,Vor,DCe,OCe,R4,D4,SX,bX,LT,NCe,zor,Gor,Md,Zm,_Ce,$Ce,MCe,FT,fl=w(()=>{"use strict";NT();NT();$();NT();NT();jor=Object.defineProperty,Bor=(t,e)=>jor(t,"name",{value:e,configurable:!0}),Uor=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),e_=["ecs","lambda","ec2"],_T=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),C4=["code","container"],t_=Object.freeze({CODE:"code",CONTAINER:"container"}),x4=["ARM_64","X86_64"],kCe="ARM_64",r_=["NONE","AWS_IAM"],T4=["public","internal"],k4=["CPU","MEMORY"],I4=["ARM","STANDARD"],vX=["Instance","Aurora"],$T=["postgresql","mysql"],cw=["foundation","compliance","hardened"],MT="FARGATE",P4=["t3.nano","t3.micro","t3.small","t3.medium","t3.large","t3.xlarge","t3.2xlarge","t3a.nano","t3a.micro","t3a.small","t3a.medium","t3a.large","t3a.xlarge","t3a.2xlarge","t4g.nano","t4g.micro","t4g.small","t4g.medium","t4g.large","t4g.xlarge","t4g.2xlarge","c5.large","c5.xlarge","c5.2xlarge","c5.4xlarge","c5.9xlarge","c5.12xlarge","c5.18xlarge","c5.24xlarge","c5a.large","c5a.xlarge","c5a.2xlarge","c5a.4xlarge","c5a.8xlarge","c5a.12xlarge","c5a.16xlarge","c5a.24xlarge","c6g.medium","c6g.large","c6g.xlarge","c6g.2xlarge","c6g.4xlarge","c6g.8xlarge","c6g.12xlarge","c6g.16xlarge","r5.large","r5.xlarge","r5.2xlarge","r5.4xlarge","r5.8xlarge","r5.12xlarge","r5.16xlarge","r5.24xlarge","r5a.large","r5a.xlarge","r5a.2xlarge","r5a.4xlarge","r5a.8xlarge","r5a.12xlarge","r5a.16xlarge","r5a.24xlarge","r6g.medium","r6g.large","r6g.xlarge","r6g.2xlarge","r6g.4xlarge","r6g.8xlarge","r6g.12xlarge","r6g.16xlarge","i3.large","i3.xlarge","i3.2xlarge","i3.4xlarge","i3.8xlarge","i3.16xlarge","p3.2xlarge","p3.8xlarge","p3.16xlarge","g4dn.xlarge","g4dn.2xlarge","g4dn.4xlarge","g4dn.8xlarge","g4dn.12xlarge","g4dn.16xlarge","m5.large","m5.xlarge","m5.2xlarge","m5.4xlarge","m5.8xlarge","m5.12xlarge","m5.16xlarge","m5.24xlarge","m5a.large","m5a.xlarge","m5a.2xlarge","m5a.4xlarge","m5a.8xlarge","m5a.12xlarge","m5a.16xlarge","m5a.24xlarge"],ICe=[0,1,5,10,15,30,60];Bor(Mp,"constIncludes");PCe=1,RCe=65535,Vor=Object.freeze({postgresql:5432,mysql:3306}),DCe=128,OCe=10240,R4=1,D4=900,SX=1,bX=1e3,LT=100,NCe=100,zor=1,Gor=!1,Md=3e3,Zm="t4g.micro",_Ce=30,$Ce=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],MCe=["standard","assets","upload","website"],FT=["AES256","KMS"]});function EX(t,e=Ot.IDENTIFIER,r=q.IDENTIFIER){return h.string().min(2,q.IDENTIFIER_MIN_LENGTH).max(50,t).regex(e,r).refine(n=>!n.endsWith("-"),{message:q.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(n=>!n.includes("--"),{message:q.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}function rb(t){return t.issues.map(e=>`${e.path.length>0?`${e.path.join(".")}: `:""}${e.message}`).join(`
144
144
  `)}var Wor,O4,bu,lw,n_,Ar,a_,uw,ra,dw,Ld,Nc,tat,rat,nat,aat,oat,jT,sat,LCe,Hor,o_,s_,iat,cat,FCe,jCe,BCe,i_,pw,Oo,qor,Sy=w(()=>{"use strict";Lt();$p();fl();xCe();Wor=Object.defineProperty,O4=(t,e)=>Wor(t,"name",{value:e,configurable:!0}),bu=O4(t=>h.union([h.literal(!1),t]),"optionalOrDisabled"),lw={check:O4(t=>t.minCapacity!==void 0&&t.maxCapacity!==void 0?t.minCapacity<=t.maxCapacity:!0,"check"),params:{message:q.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},n_=O4(t=>h.number().int(q.MEMORY_LIMIT.INTEGER).min(t,t===128?q.MEMORY_LIMIT.MIN_128:q.MEMORY_LIMIT.MIN_512).max(30720,q.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),Ar=h.string().min(1,q.REQUIRED.RESOURCE_NAME).max(63,q.MAX_LENGTH.RESOURCE_NAME).regex(Ot.RESOURCE_NAME,q.RESOURCE_NAME),a_=h.string().min(1,q.REQUIRED.BUCKET_NAME).max(63,q.MAX_LENGTH.BUCKET_NAME).regex(Ot.BUCKET_NAME,q.BUCKET_NAME),uw=h.string().min(1,q.REQUIRED.DATABASE_NAME).max(63,q.MAX_LENGTH.DATABASE_NAME).regex(Ot.DATABASE_NAME,q.DATABASE_NAME);O4(EX,"identifierSchema");ra=EX(q.MAX_LENGTH.APP_NAME),dw=EX(q.MAX_LENGTH.APP_NAME,Ot.NEW_APP_NAME,q.NEW_APP_NAME),Ld=h.number().int(q.PORT.INTEGER).min(PCe,q.PORT.MIN).max(RCe,q.PORT.MAX),Nc=h.object({key:h.string(),sourceText:h.string()}).strict(),tat=h.object({__identifier:h.string()}).strict(),rat=h.object({__expression:h.string()}).strict(),nat=h.object({__call:h.string()}).strict(),aat=h.union([tat,rat,nat]),oat=h.union([h.string(),h.number(),h.boolean(),aat]),jT=h.record(h.string().regex(Ot.ENV_VAR_NAME,q.ENV_VAR_NAME),oat),sat=h.object({id:h.string(),name:h.string().optional(),arn:h.string().optional(),field:h.string().optional()}).strict().refine(t=>t.name!==void 0!=(t.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),LCe=h.record(h.string(),sat),Hor=h.record(h.string(),h.unknown()),o_=h.enum(QN).describe(`Application type must be one of: ${QN.join(", ")}`),s_=h.enum(_p).describe(`OpenNext deployment pattern: ${_p.join(", ")}`),iat=h.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),cat=h.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),FCe=h.object({sourceText:h.string(),position:iat,afterManagedResource:h.object({type:cat,name:h.string().optional()}).strict().optional(),originalLine:h.number().int().optional(),leadingComments:h.array(h.string()).optional(),orphaned:h.boolean().optional(),orphanedComment:h.string().optional()}).strict(),jCe=h.union([h.object({tier:h.enum(Km)}).strict(),h.literal(!1)]),BCe=h.union([h.object({instanceType:h.string().optional()}).strict(),h.literal(!1)]),i_=EX(q.MAX_LENGTH.ORGANISATION_NAME),pw=h.string().regex(Ot.EMAIL,q.EMAIL),Oo=h.string().refine(t=>du.includes(t),{message:q.REGION}),qor=h.object({name:i_,email:pw,accountName:h.string().optional(),primaryRegion:Oo.optional().default(ht),secondaryRegions:h.array(Oo).optional(),security:h.enum(cw).optional(),force:h.boolean().optional()}).strict();O4(rb,"getZodErrorMessage")});var c_,Kor,UCe,VCe,zCe,AX=w(()=>{"use strict";Lt();$p();c_=h.number().min(1,q.ALARM.PERCENTAGE.MIN).max(100,q.ALARM.PERCENTAGE.MAX),Kor=h.number().min(1,q.ALARM.FREE_STORAGE_GIB.MIN),UCe=h.union([h.literal(!1),h.object({cpuThreshold:c_.optional(),memoryThreshold:c_.optional(),runningTasksMinimum:h.number().int().min(0).optional(),http5xxThreshold:c_.optional()}).strict()]),VCe=h.union([h.literal(!1),h.object({cpuThreshold:c_.optional(),freeStorageThresholdGiB:Kor.optional(),connectionsThreshold:h.number().int().min(1).optional()}).strict()]),zCe=h.union([h.literal(!1),h.object({errorRateThreshold:c_.optional(),durationThresholdPercent:c_.optional()}).strict()])});var by,l_,N4,lat,uat,dat,pat,_4,$4,M4,mat,u_,fat,d_,hat,gat,GCe,yat,L4,F4,j4,CX,vat,Sat,bat,Eat,Aat,Yor,Zor,Jor,Xor,xX,WCe,Qor,esr,tsr,rsr,nsr,HCe,p_,asr,wX,qCe,osr,KCe,B4=w(()=>{"use strict";Lt();$p();fl();Sy();AX();by=h.number().int(q.BACKUP_RETENTION.INTEGER).min(1,q.BACKUP_RETENTION.MIN).max(35,q.BACKUP_RETENTION.MAX),l_=h.number().int(q.MONITORING_INTERVAL.INTEGER).refine(t=>Mp(ICe,t),{message:q.MONITORING_INTERVAL.VALUES}),N4=h.number().int(q.DATABASE.PORT.INTEGER).min(1024,q.DATABASE.PORT.MIN).max(65535,q.DATABASE.PORT.MAX),lat=h.enum(w4).describe(`Database type must be one of: ${w4.join(", ")}`),uat=h.object({maxConnections:h.number().int(q.MAX_CONNECTIONS.INTEGER).min(1,q.MAX_CONNECTIONS.MIN).max(100,q.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:h.number().int(q.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,q.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,q.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:h.number().int(q.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,q.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,q.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:h.boolean().optional()}).strict().describe("RDS Proxy configuration"),dat=h.object({instanceType:h.string().optional(),availabilityZone:h.string().optional()}).strict().describe("Read replica configuration"),pat=h.object({automaticallyAfterDays:h.number().int(q.ROTATION.INTEGER).min(1,q.ROTATION.MIN).max(365,q.ROTATION.MAX).optional()}).strict().describe("Secret rotation configuration"),_4=h.object({username:h.string().min(1,q.REQUIRED.USERNAME).max(63,q.USERNAME.MAX_LENGTH).optional(),secretRotation:pat.optional()}).strict().describe("Database credentials configuration"),$4=bu(uat),M4=bu(dat),mat=h.object({scaleWithWriter:h.boolean().optional(),enableDatabaseInsights:h.boolean().optional(),identifierSuffix:h.string().min(1,q.IDENTIFIER_SUFFIX.REQUIRED).max(50,q.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:h.string().optional()}).strict().describe("Configuration for a single Aurora reader instance"),u_=h.object({enableDatabaseInsights:h.boolean().optional(),identifierSuffix:h.string().min(1,q.IDENTIFIER_SUFFIX.REQUIRED).max(50,q.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:h.string().optional()}).strict().describe("Configuration for Aurora writer instance"),fat=h.object({count:h.number().int(q.READER.COUNT.INTEGER).min(0,q.READER.COUNT.MIN).max(15,q.READER.COUNT.MAX).optional(),instances:h.array(mat).max(15,q.READER_INSTANCES.MAX).optional(),defaultEnableDatabaseInsights:h.boolean().optional()}).strict().refine(t=>!(t.count!==void 0&&t.instances!==void 0),{message:q.READER_INSTANCES.COUNT_OR_INSTANCES,path:["count"]}).describe("Aurora readers configuration"),d_=bu(fat),hat=h.object({awsManaged:h.literal(!0)}).strict(),gat=h.object({useCMK:h.literal(!0)}).strict(),GCe=h.union([hat,gat]),yat=h.object({mode:h.enum(["standard","advanced"]).optional(),encryptionKey:GCe.optional()}).strict().describe("Database Insights configuration"),L4=bu(yat),F4=h.object({storageKey:GCe.optional()}).strict().describe("Encryption configuration (DESTRUCTIVE to change storageKey)"),j4=h.object({name:Ar,type:lat,databaseName:h.string().min(1,q.REQUIRED.DATABASE_NAME),instanceType:h.string().optional(),allocatedStorage:h.number().optional(),multiAz:h.boolean().optional(),publiclyAccessible:h.boolean().optional(),databaseInsights:L4.optional(),port:N4.optional(),deletionProtection:h.boolean().optional(),proxy:$4.optional(),credentials:_4.optional(),readReplica:M4.optional(),encryption:F4.optional(),writer:u_.optional(),readers:d_.optional(),backupRetention:by.optional(),preferredMaintenanceWindow:h.string().optional(),monitoringInterval:l_.optional(),primaryRegion:h.string().optional(),secondaryRegions:h.array(h.string()).optional(),globalClusterIdentifier:h.string().optional(),enableGlobalWriteForwarding:h.boolean().optional(),snapshotIdentifier:h.string().optional(),snapshotUsername:h.string().optional(),databaseEngine:h.enum($T).optional(),engineExpression:h.string().optional(),variableName:h.string().optional(),extraProperties:h.array(Nc).optional(),alarms:VCe.optional()}).strict(),CX=h.object({appName:ra,nameProvidedByFlag:h.boolean().optional(),databaseName:h.string().min(1,q.REQUIRED.DATABASE_NAME).max(63,q.MAX_LENGTH.DATABASE_NAME).regex(Ot.DATABASE_NAME,q.DATABASE_NAME),resourceName:Ar.optional(),connectionConfig:h.object({connectToCompute:h.array(h.string()).optional(),connectToServices:h.array(h.string()).optional()}).strict().optional(),databaseInsights:L4.optional(),port:N4.optional(),proxy:$4.optional(),credentials:_4.optional(),encryption:F4.optional(),deletionProtection:h.boolean().optional()}).strict(),vat={databaseType:h.literal("Instance"),instanceType:h.string().optional(),multiAz:h.boolean().optional(),readReplica:M4.optional(),publiclyAccessible:h.boolean().optional(),backupRetention:by.optional(),allocatedStorage:h.number().optional(),snapshotIdentifier:h.string().optional(),snapshotUsername:h.string().optional()},Sat={databaseType:h.literal("Aurora"),writer:u_.optional(),readers:d_.optional(),backupRetention:by.optional(),preferredMaintenanceWindow:h.string().optional(),monitoringInterval:l_.optional(),snapshotIdentifier:h.string().optional(),snapshotUsername:h.string().optional()},bat={databaseType:h.literal("GlobalAurora"),primaryRegion:h.string().min(1,q.GLOBAL_AURORA.PRIMARY_REGION_REQUIRED),secondaryRegions:h.array(h.string()).optional(),globalClusterIdentifier:h.string().optional(),enableGlobalWriteForwarding:h.boolean().optional(),writer:u_.optional(),readers:d_.optional(),backupRetention:by.optional(),preferredMaintenanceWindow:h.string().optional(),monitoringInterval:l_.optional(),snapshotIdentifier:h.string().optional(),snapshotUsername:h.string().optional()},Eat=h.object({appName:ra,nameProvidedByFlag:h.boolean().optional(),databaseName:h.string().min(1,q.REQUIRED.DATABASE_NAME).max(63,q.MAX_LENGTH.DATABASE_NAME).regex(Ot.DATABASE_NAME,q.DATABASE_NAME),resourceName:Ar.optional(),connectionConfig:h.object({connectToCompute:h.array(h.string()).optional(),connectToServices:h.array(h.string()).optional()}).strict().optional()}).strict(),Aat={databaseType:h.literal("ClickHouse"),instanceType:h.string().optional(),coldTier:h.union([h.object({mode:h.literal("s3")}).strict(),h.literal(!1)]).optional(),optimiseSchedule:h.union([h.string(),h.literal(!1)]).optional(),backupSchedule:h.union([h.string(),h.literal(!1)]).optional(),backupRetentionDays:by.optional()},Yor=CX.extend(vat).strict(),Zor=CX.extend(Sat).strict(),Jor=CX.extend(bat).strict(),Xor=Eat.extend(Aat).strict(),xX=h.discriminatedUnion("databaseType",[Yor,Zor,Jor,Xor]),WCe=CX.extend({resourceName:Ar}).strict(),Qor=WCe.extend(vat).strict(),esr=WCe.extend(Sat).strict(),tsr=WCe.extend(bat).strict(),rsr=Eat.extend({resourceName:Ar}).strict(),nsr=rsr.extend(Aat).strict(),HCe=h.discriminatedUnion("databaseType",[Qor,esr,tsr,nsr]),p_=h.object({appName:ra,databaseName:h.string().min(1,q.REQUIRED.DATABASE_NAME),maxConnections:h.number().int(q.MAX_CONNECTIONS.INTEGER).min(1,q.MAX_CONNECTIONS.MIN).max(100,q.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:h.number().int(q.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,q.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,q.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:h.number().int(q.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,q.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,q.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:h.boolean().optional(),nameProvidedByFlag:h.boolean().optional()}).strict(),asr=["S","N","B"],wX=h.object({name:h.string(),type:h.enum(asr)}).strict(),qCe=h.object({name:Ar,partitionKey:wX,sortKey:wX.optional(),globalSecondaryIndexes:h.array(h.object({indexName:h.string(),partitionKey:wX,sortKey:wX.optional()}).strict()).optional(),ttlAttribute:h.string().optional(),stream:h.boolean().optional(),variableName:h.string().optional(),extraProperties:h.array(Nc).optional()}).strict(),osr=h.object({mode:h.literal("s3")}).strict(),KCe=h.object({name:Ar,type:h.literal("ClickHouse"),databaseName:uw,instanceType:h.string().optional(),coldTier:h.union([osr,h.literal(!1)]).optional(),optimiseSchedule:h.union([h.string(),h.literal(!1)]).optional(),backupSchedule:h.union([h.string(),h.literal(!1)]).optional(),backupRetentionDays:by.optional(),variableName:h.string().optional(),extraProperties:h.array(Nc).optional()}).strict()});var wat,YCe,TX,Cat,ZCe,xat,Tat,kat,Iat,Pat,JCe,BT,XCe,QCe,e0e,kX,Rat,IX,Dat,Oat,Nat,PX,RX,DX=w(()=>{"use strict";Lt();$p();Sy();wat=h.object({count:h.number().int(q.NAT_GATEWAY.INTEGER).min(0,q.NAT_GATEWAY.MIN).max(3,q.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),YCe=bu(wat),TX=h.enum(["cloudwatch","s3"]),Cat=h.object({destination:TX.optional(),retentionDays:h.number().int(q.RETENTION_DAYS.INTEGER).min(1,q.RETENTION_DAYS.MIN).max(365,q.RETENTION_DAYS.MAX).optional(),trafficType:h.enum(["ALL","ACCEPT","REJECT"]).optional()}).strict().describe("VPC flow log configuration"),ZCe=bu(Cat),xat=h.object({s3:h.boolean().optional(),dynamodb:h.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),Tat=bu(xat),kat=h.object({ecr:h.boolean().optional(),secretsManager:h.boolean().optional(),kms:h.boolean().optional(),cloudwatchLogs:h.boolean().optional(),ssm:h.boolean().optional(),sts:h.boolean().optional()}).strict().describe("Interface VPC endpoints (cost per hour)"),Iat=bu(kat),Pat=h.object({gateway:Tat.optional(),interface:Iat.optional()}).strict().describe("VPC endpoints configuration"),JCe=bu(Pat),BT=h.object({maxAzs:h.number().int(q.MAX_AZS.INTEGER).min(1,q.MAX_AZS.MIN).max(3,q.MAX_AZS.MAX).optional(),natGateways:YCe.optional(),flowLogs:ZCe.optional(),vpcEndpoints:JCe.optional(),cidrMask:h.number().int(q.CIDR_MASK.INTEGER).min(16,q.CIDR_MASK.MIN).max(28,q.CIDR_MASK.MAX).optional()}).strict(),XCe=h.string().min(1,q.REQUIRED.NETWORK_NAME).max(50,q.MAX_LENGTH.NETWORK_NAME).regex(Ot.RESOURCE_NAME,q.RESOURCE_NAME),QCe=BT.extend({name:XCe}).strict(),e0e=bu(BT),kX=h.object({appName:ra,networkName:XCe.optional(),maxAzs:h.number().int(q.MAX_AZS.INTEGER).min(1,q.MAX_AZS.MIN).max(3,q.MAX_AZS.MAX).optional(),natGateways:YCe.optional(),flowLogs:ZCe.optional(),vpcEndpoints:JCe.optional()}).strict(),Rat=Ot.CIDR,IX=h.string().regex(Rat,q.CIDR),Dat=h.object({kind:h.literal("database"),resource:h.string().min(1,q.REQUIRED.RESOURCE_REFERENCE),name:Ar,allowedFromCidrs:h.array(IX),access:h.enum(["read","write","readWrite"]).optional()}).strict(),Oat=h.object({kind:h.literal("ecsService"),resource:h.string().min(1,q.REQUIRED.RESOURCE_REFERENCE),serviceName:h.string().min(1,q.REQUIRED.SERVICE_NAME),name:Ar,allowedFromCidrs:h.array(IX),port:Ld.optional()}).strict(),Nat=h.discriminatedUnion("kind",[Dat,Oat]),PX=h.object({name:Ar,peerAppName:h.string().min(1,q.REQUIRED.APP_NAME),peerAccountId:h.string().regex(Ot.AWS_ACCOUNT_ID,q.AWS_ACCOUNT_ID),peerRegion:h.string().min(1,q.VPC_PEER.REGION_REQUIRED).optional(),peerVpcId:h.string().regex(Ot.VPC_ID,q.VPC_ID).optional(),peerVpcCidr:IX.optional(),peerRoleArn:h.string().regex(Ot.ROLE_ARN,q.ROLE_ARN).optional(),peerRouteTableIds:h.array(h.string().min(1,q.VPC_PEER.ROUTE_TABLE_ID_REQUIRED)).optional(),localVpcName:h.string().min(1,q.REQUIRED.NETWORK_NAME).optional(),enableDnsResolution:h.boolean().optional()}).strict(),RX=h.object({name:Ar,requesterAccountIds:h.array(h.string().regex(Ot.AWS_ACCOUNT_ID,q.AWS_ACCOUNT_ID)).min(1,q.VPC_PEER.MIN_REQUESTER_ACCOUNTS),localVpcName:h.string().min(1,q.REQUIRED.NETWORK_NAME).optional(),publishToSsm:h.boolean().optional(),exposedResources:h.array(Nat).optional()}).strict()});var U4,OX,V4,z4,t0e=w(()=>{"use strict";Lt();$p();fl();Sy();U4=["storage","cdn","compute"],OX=h.object({sid:h.string().optional(),effect:h.enum(["Allow","Deny"]),principals:h.array(h.string()),actions:h.array(h.string()),resources:h.array(h.string()).optional(),conditions:h.record(h.string(),h.record(h.string(),h.union([h.string(),h.array(h.string())]))).optional()}).strict(),V4=h.object({name:Ar,bucketName:h.string().optional(),publicReadAccess:h.boolean().optional(),websiteHosting:h.object({indexDocument:h.string(),errorDocument:h.string().optional()}).strict().optional(),backupVaultTier:h.enum(Km).optional(),versioned:h.boolean().optional(),encryption:h.enum(FT).optional(),kmsKeyArn:h.string().optional(),cors:h.array(h.object({allowedOrigins:h.array(h.string()),allowedMethods:h.array(h.string()),allowedHeaders:h.array(h.string()).optional(),exposedHeaders:h.array(h.string()).optional(),maxAge:h.number().optional()}).strict()).optional(),deployment:h.object({source:h.string(),prune:h.boolean().optional(),cacheControl:h.object({maxAge:h.number().optional(),immutable:h.boolean().optional()}).strict().optional()}).strict().optional(),retain:h.boolean().optional(),resourcePolicyStatements:h.array(OX).optional(),stackPlacement:h.enum(U4).optional(),variableName:h.string().optional(),extraProperties:h.array(Nc).optional()}).strict().refine(t=>t.encryption!=="KMS"||!!t.kmsKeyArn,{message:q.KMS.KEY_REQUIRED}),z4=h.object({appName:ra,bucketName:a_,nameProvidedByFlag:h.boolean().optional(),storagePreset:h.enum(MCe).optional(),publicReadAccess:h.boolean().optional(),websiteHosting:h.object({indexDocument:h.string(),errorDocument:h.string().optional()}).strict().optional(),backupVaultTier:h.enum(Km).optional(),versioned:h.boolean().optional(),encryption:h.enum(FT).optional(),kmsKeyArn:h.string().optional(),cors:h.array(h.object({allowedOrigins:h.array(h.string()),allowedMethods:h.array(h.string()),allowedHeaders:h.array(h.string()).optional(),exposedHeaders:h.array(h.string()).optional(),maxAge:h.number().optional()}).strict()).optional(),connectionConfig:h.object({connectToCompute:h.array(h.string()).optional(),connectToServices:h.array(h.string()).optional()}).strict().optional()}).strict().refine(t=>t.encryption!=="KMS"||!!t.kmsKeyArn,{message:q.KMS.KEY_REQUIRED,path:["kmsKeyArn"]})});var NX,G4,_X=w(()=>{"use strict";Lt();$p();Sy();NX=h.enum(["DESTROY","RETAIN"]),G4=h.object({name:Ar,queueType:h.enum(["standard","fifo"]).default("standard"),visibilityTimeout:h.number().int(q.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,q.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,q.SQS.VISIBILITY_TIMEOUT.MAX).optional(),retentionPeriod:h.number().int(q.SQS.RETENTION_PERIOD.INTEGER).min(60,q.SQS.RETENTION_PERIOD.MIN).max(1209600,q.SQS.RETENTION_PERIOD.MAX).optional(),contentBasedDeduplication:h.boolean().optional(),removalPolicy:NX.optional(),variableName:h.string().optional(),extraProperties:h.array(Nc).optional()}).strict()});var r0e,W4,n0e,a0e=w(()=>{"use strict";Lt();Sy();r0e=h.object({type:h.literal("basic-auth"),username:h.string().min(1),password:h.string().min(1)}).strict(),W4=h.object({name:Ar,defaultOriginRef:h.string(),behaviours:h.array(h.object({pathPattern:h.string(),originRef:h.string(),cachePolicy:h.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:h.string().optional(),certificateArn:h.string().optional(),accessGate:h.union([h.literal(!1),r0e]).optional(),extraProperties:h.array(Nc).optional()}).strict(),n0e=h.object({appName:h.string(),name:Ar.optional(),defaultOriginRef:h.string(),behaviours:h.array(h.object({pathPattern:h.string(),originRef:h.string(),cachePolicy:h.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:h.string().optional(),certificateArn:h.string().optional(),accessGate:h.union([h.literal(!1),r0e]).optional(),nameProvidedByFlag:h.boolean().optional()}).strict()});function UT(t){let e=t.split(".")[0]??"";return isr.has(e)?"ARM":"STANDARD"}function H4(t,e){let r=UT(t);return r!==e?{valid:!1,message:`Instance type '${t}' requires ${r} architecture, but '${e}' AMI was specified. Use a ${r==="ARM"?"Graviton instance (t4g, c6g, r6g, m6g, etc.)":"Intel/AMD instance (t3, c5, r5, m5, etc.)"} instead.`}:{valid:!0}}function s0e(t,e){return UT(t)===e}var ssr,o0e,isr,i0e=w(()=>{"use strict";ssr=Object.defineProperty,o0e=(t,e)=>ssr(t,"name",{value:e,configurable:!0}),isr=new Set(["t4g","c6g","c6gd","c6gn","c7g","c7gd","c7gn","r6g","r6gd","r7g","r7gd","m6g","m6gd","m7g","m7gd","a1","x2gd","im4gn","is4gen","i4g","hpc7g"]);o0e(UT,"getArchitectureForInstanceType");o0e(H4,"validateArchitectureMatch");o0e(s0e,"isArchitectureCompatible")});function l0e(t,e){if(e===void 0)return t;let r=e.context??t.context,n=e.target??t.target,a=e.buildArgs??t.buildArgs,o=e.buildSecrets??t.buildSecrets;return{path:e.path??t.path,...r!==void 0&&{context:r},...n!==void 0&&{target:n},...a!==void 0&&{buildArgs:a},...o!==void 0&&{buildSecrets:o}}}function c0e(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function q4(t){if(!c0e(t)||typeof t.path!="string"||t.path.length===0)return;let e=typeof t.context=="string"&&t.context.length>0?t.context:void 0,r=typeof t.target=="string"&&t.target.length>0?t.target:void 0,n=c0e(t.buildArgs)&&Object.keys(t.buildArgs).length>0?t.buildArgs:void 0,a=Array.isArray(t.buildSecrets)&&t.buildSecrets.length>0?t.buildSecrets:void 0,o={path:t.path,...e!==void 0&&{context:e},...r!==void 0&&{target:r},...n!==void 0&&{buildArgs:n},...a!==void 0&&{buildSecrets:a}},s=Jm.safeParse(o);return s.success?s.data:void 0}function lsr(t){if(t===void 0)return;let e=q4(t);return e===void 0?void 0:JSON.stringify(e)}var csr,$X,Rh,m_,MX,LX,_at,Jm,$at,u0e,d0e,p0e,m0e,f0e,h0e,g0e,FX,VT=w(()=>{"use strict";Lt();gJ();csr=Object.defineProperty,$X=(t,e)=>csr(t,"name",{value:e,configurable:!0}),Rh="fjall-manifest.json",m_=1,MX=/^[A-Za-z0-9_.-]+$/,LX=h.object({id:h.string().min(1,"buildSecret id cannot be empty").regex(MX,"buildSecret id may contain only letters, digits, '_', '.', and '-' (no comma, '=', or whitespace, which would break the buildx --secret argv)"),ssm:h.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:h.object({name:h.string().min(1,"secret name cannot be empty").optional(),arn:h.string().min(1,"secret arn cannot be empty").optional(),field:h.string().min(1,"secret field cannot be empty").optional()}).strict().refine(t=>t.name===void 0!=(t.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:h.string().min(1,"env variable name cannot be empty").optional()}).strict().superRefine((t,e)=>{[t.ssm,t.secretsManager,t.env].filter(r=>r!==void 0).length!==1&&e.addIssue({code:h.ZodIssueCode.custom,message:"buildSecret requires exactly one source (ssm, secretsManager, or env)"})}),_at=h.union([h.string(),h.object({ssm:h.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:h.object({name:h.string().min(1,"secret name cannot be empty").optional(),arn:h.string().min(1,"secret arn cannot be empty").optional(),field:h.string().min(1,"secret field cannot be empty").optional()}).strict().refine(t=>t.name===void 0!=(t.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:h.string().min(1,"env variable name cannot be empty").optional(),acknowledgePublic:h.boolean().optional()}).strict().superRefine((t,e)=>{[t.ssm,t.secretsManager,t.env].filter(r=>r!==void 0).length!==1&&e.addIssue({code:h.ZodIssueCode.custom,message:"buildArg value requires exactly one source (ssm, secretsManager, or env)"})})]),Jm=h.object({path:h.string(),context:h.string().min(1,"context cannot be empty").optional(),target:h.string().min(1,"target cannot be empty").optional(),buildArgs:h.record(h.string(),_at).optional(),buildSecrets:h.array(LX).optional()}).strict(),$at=Jm.partial();$X(l0e,"mergeDockerBuild");$X(c0e,"isRecord");$X(q4,"normaliseDockerBuild");$X(lsr,"dockerBuildFingerprint");u0e=h.object({name:h.string(),clusterName:h.string().optional(),docker:Jm.optional(),containerPort:h.number().optional(),secrets:h.array(h.string()).optional(),ssmSecretsPath:h.string().optional(),importedSecretNames:h.array(h.string()).optional()}).strict(),d0e=h.object({type:h.enum(_p),name:h.string(),source:h.string()}).strict(),p0e=h.object({repositoryName:h.string()}).strict(),m0e=["x86_64","arm64"],f0e=h.object({name:h.string(),secrets:h.array(h.string()).optional(),ssmSecretsPath:h.string().optional(),importedSecretNames:h.array(h.string()).optional(),docker:Jm.optional(),imageKey:h.string().optional(),architecture:h.enum(m0e).optional()}).strict(),h0e=h.object({templateHash:h.string(),synthTimestamp:h.string()}).strict(),g0e=h.object({constructPath:h.string().max(512),group:h.string().max(128),resourceType:h.string().max(256)}).strict(),FX=h.object({version:h.literal(m_),generatedAt:h.string(),appName:h.string(),services:h.array(u0e),lambdas:h.array(f0e),pattern:d0e.optional(),ecr:p0e.optional(),stacks:h.record(h.string(),h0e),resourceMap:h.record(h.string(),g0e).optional()}).strict()});function Mat(t){return!(t.image!==void 0&&t.docker!==void 0)}var usr,dsr,Lat,Fat,zT,v0e,S0e,jX,Y4,jat,BX,Bat,UX,VX,b0e,Uat,f_,E0e,K4,Vat,A0e,Z4,w0e,C0e,x0e,h_,T0e,psr,msr,fsr,k0e,y0e,J4,X4,zX=w(()=>{"use strict";Lt();$p();fl();i0e();Sy();VT();AX();usr=Object.defineProperty,dsr=(t,e)=>usr(t,"name",{value:e,configurable:!0});dsr(Mat,"imageDockerMutexCheck");Lat=h.number().int(q.CAPACITY.MIN.INTEGER).min(SX,q.GENERATOR_CAPACITY.MIN.MIN).max(bX,q.GENERATOR_CAPACITY.MIN.MAX),Fat=h.number().int(q.CAPACITY.MAX.INTEGER).min(SX,q.GENERATOR_CAPACITY.MAX.MIN).max(bX,q.GENERATOR_CAPACITY.MAX.MAX),zT=h.number().int(q.LAMBDA.MEMORY.INTEGER).min(DCe,q.LAMBDA.MEMORY.MIN).max(OCe,q.LAMBDA.MEMORY.MAX).refine(t=>t===128||t%64===0,q.LAMBDA.MEMORY.MULTIPLE),v0e=h.string().regex(Ot.LAMBDA_RUNTIME_IDENTIFIER,q.LAMBDA.RUNTIME),S0e=h.number().int(q.CPU.INTEGER).min(256,q.CPU.MIN).max(4096,q.CPU.MAX),jX=h.number().int(q.CAPACITY.DESIRED.INTEGER).min(0,q.CAPACITY.DESIRED.MIN).max(LT,q.CAPACITY.DESIRED.MAX),Y4=h.object({connectToDatabase:h.array(h.string()).optional()}).strict(),jat=h.object({minSize:h.number().int(q.CAPACITY.WARM_POOL.MIN_SIZE.INTEGER).min(0,q.CAPACITY.WARM_POOL.MIN_SIZE.MIN).max(NCe,q.CAPACITY.WARM_POOL.MIN_SIZE.MAX).optional(),reuseOnScaleIn:h.boolean().optional()}).strict(),BX=h.object({instanceType:h.string().optional(),amiHardwareType:h.enum(I4).optional(),minCapacity:h.number().int(q.CAPACITY.MIN.INTEGER).min(0,q.CAPACITY.MIN.MIN_0).max(LT,q.CAPACITY.MIN.MAX).optional(),maxCapacity:h.number().int(q.CAPACITY.MAX.INTEGER).min(1,q.CAPACITY.MAX.MIN_1).max(LT,q.CAPACITY.MAX.MAX).optional(),memoryLimitMiB:n_(128).optional(),warmPool:jat.optional(),extraProperties:h.array(Nc).optional()}).strict().superRefine((t,e)=>{if(!t.instanceType||!t.amiHardwareType)return;let r=H4(t.instanceType,t.amiHardwareType);r.valid||e.addIssue({code:"custom",message:r.message??q.ARCHITECTURE_MISMATCH,path:["instanceType"]})}).superRefine((t,e)=>{t.minCapacity===0&&!t.warmPool&&e.addIssue({code:"custom",message:q.CAPACITY.WARM_POOL_REQUIRED,path:["minCapacity"]}),t.warmPool?.minSize!==void 0&&t.maxCapacity!==void 0&&t.warmPool.minSize>t.maxCapacity&&e.addIssue({code:"custom",message:q.CAPACITY.WARM_POOL.MIN_SIZE_EXCEEDS_MAX_CAPACITY,path:["warmPool","minSize"]})}),Bat=h.enum(e_).describe(`Compute type must be one of: ${e_.join(", ")}`),UX=h.enum(tb).describe(`ECS capacity provider must be one of: ${tb.join(", ")}`),VX=h.string().refine(t=>Mp(P4,t),{message:q.INSTANCE_TYPE}),b0e=h.object({sourceType:h.enum(["sqs","dynamodb","eventbridge"]),sourceRef:h.string().describe("Name of the source resource"),batchSize:h.number().int(q.BATCH_SIZE.INTEGER).min(1,q.BATCH_SIZE.MIN).max(1e4,q.BATCH_SIZE.MAX).optional(),startingPosition:h.enum(["TRIM_HORIZON","LATEST"]).optional(),maxBatchingWindow:h.number().int(q.BATCHING_WINDOW.INTEGER).min(0,q.BATCHING_WINDOW.MIN).max(300,q.BATCHING_WINDOW.MAX).optional(),reportBatchItemFailures:h.boolean().optional()}).strict(),Uat=h.object({name:h.string().min(1,q.REQUIRED.CONTAINER_NAME).optional(),image:h.string().optional(),port:Ld.optional(),environment:jT.optional(),secretsImport:LCe.optional(),command:h.array(h.string()).optional(),entryPoint:h.array(h.string()).optional(),essential:h.boolean().optional(),healthCheck:h.object({command:h.array(h.string()),interval:h.number().int(q.HEALTH_CHECK.INTERVAL.INTEGER).min(5,q.HEALTH_CHECK.INTERVAL.MIN).max(300,q.HEALTH_CHECK.INTERVAL.MAX).optional(),timeout:h.number().int(q.HEALTH_CHECK.TIMEOUT.INTEGER).min(2,q.HEALTH_CHECK.TIMEOUT.MIN).max(60,q.HEALTH_CHECK.TIMEOUT.MAX).optional(),retries:h.number().int(q.HEALTH_CHECK.RETRIES.INTEGER).min(1,q.HEALTH_CHECK.RETRIES.MIN).max(10,q.HEALTH_CHECK.RETRIES.MAX).optional(),startPeriod:h.number().int(q.HEALTH_CHECK.START_PERIOD.INTEGER).min(0,q.HEALTH_CHECK.START_PERIOD.MIN).max(300,q.HEALTH_CHECK.START_PERIOD.MAX).optional()}).strict().optional(),ssmSecrets:h.array(h.string().regex(Ot.SECRET_NAME,q.SECRET_NAME)).optional(),extraProperties:h.array(Nc).optional()}).strict(),f_=h.string().min(1,q.REQUIRED.SERVICE_NAME).max(255,q.MAX_LENGTH.SERVICE_NAME).regex(Ot.ECS_SERVICE_NAME,q.ECS_SERVICE_NAME),E0e=h.object({domain:h.string().optional(),loadBalancer:h.union([h.literal(!1),h.enum(T4)]).optional(),directAccess:h.boolean().optional(),extraProperties:h.array(Nc).optional()}).strict().refine(t=>!(t.directAccess&&t.domain),{message:q.DIRECT_ACCESS.NO_DOMAIN,path:["directAccess"]}).refine(t=>!(t.directAccess&&typeof t.loadBalancer=="string"),{message:q.DIRECT_ACCESS.NO_LOAD_BALANCER}).describe("Cluster-level configuration"),K4=h.object({path:h.string().optional(),host:h.string().optional(),priority:h.number().int(q.PRIORITY.INTEGER).min(1,q.PRIORITY.MIN).max(5e4,q.PRIORITY.MAX).optional(),healthCheckPath:h.string().optional()}).strict().describe("Path/host-based routing configuration"),Vat=h.object({desiredCount:jX.optional(),minCapacity:h.number().int(q.CAPACITY.MIN.INTEGER).min(0,q.CAPACITY.MIN.MIN_0).max(LT,q.CAPACITY.MIN.MAX).optional(),maxCapacity:h.number().int(q.CAPACITY.MAX.INTEGER).min(1,q.CAPACITY.MAX.MIN_1).max(LT,q.CAPACITY.MAX.MAX).optional(),scalingType:h.enum(k4).optional()}).strict().refine(lw.check,lw.params).describe("ECS service scaling configuration"),A0e=h.object({name:f_,docker:Jm.optional(),needsDatabaseConnection:h.boolean().optional(),needsStorageConnection:h.boolean().optional(),needsMessagingConnection:h.boolean().optional(),image:h.string().optional(),containers:h.array(Uat).optional(),routing:h.union([K4,h.array(K4).min(1)]).optional(),cpu:S0e.optional(),memoryLimitMiB:n_(512).optional(),desiredCount:jX.optional(),scaling:bu(Vat).optional(),capacityProvider:UX,ec2Config:BX.optional(),ssmSecretsPath:h.string().regex(Ot.SSM_PATH,q.SSM_PATH).optional(),extraProperties:h.array(Nc).optional(),alarms:UCe.optional()}).strict().superRefine((t,e)=>{Mat(t)||e.addIssue({code:"custom",path:["docker"],message:q.IMAGE_DOCKER_MUTEX})}).describe("Configuration for a service in an ECS cluster"),Z4=h.object({name:Ar,type:Bat,needsConnection:h.boolean(),connectedDatabase:h.array(h.string()).optional(),connectedStorage:h.array(h.string()).optional(),connectedMessaging:h.array(h.string()).optional(),cluster:E0e.optional(),services:h.array(A0e).optional(),docker:Jm.partial().optional(),deployment:h.enum(C4).optional(),codePath:h.string().optional(),timeout:h.number().int(q.LAMBDA.TIMEOUT.INTEGER).min(R4,q.LAMBDA.TIMEOUT.MIN).max(D4,q.LAMBDA.TIMEOUT.MAX).optional(),memory:zT.optional(),handler:h.string().optional(),runtime:v0e.optional(),environment:jT.optional(),secrets:jT.optional(),eventSources:h.array(b0e).optional(),functionUrl:h.object({authType:h.enum(r_)}).strict().optional(),description:h.string().optional(),scheduleExpression:h.string().optional(),architecture:h.enum(x4).optional(),ephemeralStorageSize:h.number().int(q.EPHEMERAL_STORAGE.INTEGER).min(512,q.EPHEMERAL_STORAGE.MIN).max(10240,q.EPHEMERAL_STORAGE.MAX).optional(),functionName:h.string().optional(),ssmSecrets:h.array(h.string()).optional(),ssmSecretsPath:h.string().optional(),alarms:zCe.optional(),instanceType:VX.optional(),enableSSH:h.boolean().optional(),keyName:h.string().optional(),userData:h.string().optional(),securityGroups:h.array(h.string()).optional(),variableName:h.string().optional(),extraProperties:h.array(Nc).optional()}).strict().superRefine((t,e)=>{if(t.type==="ecs"&&t.services)for(let r=0;r<t.services.length;r++){let n=t.services[r];n?.ec2Config?.instanceType&&!n.ec2Config.amiHardwareType&&UT(n.ec2Config.instanceType)!=="ARM"&&e.addIssue({code:"custom",message:`Service '${n.name??r}' uses instance type '${n.ec2Config.instanceType}' (x86), which requires Docker images built for linux/amd64. The default build targets linux/arm64 (Graviton). Use a Graviton instance type (t4g, c6g, r6g, m6g, etc.) or set amiHardwareType: "STANDARD" to acknowledge x86.`,path:["services",r,"ec2Config","instanceType"]})}t.type==="lambda"&&t.deployment==="container"&&t.architecture==="X86_64"&&e.addIssue({code:"custom",message:"Lambda architecture 'X86_64' requires Docker images built for linux/amd64, but the default build targets linux/arm64. Use 'ARM_64' for Graviton Lambdas (recommended) or ensure your build pipeline targets linux/amd64.",path:["architecture"]})}),w0e=h.object({appName:ra,clusterName:Ar,containerPort:Ld,nameProvidedByFlag:h.boolean().optional(),ecrRepository:h.string().optional(),capacityProvider:UX.optional(),useAppEcr:h.boolean().optional(),desiredCount:jX.optional(),cpu:S0e.optional(),memoryLimitMiB:n_(512).optional(),minCapacity:Lat.optional(),maxCapacity:Fat.optional(),ec2Config:BX.optional(),connectionConfig:Y4.optional()}).strict().refine(lw.check,lw.params),C0e=h.object({appName:ra,functionName:Ar,nameProvidedByFlag:h.boolean().optional(),lambdaType:h.enum(["basic","web","custom"]).optional(),ecrRepository:h.string().optional(),timeout:h.number().int(q.LAMBDA.TIMEOUT.INTEGER).min(R4,q.LAMBDA.TIMEOUT.MIN).max(D4,q.LAMBDA.TIMEOUT.MAX).optional(),memory:zT.optional(),enableFunctionUrl:h.boolean().optional(),description:h.string().optional(),enableCors:h.boolean().optional(),corsOrigins:h.string().optional(),corsHeaders:h.string().optional(),corsMethods:h.array(h.enum($Ce)).optional(),corsCredentials:h.boolean().optional(),connectionConfig:Y4.optional()}).strict(),x0e=h.object({appName:ra,instanceName:Ar,nameProvidedByFlag:h.boolean().optional(),instanceType:VX.optional(),enableSSH:h.boolean().optional(),minCapacity:Lat.optional(),maxCapacity:Fat.optional(),connectionConfig:Y4.optional()}).strict().refine(lw.check,lw.params),h_=h.object({appName:ra,clusterName:Ar,serviceName:f_,capacityProvider:UX,containerPort:Ld.optional(),cpu:S0e.optional(),memoryLimitMiB:n_(512).optional(),desiredCount:jX.optional(),ec2Config:BX.optional(),routing:h.union([K4,h.array(K4).min(1)]).optional(),docker:Jm.partial().optional(),nameProvidedByFlag:h.boolean().optional(),connectionConfig:Y4.optional()}).strict(),T0e=h.object({appName:ra,computeName:Ar,nameProvidedByFlag:h.boolean().optional(),connectionConfig:Y4.optional()}).strict(),psr=T0e.extend({type:h.literal("ecs"),cluster:E0e.optional(),services:h.array(A0e).min(1,q.SERVICE.MIN_REQUIRED),docker:Jm.partial().optional()}).strict().refine(t=>{let e=t.services.filter(r=>r.containers?.some(n=>n.port));return e.length>1?e.every(r=>(Array.isArray(r.routing)?r.routing:r.routing?[r.routing]:[]).some(n=>n.path||n.host)):!0},{message:q.SERVICE.ROUTING_REQUIRED}).refine(t=>{let e=t.services.map(r=>r.name);return new Set(e).size===e.length},{message:q.SERVICE.UNIQUE_WITHIN_CLUSTER}),msr=T0e.extend({type:h.literal("lambda"),timeout:h.number().int(q.LAMBDA.TIMEOUT.INTEGER).min(R4,q.LAMBDA.TIMEOUT.MIN).max(D4,q.LAMBDA.TIMEOUT.MAX).optional(),memory:zT.optional(),handler:h.string().optional(),runtime:v0e.optional(),environment:jT.optional(),secrets:jT.optional(),description:h.string().optional(),functionUrl:h.union([h.object({authType:h.enum(r_).optional()}).strict(),h.literal(!1)]).optional(),eventSources:h.array(b0e).optional()}).strict(),fsr=T0e.extend({type:h.literal("ec2"),instanceType:VX.optional(),enableSSH:h.boolean().optional(),keyName:h.string().optional(),userData:h.string().optional(),securityGroups:h.array(h.string()).optional()}).strict(),k0e=h.discriminatedUnion("type",[psr,msr,fsr]),y0e=h.object({path:h.string().min(1,q.REQUIRED.ROUTING_PATH),priority:h.number().int(q.PRIORITY.INTEGER).min(1,q.PRIORITY.MIN).max(5e4,q.PRIORITY.MAX).optional()}).strict(),J4=h.object({name:h.string().min(1,q.REQUIRED.SERVICE_NAME).max(255,q.MAX_LENGTH.SERVICE_NAME).regex(Ot.RESOURCE_NAME,q.RESOURCE_NAME),serviceType:h.enum(["web","worker"]).optional(),docker:Jm.partial().optional(),containerPort:Ld.optional(),needsDatabaseConnection:h.boolean().optional(),routing:h.union([y0e,h.array(y0e).min(1)]).optional()}).strict().superRefine((t,e)=>{t.serviceType==="worker"&&(t.containerPort!==void 0&&e.addIssue({code:"custom",path:["containerPort"],message:"Worker services are not reachable inbound; remove containerPort."}),t.routing!==void 0&&e.addIssue({code:"custom",path:["routing"],message:"Worker services have no ALB route; remove routing."}))}),X4=h.object({appName:ra,instanceType:h.string().optional()}).strict()});var GX,I0e,P0e,WX,R0e,zat,D0e,O0e,Gat,HX,qX,g_,Wat,Hat,qat,Kat,y_,v_,mw,N0e,_0e,$0e=w(()=>{"use strict";Lt();$p();B4();zX();fl();$();GX=h.object({memorySize:zT.optional(),timeout:h.number().int(q.LAMBDA.TIMEOUT.INTEGER).min(1,q.LAMBDA.TIMEOUT.MIN).max(900,q.LAMBDA.TIMEOUT.MAX).optional(),ephemeralStorageSize:h.number().int(q.EPHEMERAL_STORAGE.INTEGER).min(512,q.EPHEMERAL_STORAGE.MIN).max(10240,q.EPHEMERAL_STORAGE.MAX).optional()}).strict(),I0e=h.object({type:h.enum(vX).optional(),databaseName:h.string().optional(),databaseEngine:h.enum($T).optional(),deletionProtection:h.boolean().optional(),backupRetention:by.optional(),port:N4.optional(),publiclyAccessible:h.boolean().optional(),allowedIpCidr:h.string().optional(),instanceType:h.string().optional(),allocatedStorage:h.number().int(q.ALLOCATED_STORAGE.INTEGER).min(20,q.ALLOCATED_STORAGE.MIN).max(65536,q.ALLOCATED_STORAGE.MAX).optional(),multiAz:h.boolean().optional(),readReplica:M4.optional(),writer:u_.optional(),readers:d_.optional(),allowVpcAccess:h.boolean().optional(),monitoringInterval:l_.optional(),preferredMaintenanceWindow:h.string().optional(),databaseInsights:L4.optional(),proxy:$4.optional(),credentials:_4.optional(),encryption:F4.optional(),snapshotIdentifier:h.string().optional(),snapshotUsername:h.string().optional()}).strict(),P0e=h.object({server:GX.optional(),imageOptimisation:GX.optional(),revalidation:GX.optional()}).strict(),WX=h.object({versioned:h.boolean().optional()}).strict(),R0e=h.object({assets:WX.optional(),cache:WX.optional(),media:WX.optional()}).strict(),zat=h.object({visibilityTimeout:h.number().int(q.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,q.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,q.SQS.VISIBILITY_TIMEOUT.MAX).optional(),messageRetentionPeriod:h.number().int(q.SQS.RETENTION_PERIOD.INTEGER).min(60,q.SQS.RETENTION_PERIOD.MIN).max(1209600,q.SQS.RETENTION_PERIOD.MAX).optional(),maxMessageSize:h.number().int(q.MAX_MESSAGE_SIZE.INTEGER).min(1024,q.MAX_MESSAGE_SIZE.MIN).max(262144,q.MAX_MESSAGE_SIZE.MAX).optional(),deadLetterQueue:h.union([h.literal(!1),h.object({enabled:h.boolean().optional(),maxReceiveCount:h.number().int(q.DLQ.MAX_RECEIVE_COUNT.INTEGER).min(1,q.DLQ.MAX_RECEIVE_COUNT.MIN).max(1e3,q.DLQ.MAX_RECEIVE_COUNT.MAX).optional()}).strict()]).optional()}).strict(),D0e=h.object({revalidationQueue:zat.optional()}).strict(),O0e=h.object({domainNames:h.array(h.string()).optional(),certificateArn:h.string().optional()}).strict(),Gat=h.record(h.string().regex(Ot.ENV_VAR_NAME,q.ENV_VAR_NAME),h.string()).optional(),HX=h.object({type:h.literal("payload"),name:h.string().min(1,q.REQUIRED.PATTERN_NAME),domain:h.string().optional(),database:I0e.optional(),compute:P0e.optional(),storage:R0e.optional(),messaging:D0e.optional(),cdn:O0e.optional(),environment:Gat}).strict(),qX=h.object({type:h.literal("nextjs"),name:h.string().min(1,q.REQUIRED.PATTERN_NAME),domain:h.string().optional(),database:I0e.optional(),compute:P0e.optional(),storage:R0e.optional(),messaging:D0e.optional(),cdn:O0e.optional(),environment:Gat}).strict(),g_=h.enum(AT),Wat=h.object({command:h.string().min(1,q.REQUIRED.BUILD_COMMAND),outputDir:h.string().min(1,q.REQUIRED.OUTPUT_DIR)}).strict(),Hat=h.object({headers:h.boolean().optional(),contentSecurityPolicy:h.string().optional()}).strict(),qat=h.object({to:h.string().min(1,q.REQUIRED.FORMS_TO).regex(Ot.EMAIL,q.EMAIL),from:h.string().regex(Ot.EMAIL,q.EMAIL).optional(),corsOrigin:h.string().regex(Ot.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),maxConcurrency:h.number().int().min(1).max(100).optional()}).strict(),Kat=h.object({behaviours:h.array(h.unknown()).optional()}).strict(),y_=h.object({type:h.literal("staticsite"),name:h.string().min(1,q.REQUIRED.PATTERN_NAME),source:h.string().min(1,q.REQUIRED.SOURCE),build:Wat,routing:g_.optional(),security:Hat.optional(),domain:h.string().optional(),forms:qat.optional(),cdn:Kat.optional()}).strict().superRefine((t,e)=>{if(t.forms===void 0)return;let r=t.domain;if(r===void 0||r===""){e.addIssue({code:"custom",path:["domain"],message:"A domain is required when forms are enabled: SES sends only from a verified identity, and the site's domain is the identity the pattern verifies"});return}let n=t.forms.from;n!==void 0&&!ON(n,r)&&e.addIssue({code:"custom",path:["forms","from"],message:`forms.from must be an address at ${r} (the verified SES identity) \u2014 for example noreply@${r}. Use forms.to for the recipient.`})}),v_=h.discriminatedUnion("type",[HX,qX,y_]),mw=h.enum(["lightweight","standard","resilient","custom"]),N0e=h.object({type:h.enum(vX),instanceType:h.string().optional(),backupRetention:by.optional(),deletionProtection:h.boolean().optional(),encryption:h.union([h.object({useCMK:h.literal(!0)}).strict(),h.literal(!1)]).optional()}).strict(),_0e=h.object({memorySize:zT.optional(),timeout:h.number().int(q.LAMBDA.TIMEOUT.INTEGER).min(1,q.LAMBDA.TIMEOUT.MIN).max(900,q.LAMBDA.TIMEOUT.MAX).optional()}).strict()});var M0e,hsr,KX,Yat=w(()=>{"use strict";Lt();$p();Sy();B4();DX();t0e();_X();a0e();zX();B4();$0e();M0e=h.object({appName:ra,type:o_,pattern:s_.optional(),patternConfig:v_.optional(),owner:h.string().optional(),tags:h.record(h.string(),h.string()).optional(),vpcId:h.string().optional(),network:BT.optional(),backup:jCe.optional(),tunnel:BCe.optional(),additionalNetworks:h.array(QCe).optional(),database:h.array(j4),s3:h.array(V4),compute:h.array(Z4),dynamodb:h.array(qCe).optional(),clickhouse:h.array(KCe).optional(),sqs:h.array(G4).optional(),cdn:W4.optional(),customCodeBlocks:h.array(FCe).optional(),additionalManagedImports:h.array(h.object({moduleSpecifier:h.string(),namedImports:h.array(h.string()),defaultImport:h.string().optional()}).strict()).optional()}).strict(),hsr=h.object({name:ra,type:o_,pattern:s_.optional(),patternTier:mw.optional(),patternDomain:h.string().optional(),source:h.string().min(1,q.REQUIRED.SOURCE).optional(),buildCommand:h.string().min(1,q.REQUIRED.BUILD_COMMAND).optional(),outputDir:h.string().min(1,q.REQUIRED.OUTPUT_DIR).optional(),routing:g_.optional(),formsTo:h.string().min(1,q.REQUIRED.FORMS_TO).regex(Ot.EMAIL,q.EMAIL).optional(),corsOrigin:h.string().regex(Ot.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),customDatabase:N0e.optional(),customCompute:_0e.optional(),region:h.string().optional(),owner:h.string().optional(),includeDatabase:h.boolean().optional(),databaseName:h.string().min(1,q.DATABASE.NAME.REQUIRED).max(63,q.DATABASE.NAME.MAX_LENGTH).optional(),vpcId:h.string().optional(),network:e0e.optional(),services:h.array(J4).optional(),snapshotIdentifier:h.string().optional(),snapshotUsername:h.string().optional()}).strict().superRefine((t,e)=>{t.formsTo!==void 0&&(t.patternDomain!==void 0&&t.patternDomain!==""||e.addIssue({code:"custom",path:["patternDomain"],message:"A domain is required when forms are enabled: SES sends only from a verified identity, and the site's domain is the identity the pattern verifies"}))}),KX=h.object({name:Ar,localResource:h.string().min(1),remoteApp:h.string().min(1),remoteResource:h.string().min(1),permission:h.enum(["read","write","read-write"]),remoteArn:h.string().optional()}).strict()});var Zat,gsr,j0e,F0e,B0e,Jat,Xat,Qat,YX,L0e,ZX,U0e,eot=w(()=>{"use strict";Lt();$p();Sy();Zat=["fjall-managed","external","external-manual"],gsr=h.enum(Zat),j0e=["AdministratorAccess","ReadOnlyAccess","Billing","ManagementAccountAccess"],F0e=h.object({givenName:h.string().min(1),familyName:h.string().min(1),displayName:h.string().min(1).optional(),expires:h.string().min(1).optional()}).strict(),B0e=h.object({name:h.string().min(1),path:h.string().min(1).optional()}).strict(),Jat=h.union([h.object({managedPolicyArn:h.string().min(1)}).strict(),h.object({customerManagedPolicy:B0e}).strict()]),Xat=h.object({managedPolicies:h.array(h.string().min(1)).optional(),inlinePolicy:h.record(h.string(),h.unknown()).optional(),customerManagedPolicies:h.array(B0e).optional(),permissionsBoundary:Jat.optional(),sessionDuration:h.string().min(1).optional(),description:h.string().optional(),accounts:h.union([h.array(h.string().min(1)),h.literal("all")]).optional(),includeManagementAccount:h.boolean().optional(),groups:h.array(h.string().min(1)).optional()}).strict(),Qat=h.object({description:h.string().optional()}).strict(),YX=h.string().regex(Ot.EMAIL,q.EMAIL),L0e={groups:h.record(h.string(),Qat).optional(),permissionSets:h.record(h.string(),Xat).optional(),memberships:h.record(h.string(),h.array(YX)).optional(),resolutionVersion:h.number().int().min(1).optional(),defaultPermissionSets:h.boolean().optional()},ZX=h.discriminatedUnion("source",[h.object({...L0e,source:h.literal("fjall-managed"),users:h.record(YX,F0e)}).strict(),h.object({...L0e,source:h.literal("external")}).strict(),h.object({...L0e,source:h.literal("external-manual"),users:h.record(YX,F0e).optional()}).strict()]),U0e=h.object({name:Ar,type:h.literal("organisation").optional(),organisationName:h.string().min(1).optional(),orgEmail:YX.optional(),accounts:h.unknown().optional(),accountIds:h.record(h.string(),h.string()).optional(),identityCentre:h.union([ZX,h.literal(!1)]).optional(),allowedRegions:h.array(h.string().min(1)).optional()}).strict()});var S_=w(()=>{"use strict";Sy();B4();DX();t0e();_X();a0e();zX();$0e();Yat();AX();eot()});function rot(t){let e=tot.safeParse(t);if(!e.success){let r=e.error.issues.map(n=>` - ${n.path.join(".")||"(root)"}: ${n.message}`).join(`
145
145
  `);throw new Error(`Buildkite: invalid props:
146
146
  ${r}`)}return e.data}var ysr,vsr,Ssr,JX,tot,not=w(()=>{"use strict";Lt();ysr=Object.defineProperty,vsr=(t,e)=>ysr(t,"name",{value:e,configurable:!0}),Ssr=[1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,3653],JX=h.object({buildkiteQueue:h.string().min(1,"buildkiteQueue cannot be empty").max(100).regex(/^[a-zA-Z0-9-_]+$/,"buildkiteQueue must be alphanumeric with hyphens/underscores"),buildkiteOrgSlug:h.string().min(1,"buildkiteOrgSlug cannot be empty").max(100).regex(/^[a-z0-9-]+$/,"buildkiteOrgSlug must be a lowercase Buildkite organisation slug"),agentTokenSsmParameterName:h.string().min(2).regex(/^\//,"agentTokenSsmParameterName must be a full path (leading /)").optional(),agentTokenKmsKeyArn:h.string().min(1).optional(),fjallApiKeySsmParameterName:h.string().min(2).regex(/^\//,"fjallApiKeySsmParameterName must be a full path (leading /)").optional(),instanceType:h.string().min(1).default("c8g.xlarge"),agentVolumeSizeGib:h.number().int().min(20).max(1e3).default(250),agentMinInstances:h.number().int().min(0).default(0),agentMaxInstances:h.number().int().min(1).default(2),agentsPerInstance:h.number().int().min(1).default(1),spotCapacityPercentage:h.number().int().min(0).max(100).default(0),scaleInIdlePeriodSeconds:h.number().int().min(60).default(600),disconnectAfterUptimeSeconds:h.number().int().min(3600).default(86400),maxInstanceLifetimeDays:h.number().int().min(1).max(365).default(7),terminateInstanceAfterJob:h.boolean().default(!1),purgeBuildsOnDiskFull:h.boolean().default(!0),terminateInstanceOnDiskFull:h.boolean().default(!1),logRetentionDays:h.number().int().min(1).default(30),agentLogRetentionDays:h.literal(Ssr).default(7),buildkiteAgentRelease:h.enum(["stable","beta","edge"]).default("stable"),buildkiteAgentTags:h.string().default(""),buildkiteAgentTimestampLines:h.boolean().default(!1),buildkiteAgentExperiments:h.string().default(""),buildkiteAgentTracingBackend:h.enum(["","datadog","opentelemetry"]).default(""),buildkiteAgentCancelGracePeriodSeconds:h.number().int().min(10).default(60),enableSecretsPlugin:h.boolean().default(!0),enableEcrPlugin:h.boolean().default(!1),enableDockerLoginPlugin:h.boolean().default(!1),enableDockerUserNamespaceRemap:h.boolean().default(!0),enableDockerExperimental:h.boolean().default(!1),dockerNetworkingProtocol:h.enum(["ipv4","dualstack"]).default("ipv4"),enableInstanceStorage:h.boolean().default(!1),mountTmpfsAtTmp:h.boolean().default(!0),buildkiteAgentEnableGitMirrors:h.boolean().default(!1),bootstrapScriptUrl:h.string().default(""),agentEnvFileUrl:h.string().default(""),scalerEventSchedulePeriod:h.string().min(1).default("1 minute"),scalerMinPollInterval:h.string().min(1).default("10s"),scaleOutFactor:h.string().min(1).default("1.0"),scaleOutWaitingForJobs:h.boolean().default(!1),rolePermissionsBoundaryArn:h.string().min(1).optional(),alarmSnsTopicArn:h.string().min(1).optional(),applicationId:h.string().min(1).optional(),costAllocationEnvironment:h.string().min(1).optional(),costAllocationOwner:h.string().min(1).optional()}).strict(),tot=JX.refine(t=>t.agentMinInstances<=t.agentMaxInstances,{message:"agentMinInstances must be <= agentMaxInstances"});vsr(rot,"validateBuildkiteProps")});function aot(t){return`FjallDeployBoundary${t}`}var bsr,Esr,V0e,oot,sot,Asr,wsr,iot=w(()=>{"use strict";bsr=Object.defineProperty,Esr=(t,e)=>bsr(t,"name",{value:e,configurable:!0});Esr(aot,"deployBoundaryName");V0e={Sid:"FjallInheritAdministratorAccess",Effect:"Allow",Action:"*",Resource:"*"},oot=[{Sid:"FjallDenyOrgAndAccountEscape",Effect:"Deny",Action:["organizations:LeaveOrganization","account:CloseAccount"],Resource:"*"},{Sid:"FjallDenyDisableAuditLogging",Effect:"Deny",Action:["cloudtrail:StopLogging"],Resource:"*"},{Sid:"FjallDenyBoundarySelfEscape",Effect:"Deny",Action:["iam:DeleteRolePermissionsBoundary"],Resource:"*"},{Sid:"FjallDenyDisableKmsKey",Effect:"Deny",Action:["kms:DisableKey"],Resource:"*"}],sot=[...oot,{Sid:"FjallDenyStandingHumanCredentials",Effect:"Deny",Action:["iam:CreateUser","iam:CreateLoginProfile","iam:CreateAccessKey","iam:CreateAccountAlias"],Resource:"*"},{Sid:"FjallDenyDisableConfigRecorder",Effect:"Deny",Action:["config:StopConfigurationRecorder"],Resource:"*"}],Asr=[...sot,{Sid:"FjallDenyAccountPasswordPolicyTamper",Effect:"Deny",Action:["iam:UpdateAccountPasswordPolicy","iam:DeleteAccountPasswordPolicy"],Resource:"*"},{Sid:"FjallDenyDisableDefaultEbsEncryption",Effect:"Deny",Action:["ec2:DisableEbsEncryptionByDefault"],Resource:"*"}],wsr={foundation:[V0e,...oot],compliance:[V0e,...sot],hardened:[V0e,...Asr]}});function QX(t){return`FjallDevDeploy${t}`}function cot(t){return`FjallDevProvisioner${t}`}function lot(t){return`FjallDevSyncWriter${t}`}function G0e(t){return`arn:aws:iam::${t}:policy/${uot}`}function W0e(t){return`org:${t}:dev-provisioner`}function H0e(t){return`org:${t}:dev-sync`}function dot(t){let{fjallOrgId:e,providerArn:r,issuerDomain:n}=t,a={[`${n}:aud`]:b_};return[{Sid:"FjallMachineSubject",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...a,[`${n}:sub`]:`org:${e}:*`}}},{Sid:"FjallUserSubjects",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:a,StringLike:{[`${n}:sub`]:`org:${e}:user:*`}}},{Sid:"FjallServiceSubjects",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...a,[`${n}:sub`]:[`org:${e}:discovery`,`org:${e}:connection`,`org:${e}:org-setup`,`org:${e}:dev-substrate-setup`]}}}]}function pot(t){let{fjallOrgId:e,providerArn:r,issuerDomain:n,accountId:a}=t;return[{Sid:"FjallDevSubjectsThisAccount",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${n}:aud`]:b_},StringLike:{[`${n}:sub`]:`org:${e}:dev:${a}:*`}}}]}function q0e(t){let{providerArn:e,issuerDomain:r,sid:n,subject:a}=t;return[{Sid:n,Effect:"Allow",Principal:{Federated:e},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${r}:aud`]:b_,[`${r}:sub`]:a}}}]}function mot(t){return q0e({...t,sid:"FjallDevProvisionerSubject",subject:W0e(t.fjallOrgId)})}function fot(t){return q0e({...t,sid:"FjallDevSyncSubject",subject:H0e(t.fjallOrgId)})}function hot({accountId:t}){return[{Sid:"FjallDevEcsTaggedMutations",Effect:"Allow",Action:["ecs:UpdateService","ecs:DeleteService","ecs:RunTask","ecs:StopTask"],Resource:`arn:aws:ecs:*:${t}:*`,Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevEcsTaggedCreates",Effect:"Allow",Action:["ecs:RegisterTaskDefinition","ecs:CreateService"],Resource:"*",Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevEcsTagOnCreate",Effect:"Allow",Action:["ecs:TagResource"],Resource:`arn:aws:ecs:*:${t}:*`,Condition:{StringEquals:{"ecs:CreateAction":["RegisterTaskDefinition","CreateService","RunTask"]}}},{Sid:"FjallDevEcsReads",Effect:"Allow",Action:["ecs:Describe*","ecs:List*"],Resource:"*"},{Sid:"FjallDevEcsDeregisterTaskDefinition",Effect:"Allow",Action:["ecs:DeregisterTaskDefinition"],Resource:`arn:aws:ecs:*:${t}:task-definition/fjall-dev-*`},{Sid:"FjallDevElbTaggedMutations",Effect:"Allow",Action:["elasticloadbalancing:ModifyRule","elasticloadbalancing:DeleteRule","elasticloadbalancing:ModifyTargetGroup","elasticloadbalancing:ModifyTargetGroupAttributes","elasticloadbalancing:DeleteTargetGroup","elasticloadbalancing:RegisterTargets","elasticloadbalancing:DeregisterTargets"],Resource:`arn:aws:elasticloadbalancing:*:${t}:*`,Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevElbTaggedCreates",Effect:"Allow",Action:["elasticloadbalancing:CreateTargetGroup","elasticloadbalancing:CreateRule"],Resource:`arn:aws:elasticloadbalancing:*:${t}:*`,Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevElbTagOnCreate",Effect:"Allow",Action:["elasticloadbalancing:AddTags"],Resource:`arn:aws:elasticloadbalancing:*:${t}:*`,Condition:{StringEquals:{"elasticloadbalancing:CreateAction":["CreateTargetGroup","CreateRule"]}}},{Sid:"FjallDevElbReads",Effect:"Allow",Action:["elasticloadbalancing:Describe*"],Resource:"*"},{Sid:"FjallDevSsmDevTree",Effect:"Allow",Action:["ssm:GetParameter*","ssm:PutParameter","ssm:AddTagsToResource"],Resource:`arn:aws:ssm:*:${t}:parameter/fjall/dev/*`},{Sid:"FjallDevLogsMutations",Effect:"Allow",Action:["logs:PutRetentionPolicy","logs:DeleteLogGroup"],Resource:`arn:aws:logs:*:${t}:log-group:/fjall/dev/*`},{Sid:"FjallDevLogsTaggedCreate",Effect:"Allow",Action:["logs:CreateLogGroup","logs:TagResource"],Resource:`arn:aws:logs:*:${t}:log-group:/fjall/dev/*`,Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevLogsRead",Effect:"Allow",Action:["logs:GetLogEvents","logs:DescribeLogStreams","logs:FilterLogEvents"],Resource:`arn:aws:logs:*:${t}:log-group:/fjall/dev/*`},{Sid:"FjallDevLogsDescribeGroups",Effect:"Allow",Action:["logs:DescribeLogGroups"],Resource:"*"},{Sid:"FjallDevKmsViaDevAlias",Effect:"Allow",Action:["kms:Encrypt","kms:Decrypt","kms:GenerateDataKey"],Resource:`arn:aws:kms:*:${t}:key/*`,Condition:{"ForAnyValue:StringLike":{"kms:ResourceAliases":"alias/fjall-dev-*"}}},{Sid:"FjallDevKmsSsmSecureString",Effect:"Allow",Action:["kms:Encrypt","kms:Decrypt","kms:GenerateDataKey"],Resource:`arn:aws:kms:*:${t}:key/*`,Condition:{StringLike:{"kms:ViaService":"ssm.*.amazonaws.com"}}},{Sid:"FjallDevEcrAuthToken",Effect:"Allow",Action:["ecr:GetAuthorizationToken"],Resource:"*"},{Sid:"FjallDevEcrPushPull",Effect:"Allow",Action:["ecr:PutImage","ecr:InitiateLayerUpload","ecr:UploadLayerPart","ecr:CompleteLayerUpload","ecr:BatchCheckLayerAvailability","ecr:BatchGetImage","ecr:GetDownloadUrlForLayer","ecr:DescribeImages"],Resource:`arn:aws:ecr:*:${t}:repository/*`},{Sid:"FjallDevPassDevPathRoles",Effect:"Allow",Action:["iam:PassRole"],Resource:`arn:aws:iam::${t}:role/fjall/dev/*`}]}function got({accountId:t}){return[{Sid:"FjallDevProvisionerBoundedRoleWrites",Effect:"Allow",Action:["iam:CreateRole","iam:PutRolePolicy","iam:AttachRolePolicy"],Resource:`arn:aws:iam::${t}:role/fjall/dev/*`,Condition:{StringEquals:{"iam:PermissionsBoundary":G0e(t)}}},{Sid:"FjallDevProvisionerPathRoleOps",Effect:"Allow",Action:["iam:DeleteRole","iam:DeleteRolePolicy","iam:DetachRolePolicy","iam:ListRolePolicies","iam:TagRole"],Resource:`arn:aws:iam::${t}:role/fjall/dev/*`},{Sid:"FjallDevProvisionerListRoles",Effect:"Allow",Action:["iam:ListRoles"],Resource:"*"},{Sid:"FjallDevProvisionerDevMasterSecrets",Effect:"Allow",Action:["secretsmanager:GetSecretValue"],Resource:`arn:aws:secretsmanager:*:${t}:secret:fjall-dev-*`},{Sid:"FjallDevProvisionerKmsDecryptViaSecretsManager",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${t}:key/*`,Condition:{StringLike:{"kms:ViaService":"secretsmanager.*.amazonaws.com"}}},{Sid:"FjallDevProvisionerDataApi",Effect:"Allow",Action:["rds-data:ExecuteStatement","rds-data:BatchExecuteStatement","rds-data:BeginTransaction","rds-data:CommitTransaction","rds-data:RollbackTransaction"],Resource:`arn:aws:rds:*:${t}:cluster:fjall-dev-*`},{Sid:"FjallDevProvisionerMetrics",Effect:"Allow",Action:["cloudwatch:GetMetricData"],Resource:"*"},{Sid:"FjallDevProvisionerOrphanDiscovery",Effect:"Allow",Action:["tag:GetResources"],Resource:"*"},{Sid:"FjallDevProvisionerSsmTeardown",Effect:"Allow",Action:["ssm:DeleteParameter*"],Resource:`arn:aws:ssm:*:${t}:parameter/fjall/dev/*`},{Sid:"FjallDevProvisionerLogsTeardown",Effect:"Allow",Action:["logs:DeleteLogGroup"],Resource:`arn:aws:logs:*:${t}:log-group:/fjall/dev/*`},{Sid:"FjallDevProvisionerTaggedTeardown",Effect:"Allow",Action:["ecs:UpdateService","ecs:StopTask","ecs:DeleteService","elasticloadbalancing:DeleteRule","elasticloadbalancing:DeleteTargetGroup","elasticloadbalancing:DeregisterTargets"],Resource:[`arn:aws:ecs:*:${t}:*`,`arn:aws:elasticloadbalancing:*:${t}:*`],Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevProvisionerTeardownReads",Effect:"Allow",Action:["ecs:Describe*","elasticloadbalancing:Describe*"],Resource:"*"},{Sid:"FjallDevProvisionerImageJanitor",Effect:"Allow",Action:["ecr:ListImages","ecr:DescribeImages","ecr:BatchDeleteImage"],Resource:`arn:aws:ecr:*:${t}:repository/*`},{Sid:"FjallDevProvisionerSsmReadAll",Effect:"Allow",Action:["ssm:GetParameter*"],Resource:`arn:aws:ssm:*:${t}:parameter/*`},{Sid:"FjallDevProvisionerKmsDecryptViaSsm",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${t}:key/*`,Condition:{StringLike:{"kms:ViaService":"ssm.*.amazonaws.com"}}}]}function yot({accountId:t}){return[{Sid:"FjallDevSyncPrefixReadWrite",Effect:"Allow",Action:["s3:GetObject","s3:PutObject"],Resource:`arn:aws:s3:::fjall-dev-sync-${t}-*/*`,Condition:{StringEquals:{"aws:ResourceAccount":t}}}]}function vot({accountId:t}){return[{Sid:"FjallDevBoundarySsmDevRead",Effect:"Allow",Action:["ssm:GetParameter*"],Resource:`arn:aws:ssm:*:${t}:parameter/fjall/dev/*`},{Sid:"FjallDevBoundaryKmsDecryptDevAlias",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${t}:key/*`,Condition:{"ForAnyValue:StringLike":{"kms:ResourceAliases":"alias/fjall-dev-*"}}},{Sid:"FjallDevBoundarySyncPrefixReadWrite",Effect:"Allow",Action:["s3:GetObject","s3:PutObject"],Resource:`arn:aws:s3:::fjall-dev-sync-${t}-*/*`,Condition:{StringEquals:{"aws:ResourceAccount":t}}},{Sid:"FjallDevBoundarySlotLogs",Effect:"Allow",Action:["logs:CreateLogStream","logs:PutLogEvents"],Resource:`arn:aws:logs:*:${t}:log-group:/fjall/dev/*`},{Sid:"FjallDevBoundarySyncQueue",Effect:"Allow",Action:["sqs:ReceiveMessage","sqs:DeleteMessage","sqs:GetQueueUrl"],Resource:`arn:aws:sqs:*:${t}:fjall-dev-sync-${t}-*`}]}var Csr,Eu,XX,b_,z0e,xsr,Tsr,ksr,uot,Sot=w(()=>{"use strict";Csr=Object.defineProperty,Eu=(t,e)=>Csr(t,"name",{value:e,configurable:!0}),XX="fjall.io",b_="sts.amazonaws.com",z0e="0000000000000000000000000000000000000000";Eu(QX,"devDeployRoleName");Eu(cot,"devProvisionerRoleName");Eu(lot,"devSyncWriterRoleName");xsr="FjallDevDeployPolicy",Tsr="FjallDevProvisionerPolicy",ksr="FjallDevSyncWriterPolicy",uot="FjallDevBoundary";Eu(G0e,"devBoundaryPolicyArn");Eu(W0e,"devProvisionerSubject");Eu(H0e,"devSyncSubject");Eu(dot,"buildNarrowedDeployTrustStatements");Eu(pot,"buildDevDeployTrustStatements");Eu(q0e,"buildServiceSubjectTrustStatements");Eu(mot,"buildDevProvisionerTrustStatements");Eu(fot,"buildDevSyncWriterTrustStatements");Eu(hot,"buildDevDeployPolicyStatements");Eu(got,"buildDevProvisionerPolicyStatements");Eu(yot,"buildDevSyncWriterPolicyStatements");Eu(vot,"buildDevBoundaryStatements")});var eQ=w(()=>{"use strict";S_();not();fl();iot();Sot();i0e()});function Zt(t){return JSON.stringify(t)}function GT(t){return t.map(Zt).join(", ")}function WT(t=" "){return`