fjall 33.0.0 → 33.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.
- package/bin/.bundled +2 -2
- package/bin/assets/generators/account/generator.js +97 -97
- package/bin/assets/generators/application/generator.js +86 -86
- package/bin/assets/generators/cdn/generator.js +27 -27
- package/bin/assets/generators/compute/generator.js +86 -86
- package/bin/assets/generators/compute/service/generator.js +125 -125
- package/bin/assets/generators/database/generator.js +27 -27
- package/bin/assets/generators/database/proxy/generator.js +127 -127
- package/bin/assets/generators/domain/generator.js +91 -91
- package/bin/assets/generators/network/generator.js +115 -115
- package/bin/assets/generators/organisation/generator.js +93 -93
- package/bin/assets/generators/shared/files/package.json +2 -2
- package/bin/assets/generators/storage/s3/generator.js +27 -27
- package/bin/assets/generators/tunnel/generator.js +83 -83
- package/bin/fjall.bundle.js +33 -33
- package/package.json +5 -3
- package/bin/.build-source-hash +0 -37
|
@@ -101,29 +101,29 @@ while`),s.push(" (",e.call(r,"test"),");"),(0,S.concat)(s)}case"DoExpression":{v
|
|
|
101
101
|
`,u,`
|
|
102
102
|
}`):t.objectCurlySpacing?n.push("{ ",u," }"):n.push("{",u,"}")}}else n.push(a?"{ ":"{",(0,S.fromString)(", ").join(e.map(r,"specifiers")),a?" }":"}");i.source&&n.push(" from ",e.call(r,"source"),XI(e,t,r))}var d=(0,S.concat)(n);return Ud(d)!==";"&&!(i.declaration&&(i.declaration.type==="FunctionDeclaration"||i.declaration.type==="ClassDeclaration"||i.declaration.type==="TSModuleDeclaration"||i.declaration.type==="TSInterfaceDeclaration"||i.declaration.type==="TSEnumDeclaration"))&&(d=(0,S.concat)([d,";"])),d}function Md(e,t){var r=Dn.getParentExportDeclaration(e);return r?(0,Qr.default)(r.type==="DeclareExportDeclaration"):t.unshift("declare "),(0,S.concat)(t)}function Fd(e,t){return e.call(function(r){var i=r.getValue();return i?i==="plus"?(0,S.fromString)("+"):i==="minus"?(0,S.fromString)("-"):t(r):(0,S.fromString)("")},"variance")}function bo(e,t){return e.length>1?(0,S.concat)([" ",e]):(0,S.concat)([`
|
|
103
103
|
`,ly(e).indent(t.tabWidth)])}function Ud(e){var t=e.lastPos();do{var r=e.charAt(t);if(/\S/.test(r))return r}while(e.prevPos(t))}function l2(e){return Ud(e)==="}"}function sy(e){return e.replace(/['"]/g,function(t){return t==='"'?"'":'"'})}function jc(e){var t=So.getFieldValue(e,"value"),r=So.getFieldValue(e,"extra");if(r&&typeof r.raw=="string"&&t==r.rawValue)return r.raw;if(e.type==="Literal"){var i=e.raw;if(typeof i=="string"&&t==i)return i}}function cy(e){return JSON.stringify(e).replace(/[\u2028\u2029]/g,function(t){return"\\u"+t.charCodeAt(0).toString(16)})}function Ld(e,t){switch(YI.assert(e),t.quote){case"auto":{var r=cy(e),i=sy(cy(sy(e)));return r.length>i.length?i:r}case"single":return sy(cy(sy(e)));default:return cy(e)}}function ly(e){var t=Ud(e);return!t||`
|
|
104
|
-
};`.indexOf(t)<0?(0,S.concat)([e,";"]):e}});var y2=P(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.run=Zt.prettyPrint=Zt.print=Zt.visit=Zt.types=Zt.parse=void 0;var m2=(de(),Q(le)),Zne=m2.__importDefault(No("fs")),Hne=m2.__importStar(_r());Zt.types=Hne;var f2=ZB();Object.defineProperty(Zt,"parse",{enumerable:!0,get:function(){return f2.parse}});var h2=p2(),Jne=_r();Object.defineProperty(Zt,"visit",{enumerable:!0,get:function(){return Jne.visit}});function g2(e,t){return new h2.Printer(t).print(e)}Zt.print=g2;function Xne(e,t){return new h2.Printer(t).printGenerically(e)}Zt.prettyPrint=Xne;function Yne(e,t){return Qne(process.argv[2],e,t)}Zt.run=Yne;function Qne(e,t,r){Zne.default.readFile(e,"utf-8",function(i,n){if(i){console.error(i);return}tie(n,t,r)})}function eie(e){process.stdout.write(e)}function tie(e,t,r){var i=r&&r.writeback||eie;t((0,f2.parse)(e,r),function(n){i(g2(n,r).code)})}});var Ke=P((
|
|
105
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var d=r.next();return a=d.done,d},e:function(d){o=!0,s=d},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function Zie(e,t){if(e){if(typeof e=="string")return Y4(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Y4(e,t)}}function Y4(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var Hie=Ay(),e6=qe(),Q4=e6.erase,Jie=e6.cursor,Xie=e=>[...Hie(e)].length;t6.exports=function(e,t){if(!t)return Q4.line+Jie.to(0);let r=0,i=e.split(/\r?\n/);var n=qie(i),a;try{for(n.s();!(a=n.n()).done;){let o=a.value;r+=1+Math.floor(Math.max(Xie(o)-1,0)/t)}}catch(o){n.e(o)}finally{n.f()}return Q4.lines(r)}});var bD=P((
|
|
104
|
+
};`.indexOf(t)<0?(0,S.concat)([e,";"]):e}});var y2=P(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.run=Zt.prettyPrint=Zt.print=Zt.visit=Zt.types=Zt.parse=void 0;var m2=(de(),Q(le)),Zne=m2.__importDefault(No("fs")),Hne=m2.__importStar(_r());Zt.types=Hne;var f2=ZB();Object.defineProperty(Zt,"parse",{enumerable:!0,get:function(){return f2.parse}});var h2=p2(),Jne=_r();Object.defineProperty(Zt,"visit",{enumerable:!0,get:function(){return Jne.visit}});function g2(e,t){return new h2.Printer(t).print(e)}Zt.print=g2;function Xne(e,t){return new h2.Printer(t).printGenerically(e)}Zt.prettyPrint=Xne;function Yne(e,t){return Qne(process.argv[2],e,t)}Zt.run=Yne;function Qne(e,t,r){Zne.default.readFile(e,"utf-8",function(i,n){if(i){console.error(i);return}tie(n,t,r)})}function eie(e){process.stdout.write(e)}function tie(e,t,r){var i=r&&r.writeback||eie;t((0,f2.parse)(e,r),function(n){i(g2(n,r).code)})}});var Ke=P((MCe,q4)=>{"use strict";var{FORCE_COLOR:zie,NODE_DISABLE_COLORS:Bie,TERM:Gie}=process.env,Te={enabled:!Bie&&Gie!=="dumb"&&zie!=="0",reset:je(0,0),bold:je(1,22),dim:je(2,22),italic:je(3,23),underline:je(4,24),inverse:je(7,27),hidden:je(8,28),strikethrough:je(9,29),black:je(30,39),red:je(31,39),green:je(32,39),yellow:je(33,39),blue:je(34,39),magenta:je(35,39),cyan:je(36,39),white:je(37,39),gray:je(90,39),grey:je(90,39),bgBlack:je(40,49),bgRed:je(41,49),bgGreen:je(42,49),bgYellow:je(43,49),bgBlue:je(44,49),bgMagenta:je(45,49),bgCyan:je(46,49),bgWhite:je(47,49)};function K4(e,t){let r=0,i,n="",a="";for(;r<e.length;r++)i=e[r],n+=i.open,a+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+a}function Vie(e,t){let r={has:e,keys:t};return r.reset=Te.reset.bind(r),r.bold=Te.bold.bind(r),r.dim=Te.dim.bind(r),r.italic=Te.italic.bind(r),r.underline=Te.underline.bind(r),r.inverse=Te.inverse.bind(r),r.hidden=Te.hidden.bind(r),r.strikethrough=Te.strikethrough.bind(r),r.black=Te.black.bind(r),r.red=Te.red.bind(r),r.green=Te.green.bind(r),r.yellow=Te.yellow.bind(r),r.blue=Te.blue.bind(r),r.magenta=Te.magenta.bind(r),r.cyan=Te.cyan.bind(r),r.white=Te.white.bind(r),r.gray=Te.gray.bind(r),r.grey=Te.grey.bind(r),r.bgBlack=Te.bgBlack.bind(r),r.bgRed=Te.bgRed.bind(r),r.bgGreen=Te.bgGreen.bind(r),r.bgYellow=Te.bgYellow.bind(r),r.bgBlue=Te.bgBlue.bind(r),r.bgMagenta=Te.bgMagenta.bind(r),r.bgCyan=Te.bgCyan.bind(r),r.bgWhite=Te.bgWhite.bind(r),r}function je(e,t){let r={open:`\x1B[${e}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(e)||(this.has.push(e),this.keys.push(r)),i===void 0?this:Te.enabled?K4(this.keys,i+""):i+""):i===void 0?Vie([e],[r]):Te.enabled?K4([r],i+""):i+""}}q4.exports=Te});var H4=P((FCe,Z4)=>{"use strict";Z4.exports=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}});var Ay=P((LCe,J4)=>{"use strict";J4.exports=e=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(t,"g");return typeof e=="string"?e.replace(r,""):e}});var qe=P((UCe,X4)=>{"use strict";var vD={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Wie={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},Kie={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?vD.up():"");return e&&(t+=vD.left),t}};X4.exports={cursor:vD,scroll:Wie,erase:Kie,beep:"\x07"}});var r6=P((zCe,t6)=>{"use strict";function qie(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Zie(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(d){throw d},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
105
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var d=r.next();return a=d.done,d},e:function(d){o=!0,s=d},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function Zie(e,t){if(e){if(typeof e=="string")return Y4(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Y4(e,t)}}function Y4(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var Hie=Ay(),e6=qe(),Q4=e6.erase,Jie=e6.cursor,Xie=e=>[...Hie(e)].length;t6.exports=function(e,t){if(!t)return Q4.line+Jie.to(0);let r=0,i=e.split(/\r?\n/);var n=qie(i),a;try{for(n.s();!(a=n.n()).done;){let o=a.value;r+=1+Math.floor(Math.max(Xie(o)-1,0)/t)}}catch(o){n.e(o)}finally{n.f()}return Q4.lines(r)}});var bD=P((BCe,n6)=>{"use strict";var Vd={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Yie={arrowUp:Vd.arrowUp,arrowDown:Vd.arrowDown,arrowLeft:Vd.arrowLeft,arrowRight:Vd.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Qie=process.platform==="win32"?Yie:Vd;n6.exports=Qie});var a6=P((GCe,i6)=>{"use strict";var Gc=Ke(),Co=bD(),SD=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),eae=e=>SD[e]||SD.default,Wd=Object.freeze({aborted:Gc.red(Co.cross),done:Gc.green(Co.tick),exited:Gc.yellow(Co.cross),default:Gc.cyan("?")}),tae=(e,t,r)=>t?Wd.aborted:r?Wd.exited:e?Wd.done:Wd.default,rae=e=>Gc.gray(e?Co.ellipsis:Co.pointerSmall),nae=(e,t)=>Gc.gray(e?t?Co.pointerSmall:"+":Co.line);i6.exports={styles:SD,render:eae,symbols:Wd,symbol:tae,delimiter:rae,item:nae}});var s6=P((VCe,o6)=>{"use strict";var iae=Ay();o6.exports=function(e,t){let r=String(iae(e)||"").split(/\r?\n/);return t?r.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):r.length}});var u6=P((WCe,c6)=>{"use strict";c6.exports=(e,t={})=>{let r=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((a,o)=>(o.length+r.length>=i||a[a.length-1].length+o.length+1<i?a[a.length-1]+=` ${o}`:a.push(`${r}${o}`),a),[r]).join(`
|
|
106
106
|
`)).join(`
|
|
107
|
-
`)}});var d6=P((
|
|
107
|
+
`)}});var d6=P((KCe,l6)=>{"use strict";l6.exports=(e,t,r)=>{r=r||t;let i=Math.min(t-r,e-Math.floor(r/2));i<0&&(i=0);let n=Math.min(i+r,t);return{startIndex:i,endIndex:n}}});var tn=P((qCe,p6)=>{"use strict";p6.exports={action:H4(),clear:r6(),style:a6(),strip:Ay(),figures:bD(),lines:s6(),wrap:u6(),entriesToDisplay:d6()}});var vi=P((ZCe,h6)=>{"use strict";var m6=No("readline"),aae=tn(),oae=aae.action,sae=No("events"),f6=qe(),cae=f6.beep,uae=f6.cursor,lae=Ke(),ED=class extends sae{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let r=m6.createInterface({input:this.in,escapeCodeTimeout:50});m6.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(a,o)=>{let s=oae(o,i);s===!1?this._&&this._(a,o):typeof this[s]=="function"?this[s](o):this.bell()};this.close=()=>{this.out.write(uae.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(cae)}render(){this.onRender(lae),this.firstRender&&(this.firstRender=!1)}};h6.exports=ED});var S6=P((HCe,b6)=>{"use strict";function g6(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function y6(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){g6(a,i,n,o,s,"next",u)}function s(u){g6(a,i,n,o,s,"throw",u)}o(void 0)})}}var _y=Ke(),dae=vi(),v6=qe(),pae=v6.erase,Kd=v6.cursor,Ty=tn(),xD=Ty.style,AD=Ty.clear,mae=Ty.lines,fae=Ty.figures,_D=class extends dae{constructor(t={}){super(t),this.transform=xD.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=AD("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=_y.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
108
108
|
`),this.close()}validate(){var t=this;return y6(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return y6(function*(){if(t.value=t.value||t.initial,t.cursorOffset=0,t.cursor=t.rendered.length,yield t.validate(),t.error){t.red=!0,t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
109
109
|
`),t.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,r){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${t}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${t}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Kd.down(mae(this.outputError,this.out.columns)-1)+AD(this.outputError,this.out.columns)),this.out.write(AD(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[xD.symbol(this.done,this.aborted),_y.bold(this.msg),xD.delimiter(this.done),this.red?_y.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
110
110
|
`).reduce((t,r,i)=>t+`
|
|
111
|
-
${i?" ":fae.pointerSmall} ${_y.red().italic(r)}`,"")),this.out.write(pae.line+Kd.to(0)+this.outputText+Kd.save+this.outputError+Kd.restore+Kd.move(this.cursorOffset,0)))}};b6.exports=_D});var _6=P((
|
|
111
|
+
${i?" ":fae.pointerSmall} ${_y.red().italic(r)}`,"")),this.out.write(pae.line+Kd.to(0)+this.outputText+Kd.save+this.outputError+Kd.restore+Kd.move(this.cursorOffset,0)))}};b6.exports=_D});var _6=P((JCe,A6)=>{"use strict";var bi=Ke(),hae=vi(),qd=tn(),E6=qd.style,x6=qd.clear,Cy=qd.figures,gae=qd.wrap,yae=qd.entriesToDisplay,vae=qe(),bae=vae.cursor,TD=class extends hae{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((r,i)=>(typeof r=="string"&&(r={title:r,value:i}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?i:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=x6("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
112
112
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
113
113
|
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(t,r){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(bae.hide):this.out.write(x6(this.outputText,this.out.columns)),super.render();let t=yae(this.cursor,this.choices.length,this.optionsPerPage),r=t.startIndex,i=t.endIndex;if(this.outputText=[E6.symbol(this.done,this.aborted),bi.bold(this.msg),E6.delimiter(!1),this.done?this.selection.title:this.selection.disabled?bi.yellow(this.warn):bi.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
114
114
|
`;for(let n=r;n<i;n++){let a,o,s="",u=this.choices[n];n===r&&r>0?o=Cy.arrowUp:n===i-1&&i<this.choices.length?o=Cy.arrowDown:o=" ",u.disabled?(a=this.cursor===n?bi.gray().underline(u.title):bi.strikethrough().gray(u.title),o=(this.cursor===n?bi.bold().gray(Cy.pointer)+" ":" ")+o):(a=this.cursor===n?bi.cyan().underline(u.title):u.title,o=(this.cursor===n?bi.cyan(Cy.pointer)+" ":" ")+o,u.description&&this.cursor===n&&(s=` - ${u.description}`,(o.length+a.length+s.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(s=`
|
|
115
115
|
`+gae(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${a}${bi.gray(s)}
|
|
116
|
-
`}}this.out.write(this.outputText)}};A6.exports=TD});var k6=P((
|
|
116
|
+
`}}this.out.write(this.outputText)}};A6.exports=TD});var k6=P((XCe,w6)=>{"use strict";var Iy=Ke(),Sae=vi(),I6=tn(),T6=I6.style,Eae=I6.clear,D6=qe(),C6=D6.cursor,xae=D6.erase,CD=class extends Sae{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
117
117
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
118
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,r){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(C6.hide):this.out.write(Eae(this.outputText,this.out.columns)),super.render(),this.outputText=[T6.symbol(this.done,this.aborted),Iy.bold(this.msg),T6.delimiter(this.done),this.value?this.inactive:Iy.cyan().underline(this.inactive),Iy.gray("/"),this.value?Iy.cyan().underline(this.active):this.active].join(" "),this.out.write(xae.line+C6.to(0)+this.outputText))}};w6.exports=CD});var kn=P((
|
|
118
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,r){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(C6.hide):this.out.write(Eae(this.outputText,this.out.columns)),super.render(),this.outputText=[T6.symbol(this.done,this.aborted),Iy.bold(this.msg),T6.delimiter(this.done),this.value?this.inactive:Iy.cyan().underline(this.inactive),Iy.gray("/"),this.value?Iy.cyan().underline(this.active):this.active].join(" "),this.out.write(xae.line+C6.to(0)+this.outputText))}};w6.exports=CD});var kn=P((YCe,N6)=>{"use strict";var ID=class e{constructor({token:t,date:r,parts:i,locales:n}){this.token=t,this.date=r||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((r,i)=>i>t&&r instanceof e)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),r=t.indexOf(this);return t.find((i,n)=>n>r&&i instanceof e)}toString(){return String(this.date)}};N6.exports=ID});var R6=P((QCe,P6)=>{"use strict";var Aae=kn(),DD=class extends Aae{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};P6.exports=DD});var $6=P((eIe,O6)=>{"use strict";var _ae=kn(),Tae=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),wD=class extends _ae{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Tae(t):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:t}};O6.exports=wD});var M6=P((tIe,j6)=>{"use strict";var Cae=kn(),kD=class extends Cae{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};j6.exports=kD});var L6=P((rIe,F6)=>{"use strict";var Iae=kn(),ND=class extends Iae{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};F6.exports=ND});var z6=P((nIe,U6)=>{"use strict";var Dae=kn(),PD=class extends Dae{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};U6.exports=PD});var G6=P((iIe,B6)=>{"use strict";var wae=kn(),RD=class extends wae{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),r=this.token.length;return r===2?String(t+1).padStart(2,"0"):r===3?this.locales.monthsShort[t]:r===4?this.locales.months[t]:String(t+1)}};B6.exports=RD});var W6=P((aIe,V6)=>{"use strict";var kae=kn(),OD=class extends kae{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};V6.exports=OD});var q6=P((oIe,K6)=>{"use strict";var Nae=kn(),$D=class extends Nae{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};K6.exports=$D});var H6=P((sIe,Z6)=>{"use strict";Z6.exports={DatePart:kn(),Meridiem:R6(),Day:$6(),Hours:M6(),Milliseconds:L6(),Minutes:z6(),Month:G6(),Seconds:W6(),Year:q6()}});var aG=P((cIe,iG)=>{"use strict";function J6(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function X6(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){J6(a,i,n,o,s,"next",u)}function s(u){J6(a,i,n,o,s,"throw",u)}o(void 0)})}}var jD=Ke(),Pae=vi(),FD=tn(),Y6=FD.style,Q6=FD.clear,Rae=FD.figures,nG=qe(),Oae=nG.erase,eG=nG.cursor,Si=H6(),tG=Si.DatePart,$ae=Si.Meridiem,jae=Si.Day,Mae=Si.Hours,Fae=Si.Milliseconds,Lae=Si.Minutes,Uae=Si.Month,zae=Si.Seconds,Bae=Si.Year,Gae=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,rG={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new jae(e),3:e=>new Uae(e),4:e=>new Bae(e),5:e=>new $ae(e),6:e=>new Mae(e),7:e=>new Lae(e),8:e=>new zae(e),9:e=>new Fae(e)},Vae={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},MD=class extends Pae{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Vae,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Q6("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let r;for(this.parts=[];r=Gae.exec(t);){let n=r.shift(),a=r.findIndex(o=>o!=null);this.parts.push(a in rG?rG[a]({token:r[a]||n,date:this.date,parts:this.parts,locales:this.locales}):r[a]||n)}let i=this.parts.reduce((n,a)=>(typeof a=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=a:n.push(a),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof tG)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
119
119
|
`),this.close()}validate(){var t=this;return X6(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return X6(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
120
120
|
`),t.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(r=>r instanceof tG)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(eG.hide):this.out.write(Q6(this.outputText,this.out.columns)),super.render(),this.outputText=[Y6.symbol(this.done,this.aborted),jD.bold(this.msg),Y6.delimiter(!1),this.parts.reduce((t,r,i)=>t.concat(i===this.cursor&&!this.done?jD.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
121
121
|
`).reduce((t,r,i)=>t+`
|
|
122
|
-
${i?" ":Rae.pointerSmall} ${jD.red().italic(r)}`,"")),this.out.write(Oae.line+eG.to(0)+this.outputText))}};iG.exports=MD});var pG=P((
|
|
122
|
+
${i?" ":Rae.pointerSmall} ${jD.red().italic(r)}`,"")),this.out.write(Oae.line+eG.to(0)+this.outputText))}};iG.exports=MD});var pG=P((uIe,dG)=>{"use strict";function oG(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function sG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){oG(a,i,n,o,s,"next",u)}function s(u){oG(a,i,n,o,s,"throw",u)}o(void 0)})}}var Dy=Ke(),Wae=vi(),lG=qe(),wy=lG.cursor,Kae=lG.erase,ky=tn(),LD=ky.style,qae=ky.figures,cG=ky.clear,Zae=ky.lines,Hae=/[0-9]/,UD=e=>e!==void 0,uG=(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r},zD=class extends Wae{constructor(t={}){super(t),this.transform=LD.render(t.style),this.msg=t.message,this.initial=UD(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=UD(t.min)?t.min:-1/0,this.max=UD(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=Dy.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${uG(t,this.round)}`),this._value=uG(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||Hae.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
123
123
|
`),this.close()}validate(){var t=this;return sG(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return sG(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}let r=t.value;t.value=r!==""?r:t.initial,t.done=!0,t.aborted=!1,t.error=!1,t.fire(),t.render(),t.out.write(`
|
|
124
124
|
`),t.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,r){if(!this.valid(t))return this.bell();let i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(wy.down(Zae(this.outputError,this.out.columns)-1)+cG(this.outputError,this.out.columns)),this.out.write(cG(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[LD.symbol(this.done,this.aborted),Dy.bold(this.msg),LD.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Dy[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
125
125
|
`).reduce((t,r,i)=>t+`
|
|
126
|
-
${i?" ":qae.pointerSmall} ${Dy.red().italic(r)}`,"")),this.out.write(Kae.line+wy.to(0)+this.outputText+wy.save+this.outputError+wy.restore))}};dG.exports=zD});var GD=P((
|
|
126
|
+
${i?" ":qae.pointerSmall} ${Dy.red().italic(r)}`,"")),this.out.write(Kae.line+wy.to(0)+this.outputText+wy.save+this.outputError+wy.restore))}};dG.exports=zD});var GD=P((lIe,hG)=>{"use strict";var Nn=Ke(),Jae=qe(),Xae=Jae.cursor,Yae=vi(),Zd=tn(),mG=Zd.clear,ca=Zd.figures,fG=Zd.style,Qae=Zd.wrap,eoe=Zd.entriesToDisplay,BD=class extends Yae{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((r,i)=>(typeof r=="string"&&(r={title:r,value:i}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?i:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=mG("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
127
127
|
`),this.close()}submit(){let t=this.value.filter(r=>r.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
128
128
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=t),this.render()}_(t,r){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
129
129
|
Instructions:
|
|
@@ -133,13 +133,13 @@ Instructions:
|
|
|
133
133
|
`:"")+" enter/return: Complete answer":""}renderOption(t,r,i,n){let a=(r.selected?Nn.green(ca.radioOn):ca.radioOff)+" "+n+" ",o,s;return r.disabled?o=t===i?Nn.gray().underline(r.title):Nn.strikethrough().gray(r.title):(o=t===i?Nn.cyan().underline(r.title):r.title,t===i&&r.description&&(s=` - ${r.description}`,(a.length+o.length+s.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(s=`
|
|
134
134
|
`+Qae(r.description,{margin:a.length,width:this.out.columns})))),a+o+Nn.gray(s||"")}paginateOptions(t){if(t.length===0)return Nn.red("No matches for this query.");let r=eoe(this.cursor,t.length,this.optionsPerPage),i=r.startIndex,n=r.endIndex,a,o=[];for(let s=i;s<n;s++)s===i&&i>0?a=ca.arrowUp:s===n-1&&n<t.length?a=ca.arrowDown:a=" ",o.push(this.renderOption(this.cursor,t[s],s,a));return`
|
|
135
135
|
`+o.join(`
|
|
136
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Nn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Nn.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Xae.hide),super.render();let t=[fG.symbol(this.done,this.aborted),Nn.bold(this.msg),fG.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Nn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=mG(t,this.out.columns)}};hG.exports=BD});var xG=P((
|
|
136
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Nn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Nn.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Xae.hide),super.render();let t=[fG.symbol(this.done,this.aborted),Nn.bold(this.msg),fG.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Nn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=mG(t,this.out.columns)}};hG.exports=BD});var xG=P((dIe,EG)=>{"use strict";function gG(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function toe(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){gG(a,i,n,o,s,"next",u)}function s(u){gG(a,i,n,o,s,"throw",u)}o(void 0)})}}var Hd=Ke(),roe=vi(),SG=qe(),noe=SG.erase,yG=SG.cursor,Jd=tn(),VD=Jd.style,vG=Jd.clear,WD=Jd.figures,ioe=Jd.wrap,aoe=Jd.entriesToDisplay,bG=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),ooe=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),soe=(e,t)=>{let r=e.findIndex(i=>i.value===t||i.title===t);return r>-1?r:void 0},KD=class extends roe{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:soe(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=VD.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=vG("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=bG(this.suggestions,t):this.value=this.fallback.value,this.fire()}complete(t){var r=this;return toe(function*(){let i=r.completing=r.suggest(r.input,r.choices),n=yield i;if(r.completing!==i)return;r.suggestions=n.map((o,s,u)=>({title:ooe(u,s),value:bG(u,s),description:o.description})),r.completing=!1;let a=Math.max(n.length-1,0);r.moveSelect(Math.min(a,r.select)),t&&t()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
137
137
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
138
138
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
139
139
|
`),this.close()}_(t,r){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${t}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${t}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,r,i,n){let a,o=i?WD.arrowUp:n?WD.arrowDown:" ",s=r?Hd.cyan().underline(t.title):t.title;return o=(r?Hd.cyan(WD.pointer)+" ":" ")+o,t.description&&(a=` - ${t.description}`,(o.length+s.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
|
|
140
140
|
`+ioe(t.description,{margin:3,width:this.out.columns}))),o+" "+s+Hd.gray(a||"")}render(){if(this.closed)return;this.firstRender?this.out.write(yG.hide):this.out.write(vG(this.outputText,this.out.columns)),super.render();let t=aoe(this.select,this.choices.length,this.limit),r=t.startIndex,i=t.endIndex;if(this.outputText=[VD.symbol(this.done,this.aborted,this.exited),Hd.bold(this.msg),VD.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let n=this.suggestions.slice(r,i).map((a,o)=>this.renderOption(a,this.select===o+r,o===0&&r>0,o+r===i-1&&i<this.choices.length)).join(`
|
|
141
141
|
`);this.outputText+=`
|
|
142
|
-
`+(n||Hd.gray(this.fallback.title))}this.out.write(noe.line+yG.to(0)+this.outputText)}};EG.exports=KD});var CG=P((
|
|
142
|
+
`+(n||Hd.gray(this.fallback.title))}this.out.write(noe.line+yG.to(0)+this.outputText)}};EG.exports=KD});var CG=P((pIe,TG)=>{"use strict";var Ei=Ke(),coe=qe(),uoe=coe.cursor,loe=GD(),ZD=tn(),AG=ZD.clear,_G=ZD.style,Vc=ZD.figures,qD=class extends loe{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=AG("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(i=>i===t);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,r){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
143
143
|
Instructions:
|
|
144
144
|
${Vc.arrowUp}/${Vc.arrowDown}: Highlight option
|
|
145
145
|
${Vc.arrowLeft}/${Vc.arrowRight}/[space]: Toggle selection
|
|
@@ -147,31 +147,31 @@ Instructions:
|
|
|
147
147
|
enter/return: Complete answer
|
|
148
148
|
`:""}renderCurrentInput(){return`
|
|
149
149
|
Filtered results for: ${this.inputValue?this.inputValue:Ei.gray("Enter something to filter")}
|
|
150
|
-
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?Ei.gray().underline(r.title):Ei.strikethrough().gray(r.title):n=t===i?Ei.cyan().underline(r.title):r.title,(r.selected?Ei.green(Vc.radioOn):Vc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Ei.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Ei.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(uoe.hide),super.render();let t=[_G.symbol(this.done,this.aborted),Ei.bold(this.msg),_G.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Ei.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=AG(t,this.out.columns)}};TG.exports=qD});var RG=P((
|
|
150
|
+
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?Ei.gray().underline(r.title):Ei.strikethrough().gray(r.title):n=t===i?Ei.cyan().underline(r.title):r.title,(r.selected?Ei.green(Vc.radioOn):Vc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Ei.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Ei.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(uoe.hide),super.render();let t=[_G.symbol(this.done,this.aborted),Ei.bold(this.msg),_G.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Ei.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=AG(t,this.out.columns)}};TG.exports=qD});var RG=P((mIe,PG)=>{"use strict";var IG=Ke(),doe=vi(),kG=tn(),DG=kG.style,poe=kG.clear,NG=qe(),moe=NG.erase,wG=NG.cursor,HD=class extends doe{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
151
151
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
152
|
-
`),this.close()}_(t,r){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(wG.hide):this.out.write(poe(this.outputText,this.out.columns)),super.render(),this.outputText=[DG.symbol(this.done,this.aborted),IG.bold(this.msg),DG.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:IG.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(moe.line+wG.to(0)+this.outputText))}};PG.exports=HD});var $G=P((
|
|
153
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var d=r.next();return a=d.done,d},e:function(d){o=!0,s=d},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function voe(e,t){if(e){if(typeof e=="string")return UG(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return UG(e,t)}}function UG(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function zG(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function BG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){zG(a,i,n,o,s,"next",u)}function s(u){zG(a,i,n,o,s,"throw",u)}o(void 0)})}}var JD=MG(),boe=["suggest","format","onState","validate","onRender","type"],GG=()=>{};function ua(){return XD.apply(this,arguments)}function XD(){return XD=BG(function*(e=[],{onSubmit:t=GG,onCancel:r=GG}={}){let i={},n=ua._override||{};e=[].concat(e);let a,o,s,u,d,p,h=(function(){var y=BG(function*(v,b,A=!1){if(!(!A&&v.validate&&v.validate(b)!==!0))return v.format?yield v.format(b,i):b});return function(b,A){return y.apply(this,arguments)}})();var g=yoe(e),l;try{for(g.s();!(l=g.n()).done;){o=l.value;var m=o;if(u=m.name,d=m.type,typeof d=="function"&&(d=yield d(a,LG({},i),o),o.type=d),!!d){for(let y in o){if(boe.includes(y))continue;let v=o[y];o[y]=typeof v=="function"?yield v(a,LG({},i),p):v}if(p=o,typeof o.message!="string")throw new Error("prompt message is required");var f=o;if(u=f.name,d=f.type,JD[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(n[o.name]!==void 0&&(a=yield h(o,n[o.name]),a!==void 0)){i[u]=a;continue}try{a=ua._injected?Soe(ua._injected,o.initial):yield JD[d](o),i[u]=a=yield h(o,a,!0),s=yield t(o,a,i)}catch{s=!(yield r(o,i))}if(s)return i}}}catch(y){g.e(y)}finally{g.f()}return i}),XD.apply(this,arguments)}function Soe(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function Eoe(e){ua._injected=(ua._injected||[]).concat(e)}function xoe(e){ua._override=Object.assign({},e)}VG.exports=Object.assign(ua,{prompt:ua,prompts:JD,inject:Eoe,override:xoe})});var qG=P((
|
|
152
|
+
`),this.close()}_(t,r){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(wG.hide):this.out.write(poe(this.outputText,this.out.columns)),super.render(),this.outputText=[DG.symbol(this.done,this.aborted),IG.bold(this.msg),DG.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:IG.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(moe.line+wG.to(0)+this.outputText))}};PG.exports=HD});var $G=P((fIe,OG)=>{"use strict";OG.exports={TextPrompt:S6(),SelectPrompt:_6(),TogglePrompt:k6(),DatePrompt:aG(),NumberPrompt:pG(),MultiselectPrompt:GD(),AutocompletePrompt:xG(),AutocompleteMultiselectPrompt:CG(),ConfirmPrompt:RG()}});var MG=P(jG=>{"use strict";var Jt=jG,foe=$G(),Ny=e=>e;function Pn(e,t,r={}){return new Promise((i,n)=>{let a=new foe[e](t),o=r.onAbort||Ny,s=r.onSubmit||Ny,u=r.onExit||Ny;a.on("state",t.onState||Ny),a.on("submit",d=>i(s(d))),a.on("exit",d=>i(u(d))),a.on("abort",d=>n(o(d)))})}Jt.text=e=>Pn("TextPrompt",e);Jt.password=e=>(e.style="password",Jt.text(e));Jt.invisible=e=>(e.style="invisible",Jt.text(e));Jt.number=e=>Pn("NumberPrompt",e);Jt.date=e=>Pn("DatePrompt",e);Jt.confirm=e=>Pn("ConfirmPrompt",e);Jt.list=e=>{let t=e.separator||",";return Pn("TextPrompt",e,{onSubmit:r=>r.split(t).map(i=>i.trim())})};Jt.toggle=e=>Pn("TogglePrompt",e);Jt.select=e=>Pn("SelectPrompt",e);Jt.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return Pn("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Jt.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return Pn("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var hoe=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Jt.autocomplete=e=>(e.suggest=e.suggest||hoe,e.choices=[].concat(e.choices||[]),Pn("AutocompletePrompt",e))});var WG=P((gIe,VG)=>{"use strict";function FG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function LG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?FG(Object(r),!0).forEach(function(i){goe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FG(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function goe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yoe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=voe(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(d){throw d},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
153
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var d=r.next();return a=d.done,d},e:function(d){o=!0,s=d},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function voe(e,t){if(e){if(typeof e=="string")return UG(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return UG(e,t)}}function UG(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function zG(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function BG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){zG(a,i,n,o,s,"next",u)}function s(u){zG(a,i,n,o,s,"throw",u)}o(void 0)})}}var JD=MG(),boe=["suggest","format","onState","validate","onRender","type"],GG=()=>{};function ua(){return XD.apply(this,arguments)}function XD(){return XD=BG(function*(e=[],{onSubmit:t=GG,onCancel:r=GG}={}){let i={},n=ua._override||{};e=[].concat(e);let a,o,s,u,d,p,h=(function(){var y=BG(function*(v,b,A=!1){if(!(!A&&v.validate&&v.validate(b)!==!0))return v.format?yield v.format(b,i):b});return function(b,A){return y.apply(this,arguments)}})();var g=yoe(e),l;try{for(g.s();!(l=g.n()).done;){o=l.value;var m=o;if(u=m.name,d=m.type,typeof d=="function"&&(d=yield d(a,LG({},i),o),o.type=d),!!d){for(let y in o){if(boe.includes(y))continue;let v=o[y];o[y]=typeof v=="function"?yield v(a,LG({},i),p):v}if(p=o,typeof o.message!="string")throw new Error("prompt message is required");var f=o;if(u=f.name,d=f.type,JD[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(n[o.name]!==void 0&&(a=yield h(o,n[o.name]),a!==void 0)){i[u]=a;continue}try{a=ua._injected?Soe(ua._injected,o.initial):yield JD[d](o),i[u]=a=yield h(o,a,!0),s=yield t(o,a,i)}catch{s=!(yield r(o,i))}if(s)return i}}}catch(y){g.e(y)}finally{g.f()}return i}),XD.apply(this,arguments)}function Soe(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function Eoe(e){ua._injected=(ua._injected||[]).concat(e)}function xoe(e){ua._override=Object.assign({},e)}VG.exports=Object.assign(ua,{prompt:ua,prompts:JD,inject:Eoe,override:xoe})});var qG=P((yIe,KG)=>{"use strict";KG.exports=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}});var Py=P((vIe,ZG)=>{"use strict";ZG.exports=e=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(t,"g");return typeof e=="string"?e.replace(r,""):e}});var XG=P((bIe,JG)=>{"use strict";var Aoe=Py(),{erase:HG,cursor:_oe}=qe(),Toe=e=>[...Aoe(e)].length;JG.exports=function(e,t){if(!t)return HG.line+_oe.to(0);let r=0,i=e.split(/\r?\n/);for(let n of i)r+=1+Math.floor(Math.max(Toe(n)-1,0)/t);return HG.lines(r)}});var YD=P((SIe,YG)=>{"use strict";var Xd={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Coe={arrowUp:Xd.arrowUp,arrowDown:Xd.arrowDown,arrowLeft:Xd.arrowLeft,arrowRight:Xd.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Ioe=process.platform==="win32"?Coe:Xd;YG.exports=Ioe});var eV=P((EIe,QG)=>{"use strict";var Wc=Ke(),Io=YD(),QD=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),Doe=e=>QD[e]||QD.default,Yd=Object.freeze({aborted:Wc.red(Io.cross),done:Wc.green(Io.tick),exited:Wc.yellow(Io.cross),default:Wc.cyan("?")}),woe=(e,t,r)=>t?Yd.aborted:r?Yd.exited:e?Yd.done:Yd.default,koe=e=>Wc.gray(e?Io.ellipsis:Io.pointerSmall),Noe=(e,t)=>Wc.gray(e?t?Io.pointerSmall:"+":Io.line);QG.exports={styles:QD,render:Doe,symbols:Yd,symbol:woe,delimiter:koe,item:Noe}});var rV=P((xIe,tV)=>{"use strict";var Poe=Py();tV.exports=function(e,t){let r=String(Poe(e)||"").split(/\r?\n/);return t?r.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):r.length}});var iV=P((AIe,nV)=>{"use strict";nV.exports=(e,t={})=>{let r=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((a,o)=>(o.length+r.length>=i||a[a.length-1].length+o.length+1<i?a[a.length-1]+=` ${o}`:a.push(`${r}${o}`),a),[r]).join(`
|
|
154
154
|
`)).join(`
|
|
155
|
-
`)}});var oV=P((
|
|
155
|
+
`)}});var oV=P((_Ie,aV)=>{"use strict";aV.exports=(e,t,r)=>{r=r||t;let i=Math.min(t-r,e-Math.floor(r/2));i<0&&(i=0);let n=Math.min(i+r,t);return{startIndex:i,endIndex:n}}});var rn=P((TIe,sV)=>{"use strict";sV.exports={action:qG(),clear:XG(),style:eV(),strip:Py(),figures:YD(),lines:rV(),wrap:iV(),entriesToDisplay:oV()}});var xi=P((CIe,uV)=>{"use strict";var cV=No("readline"),{action:Roe}=rn(),Ooe=No("events"),{beep:$oe,cursor:joe}=qe(),Moe=Ke(),ew=class extends Ooe{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let r=cV.createInterface({input:this.in,escapeCodeTimeout:50});cV.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(a,o)=>{let s=Roe(o,i);s===!1?this._&&this._(a,o):typeof this[s]=="function"?this[s](o):this.bell()};this.close=()=>{this.out.write(joe.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write($oe)}render(){this.onRender(Moe),this.firstRender&&(this.firstRender=!1)}};uV.exports=ew});var dV=P((IIe,lV)=>{var Ry=Ke(),Foe=xi(),{erase:Loe,cursor:Qd}=qe(),{style:tw,clear:rw,lines:Uoe,figures:zoe}=rn(),nw=class extends Foe{constructor(t={}){super(t),this.transform=tw.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=rw("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Ry.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
156
156
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
157
157
|
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,r){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${t}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${t}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Qd.down(Uoe(this.outputError,this.out.columns)-1)+rw(this.outputError,this.out.columns)),this.out.write(rw(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[tw.symbol(this.done,this.aborted),Ry.bold(this.msg),tw.delimiter(this.done),this.red?Ry.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
158
158
|
`).reduce((t,r,i)=>t+`
|
|
159
|
-
${i?" ":zoe.pointerSmall} ${Ry.red().italic(r)}`,"")),this.out.write(Loe.line+Qd.to(0)+this.outputText+Qd.save+this.outputError+Qd.restore+Qd.move(this.cursorOffset,0)))}};lV.exports=nw});var hV=P((
|
|
159
|
+
${i?" ":zoe.pointerSmall} ${Ry.red().italic(r)}`,"")),this.out.write(Loe.line+Qd.to(0)+this.outputText+Qd.save+this.outputError+Qd.restore+Qd.move(this.cursorOffset,0)))}};lV.exports=nw});var hV=P((DIe,fV)=>{"use strict";var Ai=Ke(),Boe=xi(),{style:pV,clear:mV,figures:Oy,wrap:Goe,entriesToDisplay:Voe}=rn(),{cursor:Woe}=qe(),iw=class extends Boe{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((r,i)=>(typeof r=="string"&&(r={title:r,value:i}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?i:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=mV("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
160
160
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
161
161
|
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(t,r){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Woe.hide):this.out.write(mV(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:r}=Voe(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[pV.symbol(this.done,this.aborted),Ai.bold(this.msg),pV.delimiter(!1),this.done?this.selection.title:this.selection.disabled?Ai.yellow(this.warn):Ai.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
162
162
|
`;for(let i=t;i<r;i++){let n,a,o="",s=this.choices[i];i===t&&t>0?a=Oy.arrowUp:i===r-1&&r<this.choices.length?a=Oy.arrowDown:a=" ",s.disabled?(n=this.cursor===i?Ai.gray().underline(s.title):Ai.strikethrough().gray(s.title),a=(this.cursor===i?Ai.bold().gray(Oy.pointer)+" ":" ")+a):(n=this.cursor===i?Ai.cyan().underline(s.title):s.title,a=(this.cursor===i?Ai.cyan(Oy.pointer)+" ":" ")+a,s.description&&this.cursor===i&&(o=` - ${s.description}`,(a.length+n.length+o.length>=this.out.columns||s.description.split(/\r?\n/).length>1)&&(o=`
|
|
163
163
|
`+Goe(s.description,{margin:3,width:this.out.columns})))),this.outputText+=`${a} ${n}${Ai.gray(o)}
|
|
164
|
-
`}}this.out.write(this.outputText)}};fV.exports=iw});var bV=P((
|
|
164
|
+
`}}this.out.write(this.outputText)}};fV.exports=iw});var bV=P((wIe,vV)=>{var $y=Ke(),Koe=xi(),{style:gV,clear:qoe}=rn(),{cursor:yV,erase:Zoe}=qe(),aw=class extends Koe{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
165
165
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
166
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,r){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(yV.hide):this.out.write(qoe(this.outputText,this.out.columns)),super.render(),this.outputText=[gV.symbol(this.done,this.aborted),$y.bold(this.msg),gV.delimiter(this.done),this.value?this.inactive:$y.cyan().underline(this.inactive),$y.gray("/"),this.value?$y.cyan().underline(this.active):this.active].join(" "),this.out.write(Zoe.line+yV.to(0)+this.outputText))}};vV.exports=aw});var Rn=P((
|
|
166
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,r){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(yV.hide):this.out.write(qoe(this.outputText,this.out.columns)),super.render(),this.outputText=[gV.symbol(this.done,this.aborted),$y.bold(this.msg),gV.delimiter(this.done),this.value?this.inactive:$y.cyan().underline(this.inactive),$y.gray("/"),this.value?$y.cyan().underline(this.active):this.active].join(" "),this.out.write(Zoe.line+yV.to(0)+this.outputText))}};vV.exports=aw});var Rn=P((kIe,SV)=>{"use strict";var ow=class e{constructor({token:t,date:r,parts:i,locales:n}){this.token=t,this.date=r||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((r,i)=>i>t&&r instanceof e)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),r=t.indexOf(this);return t.find((i,n)=>n>r&&i instanceof e)}toString(){return String(this.date)}};SV.exports=ow});var xV=P((NIe,EV)=>{"use strict";var Hoe=Rn(),sw=class extends Hoe{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};EV.exports=sw});var _V=P((PIe,AV)=>{"use strict";var Joe=Rn(),Xoe=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),cw=class extends Joe{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Xoe(t):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:t}};AV.exports=cw});var CV=P((RIe,TV)=>{"use strict";var Yoe=Rn(),uw=class extends Yoe{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};TV.exports=uw});var DV=P((OIe,IV)=>{"use strict";var Qoe=Rn(),lw=class extends Qoe{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};IV.exports=lw});var kV=P(($Ie,wV)=>{"use strict";var ese=Rn(),dw=class extends ese{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};wV.exports=dw});var PV=P((jIe,NV)=>{"use strict";var tse=Rn(),pw=class extends tse{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),r=this.token.length;return r===2?String(t+1).padStart(2,"0"):r===3?this.locales.monthsShort[t]:r===4?this.locales.months[t]:String(t+1)}};NV.exports=pw});var OV=P((MIe,RV)=>{"use strict";var rse=Rn(),mw=class extends rse{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};RV.exports=mw});var jV=P((FIe,$V)=>{"use strict";var nse=Rn(),fw=class extends nse{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};$V.exports=fw});var FV=P((LIe,MV)=>{"use strict";MV.exports={DatePart:Rn(),Meridiem:xV(),Day:_V(),Hours:CV(),Milliseconds:DV(),Minutes:kV(),Month:PV(),Seconds:OV(),Year:jV()}});var WV=P((UIe,VV)=>{"use strict";var hw=Ke(),ise=xi(),{style:LV,clear:UV,figures:ase}=rn(),{erase:ose,cursor:zV}=qe(),{DatePart:BV,Meridiem:sse,Day:cse,Hours:use,Milliseconds:lse,Minutes:dse,Month:pse,Seconds:mse,Year:fse}=FV(),hse=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,GV={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new cse(e),3:e=>new pse(e),4:e=>new fse(e),5:e=>new sse(e),6:e=>new use(e),7:e=>new dse(e),8:e=>new mse(e),9:e=>new lse(e)},gse={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},gw=class extends ise{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(gse,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=UV("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let r;for(this.parts=[];r=hse.exec(t);){let n=r.shift(),a=r.findIndex(o=>o!=null);this.parts.push(a in GV?GV[a]({token:r[a]||n,date:this.date,parts:this.parts,locales:this.locales}):r[a]||n)}let i=this.parts.reduce((n,a)=>(typeof a=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=a:n.push(a),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof BV)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
167
167
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
168
168
|
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(r=>r instanceof BV)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(zV.hide):this.out.write(UV(this.outputText,this.out.columns)),super.render(),this.outputText=[LV.symbol(this.done,this.aborted),hw.bold(this.msg),LV.delimiter(!1),this.parts.reduce((t,r,i)=>t.concat(i===this.cursor&&!this.done?hw.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
169
169
|
`).reduce((t,r,i)=>t+`
|
|
170
|
-
${i?" ":ase.pointerSmall} ${hw.red().italic(r)}`,"")),this.out.write(ose.line+zV.to(0)+this.outputText))}};VV.exports=gw});var HV=P((
|
|
170
|
+
${i?" ":ase.pointerSmall} ${hw.red().italic(r)}`,"")),this.out.write(ose.line+zV.to(0)+this.outputText))}};VV.exports=gw});var HV=P((zIe,ZV)=>{var jy=Ke(),yse=xi(),{cursor:My,erase:vse}=qe(),{style:yw,figures:bse,clear:KV,lines:Sse}=rn(),Ese=/[0-9]/,vw=e=>e!==void 0,qV=(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r},bw=class extends yse{constructor(t={}){super(t),this.transform=yw.render(t.style),this.msg=t.message,this.initial=vw(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=vw(t.min)?t.min:-1/0,this.max=vw(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=jy.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${qV(t,this.round)}`),this._value=qV(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||Ese.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
171
171
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
172
172
|
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,r){if(!this.valid(t))return this.bell();let i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(My.down(Sse(this.outputError,this.out.columns)-1)+KV(this.outputError,this.out.columns)),this.out.write(KV(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[yw.symbol(this.done,this.aborted),jy.bold(this.msg),yw.delimiter(this.done),!this.done||!this.done&&!this.placeholder?jy[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
173
173
|
`).reduce((t,r,i)=>t+`
|
|
174
|
-
${i?" ":bse.pointerSmall} ${jy.red().italic(r)}`,"")),this.out.write(vse.line+My.to(0)+this.outputText+My.save+this.outputError+My.restore))}};ZV.exports=bw});var Ew=P((
|
|
174
|
+
${i?" ":bse.pointerSmall} ${jy.red().italic(r)}`,"")),this.out.write(vse.line+My.to(0)+this.outputText+My.save+this.outputError+My.restore))}};ZV.exports=bw});var Ew=P((BIe,YV)=>{"use strict";var On=Ke(),{cursor:xse}=qe(),Ase=xi(),{clear:JV,figures:la,style:XV,wrap:_se,entriesToDisplay:Tse}=rn(),Sw=class extends Ase{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((r,i)=>(typeof r=="string"&&(r={title:r,value:i}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?i:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=JV("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
175
175
|
`),this.close()}submit(){let t=this.value.filter(r=>r.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
176
176
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=t),this.render()}_(t,r){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
177
177
|
Instructions:
|
|
@@ -181,13 +181,13 @@ Instructions:
|
|
|
181
181
|
`:"")+" enter/return: Complete answer":""}renderOption(t,r,i,n){let a=(r.selected?On.green(la.radioOn):la.radioOff)+" "+n+" ",o,s;return r.disabled?o=t===i?On.gray().underline(r.title):On.strikethrough().gray(r.title):(o=t===i?On.cyan().underline(r.title):r.title,t===i&&r.description&&(s=` - ${r.description}`,(a.length+o.length+s.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(s=`
|
|
182
182
|
`+_se(r.description,{margin:a.length,width:this.out.columns})))),a+o+On.gray(s||"")}paginateOptions(t){if(t.length===0)return On.red("No matches for this query.");let{startIndex:r,endIndex:i}=Tse(this.cursor,t.length,this.optionsPerPage),n,a=[];for(let o=r;o<i;o++)o===r&&r>0?n=la.arrowUp:o===i-1&&i<t.length?n=la.arrowDown:n=" ",a.push(this.renderOption(this.cursor,t[o],o,n));return`
|
|
183
183
|
`+a.join(`
|
|
184
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[On.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(On.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(xse.hide),super.render();let t=[XV.symbol(this.done,this.aborted),On.bold(this.msg),XV.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=On.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=JV(t,this.out.columns)}};YV.exports=Sw});var n3=P((
|
|
184
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[On.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(On.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(xse.hide),super.render();let t=[XV.symbol(this.done,this.aborted),On.bold(this.msg),XV.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=On.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=JV(t,this.out.columns)}};YV.exports=Sw});var n3=P((GIe,r3)=>{"use strict";var ep=Ke(),Cse=xi(),{erase:Ise,cursor:QV}=qe(),{style:xw,clear:e3,figures:Aw,wrap:Dse,entriesToDisplay:wse}=rn(),t3=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),kse=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),Nse=(e,t)=>{let r=e.findIndex(i=>i.value===t||i.title===t);return r>-1?r:void 0},_w=class extends Cse{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:Nse(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=xw.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=e3("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=t3(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){let r=this.completing=this.suggest(this.input,this.choices),i=await r;if(this.completing!==r)return;this.suggestions=i.map((a,o,s)=>({title:kse(s,o),value:t3(s,o),description:a.description})),this.completing=!1;let n=Math.max(i.length-1,0);this.moveSelect(Math.min(n,this.select)),t&&t()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
185
185
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
186
186
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
187
187
|
`),this.close()}_(t,r){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${t}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${t}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,r,i,n){let a,o=i?Aw.arrowUp:n?Aw.arrowDown:" ",s=r?ep.cyan().underline(t.title):t.title;return o=(r?ep.cyan(Aw.pointer)+" ":" ")+o,t.description&&(a=` - ${t.description}`,(o.length+s.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
|
|
188
188
|
`+Dse(t.description,{margin:3,width:this.out.columns}))),o+" "+s+ep.gray(a||"")}render(){if(this.closed)return;this.firstRender?this.out.write(QV.hide):this.out.write(e3(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:r}=wse(this.select,this.choices.length,this.limit);if(this.outputText=[xw.symbol(this.done,this.aborted,this.exited),ep.bold(this.msg),xw.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let i=this.suggestions.slice(t,r).map((n,a)=>this.renderOption(n,this.select===a+t,a===0&&t>0,a+t===r-1&&r<this.choices.length)).join(`
|
|
189
189
|
`);this.outputText+=`
|
|
190
|
-
`+(i||ep.gray(this.fallback.title))}this.out.write(Ise.line+QV.to(0)+this.outputText)}};r3.exports=_w});var s3=P((
|
|
190
|
+
`+(i||ep.gray(this.fallback.title))}this.out.write(Ise.line+QV.to(0)+this.outputText)}};r3.exports=_w});var s3=P((VIe,o3)=>{"use strict";var _i=Ke(),{cursor:Pse}=qe(),Rse=Ew(),{clear:i3,style:a3,figures:Kc}=rn(),Tw=class extends Rse{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=i3("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(i=>i===t);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,r){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
191
191
|
Instructions:
|
|
192
192
|
${Kc.arrowUp}/${Kc.arrowDown}: Highlight option
|
|
193
193
|
${Kc.arrowLeft}/${Kc.arrowRight}/[space]: Toggle selection
|
|
@@ -195,9 +195,9 @@ Instructions:
|
|
|
195
195
|
enter/return: Complete answer
|
|
196
196
|
`:""}renderCurrentInput(){return`
|
|
197
197
|
Filtered results for: ${this.inputValue?this.inputValue:_i.gray("Enter something to filter")}
|
|
198
|
-
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?_i.gray().underline(r.title):_i.strikethrough().gray(r.title):n=t===i?_i.cyan().underline(r.title):r.title,(r.selected?_i.green(Kc.radioOn):Kc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[_i.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(_i.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Pse.hide),super.render();let t=[a3.symbol(this.done,this.aborted),_i.bold(this.msg),a3.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=_i.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=i3(t,this.out.columns)}};o3.exports=Tw});var p3=P((
|
|
198
|
+
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?_i.gray().underline(r.title):_i.strikethrough().gray(r.title):n=t===i?_i.cyan().underline(r.title):r.title,(r.selected?_i.green(Kc.radioOn):Kc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[_i.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(_i.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Pse.hide),super.render();let t=[a3.symbol(this.done,this.aborted),_i.bold(this.msg),a3.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=_i.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=i3(t,this.out.columns)}};o3.exports=Tw});var p3=P((WIe,d3)=>{var c3=Ke(),Ose=xi(),{style:u3,clear:$se}=rn(),{erase:jse,cursor:l3}=qe(),Cw=class extends Ose{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
199
199
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
200
|
-
`),this.close()}_(t,r){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(l3.hide):this.out.write($se(this.outputText,this.out.columns)),super.render(),this.outputText=[u3.symbol(this.done,this.aborted),c3.bold(this.msg),u3.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:c3.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(jse.line+l3.to(0)+this.outputText))}};d3.exports=Cw});var f3=P((VIe,m3)=>{"use strict";m3.exports={TextPrompt:dV(),SelectPrompt:hV(),TogglePrompt:bV(),DatePrompt:WV(),NumberPrompt:HV(),MultiselectPrompt:Ew(),AutocompletePrompt:n3(),AutocompleteMultiselectPrompt:s3(),ConfirmPrompt:p3()}});var g3=P(h3=>{"use strict";var Xt=h3,Mse=f3(),Fy=e=>e;function $n(e,t,r={}){return new Promise((i,n)=>{let a=new Mse[e](t),o=r.onAbort||Fy,s=r.onSubmit||Fy,u=r.onExit||Fy;a.on("state",t.onState||Fy),a.on("submit",d=>i(s(d))),a.on("exit",d=>i(u(d))),a.on("abort",d=>n(o(d)))})}Xt.text=e=>$n("TextPrompt",e);Xt.password=e=>(e.style="password",Xt.text(e));Xt.invisible=e=>(e.style="invisible",Xt.text(e));Xt.number=e=>$n("NumberPrompt",e);Xt.date=e=>$n("DatePrompt",e);Xt.confirm=e=>$n("ConfirmPrompt",e);Xt.list=e=>{let t=e.separator||",";return $n("TextPrompt",e,{onSubmit:r=>r.split(t).map(i=>i.trim())})};Xt.toggle=e=>$n("TogglePrompt",e);Xt.select=e=>$n("SelectPrompt",e);Xt.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return $n("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Xt.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return $n("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var Fse=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Xt.autocomplete=e=>(e.suggest=e.suggest||Fse,e.choices=[].concat(e.choices||[]),$n("AutocompletePrompt",e))});var b3=P((KIe,v3)=>{"use strict";var Iw=g3(),Lse=["suggest","format","onState","validate","onRender","type"],y3=()=>{};async function da(e=[],{onSubmit:t=y3,onCancel:r=y3}={}){let i={},n=da._override||{};e=[].concat(e);let a,o,s,u,d,p,h=async(g,l,m=!1)=>{if(!(!m&&g.validate&&g.validate(l)!==!0))return g.format?await g.format(l,i):l};for(o of e)if({name:u,type:d}=o,typeof d=="function"&&(d=await d(a,{...i},o),o.type=d),!!d){for(let g in o){if(Lse.includes(g))continue;let l=o[g];o[g]=typeof l=="function"?await l(a,{...i},p):l}if(p=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:d}=o,Iw[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(n[o.name]!==void 0&&(a=await h(o,n[o.name]),a!==void 0)){i[u]=a;continue}try{a=da._injected?Use(da._injected,o.initial):await Iw[d](o),i[u]=a=await h(o,a,!0),s=await t(o,a,i)}catch{s=!await r(o,i)}if(s)return i}return i}function Use(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function zse(e){da._injected=(da._injected||[]).concat(e)}function Bse(e){da._override=Object.assign({},e)}v3.exports=Object.assign(da,{prompt:da,prompts:Iw,inject:zse,override:Bse})});var E3=P((qIe,S3)=>{function Gse(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,r=process.versions.node.split(".").map(Number);for(;t<e.length;t++){if(r[t]>e[t])return!1;if(e[t]>r[t])return!0}return!1}S3.exports=Gse("8.6.0")?WG():b3()});import{join as Sr,dirname as P1,normalize as b9}from"node:path";import{readFileSync as R1,existsSync as O1}from"node:fs";var k3=Object.defineProperty,Ci=(e,t)=>k3(e,"name",{value:t,configurable:!0});function Qe(e){return e.replace(/[-_](.)/g,(t,r)=>r.toUpperCase()).replace(/^./,t=>t.toUpperCase())}Ci(Qe,"toPascalCase");function gr(e){return e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}Ci(gr,"toKebab");function Ro(e){return gr(e).replace(/-/g,"_")}Ci(Ro,"toValidDatabaseName");function Ow(e){return gr(e).replace(/-/g,"_").toUpperCase()}Ci(Ow,"toScreamingSnake");function $w(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}Ci($w,"capitalise");function jw(e){return e.split(".").join("")}Ci(jw,"getSafeZoneName");function fa(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}Ci(fa,"accountConstructKey");function Mw(e){let t=e.replace(new RegExp("\\P{ASCII}","gu"),"");return fa(t)===fa(e)&&fa(e)!==""}Ci(Mw,"hasAsciiStableConstructKey");var N3=Object.defineProperty,Oo=(e,t)=>N3(e,"name",{value:t,configurable:!0});function $o(e){return`${Qe(e.split(".").join(""))}Domain`}Oo($o,"getDomainStackName");function Fw(e){return`${e}UsEast1Certificates`}Oo(Fw,"getDomainUsEast1CertificatesStackName");function qy(e){let t=e.replace(/\./g,"-");return{hostedZoneId:`${t}-hosted-zone-id`,certificateArn:`${t}-certificate-arn`,certificateHosts:`${t}-certificate-hosts`,usEast1CertificateArn:`${t}-us-east-1-certificate-arn`,usEast1CertificateHosts:`${t}-us-east-1-certificate-hosts`,delegationRoleArn:`${t}-delegation-role-arn`,nameservers:`${t}-nameservers`}}Oo(qy,"getDomainExportNames");var Lw=1e3;function Uw(e){let t=[],r=[];for(let i of e){let n=[...r,i];r.length>0&&Buffer.byteLength(JSON.stringify(n),"utf8")>Lw?(t.push(r),r=[i]):r=n}return r.length>0&&t.push(r),t.map(i=>JSON.stringify(i))}Oo(Uw,"serialiseHostsChunks");function zw(e,t){return`${e}-${t}`}Oo(zw,"hostsExportPartName");function Bw(e){return typeof e.hostedZoneId=="string"}Oo(Bw,"isManagedDomainBinding");var P3=Object.defineProperty,R3=(e,t)=>P3(e,"name",{value:t,configurable:!0});function Gw(e){return`${Qe(e)}ImageTag`}R3(Gw,"imageTagParameterName");var O3=Object.defineProperty,zn=(e,t)=>O3(e,"name",{value:t,configurable:!0});function ha(e){return Qe(e.replace(/[^A-Za-z0-9-]/g,""))}zn(ha,"safeExportToken");function Zy(e,t){let r=ha(e);return t===void 0?r:`${r}-${ha(t)}-`}zn(Zy,"albExportScope");function Vw(e,t){return`${Zy(e,t)}AlbDnsName`}zn(Vw,"albDnsExportName");function Ww(e,t){return`${Zy(e,t)}AlbHostedZoneId`}zn(Ww,"albHostedZoneIdExportName");function Kw(e,t){let r=ha(e);return t===void 0?r:`${r}-${ha(t)}-`}zn(Kw,"cdnExportScope");function qw(e,t){return`${Kw(e,t)}CdnDistributionDomainName`}zn(qw,"cdnDomainExportName");function Hy(e,t){return`${ha(e)}-${ha(t)}-`}zn(Hy,"bucketExportScope");function Zw(e,t){return`${Hy(e,t)}WebsiteEndpoint`}zn(Zw,"bucketWebsiteEndpointExportName");function Hw(e,t){return`${Hy(e,t)}WebsiteHostedZoneId`}zn(Hw,"bucketWebsiteHostedZoneIdExportName");var c={};Ur(c,{$brand:()=>Xy,$input:()=>vS,$output:()=>yS,NEVER:()=>Jy,TimePrecision:()=>xS,ZodAny:()=>dx,ZodArray:()=>hx,ZodBase64:()=>Fm,ZodBase64URL:()=>Lm,ZodBigInt:()=>ps,ZodBigIntFormat:()=>Bm,ZodBoolean:()=>ds,ZodCIDRv4:()=>jm,ZodCIDRv6:()=>Mm,ZodCUID:()=>wm,ZodCUID2:()=>km,ZodCatch:()=>Mx,ZodCodec:()=>Cu,ZodCustom:()=>Iu,ZodCustomStringFormat:()=>us,ZodDate:()=>Eu,ZodDefault:()=>Nx,ZodDiscriminatedUnion:()=>yx,ZodE164:()=>Um,ZodEmail:()=>Cm,ZodEmoji:()=>Im,ZodEnum:()=>ss,ZodError:()=>dq,ZodExactOptional:()=>Dx,ZodFile:()=>Cx,ZodFirstPartyTypeKind:()=>Jx,ZodFunction:()=>qx,ZodGUID:()=>gu,ZodIPv4:()=>Om,ZodIPv6:()=>$m,ZodISODate:()=>Sm,ZodISODateTime:()=>bm,ZodISODuration:()=>xm,ZodISOTime:()=>Em,ZodIntersection:()=>vx,ZodIssueCode:()=>mq,ZodJWT:()=>zm,ZodKSUID:()=>Rm,ZodLazy:()=>Vx,ZodLiteral:()=>Tx,ZodMAC:()=>ix,ZodMap:()=>Ax,ZodNaN:()=>Lx,ZodNanoID:()=>Dm,ZodNever:()=>mx,ZodNonOptional:()=>Zm,ZodNull:()=>ux,ZodNullable:()=>kx,ZodNumber:()=>ls,ZodNumberFormat:()=>_a,ZodObject:()=>Au,ZodOptional:()=>qm,ZodPipe:()=>Tu,ZodPrefault:()=>Rx,ZodPreprocess:()=>Ux,ZodPromise:()=>Kx,ZodReadonly:()=>zx,ZodRealError:()=>Lt,ZodRecord:()=>os,ZodSet:()=>_x,ZodString:()=>cs,ZodStringFormat:()=>Ie,ZodSuccess:()=>jx,ZodSymbol:()=>sx,ZodTemplateLiteral:()=>Gx,ZodTransform:()=>Ix,ZodTuple:()=>Sx,ZodType:()=>re,ZodULID:()=>Nm,ZodURL:()=>Su,ZodUUID:()=>sn,ZodUndefined:()=>cx,ZodUnion:()=>_u,ZodUnknown:()=>px,ZodVoid:()=>fx,ZodXID:()=>Pm,ZodXor:()=>gx,_ZodString:()=>Tm,_default:()=>Px,_function:()=>MP,any:()=>fP,array:()=>xu,base64:()=>XN,base64url:()=>YN,bigint:()=>uP,boolean:()=>ox,catch:()=>Fx,check:()=>FP,cidrv4:()=>HN,cidrv6:()=>JN,clone:()=>Ct,codec:()=>RP,coerce:()=>Xx,config:()=>Ze,core:()=>Vn,cuid:()=>zN,cuid2:()=>BN,custom:()=>LP,date:()=>gP,decode:()=>XE,decodeAsync:()=>QE,describe:()=>UP,discriminatedUnion:()=>xP,e164:()=>QN,email:()=>NN,emoji:()=>LN,encode:()=>JE,encodeAsync:()=>YE,endsWith:()=>Jo,enum:()=>Wm,exactOptional:()=>wx,file:()=>wP,flattenError:()=>ru,float32:()=>aP,float64:()=>oP,formatError:()=>nu,fromJSONSchema:()=>qP,function:()=>MP,getErrorMap:()=>hq,globalRegistry:()=>mt,gt:()=>an,gte:()=>Dt,guid:()=>PN,hash:()=>iP,hex:()=>nP,hostname:()=>rP,httpUrl:()=>FN,includes:()=>Zo,instanceof:()=>BP,int:()=>Am,int32:()=>sP,int64:()=>lP,intersection:()=>bx,invertCodec:()=>OP,ipv4:()=>KN,ipv6:()=>ZN,iso:()=>as,json:()=>VP,jwt:()=>eP,keyof:()=>yP,ksuid:()=>WN,lazy:()=>Wx,length:()=>xa,literal:()=>DP,locales:()=>du,looseObject:()=>SP,looseRecord:()=>_P,lowercase:()=>Ko,lt:()=>nn,lte:()=>er,mac:()=>qN,map:()=>TP,maxLength:()=>Ea,maxSize:()=>Ri,meta:()=>zP,mime:()=>Xo,minLength:()=>Gn,minSize:()=>on,multipleOf:()=>Pi,nan:()=>PP,nanoid:()=>UN,nativeEnum:()=>IP,negative:()=>um,never:()=>Gm,nonnegative:()=>dm,nonoptional:()=>$x,nonpositive:()=>lm,normalize:()=>Yo,null:()=>lx,nullable:()=>vu,nullish:()=>kP,number:()=>ax,object:()=>vP,optional:()=>yu,overwrite:()=>Br,parse:()=>KE,parseAsync:()=>qE,partialRecord:()=>AP,pipe:()=>_m,positive:()=>cm,prefault:()=>Ox,preprocess:()=>WP,prettifyError:()=>lv,promise:()=>jP,property:()=>pm,readonly:()=>Bx,record:()=>xx,refine:()=>Zx,regex:()=>Wo,regexes:()=>Qt,registry:()=>zp,safeDecode:()=>tx,safeDecodeAsync:()=>nx,safeEncode:()=>ex,safeEncodeAsync:()=>rx,safeParse:()=>ZE,safeParseAsync:()=>HE,set:()=>CP,setErrorMap:()=>fq,size:()=>Sa,slugify:()=>rs,startsWith:()=>Ho,strictObject:()=>bP,string:()=>hu,stringFormat:()=>tP,stringbool:()=>GP,success:()=>NP,superRefine:()=>Hx,symbol:()=>pP,templateLiteral:()=>$P,toJSONSchema:()=>gm,toLowerCase:()=>es,toUpperCase:()=>ts,transform:()=>Km,treeifyError:()=>uv,trim:()=>Qo,tuple:()=>Ex,uint32:()=>cP,uint64:()=>dP,ulid:()=>GN,undefined:()=>mP,union:()=>Vm,unknown:()=>Aa,uppercase:()=>qo,url:()=>MN,util:()=>M,uuid:()=>RN,uuidv4:()=>ON,uuidv6:()=>$N,uuidv7:()=>jN,void:()=>hP,xid:()=>VN,xor:()=>EP});var Vn={};Ur(Vn,{$ZodAny:()=>Lb,$ZodArray:()=>Vb,$ZodAsyncError:()=>zr,$ZodBase64:()=>wb,$ZodBase64URL:()=>kb,$ZodBigInt:()=>Rp,$ZodBigIntFormat:()=>$b,$ZodBoolean:()=>su,$ZodCIDRv4:()=>Cb,$ZodCIDRv6:()=>Ib,$ZodCUID:()=>fb,$ZodCUID2:()=>hb,$ZodCatch:()=>cS,$ZodCheck:()=>we,$ZodCheckBigIntFormat:()=>Vv,$ZodCheckEndsWith:()=>rb,$ZodCheckGreaterThan:()=>Ip,$ZodCheckIncludes:()=>eb,$ZodCheckLengthEquals:()=>Jv,$ZodCheckLessThan:()=>Cp,$ZodCheckLowerCase:()=>Yv,$ZodCheckMaxLength:()=>Zv,$ZodCheckMaxSize:()=>Wv,$ZodCheckMimeType:()=>ib,$ZodCheckMinLength:()=>Hv,$ZodCheckMinSize:()=>Kv,$ZodCheckMultipleOf:()=>Bv,$ZodCheckNumberFormat:()=>Gv,$ZodCheckOverwrite:()=>ab,$ZodCheckProperty:()=>nb,$ZodCheckRegex:()=>Xv,$ZodCheckSizeEquals:()=>qv,$ZodCheckStartsWith:()=>tb,$ZodCheckStringFormat:()=>Go,$ZodCheckUpperCase:()=>Qv,$ZodCodec:()=>uu,$ZodCustom:()=>gS,$ZodCustomStringFormat:()=>Rb,$ZodDate:()=>Gb,$ZodDefault:()=>iS,$ZodDiscriminatedUnion:()=>qb,$ZodE164:()=>Nb,$ZodEmail:()=>lb,$ZodEmoji:()=>pb,$ZodEncodeError:()=>Ii,$ZodEnum:()=>Yb,$ZodError:()=>tu,$ZodExactOptional:()=>rS,$ZodFile:()=>eS,$ZodFunction:()=>mS,$ZodGUID:()=>cb,$ZodIPv4:()=>Ab,$ZodIPv6:()=>_b,$ZodISODate:()=>Sb,$ZodISODateTime:()=>bb,$ZodISODuration:()=>xb,$ZodISOTime:()=>Eb,$ZodIntersection:()=>Zb,$ZodJWT:()=>Pb,$ZodKSUID:()=>vb,$ZodLazy:()=>hS,$ZodLiteral:()=>Qb,$ZodMAC:()=>Tb,$ZodMap:()=>Jb,$ZodNaN:()=>uS,$ZodNanoID:()=>mb,$ZodNever:()=>zb,$ZodNonOptional:()=>oS,$ZodNull:()=>Fb,$ZodNullable:()=>nS,$ZodNumber:()=>Pp,$ZodNumberFormat:()=>Ob,$ZodObject:()=>Ck,$ZodObjectJIT:()=>Wb,$ZodOptional:()=>$p,$ZodPipe:()=>jp,$ZodPrefault:()=>aS,$ZodPreprocess:()=>lS,$ZodPromise:()=>fS,$ZodReadonly:()=>dS,$ZodRealError:()=>Ft,$ZodRecord:()=>Hb,$ZodRegistry:()=>Up,$ZodSet:()=>Xb,$ZodString:()=>ba,$ZodStringFormat:()=>Ce,$ZodSuccess:()=>sS,$ZodSymbol:()=>jb,$ZodTemplateLiteral:()=>pS,$ZodTransform:()=>tS,$ZodTuple:()=>Op,$ZodType:()=>ee,$ZodULID:()=>gb,$ZodURL:()=>db,$ZodUUID:()=>ub,$ZodUndefined:()=>Mb,$ZodUnion:()=>cu,$ZodUnknown:()=>Ub,$ZodVoid:()=>Bb,$ZodXID:()=>yb,$ZodXor:()=>Kb,$brand:()=>Xy,$constructor:()=>T,$input:()=>vS,$output:()=>yS,Doc:()=>ou,JSONSchema:()=>DN,JSONSchemaGenerator:()=>ym,NEVER:()=>Jy,TimePrecision:()=>xS,_any:()=>GS,_array:()=>JS,_base64:()=>im,_base64url:()=>am,_bigint:()=>jS,_boolean:()=>OS,_catch:()=>nq,_check:()=>IN,_cidrv4:()=>rm,_cidrv6:()=>nm,_coercedBigint:()=>MS,_coercedBoolean:()=>$S,_coercedDate:()=>ZS,_coercedNumber:()=>DS,_coercedString:()=>SS,_cuid:()=>Hp,_cuid2:()=>Jp,_custom:()=>YS,_date:()=>qS,_decode:()=>yp,_decodeAsync:()=>bp,_default:()=>eq,_discriminatedUnion:()=>BK,_e164:()=>om,_email:()=>Bp,_emoji:()=>qp,_encode:()=>gp,_encodeAsync:()=>vp,_endsWith:()=>Jo,_enum:()=>ZK,_file:()=>XS,_float32:()=>kS,_float64:()=>NS,_gt:()=>an,_gte:()=>Dt,_guid:()=>pu,_includes:()=>Zo,_int:()=>wS,_int32:()=>PS,_int64:()=>FS,_intersection:()=>GK,_ipv4:()=>em,_ipv6:()=>tm,_isoDate:()=>_S,_isoDateTime:()=>AS,_isoDuration:()=>CS,_isoTime:()=>TS,_jwt:()=>sm,_ksuid:()=>Qp,_lazy:()=>sq,_length:()=>xa,_literal:()=>JK,_lowercase:()=>Ko,_lt:()=>nn,_lte:()=>er,_mac:()=>ES,_map:()=>KK,_max:()=>er,_maxLength:()=>Ea,_maxSize:()=>Ri,_mime:()=>Xo,_min:()=>Dt,_minLength:()=>Gn,_minSize:()=>on,_multipleOf:()=>Pi,_nan:()=>HS,_nanoid:()=>Zp,_nativeEnum:()=>HK,_negative:()=>um,_never:()=>WS,_nonnegative:()=>dm,_nonoptional:()=>tq,_nonpositive:()=>lm,_normalize:()=>Yo,_null:()=>BS,_nullable:()=>QK,_number:()=>IS,_optional:()=>YK,_overwrite:()=>Br,_parse:()=>Lo,_parseAsync:()=>Uo,_pipe:()=>iq,_positive:()=>cm,_promise:()=>cq,_property:()=>pm,_readonly:()=>aq,_record:()=>WK,_refine:()=>QS,_regex:()=>Wo,_safeDecode:()=>Ep,_safeDecodeAsync:()=>Ap,_safeEncode:()=>Sp,_safeEncodeAsync:()=>xp,_safeParse:()=>zo,_safeParseAsync:()=>Bo,_set:()=>qK,_size:()=>Sa,_slugify:()=>rs,_startsWith:()=>Ho,_string:()=>bS,_stringFormat:()=>ns,_stringbool:()=>nE,_success:()=>rq,_superRefine:()=>eE,_symbol:()=>US,_templateLiteral:()=>oq,_toLowerCase:()=>es,_toUpperCase:()=>ts,_transform:()=>XK,_trim:()=>Qo,_tuple:()=>VK,_uint32:()=>RS,_uint64:()=>LS,_ulid:()=>Xp,_undefined:()=>zS,_union:()=>UK,_unknown:()=>VS,_uppercase:()=>qo,_url:()=>mu,_uuid:()=>Gp,_uuidv4:()=>Vp,_uuidv6:()=>Wp,_uuidv7:()=>Kp,_void:()=>KS,_xid:()=>Yp,_xor:()=>zK,clone:()=>Ct,config:()=>Ze,createStandardJSONSchemaMethod:()=>is,createToJSONSchemaMethod:()=>iE,decode:()=>cW,decodeAsync:()=>lW,describe:()=>tE,encode:()=>sW,encodeAsync:()=>uW,extractDefs:()=>$i,finalize:()=>ji,flattenError:()=>ru,formatError:()=>nu,globalConfig:()=>ga,globalRegistry:()=>mt,initializeContext:()=>Oi,isValidBase64:()=>Db,isValidBase64URL:()=>xk,isValidJWT:()=>Ak,locales:()=>du,meta:()=>rE,parse:()=>fp,parseAsync:()=>hp,prettifyError:()=>lv,process:()=>Ee,regexes:()=>Qt,registry:()=>zp,safeDecode:()=>pW,safeDecodeAsync:()=>fW,safeEncode:()=>dW,safeEncodeAsync:()=>mW,safeParse:()=>dv,safeParseAsync:()=>pv,toDotPath:()=>tk,toJSONSchema:()=>gm,treeifyError:()=>uv,util:()=>M,version:()=>ob});var Jw,Jy=Object.freeze({status:"aborted"});function T(e,t,r){function i(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let d=o.prototype,p=Object.keys(d);for(let h=0;h<p.length;h++){let g=p[h];g in s||(s[g]=d[g].bind(s))}}let n=r?.Parent??Object;class a extends n{}Object.defineProperty(a,"name",{value:e});function o(s){var u;let d=r?.Parent?new a:this;i(d,s),(u=d._zod).deferred??(u.deferred=[]);for(let p of d._zod.deferred)p();return d}return Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Xy=Symbol("zod_brand"),zr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ii=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Jw=globalThis).__zod_globalConfig??(Jw.__zod_globalConfig={});var ga=globalThis.__zod_globalConfig;function Ze(e){return e&&Object.assign(ga,e),ga}var M={};Ur(M,{BIGINT_FORMAT_RANGES:()=>sv,Class:()=>Qy,NUMBER_FORMAT_RANGES:()=>ov,aborted:()=>Ni,allowsEval:()=>rv,assert:()=>L3,assertEqual:()=>$3,assertIs:()=>M3,assertNever:()=>F3,assertNotEqual:()=>j3,assignProp:()=>wi,base64ToUint8Array:()=>Yw,base64urlToUint8Array:()=>rW,cached:()=>Mo,captureStackTrace:()=>mp,cleanEnum:()=>tW,cleanRegex:()=>Xc,clone:()=>Ct,cloneDef:()=>z3,createTransparentProxy:()=>q3,defineLazy:()=>ue,esc:()=>pp,escapeRegex:()=>yr,explicitlyAborted:()=>cv,extend:()=>J3,finalizeIssue:()=>It,floatSafeRemainder:()=>ev,getElementAtPath:()=>B3,getEnumValues:()=>Jc,getLengthableOrigin:()=>eu,getParsedType:()=>K3,getSizableOrigin:()=>Qc,hexToUint8Array:()=>iW,isObject:()=>ya,isPlainObject:()=>ki,issue:()=>Fo,joinValues:()=>D,jsonStringifyReplacer:()=>jo,merge:()=>Y3,mergeDefs:()=>Bn,normalizeParams:()=>L,nullish:()=>Di,numKeys:()=>W3,objectClone:()=>U3,omit:()=>H3,optionalKeys:()=>av,parsedType:()=>j,partial:()=>Q3,pick:()=>Z3,prefixIssues:()=>Mt,primitiveTypes:()=>iv,promiseAllObject:()=>G3,propertyKeyTypes:()=>Yc,randomString:()=>V3,required:()=>eW,safeExtend:()=>X3,shallowClone:()=>nv,slugify:()=>tv,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>Qw,uint8ArrayToBase64url:()=>nW,uint8ArrayToHex:()=>aW,unwrapMessage:()=>Hc});function $3(e){return e}function j3(e){return e}function M3(e){}function F3(e){throw new Error("Unexpected value in exhaustive check")}function L3(e){}function Jc(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function D(e,t="|"){return e.map(r=>O(r)).join(t)}function jo(e,t){return typeof t=="bigint"?t.toString():t}function Mo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Di(e){return e==null}function Xc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ev(e,t){let r=e/t,i=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var Xw=Symbol("evaluating");function ue(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==Xw)return i===void 0&&(i=Xw,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function U3(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function wi(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Bn(...e){let t={};for(let r of e){let i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function z3(e){return Bn(e._zod.def)}function B3(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function G3(e){let t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{let n={};for(let a=0;a<t.length;a++)n[t[a]]=i[a];return n})}function V3(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function pp(e){return JSON.stringify(e)}function tv(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ya(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var rv=Mo(()=>{if(ga.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ki(e){if(ya(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ya(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function nv(e){return ki(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function W3(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var K3=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Yc=new Set(["string","number","symbol"]),iv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function yr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ct(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function q3(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,a){return t??(t=e()),Reflect.set(t,i,n,a)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function O(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function av(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ov={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Z3(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let a=Bn(e._zod.def,{get shape(){let o={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return wi(this,"shape",o),o},checks:[]});return Ct(e,a)}function H3(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let a=Bn(e._zod.def,{get shape(){let o={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return wi(this,"shape",o),o},checks:[]});return Ct(e,a)}function J3(e,t){if(!ki(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let a=e._zod.def.shape;for(let o in t)if(Object.getOwnPropertyDescriptor(a,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Bn(e._zod.def,{get shape(){let a={...e._zod.def.shape,...t};return wi(this,"shape",a),a}});return Ct(e,n)}function X3(e,t){if(!ki(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Bn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return wi(this,"shape",i),i}});return Ct(e,r)}function Y3(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Bn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return wi(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ct(e,r)}function Q3(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let o=Bn(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let d in r){if(!(d in s))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(u[d]=e?new e({type:"optional",innerType:s[d]}):s[d])}else for(let d in s)u[d]=e?new e({type:"optional",innerType:s[d]}):s[d];return wi(this,"shape",u),u},checks:[]});return Ct(t,o)}function eW(e,t,r){let i=Bn(t._zod.def,{get shape(){let n=t._zod.def.shape,a={...n};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new e({type:"nonoptional",innerType:n[o]}))}else for(let o in n)a[o]=new e({type:"nonoptional",innerType:n[o]});return wi(this,"shape",a),a}});return Ct(t,i)}function Ni(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function cv(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Mt(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Hc(e){return typeof e=="string"?e:e?.message}function It(e,t,r){let i=e.message?e.message:Hc(e.inst?._zod.def?.error?.(e))??Hc(t?.error?.(e))??Hc(r.customError?.(e))??Hc(r.localeError?.(e))??"Invalid input",{inst:n,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=i,t?.reportInput&&(s.input=o),s}function Qc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function eu(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function j(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Fo(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function tW(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Yw(e){let t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function Qw(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function rW(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Yw(t+r)}function nW(e){return Qw(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function iW(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i/2]=Number.parseInt(t.slice(i,i+2),16);return r}function aW(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Qy=class{constructor(...t){}};var ek=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,jo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tu=T("$ZodError",ek),Ft=T("$ZodError",ek,{Parent:Error});function ru(e,t=r=>r.message){let r={},i=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):i.push(t(n));return{formErrors:i,fieldErrors:r}}function nu(e,t=r=>r.message){let r={_errors:[]},i=(n,a=[])=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s},[...a,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...a,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...a,...o.path]);else{let s=[...a,...o.path];if(s.length===0)r._errors.push(t(o));else{let u=r,d=0;for(;d<s.length;){let p=s[d];d===s.length-1?(u[p]=u[p]||{_errors:[]},u[p]._errors.push(t(o))):u[p]=u[p]||{_errors:[]},u=u[p],d++}}}};return i(e),r}function uv(e,t=r=>r.message){let r={errors:[]},i=(n,a=[])=>{var o,s;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d},[...a,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...a,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...a,...u.path]);else{let d=[...a,...u.path];if(d.length===0){r.errors.push(t(u));continue}let p=r,h=0;for(;h<d.length;){let g=d[h],l=h===d.length-1;typeof g=="string"?(p.properties??(p.properties={}),(o=p.properties)[g]??(o[g]={errors:[]}),p=p.properties[g]):(p.items??(p.items=[]),(s=p.items)[g]??(s[g]={errors:[]}),p=p.items[g]),l&&p.errors.push(t(u)),h++}}};return i(e),r}function tk(e){let t=[],r=e.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function lv(e){let t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${tk(i.path)}`);return t.join(`
|
|
200
|
+
`),this.close()}_(t,r){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(l3.hide):this.out.write($se(this.outputText,this.out.columns)),super.render(),this.outputText=[u3.symbol(this.done,this.aborted),c3.bold(this.msg),u3.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:c3.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(jse.line+l3.to(0)+this.outputText))}};d3.exports=Cw});var f3=P((KIe,m3)=>{"use strict";m3.exports={TextPrompt:dV(),SelectPrompt:hV(),TogglePrompt:bV(),DatePrompt:WV(),NumberPrompt:HV(),MultiselectPrompt:Ew(),AutocompletePrompt:n3(),AutocompleteMultiselectPrompt:s3(),ConfirmPrompt:p3()}});var g3=P(h3=>{"use strict";var Xt=h3,Mse=f3(),Fy=e=>e;function $n(e,t,r={}){return new Promise((i,n)=>{let a=new Mse[e](t),o=r.onAbort||Fy,s=r.onSubmit||Fy,u=r.onExit||Fy;a.on("state",t.onState||Fy),a.on("submit",d=>i(s(d))),a.on("exit",d=>i(u(d))),a.on("abort",d=>n(o(d)))})}Xt.text=e=>$n("TextPrompt",e);Xt.password=e=>(e.style="password",Xt.text(e));Xt.invisible=e=>(e.style="invisible",Xt.text(e));Xt.number=e=>$n("NumberPrompt",e);Xt.date=e=>$n("DatePrompt",e);Xt.confirm=e=>$n("ConfirmPrompt",e);Xt.list=e=>{let t=e.separator||",";return $n("TextPrompt",e,{onSubmit:r=>r.split(t).map(i=>i.trim())})};Xt.toggle=e=>$n("TogglePrompt",e);Xt.select=e=>$n("SelectPrompt",e);Xt.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return $n("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Xt.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return $n("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var Fse=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Xt.autocomplete=e=>(e.suggest=e.suggest||Fse,e.choices=[].concat(e.choices||[]),$n("AutocompletePrompt",e))});var b3=P((ZIe,v3)=>{"use strict";var Iw=g3(),Lse=["suggest","format","onState","validate","onRender","type"],y3=()=>{};async function da(e=[],{onSubmit:t=y3,onCancel:r=y3}={}){let i={},n=da._override||{};e=[].concat(e);let a,o,s,u,d,p,h=async(g,l,m=!1)=>{if(!(!m&&g.validate&&g.validate(l)!==!0))return g.format?await g.format(l,i):l};for(o of e)if({name:u,type:d}=o,typeof d=="function"&&(d=await d(a,{...i},o),o.type=d),!!d){for(let g in o){if(Lse.includes(g))continue;let l=o[g];o[g]=typeof l=="function"?await l(a,{...i},p):l}if(p=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:d}=o,Iw[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(n[o.name]!==void 0&&(a=await h(o,n[o.name]),a!==void 0)){i[u]=a;continue}try{a=da._injected?Use(da._injected,o.initial):await Iw[d](o),i[u]=a=await h(o,a,!0),s=await t(o,a,i)}catch{s=!await r(o,i)}if(s)return i}return i}function Use(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function zse(e){da._injected=(da._injected||[]).concat(e)}function Bse(e){da._override=Object.assign({},e)}v3.exports=Object.assign(da,{prompt:da,prompts:Iw,inject:zse,override:Bse})});var E3=P((HIe,S3)=>{function Gse(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,r=process.versions.node.split(".").map(Number);for(;t<e.length;t++){if(r[t]>e[t])return!1;if(e[t]>r[t])return!0}return!1}S3.exports=Gse("8.6.0")?WG():b3()});import{join as Sr,dirname as P1,normalize as b9}from"node:path";import{readFileSync as R1,existsSync as O1}from"node:fs";var k3=Object.defineProperty,Ci=(e,t)=>k3(e,"name",{value:t,configurable:!0});function Qe(e){return e.replace(/[-_](.)/g,(t,r)=>r.toUpperCase()).replace(/^./,t=>t.toUpperCase())}Ci(Qe,"toPascalCase");function gr(e){return e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}Ci(gr,"toKebab");function Ro(e){return gr(e).replace(/-/g,"_")}Ci(Ro,"toValidDatabaseName");function Ow(e){return gr(e).replace(/-/g,"_").toUpperCase()}Ci(Ow,"toScreamingSnake");function $w(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}Ci($w,"capitalise");function jw(e){return e.split(".").join("")}Ci(jw,"getSafeZoneName");function fa(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}Ci(fa,"accountConstructKey");function Mw(e){let t=e.replace(new RegExp("\\P{ASCII}","gu"),"");return fa(t)===fa(e)&&fa(e)!==""}Ci(Mw,"hasAsciiStableConstructKey");var N3=Object.defineProperty,Oo=(e,t)=>N3(e,"name",{value:t,configurable:!0});function $o(e){return`${Qe(e.split(".").join(""))}Domain`}Oo($o,"getDomainStackName");function Fw(e){return`${e}UsEast1Certificates`}Oo(Fw,"getDomainUsEast1CertificatesStackName");function qy(e){let t=e.replace(/\./g,"-");return{hostedZoneId:`${t}-hosted-zone-id`,certificateArn:`${t}-certificate-arn`,certificateHosts:`${t}-certificate-hosts`,usEast1CertificateArn:`${t}-us-east-1-certificate-arn`,usEast1CertificateHosts:`${t}-us-east-1-certificate-hosts`,delegationRoleArn:`${t}-delegation-role-arn`,nameservers:`${t}-nameservers`}}Oo(qy,"getDomainExportNames");var Lw=1e3;function Uw(e){let t=[],r=[];for(let i of e){let n=[...r,i];r.length>0&&Buffer.byteLength(JSON.stringify(n),"utf8")>Lw?(t.push(r),r=[i]):r=n}return r.length>0&&t.push(r),t.map(i=>JSON.stringify(i))}Oo(Uw,"serialiseHostsChunks");function zw(e,t){return`${e}-${t}`}Oo(zw,"hostsExportPartName");function Bw(e){return typeof e.hostedZoneId=="string"}Oo(Bw,"isManagedDomainBinding");var P3=Object.defineProperty,R3=(e,t)=>P3(e,"name",{value:t,configurable:!0});function Gw(e){return`${Qe(e)}ImageTag`}R3(Gw,"imageTagParameterName");var O3=Object.defineProperty,zn=(e,t)=>O3(e,"name",{value:t,configurable:!0});function ha(e){return Qe(e.replace(/[^A-Za-z0-9-]/g,""))}zn(ha,"safeExportToken");function Zy(e,t){let r=ha(e);return t===void 0?r:`${r}-${ha(t)}-`}zn(Zy,"albExportScope");function Vw(e,t){return`${Zy(e,t)}AlbDnsName`}zn(Vw,"albDnsExportName");function Ww(e,t){return`${Zy(e,t)}AlbHostedZoneId`}zn(Ww,"albHostedZoneIdExportName");function Kw(e,t){let r=ha(e);return t===void 0?r:`${r}-${ha(t)}-`}zn(Kw,"cdnExportScope");function qw(e,t){return`${Kw(e,t)}CdnDistributionDomainName`}zn(qw,"cdnDomainExportName");function Hy(e,t){return`${ha(e)}-${ha(t)}-`}zn(Hy,"bucketExportScope");function Zw(e,t){return`${Hy(e,t)}WebsiteEndpoint`}zn(Zw,"bucketWebsiteEndpointExportName");function Hw(e,t){return`${Hy(e,t)}WebsiteHostedZoneId`}zn(Hw,"bucketWebsiteHostedZoneIdExportName");var c={};Ur(c,{$brand:()=>Xy,$input:()=>vS,$output:()=>yS,NEVER:()=>Jy,TimePrecision:()=>xS,ZodAny:()=>dx,ZodArray:()=>hx,ZodBase64:()=>Fm,ZodBase64URL:()=>Lm,ZodBigInt:()=>ps,ZodBigIntFormat:()=>Bm,ZodBoolean:()=>ds,ZodCIDRv4:()=>jm,ZodCIDRv6:()=>Mm,ZodCUID:()=>wm,ZodCUID2:()=>km,ZodCatch:()=>Mx,ZodCodec:()=>Cu,ZodCustom:()=>Iu,ZodCustomStringFormat:()=>us,ZodDate:()=>Eu,ZodDefault:()=>Nx,ZodDiscriminatedUnion:()=>yx,ZodE164:()=>Um,ZodEmail:()=>Cm,ZodEmoji:()=>Im,ZodEnum:()=>ss,ZodError:()=>dq,ZodExactOptional:()=>Dx,ZodFile:()=>Cx,ZodFirstPartyTypeKind:()=>Jx,ZodFunction:()=>qx,ZodGUID:()=>gu,ZodIPv4:()=>Om,ZodIPv6:()=>$m,ZodISODate:()=>Sm,ZodISODateTime:()=>bm,ZodISODuration:()=>xm,ZodISOTime:()=>Em,ZodIntersection:()=>vx,ZodIssueCode:()=>mq,ZodJWT:()=>zm,ZodKSUID:()=>Rm,ZodLazy:()=>Vx,ZodLiteral:()=>Tx,ZodMAC:()=>ix,ZodMap:()=>Ax,ZodNaN:()=>Lx,ZodNanoID:()=>Dm,ZodNever:()=>mx,ZodNonOptional:()=>Zm,ZodNull:()=>ux,ZodNullable:()=>kx,ZodNumber:()=>ls,ZodNumberFormat:()=>_a,ZodObject:()=>Au,ZodOptional:()=>qm,ZodPipe:()=>Tu,ZodPrefault:()=>Rx,ZodPreprocess:()=>Ux,ZodPromise:()=>Kx,ZodReadonly:()=>zx,ZodRealError:()=>Lt,ZodRecord:()=>os,ZodSet:()=>_x,ZodString:()=>cs,ZodStringFormat:()=>Ie,ZodSuccess:()=>jx,ZodSymbol:()=>sx,ZodTemplateLiteral:()=>Gx,ZodTransform:()=>Ix,ZodTuple:()=>Sx,ZodType:()=>re,ZodULID:()=>Nm,ZodURL:()=>Su,ZodUUID:()=>sn,ZodUndefined:()=>cx,ZodUnion:()=>_u,ZodUnknown:()=>px,ZodVoid:()=>fx,ZodXID:()=>Pm,ZodXor:()=>gx,_ZodString:()=>Tm,_default:()=>Px,_function:()=>MP,any:()=>fP,array:()=>xu,base64:()=>XN,base64url:()=>YN,bigint:()=>uP,boolean:()=>ox,catch:()=>Fx,check:()=>FP,cidrv4:()=>HN,cidrv6:()=>JN,clone:()=>Ct,codec:()=>RP,coerce:()=>Xx,config:()=>Ze,core:()=>Vn,cuid:()=>zN,cuid2:()=>BN,custom:()=>LP,date:()=>gP,decode:()=>XE,decodeAsync:()=>QE,describe:()=>UP,discriminatedUnion:()=>xP,e164:()=>QN,email:()=>NN,emoji:()=>LN,encode:()=>JE,encodeAsync:()=>YE,endsWith:()=>Jo,enum:()=>Wm,exactOptional:()=>wx,file:()=>wP,flattenError:()=>ru,float32:()=>aP,float64:()=>oP,formatError:()=>nu,fromJSONSchema:()=>qP,function:()=>MP,getErrorMap:()=>hq,globalRegistry:()=>mt,gt:()=>an,gte:()=>Dt,guid:()=>PN,hash:()=>iP,hex:()=>nP,hostname:()=>rP,httpUrl:()=>FN,includes:()=>Zo,instanceof:()=>BP,int:()=>Am,int32:()=>sP,int64:()=>lP,intersection:()=>bx,invertCodec:()=>OP,ipv4:()=>KN,ipv6:()=>ZN,iso:()=>as,json:()=>VP,jwt:()=>eP,keyof:()=>yP,ksuid:()=>WN,lazy:()=>Wx,length:()=>xa,literal:()=>DP,locales:()=>du,looseObject:()=>SP,looseRecord:()=>_P,lowercase:()=>Ko,lt:()=>nn,lte:()=>er,mac:()=>qN,map:()=>TP,maxLength:()=>Ea,maxSize:()=>Ri,meta:()=>zP,mime:()=>Xo,minLength:()=>Gn,minSize:()=>on,multipleOf:()=>Pi,nan:()=>PP,nanoid:()=>UN,nativeEnum:()=>IP,negative:()=>um,never:()=>Gm,nonnegative:()=>dm,nonoptional:()=>$x,nonpositive:()=>lm,normalize:()=>Yo,null:()=>lx,nullable:()=>vu,nullish:()=>kP,number:()=>ax,object:()=>vP,optional:()=>yu,overwrite:()=>Br,parse:()=>KE,parseAsync:()=>qE,partialRecord:()=>AP,pipe:()=>_m,positive:()=>cm,prefault:()=>Ox,preprocess:()=>WP,prettifyError:()=>lv,promise:()=>jP,property:()=>pm,readonly:()=>Bx,record:()=>xx,refine:()=>Zx,regex:()=>Wo,regexes:()=>Qt,registry:()=>zp,safeDecode:()=>tx,safeDecodeAsync:()=>nx,safeEncode:()=>ex,safeEncodeAsync:()=>rx,safeParse:()=>ZE,safeParseAsync:()=>HE,set:()=>CP,setErrorMap:()=>fq,size:()=>Sa,slugify:()=>rs,startsWith:()=>Ho,strictObject:()=>bP,string:()=>hu,stringFormat:()=>tP,stringbool:()=>GP,success:()=>NP,superRefine:()=>Hx,symbol:()=>pP,templateLiteral:()=>$P,toJSONSchema:()=>gm,toLowerCase:()=>es,toUpperCase:()=>ts,transform:()=>Km,treeifyError:()=>uv,trim:()=>Qo,tuple:()=>Ex,uint32:()=>cP,uint64:()=>dP,ulid:()=>GN,undefined:()=>mP,union:()=>Vm,unknown:()=>Aa,uppercase:()=>qo,url:()=>MN,util:()=>M,uuid:()=>RN,uuidv4:()=>ON,uuidv6:()=>$N,uuidv7:()=>jN,void:()=>hP,xid:()=>VN,xor:()=>EP});var Vn={};Ur(Vn,{$ZodAny:()=>Lb,$ZodArray:()=>Vb,$ZodAsyncError:()=>zr,$ZodBase64:()=>wb,$ZodBase64URL:()=>kb,$ZodBigInt:()=>Rp,$ZodBigIntFormat:()=>$b,$ZodBoolean:()=>su,$ZodCIDRv4:()=>Cb,$ZodCIDRv6:()=>Ib,$ZodCUID:()=>fb,$ZodCUID2:()=>hb,$ZodCatch:()=>cS,$ZodCheck:()=>we,$ZodCheckBigIntFormat:()=>Vv,$ZodCheckEndsWith:()=>rb,$ZodCheckGreaterThan:()=>Ip,$ZodCheckIncludes:()=>eb,$ZodCheckLengthEquals:()=>Jv,$ZodCheckLessThan:()=>Cp,$ZodCheckLowerCase:()=>Yv,$ZodCheckMaxLength:()=>Zv,$ZodCheckMaxSize:()=>Wv,$ZodCheckMimeType:()=>ib,$ZodCheckMinLength:()=>Hv,$ZodCheckMinSize:()=>Kv,$ZodCheckMultipleOf:()=>Bv,$ZodCheckNumberFormat:()=>Gv,$ZodCheckOverwrite:()=>ab,$ZodCheckProperty:()=>nb,$ZodCheckRegex:()=>Xv,$ZodCheckSizeEquals:()=>qv,$ZodCheckStartsWith:()=>tb,$ZodCheckStringFormat:()=>Go,$ZodCheckUpperCase:()=>Qv,$ZodCodec:()=>uu,$ZodCustom:()=>gS,$ZodCustomStringFormat:()=>Rb,$ZodDate:()=>Gb,$ZodDefault:()=>iS,$ZodDiscriminatedUnion:()=>qb,$ZodE164:()=>Nb,$ZodEmail:()=>lb,$ZodEmoji:()=>pb,$ZodEncodeError:()=>Ii,$ZodEnum:()=>Yb,$ZodError:()=>tu,$ZodExactOptional:()=>rS,$ZodFile:()=>eS,$ZodFunction:()=>mS,$ZodGUID:()=>cb,$ZodIPv4:()=>Ab,$ZodIPv6:()=>_b,$ZodISODate:()=>Sb,$ZodISODateTime:()=>bb,$ZodISODuration:()=>xb,$ZodISOTime:()=>Eb,$ZodIntersection:()=>Zb,$ZodJWT:()=>Pb,$ZodKSUID:()=>vb,$ZodLazy:()=>hS,$ZodLiteral:()=>Qb,$ZodMAC:()=>Tb,$ZodMap:()=>Jb,$ZodNaN:()=>uS,$ZodNanoID:()=>mb,$ZodNever:()=>zb,$ZodNonOptional:()=>oS,$ZodNull:()=>Fb,$ZodNullable:()=>nS,$ZodNumber:()=>Pp,$ZodNumberFormat:()=>Ob,$ZodObject:()=>Ck,$ZodObjectJIT:()=>Wb,$ZodOptional:()=>$p,$ZodPipe:()=>jp,$ZodPrefault:()=>aS,$ZodPreprocess:()=>lS,$ZodPromise:()=>fS,$ZodReadonly:()=>dS,$ZodRealError:()=>Ft,$ZodRecord:()=>Hb,$ZodRegistry:()=>Up,$ZodSet:()=>Xb,$ZodString:()=>ba,$ZodStringFormat:()=>Ce,$ZodSuccess:()=>sS,$ZodSymbol:()=>jb,$ZodTemplateLiteral:()=>pS,$ZodTransform:()=>tS,$ZodTuple:()=>Op,$ZodType:()=>ee,$ZodULID:()=>gb,$ZodURL:()=>db,$ZodUUID:()=>ub,$ZodUndefined:()=>Mb,$ZodUnion:()=>cu,$ZodUnknown:()=>Ub,$ZodVoid:()=>Bb,$ZodXID:()=>yb,$ZodXor:()=>Kb,$brand:()=>Xy,$constructor:()=>T,$input:()=>vS,$output:()=>yS,Doc:()=>ou,JSONSchema:()=>DN,JSONSchemaGenerator:()=>ym,NEVER:()=>Jy,TimePrecision:()=>xS,_any:()=>GS,_array:()=>JS,_base64:()=>im,_base64url:()=>am,_bigint:()=>jS,_boolean:()=>OS,_catch:()=>nq,_check:()=>IN,_cidrv4:()=>rm,_cidrv6:()=>nm,_coercedBigint:()=>MS,_coercedBoolean:()=>$S,_coercedDate:()=>ZS,_coercedNumber:()=>DS,_coercedString:()=>SS,_cuid:()=>Hp,_cuid2:()=>Jp,_custom:()=>YS,_date:()=>qS,_decode:()=>yp,_decodeAsync:()=>bp,_default:()=>eq,_discriminatedUnion:()=>BK,_e164:()=>om,_email:()=>Bp,_emoji:()=>qp,_encode:()=>gp,_encodeAsync:()=>vp,_endsWith:()=>Jo,_enum:()=>ZK,_file:()=>XS,_float32:()=>kS,_float64:()=>NS,_gt:()=>an,_gte:()=>Dt,_guid:()=>pu,_includes:()=>Zo,_int:()=>wS,_int32:()=>PS,_int64:()=>FS,_intersection:()=>GK,_ipv4:()=>em,_ipv6:()=>tm,_isoDate:()=>_S,_isoDateTime:()=>AS,_isoDuration:()=>CS,_isoTime:()=>TS,_jwt:()=>sm,_ksuid:()=>Qp,_lazy:()=>sq,_length:()=>xa,_literal:()=>JK,_lowercase:()=>Ko,_lt:()=>nn,_lte:()=>er,_mac:()=>ES,_map:()=>KK,_max:()=>er,_maxLength:()=>Ea,_maxSize:()=>Ri,_mime:()=>Xo,_min:()=>Dt,_minLength:()=>Gn,_minSize:()=>on,_multipleOf:()=>Pi,_nan:()=>HS,_nanoid:()=>Zp,_nativeEnum:()=>HK,_negative:()=>um,_never:()=>WS,_nonnegative:()=>dm,_nonoptional:()=>tq,_nonpositive:()=>lm,_normalize:()=>Yo,_null:()=>BS,_nullable:()=>QK,_number:()=>IS,_optional:()=>YK,_overwrite:()=>Br,_parse:()=>Lo,_parseAsync:()=>Uo,_pipe:()=>iq,_positive:()=>cm,_promise:()=>cq,_property:()=>pm,_readonly:()=>aq,_record:()=>WK,_refine:()=>QS,_regex:()=>Wo,_safeDecode:()=>Ep,_safeDecodeAsync:()=>Ap,_safeEncode:()=>Sp,_safeEncodeAsync:()=>xp,_safeParse:()=>zo,_safeParseAsync:()=>Bo,_set:()=>qK,_size:()=>Sa,_slugify:()=>rs,_startsWith:()=>Ho,_string:()=>bS,_stringFormat:()=>ns,_stringbool:()=>nE,_success:()=>rq,_superRefine:()=>eE,_symbol:()=>US,_templateLiteral:()=>oq,_toLowerCase:()=>es,_toUpperCase:()=>ts,_transform:()=>XK,_trim:()=>Qo,_tuple:()=>VK,_uint32:()=>RS,_uint64:()=>LS,_ulid:()=>Xp,_undefined:()=>zS,_union:()=>UK,_unknown:()=>VS,_uppercase:()=>qo,_url:()=>mu,_uuid:()=>Gp,_uuidv4:()=>Vp,_uuidv6:()=>Wp,_uuidv7:()=>Kp,_void:()=>KS,_xid:()=>Yp,_xor:()=>zK,clone:()=>Ct,config:()=>Ze,createStandardJSONSchemaMethod:()=>is,createToJSONSchemaMethod:()=>iE,decode:()=>cW,decodeAsync:()=>lW,describe:()=>tE,encode:()=>sW,encodeAsync:()=>uW,extractDefs:()=>$i,finalize:()=>ji,flattenError:()=>ru,formatError:()=>nu,globalConfig:()=>ga,globalRegistry:()=>mt,initializeContext:()=>Oi,isValidBase64:()=>Db,isValidBase64URL:()=>xk,isValidJWT:()=>Ak,locales:()=>du,meta:()=>rE,parse:()=>fp,parseAsync:()=>hp,prettifyError:()=>lv,process:()=>Ee,regexes:()=>Qt,registry:()=>zp,safeDecode:()=>pW,safeDecodeAsync:()=>fW,safeEncode:()=>dW,safeEncodeAsync:()=>mW,safeParse:()=>dv,safeParseAsync:()=>pv,toDotPath:()=>tk,toJSONSchema:()=>gm,treeifyError:()=>uv,util:()=>M,version:()=>ob});var Jw,Jy=Object.freeze({status:"aborted"});function T(e,t,r){function i(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let d=o.prototype,p=Object.keys(d);for(let h=0;h<p.length;h++){let g=p[h];g in s||(s[g]=d[g].bind(s))}}let n=r?.Parent??Object;class a extends n{}Object.defineProperty(a,"name",{value:e});function o(s){var u;let d=r?.Parent?new a:this;i(d,s),(u=d._zod).deferred??(u.deferred=[]);for(let p of d._zod.deferred)p();return d}return Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Xy=Symbol("zod_brand"),zr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ii=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Jw=globalThis).__zod_globalConfig??(Jw.__zod_globalConfig={});var ga=globalThis.__zod_globalConfig;function Ze(e){return e&&Object.assign(ga,e),ga}var M={};Ur(M,{BIGINT_FORMAT_RANGES:()=>sv,Class:()=>Qy,NUMBER_FORMAT_RANGES:()=>ov,aborted:()=>Ni,allowsEval:()=>rv,assert:()=>L3,assertEqual:()=>$3,assertIs:()=>M3,assertNever:()=>F3,assertNotEqual:()=>j3,assignProp:()=>wi,base64ToUint8Array:()=>Yw,base64urlToUint8Array:()=>rW,cached:()=>Mo,captureStackTrace:()=>mp,cleanEnum:()=>tW,cleanRegex:()=>Xc,clone:()=>Ct,cloneDef:()=>z3,createTransparentProxy:()=>q3,defineLazy:()=>ue,esc:()=>pp,escapeRegex:()=>yr,explicitlyAborted:()=>cv,extend:()=>J3,finalizeIssue:()=>It,floatSafeRemainder:()=>ev,getElementAtPath:()=>B3,getEnumValues:()=>Jc,getLengthableOrigin:()=>eu,getParsedType:()=>K3,getSizableOrigin:()=>Qc,hexToUint8Array:()=>iW,isObject:()=>ya,isPlainObject:()=>ki,issue:()=>Fo,joinValues:()=>D,jsonStringifyReplacer:()=>jo,merge:()=>Y3,mergeDefs:()=>Bn,normalizeParams:()=>L,nullish:()=>Di,numKeys:()=>W3,objectClone:()=>U3,omit:()=>H3,optionalKeys:()=>av,parsedType:()=>j,partial:()=>Q3,pick:()=>Z3,prefixIssues:()=>Mt,primitiveTypes:()=>iv,promiseAllObject:()=>G3,propertyKeyTypes:()=>Yc,randomString:()=>V3,required:()=>eW,safeExtend:()=>X3,shallowClone:()=>nv,slugify:()=>tv,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>Qw,uint8ArrayToBase64url:()=>nW,uint8ArrayToHex:()=>aW,unwrapMessage:()=>Hc});function $3(e){return e}function j3(e){return e}function M3(e){}function F3(e){throw new Error("Unexpected value in exhaustive check")}function L3(e){}function Jc(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function D(e,t="|"){return e.map(r=>O(r)).join(t)}function jo(e,t){return typeof t=="bigint"?t.toString():t}function Mo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Di(e){return e==null}function Xc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ev(e,t){let r=e/t,i=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var Xw=Symbol("evaluating");function ue(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==Xw)return i===void 0&&(i=Xw,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function U3(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function wi(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Bn(...e){let t={};for(let r of e){let i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function z3(e){return Bn(e._zod.def)}function B3(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function G3(e){let t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{let n={};for(let a=0;a<t.length;a++)n[t[a]]=i[a];return n})}function V3(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function pp(e){return JSON.stringify(e)}function tv(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ya(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var rv=Mo(()=>{if(ga.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ki(e){if(ya(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ya(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function nv(e){return ki(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function W3(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var K3=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Yc=new Set(["string","number","symbol"]),iv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function yr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ct(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function q3(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,a){return t??(t=e()),Reflect.set(t,i,n,a)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function O(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function av(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ov={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Z3(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let a=Bn(e._zod.def,{get shape(){let o={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return wi(this,"shape",o),o},checks:[]});return Ct(e,a)}function H3(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let a=Bn(e._zod.def,{get shape(){let o={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return wi(this,"shape",o),o},checks:[]});return Ct(e,a)}function J3(e,t){if(!ki(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let a=e._zod.def.shape;for(let o in t)if(Object.getOwnPropertyDescriptor(a,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Bn(e._zod.def,{get shape(){let a={...e._zod.def.shape,...t};return wi(this,"shape",a),a}});return Ct(e,n)}function X3(e,t){if(!ki(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Bn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return wi(this,"shape",i),i}});return Ct(e,r)}function Y3(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Bn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return wi(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ct(e,r)}function Q3(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let o=Bn(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let d in r){if(!(d in s))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(u[d]=e?new e({type:"optional",innerType:s[d]}):s[d])}else for(let d in s)u[d]=e?new e({type:"optional",innerType:s[d]}):s[d];return wi(this,"shape",u),u},checks:[]});return Ct(t,o)}function eW(e,t,r){let i=Bn(t._zod.def,{get shape(){let n=t._zod.def.shape,a={...n};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new e({type:"nonoptional",innerType:n[o]}))}else for(let o in n)a[o]=new e({type:"nonoptional",innerType:n[o]});return wi(this,"shape",a),a}});return Ct(t,i)}function Ni(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function cv(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Mt(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Hc(e){return typeof e=="string"?e:e?.message}function It(e,t,r){let i=e.message?e.message:Hc(e.inst?._zod.def?.error?.(e))??Hc(t?.error?.(e))??Hc(r.customError?.(e))??Hc(r.localeError?.(e))??"Invalid input",{inst:n,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=i,t?.reportInput&&(s.input=o),s}function Qc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function eu(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function j(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Fo(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function tW(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Yw(e){let t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function Qw(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function rW(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Yw(t+r)}function nW(e){return Qw(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function iW(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i/2]=Number.parseInt(t.slice(i,i+2),16);return r}function aW(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Qy=class{constructor(...t){}};var ek=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,jo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tu=T("$ZodError",ek),Ft=T("$ZodError",ek,{Parent:Error});function ru(e,t=r=>r.message){let r={},i=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):i.push(t(n));return{formErrors:i,fieldErrors:r}}function nu(e,t=r=>r.message){let r={_errors:[]},i=(n,a=[])=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s},[...a,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...a,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...a,...o.path]);else{let s=[...a,...o.path];if(s.length===0)r._errors.push(t(o));else{let u=r,d=0;for(;d<s.length;){let p=s[d];d===s.length-1?(u[p]=u[p]||{_errors:[]},u[p]._errors.push(t(o))):u[p]=u[p]||{_errors:[]},u=u[p],d++}}}};return i(e),r}function uv(e,t=r=>r.message){let r={errors:[]},i=(n,a=[])=>{var o,s;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d},[...a,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...a,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...a,...u.path]);else{let d=[...a,...u.path];if(d.length===0){r.errors.push(t(u));continue}let p=r,h=0;for(;h<d.length;){let g=d[h],l=h===d.length-1;typeof g=="string"?(p.properties??(p.properties={}),(o=p.properties)[g]??(o[g]={errors:[]}),p=p.properties[g]):(p.items??(p.items=[]),(s=p.items)[g]??(s[g]={errors:[]}),p=p.items[g]),l&&p.errors.push(t(u)),h++}}};return i(e),r}function tk(e){let t=[],r=e.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function lv(e){let t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${tk(i.path)}`);return t.join(`
|
|
201
201
|
`)}var Lo=e=>(t,r,i,n)=>{let a=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new zr;if(o.issues.length){let s=new(n?.Err??e)(o.issues.map(u=>It(u,a,Ze())));throw mp(s,n?.callee),s}return o.value},fp=Lo(Ft),Uo=e=>async(t,r,i,n)=>{let a=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(n?.Err??e)(o.issues.map(u=>It(u,a,Ze())));throw mp(s,n?.callee),s}return o.value},hp=Uo(Ft),zo=e=>(t,r,i)=>{let n=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise)throw new zr;return a.issues.length?{success:!1,error:new(e??tu)(a.issues.map(o=>It(o,n,Ze())))}:{success:!0,data:a.value}},dv=zo(Ft),Bo=e=>async(t,r,i)=>{let n=i?{...i,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},n);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(o=>It(o,n,Ze())))}:{success:!0,data:a.value}},pv=Bo(Ft),gp=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Lo(e)(t,r,n)},sW=gp(Ft),yp=e=>(t,r,i)=>Lo(e)(t,r,i),cW=yp(Ft),vp=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Uo(e)(t,r,n)},uW=vp(Ft),bp=e=>async(t,r,i)=>Uo(e)(t,r,i),lW=bp(Ft),Sp=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return zo(e)(t,r,n)},dW=Sp(Ft),Ep=e=>(t,r,i)=>zo(e)(t,r,i),pW=Ep(Ft),xp=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Bo(e)(t,r,n)},mW=xp(Ft),Ap=e=>async(t,r,i)=>Bo(e)(t,r,i),fW=Ap(Ft);var Qt={};Ur(Qt,{base64:()=>Dv,base64url:()=>_p,bigint:()=>$v,boolean:()=>Mv,browserEmail:()=>xW,cidrv4:()=>Cv,cidrv6:()=>Iv,cuid:()=>mv,cuid2:()=>fv,date:()=>Nv,datetime:()=>Rv,domain:()=>TW,duration:()=>bv,e164:()=>kv,email:()=>Ev,emoji:()=>xv,extendedDuration:()=>hW,guid:()=>Sv,hex:()=>CW,hostname:()=>_W,html5Email:()=>bW,httpProtocol:()=>wv,idnEmail:()=>EW,integer:()=>jv,ipv4:()=>Av,ipv6:()=>_v,ksuid:()=>yv,lowercase:()=>Uv,mac:()=>Tv,md5_base64:()=>DW,md5_base64url:()=>wW,md5_hex:()=>IW,nanoid:()=>vv,null:()=>Fv,number:()=>Tp,rfc5322Email:()=>SW,sha1_base64:()=>NW,sha1_base64url:()=>PW,sha1_hex:()=>kW,sha256_base64:()=>OW,sha256_base64url:()=>$W,sha256_hex:()=>RW,sha384_base64:()=>MW,sha384_base64url:()=>FW,sha384_hex:()=>jW,sha512_base64:()=>UW,sha512_base64url:()=>zW,sha512_hex:()=>LW,string:()=>Ov,time:()=>Pv,ulid:()=>hv,undefined:()=>Lv,unicodeEmail:()=>rk,uppercase:()=>zv,uuid:()=>va,uuid4:()=>gW,uuid6:()=>yW,uuid7:()=>vW,xid:()=>gv});var mv=/^[cC][0-9a-z]{6,}$/,fv=/^[0-9a-z]+$/,hv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gv=/^[0-9a-vA-V]{20}$/,yv=/^[A-Za-z0-9]{27}$/,vv=/^[a-zA-Z0-9_-]{21}$/,bv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hW=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Sv=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,va=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gW=va(4),yW=va(6),vW=va(7),Ev=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bW=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,SW=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,rk=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,EW=rk,xW=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,AW="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function xv(){return new RegExp(AW,"u")}var Av=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_v=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Tv=e=>{let t=yr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Cv=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Iv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Dv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_p=/^[A-Za-z0-9_-]*$/,_W=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,TW=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,wv=/^https?$/,kv=/^\+[1-9]\d{6,14}$/,nk="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Nv=new RegExp(`^${nk}$`);function ik(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Pv(e){return new RegExp(`^${ik(e)}$`)}function Rv(e){let t=ik({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${r.join("|")})`;return new RegExp(`^${nk}T(?:${i})$`)}var Ov=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},$v=/^-?\d+n?$/,jv=/^-?\d+$/,Tp=/^-?\d+(?:\.\d+)?$/,Mv=/^(?:true|false)$/i,Fv=/^null$/i;var Lv=/^undefined$/i;var Uv=/^[^A-Z]*$/,zv=/^[^a-z]*$/,CW=/^[0-9a-fA-F]*$/;function iu(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function au(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var IW=/^[0-9a-fA-F]{32}$/,DW=iu(22,"=="),wW=au(22),kW=/^[0-9a-fA-F]{40}$/,NW=iu(27,"="),PW=au(27),RW=/^[0-9a-fA-F]{64}$/,OW=iu(43,"="),$W=au(43),jW=/^[0-9a-fA-F]{96}$/,MW=iu(64,""),FW=au(64),LW=/^[0-9a-fA-F]{128}$/,UW=iu(86,"=="),zW=au(86);var we=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ok={number:"number",bigint:"bigint",object:"date"},Cp=T("$ZodCheckLessThan",(e,t)=>{we.init(e,t);let r=ok[typeof t.value];e._zod.onattach.push(i=>{let n=i._zod.bag,a=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ip=T("$ZodCheckGreaterThan",(e,t)=>{we.init(e,t);let r=ok[typeof t.value];e._zod.onattach.push(i=>{let n=i._zod.bag,a=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bv=T("$ZodCheckMultipleOf",(e,t)=>{we.init(e,t),e._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):ev(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Gv=T("$ZodCheckNumberFormat",(e,t)=>{we.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[n,a]=ov[t.format];e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,s.minimum=n,s.maximum=a,r&&(s.pattern=jv)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s)){o.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}s<n&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Vv=T("$ZodCheckBigIntFormat",(e,t)=>{we.init(e,t);let[r,i]=sv[t.format];e._zod.onattach.push(n=>{let a=n._zod.bag;a.format=t.format,a.minimum=r,a.maximum=i}),e._zod.check=n=>{let a=n.value;a<r&&n.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>i&&n.issues.push({origin:"bigint",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Wv=T("$ZodCheckMaxSize",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let n=i.value;n.size<=t.maximum||i.issues.push({origin:Qc(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Kv=T("$ZodCheckMinSize",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let n=i.value;n.size>=t.minimum||i.issues.push({origin:Qc(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),qv=T("$ZodCheckSizeEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=i=>{let n=i.value,a=n.size;if(a===t.size)return;let o=a>t.size;i.issues.push({origin:Qc(n),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Zv=T("$ZodCheckMaxLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let n=i.value;if(n.length<=t.maximum)return;let o=eu(n);i.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Hv=T("$ZodCheckMinLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let n=i.value;if(n.length>=t.minimum)return;let o=eu(n);i.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Jv=T("$ZodCheckLengthEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=i=>{let n=i.value,a=n.length;if(a===t.length)return;let o=eu(n),s=a>t.length;i.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Go=T("$ZodCheckStringFormat",(e,t)=>{var r,i;we.init(e,t),e._zod.onattach.push(n=>{let a=n._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),Xv=T("$ZodCheckRegex",(e,t)=>{Go.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Yv=T("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Uv),Go.init(e,t)}),Qv=T("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zv),Go.init(e,t)}),eb=T("$ZodCheckIncludes",(e,t)=>{we.init(e,t);let r=yr(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(n=>{let a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(i)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),tb=T("$ZodCheckStartsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`^${yr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),rb=T("$ZodCheckEndsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`.*${yr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function ak(e,t,r){e.issues.length&&t.issues.push(...Mt(r,e.issues))}var nb=T("$ZodCheckProperty",(e,t)=>{we.init(e,t),e._zod.check=r=>{let i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>ak(n,r,t.property));ak(i,r,t.property)}}),ib=T("$ZodCheckMimeType",(e,t)=>{we.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),ab=T("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ou=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
|
|
202
202
|
`).filter(o=>o),n=Math.min(...i.map(o=>o.length-o.trimStart().length)),a=i.map(o=>o.slice(n)).map(o=>" ".repeat(this.indent*2)+o);for(let o of a)this.content.push(o)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(a=>` ${a}`)];return new t(...r,n.join(`
|
|
203
203
|
`))}};var ob={major:4,minor:4,patch:3};var ee=T("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ob;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let n of i)for(let a of n._zod.onattach)a(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(o,s,u)=>{let d=Ni(o),p;for(let h of s){if(h._zod.def.when){if(cv(o)||!h._zod.def.when(o))continue}else if(d)continue;let g=o.issues.length,l=h._zod.check(o);if(l instanceof Promise&&u?.async===!1)throw new zr;if(p||l instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await l,o.issues.length!==g&&(d||(d=Ni(o,g)))});else{if(o.issues.length===g)continue;d||(d=Ni(o,g))}}return p?p.then(()=>o):o},a=(o,s,u)=>{if(Ni(o))return o.aborted=!0,o;let d=n(s,i,u);if(d instanceof Promise){if(u.async===!1)throw new zr;return d.then(p=>e._zod.parse(p,u))}return e._zod.parse(d,u)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let d=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return d instanceof Promise?d.then(p=>a(p,o,s)):a(d,o,s)}let u=e._zod.parse(o,s);if(u instanceof Promise){if(s.async===!1)throw new zr;return u.then(d=>n(d,i,s))}return n(u,i,s)}}ue(e,"~standard",()=>({validate:n=>{try{let a=dv(e,n);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return pv(e,n).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),ba=T("$ZodString",(e,t)=>{ee.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ov(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ce=T("$ZodStringFormat",(e,t)=>{Go.init(e,t),ba.init(e,t)}),cb=T("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Sv),Ce.init(e,t)}),ub=T("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=va(i))}else t.pattern??(t.pattern=va());Ce.init(e,t)}),lb=T("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ev),Ce.init(e,t)}),db=T("$ZodURL",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{try{let i=r.value.trim();if(!t.normalize&&t.protocol?.source===wv.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),pb=T("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=xv()),Ce.init(e,t)}),mb=T("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=vv),Ce.init(e,t)}),fb=T("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mv),Ce.init(e,t)}),hb=T("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=fv),Ce.init(e,t)}),gb=T("$ZodULID",(e,t)=>{t.pattern??(t.pattern=hv),Ce.init(e,t)}),yb=T("$ZodXID",(e,t)=>{t.pattern??(t.pattern=gv),Ce.init(e,t)}),vb=T("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yv),Ce.init(e,t)}),bb=T("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Rv(t)),Ce.init(e,t)}),Sb=T("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Nv),Ce.init(e,t)}),Eb=T("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Pv(t)),Ce.init(e,t)}),xb=T("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=bv),Ce.init(e,t)}),Ab=T("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Av),Ce.init(e,t),e._zod.bag.format="ipv4"}),_b=T("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_v),Ce.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Tb=T("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Tv(t.delimiter)),Ce.init(e,t),e._zod.bag.format="mac"}),Cb=T("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Cv),Ce.init(e,t)}),Ib=T("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Iv),Ce.init(e,t),e._zod.check=r=>{let i=r.value.split("/");try{if(i.length!==2)throw new Error;let[n,a]=i;if(!a)throw new Error;let o=Number(a);if(`${o}`!==a)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Db(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var wb=T("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Dv),Ce.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Db(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function xk(e){if(!_p.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Db(r)}var kb=T("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_p),Ce.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{xk(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Nb=T("$ZodE164",(e,t)=>{t.pattern??(t.pattern=kv),Ce.init(e,t)});function Ak(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Pb=T("$ZodJWT",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{Ak(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Rb=T("$ZodCustomStringFormat",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Pp=T("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=e._zod.bag.pattern??Tp,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let a=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...a?{received:a}:{}}),r}}),Ob=T("$ZodNumberFormat",(e,t)=>{Gv.init(e,t),Pp.init(e,t)}),su=T("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=Mv,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Rp=T("$ZodBigInt",(e,t)=>{ee.init(e,t),e._zod.pattern=$v,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),$b=T("$ZodBigIntFormat",(e,t)=>{Vv.init(e,t),Rp.init(e,t)}),jb=T("$ZodSymbol",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Mb=T("$ZodUndefined",(e,t)=>{ee.init(e,t),e._zod.pattern=Lv,e._zod.values=new Set([void 0]),e._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Fb=T("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=Fv,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Lb=T("$ZodAny",(e,t)=>{ee.init(e,t),e._zod.parse=r=>r}),Ub=T("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=r=>r}),zb=T("$ZodNever",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Bb=T("$ZodVoid",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Gb=T("$ZodDate",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,a=n instanceof Date;return a&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...a?{received:"Invalid Date"}:{},inst:e}),r}});function ck(e,t,r){e.issues.length&&t.issues.push(...Mt(r,e.issues)),t.value[r]=e.value}var Vb=T("$ZodArray",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let a=[];for(let o=0;o<n.length;o++){let s=n[o],u=t.element._zod.run({value:s,issues:[]},i);u instanceof Promise?a.push(u.then(d=>ck(d,r,o))):ck(u,r,o)}return a.length?Promise.all(a).then(()=>r):r}});function Np(e,t,r,i,n,a){let o=r in i;if(e.issues.length){if(n&&a&&!o)return;t.issues.push(...Mt(r,e.issues))}if(!o&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function _k(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=av(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Tk(e,t,r,i,n,a){let o=[],s=n.keySet,u=n.catchall._zod,d=u.def.type,p=u.optin==="optional",h=u.optout==="optional";for(let g in t){if(g==="__proto__"||s.has(g))continue;if(d==="never"){o.push(g);continue}let l=u.run({value:t[g],issues:[]},i);l instanceof Promise?e.push(l.then(m=>Np(m,r,g,t,p,h))):Np(l,r,g,t,p,h)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}var Ck=T("$ZodObject",(e,t)=>{if(ee.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let i=Mo(()=>_k(t));ue(e._zod,"propValues",()=>{let s=t.shape,u={};for(let d in s){let p=s[d]._zod;if(p.values){u[d]??(u[d]=new Set);for(let h of p.values)u[d].add(h)}}return u});let n=ya,a=t.catchall,o;e._zod.parse=(s,u)=>{o??(o=i.value);let d=s.value;if(!n(d))return s.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),s;s.value={};let p=[],h=o.shape;for(let g of o.keys){let l=h[g],m=l._zod.optin==="optional",f=l._zod.optout==="optional",y=l._zod.run({value:d[g],issues:[]},u);y instanceof Promise?p.push(y.then(v=>Np(v,s,g,d,m,f))):Np(y,s,g,d,m,f)}return a?Tk(p,d,s,u,i.value,e):p.length?Promise.all(p).then(()=>s):s}}),Wb=T("$ZodObjectJIT",(e,t)=>{Ck.init(e,t);let r=e._zod.parse,i=Mo(()=>_k(t)),n=g=>{let l=new ou(["shape","payload","ctx"]),m=i.value,f=A=>{let x=pp(A);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};l.write("const input = payload.value;");let y=Object.create(null),v=0;for(let A of m.keys)y[A]=`key_${v++}`;l.write("const newResult = {};");for(let A of m.keys){let x=y[A],_=pp(A),C=g[A],R=C?._zod?.optin==="optional",W=C?._zod?.optout==="optional";l.write(`const ${x} = ${f(A)};`),R&&W?l.write(`
|
|
@@ -338,7 +338,7 @@ ${XA}
|
|
|
338
338
|
`)}
|
|
339
339
|
`}Bi(O$,"renderUpdateEnvelope");var $f,jf=!1;function RJ(e){$f=e,jf=!1}Bi(RJ,"armUpdateEnvelope");function OJ(){$f=void 0,jf=!1}Bi(OJ,"disarmUpdateEnvelope");function $$(){if(!(jf||$f===void 0)){jf=!0;try{return $f()}catch(e){un.debug("UpdateEnvelope","Envelope source failed",{error:ae(e instanceof Error?e.message:String(e))});return}}}Bi($$,"takeUpdateEnvelope");function Ds(){let e=$$();return e===void 0?"":O$(e)}Bi(Ds,"takeUpdateEnvelopeTail");var $J=Object.defineProperty,Pa=(e,t)=>$J(e,"name",{value:t,configurable:!0}),w={success:Pa(e=>e.outcome==="success","success"),error:Pa(e=>e.outcome==="error","error"),empty:Pa(e=>e.outcome==="empty","empty"),unsupported:Pa(e=>e.outcome==="unsupported","unsupported"),successDryRun:Pa(e=>e.outcome==="success"&&e.dryRun==="true","successDryRun"),successOffline:Pa(e=>e.outcome==="success"&&e.offline==="true","successOffline"),errorWithCode:Pa(e=>t=>t.outcome==="error"&&t.errorCode===e,"errorWithCode")};var jJ=Object.defineProperty,MJ=(e,t)=>jJ(e,"name",{value:t,configurable:!0}),FJ=["account deploy","add","agent install-skill","agent session-context","apps create","apps describe","apps detect","apps list","assets compliance","assets list","assets show","assets summary","aws exec","build","ci run","ci setup","ci status","ci token create","ci token list","ci token revoke","ci verify","compliance fix","compliance fix --execute","connect","connect status","costs show","create account","create app","create domain","create org","deploy","deploy diff","deploy logs","deployments cancel","deployments force-release","deployments list","destroy","dev down","dev list","dev substrate down","dev up","domain","domain create","domain delegate","domain deploy","domain destroy","domain eject","domain export","domain import","domain list","domain records list","domain sync","domain verify","drift detect","drift repair","drift resume","fjall","history","home","import","list","login","metrics show","migrate identity","modify","org bind","org deploy","org get","org identity setup-google","platform deploy","remove","restore","secrets delete","secrets exec","secrets export","secrets get","secrets import","secrets list","secrets set","services","status","target get","target list","target set","token create","token list","token revoke","token show","tunnel","undo","unlock bucket","user add","user list","user rebind","user remove","validate"],LJ=new Set(FJ);function Mf(e){return typeof e=="string"&&LJ.has(e)}MJ(Mf,"isAgentWriterSurface");var Xu="fjall";var UJ=Object.defineProperty,zJ=(e,t)=>UJ(e,"name",{value:t,configurable:!0}),j$=[{command:Xu,match:w.error,templates:["Run `fjall --help` to list the available commands"]},{command:"home",match:w.success,templates:["Run `fjall apps describe <name>` to see app details","Run `fjall deploy <name>` to deploy","Run `fjall status <name>` to check a specific app"]},{command:"home",match:w.empty,templates:[`Run \`${te.createApplicationAgent} --name "<name>"\` to create your first app`,`Run \`${te.connect}\` to connect an AWS account`]},{command:"apps list",match:w.success,templates:["Run `fjall apps describe <name>` to see app details","Run `fjall deploy <name>` to deploy",`Run \`${te.createApplicationAgent} --name "<name>"\` to create a new app`]},{command:"apps list",match:w.empty,templates:[`Run \`${te.createApplicationAgent} --name "<name>"\` to create your first app`,`Run \`${te.connect}\` to connect an AWS account first`]},{command:"apps describe",match:w.success,templates:["Run `fjall deploy <app>` to deploy","Run `fjall secrets list --app <app>` to list secrets","Run `fjall status <app>` to check health"]},{command:"apps detect",match:w.empty,templates:["Run `fjall apps detect <path> --agent` against the directory holding the application, if this was the repository root","Pass `--pattern staticsite` with `--source`, `--build-command` and `--output-dir` explicitly if the app has no recognised framework dependency"]},{command:"apps detect",match:w.success,templates:[`Run \`${te.createApplicationAgent} --name <name> --pattern <pattern>\` using the \`pattern\` column \u2014 never the \`framework\` column`,"Skip any row whose `role` is `library` \u2014 those are not deployable applications","Confirm `outputDir` exists after building: it is a framework convention, not a verified path"]},{command:"apps create",match:w.successOffline,templates:["Run `npm install` in the app directory \u2014 `--offline` skipped it",`Re-run \`${te.createApplicationAgent}\` without \`--offline\` once you have credentials, to register the app`,"Run `fjall deploy <app>` only after both of the above"]},{command:"apps create",match:w.success,templates:["Run `fjall deploy <app>` to deploy your new app","Run `fjall secrets set --app <app> DB_URL=<url>` to configure secrets"]},{command:"status",match:w.success,templates:["Run `fjall deploy <app>` to deploy","Run `fjall apps describe <app>` for details"]},{command:"deploy",match:w.success,templates:["Run `fjall status <app>` to check health","Run `fjall apps describe <app>` for full details"]},{command:"deploy",match:w.error,templates:["Run `fjall deploy <app>` to retry","Run `fjall status <app>` to check current state"]},{command:"destroy",match:w.success,templates:["Run `fjall list` to see remaining resources","Run `fjall apps list` to see remaining apps"]},{command:"destroy",match:w.error,templates:["Run `fjall destroy <app> --skip-confirmation` to force destroy","Run `fjall status <app>` to check current state"]},{command:"build",match:w.success,templates:["Run `fjall deploy <app> --image-tag <tag>` with a tag from `artefacts` to roll out this build","Run `fjall status <app>` to check health"]},{command:"connect",match:zJ(e=>e.outcome==="success"&&e.pending==="true","match"),templates:["Run `fjall connect status --external-id <externalId> --wait` to block until the stack completes"]},{command:"connect",match:w.success,templates:[`Run \`${te.accountDeploy}\` or \`${te.organisationDeploy}\` to deploy infrastructure`,`Run \`${te.createApplicationAgent} --name "<name>"\` to create an app`]},{command:"connect status",match:w.success,templates:["Run `fjall connect status --external-id <id> --wait` to block until a pending stack completes",`Run \`${te.accountDeploy}\` or \`${te.organisationDeploy}\` to deploy infrastructure`]},{command:"connect status",match:w.empty,templates:[`Run \`${te.connect}\` to connect an AWS account`]},{command:"login",match:w.success,templates:["Run `fjall apps list` to see your applications",`Run \`${te.connect}\` to connect an AWS account`]},{command:"list",match:w.success,templates:["Run `fjall apps describe <name>` for app details","Run `fjall deploy <name>` to deploy"]},{command:"add",match:w.success,templates:["Run `fjall deploy <app>` to deploy the change","Run `fjall apps describe <app>` to see updated resources"]},{command:"modify",match:w.success,templates:["Run `fjall validate --deep --app <app>` to typecheck the edited infrastructure.ts","Run `fjall deploy <app>` to deploy the change","Run `fjall undo --app <app>` to restore the .bak sidecar if the edit was wrong"]},{command:"remove",match:w.success,templates:["Run `fjall validate --deep --app <app>` to confirm nothing still references the removed resource","Run `fjall deploy <app>` to deploy the change","Run `fjall undo --app <app>` to restore the .bak sidecar if the removal was wrong"]},{command:"validate",match:w.success,templates:["Run `fjall deploy <app>` to deploy the validated infrastructure"]},{command:"validate",match:w.error,templates:["Run `fjall undo --app <app>` to restore the most recent .bak sidecar","Run `fjall history --app <app>` to list older snapshots to restore from"]},{command:"undo",match:w.success,templates:["Run `fjall validate --deep --app <app>` to confirm the restored infrastructure.ts typechecks","Run `fjall history --app <app>` to restore an older snapshot instead"]},{command:"history",match:w.success,templates:["Run `fjall history --restore <timestamp> --app <app>` to restore a specific snapshot","Run `fjall undo --app <app>` to restore the most recent .bak sidecar instead"]},{command:"history",match:w.empty,templates:["No snapshots yet \u2014 `fjall add`, `fjall modify` and `fjall remove` each write one before editing infrastructure.ts"]},{command:"tunnel",match:w.success,templates:["Run `fjall tunnel <app> --background` to run in the background"]}];var M$=[{command:"secrets list",match:w.success,templates:["Run `fjall secrets set --app <app> KEY=VALUE` to set a secret","Run `fjall rollout <app>` to restart running services with the latest values"]},{command:"secrets list",match:w.empty,templates:["Run `fjall secrets set --app <app> KEY=VALUE` to add a secret","Run `fjall secrets import --app <app> <file>` to bulk import"]},{command:"secrets get",match:w.success,templates:["Run `fjall secrets set --app <app> KEY=VALUE` to update","Run `fjall secrets list --app <app>` to see all secrets"]},{command:"secrets set",match:w.success,templates:["Run `fjall rollout <app>` to restart running services with the new value","New key? Run a full `fjall deploy <app>` so the task definition gains the reference","Run `fjall secrets list --app <app>` to verify"]},{command:"secrets delete",match:w.success,templates:["Declared for a service? Re-run with `--remove-declaration` (or edit infrastructure.ts ssmSecrets), then `fjall deploy <app>` \u2014 a stale declaration breaks task launches","Not declared anywhere? Run `fjall rollout <app>` so running services drop the previous value","Run `fjall secrets list --app <app>` to verify"]},{command:"secrets import",match:w.success,templates:["Run `fjall rollout <app>` to restart running services with the imported values","New keys? Run a full `fjall deploy <app>` so task definitions gain the references","Run `fjall secrets list --app <app>` to verify"]},{command:"secrets export",match:w.success,templates:["Run `fjall secrets list --app <app>` to see all secret names","Run `fjall secrets import --app <app> <file>` to restore"]},{command:"secrets exec",match:w.success,templates:["Run `fjall secrets list --app <app>` to see available secrets"]}];var BJ=Object.defineProperty,GJ=(e,t)=>BJ(e,"name",{value:t,configurable:!0});var F$="identity-only organisation deploys typically take 2-5 minutes",m_=`Run \`${te.organisationDeploy}\` to apply the change (${F$}).`,Ufe=`Deploy the organisation now to apply this change? (${F$})`,VJ="Groups have no members",ws="fjall user add <email> --group <group>",WJ=ws,zfe=`${VJ} \u2014 run \`${WJ}\` to declare access.`;function KJ(e,t){return`Declared identity (source "${e}"): ${String(t)} user${t===1?"":"s"}`}GJ(KJ,"formatUserListHeading");var Bfe=`No users or memberships declared. Run \`${ws}\` to add one.`;var L$=[{command:"user list",match:w.success,templates:[`Run \`${ws}\` to grant access`,`Run \`${te.organisationDeploy}\` to apply declared changes`]},{command:"user list",match:w.empty,templates:[`Run \`${ws}\` to declare the first membership`]},{command:"user add",match:w.success,templates:[m_,"Run `fjall user list` to review the declared users"]},{command:"user remove",match:w.success,templates:[m_,"Run `fjall user list` to see the remaining users"]},{command:"user rebind",match:w.success,templates:[`Run \`${te.organisationDeploy}\` to re-resolve external users against the identity store`]},{command:"org identity setup-google",match:w.success,templates:[`Run \`${ws} --live\` to declare access for a synced user`,"Run `fjall user list --live` to compare declared memberships against the identity store"]},{command:"token create",match:w.success,templates:["Run `fjall token list` to see all tokens","Save the token now \u2014 it cannot be retrieved again"]},{command:"token list",match:w.success,templates:["Run `fjall token create --name <name> --scope <scope> --expires <duration>` to create a token","Run `fjall token revoke <id>` to revoke a token"]},{command:"token show",match:w.success,templates:["Run `fjall token revoke <id>` to revoke this token","Run `fjall token list` to see all tokens"]},{command:"token revoke",match:w.success,templates:["Run `fjall token list` to see remaining tokens"]},{command:"target list",match:w.success,templates:["Run `fjall target set <name>` to change active target","Run `fjall deploy <app>` to deploy to the active target","Run `fjall apps list` to see applications"]},{command:"target list",match:w.empty,templates:[`Run \`${te.connect}\` to connect an AWS account`,`Run \`${te.login}\` to authenticate if not logged in`]},{command:"org bind",match:w.success,templates:["Run `fjall org get` to confirm the organisation's regions and accounts","Commit fjall-config.json so every checkout of this project carries the binding"]},{command:"org get",match:w.success,templates:["Run `fjall target list` to see which account/region pairs are deployable","Run `fjall accounts list` to see application-hosting accounts only"]},{command:"target get",match:w.success,templates:["Run `fjall target set <name>` to change active target","Run `fjall target list` to see all targets"]},{command:"target get",match:w.empty,templates:["Run `fjall target set <name>` to set a target","Run `fjall target list` to see available targets"]},{command:"target set",match:w.success,templates:["Run `fjall deploy <app>` to deploy to this target","Run `fjall target get` to verify the active target"]},{command:"target set",match:w.errorWithCode("NOT_FOUND"),templates:["Run `fjall target list` to see available targets",`Run \`${te.connect}\` to connect an AWS account if none available`]}];import{platform as gX,arch as yX}from"os";import*as Re from"fs";import*as Nt from"path";var qJ=Object.defineProperty,Ff=(e,t)=>qJ(e,"name",{value:t,configurable:!0});function ZJ(e){return e.success===!0}Ff(ZJ,"isSuccess");function HJ(e){return e.success===!1}Ff(HJ,"isFailure");function Ra(e){return{success:!0,data:e}}Ff(Ra,"success");function ln(e){return{success:!1,error:e}}Ff(ln,"failure");var JJ=Object.defineProperty,Lf=(e,t)=>JJ(e,"name",{value:t,configurable:!0}),XJ=Lf(e=>{try{return JSON.stringify(e)}catch{return"[unserializable]"}},"safeStringify"),U$=Lf((e,t,r,i)=>{let n=new Date().toISOString(),a=e.toUpperCase(),o=i?` ${XJ(i)}`:"";process.stderr.write(`[${n}] [${a}] [${t}] ${r}${o}
|
|
340
340
|
`)},"defaultWriter"),Oa=U$;function YJ(e){Oa=e}Lf(YJ,"configureLogWriter");function QJ(){Oa=U$}Lf(QJ,"resetLogWriter");var $a={info(e,t,r){Oa("info",e,t,r)},warn(e,t,r){Oa("warn",e,t,r)},error(e,t,r){Oa("error",e,t,r)},debug(e,t,r){process.env.FJALL_DEBUG==="true"&&Oa("debug",e,t,r)},trace(e,t,r){process.env.FJALL_TRACE==="true"&&Oa("trace",e,t,r)},isDebugEnabled(){return process.env.FJALL_DEBUG==="true"}};var eX=Object.defineProperty,f_=(e,t)=>eX(e,"name",{value:t,configurable:!0}),h_=c.object({name:c.string(),type:c.enum(["apex","delegated"]),parentDomain:c.string().optional(),account:c.string().optional(),region:c.string().optional()}).strict(),g_=c.object({id:c.string().min(1),name:c.string().min(1).optional()}).strict(),Uf=c.object({activeTarget:c.string().optional(),domains:c.array(h_).optional(),capacityIdentity:Hm.optional(),organisation:g_.optional()}).strict(),Yu=c.object({activeTarget:c.string().optional(),domains:c.array(h_).optional(),capacityIdentity:Hm.optional(),organisation:g_.optional()});function ja(e={}){return JSON.stringify(e,null,2)}f_(ja,"serialiseRootConfig");var zf=Uf.keyof().options;function y_(e,t,r){let i=t[r];i!==void 0&&(e[r]=i)}f_(y_,"copyDefinedKey");function Bf(e,t){if(t===void 0)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let i of r)if(e[i]!==t[i])return!1;return!0}f_(Bf,"domainEntriesEqual");var tX=Object.defineProperty,ks=(e,t)=>tX(e,"name",{value:t,configurable:!0});function Qu(e){if(e===void 0||e==="")return{kind:"absent"};let t;try{t=JSON.parse(e)}catch(a){return{kind:"unmergeable",reason:`the existing file could not be read or parsed as JSON (${ae(ze(a))})`}}if(typeof t!="object"||t===null||Array.isArray(t))return{kind:"unmergeable",reason:"it does not contain a JSON object"};let r=Yu.safeParse(t);if(!r.success){let a=r.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`).join("; ");return{kind:"unmergeable",reason:`a recognised key in the existing file is malformed (${ae(a)})`}}let i={},n=zf;for(let[a,o]of Object.entries(t))n.includes(a)||(i[a]=o);return{kind:"ok",disk:{known:r.data,foreign:i}}}ks(Qu,"readRootConfigForMerge");function z$(e,t,r){return JSON.stringify(e[r])!==JSON.stringify(t[r])}ks(z$,"sessionChangedKey");function B$(e,t,r){let i=t.domains,n=r.domains??[];if(i===void 0&&n.length===0)return e;let a=ks(h=>h.toLowerCase(),"norm"),o=i??[],s=new Map(n.map(h=>[a(h.name),h])),u=new Map(o.map(h=>[a(h.name),h])),d=[],p=new Set;for(let h of e??[]){let g=a(h.name);p.add(g);let l=u.get(g),m=s.get(g);if(l!==void 0&&!Bf(l,m)){d.push(l);continue}l===void 0&&m!==void 0||d.push(h)}for(let h of o){let g=a(h.name);p.has(g)||Bf(h,s.get(g))||d.push(h)}return d}ks(B$,"mergeDomains");function el(e,t,r){let i={...e.foreign,...e.known};for(let a of zf)a!=="domains"&&z$(t,r,a)&&(t[a]===void 0?delete i[a]:y_(i,t,a));let n=B$(e.known.domains,t,r);return n!==void 0?i.domains=n:delete i.domains,i}ks(el,"mergeRootConfig");function G$(e,t,r={}){let i=Qu(e);return i.kind==="unmergeable"?{kind:"unmergeable",reason:i.reason}:i.kind==="absent"?{kind:"ok",content:ja(t)}:{kind:"ok",content:ja(el(i.disk,t,r))}}ks(G$,"mergeRootConfigContent");var rX=Object.defineProperty,nX=(e,t)=>rX(e,"name",{value:t,configurable:!0}),iX=10;var aX=c.object({activeTarget:c.string().optional()}),Gf=class e{static{nX(this,"Config")}rootConfig;configPath=null;loadFailed=!1;parseDegraded=!1;loadedSnapshot={};searchStartDir;constructor(t,r){this.rootConfig=t??{},this.configPath=r??null}static findConfigDirectory(t){let r=t!==void 0&&t!==""?t:process.cwd();for(let i=0;i<iX;i++){let n=Nt.join(r,"fjall"),a=Nt.join(n,Kn);if(Re.existsSync(a))return n;let o=Nt.join(r,Kn);if(Re.existsSync(o))return r;let s=Nt.dirname(r);if(s===r)break;r=s}return null}static loadConfigFile(t){try{return Re.accessSync(t,Re.constants.R_OK),Re.readFileSync(t,{encoding:"utf8"})}catch(r){return $a.warn("Config",`Config file at ${t} could not be read; using defaults`,{file:t,error:ae(ze(r))}),null}}static loadConfig(t){let r=e.findConfigDirectory(t);if(!r){let u=new e;return u.searchStartDir=t,u}let i=Nt.join(r,Kn),n=e.loadConfigFile(i);if(n===null){let u=new e(void 0,i);return u.searchStartDir=t,u.loadFailed=!0,u}let a,o=!1;if(n!==""){let u;try{u=JSON.parse(n)}catch(p){throw e.formatZodError(p,Kn)}let d=Uf.safeParse(u);if(d.success)a=d.data;else{let p=Yu.safeParse(u);a=p.success?p.data:{},o=!p.success,p.success?$a.warn("Config","fjall-config.json contains keys this version does not recognise (only activeTarget, domains, capacityIdentity and organisation are read). They were most likely written by a newer fjall version \u2014 leave them in place; saves preserve them verbatim.",{file:i}):$a.warn("Config","fjall-config.json has a malformed activeTarget, domains or capacityIdentity value, so its contents were ignored for this run \u2014 any capacity-identity pins it holds will NOT apply (a pinned stack deploys unpinned and is blocked by the rename gate). Fix the file by hand; do NOT regenerate it, which would discard the pins.",{file:i})}}let s=new e(a,i);return s.searchStartDir=t,s.parseDegraded=o,s.loadedSnapshot=structuredClone(s.rootConfig),s}static formatZodError(t,r){if(t instanceof c.ZodError&&t.issues.length>0){let n=t.issues.map(a=>`${a.path.join(".")}: ${a.message}`).join("; ");return new Error(`Failed to parse ${r}: ${n}`)}let i=(t instanceof Error?t.message:String(t)).replace(/\n/g," ").substring(0,500);return new Error(`Failed to parse ${r}: ${i}`)}saveConfig(){let t=Nt.join(this.resolveProjectDirectory()??Nt.join(this.searchStartDir??process.cwd(),"fjall"),Kn);if(this.loadFailed)return ln(new Error(`Refusing to save ${t}: the file exists but could not be read when this config loaded, so saving would replace its contents with state that never included them. Fix the file permissions (e.g. chmod u+rw ${t}) and retry.`));let r=Nt.dirname(t);try{Re.mkdirSync(r,{recursive:!0})}catch(s){return ln(new Error(`Cannot create config directory ${r}: ${ae(ze(s))}`))}let i=e.assertWritable(t,r);if(!i.success)return i;let n=this.mergeWithDisk(t);if(!n.success)return n;let a=ja(n.data),o=`${t}.tmp-${process.pid}`;try{Re.writeFileSync(o,a,{mode:384}),Re.renameSync(o,t)}catch(s){return ln(new Error(`Failed to save ${t}: ${ae(ze(s))}`))}return this.configPath=t,Ra(void 0)}static assertWritable(t,r){if(Re.existsSync(t))try{Re.accessSync(t,Re.constants.W_OK)}catch{return ln(new Error(`Cannot save ${t}: the file is read-only. Make it writable (e.g. chmod u+w ${t}) and retry.`))}try{Re.accessSync(r,Re.constants.W_OK)}catch{return ln(new Error(`Cannot save ${t}: the directory ${r} is not writable. Make it writable (e.g. chmod u+w ${r}) and retry.`))}return Ra(void 0)}mergeWithDisk(t){let r=e.readDiskConfigForMerge(t);return r.kind==="unmergeable"?ln(new Error(`Refusing to save ${t}: ${r.reason}. Writing now would keep only this session's state and drop everything else the file carries (including keys written by other fjall versions). Fix or remove the file and retry.`)):r.kind==="absent"?Ra(this.rootConfig):Ra(el(r.disk,this.rootConfig,this.loadedSnapshot))}static readDiskConfigForMerge(t){if(!Re.existsSync(t))return{kind:"absent"};let r;try{r=Re.readFileSync(t,{encoding:"utf8"})}catch(i){return{kind:"unmergeable",reason:`the existing file could not be read or parsed as JSON (${ae(ze(i))})`}}return Qu(r)}static getConfigDirectory(t){return e.findConfigDirectory(t)}getConfigPath(){return this.configPath}isContentUnavailable(){return this.loadFailed||this.parseDegraded}static warnedLegacyActiveTarget=!1;localConfigCache;resolveProjectDirectory(){return this.configPath!==null?Nt.dirname(this.configPath):e.findConfigDirectory(this.searchStartDir)}localConfigFile(){let t=this.resolveProjectDirectory();return t===null?null:Nt.join(t,zi,Lu)}loadLocalConfig(){if(this.localConfigCache===void 0){let t=this.localConfigFile();if(t===null)return this.localConfigCache={};try{let r=Re.readFileSync(t,{encoding:"utf8"}),i=aX.safeParse(JSON.parse(r));this.localConfigCache=i.success?i.data:{}}catch{this.localConfigCache={}}}return this.localConfigCache}writeLocalConfig(t){let r=this.localConfigFile();if(r===null)return ln(new Error("Cannot persist local state: no fjall-config.json was found from this directory, so there is no project to anchor `.fjall/local.json` to. Run this from inside a fjall project, or run `fjall create account` / `fjall create app` first."));try{Re.mkdirSync(Nt.dirname(r),{recursive:!0});let i=`${r}.tmp-${process.pid}`;Re.writeFileSync(i,JSON.stringify(t,null,2)+`
|
|
341
|
-
`,{encoding:"utf8"}),Re.renameSync(i,r),Tf(Nt.dirname(Nt.dirname(r)),[Af,...Uu],{header:GA,marker:n$})}catch(i){return ln(new Error(`Failed to write ${r}: ${ae(ze(i))}`))}return this.localConfigCache=t,Ra(void 0)}static warnLegacyActiveTargetOnce(){e.warnedLegacyActiveTarget||(e.warnedLegacyActiveTarget=!0,$a.warn("Config","`activeTarget` in fjall-config.json is deprecated and ignored: a committed target must never re-aim a deploy or CI pipeline. Run `fjall target set <name>` to store it locally in .fjall/local.json, then remove `activeTarget` from the committed fjall-config.json."))}getActiveTarget(){let t=this.loadLocalConfig().activeTarget;if(t!==void 0)return t;this.rootConfig.activeTarget!==void 0&&e.warnLegacyActiveTargetOnce()}setActiveTarget(t){let r=this.loadLocalConfig();return r.activeTarget=t,this.writeLocalConfig(r)}clearActiveTarget(){let t=this.loadLocalConfig();return delete t.activeTarget,this.writeLocalConfig(t)}getDomains(){return this.rootConfig.domains??[]}setDomains(t){this.rootConfig.domains=t}addDomain(t){this.rootConfig.domains||(this.rootConfig.domains=[]),this.rootConfig.domains.push(t)}getDomain(t){return this.rootConfig.domains?.find(r=>r.name.toLowerCase()===t.toLowerCase())}removeDomain(t){if(!this.rootConfig.domains)return!1;let r=this.rootConfig.domains.findIndex(i=>i.name.toLowerCase()===t.toLowerCase());return r===-1?!1:(this.rootConfig.domains.splice(r,1),!0)}getOrganisation(){return this.rootConfig.organisation}setOrganisation(t){this.rootConfig.organisation=t}clearOrganisation(){delete this.rootConfig.organisation}};var oX=Object.defineProperty,Gi=(e,t)=>oX(e,"name",{value:t,configurable:!0});function v_(e){let t;try{t=Gf.loadConfig(e)}catch(i){return{kind:"unreadable",reason:ae(ze(i))}}if(t.isContentUnavailable())return{kind:"unreadable",reason:"fjall-config.json exists but its contents could not be loaded (the preceding warning names the problem)"};let r=t.getOrganisation();return r!==void 0?{kind:"bound",bound:r}:t.getConfigPath()===null?{kind:"no_project"}:{kind:"unbound"}}Gi(v_,"readProjectBinding");function b_(e,t,r){switch(e.kind){case"unreadable":return e;case"no_project":return{kind:"unbound",projectFound:!1,identity:t};case"unbound":return{kind:"unbound",projectFound:!0,identity:t};case"bound":return t===null?{kind:"unverifiable",bound:e.bound,reason:r??"the organisation could not be resolved"}:e.bound.id===t.id?{kind:"matched",bound:e.bound}:{kind:"mismatched",bound:e.bound,actual:t}}}Gi(b_,"resolveBindingVerdict");function V$(e,t={}){return b_(v_(t.startDir),e,t.unresolvedReason)}Gi(V$,"checkProjectOrganisation");function Ma(e){return e.name!==void 0&&e.name!==""?`${e.name} (${e.id})`:e.id}Gi(Ma,"describeOrganisation");function W$(e,t,r){return`Refusing to ${e}: this project's fjall-config.json records organisation ${Ma(t)} as its home, but the credential in use belongs to ${Ma(r)}. Nothing was created, synthesised or deployed. Cure: authenticate as ${Ma(t)} ('fjall login', or set FJALL_API_KEY to a key for that organisation), or \u2014 if this project really is moving \u2014 run 'fjall org bind --org ${r.id} --force' to re-bind it.`}Gi(W$,"buildWrongOrganisationMessage");function K$(e,t){return`Refusing to ${e}: ${t}, so this project's organisation binding cannot be checked. Nothing was created, synthesised or deployed. Cure: fix fjall-config.json (permissions or contents), then re-run.`}Gi(K$,"buildUnreadableConfigMessage");function q$(e,t){return`Could not confirm which organisation your credential belongs to (${t}). Proceeding \u2014 this project is bound to ${Ma(e)}, and a mismatch would not have been caught.`}Gi(q$,"buildUnverifiableNotice");function Z$(e){return`This project is not bound to an organisation. Run 'fjall org bind' to pin it to ${Ma(e)} \u2014 afterwards, any command run here with another organisation's credential is refused instead of silently landing there.`}Gi(Z$,"buildUnboundNotice");import{createHash as uX}from"node:crypto";var sX=Object.defineProperty,cX=(e,t)=>sX(e,"name",{value:t,configurable:!0});function H$(e,t){return uX("sha256").update(`${e}${t}`).digest("hex")}cX(H$,"credentialFingerprint");import*as Wf from"node:fs";var lX=Object.defineProperty,Vf=(e,t)=>lX(e,"name",{value:t,configurable:!0}),J$="org-config-cache.json";function S_(){return vs(J$)}Vf(S_,"orgConfigCachePath");function E_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Vf(E_,"isObject");function x_(e){return E_(e)&&typeof e.organisationId=="string"&&e.organisationId!==""&&typeof e.organisationName=="string"}Vf(x_,"isCachedCredentialIdentity");function X$(e){try{let t=S_();if(!Wf.existsSync(t))return null;let r=JSON.parse(Wf.readFileSync(t,"utf-8"));return!E_(r)||r.credentialFingerprint!==e?null:x_(r.identity)?r.identity:null}catch(t){return $a.debug("cachedCredentialIdentity","Cache read failed, treating as a miss",{error:ae(ze(t))}),null}}Vf(X$,"readCachedCredentialIdentity");var dX=Object.defineProperty,pX=(e,t)=>dX(e,"name",{value:t,configurable:!0}),Y$="https://fjall.io";function Kf(){let e=process.env.FJALL_API_URL;return e!==void 0&&e!==""?e:Y$}pX(Kf,"resolveApiBaseUrl");var Q$={name:"@fjall/cli",version:"33.0.0",repository:{type:"git",url:"git+https://github.com/fjall-tech/fjall.git",directory:"cli"},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 && node ../scripts/stamp-build.mjs",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 && node ../scripts/sync-ci-plugin-major.mjs",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.62.0","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/ejs":"^3.1.5","@types/prompts":"^2.4.9","@types/proper-lockfile":"^4.1.4","@types/react":"^19.2.17","@typescript-eslint/parser":"^8.65.0","@vitest/coverage-v8":"^4.1.10","aws-cdk-lib":"^2.265.0",constructs:"^10.7.2",eslint:"^10.8.0","ink-testing-library":"^4.0.0",jsdom:"^30.0.1",prettier:"^3.9.6","react-dom":"^19.2.8","strip-ansi":"^6.0.1","tsc-watch":"^7.2.1",tsx:"^4.23.1","typescript-eslint":"^8.65.0",vitest:"4.1.10"},dependencies:{"@anthropic-ai/sdk":"^0.115.0","@aws-sdk/client-acm":"^3.1098.0","@aws-sdk/client-auto-scaling":"^3.1098.0","@aws-sdk/client-backup":"^3.1098.0","@aws-sdk/client-cloudformation":"^3.1098.0","@aws-sdk/client-cost-explorer":"^3.1098.0","@aws-sdk/client-ec2":"^3.1098.0","@aws-sdk/client-ecr":"^3.1098.0","@aws-sdk/client-ecs":"^3.1098.0","@aws-sdk/client-elasticache":"^3.1098.0","@aws-sdk/client-iam":"^3.1098.0","@aws-sdk/client-identitystore":"^3.1098.0","@aws-sdk/client-lambda":"^3.1098.0","@aws-sdk/client-organizations":"^3.1098.0","@aws-sdk/client-ram":"^3.1098.0","@aws-sdk/client-rds":"^3.1098.0","@aws-sdk/client-route-53":"^3.1098.0","@aws-sdk/client-s3":"^3.1098.0","@aws-sdk/client-secrets-manager":"^3.1098.0","@aws-sdk/client-ssm":"^3.1098.0","@aws-sdk/client-sso":"^3.1098.0","@aws-sdk/client-sso-admin":"^3.1098.0","@aws-sdk/client-sso-oidc":"^3.1098.0","@aws-sdk/client-sts":"^3.1098.0","@fjall/deploy-core":"^33.0.0","@fjall/generator":"^33.0.0","@fjall/util":"^33.0.0","@nx/devkit":"^23.1.0","@opennextjs/aws":"^4.1.0","@smithy/node-http-handler":"^4.9.13","@toon-format/toon":"^4.1.0","aws-cdk":"^2.1134.0",axios:"^1.19.0",chalk:"^6.0.0","cli-cursor":"^5.0.0",commander:"^15.0.0",ejs:"^6.0.1",ink:"^7.1.1","js-yaml":"^5.2.2",open:"^11.0.0",ora:"^9.4.1",prompts:"^2.4.2","proper-lockfile":"^4.1.2",protobufjs:"^8.7.1",react:"^19.2.8",typescript:"^6.0.3","update-check":"^1.5.4",zod:"^4.4.3"}};var fX=Object.defineProperty,hX=(e,t)=>fX(e,"name",{value:t,configurable:!0}),Uhe=`fjall-cli/${Q$.version} node/${process.versions.node} ${gX()}/${yX()}`;var e1=Kf(),zhe=c.looseObject({deviceCode:c.string(),userCode:c.string(),verificationUri:c.string(),expiresIn:c.number(),interval:c.number()}),Bhe=c.looseObject({status:c.string(),apiKey:c.string().optional(),organisationId:c.string().optional(),organisationName:c.string().optional(),email:c.string().optional()}),Ghe=c.looseObject({application:c.looseObject({id:c.string()})}),A_=c.looseObject({id:c.string(),name:c.string(),vpcCidr:c.string().nullable(),connectedAwsAccountId:c.string().nullable()}),Vhe=c.looseObject({applications:c.array(A_),nextCursor:c.string().optional()}),Whe=c.looseObject({application:A_}),Khe=c.looseObject({applications:c.array(A_)}),qhe=c.looseObject({application:c.looseObject({id:c.string(),name:c.string()})}),Zhe=c.looseObject({primaryRegion:c.string().nullish(),secondaryRegions:c.array(c.string()).optional(),disasterRecoveryRegion:c.string().nullish(),providerAccounts:c.custom(e=>Array.isArray(e)),ssoSessions:c.record(c.string(),c.looseObject({ssoRegion:c.string(),ssoStartUrl:c.string()})).optional(),rootOidcRoleArn:c.string().nullish(),allowCodemodLlmFallback:c.boolean().optional(),rootAccessManagement:c.custom(e=>typeof e=="string").optional(),requireTrackedDeploys:c.boolean().optional().catch(void 0)}),Hhe=c.looseObject({id:c.string(),token:c.string(),tokenPrefix:c.string(),name:c.string(),scopes:c.array(c.string())}),vX=c.looseObject({id:c.string(),name:c.string(),tokenPrefix:c.string(),scopes:c.array(c.string()),resourceConstraints:c.record(c.string(),c.unknown()),sourceTag:c.string().nullable(),expiresAt:c.string(),createdAt:c.string(),revokedAt:c.string().nullable(),revokedReason:c.string().nullable(),lastUsedAt:c.string().nullable(),usageCount:c.number(),deniedCount:c.number()}),Jhe=c.looseObject({tokens:c.array(vX)}),Xhe=c.looseObject({scopes:c.array(c.string()),expiresAt:c.string().optional()}),bX=c.looseObject({id:c.string(),awsAccountId:c.string(),accountName:c.string().nullable(),environment:c.string().nullable()}),Yhe=c.looseObject({accounts:c.array(bX)}),SX=c.looseObject({id:c.string(),assetIdentifier:c.string(),name:c.string(),type:c.string(),status:c.string(),region:c.string().nullish(),_count:c.looseObject({complianceIssues:c.number()}).optional()}),EX=c.looseObject({id:c.string(),name:c.string(),assetIdentifier:c.string(),provider:c.string(),type:c.string(),status:c.string(),region:c.string().nullish(),iacStatus:c.string().nullish(),accountId:c.string().nullish(),estimatedMonthlyCost:c.string().nullish(),lastSeenAt:c.string().nullish(),createdAt:c.string().nullish(),updatedAt:c.string().nullish()}),Qhe=c.looseObject({assets:c.array(SX),nextCursor:c.string().optional()}),ege=c.looseObject({asset:EX}),xX=c.looseObject({id:c.string(),ruleId:c.string(),title:c.string(),severity:c.string(),status:c.string()}),tge=c.looseObject({issues:c.array(xX)}),rge=c.record(c.string(),c.unknown()),nge=c.union([c.array(c.record(c.string(),c.unknown())),c.record(c.string(),c.unknown())]),ige=c.record(c.string(),c.unknown()),age=c.record(c.string(),c.unknown()),oge=c.record(c.string(),c.unknown()),sge=c.record(c.string(),c.unknown()),cge=c.looseObject({deployment:c.looseObject({id:c.string()}),minCliVersion:c.string().optional()});var AX=c.object({id:c.string(),releaseNumber:c.number().int(),status:c.string(),commitSha:c.string().nullable(),branch:c.string().nullable(),createdAt:c.string(),assemblyDigest:c.string().nullable(),createdByDeploymentId:c.string().nullable(),rollbackOfReleaseId:c.string().nullable(),services:c.array(vf.strip())}),uge=c.object({releases:c.array(AX),currentReleaseId:c.string().nullable(),nextCursor:c.number().int().optional()}),_X=c.object({id:c.string(),status:c.string(),target:c.string().nullish(),applicationId:c.string().nullish(),applicationName:c.string().nullish(),connectedAwsAccountId:c.string().nullish(),source:c.string().nullish(),startedAt:c.string().nullish(),triggeredByName:c.string().nullish(),machineLabel:c.string().nullish()}),lge=c.object({deployments:c.array(_X)}),dge=c.object({cancelled:c.boolean(),message:c.string().nullish(),declined:c.boolean().nullish()}),pge=c.object({released:c.literal(!0),id:c.string().nullish()}),mge=c.looseObject({organisationId:c.string(),organisationName:c.string(),organisationSlug:c.string().min(1).optional()}),fge=c.looseObject({status:c.string(),roleArn:c.string().optional(),accountId:c.string().optional(),phase:c.string().optional(),reason:c.string().optional()}),hge=c.looseObject({token:c.string()}),TX=c.looseObject({quickCreateUrl:c.string(),externalId:c.string()}),CX=c.looseObject({alreadyConnected:c.literal(!0),account:c.looseObject({awsAccountId:c.string(),accountName:c.string().nullable(),status:c.string()})}),gge=c.union([CX,TX]);function IX(e){return"alreadyConnected"in e&&e.alreadyConnected===!0}hX(IX,"isAlreadyConnected");var yge=c.looseObject({registered:c.boolean(),repository:c.looseObject({id:c.string()}).optional()});var DX=Object.defineProperty,wX=(e,t)=>DX(e,"name",{value:t,configurable:!0});function tl(e=e1){return`Deploy tokens are minted from a signed-in browser session by an owner or admin: open ${e}/settings/ci (Settings \u2192 CI/CD Tokens).`}wX(tl,"deployTokenMintGuidance");var t1=[{command:"ci status",match:w.success,templates:["Run `fjall ci verify` to check the rest of the wiring \u2014 an active deploy token is necessary, not sufficient","Run `fjall ci token list` to see which applications, environments and accounts each active token may deploy to"]},{command:"ci status",match:w.empty,templates:[tl(),"Run `fjall ci setup --plan --app <app>` to learn where the workflow file will go and which secret name it will read (`workflowPath`, `secretName`) \u2014 the two things needed to stage the secret before minting. `--plan` mints nothing and writes nothing, and the workflow BODY is printed on the human surface only: it is not a field of the agent payload"]},{command:"ci token list",match:w.success,templates:["Run `fjall token show <id>` to inspect one token's stored constraints","Run `fjall ci token revoke <id> --reason <text>` to revoke a listed token"]},{command:"ci token list",match:w.empty,templates:[tl(),"Run `fjall ci status` to re-check readiness once a token exists"]},{command:"ci token revoke",match:w.success,templates:["Run `fjall ci token list` to confirm the token now lists as revoked \u2014 a revoked token stays listed, it does not disappear",`Any CI job still holding this token now fails to authenticate. ${tl()}`]}];var qf="Do not retry or vary flags: `supported: false` is the server's capability verdict, not an input error \u2014 every invocation answers the same until the Fjall server is updated to a version that ships this API (the `message` field names the upgrade)",r1=[{command:"deployments list",match:w.unsupported,templates:[qf]},{command:"deployments cancel",match:w.unsupported,templates:[qf]},{command:"deployments force-release",match:w.unsupported,templates:[qf]},{command:"dev list",match:w.unsupported,templates:[qf]},{command:"deployments list",match:w.success,templates:["Run `fjall deployments cancel <id>` to request co-operative cancellation of a listed deployment","Run `fjall deploy logs --deployment-id <id>` to read one deployment's logs"]},{command:"deployments cancel",match:w.success,templates:["Run `fjall deployments list` to confirm whether the slot is free, and read `cancelled` and `declined` before assuming it is: `cancelled: false` means the request was refused, `declined: true` is an already-terminal reject, and a plain granted cancel is co-operative \u2014 the deployment has to acknowledge it","Run `fjall deployments force-release <id> --confirm <id>` to clear a slot that stays occupied (organisation admin, audited \u2014 retype the id in `--confirm`)"]},{command:"deployments force-release",match:w.success,templates:["Run `fjall deployments list` to confirm the slot is free","Run `fjall deploy <app>` to retry the deployment the wedged slot was blocking"]},{command:"dev up",match:w.success,templates:["Run `fjall dev list <app>` to see every slot for this app with its `host` \u2014 rows carry `host`, not a full URL, and it is empty until the slot leaves `creating`","Run `fjall dev down <app> --branch <branch>` to tear this slot down"]},{command:"dev list",match:w.success,templates:["Run `fjall dev down <app> --branch <branch>` to tear one listed slot down \u2014 every row carries the `branch` to name here","Run `fjall dev up <app> --branch <branch>` to bring another branch up"]},{command:"dev down",match:w.success,templates:["Run `fjall dev list <app>` to see which slots remain","Run `fjall dev up <app> --branch <branch>` to bring the branch back up"]},{command:"dev substrate down",match:w.success,templates:["Run `fjall dev list <app>` to confirm no slot survives \u2014 the substrate will not tear down under live slots, and `--force` takes them with it","Any `residuals` row survives the teardown and can still cost: its `cleanupHint` names the manual step"]}];var n1=["Run `fjall domain deploy <name>` to deploy the domain","Run `fjall domain verify <name>` to check DNS delegation once it is deployed","Run `fjall domain export <name>` to export the live zone records"],i1=[{command:"org deploy",match:w.success,templates:["Run `fjall org get` to review the deployed organisation topology and accounts",`Run \`${te.accountDeploy}\` to deploy the account tier if you passed \`--no-cascade\``,`Run \`${te.createApplicationAgent} --name "<name>"\` to create an application to deploy into it`]},{command:"org deploy",match:w.error,templates:["Run `fjall org get` to see which tier of the cascade is already deployed",`Run \`${te.organisationDeploy} --no-cascade\` to retry the organisation stack alone`]},{command:"platform deploy",match:w.success,templates:[`Run \`${te.accountDeploy}\` to deploy the account tier on top of it`]},{command:"platform deploy",match:w.error,templates:["Run `fjall org get` to check the organisation tier is deployed first"]},{command:"account deploy",match:w.success,templates:["Run `fjall apps list` to see which applications are registered","Run `fjall deploy <application>` to deploy one into this account"]},{command:"account deploy",match:w.error,templates:["Run `fjall org get` to confirm the account is registered in the organisation",`Run \`${te.accountDeploy} --target <target>\` to select a specific member account`]},{command:"domain list",match:w.success,templates:["Run `fjall domain verify <name>` to check DNS delegation","Run `fjall domain export <name>` to export zone file","Run `fjall create domain --name <name>` to create a new domain"]},{command:"domain list",match:w.empty,templates:['Run `fjall create domain --name "<name>"` to create a domain',"Run `fjall domain import <name>` to import from Route53"]},{command:"domain verify",match:w.success,templates:["Run `fjall domain export <name>` to export zone file","Run `fjall domain deploy <name>` to deploy domain infrastructure"]},{command:"domain verify",match:w.error,templates:["Run `fjall domain verify <name>` to retry","Run `fjall domain list` to see existing domains"]},{command:"domain export",match:w.success,templates:["Run `fjall domain verify <name>` to check delegation","Run `fjall domain import <name>` to re-import from Route53"]},{command:"domain import",match:w.success,templates:["Run `fjall domain verify <name>` to check delegation","Run `fjall domain export <name>` to see the zone file","Run `fjall domain deploy <name>` to deploy domain infrastructure"]},{command:"domain import",match:w.error,templates:["Run `fjall domain import --hosted-zone-id <id>` to import by zone ID","Run `fjall domain list` to see existing domains"]},{command:"domain records list",match:w.success,templates:["Run `fjall domain sync <domain>` for the full zone-hygiene report","Run `fjall domain sync <domain> --fix` to remediate residue records via the destruction ceremony"]},{command:"domain records list",match:w.empty,templates:["Run `fjall domain deploy <domain>` to deploy the domain's declared records","Run `fjall domain list` to see existing domains"]},{command:"domain records list",match:w.error,templates:["Run `fjall domain records list <domain> --hosted-zone-id <id>` when the zone is not resolvable by name",`Run \`${te.connect}\` if AWS credentials are missing`]},{command:"domain sync",match:w.success,templates:["Run `fjall domain sync <domain> --fix` to remediate residue records (ceremony-gated)","Run `fjall domain records list <domain>` to see every record with its owner"]},{command:"domain sync",match:w.error,templates:["Run `fjall domain sync <domain> --hosted-zone-id <id>` when the zone is not resolvable by name","Run `fjall domain list` to see existing domains"]},{command:"domain delegate",match:w.success,templates:["Run `fjall domain verify <domain>` to confirm public DNS resolution","Run `fjall domain deploy <domain>` to continue a two-phase deploy after delegation"]},{command:"domain delegate",match:w.error,templates:["Run `fjall domain deploy <parent-domain>` so the parent publishes its DelegationRole","Run `fjall domain verify <domain> --show-delegation` for registrar instructions"]},{command:"domain destroy",match:w.success,templates:["Run `fjall domain list` to see remaining domains","Run `fjall domain sync <parent-domain>` to confirm no delegation residue remains"]},{command:"domain destroy",match:w.error,templates:["Run `fjall domain destroy <domain> --remediate '<name>'=recreate` with the exact consent the ticket names","Run `fjall domain list` to see existing domains"]},{command:"domain deploy",match:w.success,templates:["Run `fjall domain verify <domain>` to check DNS propagation","Run `fjall domain delegate <domain>` to write the NS delegation for a delegated child"]},{command:"domain deploy",match:w.error,templates:["Run `fjall domain deploy <domain>` to resume \u2014 the zone phase is retained and skipped on re-run","Run `fjall domain verify <domain> --show-delegation` for registrar delegation instructions"]},{command:"domain eject",match:w.success,templates:["Review the ejected infrastructure.ts \u2014 it is now vanilla CDK owned by you","Run `fjall domain list` to see remaining managed domains"]},{command:"create domain",match:w.success,templates:n1},{command:"domain create",match:w.success,templates:n1},{command:"create domain",match:w.error,templates:["Run `fjall domain list` to see existing domains",'Run `fjall create domain --name "<name>"` to retry with a different name']},{command:"create account",match:w.success,templates:[`Run \`${te.connect} --environment production\` to link your AWS account`,`Run \`${te.accountDeploy}\` to deploy account infrastructure (after connecting)`]},{command:"create account",match:w.error,templates:[`Run \`${te.createAccount} --primary-region <region>\` to retry`,`Run \`${te.createAccount} --help\` for usage information`]},{command:"create org",match:w.success,templates:[`Run \`${te.connect} --name "<account-name>" --region <region>\` to link the AWS Organizations management account \u2014 omit \`--environment\` so it registers at the organisation tier`,`Run \`${te.organisationDeploy}\` to deploy all infrastructure (after connecting)`]},{command:"create org",match:w.error,templates:[`Run \`${te.createOrganisation} --email "<email>"\` to retry (add \`--name "<name>"\` only for a brand-new organisation)`,`Run \`${te.createOrganisation} --help\` for all options`]},{command:"restore",match:w.successDryRun,templates:["Run `fjall restore <resourceType> --recovery-point <recoveryPointArn> --yes` to initiate restore","Run `fjall apps list` to see existing applications"]},{command:"restore",match:w.success,templates:["Open the AWS Console URL above to monitor restore progress","Run `fjall import` to import the restored resource after completion"]},{command:"restore",match:w.errorWithCode("NOT_FOUND"),templates:["Verify the recovery point ARN is correct and exists in the current region","Run `fjall restore <resourceType> --recovery-point <arn>` to retry"]},{command:"restore",match:w.errorWithCode("FORBIDDEN"),templates:["Ensure the IAM role has backup:StartRestoreJob and iam:PassRole permissions","Run `fjall restore` interactively to configure with guided setup"]},{command:"import",match:w.successDryRun,templates:["Run `fjall import --app <app> --resource-id <resourceId> --yes` to import a specific resource","Run `fjall import --app <app> --yes` to import all discovered resources"]},{command:"import",match:w.success,templates:["Run `fjall deploy <app>` to deploy with the imported resource","Run `fjall apps describe <app>` to see updated resources"]},{command:"import",match:w.errorWithCode("NOT_FOUND"),templates:[`Run \`${te.createApplicationAgent} --name "<app>"\` to create the application`,"Run `fjall apps list` to see existing applications"]},{command:"import",match:w.errorWithCode("VALIDATION_ERROR"),templates:["Run `fjall import --app <app> --resource-id <resourceId>` to import a specific resource","Run `fjall import --app <app> --resource-id <resourceId> --yes` to import immediately"]},{command:"aws exec",match:w.success,templates:["Run `fjall aws exec -- <command...>` to run another AWS CLI command","Run `fjall status` to check application health"]},{command:"aws exec",match:w.error,templates:["Retry the command \u2014 OIDC token mints can fail transiently",`Run \`${te.login}\` if the retry also fails with an authentication error`]},{command:"unlock bucket",match:w.success,templates:["Re-put sane bucket policy statements (enforceSSL deny, access grants) \u2014 the unlock deleted the ENTIRE policy","Run `fjall destroy <app>` to retry the blocked stack cleanup"]},{command:"unlock bucket",match:w.error,templates:["Ensure your credentials belong to the organisation's management account \u2014 STS AssumeRoot is rejected elsewhere","Run `fjall unlock bucket <name> --account <id> --acknowledge-root-session` to retry"]}];var kX=Object.defineProperty,c1=(e,t)=>kX(e,"name",{value:t,configurable:!0}),a1="Run `fjall connect status` to check that an AWS account is connected: asset discovery only inventories connected accounts, so an organisation with none has nothing to inventory",o1=["Run `fjall assets show <asset>` to read one asset in full \u2014 pass its `assetIdentifier`","Run `fjall assets compliance <asset>` to list an asset's recorded posture issues \u2014 pass its `assetIdentifier`, the address every server version accepts"],s1=c1(e=>e.outcome==="success"&&e.nextCursor!==void 0,"isTruncatedPage"),u1=[{command:"assets list",match:c1(e=>s1(e)&&e.fields!==void 0&&e.fields!=="","match"),templates:["This window is truncated \u2014 more assets exist beyond these rows. Run `fjall assets list --cursor <nextCursor> --fields <fields>` to fetch the next page with the same projection; `total` counts this window only, and `fjall assets summary` reports the estate-wide tally, split active/deleted",...o1]},{command:"assets list",match:s1,templates:["This window is truncated \u2014 more assets exist beyond these rows. Run `fjall assets list --cursor <nextCursor>` to fetch the next page; `total` counts this window only, and `fjall assets summary` reports the estate-wide tally, split active/deleted",...o1]},{command:"assets list",match:w.success,templates:["The `total` aggregate counts the rows in this response, not the estate: `--take` bounds the window (default 50). No `nextCursor` aggregate here means the estate ends with these rows; `fjall assets summary` reports the estate-wide tally, split active/deleted","Run `fjall assets show <asset>` to read one asset in full","Run `fjall assets compliance <asset>` to list an asset's recorded posture issues \u2014 pass its `assetIdentifier`, the address every server version accepts (row `id`s are only accepted by newer servers)"]},{command:"assets list",match:w.empty,templates:["Run `fjall assets list --status deleted` to include assets discovery has since marked deleted \u2014 the default listing hides them",a1]},{command:"assets show",match:w.success,templates:["Run `fjall assets compliance <asset>` to list the posture issues recorded against this asset","Run `fjall assets show <asset> --fields id,accountId,iacStatus,estimatedMonthlyCost,lastSeenAt` to read the fields the default projection omits"]},{command:"assets compliance",match:w.success,templates:["Read the `status` column before acting: this listing returns every issue recorded against the asset, `resolved` and `suppressed` included, where the `openIssues` count on `fjall assets list` counts only the open ones","Run `fjall compliance fix --domain compliance --issue-id <issueId>` to read this issue in full alongside the organisation's other open issues. `--domain` is the producer's category \u2014 one of `compliance`, `cost`, `performance` \u2014 not a framework name, and the response is context to reason from, not a remediation step: use `--execute` to run one","Run `fjall assets show <asset>` to read the asset these issues were raised against"]},{command:"assets compliance",match:w.empty,templates:["No issue of ANY status has been recorded against this asset \u2014 an empty listing here is not the same as issues that were resolved, which would still appear with `status: resolved`","Run `fjall assets list --fields name,assetIdentifier,openIssues` to find the assets that do carry open issues"]},{command:"assets summary",match:w.success,templates:["Run `fjall assets list --fields name,assetIdentifier,openIssues` to see which assets sit behind `withIssues` \u2014 `withIssues` counts the assets carrying at least one open issue, `openIssues` counts those issues per asset","Run `fjall assets list --take <n>` to read the rows behind these totals \u2014 page onwards with `--cursor` when the listing reports a `nextCursor`, and pass `--status deleted` to include the `deleted` rows in the listing (interleaved with active \u2014 read the `status` column). These totals are estate-wide (the summary pages the listing to exhaustion, deleted assets included): `total` counts the whole estate, `active` and `deleted` split it"]},{command:"assets summary",match:w.empty,templates:[a1]},{command:"costs show",match:w.success,templates:["Run `fjall costs --mode forecast` to see forecasted spend","Run `fjall costs --mode breakdown` to see service-level breakdown"]},{command:"costs show",match:w.error,templates:["Run `fjall costs --app <app>` to filter by application","Run `fjall costs --help` for usage information"]},{command:"metrics show",match:w.success,templates:["Run `fjall metrics --mode latency` to see latency percentiles","Run `fjall metrics --mode errors` to see error trends"]},{command:"metrics show",match:w.error,templates:["Run `fjall metrics --app <app>` to filter by application","Run `fjall metrics --help` for usage information"]},{command:"compliance fix",match:w.success,templates:["Run `fjall compliance fix --domain <domain> --issue-id <id>` to narrow the suggestions to one issue","Run `fjall deploy <app>` to apply remediation changes"]},{command:"compliance fix",match:w.error,templates:["Run `fjall compliance fix --domain <domain>` to name the compliance domain","Run `fjall compliance --help` for usage information"]},{command:"compliance fix --execute",match:w.success,templates:["Read the result's `kind` before treating the issue as fixed: `auto-pr` opened a pull request that still has to be merged, `imperative` rewrote the live policy, and `manual-hint` changed nothing \u2014 its `awsCliHint` carries the manual step, and that field is absent for rules that supply no hint (`message` is a fixed string either way)","Do not re-read the issue to confirm the cure: nothing on the remediation path writes to the issue record, so `status` stays `open` until the next discovery scan re-evaluates the asset. Verify at the thing that changed \u2014 the pull request, or the live resource","Run `fjall deploy <app>` to roll out an `auto-pr` remediation once its pull request is merged"]},{command:"deploy diff",match:w.success,templates:["Run `fjall deploy logs --deployment-id <id>` to analyse deployment logs","Run `fjall status <app>` to check current deployment health"]},{command:"deploy diff",match:w.error,templates:["Run `fjall list deployments` to see recent deployment IDs","Run `fjall deploy diff --help` for usage information"]},{command:"deploy logs",match:w.success,templates:["Run `fjall deploy diff <idA> <idB>` to compare two deployments","Run `fjall status <app>` to check current deployment health"]},{command:"deploy logs",match:w.error,templates:["Run `fjall deploy logs --deployment-id <id>` with a valid deployment ID","Run `fjall list deployments` to find a deployment ID"]}];var NX={command:"*",match:w.error,templates:["Run `fjall <command> --help` for usage information"]},l1=[...j$,...M$,...L$,...t1,...r1,...i1,...u1,NX];var PX=Object.defineProperty,RX=(e,t)=>PX(e,"name",{value:t,configurable:!0}),d1=["app","environment","region","profile","target","cluster","service","lambda","status","type"],Fa=["app","cluster","service","lambda"],OX=["status","type","region"],__={deploy:["environment","region","target"],"deploy diff":[],"deploy logs":[],destroy:["target"],"org deploy":["target"],"org destroy":["target"],"platform deploy":["target"],"platform destroy":["target"],"account deploy":["target"],"account destroy":["target"],status:[],rollout:[],list:["app"],apps:["target"],connect:["environment","region"],"connect status":[],import:["app","region"],costs:["app"],metrics:["app"],compliance:["app"],"token create":["app","environment"],"unlock bucket":["region"],"aws exec":["app","region","target"],"secrets set":Fa,"secrets get":Fa,"secrets list":Fa,"secrets delete":Fa,"secrets export":Fa,"secrets import":Fa,"secrets exec":Fa,"assets list":OX},$X=Math.max(...Object.keys(__).map(e=>e.split(" ").length));function T_(e){let t=e.trim().split(/\s+/).slice(1);for(let r=$X;r>=1;r--){let i=t.slice(0,r).join(" ");if(Object.hasOwn(__,i))return __[i]}return[]}RX(T_,"resolvePreservableFlags");var jX=Object.defineProperty,Hf=(e,t)=>jX(e,"name",{value:t,configurable:!0});function C_(e){let t=e.replace(/[\u0000-\u001f\u007f`]/g,"");return/[^\w@%+=:,./-]/.test(t)?`'${t.replace(/'/g,"'\\''")}'`:t}Hf(C_,"shellEscape");function p1(e,t,r){let i=new Set,n=e.replace(/<(\w+)>/g,(a,o)=>{let s=t[o];return s===void 0||s===""?`<${o}>`:(i.add(o),o==="command"?s:C_(s))});return m1(n,r,i)}Hf(p1,"interpolateTemplate");var Zf=class{static{Hf(this,"SuggestionResolver")}command;flags;constructor(t,r){this.command=t,this.flags=r}resolve(t){let r=l1.find(i=>(i.command===this.command||i.command==="*")&&i.match(t));return r===void 0?[]:r.templates.map(i=>p1(i,t,this.flags))}};function m1(e,t,r=new Set){let i=/`(fjall[^`]*)`/.exec(e),n=i?.[1];if(i===null||n===void 0)return e;let a=T_(n),o=[];for(let p of d1){if(!a.includes(p))continue;let h=t[p];h!==void 0&&h!==""&&!r.has(p)&&!n.includes(`--${p}`)&&o.push(`--${p} ${C_(h)}`)}if(o.length===0)return e;let s=` ${o.join(" ")}`,u=n.indexOf(" -- "),d=u===-1?`${n}${s}`:`${n.slice(0,u)}${s}${n.slice(u)}`;return e.slice(0,i.index)+`\`${d}\``+e.slice(i.index+i[0].length)}Hf(m1,"applyPreservedFlags");var MX=Object.defineProperty,Yn=(e,t)=>MX(e,"name",{value:t,configurable:!0});function Kr(e,t){if(t!==void 0&&Ns(e)){let i={};for(let[n,a]of Object.entries(e))i[n]=t.has(n)?a:Kr(a);return i}if(typeof e=="string")return ae(e);if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(i=>Kr(i));if(e instanceof Date||e instanceof RegExp)return e;let r={};for(let[i,n]of Object.entries(e))r[i]=Kr(n);return r}Yn(Kr,"maskTree");function Jf(e){if(Array.isArray(e))return e.map(Jf);if(!Ns(e))return e;let t={};for(let[r,i]of Object.entries(e))i!==void 0&&(t[r]=Jf(i));return t}Yn(Jf,"stripAbsent");function Ns(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date)&&!(e instanceof RegExp)}Yn(Ns,"isPlainRecord");function f1(e){let t=e?.verbatimFields;return t!==void 0&&t.length>0?new Set(t):void 0}Yn(f1,"toVerbatimKeys");function h1(e,t){return t===void 0||!Ns(e)?!1:Object.keys(e).some(r=>t.has(r))}Yn(h1,"carriesVerbatimField");function g1(e,t){let r=e;for(let i of t.split(".")){if(!Ns(r))return;r=r[i]}return r}Yn(g1,"resolveDotPath");function y1(e,t,r){let i=e.project(t),n={};for(let a of r)a in i&&(n[a]=i[a]);return n}Yn(y1,"projectSelectedFields");var rl=class{static{Yn(this,"AgentOutputWriter")}write;hasWrittenBlock=!1;resolver;flags;full;budget;requestedFields;constructor(t){this.write=t.writeFn??(r=>{process.stdout.write(r)}),this.resolver=new Zf(t.command,t.flags),this.flags=t.flags,this.full=t.full??!1,this.budget=t.budget,this.requestedFields=t.fields??[]}get isFullOutput(){return this.full}writeBlock(t){t!==""&&(this.hasWrittenBlock&&this.write(XA+`
|
|
341
|
+
`,{encoding:"utf8"}),Re.renameSync(i,r),Tf(Nt.dirname(Nt.dirname(r)),[Af,...Uu],{header:GA,marker:n$})}catch(i){return ln(new Error(`Failed to write ${r}: ${ae(ze(i))}`))}return this.localConfigCache=t,Ra(void 0)}static warnLegacyActiveTargetOnce(){e.warnedLegacyActiveTarget||(e.warnedLegacyActiveTarget=!0,$a.warn("Config","`activeTarget` in fjall-config.json is deprecated and ignored: a committed target must never re-aim a deploy or CI pipeline. Run `fjall target set <name>` to store it locally in .fjall/local.json, then remove `activeTarget` from the committed fjall-config.json."))}getActiveTarget(){let t=this.loadLocalConfig().activeTarget;if(t!==void 0)return t;this.rootConfig.activeTarget!==void 0&&e.warnLegacyActiveTargetOnce()}setActiveTarget(t){let r=this.loadLocalConfig();return r.activeTarget=t,this.writeLocalConfig(r)}clearActiveTarget(){let t=this.loadLocalConfig();return delete t.activeTarget,this.writeLocalConfig(t)}getDomains(){return this.rootConfig.domains??[]}setDomains(t){this.rootConfig.domains=t}addDomain(t){this.rootConfig.domains||(this.rootConfig.domains=[]),this.rootConfig.domains.push(t)}getDomain(t){return this.rootConfig.domains?.find(r=>r.name.toLowerCase()===t.toLowerCase())}removeDomain(t){if(!this.rootConfig.domains)return!1;let r=this.rootConfig.domains.findIndex(i=>i.name.toLowerCase()===t.toLowerCase());return r===-1?!1:(this.rootConfig.domains.splice(r,1),!0)}getOrganisation(){return this.rootConfig.organisation}setOrganisation(t){this.rootConfig.organisation=t}clearOrganisation(){delete this.rootConfig.organisation}};var oX=Object.defineProperty,Gi=(e,t)=>oX(e,"name",{value:t,configurable:!0});function v_(e){let t;try{t=Gf.loadConfig(e)}catch(i){return{kind:"unreadable",reason:ae(ze(i))}}if(t.isContentUnavailable())return{kind:"unreadable",reason:"fjall-config.json exists but its contents could not be loaded (the preceding warning names the problem)"};let r=t.getOrganisation();return r!==void 0?{kind:"bound",bound:r}:t.getConfigPath()===null?{kind:"no_project"}:{kind:"unbound"}}Gi(v_,"readProjectBinding");function b_(e,t,r){switch(e.kind){case"unreadable":return e;case"no_project":return{kind:"unbound",projectFound:!1,identity:t};case"unbound":return{kind:"unbound",projectFound:!0,identity:t};case"bound":return t===null?{kind:"unverifiable",bound:e.bound,reason:r??"the organisation could not be resolved"}:e.bound.id===t.id?{kind:"matched",bound:e.bound}:{kind:"mismatched",bound:e.bound,actual:t}}}Gi(b_,"resolveBindingVerdict");function V$(e,t={}){return b_(v_(t.startDir),e,t.unresolvedReason)}Gi(V$,"checkProjectOrganisation");function Ma(e){return e.name!==void 0&&e.name!==""?`${e.name} (${e.id})`:e.id}Gi(Ma,"describeOrganisation");function W$(e,t,r){return`Refusing to ${e}: this project's fjall-config.json records organisation ${Ma(t)} as its home, but the credential in use belongs to ${Ma(r)}. Nothing was created, synthesised or deployed. Cure: authenticate as ${Ma(t)} ('fjall login', or set FJALL_API_KEY to a key for that organisation), or \u2014 if this project really is moving \u2014 run 'fjall org bind --org ${r.id} --force' to re-bind it.`}Gi(W$,"buildWrongOrganisationMessage");function K$(e,t){return`Refusing to ${e}: ${t}, so this project's organisation binding cannot be checked. Nothing was created, synthesised or deployed. Cure: fix fjall-config.json (permissions or contents), then re-run.`}Gi(K$,"buildUnreadableConfigMessage");function q$(e,t){return`Could not confirm which organisation your credential belongs to (${t}). Proceeding \u2014 this project is bound to ${Ma(e)}, and a mismatch would not have been caught.`}Gi(q$,"buildUnverifiableNotice");function Z$(e){return`This project is not bound to an organisation. Run 'fjall org bind' to pin it to ${Ma(e)} \u2014 afterwards, any command run here with another organisation's credential is refused instead of silently landing there.`}Gi(Z$,"buildUnboundNotice");import{createHash as uX}from"node:crypto";var sX=Object.defineProperty,cX=(e,t)=>sX(e,"name",{value:t,configurable:!0});function H$(e,t){return uX("sha256").update(`${e}${t}`).digest("hex")}cX(H$,"credentialFingerprint");import*as Wf from"node:fs";var lX=Object.defineProperty,Vf=(e,t)=>lX(e,"name",{value:t,configurable:!0}),J$="org-config-cache.json";function S_(){return vs(J$)}Vf(S_,"orgConfigCachePath");function E_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Vf(E_,"isObject");function x_(e){return E_(e)&&typeof e.organisationId=="string"&&e.organisationId!==""&&typeof e.organisationName=="string"}Vf(x_,"isCachedCredentialIdentity");function X$(e){try{let t=S_();if(!Wf.existsSync(t))return null;let r=JSON.parse(Wf.readFileSync(t,"utf-8"));return!E_(r)||r.credentialFingerprint!==e?null:x_(r.identity)?r.identity:null}catch(t){return $a.debug("cachedCredentialIdentity","Cache read failed, treating as a miss",{error:ae(ze(t))}),null}}Vf(X$,"readCachedCredentialIdentity");var dX=Object.defineProperty,pX=(e,t)=>dX(e,"name",{value:t,configurable:!0}),Y$="https://fjall.io";function Kf(){let e=process.env.FJALL_API_URL;return e!==void 0&&e!==""?e:Y$}pX(Kf,"resolveApiBaseUrl");var Q$={name:"@fjall/cli",version:"33.1.0",repository:{type:"git",url:"git+https://github.com/fjall-tech/fjall.git",directory:"cli"},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 && node ../scripts/stamp-build.mjs",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 && node ../scripts/sync-ci-plugin-major.mjs",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.62.0","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/ejs":"^3.1.5","@types/prompts":"^2.4.9","@types/proper-lockfile":"^4.1.4","@types/react":"^19.2.17","@typescript-eslint/parser":"^8.65.0","@vitest/coverage-v8":"^4.1.10","aws-cdk-lib":"^2.265.0",constructs:"^10.7.2",eslint:"^10.8.0","ink-testing-library":"^4.0.0",jsdom:"^30.0.1",prettier:"^3.9.6","react-dom":"^19.2.8","strip-ansi":"^6.0.1","tsc-watch":"^7.2.1",tsx:"^4.23.1","typescript-eslint":"^8.65.0",vitest:"4.1.10"},dependencies:{"@anthropic-ai/sdk":"^0.115.0","@aws-sdk/client-acm":"^3.1098.0","@aws-sdk/client-auto-scaling":"^3.1098.0","@aws-sdk/client-backup":"^3.1098.0","@aws-sdk/client-cloudformation":"^3.1098.0","@aws-sdk/client-cost-explorer":"^3.1098.0","@aws-sdk/client-ec2":"^3.1098.0","@aws-sdk/client-ecr":"^3.1098.0","@aws-sdk/client-ecs":"^3.1098.0","@aws-sdk/client-elasticache":"^3.1098.0","@aws-sdk/client-iam":"^3.1098.0","@aws-sdk/client-identitystore":"^3.1098.0","@aws-sdk/client-lambda":"^3.1098.0","@aws-sdk/client-organizations":"^3.1098.0","@aws-sdk/client-ram":"^3.1098.0","@aws-sdk/client-rds":"^3.1098.0","@aws-sdk/client-route-53":"^3.1098.0","@aws-sdk/client-s3":"^3.1098.0","@aws-sdk/client-secrets-manager":"^3.1098.0","@aws-sdk/client-ssm":"^3.1098.0","@aws-sdk/client-sso":"^3.1098.0","@aws-sdk/client-sso-admin":"^3.1098.0","@aws-sdk/client-sso-oidc":"^3.1098.0","@aws-sdk/client-sts":"^3.1098.0","@fjall/deploy-core":"^33.1.0","@fjall/generator":"^33.1.0","@fjall/util":"^33.1.0","@nx/devkit":"^23.1.0","@opennextjs/aws":"^4.1.0","@smithy/node-http-handler":"^4.9.13","@toon-format/toon":"^4.1.0","aws-cdk":"^2.1134.0",axios:"^1.19.0",chalk:"^6.0.0","cli-cursor":"^5.0.0",commander:"^15.0.0",ejs:"^6.0.1",ink:"^7.1.1","js-yaml":"^5.2.2",open:"^11.0.0",ora:"^9.4.1",prompts:"^2.4.2","proper-lockfile":"^4.1.2",protobufjs:"^8.7.1",react:"^19.2.8",typescript:"^6.0.3","update-check":"^1.5.4",zod:"^4.4.3"}};var fX=Object.defineProperty,hX=(e,t)=>fX(e,"name",{value:t,configurable:!0}),Uhe=`fjall-cli/${Q$.version} node/${process.versions.node} ${gX()}/${yX()}`;var e1=Kf(),zhe=c.looseObject({deviceCode:c.string(),userCode:c.string(),verificationUri:c.string(),expiresIn:c.number(),interval:c.number()}),Bhe=c.looseObject({status:c.string(),apiKey:c.string().optional(),organisationId:c.string().optional(),organisationName:c.string().optional(),email:c.string().optional()}),Ghe=c.looseObject({application:c.looseObject({id:c.string()})}),A_=c.looseObject({id:c.string(),name:c.string(),vpcCidr:c.string().nullable(),connectedAwsAccountId:c.string().nullable()}),Vhe=c.looseObject({applications:c.array(A_),nextCursor:c.string().optional()}),Whe=c.looseObject({application:A_}),Khe=c.looseObject({applications:c.array(A_)}),qhe=c.looseObject({application:c.looseObject({id:c.string(),name:c.string()})}),Zhe=c.looseObject({primaryRegion:c.string().nullish(),secondaryRegions:c.array(c.string()).optional(),disasterRecoveryRegion:c.string().nullish(),providerAccounts:c.custom(e=>Array.isArray(e)),ssoSessions:c.record(c.string(),c.looseObject({ssoRegion:c.string(),ssoStartUrl:c.string()})).optional(),rootOidcRoleArn:c.string().nullish(),allowCodemodLlmFallback:c.boolean().optional(),rootAccessManagement:c.custom(e=>typeof e=="string").optional(),requireTrackedDeploys:c.boolean().optional().catch(void 0)}),Hhe=c.looseObject({id:c.string(),token:c.string(),tokenPrefix:c.string(),name:c.string(),scopes:c.array(c.string())}),vX=c.looseObject({id:c.string(),name:c.string(),tokenPrefix:c.string(),scopes:c.array(c.string()),resourceConstraints:c.record(c.string(),c.unknown()),sourceTag:c.string().nullable(),expiresAt:c.string(),createdAt:c.string(),revokedAt:c.string().nullable(),revokedReason:c.string().nullable(),lastUsedAt:c.string().nullable(),usageCount:c.number(),deniedCount:c.number()}),Jhe=c.looseObject({tokens:c.array(vX)}),Xhe=c.looseObject({scopes:c.array(c.string()),expiresAt:c.string().optional()}),bX=c.looseObject({id:c.string(),awsAccountId:c.string(),accountName:c.string().nullable(),environment:c.string().nullable()}),Yhe=c.looseObject({accounts:c.array(bX)}),SX=c.looseObject({id:c.string(),assetIdentifier:c.string(),name:c.string(),type:c.string(),status:c.string(),region:c.string().nullish(),_count:c.looseObject({complianceIssues:c.number()}).optional()}),EX=c.looseObject({id:c.string(),name:c.string(),assetIdentifier:c.string(),provider:c.string(),type:c.string(),status:c.string(),region:c.string().nullish(),iacStatus:c.string().nullish(),accountId:c.string().nullish(),estimatedMonthlyCost:c.string().nullish(),lastSeenAt:c.string().nullish(),createdAt:c.string().nullish(),updatedAt:c.string().nullish()}),Qhe=c.looseObject({assets:c.array(SX),nextCursor:c.string().optional()}),ege=c.looseObject({asset:EX}),xX=c.looseObject({id:c.string(),ruleId:c.string(),title:c.string(),severity:c.string(),status:c.string()}),tge=c.looseObject({issues:c.array(xX)}),rge=c.record(c.string(),c.unknown()),nge=c.union([c.array(c.record(c.string(),c.unknown())),c.record(c.string(),c.unknown())]),ige=c.record(c.string(),c.unknown()),age=c.record(c.string(),c.unknown()),oge=c.record(c.string(),c.unknown()),sge=c.record(c.string(),c.unknown()),cge=c.looseObject({deployment:c.looseObject({id:c.string()}),minCliVersion:c.string().optional()});var AX=c.object({id:c.string(),releaseNumber:c.number().int(),status:c.string(),commitSha:c.string().nullable(),branch:c.string().nullable(),createdAt:c.string(),assemblyDigest:c.string().nullable(),createdByDeploymentId:c.string().nullable(),rollbackOfReleaseId:c.string().nullable(),services:c.array(vf.strip())}),uge=c.object({releases:c.array(AX),currentReleaseId:c.string().nullable(),nextCursor:c.number().int().optional()}),_X=c.object({id:c.string(),status:c.string(),target:c.string().nullish(),applicationId:c.string().nullish(),applicationName:c.string().nullish(),connectedAwsAccountId:c.string().nullish(),source:c.string().nullish(),startedAt:c.string().nullish(),triggeredByName:c.string().nullish(),machineLabel:c.string().nullish()}),lge=c.object({deployments:c.array(_X)}),dge=c.object({cancelled:c.boolean(),message:c.string().nullish(),declined:c.boolean().nullish()}),pge=c.object({released:c.literal(!0),id:c.string().nullish()}),mge=c.looseObject({organisationId:c.string(),organisationName:c.string(),organisationSlug:c.string().min(1).optional()}),fge=c.looseObject({status:c.string(),roleArn:c.string().optional(),accountId:c.string().optional(),phase:c.string().optional(),reason:c.string().optional()}),hge=c.looseObject({token:c.string()}),TX=c.looseObject({quickCreateUrl:c.string(),externalId:c.string()}),CX=c.looseObject({alreadyConnected:c.literal(!0),account:c.looseObject({awsAccountId:c.string(),accountName:c.string().nullable(),status:c.string()})}),gge=c.union([CX,TX]);function IX(e){return"alreadyConnected"in e&&e.alreadyConnected===!0}hX(IX,"isAlreadyConnected");var yge=c.looseObject({registered:c.boolean(),repository:c.looseObject({id:c.string()}).optional()});var DX=Object.defineProperty,wX=(e,t)=>DX(e,"name",{value:t,configurable:!0});function tl(e=e1){return`Deploy tokens are minted from a signed-in browser session by an owner or admin: open ${e}/settings/ci (Settings \u2192 CI/CD Tokens).`}wX(tl,"deployTokenMintGuidance");var t1=[{command:"ci status",match:w.success,templates:["Run `fjall ci verify` to check the rest of the wiring \u2014 an active deploy token is necessary, not sufficient","Run `fjall ci token list` to see which applications, environments and accounts each active token may deploy to"]},{command:"ci status",match:w.empty,templates:[tl(),"Run `fjall ci setup --plan --app <app>` to learn where the workflow file will go and which secret name it will read (`workflowPath`, `secretName`) \u2014 the two things needed to stage the secret before minting. `--plan` mints nothing and writes nothing, and the workflow BODY is printed on the human surface only: it is not a field of the agent payload"]},{command:"ci token list",match:w.success,templates:["Run `fjall token show <id>` to inspect one token's stored constraints","Run `fjall ci token revoke <id> --reason <text>` to revoke a listed token"]},{command:"ci token list",match:w.empty,templates:[tl(),"Run `fjall ci status` to re-check readiness once a token exists"]},{command:"ci token revoke",match:w.success,templates:["Run `fjall ci token list` to confirm the token now lists as revoked \u2014 a revoked token stays listed, it does not disappear",`Any CI job still holding this token now fails to authenticate. ${tl()}`]}];var qf="Do not retry or vary flags: `supported: false` is the server's capability verdict, not an input error \u2014 every invocation answers the same until the Fjall server is updated to a version that ships this API (the `message` field names the upgrade)",r1=[{command:"deployments list",match:w.unsupported,templates:[qf]},{command:"deployments cancel",match:w.unsupported,templates:[qf]},{command:"deployments force-release",match:w.unsupported,templates:[qf]},{command:"dev list",match:w.unsupported,templates:[qf]},{command:"deployments list",match:w.success,templates:["Run `fjall deployments cancel <id>` to request co-operative cancellation of a listed deployment","Run `fjall deploy logs --deployment-id <id>` to read one deployment's logs"]},{command:"deployments cancel",match:w.success,templates:["Run `fjall deployments list` to confirm whether the slot is free, and read `cancelled` and `declined` before assuming it is: `cancelled: false` means the request was refused, `declined: true` is an already-terminal reject, and a plain granted cancel is co-operative \u2014 the deployment has to acknowledge it","Run `fjall deployments force-release <id> --confirm <id>` to clear a slot that stays occupied (organisation admin, audited \u2014 retype the id in `--confirm`)"]},{command:"deployments force-release",match:w.success,templates:["Run `fjall deployments list` to confirm the slot is free","Run `fjall deploy <app>` to retry the deployment the wedged slot was blocking"]},{command:"dev up",match:w.success,templates:["Run `fjall dev list <app>` to see every slot for this app with its `host` \u2014 rows carry `host`, not a full URL, and it is empty until the slot leaves `creating`","Run `fjall dev down <app> --branch <branch>` to tear this slot down"]},{command:"dev list",match:w.success,templates:["Run `fjall dev down <app> --branch <branch>` to tear one listed slot down \u2014 every row carries the `branch` to name here","Run `fjall dev up <app> --branch <branch>` to bring another branch up"]},{command:"dev down",match:w.success,templates:["Run `fjall dev list <app>` to see which slots remain","Run `fjall dev up <app> --branch <branch>` to bring the branch back up"]},{command:"dev substrate down",match:w.success,templates:["Run `fjall dev list <app>` to confirm no slot survives \u2014 the substrate will not tear down under live slots, and `--force` takes them with it","Any `residuals` row survives the teardown and can still cost: its `cleanupHint` names the manual step"]}];var n1=["Run `fjall domain deploy <name>` to deploy the domain","Run `fjall domain verify <name>` to check DNS delegation once it is deployed","Run `fjall domain export <name>` to export the live zone records"],i1=[{command:"org deploy",match:w.success,templates:["Run `fjall org get` to review the deployed organisation topology and accounts",`Run \`${te.accountDeploy}\` to deploy the account tier if you passed \`--no-cascade\``,`Run \`${te.createApplicationAgent} --name "<name>"\` to create an application to deploy into it`]},{command:"org deploy",match:w.error,templates:["Run `fjall org get` to see which tier of the cascade is already deployed",`Run \`${te.organisationDeploy} --no-cascade\` to retry the organisation stack alone`]},{command:"platform deploy",match:w.success,templates:[`Run \`${te.accountDeploy}\` to deploy the account tier on top of it`]},{command:"platform deploy",match:w.error,templates:["Run `fjall org get` to check the organisation tier is deployed first"]},{command:"account deploy",match:w.success,templates:["Run `fjall apps list` to see which applications are registered","Run `fjall deploy <application>` to deploy one into this account"]},{command:"account deploy",match:w.error,templates:["Run `fjall org get` to confirm the account is registered in the organisation",`Run \`${te.accountDeploy} --target <target>\` to select a specific member account`]},{command:"domain list",match:w.success,templates:["Run `fjall domain verify <name>` to check DNS delegation","Run `fjall domain export <name>` to export zone file","Run `fjall create domain --name <name>` to create a new domain"]},{command:"domain list",match:w.empty,templates:['Run `fjall create domain --name "<name>"` to create a domain',"Run `fjall domain import <name>` to import from Route53"]},{command:"domain verify",match:w.success,templates:["Run `fjall domain export <name>` to export zone file","Run `fjall domain deploy <name>` to deploy domain infrastructure"]},{command:"domain verify",match:w.error,templates:["Run `fjall domain verify <name>` to retry","Run `fjall domain list` to see existing domains"]},{command:"domain export",match:w.success,templates:["Run `fjall domain verify <name>` to check delegation","Run `fjall domain import <name>` to re-import from Route53"]},{command:"domain import",match:w.success,templates:["Run `fjall domain verify <name>` to check delegation","Run `fjall domain export <name>` to see the zone file","Run `fjall domain deploy <name>` to deploy domain infrastructure"]},{command:"domain import",match:w.error,templates:["Run `fjall domain import --hosted-zone-id <id>` to import by zone ID","Run `fjall domain list` to see existing domains"]},{command:"domain records list",match:w.success,templates:["Run `fjall domain sync <domain>` for the full zone-hygiene report","Run `fjall domain sync <domain> --fix` to remediate residue records via the destruction ceremony"]},{command:"domain records list",match:w.empty,templates:["Run `fjall domain deploy <domain>` to deploy the domain's declared records","Run `fjall domain list` to see existing domains"]},{command:"domain records list",match:w.error,templates:["Run `fjall domain records list <domain> --hosted-zone-id <id>` when the zone is not resolvable by name",`Run \`${te.connect}\` if AWS credentials are missing`]},{command:"domain sync",match:w.success,templates:["Run `fjall domain sync <domain> --fix` to remediate residue records (ceremony-gated)","Run `fjall domain records list <domain>` to see every record with its owner"]},{command:"domain sync",match:w.error,templates:["Run `fjall domain sync <domain> --hosted-zone-id <id>` when the zone is not resolvable by name","Run `fjall domain list` to see existing domains"]},{command:"domain delegate",match:w.success,templates:["Run `fjall domain verify <domain>` to confirm public DNS resolution","Run `fjall domain deploy <domain>` to continue a two-phase deploy after delegation"]},{command:"domain delegate",match:w.error,templates:["Run `fjall domain deploy <parent-domain>` so the parent publishes its DelegationRole","Run `fjall domain verify <domain> --show-delegation` for registrar instructions"]},{command:"domain destroy",match:w.success,templates:["Run `fjall domain list` to see remaining domains","Run `fjall domain sync <parent-domain>` to confirm no delegation residue remains"]},{command:"domain destroy",match:w.error,templates:["Run `fjall domain destroy <domain> --remediate '<name>'=recreate` with the exact consent the ticket names","Run `fjall domain list` to see existing domains"]},{command:"domain deploy",match:w.success,templates:["Run `fjall domain verify <domain>` to check DNS propagation","Run `fjall domain delegate <domain>` to write the NS delegation for a delegated child"]},{command:"domain deploy",match:w.error,templates:["Run `fjall domain deploy <domain>` to resume \u2014 the zone phase is retained and skipped on re-run","Run `fjall domain verify <domain> --show-delegation` for registrar delegation instructions"]},{command:"domain eject",match:w.success,templates:["Review the ejected infrastructure.ts \u2014 it is now vanilla CDK owned by you","Run `fjall domain list` to see remaining managed domains"]},{command:"create domain",match:w.success,templates:n1},{command:"domain create",match:w.success,templates:n1},{command:"create domain",match:w.error,templates:["Run `fjall domain list` to see existing domains",'Run `fjall create domain --name "<name>"` to retry with a different name']},{command:"create account",match:w.success,templates:[`Run \`${te.connect} --environment production\` to link your AWS account`,`Run \`${te.accountDeploy}\` to deploy account infrastructure (after connecting)`]},{command:"create account",match:w.error,templates:[`Run \`${te.createAccount} --primary-region <region>\` to retry`,`Run \`${te.createAccount} --help\` for usage information`]},{command:"create org",match:w.success,templates:[`Run \`${te.connect} --name "<account-name>" --region <region>\` to link the AWS Organizations management account \u2014 omit \`--environment\` so it registers at the organisation tier`,`Run \`${te.organisationDeploy}\` to deploy all infrastructure (after connecting)`]},{command:"create org",match:w.error,templates:[`Run \`${te.createOrganisation} --email "<email>"\` to retry (add \`--name "<name>"\` only for a brand-new organisation)`,`Run \`${te.createOrganisation} --help\` for all options`]},{command:"restore",match:w.successDryRun,templates:["Run `fjall restore <resourceType> --recovery-point <recoveryPointArn> --yes` to initiate restore","Run `fjall apps list` to see existing applications"]},{command:"restore",match:w.success,templates:["Open the AWS Console URL above to monitor restore progress","Run `fjall import` to import the restored resource after completion"]},{command:"restore",match:w.errorWithCode("NOT_FOUND"),templates:["Verify the recovery point ARN is correct and exists in the current region","Run `fjall restore <resourceType> --recovery-point <arn>` to retry"]},{command:"restore",match:w.errorWithCode("FORBIDDEN"),templates:["Ensure the IAM role has backup:StartRestoreJob and iam:PassRole permissions","Run `fjall restore` interactively to configure with guided setup"]},{command:"import",match:w.successDryRun,templates:["Run `fjall import --app <app> --resource-id <resourceId> --yes` to import a specific resource","Run `fjall import --app <app> --yes` to import all discovered resources"]},{command:"import",match:w.success,templates:["Run `fjall deploy <app>` to deploy with the imported resource","Run `fjall apps describe <app>` to see updated resources"]},{command:"import",match:w.errorWithCode("NOT_FOUND"),templates:[`Run \`${te.createApplicationAgent} --name "<app>"\` to create the application`,"Run `fjall apps list` to see existing applications"]},{command:"import",match:w.errorWithCode("VALIDATION_ERROR"),templates:["Run `fjall import --app <app> --resource-id <resourceId>` to import a specific resource","Run `fjall import --app <app> --resource-id <resourceId> --yes` to import immediately"]},{command:"aws exec",match:w.success,templates:["Run `fjall aws exec -- <command...>` to run another AWS CLI command","Run `fjall status` to check application health"]},{command:"aws exec",match:w.error,templates:["Retry the command \u2014 OIDC token mints can fail transiently",`Run \`${te.login}\` if the retry also fails with an authentication error`]},{command:"unlock bucket",match:w.success,templates:["Re-put sane bucket policy statements (enforceSSL deny, access grants) \u2014 the unlock deleted the ENTIRE policy","Run `fjall destroy <app>` to retry the blocked stack cleanup"]},{command:"unlock bucket",match:w.error,templates:["Ensure your credentials belong to the organisation's management account \u2014 STS AssumeRoot is rejected elsewhere","Run `fjall unlock bucket <name> --account <id> --acknowledge-root-session` to retry"]}];var kX=Object.defineProperty,c1=(e,t)=>kX(e,"name",{value:t,configurable:!0}),a1="Run `fjall connect status` to check that an AWS account is connected: asset discovery only inventories connected accounts, so an organisation with none has nothing to inventory",o1=["Run `fjall assets show <asset>` to read one asset in full \u2014 pass its `assetIdentifier`","Run `fjall assets compliance <asset>` to list an asset's recorded posture issues \u2014 pass its `assetIdentifier`, the address every server version accepts"],s1=c1(e=>e.outcome==="success"&&e.nextCursor!==void 0,"isTruncatedPage"),u1=[{command:"assets list",match:c1(e=>s1(e)&&e.fields!==void 0&&e.fields!=="","match"),templates:["This window is truncated \u2014 more assets exist beyond these rows. Run `fjall assets list --cursor <nextCursor> --fields <fields>` to fetch the next page with the same projection; `total` counts this window only, and `fjall assets summary` reports the estate-wide tally, split active/deleted",...o1]},{command:"assets list",match:s1,templates:["This window is truncated \u2014 more assets exist beyond these rows. Run `fjall assets list --cursor <nextCursor>` to fetch the next page; `total` counts this window only, and `fjall assets summary` reports the estate-wide tally, split active/deleted",...o1]},{command:"assets list",match:w.success,templates:["The `total` aggregate counts the rows in this response, not the estate: `--take` bounds the window (default 50). No `nextCursor` aggregate here means the estate ends with these rows; `fjall assets summary` reports the estate-wide tally, split active/deleted","Run `fjall assets show <asset>` to read one asset in full","Run `fjall assets compliance <asset>` to list an asset's recorded posture issues \u2014 pass its `assetIdentifier`, the address every server version accepts (row `id`s are only accepted by newer servers)"]},{command:"assets list",match:w.empty,templates:["Run `fjall assets list --status deleted` to include assets discovery has since marked deleted \u2014 the default listing hides them",a1]},{command:"assets show",match:w.success,templates:["Run `fjall assets compliance <asset>` to list the posture issues recorded against this asset","Run `fjall assets show <asset> --fields id,accountId,iacStatus,estimatedMonthlyCost,lastSeenAt` to read the fields the default projection omits"]},{command:"assets compliance",match:w.success,templates:["Read the `status` column before acting: this listing returns every issue recorded against the asset, `resolved` and `suppressed` included, where the `openIssues` count on `fjall assets list` counts only the open ones","Run `fjall compliance fix --domain compliance --issue-id <issueId>` to read this issue in full alongside the organisation's other open issues. `--domain` is the producer's category \u2014 one of `compliance`, `cost`, `performance` \u2014 not a framework name, and the response is context to reason from, not a remediation step: use `--execute` to run one","Run `fjall assets show <asset>` to read the asset these issues were raised against"]},{command:"assets compliance",match:w.empty,templates:["No issue of ANY status has been recorded against this asset \u2014 an empty listing here is not the same as issues that were resolved, which would still appear with `status: resolved`","Run `fjall assets list --fields name,assetIdentifier,openIssues` to find the assets that do carry open issues"]},{command:"assets summary",match:w.success,templates:["Run `fjall assets list --fields name,assetIdentifier,openIssues` to see which assets sit behind `withIssues` \u2014 `withIssues` counts the assets carrying at least one open issue, `openIssues` counts those issues per asset","Run `fjall assets list --take <n>` to read the rows behind these totals \u2014 page onwards with `--cursor` when the listing reports a `nextCursor`, and pass `--status deleted` to include the `deleted` rows in the listing (interleaved with active \u2014 read the `status` column). These totals are estate-wide (the summary pages the listing to exhaustion, deleted assets included): `total` counts the whole estate, `active` and `deleted` split it"]},{command:"assets summary",match:w.empty,templates:[a1]},{command:"costs show",match:w.success,templates:["Run `fjall costs --mode forecast` to see forecasted spend","Run `fjall costs --mode breakdown` to see service-level breakdown"]},{command:"costs show",match:w.error,templates:["Run `fjall costs --app <app>` to filter by application","Run `fjall costs --help` for usage information"]},{command:"metrics show",match:w.success,templates:["Run `fjall metrics --mode latency` to see latency percentiles","Run `fjall metrics --mode errors` to see error trends"]},{command:"metrics show",match:w.error,templates:["Run `fjall metrics --app <app>` to filter by application","Run `fjall metrics --help` for usage information"]},{command:"compliance fix",match:w.success,templates:["Run `fjall compliance fix --domain <domain> --issue-id <id>` to narrow the suggestions to one issue","Run `fjall deploy <app>` to apply remediation changes"]},{command:"compliance fix",match:w.error,templates:["Run `fjall compliance fix --domain <domain>` to name the compliance domain","Run `fjall compliance --help` for usage information"]},{command:"compliance fix --execute",match:w.success,templates:["Read the result's `kind` before treating the issue as fixed: `auto-pr` opened a pull request that still has to be merged, `imperative` rewrote the live policy, and `manual-hint` changed nothing \u2014 its `awsCliHint` carries the manual step, and that field is absent for rules that supply no hint (`message` is a fixed string either way)","Do not re-read the issue to confirm the cure: nothing on the remediation path writes to the issue record, so `status` stays `open` until the next discovery scan re-evaluates the asset. Verify at the thing that changed \u2014 the pull request, or the live resource","Run `fjall deploy <app>` to roll out an `auto-pr` remediation once its pull request is merged"]},{command:"deploy diff",match:w.success,templates:["Run `fjall deploy logs --deployment-id <id>` to analyse deployment logs","Run `fjall status <app>` to check current deployment health"]},{command:"deploy diff",match:w.error,templates:["Run `fjall list deployments` to see recent deployment IDs","Run `fjall deploy diff --help` for usage information"]},{command:"deploy logs",match:w.success,templates:["Run `fjall deploy diff <idA> <idB>` to compare two deployments","Run `fjall status <app>` to check current deployment health"]},{command:"deploy logs",match:w.error,templates:["Run `fjall deploy logs --deployment-id <id>` with a valid deployment ID","Run `fjall list deployments` to find a deployment ID"]}];var NX={command:"*",match:w.error,templates:["Run `fjall <command> --help` for usage information"]},l1=[...j$,...M$,...L$,...t1,...r1,...i1,...u1,NX];var PX=Object.defineProperty,RX=(e,t)=>PX(e,"name",{value:t,configurable:!0}),d1=["app","environment","region","profile","target","cluster","service","lambda","status","type"],Fa=["app","cluster","service","lambda"],OX=["status","type","region"],__={deploy:["environment","region","target"],"deploy diff":[],"deploy logs":[],destroy:["target"],"org deploy":["target"],"org destroy":["target"],"platform deploy":["target"],"platform destroy":["target"],"account deploy":["target"],"account destroy":["target"],status:[],rollout:[],list:["app"],apps:["target"],connect:["environment","region"],"connect status":[],import:["app","region"],costs:["app"],metrics:["app"],compliance:["app"],"token create":["app","environment"],"unlock bucket":["region"],"aws exec":["app","region","target"],"secrets set":Fa,"secrets get":Fa,"secrets list":Fa,"secrets delete":Fa,"secrets export":Fa,"secrets import":Fa,"secrets exec":Fa,"assets list":OX},$X=Math.max(...Object.keys(__).map(e=>e.split(" ").length));function T_(e){let t=e.trim().split(/\s+/).slice(1);for(let r=$X;r>=1;r--){let i=t.slice(0,r).join(" ");if(Object.hasOwn(__,i))return __[i]}return[]}RX(T_,"resolvePreservableFlags");var jX=Object.defineProperty,Hf=(e,t)=>jX(e,"name",{value:t,configurable:!0});function C_(e){let t=e.replace(/[\u0000-\u001f\u007f`]/g,"");return/[^\w@%+=:,./-]/.test(t)?`'${t.replace(/'/g,"'\\''")}'`:t}Hf(C_,"shellEscape");function p1(e,t,r){let i=new Set,n=e.replace(/<(\w+)>/g,(a,o)=>{let s=t[o];return s===void 0||s===""?`<${o}>`:(i.add(o),o==="command"?s:C_(s))});return m1(n,r,i)}Hf(p1,"interpolateTemplate");var Zf=class{static{Hf(this,"SuggestionResolver")}command;flags;constructor(t,r){this.command=t,this.flags=r}resolve(t){let r=l1.find(i=>(i.command===this.command||i.command==="*")&&i.match(t));return r===void 0?[]:r.templates.map(i=>p1(i,t,this.flags))}};function m1(e,t,r=new Set){let i=/`(fjall[^`]*)`/.exec(e),n=i?.[1];if(i===null||n===void 0)return e;let a=T_(n),o=[];for(let p of d1){if(!a.includes(p))continue;let h=t[p];h!==void 0&&h!==""&&!r.has(p)&&!n.includes(`--${p}`)&&o.push(`--${p} ${C_(h)}`)}if(o.length===0)return e;let s=` ${o.join(" ")}`,u=n.indexOf(" -- "),d=u===-1?`${n}${s}`:`${n.slice(0,u)}${s}${n.slice(u)}`;return e.slice(0,i.index)+`\`${d}\``+e.slice(i.index+i[0].length)}Hf(m1,"applyPreservedFlags");var MX=Object.defineProperty,Yn=(e,t)=>MX(e,"name",{value:t,configurable:!0});function Kr(e,t){if(t!==void 0&&Ns(e)){let i={};for(let[n,a]of Object.entries(e))i[n]=t.has(n)?a:Kr(a);return i}if(typeof e=="string")return ae(e);if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(i=>Kr(i));if(e instanceof Date||e instanceof RegExp)return e;let r={};for(let[i,n]of Object.entries(e))r[i]=Kr(n);return r}Yn(Kr,"maskTree");function Jf(e){if(Array.isArray(e))return e.map(Jf);if(!Ns(e))return e;let t={};for(let[r,i]of Object.entries(e))i!==void 0&&(t[r]=Jf(i));return t}Yn(Jf,"stripAbsent");function Ns(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date)&&!(e instanceof RegExp)}Yn(Ns,"isPlainRecord");function f1(e){let t=e?.verbatimFields;return t!==void 0&&t.length>0?new Set(t):void 0}Yn(f1,"toVerbatimKeys");function h1(e,t){return t===void 0||!Ns(e)?!1:Object.keys(e).some(r=>t.has(r))}Yn(h1,"carriesVerbatimField");function g1(e,t){let r=e;for(let i of t.split(".")){if(!Ns(r))return;r=r[i]}return r}Yn(g1,"resolveDotPath");function y1(e,t,r){let i=e.project(t),n={};for(let a of r)a in i&&(n[a]=i[a]);return n}Yn(y1,"projectSelectedFields");var rl=class{static{Yn(this,"AgentOutputWriter")}write;hasWrittenBlock=!1;resolver;flags;full;budget;requestedFields;constructor(t){this.write=t.writeFn??(r=>{process.stdout.write(r)}),this.resolver=new Zf(t.command,t.flags),this.flags=t.flags,this.full=t.full??!1,this.budget=t.budget,this.requestedFields=t.fields??[]}get isFullOutput(){return this.full}writeBlock(t){t!==""&&(this.hasWrittenBlock&&this.write(XA+`
|
|
342
342
|
`),this.hasWrittenBlock=!0,this.write(t))}renderResult(t,r){let i=f1(r?.schema),n=Kr(t,i),a=r?.schema!==void 0&&Ns(n)?this.applySchema(n,r.schema):n,o=QA(a),s=this.resolveHelp(r?.suggestionContext),u=o+s+`
|
|
343
343
|
`;this.writeBlock((h1(a,i)?u:Of(u,this.budget))+Ds())}renderListResult(t,r,i){let n=t.map(d=>Kr(d)),a=i.fields,o=a!==void 0&&a.length>0?a:r.fields,s=e_(n,{fields:o,project:Yn(d=>y1(r,d,o),"project")},{entity:i.entity,aggregates:i.aggregates===void 0?void 0:Kr(i.aggregates)}),u=this.resolveHelp(i.suggestionContext);this.writeBlock(Of(s+u+`
|
|
344
344
|
`,this.budget)+Ds())}renderEvent(t){let r=Kr(t),i=n_({...r,value:Jf(r.value)});this.writeBlock(i)}renderError(t,r){let i={...t,message:ae(t.message),...t.details!==void 0?{details:Kr(t.details)}:{}},n=t_(i),a=this.resolveHelp(r);this.writeBlock(n+a+`
|
|
@@ -351,7 +351,7 @@ ${XA}
|
|
|
351
351
|
`)}}setDebugEnabled(t){this.debugEnabled=t}write(t,r){this.isClosing||(this.initialised||this.initialise(),this.buffer.push(t),this.debugEnabled&&r&&this.debugBuffer.push(t),this.buffer.length>=this.config.maxBufferSize&&this.flush())}flushBuffer(t,r,i){if(t.length===0||!r)return{buffer:t,stream:r};let n=r;this.fileRotator.needsRotation(i,this.config.maxFileSize)&&(n.end(),this.fileRotator.rotate(i),n=this.openStream(i));for(let a of t)n.write(JSON.stringify(a)+`
|
|
352
352
|
`);return{buffer:[],stream:n}}flush(){let t=this.flushBuffer(this.buffer,this.mainLogStream,this.mainLogPath);this.buffer=t.buffer,this.mainLogStream=t.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 t=[];this.mainLogStream&&(t.push(this.mainLogStream),this.mainLogStream=null),this.debugLogStream&&(t.push(this.debugLogStream),this.debugLogStream=null),this.buffer=[],this.debugBuffer=[],this.initialised=!1,await Promise.all(t.map(r=>new Promise(i=>{r.end(()=>i())}))),this.isClosing=!1}};import{createWriteStream as u9,existsSync as l9,mkdirSync as d9,readdirSync as p9,statSync as m9,unlinkSync as f9}from"fs";import{join as j_}from"path";var Qn={trace:0,debug:1,info:2,warn:3,error:4},dn={MAX_FILE_SIZE:al.MAX_FILE_SIZE,MAX_FILES:al.MAX_FILES,MAX_BUFFER_SIZE:100,MAX_DEPLOYMENT_LOGS_PER_APP:100,MAX_DEPLOYMENT_LOG_BYTES_PER_APP:256*1024*1024,FLUSH_INTERVAL_MS:500,LOG_FILENAME:"fjall.jsonl",DEBUG_LOG_FILENAME:"fjall-debug.jsonl"};var o9=Object.defineProperty,s9=(e,t)=>o9(e,"name",{value:t,configurable:!0});function $s(){return nf()}s9($s,"getDefaultLogDir");var c9=Object.defineProperty,w1=(e,t)=>c9(e,"name",{value:t,configurable:!0}),h9=/^[a-zA-Z0-9_-]+-\d{4}-\d{2}-\d{2}T[\d-]+Z\.jsonl$/,g9=6e4;function k1(e,t,r){try{let i=Date.now(),n=p9(e).filter(s=>h9.test(s)).map(s=>{let u=j_(e,s);try{let d=m9(u);return{path:u,mtimeMs:d.mtimeMs,size:d.size}}catch{return}}).filter(s=>s!==void 0&&i-s.mtimeMs>=g9);n.sort((s,u)=>u.mtimeMs-s.mtimeMs);let a=0,o=0;for(let s of n){if(a===0||a<t&&o+s.size<=r){a+=1,o+=s.size;continue}try{f9(s.path)}catch{}}}catch{}}w1(k1,"pruneOldDeploymentLogs");var ol=class{static{w1(this,"DeploymentLoggerImpl")}mainLogger;appName;operationType;logStream=null;logPath;deploymentId;buffer=[];flushInterval=null;isClosing=!1;maxBufferSize=dn.MAX_BUFFER_SIZE;constructor(t,r,i){this.mainLogger=t,this.appName=r,this.operationType=i,this.deploymentId=`${i}-${Date.now()}`;let n=$s(),a=j_(n,"deployments",r);l9(a)||d9(a,{recursive:!0}),k1(a,dn.MAX_DEPLOYMENT_LOGS_PER_APP,dn.MAX_DEPLOYMENT_LOG_BYTES_PER_APP);let o=new Date().toISOString().replace(/[:.]/g,"-"),s=`${i}-${o}.jsonl`;this.logPath=j_(a,s);try{this.logStream=u9(this.logPath,{flags:"a"}),this.flushInterval=setInterval(()=>this.flush(),dn.FLUSH_INTERVAL_MS),this.info("DeploymentLogger","Deployment logging initialised",{appName:r,operationType:i,deploymentId:this.deploymentId,logPath:this.logPath})}catch{}}log(t,r,i,n,a,o){if(this.isClosing)return;let s={timestamp:new Date().toISOString(),level:t,component:r,message:i,correlationId:this.deploymentId,...n&&Object.keys(n).length>0&&{data:n},...a&&{stackName:a},...o&&{phase:o}};this.buffer.push(s),this.mainLogger.logWithCorrelation(t,r,i,this.deploymentId,n,a,o),this.buffer.length>=this.maxBufferSize&&this.flush()}flush(){if(!(this.buffer.length===0||!this.logStream)){for(let t of this.buffer)this.logStream.write(JSON.stringify(t)+`
|
|
353
353
|
`);this.buffer=[]}}info(t,r,i){this.log("info",t,r,i)}warn(t,r,i){this.log("warn",t,r,i)}error(t,r,i){this.log("error",t,r,i)}debug(t,r,i){this.log("debug",t,r,i)}stackEvent(t,r,i,n){this.log("info","StackDeployment",i,n,t,r)}dockerEvent(t,r){this.log("info","DockerOperation",t,{percentage:r})}ecsEvent(t,r,i){this.log("info","ECSDeployment",t,{percentage:r,taskCount:i})}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}};var y9=Object.defineProperty,L_=(e,t)=>y9(e,"name",{value:t,configurable:!0});function F_(){let e=P_();return e==="agent"||e==="mcp"}L_(F_,"isStructuredOutputMode");function N1(){return _s.isUIMode||_s.isNonInteractive}L_(N1,"surfaceOwnsConsole");var th=class e{static{L_(this,"Logger")}static instance=null;config;debugEnabled;traceEnabled;minLevel;fileWriter;mainLogPath;debugLogPath;constructor(){let t=$s(),r=M_(t,"debug"),{maxFileSize:i,maxFiles:n}=$_();this.config={logDir:t,debugLogDir:r,maxFileSize:i,maxFiles:n,maxBufferSize:dn.MAX_BUFFER_SIZE,flushIntervalMs:dn.FLUSH_INTERVAL_MS},this.mainLogPath=M_(t,dn.LOG_FILENAME),this.debugLogPath=M_(r,dn.DEBUG_LOG_FILENAME),this.debugEnabled=process.env.FJALL_DEBUG==="true"||process.env.FJALL_TRACE==="true"||process.argv.includes("--verbose")||process.argv.includes("-v"),this.traceEnabled=process.env.FJALL_TRACE==="true";let a=process.env.FJALL_LOG_LEVEL?.toLowerCase();a&&a in Qn?this.minLevel=a:this.traceEnabled?this.minLevel="trace":this.debugEnabled?this.minLevel="debug":this.minLevel="info",this.fileWriter=new eh(this.config,this.mainLogPath,this.debugLogPath,this.debugEnabled)}static getInstance(){return e.instance||(e.instance=new e),e.instance}shouldLog(t){return Qn[t]>=Qn[this.minLevel]}createEntry(t,r,i,n,a,o,s){return{timestamp:new Date().toISOString(),level:t,component:r,message:i,...a&&{correlationId:a},...n&&Object.keys(n).length>0&&{data:n},...o&&{stackName:o},...s&&{phase:s}}}log(t,r,i,n,a,o,s){if(!this.shouldLog(t))return;let u=this.createEntry(t,r,i,n,a,o,s),d=t==="debug"||t==="trace";this.fileWriter.write(u,d),this.writeConsole(u)}writeConsole(t){if(F_()||N1()){this.debugEnabled&&this.writeStderrLine(t);return}let r=this.getConsolePrefix(t.level),i=`[${t.component}]`,n=`${r} ${i} ${t.message}`;t.level==="error"?console.error(n):t.level==="warn"?console.warn(n):console.log(n)}writeStderrLine(t){let r=this.getConsolePrefix(t.level),i=`[${t.component}]`,n="";if(t.data&&Object.keys(t.data).length>0)try{n=` ${JSON.stringify(t.data)}`}catch{n=" [unserialisable data]"}let a=`${r} ${i} ${t.message}${n}`;process.stderr.write(`${ae(a)}
|
|
354
|
-
`)}getConsolePrefix(t){switch(t){case"error":return"[ERROR]";case"warn":return"[WARN]";case"info":return"[INFO]";case"debug":return"[DEBUG]";case"trace":return"[TRACE]"}}error(t,r,i){this.log("error",t,r,i)}warn(t,r,i){this.log("warn",t,r,i)}info(t,r,i){this.log("info",t,r,i)}debug(t,r,i){this.log("debug",t,r,i)}trace(t,r,i){this.log("trace",t,r,i)}diagnostic(t,r,i,n){this.log(t,r,i,n),!this.debugEnabled&&F_()&&(Qn[t]<Qn.info||this.writeStderrLine(this.createEntry(t,r,i,n)))}isDebugEnabled(){return this.debugEnabled}isTraceEnabled(){return this.traceEnabled}enableDebug(){this.debugEnabled=!0,Qn[this.minLevel]>Qn.debug&&(this.minLevel="debug"),this.fileWriter.setDebugEnabled(!0),this.fileWriter.isInitialised&&this.fileWriter.initialiseDebugStream()}withCorrelation(t){return new Rs(this,t)}forDeployment(t,r="deploy"){return new ol(this,t,r)}close(){this.fileWriter.close()}async flushAndClose(){await this.fileWriter.closeAndFlush()}getLogPath(){return this.mainLogPath}getDebugLogPath(){return this.debugLogPath}getLogDir(){return this.config.logDir}logWithCorrelation(t,r,i,n,a,o,s){this.log(t,r,i,a,n,o,s)}static reset(){e.instance&&(e.instance.close(),e.instance=null)}};var un=th.getInstance();var v9=Object.defineProperty,ut=(e,t)=>v9(e,"name",{value:t,configurable:!0}),js="fjall";function Ua(e,t){let r=b9(e);if(r.includes("..")||r.startsWith("/"))throw new Error(`Invalid ${t}: path traversal is not allowed`)}ut(Ua,"assertNoTraversal");function S9(){return js}ut(S9,"getFjallPath");function E9(e){let t=P1(e);return P1(t)||"."}ut(E9,"getProjectRoot");function $1(e){if(!O1(e))throw new Error(`Infrastructure file not found: ${e}`);let t=R1(e,"utf-8"),r=j1(t);if(r===void 0)throw new Error(`Could not find appName in infrastructure file: ${e}. Expected format: const appName = "yourAppName";`);return r}ut($1,"getAppNameFromInfrastructure");function j1(e){return e.match(/const\s+appName\s*=\s*["']([^"']+)["']/)?.[1]}ut(j1,"parseAppNameFromInfrastructureContent");function x9(e){if(!O1(e))return;let t;try{t=R1(e,"utf-8")}catch(r){un.debug("PathHelpers","Could not read organisation infrastructure",{error:ae(ze(r))});return}return t.match(/organisationName:\s*(["'])(.+?)\1/)?.[2]}ut(x9,"readOrganisationNameFromInfrastructure");function A9(e){let t=Sr(e,z_);return $1(t)}ut(A9,"getAppName");function ei(e){return Ua(e,"app name"),Sr(js,e,z_)}ut(ei,"getInfrastructurePath");function M1(e){return Ua(e,"app name"),Sr(js,e)}ut(M1,"getAppPath");function F1(e,t){let r=e??process.cwd();return t===void 0?r:(Ua(t,"container"),Sr(r,t))}ut(F1,"resolveScaffoldRootDir");function _9(e,t,r){return Sr(F1(t,r),M1(e))}ut(_9,"resolveAppScaffoldPath");function T9(e){return Ua(e,"component name"),Sr(js,e)}ut(T9,"getOrganisationComponentPath");function C9(e){return Ua(e,"deployment type"),Sr(js,e,"logs")}ut(C9,"getDeploymentLogsPath");function L1(){return Sr(js,"domains")}ut(L1,"getDomainsDir");function U_(e){return Ua(e,"domain name"),Sr(L1(),e)}ut(U_,"getDomainComponentPath");function I9(e){return Sr(U_(e),z_)}ut(I9,"getDomainInfrastructurePath");function D9(e){return Sr(U_(e),w9)}ut(D9,"getDomainZoneFilePath");var z_="infrastructure.ts",w9="zone.bind",k9="cdk.out";function N9(e){return Sr(e,k9)}ut(N9,"getCdkOutPath");var P9=Object.defineProperty,Ms=(e,t)=>P9(e,"name",{value:t,configurable:!0});function B_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Ms(B_,"escapeRegExp");function U1(e,t,r){let i=ei(t),n=e.read(i)?.toString();return n?new RegExp(`["']${B_(r)}["']`).test(n):!1}Ms(U1,"resourceExists");function G_(e,t,r){let i=ei(t);if(!e.read(i)?.toString())throw new Error(`Infrastructure file not found for ${t}`);if(U1(e,t,r))throw new Error(`Resource name '${r}' already exists in ${t}. Please choose a different name or remove the existing resource first.`)}Ms(G_,"assertResourceNameUnique");function R9(e,t,r){let i=ei(t),n=e.read(i)?.toString();if(!n)return 0;let a={database:/DatabaseFactory\.build\(/g,compute:/ComputeFactory\.build\(/g,lambda:/type:\s*["']lambda["']/g,ecs:/type:\s*["']ecs["']/g,ec2:/type:\s*["']ec2["']/g}[r];if(!a)return 0;let o=n.match(a);return o?o.length:0}Ms(R9,"countResourcesOfType");function O9(e,t){let r=ei(t),i=e.read(r)?.toString();if(!i)return[];let n=[],a=i.matchAll(/ComputeFactory\.build\(["']([^"']+)["'],\s*\{([^}]*?)\}/gs);for(let o of a){let s=o[1],u=o[2],d="ecs";u.includes('type: "lambda"')?d="lambda":u.includes('type: "ec2"')&&(d="ec2");let p=u.includes("connections:"),h=[];if(p){let g=u.match(/connections:\s*\[([^\]]+)\]/);if(g){let l=g[1].match(/\w+/g)??[];h.push(...l)}}n.push({name:s,type:d,hasConnections:p,connectedResources:h})}return n}Ms(O9,"detectComputeResources");function $9(e,t,r){let i=ei(t),n=e.read(i)?.toString();return n?new RegExp(`databaseName:\\s*["']${B_(r)}["']`).test(n):!1}Ms($9,"databaseExists");import*as Bc from"fs";import*as L4 from"path";var j9=Object.defineProperty,Fs=(e,t)=>j9(e,"name",{value:t,configurable:!0});function V_(e){return e.success===!0}Fs(V_,"isSuccess");function W_(e){return e.success===!1}Fs(W_,"isFailure");function V(e){return{success:!0,data:e}}Fs(V,"success");function $(e){return{success:!1,error:e}}Fs($,"failure");async function K_(e){try{let t=await e();return V(t)}catch(t){return $(Gr(t))}}Fs(K_,"tryAsync");function q_(e){try{let t=e();return V(t)}catch(t){return $(Gr(t))}}Fs(q_,"trySync");var M9=Object.defineProperty,F9=(e,t)=>M9(e,"name",{value:t,configurable:!0}),z1=/^[a-zA-Z][a-zA-Z0-9-]*$/,L9=Ou.source.replace(/^\^|\$$/g,""),he=Object.freeze({IDENTIFIER:z1,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:z1,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(`^(?:/${L9})+$`),SECRET_NAME:pf,SSM_COMPONENT:Ou,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_]*$/});function Z_(e){let t=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(e);if(!t)return;let r=t[1],i=t[2];if(r===void 0||i===void 0)return;let n=parseInt(r,10);if(!Number.isFinite(n)||n<1)return;let a=i==="minute"||i==="hour"||i==="day";if(!(a&&n!==1)&&!(!a&&n===1))return i==="minute"||i==="minutes"?{everyMs:n*6e4}:i==="hour"||i==="hours"?{everyMs:n*60*6e4}:{everyMs:n*24*60*6e4}}F9(Z_,"parseRateExpression");var B1=["t4g.medium","m7g.medium","m8g.medium","r7g.medium","r8g.medium","m7g.large","m8g.large","r7g.large","r8g.large","m7g.xlarge","m8g.xlarge","r7g.xlarge","r8g.xlarge"];var E=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:uA,SSM_COMPONENT:mf,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",CONNECTED_RESOURCE_NAME:"Connected resource names must not be empty"},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"}},CLICKHOUSE_STORAGE:{INTEGER:"ClickHouse storage must be a whole number of GiB",MIN:`ClickHouse storage must be at least ${100} GiB`,MAX:`ClickHouse storage cannot exceed ${16384} GiB (the gp3 ceiling)`},CLICKHOUSE_IOPS:{INTEGER:"ClickHouse iops must be a whole number",MIN:`ClickHouse iops must be at least ${3e3} (the gp3 baseline)`,MAX:`ClickHouse iops cannot exceed ${8e4} (the gp3 ceiling)`},CLICKHOUSE_THROUGHPUT:{INTEGER:"ClickHouse throughputMbps must be a whole number of MiB/s",MIN:`ClickHouse throughputMbps must be at least ${125} MiB/s (the gp3 baseline)`,MAX:`ClickHouse throughputMbps cannot exceed ${2e3} MiB/s (the gp3 ceiling)`},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 (the RDS automated-backup ceiling)"},CLICKHOUSE_BACKUP_RETENTION:{INTEGER:"ClickHouse backup retention must be an integer number of days",MIN:`ClickHouse backup retention must be at least ${1} day`,MAX:`ClickHouse backup retention cannot exceed ${3650} 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"},RESPONSE_TIME_MS:{MIN:"Response-time threshold must be at least 1 ms"}},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 U9=Object.defineProperty,Er=(e,t)=>U9(e,"name",{value:t,configurable:!0}),z9=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],B9=Object.freeze(z9.flatMap(e=>{let t=hs(e);return t?[t]:[]})),n0=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function rh(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}Er(rh,"parseRegionList");function i0(e){return Wn.includes(e)}Er(i0,"isValidRegion");function a0(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}Er(a0,"isValidRegionFormat");function o0(e){if(!e)return n0.slice(0,3);let t=e.toLowerCase().split("-"),r=t[0],i=t.length>1?t[1]:"",n=[];return r&&i&&(n=Wn.filter(a=>a.startsWith(`${r}-${i}`))),n.length===0&&r&&(n=Wn.filter(a=>a.startsWith(`${r}-`))),n.length>0?n.slice(0,3):n0.slice(0,3)}Er(o0,"getSuggestions");function s0(e){if(i0(e))return!0;let t=o0(e);return a0(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}Er(s0,"validateRegion");function G1(e){if(!e||e.trim()==="")return!0;let t=rh(e);for(let r of t){let i=s0(r);if(i!==!0)return i}return!0}Er(G1,"validateRegionList");function c0(e,t){return e.filter(r=>r!==t)}Er(c0,"filterDuplicateRegions");function u0(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}Er(u0,"toRegionOption");function V1(){return Ut.map(u0)}Er(V1,"getRegionOptions");function W1(e){return Ut.filter(t=>t.code!==e).map(u0)}Er(W1,"getRegionOptionsExcluding");function K1(e){let t=Ut.find(r=>r.code===e);return t?t.city:e}Er(K1,"getRegionName");function q1(e){return t=>{let r=rh(t);return c0(r,e)}}Er(q1,"createRegionFormatter");var nh="33.0.0";var ih=["Aurora","Instance","GlobalAurora","ClickHouse"],Ls=["FARGATE","FARGATE_SPOT","EC2"],qr=Pu,ah=["tinkerer","lightweight","standard","resilient","enterprise"],l0="custom",sl=[...ah,l0];var G9=Object.defineProperty,V9=(e,t)=>G9(e,"name",{value:t,configurable:!0}),Sve=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),cl=["ecs","lambda","ec2"],ul=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),oh=["code","container"],sh=Object.freeze({CODE:"code",CONTAINER:"container"}),ch=["ARM_64","X86_64"],Z1="ARM_64",ll=["NONE","AWS_IAM"],uh=["public","internal"],lh=["CPU","MEMORY"],za=["messaging","compute"],dh=["ARM","STANDARD"],d0=["Instance","Aurora"],Us=["postgresql","mysql"],dl=["web","worker"],H1=["foundation","compliance","hardened"];var ph=["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"],J1=[0,1,5,10,15,30,60];function zt(e,t){return e.includes(t)}V9(zt,"constIncludes");var X1=1,Y1=65535,Tve=Object.freeze({postgresql:5432,mysql:3306}),Q1=128,ej=10240,mh=1,fh=900,p0=1,m0=1e3,zs=100,tj=100;var rj=3e3;var nj=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],ij=["standard","assets","upload","website"],Bs=["AES256","KMS"];var W9=Object.defineProperty,pl=(e,t)=>W9(e,"name",{value:t,configurable:!0}),Bt=pl(e=>c.union([c.literal(!1),e]),"optionalOrDisabled"),Ba={check:pl(e=>e.minCapacity!==void 0&&e.maxCapacity!==void 0?e.minCapacity<=e.maxCapacity:!0,"check"),params:{message:E.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},ml=pl(e=>c.number().int(E.MEMORY_LIMIT.INTEGER).min(e,e===128?E.MEMORY_LIMIT.MIN_128:E.MEMORY_LIMIT.MIN_512).max(30720,E.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),be=c.string().min(1,E.REQUIRED.RESOURCE_NAME).max(63,E.MAX_LENGTH.RESOURCE_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),oj=c.string().min(1,E.REQUIRED.BUCKET_NAME).max(63,E.MAX_LENGTH.BUCKET_NAME).regex(he.BUCKET_NAME,E.BUCKET_NAME),sj=c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME);function hh(e,t=he.IDENTIFIER,r=E.IDENTIFIER){return c.string().min(2,E.IDENTIFIER_MIN_LENGTH).max(50,e).regex(t,r).refine(i=>!i.endsWith("-"),{message:E.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(i=>!i.includes("--"),{message:E.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}pl(hh,"identifierSchema");var lt=hh(E.MAX_LENGTH.APP_NAME),Pve=hh(E.MAX_LENGTH.APP_NAME,he.NEW_APP_NAME,E.NEW_APP_NAME),Ga=c.number().int(E.PORT.INTEGER).min(X1,E.PORT.MIN).max(Y1,E.PORT.MAX),St=c.object({key:c.string(),sourceText:c.string()}).strict(),K9=c.object({__identifier:c.string()}).strict(),q9=c.object({__expression:c.string()}).strict(),Z9=c.object({__call:c.string()}).strict(),H9=c.union([K9,q9,Z9]),J9=c.union([c.string(),c.number(),c.boolean(),H9]),Gs=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),J9),X9=c.object({id:c.string(),name:c.string().optional(),arn:c.string().optional(),field:c.string().optional()}).strict().refine(e=>e.name!==void 0!=(e.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),cj=c.record(c.string(),X9),Rve=c.record(c.string(),c.unknown()),f0=c.enum(sl).describe(`Application type must be one of: ${sl.join(", ")}`),h0=c.enum(vr).describe(`OpenNext deployment pattern: ${vr.join(", ")}`),Y9=c.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),Q9=c.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),uj=c.object({sourceText:c.string(),position:Y9,afterManagedResource:c.object({type:Q9,name:c.string().optional()}).strict().optional(),originalLine:c.number().int().optional(),leadingComments:c.array(c.string()).optional(),orphaned:c.boolean().optional(),orphanedComment:c.string().optional()}).strict(),lj=c.union([c.object({tier:c.enum(qr)}).strict(),c.literal(!1)]),dj=c.union([c.object({instanceType:c.string().optional()}).strict(),c.literal(!1)]),e8=hh(E.MAX_LENGTH.ORGANISATION_NAME),t8=c.string().regex(he.EMAIL,E.EMAIL),aj=c.string().refine(e=>Wn.includes(e),{message:E.REGION}),Ove=c.object({name:e8,email:t8,accountName:c.string().optional(),primaryRegion:aj.optional().default(fs),secondaryRegions:c.array(aj).optional(),security:c.enum(H1).optional(),force:c.boolean().optional()}).strict();function fl(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
|
|
354
|
+
`)}getConsolePrefix(t){switch(t){case"error":return"[ERROR]";case"warn":return"[WARN]";case"info":return"[INFO]";case"debug":return"[DEBUG]";case"trace":return"[TRACE]"}}error(t,r,i){this.log("error",t,r,i)}warn(t,r,i){this.log("warn",t,r,i)}info(t,r,i){this.log("info",t,r,i)}debug(t,r,i){this.log("debug",t,r,i)}trace(t,r,i){this.log("trace",t,r,i)}diagnostic(t,r,i,n){this.log(t,r,i,n),!this.debugEnabled&&F_()&&(Qn[t]<Qn.info||this.writeStderrLine(this.createEntry(t,r,i,n)))}isDebugEnabled(){return this.debugEnabled}isTraceEnabled(){return this.traceEnabled}enableDebug(){this.debugEnabled=!0,Qn[this.minLevel]>Qn.debug&&(this.minLevel="debug"),this.fileWriter.setDebugEnabled(!0),this.fileWriter.isInitialised&&this.fileWriter.initialiseDebugStream()}withCorrelation(t){return new Rs(this,t)}forDeployment(t,r="deploy"){return new ol(this,t,r)}close(){this.fileWriter.close()}async flushAndClose(){await this.fileWriter.closeAndFlush()}getLogPath(){return this.mainLogPath}getDebugLogPath(){return this.debugLogPath}getLogDir(){return this.config.logDir}logWithCorrelation(t,r,i,n,a,o,s){this.log(t,r,i,a,n,o,s)}static reset(){e.instance&&(e.instance.close(),e.instance=null)}};var un=th.getInstance();var v9=Object.defineProperty,ut=(e,t)=>v9(e,"name",{value:t,configurable:!0}),js="fjall";function Ua(e,t){let r=b9(e);if(r.includes("..")||r.startsWith("/"))throw new Error(`Invalid ${t}: path traversal is not allowed`)}ut(Ua,"assertNoTraversal");function S9(){return js}ut(S9,"getFjallPath");function E9(e){let t=P1(e);return P1(t)||"."}ut(E9,"getProjectRoot");function $1(e){if(!O1(e))throw new Error(`Infrastructure file not found: ${e}`);let t=R1(e,"utf-8"),r=j1(t);if(r===void 0)throw new Error(`Could not find appName in infrastructure file: ${e}. Expected format: const appName = "yourAppName";`);return r}ut($1,"getAppNameFromInfrastructure");function j1(e){return e.match(/const\s+appName\s*=\s*["']([^"']+)["']/)?.[1]}ut(j1,"parseAppNameFromInfrastructureContent");function x9(e){if(!O1(e))return;let t;try{t=R1(e,"utf-8")}catch(r){un.debug("PathHelpers","Could not read organisation infrastructure",{error:ae(ze(r))});return}return t.match(/organisationName:\s*(["'])(.+?)\1/)?.[2]}ut(x9,"readOrganisationNameFromInfrastructure");function A9(e){let t=Sr(e,z_);return $1(t)}ut(A9,"getAppName");function ei(e){return Ua(e,"app name"),Sr(js,e,z_)}ut(ei,"getInfrastructurePath");function M1(e){return Ua(e,"app name"),Sr(js,e)}ut(M1,"getAppPath");function F1(e,t){let r=e??process.cwd();return t===void 0?r:(Ua(t,"container"),Sr(r,t))}ut(F1,"resolveScaffoldRootDir");function _9(e,t,r){return Sr(F1(t,r),M1(e))}ut(_9,"resolveAppScaffoldPath");function T9(e){return Ua(e,"component name"),Sr(js,e)}ut(T9,"getOrganisationComponentPath");function C9(e){return Ua(e,"deployment type"),Sr(js,e,"logs")}ut(C9,"getDeploymentLogsPath");function L1(){return Sr(js,"domains")}ut(L1,"getDomainsDir");function U_(e){return Ua(e,"domain name"),Sr(L1(),e)}ut(U_,"getDomainComponentPath");function I9(e){return Sr(U_(e),z_)}ut(I9,"getDomainInfrastructurePath");function D9(e){return Sr(U_(e),w9)}ut(D9,"getDomainZoneFilePath");var z_="infrastructure.ts",w9="zone.bind",k9="cdk.out";function N9(e){return Sr(e,k9)}ut(N9,"getCdkOutPath");var P9=Object.defineProperty,Ms=(e,t)=>P9(e,"name",{value:t,configurable:!0});function B_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Ms(B_,"escapeRegExp");function U1(e,t,r){let i=ei(t),n=e.read(i)?.toString();return n?new RegExp(`["']${B_(r)}["']`).test(n):!1}Ms(U1,"resourceExists");function G_(e,t,r){let i=ei(t);if(!e.read(i)?.toString())throw new Error(`Infrastructure file not found for ${t}`);if(U1(e,t,r))throw new Error(`Resource name '${r}' already exists in ${t}. Please choose a different name or remove the existing resource first.`)}Ms(G_,"assertResourceNameUnique");function R9(e,t,r){let i=ei(t),n=e.read(i)?.toString();if(!n)return 0;let a={database:/DatabaseFactory\.build\(/g,compute:/ComputeFactory\.build\(/g,lambda:/type:\s*["']lambda["']/g,ecs:/type:\s*["']ecs["']/g,ec2:/type:\s*["']ec2["']/g}[r];if(!a)return 0;let o=n.match(a);return o?o.length:0}Ms(R9,"countResourcesOfType");function O9(e,t){let r=ei(t),i=e.read(r)?.toString();if(!i)return[];let n=[],a=i.matchAll(/ComputeFactory\.build\(["']([^"']+)["'],\s*\{([^}]*?)\}/gs);for(let o of a){let s=o[1],u=o[2],d="ecs";u.includes('type: "lambda"')?d="lambda":u.includes('type: "ec2"')&&(d="ec2");let p=u.includes("connections:"),h=[];if(p){let g=u.match(/connections:\s*\[([^\]]+)\]/);if(g){let l=g[1].match(/\w+/g)??[];h.push(...l)}}n.push({name:s,type:d,hasConnections:p,connectedResources:h})}return n}Ms(O9,"detectComputeResources");function $9(e,t,r){let i=ei(t),n=e.read(i)?.toString();return n?new RegExp(`databaseName:\\s*["']${B_(r)}["']`).test(n):!1}Ms($9,"databaseExists");import*as Bc from"fs";import*as L4 from"path";var j9=Object.defineProperty,Fs=(e,t)=>j9(e,"name",{value:t,configurable:!0});function V_(e){return e.success===!0}Fs(V_,"isSuccess");function W_(e){return e.success===!1}Fs(W_,"isFailure");function V(e){return{success:!0,data:e}}Fs(V,"success");function $(e){return{success:!1,error:e}}Fs($,"failure");async function K_(e){try{let t=await e();return V(t)}catch(t){return $(Gr(t))}}Fs(K_,"tryAsync");function q_(e){try{let t=e();return V(t)}catch(t){return $(Gr(t))}}Fs(q_,"trySync");var M9=Object.defineProperty,F9=(e,t)=>M9(e,"name",{value:t,configurable:!0}),z1=/^[a-zA-Z][a-zA-Z0-9-]*$/,L9=Ou.source.replace(/^\^|\$$/g,""),he=Object.freeze({IDENTIFIER:z1,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:z1,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(`^(?:/${L9})+$`),SECRET_NAME:pf,SSM_COMPONENT:Ou,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_]*$/});function Z_(e){let t=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(e);if(!t)return;let r=t[1],i=t[2];if(r===void 0||i===void 0)return;let n=parseInt(r,10);if(!Number.isFinite(n)||n<1)return;let a=i==="minute"||i==="hour"||i==="day";if(!(a&&n!==1)&&!(!a&&n===1))return i==="minute"||i==="minutes"?{everyMs:n*6e4}:i==="hour"||i==="hours"?{everyMs:n*60*6e4}:{everyMs:n*24*60*6e4}}F9(Z_,"parseRateExpression");var B1=["t4g.medium","m7g.medium","m8g.medium","r7g.medium","r8g.medium","m7g.large","m8g.large","r7g.large","r8g.large","m7g.xlarge","m8g.xlarge","r7g.xlarge","r8g.xlarge"];var E=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:uA,SSM_COMPONENT:mf,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",CONNECTED_RESOURCE_NAME:"Connected resource names must not be empty"},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"}},CLICKHOUSE_STORAGE:{INTEGER:"ClickHouse storage must be a whole number of GiB",MIN:`ClickHouse storage must be at least ${100} GiB`,MAX:`ClickHouse storage cannot exceed ${16384} GiB (the gp3 ceiling)`},CLICKHOUSE_IOPS:{INTEGER:"ClickHouse iops must be a whole number",MIN:`ClickHouse iops must be at least ${3e3} (the gp3 baseline)`,MAX:`ClickHouse iops cannot exceed ${8e4} (the gp3 ceiling)`},CLICKHOUSE_THROUGHPUT:{INTEGER:"ClickHouse throughputMbps must be a whole number of MiB/s",MIN:`ClickHouse throughputMbps must be at least ${125} MiB/s (the gp3 baseline)`,MAX:`ClickHouse throughputMbps cannot exceed ${2e3} MiB/s (the gp3 ceiling)`},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 (the RDS automated-backup ceiling)"},CLICKHOUSE_BACKUP_RETENTION:{INTEGER:"ClickHouse backup retention must be an integer number of days",MIN:`ClickHouse backup retention must be at least ${1} day`,MAX:`ClickHouse backup retention cannot exceed ${3650} 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"},RESPONSE_TIME_MS:{MIN:"Response-time threshold must be at least 1 ms"}},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 U9=Object.defineProperty,Er=(e,t)=>U9(e,"name",{value:t,configurable:!0}),z9=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],B9=Object.freeze(z9.flatMap(e=>{let t=hs(e);return t?[t]:[]})),n0=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function rh(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}Er(rh,"parseRegionList");function i0(e){return Wn.includes(e)}Er(i0,"isValidRegion");function a0(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}Er(a0,"isValidRegionFormat");function o0(e){if(!e)return n0.slice(0,3);let t=e.toLowerCase().split("-"),r=t[0],i=t.length>1?t[1]:"",n=[];return r&&i&&(n=Wn.filter(a=>a.startsWith(`${r}-${i}`))),n.length===0&&r&&(n=Wn.filter(a=>a.startsWith(`${r}-`))),n.length>0?n.slice(0,3):n0.slice(0,3)}Er(o0,"getSuggestions");function s0(e){if(i0(e))return!0;let t=o0(e);return a0(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}Er(s0,"validateRegion");function G1(e){if(!e||e.trim()==="")return!0;let t=rh(e);for(let r of t){let i=s0(r);if(i!==!0)return i}return!0}Er(G1,"validateRegionList");function c0(e,t){return e.filter(r=>r!==t)}Er(c0,"filterDuplicateRegions");function u0(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}Er(u0,"toRegionOption");function V1(){return Ut.map(u0)}Er(V1,"getRegionOptions");function W1(e){return Ut.filter(t=>t.code!==e).map(u0)}Er(W1,"getRegionOptionsExcluding");function K1(e){let t=Ut.find(r=>r.code===e);return t?t.city:e}Er(K1,"getRegionName");function q1(e){return t=>{let r=rh(t);return c0(r,e)}}Er(q1,"createRegionFormatter");var nh="33.1.0";var ih=["Aurora","Instance","GlobalAurora","ClickHouse"],Ls=["FARGATE","FARGATE_SPOT","EC2"],qr=Pu,ah=["tinkerer","lightweight","standard","resilient","enterprise"],l0="custom",sl=[...ah,l0];var G9=Object.defineProperty,V9=(e,t)=>G9(e,"name",{value:t,configurable:!0}),Sve=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),cl=["ecs","lambda","ec2"],ul=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),oh=["code","container"],sh=Object.freeze({CODE:"code",CONTAINER:"container"}),ch=["ARM_64","X86_64"],Z1="ARM_64",ll=["NONE","AWS_IAM"],uh=["public","internal"],lh=["CPU","MEMORY"],za=["messaging","compute"],dh=["ARM","STANDARD"],d0=["Instance","Aurora"],Us=["postgresql","mysql"],dl=["web","worker"],H1=["foundation","compliance","hardened"];var ph=["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"],J1=[0,1,5,10,15,30,60];function zt(e,t){return e.includes(t)}V9(zt,"constIncludes");var X1=1,Y1=65535,Tve=Object.freeze({postgresql:5432,mysql:3306}),Q1=128,ej=10240,mh=1,fh=900,p0=1,m0=1e3,zs=100,tj=100;var rj=3e3;var nj=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],ij=["standard","assets","upload","website"],Bs=["AES256","KMS"];var W9=Object.defineProperty,pl=(e,t)=>W9(e,"name",{value:t,configurable:!0}),Bt=pl(e=>c.union([c.literal(!1),e]),"optionalOrDisabled"),Ba={check:pl(e=>e.minCapacity!==void 0&&e.maxCapacity!==void 0?e.minCapacity<=e.maxCapacity:!0,"check"),params:{message:E.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},ml=pl(e=>c.number().int(E.MEMORY_LIMIT.INTEGER).min(e,e===128?E.MEMORY_LIMIT.MIN_128:E.MEMORY_LIMIT.MIN_512).max(30720,E.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),be=c.string().min(1,E.REQUIRED.RESOURCE_NAME).max(63,E.MAX_LENGTH.RESOURCE_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),oj=c.string().min(1,E.REQUIRED.BUCKET_NAME).max(63,E.MAX_LENGTH.BUCKET_NAME).regex(he.BUCKET_NAME,E.BUCKET_NAME),sj=c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME);function hh(e,t=he.IDENTIFIER,r=E.IDENTIFIER){return c.string().min(2,E.IDENTIFIER_MIN_LENGTH).max(50,e).regex(t,r).refine(i=>!i.endsWith("-"),{message:E.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(i=>!i.includes("--"),{message:E.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}pl(hh,"identifierSchema");var lt=hh(E.MAX_LENGTH.APP_NAME),Pve=hh(E.MAX_LENGTH.APP_NAME,he.NEW_APP_NAME,E.NEW_APP_NAME),Ga=c.number().int(E.PORT.INTEGER).min(X1,E.PORT.MIN).max(Y1,E.PORT.MAX),St=c.object({key:c.string(),sourceText:c.string()}).strict(),K9=c.object({__identifier:c.string()}).strict(),q9=c.object({__expression:c.string()}).strict(),Z9=c.object({__call:c.string()}).strict(),H9=c.union([K9,q9,Z9]),J9=c.union([c.string(),c.number(),c.boolean(),H9]),Gs=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),J9),X9=c.object({id:c.string(),name:c.string().optional(),arn:c.string().optional(),field:c.string().optional()}).strict().refine(e=>e.name!==void 0!=(e.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),cj=c.record(c.string(),X9),Rve=c.record(c.string(),c.unknown()),f0=c.enum(sl).describe(`Application type must be one of: ${sl.join(", ")}`),h0=c.enum(vr).describe(`OpenNext deployment pattern: ${vr.join(", ")}`),Y9=c.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),Q9=c.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),uj=c.object({sourceText:c.string(),position:Y9,afterManagedResource:c.object({type:Q9,name:c.string().optional()}).strict().optional(),originalLine:c.number().int().optional(),leadingComments:c.array(c.string()).optional(),orphaned:c.boolean().optional(),orphanedComment:c.string().optional()}).strict(),lj=c.union([c.object({tier:c.enum(qr)}).strict(),c.literal(!1)]),dj=c.union([c.object({instanceType:c.string().optional()}).strict(),c.literal(!1)]),e8=hh(E.MAX_LENGTH.ORGANISATION_NAME),t8=c.string().regex(he.EMAIL,E.EMAIL),aj=c.string().refine(e=>Wn.includes(e),{message:E.REGION}),Ove=c.object({name:e8,email:t8,accountName:c.string().optional(),primaryRegion:aj.optional().default(fs),secondaryRegions:c.array(aj).optional(),security:c.enum(H1).optional(),force:c.boolean().optional()}).strict();function fl(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
|
|
355
355
|
`)}pl(fl,"getZodErrorMessage");var gh=c.number().min(1,E.ALARM.PERCENTAGE.MIN).max(100,E.ALARM.PERCENTAGE.MAX),g0=c.union([gh,c.literal(!1)]),r8=c.union([c.number().min(1,E.ALARM.RESPONSE_TIME_MS.MIN),c.literal(!1)]),n8=c.number().min(1,E.ALARM.FREE_STORAGE_GIB.MIN),pj=c.union([c.literal(!1),c.object({cpuThreshold:g0.optional(),memoryThreshold:g0.optional(),runningTasksMinimum:c.number().int().min(0).optional(),http5xxThreshold:g0.optional(),p99ResponseTimeThresholdMs:r8.optional()}).strict()]),mj=c.union([c.literal(!1),c.object({cpuThreshold:gh.optional(),freeStorageThresholdGiB:n8.optional(),connectionsThreshold:c.number().int().min(1).optional()}).strict()]),fj=c.union([c.literal(!1),c.object({errorRateThreshold:gh.optional(),durationThresholdPercent:gh.optional()}).strict()]);var Va=c.number().int(E.BACKUP_RETENTION.INTEGER).min(1,E.BACKUP_RETENTION.MIN).max(35,E.BACKUP_RETENTION.MAX),hj=c.number().int(E.CLICKHOUSE_STORAGE.INTEGER).min(100,E.CLICKHOUSE_STORAGE.MIN).max(16384,E.CLICKHOUSE_STORAGE.MAX),gj=c.number().int(E.CLICKHOUSE_IOPS.INTEGER).min(3e3,E.CLICKHOUSE_IOPS.MIN).max(8e4,E.CLICKHOUSE_IOPS.MAX),yj=c.number().int(E.CLICKHOUSE_THROUGHPUT.INTEGER).min(125,E.CLICKHOUSE_THROUGHPUT.MIN).max(2e3,E.CLICKHOUSE_THROUGHPUT.MAX),i8=c.enum(B1),vj=c.number().int(E.CLICKHOUSE_BACKUP_RETENTION.INTEGER).min(1,E.CLICKHOUSE_BACKUP_RETENTION.MIN).max(3650,E.CLICKHOUSE_BACKUP_RETENTION.MAX),hl=c.number().int(E.MONITORING_INTERVAL.INTEGER).refine(e=>zt(J1,e),{message:E.MONITORING_INTERVAL.VALUES}),vh=c.number().int(E.DATABASE.PORT.INTEGER).min(1024,E.DATABASE.PORT.MIN).max(65535,E.DATABASE.PORT.MAX),a8=c.enum(ih).describe(`Database type must be one of: ${ih.join(", ")}`),o8=c.object({maxConnections:c.number().int(E.MAX_CONNECTIONS.INTEGER).min(1,E.MAX_CONNECTIONS.MIN).max(100,E.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:c.number().int(E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:c.number().int(E.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,E.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,E.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:c.boolean().optional()}).strict().describe("RDS Proxy configuration"),s8=c.object({instanceType:c.string().optional(),availabilityZone:c.string().optional()}).strict().describe("Read replica configuration"),c8=c.object({automaticallyAfterDays:c.number().int(E.ROTATION.INTEGER).min(1,E.ROTATION.MIN).max(365,E.ROTATION.MAX).optional()}).strict().describe("Secret rotation configuration"),bh=c.object({username:c.string().min(1,E.REQUIRED.USERNAME).max(63,E.USERNAME.MAX_LENGTH).optional(),secretRotation:c8.optional()}).strict().describe("Database credentials configuration"),Sh=Bt(o8),Eh=Bt(s8),u8=c.object({scaleWithWriter:c.boolean().optional(),enableDatabaseInsights:c.boolean().optional(),identifierSuffix:c.string().min(1,E.IDENTIFIER_SUFFIX.REQUIRED).max(50,E.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:c.string().optional()}).strict().describe("Configuration for a single Aurora reader instance"),gl=c.object({enableDatabaseInsights:c.boolean().optional(),identifierSuffix:c.string().min(1,E.IDENTIFIER_SUFFIX.REQUIRED).max(50,E.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:c.string().optional()}).strict().describe("Configuration for Aurora writer instance"),l8=c.object({count:c.number().int(E.READER.COUNT.INTEGER).min(0,E.READER.COUNT.MIN).max(15,E.READER.COUNT.MAX).optional(),instances:c.array(u8).max(15,E.READER_INSTANCES.MAX).optional(),defaultEnableDatabaseInsights:c.boolean().optional()}).strict().refine(e=>!(e.count!==void 0&&e.instances!==void 0),{message:E.READER_INSTANCES.COUNT_OR_INSTANCES,path:["count"]}).describe("Aurora readers configuration"),yl=Bt(l8),d8=c.object({awsManaged:c.literal(!0)}).strict(),p8=c.object({useCMK:c.literal(!0)}).strict(),bj=c.union([d8,p8]),m8=c.object({mode:c.enum(["standard","advanced"]).optional(),encryptionKey:bj.optional()}).strict().describe("Database Insights configuration"),xh=Bt(m8),Ah=c.object({storageKey:bj.optional()}).strict().describe("Encryption configuration (DESTRUCTIVE to change storageKey)"),vl=c.object({name:be,type:a8,databaseName:c.string().min(1,E.REQUIRED.DATABASE_NAME),instanceType:c.string().optional(),allocatedStorage:c.number().optional(),multiAz:c.boolean().optional(),publiclyAccessible:c.boolean().optional(),databaseInsights:xh.optional(),port:vh.optional(),deletionProtection:c.boolean().optional(),proxy:Sh.optional(),credentials:bh.optional(),readReplica:Eh.optional(),encryption:Ah.optional(),writer:gl.optional(),readers:yl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:hl.optional(),primaryRegion:c.string().optional(),secondaryRegions:c.array(c.string()).optional(),globalClusterIdentifier:c.string().optional(),enableGlobalWriteForwarding:c.boolean().optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional(),databaseEngine:c.enum(Us).optional(),engineExpression:c.string().optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional(),alarms:mj.optional()}).strict(),_h=c.object({appName:lt,nameProvidedByFlag:c.boolean().optional(),databaseName:c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME),resourceName:be.optional(),connectionConfig:c.object({connectToCompute:c.array(c.string()).optional(),connectToServices:c.array(c.string()).optional()}).strict().optional(),databaseInsights:xh.optional(),port:vh.optional(),proxy:Sh.optional(),credentials:bh.optional(),encryption:Ah.optional(),deletionProtection:c.boolean().optional()}).strict(),Sj={databaseType:c.literal("Instance"),instanceType:c.string().optional(),multiAz:c.boolean().optional(),readReplica:Eh.optional(),publiclyAccessible:c.boolean().optional(),backupRetention:Va.optional(),allocatedStorage:c.number().optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},Ej={databaseType:c.literal("Aurora"),writer:gl.optional(),readers:yl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:hl.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},xj={databaseType:c.literal("GlobalAurora"),primaryRegion:c.string().min(1,E.GLOBAL_AURORA.PRIMARY_REGION_REQUIRED),secondaryRegions:c.array(c.string()).optional(),globalClusterIdentifier:c.string().optional(),enableGlobalWriteForwarding:c.boolean().optional(),writer:gl.optional(),readers:yl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:hl.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},Aj=c.object({appName:lt,nameProvidedByFlag:c.boolean().optional(),databaseName:c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME),resourceName:be.optional(),connectionConfig:c.object({connectToCompute:c.array(c.string()).optional(),connectToServices:c.array(c.string()).optional()}).strict().optional()}).strict(),_j={databaseType:c.literal("ClickHouse"),instanceType:i8.optional(),storageGb:hj.optional(),iops:gj.optional(),throughputMbps:yj.optional(),coldTier:c.union([c.object({mode:c.literal("s3")}).strict(),c.literal(!1)]).optional(),optimiseSchedule:c.union([c.string(),c.literal(!1)]).optional(),backupSchedule:c.union([c.string(),c.literal(!1)]).optional(),backupVerify:c.literal(!1).optional(),backupRetentionDays:vj.optional()},f8=_h.extend(Sj).strict(),h8=_h.extend(Ej).strict(),g8=_h.extend(xj).strict(),y8=Aj.extend(_j).strict(),Wve=c.discriminatedUnion("databaseType",[f8,h8,g8,y8]),y0=_h.extend({resourceName:be}).strict(),v8=y0.extend(Sj).strict(),b8=y0.extend(Ej).strict(),S8=y0.extend(xj).strict(),E8=Aj.extend({resourceName:be}).strict(),x8=E8.extend(_j).strict(),Kve=c.discriminatedUnion("databaseType",[v8,b8,S8,x8]),qve=c.object({appName:lt,databaseName:c.string().min(1,E.REQUIRED.DATABASE_NAME),maxConnections:c.number().int(E.MAX_CONNECTIONS.INTEGER).min(1,E.MAX_CONNECTIONS.MIN).max(100,E.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:c.number().int(E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:c.number().int(E.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,E.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,E.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:c.boolean().optional(),nameProvidedByFlag:c.boolean().optional()}).strict(),A8=["S","N","B"],yh=c.object({name:c.string(),type:c.enum(A8)}).strict(),Tj=c.object({name:be,partitionKey:yh,sortKey:yh.optional(),globalSecondaryIndexes:c.array(c.object({indexName:c.string(),partitionKey:yh,sortKey:yh.optional()}).strict()).optional(),ttlAttribute:c.string().optional(),stream:c.boolean().optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict(),_8=c.object({mode:c.literal("s3")}).strict(),Cj=c.object({name:be,type:c.literal("ClickHouse"),databaseName:sj,instanceType:c.string().optional(),storageGb:hj.optional(),iops:gj.optional(),throughputMbps:yj.optional(),coldTier:c.union([_8,c.literal(!1)]).optional(),optimiseSchedule:c.union([c.string(),c.literal(!1)]).optional(),backupSchedule:c.union([c.string(),c.literal(!1)]).optional(),backupVerify:c.literal(!1).optional(),backupRetentionDays:vj.optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict();var T8=c.object({count:c.number().int(E.NAT_GATEWAY.INTEGER).min(0,E.NAT_GATEWAY.MIN).max(3,E.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),Ij=Bt(T8),v0=c.enum(["cloudwatch","s3"]),C8=c.object({destination:v0.optional(),retentionDays:c.number().int(E.RETENTION_DAYS.INTEGER).min(1,E.RETENTION_DAYS.MIN).max(365,E.RETENTION_DAYS.MAX).optional(),trafficType:c.enum(["ALL","ACCEPT","REJECT"]).optional()}).strict().describe("VPC flow log configuration"),Dj=Bt(C8),I8=c.object({s3:c.boolean().optional(),dynamodb:c.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),D8=Bt(I8),w8=c.object({ecr:c.boolean().optional(),secretsManager:c.boolean().optional(),kms:c.boolean().optional(),cloudwatchLogs:c.boolean().optional(),ssm:c.boolean().optional(),sts:c.boolean().optional()}).strict().describe("Interface VPC endpoints (cost per hour)"),k8=Bt(w8),N8=c.object({gateway:D8.optional(),interface:k8.optional()}).strict().describe("VPC endpoints configuration"),wj=Bt(N8),Wa=c.object({maxAzs:c.number().int(E.MAX_AZS.INTEGER).min(1,E.MAX_AZS.MIN).max(3,E.MAX_AZS.MAX).optional(),natGateways:Ij.optional(),flowLogs:Dj.optional(),vpcEndpoints:wj.optional(),cidrMask:c.number().int(E.CIDR_MASK.INTEGER).min(16,E.CIDR_MASK.MIN).max(28,E.CIDR_MASK.MAX).optional()}).strict(),kj=c.string().min(1,E.REQUIRED.NETWORK_NAME).max(50,E.MAX_LENGTH.NETWORK_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),Nj=Wa.extend({name:kj}).strict(),Pj=Bt(Wa),Yve=c.object({appName:lt,networkName:kj.optional(),maxAzs:c.number().int(E.MAX_AZS.INTEGER).min(1,E.MAX_AZS.MIN).max(3,E.MAX_AZS.MAX).optional(),natGateways:Ij.optional(),flowLogs:Dj.optional(),vpcEndpoints:wj.optional()}).strict(),P8=he.CIDR,b0=c.string().regex(P8,E.CIDR),R8=c.object({kind:c.literal("database"),resource:c.string().min(1,E.REQUIRED.RESOURCE_REFERENCE),name:be,allowedFromCidrs:c.array(b0),access:c.enum(["read","write","readWrite"]).optional()}).strict(),O8=c.object({kind:c.literal("ecsService"),resource:c.string().min(1,E.REQUIRED.RESOURCE_REFERENCE),serviceName:c.string().min(1,E.REQUIRED.SERVICE_NAME),name:be,allowedFromCidrs:c.array(b0),port:Ga.optional()}).strict(),$8=c.discriminatedUnion("kind",[R8,O8]),Rj=c.object({name:be,peerAppName:c.string().min(1,E.REQUIRED.APP_NAME),peerAccountId:c.string().regex(he.AWS_ACCOUNT_ID,E.AWS_ACCOUNT_ID),peerRegion:c.string().min(1,E.VPC_PEER.REGION_REQUIRED).optional(),peerVpcId:c.string().regex(he.VPC_ID,E.VPC_ID).optional(),peerVpcCidr:b0.optional(),peerRoleArn:c.string().regex(he.ROLE_ARN,E.ROLE_ARN).optional(),peerRouteTableIds:c.array(c.string().min(1,E.VPC_PEER.ROUTE_TABLE_ID_REQUIRED)).optional(),localVpcName:c.string().min(1,E.REQUIRED.NETWORK_NAME).optional(),enableDnsResolution:c.boolean().optional()}).strict(),S0=c.object({name:be,requesterAccountIds:c.array(c.string().regex(he.AWS_ACCOUNT_ID,E.AWS_ACCOUNT_ID)).min(1,E.VPC_PEER.MIN_REQUESTER_ACCOUNTS),localVpcName:c.string().min(1,E.REQUIRED.NETWORK_NAME).optional(),publishToSsm:c.boolean().optional(),exposedResources:c.array($8).optional()}).strict();var Th=["storage","cdn","compute"],j8=c.object({sid:c.string().optional(),effect:c.enum(["Allow","Deny"]),principals:c.array(c.string()),actions:c.array(c.string()),resources:c.array(c.string()).optional(),conditions:c.record(c.string(),c.record(c.string(),c.union([c.string(),c.array(c.string())]))).optional()}).strict(),bl=c.object({name:be,bucketName:c.string().optional(),publicReadAccess:c.boolean().optional(),websiteHosting:c.object({indexDocument:c.string(),errorDocument:c.string().optional()}).strict().optional(),backupVaultTier:c.enum(qr).optional(),versioned:c.boolean().optional(),encryption:c.enum(Bs).optional(),kmsKeyArn:c.string().optional(),cors:c.array(c.object({allowedOrigins:c.array(c.string()),allowedMethods:c.array(c.string()),allowedHeaders:c.array(c.string()).optional(),exposedHeaders:c.array(c.string()).optional(),maxAge:c.number().optional()}).strict()).optional(),deployment:c.object({source:c.string(),prune:c.boolean().optional(),cacheControl:c.object({maxAge:c.number().optional(),immutable:c.boolean().optional()}).strict().optional()}).strict().optional(),retain:c.boolean().optional(),resourcePolicyStatements:c.array(j8).optional(),stackPlacement:c.enum(Th).optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:E.KMS.KEY_REQUIRED}),Oj=c.object({appName:lt,bucketName:oj,nameProvidedByFlag:c.boolean().optional(),storagePreset:c.enum(ij).optional(),publicReadAccess:c.boolean().optional(),websiteHosting:c.object({indexDocument:c.string(),errorDocument:c.string().optional()}).strict().optional(),backupVaultTier:c.enum(qr).optional(),versioned:c.boolean().optional(),encryption:c.enum(Bs).optional(),kmsKeyArn:c.string().optional(),cors:c.array(c.object({allowedOrigins:c.array(c.string()),allowedMethods:c.array(c.string()),allowedHeaders:c.array(c.string()).optional(),exposedHeaders:c.array(c.string()).optional(),maxAge:c.number().optional()}).strict()).optional(),connectionConfig:c.object({connectToCompute:c.array(c.string()).optional(),connectToServices:c.array(c.string()).optional()}).strict().optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:E.KMS.KEY_REQUIRED,path:["kmsKeyArn"]});var E0=c.enum(["DESTROY","RETAIN"]),Sl=c.object({name:be,queueType:c.enum(["standard","fifo"]).default("standard"),visibilityTimeout:c.number().int(E.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,E.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,E.SQS.VISIBILITY_TIMEOUT.MAX).optional(),retentionPeriod:c.number().int(E.SQS.RETENTION_PERIOD.INTEGER).min(60,E.SQS.RETENTION_PERIOD.MIN).max(1209600,E.SQS.RETENTION_PERIOD.MAX).optional(),contentBasedDeduplication:c.boolean().optional(),removalPolicy:E0.optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict();var $j=c.object({type:c.literal("basic-auth"),username:c.string().min(1),password:c.string().min(1)}).strict(),El=c.object({name:be,defaultOriginRef:c.string(),behaviours:c.array(c.object({pathPattern:c.string(),originRef:c.string(),cachePolicy:c.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:c.string().optional(),certificateArn:c.string().optional(),domain:c.string().optional(),originHostname:c.string().optional(),accessGate:c.union([c.literal(!1),$j]).optional(),extraProperties:c.array(St).optional()}).strict(),dbe=c.object({appName:c.string(),name:be.optional(),defaultOriginRef:c.string(),behaviours:c.array(c.object({pathPattern:c.string(),originRef:c.string(),cachePolicy:c.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:c.string().optional(),certificateArn:c.string().optional(),domain:c.string().optional(),originHostname:c.string().optional(),accessGate:c.union([c.literal(!1),$j]).optional(),nameProvidedByFlag:c.boolean().optional()}).strict();var M8=Object.defineProperty,x0=(e,t)=>M8(e,"name",{value:t,configurable:!0}),F8=new Set(["t4g","c6g","c6gd","c6gn","c7g","c7gd","c7gn","r6g","r6gd","r7g","r7gd","r8g","r8gd","c8g","c8gd","c8gn","m6g","m6gd","m7g","m7gd","m8g","m8gd","x8g","i8g","a1","x2gd","im4gn","is4gen","i4g","hpc7g"]);function Vi(e){let t=e.split(".")[0]??"";return F8.has(t)?"ARM":"STANDARD"}x0(Vi,"getArchitectureForInstanceType");function Ch(e,t){let r=Vi(e);return r!==t?{valid:!1,message:`Instance type '${e}' requires ${r} architecture, but '${t}' 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}}x0(Ch,"validateArchitectureMatch");function jj(e,t){return Vi(e)===t}x0(jj,"isArchitectureCompatible");var L8=Object.defineProperty,Ih=(e,t)=>L8(e,"name",{value:t,configurable:!0});var U8=1;var z8=/^[A-Za-z0-9_.-]+$/,B8=c.object({id:c.string().min(1,"buildSecret id cannot be empty").regex(z8,"buildSecret id may contain only letters, digits, '_', '.', and '-' (no comma, '=', or whitespace, which would break the buildx --secret argv)"),ssm:c.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:c.object({name:c.string().min(1,"secret name cannot be empty").optional(),arn:c.string().min(1,"secret arn cannot be empty").optional(),field:c.string().min(1,"secret field cannot be empty").optional()}).strict().refine(e=>e.name===void 0!=(e.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:c.string().min(1,"env variable name cannot be empty").optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(r=>r!==void 0).length!==1&&t.addIssue({code:c.ZodIssueCode.custom,message:"buildSecret requires exactly one source (ssm, secretsManager, or env)"})}),G8=c.union([c.string(),c.object({ssm:c.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:c.object({name:c.string().min(1,"secret name cannot be empty").optional(),arn:c.string().min(1,"secret arn cannot be empty").optional(),field:c.string().min(1,"secret field cannot be empty").optional()}).strict().refine(e=>e.name===void 0!=(e.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:c.string().min(1,"env variable name cannot be empty").optional(),acknowledgePublic:c.boolean().optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(r=>r!==void 0).length!==1&&t.addIssue({code:c.ZodIssueCode.custom,message:"buildArg value requires exactly one source (ssm, secretsManager, or env)"})})]),pn=c.object({path:c.string(),context:c.string().min(1,"context cannot be empty").optional(),target:c.string().min(1,"target cannot be empty").optional(),buildArgs:c.record(c.string(),G8).optional(),buildSecrets:c.array(B8).optional()}).strict(),gbe=pn.partial();function V8(e,t){if(t===void 0)return e;let r=t.context??e.context,i=t.target??e.target,n=t.buildArgs??e.buildArgs,a=t.buildSecrets??e.buildSecrets;return{path:t.path??e.path,...r!==void 0&&{context:r},...i!==void 0&&{target:i},...n!==void 0&&{buildArgs:n},...a!==void 0&&{buildSecrets:a}}}Ih(V8,"mergeDockerBuild");function A0(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Ih(A0,"isRecord");function Mj(e){if(!A0(e)||typeof e.path!="string"||e.path.length===0)return;let t=typeof e.context=="string"&&e.context.length>0?e.context:void 0,r=typeof e.target=="string"&&e.target.length>0?e.target:void 0,i=A0(e.buildArgs)&&Object.keys(e.buildArgs).length>0?e.buildArgs:void 0,n=Array.isArray(e.buildSecrets)&&e.buildSecrets.length>0?e.buildSecrets:void 0,a={path:e.path,...t!==void 0&&{context:t},...r!==void 0&&{target:r},...i!==void 0&&{buildArgs:i},...n!==void 0&&{buildSecrets:n}},o=pn.safeParse(a);return o.success?o.data:void 0}Ih(Mj,"normaliseDockerBuild");function W8(e){if(e===void 0)return;let t=Mj(e);return t===void 0?void 0:JSON.stringify(t)}Ih(W8,"dockerBuildFingerprint");var K8=c.object({name:c.string(),clusterName:c.string().optional(),docker:pn.optional(),containerPort:c.number().optional(),secrets:c.array(c.string()).optional(),ssmSecretsPath:c.string().optional(),importedSecretNames:c.array(c.string()).optional(),schemaGateImageTag:c.string().optional()}).strict(),q8=c.object({type:c.enum(vr),name:c.string(),source:c.string()}).strict(),Z8=c.object({repositoryName:c.string()}).strict(),H8=["x86_64","arm64"],J8=c.object({name:c.string(),secrets:c.array(c.string()).optional(),ssmSecretsPath:c.string().optional(),importedSecretNames:c.array(c.string()).optional(),docker:pn.optional(),imageKey:c.string().optional(),architecture:c.enum(H8).optional()}).strict(),X8=c.object({templateHash:c.string(),synthTimestamp:c.string()}).strict(),Y8=c.object({constructPath:c.string().max(512),group:c.string().max(128),resourceType:c.string().max(256)}).strict(),Q8=c.object({synthesisedBy:c.string().min(1).max(128),minimumEngineVersion:c.string().min(1).max(32),maximumEngineMajor:c.number().int().min(0).optional(),minimumAwsCdkCli:c.string().min(1).max(32).optional()}).strict(),e5=c.object({appName:c.string().min(1).max(128),slot:c.string().min(1).max(64),clusterName:c.string().min(1).max(128),anchor:c.string().min(1).max(128),pinned:c.boolean(),currentServiceName:c.string().min(1).max(256),legacyKey:c.string().min(1).max(256),legacyAnchor:c.string().min(1).max(256),legacyServiceName:c.string().min(1).max(512),legacyKeyFields:c.array(c.string().max(64)).max(32)}).strict(),t5=c.object({constructPath:c.string().min(1).max(512),resourceType:c.string().min(1).max(256),physicalNameHint:c.string().min(1).max(512),policy:c.enum(["retain","snapshot","adopted"]),destroyDisposition:c.enum(["survives","deleted-on-explicit-destroy"]),reason:c.string().min(1).max(1024),costClass:c.enum(["none","storage","fixed-monthly"]),cleanupHint:c.string().min(1).max(1024)}).strict(),ybe=c.object({version:c.literal(U8),generatedAt:c.string(),appName:c.string(),services:c.array(K8),lambdas:c.array(J8),pattern:q8.optional(),ecr:Z8.optional(),stacks:c.record(c.string(),X8),resourceMap:c.record(c.string(),Y8).optional(),engineCompat:Q8.optional(),identityAliases:c.array(e5).optional(),residuals:c.array(t5).optional()}).strict();var r5=Object.defineProperty,n5=(e,t)=>r5(e,"name",{value:t,configurable:!0});function Lj(e){return!(e.image!==void 0&&e.docker!==void 0)}n5(Lj,"imageDockerMutexCheck");var Uj=c.number().int(E.CAPACITY.MIN.INTEGER).min(p0,E.GENERATOR_CAPACITY.MIN.MIN).max(m0,E.GENERATOR_CAPACITY.MIN.MAX),zj=c.number().int(E.CAPACITY.MAX.INTEGER).min(p0,E.GENERATOR_CAPACITY.MAX.MIN).max(m0,E.GENERATOR_CAPACITY.MAX.MAX),Vs=c.number().int(E.LAMBDA.MEMORY.INTEGER).min(Q1,E.LAMBDA.MEMORY.MIN).max(ej,E.LAMBDA.MEMORY.MAX).refine(e=>e===128||e%64===0,E.LAMBDA.MEMORY.MULTIPLE),Bj=c.string().regex(he.LAMBDA_RUNTIME_IDENTIFIER,E.LAMBDA.RUNTIME),_0=c.number().int(E.CPU.INTEGER).min(256,E.CPU.MIN).max(4096,E.CPU.MAX),wh=c.number().int(E.CAPACITY.DESIRED.INTEGER).min(0,E.CAPACITY.DESIRED.MIN).max(zs,E.CAPACITY.DESIRED.MAX),xl=c.object({connectToDatabase:c.array(c.string()).optional()}).strict(),i5=c.object({minSize:c.number().int(E.CAPACITY.WARM_POOL.MIN_SIZE.INTEGER).min(0,E.CAPACITY.WARM_POOL.MIN_SIZE.MIN).max(tj,E.CAPACITY.WARM_POOL.MIN_SIZE.MAX).optional(),reuseOnScaleIn:c.boolean().optional()}).strict(),T0=c.object({instanceType:c.string().optional(),amiHardwareType:c.enum(dh).optional(),minCapacity:c.number().int(E.CAPACITY.MIN.INTEGER).min(0,E.CAPACITY.MIN.MIN_0).max(zs,E.CAPACITY.MIN.MAX).optional(),maxCapacity:c.number().int(E.CAPACITY.MAX.INTEGER).min(1,E.CAPACITY.MAX.MIN_1).max(zs,E.CAPACITY.MAX.MAX).optional(),memoryLimitMiB:ml(128).optional(),warmPool:i5.optional(),extraProperties:c.array(St).optional()}).strict().superRefine((e,t)=>{if(!e.instanceType||!e.amiHardwareType)return;let r=Ch(e.instanceType,e.amiHardwareType);r.valid||t.addIssue({code:"custom",message:r.message??E.ARCHITECTURE_MISMATCH,path:["instanceType"]})}).superRefine((e,t)=>{e.minCapacity===0&&!e.warmPool&&t.addIssue({code:"custom",message:E.CAPACITY.WARM_POOL_REQUIRED,path:["minCapacity"]}),e.warmPool?.minSize!==void 0&&e.maxCapacity!==void 0&&e.warmPool.minSize>e.maxCapacity&&t.addIssue({code:"custom",message:E.CAPACITY.WARM_POOL.MIN_SIZE_EXCEEDS_MAX_CAPACITY,path:["warmPool","minSize"]})}),a5=c.enum(cl).describe(`Compute type must be one of: ${cl.join(", ")}`),C0=c.enum(Ls).describe(`ECS capacity provider must be one of: ${Ls.join(", ")}`),I0=c.string().refine(e=>zt(ph,e),{message:E.INSTANCE_TYPE}),Gj=c.object({sourceType:c.enum(["sqs","dynamodb","eventbridge"]),sourceRef:c.string().describe("Name of the source resource"),batchSize:c.number().int(E.BATCH_SIZE.INTEGER).min(1,E.BATCH_SIZE.MIN).max(1e4,E.BATCH_SIZE.MAX).optional(),startingPosition:c.enum(["TRIM_HORIZON","LATEST"]).optional(),maxBatchingWindow:c.number().int(E.BATCHING_WINDOW.INTEGER).min(0,E.BATCHING_WINDOW.MIN).max(300,E.BATCHING_WINDOW.MAX).optional(),reportBatchItemFailures:c.boolean().optional()}).strict(),o5=c.object({name:c.string().min(1,E.REQUIRED.CONTAINER_NAME).optional(),image:c.string().optional(),port:Ga.optional(),environment:Gs.optional(),secretsImport:cj.optional(),command:c.array(c.string()).optional(),entryPoint:c.array(c.string()).optional(),essential:c.boolean().optional(),healthCheck:c.object({command:c.array(c.string()),interval:c.number().int(E.HEALTH_CHECK.INTERVAL.INTEGER).min(5,E.HEALTH_CHECK.INTERVAL.MIN).max(300,E.HEALTH_CHECK.INTERVAL.MAX).optional(),timeout:c.number().int(E.HEALTH_CHECK.TIMEOUT.INTEGER).min(2,E.HEALTH_CHECK.TIMEOUT.MIN).max(60,E.HEALTH_CHECK.TIMEOUT.MAX).optional(),retries:c.number().int(E.HEALTH_CHECK.RETRIES.INTEGER).min(1,E.HEALTH_CHECK.RETRIES.MIN).max(10,E.HEALTH_CHECK.RETRIES.MAX).optional(),startPeriod:c.number().int(E.HEALTH_CHECK.START_PERIOD.INTEGER).min(0,E.HEALTH_CHECK.START_PERIOD.MIN).max(300,E.HEALTH_CHECK.START_PERIOD.MAX).optional()}).strict().optional(),ssmSecrets:c.array(c.string().regex(he.SECRET_NAME,E.SECRET_NAME)).optional(),extraProperties:c.array(St).optional()}).strict(),Vj=c.string().min(1,E.REQUIRED.SERVICE_NAME).max(255,E.MAX_LENGTH.SERVICE_NAME).regex(he.ECS_SERVICE_NAME,E.ECS_SERVICE_NAME),Wj=c.object({domain:c.string().optional(),loadBalancer:c.union([c.literal(!1),c.enum(uh)]).optional(),directAccess:c.boolean().optional(),extraProperties:c.array(St).optional()}).strict().refine(e=>!(e.directAccess&&e.domain),{message:E.DIRECT_ACCESS.NO_DOMAIN,path:["directAccess"]}).refine(e=>!(e.directAccess&&typeof e.loadBalancer=="string"),{message:E.DIRECT_ACCESS.NO_LOAD_BALANCER}).describe("Cluster-level configuration"),Dh=c.object({path:c.string().optional(),host:c.string().optional(),priority:c.number().int(E.PRIORITY.INTEGER).min(1,E.PRIORITY.MIN).max(5e4,E.PRIORITY.MAX).optional(),healthCheckPath:c.string().optional()}).strict().describe("Path/host-based routing configuration"),s5=c.object({desiredCount:wh.optional(),minCapacity:c.number().int(E.CAPACITY.MIN.INTEGER).min(0,E.CAPACITY.MIN.MIN_0).max(zs,E.CAPACITY.MIN.MAX).optional(),maxCapacity:c.number().int(E.CAPACITY.MAX.INTEGER).min(1,E.CAPACITY.MAX.MIN_1).max(zs,E.CAPACITY.MAX.MAX).optional(),scalingType:c.enum(lh).optional()}).strict().refine(Ba.check,Ba.params).describe("ECS service scaling configuration"),Kj=c.object({name:Vj,docker:pn.optional(),needsDatabaseConnection:c.boolean().optional(),needsStorageConnection:c.boolean().optional(),needsMessagingConnection:c.boolean().optional(),image:c.string().optional(),containers:c.array(o5).optional(),routing:c.union([Dh,c.array(Dh).min(1)]).optional(),serviceType:c.enum(dl).optional(),cpu:_0.optional(),memoryLimitMiB:ml(512).optional(),desiredCount:wh.optional(),scaling:Bt(s5).optional(),capacityProvider:C0,ec2Config:T0.optional(),ssmSecretsPath:c.string().regex(he.SSM_PATH,E.SSM_PATH).optional(),extraProperties:c.array(St).optional(),alarms:pj.optional()}).strict().superRefine((e,t)=>{Lj(e)||t.addIssue({code:"custom",path:["docker"],message:E.IMAGE_DOCKER_MUTEX})}).describe("Configuration for a service in an ECS cluster"),Al=c.object({name:be,type:a5,needsConnection:c.boolean(),connectedDatabase:c.array(c.string().min(1,E.REQUIRED.CONNECTED_RESOURCE_NAME)).optional(),connectedStorage:c.array(c.string().min(1,E.REQUIRED.CONNECTED_RESOURCE_NAME)).optional(),connectedMessaging:c.array(c.string().min(1,E.REQUIRED.CONNECTED_RESOURCE_NAME)).optional(),cluster:Wj.optional(),containerInsights:c.boolean().optional(),services:c.array(Kj).optional(),docker:pn.partial().optional(),deployment:c.enum(oh).optional(),codePath:c.string().optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(mh,E.LAMBDA.TIMEOUT.MIN).max(fh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:Vs.optional(),handler:c.string().optional(),runtime:Bj.optional(),environment:Gs.optional(),secrets:Gs.optional(),eventSources:c.array(Gj).optional(),functionUrl:c.object({authType:c.enum(ll)}).strict().optional(),description:c.string().optional(),scheduleExpression:c.string().optional(),scheduleStackPlacement:c.enum(za).optional(),architecture:c.enum(ch).optional(),ephemeralStorageSize:c.number().int(E.EPHEMERAL_STORAGE.INTEGER).min(512,E.EPHEMERAL_STORAGE.MIN).max(10240,E.EPHEMERAL_STORAGE.MAX).optional(),functionName:c.string().optional(),ssmSecrets:c.array(c.string()).optional(),ssmSecretsPath:c.string().optional(),alarms:fj.optional(),instanceType:I0.optional(),enableSSH:c.boolean().optional(),keyName:c.string().optional(),userData:c.string().optional(),securityGroups:c.array(c.string()).optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict().superRefine((e,t)=>{if(e.type==="ecs"&&e.services)for(let r=0;r<e.services.length;r++){let i=e.services[r];i?.ec2Config?.instanceType&&!i.ec2Config.amiHardwareType&&Vi(i.ec2Config.instanceType)!=="ARM"&&t.addIssue({code:"custom",message:`Service '${i.name??r}' uses instance type '${i.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"]})}e.type==="lambda"&&e.deployment==="container"&&e.architecture==="X86_64"&&t.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"]})}),Cbe=c.object({appName:lt,clusterName:be,containerPort:Ga,nameProvidedByFlag:c.boolean().optional(),ecrRepository:c.string().optional(),capacityProvider:C0.optional(),useAppEcr:c.boolean().optional(),desiredCount:wh.optional(),cpu:_0.optional(),memoryLimitMiB:ml(512).optional(),minCapacity:Uj.optional(),maxCapacity:zj.optional(),ec2Config:T0.optional(),connectionConfig:xl.optional()}).strict().refine(Ba.check,Ba.params),Ibe=c.object({appName:lt,functionName:be,nameProvidedByFlag:c.boolean().optional(),lambdaType:c.enum(["basic","web","custom"]).optional(),ecrRepository:c.string().optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(mh,E.LAMBDA.TIMEOUT.MIN).max(fh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:Vs.optional(),enableFunctionUrl:c.boolean().optional(),description:c.string().optional(),enableCors:c.boolean().optional(),corsOrigins:c.string().optional(),corsHeaders:c.string().optional(),corsMethods:c.array(c.enum(nj)).optional(),corsCredentials:c.boolean().optional(),connectionConfig:xl.optional()}).strict(),Dbe=c.object({appName:lt,instanceName:be,nameProvidedByFlag:c.boolean().optional(),instanceType:I0.optional(),enableSSH:c.boolean().optional(),minCapacity:Uj.optional(),maxCapacity:zj.optional(),connectionConfig:xl.optional()}).strict().refine(Ba.check,Ba.params),wbe=c.object({appName:lt,clusterName:be,serviceName:Vj,capacityProvider:C0,containerPort:Ga.optional(),cpu:_0.optional(),memoryLimitMiB:ml(512).optional(),desiredCount:wh.optional(),ec2Config:T0.optional(),routing:c.union([Dh,c.array(Dh).min(1)]).optional(),docker:pn.partial().optional(),nameProvidedByFlag:c.boolean().optional(),connectionConfig:xl.optional()}).strict(),D0=c.object({appName:lt,computeName:be,nameProvidedByFlag:c.boolean().optional(),connectionConfig:xl.optional()}).strict(),c5=D0.extend({type:c.literal("ecs"),cluster:Wj.optional(),services:c.array(Kj).min(1,E.SERVICE.MIN_REQUIRED),docker:pn.partial().optional()}).strict().refine(e=>{let t=e.services.filter(r=>r.containers?.some(i=>i.port));return t.length>1?t.every(r=>(Array.isArray(r.routing)?r.routing:r.routing?[r.routing]:[]).some(i=>i.path||i.host)):!0},{message:E.SERVICE.ROUTING_REQUIRED}).refine(e=>{let t=e.services.map(r=>r.name);return new Set(t).size===t.length},{message:E.SERVICE.UNIQUE_WITHIN_CLUSTER}),u5=D0.extend({type:c.literal("lambda"),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(mh,E.LAMBDA.TIMEOUT.MIN).max(fh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:Vs.optional(),handler:c.string().optional(),runtime:Bj.optional(),environment:Gs.optional(),secrets:Gs.optional(),description:c.string().optional(),functionUrl:c.union([c.object({authType:c.enum(ll).optional()}).strict(),c.literal(!1)]).optional(),eventSources:c.array(Gj).optional()}).strict(),l5=D0.extend({type:c.literal("ec2"),instanceType:I0.optional(),enableSSH:c.boolean().optional(),keyName:c.string().optional(),userData:c.string().optional(),securityGroups:c.array(c.string()).optional()}).strict(),kbe=c.discriminatedUnion("type",[c5,u5,l5]),Fj=c.object({path:c.string().min(1,E.REQUIRED.ROUTING_PATH),priority:c.number().int(E.PRIORITY.INTEGER).min(1,E.PRIORITY.MIN).max(5e4,E.PRIORITY.MAX).optional()}).strict(),qj=c.object({name:c.string().min(1,E.REQUIRED.SERVICE_NAME).max(255,E.MAX_LENGTH.SERVICE_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),serviceType:c.enum(dl).optional(),docker:pn.partial().optional(),containerPort:Ga.optional(),needsDatabaseConnection:c.boolean().optional(),routing:c.union([Fj,c.array(Fj).min(1)]).optional()}).strict().superRefine((e,t)=>{e.serviceType==="worker"&&(e.containerPort!==void 0&&t.addIssue({code:"custom",path:["containerPort"],message:"Worker services are not reachable inbound; remove containerPort."}),e.routing!==void 0&&t.addIssue({code:"custom",path:["routing"],message:"Worker services have no ALB route; remove routing."}))}),Nbe=c.object({appName:lt,instanceType:c.string().optional()}).strict();var w0=c.object({memorySize:Vs.optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(1,E.LAMBDA.TIMEOUT.MIN).max(900,E.LAMBDA.TIMEOUT.MAX).optional(),ephemeralStorageSize:c.number().int(E.EPHEMERAL_STORAGE.INTEGER).min(512,E.EPHEMERAL_STORAGE.MIN).max(10240,E.EPHEMERAL_STORAGE.MAX).optional()}).strict(),Zj=c.object({type:c.enum(d0).optional(),databaseName:c.string().optional(),databaseEngine:c.enum(Us).optional(),deletionProtection:c.boolean().optional(),backupRetention:Va.optional(),port:vh.optional(),publiclyAccessible:c.boolean().optional(),allowedIpCidr:c.string().optional(),instanceType:c.string().optional(),allocatedStorage:c.number().int(E.ALLOCATED_STORAGE.INTEGER).min(20,E.ALLOCATED_STORAGE.MIN).max(65536,E.ALLOCATED_STORAGE.MAX).optional(),multiAz:c.boolean().optional(),readReplica:Eh.optional(),writer:gl.optional(),readers:yl.optional(),allowVpcAccess:c.boolean().optional(),monitoringInterval:hl.optional(),preferredMaintenanceWindow:c.string().optional(),databaseInsights:xh.optional(),proxy:Sh.optional(),credentials:bh.optional(),encryption:Ah.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()}).strict(),Hj=c.object({server:w0.optional(),imageOptimisation:w0.optional(),revalidation:w0.optional()}).strict(),k0=c.object({versioned:c.boolean().optional()}).strict(),Jj=c.object({assets:k0.optional(),cache:k0.optional(),media:k0.optional()}).strict(),d5=c.object({visibilityTimeout:c.number().int(E.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,E.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,E.SQS.VISIBILITY_TIMEOUT.MAX).optional(),messageRetentionPeriod:c.number().int(E.SQS.RETENTION_PERIOD.INTEGER).min(60,E.SQS.RETENTION_PERIOD.MIN).max(1209600,E.SQS.RETENTION_PERIOD.MAX).optional(),maxMessageSize:c.number().int(E.MAX_MESSAGE_SIZE.INTEGER).min(1024,E.MAX_MESSAGE_SIZE.MIN).max(262144,E.MAX_MESSAGE_SIZE.MAX).optional(),deadLetterQueue:c.union([c.literal(!1),c.object({enabled:c.boolean().optional(),maxReceiveCount:c.number().int(E.DLQ.MAX_RECEIVE_COUNT.INTEGER).min(1,E.DLQ.MAX_RECEIVE_COUNT.MIN).max(1e3,E.DLQ.MAX_RECEIVE_COUNT.MAX).optional()}).strict()]).optional()}).strict(),Xj=c.object({revalidationQueue:d5.optional()}).strict(),Yj=c.object({domainNames:c.array(c.string()).optional(),certificateArn:c.string().optional()}).strict(),Qj=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),c.string()).optional(),N0=c.object({type:c.literal("payload"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),domain:c.string().optional(),database:Zj.optional(),compute:Hj.optional(),storage:Jj.optional(),messaging:Xj.optional(),cdn:Yj.optional(),environment:Qj}).strict(),P0=c.object({type:c.literal("nextjs"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),domain:c.string().optional(),database:Zj.optional(),compute:Hj.optional(),storage:Jj.optional(),messaging:Xj.optional(),cdn:Yj.optional(),environment:Qj}).strict(),R0=c.enum(Mu),p5=c.object({command:c.string().min(1,E.REQUIRED.BUILD_COMMAND),outputDir:c.string().min(1,E.REQUIRED.OUTPUT_DIR)}).strict(),m5=c.object({maxAgeDays:c.number().optional(),includeSubdomains:c.boolean().optional(),preload:c.boolean().optional()}).strict(),f5=c.object({headers:c.boolean().optional(),contentSecurityPolicy:c.string().optional(),hsts:c.union([c.literal(!1),m5]).optional()}).strict(),h5=c.object({to:c.string().min(1,E.REQUIRED.FORMS_TO).regex(he.EMAIL,E.EMAIL),from:c.string().regex(he.EMAIL,E.EMAIL).optional(),corsOrigin:c.string().regex(he.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),maxConcurrency:c.number().int().min(1).max(100).optional()}).strict(),g5=c.object({behaviours:c.array(c.unknown()).optional(),priceClass:c.enum(Fu).optional(),invalidateOnDeploy:c.boolean().optional()}).strict(),y5=c.object({type:c.literal("basic-auth"),username:c.string().min(1,"accessGate.username must not be empty"),password:c.string().min(1,"accessGate.password must not be empty")}).strict(),_l=c.object({type:c.literal("staticsite"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),source:c.string().min(1,E.REQUIRED.SOURCE),build:p5,routing:R0.optional(),security:f5.optional(),domain:c.string().optional(),zoneName:c.string().optional(),hostedZoneId:c.string().optional(),forms:h5.optional(),cdn:g5.optional(),accessGate:y5.optional()}).strict().superRefine((e,t)=>{if(e.forms===void 0)return;let r=e.domain;if(r===void 0||r===""){t.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 i=e.forms.from;i!==void 0&&!Ef(i,r)&&t.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.`})}),Tl=c.discriminatedUnion("type",[N0,P0,_l]),eM=c.enum(["lightweight","standard","resilient","custom"]),tM=c.object({type:c.enum(d0),instanceType:c.string().optional(),backupRetention:Va.optional(),deletionProtection:c.boolean().optional(),encryption:c.union([c.object({useCMK:c.literal(!0)}).strict(),c.literal(!1)]).optional()}).strict(),rM=c.object({memorySize:Vs.optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(1,E.LAMBDA.TIMEOUT.MIN).max(900,E.LAMBDA.TIMEOUT.MAX).optional()}).strict();var nM=c.object({appName:lt,type:f0,pattern:h0.optional(),patternConfig:Tl.optional(),owner:c.string().optional(),tags:c.record(c.string(),c.string()).optional(),vpcId:c.string().optional(),network:Wa.optional(),backup:lj.optional(),tunnel:dj.optional(),additionalNetworks:c.array(Nj).optional(),database:c.array(vl),s3:c.array(bl),compute:c.array(Al),dynamodb:c.array(Tj).optional(),clickhouse:c.array(Cj).optional(),sqs:c.array(Sl).optional(),cdn:El.optional(),customCodeBlocks:c.array(uj).optional(),additionalManagedImports:c.array(c.object({moduleSpecifier:c.string(),namedImports:c.array(c.string()),defaultImport:c.string().optional()}).strict()).optional()}).strict(),Xbe=c.object({name:lt,type:f0,pattern:h0.optional(),patternTier:eM.optional(),patternDomain:c.string().optional(),source:c.string().min(1,E.REQUIRED.SOURCE).optional(),buildCommand:c.string().min(1,E.REQUIRED.BUILD_COMMAND).optional(),outputDir:c.string().min(1,E.REQUIRED.OUTPUT_DIR).optional(),routing:R0.optional(),formsTo:c.string().min(1,E.REQUIRED.FORMS_TO).regex(he.EMAIL,E.EMAIL).optional(),corsOrigin:c.string().regex(he.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),customDatabase:tM.optional(),customCompute:rM.optional(),region:c.string().optional(),owner:c.string().optional(),includeDatabase:c.boolean().optional(),databaseName:c.string().min(1,E.DATABASE.NAME.REQUIRED).max(63,E.DATABASE.NAME.MAX_LENGTH).optional(),vpcId:c.string().optional(),network:Pj.optional(),services:c.array(qj).optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()}).strict().superRefine((e,t)=>{e.formsTo!==void 0&&(e.patternDomain!==void 0&&e.patternDomain!==""||t.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"}))}),O0=c.object({name:be,localResource:c.string().min(1),remoteApp:c.string().min(1),remoteResource:c.string().min(1),permission:c.enum(["read","write","read-write"]),remoteArn:c.string().optional()}).strict();var v5=["fjall-managed","external","external-manual"],rSe=c.enum(v5);var iM=c.object({givenName:c.string().min(1),familyName:c.string().min(1),displayName:c.string().min(1).optional(),expires:c.string().min(1).optional()}).strict(),aM=c.object({name:c.string().min(1),path:c.string().min(1).optional()}).strict(),b5=c.union([c.object({managedPolicyArn:c.string().min(1)}).strict(),c.object({customerManagedPolicy:aM}).strict()]),S5=c.object({managedPolicies:c.array(c.string().min(1)).optional(),inlinePolicy:c.record(c.string(),c.unknown()).optional(),customerManagedPolicies:c.array(aM).optional(),permissionsBoundary:b5.optional(),sessionDuration:c.string().min(1).optional(),description:c.string().optional(),accounts:c.union([c.array(c.string().min(1)),c.literal("all")]).optional(),includeManagementAccount:c.boolean().optional(),groups:c.array(c.string().min(1)).optional()}).strict(),E5=c.object({description:c.string().optional()}).strict(),kh=c.string().regex(he.EMAIL,E.EMAIL),$0={groups:c.record(c.string(),E5).optional(),permissionSets:c.record(c.string(),S5).optional(),memberships:c.record(c.string(),c.array(kh)).optional(),resolutionVersion:c.number().int().min(1).optional(),defaultPermissionSets:c.boolean().optional()},x5=c.discriminatedUnion("source",[c.object({...$0,source:c.literal("fjall-managed"),users:c.record(kh,iM)}).strict(),c.object({...$0,source:c.literal("external")}).strict(),c.object({...$0,source:c.literal("external-manual"),users:c.record(kh,iM).optional()}).strict()]),j0=c.object({name:be,type:c.literal("organisation").optional(),organisationName:c.string().min(1).optional(),orgEmail:kh.optional(),accounts:c.unknown().optional(),accountIds:c.record(c.string(),c.string()).optional(),identityCentre:c.union([x5,c.literal(!1)]).optional(),allowedRegions:c.array(c.string().min(1)).optional()}).strict();var A5=Object.defineProperty,_5=(e,t)=>A5(e,"name",{value:t,configurable:!0}),T5=[1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,3653],Nh=c.object({buildkiteQueue:c.string().min(1,"buildkiteQueue cannot be empty").max(100).regex(/^[a-zA-Z0-9-_]+$/,"buildkiteQueue must be alphanumeric with hyphens/underscores"),buildkiteOrgSlug:c.string().min(1,"buildkiteOrgSlug cannot be empty").max(100).regex(/^[a-z0-9-]+$/,"buildkiteOrgSlug must be a lowercase Buildkite organisation slug"),agentTokenSsmParameterName:c.string().min(2).regex(/^\//,"agentTokenSsmParameterName must be a full path (leading /)").optional(),agentTokenKmsKeyArn:c.string().min(1).optional(),fjallApiKeySsmParameterName:c.string().min(2).regex(/^\//,"fjallApiKeySsmParameterName must be a full path (leading /)").optional(),instanceType:c.string().min(1).default("c8g.xlarge"),agentVolumeSizeGib:c.number().int().min(20).max(1e3).default(250),agentMinInstances:c.number().int().min(0).default(0),agentMaxInstances:c.number().int().min(1).default(2),agentsPerInstance:c.number().int().min(1).default(1),spotCapacityPercentage:c.number().int().min(0).max(100).default(0),scaleInIdlePeriodSeconds:c.number().int().min(60).default(600),disconnectAfterUptimeSeconds:c.number().int().min(3600).default(86400),maxInstanceLifetimeDays:c.number().int().min(1).max(365).default(7),terminateInstanceAfterJob:c.boolean().default(!1),purgeBuildsOnDiskFull:c.boolean().default(!0),terminateInstanceOnDiskFull:c.boolean().default(!1),logRetentionDays:c.number().int().min(1).default(30),agentLogRetentionDays:c.literal(T5).default(7),buildkiteAgentRelease:c.enum(["stable","beta","edge"]).default("stable"),buildkiteAgentTags:c.string().default(""),buildkiteAgentTimestampLines:c.boolean().default(!1),buildkiteAgentExperiments:c.string().default(""),buildkiteAgentTracingBackend:c.enum(["","datadog","opentelemetry"]).default(""),buildkiteAgentCancelGracePeriodSeconds:c.number().int().min(10).default(60),enableSecretsPlugin:c.boolean().default(!0),enableEcrPlugin:c.boolean().default(!1),enableDockerLoginPlugin:c.boolean().default(!1),enableDockerUserNamespaceRemap:c.boolean().default(!0),enableDockerExperimental:c.boolean().default(!1),dockerNetworkingProtocol:c.enum(["ipv4","dualstack"]).default("ipv4"),enableInstanceStorage:c.boolean().default(!1),mountTmpfsAtTmp:c.boolean().default(!0),buildkiteAgentEnableGitMirrors:c.boolean().default(!1),bootstrapScriptUrl:c.string().default(""),agentEnvFileUrl:c.string().default(""),scalerEventSchedulePeriod:c.string().min(1).default("1 minute"),scalerMinPollInterval:c.string().min(1).default("10s"),scaleOutFactor:c.string().min(1).default("1.0"),scaleOutWaitingForJobs:c.boolean().default(!1),rolePermissionsBoundaryArn:c.string().min(1).optional(),alarmSnsTopicArn:c.string().min(1).optional(),applicationId:c.string().min(1).optional(),costAllocationEnvironment:c.string().min(1).optional(),costAllocationOwner:c.string().min(1).optional()}).strict(),C5=Nh.refine(e=>e.agentMinInstances<=e.agentMaxInstances,{message:"agentMinInstances must be <= agentMaxInstances"});function I5(e){let t=C5.safeParse(e);if(!t.success){let r=t.error.issues.map(i=>` - ${i.path.join(".")||"(root)"}: ${i.message}`).join(`
|
|
356
356
|
`);throw new Error(`Buildkite: invalid props:
|
|
357
357
|
${r}`)}return t.data}_5(I5,"validateBuildkiteProps");var D5=Object.defineProperty,sM=(e,t)=>D5(e,"name",{value:t,configurable:!0});function cM(e){return`FjallDeployBoundary${e}`}sM(cM,"deployBoundaryName");var w5="/fjall/";function uM(e){return`FjallDeploy${e}`}sM(uM,"deployRoleName");var oM=`arn:*:iam::*:policy/${cM("*")}`,k5=[`arn:*:iam::*:role${w5}${uM("*")}`,"arn:*:iam::*:role/cdk-*-cfn-exec-role-*"],M0={Sid:"FjallInheritAdministratorAccess",Effect:"Allow",Action:"*",Resource:"*"},lM=[{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:"FjallDenyBoundaryReplace",Effect:"Deny",Action:["iam:PutRolePermissionsBoundary"],Resource:k5,Condition:{ArnNotLike:{"iam:PermissionsBoundary":oM}}},{Sid:"FjallDenyBoundaryPolicyTamper",Effect:"Deny",Action:["iam:CreatePolicy","iam:CreatePolicyVersion","iam:DeletePolicyVersion","iam:SetDefaultPolicyVersion","iam:DeletePolicy"],Resource:oM},{Sid:"FjallDenyDisableKmsKey",Effect:"Deny",Action:["kms:DisableKey"],Resource:"*"}],dM=[...lM,{Sid:"FjallDenyStandingHumanCredentials",Effect:"Deny",Action:["iam:CreateUser","iam:CreateLoginProfile","iam:CreateAccessKey","iam:CreateAccountAlias"],Resource:"*"},{Sid:"FjallDenyDisableConfigRecorder",Effect:"Deny",Action:["config:StopConfigurationRecorder"],Resource:"*"}],N5=[...dM,{Sid:"FjallDenyAccountPasswordPolicyTamper",Effect:"Deny",Action:["iam:UpdateAccountPasswordPolicy","iam:DeleteAccountPasswordPolicy"],Resource:"*"},{Sid:"FjallDenyDisableDefaultEbsEncryption",Effect:"Deny",Action:["ec2:DisableEbsEncryptionByDefault"],Resource:"*"}];var vSe={foundation:[M0,...lM],compliance:[M0,...dM],hardened:[M0,...N5]};var P5=Object.defineProperty,dt=(e,t)=>P5(e,"name",{value:t,configurable:!0});var U0="sts.amazonaws.com";function R5(e){return`FjallDevDeploy${e}`}dt(R5,"devDeployRoleName");function O5(e){return`FjallDevProvisioner${e}`}dt(O5,"devProvisionerRoleName");function $5(e){return`FjallDevSyncWriter${e}`}dt($5,"devSyncWriterRoleName");var j5="FjallDevBoundary";function pM(e){return`arn:aws:iam::${e}:policy/${j5}`}dt(pM,"devBoundaryPolicyArn");function mM(e){return`org:${e}:dev-provisioner`}dt(mM,"devProvisionerSubject");function fM(e){return`org:${e}:dev-sync`}dt(fM,"devSyncSubject");function F0(e,t){return`org:${e}:acct:${t}`}dt(F0,"deployAccountSubject");function L0(e){return`org:${e}:*`}dt(L0,"genericMachineSubject");var M5=["discovery","connection","org-setup","dev-substrate-setup"];function hM(e,t){return`org:${e}:${t}`}dt(hM,"serviceSubject");function F5(e){let{fjallOrgId:t,providerArn:r,issuerDomain:i,accountTier:n,accountId:a}=e,o=e.machineTrustMode??"expanded",s={[`${i}:aud`]:U0},u;if(o==="account-scoped"){if(n===void 0||!uf(n)||a===void 0)throw new Error(`machineTrustMode "account-scoped" requires a governance accountTier and an accountId (got tier: ${String(n)}, accountId ${a===void 0?"absent":"present"}) \u2014 refusing to fall back to the generic machine subject: a silent fallback would re-widen the trust the \xA74.4a Step-3 contract removes`);u=[F0(t,a)]}else a!==void 0?u=[L0(t),F0(t,a)]:u=L0(t);return[{Sid:"FjallMachineSubject",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...s,[`${i}:sub`]:u}}},{Sid:"FjallUserSubjects",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:s,StringLike:{[`${i}:sub`]:`org:${t}:user:*`}}},{Sid:"FjallServiceSubjects",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...s,[`${i}:sub`]:M5.map(d=>hM(t,d))}}}]}dt(F5,"buildNarrowedDeployTrustStatements");function L5(e){let{fjallOrgId:t,providerArn:r,issuerDomain:i,accountId:n}=e;return[{Sid:"FjallDevSubjectsThisAccount",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${i}:aud`]:U0},StringLike:{[`${i}:sub`]:`org:${t}:dev:${n}:*`}}}]}dt(L5,"buildDevDeployTrustStatements");function z0(e){let{providerArn:t,issuerDomain:r,sid:i,subject:n}=e;return[{Sid:i,Effect:"Allow",Principal:{Federated:t},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${r}:aud`]:U0,[`${r}:sub`]:n}}}]}dt(z0,"buildServiceSubjectTrustStatements");function U5(e){return z0({...e,sid:"FjallDevProvisionerSubject",subject:mM(e.fjallOrgId)})}dt(U5,"buildDevProvisionerTrustStatements");function z5(e){return z0({...e,sid:"FjallDevSyncSubject",subject:fM(e.fjallOrgId)})}dt(z5,"buildDevSyncWriterTrustStatements");function B5({accountId:e}){return[{Sid:"FjallDevEcsTaggedMutations",Effect:"Allow",Action:["ecs:UpdateService","ecs:DeleteService","ecs:RunTask","ecs:StopTask"],Resource:`arn:aws:ecs:*:${e}:*`,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:*:${e}:*`,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:*:${e}: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:*:${e}:*`,Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevElbTaggedCreates",Effect:"Allow",Action:["elasticloadbalancing:CreateTargetGroup","elasticloadbalancing:CreateRule"],Resource:`arn:aws:elasticloadbalancing:*:${e}:*`,Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevElbTagOnCreate",Effect:"Allow",Action:["elasticloadbalancing:AddTags"],Resource:`arn:aws:elasticloadbalancing:*:${e}:*`,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:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevLogsMutations",Effect:"Allow",Action:["logs:PutRetentionPolicy","logs:DeleteLogGroup"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevLogsTaggedCreate",Effect:"Allow",Action:["logs:CreateLogGroup","logs:TagResource"],Resource:`arn:aws:logs:*:${e}: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:*:${e}: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:*:${e}:key/*`,Condition:{"ForAnyValue:StringLike":{"kms:ResourceAliases":"alias/fjall-dev-*"}}},{Sid:"FjallDevKmsSsmSecureString",Effect:"Allow",Action:["kms:Encrypt","kms:Decrypt","kms:GenerateDataKey"],Resource:`arn:aws:kms:*:${e}: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:*:${e}:repository/*`},{Sid:"FjallDevPassDevPathRoles",Effect:"Allow",Action:["iam:PassRole"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`}]}dt(B5,"buildDevDeployPolicyStatements");function G5({accountId:e}){return[{Sid:"FjallDevProvisionerBoundedRoleWrites",Effect:"Allow",Action:["iam:CreateRole","iam:PutRolePolicy","iam:AttachRolePolicy"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`,Condition:{StringEquals:{"iam:PermissionsBoundary":pM(e)}}},{Sid:"FjallDevProvisionerPathRoleOps",Effect:"Allow",Action:["iam:DeleteRole","iam:DeleteRolePolicy","iam:DetachRolePolicy","iam:ListRolePolicies","iam:TagRole"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`},{Sid:"FjallDevProvisionerListRoles",Effect:"Allow",Action:["iam:ListRoles"],Resource:"*"},{Sid:"FjallDevProvisionerDevMasterSecrets",Effect:"Allow",Action:["secretsmanager:GetSecretValue"],Resource:`arn:aws:secretsmanager:*:${e}:secret:fjall-dev-*`},{Sid:"FjallDevProvisionerKmsDecryptViaSecretsManager",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}: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:*:${e}: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:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevProvisionerLogsTeardown",Effect:"Allow",Action:["logs:DeleteLogGroup"],Resource:`arn:aws:logs:*:${e}: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:*:${e}:*`,`arn:aws:elasticloadbalancing:*:${e}:*`],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:*:${e}:repository/*`},{Sid:"FjallDevProvisionerSsmReadAll",Effect:"Allow",Action:["ssm:GetParameter*"],Resource:`arn:aws:ssm:*:${e}:parameter/*`},{Sid:"FjallDevProvisionerKmsDecryptViaSsm",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{StringLike:{"kms:ViaService":"ssm.*.amazonaws.com"}}}]}dt(G5,"buildDevProvisionerPolicyStatements");function V5({accountId:e}){return[{Sid:"FjallDevSyncPrefixReadWrite",Effect:"Allow",Action:["s3:GetObject","s3:PutObject"],Resource:`arn:aws:s3:::fjall-dev-sync-${e}-*/*`,Condition:{StringEquals:{"aws:ResourceAccount":e}}}]}dt(V5,"buildDevSyncWriterPolicyStatements");function W5({accountId:e}){return[{Sid:"FjallDevBoundarySsmDevRead",Effect:"Allow",Action:["ssm:GetParameter*"],Resource:`arn:aws:ssm:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevBoundaryKmsDecryptDevAlias",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}: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-${e}-*/*`,Condition:{StringEquals:{"aws:ResourceAccount":e}}},{Sid:"FjallDevBoundarySlotLogs",Effect:"Allow",Action:["logs:CreateLogStream","logs:PutLogEvents"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevBoundarySyncQueue",Effect:"Allow",Action:["sqs:ReceiveMessage","sqs:DeleteMessage","sqs:GetQueueUrl"],Resource:`arn:aws:sqs:*:${e}:fjall-dev-sync-${e}-*`}]}dt(W5,"buildDevBoundaryStatements");var K5=Object.defineProperty,tr=(e,t)=>K5(e,"name",{value:t,configurable:!0});function H(e){return JSON.stringify(e)}tr(H,"escapeStringLiteral");function Cl(e){return e.map(H).join(", ")}tr(Cl,"formatStringArray");var q5="import:SharedAlarmTopicArn";function Ka(e=" "){return`
|
|
@@ -615,7 +615,7 @@ ${a}`)}throw n}}$g(uo,"convertToResourcePlan");var ore=Object.defineProperty,Sc=
|
|
|
615
615
|
`;return i.push(`Custom code from line ${t.originalLine} could not be positioned. Added at end of file.`),e+`
|
|
616
616
|
`+n+t.sourceText}Or(Rz,"insertOrOrphanBlock");function Lg(e,t,r){if(!t||t.length===0)return{content:e,success:!0};try{let i=ra(e),n=Kt(i),a=[],o=Pz(t),s=e;for(let u of o){let d=$z(i,n,u,r,a);s=Rz(s,u,d,a)}return{content:s,success:!0,warnings:a.length>0?a:void 0}}catch(i){return En(i,e)}}Or(Lg,"injectCustomCodeBlocks");function Oz(e,t,r,i){if(!t.afterManagedResource)return null;let n=t.afterManagedResource,a=(n.name&&r?.get(n.name))??n.name,o=e.find(u=>u.type===n.type&&u.resourceName===a);if(o)return o.endPos;let s=e.filter(u=>u.type===n.type&&u.isManaged);return s.length===1?s[0].endPos:(i&&i.push(`Resource ${na(t.afterManagedResource.type,t.afterManagedResource.name)} not found. Custom code may be orphaned.`),null)}Or(Oz,"findAfterResourcePosition");function $z(e,t,r,i,n){switch(r.position){case"before-imports":return 0;case"after-imports":return rI(t,"import")?.endPos??0;case"after-app-init":return jg(t,"app-init")?.endPos??null;case"after-tags":return jg(t,"tags")?.endPos??null;case"after-resource":return Oz(t,r,i,n);case"end-of-file":return e.getEnd();default:return null}}Or($z,"findCustomCodeInsertPosition");function jz(e,t,r){let i=Fg(e,t),n=r.sourceText;return n=Mg(i,n)+n,n.endsWith(`
|
|
617
617
|
`)||(n+=`
|
|
618
|
-
`),n}Or(jz,"formatCustomCodeForInsertion");function Mz(e){try{let t=function(n){n.kind===lo.SyntaxKind.Unknown&&i.push("Unknown node found in AST - possible parse error"),lo.forEachChild(n,t)};Or(t,"visit");let r=ra(e),i=[];return t(r),i.length>0?{valid:!1,errors:i}:{valid:!0}}catch(t){return{valid:!1,errors:[ze(t)]}}}Or(Mz,"validateModifiedFile");import*as We from"typescript";var Ad=c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),ure=c.object({name:c.string(),type:Ad,ttl:c.number().optional(),value:c.string(),priority:c.number().optional(),weight:c.number().optional(),port:c.number().optional()}).strict(),lre=c.object({subdomain:c.string(),targetAccount:c.string(),auto:c.boolean()}).strict(),dre=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string())}).strict(),u0e=c.object({origin:c.string(),ttl:c.number(),records:c.array(ure),delegations:c.array(lre),certificates:c.array(dre)}).strict(),xn=Object.freeze({ORIGIN:"$ORIGIN",TTL:"$TTL",FJALL_DELEGATE:"$FJALL-DELEGATE",FJALL_CERT:"$FJALL-CERT"}),Fz="ALIAS ";var Lz=c.discriminatedUnion("kind",[c.object({kind:c.literal("ecs"),appName:c.string(),computeName:c.string().min(1).optional()}).strict(),c.object({kind:c.literal("cdn"),appName:c.string(),cdnName:c.string().min(1).optional()}).strict(),c.object({kind:c.literal("bucket"),appName:c.string(),bucketName:c.string()}).strict(),c.object({kind:c.literal("custom"),dnsName:c.string(),hostedZoneId:c.string()}).strict()]),Uz=Lz.options.map(e=>e.shape.kind.value),oI=c.enum(["A","AAAA"]),sI=c.enum(["route53","external-delegated","external-records"]),zz=c.enum(["zone","full"]),Ug=c.string().regex(/^[A-Za-z][A-Za-z0-9]*$/),pre=c.object({kind:c.literal("standard"),type:c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:c.string(),value:c.union([c.string(),c.array(c.string())]),ttl:c.number().int().positive().optional(),id:Ug.optional()}).strict(),mre=c.object({kind:c.literal("alias"),type:oI,name:c.string(),target:Lz,id:Ug.optional()}).strict(),fre=c.discriminatedUnion("kind",[pre,mre]),hre=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string()).optional(),transparencyLogging:c.boolean().optional(),cloudFront:c.boolean().optional()}).strict(),gre=c.object({subdomain:c.string(),toAccount:c.string(),auto:c.boolean().optional()}).strict(),cI=c.enum(["indexed","stable"]),p0e=c.object({zoneName:c.string(),registrar:sI,recordIds:cI.optional(),hostedZoneId:c.string().optional(),delegatedSubdomain:c.string().optional(),adoptedNameServers:c.array(c.string().min(1)).min(1).optional(),records:c.array(fre),certificates:c.array(hre),delegations:c.array(gre)}).strict().refine(e=>e.registrar!=="external-delegated"||e.delegatedSubdomain!==void 0,{message:"external-delegated requires delegatedSubdomain"}).refine(e=>e.registrar!=="external-records"||e.delegations.length===0,{message:"external-records forbids delegations"}).refine(e=>e.registrar==="external-delegated"||e.adoptedNameServers===void 0,{message:"adoptedNameServers requires registrar external-delegated"}).refine(e=>e.registrar!=="external-delegated"||e.hostedZoneId===void 0==(e.adoptedNameServers===void 0),{message:"external-delegated adoption requires hostedZoneId and adoptedNameServers together (both-or-neither)"});var yre=Object.defineProperty,Xe=(e,t)=>yre(e,"name",{value:t,configurable:!0}),Vz=sI.options,Bz=zz.options,Gz=cI.options,vre=Ad.options,bre=oI.options;function lI(e){let t=[],r=Xe(n=>{if(We.isNewExpression(n)&&Wz(n.expression)){let a=Kz(n);a!==void 0&&t.push(a)}We.forEachChild(n,r)},"visit");if(r(e),t.length===0)return V(void 0);if(t.length>1)return $(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${t.length}`));let i=t[0];return i?V(i):V(void 0)}Xe(lI,"findDomainConstructCall");function Wz(e){return We.isIdentifier(e)&&e.text==="Domain"}Xe(Wz,"isDomainIdentifier");function Kz(e){let t=e.arguments;if(!t||t.length<3)return;let r=t[0],i=t[1],n=t[2];if(!r||!i||!n||!We.isObjectLiteralExpression(n))return;let a=qz(e);if(a===void 0)return;let o=Zz(e),s=We.isStringLiteral(i)?i.text:void 0;return{callExpression:e,containingStatement:a,propsObjectLiteral:n,domainVarId:o,scopeArgumentText:r.getText(),constructIdLiteral:s}}Xe(Kz,"buildMatch");function qz(e){let t=e;for(;t!==void 0;){if(We.isExpressionStatement(t)||We.isVariableStatement(t))return t;t=t.parent}}Xe(qz,"findContainingTopLevelStatement");function Zz(e){let t=e.parent;for(;t!==void 0;){if(We.isVariableDeclaration(t)&&We.isIdentifier(t.name)&&t.initializer===e)return t.name.text;t=t.parent}}Xe(Zz,"extractDomainVarId");function Hz(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${Vz.join(", ")}, got ${JSON.stringify(e.value)}`;case"missing_field":return`'${e.field}' property is required`;case"invalid_literal":return`'${e.field}' ${e.reason}`;case"removed_field":return`'${e.field}' was removed from the Domain API \u2014 ${e.cure}`}}Xe(Hz,"errorMessage");var Sre="declare the delegated child as its own Domain with registrar: 'external-delegated' and set 'parentDelegationRoleArn' (the CLI injects it via ManagedDomainBinding.delegationRoleArn); the child UPSERTs its NS records into the parent zone";function dI(e){let t=ye(e),r=ce(t.registrar,Vz);if(r===void 0){let u=t.registrar;if(u===void 0)return $({kind:"registrar_required"});let d=typeof u=="string"?u:Bg(u);return $({kind:"registrar_unsupported",value:d})}let i=N(t.zoneName);if(i===void 0)return $({kind:"missing_field",field:"zoneName"});let n=ce(t.recordIds,Gz);if(t.recordIds!==void 0&&n===void 0)return $({kind:"invalid_literal",field:"recordIds",reason:`must be one of ${Gz.map(u=>`'${u}'`).join(", ")}`});let a=Yz(t.records);if(!a.success)return a;let o=nB(t.certificates);if(!o.success)return o;if(t.delegations!==void 0)return $({kind:"removed_field",field:"delegations",cure:Sre});let s={zoneName:i,recordIds:n,description:N(t.description),costAllocationEnvironment:N(t.costAllocationEnvironment),tags:iB(t.tags),records:a.data,certificates:o.data};switch(r){case"route53":return V({...s,registrar:r,hostedZoneId:N(t.hostedZoneId)});case"external-delegated":{let u=N(t.delegatedSubdomain);if(u===void 0)return $({kind:"missing_field",field:"delegatedSubdomain"});let d=N(t.hostedZoneId);if(t.hostedZoneId!==void 0&&d===void 0)return $({kind:"invalid_literal",field:"hostedZoneId",reason:"must be a literal string zone id on external-delegated \u2014 dynamic expressions cannot be round-tripped"});let p=Je(t.adoptedNameServers);if(t.adoptedNameServers!==void 0&&p===void 0)return $({kind:"invalid_literal",field:"adoptedNameServers",reason:"must be an array of literal NS hostname strings \u2014 the parent NS UPSERT writes them verbatim"});if(d===void 0!=(p===void 0))return $({kind:"invalid_literal",field:d===void 0?"hostedZoneId":"adoptedNameServers",reason:"adopting an existing child zone requires hostedZoneId and adoptedNameServers together (both-or-neither) \u2014 an imported zone exposes no name-server attribute at synth"});let h=N(t.parentDelegationRoleArn);if(t.parentDelegationRoleArn!==void 0&&h===void 0)return $({kind:"invalid_literal",field:"parentDelegationRoleArn",reason:"must be a literal string ARN (VD2-a) \u2014 the CLI injects it via ManagedDomainBinding.delegationRoleArn; dynamic expressions such as Fn.importValue are not supported"});let g=ce(t.phase,Bz);return t.phase!==void 0&&g===void 0?$({kind:"invalid_literal",field:"phase",reason:`must be one of ${Bz.map(l=>`'${l}'`).join(", ")}`}):V({...s,registrar:r,delegatedSubdomain:u,hostedZoneId:d,adoptedNameServers:p,parentDelegationRoleArn:h,phase:g})}case"external-records":return V({...s,registrar:r})}}Xe(dI,"parseDomainProps");function Jz(e){return Hz(e)}Xe(Jz,"parseDomainErrorMessage");function Xz(e,t,r){let i=We.createSourceFile(t,e,We.ScriptTarget.Latest,!0,We.ScriptKind.TS),n=lI(i);if(!n.success)return $(new Error(n.error.message));if(n.data===void 0)return $(new Error(`Domain '${r}': no 'new Domain(...)' call found in ${t} \u2014 the file is not a Fjall domain component.`));let a=dI(n.data.propsObjectLiteral);return a.success?V(a.data):$(new Error(`Domain '${r}': infrastructure.ts could not be parsed (${a.error.kind}).`))}Xe(Xz,"parseDomainInfrastructureSource");function Yz(e){if(e===void 0)return V([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"records",reason:"must be an array"});let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(!Z(i))return $({kind:"invalid_literal",field:`records[${r}]`,reason:"must be an object literal"});let n=Qz(i,r);if(!n.success)return n;t.push(n.data)}return V(t)}Xe(Yz,"parseRecordsArray");function Qz(e,t){let r=N(e.type),i=N(e.name);if(r===void 0)return $({kind:"missing_field",field:`records[${t}].type`});if(i===void 0)return $({kind:"missing_field",field:`records[${t}].name`});let n=N(e.id);if(e.id!==void 0&&(n===void 0||!Ug.safeParse(n).success))return $({kind:"invalid_literal",field:`records[${t}].id`,reason:"must be a literal alphanumeric string starting with a letter \u2014 it becomes a CloudFormation logical-ID segment"});if(e.target!==void 0){if(!bre.some(d=>d===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`alias records must have type 'A' or 'AAAA', got '${r}'`});let u=tB(e.target);return V({kind:"alias",type:r,name:i,target:u,...n!==void 0?{id:n}:{}})}if(!vre.some(u=>u===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`unsupported record type '${r}'`});let a=eB(e.value);if(a===void 0)return $({kind:"invalid_literal",field:`records[${t}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(e.value)})`});let o=q(e.ttl),s={kind:"standard",type:r,name:i,value:a,...o!==void 0?{ttl:o}:{},...n!==void 0?{id:n}:{}};return V(s)}Xe(Qz,"parseRecord");function eB(e){if(e===void 0)return;if(typeof e=="string")return e;let t=Je(e);if(t!==void 0)return t}Xe(eB,"parseRecordValue");function tB(e){if(Jr(e))return rB(e);if(Z(e)){let t=ce(e.kind,Uz);if(t==="ecs"||t==="cdn"){let r=N(e.appName);if(r!==void 0)return{kind:t,appName:r}}if(t==="bucket"){let r=N(e.appName),i=N(e.bucketName);if(r!==void 0&&i!==void 0)return{kind:t,appName:r,bucketName:i}}if(t==="custom"){let r=N(e.dnsName),i=N(e.hostedZoneId);if(r!==void 0&&i!==void 0)return{kind:t,dnsName:r,hostedZoneId:i}}}return{kind:"unresolved",sourceText:Bg(e)}}Xe(tB,"parseTarget");function rB(e){let t=e.__call.trim(),r=t.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!r)return{kind:"unresolved",sourceText:t};let i=r[1],n=r[2]??"",a=zg(n);switch(i){case"fjallApp":{let o=An(a,0);if(o===void 0)return{kind:"dynamic",sourceText:t};if(a.length<2)return{kind:"ecs",appName:o};let s=An(a,1);return s===void 0?{kind:"dynamic",sourceText:t}:{kind:"ecs",appName:o,computeName:s}}case"fjallCdn":{let o=An(a,0);if(o===void 0)return{kind:"dynamic",sourceText:t};if(a.length<2)return{kind:"cdn",appName:o};let s=An(a,1);return s===void 0?{kind:"dynamic",sourceText:t}:{kind:"cdn",appName:o,cdnName:s}}case"fjallBucket":{if(a.length<2)return{kind:"unresolved",sourceText:t};let o=An(a,0),s=An(a,1);return o===void 0||s===void 0?{kind:"dynamic",sourceText:t}:{kind:"bucket",appName:o,bucketName:s}}case"aliasTo":{if(a.length>=2){let o=An(a,0),s=An(a,1);return o!==void 0&&s!==void 0?{kind:"custom",dnsName:o,hostedZoneId:s}:{kind:"dynamic",sourceText:t}}if(a.length===1){let o=a[0]?.trim()??"",s=uI(o,"dnsName"),u=uI(o,"hostedZoneId");return s!==void 0&&u!==void 0?{kind:"custom",dnsName:s,hostedZoneId:u}:{kind:"dynamic",sourceText:t}}return{kind:"unresolved",sourceText:t}}default:return{kind:"unresolved",sourceText:t}}}Xe(rB,"resolveCallRefTarget");function zg(e){let t=[],r=0,i=null,n="";for(let o=0;o<e.length;o++){let s=e[o];if(i!==null){if(n+=s,s==="\\"&&o+1<e.length){let u=e[o+1];u!==void 0&&(n+=u,o+=1);continue}s===i&&(i=null);continue}if(s==='"'||s==="'"||s==="`"){i=s,n+=s;continue}if(s==="("||s==="{"||s==="["){r+=1,n+=s;continue}if(s===")"||s==="}"||s==="]"){r-=1,n+=s;continue}if(s===","&&r===0){t.push(n.trim()),n="";continue}n+=s}let a=n.trim();return a.length>0&&t.push(a),t}Xe(zg,"splitTopLevelArgs");function An(e,t){let r=e[t];if(r===void 0)return;let i=r.trim();if(i.length<2)return;let n=i[0],a=i[i.length-1];if(n===a&&!(n!=='"'&&n!=="'"&&n!=="`"))return i.slice(1,-1)}Xe(An,"extractStringLiteralArg");function uI(e,t){let r=e.trim().replace(/^\{|\}$/g,""),i=zg(r);for(let n of i){let a=n.indexOf(":");if(a<0||n.slice(0,a).trim().replace(/["'`]/g,"")!==t)continue;let o=n.slice(a+1).trim();return An([o],0)}}Xe(uI,"extractObjectFieldString");function nB(e){if(e===void 0)return V([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"certificates",reason:"must be an array"});let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(typeof i=="string"){t.push({domainName:i});continue}if(!Z(i))return $({kind:"invalid_literal",field:`certificates[${r}]`,reason:"must be a string or object literal"});let n=N(i.domainName);if(n===void 0)return $({kind:"missing_field",field:`certificates[${r}].domainName`});let a=Je(i.subjectAlternativeNames),o=ne(i.transparencyLogging),s=ne(i.cloudFront);if(i.cloudFront!==void 0&&s===void 0)return $({kind:"invalid_literal",field:`certificates[${r}].cloudFront`,reason:"must be a boolean literal \u2014 the CloudFront designation drives the zone-level us-east-1 export contract and cannot be round-tripped from a dynamic expression"});t.push({domainName:n,...a!==void 0?{subjectAlternativeNames:a}:{},...o!==void 0?{transparencyLogging:o}:{},...s!==void 0?{cloudFront:s}:{}})}return V(t)}Xe(nB,"parseCertificatesArray");function iB(e){if(e===void 0||!Z(e))return;let t={};for(let[r,i]of Object.entries(e)){let n=N(i);n!==void 0&&(t[r]=n)}return Object.keys(t).length===0?void 0:t}Xe(iB,"parseStringRecord");function Bg(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return`[${e.map(t=>Bg(t)).join(", ")}]`;if(typeof e=="object"){if("__call"in e)return String(e.__call);if("__identifier"in e)return String(e.__identifier);if("__expression"in e)return String(e.__expression);if("__unknown"in e)return String(e.__unknown)}return String(e)}Xe(Bg,"stringifyParsedValue");var vy=Po(_r(),1);var Ere=Object.defineProperty,po=(e,t)=>Ere(e,"name",{value:t,configurable:!0}),qt=Symbol("non-literal");function xre(e,t){let r={};for(let i of e.properties){if(i.type!=="Property"&&i.type!=="ObjectProperty"||i.shorthand===!0||i.computed===!0)continue;let n=di(i.key);if(n===void 0||i.value===void 0)continue;let a=Gg(i.value);a!==qt&&(r[n]=a)}return{...r,...t}}po(xre,"buildMergedLiteral");function Are(e){let t=[];for(let r of e.properties){if(r.type!=="Property"&&r.type!=="ObjectProperty"||r.shorthand===!0||r.computed===!0)continue;let i=di(r.key);i!==void 0&&t.push(i)}return t}po(Are,"collectPropertyKeys");function Gg(e){let t=e.value;switch(e.type){case"StringLiteral":return typeof t=="string"?t:qt;case"NumericLiteral":return typeof t=="number"?t:qt;case"BooleanLiteral":return typeof t=="boolean"?t:qt;case"NullLiteral":return null;case"ArrayExpression":return aB(e);case"ObjectExpression":return oB(e);default:return qt}}po(Gg,"astToLiteral");function aB(e){let t=e.elements;if(!Array.isArray(t))return qt;let r=[];for(let i of t){if(!Se(i))return qt;let n=Gg(i);if(n===qt)return qt;r.push(n)}return r}po(aB,"arrayToLiteral");function oB(e){let t=e.properties;if(!Array.isArray(t))return qt;let r={};for(let i of t){if(!Se(i)||i.type!=="Property"&&i.type!=="ObjectProperty")return qt;let n=di(i.key),a=i.value;if(n===void 0||a===void 0)return qt;let o=Gg(a);if(o===qt)return qt;r[n]=o}return r}po(oB,"objectToLiteral");function di(e){if(e===void 0)return;let t=e;if(e.type==="Identifier"&&typeof t.name=="string")return t.name;if(e.type==="StringLiteral"&&typeof t.value=="string")return t.value}po(di,"readKeyName");function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}po(Se,"isNodeShape");var v2=Po(y2(),1),rie=Object.defineProperty,Eo=(e,t)=>rie(e,"name",{value:t,configurable:!0}),b2="\uFEFF",my=65279;function nie(e,t){let r=Bd(t),i=E2(e),n=v2.print(e,{quote:i,lineTerminator:r,trailingComma:!0}).code,a=S2(n,t),o=t.charCodeAt(0)===my,s=a.charCodeAt(0)===my;return o&&!s?`${b2}${a}`:a}Eo(nie,"printFile");var iie=/^(#![^\n\r]*)((?:\r?\n)*)/;function S2(e,t){let r=t.charCodeAt(0)===my?t.slice(1):t,i=iie.exec(r);if(i===null)return e;let n=i[1],a=i[2]??"";if(n===void 0)return e;let o=Eo(p=>p!==""&&a===""?Bd(t):a,"separatorOrFloor"),s=e.charCodeAt(0)===my,u=s?b2:"",d=s?e.slice(1):e;if(d.startsWith(n)){let p=d.slice(n.length).replace(/^(?:\r?\n)*/,"");return`${u}${n}${o(p)}${p}`}return d.startsWith("#!")?e:`${u}${n}${o(d)}${d}`}Eo(S2,"restoreShebangPrefix");function Bd(e){return e.includes(`\r
|
|
618
|
+
`),n}Or(jz,"formatCustomCodeForInsertion");function Mz(e){try{let t=function(n){n.kind===lo.SyntaxKind.Unknown&&i.push("Unknown node found in AST - possible parse error"),lo.forEachChild(n,t)};Or(t,"visit");let r=ra(e),i=[];return t(r),i.length>0?{valid:!1,errors:i}:{valid:!0}}catch(t){return{valid:!1,errors:[ze(t)]}}}Or(Mz,"validateModifiedFile");import*as We from"typescript";var Ad=c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),ure=c.object({name:c.string(),type:Ad,ttl:c.number().optional(),value:c.string(),priority:c.number().optional(),weight:c.number().optional(),port:c.number().optional()}).strict(),lre=c.object({subdomain:c.string(),targetAccount:c.string(),auto:c.boolean()}).strict(),dre=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string())}).strict(),d0e=c.object({origin:c.string(),ttl:c.number(),records:c.array(ure),delegations:c.array(lre),certificates:c.array(dre)}).strict(),xn=Object.freeze({ORIGIN:"$ORIGIN",TTL:"$TTL",FJALL_DELEGATE:"$FJALL-DELEGATE",FJALL_CERT:"$FJALL-CERT"}),Fz="ALIAS ";var Lz=c.discriminatedUnion("kind",[c.object({kind:c.literal("ecs"),appName:c.string(),computeName:c.string().min(1).optional()}).strict(),c.object({kind:c.literal("cdn"),appName:c.string(),cdnName:c.string().min(1).optional()}).strict(),c.object({kind:c.literal("bucket"),appName:c.string(),bucketName:c.string()}).strict(),c.object({kind:c.literal("custom"),dnsName:c.string(),hostedZoneId:c.string()}).strict()]),Uz=Lz.options.map(e=>e.shape.kind.value),oI=c.enum(["A","AAAA"]),sI=c.enum(["route53","external-delegated","external-records"]),zz=c.enum(["zone","full"]),Ug=c.string().regex(/^[A-Za-z][A-Za-z0-9]*$/),pre=c.object({kind:c.literal("standard"),type:c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:c.string(),value:c.union([c.string(),c.array(c.string())]),ttl:c.number().int().positive().optional(),id:Ug.optional()}).strict(),mre=c.object({kind:c.literal("alias"),type:oI,name:c.string(),target:Lz,id:Ug.optional()}).strict(),fre=c.discriminatedUnion("kind",[pre,mre]),hre=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string()).optional(),transparencyLogging:c.boolean().optional(),cloudFront:c.boolean().optional()}).strict(),gre=c.object({subdomain:c.string(),toAccount:c.string(),auto:c.boolean().optional()}).strict(),cI=c.enum(["indexed","stable"]),f0e=c.object({zoneName:c.string(),registrar:sI,recordIds:cI.optional(),hostedZoneId:c.string().optional(),delegatedSubdomain:c.string().optional(),adoptedNameServers:c.array(c.string().min(1)).min(1).optional(),records:c.array(fre),certificates:c.array(hre),delegations:c.array(gre)}).strict().refine(e=>e.registrar!=="external-delegated"||e.delegatedSubdomain!==void 0,{message:"external-delegated requires delegatedSubdomain"}).refine(e=>e.registrar!=="external-records"||e.delegations.length===0,{message:"external-records forbids delegations"}).refine(e=>e.registrar==="external-delegated"||e.adoptedNameServers===void 0,{message:"adoptedNameServers requires registrar external-delegated"}).refine(e=>e.registrar!=="external-delegated"||e.hostedZoneId===void 0==(e.adoptedNameServers===void 0),{message:"external-delegated adoption requires hostedZoneId and adoptedNameServers together (both-or-neither)"});var yre=Object.defineProperty,Xe=(e,t)=>yre(e,"name",{value:t,configurable:!0}),Vz=sI.options,Bz=zz.options,Gz=cI.options,vre=Ad.options,bre=oI.options;function lI(e){let t=[],r=Xe(n=>{if(We.isNewExpression(n)&&Wz(n.expression)){let a=Kz(n);a!==void 0&&t.push(a)}We.forEachChild(n,r)},"visit");if(r(e),t.length===0)return V(void 0);if(t.length>1)return $(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${t.length}`));let i=t[0];return i?V(i):V(void 0)}Xe(lI,"findDomainConstructCall");function Wz(e){return We.isIdentifier(e)&&e.text==="Domain"}Xe(Wz,"isDomainIdentifier");function Kz(e){let t=e.arguments;if(!t||t.length<3)return;let r=t[0],i=t[1],n=t[2];if(!r||!i||!n||!We.isObjectLiteralExpression(n))return;let a=qz(e);if(a===void 0)return;let o=Zz(e),s=We.isStringLiteral(i)?i.text:void 0;return{callExpression:e,containingStatement:a,propsObjectLiteral:n,domainVarId:o,scopeArgumentText:r.getText(),constructIdLiteral:s}}Xe(Kz,"buildMatch");function qz(e){let t=e;for(;t!==void 0;){if(We.isExpressionStatement(t)||We.isVariableStatement(t))return t;t=t.parent}}Xe(qz,"findContainingTopLevelStatement");function Zz(e){let t=e.parent;for(;t!==void 0;){if(We.isVariableDeclaration(t)&&We.isIdentifier(t.name)&&t.initializer===e)return t.name.text;t=t.parent}}Xe(Zz,"extractDomainVarId");function Hz(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${Vz.join(", ")}, got ${JSON.stringify(e.value)}`;case"missing_field":return`'${e.field}' property is required`;case"invalid_literal":return`'${e.field}' ${e.reason}`;case"removed_field":return`'${e.field}' was removed from the Domain API \u2014 ${e.cure}`}}Xe(Hz,"errorMessage");var Sre="declare the delegated child as its own Domain with registrar: 'external-delegated' and set 'parentDelegationRoleArn' (the CLI injects it via ManagedDomainBinding.delegationRoleArn); the child UPSERTs its NS records into the parent zone";function dI(e){let t=ye(e),r=ce(t.registrar,Vz);if(r===void 0){let u=t.registrar;if(u===void 0)return $({kind:"registrar_required"});let d=typeof u=="string"?u:Bg(u);return $({kind:"registrar_unsupported",value:d})}let i=N(t.zoneName);if(i===void 0)return $({kind:"missing_field",field:"zoneName"});let n=ce(t.recordIds,Gz);if(t.recordIds!==void 0&&n===void 0)return $({kind:"invalid_literal",field:"recordIds",reason:`must be one of ${Gz.map(u=>`'${u}'`).join(", ")}`});let a=Yz(t.records);if(!a.success)return a;let o=nB(t.certificates);if(!o.success)return o;if(t.delegations!==void 0)return $({kind:"removed_field",field:"delegations",cure:Sre});let s={zoneName:i,recordIds:n,description:N(t.description),costAllocationEnvironment:N(t.costAllocationEnvironment),tags:iB(t.tags),records:a.data,certificates:o.data};switch(r){case"route53":return V({...s,registrar:r,hostedZoneId:N(t.hostedZoneId)});case"external-delegated":{let u=N(t.delegatedSubdomain);if(u===void 0)return $({kind:"missing_field",field:"delegatedSubdomain"});let d=N(t.hostedZoneId);if(t.hostedZoneId!==void 0&&d===void 0)return $({kind:"invalid_literal",field:"hostedZoneId",reason:"must be a literal string zone id on external-delegated \u2014 dynamic expressions cannot be round-tripped"});let p=Je(t.adoptedNameServers);if(t.adoptedNameServers!==void 0&&p===void 0)return $({kind:"invalid_literal",field:"adoptedNameServers",reason:"must be an array of literal NS hostname strings \u2014 the parent NS UPSERT writes them verbatim"});if(d===void 0!=(p===void 0))return $({kind:"invalid_literal",field:d===void 0?"hostedZoneId":"adoptedNameServers",reason:"adopting an existing child zone requires hostedZoneId and adoptedNameServers together (both-or-neither) \u2014 an imported zone exposes no name-server attribute at synth"});let h=N(t.parentDelegationRoleArn);if(t.parentDelegationRoleArn!==void 0&&h===void 0)return $({kind:"invalid_literal",field:"parentDelegationRoleArn",reason:"must be a literal string ARN (VD2-a) \u2014 the CLI injects it via ManagedDomainBinding.delegationRoleArn; dynamic expressions such as Fn.importValue are not supported"});let g=ce(t.phase,Bz);return t.phase!==void 0&&g===void 0?$({kind:"invalid_literal",field:"phase",reason:`must be one of ${Bz.map(l=>`'${l}'`).join(", ")}`}):V({...s,registrar:r,delegatedSubdomain:u,hostedZoneId:d,adoptedNameServers:p,parentDelegationRoleArn:h,phase:g})}case"external-records":return V({...s,registrar:r})}}Xe(dI,"parseDomainProps");function Jz(e){return Hz(e)}Xe(Jz,"parseDomainErrorMessage");function Xz(e,t,r){let i=We.createSourceFile(t,e,We.ScriptTarget.Latest,!0,We.ScriptKind.TS),n=lI(i);if(!n.success)return $(new Error(n.error.message));if(n.data===void 0)return $(new Error(`Domain '${r}': no 'new Domain(...)' call found in ${t} \u2014 the file is not a Fjall domain component.`));let a=dI(n.data.propsObjectLiteral);return a.success?V(a.data):$(new Error(`Domain '${r}': infrastructure.ts could not be parsed (${a.error.kind}).`))}Xe(Xz,"parseDomainInfrastructureSource");function Yz(e){if(e===void 0)return V([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"records",reason:"must be an array"});let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(!Z(i))return $({kind:"invalid_literal",field:`records[${r}]`,reason:"must be an object literal"});let n=Qz(i,r);if(!n.success)return n;t.push(n.data)}return V(t)}Xe(Yz,"parseRecordsArray");function Qz(e,t){let r=N(e.type),i=N(e.name);if(r===void 0)return $({kind:"missing_field",field:`records[${t}].type`});if(i===void 0)return $({kind:"missing_field",field:`records[${t}].name`});let n=N(e.id);if(e.id!==void 0&&(n===void 0||!Ug.safeParse(n).success))return $({kind:"invalid_literal",field:`records[${t}].id`,reason:"must be a literal alphanumeric string starting with a letter \u2014 it becomes a CloudFormation logical-ID segment"});if(e.target!==void 0){if(!bre.some(d=>d===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`alias records must have type 'A' or 'AAAA', got '${r}'`});let u=tB(e.target);return V({kind:"alias",type:r,name:i,target:u,...n!==void 0?{id:n}:{}})}if(!vre.some(u=>u===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`unsupported record type '${r}'`});let a=eB(e.value);if(a===void 0)return $({kind:"invalid_literal",field:`records[${t}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(e.value)})`});let o=q(e.ttl),s={kind:"standard",type:r,name:i,value:a,...o!==void 0?{ttl:o}:{},...n!==void 0?{id:n}:{}};return V(s)}Xe(Qz,"parseRecord");function eB(e){if(e===void 0)return;if(typeof e=="string")return e;let t=Je(e);if(t!==void 0)return t}Xe(eB,"parseRecordValue");function tB(e){if(Jr(e))return rB(e);if(Z(e)){let t=ce(e.kind,Uz);if(t==="ecs"||t==="cdn"){let r=N(e.appName);if(r!==void 0)return{kind:t,appName:r}}if(t==="bucket"){let r=N(e.appName),i=N(e.bucketName);if(r!==void 0&&i!==void 0)return{kind:t,appName:r,bucketName:i}}if(t==="custom"){let r=N(e.dnsName),i=N(e.hostedZoneId);if(r!==void 0&&i!==void 0)return{kind:t,dnsName:r,hostedZoneId:i}}}return{kind:"unresolved",sourceText:Bg(e)}}Xe(tB,"parseTarget");function rB(e){let t=e.__call.trim(),r=t.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!r)return{kind:"unresolved",sourceText:t};let i=r[1],n=r[2]??"",a=zg(n);switch(i){case"fjallApp":{let o=An(a,0);if(o===void 0)return{kind:"dynamic",sourceText:t};if(a.length<2)return{kind:"ecs",appName:o};let s=An(a,1);return s===void 0?{kind:"dynamic",sourceText:t}:{kind:"ecs",appName:o,computeName:s}}case"fjallCdn":{let o=An(a,0);if(o===void 0)return{kind:"dynamic",sourceText:t};if(a.length<2)return{kind:"cdn",appName:o};let s=An(a,1);return s===void 0?{kind:"dynamic",sourceText:t}:{kind:"cdn",appName:o,cdnName:s}}case"fjallBucket":{if(a.length<2)return{kind:"unresolved",sourceText:t};let o=An(a,0),s=An(a,1);return o===void 0||s===void 0?{kind:"dynamic",sourceText:t}:{kind:"bucket",appName:o,bucketName:s}}case"aliasTo":{if(a.length>=2){let o=An(a,0),s=An(a,1);return o!==void 0&&s!==void 0?{kind:"custom",dnsName:o,hostedZoneId:s}:{kind:"dynamic",sourceText:t}}if(a.length===1){let o=a[0]?.trim()??"",s=uI(o,"dnsName"),u=uI(o,"hostedZoneId");return s!==void 0&&u!==void 0?{kind:"custom",dnsName:s,hostedZoneId:u}:{kind:"dynamic",sourceText:t}}return{kind:"unresolved",sourceText:t}}default:return{kind:"unresolved",sourceText:t}}}Xe(rB,"resolveCallRefTarget");function zg(e){let t=[],r=0,i=null,n="";for(let o=0;o<e.length;o++){let s=e[o];if(i!==null){if(n+=s,s==="\\"&&o+1<e.length){let u=e[o+1];u!==void 0&&(n+=u,o+=1);continue}s===i&&(i=null);continue}if(s==='"'||s==="'"||s==="`"){i=s,n+=s;continue}if(s==="("||s==="{"||s==="["){r+=1,n+=s;continue}if(s===")"||s==="}"||s==="]"){r-=1,n+=s;continue}if(s===","&&r===0){t.push(n.trim()),n="";continue}n+=s}let a=n.trim();return a.length>0&&t.push(a),t}Xe(zg,"splitTopLevelArgs");function An(e,t){let r=e[t];if(r===void 0)return;let i=r.trim();if(i.length<2)return;let n=i[0],a=i[i.length-1];if(n===a&&!(n!=='"'&&n!=="'"&&n!=="`"))return i.slice(1,-1)}Xe(An,"extractStringLiteralArg");function uI(e,t){let r=e.trim().replace(/^\{|\}$/g,""),i=zg(r);for(let n of i){let a=n.indexOf(":");if(a<0||n.slice(0,a).trim().replace(/["'`]/g,"")!==t)continue;let o=n.slice(a+1).trim();return An([o],0)}}Xe(uI,"extractObjectFieldString");function nB(e){if(e===void 0)return V([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"certificates",reason:"must be an array"});let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(typeof i=="string"){t.push({domainName:i});continue}if(!Z(i))return $({kind:"invalid_literal",field:`certificates[${r}]`,reason:"must be a string or object literal"});let n=N(i.domainName);if(n===void 0)return $({kind:"missing_field",field:`certificates[${r}].domainName`});let a=Je(i.subjectAlternativeNames),o=ne(i.transparencyLogging),s=ne(i.cloudFront);if(i.cloudFront!==void 0&&s===void 0)return $({kind:"invalid_literal",field:`certificates[${r}].cloudFront`,reason:"must be a boolean literal \u2014 the CloudFront designation drives the zone-level us-east-1 export contract and cannot be round-tripped from a dynamic expression"});t.push({domainName:n,...a!==void 0?{subjectAlternativeNames:a}:{},...o!==void 0?{transparencyLogging:o}:{},...s!==void 0?{cloudFront:s}:{}})}return V(t)}Xe(nB,"parseCertificatesArray");function iB(e){if(e===void 0||!Z(e))return;let t={};for(let[r,i]of Object.entries(e)){let n=N(i);n!==void 0&&(t[r]=n)}return Object.keys(t).length===0?void 0:t}Xe(iB,"parseStringRecord");function Bg(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return`[${e.map(t=>Bg(t)).join(", ")}]`;if(typeof e=="object"){if("__call"in e)return String(e.__call);if("__identifier"in e)return String(e.__identifier);if("__expression"in e)return String(e.__expression);if("__unknown"in e)return String(e.__unknown)}return String(e)}Xe(Bg,"stringifyParsedValue");var vy=Po(_r(),1);var Ere=Object.defineProperty,po=(e,t)=>Ere(e,"name",{value:t,configurable:!0}),qt=Symbol("non-literal");function xre(e,t){let r={};for(let i of e.properties){if(i.type!=="Property"&&i.type!=="ObjectProperty"||i.shorthand===!0||i.computed===!0)continue;let n=di(i.key);if(n===void 0||i.value===void 0)continue;let a=Gg(i.value);a!==qt&&(r[n]=a)}return{...r,...t}}po(xre,"buildMergedLiteral");function Are(e){let t=[];for(let r of e.properties){if(r.type!=="Property"&&r.type!=="ObjectProperty"||r.shorthand===!0||r.computed===!0)continue;let i=di(r.key);i!==void 0&&t.push(i)}return t}po(Are,"collectPropertyKeys");function Gg(e){let t=e.value;switch(e.type){case"StringLiteral":return typeof t=="string"?t:qt;case"NumericLiteral":return typeof t=="number"?t:qt;case"BooleanLiteral":return typeof t=="boolean"?t:qt;case"NullLiteral":return null;case"ArrayExpression":return aB(e);case"ObjectExpression":return oB(e);default:return qt}}po(Gg,"astToLiteral");function aB(e){let t=e.elements;if(!Array.isArray(t))return qt;let r=[];for(let i of t){if(!Se(i))return qt;let n=Gg(i);if(n===qt)return qt;r.push(n)}return r}po(aB,"arrayToLiteral");function oB(e){let t=e.properties;if(!Array.isArray(t))return qt;let r={};for(let i of t){if(!Se(i)||i.type!=="Property"&&i.type!=="ObjectProperty")return qt;let n=di(i.key),a=i.value;if(n===void 0||a===void 0)return qt;let o=Gg(a);if(o===qt)return qt;r[n]=o}return r}po(oB,"objectToLiteral");function di(e){if(e===void 0)return;let t=e;if(e.type==="Identifier"&&typeof t.name=="string")return t.name;if(e.type==="StringLiteral"&&typeof t.value=="string")return t.value}po(di,"readKeyName");function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}po(Se,"isNodeShape");var v2=Po(y2(),1),rie=Object.defineProperty,Eo=(e,t)=>rie(e,"name",{value:t,configurable:!0}),b2="\uFEFF",my=65279;function nie(e,t){let r=Bd(t),i=E2(e),n=v2.print(e,{quote:i,lineTerminator:r,trailingComma:!0}).code,a=S2(n,t),o=t.charCodeAt(0)===my,s=a.charCodeAt(0)===my;return o&&!s?`${b2}${a}`:a}Eo(nie,"printFile");var iie=/^(#![^\n\r]*)((?:\r?\n)*)/;function S2(e,t){let r=t.charCodeAt(0)===my?t.slice(1):t,i=iie.exec(r);if(i===null)return e;let n=i[1],a=i[2]??"";if(n===void 0)return e;let o=Eo(p=>p!==""&&a===""?Bd(t):a,"separatorOrFloor"),s=e.charCodeAt(0)===my,u=s?b2:"",d=s?e.slice(1):e;if(d.startsWith(n)){let p=d.slice(n.length).replace(/^(?:\r?\n)*/,"");return`${u}${n}${o(p)}${p}`}return d.startsWith("#!")?e:`${u}${n}${o(d)}${d}`}Eo(S2,"restoreShebangPrefix");function Bd(e){return e.includes(`\r
|
|
619
619
|
`)?`\r
|
|
620
620
|
`:`
|
|
621
621
|
`}Eo(Bd,"detectLineTerminator");function E2(e){let t=0,r=0;return x2(e,i=>{if(i.type!=="StringLiteral"&&i.type!=="Literal")return;let n=i.extra;if(!zd(n))return;let a=n.raw;if(typeof a!="string"||a.length===0)return;let o=a.charAt(0);o==="'"?t+=1:o==='"'&&(r+=1)}),t>r?"single":"double"}Eo(E2,"detectQuoteStyle");function x2(e,t){let r=[e];for(;r.length>0;){let i=r.pop();if(!(!zd(i)||typeof i.type!="string")){t(i);for(let n of Object.keys(i)){if(n==="loc"||n==="comments"||n==="tokens")continue;let a=i[n];if(Array.isArray(a))for(let o of a)zd(o)&&typeof o.type=="string"&&r.push(o);else zd(a)&&typeof a.type=="string"&&r.push(a)}}}}Eo(x2,"visit");function zd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Eo(zd,"isRecord");var aie=Object.defineProperty,fy=(e,t)=>aie(e,"name",{value:t,configurable:!0});function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}fy(Ht,"isRecord");function oie(e){if(!Ht(e))return;let t=e.program;if(!Ht(t))return;let r=t.body;if(Array.isArray(r)&&r.every(Ht))return r}fy(oie,"extractProgramBody");function QI(e,t){return e.length===0?0:e.split(t).length}fy(QI,"countLines");function sie(e,t){let r=Bd(e),i=QI(t,r)-QI(e,r);return i>=0?{added:i,removed:0}:{added:0,removed:-i}}fy(sie,"computeLinesDelta");var cie=Object.defineProperty,en=(e,t)=>cie(e,"name",{value:t,configurable:!0});function uie(e){let t=A2(e),r=_2(e),i=en(n=>t.get(n)===1?r.get(n):void 0,"initFor");return{resolveString(n){let a=i(n);return a===void 0?void 0:eD(a)},resolveStringArray(n){let a=i(n);if(a===void 0)return;let o=sa(a);if(o.type!=="ArrayExpression")return;let s=o.elements;if(!Array.isArray(s))return;let u=[];for(let d of s){if(!Se(d))return;let p=eD(d);if(p===void 0)return;u.push(p)}return u},objectKeysOf:en(n=>hy(n,i,new Set),"objectKeysOf")}}en(uie,"buildModuleConstResolver");function eD(e){let t=sa(e);if(t.type==="StringLiteral"){let r=t.value;return typeof r=="string"?r:void 0}if(t.type==="TemplateLiteral"){let r=t.expressions,i=t.quasis;if(!Array.isArray(r)||r.length!==0||!Array.isArray(i)||i.length!==1)return;let[n]=i;return!Ht(n)||!Ht(n.value)?void 0:typeof n.value.cooked=="string"?n.value.cooked:void 0}}en(eD,"readStaticString");var lie=new Set(["TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression","ParenthesizedExpression"]);function sa(e){let t=e;for(;lie.has(t.type);){let r=t.expression;if(!Se(r))return t;t=r}return t}en(sa,"unwrapTsWrappers");function hy(e,t,r){let i=sa(e);if(i.type==="Identifier"){let o=i.name;if(typeof o!="string"||r.has(o))return;r.add(o);let s=t(o);return s===void 0?void 0:hy(s,t,r)}if(i.type!=="ObjectExpression")return;let n=i.properties;if(!Array.isArray(n))return;let a=[];for(let o of n){if(!Se(o))return;if(o.type==="SpreadElement"||o.type==="SpreadProperty"){let d=o.argument;if(!Se(d))return;let p=hy(d,t,r);if(p===void 0)return;a.push(...p);continue}if(o.type!=="Property"&&o.type!=="ObjectProperty"&&o.type!=="ObjectMethod"||o.computed===!0)return;let s=o.key;if(!Se(s))return;let u=di(s);if(u===void 0)return;a.push(u)}return a}en(hy,"objectKeysOfNode");function A2(e){let t=new Map,r=en(a=>{t.set(a,(t.get(a)??0)+1)},"bump"),i=en(a=>{if(Se(a))switch(a.type){case"Identifier":{let o=a.name;typeof o=="string"&&r(o);return}case"ObjectPattern":{let o=a.properties;if(!Array.isArray(o))return;for(let s of o)Se(s)&&(s.type==="RestElement"||s.type==="RestProperty"?i(s.argument):i(s.value));return}case"ArrayPattern":{let o=a.elements;if(!Array.isArray(o))return;for(let s of o)i(s);return}case"AssignmentPattern":i(a.left);return;case"RestElement":i(a.argument);return;case"TSParameterProperty":i(a.parameter);return;default:return}},"bumpPattern"),n=en(a=>{let o=[a];for(;o.length>0;){let s=o.pop();if(Ht(s)){if(typeof s.type=="string"){let u=s;switch(u.type){case"VariableDeclarator":i(u.id);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{i(u.id);let d=u.params;if(Array.isArray(d))for(let p of d)i(p);break}case"ClassDeclaration":case"ClassExpression":i(u.id);break;case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":i(u.local);break;case"CatchClause":i(u.param);break;default:break}}for(let u of Object.keys(s)){if(u==="loc"||u==="comments"||u==="tokens")continue;let d=s[u];if(Array.isArray(d))for(let p of d)Ht(p)&&o.push(p);else Ht(d)&&o.push(d)}}}},"visitForBindings");for(let a of e)n(a);return t}en(A2,"countBindings");function _2(e){let t=new Map;for(let r of e){let i=r.type==="ExportNamedDeclaration"?r.declaration:r;if(!Se(i)||i.type!=="VariableDeclaration"||i.kind!=="const")continue;let n=i.declarations;if(Array.isArray(n))for(let a of n){if(!Se(a)||a.type!=="VariableDeclarator")continue;let o=a.id,s=a.init;if(!Se(o)||o.type!=="Identifier"||!Se(s))continue;let u=o.name;typeof u=="string"&&t.set(u,s)}}return t}en(_2,"collectTopLevelConstInits");var die=Object.defineProperty,gy=(e,t)=>die(e,"name",{value:t,configurable:!0});function pie(e,t){return e.properties.find(r=>(r.type==="Property"||r.type==="ObjectProperty")&&r.shorthand!==!0&&r.computed!==!0&&di(r.key)===t)}gy(pie,"findPropertyByKey");function mie(e,t){return!e.properties.some(r=>r.type==="SpreadElement"||r.type==="SpreadProperty"?!0:r.type!=="Property"&&r.type!=="ObjectProperty"?!1:r.computed===!0?!0:r.shorthand===!0&&di(r.key)===t)}gy(mie,"objectAbsenceIsProvable");function fie(e,t){e.properties[e.properties.length-1]?.extra?.trailingComma===!0&&(t.extra={...t.extra??{},trailingComma:!0}),e.properties.push(t)}gy(fie,"pushPropertyPreservingComma");function yy(e,t){let r=[e];for(;r.length>0;){let i=r.pop();if(Ht(i)){typeof i.type=="string"&&t(i);for(let n of Object.keys(i)){if(n==="loc"||n==="comments"||n==="tokens")continue;let a=i[n];if(Array.isArray(a))for(let o of a)Ht(o)&&r.push(o);else Ht(a)&&r.push(a)}}}}gy(yy,"visit");var hie=Object.defineProperty,xo=(e,t)=>hie(e,"name",{value:t,configurable:!0});function rD(e,t,r){let i=[];for(let p=0;p<e.length;p++){let h=e[p];if(h===void 0)continue;let g=!1;yy(h,l=>{l.type==="CallExpression"&&by(l,t.factory,r)&&(g=!0)}),g&&i.push({statementIndex:p})}if(i.length===0)return $({kind:"statement-not-found"});if(i.length>1)return $({kind:"ambiguous",count:i.length});let n=i[0];if(n===void 0)return $({kind:"statement-not-found"});let a=e[n.statementIndex];if(a===void 0)return $({kind:"statement-not-found"});let o=a.type==="ExportNamedDeclaration"||a.type==="ExportDefaultDeclaration",s=nD(a);if(s===void 0)return $({kind:"unbindable-statement",statementType:a.type});if(s.type==="VariableDeclaration"){let p=s.declarations;if(!Array.isArray(p)||p.length!==1)return $({kind:"multiple-declarators"});let h=p[0].id;if(!Se(h)||h.type!=="Identifier")return $({kind:"pattern-binding"});let g=h.name;if(typeof g!="string")return $({kind:"unreadable-name"});let l=p[0].init;return!Se(l)||!tD(l,t,r)?$({kind:"init-not-app-method-wrap"}):V({variableName:g,resourceName:r,statementIndex:n.statementIndex})}if(o)return $({kind:"unbindable-statement",statementType:a.type});if(s.type!=="ExpressionStatement")return $({kind:"unbindable-statement",statementType:s.type});let u=s.expression;if(!Se(u)||u.type!=="CallExpression")return $({kind:"not-app-method-call"});if(by(u,t.factory,r))return $({kind:"bare-factory-call"});if(!tD(u,t,r))return $({kind:"foreign-wrapper"});let d=xr(r);return Wi.has(d)?$({kind:"reserved-word",variableName:d}):C2(e,d)?$({kind:"name-conflict",variableName:d}):V({variableName:d,resourceName:r,statementIndex:n.statementIndex,wrap:{statementIndex:n.statementIndex,expression:u}})}xo(rD,"planBinding");function gie(e,t){if(t.wrap===void 0)return;let{statementIndex:r,expression:i}=t.wrap,n=e[r],a=vy.builders.variableDeclaration("const",[vy.builders.variableDeclarator(vy.builders.identifier(t.variableName),i)]),o=n?.comments;o!==void 0&&(a.comments=o),e[r]=a}xo(gie,"applyBinding");function by(e,t,r){let i=e.callee;if(!Se(i)||i.type!=="MemberExpression"||i.computed===!0)return!1;let n=i.object,a=i.property;if(!Se(n)||n.type!=="Identifier"||n.name!==t||!Se(a)||a.type!=="Identifier"||a.name!=="build")return!1;let o=e.arguments;if(!Array.isArray(o))return!1;let s=o[0];return!Se(s)||s.type!=="StringLiteral"&&s.type!=="Literal"?!1:s.value===r}xo(by,"isFactoryBuildOf");function nD(e){if(e.type!=="ExportNamedDeclaration"&&e.type!=="ExportDefaultDeclaration")return e;let t=e.declaration;return Se(t)?t:void 0}xo(nD,"unwrapExportDeclaration");function T2(e){let t=sa(e);if(t.type!=="CallExpression")return;let r=t.callee;if(!Se(r)||r.type!=="MemberExpression"||r.computed===!0)return;let i=r.property;if(!Se(i)||i.type!=="Identifier")return;let n=i.name;return typeof n=="string"?n:void 0}xo(T2,"appMethodNameOf");function tD(e,t,r){let i=sa(e);if(T2(i)!==t.appMethod)return!1;let n=i.arguments;if(!Array.isArray(n))return!1;let a=n[0];return Se(a)?by(sa(a),t.factory,r):!1}xo(tD,"isAppMethodWrap");function C2(e,t){for(let r of e){let i=nD(r);if(i!==void 0){if(i.type==="ImportDeclaration"){let n=i.specifiers;if(!Array.isArray(n))continue;for(let a of n){let o=a.local;if(Se(o)&&o.name===t)return!0}continue}if(i.type==="VariableDeclaration"){let n=i.declarations;if(!Array.isArray(n))continue;for(let a of n){if(!Se(a))continue;let o=a.id;if(!Se(o))continue;let s=!1;if(yy(o,u=>{u.type==="Identifier"&&u.name===t&&(s=!0)}),s)return!0}continue}if(i.type==="FunctionDeclaration"||i.type==="ClassDeclaration"){let n=i.id;if(Se(n)&&n.name===t)return!0}}}return!1}xo(C2,"moduleScopeDeclares");var yie=Object.defineProperty,Fc=(e,t)=>yie(e,"name",{value:t,configurable:!0}),vie={cdn:{default:["storage","compute"]},compute:{perKey:{connectedDatabase:["database"],connectedStorage:["storage"],connectedMessaging:["messaging"]}}};function bie(e,t,r={}){let i=vie[e],n=[],a=Fc((o,s)=>{let u=t();if(u===void 0)return;let d=(s!==void 0?i?.perKey?.[s]:void 0)??i?.default??[],p=[];for(let l of d){let m=ai[l].emitWrapper?.appMethod;if(m===void 0)continue;let f=rD(u,{factory:Gt[l],appMethod:m},o);if(f.success){p.push(f.data);continue}if(f.error.kind!=="statement-not-found")return}if(p.length!==1)return;let h=p[0];if(h===void 0)return;let g=r.mustPrecedeStatementIndex;if(!(g!==void 0&&h.statementIndex>=g))return h.wrap!==void 0&&n.push({plan:h,...s!==void 0&&{planKey:s}}),h.variableName},"resolveBinding");return{resolveBinding:a,resolveBindings:Fc((o,s)=>{let u=n.length,d=[];for(let p of o){let h=a(p,s);if(h===void 0){n.length=u;return}d.push(h)}return d},"resolveBindings"),takePendingWraps:Fc(()=>{let o=n;return n=[],o.map(s=>s.plan)},"takePendingWraps"),pendingDeclarations:Fc(()=>n.map(({plan:o,planKey:s})=>({variableName:o.variableName,resourceName:o.resourceName,statementIndex:o.statementIndex,...s!==void 0&&{planKey:s}})),"pendingDeclarations")}}Fc(bie,"createSiblingBindingResolution");function iD(e){let t=new Map;for(let r of e){let i=t.get(r.variableName);if(i===void 0){t.set(r.variableName,r);continue}if(i.statementIndex!==r.statementIndex)return{first:i,second:r}}}Fc(iD,"findPendingWrapCollision");var Sie=Object.defineProperty,Fr=(e,t)=>Sie(e,"name",{value:t,configurable:!0});function I2(e){return e?.map(t=>({name:t.name,...t.serviceType!==void 0&&{serviceType:t.serviceType},...t.docker!==void 0&&{docker:t.docker},...t.containerPort!==void 0&&{containerPort:t.containerPort},...t.needsDatabaseConnection!==void 0&&{needsDatabaseConnection:t.needsDatabaseConnection},...t.routing!==void 0&&{routing:t.routing}}))}Fr(I2,"toUserServiceConfigs");function D2(e,t,r=!0,i,n){let a={appName:e,type:t,database:[],s3:[],compute:[]};if(t==="custom")return a;let o=t,s=si[o];return{...a,database:w2(e,s,o,r,n),compute:R2(e,s,o,r,i),network:s.network,backup:s.backup}}Fr(D2,"planApplicationResources");function w2(e,t,r,i,n){let a=pC(r),o=t.database[a];return!i||o===null?[]:[{name:e,type:a,databaseName:Ro(e),variableName:`${xr(e)}Database`,...o,...n?.snapshotIdentifier!==void 0&&{snapshotIdentifier:n.snapshotIdentifier},...n?.snapshotUsername!==void 0&&{snapshotUsername:n.snapshotUsername}}]}Fr(w2,"buildDatabasePlan");function k2(e,t){if(!(e===void 0&&t===void 0))return{scaling:{...e!==void 0&&{minCapacity:e},...t!==void 0&&{maxCapacity:t}}}}Fr(k2,"buildScalingConfig");function aD(e){let{minCapacity:t,maxCapacity:r,...i}=e;return{...i,...k2(t,r)}}Fr(aD,"planServiceFromTierPreset");function N2(e,t){let r=aD(e),i=t?.serviceType==="worker",n=t?.containerPort??rj,a=t?.docker;return{...r,...a?.path!==void 0&&{docker:{path:a.path,...a.context!==void 0&&{context:a.context},...a.target!==void 0&&{target:a.target}}},...t?.needsDatabaseConnection!==void 0&&{needsDatabaseConnection:t.needsDatabaseConnection},...i&&{serviceType:"worker"},containers:i?[{}]:[{port:n}]}}Fr(N2,"buildServiceEntry");function P2(e,t){return t||e?.directAccess===!0?e:{...e,loadBalancer:!1}}Fr(P2,"resolveClusterConfig");function R2(e,t,r,i,n){let a=t.compute.ecs,o=(n&&n.length>0?mC(r,n):a.services.map((u,d)=>({...u,name:d===0?"api":`service-${d+1}`}))).map((u,d)=>N2(u,n?.[d])),s=o.some(u=>u.containers?.some(d=>d.port!==void 0));return[{name:e,type:ul.ECS,needsConnection:i,connectedDatabase:i?[e]:void 0,variableName:`${xr(e)}Compute`,cluster:P2(a.cluster,s),services:o}]}Fr(R2,"buildComputePlan");function O2(e){let t=[],r=0,i=Fr((a,o,s)=>{t.push({variableName:a,resourceName:o,statementIndex:r++,planKey:s})},"declare");for(let a of e.additionalNetworks??[])i(xr(a.name),a.name,"additionalNetworks");if(uc(e))return t;for(let a of e.database)Vl(a,e)&&i(ke(a),a.name,"database");for(let a of e.clickhouse??[])Wl(a,e)&&i(ke(a),a.name,"clickhouse");for(let a of e.s3)rd(a,e)&&i(ke(a),a.name,"s3");for(let a of e.dynamodb??[])i(ke(a),a.name,"dynamodb");for(let a of e.sqs??[])nd(a,e)&&i(ke(a),a.name,"sqs");let n=ld(e);for(let a of e.compute)(n.has(a.name)||a.scheduleExpression!==void 0)&&i(ke(a),a.name,"compute");return t}Fr(O2,"collectPlannedDeclarations");function $2(e){let t=[],r=/^const\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*=/gm,i=ud(e),n=-1,a;for(;(a=r.exec(i))!==null;){let o=a[1];o!==void 0&&t.push({variableName:o,resourceName:o,statementIndex:n--,planKey:"prelude"})}return t}Fr($2,"collectPreludeDeclarations");function Lc(e,t){let r=O2(e),i=r.find(s=>Wi.has(s.variableName));if(i!==void 0)return $(new Error(`Cannot generate infrastructure: ${i.planKey} resource "${i.resourceName}" binds the module-scope const \`${i.variableName}\`, a JavaScript reserved word \u2014 the generated file would not parse. Rename the resource, or give it a distinct variableName in the plan.`));let n=iD([...$2(e),...r]);if(n!==void 0)return n.first.planKey==="prelude"?$(new Error(`Cannot generate infrastructure: ${n.second.planKey} resource "${n.second.resourceName}" binds the module-scope const \`${n.first.variableName}\`, which the scaffold prelude itself declares \u2014 the generated file would not compile (Identifier '${n.first.variableName}' has already been declared). Rename the resource, or give it a distinct variableName in the plan.`)):$(new Error(`Cannot generate infrastructure: ${n.first.planKey} resource "${n.first.resourceName}" and ${n.second.planKey} resource "${n.second.resourceName}" both bind the module-scope const \`${n.first.variableName}\` \u2014 the generated file would not compile (Identifier '${n.first.variableName}' has already been declared). Rename one of the resources, or give one a distinct variableName in the plan.`));if(!uc(e)){let s=lg(e);if(s!==void 0)return $(new Error(`Cannot generate infrastructure: compute resource "${s.resourceName}" key \`${s.key}\` cannot be emitted \u2014 ${s.reason}`))}let a=[Sg(e),ud(e),bg(e)];if(uc(e))a.push(od(e),cd(e));else{let s=ld(e);a.push(cd(e),eg(e),tg(e),pg(e),mg(e),fg(e),dg(e,s),Eg(e))}let o=a.join("");if(e.customCodeBlocks&&e.customCodeBlocks.length>0){let s=Lg(o,e.customCodeBlocks,t?.resourceMapping);return s.success?V(s.content):$(new Error(`Custom code injection failed: ${s.error??"unknown error"}`))}return V(o)}Fr(Lc,"generateInfrastructureFromPlan");var Eie=Object.defineProperty,Uc=(e,t)=>Eie(e,"name",{value:t,configurable:!0}),xie=dC("standard");function j2(e){return Tl.options.some(t=>t.shape?.type?.value===e)}Uc(j2,"isPatternConfigType");function M2(e,t,r){let{tier:i="standard",domain:n,database:a,compute:o,cdn:s,environment:u,tags:d}=r??{},p=Ag(i);if(!p&&i!=="custom")return $(new Error(`Invalid pattern tier: "${i}". Valid tiers are: ${[...pd,"custom"].join(", ")}`));if(!j2(t))return $(new Error(`Unsupported pattern type: ${t}`));let h=p?xg(i):null,g=z2(t,e,{domain:n,database:a,compute:o,cdn:s,environment:u,tierPreset:h});if(!g.success)return g;let l=g.data;return V({appName:e,type:"standard",pattern:t,network:h?h.network:xie,backup:h?h.backup:!1,patternConfig:l,database:[],s3:[],compute:[],tags:d??{}})}Uc(M2,"planOpenNextResources");function F2(e,t){return{type:e?.type??t.database.type,instanceType:e?.instanceType??t.database.instanceType,...e?.backupRetention!==void 0&&{backupRetention:e.backupRetention},deletionProtection:e?.deletionProtection??t.database.deletionProtection,...e?.databaseName!==void 0&&{databaseName:e.databaseName},...e?.publiclyAccessible!==void 0&&{publiclyAccessible:e.publiclyAccessible},...e?.allowedIpCidr!==void 0&&{allowedIpCidr:e.allowedIpCidr},...e?.encryption!==void 0&&{encryption:e.encryption}}}Uc(F2,"mergeDatabaseConfig");function L2(e,t){return{memorySize:e?.memorySize??t.compute.memorySize,timeout:e?.timeout??t.compute.timeout}}Uc(L2,"mergeComputeConfig");function U2(e){let{encryption:t,...r}=e;return{...r,...t&&{encryption:{storageKey:t}}}}Uc(U2,"toPatternDatabaseConfig");function z2(e,t,r){let{domain:i,database:n,compute:a,cdn:o,environment:s,tierPreset:u}=r,d=u?F2(n,u):n,p=u?L2(a,u):a,h={type:e,name:t,domain:i,database:d?U2(d):void 0,compute:p?{server:p}:void 0,cdn:o?{domainNames:o.domainNames,certificateArn:o.certificateArn}:void 0,environment:s},g=Tl.safeParse(h);return g.success?V(g.data):$(new Error(`Invalid pattern config: ${g.error.message}`))}Uc(z2,"buildPatternConfig");var Aie=Object.defineProperty,_ie=(e,t)=>Aie(e,"name",{value:t,configurable:!0});function B2(e,t){let r={type:"staticsite",name:e,source:t.source,build:t.build,...t.routing!==void 0&&{routing:t.routing},...t.security!==void 0&&{security:t.security},...t.domain!==void 0&&{domain:t.domain},...t.forms!==void 0&&{forms:t.forms},...t.cdn!==void 0&&{cdn:t.cdn}},i=_l.safeParse(r);return i.success?V({appName:e,type:"standard",pattern:"staticsite",patternConfig:i.data,database:[],s3:[],compute:[],tags:t.tags??{}}):$(new Error(`Invalid static-site pattern config: ${i.error.message}`))}_ie(B2,"planStaticSiteResources");var Tie=Object.defineProperty,Sy=(e,t)=>Tie(e,"name",{value:t,configurable:!0});function G2(e){let t=e.split("/");if(t.length!==2||!t[0]||!t[1])throw new Error(`Invalid service reference format: '${e}'. Expected 'ClusterName/ServiceName'.`);return t[0]}Sy(G2,"parseServiceReference");function oD(e,t,r){r==="database"?(e.needsConnection=!0,e.connectedDatabase=[...new Set([...e.connectedDatabase??[],t])]):e.connectedStorage=[...new Set([...e.connectedStorage??[],t])]}Sy(oD,"addResourceConnection");function zc(e,t,r,i){let n=new Set(t),a=[...new Set(t.map(G2))];for(let o of a){let s=e.compute.find(u=>u.name===o);if(s?.services){oD(s,r,i);for(let u of s.services){let d=`${o}/${u.name}`;n.has(d)&&(i==="database"?u.needsDatabaseConnection=!0:u.needsStorageConnection=!0)}}}}Sy(zc,"applyServiceConnections");function Ao(e,t,r,i){for(let n of e.compute)if(t.includes(n.name)&&(oD(n,r,i),n.services))for(let a of n.services)i==="database"?a.needsDatabaseConnection=!0:a.needsStorageConnection=!0}Sy(Ao,"applyComputeConnections");var Cie=Object.defineProperty,st=(e,t)=>Cie(e,"name",{value:t,configurable:!0});function V2(e){let t=e.database.length>0,r=e.cdn!==void 0;return[{type:"database",label:"Database (RDS)",available:!0},{type:"database:proxy",label:"RDS Proxy",available:t,reason:t?void 0:"Requires at least one database"},{type:"storage:s3",label:"S3 Bucket",available:!0},{type:"network",label:"Network (VPC)",available:!0},{type:"compute:ecs",label:"Compute (ECS)",available:!0},{type:"compute:lambda",label:"Compute (Lambda)",available:!0},{type:"cdn",label:"CDN (CloudFront)",available:!r,reason:r?"A CDN is already configured. Remove existing CDN first.":void 0},{type:"tunnel",label:"Database Tunnel",available:t&&!e.tunnel,reason:t?e.tunnel?"Tunnel is already enabled":void 0:"Requires at least one database"}]}st(V2,"listAvailableResources");function Gd(e,t){if(cD(e,t.resourceName))return $(new Error(uD(t.resourceName)));switch(t.type){case"database":return W2(e,t);case"database:proxy":return K2(e,t);case"storage:s3":return V(void 0);case"network":return V(void 0);case"compute:ecs":return!t.services||t.services.length===0?$(new Error("ECS compute requires at least one service.")):V(void 0);case"compute:lambda":return V(void 0);case"cdn":return q2(e,t);case"tunnel":return Z2(e);default:{let r=t;return $(new Error(`Unknown resource type: ${String(r)}`))}}}st(Gd,"validateResourceAddition");function W2(e,t){let r=t.databaseName??t.resourceName.toLowerCase();return e.database.some(i=>i.databaseName===r)?$(new Error(`Database name '${r}' already exists. Choose a different database name.`)):t.databaseType==="GlobalAurora"&&!t.primaryRegion?$(new Error("GlobalAurora databases require a primaryRegion.")):V(void 0)}st(W2,"validateDatabaseAddition");function K2(e,t){let r=e.database.find(i=>i.name===t.targetDatabase||i.databaseName===t.targetDatabase);if(!r){let i=e.database.map(n=>n.name).join(", ")||"none";return $(new Error(`Database '${t.targetDatabase}' not found. Available databases: ${i}`))}return r.proxy!==void 0&&r.proxy!==!1?$(new Error(`Database '${r.name}' already has RDS Proxy enabled.`)):V(void 0)}st(K2,"validateProxyAddition");function q2(e,t){if(e.cdn)return $(new Error("A CDN is already configured for this application. Remove the existing CDN first."));if(!sD(e,t.defaultOriginRef))return $(new Error(`Origin '${t.defaultOriginRef}' not found in plan. CDN origin must reference an existing resource.`));if(t.behaviours){for(let r of t.behaviours)if(!sD(e,r.originRef))return $(new Error(`Behaviour origin '${r.originRef}' not found in plan.`))}return V(void 0)}st(q2,"validateCdnAddition");function Z2(e){return e.tunnel&&typeof e.tunnel=="object"?$(new Error("Tunnel is already enabled for this application.")):e.database.length===0?$(new Error("No databases found \u2014 tunnel requires at least one relational database.")):V(void 0)}st(Z2,"validateTunnelAddition");function Ey(e,t){let r=Gd(e,t);if(!r.success)return r;switch(t.type){case"database":return H2(e,t);case"database:proxy":return J2(e,t);case"storage:s3":return X2(e,t);case"network":return Y2(e,t);case"compute:ecs":return Q2(e,t);case"compute:lambda":return e4(e,t);case"cdn":return t4(e,t);case"tunnel":return r4(e,t);default:{let i=t;return $(new Error(`Unknown resource type: ${String(i)}`))}}}st(Ey,"addResourceToPlan");function H2(e,t){let r=t.databaseName??t.resourceName.toLowerCase(),i={name:t.resourceName,type:t.databaseType,databaseName:r},n;switch(t.databaseType){case"Instance":n={...i,...t.instanceType!==void 0?{instanceType:t.instanceType}:{},...t.multiAz!==void 0?{multiAz:t.multiAz}:{},...t.readReplica!==void 0?{readReplica:t.readReplica}:{},...t.publiclyAccessible!==void 0?{publiclyAccessible:t.publiclyAccessible}:{},...t.backupRetention!==void 0?{backupRetention:t.backupRetention}:{}};break;case"Aurora":n={...i,...t.writer!==void 0?{writer:t.writer}:{},...t.readers!==void 0?{readers:t.readers}:{},...t.backupRetention!==void 0?{backupRetention:t.backupRetention}:{},...t.preferredMaintenanceWindow!==void 0?{preferredMaintenanceWindow:t.preferredMaintenanceWindow}:{}};break;case"GlobalAurora":n={...i,primaryRegion:t.primaryRegion,...t.secondaryRegions!==void 0?{secondaryRegions:t.secondaryRegions}:{}};break;default:{let o=t.databaseType;return $(new Error(`Unknown database type: ${String(o)}`))}}let a={...e,database:[...e.database,n]};return lD(a,t.resourceName,"database",t),V(a)}st(H2,"addDatabase");function J2(e,t){let r=e.database.map(a=>({...a})),i=r.find(a=>a.name===t.targetDatabase||a.databaseName===t.targetDatabase);if(!i)return $(new Error(`Database '${t.targetDatabase}' not found.`));let n={};return t.maxConnections!==void 0&&(n.maxConnections=t.maxConnections),t.maxIdleConnections!==void 0&&(n.maxIdleConnections=t.maxIdleConnections),t.connectionBorrowTimeout!==void 0&&(n.connectionBorrowTimeout=t.connectionBorrowTimeout),t.requireTLS!==void 0&&(n.requireTLS=t.requireTLS),i.proxy=Object.keys(n).length>0?n:{},V({...e,database:r})}st(J2,"addProxy");function X2(e,t){let r=t.bucketName??t.resourceName.toLowerCase(),i=Qe(r),n=e.s3.length,a=n===0?"":`${n+1}`,o={name:i,bucketName:r,variableName:`bucket${a}`,...t.publicReadAccess!==void 0?{publicReadAccess:t.publicReadAccess}:{},...t.versioned!==void 0?{versioned:t.versioned}:{},...t.encryption!==void 0?{encryption:t.encryption}:{},...t.websiteHosting?{websiteHosting:{indexDocument:"index.html"}}:{}},s={...e,s3:[...e.s3,o]};return lD(s,i,"storage",t),V(s)}st(X2,"addS3");function Y2(e,t){let r={};if(t.maxAzs!==void 0&&(r.maxAzs=t.maxAzs),t.natGateways!==void 0&&(r.natGateways=t.natGateways),t.flowLogs!==void 0&&(r.flowLogs=t.flowLogs),t.vpcEndpoints!==void 0&&(r.vpcEndpoints=t.vpcEndpoints),t.networkName){let i={name:t.networkName,...r};return V({...e,additionalNetworks:[...e.additionalNetworks??[],i]})}return V({...e,network:{...e.network??{},...r}})}st(Y2,"addNetwork");function Q2(e,t){let r=t.connectedDatabase??[],i={name:t.resourceName,type:"ecs",needsConnection:r.length>0,connectedDatabase:r,...t.loadBalancer!==void 0?{cluster:{loadBalancer:t.loadBalancer}}:{},services:t.services.map(n=>({name:n.name,capacityProvider:n.capacityProvider??"FARGATE",...n.port!==void 0?{containers:[{port:n.port}]}:{},...n.cpu!==void 0?{cpu:n.cpu}:{},...n.memory!==void 0?{memoryLimitMiB:n.memory}:{}})),...t.docker!==void 0&&{docker:t.docker}};return V({...e,compute:[...e.compute,i]})}st(Q2,"addEcsCompute");function e4(e,t){let r=t.connectedDatabase??[],i={name:t.resourceName,type:"lambda",needsConnection:r.length>0,connectedDatabase:r,...t.timeout!==void 0?{timeout:t.timeout}:{},...t.memory!==void 0?{memory:t.memory}:{},...t.handler!==void 0?{handler:t.handler}:{},...t.runtime!==void 0?{runtime:t.runtime}:{}};return V({...e,compute:[...e.compute,i]})}st(e4,"addLambdaCompute");function t4(e,t){let r={name:t.resourceName,defaultOriginRef:t.defaultOriginRef,...t.customDomain!==void 0?{customDomain:t.customDomain}:{},...t.certificateArn!==void 0?{certificateArn:t.certificateArn}:{},...t.domain!==void 0?{domain:t.domain}:{},...t.originHostname!==void 0?{originHostname:t.originHostname}:{},...t.behaviours&&t.behaviours.length>0?{behaviours:[...t.behaviours].map(i=>({pathPattern:i.pathPattern,originRef:i.originRef,...i.cachePolicy!==void 0?{cachePolicy:i.cachePolicy}:{}}))}:{}};return V({...e,cdn:r})}st(t4,"addCdn");function r4(e,t){let r=t.instanceType?{instanceType:t.instanceType}:{};return V({...e,tunnel:r})}st(r4,"addTunnel");function cD(e,t){let r=[...e.database.map(i=>i.name),...(e.clickhouse??[]).map(i=>i.name),...e.s3.map(i=>i.name),...e.compute.map(i=>i.name),...(e.dynamodb??[]).map(i=>i.name),...(e.sqs??[]).map(i=>i.name),...(e.additionalNetworks??[]).map(i=>i.name)];return e.cdn&&r.push(e.cdn.name),r.includes(t)}st(cD,"isResourceNameTaken");function uD(e){return`Resource name '${e}' is already used in this application.`}st(uD,"resourceNameTakenMessage");function sD(e,t){return e.database.some(r=>r.name===t)||e.s3.some(r=>r.name===t)||e.compute.some(r=>r.name===t)||(e.dynamodb??[]).some(r=>r.name===t)||(e.sqs??[]).some(r=>r.name===t)}st(sD,"resourceExistsInPlan");function lD(e,t,r,i){i.connectToCompute&&i.connectToCompute.length>0&&Ao(e,[...i.connectToCompute],t,r),i.connectToServices&&i.connectToServices.length>0&&zc(e,[...i.connectToServices],t,r)}st(lD,"applyConnections");var Iie=Object.defineProperty,Die=(e,t)=>Iie(e,"name",{value:t,configurable:!0});function n4(e,t,r){let i;try{i=ta(e,{extractCustomCode:!0})}catch(u){return $(new Error(`Failed to parse infrastructure.ts: ${u instanceof Error?u.message:String(u)}`))}let n;try{n=uo(i,t,{skipValidation:!0})}catch(u){return $(new Error(`Failed to build resource plan: ${u instanceof Error?u.message:String(u)}`))}i.customCodeBlocks&&i.customCodeBlocks.length>0&&(n.customCodeBlocks=i.customCodeBlocks);let a=Gd(n,r);if(!a.success)return a;let o=Ey(n,r);if(!o.success)return o;let s=Lc(o.data);return s.success?V({originalContent:e,modifiedContent:s.data,addedResource:{type:r.type,name:r.resourceName}}):$(new Error(`Code generation failed: ${s.error.message}`))}Die(n4,"generateResourceChange");var wie=Object.defineProperty,_o=(e,t)=>wie(e,"name",{value:t,configurable:!0});function wn(e,...t){let r={};for(let i of t)e[i]!==void 0&&(r[i]=e[i]);return r}_o(wn,"pickDefined");function i4(e,t){let r={name:e,type:t.databaseType,databaseName:t.databaseName,...wn(t,"databaseInsights","port","proxy","credentials","encryption","deletionProtection")};switch(t.databaseType){case"Instance":return{...r,...wn(t,"instanceType","multiAz","readReplica","publiclyAccessible","backupRetention","allocatedStorage","snapshotIdentifier","snapshotUsername")};case"Aurora":return{...r,...wn(t,"writer","readers","backupRetention","preferredMaintenanceWindow","monitoringInterval","snapshotIdentifier","snapshotUsername")};case"GlobalAurora":return{...r,primaryRegion:t.primaryRegion,...t.secondaryRegions&&t.secondaryRegions.length>0&&{secondaryRegions:t.secondaryRegions},...wn(t,"globalClusterIdentifier","enableGlobalWriteForwarding","writer","readers","backupRetention","preferredMaintenanceWindow","monitoringInterval","snapshotIdentifier","snapshotUsername")};default:return t}}_o(i4,"buildRelationalResourcePlan");function a4(e){return`${e}Database`}_o(a4,"defaultRelationalDatabaseName");function o4(e,t){return`Database name '${e}' already exists in ${t}. Please choose a different database name.`}_o(o4,"duplicateDatabaseNameMessage");function s4(e,t){let r=e.find(n=>n.name===t.databaseName||n.databaseName===t.databaseName);if(!r)return{ok:!1,message:`Database '${t.databaseName}' not found. Available databases: ${e.map(n=>n.name).join(", ")||"none"}`};if(r.proxy!==void 0&&r.proxy!==!1)return{ok:!1,message:`Database '${r.name}' already has RDS Proxy enabled.`};let i=wn(t,"maxConnections","maxIdleConnections","connectionBorrowTimeout","requireTLS");return{ok:!0,database:r,proxyValue:Object.keys(i).length>0?i:{}}}_o(s4,"resolveProxyAddition");function c4(e,t){return{name:e,type:"ClickHouse",databaseName:t.databaseName,...wn(t,"instanceType","storageGb","iops","throughputMbps","coldTier","optimiseSchedule","backupSchedule","backupVerify","backupRetentionDays")}}_o(c4,"buildClickHouseResourcePlan");function xy(e,t,r){let i=t.storagePreset??"standard",n=_g[i],a=r===0?"":`${r+1}`;return{name:e,bucketName:t.bucketName,variableName:`bucket${a}`,...n,...wn(t,"publicReadAccess","websiteHosting","backupVaultTier","versioned","encryption","kmsKeyArn","cors")}}_o(xy,"buildS3ResourcePlan");var kie=Object.defineProperty,yi=(e,t)=>kie(e,"name",{value:t,configurable:!0}),Nie=new Set(Ad.options);function u4(e){return Nie.has(e.toUpperCase())}yi(u4,"isRecordType");function l4(e){return e.endsWith(".")?e.slice(0,-1):e}yi(l4,"stripTrailingDot");function d4(e){let t=!1;for(let r=0;r<e.length;r++)if(e[r]==='"')t=!t;else if(e[r]===";"&&!t)return e.slice(0,r).trimEnd();return e}yi(d4,"stripInlineComment");function p4(e,t){let r=e.slice(t).join(" "),i=[],n="",a=!1;for(let o of r)o==='"'?(a&&(i.push(n),n=""),a=!a):a&&(n+=o);return i.join(" ")}yi(p4,"parseTxtValue");function m4(e){let t=/;\s*auto\s*$/.test(e),r=e.replace(/;\s*auto\s*$/,"").trim().match(/^\$FJALL-DELEGATE\s+(\S+)\s+TO\s+(\S+)$/i);if(r)return{subdomain:r[1],targetAccount:r[2],auto:t}}yi(m4,"parseDelegateDirective");function f4(e){if(e.length<2)return;let t=e[1],r=e.slice(2);return{domainName:t,subjectAlternativeNames:r}}yi(f4,"parseCertDirective");function h4(e){let t=[],r="",i=!1;for(let n of e)n==='"'?(i=!i,r+=n):/\s/.test(n)&&!i?r.length>0&&(t.push(r),r=""):r+=n;return r.length>0&&t.push(r),t}yi(h4,"tokenise");function g4(e){if(e.length<2)return;let t=0,r=e[t++],i,n;for(;t<e.length&&n===void 0;){let o=e[t].toUpperCase();if(o==="IN")t++;else if(u4(o))n=o,t++;else if(/^\d+$/.test(e[t]))i=parseInt(e[t],10),t++;else return}if(!n)return;let a=e.slice(t);switch(n){case"MX":{if(a.length<2)return;let o=parseInt(a[0],10),s=a.slice(1).join(" ");return{name:r,type:n,ttl:i,value:s,priority:o}}case"SRV":{if(a.length<4)return;let o=parseInt(a[0],10),s=parseInt(a[1],10),u=parseInt(a[2],10),d=a[3];return{name:r,type:n,ttl:i,value:d,priority:o,weight:s,port:u}}case"TXT":{let o=p4(e,t);return{name:r,type:n,ttl:i,value:o}}case"CAA":{let o=a.join(" ");return{name:r,type:n,ttl:i,value:o}}case"A":case"AAAA":{if(a.length===0)return;if(a[0].toUpperCase()==="ALIAS"){if(a.length<2)return;let o=a.slice(1).join(" ");return{name:r,type:n,ttl:i,value:`${Fz}${o}`}}return{name:r,type:n,ttl:i,value:a[0]}}default:return a.length===0?void 0:{name:r,type:n,ttl:i,value:a[0]}}}yi(g4,"parseRecord");function y4(e){let t=e.split(`
|
|
@@ -818,4 +818,4 @@ ${fl(i.error)}`);return i.data}To(G4,"validateGeneratorOptions");function V4(e,t
|
|
|
818
818
|
`),[e[0].name];let i=[];for(;i.length===0;)i=(await(0,Dw.default)([{type:"multiselect",name:"selected",message:t,choices:e.map(n=>({title:n.name,value:n.name,description:r?.(n),selected:!1}))}]))?.selected||[],i.length===0&&process.stdout.write(`
|
|
819
819
|
Please select at least one resource
|
|
820
820
|
|
|
821
|
-
`);return i}x3(kw,"selectResources");var Wse=Object.defineProperty,Kse=(e,t)=>Wse(e,"name",{value:t,configurable:!0});async function Nw(e,t,r,i,n){if(e.compute.length===0)return;if(t.connectionConfig){let{connectToCompute:o=[],connectToServices:s=[]}=t.connectionConfig;s.length>0&&zc(e,s,r,i),o.length>0&&Ao(e,o,r,i);return}if(t.nameProvidedByFlag||!await ww(e.compute.length,"compute resource",n.singularPrompt,n.pluralPrompt))return;let a=await kw(e.compute,"Select compute resources to connect:",o=>o.type.toUpperCase());a.length>0&&Ao(e,a,r,i)}Kse(Nw,"handleResourceConnections");var qse=Object.defineProperty,Zse=(e,t)=>qse(e,"name",{value:t,configurable:!0});async function A3(e,t){await yD(e,Oj,t,"S3",async({tree:r,validated:i,plan:n})=>{let a=Qe(i.bucketName);G_(r,i.appName,a);let o=xy(a,i,n.s3.length),s={...n,s3:[...n.s3,o]};return await Nw(s,i,a,"storage",{singularPrompt:"Found an existing compute resource. Connect this bucket to it?",pluralPrompt:"Found {count} compute resources. Connect this bucket to them?"}),s})}Zse(A3,"s3Generator");var
|
|
821
|
+
`);return i}x3(kw,"selectResources");var Wse=Object.defineProperty,Kse=(e,t)=>Wse(e,"name",{value:t,configurable:!0});async function Nw(e,t,r,i,n){if(e.compute.length===0)return;if(t.connectionConfig){let{connectToCompute:o=[],connectToServices:s=[]}=t.connectionConfig;s.length>0&&zc(e,s,r,i),o.length>0&&Ao(e,o,r,i);return}if(t.nameProvidedByFlag||!await ww(e.compute.length,"compute resource",n.singularPrompt,n.pluralPrompt))return;let a=await kw(e.compute,"Select compute resources to connect:",o=>o.type.toUpperCase());a.length>0&&Ao(e,a,r,i)}Kse(Nw,"handleResourceConnections");var qse=Object.defineProperty,Zse=(e,t)=>qse(e,"name",{value:t,configurable:!0});async function A3(e,t){await yD(e,Oj,t,"S3",async({tree:r,validated:i,plan:n})=>{let a=Qe(i.bucketName);G_(r,i.appName,a);let o=xy(a,i,n.s3.length),s={...n,s3:[...n.s3,o]};return await Nw(s,i,a,"storage",{singularPrompt:"Found an existing compute resource. Connect this bucket to it?",pluralPrompt:"Found {count} compute resources. Connect this bucket to them?"}),s})}Zse(A3,"s3Generator");var iDe=A3;export{iDe as default,A3 as s3Generator};
|