dodopayments-cli 2.0.2 → 2.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/dist/index.js CHANGED
@@ -1,32 +1,32 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as C8}from"node:module";var e3=Object.create;var{getPrototypeOf:D8,defineProperty:Yu,getOwnPropertyNames:F8}=Object;var u8=Object.prototype.hasOwnProperty;var fF=(D,F,u)=>{u=D!=null?e3(D8(D)):{};let C=F||!D||!D.__esModule?Yu(u,"default",{value:D,enumerable:!0}):u;for(let E of F8(D))if(!u8.call(C,E))Yu(C,E,{get:()=>D[E],enumerable:!0});return C};var AD=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var M=(D,F)=>()=>(D&&(F=D(D=0)),F);var zu=C8(import.meta.url);var hu=AD((vu)=>{Object.defineProperty(vu,"__esModule",{value:!0});vu.timingSafeEqual=void 0;function bu(D,F=""){if(!D)throw Error(F)}function S8(D,F){if(D.byteLength!==F.byteLength)return!1;if(!(D instanceof DataView))D=new DataView(ArrayBuffer.isView(D)?D.buffer:D);if(!(F instanceof DataView))F=new DataView(ArrayBuffer.isView(F)?F.buffer:F);bu(D instanceof DataView),bu(F instanceof DataView);let u=D.byteLength,C=0,E=-1;while(++E<u)C|=D.getUint8(E)^F.getUint8(E);return C===0}vu.timingSafeEqual=S8});var du=AD((m)=>{var w8=m&&m.__extends||function(){var D=function(F,u){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,E){C.__proto__=E}||function(C,E){for(var B in E)if(E.hasOwnProperty(B))C[B]=E[B]},D(F,u)};return function(F,u){D(F,u);function C(){this.constructor=F}F.prototype=u===null?Object.create(u):(C.prototype=u.prototype,new C)}}();Object.defineProperty(m,"__esModule",{value:!0});var L=256,O0=function(){function D(F){if(F===void 0)F="=";this._paddingCharacter=F}return D.prototype.encodedLength=function(F){if(!this._paddingCharacter)return(F*8+5)/6|0;return(F+2)/3*4|0},D.prototype.encode=function(F){var u="",C=0;for(;C<F.length-2;C+=3){var E=F[C]<<16|F[C+1]<<8|F[C+2];u+=this._encodeByte(E>>>18&63),u+=this._encodeByte(E>>>12&63),u+=this._encodeByte(E>>>6&63),u+=this._encodeByte(E>>>0&63)}var B=F.length-C;if(B>0){var E=F[C]<<16|(B===2?F[C+1]<<8:0);if(u+=this._encodeByte(E>>>18&63),u+=this._encodeByte(E>>>12&63),B===2)u+=this._encodeByte(E>>>6&63);else u+=this._paddingCharacter||"";u+=this._paddingCharacter||""}return u},D.prototype.maxDecodedLength=function(F){if(!this._paddingCharacter)return(F*6+7)/8|0;return F/4*3|0},D.prototype.decodedLength=function(F){return this.maxDecodedLength(F.length-this._getPaddingLength(F))},D.prototype.decode=function(F){if(F.length===0)return new Uint8Array(0);var u=this._getPaddingLength(F),C=F.length-u,E=new Uint8Array(this.maxDecodedLength(C)),B=0,$=0,Q=0,z=0,X=0,Y=0,Z=0;for(;$<C-4;$+=4)z=this._decodeChar(F.charCodeAt($+0)),X=this._decodeChar(F.charCodeAt($+1)),Y=this._decodeChar(F.charCodeAt($+2)),Z=this._decodeChar(F.charCodeAt($+3)),E[B++]=z<<2|X>>>4,E[B++]=X<<4|Y>>>2,E[B++]=Y<<6|Z,Q|=z&L,Q|=X&L,Q|=Y&L,Q|=Z&L;if($<C-1)z=this._decodeChar(F.charCodeAt($)),X=this._decodeChar(F.charCodeAt($+1)),E[B++]=z<<2|X>>>4,Q|=z&L,Q|=X&L;if($<C-2)Y=this._decodeChar(F.charCodeAt($+2)),E[B++]=X<<4|Y>>>2,Q|=Y&L;if($<C-3)Z=this._decodeChar(F.charCodeAt($+3)),E[B++]=Y<<6|Z,Q|=Z&L;if(Q!==0)throw Error("Base64Coder: incorrect characters for decoding");return E},D.prototype._encodeByte=function(F){var u=F;return u+=65,u+=25-F>>>8&6,u+=51-F>>>8&-75,u+=61-F>>>8&-15,u+=62-F>>>8&3,String.fromCharCode(u)},D.prototype._decodeChar=function(F){var u=L;return u+=(42-F&F-44)>>>8&-L+F-43+62,u+=(46-F&F-48)>>>8&-L+F-47+63,u+=(47-F&F-58)>>>8&-L+F-48+52,u+=(64-F&F-91)>>>8&-L+F-65+0,u+=(96-F&F-123)>>>8&-L+F-97+26,u},D.prototype._getPaddingLength=function(F){var u=0;if(this._paddingCharacter){for(var C=F.length-1;C>=0;C--){if(F[C]!==this._paddingCharacter)break;u++}if(F.length<4||u>2)throw Error("Base64Coder: incorrect padding")}return u},D}();m.Coder=O0;var KF=new O0;function R8(D){return KF.encode(D)}m.encode=R8;function j8(D){return KF.decode(D)}m.decode=j8;var gu=function(D){w8(F,D);function F(){return D!==null&&D.apply(this,arguments)||this}return F.prototype._encodeByte=function(u){var C=u;return C+=65,C+=25-u>>>8&6,C+=51-u>>>8&-75,C+=61-u>>>8&-13,C+=62-u>>>8&49,String.fromCharCode(C)},F.prototype._decodeChar=function(u){var C=L;return C+=(44-u&u-46)>>>8&-L+u-45+62,C+=(94-u&u-96)>>>8&-L+u-95+63,C+=(47-u&u-58)>>>8&-L+u-48+52,C+=(64-u&u-91)>>>8&-L+u-65+0,C+=(96-u&u-123)>>>8&-L+u-97+26,C},F}(O0);m.URLSafeCoder=gu;var mu=new gu;function k8(D){return mu.encode(D)}m.encodeURLSafe=k8;function I8(D){return mu.decode(D)}m.decodeURLSafe=I8;m.encodedLength=function(D){return KF.encodedLength(D)};m.maxDecodedLength=function(D){return KF.maxDecodedLength(D)};m.decodedLength=function(D){return KF.decodedLength(D)}});var lu=AD((cu,dF)=>{(function(D,F){var u={};F(u);var C=u.default;for(var E in u)C[E]=u[E];if(typeof dF==="object"&&typeof dF.exports==="object")dF.exports=C;else if(typeof define==="function"&&define.amd)define(function(){return C});else D.sha256=C})(cu,function(D){D.__esModule=!0,D.digestLength=32,D.blockSize=64;var F=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function u(Z,A,J,G,T){var W,O,_,V,S,q,b,H,w,R,f,h,a;while(T>=64){W=A[0],O=A[1],_=A[2],V=A[3],S=A[4],q=A[5],b=A[6],H=A[7];for(R=0;R<16;R++)f=G+R*4,Z[R]=(J[f]&255)<<24|(J[f+1]&255)<<16|(J[f+2]&255)<<8|J[f+3]&255;for(R=16;R<64;R++)w=Z[R-2],h=(w>>>17|w<<15)^(w>>>19|w<<13)^w>>>10,w=Z[R-15],a=(w>>>7|w<<25)^(w>>>18|w<<14)^w>>>3,Z[R]=(h+Z[R-7]|0)+(a+Z[R-16]|0);for(R=0;R<64;R++)h=(((S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7))+(S&q^~S&b)|0)+(H+(F[R]+Z[R]|0)|0)|0,a=((W>>>2|W<<30)^(W>>>13|W<<19)^(W>>>22|W<<10))+(W&O^W&_^O&_)|0,H=b,b=q,q=S,S=V+h|0,V=_,_=O,O=W,W=h+a|0;A[0]+=W,A[1]+=O,A[2]+=_,A[3]+=V,A[4]+=S,A[5]+=q,A[6]+=b,A[7]+=H,G+=64,T-=64}return G}var C=function(){function Z(){this.digestLength=D.digestLength,this.blockSize=D.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return Z.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},Z.prototype.clean=function(){for(var A=0;A<this.buffer.length;A++)this.buffer[A]=0;for(var A=0;A<this.temp.length;A++)this.temp[A]=0;this.reset()},Z.prototype.update=function(A,J){if(J===void 0)J=A.length;if(this.finished)throw Error("SHA256: can't update because hash was finished.");var G=0;if(this.bytesHashed+=J,this.bufferLength>0){while(this.bufferLength<64&&J>0)this.buffer[this.bufferLength++]=A[G++],J--;if(this.bufferLength===64)u(this.temp,this.state,this.buffer,0,64),this.bufferLength=0}if(J>=64)G=u(this.temp,this.state,A,G,J),J%=64;while(J>0)this.buffer[this.bufferLength++]=A[G++],J--;return this},Z.prototype.finish=function(A){if(!this.finished){var J=this.bytesHashed,G=this.bufferLength,T=J/536870912|0,W=J<<3,O=J%64<56?64:128;this.buffer[G]=128;for(var _=G+1;_<O-8;_++)this.buffer[_]=0;this.buffer[O-8]=T>>>24&255,this.buffer[O-7]=T>>>16&255,this.buffer[O-6]=T>>>8&255,this.buffer[O-5]=T>>>0&255,this.buffer[O-4]=W>>>24&255,this.buffer[O-3]=W>>>16&255,this.buffer[O-2]=W>>>8&255,this.buffer[O-1]=W>>>0&255,u(this.temp,this.state,this.buffer,0,O),this.finished=!0}for(var _=0;_<8;_++)A[_*4+0]=this.state[_]>>>24&255,A[_*4+1]=this.state[_]>>>16&255,A[_*4+2]=this.state[_]>>>8&255,A[_*4+3]=this.state[_]>>>0&255;return this},Z.prototype.digest=function(){var A=new Uint8Array(this.digestLength);return this.finish(A),A},Z.prototype._saveState=function(A){for(var J=0;J<this.state.length;J++)A[J]=this.state[J]},Z.prototype._restoreState=function(A,J){for(var G=0;G<this.state.length;G++)this.state[G]=A[G];this.bytesHashed=J,this.finished=!1,this.bufferLength=0},Z}();D.Hash=C;var E=function(){function Z(A){this.inner=new C,this.outer=new C,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var J=new Uint8Array(this.blockSize);if(A.length>this.blockSize)new C().update(A).finish(J).clean();else for(var G=0;G<A.length;G++)J[G]=A[G];for(var G=0;G<J.length;G++)J[G]^=54;this.inner.update(J);for(var G=0;G<J.length;G++)J[G]^=106;this.outer.update(J),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var G=0;G<J.length;G++)J[G]=0}return Z.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},Z.prototype.clean=function(){for(var A=0;A<this.istate.length;A++)this.ostate[A]=this.istate[A]=0;this.inner.clean(),this.outer.clean()},Z.prototype.update=function(A){return this.inner.update(A),this},Z.prototype.finish=function(A){if(this.outer.finished)this.outer.finish(A);else this.inner.finish(A),this.outer.update(A,this.digestLength).finish(A);return this},Z.prototype.digest=function(){var A=new Uint8Array(this.digestLength);return this.finish(A),A},Z}();D.HMAC=E;function B(Z){var A=new C().update(Z),J=A.digest();return A.clean(),J}D.hash=B,D.default=B;function $(Z,A){var J=new E(Z).update(A),G=J.digest();return J.clean(),G}D.hmac=$;function Q(Z,A,J,G){var T=G[0];if(T===0)throw Error("hkdf: cannot expand more");if(A.reset(),T>1)A.update(Z);if(J)A.update(J);A.update(G),A.finish(Z),G[0]++}var z=new Uint8Array(D.digestLength);function X(Z,A,J,G){if(A===void 0)A=z;if(G===void 0)G=32;var T=new Uint8Array([1]),W=$(A,Z),O=new E(W),_=new Uint8Array(O.digestLength),V=_.length,S=new Uint8Array(G);for(var q=0;q<G;q++){if(V===_.length)Q(_,O,J,T),V=0;S[q]=_[V++]}return O.clean(),_.fill(0),T.fill(0),S}D.hkdf=X;function Y(Z,A,J,G){var T=new E(Z),W=T.digestLength,O=new Uint8Array(4),_=new Uint8Array(W),V=new Uint8Array(W),S=new Uint8Array(G);for(var q=0;q*W<G;q++){var b=q+1;O[0]=b>>>24&255,O[1]=b>>>16&255,O[2]=b>>>8&255,O[3]=b>>>0&255,T.reset(),T.update(A),T.update(O),T.finish(V);for(var H=0;H<W;H++)_[H]=V[H];for(var H=2;H<=J;H++){T.reset(),T.update(V).finish(V);for(var w=0;w<W;w++)_[w]^=V[w]}for(var H=0;H<W&&q*W+H<G;H++)S[q*W+H]=_[H]}for(var q=0;q<W;q++)_[q]=V[q]=0;for(var q=0;q<4;q++)O[q]=0;return T.clean(),S}D.pbkdf2=Y})});var ru=AD((iu)=>{Object.defineProperty(iu,"__esModule",{value:!0});iu.Webhook=iu.WebhookVerificationError=void 0;var L8=hu(),pu=du(),f8=lu(),nu=300;class T0 extends Error{constructor(D){super(D);Object.setPrototypeOf(this,T0.prototype),this.name="ExtendableError",this.stack=Error(D).stack}}class CD extends T0{constructor(D){super(D);Object.setPrototypeOf(this,CD.prototype),this.name="WebhookVerificationError"}}iu.WebhookVerificationError=CD;class _F{constructor(D,F){if(!D)throw Error("Secret can't be empty.");if((F===null||F===void 0?void 0:F.format)==="raw")if(D instanceof Uint8Array)this.key=D;else this.key=Uint8Array.from(D,(u)=>u.charCodeAt(0));else{if(typeof D!=="string")throw Error("Expected secret to be of type string");if(D.startsWith(_F.prefix))D=D.substring(_F.prefix.length);this.key=pu.decode(D)}}verify(D,F){let u={};for(let Z of Object.keys(F))u[Z.toLowerCase()]=F[Z];let C=u["webhook-id"],E=u["webhook-signature"],B=u["webhook-timestamp"];if(!E||!C||!B)throw new CD("Missing required headers");let $=this.verifyTimestamp(B),z=this.sign(C,$,D).split(",")[1],X=E.split(" "),Y=new globalThis.TextEncoder;for(let Z of X){let[A,J]=Z.split(",");if(A!=="v1")continue;if((0,L8.timingSafeEqual)(Y.encode(J),Y.encode(z)))return JSON.parse(D.toString())}throw new CD("No matching signature found")}sign(D,F,u){if(typeof u==="string");else if(u.constructor.name==="Buffer")u=u.toString();else throw Error("Expected payload to be of type string or Buffer.");let C=new TextEncoder,E=Math.floor(F.getTime()/1000),B=C.encode(`${D}.${E}.${u}`);return`v1,${pu.encode(f8.hmac(this.key,B))}`}verifyTimestamp(D){let F=Math.floor(Date.now()/1000),u=parseInt(D,10);if(isNaN(u))throw new CD("Invalid Signature Headers");if(F-u>nu)throw new CD("Message timestamp too old");if(u>F+nu)throw new CD("Message timestamp too new");return new Date(u*1000)}}iu.Webhook=_F;_F.prefix="whsec_"});var TF=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",lF=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n",NF=(D)=>D.name==="backspace",V0=(D)=>D.name==="tab",H0=(D)=>"1234567890".includes(D.name),UF=(D)=>D.name==="enter"||D.name==="return";var q0,M0,pF,x0,VF;var nF=M(()=>{q0=class q0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}};M0=class M0 extends Error{name="CancelPromptError";message="Prompt was canceled"};pF=class pF extends Error{name="ExitPromptError"};x0=class x0 extends Error{name="HookError"};VF=class VF extends Error{name="ValidationError"}});import{AsyncLocalStorage as v8,AsyncResource as y8}from"node:async_hooks";function h8(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function D2(D,F){let u=h8(D);return eu.run(u,()=>{function C(E){u.handleChange=()=>{u.index=0,E()},u.handleChange()}return F(C)})}function XD(){let D=eu.getStore();if(!D)throw new x0("[Inquirer] Hook functions can only be called from within a prompt");return D}function S0(){return XD().rl}function w0(D){let F=(...u)=>{let C=XD(),E=!1,B=C.handleChange;C.handleChange=()=>{E=!0};let $=D(...u);if(E)B();return C.handleChange=B,$};return y8.bind(F)}function cD(D){let F=XD(),{index:u}=F,C={get(){return F.hooks[u]},set(B){F.hooks[u]=B},initialized:u in F.hooks},E=D(C);return F.index++,E}function F2(){XD().handleChange()}var eu,GD;var YD=M(()=>{nF();eu=new v8;GD={queue(D){let F=XD(),{index:u}=F;F.hooksEffect.push(()=>{F.hooksCleanup[u]?.();let C=D(S0());if(C!=null&&typeof C!=="function")throw new VF("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[u]=C})},run(){let D=XD();w0(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=XD();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}}});import{AsyncResource as g8}from"node:async_hooks";function g(D){return cD((F)=>{let u=g8.bind(function(B){if(F.get()!==B)F.set(B),F2()});if(F.initialized)return[F.get(),u];let C=typeof D==="function"?D():D;return F.set(C),[C,u]})}var iF=M(()=>{YD()});function t(D,F){cD((u)=>{let C=u.get();if(!Array.isArray(C)||F.some((B,$)=>!Object.is(B,C[$])))GD.queue(D);u.set(F)})}var aF=M(()=>{YD()});import i from"node:process";function m8(){if(i.platform!=="win32")return i.env.TERM!=="linux";return Boolean(i.env.WT_SESSION)||Boolean(i.env.TERMINUS_SUBLIME)||i.env.ConEmuTask==="{cmd::Cmder}"||i.env.TERM_PROGRAM==="Terminus-Sublime"||i.env.TERM_PROGRAM==="vscode"||i.env.TERM==="xterm-256color"||i.env.TERM==="alacritty"||i.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var u2,C2,d8,c8,l8,p8,n8,lD,CB;var rF=M(()=>{u2={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},C2={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},d8={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},c8={...u2,...C2},l8={...u2,...d8},p8=m8(),n8=p8?c8:l8,lD=n8,CB=Object.entries(C2)});import{styleText as n}from"node:util";var E2;var B2=M(()=>{rF();E2={prefix:{idle:n("blue","?"),done:n("green",lD.tick)},spinner:{interval:80,frames:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"].map((D)=>n("yellow",D))},style:{answer:(D)=>n("cyan",D),message:(D)=>n("bold",D),error:(D)=>n("red",`> ${D}`),defaultAnswer:(D)=>n("dim",`(${D})`),help:(D)=>n("dim",D),highlight:(D)=>n("cyan",D),key:(D)=>n("cyan",n("bold",`<${D}>`))}}});function A2(D){if(typeof D!=="object"||D===null)return!1;let F=D;while(Object.getPrototypeOf(F)!==null)F=Object.getPrototypeOf(F);return Object.getPrototypeOf(D)===F}function $2(...D){let F={};for(let u of D)for(let[C,E]of Object.entries(u)){let B=F[C];F[C]=A2(B)&&A2(E)?$2(B,E):E}return F}function zD(...D){let F=[E2,...D.filter((u)=>u!=null)];return $2(...F)}var R0=M(()=>{B2()});function HF({status:D="idle",theme:F}){let[u,C]=g(!1),[E,B]=g(0),{prefix:$,spinner:Q}=zD(F);if(t(()=>{if(D==="loading"){let X,Y=-1,Z=setTimeout(()=>{C(!0),X=setInterval(()=>{Y=Y+1,B(Y%Q.frames.length)},Q.interval)},300);return()=>{clearTimeout(Z),clearInterval(X)}}else C(!1)},[D]),u)return Q.frames[E];return typeof $==="string"?$:$[D==="loading"?"idle":D]??$.idle}var Z2=M(()=>{iF();aF();R0()});function qF(D,F){return cD((u)=>{let C=u.get();if(!C||C.dependencies.length!==F.length||C.dependencies.some((E,B)=>E!==F[B])){let E=D();return u.set({value:E,dependencies:F}),E}return C.value})}var Q2=M(()=>{YD()});function KD(D){return g({current:D})[0]}var tF=M(()=>{iF()});function MF(D){let F=KD(D);F.current=D,t((u)=>{let C=!1,E=w0((B,$)=>{if(C)return;F.current($,u)});return u.input.on("keypress",E),()=>{C=!0,u.input.removeListener("keypress",E)}},[])}var J2=M(()=>{tF();aF();YD()});var G2=AD((VB,X2)=>{X2.exports=a8;function i8(D){let F={defaultWidth:0,output:process.stdout,tty:zu("tty")};if(!D)return F;return Object.keys(F).forEach(function(u){if(!D[u])D[u]=F[u]}),D}function a8(D){let F=i8(D);if(F.output.getWindowSize)return F.output.getWindowSize()[0]||F.defaultWidth;if(F.tty.getWindowSize)return F.tty.getWindowSize()[1]||F.defaultWidth;if(F.output.columns)return F.output.columns;if(process.env.CLI_WIDTH){let u=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(u)&&u!==0)return u}return F.defaultWidth}});function j0({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}function xF(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(r8,"")}var r8;var k0=M(()=>{r8=j0()});function Y2(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function z2(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function K2(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}var _2=()=>{};function t8(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function W2(D,{ambiguousAsWide:F=!1}={}){if(t8(D),z2(D)||K2(D)||F&&Y2(D))return 2;return 1}var O2=M(()=>{_2()});var N2=AD((jB,T2)=>{T2.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});function _D(D,F={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:u=!0,countAnsiEscapeCodes:C=!1}=F;if(!C)D=xF(D);if(D.length===0)return 0;let E=0,B={ambiguousAsWide:!u};for(let{segment:$}of s8.segment(D)){let Q=$.codePointAt(0);if(Q<=31||Q>=127&&Q<=159)continue;if(Q>=8203&&Q<=8207||Q===65279)continue;if(Q>=768&&Q<=879||Q>=6832&&Q<=6911||Q>=7616&&Q<=7679||Q>=8400&&Q<=8447||Q>=65056&&Q<=65071)continue;if(Q>=55296&&Q<=57343)continue;if(Q>=65024&&Q<=65039)continue;if(o8.test($))continue;if(U2.default().test($)){E+=2;continue}E+=W2(Q,B)}return E}var U2,s8,o8;var V2=M(()=>{k0();O2();U2=fF(N2(),1),s8=new Intl.Segmenter,o8=/^\p{Default_Ignorable_Code_Point}$/u});function F6(){let D=new Map;for(let[F,u]of Object.entries(I)){for(let[C,E]of Object.entries(u))I[C]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},u[C]=I[C],D.set(E[0],E[1]);Object.defineProperty(I,F,{value:u,enumerable:!1})}return Object.defineProperty(I,"codes",{value:D,enumerable:!1}),I.color.close="\x1B[39m",I.bgColor.close="\x1B[49m",I.color.ansi=H2(),I.color.ansi256=q2(),I.color.ansi16m=M2(),I.bgColor.ansi=H2(10),I.bgColor.ansi256=q2(10),I.bgColor.ansi16m=M2(10),Object.defineProperties(I,{rgbToAnsi256:{value(F,u,C){if(F===u&&u===C){if(F<8)return 16;if(F>248)return 231;return Math.round((F-8)/247*24)+232}return 16+36*Math.round(F/255*5)+6*Math.round(u/255*5)+Math.round(C/255*5)},enumerable:!1},hexToRgb:{value(F){let u=/[a-f\d]{6}|[a-f\d]{3}/i.exec(F.toString(16));if(!u)return[0,0,0];let[C]=u;if(C.length===3)C=[...C].map((B)=>B+B).join("");let E=Number.parseInt(C,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(F)=>I.rgbToAnsi256(...I.hexToRgb(F)),enumerable:!1},ansi256ToAnsi:{value(F){if(F<8)return 30+F;if(F<16)return 90+(F-8);let u,C,E;if(F>=232)u=((F-232)*10+8)/255,C=u,E=u;else{F-=16;let Q=F%36;u=Math.floor(F/36)/5,C=Math.floor(Q/6)/5,E=Q%6/5}let B=Math.max(u,C,E)*2;if(B===0)return 30;let $=30+(Math.round(E)<<2|Math.round(C)<<1|Math.round(u));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(F,u,C)=>I.ansi256ToAnsi(I.rgbToAnsi256(F,u,C)),enumerable:!1},hexToAnsi:{value:(F)=>I.ansi256ToAnsi(I.hexToAnsi256(F)),enumerable:!1}}),I}var H2=(D=0)=>(F)=>`\x1B[${F+D}m`,q2=(D=0)=>(F)=>`\x1B[${38+D};5;${F}m`,M2=(D=0)=>(F,u,C)=>`\x1B[${38+D};2;${F};${u};${C}m`,I,fB,e8,D6,PB,u6,x2;var S2=M(()=>{I={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},fB=Object.keys(I.modifier),e8=Object.keys(I.color),D6=Object.keys(I.bgColor),PB=[...e8,...D6];u6=F6(),x2=u6});function f0(D,F,u){return String(D).normalize().replaceAll(`\r
2
+ import{createRequire as E8}from"node:module";var D8=Object.create;var{getPrototypeOf:F8,defineProperty:z2,getOwnPropertyNames:u8}=Object;var C8=Object.prototype.hasOwnProperty;var PF=(D,F,u)=>{u=D!=null?D8(F8(D)):{};let C=F||!D||!D.__esModule?z2(u,"default",{value:D,enumerable:!0}):u;for(let E of u8(D))if(!C8.call(C,E))z2(C,E,{get:()=>D[E],enumerable:!0});return C};var ZD=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var M=(D,F)=>()=>(D&&(F=D(D=0)),F);var K2=E8(import.meta.url);var g2=ZD((y2)=>{Object.defineProperty(y2,"__esModule",{value:!0});y2.timingSafeEqual=void 0;function v2(D,F=""){if(!D)throw Error(F)}function w8(D,F){if(D.byteLength!==F.byteLength)return!1;if(!(D instanceof DataView))D=new DataView(ArrayBuffer.isView(D)?D.buffer:D);if(!(F instanceof DataView))F=new DataView(ArrayBuffer.isView(F)?F.buffer:F);v2(D instanceof DataView),v2(F instanceof DataView);let u=D.byteLength,C=0,E=-1;while(++E<u)C|=D.getUint8(E)^F.getUint8(E);return C===0}y2.timingSafeEqual=w8});var d2=ZD((p)=>{var R8=p&&p.__extends||function(){var D=function(F,u){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,E){C.__proto__=E}||function(C,E){for(var A in E)if(E.hasOwnProperty(A))C[A]=E[A]},D(F,u)};return function(F,u){D(F,u);function C(){this.constructor=F}F.prototype=u===null?Object.create(u):(C.prototype=u.prototype,new C)}}();Object.defineProperty(p,"__esModule",{value:!0});var f=256,V0=function(){function D(F){if(F===void 0)F="=";this._paddingCharacter=F}return D.prototype.encodedLength=function(F){if(!this._paddingCharacter)return(F*8+5)/6|0;return(F+2)/3*4|0},D.prototype.encode=function(F){var u="",C=0;for(;C<F.length-2;C+=3){var E=F[C]<<16|F[C+1]<<8|F[C+2];u+=this._encodeByte(E>>>18&63),u+=this._encodeByte(E>>>12&63),u+=this._encodeByte(E>>>6&63),u+=this._encodeByte(E>>>0&63)}var A=F.length-C;if(A>0){var E=F[C]<<16|(A===2?F[C+1]<<8:0);if(u+=this._encodeByte(E>>>18&63),u+=this._encodeByte(E>>>12&63),A===2)u+=this._encodeByte(E>>>6&63);else u+=this._paddingCharacter||"";u+=this._paddingCharacter||""}return u},D.prototype.maxDecodedLength=function(F){if(!this._paddingCharacter)return(F*6+7)/8|0;return F/4*3|0},D.prototype.decodedLength=function(F){return this.maxDecodedLength(F.length-this._getPaddingLength(F))},D.prototype.decode=function(F){if(F.length===0)return new Uint8Array(0);var u=this._getPaddingLength(F),C=F.length-u,E=new Uint8Array(this.maxDecodedLength(C)),A=0,$=0,Q=0,Y=0,J=0,X=0,Z=0;for(;$<C-4;$+=4)Y=this._decodeChar(F.charCodeAt($+0)),J=this._decodeChar(F.charCodeAt($+1)),X=this._decodeChar(F.charCodeAt($+2)),Z=this._decodeChar(F.charCodeAt($+3)),E[A++]=Y<<2|J>>>4,E[A++]=J<<4|X>>>2,E[A++]=X<<6|Z,Q|=Y&f,Q|=J&f,Q|=X&f,Q|=Z&f;if($<C-1)Y=this._decodeChar(F.charCodeAt($)),J=this._decodeChar(F.charCodeAt($+1)),E[A++]=Y<<2|J>>>4,Q|=Y&f,Q|=J&f;if($<C-2)X=this._decodeChar(F.charCodeAt($+2)),E[A++]=J<<4|X>>>2,Q|=X&f;if($<C-3)Z=this._decodeChar(F.charCodeAt($+3)),E[A++]=X<<6|Z,Q|=Z&f;if(Q!==0)throw Error("Base64Coder: incorrect characters for decoding");return E},D.prototype._encodeByte=function(F){var u=F;return u+=65,u+=25-F>>>8&6,u+=51-F>>>8&-75,u+=61-F>>>8&-15,u+=62-F>>>8&3,String.fromCharCode(u)},D.prototype._decodeChar=function(F){var u=f;return u+=(42-F&F-44)>>>8&-f+F-43+62,u+=(46-F&F-48)>>>8&-f+F-47+63,u+=(47-F&F-58)>>>8&-f+F-48+52,u+=(64-F&F-91)>>>8&-f+F-65+0,u+=(96-F&F-123)>>>8&-f+F-97+26,u},D.prototype._getPaddingLength=function(F){var u=0;if(this._paddingCharacter){for(var C=F.length-1;C>=0;C--){if(F[C]!==this._paddingCharacter)break;u++}if(F.length<4||u>2)throw Error("Base64Coder: incorrect padding")}return u},D}();p.Coder=V0;var WF=new V0;function j8(D){return WF.encode(D)}p.encode=j8;function k8(D){return WF.decode(D)}p.decode=k8;var m2=function(D){R8(F,D);function F(){return D!==null&&D.apply(this,arguments)||this}return F.prototype._encodeByte=function(u){var C=u;return C+=65,C+=25-u>>>8&6,C+=51-u>>>8&-75,C+=61-u>>>8&-13,C+=62-u>>>8&49,String.fromCharCode(C)},F.prototype._decodeChar=function(u){var C=f;return C+=(44-u&u-46)>>>8&-f+u-45+62,C+=(94-u&u-96)>>>8&-f+u-95+63,C+=(47-u&u-58)>>>8&-f+u-48+52,C+=(64-u&u-91)>>>8&-f+u-65+0,C+=(96-u&u-123)>>>8&-f+u-97+26,C},F}(V0);p.URLSafeCoder=m2;var c2=new m2;function L8(D){return c2.encode(D)}p.encodeURLSafe=L8;function I8(D){return c2.decode(D)}p.decodeURLSafe=I8;p.encodedLength=function(D){return WF.encodedLength(D)};p.maxDecodedLength=function(D){return WF.maxDecodedLength(D)};p.decodedLength=function(D){return WF.decodedLength(D)}});var p2=ZD((l2,dF)=>{(function(D,F){var u={};F(u);var C=u.default;for(var E in u)C[E]=u[E];if(typeof dF==="object"&&typeof dF.exports==="object")dF.exports=C;else if(typeof define==="function"&&define.amd)define(function(){return C});else D.sha256=C})(l2,function(D){D.__esModule=!0,D.digestLength=32,D.blockSize=64;var F=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function u(Z,B,G,z,T){var W,O,_,V,w,q,h,H,R,j,P,c,t;while(T>=64){W=B[0],O=B[1],_=B[2],V=B[3],w=B[4],q=B[5],h=B[6],H=B[7];for(j=0;j<16;j++)P=z+j*4,Z[j]=(G[P]&255)<<24|(G[P+1]&255)<<16|(G[P+2]&255)<<8|G[P+3]&255;for(j=16;j<64;j++)R=Z[j-2],c=(R>>>17|R<<15)^(R>>>19|R<<13)^R>>>10,R=Z[j-15],t=(R>>>7|R<<25)^(R>>>18|R<<14)^R>>>3,Z[j]=(c+Z[j-7]|0)+(t+Z[j-16]|0);for(j=0;j<64;j++)c=(((w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7))+(w&q^~w&h)|0)+(H+(F[j]+Z[j]|0)|0)|0,t=((W>>>2|W<<30)^(W>>>13|W<<19)^(W>>>22|W<<10))+(W&O^W&_^O&_)|0,H=h,h=q,q=w,w=V+c|0,V=_,_=O,O=W,W=c+t|0;B[0]+=W,B[1]+=O,B[2]+=_,B[3]+=V,B[4]+=w,B[5]+=q,B[6]+=h,B[7]+=H,z+=64,T-=64}return z}var C=function(){function Z(){this.digestLength=D.digestLength,this.blockSize=D.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return Z.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},Z.prototype.clean=function(){for(var B=0;B<this.buffer.length;B++)this.buffer[B]=0;for(var B=0;B<this.temp.length;B++)this.temp[B]=0;this.reset()},Z.prototype.update=function(B,G){if(G===void 0)G=B.length;if(this.finished)throw Error("SHA256: can't update because hash was finished.");var z=0;if(this.bytesHashed+=G,this.bufferLength>0){while(this.bufferLength<64&&G>0)this.buffer[this.bufferLength++]=B[z++],G--;if(this.bufferLength===64)u(this.temp,this.state,this.buffer,0,64),this.bufferLength=0}if(G>=64)z=u(this.temp,this.state,B,z,G),G%=64;while(G>0)this.buffer[this.bufferLength++]=B[z++],G--;return this},Z.prototype.finish=function(B){if(!this.finished){var G=this.bytesHashed,z=this.bufferLength,T=G/536870912|0,W=G<<3,O=G%64<56?64:128;this.buffer[z]=128;for(var _=z+1;_<O-8;_++)this.buffer[_]=0;this.buffer[O-8]=T>>>24&255,this.buffer[O-7]=T>>>16&255,this.buffer[O-6]=T>>>8&255,this.buffer[O-5]=T>>>0&255,this.buffer[O-4]=W>>>24&255,this.buffer[O-3]=W>>>16&255,this.buffer[O-2]=W>>>8&255,this.buffer[O-1]=W>>>0&255,u(this.temp,this.state,this.buffer,0,O),this.finished=!0}for(var _=0;_<8;_++)B[_*4+0]=this.state[_]>>>24&255,B[_*4+1]=this.state[_]>>>16&255,B[_*4+2]=this.state[_]>>>8&255,B[_*4+3]=this.state[_]>>>0&255;return this},Z.prototype.digest=function(){var B=new Uint8Array(this.digestLength);return this.finish(B),B},Z.prototype._saveState=function(B){for(var G=0;G<this.state.length;G++)B[G]=this.state[G]},Z.prototype._restoreState=function(B,G){for(var z=0;z<this.state.length;z++)this.state[z]=B[z];this.bytesHashed=G,this.finished=!1,this.bufferLength=0},Z}();D.Hash=C;var E=function(){function Z(B){this.inner=new C,this.outer=new C,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var G=new Uint8Array(this.blockSize);if(B.length>this.blockSize)new C().update(B).finish(G).clean();else for(var z=0;z<B.length;z++)G[z]=B[z];for(var z=0;z<G.length;z++)G[z]^=54;this.inner.update(G);for(var z=0;z<G.length;z++)G[z]^=106;this.outer.update(G),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var z=0;z<G.length;z++)G[z]=0}return Z.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},Z.prototype.clean=function(){for(var B=0;B<this.istate.length;B++)this.ostate[B]=this.istate[B]=0;this.inner.clean(),this.outer.clean()},Z.prototype.update=function(B){return this.inner.update(B),this},Z.prototype.finish=function(B){if(this.outer.finished)this.outer.finish(B);else this.inner.finish(B),this.outer.update(B,this.digestLength).finish(B);return this},Z.prototype.digest=function(){var B=new Uint8Array(this.digestLength);return this.finish(B),B},Z}();D.HMAC=E;function A(Z){var B=new C().update(Z),G=B.digest();return B.clean(),G}D.hash=A,D.default=A;function $(Z,B){var G=new E(Z).update(B),z=G.digest();return G.clean(),z}D.hmac=$;function Q(Z,B,G,z){var T=z[0];if(T===0)throw Error("hkdf: cannot expand more");if(B.reset(),T>1)B.update(Z);if(G)B.update(G);B.update(z),B.finish(Z),z[0]++}var Y=new Uint8Array(D.digestLength);function J(Z,B,G,z){if(B===void 0)B=Y;if(z===void 0)z=32;var T=new Uint8Array([1]),W=$(B,Z),O=new E(W),_=new Uint8Array(O.digestLength),V=_.length,w=new Uint8Array(z);for(var q=0;q<z;q++){if(V===_.length)Q(_,O,G,T),V=0;w[q]=_[V++]}return O.clean(),_.fill(0),T.fill(0),w}D.hkdf=J;function X(Z,B,G,z){var T=new E(Z),W=T.digestLength,O=new Uint8Array(4),_=new Uint8Array(W),V=new Uint8Array(W),w=new Uint8Array(z);for(var q=0;q*W<z;q++){var h=q+1;O[0]=h>>>24&255,O[1]=h>>>16&255,O[2]=h>>>8&255,O[3]=h>>>0&255,T.reset(),T.update(B),T.update(O),T.finish(V);for(var H=0;H<W;H++)_[H]=V[H];for(var H=2;H<=G;H++){T.reset(),T.update(V).finish(V);for(var R=0;R<W;R++)_[R]^=V[R]}for(var H=0;H<W&&q*W+H<z;H++)w[q*W+H]=_[H]}for(var q=0;q<W;q++)_[q]=V[q]=0;for(var q=0;q<4;q++)O[q]=0;return T.clean(),w}D.pbkdf2=X})});var t2=ZD((a2)=>{Object.defineProperty(a2,"__esModule",{value:!0});a2.Webhook=a2.WebhookVerificationError=void 0;var f8=g2(),n2=d2(),P8=p2(),i2=300;class H0 extends Error{constructor(D){super(D);Object.setPrototypeOf(this,H0.prototype),this.name="ExtendableError",this.stack=Error(D).stack}}class BD extends H0{constructor(D){super(D);Object.setPrototypeOf(this,BD.prototype),this.name="WebhookVerificationError"}}a2.WebhookVerificationError=BD;class OF{constructor(D,F){if(!D)throw Error("Secret can't be empty.");if((F===null||F===void 0?void 0:F.format)==="raw")if(D instanceof Uint8Array)this.key=D;else this.key=Uint8Array.from(D,(u)=>u.charCodeAt(0));else{if(typeof D!=="string")throw Error("Expected secret to be of type string");if(D.startsWith(OF.prefix))D=D.substring(OF.prefix.length);this.key=n2.decode(D)}}verify(D,F){let u={};for(let Z of Object.keys(F))u[Z.toLowerCase()]=F[Z];let C=u["webhook-id"],E=u["webhook-signature"],A=u["webhook-timestamp"];if(!E||!C||!A)throw new BD("Missing required headers");let $=this.verifyTimestamp(A),Y=this.sign(C,$,D).split(",")[1],J=E.split(" "),X=new globalThis.TextEncoder;for(let Z of J){let[B,G]=Z.split(",");if(B!=="v1")continue;if((0,f8.timingSafeEqual)(X.encode(G),X.encode(Y)))return JSON.parse(D.toString())}throw new BD("No matching signature found")}sign(D,F,u){if(typeof u==="string");else if(u.constructor.name==="Buffer")u=u.toString();else throw Error("Expected payload to be of type string or Buffer.");let C=new TextEncoder,E=Math.floor(F.getTime()/1000),A=C.encode(`${D}.${E}.${u}`);return`v1,${n2.encode(P8.hmac(this.key,A))}`}verifyTimestamp(D){let F=Math.floor(Date.now()/1000),u=parseInt(D,10);if(isNaN(u))throw new BD("Invalid Signature Headers");if(F-u>i2)throw new BD("Message timestamp too old");if(u>F+i2)throw new BD("Message timestamp too new");return new Date(u*1000)}}a2.Webhook=OF;OF.prefix="whsec_"});var UF=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",pF=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n",VF=(D)=>D.name==="backspace",x0=(D)=>D.name==="tab",S0=(D)=>"1234567890".includes(D.name),HF=(D)=>D.name==="enter"||D.name==="return";var w0,R0,nF,j0,qF;var iF=M(()=>{w0=class w0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}};R0=class R0 extends Error{name="CancelPromptError";message="Prompt was canceled"};nF=class nF extends Error{name="ExitPromptError"};j0=class j0 extends Error{name="HookError"};qF=class qF extends Error{name="ValidationError"}});import{AsyncLocalStorage as y8,AsyncResource as h8}from"node:async_hooks";function g8(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function Fu(D,F){let u=g8(D);return Du.run(u,()=>{function C(E){u.handleChange=()=>{u.index=0,E()},u.handleChange()}return F(C)})}function YD(){let D=Du.getStore();if(!D)throw new j0("[Inquirer] Hook functions can only be called from within a prompt");return D}function k0(){return YD().rl}function L0(D){let F=(...u)=>{let C=YD(),E=!1,A=C.handleChange;C.handleChange=()=>{E=!0};let $=D(...u);if(E)A();return C.handleChange=A,$};return h8.bind(F)}function pD(D){let F=YD(),{index:u}=F,C={get(){return F.hooks[u]},set(A){F.hooks[u]=A},initialized:u in F.hooks},E=D(C);return F.index++,E}function uu(){YD().handleChange()}var Du,zD;var KD=M(()=>{iF();Du=new y8;zD={queue(D){let F=YD(),{index:u}=F;F.hooksEffect.push(()=>{F.hooksCleanup[u]?.();let C=D(k0());if(C!=null&&typeof C!=="function")throw new qF("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[u]=C})},run(){let D=YD();L0(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=YD();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}}});import{AsyncResource as m8}from"node:async_hooks";function d(D){return pD((F)=>{let u=m8.bind(function(A){if(F.get()!==A)F.set(A),uu()});if(F.initialized)return[F.get(),u];let C=typeof D==="function"?D():D;return F.set(C),[C,u]})}var aF=M(()=>{KD()});function o(D,F){pD((u)=>{let C=u.get();if(!Array.isArray(C)||F.some((A,$)=>!Object.is(A,C[$])))zD.queue(D);u.set(F)})}var rF=M(()=>{KD()});import r from"node:process";function c8(){if(r.platform!=="win32")return r.env.TERM!=="linux";return Boolean(r.env.WT_SESSION)||Boolean(r.env.TERMINUS_SUBLIME)||r.env.ConEmuTask==="{cmd::Cmder}"||r.env.TERM_PROGRAM==="Terminus-Sublime"||r.env.TERM_PROGRAM==="vscode"||r.env.TERM==="xterm-256color"||r.env.TERM==="alacritty"||r.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Cu,Eu,d8,l8,p8,n8,i8,nD,QB;var tF=M(()=>{Cu={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},Eu={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},d8={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},l8={...Cu,...Eu},p8={...Cu,...d8},n8=c8(),i8=n8?l8:p8,nD=i8,QB=Object.entries(Eu)});import{styleText as i}from"node:util";var Bu;var Au=M(()=>{tF();Bu={prefix:{idle:i("blue","?"),done:i("green",nD.tick)},spinner:{interval:80,frames:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"].map((D)=>i("yellow",D))},style:{answer:(D)=>i("cyan",D),message:(D)=>i("bold",D),error:(D)=>i("red",`> ${D}`),defaultAnswer:(D)=>i("dim",`(${D})`),help:(D)=>i("dim",D),highlight:(D)=>i("cyan",D),key:(D)=>i("cyan",i("bold",`<${D}>`))}}});function $u(D){if(typeof D!=="object"||D===null)return!1;let F=D;while(Object.getPrototypeOf(F)!==null)F=Object.getPrototypeOf(F);return Object.getPrototypeOf(D)===F}function Zu(...D){let F={};for(let u of D)for(let[C,E]of Object.entries(u)){let A=F[C];F[C]=$u(A)&&$u(E)?Zu(A,E):E}return F}function _D(...D){let F=[Bu,...D.filter((u)=>u!=null)];return Zu(...F)}var I0=M(()=>{Au()});function MF({status:D="idle",theme:F}){let[u,C]=d(!1),[E,A]=d(0),{prefix:$,spinner:Q}=_D(F);if(o(()=>{if(D==="loading"){let J,X=-1,Z=setTimeout(()=>{C(!0),J=setInterval(()=>{X=X+1,A(X%Q.frames.length)},Q.interval)},300);return()=>{clearTimeout(Z),clearInterval(J)}}else C(!1)},[D]),u)return Q.frames[E];return typeof $==="string"?$:$[D==="loading"?"idle":D]??$.idle}var Qu=M(()=>{aF();rF();I0()});function xF(D,F){return pD((u)=>{let C=u.get();if(!C||C.dependencies.length!==F.length||C.dependencies.some((E,A)=>E!==F[A])){let E=D();return u.set({value:E,dependencies:F}),E}return C.value})}var Gu=M(()=>{KD()});function WD(D){return d({current:D})[0]}var sF=M(()=>{aF()});function SF(D){let F=WD(D);F.current=D,o((u)=>{let C=!1,E=L0((A,$)=>{if(C)return;F.current($,u)});return u.input.on("keypress",E),()=>{C=!0,u.input.removeListener("keypress",E)}},[])}var Ju=M(()=>{sF();rF();KD()});var Yu=ZD((wB,Xu)=>{Xu.exports=r8;function a8(D){let F={defaultWidth:0,output:process.stdout,tty:K2("tty")};if(!D)return F;return Object.keys(F).forEach(function(u){if(!D[u])D[u]=F[u]}),D}function r8(D){let F=a8(D);if(F.output.getWindowSize)return F.output.getWindowSize()[0]||F.defaultWidth;if(F.tty.getWindowSize)return F.tty.getWindowSize()[1]||F.defaultWidth;if(F.output.columns)return F.output.columns;if(process.env.CLI_WIDTH){let u=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(u)&&u!==0)return u}return F.defaultWidth}});function f0({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}function wF(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(t8,"")}var t8;var P0=M(()=>{t8=f0()});function zu(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function Ku(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function _u(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}var Wu=()=>{};function s8(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function Ou(D,{ambiguousAsWide:F=!1}={}){if(s8(D),Ku(D)||_u(D)||F&&zu(D))return 2;return 1}var Tu=M(()=>{Wu()});var Uu=ZD((bB,Nu)=>{Nu.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});function OD(D,F={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:u=!0,countAnsiEscapeCodes:C=!1}=F;if(!C)D=wF(D);if(D.length===0)return 0;let E=0,A={ambiguousAsWide:!u};for(let{segment:$}of o8.segment(D)){let Q=$.codePointAt(0);if(Q<=31||Q>=127&&Q<=159)continue;if(Q>=8203&&Q<=8207||Q===65279)continue;if(Q>=768&&Q<=879||Q>=6832&&Q<=6911||Q>=7616&&Q<=7679||Q>=8400&&Q<=8447||Q>=65056&&Q<=65071)continue;if(Q>=55296&&Q<=57343)continue;if(Q>=65024&&Q<=65039)continue;if(e8.test($))continue;if(Vu.default().test($)){E+=2;continue}E+=Ou(Q,A)}return E}var Vu,o8,e8;var Hu=M(()=>{P0();Tu();Vu=PF(Uu(),1),o8=new Intl.Segmenter,e8=/^\p{Default_Ignorable_Code_Point}$/u});function u6(){let D=new Map;for(let[F,u]of Object.entries(L)){for(let[C,E]of Object.entries(u))L[C]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},u[C]=L[C],D.set(E[0],E[1]);Object.defineProperty(L,F,{value:u,enumerable:!1})}return Object.defineProperty(L,"codes",{value:D,enumerable:!1}),L.color.close="\x1B[39m",L.bgColor.close="\x1B[49m",L.color.ansi=qu(),L.color.ansi256=Mu(),L.color.ansi16m=xu(),L.bgColor.ansi=qu(10),L.bgColor.ansi256=Mu(10),L.bgColor.ansi16m=xu(10),Object.defineProperties(L,{rgbToAnsi256:{value(F,u,C){if(F===u&&u===C){if(F<8)return 16;if(F>248)return 231;return Math.round((F-8)/247*24)+232}return 16+36*Math.round(F/255*5)+6*Math.round(u/255*5)+Math.round(C/255*5)},enumerable:!1},hexToRgb:{value(F){let u=/[a-f\d]{6}|[a-f\d]{3}/i.exec(F.toString(16));if(!u)return[0,0,0];let[C]=u;if(C.length===3)C=[...C].map((A)=>A+A).join("");let E=Number.parseInt(C,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(F)=>L.rgbToAnsi256(...L.hexToRgb(F)),enumerable:!1},ansi256ToAnsi:{value(F){if(F<8)return 30+F;if(F<16)return 90+(F-8);let u,C,E;if(F>=232)u=((F-232)*10+8)/255,C=u,E=u;else{F-=16;let Q=F%36;u=Math.floor(F/36)/5,C=Math.floor(Q/6)/5,E=Q%6/5}let A=Math.max(u,C,E)*2;if(A===0)return 30;let $=30+(Math.round(E)<<2|Math.round(C)<<1|Math.round(u));if(A===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(F,u,C)=>L.ansi256ToAnsi(L.rgbToAnsi256(F,u,C)),enumerable:!1},hexToAnsi:{value:(F)=>L.ansi256ToAnsi(L.hexToAnsi256(F)),enumerable:!1}}),L}var qu=(D=0)=>(F)=>`\x1B[${F+D}m`,Mu=(D=0)=>(F)=>`\x1B[${38+D};5;${F}m`,xu=(D=0)=>(F,u,C)=>`\x1B[${38+D};2;${F};${u};${C}m`,L,gB,D6,F6,mB,C6,Su;var wu=M(()=>{L={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},gB=Object.keys(L.modifier),D6=Object.keys(L.color),F6=Object.keys(L.bgColor),mB=[...D6,...F6];C6=u6(),Su=C6});function y0(D,F,u){return String(D).normalize().replaceAll(`\r
3
3
  `,`
4
4
  `).split(`
5
- `).map((C)=>$6(C,F,u)).join(`
6
- `)}var oF,C6=39,L0="\x07",j2="[",E6="]",k2="m",sF,w2=(D)=>`${oF.values().next().value}${j2}${D}${k2}`,R2=(D)=>`${oF.values().next().value}${sF}${D}${L0}`,B6=(D)=>D.split(" ").map((F)=>_D(F)),I0=(D,F,u)=>{let C=[...F],E=!1,B=!1,$=_D(xF(D.at(-1)));for(let[Q,z]of C.entries()){let X=_D(z);if($+X<=u)D[D.length-1]+=z;else D.push(z),$=0;if(oF.has(z))E=!0,B=C.slice(Q+1,Q+1+sF.length).join("")===sF;if(E){if(B){if(z===L0)E=!1,B=!1}else if(z===k2)E=!1;continue}if($+=X,$===u&&Q<C.length-1)D.push(""),$=0}if(!$&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},A6=(D)=>{let F=D.split(" "),u=F.length;while(u>0){if(_D(F[u-1])>0)break;u--}if(u===F.length)return D;return F.slice(0,u).join(" ")+F.slice(u).join("")},$6=(D,F,u={})=>{if(u.trim!==!1&&D.trim()==="")return"";let C="",E,B,$=B6(D),Q=[""];for(let[Z,A]of D.split(" ").entries()){if(u.trim!==!1)Q[Q.length-1]=Q.at(-1).trimStart();let J=_D(Q.at(-1));if(Z!==0){if(J>=F&&(u.wordWrap===!1||u.trim===!1))Q.push(""),J=0;if(J>0||u.trim===!1)Q[Q.length-1]+=" ",J++}if(u.hard&&$[Z]>F){let G=F-J,T=1+Math.floor(($[Z]-G-1)/F);if(Math.floor(($[Z]-1)/F)<T)Q.push("");I0(Q,A,F);continue}if(J+$[Z]>F&&J>0&&$[Z]>0){if(u.wordWrap===!1&&J<F){I0(Q,A,F);continue}Q.push("")}if(J+$[Z]>F&&u.wordWrap===!1){I0(Q,A,F);continue}Q[Q.length-1]+=A}if(u.trim!==!1)Q=Q.map((Z)=>A6(Z));let z=Q.join(`
7
- `),X=[...z],Y=0;for(let[Z,A]of X.entries()){if(C+=A,oF.has(A)){let{groups:G}=new RegExp(`(?:\\${j2}(?<code>\\d+)m|\\${sF}(?<uri>.*)${L0})`).exec(z.slice(Y))||{groups:{}};if(G.code!==void 0){let T=Number.parseFloat(G.code);E=T===C6?void 0:T}else if(G.uri!==void 0)B=G.uri.length===0?void 0:G.uri}let J=x2.codes.get(Number(E));if(X[Z+1]===`
8
- `){if(B)C+=R2("");if(E&&J)C+=w2(J)}else if(A===`
9
- `){if(E&&J)C+=w2(E);if(B)C+=R2(B)}Y+=A.length}return C};var I2=M(()=>{V2();k0();S2();oF=new Set(["\x1B","›"]),sF=`${E6}8;;`});function SF(D,F){return D.split(`
10
- `).flatMap((u)=>f0(u,F,{trim:!1,hard:!0}).split(`
5
+ `).map((C)=>Z6(C,F,u)).join(`
6
+ `)}var eF,E6=39,v0="\x07",ku="[",B6="]",Lu="m",oF,Ru=(D)=>`${eF.values().next().value}${ku}${D}${Lu}`,ju=(D)=>`${eF.values().next().value}${oF}${D}${v0}`,A6=(D)=>D.split(" ").map((F)=>OD(F)),b0=(D,F,u)=>{let C=[...F],E=!1,A=!1,$=OD(wF(D.at(-1)));for(let[Q,Y]of C.entries()){let J=OD(Y);if($+J<=u)D[D.length-1]+=Y;else D.push(Y),$=0;if(eF.has(Y))E=!0,A=C.slice(Q+1,Q+1+oF.length).join("")===oF;if(E){if(A){if(Y===v0)E=!1,A=!1}else if(Y===Lu)E=!1;continue}if($+=J,$===u&&Q<C.length-1)D.push(""),$=0}if(!$&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},$6=(D)=>{let F=D.split(" "),u=F.length;while(u>0){if(OD(F[u-1])>0)break;u--}if(u===F.length)return D;return F.slice(0,u).join(" ")+F.slice(u).join("")},Z6=(D,F,u={})=>{if(u.trim!==!1&&D.trim()==="")return"";let C="",E,A,$=A6(D),Q=[""];for(let[Z,B]of D.split(" ").entries()){if(u.trim!==!1)Q[Q.length-1]=Q.at(-1).trimStart();let G=OD(Q.at(-1));if(Z!==0){if(G>=F&&(u.wordWrap===!1||u.trim===!1))Q.push(""),G=0;if(G>0||u.trim===!1)Q[Q.length-1]+=" ",G++}if(u.hard&&$[Z]>F){let z=F-G,T=1+Math.floor(($[Z]-z-1)/F);if(Math.floor(($[Z]-1)/F)<T)Q.push("");b0(Q,B,F);continue}if(G+$[Z]>F&&G>0&&$[Z]>0){if(u.wordWrap===!1&&G<F){b0(Q,B,F);continue}Q.push("")}if(G+$[Z]>F&&u.wordWrap===!1){b0(Q,B,F);continue}Q[Q.length-1]+=B}if(u.trim!==!1)Q=Q.map((Z)=>$6(Z));let Y=Q.join(`
7
+ `),J=[...Y],X=0;for(let[Z,B]of J.entries()){if(C+=B,eF.has(B)){let{groups:z}=new RegExp(`(?:\\${ku}(?<code>\\d+)m|\\${oF}(?<uri>.*)${v0})`).exec(Y.slice(X))||{groups:{}};if(z.code!==void 0){let T=Number.parseFloat(z.code);E=T===E6?void 0:T}else if(z.uri!==void 0)A=z.uri.length===0?void 0:z.uri}let G=Su.codes.get(Number(E));if(J[Z+1]===`
8
+ `){if(A)C+=ju("");if(E&&G)C+=Ru(G)}else if(B===`
9
+ `){if(E&&G)C+=Ru(E);if(A)C+=ju(A)}X+=B.length}return C};var Iu=M(()=>{Hu();P0();wu();eF=new Set(["\x1B","›"]),oF=`${B6}8;;`});function RF(D,F){return D.split(`
10
+ `).flatMap((u)=>y0(u,F,{trim:!1,hard:!0}).split(`
11
11
  `).map((C)=>C.trimEnd())).join(`
12
- `)}function eF(){return L2.default({defaultWidth:80,output:S0().output})}var L2;var P0=M(()=>{I2();YD();L2=fF(G2(),1)});function Z6({active:D,renderedItems:F,pageSize:u,loop:C}){let E=KD({lastPointer:D,lastActive:void 0}),{lastPointer:B,lastActive:$}=E.current,Q=Math.floor(u/2),z=F.reduce((Z,A)=>Z+A.length,0),X=F.slice(0,D).reduce((Z,A)=>Z+A.length,0),Y=X;if(z>u)if(C){if(Y=B,$!=null&&$<D&&D-$<u)Y=Math.min(Q,Math.abs(D-$)===1?Math.min(B+(F[$]?.length??0),Math.max(X,B)):B+D-$)}else{let Z=F.slice(D).reduce((A,J)=>A+J.length,0);Y=Z<u-Q?u-Z:Math.min(X,Q)}return E.current.lastPointer=Y,E.current.lastActive=D,Y}function b0({items:D,active:F,renderItem:u,pageSize:C,loop:E=!0}){let B=eF(),$=(O)=>(O%D.length+D.length)%D.length,Q=D.map((O,_)=>{if(O==null)return[];return SF(u({item:O,index:_,isActive:_===F}),B).split(`
13
- `)}),z=Q.reduce((O,_)=>O+_.length,0),X=(O)=>Q[O]??[],Y=Z6({active:F,renderedItems:Q,pageSize:C,loop:E}),Z=X(F).slice(0,C),A=Y+Z.length<=C?Y:C-Z.length,J=Array.from({length:C});J.splice(A,Z.length,...Z);let G=new Set([F]),T=A+Z.length,W=$(F+1);while(T<C&&!G.has(W)&&(E&&z>C?W!==F:W>F)){let _=X(W).slice(0,C-T);J.splice(T,_.length,..._),G.add(W),T+=_.length,W=$(W+1)}T=A-1,W=$(F-1);while(T>=0&&!G.has(W)&&(E&&z>C?W!==F:W<F)){let O=X(W),_=O.slice(Math.max(0,O.length-T-1));J.splice(T-_.length+1,_.length,..._),G.add(W),T-=_.length,W=$(W-1)}return J.filter((O)=>typeof O==="string").join(`
14
- `)}var f2=M(()=>{tF();P0()});var v2=AD((iB,b2)=>{var Q6=zu("stream");class P2 extends Q6{#u=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#F(D,F){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return F}#D(D,...F){if(typeof this._dest?.[D]==="function")this._dest[D](...F);if(typeof this._src?.[D]==="function")this._src[D](...F)}get isTTY(){if(this.#u!==null)return this.#u;return this.#F("isTTY",!1)}set isTTY(D){this.#u=D}get rows(){return this.#F("rows")}get columns(){return this.#F("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,F){return this._dest=D,super.pipe(D,F)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}b2.exports=P2});var WD;var y2=M(()=>{WD=[];WD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")WD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")WD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});class h2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(y0[v0])return y0[v0];J6(y0,v0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let u=this.listeners[D],C=u.indexOf(F);if(C===-1)return;if(C===0&&u.length===1)u.length=0;else u.splice(C,1)}emit(D,F,u){if(this.emitted[D])return!1;this.emitted[D]=!0;let C=!1;for(let E of this.listeners[D])C=E(F,u)===!0||C;if(D==="exit")C=this.emit("afterExit",F,u)||C;return C}}class g0{}var D0=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",v0,y0,J6,X6=(D)=>{return{onExit(F,u){return D.onExit(F,u)},load(){return D.load()},unload(){return D.unload()}}},g2,m2,h0,d2,tB,sB;var c2=M(()=>{y2();v0=Symbol.for("signal-exit emitter"),y0=globalThis,J6=Object.defineProperty.bind(Object);g2=class g2 extends g0{onExit(){return()=>{}}load(){}unload(){}};m2=class m2 extends g0{#u=h0.platform==="win32"?"SIGINT":"SIGHUP";#F=new h2;#D;#B;#A;#E={};#C=!1;constructor(D){super();this.#D=D,this.#E={};for(let F of WD)this.#E[F]=()=>{let u=this.#D.listeners(F),{count:C}=this.#F,E=D;if(typeof E.__signal_exit_emitter__==="object"&&typeof E.__signal_exit_emitter__.count==="number")C+=E.__signal_exit_emitter__.count;if(u.length===C){this.unload();let B=this.#F.emit("exit",null,F),$=F==="SIGHUP"?this.#u:F;if(!B)D.kill(D.pid,$)}};this.#A=D.reallyExit,this.#B=D.emit}onExit(D,F){if(!D0(this.#D))return()=>{};if(this.#C===!1)this.load();let u=F?.alwaysLast?"afterExit":"exit";return this.#F.on(u,D),()=>{if(this.#F.removeListener(u,D),this.#F.listeners.exit.length===0&&this.#F.listeners.afterExit.length===0)this.unload()}}load(){if(this.#C)return;this.#C=!0,this.#F.count+=1;for(let D of WD)try{let F=this.#E[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#Z(D,...F)},this.#D.reallyExit=(D)=>{return this.#$(D)}}unload(){if(!this.#C)return;this.#C=!1,WD.forEach((D)=>{let F=this.#E[D];if(!F)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch(u){}}),this.#D.emit=this.#B,this.#D.reallyExit=this.#A,this.#F.count-=1}#$(D){if(!D0(this.#D))return 0;return this.#D.exitCode=D||0,this.#F.emit("exit",this.#D.exitCode,null),this.#A.call(this.#D,this.#D.exitCode)}#Z(D,...F){let u=this.#B;if(D==="exit"&&D0(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let C=u.call(this.#D,D,...F);return this.#F.emit("exit",this.#D.exitCode,null),C}else return u.call(this.#D,D,...F)}};h0=globalThis.process,{onExit:d2,load:tB,unload:sB}=X6(D0(h0)?new m2(h0):new g2)});var G6="\x1B[G",p2="\x1B[?25l",n2="\x1B[?25h",m0=(D=1)=>D>0?`\x1B[${D}A`:"",d0=(D=1)=>D>0?`\x1B[${D}B`:"",c0=(D,F)=>{if(typeof F==="number"&&!Number.isNaN(F))return`\x1B[${F+1};${D+1}H`;return`\x1B[${D+1}G`},l2="\x1B[2K",l0=(D)=>D>0?(l2+m0(1)).repeat(D-1)+l2+G6:"";import{stripVTControlCharacters as Y6}from"node:util";class F0{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,F=""){let u=z6(D),C=Y6(u),E=C;if(this.rl.line.length>0)E=E.slice(0,-this.rl.line.length);this.rl.setPrompt(E),this.cursorPos=this.rl.getCursorPos();let B=eF();if(D=SF(D,B),F=SF(F,B),C.length%B===0)D+=`
12
+ `)}function D0(){return fu.default({defaultWidth:80,output:k0().output})}var fu;var h0=M(()=>{Iu();KD();fu=PF(Yu(),1)});function Q6({active:D,renderedItems:F,pageSize:u,loop:C}){let E=WD({lastPointer:D,lastActive:void 0}),{lastPointer:A,lastActive:$}=E.current,Q=Math.floor(u/2),Y=F.reduce((Z,B)=>Z+B.length,0),J=F.slice(0,D).reduce((Z,B)=>Z+B.length,0),X=J;if(Y>u)if(C){if(X=A,$!=null&&$<D&&D-$<u)X=Math.min(Q,Math.abs(D-$)===1?Math.min(A+(F[$]?.length??0),Math.max(J,A)):A+D-$)}else{let Z=F.slice(D).reduce((B,G)=>B+G.length,0);X=Z<u-Q?u-Z:Math.min(J,Q)}return E.current.lastPointer=X,E.current.lastActive=D,X}function g0({items:D,active:F,renderItem:u,pageSize:C,loop:E=!0}){let A=D0(),$=(O)=>(O%D.length+D.length)%D.length,Q=D.map((O,_)=>{if(O==null)return[];return RF(u({item:O,index:_,isActive:_===F}),A).split(`
13
+ `)}),Y=Q.reduce((O,_)=>O+_.length,0),J=(O)=>Q[O]??[],X=Q6({active:F,renderedItems:Q,pageSize:C,loop:E}),Z=J(F).slice(0,C),B=X+Z.length<=C?X:C-Z.length,G=Array.from({length:C});G.splice(B,Z.length,...Z);let z=new Set([F]),T=B+Z.length,W=$(F+1);while(T<C&&!z.has(W)&&(E&&Y>C?W!==F:W>F)){let _=J(W).slice(0,C-T);G.splice(T,_.length,..._),z.add(W),T+=_.length,W=$(W+1)}T=B-1,W=$(F-1);while(T>=0&&!z.has(W)&&(E&&Y>C?W!==F:W<F)){let O=J(W),_=O.slice(Math.max(0,O.length-T-1));G.splice(T-_.length+1,_.length,..._),z.add(W),T-=_.length,W=$(W-1)}return G.filter((O)=>typeof O==="string").join(`
14
+ `)}var Pu=M(()=>{sF();h0()});var yu=ZD((eB,vu)=>{var G6=K2("stream");class bu extends G6{#u=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#F(D,F){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return F}#D(D,...F){if(typeof this._dest?.[D]==="function")this._dest[D](...F);if(typeof this._src?.[D]==="function")this._src[D](...F)}get isTTY(){if(this.#u!==null)return this.#u;return this.#F("isTTY",!1)}set isTTY(D){this.#u=D}get rows(){return this.#F("rows")}get columns(){return this.#F("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,F){return this._dest=D,super.pipe(D,F)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}vu.exports=bu});var TD;var hu=M(()=>{TD=[];TD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")TD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")TD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});class gu{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(c0[m0])return c0[m0];J6(c0,m0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let u=this.listeners[D],C=u.indexOf(F);if(C===-1)return;if(C===0&&u.length===1)u.length=0;else u.splice(C,1)}emit(D,F,u){if(this.emitted[D])return!1;this.emitted[D]=!0;let C=!1;for(let E of this.listeners[D])C=E(F,u)===!0||C;if(D==="exit")C=this.emit("afterExit",F,u)||C;return C}}class l0{}var F0=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",m0,c0,J6,X6=(D)=>{return{onExit(F,u){return D.onExit(F,u)},load(){return D.load()},unload(){return D.unload()}}},mu,cu,d0,du,u4,C4;var lu=M(()=>{hu();m0=Symbol.for("signal-exit emitter"),c0=globalThis,J6=Object.defineProperty.bind(Object);mu=class mu extends l0{onExit(){return()=>{}}load(){}unload(){}};cu=class cu extends l0{#u=d0.platform==="win32"?"SIGINT":"SIGHUP";#F=new gu;#D;#B;#A;#E={};#C=!1;constructor(D){super();this.#D=D,this.#E={};for(let F of TD)this.#E[F]=()=>{let u=this.#D.listeners(F),{count:C}=this.#F,E=D;if(typeof E.__signal_exit_emitter__==="object"&&typeof E.__signal_exit_emitter__.count==="number")C+=E.__signal_exit_emitter__.count;if(u.length===C){this.unload();let A=this.#F.emit("exit",null,F),$=F==="SIGHUP"?this.#u:F;if(!A)D.kill(D.pid,$)}};this.#A=D.reallyExit,this.#B=D.emit}onExit(D,F){if(!F0(this.#D))return()=>{};if(this.#C===!1)this.load();let u=F?.alwaysLast?"afterExit":"exit";return this.#F.on(u,D),()=>{if(this.#F.removeListener(u,D),this.#F.listeners.exit.length===0&&this.#F.listeners.afterExit.length===0)this.unload()}}load(){if(this.#C)return;this.#C=!0,this.#F.count+=1;for(let D of TD)try{let F=this.#E[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#Z(D,...F)},this.#D.reallyExit=(D)=>{return this.#$(D)}}unload(){if(!this.#C)return;this.#C=!1,TD.forEach((D)=>{let F=this.#E[D];if(!F)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch(u){}}),this.#D.emit=this.#B,this.#D.reallyExit=this.#A,this.#F.count-=1}#$(D){if(!F0(this.#D))return 0;return this.#D.exitCode=D||0,this.#F.emit("exit",this.#D.exitCode,null),this.#A.call(this.#D,this.#D.exitCode)}#Z(D,...F){let u=this.#B;if(D==="exit"&&F0(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let C=u.call(this.#D,D,...F);return this.#F.emit("exit",this.#D.exitCode,null),C}else return u.call(this.#D,D,...F)}};d0=globalThis.process,{onExit:du,load:u4,unload:C4}=X6(F0(d0)?new cu(d0):new mu)});var Y6="\x1B[G",nu="\x1B[?25l",iu="\x1B[?25h",p0=(D=1)=>D>0?`\x1B[${D}A`:"",n0=(D=1)=>D>0?`\x1B[${D}B`:"",i0=(D,F)=>{if(typeof F==="number"&&!Number.isNaN(F))return`\x1B[${F+1};${D+1}H`;return`\x1B[${D+1}G`},pu="\x1B[2K",a0=(D)=>D>0?(pu+p0(1)).repeat(D-1)+pu+Y6:"";import{stripVTControlCharacters as z6}from"node:util";class u0{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,F=""){let u=K6(D),C=z6(u),E=C;if(this.rl.line.length>0)E=E.slice(0,-this.rl.line.length);this.rl.setPrompt(E),this.cursorPos=this.rl.getCursorPos();let A=D0();if(D=RF(D,A),F=RF(F,A),C.length%A===0)D+=`
15
15
  `;let $=D+(F?`
16
- `+F:""),z=Math.floor(C.length/B)-this.cursorPos.rows+(F?i2(F):0);if(z>0)$+=m0(z);$+=c0(this.cursorPos.cols),this.write(d0(this.extraLinesUnderPrompt)+l0(this.height)+$),this.extraLinesUnderPrompt=z,this.height=i2($)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(c0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let F=d0(this.extraLinesUnderPrompt);F+=D?l0(this.height):`
17
- `,F+=n2,this.write(F),this.rl.close()}}var i2=(D)=>D.split(`
18
- `).length,z6=(D)=>D.split(`
19
- `).pop()??"";var a2=M(()=>{P0()});var p0;var r2=M(()=>{p0=class p0 extends Promise{static withResolver(){let D,F;return{promise:new Promise((C,E)=>{D=C,F=E}),resolve:D,reject:F}}}});import*as t2 from"node:readline";import{AsyncResource as K6}from"node:async_hooks";function _6(){let D=Error.prepareStackTrace,F=[];try{Error.prepareStackTrace=(u,C)=>{let E=C.slice(1);return F=E,E},Error().stack}catch{return F}return Error.prepareStackTrace=D,F}function wF(D){let F=_6();return(C,E={})=>{let{input:B=process.stdin,signal:$}=E,Q=new Set,z=new s2.default;z.pipe(E.output??process.stdout);let X=t2.createInterface({terminal:!0,input:B,output:z}),Y=new F0(X),{promise:Z,resolve:A,reject:J}=p0.withResolver(),G=()=>J(new M0);if($){let O=()=>J(new q0({cause:$.reason}));if($.aborted)return O(),Object.assign(Z,{cancel:G});$.addEventListener("abort",O),Q.add(()=>$.removeEventListener("abort",O))}Q.add(d2((O,_)=>{J(new pF(`User force closed the prompt with ${O} ${_}`))}));let T=()=>J(new pF("User force closed the prompt with SIGINT"));X.on("SIGINT",T),Q.add(()=>X.removeListener("SIGINT",T));let W=()=>Y.checkCursorPos();return X.input.on("keypress",W),Q.add(()=>X.input.removeListener("keypress",W)),D2(X,(O)=>{let _=K6.bind(()=>GD.clearAll());return X.on("close",_),Q.add(()=>X.removeListener("close",_)),O(()=>{try{let V=D(C,(b)=>{setImmediate(()=>A(b))});if(V===void 0){let b=F[1]?.getFileName();throw Error(`Prompt functions must return a string.
20
- at ${b}`)}let[S,q]=typeof V==="string"?[V]:V;Y.render(S,q),GD.run()}catch(V){J(V)}}),Object.assign(Z.then((V)=>{return GD.clearAll(),V},(V)=>{throw GD.clearAll(),V}).finally(()=>{Q.forEach((V)=>V()),Y.done({clearContent:Boolean(E.clearPromptOnDone)}),z.end()}).then(()=>Z),{cancel:G})})}}var s2;var o2=M(()=>{c2();a2();r2();YD();nF();s2=fF(v2(),1)});import{styleText as W6}from"node:util";class ED{separator=W6("dim",Array.from({length:15}).join(lD.line));type="separator";constructor(D){if(D)this.separator=D}static isSeparator(D){return Boolean(D&&typeof D==="object"&&"type"in D&&D.type==="separator")}}var e2=M(()=>{rF()});var n0=M(()=>{Z2();iF();aF();Q2();tF();J2();R0();f2();o2();e2();nF()});var O6,j;var D3=M(()=>{n0();O6={validationFailureMode:"keep"},j=wF((D,F)=>{let{prefill:u="tab"}=D,C=zD(O6,D.theme),[E,B]=g("idle"),[$="",Q]=g(D.default),[z,X]=g(),[Y,Z]=g(""),A=HF({status:E,theme:C});async function J(_){let{required:V,pattern:S,patternError:q="Invalid input"}=D;if(V&&!_)return"You must provide a value";if(S&&!S.test(_))return q;if(typeof D.validate==="function")return await D.validate(_)||"You must provide a valid value";return!0}MF(async(_,V)=>{if(E!=="idle")return;if(UF(_)){let S=Y||$;B("loading");let q=await J(S);if(q===!0)Z(S),B("done"),F(S);else{if(C.validationFailureMode==="clear")Z("");else V.write(Y);X(q),B("idle")}}else if(NF(_)&&!Y)Q(void 0);else if(V0(_)&&!Y)Q(void 0),V.clearLine(0),V.write($),Z($);else Z(V.line),X(void 0)}),t((_)=>{if(u==="editable"&&$)_.write($),Z($)},[]);let G=C.style.message(D.message,E),T=Y;if(typeof D.transformer==="function")T=D.transformer(Y,{isFinal:E==="done"});else if(E==="done")T=C.style.answer(Y);let W;if($&&E!=="done"&&!Y)W=C.style.defaultAnswer($);let O="";if(z)O=C.style.error(z);return[[A,G,W,T].filter((_)=>_!==void 0).join(" "),O]})});import{styleText as RF}from"node:util";function pD(D){return!ED.isSeparator(D)&&!D.disabled}function N6(D){return D.map((F)=>{if(ED.isSeparator(F))return F;if(typeof F!=="object"||F===null||!("value"in F)){let E=String(F);return{value:F,name:E,short:E,disabled:!1}}let u=F.name??String(F.value),C={value:F.value,name:u,short:F.short??u,disabled:F.disabled??!1};if(F.description)C.description=F.description;return C})}var T6,nD;var F3=M(()=>{n0();rF();T6={icon:{cursor:lD.pointer},style:{disabled:(D)=>RF("dim",`- ${D}`),description:(D)=>RF("cyan",D),keysHelpTip:(D)=>D.map(([F,u])=>`${RF("bold",F)} ${RF("dim",u)}`).join(RF("dim"," • "))},indexMode:"hidden",keybindings:[]};nD=wF((D,F)=>{let{loop:u=!0,pageSize:C=7}=D,E=zD(T6,D.theme),{keybindings:B}=E,[$,Q]=g("idle"),z=HF({status:$,theme:E}),X=KD(),Y=!B.includes("vim"),Z=qF(()=>N6(D.choices),[D.choices]),A=qF(()=>{let H=Z.findIndex(pD),w=Z.findLastIndex(pD);if(H===-1)throw new VF("[select prompt] No selectable choices. All choices are disabled.");return{first:H,last:w}},[Z]),J=qF(()=>{if(!("default"in D))return-1;return Z.findIndex((H)=>pD(H)&&H.value===D.default)},[D.default,Z]),[G,T]=g(J===-1?A.first:J),W=Z[G];MF((H,w)=>{if(clearTimeout(X.current),UF(H))Q("done"),F(W.value);else if(TF(H,B)||lF(H,B)){if(w.clearLine(0),u||TF(H,B)&&G!==A.first||lF(H,B)&&G!==A.last){let R=TF(H,B)?-1:1,f=G;do f=(f+R+Z.length)%Z.length;while(!pD(Z[f]));T(f)}}else if(H0(H)&&!Number.isNaN(Number(w.line))){let R=Number(w.line)-1,f=-1,h=Z.findIndex((tD)=>{if(ED.isSeparator(tD))return!1;return f++,f===R}),a=Z[h];if(a!=null&&pD(a))T(h);X.current=setTimeout(()=>{w.clearLine(0)},700)}else if(NF(H))w.clearLine(0);else if(Y){let R=w.line.toLowerCase(),f=Z.findIndex((h)=>{if(ED.isSeparator(h)||!pD(h))return!1;return h.name.toLowerCase().startsWith(R)});if(f!==-1)T(f);X.current=setTimeout(()=>{w.clearLine(0)},700)}}),t(()=>()=>{clearTimeout(X.current)},[]);let O=E.style.message(D.message,$),_=E.style.keysHelpTip([["↑↓","navigate"],["⏎","select"]]),V=0,S=b0({items:Z,active:G,renderItem({item:H,isActive:w,index:R}){if(ED.isSeparator(H))return V++,` ${H.separator}`;let f=E.indexMode==="number"?`${R+1-V}. `:"";if(H.disabled){let tD=typeof H.disabled==="string"?H.disabled:"(disabled)";return E.style.disabled(`${f}${H.name} ${tD}`)}let h=w?E.style.highlight:(tD)=>tD,a=w?E.icon.cursor:" ";return h(`${a} ${f}${H.name}`)},pageSize:C,loop:u});if($==="done")return[z,O,E.style.answer(W.short)].filter(Boolean).join(" ");let{description:q}=W;return`${[[z,O].filter(Boolean).join(" "),S," ",q?E.style.description(q):"",_].filter(Boolean).join(`
21
- `).trimEnd()}${p2}`})});var i0=M(()=>{D3();F3()});var N3;var U3=M(()=>{N3=["subscription.active","subscription.updated","subscription.on_hold","subscription.renewed","subscription.plan_changed","subscription.cancelled","subscription.failed","subscription.expired","payment.success","payment.failed","payment.processing","payment.cancelled","licence.created","refund.success","refund.failed","dispute.opened","dispute.expired","dispute.accepted","dispute.cancelled","dispute.challenged","dispute.won","dispute.lost"]});var BD=({business_id:D="bus_test",product_id:F="pdt_test",subscription_id:u="sub_test",qty:C=1,metadata:E})=>{return{business_id:D,data:{addons:[],billing:{city:"New York",country:"US",state:"New York",street:"11th Main",zipcode:"12345"},cancel_at_next_billing_date:!1,cancelled_at:null,created_at:new Date().toISOString(),currency:"USD",customer:{customer_id:"cus_123456",email:"test@acme.com",name:"Test user",phone_number:null},discount_cycles_remaining:null,discount_id:null,expires_at:null,metadata:E,meters:[],next_billing_date:new Date(new Date().setMonth(new Date().getMonth()+1)),on_demand:!1,payload_type:"Subscription",payment_frequency_count:1,payment_frequency_interval:"Month",previous_billing_date:new Date().toISOString(),product_id:F,quantity:C,recurring_pre_tax_amount:400,status:"active",subscription_id:u,subscription_period_count:10,subscription_period_interval:"Year",tax_inclusive:!1,trial_period_days:0},timestamp:new Date().toISOString()}},V3=(D)=>{return{...BD(D),type:"subscription.active"}},H3=(D)=>{let F=BD(D);return{...F,type:"subscription.updated",data:{...F.data,status:"active"}}},q3=(D)=>{let F=BD(D);return{...F,type:"subscription.on_hold",data:{...F.data,status:"on_hold"}}},M3=(D)=>{return{...BD(D),type:"subscription.renewed"}},x3=(D)=>{let F=BD(D);return{...F,type:"subscription.plan_changed",data:{...F.data,status:"active"}}},S3=(D)=>{let F=BD(D);return{...F,type:"subscription.cancelled",data:{...F.data,cancel_at_next_billing_date:!0,status:"cancelled"}}},w3=(D)=>{let F=BD(D);return{...F,type:"subscription.failed",data:{...F.data,status:"failed"}}},R3=(D)=>{let F=BD(D);return{...F,type:"subscription.expired",data:{...F.data,status:"expired"}}};var j3=()=>{};var A0=({business_id:D="bus_test",product_id:F="pdt_test",qty:u=1})=>{return{business_id:D,data:{billing:{city:"New York",country:"US",state:"New York",street:"New York, New York",zipcode:"12345"},brand_id:D,business_id:D,card_issuing_country:"GB",card_last_four:"4242",card_network:"VISA",card_type:"CREDIT",checkout_session_id:"cks_123",created_at:new Date().toISOString(),currency:"USD",customer:{customer_id:"cus_test",email:"test@acme.com",metadata:{},name:"Test user",phone_number:"+15555550100"},digital_products_delivered:!1,discount_id:null,disputes:[],error_code:null,error_message:null,invoice_id:"inv_test",metadata:{},payload_type:"Payment",payment_id:"pay_test",payment_link:"https://test.checkout.dodopayments.com/cbq",payment_method:"card",payment_method_type:"card",product_cart:[{product_id:F,quantity:u}],refunds:[],settlement_amount:400,settlement_currency:"USD",settlement_tax:null,status:"succeeded",subscription_id:null,tax:null,total_amount:400,updated_at:null},timestamp:new Date().toISOString()}},k3=(D)=>{return{...A0(D),type:"payment.succeeded"}},I3=(D)=>{return{...A0(D),type:"payment.failed"}},L3=(D)=>{return{...A0(D),type:"payment.processing"}},f3=(D)=>{return{...A0(D),type:"payment.cancelled"}};var P3=()=>{};var b3=({business_id:D="bus_test"})=>{return{business_id:D,data:{amount:400,business_id:D,created_at:new Date().toISOString(),currency:"USD",customer:{customer_id:"cus_test",email:"test@acme.com",name:"Test user",phone_number:null},is_partial:!1,payload_type:"Refund",payment_id:"pay_test",reason:"Testing success refund",refund_id:"ref_test",status:"succeeded"},timestamp:new Date().toISOString()}},v3=(D)=>{return{...b3(D),type:"refund.succeeded"}},y3=(D)=>{return{...b3(D),type:"refund.failed"}};var h3=()=>{};var ND=({business_id:D="bus_test"})=>{return{business_id:D,data:{amount:400,business_id:D,created_at:new Date().toISOString(),currency:"USD",customer:{customer_id:"cus_test",email:"test@acme.com",name:"Test user",phone_number:"+447700900123"},dispute_id:"dp_test",dispute_stage:"dispute",dispute_status:"dispute_opened",payload_type:"Dispute",payment_id:"pay_test",reason:"testing dispute",remarks:null},timestamp:new Date().toISOString()}},g3=(D)=>{let F=ND(D);return{...F,type:"dispute.opened",data:{...F.data,dispute_status:"dispute_opened"}}},m3=(D)=>{let F=ND(D);return{...F,type:"dispute.expired",data:{...F.data,dispute_status:"dispute_expired"}}},d3=(D)=>{let F=ND(D);return{...F,type:"dispute.accepted",data:{...F.data,dispute_status:"dispute_accepted"}}},c3=(D)=>{let F=ND(D);return{...F,type:"dispute.cancelled",data:{...F.data,dispute_status:"dispute_cancelled"}}},l3=(D)=>{let F=ND(D);return{...F,type:"dispute.challenged",data:{...F.data,dispute_status:"dispute_challenged"}}},p3=(D)=>{let F=ND(D);return{...F,type:"dispute.won",data:{...F.data,dispute_status:"dispute_won"}}},n3=(D)=>{let F=ND(D);return{...F,type:"dispute.lost",data:{...F.data,dispute_status:"dispute_lost"}}};var i3=()=>{};var CC=({business_id:D="bus_test",product_id:F="pdt_test",subscription_id:u})=>{return{business_id:D,data:{activations_limit:null,business_id:D,created_at:new Date().toISOString(),customer_id:"cus_test",expires_at:null,id:"lic_test",instances_count:0,key:"db44b22c-fe9b-4a68-bf0d-b0e0d6c6c8c0",payload_type:"LicenseKey",payment_id:"pay_test",product_id:F,status:"active",subscription_id:u},timestamp:new Date().toISOString()}},a3=(D)=>{return{...CC(D),type:"license_key.created"}};var r3=()=>{};var AC={};var EC,kF,Qu,BC;var t3=M(async()=>{i0();U3();j3();P3();h3();i3();r3();EC=await j({message:"What is your endpoint?",validate:(D)=>{if(!D.startsWith("http"))return"Please enter a valid URL starting with http or https";return!0}}),kF=await j({message:"What is your Dodo Payments business ID? (Optional)",default:"bus_test"}),Qu=await j({message:"What is your product ID? (Optional)",default:"pdt_test"}),BC=await j({message:"What is your metadata? (JSON stringified, Optional)",default:"{}"});while(!0){let D=await nD({message:"Select an event to send:",choices:[...N3,"exit"].map((C)=>({value:C,name:C})),loop:!1});if(D==="exit")console.log("Exiting..."),process.exit();let F,u=JSON.parse(BC);if(D.startsWith("subscription.")){let C={business_id:kF,product_id:Qu,metadata:u};if(D==="subscription.active")F=V3(C);else if(D==="subscription.updated")F=H3(C);else if(D==="subscription.on_hold")F=q3(C);else if(D==="subscription.renewed")F=M3(C);else if(D==="subscription.plan_changed")F=x3(C);else if(D==="subscription.cancelled")F=S3(C);else if(D==="subscription.failed")F=w3(C);else if(D==="subscription.expired")F=R3(C)}if(D.startsWith("payment.")){let C={business_id:kF,product_id:Qu,metadata:u};if(D==="payment.success")F=k3(C);else if(D==="payment.failed")F=I3(C);else if(D==="payment.processing")F=L3(C);else if(D==="payment.cancelled")F=f3(C)}if(D.startsWith("refund.")){let C={business_id:kF};if(D==="refund.success")F=v3(C);else if(D==="refund.failed")F=y3(C)}if(D.startsWith("dispute.")){let C={business_id:kF};if(D==="dispute.opened")F=g3(C);else if(D==="dispute.expired")F=m3(C);else if(D==="dispute.accepted")F=d3(C);else if(D==="dispute.cancelled")F=c3(C);else if(D==="dispute.challenged")F=l3(C);else if(D==="dispute.won")F=p3(C);else if(D==="dispute.lost")F=n3(C)}if(D.startsWith("licence.")){let C={business_id:kF,product_id:Qu};if(D==="licence.created")F=a3(C)}await fetch(EC,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}).then(async(C)=>{console.log(`✅ Webhook Event Sent!
16
+ `+F:""),Y=Math.floor(C.length/A)-this.cursorPos.rows+(F?au(F):0);if(Y>0)$+=p0(Y);$+=i0(this.cursorPos.cols),this.write(n0(this.extraLinesUnderPrompt)+a0(this.height)+$),this.extraLinesUnderPrompt=Y,this.height=au($)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(i0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let F=n0(this.extraLinesUnderPrompt);F+=D?a0(this.height):`
17
+ `,F+=iu,this.write(F),this.rl.close()}}var au=(D)=>D.split(`
18
+ `).length,K6=(D)=>D.split(`
19
+ `).pop()??"";var ru=M(()=>{h0()});var r0;var tu=M(()=>{r0=class r0 extends Promise{static withResolver(){let D,F;return{promise:new Promise((C,E)=>{D=C,F=E}),resolve:D,reject:F}}}});import*as su from"node:readline";import{AsyncResource as _6}from"node:async_hooks";function W6(){let D=Error.prepareStackTrace,F=[];try{Error.prepareStackTrace=(u,C)=>{let E=C.slice(1);return F=E,E},Error().stack}catch{return F}return Error.prepareStackTrace=D,F}function jF(D){let F=W6();return(C,E={})=>{let{input:A=process.stdin,signal:$}=E,Q=new Set,Y=new ou.default;Y.pipe(E.output??process.stdout);let J=su.createInterface({terminal:!0,input:A,output:Y}),X=new u0(J),{promise:Z,resolve:B,reject:G}=r0.withResolver(),z=()=>G(new R0);if($){let O=()=>G(new w0({cause:$.reason}));if($.aborted)return O(),Object.assign(Z,{cancel:z});$.addEventListener("abort",O),Q.add(()=>$.removeEventListener("abort",O))}Q.add(du((O,_)=>{G(new nF(`User force closed the prompt with ${O} ${_}`))}));let T=()=>G(new nF("User force closed the prompt with SIGINT"));J.on("SIGINT",T),Q.add(()=>J.removeListener("SIGINT",T));let W=()=>X.checkCursorPos();return J.input.on("keypress",W),Q.add(()=>J.input.removeListener("keypress",W)),Fu(J,(O)=>{let _=_6.bind(()=>zD.clearAll());return J.on("close",_),Q.add(()=>J.removeListener("close",_)),O(()=>{try{let V=D(C,(h)=>{setImmediate(()=>B(h))});if(V===void 0){let h=F[1]?.getFileName();throw Error(`Prompt functions must return a string.
20
+ at ${h}`)}let[w,q]=typeof V==="string"?[V]:V;X.render(w,q),zD.run()}catch(V){G(V)}}),Object.assign(Z.then((V)=>{return zD.clearAll(),V},(V)=>{throw zD.clearAll(),V}).finally(()=>{Q.forEach((V)=>V()),X.done({clearContent:Boolean(E.clearPromptOnDone)}),Y.end()}).then(()=>Z),{cancel:z})})}}var ou;var eu=M(()=>{lu();ru();tu();KD();iF();ou=PF(yu(),1)});import{styleText as O6}from"node:util";class AD{separator=O6("dim",Array.from({length:15}).join(nD.line));type="separator";constructor(D){if(D)this.separator=D}static isSeparator(D){return Boolean(D&&typeof D==="object"&&"type"in D&&D.type==="separator")}}var D3=M(()=>{tF()});var t0=M(()=>{Qu();aF();rF();Gu();sF();Ju();I0();Pu();eu();D3();iF()});var T6,x;var F3=M(()=>{t0();T6={validationFailureMode:"keep"},x=jF((D,F)=>{let{prefill:u="tab"}=D,C=_D(T6,D.theme),[E,A]=d("idle"),[$="",Q]=d(D.default),[Y,J]=d(),[X,Z]=d(""),B=MF({status:E,theme:C});async function G(_){let{required:V,pattern:w,patternError:q="Invalid input"}=D;if(V&&!_)return"You must provide a value";if(w&&!w.test(_))return q;if(typeof D.validate==="function")return await D.validate(_)||"You must provide a valid value";return!0}SF(async(_,V)=>{if(E!=="idle")return;if(HF(_)){let w=X||$;A("loading");let q=await G(w);if(q===!0)Z(w),A("done"),F(w);else{if(C.validationFailureMode==="clear")Z("");else V.write(X);J(q),A("idle")}}else if(VF(_)&&!X)Q(void 0);else if(x0(_)&&!X)Q(void 0),V.clearLine(0),V.write($),Z($);else Z(V.line),J(void 0)}),o((_)=>{if(u==="editable"&&$)_.write($),Z($)},[]);let z=C.style.message(D.message,E),T=X;if(typeof D.transformer==="function")T=D.transformer(X,{isFinal:E==="done"});else if(E==="done")T=C.style.answer(X);let W;if($&&E!=="done"&&!X)W=C.style.defaultAnswer($);let O="";if(Y)O=C.style.error(Y);return[[B,z,W,T].filter((_)=>_!==void 0).join(" "),O]})});import{styleText as kF}from"node:util";function iD(D){return!AD.isSeparator(D)&&!D.disabled}function U6(D){return D.map((F)=>{if(AD.isSeparator(F))return F;if(typeof F!=="object"||F===null||!("value"in F)){let E=String(F);return{value:F,name:E,short:E,disabled:!1}}let u=F.name??String(F.value),C={value:F.value,name:u,short:F.short??u,disabled:F.disabled??!1};if(F.description)C.description=F.description;return C})}var N6,e;var u3=M(()=>{t0();tF();N6={icon:{cursor:nD.pointer},style:{disabled:(D)=>kF("dim",`- ${D}`),description:(D)=>kF("cyan",D),keysHelpTip:(D)=>D.map(([F,u])=>`${kF("bold",F)} ${kF("dim",u)}`).join(kF("dim"," • "))},indexMode:"hidden",keybindings:[]};e=jF((D,F)=>{let{loop:u=!0,pageSize:C=7}=D,E=_D(N6,D.theme),{keybindings:A}=E,[$,Q]=d("idle"),Y=MF({status:$,theme:E}),J=WD(),X=!A.includes("vim"),Z=xF(()=>U6(D.choices),[D.choices]),B=xF(()=>{let H=Z.findIndex(iD),R=Z.findLastIndex(iD);if(H===-1)throw new qF("[select prompt] No selectable choices. All choices are disabled.");return{first:H,last:R}},[Z]),G=xF(()=>{if(!("default"in D))return-1;return Z.findIndex((H)=>iD(H)&&H.value===D.default)},[D.default,Z]),[z,T]=d(G===-1?B.first:G),W=Z[z];SF((H,R)=>{if(clearTimeout(J.current),HF(H))Q("done"),F(W.value);else if(UF(H,A)||pF(H,A)){if(R.clearLine(0),u||UF(H,A)&&z!==B.first||pF(H,A)&&z!==B.last){let j=UF(H,A)?-1:1,P=z;do P=(P+j+Z.length)%Z.length;while(!iD(Z[P]));T(P)}}else if(S0(H)&&!Number.isNaN(Number(R.line))){let j=Number(R.line)-1,P=-1,c=Z.findIndex((oD)=>{if(AD.isSeparator(oD))return!1;return P++,P===j}),t=Z[c];if(t!=null&&iD(t))T(c);J.current=setTimeout(()=>{R.clearLine(0)},700)}else if(VF(H))R.clearLine(0);else if(X){let j=R.line.toLowerCase(),P=Z.findIndex((c)=>{if(AD.isSeparator(c)||!iD(c))return!1;return c.name.toLowerCase().startsWith(j)});if(P!==-1)T(P);J.current=setTimeout(()=>{R.clearLine(0)},700)}}),o(()=>()=>{clearTimeout(J.current)},[]);let O=E.style.message(D.message,$),_=E.style.keysHelpTip([["↑↓","navigate"],["⏎","select"]]),V=0,w=g0({items:Z,active:z,renderItem({item:H,isActive:R,index:j}){if(AD.isSeparator(H))return V++,` ${H.separator}`;let P=E.indexMode==="number"?`${j+1-V}. `:"";if(H.disabled){let oD=typeof H.disabled==="string"?H.disabled:"(disabled)";return E.style.disabled(`${P}${H.name} ${oD}`)}let c=R?E.style.highlight:(oD)=>oD,t=R?E.icon.cursor:" ";return c(`${t} ${P}${H.name}`)},pageSize:C,loop:u});if($==="done")return[Y,O,E.style.answer(W.short)].filter(Boolean).join(" ");let{description:q}=W;return`${[[Y,O].filter(Boolean).join(" "),w," ",q?E.style.description(q):"",_].filter(Boolean).join(`
21
+ `).trimEnd()}${nu}`})});var C0=M(()=>{F3();u3()});var U3;var V3=M(()=>{U3=["subscription.active","subscription.updated","subscription.on_hold","subscription.renewed","subscription.plan_changed","subscription.cancelled","subscription.failed","subscription.expired","payment.success","payment.failed","payment.processing","payment.cancelled","licence.created","refund.success","refund.failed","dispute.opened","dispute.expired","dispute.accepted","dispute.cancelled","dispute.challenged","dispute.won","dispute.lost"]});var $D=({business_id:D="bus_test",product_id:F="pdt_test",subscription_id:u="sub_test",qty:C=1,metadata:E})=>{return{business_id:D,data:{addons:[],billing:{city:"New York",country:"US",state:"New York",street:"11th Main",zipcode:"12345"},cancel_at_next_billing_date:!1,cancelled_at:null,created_at:new Date().toISOString(),currency:"USD",customer:{customer_id:"cus_123456",email:"test@acme.com",name:"Test user",phone_number:null},discount_cycles_remaining:null,discount_id:null,expires_at:null,metadata:E,meters:[],next_billing_date:new Date(new Date().setMonth(new Date().getMonth()+1)),on_demand:!1,payload_type:"Subscription",payment_frequency_count:1,payment_frequency_interval:"Month",previous_billing_date:new Date().toISOString(),product_id:F,quantity:C,recurring_pre_tax_amount:400,status:"active",subscription_id:u,subscription_period_count:10,subscription_period_interval:"Year",tax_inclusive:!1,trial_period_days:0},timestamp:new Date().toISOString()}},H3=(D)=>{return{...$D(D),type:"subscription.active"}},q3=(D)=>{let F=$D(D);return{...F,type:"subscription.updated",data:{...F.data,status:"active"}}},M3=(D)=>{let F=$D(D);return{...F,type:"subscription.on_hold",data:{...F.data,status:"on_hold"}}},x3=(D)=>{return{...$D(D),type:"subscription.renewed"}},S3=(D)=>{let F=$D(D);return{...F,type:"subscription.plan_changed",data:{...F.data,status:"active"}}},w3=(D)=>{let F=$D(D);return{...F,type:"subscription.cancelled",data:{...F.data,cancel_at_next_billing_date:!0,status:"cancelled"}}},R3=(D)=>{let F=$D(D);return{...F,type:"subscription.failed",data:{...F.data,status:"failed"}}},j3=(D)=>{let F=$D(D);return{...F,type:"subscription.expired",data:{...F.data,status:"expired"}}};var k3=()=>{};var Q0=({business_id:D="bus_test",product_id:F="pdt_test",qty:u=1})=>{return{business_id:D,data:{billing:{city:"New York",country:"US",state:"New York",street:"New York, New York",zipcode:"12345"},brand_id:D,business_id:D,card_issuing_country:"GB",card_last_four:"4242",card_network:"VISA",card_type:"CREDIT",checkout_session_id:"cks_123",created_at:new Date().toISOString(),currency:"USD",customer:{customer_id:"cus_test",email:"test@acme.com",metadata:{},name:"Test user",phone_number:"+15555550100"},digital_products_delivered:!1,discount_id:null,disputes:[],error_code:null,error_message:null,invoice_id:"inv_test",metadata:{},payload_type:"Payment",payment_id:"pay_test",payment_link:"https://test.checkout.dodopayments.com/cbq",payment_method:"card",payment_method_type:"card",product_cart:[{product_id:F,quantity:u}],refunds:[],settlement_amount:400,settlement_currency:"USD",settlement_tax:null,status:"succeeded",subscription_id:null,tax:null,total_amount:400,updated_at:null},timestamp:new Date().toISOString()}},L3=(D)=>{return{...Q0(D),type:"payment.succeeded"}},I3=(D)=>{return{...Q0(D),type:"payment.failed"}},f3=(D)=>{return{...Q0(D),type:"payment.processing"}},P3=(D)=>{return{...Q0(D),type:"payment.cancelled"}};var b3=()=>{};var v3=({business_id:D="bus_test"})=>{return{business_id:D,data:{amount:400,business_id:D,created_at:new Date().toISOString(),currency:"USD",customer:{customer_id:"cus_test",email:"test@acme.com",name:"Test user",phone_number:null},is_partial:!1,payload_type:"Refund",payment_id:"pay_test",reason:"Testing success refund",refund_id:"ref_test",status:"succeeded"},timestamp:new Date().toISOString()}},y3=(D)=>{return{...v3(D),type:"refund.succeeded"}},h3=(D)=>{return{...v3(D),type:"refund.failed"}};var g3=()=>{};var UD=({business_id:D="bus_test"})=>{return{business_id:D,data:{amount:400,business_id:D,created_at:new Date().toISOString(),currency:"USD",customer:{customer_id:"cus_test",email:"test@acme.com",name:"Test user",phone_number:"+447700900123"},dispute_id:"dp_test",dispute_stage:"dispute",dispute_status:"dispute_opened",payload_type:"Dispute",payment_id:"pay_test",reason:"testing dispute",remarks:null},timestamp:new Date().toISOString()}},m3=(D)=>{let F=UD(D);return{...F,type:"dispute.opened",data:{...F.data,dispute_status:"dispute_opened"}}},c3=(D)=>{let F=UD(D);return{...F,type:"dispute.expired",data:{...F.data,dispute_status:"dispute_expired"}}},d3=(D)=>{let F=UD(D);return{...F,type:"dispute.accepted",data:{...F.data,dispute_status:"dispute_accepted"}}},l3=(D)=>{let F=UD(D);return{...F,type:"dispute.cancelled",data:{...F.data,dispute_status:"dispute_cancelled"}}},p3=(D)=>{let F=UD(D);return{...F,type:"dispute.challenged",data:{...F.data,dispute_status:"dispute_challenged"}}},n3=(D)=>{let F=UD(D);return{...F,type:"dispute.won",data:{...F.data,dispute_status:"dispute_won"}}},i3=(D)=>{let F=UD(D);return{...F,type:"dispute.lost",data:{...F.data,dispute_status:"dispute_lost"}}};var a3=()=>{};var E1=({business_id:D="bus_test",product_id:F="pdt_test",subscription_id:u})=>{return{business_id:D,data:{activations_limit:null,business_id:D,created_at:new Date().toISOString(),customer_id:"cus_test",expires_at:null,id:"lic_test",instances_count:0,key:"db44b22c-fe9b-4a68-bf0d-b0e0d6c6c8c0",payload_type:"LicenseKey",payment_id:"pay_test",product_id:F,status:"active",subscription_id:u},timestamp:new Date().toISOString()}},r3=(D)=>{return{...E1(D),type:"license_key.created"}};var t3=()=>{};var $1={};var B1,IF,X2,A1;var s3=M(async()=>{C0();V3();k3();b3();g3();a3();t3();B1=await x({message:"What is your endpoint?",validate:(D)=>{if(!D.startsWith("http"))return"Please enter a valid URL starting with http or https";return!0}}),IF=await x({message:"What is your Dodo Payments business ID? (Optional)",default:"bus_test"}),X2=await x({message:"What is your product ID? (Optional)",default:"pdt_test"}),A1=await x({message:"What is your metadata? (JSON stringified, Optional)",default:"{}"});while(!0){let D=await e({message:"Select an event to send:",choices:[...U3,"exit"].map((C)=>({value:C,name:C})),loop:!1});if(D==="exit")console.log("Exiting..."),process.exit();let F,u=JSON.parse(A1);if(D.startsWith("subscription.")){let C={business_id:IF,product_id:X2,metadata:u};if(D==="subscription.active")F=H3(C);else if(D==="subscription.updated")F=q3(C);else if(D==="subscription.on_hold")F=M3(C);else if(D==="subscription.renewed")F=x3(C);else if(D==="subscription.plan_changed")F=S3(C);else if(D==="subscription.cancelled")F=w3(C);else if(D==="subscription.failed")F=R3(C);else if(D==="subscription.expired")F=j3(C)}if(D.startsWith("payment.")){let C={business_id:IF,product_id:X2,metadata:u};if(D==="payment.success")F=L3(C);else if(D==="payment.failed")F=I3(C);else if(D==="payment.processing")F=f3(C);else if(D==="payment.cancelled")F=P3(C)}if(D.startsWith("refund.")){let C={business_id:IF};if(D==="refund.success")F=y3(C);else if(D==="refund.failed")F=h3(C)}if(D.startsWith("dispute.")){let C={business_id:IF};if(D==="dispute.opened")F=m3(C);else if(D==="dispute.expired")F=c3(C);else if(D==="dispute.accepted")F=d3(C);else if(D==="dispute.cancelled")F=l3(C);else if(D==="dispute.challenged")F=p3(C);else if(D==="dispute.won")F=n3(C);else if(D==="dispute.lost")F=i3(C)}if(D.startsWith("licence.")){let C={business_id:IF,product_id:X2};if(D==="licence.created")F=r3(C)}await fetch(B1,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}).then(async(C)=>{console.log(`✅ Webhook Event Sent!
22
22
  Received Response Code: ${C.status}
23
- Received Response Body: ${await C.text()}`),console.log()}).catch((C)=>{console.error("❌ Webhook Event Failed:",C),console.log()})}});import $C from"node:os";import UD from"node:path";function qD(D,F,u,C,E){if(C==="m")throw TypeError("Private method is not writable");if(C==="a"&&!E)throw TypeError("Private accessor was defined without a setter");if(typeof F==="function"?D!==F||!E:!F.has(D))throw TypeError("Cannot write private member to an object whose class did not declare it");return C==="a"?E.call(D,u):E?E.value=u:F.set(D,u),u}function e(D,F,u,C){if(u==="a"&&!C)throw TypeError("Private accessor was defined without a getter");if(typeof F==="function"?D!==F||!C:!F.has(D))throw TypeError("Cannot read private member from an object whose class did not declare it");return u==="m"?C:u==="a"?C.call(D):C?C.value:F.get(D)}var Z0=function(){let{crypto:D}=globalThis;if(D?.randomUUID)return Z0=D.randomUUID.bind(D),D.randomUUID();let F=new Uint8Array(1),u=D?()=>D.getRandomValues(F)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(C)=>(+C^u()&15>>+C/4).toString(16))};function Ku(D){return typeof D==="object"&&D!==null&&(("name"in D)&&D.name==="AbortError"||("message"in D)&&String(D.message).includes("FetchRequestCanceledException"))}var sD=(D)=>{if(D instanceof Error)return D;if(typeof D==="object"&&D!==null){try{if(Object.prototype.toString.call(D)==="[object Error]"){let F=Error(D.message,D.cause?{cause:D.cause}:{});if(D.stack)F.stack=D.stack;if(D.cause&&!F.cause)F.cause=D.cause;if(D.name)F.name=D.name;return F}}catch{}try{return Error(JSON.stringify(D))}catch{}}return Error(D)};class v extends Error{}class P extends v{constructor(D,F,u,C){super(`${P.makeMessage(D,F,u)}`);this.status=D,this.headers=C,this.error=F}static makeMessage(D,F,u){let C=F?.message?typeof F.message==="string"?F.message:JSON.stringify(F.message):F?JSON.stringify(F):u;if(D&&C)return`${D} ${C}`;if(D)return`${D} status code (no body)`;if(C)return C;return"(no status code or body)"}static generate(D,F,u,C){if(!D||!C)return new $D({message:u,cause:sD(F)});let E=F;if(D===400)return new eD(D,E,u,C);if(D===401)return new DF(D,E,u,C);if(D===403)return new FF(D,E,u,C);if(D===404)return new uF(D,E,u,C);if(D===409)return new CF(D,E,u,C);if(D===422)return new EF(D,E,u,C);if(D===429)return new BF(D,E,u,C);if(D>=500)return new AF(D,E,u,C);return new P(D,E,u,C)}}class MD extends P{constructor({message:D}={}){super(void 0,void 0,D||"Request was aborted.",void 0)}}class $D extends P{constructor({message:D,cause:F}){super(void 0,void 0,D||"Connection error.",void 0);if(F)this.cause=F}}class oD extends $D{constructor({message:D}={}){super({message:D??"Request timed out."})}}class eD extends P{}class DF extends P{}class FF extends P{}class uF extends P{}class CF extends P{}class EF extends P{}class BF extends P{}class AF extends P{}var B8=/^[a-z][a-z0-9+.-]*:/i,_u=(D)=>{return B8.test(D)},Q0=(D)=>(Q0=Array.isArray,Q0(D)),J0=Q0;function X0(D){if(typeof D!=="object")return{};return D??{}}function Wu(D){if(!D)return!0;for(let F in D)return!1;return!0}function Ou(D,F){return Object.prototype.hasOwnProperty.call(D,F)}var Tu=(D,F)=>{if(typeof F!=="number"||!Number.isInteger(F))throw new v(`${D} must be an integer`);if(F<0)throw new v(`${D} must be a positive integer`);return F};var Nu=(D)=>{try{return JSON.parse(D)}catch(F){return}};var Uu=(D)=>new Promise((F)=>setTimeout(F,D));var DD="2.17.2";function A8(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var $8=()=>{let D=A8();if(D==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DD,"X-Stainless-OS":Hu(Deno.build.os),"X-Stainless-Arch":Vu(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DD,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(D==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DD,"X-Stainless-OS":Hu(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Vu(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let F=Z8();if(F)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DD,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${F.browser}`,"X-Stainless-Runtime-Version":F.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DD,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Z8(){if(typeof navigator>"u"||!navigator)return null;let D=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:F,pattern:u}of D){let C=u.exec(navigator.userAgent);if(C){let E=C[1]||0,B=C[2]||0,$=C[3]||0;return{browser:F,version:`${E}.${B}.${$}`}}}return null}var Vu=(D)=>{if(D==="x32")return"x32";if(D==="x86_64"||D==="x64")return"x64";if(D==="arm")return"arm";if(D==="aarch64"||D==="arm64")return"arm64";if(D)return`other:${D}`;return"unknown"},Hu=(D)=>{if(D=D.toLowerCase(),D.includes("ios"))return"iOS";if(D==="android")return"Android";if(D==="darwin")return"MacOS";if(D==="win32")return"Windows";if(D==="freebsd")return"FreeBSD";if(D==="openbsd")return"OpenBSD";if(D==="linux")return"Linux";if(D)return`Other:${D}`;return"Unknown"},qu,Mu=()=>{return qu??(qu=$8())};function xu(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new DodoPayments({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Q8(...D){let F=globalThis.ReadableStream;if(typeof F>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new F(...D)}function G0(D){let F=Symbol.asyncIterator in D?D[Symbol.asyncIterator]():D[Symbol.iterator]();return Q8({start(){},async pull(u){let{done:C,value:E}=await F.next();if(C)u.close();else u.enqueue(E)},async cancel(){await F.return?.()}})}async function Su(D){if(D===null||typeof D!=="object")return;if(D[Symbol.asyncIterator]){await D[Symbol.asyncIterator]().return?.();return}let F=D.getReader(),u=F.cancel();F.releaseLock(),await u}var wu=({headers:D,body:F})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(F)}};var bF={off:0,error:200,warn:300,info:400,debug:500},Y0=(D,F,u)=>{if(!D)return;if(Ou(bF,D))return D;y(u).warn(`${F} was set to ${JSON.stringify(D)}, expected one of ${JSON.stringify(Object.keys(bF))}`);return};function $F(){}function PF(D,F,u){if(!F||bF[D]>bF[u])return $F;else return F[D].bind(F)}var G8={error:$F,warn:$F,info:$F,debug:$F},Ru=new WeakMap;function y(D){let F=D.logger,u=D.logLevel??"off";if(!F)return G8;let C=Ru.get(F);if(C&&C[0]===u)return C[1];let E={error:PF("error",F,u),warn:PF("warn",F,u),info:PF("info",F,u),debug:PF("debug",F,u)};return Ru.set(F,[u,E]),E}var r=(D)=>{if(D.options)D.options={...D.options},delete D.options.headers;if(D.headers)D.headers=Object.fromEntries((D.headers instanceof Headers?[...D.headers]:Object.entries(D.headers)).map(([F,u])=>[F,F.toLowerCase()==="authorization"||F.toLowerCase()==="cookie"||F.toLowerCase()==="set-cookie"?"***":u]));if("retryOfRequestLogID"in D){if(D.retryOfRequestLogID)D.retryOf=D.retryOfRequestLogID;delete D.retryOfRequestLogID}return D};async function vF(D,F){let{response:u,requestLogID:C,retryOfRequestLogID:E,startTime:B}=F,$=await(async()=>{if(u.status===204)return null;if(F.options.__binaryResponse)return u;let z=u.headers.get("content-type")?.split(";")[0]?.trim();if(z?.includes("application/json")||z?.endsWith("+json"))return await u.json();return await u.text()})();return y(D).debug(`[${C}] response parsed`,r({retryOfRequestLogID:E,url:u.url,status:u.status,body:$,durationMs:Date.now()-B})),$}var ZF;class ZD extends Promise{constructor(D,F,u=vF){super((C)=>{C(null)});this.responsePromise=F,this.parseResponse=u,ZF.set(this,void 0),qD(this,ZF,D,"f")}_thenUnwrap(D){return new ZD(e(this,ZF,"f"),this.responsePromise,async(F,u)=>D(await this.parseResponse(F,u),u))}asResponse(){return this.responsePromise.then((D)=>D.response)}async withResponse(){let[D,F]=await Promise.all([this.parse(),this.asResponse()]);return{data:D,response:F}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((D)=>this.parseResponse(e(this,ZF,"f"),D));return this.parsedPromise}then(D,F){return this.parse().then(D,F)}catch(D){return this.parse().catch(D)}finally(D){return this.parse().finally(D)}}ZF=new WeakMap;var yF;class z0{constructor(D,F,u,C){yF.set(this,void 0),qD(this,yF,D,"f"),this.options=C,this.response=F,this.body=u}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let D=this.nextPageRequestOptions();if(!D)throw new v("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await e(this,yF,"f").requestAPIList(this.constructor,D)}async*iterPages(){let D=this;yield D;while(D.hasNextPage())D=await D.getNextPage(),yield D}async*[(yF=new WeakMap,Symbol.asyncIterator)](){for await(let D of this.iterPages())for(let F of D.getPaginatedItems())yield F}}class hF extends ZD{constructor(D,F,u){super(D,F,async(C,E)=>new u(C,E.response,await vF(C,E),E.options))}async*[Symbol.asyncIterator](){let D=await this;for await(let F of D)yield F}}class x extends z0{constructor(D,F,u,C){super(D,F,u,C);this.items=u.items||[]}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){let F=this.options.query?.page_number??1;return{...this.options,query:{...X0(this.options.query),page_number:F+1}}}}class K0 extends z0{constructor(D,F,u,C){super(D,F,u,C);this.data=u.data||[],this.iterator=u.iterator||"",this.done=u.done||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.done===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let D=this.iterator;if(!D)return null;return{...this.options,query:{...X0(this.options.query),iterator:D}}}}var _0=()=>{if(typeof File>"u"){let{process:D}=globalThis,F=typeof D?.versions?.node==="string"&&parseInt(D.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(F?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function gF(D,F,u){return _0(),new File(D,F??"unknown_file",u)}function ju(D){return(typeof D==="object"&&D!==null&&(("name"in D)&&D.name&&String(D.name)||("url"in D)&&D.url&&String(D.url)||("filename"in D)&&D.filename&&String(D.filename)||("path"in D)&&D.path&&String(D.path))||"").split(/[\\/]/).pop()||void 0}var ku=(D)=>D!=null&&typeof D==="object"&&typeof D[Symbol.asyncIterator]==="function";var Iu=(D)=>D!=null&&typeof D==="object"&&typeof D.size==="number"&&typeof D.type==="string"&&typeof D.text==="function"&&typeof D.slice==="function"&&typeof D.arrayBuffer==="function",z8=(D)=>D!=null&&typeof D==="object"&&typeof D.name==="string"&&typeof D.lastModified==="number"&&Iu(D),K8=(D)=>D!=null&&typeof D==="object"&&typeof D.url==="string"&&typeof D.blob==="function";async function mF(D,F,u){if(_0(),D=await D,z8(D)){if(D instanceof File)return D;return gF([await D.arrayBuffer()],D.name)}if(K8(D)){let E=await D.blob();return F||(F=new URL(D.url).pathname.split(/[\\/]/).pop()),gF(await W0(E),F,u)}let C=await W0(D);if(F||(F=ju(D)),!u?.type){let E=C.find((B)=>typeof B==="object"&&("type"in B)&&B.type);if(typeof E==="string")u={...u,type:E}}return gF(C,F,u)}async function W0(D){let F=[];if(typeof D==="string"||ArrayBuffer.isView(D)||D instanceof ArrayBuffer)F.push(D);else if(Iu(D))F.push(D instanceof Blob?D:await D.arrayBuffer());else if(ku(D))for await(let u of D)F.push(...await W0(u));else{let u=D?.constructor?.name;throw Error(`Unexpected data type: ${typeof D}${u?`; constructor: ${u}`:""}${_8(D)}`)}return F}function _8(D){if(typeof D!=="object"||D===null)return"";return`; props: [${Object.getOwnPropertyNames(D).map((u)=>`"${u}"`).join(", ")}]`}class N{constructor(D){this._client=D}}function fu(D){return D.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Lu=Object.freeze(Object.create(null)),O8=(D=fu)=>function(u,...C){if(u.length===1)return u[0];let E=!1,B=[],$=u.reduce((Y,Z,A)=>{if(/[?#]/.test(Z))E=!0;let J=C[A],G=(E?encodeURIComponent:D)(""+J);if(A!==C.length&&(J==null||typeof J==="object"&&J.toString===Object.getPrototypeOf(Object.getPrototypeOf(J.hasOwnProperty??Lu)??Lu)?.toString))G=J+"",B.push({start:Y.length+Z.length,length:G.length,error:`Value of type ${Object.prototype.toString.call(J).slice(8,-1)} is not a valid path parameter`});return Y+Z+(A===C.length?"":G)},""),Q=$.split(/[?#]/,1)[0],z=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,X;while((X=z.exec(Q))!==null)B.push({start:X.index,length:X[0].length,error:`Value "${X[0]}" can't be safely passed as a path parameter`});if(B.sort((Y,Z)=>Y.start-Z.start),B.length>0){let Y=0,Z=B.reduce((A,J)=>{let G=" ".repeat(J.start-Y),T="^".repeat(J.length);return Y=J.start+J.length,A+G+T},"");throw new v(`Path parameters result in path with invalid segments:
24
- ${B.map((A)=>A.error).join(`
23
+ Received Response Body: ${await C.text()}`),console.log()}).catch((C)=>{console.error("❌ Webhook Event Failed:",C),console.log()})}});import Z1 from"node:os";import VD from"node:path";function MD(D,F,u,C,E){if(C==="m")throw TypeError("Private method is not writable");if(C==="a"&&!E)throw TypeError("Private accessor was defined without a setter");if(typeof F==="function"?D!==F||!E:!F.has(D))throw TypeError("Cannot write private member to an object whose class did not declare it");return C==="a"?E.call(D,u):E?E.value=u:F.set(D,u),u}function FD(D,F,u,C){if(u==="a"&&!C)throw TypeError("Private accessor was defined without a getter");if(typeof F==="function"?D!==F||!C:!F.has(D))throw TypeError("Cannot read private member from an object whose class did not declare it");return u==="m"?C:u==="a"?C.call(D):C?C.value:F.get(D)}var X0=function(){let{crypto:D}=globalThis;if(D?.randomUUID)return X0=D.randomUUID.bind(D),D.randomUUID();let F=new Uint8Array(1),u=D?()=>D.getRandomValues(F)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(C)=>(+C^u()&15>>+C/4).toString(16))};function _2(D){return typeof D==="object"&&D!==null&&(("name"in D)&&D.name==="AbortError"||("message"in D)&&String(D.message).includes("FetchRequestCanceledException"))}var eD=(D)=>{if(D instanceof Error)return D;if(typeof D==="object"&&D!==null){try{if(Object.prototype.toString.call(D)==="[object Error]"){let F=Error(D.message,D.cause?{cause:D.cause}:{});if(D.stack)F.stack=D.stack;if(D.cause&&!F.cause)F.cause=D.cause;if(D.name)F.name=D.name;return F}}catch{}try{return Error(JSON.stringify(D))}catch{}}return Error(D)};class g extends Error{}class v extends g{constructor(D,F,u,C){super(`${v.makeMessage(D,F,u)}`);this.status=D,this.headers=C,this.error=F}static makeMessage(D,F,u){let C=F?.message?typeof F.message==="string"?F.message:JSON.stringify(F.message):F?JSON.stringify(F):u;if(D&&C)return`${D} ${C}`;if(D)return`${D} status code (no body)`;if(C)return C;return"(no status code or body)"}static generate(D,F,u,C){if(!D||!C)return new QD({message:u,cause:eD(F)});let E=F;if(D===400)return new FF(D,E,u,C);if(D===401)return new uF(D,E,u,C);if(D===403)return new CF(D,E,u,C);if(D===404)return new EF(D,E,u,C);if(D===409)return new BF(D,E,u,C);if(D===422)return new AF(D,E,u,C);if(D===429)return new $F(D,E,u,C);if(D>=500)return new ZF(D,E,u,C);return new v(D,E,u,C)}}class xD extends v{constructor({message:D}={}){super(void 0,void 0,D||"Request was aborted.",void 0)}}class QD extends v{constructor({message:D,cause:F}){super(void 0,void 0,D||"Connection error.",void 0);if(F)this.cause=F}}class DF extends QD{constructor({message:D}={}){super({message:D??"Request timed out."})}}class FF extends v{}class uF extends v{}class CF extends v{}class EF extends v{}class BF extends v{}class AF extends v{}class $F extends v{}class ZF extends v{}var A8=/^[a-z][a-z0-9+.-]*:/i,W2=(D)=>{return A8.test(D)},Y0=(D)=>(Y0=Array.isArray,Y0(D)),z0=Y0;function K0(D){if(typeof D!=="object")return{};return D??{}}function O2(D){if(!D)return!0;for(let F in D)return!1;return!0}function T2(D,F){return Object.prototype.hasOwnProperty.call(D,F)}var N2=(D,F)=>{if(typeof F!=="number"||!Number.isInteger(F))throw new g(`${D} must be an integer`);if(F<0)throw new g(`${D} must be a positive integer`);return F};var U2=(D)=>{try{return JSON.parse(D)}catch(F){return}};var V2=(D)=>new Promise((F)=>setTimeout(F,D));var uD="2.19.0";function $8(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var Z8=()=>{let D=$8();if(D==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uD,"X-Stainless-OS":q2(Deno.build.os),"X-Stainless-Arch":H2(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uD,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(D==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uD,"X-Stainless-OS":q2(globalThis.process.platform??"unknown"),"X-Stainless-Arch":H2(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let F=Q8();if(F)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uD,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${F.browser}`,"X-Stainless-Runtime-Version":F.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uD,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Q8(){if(typeof navigator>"u"||!navigator)return null;let D=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:F,pattern:u}of D){let C=u.exec(navigator.userAgent);if(C){let E=C[1]||0,A=C[2]||0,$=C[3]||0;return{browser:F,version:`${E}.${A}.${$}`}}}return null}var H2=(D)=>{if(D==="x32")return"x32";if(D==="x86_64"||D==="x64")return"x64";if(D==="arm")return"arm";if(D==="aarch64"||D==="arm64")return"arm64";if(D)return`other:${D}`;return"unknown"},q2=(D)=>{if(D=D.toLowerCase(),D.includes("ios"))return"iOS";if(D==="android")return"Android";if(D==="darwin")return"MacOS";if(D==="win32")return"Windows";if(D==="freebsd")return"FreeBSD";if(D==="openbsd")return"OpenBSD";if(D==="linux")return"Linux";if(D)return`Other:${D}`;return"Unknown"},M2,x2=()=>{return M2??(M2=Z8())};function S2(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new DodoPayments({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function G8(...D){let F=globalThis.ReadableStream;if(typeof F>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new F(...D)}function _0(D){let F=Symbol.asyncIterator in D?D[Symbol.asyncIterator]():D[Symbol.iterator]();return G8({start(){},async pull(u){let{done:C,value:E}=await F.next();if(C)u.close();else u.enqueue(E)},async cancel(){await F.return?.()}})}async function w2(D){if(D===null||typeof D!=="object")return;if(D[Symbol.asyncIterator]){await D[Symbol.asyncIterator]().return?.();return}let F=D.getReader(),u=F.cancel();F.releaseLock(),await u}var R2=({headers:D,body:F})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(F)}};var vF={off:0,error:200,warn:300,info:400,debug:500},W0=(D,F,u)=>{if(!D)return;if(T2(vF,D))return D;m(u).warn(`${F} was set to ${JSON.stringify(D)}, expected one of ${JSON.stringify(Object.keys(vF))}`);return};function QF(){}function bF(D,F,u){if(!F||vF[D]>vF[u])return QF;else return F[D].bind(F)}var Y8={error:QF,warn:QF,info:QF,debug:QF},j2=new WeakMap;function m(D){let F=D.logger,u=D.logLevel??"off";if(!F)return Y8;let C=j2.get(F);if(C&&C[0]===u)return C[1];let E={error:bF("error",F,u),warn:bF("warn",F,u),info:bF("info",F,u),debug:bF("debug",F,u)};return j2.set(F,[u,E]),E}var s=(D)=>{if(D.options)D.options={...D.options},delete D.options.headers;if(D.headers)D.headers=Object.fromEntries((D.headers instanceof Headers?[...D.headers]:Object.entries(D.headers)).map(([F,u])=>[F,F.toLowerCase()==="authorization"||F.toLowerCase()==="cookie"||F.toLowerCase()==="set-cookie"?"***":u]));if("retryOfRequestLogID"in D){if(D.retryOfRequestLogID)D.retryOf=D.retryOfRequestLogID;delete D.retryOfRequestLogID}return D};async function yF(D,F){let{response:u,requestLogID:C,retryOfRequestLogID:E,startTime:A}=F,$=await(async()=>{if(u.status===204)return null;if(F.options.__binaryResponse)return u;let Y=u.headers.get("content-type")?.split(";")[0]?.trim();if(Y?.includes("application/json")||Y?.endsWith("+json")){if(u.headers.get("content-length")==="0")return;return await u.json()}return await u.text()})();return m(D).debug(`[${C}] response parsed`,s({retryOfRequestLogID:E,url:u.url,status:u.status,body:$,durationMs:Date.now()-A})),$}var GF;class GD extends Promise{constructor(D,F,u=yF){super((C)=>{C(null)});this.responsePromise=F,this.parseResponse=u,GF.set(this,void 0),MD(this,GF,D,"f")}_thenUnwrap(D){return new GD(FD(this,GF,"f"),this.responsePromise,async(F,u)=>D(await this.parseResponse(F,u),u))}asResponse(){return this.responsePromise.then((D)=>D.response)}async withResponse(){let[D,F]=await Promise.all([this.parse(),this.asResponse()]);return{data:D,response:F}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((D)=>this.parseResponse(FD(this,GF,"f"),D));return this.parsedPromise}then(D,F){return this.parse().then(D,F)}catch(D){return this.parse().catch(D)}finally(D){return this.parse().finally(D)}}GF=new WeakMap;var hF;class O0{constructor(D,F,u,C){hF.set(this,void 0),MD(this,hF,D,"f"),this.options=C,this.response=F,this.body=u}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let D=this.nextPageRequestOptions();if(!D)throw new g("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await FD(this,hF,"f").requestAPIList(this.constructor,D)}async*iterPages(){let D=this;yield D;while(D.hasNextPage())D=await D.getNextPage(),yield D}async*[(hF=new WeakMap,Symbol.asyncIterator)](){for await(let D of this.iterPages())for(let F of D.getPaginatedItems())yield F}}class gF extends GD{constructor(D,F,u){super(D,F,async(C,E)=>new u(C,E.response,await yF(C,E),E.options))}async*[Symbol.asyncIterator](){let D=await this;for await(let F of D)yield F}}class S extends O0{constructor(D,F,u,C){super(D,F,u,C);this.items=u.items||[]}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){let F=this.options.query?.page_number??1;return{...this.options,query:{...K0(this.options.query),page_number:F+1}}}}class T0 extends O0{constructor(D,F,u,C){super(D,F,u,C);this.data=u.data||[],this.iterator=u.iterator||"",this.done=u.done||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.done===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let D=this.iterator;if(!D)return null;return{...this.options,query:{...K0(this.options.query),iterator:D}}}}var N0=()=>{if(typeof File>"u"){let{process:D}=globalThis,F=typeof D?.versions?.node==="string"&&parseInt(D.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(F?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function mF(D,F,u){return N0(),new File(D,F??"unknown_file",u)}function k2(D){return(typeof D==="object"&&D!==null&&(("name"in D)&&D.name&&String(D.name)||("url"in D)&&D.url&&String(D.url)||("filename"in D)&&D.filename&&String(D.filename)||("path"in D)&&D.path&&String(D.path))||"").split(/[\\/]/).pop()||void 0}var L2=(D)=>D!=null&&typeof D==="object"&&typeof D[Symbol.asyncIterator]==="function";var I2=(D)=>D!=null&&typeof D==="object"&&typeof D.size==="number"&&typeof D.type==="string"&&typeof D.text==="function"&&typeof D.slice==="function"&&typeof D.arrayBuffer==="function",K8=(D)=>D!=null&&typeof D==="object"&&typeof D.name==="string"&&typeof D.lastModified==="number"&&I2(D),_8=(D)=>D!=null&&typeof D==="object"&&typeof D.url==="string"&&typeof D.blob==="function";async function cF(D,F,u){if(N0(),D=await D,K8(D)){if(D instanceof File)return D;return mF([await D.arrayBuffer()],D.name)}if(_8(D)){let E=await D.blob();return F||(F=new URL(D.url).pathname.split(/[\\/]/).pop()),mF(await U0(E),F,u)}let C=await U0(D);if(F||(F=k2(D)),!u?.type){let E=C.find((A)=>typeof A==="object"&&("type"in A)&&A.type);if(typeof E==="string")u={...u,type:E}}return mF(C,F,u)}async function U0(D){let F=[];if(typeof D==="string"||ArrayBuffer.isView(D)||D instanceof ArrayBuffer)F.push(D);else if(I2(D))F.push(D instanceof Blob?D:await D.arrayBuffer());else if(L2(D))for await(let u of D)F.push(...await U0(u));else{let u=D?.constructor?.name;throw Error(`Unexpected data type: ${typeof D}${u?`; constructor: ${u}`:""}${W8(D)}`)}return F}function W8(D){if(typeof D!=="object"||D===null)return"";return`; props: [${Object.getOwnPropertyNames(D).map((u)=>`"${u}"`).join(", ")}]`}class N{constructor(D){this._client=D}}function P2(D){return D.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var f2=Object.freeze(Object.create(null)),T8=(D=P2)=>function(u,...C){if(u.length===1)return u[0];let E=!1,A=[],$=u.reduce((X,Z,B)=>{if(/[?#]/.test(Z))E=!0;let G=C[B],z=(E?encodeURIComponent:D)(""+G);if(B!==C.length&&(G==null||typeof G==="object"&&G.toString===Object.getPrototypeOf(Object.getPrototypeOf(G.hasOwnProperty??f2)??f2)?.toString))z=G+"",A.push({start:X.length+Z.length,length:z.length,error:`Value of type ${Object.prototype.toString.call(G).slice(8,-1)} is not a valid path parameter`});return X+Z+(B===C.length?"":z)},""),Q=$.split(/[?#]/,1)[0],Y=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,J;while((J=Y.exec(Q))!==null)A.push({start:J.index,length:J[0].length,error:`Value "${J[0]}" can't be safely passed as a path parameter`});if(A.sort((X,Z)=>X.start-Z.start),A.length>0){let X=0,Z=A.reduce((B,G)=>{let z=" ".repeat(G.start-X),T="^".repeat(G.length);return X=G.start+G.length,B+z+T},"");throw new g(`Path parameters result in path with invalid segments:
24
+ ${A.map((B)=>B.error).join(`
25
25
  `)}
26
26
  ${$}
27
- ${Z}`)}return $},K=O8(fu);class xD extends N{create(D,F){return this._client.post("/addons",{body:D,...F})}retrieve(D,F){return this._client.get(K`/addons/${D}`,F)}update(D,F,u){return this._client.patch(K`/addons/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/addons",x,{query:D,...F})}updateImages(D,F){return this._client.put(K`/addons/${D}/images`,F)}}class SD extends N{create(D,F){return this._client.post("/brands",{body:D,...F})}retrieve(D,F){return this._client.get(K`/brands/${D}`,F)}update(D,F,u){return this._client.patch(K`/brands/${D}`,{body:F,...u})}list(D){return this._client.get("/brands",D)}updateImages(D,F){return this._client.put(K`/brands/${D}/images`,F)}}class wD extends N{create(D,F){return this._client.post("/checkouts",{body:D,...F})}retrieve(D,F){return this._client.get(K`/checkouts/${D}`,F)}preview(D,F){return this._client.post("/checkouts/preview",{body:D,...F})}}class QF extends N{create(D,F={},u){let{send_email:C}=F??{};return this._client.post(K`/customers/${D}/customer-portal/session`,{query:{send_email:C},...u})}}class JF extends N{create(D,F,u){return this._client.post(K`/customers/${D}/wallets/ledger-entries`,{body:F,...u})}list(D,F={},u){return this._client.getAPIList(K`/customers/${D}/wallets/ledger-entries`,x,{query:F,...u})}}class RD extends N{constructor(){super(...arguments);this.ledgerEntries=new JF(this._client)}list(D,F){return this._client.get(K`/customers/${D}/wallets`,F)}}RD.LedgerEntries=JF;class FD extends N{constructor(){super(...arguments);this.customerPortal=new QF(this._client),this.wallets=new RD(this._client)}create(D,F){return this._client.post("/customers",{body:D,...F})}retrieve(D,F){return this._client.get(K`/customers/${D}`,F)}update(D,F,u){return this._client.patch(K`/customers/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/customers",x,{query:D,...F})}retrievePaymentMethods(D,F){return this._client.get(K`/customers/${D}/payment-methods`,F)}}FD.CustomerPortal=QF;FD.Wallets=RD;var Pu=Symbol("brand.privateNullableHeaders");function*V8(D){if(!D)return;if(Pu in D){let{values:C,nulls:E}=D;yield*C.entries();for(let B of E)yield[B,null];return}let F=!1,u;if(D instanceof Headers)u=D.entries();else if(J0(D))u=D;else F=!0,u=Object.entries(D??{});for(let C of u){let E=C[0];if(typeof E!=="string")throw TypeError("expected header name to be a string");let B=J0(C[1])?C[1]:[C[1]],$=!1;for(let Q of B){if(Q===void 0)continue;if(F&&!$)$=!0,yield[E,null];yield[E,Q]}}}var k=(D)=>{let F=new Headers,u=new Set;for(let C of D){let E=new Set;for(let[B,$]of V8(C)){let Q=B.toLowerCase();if(!E.has(Q))F.delete(B),E.add(Q);if($===null)F.delete(B),u.add(Q);else F.append(B,$),u.delete(Q)}}return{[Pu]:!0,values:F,nulls:u}};class jD extends N{create(D,F){return this._client.post("/discounts",{body:D,...F})}retrieve(D,F){return this._client.get(K`/discounts/${D}`,F)}update(D,F,u){return this._client.patch(K`/discounts/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/discounts",x,{query:D,...F})}delete(D,F){return this._client.delete(K`/discounts/${D}`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}retrieveByCode(D,F){return this._client.get(K`/discounts/code/${D}`,F)}}class kD extends N{retrieve(D,F){return this._client.get(K`/disputes/${D}`,F)}list(D={},F){return this._client.getAPIList("/disputes",x,{query:D,...F})}}class XF extends N{retrieve(D,F){return this._client.get(K`/invoices/payments/${D}`,{...F,headers:k([{Accept:"application/pdf"},F?.headers]),__binaryResponse:!0})}retrieveRefund(D,F){return this._client.get(K`/invoices/refunds/${D}`,{...F,headers:k([{Accept:"application/pdf"},F?.headers]),__binaryResponse:!0})}}class QD extends N{constructor(){super(...arguments);this.payments=new XF(this._client)}}QD.Payments=XF;class ID extends N{retrieve(D,F){return this._client.get(K`/license_key_instances/${D}`,F)}update(D,F,u){return this._client.patch(K`/license_key_instances/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/license_key_instances",x,{query:D,...F})}}class LD extends N{retrieve(D,F){return this._client.get(K`/license_keys/${D}`,F)}update(D,F,u){return this._client.patch(K`/license_keys/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/license_keys",x,{query:D,...F})}}class fD extends N{activate(D,F){return this._client.post("/licenses/activate",{body:D,...F})}deactivate(D,F){return this._client.post("/licenses/deactivate",{body:D,...F,headers:k([{Accept:"*/*"},F?.headers])})}validate(D,F){return this._client.post("/licenses/validate",{body:D,...F})}}class PD extends N{create(D,F){return this._client.post("/meters",{body:D,...F})}retrieve(D,F){return this._client.get(K`/meters/${D}`,F)}list(D={},F){return this._client.getAPIList("/meters",x,{query:D,...F})}archive(D,F){return this._client.delete(K`/meters/${D}`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}unarchive(D,F){return this._client.post(K`/meters/${D}/unarchive`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}}class bD extends N{listSupportedCountries(D){return this._client.get("/checkout/supported_countries",D)}}class vD extends N{create(D,F){return this._client.post("/payments",{body:D,...F})}retrieve(D,F){return this._client.get(K`/payments/${D}`,F)}list(D={},F){return this._client.getAPIList("/payments",x,{query:D,...F})}retrieveLineItems(D,F){return this._client.get(K`/payments/${D}/line-items`,F)}}class yD extends N{list(D={},F){return this._client.getAPIList("/payouts",x,{query:D,...F})}}class GF extends N{update(D,F={},u){let{force_update:C}=F??{};return this._client.put(K`/products/${D}/images`,{query:{force_update:C},...u})}}class YF extends N{create(D,F,u){return this._client.post(K`/products/${D}/short_links`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/products/short_links",x,{query:D,...F})}}class uD extends N{constructor(){super(...arguments);this.images=new GF(this._client),this.shortLinks=new YF(this._client)}create(D,F){return this._client.post("/products",{body:D,...F})}retrieve(D,F){return this._client.get(K`/products/${D}`,F)}update(D,F,u){return this._client.patch(K`/products/${D}`,{body:F,...u,headers:k([{Accept:"*/*"},u?.headers])})}list(D={},F){return this._client.getAPIList("/products",x,{query:D,...F})}archive(D,F){return this._client.delete(K`/products/${D}`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}unarchive(D,F){return this._client.post(K`/products/${D}/unarchive`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}updateFiles(D,F,u){return this._client.put(K`/products/${D}/files`,{body:F,...u})}}uD.Images=GF;uD.ShortLinks=YF;class hD extends N{create(D,F){return this._client.post("/refunds",{body:D,...F})}retrieve(D,F){return this._client.get(K`/refunds/${D}`,F)}list(D={},F){return this._client.getAPIList("/refunds",x,{query:D,...F})}}class gD extends N{create(D,F){return this._client.post("/subscriptions",{body:D,...F})}retrieve(D,F){return this._client.get(K`/subscriptions/${D}`,F)}update(D,F,u){return this._client.patch(K`/subscriptions/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/subscriptions",x,{query:D,...F})}changePlan(D,F,u){return this._client.post(K`/subscriptions/${D}/change-plan`,{body:F,...u,headers:k([{Accept:"*/*"},u?.headers])})}charge(D,F,u){return this._client.post(K`/subscriptions/${D}/charge`,{body:F,...u})}previewChangePlan(D,F,u){return this._client.post(K`/subscriptions/${D}/change-plan/preview`,{body:F,...u})}retrieveUsageHistory(D,F={},u){return this._client.getAPIList(K`/subscriptions/${D}/usage-history`,x,{query:F,...u})}updatePaymentMethod(D,F,u){return this._client.post(K`/subscriptions/${D}/update-payment-method`,{body:F,...u})}}class mD extends N{retrieve(D,F){return this._client.get(K`/events/${D}`,F)}list(D={},F){return this._client.getAPIList("/events",x,{query:D,...F})}ingest(D,F){return this._client.post("/events/ingest",{body:D,...F})}}class dD extends N{}class zF extends N{retrieve(D,F){return this._client.get(K`/webhooks/${D}/headers`,F)}update(D,F,u){return this._client.patch(K`/webhooks/${D}/headers`,{body:F,...u,headers:k([{Accept:"*/*"},u?.headers])})}}var tu=fF(ru(),1);class JD extends N{constructor(){super(...arguments);this.headers=new zF(this._client)}create(D,F){return this._client.post("/webhooks",{body:D,...F})}retrieve(D,F){return this._client.get(K`/webhooks/${D}`,F)}update(D,F,u){return this._client.patch(K`/webhooks/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/webhooks",K0,{query:D,...F})}delete(D,F){return this._client.delete(K`/webhooks/${D}`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}retrieveSecret(D,F){return this._client.get(K`/webhooks/${D}/secret`,F)}unsafeUnwrap(D){return JSON.parse(D)}unwrap(D,{headers:F,key:u}){if(F!==void 0){let C=u===void 0?this._client.webhookKey:u;if(C===null)throw Error("Webhook key must not be null in order to unwrap");new tu.Webhook(C).verify(D,F)}return JSON.parse(D)}}JD.Headers=zF;var WF=(D)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[D]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(D)?.trim();return};var N0,U0,cF,su,ou={live_mode:"https://live.dodopayments.com",test_mode:"https://test.dodopayments.com"};class U{constructor({baseURL:D=WF("DODO_PAYMENTS_BASE_URL"),bearerToken:F=WF("DODO_PAYMENTS_API_KEY"),webhookKey:u=WF("DODO_PAYMENTS_WEBHOOK_KEY")??null,...C}={}){if(N0.add(this),cF.set(this,void 0),this.checkoutSessions=new wD(this),this.payments=new vD(this),this.subscriptions=new gD(this),this.invoices=new QD(this),this.licenses=new fD(this),this.licenseKeys=new LD(this),this.licenseKeyInstances=new ID(this),this.customers=new FD(this),this.refunds=new hD(this),this.disputes=new kD(this),this.payouts=new yD(this),this.products=new uD(this),this.misc=new bD(this),this.discounts=new jD(this),this.addons=new xD(this),this.brands=new SD(this),this.webhooks=new JD(this),this.webhookEvents=new dD(this),this.usageEvents=new mD(this),this.meters=new PD(this),F===void 0)throw new v("The DODO_PAYMENTS_API_KEY environment variable is missing or empty; either provide it, or instantiate the DodoPayments client with an bearerToken option, like new DodoPayments({ bearerToken: 'My Bearer Token' }).");let E={bearerToken:F,webhookKey:u,...C,baseURL:D,environment:C.environment??"live_mode"};if(D&&C.environment)throw new v("Ambiguous URL; The `baseURL` option (or DODO_PAYMENTS_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null");this.baseURL=E.baseURL||ou[E.environment||"live_mode"],this.timeout=E.timeout??U0.DEFAULT_TIMEOUT,this.logger=E.logger??console;let B="warn";this.logLevel=B,this.logLevel=Y0(E.logLevel,"ClientOptions.logLevel",this)??Y0(WF("DODO_PAYMENTS_LOG"),"process.env['DODO_PAYMENTS_LOG']",this)??B,this.fetchOptions=E.fetchOptions,this.maxRetries=E.maxRetries??2,this.fetch=E.fetch??xu(),qD(this,cF,wu,"f"),this._options=E,this.bearerToken=F,this.webhookKey=u}withOptions(D){return new this.constructor({...this._options,environment:D.environment?D.environment:void 0,baseURL:D.environment?void 0:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,bearerToken:this.bearerToken,webhookKey:this.webhookKey,...D})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:D,nulls:F}){return}async authHeaders(D){return k([{Authorization:`Bearer ${this.bearerToken}`}])}stringifyQuery(D){return Object.entries(D).filter(([F,u])=>typeof u<"u").map(([F,u])=>{if(typeof u==="string"||typeof u==="number"||typeof u==="boolean")return`${encodeURIComponent(F)}=${encodeURIComponent(u)}`;if(u===null)return`${encodeURIComponent(F)}=`;throw new v(`Cannot stringify type ${typeof u}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${DD}`}defaultIdempotencyKey(){return`stainless-node-retry-${Z0()}`}makeStatusError(D,F,u,C){return P.generate(D,F,u,C)}buildURL(D,F,u){let C=!e(this,N0,"m",su).call(this)&&u||this.baseURL,E=_u(D)?new URL(D):new URL(C+(C.endsWith("/")&&D.startsWith("/")?D.slice(1):D)),B=this.defaultQuery();if(!Wu(B))F={...B,...F};if(typeof F==="object"&&F&&!Array.isArray(F))E.search=this.stringifyQuery(F);return E.toString()}async prepareOptions(D){}async prepareRequest(D,{url:F,options:u}){}get(D,F){return this.methodRequest("get",D,F)}post(D,F){return this.methodRequest("post",D,F)}patch(D,F){return this.methodRequest("patch",D,F)}put(D,F){return this.methodRequest("put",D,F)}delete(D,F){return this.methodRequest("delete",D,F)}methodRequest(D,F,u){return this.request(Promise.resolve(u).then((C)=>{return{method:D,path:F,...C}}))}request(D,F=null){return new ZD(this,this.makeRequest(D,F,void 0))}async makeRequest(D,F,u){let C=await D,E=C.maxRetries??this.maxRetries;if(F==null)F=E;await this.prepareOptions(C);let{req:B,url:$,timeout:Q}=await this.buildRequest(C,{retryCount:E-F});await this.prepareRequest(B,{url:$,options:C});let z="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),X=u===void 0?"":`, retryOf: ${u}`,Y=Date.now();if(y(this).debug(`[${z}] sending request`,r({retryOfRequestLogID:u,method:C.method,url:$,options:C,headers:B.headers})),C.signal?.aborted)throw new MD;let Z=new AbortController,A=await this.fetchWithTimeout($,B,Q,Z).catch(sD),J=Date.now();if(A instanceof globalThis.Error){let T=`retrying, ${F} attempts remaining`;if(C.signal?.aborted)throw new MD;let W=Ku(A)||/timed? ?out/i.test(String(A)+("cause"in A?String(A.cause):""));if(F)return y(this).info(`[${z}] connection ${W?"timed out":"failed"} - ${T}`),y(this).debug(`[${z}] connection ${W?"timed out":"failed"} (${T})`,r({retryOfRequestLogID:u,url:$,durationMs:J-Y,message:A.message})),this.retryRequest(C,F,u??z);if(y(this).info(`[${z}] connection ${W?"timed out":"failed"} - error; no more retries left`),y(this).debug(`[${z}] connection ${W?"timed out":"failed"} (error; no more retries left)`,r({retryOfRequestLogID:u,url:$,durationMs:J-Y,message:A.message})),W)throw new oD;throw new $D({cause:A})}let G=`[${z}${X}] ${B.method} ${$} ${A.ok?"succeeded":"failed"} with status ${A.status} in ${J-Y}ms`;if(!A.ok){let T=await this.shouldRetry(A);if(F&&T){let q=`retrying, ${F} attempts remaining`;return await Su(A.body),y(this).info(`${G} - ${q}`),y(this).debug(`[${z}] response error (${q})`,r({retryOfRequestLogID:u,url:A.url,status:A.status,headers:A.headers,durationMs:J-Y})),this.retryRequest(C,F,u??z,A.headers)}let W=T?"error; no more retries left":"error; not retryable";y(this).info(`${G} - ${W}`);let O=await A.text().catch((q)=>sD(q).message),_=Nu(O),V=_?void 0:O;throw y(this).debug(`[${z}] response error (${W})`,r({retryOfRequestLogID:u,url:A.url,status:A.status,headers:A.headers,message:V,durationMs:Date.now()-Y})),this.makeStatusError(A.status,_,V,A.headers)}return y(this).info(G),y(this).debug(`[${z}] response start`,r({retryOfRequestLogID:u,url:A.url,status:A.status,headers:A.headers,durationMs:J-Y})),{response:A,options:C,controller:Z,requestLogID:z,retryOfRequestLogID:u,startTime:Y}}getAPIList(D,F,u){return this.requestAPIList(F,{method:"get",path:D,...u})}requestAPIList(D,F){let u=this.makeRequest(F,null,void 0);return new hF(this,u,D)}async fetchWithTimeout(D,F,u,C){let{signal:E,method:B,...$}=F||{};if(E)E.addEventListener("abort",()=>C.abort());let Q=setTimeout(()=>C.abort(),u),z=globalThis.ReadableStream&&$.body instanceof globalThis.ReadableStream||typeof $.body==="object"&&$.body!==null&&Symbol.asyncIterator in $.body,X={signal:C.signal,...z?{duplex:"half"}:{},method:"GET",...$};if(B)X.method=B.toUpperCase();try{return await this.fetch.call(void 0,D,X)}finally{clearTimeout(Q)}}async shouldRetry(D){let F=D.headers.get("x-should-retry");if(F==="true")return!0;if(F==="false")return!1;if(D.status===408)return!0;if(D.status===409)return!0;if(D.status===429)return!0;if(D.status>=500)return!0;return!1}async retryRequest(D,F,u,C){let E,B=C?.get("retry-after-ms");if(B){let Q=parseFloat(B);if(!Number.isNaN(Q))E=Q}let $=C?.get("retry-after");if($&&!E){let Q=parseFloat($);if(!Number.isNaN(Q))E=Q*1000;else E=Date.parse($)-Date.now()}if(!(E&&0<=E&&E<60000)){let Q=D.maxRetries??this.maxRetries;E=this.calculateDefaultRetryTimeoutMillis(F,Q)}return await Uu(E),this.makeRequest(D,F-1,u)}calculateDefaultRetryTimeoutMillis(D,F){let E=F-D,B=Math.min(0.5*Math.pow(2,E),8),$=1-Math.random()*0.25;return B*$*1000}async buildRequest(D,{retryCount:F=0}={}){let u={...D},{method:C,path:E,query:B,defaultBaseURL:$}=u,Q=this.buildURL(E,B,$);if("timeout"in u)Tu("timeout",u.timeout);u.timeout=u.timeout??this.timeout;let{bodyHeaders:z,body:X}=this.buildBody({options:u}),Y=await this.buildHeaders({options:D,method:C,bodyHeaders:z,retryCount:F});return{req:{method:C,headers:Y,...u.signal&&{signal:u.signal},...globalThis.ReadableStream&&X instanceof globalThis.ReadableStream&&{duplex:"half"},...X&&{body:X},...this.fetchOptions??{},...u.fetchOptions??{}},url:Q,timeout:u.timeout}}async buildHeaders({options:D,method:F,bodyHeaders:u,retryCount:C}){let E={};if(this.idempotencyHeader&&F!=="get"){if(!D.idempotencyKey)D.idempotencyKey=this.defaultIdempotencyKey();E[this.idempotencyHeader]=D.idempotencyKey}let B=k([E,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(C),...D.timeout?{"X-Stainless-Timeout":String(Math.trunc(D.timeout/1000))}:{},...Mu()},await this.authHeaders(D),this._options.defaultHeaders,u,D.headers]);return this.validateHeaders(B),B.values}buildBody({options:{body:D,headers:F}}){if(!D)return{bodyHeaders:void 0,body:void 0};let u=k([F]);if(ArrayBuffer.isView(D)||D instanceof ArrayBuffer||D instanceof DataView||typeof D==="string"&&u.values.has("content-type")||globalThis.Blob&&D instanceof globalThis.Blob||D instanceof FormData||D instanceof URLSearchParams||globalThis.ReadableStream&&D instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:D};else if(typeof D==="object"&&((Symbol.asyncIterator in D)||(Symbol.iterator in D)&&("next"in D)&&typeof D.next==="function"))return{bodyHeaders:void 0,body:G0(D)};else return e(this,cF,"f").call(this,{body:D,headers:u})}}U0=U,cF=new WeakMap,N0=new WeakSet,su=function(){return this.baseURL!==ou[this._options.environment||"live_mode"]};U.DodoPayments=U0;U.DEFAULT_TIMEOUT=60000;U.DodoPaymentsError=v;U.APIError=P;U.APIConnectionError=$D;U.APIConnectionTimeoutError=oD;U.APIUserAbortError=MD;U.NotFoundError=uF;U.ConflictError=CF;U.RateLimitError=BF;U.BadRequestError=eD;U.AuthenticationError=DF;U.InternalServerError=AF;U.PermissionDeniedError=FF;U.UnprocessableEntityError=EF;U.toFile=mF;U.CheckoutSessions=wD;U.Payments=vD;U.Subscriptions=gD;U.Invoices=QD;U.Licenses=fD;U.LicenseKeys=LD;U.LicenseKeyInstances=ID;U.Customers=FD;U.Refunds=hD;U.Disputes=kD;U.Payouts=yD;U.Products=uD;U.Misc=bD;U.Discounts=jD;U.Addons=xD;U.Brands=SD;U.Webhooks=JD;U.WebhookEvents=dD;U.UsageEvents=mD;U.Meters=PD;i0();import Au from"node:process";import T3 from"node:path";import{fileURLToPath as o6}from"node:url";import e6 from"node:child_process";import DC,{constants as FC}from"node:fs/promises";import{promisify as k6}from"node:util";import I6 from"node:child_process";import o0,{constants as Z3}from"node:fs/promises";import E3 from"node:process";import M6 from"node:os";import x6 from"node:fs";import H6 from"node:fs";import u3 from"node:fs";var a0;function U6(){try{return u3.statSync("/.dockerenv"),!0}catch{return!1}}function V6(){try{return u3.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function r0(){if(a0===void 0)a0=U6()||V6();return a0}var t0,q6=()=>{try{return H6.statSync("/run/.containerenv"),!0}catch{return!1}};function iD(){if(t0===void 0)t0=q6()||r0();return t0}var C3=()=>{if(E3.platform!=="linux")return!1;if(M6.release().toLowerCase().includes("microsoft")){if(iD())return!1;return!0}try{return x6.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!iD():!1}catch{return!1}},s=E3.env.__IS_WSL_TEST__?C3:C3();import B3 from"node:process";import{Buffer as S6}from"node:buffer";import{promisify as w6}from"node:util";import R6 from"node:child_process";var j6=w6(R6.execFile),s0=()=>`${B3.env.SYSTEMROOT||B3.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var d=async(D,F={})=>{let{powerShellPath:u,...C}=F,E=d.encodeCommand(D);return j6(u??s0(),[...d.argumentsPrefix,E],{encoding:"utf8",...C})};d.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];d.encodeCommand=(D)=>S6.from(D,"utf16le").toString("base64");d.escapeArgument=(D)=>`'${String(D).replaceAll("'","''")}'`;function A3(D){for(let F of D.split(`
28
- `)){if(/^\s*#/.test(F))continue;let u=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(F);if(!u)continue;return u.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var L6=k6(I6.execFile),f6=(()=>{let F;return async function(){if(F)return F;let u="/etc/wsl.conf",C=!1;try{await o0.access(u,Z3.F_OK),C=!0}catch{}if(!C)return"/mnt/";let E=await o0.readFile(u,{encoding:"utf8"}),B=A3(E);if(B===void 0)return"/mnt/";return F=B,F=F.endsWith("/")?F:`${F}/`,F}})(),P6=async()=>{return`${await f6()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},u0=s?P6:s0,$3,Q3=async()=>{return $3??=(async()=>{try{let D=await u0();return await o0.access(D,Z3.X_OK),!0}catch{return!1}})(),$3},J3=async()=>{let D=await u0(),F=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:u}=await d(F,{powerShellPath:D});return u.trim()},X3=async(D)=>{if(/^[a-z]+:\/\//i.test(D))return D;try{let{stdout:F}=await L6("wslpath",["-aw",D],{encoding:"utf8"});return F.trim()}catch{return D}};function OD(D,F,u){let C=(E)=>Object.defineProperty(D,F,{value:E,enumerable:!0,writable:!0});return Object.defineProperty(D,F,{configurable:!0,enumerable:!0,get(){let E=u();return C(E),E},set(E){C(E)}}),D}import{promisify as i6}from"node:util";import Cu from"node:process";import{execFile as a6}from"node:child_process";import{promisify as b6}from"node:util";import v6 from"node:process";import{execFile as y6}from"node:child_process";var h6=b6(y6);async function e0(){if(v6.platform!=="darwin")throw Error("macOS only");let{stdout:D}=await h6("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),u=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(D)?.groups.id??"com.apple.Safari";if(u==="com.apple.safari")return"com.apple.Safari";return u}import g6 from"node:process";import{promisify as m6}from"node:util";import{execFile as d6,execFileSync as O9}from"node:child_process";var c6=m6(d6);async function G3(D,{humanReadableOutput:F=!0,signal:u}={}){if(g6.platform!=="darwin")throw Error("macOS only");let C=F?[]:["-ss"],E={};if(u)E.signal=u;let{stdout:B}=await c6("osascript",["-e",D,C],E);return B.trim()}async function Du(D){return G3(`tell application "Finder" to set app_path to application file id "${D}" as string
29
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as l6}from"node:util";import{execFile as p6}from"node:child_process";var n6=l6(p6),Y3={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},C0=new Map(Object.entries(Y3));class Fu extends Error{}async function uu(D=n6){let{stdout:F}=await D("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),u=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(F);if(!u)throw new Fu(`Cannot find Windows browser in stdout: ${JSON.stringify(F)}`);let{id:C}=u.groups,E=Y3[C];if(!E)throw new Fu(`Unknown browser ID: ${C}`);return E}var r6=i6(a6),t6=(D)=>D.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(F)=>F.toUpperCase());async function Eu(){if(Cu.platform==="darwin"){let D=await e0();return{name:await Du(D),id:D}}if(Cu.platform==="linux"){let{stdout:D}=await r6("xdg-mime",["query","default","x-scheme-handler/http"]),F=D.trim();return{name:t6(F.replace(/.desktop$/,"").replace("-"," ")),id:F}}if(Cu.platform==="win32")return uu();throw Error("Only macOS, Linux, and Windows are supported")}import Bu from"node:process";var s6=Boolean(Bu.env.SSH_CONNECTION||Bu.env.SSH_CLIENT||Bu.env.SSH_TTY),z3=s6;var E0=Symbol("fallbackAttempt"),$u=import.meta.url?T3.dirname(o6(import.meta.url)):"",K3=T3.join($u,"xdg-open"),{platform:aD,arch:_3}=Au,W3=async(D,F)=>{if(D.length===0)return;let u=[];for(let C of D)try{return await F(C)}catch(E){u.push(E)}throw AggregateError(u,"Failed to open in all supported apps")},B0=async(D)=>{D={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...D};let F=D[E0]===!0;if(delete D[E0],Array.isArray(D.app))return W3(D.app,(X)=>B0({...D,app:X,[E0]:!0}));let{name:u,arguments:C=[]}=D.app??{};if(C=[...C],Array.isArray(u))return W3(u,(X)=>B0({...D,app:{name:X,arguments:C},[E0]:!0}));if(u==="browser"||u==="browserPrivate"){let X={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},Y={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},Z;if(s){let A=await J3();Z=C0.get(A)??{}}else Z=await Eu();if(Z.id in X){let A=X[Z.id.toLowerCase()];if(u==="browserPrivate"){if(A==="safari")throw Error("Safari doesn't support opening in private mode via command line");C.push(Y[A])}return B0({...D,app:{name:rD[A],arguments:C}})}throw Error(`${Z.name} is not supported as a default browser`)}let E,B=[],$={},Q=!1;if(s&&!iD()&&!z3&&!u)Q=await Q3();if(aD==="darwin"){if(E="open",D.wait)B.push("--wait-apps");if(D.background)B.push("--background");if(D.newInstance)B.push("--new");if(u)B.push("-a",u)}else if(aD==="win32"||Q){if(E=await u0(),B.push(...d.argumentsPrefix),!s)$.windowsVerbatimArguments=!0;if(s&&D.target)D.target=await X3(D.target);let X=["$ProgressPreference = 'SilentlyContinue';","Start"];if(D.wait)X.push("-Wait");if(u){if(X.push(d.escapeArgument(u)),D.target)C.push(D.target)}else if(D.target)X.push(d.escapeArgument(D.target));if(C.length>0)C=C.map((Y)=>d.escapeArgument(Y)),X.push("-ArgumentList",C.join(","));if(D.target=d.encodeCommand(X.join(" ")),!D.wait)$.stdio="ignore"}else{if(u)E=u;else{let X=!$u||$u==="/",Y=!1;try{await DC.access(K3,FC.X_OK),Y=!0}catch{}E=Au.versions.electron??(aD==="android"||X||!Y)?"xdg-open":K3}if(C.length>0)B.push(...C);if(!D.wait)$.stdio="ignore",$.detached=!0}if(aD==="darwin"&&C.length>0)B.push("--args",...C);if(D.target)B.push(D.target);let z=e6.spawn(E,B,$);if(D.wait)return new Promise((X,Y)=>{z.once("error",Y),z.once("close",(Z)=>{if(!D.allowNonzeroExitCode&&Z!==0){Y(Error(`Exited with code ${Z}`));return}X(z)})});if(F)return new Promise((X,Y)=>{z.once("error",Y),z.once("spawn",()=>{z.once("close",(Z)=>{if(z.off("error",Y),Z!==0){Y(Error(`Exited with code ${Z}`));return}z.unref(),X(z)})})});return z.unref(),new Promise((X,Y)=>{z.once("error",Y),z.once("spawn",()=>{z.off("error",Y),X(z)})})},uC=(D,F)=>{if(typeof D!=="string")throw TypeError("Expected a `target`");return B0({...F,target:D})};function O3(D){if(typeof D==="string"||Array.isArray(D))return D;let{[_3]:F}=D;if(!F)throw Error(`${_3} is not supported`);return F}function jF({[aD]:D},{wsl:F}={}){if(F&&s)return O3(F);if(!D)throw Error(`${aD} is not supported`);return O3(D)}var rD={browser:"browser",browserPrivate:"browserPrivate"};OD(rD,"chrome",()=>jF({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));OD(rD,"brave",()=>jF({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));OD(rD,"firefox",()=>jF({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));OD(rD,"edge",()=>jF({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));OD(rD,"safari",()=>jF({darwin:"Safari"}));var Zu=uC;var TD={USD:"$",INR:"₹",EUR:"€",GBP:"£"};import VD from"node:fs";var ZC=`
27
+ ${Z}`)}return $},K=T8(P2);class SD extends N{create(D,F){return this._client.post("/addons",{body:D,...F})}retrieve(D,F){return this._client.get(K`/addons/${D}`,F)}update(D,F,u){return this._client.patch(K`/addons/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/addons",S,{query:D,...F})}updateImages(D,F){return this._client.put(K`/addons/${D}/images`,F)}}class wD extends N{retrieveLedger(D={},F){return this._client.getAPIList("/balances/ledger",S,{query:D,...F})}}class RD extends N{create(D,F){return this._client.post("/brands",{body:D,...F})}retrieve(D,F){return this._client.get(K`/brands/${D}`,F)}update(D,F,u){return this._client.patch(K`/brands/${D}`,{body:F,...u})}list(D){return this._client.get("/brands",D)}updateImages(D,F){return this._client.put(K`/brands/${D}/images`,F)}}class jD extends N{create(D,F){return this._client.post("/checkouts",{body:D,...F})}retrieve(D,F){return this._client.get(K`/checkouts/${D}`,F)}preview(D,F){return this._client.post("/checkouts/preview",{body:D,...F})}}class JF extends N{create(D,F={},u){let{send_email:C}=F??{};return this._client.post(K`/customers/${D}/customer-portal/session`,{query:{send_email:C},...u})}}class XF extends N{create(D,F,u){return this._client.post(K`/customers/${D}/wallets/ledger-entries`,{body:F,...u})}list(D,F={},u){return this._client.getAPIList(K`/customers/${D}/wallets/ledger-entries`,S,{query:F,...u})}}class kD extends N{constructor(){super(...arguments);this.ledgerEntries=new XF(this._client)}list(D,F){return this._client.get(K`/customers/${D}/wallets`,F)}}kD.LedgerEntries=XF;class CD extends N{constructor(){super(...arguments);this.customerPortal=new JF(this._client),this.wallets=new kD(this._client)}create(D,F){return this._client.post("/customers",{body:D,...F})}retrieve(D,F){return this._client.get(K`/customers/${D}`,F)}update(D,F,u){return this._client.patch(K`/customers/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/customers",S,{query:D,...F})}retrievePaymentMethods(D,F){return this._client.get(K`/customers/${D}/payment-methods`,F)}}CD.CustomerPortal=JF;CD.Wallets=kD;var b2=Symbol("brand.privateNullableHeaders");function*H8(D){if(!D)return;if(b2 in D){let{values:C,nulls:E}=D;yield*C.entries();for(let A of E)yield[A,null];return}let F=!1,u;if(D instanceof Headers)u=D.entries();else if(z0(D))u=D;else F=!0,u=Object.entries(D??{});for(let C of u){let E=C[0];if(typeof E!=="string")throw TypeError("expected header name to be a string");let A=z0(C[1])?C[1]:[C[1]],$=!1;for(let Q of A){if(Q===void 0)continue;if(F&&!$)$=!0,yield[E,null];yield[E,Q]}}}var k=(D)=>{let F=new Headers,u=new Set;for(let C of D){let E=new Set;for(let[A,$]of H8(C)){let Q=A.toLowerCase();if(!E.has(Q))F.delete(A),E.add(Q);if($===null)F.delete(A),u.add(Q);else F.append(A,$),u.delete(Q)}}return{[b2]:!0,values:F,nulls:u}};class LD extends N{create(D,F){return this._client.post("/discounts",{body:D,...F})}retrieve(D,F){return this._client.get(K`/discounts/${D}`,F)}update(D,F,u){return this._client.patch(K`/discounts/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/discounts",S,{query:D,...F})}delete(D,F){return this._client.delete(K`/discounts/${D}`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}retrieveByCode(D,F){return this._client.get(K`/discounts/code/${D}`,F)}}class ID extends N{retrieve(D,F){return this._client.get(K`/disputes/${D}`,F)}list(D={},F){return this._client.getAPIList("/disputes",S,{query:D,...F})}}class YF extends N{retrieve(D,F){return this._client.get(K`/invoices/payments/${D}`,{...F,headers:k([{Accept:"application/pdf"},F?.headers]),__binaryResponse:!0})}retrieveRefund(D,F){return this._client.get(K`/invoices/refunds/${D}`,{...F,headers:k([{Accept:"application/pdf"},F?.headers]),__binaryResponse:!0})}}class JD extends N{constructor(){super(...arguments);this.payments=new YF(this._client)}}JD.Payments=YF;class fD extends N{retrieve(D,F){return this._client.get(K`/license_key_instances/${D}`,F)}update(D,F,u){return this._client.patch(K`/license_key_instances/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/license_key_instances",S,{query:D,...F})}}class PD extends N{retrieve(D,F){return this._client.get(K`/license_keys/${D}`,F)}update(D,F,u){return this._client.patch(K`/license_keys/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/license_keys",S,{query:D,...F})}}class bD extends N{activate(D,F){return this._client.post("/licenses/activate",{body:D,...F})}deactivate(D,F){return this._client.post("/licenses/deactivate",{body:D,...F,headers:k([{Accept:"*/*"},F?.headers])})}validate(D,F){return this._client.post("/licenses/validate",{body:D,...F})}}class vD extends N{create(D,F){return this._client.post("/meters",{body:D,...F})}retrieve(D,F){return this._client.get(K`/meters/${D}`,F)}list(D={},F){return this._client.getAPIList("/meters",S,{query:D,...F})}archive(D,F){return this._client.delete(K`/meters/${D}`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}unarchive(D,F){return this._client.post(K`/meters/${D}/unarchive`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}}class yD extends N{listSupportedCountries(D){return this._client.get("/checkout/supported_countries",D)}}class hD extends N{create(D,F){return this._client.post("/payments",{body:D,...F})}retrieve(D,F){return this._client.get(K`/payments/${D}`,F)}list(D={},F){return this._client.getAPIList("/payments",S,{query:D,...F})}retrieveLineItems(D,F){return this._client.get(K`/payments/${D}/line-items`,F)}}class gD extends N{list(D={},F){return this._client.getAPIList("/payouts",S,{query:D,...F})}}class zF extends N{update(D,F={},u){let{force_update:C}=F??{};return this._client.put(K`/products/${D}/images`,{query:{force_update:C},...u})}}class KF extends N{create(D,F,u){return this._client.post(K`/products/${D}/short_links`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/products/short_links",S,{query:D,...F})}}class ED extends N{constructor(){super(...arguments);this.images=new zF(this._client),this.shortLinks=new KF(this._client)}create(D,F){return this._client.post("/products",{body:D,...F})}retrieve(D,F){return this._client.get(K`/products/${D}`,F)}update(D,F,u){return this._client.patch(K`/products/${D}`,{body:F,...u,headers:k([{Accept:"*/*"},u?.headers])})}list(D={},F){return this._client.getAPIList("/products",S,{query:D,...F})}archive(D,F){return this._client.delete(K`/products/${D}`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}unarchive(D,F){return this._client.post(K`/products/${D}/unarchive`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}updateFiles(D,F,u){return this._client.put(K`/products/${D}/files`,{body:F,...u})}}ED.Images=zF;ED.ShortLinks=KF;class mD extends N{create(D,F){return this._client.post("/refunds",{body:D,...F})}retrieve(D,F){return this._client.get(K`/refunds/${D}`,F)}list(D={},F){return this._client.getAPIList("/refunds",S,{query:D,...F})}}class cD extends N{create(D,F){return this._client.post("/subscriptions",{body:D,...F})}retrieve(D,F){return this._client.get(K`/subscriptions/${D}`,F)}update(D,F,u){return this._client.patch(K`/subscriptions/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/subscriptions",S,{query:D,...F})}changePlan(D,F,u){return this._client.post(K`/subscriptions/${D}/change-plan`,{body:F,...u,headers:k([{Accept:"*/*"},u?.headers])})}charge(D,F,u){return this._client.post(K`/subscriptions/${D}/charge`,{body:F,...u})}previewChangePlan(D,F,u){return this._client.post(K`/subscriptions/${D}/change-plan/preview`,{body:F,...u})}retrieveUsageHistory(D,F={},u){return this._client.getAPIList(K`/subscriptions/${D}/usage-history`,S,{query:F,...u})}updatePaymentMethod(D,F,u){return this._client.post(K`/subscriptions/${D}/update-payment-method`,{body:F,...u})}}class dD extends N{retrieve(D,F){return this._client.get(K`/events/${D}`,F)}list(D={},F){return this._client.getAPIList("/events",S,{query:D,...F})}ingest(D,F){return this._client.post("/events/ingest",{body:D,...F})}}class lD extends N{}class _F extends N{retrieve(D,F){return this._client.get(K`/webhooks/${D}/headers`,F)}update(D,F,u){return this._client.patch(K`/webhooks/${D}/headers`,{body:F,...u,headers:k([{Accept:"*/*"},u?.headers])})}}var s2=PF(t2(),1);class XD extends N{constructor(){super(...arguments);this.headers=new _F(this._client)}create(D,F){return this._client.post("/webhooks",{body:D,...F})}retrieve(D,F){return this._client.get(K`/webhooks/${D}`,F)}update(D,F,u){return this._client.patch(K`/webhooks/${D}`,{body:F,...u})}list(D={},F){return this._client.getAPIList("/webhooks",T0,{query:D,...F})}delete(D,F){return this._client.delete(K`/webhooks/${D}`,{...F,headers:k([{Accept:"*/*"},F?.headers])})}retrieveSecret(D,F){return this._client.get(K`/webhooks/${D}/secret`,F)}unsafeUnwrap(D){return JSON.parse(D)}unwrap(D,{headers:F,key:u}){if(F!==void 0){let C=u===void 0?this._client.webhookKey:u;if(C===null)throw Error("Webhook key must not be null in order to unwrap");new s2.Webhook(C).verify(D,F)}return JSON.parse(D)}}XD.Headers=_F;var TF=(D)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[D]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(D)?.trim();return};var q0,M0,lF,o2,e2={live_mode:"https://live.dodopayments.com",test_mode:"https://test.dodopayments.com"};class U{constructor({baseURL:D=TF("DODO_PAYMENTS_BASE_URL"),bearerToken:F=TF("DODO_PAYMENTS_API_KEY"),webhookKey:u=TF("DODO_PAYMENTS_WEBHOOK_KEY")??null,...C}={}){if(q0.add(this),lF.set(this,void 0),this.checkoutSessions=new jD(this),this.payments=new hD(this),this.subscriptions=new cD(this),this.invoices=new JD(this),this.licenses=new bD(this),this.licenseKeys=new PD(this),this.licenseKeyInstances=new fD(this),this.customers=new CD(this),this.refunds=new mD(this),this.disputes=new ID(this),this.payouts=new gD(this),this.products=new ED(this),this.misc=new yD(this),this.discounts=new LD(this),this.addons=new SD(this),this.brands=new RD(this),this.webhooks=new XD(this),this.webhookEvents=new lD(this),this.usageEvents=new dD(this),this.meters=new vD(this),this.balances=new wD(this),F===void 0)throw new g("The DODO_PAYMENTS_API_KEY environment variable is missing or empty; either provide it, or instantiate the DodoPayments client with an bearerToken option, like new DodoPayments({ bearerToken: 'My Bearer Token' }).");let E={bearerToken:F,webhookKey:u,...C,baseURL:D,environment:C.environment??"live_mode"};if(D&&C.environment)throw new g("Ambiguous URL; The `baseURL` option (or DODO_PAYMENTS_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null");this.baseURL=E.baseURL||e2[E.environment||"live_mode"],this.timeout=E.timeout??M0.DEFAULT_TIMEOUT,this.logger=E.logger??console;let A="warn";this.logLevel=A,this.logLevel=W0(E.logLevel,"ClientOptions.logLevel",this)??W0(TF("DODO_PAYMENTS_LOG"),"process.env['DODO_PAYMENTS_LOG']",this)??A,this.fetchOptions=E.fetchOptions,this.maxRetries=E.maxRetries??2,this.fetch=E.fetch??S2(),MD(this,lF,R2,"f"),this._options=E,this.bearerToken=F,this.webhookKey=u}withOptions(D){return new this.constructor({...this._options,environment:D.environment?D.environment:void 0,baseURL:D.environment?void 0:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,bearerToken:this.bearerToken,webhookKey:this.webhookKey,...D})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:D,nulls:F}){return}async authHeaders(D){return k([{Authorization:`Bearer ${this.bearerToken}`}])}stringifyQuery(D){return Object.entries(D).filter(([F,u])=>typeof u<"u").map(([F,u])=>{if(typeof u==="string"||typeof u==="number"||typeof u==="boolean")return`${encodeURIComponent(F)}=${encodeURIComponent(u)}`;if(u===null)return`${encodeURIComponent(F)}=`;throw new g(`Cannot stringify type ${typeof u}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${uD}`}defaultIdempotencyKey(){return`stainless-node-retry-${X0()}`}makeStatusError(D,F,u,C){return v.generate(D,F,u,C)}buildURL(D,F,u){let C=!FD(this,q0,"m",o2).call(this)&&u||this.baseURL,E=W2(D)?new URL(D):new URL(C+(C.endsWith("/")&&D.startsWith("/")?D.slice(1):D)),A=this.defaultQuery();if(!O2(A))F={...A,...F};if(typeof F==="object"&&F&&!Array.isArray(F))E.search=this.stringifyQuery(F);return E.toString()}async prepareOptions(D){}async prepareRequest(D,{url:F,options:u}){}get(D,F){return this.methodRequest("get",D,F)}post(D,F){return this.methodRequest("post",D,F)}patch(D,F){return this.methodRequest("patch",D,F)}put(D,F){return this.methodRequest("put",D,F)}delete(D,F){return this.methodRequest("delete",D,F)}methodRequest(D,F,u){return this.request(Promise.resolve(u).then((C)=>{return{method:D,path:F,...C}}))}request(D,F=null){return new GD(this,this.makeRequest(D,F,void 0))}async makeRequest(D,F,u){let C=await D,E=C.maxRetries??this.maxRetries;if(F==null)F=E;await this.prepareOptions(C);let{req:A,url:$,timeout:Q}=await this.buildRequest(C,{retryCount:E-F});await this.prepareRequest(A,{url:$,options:C});let Y="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),J=u===void 0?"":`, retryOf: ${u}`,X=Date.now();if(m(this).debug(`[${Y}] sending request`,s({retryOfRequestLogID:u,method:C.method,url:$,options:C,headers:A.headers})),C.signal?.aborted)throw new xD;let Z=new AbortController,B=await this.fetchWithTimeout($,A,Q,Z).catch(eD),G=Date.now();if(B instanceof globalThis.Error){let T=`retrying, ${F} attempts remaining`;if(C.signal?.aborted)throw new xD;let W=_2(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(F)return m(this).info(`[${Y}] connection ${W?"timed out":"failed"} - ${T}`),m(this).debug(`[${Y}] connection ${W?"timed out":"failed"} (${T})`,s({retryOfRequestLogID:u,url:$,durationMs:G-X,message:B.message})),this.retryRequest(C,F,u??Y);if(m(this).info(`[${Y}] connection ${W?"timed out":"failed"} - error; no more retries left`),m(this).debug(`[${Y}] connection ${W?"timed out":"failed"} (error; no more retries left)`,s({retryOfRequestLogID:u,url:$,durationMs:G-X,message:B.message})),W)throw new DF;throw new QD({cause:B})}let z=`[${Y}${J}] ${A.method} ${$} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${G-X}ms`;if(!B.ok){let T=await this.shouldRetry(B);if(F&&T){let q=`retrying, ${F} attempts remaining`;return await w2(B.body),m(this).info(`${z} - ${q}`),m(this).debug(`[${Y}] response error (${q})`,s({retryOfRequestLogID:u,url:B.url,status:B.status,headers:B.headers,durationMs:G-X})),this.retryRequest(C,F,u??Y,B.headers)}let W=T?"error; no more retries left":"error; not retryable";m(this).info(`${z} - ${W}`);let O=await B.text().catch((q)=>eD(q).message),_=U2(O),V=_?void 0:O;throw m(this).debug(`[${Y}] response error (${W})`,s({retryOfRequestLogID:u,url:B.url,status:B.status,headers:B.headers,message:V,durationMs:Date.now()-X})),this.makeStatusError(B.status,_,V,B.headers)}return m(this).info(z),m(this).debug(`[${Y}] response start`,s({retryOfRequestLogID:u,url:B.url,status:B.status,headers:B.headers,durationMs:G-X})),{response:B,options:C,controller:Z,requestLogID:Y,retryOfRequestLogID:u,startTime:X}}getAPIList(D,F,u){return this.requestAPIList(F,u&&"then"in u?u.then((C)=>({method:"get",path:D,...C})):{method:"get",path:D,...u})}requestAPIList(D,F){let u=this.makeRequest(F,null,void 0);return new gF(this,u,D)}async fetchWithTimeout(D,F,u,C){let{signal:E,method:A,...$}=F||{},Q=this._makeAbort(C);if(E)E.addEventListener("abort",Q,{once:!0});let Y=setTimeout(Q,u),J=globalThis.ReadableStream&&$.body instanceof globalThis.ReadableStream||typeof $.body==="object"&&$.body!==null&&Symbol.asyncIterator in $.body,X={signal:C.signal,...J?{duplex:"half"}:{},method:"GET",...$};if(A)X.method=A.toUpperCase();try{return await this.fetch.call(void 0,D,X)}finally{clearTimeout(Y)}}async shouldRetry(D){let F=D.headers.get("x-should-retry");if(F==="true")return!0;if(F==="false")return!1;if(D.status===408)return!0;if(D.status===409)return!0;if(D.status===429)return!0;if(D.status>=500)return!0;return!1}async retryRequest(D,F,u,C){let E,A=C?.get("retry-after-ms");if(A){let Q=parseFloat(A);if(!Number.isNaN(Q))E=Q}let $=C?.get("retry-after");if($&&!E){let Q=parseFloat($);if(!Number.isNaN(Q))E=Q*1000;else E=Date.parse($)-Date.now()}if(!(E&&0<=E&&E<60000)){let Q=D.maxRetries??this.maxRetries;E=this.calculateDefaultRetryTimeoutMillis(F,Q)}return await V2(E),this.makeRequest(D,F-1,u)}calculateDefaultRetryTimeoutMillis(D,F){let E=F-D,A=Math.min(0.5*Math.pow(2,E),8),$=1-Math.random()*0.25;return A*$*1000}async buildRequest(D,{retryCount:F=0}={}){let u={...D},{method:C,path:E,query:A,defaultBaseURL:$}=u,Q=this.buildURL(E,A,$);if("timeout"in u)N2("timeout",u.timeout);u.timeout=u.timeout??this.timeout;let{bodyHeaders:Y,body:J}=this.buildBody({options:u}),X=await this.buildHeaders({options:D,method:C,bodyHeaders:Y,retryCount:F});return{req:{method:C,headers:X,...u.signal&&{signal:u.signal},...globalThis.ReadableStream&&J instanceof globalThis.ReadableStream&&{duplex:"half"},...J&&{body:J},...this.fetchOptions??{},...u.fetchOptions??{}},url:Q,timeout:u.timeout}}async buildHeaders({options:D,method:F,bodyHeaders:u,retryCount:C}){let E={};if(this.idempotencyHeader&&F!=="get"){if(!D.idempotencyKey)D.idempotencyKey=this.defaultIdempotencyKey();E[this.idempotencyHeader]=D.idempotencyKey}let A=k([E,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(C),...D.timeout?{"X-Stainless-Timeout":String(Math.trunc(D.timeout/1000))}:{},...x2()},await this.authHeaders(D),this._options.defaultHeaders,u,D.headers]);return this.validateHeaders(A),A.values}_makeAbort(D){return()=>D.abort()}buildBody({options:{body:D,headers:F}}){if(!D)return{bodyHeaders:void 0,body:void 0};let u=k([F]);if(ArrayBuffer.isView(D)||D instanceof ArrayBuffer||D instanceof DataView||typeof D==="string"&&u.values.has("content-type")||globalThis.Blob&&D instanceof globalThis.Blob||D instanceof FormData||D instanceof URLSearchParams||globalThis.ReadableStream&&D instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:D};else if(typeof D==="object"&&((Symbol.asyncIterator in D)||(Symbol.iterator in D)&&("next"in D)&&typeof D.next==="function"))return{bodyHeaders:void 0,body:_0(D)};else return FD(this,lF,"f").call(this,{body:D,headers:u})}}M0=U,lF=new WeakMap,q0=new WeakSet,o2=function(){return this.baseURL!==e2[this._options.environment||"live_mode"]};U.DodoPayments=M0;U.DEFAULT_TIMEOUT=60000;U.DodoPaymentsError=g;U.APIError=v;U.APIConnectionError=QD;U.APIConnectionTimeoutError=DF;U.APIUserAbortError=xD;U.NotFoundError=EF;U.ConflictError=BF;U.RateLimitError=$F;U.BadRequestError=FF;U.AuthenticationError=uF;U.InternalServerError=ZF;U.PermissionDeniedError=CF;U.UnprocessableEntityError=AF;U.toFile=cF;U.CheckoutSessions=jD;U.Payments=hD;U.Subscriptions=cD;U.Invoices=JD;U.Licenses=bD;U.LicenseKeys=PD;U.LicenseKeyInstances=fD;U.Customers=CD;U.Refunds=mD;U.Disputes=ID;U.Payouts=gD;U.Products=ED;U.Misc=yD;U.Discounts=LD;U.Addons=SD;U.Brands=RD;U.Webhooks=XD;U.WebhookEvents=lD;U.UsageEvents=dD;U.Meters=vD;U.Balances=wD;C0();import Q2 from"node:process";import N3 from"node:path";import{fileURLToPath as e6}from"node:url";import D1 from"node:child_process";import F1,{constants as u1}from"node:fs/promises";import{promisify as L6}from"node:util";import I6 from"node:child_process";import F2,{constants as Q3}from"node:fs/promises";import B3 from"node:process";import x6 from"node:os";import S6 from"node:fs";import q6 from"node:fs";import C3 from"node:fs";var s0;function V6(){try{return C3.statSync("/.dockerenv"),!0}catch{return!1}}function H6(){try{return C3.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function o0(){if(s0===void 0)s0=V6()||H6();return s0}var e0,M6=()=>{try{return q6.statSync("/run/.containerenv"),!0}catch{return!1}};function aD(){if(e0===void 0)e0=M6()||o0();return e0}var E3=()=>{if(B3.platform!=="linux")return!1;if(x6.release().toLowerCase().includes("microsoft")){if(aD())return!1;return!0}try{return S6.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!aD():!1}catch{return!1}},DD=B3.env.__IS_WSL_TEST__?E3:E3();import A3 from"node:process";import{Buffer as w6}from"node:buffer";import{promisify as R6}from"node:util";import j6 from"node:child_process";var k6=R6(j6.execFile),D2=()=>`${A3.env.SYSTEMROOT||A3.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var n=async(D,F={})=>{let{powerShellPath:u,...C}=F,E=n.encodeCommand(D);return k6(u??D2(),[...n.argumentsPrefix,E],{encoding:"utf8",...C})};n.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];n.encodeCommand=(D)=>w6.from(D,"utf16le").toString("base64");n.escapeArgument=(D)=>`'${String(D).replaceAll("'","''")}'`;function $3(D){for(let F of D.split(`
28
+ `)){if(/^\s*#/.test(F))continue;let u=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(F);if(!u)continue;return u.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var f6=L6(I6.execFile),P6=(()=>{let F;return async function(){if(F)return F;let u="/etc/wsl.conf",C=!1;try{await F2.access(u,Q3.F_OK),C=!0}catch{}if(!C)return"/mnt/";let E=await F2.readFile(u,{encoding:"utf8"}),A=$3(E);if(A===void 0)return"/mnt/";return F=A,F=F.endsWith("/")?F:`${F}/`,F}})(),b6=async()=>{return`${await P6()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},E0=DD?b6:D2,Z3,G3=async()=>{return Z3??=(async()=>{try{let D=await E0();return await F2.access(D,Q3.X_OK),!0}catch{return!1}})(),Z3},J3=async()=>{let D=await E0(),F=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:u}=await n(F,{powerShellPath:D});return u.trim()},X3=async(D)=>{if(/^[a-z]+:\/\//i.test(D))return D;try{let{stdout:F}=await f6("wslpath",["-aw",D],{encoding:"utf8"});return F.trim()}catch{return D}};function ND(D,F,u){let C=(E)=>Object.defineProperty(D,F,{value:E,enumerable:!0,writable:!0});return Object.defineProperty(D,F,{configurable:!0,enumerable:!0,get(){let E=u();return C(E),E},set(E){C(E)}}),D}import{promisify as a6}from"node:util";import A2 from"node:process";import{execFile as r6}from"node:child_process";import{promisify as v6}from"node:util";import y6 from"node:process";import{execFile as h6}from"node:child_process";var g6=v6(h6);async function u2(){if(y6.platform!=="darwin")throw Error("macOS only");let{stdout:D}=await g6("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),u=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(D)?.groups.id??"com.apple.Safari";if(u==="com.apple.safari")return"com.apple.Safari";return u}import m6 from"node:process";import{promisify as c6}from"node:util";import{execFile as d6,execFileSync as q9}from"node:child_process";var l6=c6(d6);async function Y3(D,{humanReadableOutput:F=!0,signal:u}={}){if(m6.platform!=="darwin")throw Error("macOS only");let C=F?[]:["-ss"],E={};if(u)E.signal=u;let{stdout:A}=await l6("osascript",["-e",D,C],E);return A.trim()}async function C2(D){return Y3(`tell application "Finder" to set app_path to application file id "${D}" as string
29
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as p6}from"node:util";import{execFile as n6}from"node:child_process";var i6=p6(n6),z3={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},B0=new Map(Object.entries(z3));class E2 extends Error{}async function B2(D=i6){let{stdout:F}=await D("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),u=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(F);if(!u)throw new E2(`Cannot find Windows browser in stdout: ${JSON.stringify(F)}`);let{id:C}=u.groups,E=z3[C];if(!E)throw new E2(`Unknown browser ID: ${C}`);return E}var t6=a6(r6),s6=(D)=>D.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(F)=>F.toUpperCase());async function $2(){if(A2.platform==="darwin"){let D=await u2();return{name:await C2(D),id:D}}if(A2.platform==="linux"){let{stdout:D}=await t6("xdg-mime",["query","default","x-scheme-handler/http"]),F=D.trim();return{name:s6(F.replace(/.desktop$/,"").replace("-"," ")),id:F}}if(A2.platform==="win32")return B2();throw Error("Only macOS, Linux, and Windows are supported")}import Z2 from"node:process";var o6=Boolean(Z2.env.SSH_CONNECTION||Z2.env.SSH_CLIENT||Z2.env.SSH_TTY),K3=o6;var A0=Symbol("fallbackAttempt"),G2=import.meta.url?N3.dirname(e6(import.meta.url)):"",_3=N3.join(G2,"xdg-open"),{platform:rD,arch:W3}=Q2,O3=async(D,F)=>{if(D.length===0)return;let u=[];for(let C of D)try{return await F(C)}catch(E){u.push(E)}throw AggregateError(u,"Failed to open in all supported apps")},$0=async(D)=>{D={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...D};let F=D[A0]===!0;if(delete D[A0],Array.isArray(D.app))return O3(D.app,(J)=>$0({...D,app:J,[A0]:!0}));let{name:u,arguments:C=[]}=D.app??{};if(C=[...C],Array.isArray(u))return O3(u,(J)=>$0({...D,app:{name:J,arguments:C},[A0]:!0}));if(u==="browser"||u==="browserPrivate"){let J={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},X={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},Z;if(DD){let B=await J3();Z=B0.get(B)??{}}else Z=await $2();if(Z.id in J){let B=J[Z.id.toLowerCase()];if(u==="browserPrivate"){if(B==="safari")throw Error("Safari doesn't support opening in private mode via command line");C.push(X[B])}return $0({...D,app:{name:tD[B],arguments:C}})}throw Error(`${Z.name} is not supported as a default browser`)}let E,A=[],$={},Q=!1;if(DD&&!aD()&&!K3&&!u)Q=await G3();if(rD==="darwin"){if(E="open",D.wait)A.push("--wait-apps");if(D.background)A.push("--background");if(D.newInstance)A.push("--new");if(u)A.push("-a",u)}else if(rD==="win32"||Q){if(E=await E0(),A.push(...n.argumentsPrefix),!DD)$.windowsVerbatimArguments=!0;if(DD&&D.target)D.target=await X3(D.target);let J=["$ProgressPreference = 'SilentlyContinue';","Start"];if(D.wait)J.push("-Wait");if(u){if(J.push(n.escapeArgument(u)),D.target)C.push(D.target)}else if(D.target)J.push(n.escapeArgument(D.target));if(C.length>0)C=C.map((X)=>n.escapeArgument(X)),J.push("-ArgumentList",C.join(","));if(D.target=n.encodeCommand(J.join(" ")),!D.wait)$.stdio="ignore"}else{if(u)E=u;else{let J=!G2||G2==="/",X=!1;try{await F1.access(_3,u1.X_OK),X=!0}catch{}E=Q2.versions.electron??(rD==="android"||J||!X)?"xdg-open":_3}if(C.length>0)A.push(...C);if(!D.wait)$.stdio="ignore",$.detached=!0}if(rD==="darwin"&&C.length>0)A.push("--args",...C);if(D.target)A.push(D.target);let Y=D1.spawn(E,A,$);if(D.wait)return new Promise((J,X)=>{Y.once("error",X),Y.once("close",(Z)=>{if(!D.allowNonzeroExitCode&&Z!==0){X(Error(`Exited with code ${Z}`));return}J(Y)})});if(F)return new Promise((J,X)=>{Y.once("error",X),Y.once("spawn",()=>{Y.once("close",(Z)=>{if(Y.off("error",X),Z!==0){X(Error(`Exited with code ${Z}`));return}Y.unref(),J(Y)})})});return Y.unref(),new Promise((J,X)=>{Y.once("error",X),Y.once("spawn",()=>{Y.off("error",X),J(Y)})})},C1=(D,F)=>{if(typeof D!=="string")throw TypeError("Expected a `target`");return $0({...F,target:D})};function T3(D){if(typeof D==="string"||Array.isArray(D))return D;let{[W3]:F}=D;if(!F)throw Error(`${W3} is not supported`);return F}function LF({[rD]:D},{wsl:F}={}){if(F&&DD)return T3(F);if(!D)throw Error(`${rD} is not supported`);return T3(D)}var tD={browser:"browser",browserPrivate:"browserPrivate"};ND(tD,"chrome",()=>LF({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));ND(tD,"brave",()=>LF({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));ND(tD,"firefox",()=>LF({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));ND(tD,"edge",()=>LF({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));ND(tD,"safari",()=>LF({darwin:"Safari"}));var Z0=C1;var a={USD:"$",INR:"₹",EUR:"€",GBP:"£"};import HD from"node:fs";C0();async function J2({API_KEY:D,DodoClient:F}){let u=await x({message:"Enter the endpoint URL: "}),C;if(process.env.DODO_WH_TEST_SERVER_URL)C=`https://${process.env.DODO_WH_TEST_SERVER_URL}/`;else C="https://wsserver.dodopayments.tech/";let E=!1;if((await F.webhooks.list({limit:100})).data.forEach((Y)=>{if(Y.url===C)E=!0}),!E)await F.webhooks.create({url:C,description:"This webhook as been automatically added by Dodo Payments CLI for testing webhooks"});let $;if(process.env.DODO_WH_TEST_SERVER_URL)$=`wss://${process.env.DODO_WH_TEST_SERVER_URL}/connect`;else $="wss://wsserver.dodopayments.tech/connect";let Q=new WebSocket($,{headers:{"api-key":D}});Q.onopen=()=>{console.log("Successfully connected to Dodo Payments CLI Webhook Server ✅")},Q.onmessage=async(Y)=>{try{let J=JSON.parse(Y.data.toString());if(J.requestId){console.log("Received webhook!"),console.log("Event Type:",J.payload.type);let X=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json",...J.headers},body:JSON.stringify(J.payload)}),Z=await X.text(),B;try{B=JSON.parse(Z)}catch(z){B=Z}let G={};X.headers.forEach((z,T)=>{G[T]=z}),console.log("Status:",X.status),console.log("Response:",B),console.log(),Q.send(JSON.stringify({type:"webhook_response",requestId:J.requestId,status:X.status,body:B,headers:G}))}}catch(J){console.error("Failed to parse or respond to message",J)}},Q.onclose=(Y)=>{console.log("Disconnected from Dodo Payments CLI Webhook Server"),console.log("Reason:",Y.reason),console.log("Code:",Y.code)},Q.onerror=(Y)=>{console.log("Error in Dodo Payments CLI Webhook Server:",Y)}}var l={products:[{command:"list",description:"List your products"},{command:"create",description:"Create a new product"},{command:"info",description:"Get info about a product"}],payments:[{command:"list",description:"List your payments"},{command:"info",description:"Information about a payment"}],customers:[{command:"list",description:"List your customers"},{command:"create",description:"Create a customer"},{command:"update",description:"Update a customer"}],discounts:[{command:"list",description:"List your discounts"},{command:"create",description:"Create a discount"},{command:"delete",description:"Remove a discount"}],licences:[{command:"list",description:"List licences"}],addons:[{command:"create",description:"Create an addon"},{command:"list",description:"List addons"},{command:"info",description:"Get addon info"}],refunds:[{command:"list",description:"List refunds"},{command:"info",description:"Get refund info"}],wh:[{command:"listen",description:"Listen to webhook events directly from Dodo Payments"},{command:"trigger",description:"Trigger a webhook event"}],checkout:[{command:"new",description:"Create a checkout session"}]};var Q1=`
30
30
  /$$$$$$$ /$$ /$$$$$$ /$$ /$$$$$$
31
31
  | $$__ $$ | $$ /$$__ $$| $$ |_ $$_/
32
32
  | $$ \\ $$ /$$$$$$ /$$$$$$$ /$$$$$$ | $$ \\__/| $$ | $$
@@ -37,4 +37,4 @@ tell application "System Events" to get value of property list item "CFBundleNam
37
37
  |_______/ \\______/ \\_______/ \\______/ \\______/ |________/|______/
38
38
 
39
39
  The CLI to manage Dodo Payments!
40
- `;function Ju(D){return typeof D==="object"&&D!==null&&"error"in D&&typeof D.error?.code==="string"}var IF=(D,F)=>`\x1B]8;;${F}\x1B\\${D}\x1B]8;;\x1B\\`,o={products:[{command:"list",description:"List your products"},{command:"create",description:"Create a new product"},{command:"info",description:"Get info about a product"}],payments:[{command:"list",description:"List your payments"},{command:"info",description:"Information about a payment"}],customers:[{command:"list",description:"List your customers"},{command:"create",description:"Create a customer"},{command:"update",description:"Update a customer"}],discounts:[{command:"list",description:"List your discounts"},{command:"create",description:"Create a discount"},{command:"delete",description:"Remove a discount"}],wh:[{command:"",description:"Send a webhook event"}]},o3=process.argv,l=o3[2],c=o3[3],HD=$C.homedir(),Xu=()=>{console.log(ZC),Object.keys(o).forEach((D)=>{console.log(`Category: ${D}`),o[D].forEach((F)=>{console.log(`dodo ${D} ${F.command} - ${F.description}`)}),console.log("")})};if(l==="login"){Zu("https://app.dodopayments.com/developer/api-keys");let D=await j({message:"Enter your Dodo Payments API Key:",required:!0}),F=await nD({choices:[{name:"Test Mode",value:"test_mode"},{name:"Live Mode",value:"live_mode"}],message:"Choose the environment:"}),u=new U({bearerToken:D,environment:F});console.log("Verifying Dodo Payments API Key");try{await u.products.list({page_size:1}),console.log("Successfully verified your Dodo Payments API Key!")}catch(E){console.log("Something went wrong while authenticating:",E),process.exit(1)}console.log("Storing / Updating existing configuration...");let C;try{C=Object.create(JSON.parse(VD.readFileSync(UD.join(HD,".dodopayments","api-key"),"utf-8")))}catch{C={}}if(C[F]=D,!VD.existsSync(UD.join(HD,".dodopayments")))VD.mkdirSync(UD.join(HD,".dodopayments"));VD.writeFileSync(UD.join(HD,".dodopayments","api-key"),JSON.stringify(C)),C[F]=D,console.log("Setup complete successfully!"),process.exit(0)}if(l==="wh")await t3().then(() => AC);if(!VD.existsSync(UD.join(HD,".dodopayments","api-key")))if(l&&c)console.log("Please login using `dodo login` command first!"),process.exit(0);else if(l){if(l in o)console.log(`Category: ${l}`),o[l].forEach((D)=>{console.log(`dodo ${l} ${D.command} - ${D.description}`)}),console.log("\nPlease login using `dodo login` command first!");else Xu();process.exit(0)}else Xu(),console.log("Please login using `dodo login` command first!"),process.exit(0);var $0;try{$0=JSON.parse(VD.readFileSync(UD.join(HD,".dodopayments","api-key"),"utf-8"))}catch{VD.rmSync(UD.join(HD,".dodopayments","api-key"),{force:!0}),console.log("Failed to decode API Key configuration. Your config has been reset. Please log in again using `dodo login`"),process.exit(0)}var Gu,LF,s3=Object.keys($0);if(s3.length===1)LF=s3[0],Gu=$0[LF];else LF=await nD({choices:[{name:"Test Mode",value:"test_mode"},{name:"Live Mode",value:"live_mode"}],message:"Choose the environment:"}),Gu=$0[LF];var p=new U({bearerToken:Gu,environment:LF});if(l==="products")if(c==="list"){let D=await j({message:"Enter page:",default:"1",validate:(C)=>C.trim()!==""}),u=(await p.products.list({page_number:parseInt(D)-1,page_size:100})).items.map((C)=>({name:C.name,product_id:C.product_id,created_at:new Date(C.created_at).toLocaleString(),...C.is_recurring?{price:`${TD[C.price_detail.currency]||C.price_detail.currency+" "}${(C.price*0.01).toFixed(2)} Every ${C.price_detail?.payment_frequency_count} ${C.price_detail?.payment_frequency_interval}`}:{price:`${TD[C.price_detail.currency]||C.price_detail.currency+" "}${(C.price*0.01).toFixed(2)} (One Time)`},edit_url:IF("CTRL + Click to open",`https://app.dodopayments.com/products/edit?id=${C.product_id}`)}));console.table(u)}else if(c==="create")Zu("https://app.dodopayments.com/products/create");else if(c==="info")try{let D=await j({message:"Enter product ID:",validate:(u)=>u.startsWith("pdt_")||"Please enter a valid product ID!"}),F=await p.products.retrieve(D);console.table({product_id:F.product_id,name:F.name,...F.description?.trim()!==""&&{description:F.description},created_at:new Date(F.created_at).toLocaleString(),updated_at:new Date(F.updated_at).toLocaleString(),...F.is_recurring?{price:`${TD[F.price.currency]||F.price.currency+" "}${((F.price.price||F.price.fixed_price)*0.01).toFixed(2)} Every ${F.price.payment_frequency_count} ${F.price.payment_frequency_interval}`}:{price:`${TD[F.price.currency]||F.price.currency+" "}${((F.price.price||F.price.fixed_price)*0.01).toFixed(2)} (One Time)`},tax_category:F.tax_category,edit_url:IF("CTRL + Click to open",`https://app.dodopayments.com/products/edit?id=${F.product_id}`)})}catch(D){if(Ju(D)&&D.error.code==="NOT_FOUND")console.log("Incorrect product ID!");else console.error(D)}else o.products.forEach((D)=>{console.log(`dodo products ${D.command} - ${D.description}`)});else if(l==="payments")if(c==="list"){let D=await j({message:"Enter page:",default:"1",validate:(C)=>C.trim()!==""}),u=(await p.payments.list({page_number:parseInt(D)-1,page_size:100})).items.map((C)=>{return{"payment id":C.payment_id,"created at":new Date(C.created_at).toLocaleString(),"subscription id":C.subscription_id,"total amount":`${TD[C.currency]||C.currency+" "}${(C.total_amount*0.01).toFixed(2)}`,status:C.status,"more info":IF("CTRL + Click to open",`https://app.dodopayments.com/transactions/payments/${C.payment_id}`)}});console.table(u)}else if(c==="info")try{let F=await p.payments.retrieve("pay_0NWiGvZPWxeWeNWISbfat");console.log(F);let u={"payment id":F.payment_id,status:F.status,"total amount":`${TD[F.currency]||F.currency+" "}${(F.total_amount*0.01).toFixed(2)}`,"payment method":F.payment_method,createdAt:new Date(F.created_at).toLocaleString(),customer:F.customer.customer_id,"customer email":F.customer.email,...F.subscription_id&&{"subscription id":F.subscription_id},"billing address street":`${F.billing.street}`,"billing address state":`${F.billing.state}`,"billing address city":`${F.billing.city}`,"billing address country":`${F.billing.country}`,"billing address zipcode":`${F.billing.zipcode}`,"more info":IF("Ctrl + Click to open",`https://app.dodopayments.com/transactions/payments/${F.payment_id}`)};console.table(u)}catch(D){if(Ju(D)&&D.error.code==="NOT_FOUND")console.log("Incorrect payment ID!");else console.error(D)}else o.payments.forEach((D)=>{console.log(`dodo payments ${D.command} - ${D.description}`)});else if(l==="customers")if(c==="list"){let D=await j({message:"Enter page:",default:"1",validate:(F)=>F.trim()!==""});console.table((await p.customers.list({page_number:parseInt(D)-1,page_size:100})).items,["customer_id","name","email","phone_number"])}else if(c==="create"){let D=await j({message:"Enter Name: ",validate:(E)=>E.trim()!==""}),F=await j({message:"Enter Email: ",validate:(E)=>E.trim()!==""}),u=await j({message:"Enter Phone Number: "}),C=await p.customers.create({name:D,email:F,phone_number:u.trim()!==""?u:null});console.log("Customer Successfully Created!"),console.table([C],["customer_id","name","email","phone_number"])}else if(c==="update"){let D=await j({message:"Enter customer ID:",validate:(F)=>F.startsWith("cus_")||"Please enter a valid customer ID!"});try{let F=await p.customers.retrieve(D),u=await j({message:"Enter customer name:",default:F.name}),C=await j({message:"Enter customer phone:",default:F.phone_number?.toString()}),E=await p.customers.update(D,{name:u,phone_number:C.trim()!==""?C:null});console.table([E],["customer_id","name","email","phone_number"])}catch(F){if(Ju(F)&&F.error.code==="NOT_FOUND")console.log("Incorrect customer ID!");else console.error(F)}}else o.products.forEach((D)=>{console.log(`dodo customers ${D.command} - ${D.description}`)});else if(l==="discounts")if(c==="list"){let D=await j({message:"Enter page:",default:"1",validate:(C)=>C.trim()!==""}),u=(await p.discounts.list({page_number:parseInt(D)-1,page_size:100})).items.map((C)=>({name:C.name,code:C.code,"discount id":C.discount_id,"created at":new Date(C.created_at).toLocaleString(),...C.type==="percentage"?{amount:`${(C.amount*0.01).toFixed(2)}%`}:{amount:C.amount},"more info":IF("Ctrl + Click for more info",`https://app.dodopayments.com/sales/discounts/edit?id=${C.discount_id}`)}));console.table(u)}else if(c==="create"){let D=await j({message:"Enter discount name:",validate:(B)=>B.trim()!==""}),F=await j({message:"Enter discount percentage:",validate:(B)=>{let $=parseFloat(B);if(!Number.isNaN($)&&$>0&&$<=100)return!0;else return!1}}),u=await j({message:"Enter discount code (Optional):"}),C=await j({message:"Enter discount cycles (Optional):"}),E=await p.discounts.create({name:D,code:u.trim()!==""?u:null,amount:parseFloat(F)*100,type:"percentage",...C.trim()!==""&&{subscription_cycles:parseInt(C)}});console.log("Discount created successfully!"),console.table({name:E.name,code:E.code,"discount id":E.discount_id,...C.trim()!==""&&{"subscription cycles":E.subscription_cycles}})}else if(c==="delete")await p.discounts.delete(await j({message:"Enter discount ID to be deleted:",validate:(D)=>D.startsWith("dsc_")})),console.log("Successfully deleted discount!");else o.discounts.forEach((D)=>{console.log(`dodo discounts ${D.command} - ${D.description}`)});else if(l==="licences")if(c==="list"){let D=await j({message:"Enter page:",default:"1",validate:(u)=>u.trim()!==""}),F=await p.licenseKeys.list({page_number:parseInt(D)-1,page_size:100});console.log(F.items)}else o.licences.forEach((D)=>{console.log(`dodo licences ${D.command} - ${D.description}`)});else Xu();
40
+ `;function sD(D){return typeof D==="object"&&D!==null&&"error"in D&&typeof D.error?.code==="string"}var e3=process.argv,y=e3[2],I=e3[3],qD=Z1.homedir(),Y2=()=>{console.log(Q1),Object.keys(l).forEach((D)=>{console.log(`Category: ${D}`),l[D].forEach((F)=>{console.log(`dodo ${D} ${F.command} - ${F.description}`)}),console.log("")})};if(y==="login"){Z0("https://app.dodopayments.com/developer/api-keys");let D=await x({message:"Enter your Dodo Payments API Key:",required:!0}),F=await e({choices:[{name:"Test Mode",value:"test_mode"},{name:"Live Mode",value:"live_mode"}],message:"Choose the environment:"}),u=new U({bearerToken:D,environment:F});console.log("Verifying Dodo Payments API Key");try{await u.products.list({page_size:1}),console.log("Successfully verified your Dodo Payments API Key!")}catch(E){console.log("Something went wrong while authenticating, please check your API key!"),process.exit(1)}console.log("Storing / Updating existing configuration...");let C;try{C=JSON.parse(HD.readFileSync(VD.join(qD,".dodopayments","api-key"),"utf-8"))}catch{C={}}if(C[F]=D,!HD.existsSync(VD.join(qD,".dodopayments")))HD.mkdirSync(VD.join(qD,".dodopayments"));HD.writeFileSync(VD.join(qD,".dodopayments","api-key"),JSON.stringify(C)),console.log("Setup complete successfully!"),process.exit(0)}if(!HD.existsSync(VD.join(qD,".dodopayments","api-key")))if(y&&I)console.log("Please login using `dodo login` command first!"),process.exit(0);else if(y){if(y in l)console.log(`Category: ${y}`),l[y].forEach((D)=>{console.log(`dodo ${y} ${D.command} - ${D.description}`)}),console.log("\nPlease login using `dodo login` command first!");else Y2();process.exit(0)}else Y2(),console.log("Please login using `dodo login` command first!"),process.exit(0);var G0;try{G0=JSON.parse(HD.readFileSync(VD.join(qD,".dodopayments","api-key"),"utf-8"))}catch{HD.rmSync(VD.join(qD,".dodopayments","api-key"),{force:!0}),console.log("Failed to decode API Key configuration. Your config has been reset. Please log in again using `dodo login`"),process.exit(0)}var J0,fF,o3=Object.keys(G0);if(o3.length===1)fF=o3[0],J0=G0[fF];else fF=await e({choices:[{name:"Test Mode",value:"test_mode"},{name:"Live Mode",value:"live_mode"}],message:"Choose the environment:"}),J0=G0[fF];var b=new U({bearerToken:J0,environment:fF});if(y==="products")if(I==="list"){let D=await x({message:"Enter page:",default:"1",validate:(C)=>C.trim()!==""}),u=(await b.products.list({page_number:parseInt(D)-1,page_size:100})).items.map((C)=>({name:C.name,"product id":C.product_id,created_at:new Date(C.created_at).toLocaleString(),...C.is_recurring?{price:`${a[C.price_detail.currency]||C.price_detail.currency+" "}${(C.price*0.01).toFixed(2)} Every ${C.price_detail.payment_frequency_count} ${C.price_detail?.payment_frequency_interval}`}:{price:`${a[C.price_detail.currency]||C.price_detail.currency+" "}${(C.price*0.01).toFixed(2)} (One Time)`}}));console.table(u),console.log("To edit a product, go to https://app.dodopayments.com/products/edit?id={product_id}")}else if(I==="create")Z0("https://app.dodopayments.com/products/create");else if(I==="info")try{let D=await x({message:"Enter product ID:",validate:(u)=>u.startsWith("pdt_")||"Please enter a valid product ID!"}),F=await b.products.retrieve(D);console.table({"product id":F.product_id,name:F.name,...F.description?.trim()!==""&&{description:F.description},created_at:new Date(F.created_at).toLocaleString(),updated_at:new Date(F.updated_at).toLocaleString(),...F.is_recurring?{price:`${a[F.price.currency]||F.price.currency+" "}${((F.price.price||F.price.fixed_price)*0.01).toFixed(2)} Every ${F.price.payment_frequency_count} ${F.price.payment_frequency_interval}`}:{price:`${a[F.price.currency]||F.price.currency+" "}${(F.price.price*0.01).toFixed(2)} (One Time)`},tax_category:F.tax_category}),console.log(`To edit the product, go to https://app.dodopayments.com/products/edit?id=${F.product_id}`)}catch(D){if(sD(D)&&D.error.code==="NOT_FOUND")console.log("Incorrect product ID!");else console.error(D)}else l.products.forEach((D)=>{console.log(`dodo products ${D.command} - ${D.description}`)});else if(y==="payments")if(I==="list"){let D=await x({message:"Enter page:",default:"1",validate:(C)=>C.trim()!==""}),u=(await b.payments.list({page_number:parseInt(D)-1,page_size:100})).items.map((C)=>{return{"payment id":C.payment_id,"created at":new Date(C.created_at).toLocaleString(),"subscription id":C.subscription_id,"total amount":`${a[C.currency]||C.currency+" "}${(C.total_amount*0.01).toFixed(2)}`,status:C.status}});console.table(u),console.log("To view a payment, go to https://app.dodopayments.com/transactions/payments/{payment_id}")}else if(I==="info")try{let F=await b.payments.retrieve("pay_0NWiGvZPWxeWeNWISbfat");console.log(F);let u={"payment id":F.payment_id,status:F.status,"total amount":`${a[F.currency]||F.currency+" "}${(F.total_amount*0.01).toFixed(2)}`,"payment method":F.payment_method,createdAt:new Date(F.created_at).toLocaleString(),customer:F.customer.customer_id,"customer email":F.customer.email,...F.subscription_id&&{"subscription id":F.subscription_id},"billing address street":`${F.billing.street}`,"billing address state":`${F.billing.state}`,"billing address city":`${F.billing.city}`,"billing address country":`${F.billing.country}`,"billing address zipcode":`${F.billing.zipcode}`};console.table(u),console.log(`To view the payment, go to https://app.dodopayments.com/transactions/payments/${F.payment_id}`)}catch(D){if(sD(D)&&D.error.code==="NOT_FOUND")console.log("Incorrect payment ID!");else console.error(D)}else l.payments.forEach((D)=>{console.log(`dodo payments ${D.command} - ${D.description}`)});else if(y==="customers")if(I==="list"){let D=await x({message:"Enter page:",default:"1",validate:(F)=>F.trim()!==""});console.table((await b.customers.list({page_number:parseInt(D)-1,page_size:100})).items,["customer_id","name","email","phone_number"])}else if(I==="create"){let D=await x({message:"Enter Name: ",validate:(E)=>E.trim()!==""}),F=await x({message:"Enter Email: ",validate:(E)=>E.trim()!==""}),u=await x({message:"Enter Phone Number: "}),C=await b.customers.create({name:D,email:F,phone_number:u.trim()!==""?u:null});console.log("Customer Successfully Created!"),console.table([C],["customer_id","name","email","phone_number"])}else if(I==="update"){let D=await x({message:"Enter customer ID:",validate:(F)=>F.startsWith("cus_")||"Please enter a valid customer ID!"});try{let F=await b.customers.retrieve(D),u=await x({message:"Enter customer name:",default:F.name}),C=await x({message:"Enter customer phone:",default:F.phone_number?.toString()}),E=await b.customers.update(D,{name:u,phone_number:C.trim()!==""?C:null});console.table([E],["customer_id","name","email","phone_number"])}catch(F){if(sD(F)&&F.error.code==="NOT_FOUND")console.log("Incorrect customer ID!");else console.error(F)}}else l.customers.forEach((D)=>{console.log(`dodo customers ${D.command} - ${D.description}`)});else if(y==="discounts")if(I==="list"){let D=await x({message:"Enter page:",default:"1",validate:(C)=>C.trim()!==""}),u=(await b.discounts.list({page_number:parseInt(D)-1,page_size:100})).items.map((C)=>({name:C.name,code:C.code,"discount id":C.discount_id,"created at":new Date(C.created_at).toLocaleString(),...C.type==="percentage"?{amount:`${(C.amount*0.01).toFixed(2)}%`}:{amount:C.amount}}));console.table(u),console.log("To view a discount, go to https://app.dodopayments.com/sales/discounts/edit?id={discount_id}")}else if(I==="create"){let D=await x({message:"Enter discount name:",validate:(A)=>A.trim()!==""}),F=await x({message:"Enter discount percentage:",validate:(A)=>{let $=parseFloat(A);if(!Number.isNaN($)&&$>0&&$<=100)return!0;else return!1}}),u=await x({message:"Enter discount code (Optional):"}),C=await x({message:"Enter discount cycles (Optional):"}),E=await b.discounts.create({name:D,code:u.trim()!==""?u:null,amount:parseFloat(F)*100,type:"percentage",...C.trim()!==""&&{subscription_cycles:parseInt(C)}});console.log("Discount created successfully!"),console.table({name:E.name,code:E.code,"discount id":E.discount_id,...C.trim()!==""&&{"subscription cycles":E.subscription_cycles}})}else if(I==="delete")await b.discounts.delete(await x({message:"Enter discount ID to be deleted:",validate:(D)=>D.startsWith("dsc_")})),console.log("Successfully deleted discount!");else l.discounts.forEach((D)=>{console.log(`dodo discounts ${D.command} - ${D.description}`)});else if(y==="licences")if(I==="list"){let D=await x({message:"Enter page:",default:"1",validate:(u)=>u.trim()!==""}),F=await b.licenseKeys.list({page_number:parseInt(D)-1,page_size:100});console.log(F.items)}else l.licences.forEach((D)=>{console.log(`dodo licences ${D.command} - ${D.description}`)});else if(y==="addons")if(I==="create")Z0("https://app.dodopayments.com/products/create/add-on");else if(I==="list"){let D=await x({message:"Enter page:",default:"1",validate:(C)=>C.trim()!==""}),u=(await b.addons.list({page_number:parseInt(D)-1,page_size:100})).items.map((C)=>({id:C.id,name:C.name,price:`${a[C.currency]||C.currency+" "}${C.price*0.01}`,"created on":new Date(C.created_at).toLocaleString()}));console.table(u)}else if(I==="info")try{let D=await x({message:"Enter addon ID:",validate:(u)=>u.startsWith("adn_")||"Please enter a valid addon ID!"}),F=await b.addons.retrieve(D);console.table({"addon id":F.id,name:F.name,price:`${a[F.currency]||F.currency+" "}${F.price*0.01}`,...F.description?.trim()!==""&&{description:F.description},created_at:new Date(F.created_at).toLocaleString(),updated_at:new Date(F.updated_at).toLocaleString(),tax_category:F.tax_category}),console.log(`To edit the addon, go to https://app.dodopayments.com/products/edit/add-on?id=${F.id}`)}catch(D){if(sD(D)&&D.error.code==="NOT_FOUND")console.log("Incorrect addon ID!");else console.error(D)}else l.addons.forEach((D)=>{console.log(`dodo addons ${D.command} - ${D.description}`)});else if(y==="refund")if(I==="list"){let D=await x({message:"Enter page:",default:"1",validate:(C)=>C.trim()!==""}),u=(await b.refunds.list({page_number:parseInt(D)-1,page_size:100})).items.map((C)=>({id:C.refund_id,"payment id":C.payment_id,price:`${a[C.currency||""]||C.currency+" "}${(C.amount||0)*0.01}`,"created on":new Date(C.created_at).toLocaleString()}));console.table(u)}else if(I==="info")try{let D=await x({message:"Enter refund ID:",validate:(u)=>u.startsWith("ref_")||"Please enter a valid refund ID!"}),F=await b.refunds.retrieve(D);console.table({"refund id":F.refund_id,"payment id":F.payment_id,...Object.keys(F.metadata).length>0&&{metadata:F.metadata},"customer id":F.customer.email,"refund type":F.is_partial?"Partial":"Full",price:`${a[F.currency||""]||F.currency+" "}${(F.amount||0)*0.01}`,...F.reason?.trim()!==""&&{reason:F.reason},created_at:new Date(F.created_at).toLocaleString()})}catch(D){if(sD(D)&&D.error.code==="NOT_FOUND")console.log("Incorrect refund ID!");else console.error(D)}else l.refunds.forEach((D)=>{console.log(`dodo refunds ${D.command} - ${D.description}`)});else if(y==="wh")if(I==="listen")J2({API_KEY:J0,DodoClient:b});else if(I==="trigger")s3();else l.wh.forEach((D)=>{console.log(`dodo wh ${D.command} - ${D.description}`)});else if(y==="checkout")if(I==="new"){let D={product_cart:[]},F=await x({message:"Enter product: ",validate:(u)=>{return u.startsWith("pdt_")}});if(D.product_cart=[{product_id:F,quantity:1}],await e({message:"Use advanced options?",choices:[{name:"Yes",value:!0},{name:"No",value:!1}],default:!1})){D.minimal_address=await e({message:"Enable minimal Address:",choices:[{name:"Yes",value:!0},{name:"No",value:!1}],default:!1});let u=await x({message:"Enter return URL (Optional):"});if(u.trim()!=="")D.return_url=u;D.force_3ds=await e({message:"Force 3DS?",choices:[{name:"Yes",value:!0},{name:"No",value:!1}]});let C=await x({message:"Enter discount code (Optional):"});if(C.trim()!=="")D.discount_code=C;let E=await x({message:"Enter metadata (Optional, JSON stringified):"});if(E.trim()!=="")D.metadata=JSON.parse(E)}try{let u=await b.checkoutSessions.create(D);console.log("Checkout Session URL:",u.checkout_url)}catch(u){if(sD(u))console.log(`Error: ${u.error.message}`)}}else l.checkout.forEach((D)=>{console.log(`dodo checkout ${D.command} - ${D.description}`)});else Y2();