mytools-tasks 0.17.13 → 0.18.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.
Files changed (2) hide show
  1. package/dist/index.js +77 -209
  2. package/package.json +12 -19
package/dist/index.js CHANGED
@@ -1,125 +1,122 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var A_=Object.create;var So=Object.defineProperty;var O_=Object.getOwnPropertyDescriptor;var I_=Object.getOwnPropertyNames;var q_=Object.getPrototypeOf,M_=Object.prototype.hasOwnProperty;var ps=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),D_=(t,e)=>{for(var r in e)So(t,r,{get:e[r],enumerable:!0})},F_=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of I_(e))!M_.call(t,o)&&o!==r&&So(t,o,{get:()=>e[o],enumerable:!(n=O_(e,o))||n.enumerable});return t};var B=(t,e,r)=>(r=t!=null?A_(q_(t)):{},F_(e||!t||!t.__esModule?So(r,"default",{value:t,enumerable:!0}):r,t));var Z=S((OE,cc)=>{"use strict";var{FORCE_COLOR:B_,NODE_DISABLE_COLORS:$_,TERM:j_}=process.env,H={enabled:!$_&&j_!=="dumb"&&B_!=="0",reset:Y(0,0),bold:Y(1,22),dim:Y(2,22),italic:Y(3,23),underline:Y(4,24),inverse:Y(7,27),hidden:Y(8,28),strikethrough:Y(9,29),black:Y(30,39),red:Y(31,39),green:Y(32,39),yellow:Y(33,39),blue:Y(34,39),magenta:Y(35,39),cyan:Y(36,39),white:Y(37,39),gray:Y(90,39),grey:Y(90,39),bgBlack:Y(40,49),bgRed:Y(41,49),bgGreen:Y(42,49),bgYellow:Y(43,49),bgBlue:Y(44,49),bgMagenta:Y(45,49),bgCyan:Y(46,49),bgWhite:Y(47,49)};function lc(t,e){let r=0,n,o="",a="";for(;r<t.length;r++)n=t[r],o+=n.open,a+=n.close,e.includes(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return o+e+a}function L_(t,e){let r={has:t,keys:e};return r.reset=H.reset.bind(r),r.bold=H.bold.bind(r),r.dim=H.dim.bind(r),r.italic=H.italic.bind(r),r.underline=H.underline.bind(r),r.inverse=H.inverse.bind(r),r.hidden=H.hidden.bind(r),r.strikethrough=H.strikethrough.bind(r),r.black=H.black.bind(r),r.red=H.red.bind(r),r.green=H.green.bind(r),r.yellow=H.yellow.bind(r),r.blue=H.blue.bind(r),r.magenta=H.magenta.bind(r),r.cyan=H.cyan.bind(r),r.white=H.white.bind(r),r.gray=H.gray.bind(r),r.grey=H.grey.bind(r),r.bgBlack=H.bgBlack.bind(r),r.bgRed=H.bgRed.bind(r),r.bgGreen=H.bgGreen.bind(r),r.bgYellow=H.bgYellow.bind(r),r.bgBlue=H.bgBlue.bind(r),r.bgMagenta=H.bgMagenta.bind(r),r.bgCyan=H.bgCyan.bind(r),r.bgWhite=H.bgWhite.bind(r),r}function Y(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(this.has.includes(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:H.enabled?lc(this.keys,n+""):n+""):n===void 0?L_([t],[r]):H.enabled?lc([r],n+""):n+""}}cc.exports=H});var dc=S((IE,hc)=>{"use strict";hc.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var En=S((qE,fc)=>{"use strict";fc.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var X=S((ME,mc)=>{"use strict";var To={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},N_={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},U_={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?To.up():"");return t&&(e+=To.left),e}};mc.exports={cursor:To,scroll:N_,erase:U_,beep:"\x07"}});var wc=S((DE,yc)=>{"use strict";function W_(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=z_(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,l=!1,h;return{s:function(){r=r.call(t)},n:function(){var f=r.next();return a=f.done,f},e:function(f){l=!0,h=f},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(l)throw h}}}}function z_(t,e){if(t){if(typeof t=="string")return pc(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pc(t,e)}}function pc(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var H_=En(),bc=X(),gc=bc.erase,G_=bc.cursor,V_=t=>[...H_(t)].length;yc.exports=function(t,e){if(!e)return gc.line+G_.to(0);let r=0,n=t.split(/\r?\n/);var o=W_(n),a;try{for(o.s();!(a=o.n()).done;){let l=a.value;r+=1+Math.floor(Math.max(V_(l)-1,0)/e)}}catch(l){o.e(l)}finally{o.f()}return gc.lines(r)}});var Ro=S((FE,_c)=>{"use strict";var gs={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Y_={arrowUp:gs.arrowUp,arrowDown:gs.arrowDown,arrowLeft:gs.arrowLeft,arrowRight:gs.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Q_=process.platform==="win32"?Y_:gs;_c.exports=Q_});var Sc=S((BE,vc)=>{"use strict";var Or=Z(),ir=Ro(),xo=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),J_=t=>xo[t]||xo.default,bs=Object.freeze({aborted:Or.red(ir.cross),done:Or.green(ir.tick),exited:Or.yellow(ir.cross),default:Or.cyan("?")}),K_=(t,e,r)=>e?bs.aborted:r?bs.exited:t?bs.done:bs.default,Z_=t=>Or.gray(t?ir.ellipsis:ir.pointerSmall),X_=(t,e)=>Or.gray(t?e?ir.pointerSmall:"+":ir.line);vc.exports={styles:xo,render:J_,symbols:bs,symbol:K_,delimiter:Z_,item:X_}});var Rc=S(($E,Tc)=>{"use strict";var ev=En();Tc.exports=function(t,e){let r=String(ev(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,o)=>n+o):r.length}});var Cc=S((jE,xc)=>{"use strict";xc.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((a,l)=>(l.length+r.length>=n||a[a.length-1].length+l.length+1<n?a[a.length-1]+=` ${l}`:a.push(`${r}${l}`),a),[r]).join(`
2
+ "use strict";var a_=Object.create;var io=Object.defineProperty;var u_=Object.getOwnPropertyDescriptor;var l_=Object.getOwnPropertyNames;var c_=Object.getPrototypeOf,h_=Object.prototype.hasOwnProperty;var cs=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),d_=(t,e)=>{for(var r in e)io(t,r,{get:e[r],enumerable:!0})},f_=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l_(e))!h_.call(t,o)&&o!==r&&io(t,o,{get:()=>e[o],enumerable:!(n=u_(e,o))||n.enumerable});return t};var ie=(t,e,r)=>(r=t!=null?a_(c_(t)):{},f_(e||!t||!t.__esModule?io(r,"default",{value:t,enumerable:!0}):r,t));var Z=S((qx,jl)=>{"use strict";var{FORCE_COLOR:m_,NODE_DISABLE_COLORS:p_,TERM:g_}=process.env,z={enabled:!p_&&g_!=="dumb"&&m_!=="0",reset:V(0,0),bold:V(1,22),dim:V(2,22),italic:V(3,23),underline:V(4,24),inverse:V(7,27),hidden:V(8,28),strikethrough:V(9,29),black:V(30,39),red:V(31,39),green:V(32,39),yellow:V(33,39),blue:V(34,39),magenta:V(35,39),cyan:V(36,39),white:V(37,39),gray:V(90,39),grey:V(90,39),bgBlack:V(40,49),bgRed:V(41,49),bgGreen:V(42,49),bgYellow:V(43,49),bgBlue:V(44,49),bgMagenta:V(45,49),bgCyan:V(46,49),bgWhite:V(47,49)};function $l(t,e){let r=0,n,o="",u="";for(;r<t.length;r++)n=t[r],o+=n.open,u+=n.close,e.includes(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return o+e+u}function b_(t,e){let r={has:t,keys:e};return r.reset=z.reset.bind(r),r.bold=z.bold.bind(r),r.dim=z.dim.bind(r),r.italic=z.italic.bind(r),r.underline=z.underline.bind(r),r.inverse=z.inverse.bind(r),r.hidden=z.hidden.bind(r),r.strikethrough=z.strikethrough.bind(r),r.black=z.black.bind(r),r.red=z.red.bind(r),r.green=z.green.bind(r),r.yellow=z.yellow.bind(r),r.blue=z.blue.bind(r),r.magenta=z.magenta.bind(r),r.cyan=z.cyan.bind(r),r.white=z.white.bind(r),r.gray=z.gray.bind(r),r.grey=z.grey.bind(r),r.bgBlack=z.bgBlack.bind(r),r.bgRed=z.bgRed.bind(r),r.bgGreen=z.bgGreen.bind(r),r.bgYellow=z.bgYellow.bind(r),r.bgBlue=z.bgBlue.bind(r),r.bgMagenta=z.bgMagenta.bind(r),r.bgCyan=z.bgCyan.bind(r),r.bgWhite=z.bgWhite.bind(r),r}function V(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(this.has.includes(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:z.enabled?$l(this.keys,n+""):n+""):n===void 0?b_([t],[r]):z.enabled?$l([r],n+""):n+""}}jl.exports=z});var Nl=S((Dx,Ll)=>{"use strict";Ll.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var wn=S((Mx,Ul)=>{"use strict";Ul.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var X=S((Bx,Wl)=>{"use strict";var oo={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},y_={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},__={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?oo.up():"");return t&&(e+=oo.left),e}};Wl.exports={cursor:oo,scroll:y_,erase:__,beep:"\x07"}});var Yl=S((Fx,Vl)=>{"use strict";function w_(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=v_(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(m){throw m},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var u=!0,l=!1,h;return{s:function(){r=r.call(t)},n:function(){var m=r.next();return u=m.done,m},e:function(m){l=!0,h=m},f:function(){try{!u&&r.return!=null&&r.return()}finally{if(l)throw h}}}}function v_(t,e){if(t){if(typeof t=="string")return zl(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zl(t,e)}}function zl(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var S_=wn(),Gl=X(),Hl=Gl.erase,T_=Gl.cursor,R_=t=>[...S_(t)].length;Vl.exports=function(t,e){if(!e)return Hl.line+T_.to(0);let r=0,n=t.split(/\r?\n/);var o=w_(n),u;try{for(o.s();!(u=o.n()).done;){let l=u.value;r+=1+Math.floor(Math.max(R_(l)-1,0)/e)}}catch(l){o.e(l)}finally{o.f()}return Hl.lines(r)}});var ao=S(($x,Ql)=>{"use strict";var hs={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},C_={arrowUp:hs.arrowUp,arrowDown:hs.arrowDown,arrowLeft:hs.arrowLeft,arrowRight:hs.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},x_=process.platform==="win32"?C_:hs;Ql.exports=x_});var Kl=S((jx,Jl)=>{"use strict";var kr=Z(),Xt=ao(),uo=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),k_=t=>uo[t]||uo.default,ds=Object.freeze({aborted:kr.red(Xt.cross),done:kr.green(Xt.tick),exited:kr.yellow(Xt.cross),default:kr.cyan("?")}),P_=(t,e,r)=>e?ds.aborted:r?ds.exited:t?ds.done:ds.default,E_=t=>kr.gray(t?Xt.ellipsis:Xt.pointerSmall),A_=(t,e)=>kr.gray(t?e?Xt.pointerSmall:"+":Xt.line);Jl.exports={styles:uo,render:k_,symbols:ds,symbol:P_,delimiter:E_,item:A_}});var Xl=S((Lx,Zl)=>{"use strict";var O_=wn();Zl.exports=function(t,e){let r=String(O_(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,o)=>n+o):r.length}});var tc=S((Nx,ec)=>{"use strict";ec.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((u,l)=>(l.length+r.length>=n||u[u.length-1].length+l.length+1<n?u[u.length-1]+=` ${l}`:u.push(`${r}${l}`),u),[r]).join(`
4
4
  `)).join(`
5
- `)}});var Ec=S((LE,kc)=>{"use strict";kc.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let o=Math.min(n+r,e);return{startIndex:n,endIndex:o}}});var Ke=S((NE,Pc)=>{"use strict";Pc.exports={action:dc(),clear:wc(),style:Sc(),strip:En(),figures:Ro(),lines:Rc(),wrap:Cc(),entriesToDisplay:Ec()}});var wt=S((UE,Ic)=>{"use strict";var Ac=require("readline"),tv=Ke(),rv=tv.action,sv=require("events"),Oc=X(),nv=Oc.beep,iv=Oc.cursor,ov=Z(),Co=class extends sv{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=Ac.createInterface({input:this.in,escapeCodeTimeout:50});Ac.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,o=(a,l)=>{let h=rv(l,n);h===!1?this._&&this._(a,l):typeof this[h]=="function"?this[h](l):this.bell()};this.close=()=>{this.out.write(iv.show),this.in.removeListener("keypress",o),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",o)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(nv)}render(){this.onRender(ov),this.firstRender&&(this.firstRender=!1)}};Ic.exports=Co});var Bc=S((WE,Fc)=>{"use strict";function qc(t,e,r,n,o,a,l){try{var h=t[a](l),d=h.value}catch(f){r(f);return}h.done?e(d):Promise.resolve(d).then(n,o)}function Mc(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function l(d){qc(a,n,o,l,h,"next",d)}function h(d){qc(a,n,o,l,h,"throw",d)}l(void 0)})}}var Pn=Z(),av=wt(),Dc=X(),uv=Dc.erase,ys=Dc.cursor,An=Ke(),ko=An.style,Eo=An.clear,lv=An.lines,cv=An.figures,Po=class extends av{constructor(e={}){super(e),this.transform=ko.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Eo("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Pn.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
6
- `),this.close()}validate(){var e=this;return Mc(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return Mc(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
7
- `),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),o=this.value.slice(this.cursor);this.value=`${n}${e}${o}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ys.down(lv(this.outputError,this.out.columns)-1)+Eo(this.outputError,this.out.columns)),this.out.write(Eo(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ko.symbol(this.done,this.aborted),Pn.bold(this.msg),ko.delimiter(this.done),this.red?Pn.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
5
+ `)}});var sc=S((Ux,rc)=>{"use strict";rc.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let o=Math.min(n+r,e);return{startIndex:n,endIndex:o}}});var Ve=S((Wx,nc)=>{"use strict";nc.exports={action:Nl(),clear:Yl(),style:Kl(),strip:wn(),figures:ao(),lines:Xl(),wrap:tc(),entriesToDisplay:sc()}});var mt=S((zx,ac)=>{"use strict";var ic=require("readline"),I_=Ve(),q_=I_.action,D_=require("events"),oc=X(),M_=oc.beep,B_=oc.cursor,F_=Z(),lo=class extends D_{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=ic.createInterface({input:this.in,escapeCodeTimeout:50});ic.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,o=(u,l)=>{let h=q_(l,n);h===!1?this._&&this._(u,l):typeof this[h]=="function"?this[h](l):this.bell()};this.close=()=>{this.out.write(B_.show),this.in.removeListener("keypress",o),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",o)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(M_)}render(){this.onRender(F_),this.firstRender&&(this.firstRender=!1)}};ac.exports=lo});var dc=S((Hx,hc)=>{"use strict";function uc(t,e,r,n,o,u,l){try{var h=t[u](l),d=h.value}catch(m){r(m);return}h.done?e(d):Promise.resolve(d).then(n,o)}function lc(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function l(d){uc(u,n,o,l,h,"next",d)}function h(d){uc(u,n,o,l,h,"throw",d)}l(void 0)})}}var vn=Z(),$_=mt(),cc=X(),j_=cc.erase,fs=cc.cursor,Sn=Ve(),co=Sn.style,ho=Sn.clear,L_=Sn.lines,N_=Sn.figures,fo=class extends $_{constructor(e={}){super(e),this.transform=co.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=ho("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=vn.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
6
+ `),this.close()}validate(){var e=this;return lc(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return lc(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
7
+ `),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),o=this.value.slice(this.cursor);this.value=`${n}${e}${o}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(fs.down(L_(this.outputError,this.out.columns)-1)+ho(this.outputError,this.out.columns)),this.out.write(ho(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[co.symbol(this.done,this.aborted),vn.bold(this.msg),co.delimiter(this.done),this.red?vn.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
8
8
  `).reduce((e,r,n)=>e+`
9
- ${n?" ":cv.pointerSmall} ${Pn.red().italic(r)}`,"")),this.out.write(uv.line+ys.to(0)+this.outputText+ys.save+this.outputError+ys.restore+ys.move(this.cursorOffset,0)))}};Fc.exports=Po});var Nc=S((zE,Lc)=>{"use strict";var _t=Z(),hv=wt(),ws=Ke(),$c=ws.style,jc=ws.clear,On=ws.figures,dv=ws.wrap,fv=ws.entriesToDisplay,mv=X(),pv=mv.cursor,Ao=class extends hv{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=jc("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
9
+ ${n?" ":N_.pointerSmall} ${vn.red().italic(r)}`,"")),this.out.write(j_.line+fs.to(0)+this.outputText+fs.save+this.outputError+fs.restore+fs.move(this.cursorOffset,0)))}};hc.exports=fo});var gc=S((Gx,pc)=>{"use strict";var pt=Z(),U_=mt(),ms=Ve(),fc=ms.style,mc=ms.clear,Tn=ms.figures,W_=ms.wrap,z_=ms.entriesToDisplay,H_=X(),G_=H_.cursor,mo=class extends U_{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=mc("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
10
10
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
11
- `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(pv.hide):this.out.write(jc(this.outputText,this.out.columns)),super.render();let e=fv(this.cursor,this.choices.length,this.optionsPerPage),r=e.startIndex,n=e.endIndex;if(this.outputText=[$c.symbol(this.done,this.aborted),_t.bold(this.msg),$c.delimiter(!1),this.done?this.selection.title:this.selection.disabled?_t.yellow(this.warn):_t.gray(this.hint)].join(" "),!this.done){this.outputText+=`
12
- `;for(let o=r;o<n;o++){let a,l,h="",d=this.choices[o];o===r&&r>0?l=On.arrowUp:o===n-1&&n<this.choices.length?l=On.arrowDown:l=" ",d.disabled?(a=this.cursor===o?_t.gray().underline(d.title):_t.strikethrough().gray(d.title),l=(this.cursor===o?_t.bold().gray(On.pointer)+" ":" ")+l):(a=this.cursor===o?_t.cyan().underline(d.title):d.title,l=(this.cursor===o?_t.cyan(On.pointer)+" ":" ")+l,d.description&&this.cursor===o&&(h=` - ${d.description}`,(l.length+a.length+h.length>=this.out.columns||d.description.split(/\r?\n/).length>1)&&(h=`
13
- `+dv(d.description,{margin:3,width:this.out.columns})))),this.outputText+=`${l} ${a}${_t.gray(h)}
14
- `}}this.out.write(this.outputText)}};Lc.exports=Ao});var Vc=S((HE,Gc)=>{"use strict";var In=Z(),gv=wt(),zc=Ke(),Uc=zc.style,bv=zc.clear,Hc=X(),Wc=Hc.cursor,yv=Hc.erase,Oo=class extends gv{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
11
+ `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(G_.hide):this.out.write(mc(this.outputText,this.out.columns)),super.render();let e=z_(this.cursor,this.choices.length,this.optionsPerPage),r=e.startIndex,n=e.endIndex;if(this.outputText=[fc.symbol(this.done,this.aborted),pt.bold(this.msg),fc.delimiter(!1),this.done?this.selection.title:this.selection.disabled?pt.yellow(this.warn):pt.gray(this.hint)].join(" "),!this.done){this.outputText+=`
12
+ `;for(let o=r;o<n;o++){let u,l,h="",d=this.choices[o];o===r&&r>0?l=Tn.arrowUp:o===n-1&&n<this.choices.length?l=Tn.arrowDown:l=" ",d.disabled?(u=this.cursor===o?pt.gray().underline(d.title):pt.strikethrough().gray(d.title),l=(this.cursor===o?pt.bold().gray(Tn.pointer)+" ":" ")+l):(u=this.cursor===o?pt.cyan().underline(d.title):d.title,l=(this.cursor===o?pt.cyan(Tn.pointer)+" ":" ")+l,d.description&&this.cursor===o&&(h=` - ${d.description}`,(l.length+u.length+h.length>=this.out.columns||d.description.split(/\r?\n/).length>1)&&(h=`
13
+ `+W_(d.description,{margin:3,width:this.out.columns})))),this.outputText+=`${l} ${u}${pt.gray(h)}
14
+ `}}this.out.write(this.outputText)}};pc.exports=mo});var Sc=S((Vx,vc)=>{"use strict";var Rn=Z(),V_=mt(),_c=Ve(),bc=_c.style,Y_=_c.clear,wc=X(),yc=wc.cursor,Q_=wc.erase,po=class extends V_{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
15
15
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
16
- `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Wc.hide):this.out.write(bv(this.outputText,this.out.columns)),super.render(),this.outputText=[Uc.symbol(this.done,this.aborted),In.bold(this.msg),Uc.delimiter(this.done),this.value?this.inactive:In.cyan().underline(this.inactive),In.gray("/"),this.value?In.cyan().underline(this.active):this.active].join(" "),this.out.write(yv.line+Wc.to(0)+this.outputText))}};Gc.exports=Oo});var nt=S((GE,Yc)=>{"use strict";var Io=class t{constructor({token:e,date:r,parts:n,locales:o}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=o||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,o)=>o>r&&n instanceof t)}toString(){return String(this.date)}};Yc.exports=Io});var Jc=S((VE,Qc)=>{"use strict";var wv=nt(),qo=class extends wv{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Qc.exports=qo});var Zc=S((YE,Kc)=>{"use strict";var _v=nt(),vv=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),Mo=class extends _v{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+vv(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};Kc.exports=Mo});var eh=S((QE,Xc)=>{"use strict";var Sv=nt(),Do=class extends Sv{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Xc.exports=Do});var rh=S((JE,th)=>{"use strict";var Tv=nt(),Fo=class extends Tv{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};th.exports=Fo});var nh=S((KE,sh)=>{"use strict";var Rv=nt(),Bo=class extends Rv{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};sh.exports=Bo});var oh=S((ZE,ih)=>{"use strict";var xv=nt(),$o=class extends xv{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};ih.exports=$o});var uh=S((XE,ah)=>{"use strict";var Cv=nt(),jo=class extends Cv{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};ah.exports=jo});var ch=S((eP,lh)=>{"use strict";var kv=nt(),Lo=class extends kv{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};lh.exports=Lo});var dh=S((tP,hh)=>{"use strict";hh.exports={DatePart:nt(),Meridiem:Jc(),Day:Zc(),Hours:eh(),Milliseconds:rh(),Minutes:nh(),Month:oh(),Seconds:uh(),Year:ch()}});var Sh=S((rP,vh)=>{"use strict";function fh(t,e,r,n,o,a,l){try{var h=t[a](l),d=h.value}catch(f){r(f);return}h.done?e(d):Promise.resolve(d).then(n,o)}function mh(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function l(d){fh(a,n,o,l,h,"next",d)}function h(d){fh(a,n,o,l,h,"throw",d)}l(void 0)})}}var No=Z(),Ev=wt(),Wo=Ke(),ph=Wo.style,gh=Wo.clear,Pv=Wo.figures,_h=X(),Av=_h.erase,bh=_h.cursor,vt=dh(),yh=vt.DatePart,Ov=vt.Meridiem,Iv=vt.Day,qv=vt.Hours,Mv=vt.Milliseconds,Dv=vt.Minutes,Fv=vt.Month,Bv=vt.Seconds,$v=vt.Year,jv=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,wh={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new Iv(t),3:t=>new Fv(t),4:t=>new $v(t),5:t=>new Ov(t),6:t=>new qv(t),7:t=>new Dv(t),8:t=>new Bv(t),9:t=>new Mv(t)},Lv={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},Uo=class extends Ev{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Lv,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=gh("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=jv.exec(e);){let o=r.shift(),a=r.findIndex(l=>l!=null);this.parts.push(a in wh?wh[a]({token:r[a]||o,date:this.date,parts:this.parts,locales:this.locales}):r[a]||o)}let n=this.parts.reduce((o,a)=>(typeof a=="string"&&typeof o[o.length-1]=="string"?o[o.length-1]+=a:o.push(a),o),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof yh)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
17
- `),this.close()}validate(){var e=this;return mh(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return mh(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
18
- `),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof yh)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(bh.hide):this.out.write(gh(this.outputText,this.out.columns)),super.render(),this.outputText=[ph.symbol(this.done,this.aborted),No.bold(this.msg),ph.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?No.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
16
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(yc.hide):this.out.write(Y_(this.outputText,this.out.columns)),super.render(),this.outputText=[bc.symbol(this.done,this.aborted),Rn.bold(this.msg),bc.delimiter(this.done),this.value?this.inactive:Rn.cyan().underline(this.inactive),Rn.gray("/"),this.value?Rn.cyan().underline(this.active):this.active].join(" "),this.out.write(Q_.line+yc.to(0)+this.outputText))}};vc.exports=po});var Xe=S((Yx,Tc)=>{"use strict";var go=class t{constructor({token:e,date:r,parts:n,locales:o}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=o||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,o)=>o>r&&n instanceof t)}toString(){return String(this.date)}};Tc.exports=go});var Cc=S((Qx,Rc)=>{"use strict";var J_=Xe(),bo=class extends J_{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Rc.exports=bo});var kc=S((Jx,xc)=>{"use strict";var K_=Xe(),Z_=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),yo=class extends K_{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Z_(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};xc.exports=yo});var Ec=S((Kx,Pc)=>{"use strict";var X_=Xe(),_o=class extends X_{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Pc.exports=_o});var Oc=S((Zx,Ac)=>{"use strict";var ew=Xe(),wo=class extends ew{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Ac.exports=wo});var qc=S((Xx,Ic)=>{"use strict";var tw=Xe(),vo=class extends tw{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Ic.exports=vo});var Mc=S((ek,Dc)=>{"use strict";var rw=Xe(),So=class extends rw{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};Dc.exports=So});var Fc=S((tk,Bc)=>{"use strict";var sw=Xe(),To=class extends sw{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Bc.exports=To});var jc=S((rk,$c)=>{"use strict";var nw=Xe(),Ro=class extends nw{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};$c.exports=Ro});var Nc=S((sk,Lc)=>{"use strict";Lc.exports={DatePart:Xe(),Meridiem:Cc(),Day:kc(),Hours:Ec(),Milliseconds:Oc(),Minutes:qc(),Month:Mc(),Seconds:Fc(),Year:jc()}});var Kc=S((nk,Jc)=>{"use strict";function Uc(t,e,r,n,o,u,l){try{var h=t[u](l),d=h.value}catch(m){r(m);return}h.done?e(d):Promise.resolve(d).then(n,o)}function Wc(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function l(d){Uc(u,n,o,l,h,"next",d)}function h(d){Uc(u,n,o,l,h,"throw",d)}l(void 0)})}}var Co=Z(),iw=mt(),ko=Ve(),zc=ko.style,Hc=ko.clear,ow=ko.figures,Qc=X(),aw=Qc.erase,Gc=Qc.cursor,gt=Nc(),Vc=gt.DatePart,uw=gt.Meridiem,lw=gt.Day,cw=gt.Hours,hw=gt.Milliseconds,dw=gt.Minutes,fw=gt.Month,mw=gt.Seconds,pw=gt.Year,gw=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,Yc={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new lw(t),3:t=>new fw(t),4:t=>new pw(t),5:t=>new uw(t),6:t=>new cw(t),7:t=>new dw(t),8:t=>new mw(t),9:t=>new hw(t)},bw={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},xo=class extends iw{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(bw,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Hc("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=gw.exec(e);){let o=r.shift(),u=r.findIndex(l=>l!=null);this.parts.push(u in Yc?Yc[u]({token:r[u]||o,date:this.date,parts:this.parts,locales:this.locales}):r[u]||o)}let n=this.parts.reduce((o,u)=>(typeof u=="string"&&typeof o[o.length-1]=="string"?o[o.length-1]+=u:o.push(u),o),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof Vc)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
17
+ `),this.close()}validate(){var e=this;return Wc(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return Wc(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
18
+ `),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof Vc)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Gc.hide):this.out.write(Hc(this.outputText,this.out.columns)),super.render(),this.outputText=[zc.symbol(this.done,this.aborted),Co.bold(this.msg),zc.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?Co.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
19
19
  `).reduce((e,r,n)=>e+`
20
- ${n?" ":Pv.pointerSmall} ${No.red().italic(r)}`,"")),this.out.write(Av.line+bh.to(0)+this.outputText))}};vh.exports=Uo});var Ph=S((sP,Eh)=>{"use strict";function Th(t,e,r,n,o,a,l){try{var h=t[a](l),d=h.value}catch(f){r(f);return}h.done?e(d):Promise.resolve(d).then(n,o)}function Rh(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function l(d){Th(a,n,o,l,h,"next",d)}function h(d){Th(a,n,o,l,h,"throw",d)}l(void 0)})}}var qn=Z(),Nv=wt(),kh=X(),Mn=kh.cursor,Uv=kh.erase,Dn=Ke(),zo=Dn.style,Wv=Dn.figures,xh=Dn.clear,zv=Dn.lines,Hv=/[0-9]/,Ho=t=>t!==void 0,Ch=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},Go=class extends Nv{constructor(e={}){super(e),this.transform=zo.render(e.style),this.msg=e.message,this.initial=Ho(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Ho(e.min)?e.min:-1/0,this.max=Ho(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=qn.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Ch(e,this.round)}`),this._value=Ch(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Hv.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
21
- `),this.close()}validate(){var e=this;return Rh(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return Rh(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let r=e.value;e.value=r!==""?r:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
22
- `),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Mn.down(zv(this.outputError,this.out.columns)-1)+xh(this.outputError,this.out.columns)),this.out.write(xh(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[zo.symbol(this.done,this.aborted),qn.bold(this.msg),zo.delimiter(this.done),!this.done||!this.done&&!this.placeholder?qn[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
20
+ ${n?" ":ow.pointerSmall} ${Co.red().italic(r)}`,"")),this.out.write(aw.line+Gc.to(0)+this.outputText))}};Jc.exports=xo});var nh=S((ik,sh)=>{"use strict";function Zc(t,e,r,n,o,u,l){try{var h=t[u](l),d=h.value}catch(m){r(m);return}h.done?e(d):Promise.resolve(d).then(n,o)}function Xc(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function l(d){Zc(u,n,o,l,h,"next",d)}function h(d){Zc(u,n,o,l,h,"throw",d)}l(void 0)})}}var Cn=Z(),yw=mt(),rh=X(),xn=rh.cursor,_w=rh.erase,kn=Ve(),Po=kn.style,ww=kn.figures,eh=kn.clear,vw=kn.lines,Sw=/[0-9]/,Eo=t=>t!==void 0,th=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},Ao=class extends yw{constructor(e={}){super(e),this.transform=Po.render(e.style),this.msg=e.message,this.initial=Eo(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Eo(e.min)?e.min:-1/0,this.max=Eo(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Cn.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${th(e,this.round)}`),this._value=th(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Sw.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
21
+ `),this.close()}validate(){var e=this;return Xc(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return Xc(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let r=e.value;e.value=r!==""?r:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
22
+ `),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(xn.down(vw(this.outputError,this.out.columns)-1)+eh(this.outputError,this.out.columns)),this.out.write(eh(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Po.symbol(this.done,this.aborted),Cn.bold(this.msg),Po.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Cn[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
23
23
  `).reduce((e,r,n)=>e+`
24
- ${n?" ":Wv.pointerSmall} ${qn.red().italic(r)}`,"")),this.out.write(Uv.line+Mn.to(0)+this.outputText+Mn.save+this.outputError+Mn.restore))}};Eh.exports=Go});var Yo=S((nP,Ih)=>{"use strict";var it=Z(),Gv=X(),Vv=Gv.cursor,Yv=wt(),_s=Ke(),Ah=_s.clear,Ut=_s.figures,Oh=_s.style,Qv=_s.wrap,Jv=_s.entriesToDisplay,Vo=class extends Yv{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=Ah("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
24
+ ${n?" ":ww.pointerSmall} ${Cn.red().italic(r)}`,"")),this.out.write(_w.line+xn.to(0)+this.outputText+xn.save+this.outputError+xn.restore))}};sh.exports=Ao});var Io=S((ok,ah)=>{"use strict";var et=Z(),Tw=X(),Rw=Tw.cursor,Cw=mt(),ps=Ve(),ih=ps.clear,Bt=ps.figures,oh=ps.style,xw=ps.wrap,kw=ps.entriesToDisplay,Oo=class extends Cw{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=ih("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
25
25
  `),this.close()}submit(){let e=this.value.filter(r=>r.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
26
26
  `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=e),this.render()}_(e,r){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
27
27
  Instructions:
28
- ${Ut.arrowUp}/${Ut.arrowDown}: Highlight option
29
- ${Ut.arrowLeft}/${Ut.arrowRight}/[space]: Toggle selection
28
+ ${Bt.arrowUp}/${Bt.arrowDown}: Highlight option
29
+ ${Bt.arrowLeft}/${Bt.arrowRight}/[space]: Toggle selection
30
30
  `+(this.maxChoices===void 0?` a: Toggle all
31
- `:"")+" enter/return: Complete answer":""}renderOption(e,r,n,o){let a=(r.selected?it.green(Ut.radioOn):Ut.radioOff)+" "+o+" ",l,h;return r.disabled?l=e===n?it.gray().underline(r.title):it.strikethrough().gray(r.title):(l=e===n?it.cyan().underline(r.title):r.title,e===n&&r.description&&(h=` - ${r.description}`,(a.length+l.length+h.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(h=`
32
- `+Qv(r.description,{margin:a.length,width:this.out.columns})))),a+l+it.gray(h||"")}paginateOptions(e){if(e.length===0)return it.red("No matches for this query.");let r=Jv(this.cursor,e.length,this.optionsPerPage),n=r.startIndex,o=r.endIndex,a,l=[];for(let h=n;h<o;h++)h===n&&n>0?a=Ut.arrowUp:h===o-1&&o<e.length?a=Ut.arrowDown:a=" ",l.push(this.renderOption(this.cursor,e[h],h,a));return`
31
+ `:"")+" enter/return: Complete answer":""}renderOption(e,r,n,o){let u=(r.selected?et.green(Bt.radioOn):Bt.radioOff)+" "+o+" ",l,h;return r.disabled?l=e===n?et.gray().underline(r.title):et.strikethrough().gray(r.title):(l=e===n?et.cyan().underline(r.title):r.title,e===n&&r.description&&(h=` - ${r.description}`,(u.length+l.length+h.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(h=`
32
+ `+xw(r.description,{margin:u.length,width:this.out.columns})))),u+l+et.gray(h||"")}paginateOptions(e){if(e.length===0)return et.red("No matches for this query.");let r=kw(this.cursor,e.length,this.optionsPerPage),n=r.startIndex,o=r.endIndex,u,l=[];for(let h=n;h<o;h++)h===n&&n>0?u=Bt.arrowUp:h===o-1&&o<e.length?u=Bt.arrowDown:u=" ",l.push(this.renderOption(this.cursor,e[h],h,u));return`
33
33
  `+l.join(`
34
- `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[it.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(it.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Vv.hide),super.render();let e=[Oh.symbol(this.done,this.aborted),it.bold(this.msg),Oh.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=it.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=Ah(e,this.out.columns)}};Ih.exports=Vo});var jh=S((iP,$h)=>{"use strict";function qh(t,e,r,n,o,a,l){try{var h=t[a](l),d=h.value}catch(f){r(f);return}h.done?e(d):Promise.resolve(d).then(n,o)}function Kv(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function l(d){qh(a,n,o,l,h,"next",d)}function h(d){qh(a,n,o,l,h,"throw",d)}l(void 0)})}}var vs=Z(),Zv=wt(),Bh=X(),Xv=Bh.erase,Mh=Bh.cursor,Ss=Ke(),Qo=Ss.style,Dh=Ss.clear,Jo=Ss.figures,eS=Ss.wrap,tS=Ss.entriesToDisplay,Fh=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),rS=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),sS=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},Ko=class extends Zv{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:sS(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Qo.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Dh("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Fh(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var r=this;return Kv(function*(){let n=r.completing=r.suggest(r.input,r.choices),o=yield n;if(r.completing!==n)return;r.suggestions=o.map((l,h,d)=>({title:rS(d,h),value:Fh(d,h),description:l.description})),r.completing=!1;let a=Math.max(o.length-1,0);r.moveSelect(Math.min(a,r.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
34
+ `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[et.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(et.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Rw.hide),super.render();let e=[oh.symbol(this.done,this.aborted),et.bold(this.msg),oh.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=et.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=ih(e,this.out.columns)}};ah.exports=Oo});var mh=S((ak,fh)=>{"use strict";function uh(t,e,r,n,o,u,l){try{var h=t[u](l),d=h.value}catch(m){r(m);return}h.done?e(d):Promise.resolve(d).then(n,o)}function Pw(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function l(d){uh(u,n,o,l,h,"next",d)}function h(d){uh(u,n,o,l,h,"throw",d)}l(void 0)})}}var gs=Z(),Ew=mt(),dh=X(),Aw=dh.erase,lh=dh.cursor,bs=Ve(),qo=bs.style,ch=bs.clear,Do=bs.figures,Ow=bs.wrap,Iw=bs.entriesToDisplay,hh=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),qw=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Dw=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},Mo=class extends Ew{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Dw(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=qo.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=ch("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=hh(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var r=this;return Pw(function*(){let n=r.completing=r.suggest(r.input,r.choices),o=yield n;if(r.completing!==n)return;r.suggestions=o.map((l,h,d)=>({title:qw(d,h),value:hh(d,h),description:l.description})),r.completing=!1;let u=Math.max(o.length-1,0);r.moveSelect(Math.min(u,r.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
35
35
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
36
36
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
37
- `),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),o=this.input.slice(this.cursor);this.input=`${n}${e}${o}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,o){let a,l=n?Jo.arrowUp:o?Jo.arrowDown:" ",h=r?vs.cyan().underline(e.title):e.title;return l=(r?vs.cyan(Jo.pointer)+" ":" ")+l,e.description&&(a=` - ${e.description}`,(l.length+h.length+a.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(a=`
38
- `+eS(e.description,{margin:3,width:this.out.columns}))),l+" "+h+vs.gray(a||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Mh.hide):this.out.write(Dh(this.outputText,this.out.columns)),super.render();let e=tS(this.select,this.choices.length,this.limit),r=e.startIndex,n=e.endIndex;if(this.outputText=[Qo.symbol(this.done,this.aborted,this.exited),vs.bold(this.msg),Qo.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let o=this.suggestions.slice(r,n).map((a,l)=>this.renderOption(a,this.select===l+r,l===0&&r>0,l+r===n-1&&n<this.choices.length)).join(`
37
+ `),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),o=this.input.slice(this.cursor);this.input=`${n}${e}${o}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,o){let u,l=n?Do.arrowUp:o?Do.arrowDown:" ",h=r?gs.cyan().underline(e.title):e.title;return l=(r?gs.cyan(Do.pointer)+" ":" ")+l,e.description&&(u=` - ${e.description}`,(l.length+h.length+u.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(u=`
38
+ `+Ow(e.description,{margin:3,width:this.out.columns}))),l+" "+h+gs.gray(u||"")}render(){if(this.closed)return;this.firstRender?this.out.write(lh.hide):this.out.write(ch(this.outputText,this.out.columns)),super.render();let e=Iw(this.select,this.choices.length,this.limit),r=e.startIndex,n=e.endIndex;if(this.outputText=[qo.symbol(this.done,this.aborted,this.exited),gs.bold(this.msg),qo.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let o=this.suggestions.slice(r,n).map((u,l)=>this.renderOption(u,this.select===l+r,l===0&&r>0,l+r===n-1&&n<this.choices.length)).join(`
39
39
  `);this.outputText+=`
40
- `+(o||vs.gray(this.fallback.title))}this.out.write(Xv.line+Mh.to(0)+this.outputText)}};$h.exports=Ko});var Wh=S((oP,Uh)=>{"use strict";var St=Z(),nS=X(),iS=nS.cursor,oS=Yo(),Xo=Ke(),Lh=Xo.clear,Nh=Xo.style,Ir=Xo.figures,Zo=class extends oS{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Lh("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
40
+ `+(o||gs.gray(this.fallback.title))}this.out.write(Aw.line+lh.to(0)+this.outputText)}};fh.exports=Mo});var yh=S((uk,bh)=>{"use strict";var bt=Z(),Mw=X(),Bw=Mw.cursor,Fw=Io(),Fo=Ve(),ph=Fo.clear,gh=Fo.style,Pr=Fo.figures,Bo=class extends Fw{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=ph("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
41
41
  Instructions:
42
- ${Ir.arrowUp}/${Ir.arrowDown}: Highlight option
43
- ${Ir.arrowLeft}/${Ir.arrowRight}/[space]: Toggle selection
42
+ ${Pr.arrowUp}/${Pr.arrowDown}: Highlight option
43
+ ${Pr.arrowLeft}/${Pr.arrowRight}/[space]: Toggle selection
44
44
  [a,b,c]/delete: Filter choices
45
45
  enter/return: Complete answer
46
46
  `:""}renderCurrentInput(){return`
47
- Filtered results for: ${this.inputValue?this.inputValue:St.gray("Enter something to filter")}
48
- `}renderOption(e,r,n){let o;return r.disabled?o=e===n?St.gray().underline(r.title):St.strikethrough().gray(r.title):o=e===n?St.cyan().underline(r.title):r.title,(r.selected?St.green(Ir.radioOn):Ir.radioOff)+" "+o}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[St.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(St.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(iS.hide),super.render();let e=[Nh.symbol(this.done,this.aborted),St.bold(this.msg),Nh.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=St.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Lh(e,this.out.columns)}};Uh.exports=Zo});var Jh=S((aP,Qh)=>{"use strict";var zh=Z(),aS=wt(),Vh=Ke(),Hh=Vh.style,uS=Vh.clear,Yh=X(),lS=Yh.erase,Gh=Yh.cursor,ea=class extends aS{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
47
+ Filtered results for: ${this.inputValue?this.inputValue:bt.gray("Enter something to filter")}
48
+ `}renderOption(e,r,n){let o;return r.disabled?o=e===n?bt.gray().underline(r.title):bt.strikethrough().gray(r.title):o=e===n?bt.cyan().underline(r.title):r.title,(r.selected?bt.green(Pr.radioOn):Pr.radioOff)+" "+o}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[bt.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(bt.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Bw.hide),super.render();let e=[gh.symbol(this.done,this.aborted),bt.bold(this.msg),gh.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=bt.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=ph(e,this.out.columns)}};bh.exports=Bo});var Ch=S((lk,Rh)=>{"use strict";var _h=Z(),$w=mt(),Sh=Ve(),wh=Sh.style,jw=Sh.clear,Th=X(),Lw=Th.erase,vh=Th.cursor,$o=class extends $w{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
49
49
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
50
- `),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Gh.hide):this.out.write(uS(this.outputText,this.out.columns)),super.render(),this.outputText=[Hh.symbol(this.done,this.aborted),zh.bold(this.msg),Hh.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:zh.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(lS.line+Gh.to(0)+this.outputText))}};Qh.exports=ea});var Zh=S((uP,Kh)=>{"use strict";Kh.exports={TextPrompt:Bc(),SelectPrompt:Nc(),TogglePrompt:Vc(),DatePrompt:Sh(),NumberPrompt:Ph(),MultiselectPrompt:Yo(),AutocompletePrompt:jh(),AutocompleteMultiselectPrompt:Wh(),ConfirmPrompt:Jh()}});var ed=S(Xh=>{"use strict";var be=Xh,cS=Zh(),Fn=t=>t;function ot(t,e,r={}){return new Promise((n,o)=>{let a=new cS[t](e),l=r.onAbort||Fn,h=r.onSubmit||Fn,d=r.onExit||Fn;a.on("state",e.onState||Fn),a.on("submit",f=>n(h(f))),a.on("exit",f=>n(d(f))),a.on("abort",f=>o(l(f)))})}be.text=t=>ot("TextPrompt",t);be.password=t=>(t.style="password",be.text(t));be.invisible=t=>(t.style="invisible",be.text(t));be.number=t=>ot("NumberPrompt",t);be.date=t=>ot("DatePrompt",t);be.confirm=t=>ot("ConfirmPrompt",t);be.list=t=>{let e=t.separator||",";return ot("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};be.toggle=t=>ot("TogglePrompt",t);be.select=t=>ot("SelectPrompt",t);be.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return ot("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};be.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return ot("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var hS=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));be.autocomplete=t=>(t.suggest=t.suggest||hS,t.choices=[].concat(t.choices||[]),ot("AutocompletePrompt",t))});var ud=S((cP,ad)=>{"use strict";function td(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function rd(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?td(Object(r),!0).forEach(function(n){dS(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):td(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function dS(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fS(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=mS(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
51
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,l=!1,h;return{s:function(){r=r.call(t)},n:function(){var f=r.next();return a=f.done,f},e:function(f){l=!0,h=f},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(l)throw h}}}}function mS(t,e){if(t){if(typeof t=="string")return sd(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sd(t,e)}}function sd(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function nd(t,e,r,n,o,a,l){try{var h=t[a](l),d=h.value}catch(f){r(f);return}h.done?e(d):Promise.resolve(d).then(n,o)}function id(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function l(d){nd(a,n,o,l,h,"next",d)}function h(d){nd(a,n,o,l,h,"throw",d)}l(void 0)})}}var ta=ed(),pS=["suggest","format","onState","validate","onRender","type"],od=()=>{};function Wt(){return ra.apply(this,arguments)}function ra(){return ra=id(function*(t=[],{onSubmit:e=od,onCancel:r=od}={}){let n={},o=Wt._override||{};t=[].concat(t);let a,l,h,d,f,p,w=(function(){var k=id(function*(E,L,K=!1){if(!(!K&&E.validate&&E.validate(L)!==!0))return E.format?yield E.format(L,n):L});return function(L,K){return k.apply(this,arguments)}})();var _=fS(t),T;try{for(_.s();!(T=_.n()).done;){l=T.value;var y=l;if(d=y.name,f=y.type,typeof f=="function"&&(f=yield f(a,rd({},n),l),l.type=f),!!f){for(let k in l){if(pS.includes(k))continue;let E=l[k];l[k]=typeof E=="function"?yield E(a,rd({},n),p):E}if(p=l,typeof l.message!="string")throw new Error("prompt message is required");var M=l;if(d=M.name,f=M.type,ta[f]===void 0)throw new Error(`prompt type (${f}) is not defined`);if(o[l.name]!==void 0&&(a=yield w(l,o[l.name]),a!==void 0)){n[d]=a;continue}try{a=Wt._injected?gS(Wt._injected,l.initial):yield ta[f](l),n[d]=a=yield w(l,a,!0),h=yield e(l,a,n)}catch{h=!(yield r(l,n))}if(h)return n}}}catch(k){_.e(k)}finally{_.f()}return n}),ra.apply(this,arguments)}function gS(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function bS(t){Wt._injected=(Wt._injected||[]).concat(t)}function yS(t){Wt._override=Object.assign({},t)}ad.exports=Object.assign(Wt,{prompt:Wt,prompts:ta,inject:bS,override:yS})});var cd=S((hP,ld)=>{"use strict";ld.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var Bn=S((dP,hd)=>{"use strict";hd.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var md=S((fP,fd)=>{"use strict";var wS=Bn(),{erase:dd,cursor:_S}=X(),vS=t=>[...wS(t)].length;fd.exports=function(t,e){if(!e)return dd.line+_S.to(0);let r=0,n=t.split(/\r?\n/);for(let o of n)r+=1+Math.floor(Math.max(vS(o)-1,0)/e);return dd.lines(r)}});var sa=S((mP,pd)=>{"use strict";var Ts={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},SS={arrowUp:Ts.arrowUp,arrowDown:Ts.arrowDown,arrowLeft:Ts.arrowLeft,arrowRight:Ts.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},TS=process.platform==="win32"?SS:Ts;pd.exports=TS});var bd=S((pP,gd)=>{"use strict";var qr=Z(),or=sa(),na=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),RS=t=>na[t]||na.default,Rs=Object.freeze({aborted:qr.red(or.cross),done:qr.green(or.tick),exited:qr.yellow(or.cross),default:qr.cyan("?")}),xS=(t,e,r)=>e?Rs.aborted:r?Rs.exited:t?Rs.done:Rs.default,CS=t=>qr.gray(t?or.ellipsis:or.pointerSmall),kS=(t,e)=>qr.gray(t?e?or.pointerSmall:"+":or.line);gd.exports={styles:na,render:RS,symbols:Rs,symbol:xS,delimiter:CS,item:kS}});var wd=S((gP,yd)=>{"use strict";var ES=Bn();yd.exports=function(t,e){let r=String(ES(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,o)=>n+o):r.length}});var vd=S((bP,_d)=>{"use strict";_d.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((a,l)=>(l.length+r.length>=n||a[a.length-1].length+l.length+1<n?a[a.length-1]+=` ${l}`:a.push(`${r}${l}`),a),[r]).join(`
50
+ `),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(vh.hide):this.out.write(jw(this.outputText,this.out.columns)),super.render(),this.outputText=[wh.symbol(this.done,this.aborted),_h.bold(this.msg),wh.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:_h.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Lw.line+vh.to(0)+this.outputText))}};Rh.exports=$o});var kh=S((ck,xh)=>{"use strict";xh.exports={TextPrompt:dc(),SelectPrompt:gc(),TogglePrompt:Sc(),DatePrompt:Kc(),NumberPrompt:nh(),MultiselectPrompt:Io(),AutocompletePrompt:mh(),AutocompleteMultiselectPrompt:yh(),ConfirmPrompt:Ch()}});var Eh=S(Ph=>{"use strict";var ye=Ph,Nw=kh(),Pn=t=>t;function tt(t,e,r={}){return new Promise((n,o)=>{let u=new Nw[t](e),l=r.onAbort||Pn,h=r.onSubmit||Pn,d=r.onExit||Pn;u.on("state",e.onState||Pn),u.on("submit",m=>n(h(m))),u.on("exit",m=>n(d(m))),u.on("abort",m=>o(l(m)))})}ye.text=t=>tt("TextPrompt",t);ye.password=t=>(t.style="password",ye.text(t));ye.invisible=t=>(t.style="invisible",ye.text(t));ye.number=t=>tt("NumberPrompt",t);ye.date=t=>tt("DatePrompt",t);ye.confirm=t=>tt("ConfirmPrompt",t);ye.list=t=>{let e=t.separator||",";return tt("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};ye.toggle=t=>tt("TogglePrompt",t);ye.select=t=>tt("SelectPrompt",t);ye.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return tt("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};ye.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return tt("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var Uw=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));ye.autocomplete=t=>(t.suggest=t.suggest||Uw,t.choices=[].concat(t.choices||[]),tt("AutocompletePrompt",t))});var Fh=S((dk,Bh)=>{"use strict";function Ah(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function Oh(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ah(Object(r),!0).forEach(function(n){Ww(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ah(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ww(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zw(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Hw(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(m){throw m},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
51
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var u=!0,l=!1,h;return{s:function(){r=r.call(t)},n:function(){var m=r.next();return u=m.done,m},e:function(m){l=!0,h=m},f:function(){try{!u&&r.return!=null&&r.return()}finally{if(l)throw h}}}}function Hw(t,e){if(t){if(typeof t=="string")return Ih(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ih(t,e)}}function Ih(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function qh(t,e,r,n,o,u,l){try{var h=t[u](l),d=h.value}catch(m){r(m);return}h.done?e(d):Promise.resolve(d).then(n,o)}function Dh(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function l(d){qh(u,n,o,l,h,"next",d)}function h(d){qh(u,n,o,l,h,"throw",d)}l(void 0)})}}var jo=Eh(),Gw=["suggest","format","onState","validate","onRender","type"],Mh=()=>{};function Ft(){return Lo.apply(this,arguments)}function Lo(){return Lo=Dh(function*(t=[],{onSubmit:e=Mh,onCancel:r=Mh}={}){let n={},o=Ft._override||{};t=[].concat(t);let u,l,h,d,m,p,w=(function(){var k=Dh(function*(P,j,J=!1){if(!(!J&&P.validate&&P.validate(j)!==!0))return P.format?yield P.format(j,n):j});return function(j,J){return k.apply(this,arguments)}})();var _=zw(t),R;try{for(_.s();!(R=_.n()).done;){l=R.value;var y=l;if(d=y.name,m=y.type,typeof m=="function"&&(m=yield m(u,Oh({},n),l),l.type=m),!!m){for(let k in l){if(Gw.includes(k))continue;let P=l[k];l[k]=typeof P=="function"?yield P(u,Oh({},n),p):P}if(p=l,typeof l.message!="string")throw new Error("prompt message is required");var D=l;if(d=D.name,m=D.type,jo[m]===void 0)throw new Error(`prompt type (${m}) is not defined`);if(o[l.name]!==void 0&&(u=yield w(l,o[l.name]),u!==void 0)){n[d]=u;continue}try{u=Ft._injected?Vw(Ft._injected,l.initial):yield jo[m](l),n[d]=u=yield w(l,u,!0),h=yield e(l,u,n)}catch{h=!(yield r(l,n))}if(h)return n}}}catch(k){_.e(k)}finally{_.f()}return n}),Lo.apply(this,arguments)}function Vw(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function Yw(t){Ft._injected=(Ft._injected||[]).concat(t)}function Qw(t){Ft._override=Object.assign({},t)}Bh.exports=Object.assign(Ft,{prompt:Ft,prompts:jo,inject:Yw,override:Qw})});var jh=S((fk,$h)=>{"use strict";$h.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var En=S((mk,Lh)=>{"use strict";Lh.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var Wh=S((pk,Uh)=>{"use strict";var Jw=En(),{erase:Nh,cursor:Kw}=X(),Zw=t=>[...Jw(t)].length;Uh.exports=function(t,e){if(!e)return Nh.line+Kw.to(0);let r=0,n=t.split(/\r?\n/);for(let o of n)r+=1+Math.floor(Math.max(Zw(o)-1,0)/e);return Nh.lines(r)}});var No=S((gk,zh)=>{"use strict";var ys={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Xw={arrowUp:ys.arrowUp,arrowDown:ys.arrowDown,arrowLeft:ys.arrowLeft,arrowRight:ys.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},ev=process.platform==="win32"?Xw:ys;zh.exports=ev});var Gh=S((bk,Hh)=>{"use strict";var Er=Z(),er=No(),Uo=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),tv=t=>Uo[t]||Uo.default,_s=Object.freeze({aborted:Er.red(er.cross),done:Er.green(er.tick),exited:Er.yellow(er.cross),default:Er.cyan("?")}),rv=(t,e,r)=>e?_s.aborted:r?_s.exited:t?_s.done:_s.default,sv=t=>Er.gray(t?er.ellipsis:er.pointerSmall),nv=(t,e)=>Er.gray(t?e?er.pointerSmall:"+":er.line);Hh.exports={styles:Uo,render:tv,symbols:_s,symbol:rv,delimiter:sv,item:nv}});var Yh=S((yk,Vh)=>{"use strict";var iv=En();Vh.exports=function(t,e){let r=String(iv(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,o)=>n+o):r.length}});var Jh=S((_k,Qh)=>{"use strict";Qh.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((u,l)=>(l.length+r.length>=n||u[u.length-1].length+l.length+1<n?u[u.length-1]+=` ${l}`:u.push(`${r}${l}`),u),[r]).join(`
52
52
  `)).join(`
53
- `)}});var Td=S((yP,Sd)=>{"use strict";Sd.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let o=Math.min(n+r,e);return{startIndex:n,endIndex:o}}});var Ze=S((wP,Rd)=>{"use strict";Rd.exports={action:cd(),clear:md(),style:bd(),strip:Bn(),figures:sa(),lines:wd(),wrap:vd(),entriesToDisplay:Td()}});var Tt=S((_P,Cd)=>{"use strict";var xd=require("readline"),{action:PS}=Ze(),AS=require("events"),{beep:OS,cursor:IS}=X(),qS=Z(),ia=class extends AS{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=xd.createInterface({input:this.in,escapeCodeTimeout:50});xd.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,o=(a,l)=>{let h=PS(l,n);h===!1?this._&&this._(a,l):typeof this[h]=="function"?this[h](l):this.bell()};this.close=()=>{this.out.write(IS.show),this.in.removeListener("keypress",o),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",o)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(OS)}render(){this.onRender(qS),this.firstRender&&(this.firstRender=!1)}};Cd.exports=ia});var Ed=S((vP,kd)=>{"use strict";var $n=Z(),MS=Tt(),{erase:DS,cursor:xs}=X(),{style:oa,clear:aa,lines:FS,figures:BS}=Ze(),ua=class extends MS{constructor(e={}){super(e),this.transform=oa.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=aa("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=$n.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
53
+ `)}});var Zh=S((wk,Kh)=>{"use strict";Kh.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let o=Math.min(n+r,e);return{startIndex:n,endIndex:o}}});var Ye=S((vk,Xh)=>{"use strict";Xh.exports={action:jh(),clear:Wh(),style:Gh(),strip:En(),figures:No(),lines:Yh(),wrap:Jh(),entriesToDisplay:Zh()}});var yt=S((Sk,td)=>{"use strict";var ed=require("readline"),{action:ov}=Ye(),av=require("events"),{beep:uv,cursor:lv}=X(),cv=Z(),Wo=class extends av{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=ed.createInterface({input:this.in,escapeCodeTimeout:50});ed.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,o=(u,l)=>{let h=ov(l,n);h===!1?this._&&this._(u,l):typeof this[h]=="function"?this[h](l):this.bell()};this.close=()=>{this.out.write(lv.show),this.in.removeListener("keypress",o),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",o)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(uv)}render(){this.onRender(cv),this.firstRender&&(this.firstRender=!1)}};td.exports=Wo});var sd=S((Tk,rd)=>{"use strict";var An=Z(),hv=yt(),{erase:dv,cursor:ws}=X(),{style:zo,clear:Ho,lines:fv,figures:mv}=Ye(),Go=class extends hv{constructor(e={}){super(e),this.transform=zo.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Ho("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=An.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
54
54
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
55
- `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),o=this.value.slice(this.cursor);this.value=`${n}${e}${o}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(xs.down(FS(this.outputError,this.out.columns)-1)+aa(this.outputError,this.out.columns)),this.out.write(aa(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[oa.symbol(this.done,this.aborted),$n.bold(this.msg),oa.delimiter(this.done),this.red?$n.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
55
+ `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),o=this.value.slice(this.cursor);this.value=`${n}${e}${o}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ws.down(fv(this.outputError,this.out.columns)-1)+Ho(this.outputError,this.out.columns)),this.out.write(Ho(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[zo.symbol(this.done,this.aborted),An.bold(this.msg),zo.delimiter(this.done),this.red?An.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
56
56
  `).reduce((e,r,n)=>e+`
57
- ${n?" ":BS.pointerSmall} ${$n.red().italic(r)}`,"")),this.out.write(DS.line+xs.to(0)+this.outputText+xs.save+this.outputError+xs.restore+xs.move(this.cursorOffset,0)))}};kd.exports=ua});var Id=S((SP,Od)=>{"use strict";var Rt=Z(),$S=Tt(),{style:Pd,clear:Ad,figures:jn,wrap:jS,entriesToDisplay:LS}=Ze(),{cursor:NS}=X(),la=class extends $S{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Ad("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
57
+ ${n?" ":mv.pointerSmall} ${An.red().italic(r)}`,"")),this.out.write(dv.line+ws.to(0)+this.outputText+ws.save+this.outputError+ws.restore+ws.move(this.cursorOffset,0)))}};rd.exports=Go});var ad=S((Rk,od)=>{"use strict";var _t=Z(),pv=yt(),{style:nd,clear:id,figures:On,wrap:gv,entriesToDisplay:bv}=Ye(),{cursor:yv}=X(),Vo=class extends pv{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=id("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
58
58
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
59
- `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(NS.hide):this.out.write(Ad(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=LS(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[Pd.symbol(this.done,this.aborted),Rt.bold(this.msg),Pd.delimiter(!1),this.done?this.selection.title:this.selection.disabled?Rt.yellow(this.warn):Rt.gray(this.hint)].join(" "),!this.done){this.outputText+=`
60
- `;for(let n=e;n<r;n++){let o,a,l="",h=this.choices[n];n===e&&e>0?a=jn.arrowUp:n===r-1&&r<this.choices.length?a=jn.arrowDown:a=" ",h.disabled?(o=this.cursor===n?Rt.gray().underline(h.title):Rt.strikethrough().gray(h.title),a=(this.cursor===n?Rt.bold().gray(jn.pointer)+" ":" ")+a):(o=this.cursor===n?Rt.cyan().underline(h.title):h.title,a=(this.cursor===n?Rt.cyan(jn.pointer)+" ":" ")+a,h.description&&this.cursor===n&&(l=` - ${h.description}`,(a.length+o.length+l.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(l=`
61
- `+jS(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${a} ${o}${Rt.gray(l)}
62
- `}}this.out.write(this.outputText)}};Od.exports=la});var Fd=S((TP,Dd)=>{"use strict";var Ln=Z(),US=Tt(),{style:qd,clear:WS}=Ze(),{cursor:Md,erase:zS}=X(),ca=class extends US{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
59
+ `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(yv.hide):this.out.write(id(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=bv(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[nd.symbol(this.done,this.aborted),_t.bold(this.msg),nd.delimiter(!1),this.done?this.selection.title:this.selection.disabled?_t.yellow(this.warn):_t.gray(this.hint)].join(" "),!this.done){this.outputText+=`
60
+ `;for(let n=e;n<r;n++){let o,u,l="",h=this.choices[n];n===e&&e>0?u=On.arrowUp:n===r-1&&r<this.choices.length?u=On.arrowDown:u=" ",h.disabled?(o=this.cursor===n?_t.gray().underline(h.title):_t.strikethrough().gray(h.title),u=(this.cursor===n?_t.bold().gray(On.pointer)+" ":" ")+u):(o=this.cursor===n?_t.cyan().underline(h.title):h.title,u=(this.cursor===n?_t.cyan(On.pointer)+" ":" ")+u,h.description&&this.cursor===n&&(l=` - ${h.description}`,(u.length+o.length+l.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(l=`
61
+ `+gv(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${u} ${o}${_t.gray(l)}
62
+ `}}this.out.write(this.outputText)}};od.exports=Vo});var hd=S((Ck,cd)=>{"use strict";var In=Z(),_v=yt(),{style:ud,clear:wv}=Ye(),{cursor:ld,erase:vv}=X(),Yo=class extends _v{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
63
63
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
64
- `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Md.hide):this.out.write(WS(this.outputText,this.out.columns)),super.render(),this.outputText=[qd.symbol(this.done,this.aborted),Ln.bold(this.msg),qd.delimiter(this.done),this.value?this.inactive:Ln.cyan().underline(this.inactive),Ln.gray("/"),this.value?Ln.cyan().underline(this.active):this.active].join(" "),this.out.write(zS.line+Md.to(0)+this.outputText))}};Dd.exports=ca});var at=S((RP,Bd)=>{"use strict";var ha=class t{constructor({token:e,date:r,parts:n,locales:o}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=o||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,o)=>o>r&&n instanceof t)}toString(){return String(this.date)}};Bd.exports=ha});var jd=S((xP,$d)=>{"use strict";var HS=at(),da=class extends HS{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};$d.exports=da});var Nd=S((CP,Ld)=>{"use strict";var GS=at(),VS=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),fa=class extends GS{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+VS(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};Ld.exports=fa});var Wd=S((kP,Ud)=>{"use strict";var YS=at(),ma=class extends YS{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Ud.exports=ma});var Hd=S((EP,zd)=>{"use strict";var QS=at(),pa=class extends QS{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};zd.exports=pa});var Vd=S((PP,Gd)=>{"use strict";var JS=at(),ga=class extends JS{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Gd.exports=ga});var Qd=S((AP,Yd)=>{"use strict";var KS=at(),ba=class extends KS{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};Yd.exports=ba});var Kd=S((OP,Jd)=>{"use strict";var ZS=at(),ya=class extends ZS{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Jd.exports=ya});var Xd=S((IP,Zd)=>{"use strict";var XS=at(),wa=class extends XS{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Zd.exports=wa});var tf=S((qP,ef)=>{"use strict";ef.exports={DatePart:at(),Meridiem:jd(),Day:Nd(),Hours:Wd(),Milliseconds:Hd(),Minutes:Vd(),Month:Qd(),Seconds:Kd(),Year:Xd()}});var lf=S((MP,uf)=>{"use strict";var _a=Z(),eT=Tt(),{style:rf,clear:sf,figures:tT}=Ze(),{erase:rT,cursor:nf}=X(),{DatePart:of,Meridiem:sT,Day:nT,Hours:iT,Milliseconds:oT,Minutes:aT,Month:uT,Seconds:lT,Year:cT}=tf(),hT=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,af={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new nT(t),3:t=>new uT(t),4:t=>new cT(t),5:t=>new sT(t),6:t=>new iT(t),7:t=>new aT(t),8:t=>new lT(t),9:t=>new oT(t)},dT={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},va=class extends eT{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(dT,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=sf("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=hT.exec(e);){let o=r.shift(),a=r.findIndex(l=>l!=null);this.parts.push(a in af?af[a]({token:r[a]||o,date:this.date,parts:this.parts,locales:this.locales}):r[a]||o)}let n=this.parts.reduce((o,a)=>(typeof a=="string"&&typeof o[o.length-1]=="string"?o[o.length-1]+=a:o.push(a),o),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof of)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
64
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(ld.hide):this.out.write(wv(this.outputText,this.out.columns)),super.render(),this.outputText=[ud.symbol(this.done,this.aborted),In.bold(this.msg),ud.delimiter(this.done),this.value?this.inactive:In.cyan().underline(this.inactive),In.gray("/"),this.value?In.cyan().underline(this.active):this.active].join(" "),this.out.write(vv.line+ld.to(0)+this.outputText))}};cd.exports=Yo});var rt=S((xk,dd)=>{"use strict";var Qo=class t{constructor({token:e,date:r,parts:n,locales:o}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=o||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,o)=>o>r&&n instanceof t)}toString(){return String(this.date)}};dd.exports=Qo});var md=S((kk,fd)=>{"use strict";var Sv=rt(),Jo=class extends Sv{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};fd.exports=Jo});var gd=S((Pk,pd)=>{"use strict";var Tv=rt(),Rv=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),Ko=class extends Tv{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Rv(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};pd.exports=Ko});var yd=S((Ek,bd)=>{"use strict";var Cv=rt(),Zo=class extends Cv{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};bd.exports=Zo});var wd=S((Ak,_d)=>{"use strict";var xv=rt(),Xo=class extends xv{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};_d.exports=Xo});var Sd=S((Ok,vd)=>{"use strict";var kv=rt(),ea=class extends kv{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};vd.exports=ea});var Rd=S((Ik,Td)=>{"use strict";var Pv=rt(),ta=class extends Pv{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};Td.exports=ta});var xd=S((qk,Cd)=>{"use strict";var Ev=rt(),ra=class extends Ev{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Cd.exports=ra});var Pd=S((Dk,kd)=>{"use strict";var Av=rt(),sa=class extends Av{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};kd.exports=sa});var Ad=S((Mk,Ed)=>{"use strict";Ed.exports={DatePart:rt(),Meridiem:md(),Day:gd(),Hours:yd(),Milliseconds:wd(),Minutes:Sd(),Month:Rd(),Seconds:xd(),Year:Pd()}});var Fd=S((Bk,Bd)=>{"use strict";var na=Z(),Ov=yt(),{style:Od,clear:Id,figures:Iv}=Ye(),{erase:qv,cursor:qd}=X(),{DatePart:Dd,Meridiem:Dv,Day:Mv,Hours:Bv,Milliseconds:Fv,Minutes:$v,Month:jv,Seconds:Lv,Year:Nv}=Ad(),Uv=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,Md={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new Mv(t),3:t=>new jv(t),4:t=>new Nv(t),5:t=>new Dv(t),6:t=>new Bv(t),7:t=>new $v(t),8:t=>new Lv(t),9:t=>new Fv(t)},Wv={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},ia=class extends Ov{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Wv,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Id("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=Uv.exec(e);){let o=r.shift(),u=r.findIndex(l=>l!=null);this.parts.push(u in Md?Md[u]({token:r[u]||o,date:this.date,parts:this.parts,locales:this.locales}):r[u]||o)}let n=this.parts.reduce((o,u)=>(typeof u=="string"&&typeof o[o.length-1]=="string"?o[o.length-1]+=u:o.push(u),o),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof Dd)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
65
65
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
66
- `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof of)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(nf.hide):this.out.write(sf(this.outputText,this.out.columns)),super.render(),this.outputText=[rf.symbol(this.done,this.aborted),_a.bold(this.msg),rf.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?_a.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
66
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof Dd)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(qd.hide):this.out.write(Id(this.outputText,this.out.columns)),super.render(),this.outputText=[Od.symbol(this.done,this.aborted),na.bold(this.msg),Od.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?na.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
67
67
  `).reduce((e,r,n)=>e+`
68
- ${n?" ":tT.pointerSmall} ${_a.red().italic(r)}`,"")),this.out.write(rT.line+nf.to(0)+this.outputText))}};uf.exports=va});var ff=S((DP,df)=>{"use strict";var Nn=Z(),fT=Tt(),{cursor:Un,erase:mT}=X(),{style:Sa,figures:pT,clear:cf,lines:gT}=Ze(),bT=/[0-9]/,Ta=t=>t!==void 0,hf=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},Ra=class extends fT{constructor(e={}){super(e),this.transform=Sa.render(e.style),this.msg=e.message,this.initial=Ta(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Ta(e.min)?e.min:-1/0,this.max=Ta(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Nn.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${hf(e,this.round)}`),this._value=hf(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||bT.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
68
+ ${n?" ":Iv.pointerSmall} ${na.red().italic(r)}`,"")),this.out.write(qv.line+qd.to(0)+this.outputText))}};Bd.exports=ia});var Nd=S((Fk,Ld)=>{"use strict";var qn=Z(),zv=yt(),{cursor:Dn,erase:Hv}=X(),{style:oa,figures:Gv,clear:$d,lines:Vv}=Ye(),Yv=/[0-9]/,aa=t=>t!==void 0,jd=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},ua=class extends zv{constructor(e={}){super(e),this.transform=oa.render(e.style),this.msg=e.message,this.initial=aa(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=aa(e.min)?e.min:-1/0,this.max=aa(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=qn.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${jd(e,this.round)}`),this._value=jd(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Yv.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
69
69
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
70
- `),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Un.down(gT(this.outputError,this.out.columns)-1)+cf(this.outputError,this.out.columns)),this.out.write(cf(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Sa.symbol(this.done,this.aborted),Nn.bold(this.msg),Sa.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Nn[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
70
+ `),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Dn.down(Vv(this.outputError,this.out.columns)-1)+$d(this.outputError,this.out.columns)),this.out.write($d(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[oa.symbol(this.done,this.aborted),qn.bold(this.msg),oa.delimiter(this.done),!this.done||!this.done&&!this.placeholder?qn[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
71
71
  `).reduce((e,r,n)=>e+`
72
- ${n?" ":pT.pointerSmall} ${Nn.red().italic(r)}`,"")),this.out.write(mT.line+Un.to(0)+this.outputText+Un.save+this.outputError+Un.restore))}};df.exports=Ra});var Ca=S((FP,gf)=>{"use strict";var ut=Z(),{cursor:yT}=X(),wT=Tt(),{clear:mf,figures:zt,style:pf,wrap:_T,entriesToDisplay:vT}=Ze(),xa=class extends wT{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=mf("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
72
+ ${n?" ":Gv.pointerSmall} ${qn.red().italic(r)}`,"")),this.out.write(Hv.line+Dn.to(0)+this.outputText+Dn.save+this.outputError+Dn.restore))}};Ld.exports=ua});var ca=S(($k,zd)=>{"use strict";var st=Z(),{cursor:Qv}=X(),Jv=yt(),{clear:Ud,figures:$t,style:Wd,wrap:Kv,entriesToDisplay:Zv}=Ye(),la=class extends Jv{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=Ud("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
73
73
  `),this.close()}submit(){let e=this.value.filter(r=>r.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
74
74
  `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=e),this.render()}_(e,r){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
75
75
  Instructions:
76
- ${zt.arrowUp}/${zt.arrowDown}: Highlight option
77
- ${zt.arrowLeft}/${zt.arrowRight}/[space]: Toggle selection
76
+ ${$t.arrowUp}/${$t.arrowDown}: Highlight option
77
+ ${$t.arrowLeft}/${$t.arrowRight}/[space]: Toggle selection
78
78
  `+(this.maxChoices===void 0?` a: Toggle all
79
- `:"")+" enter/return: Complete answer":""}renderOption(e,r,n,o){let a=(r.selected?ut.green(zt.radioOn):zt.radioOff)+" "+o+" ",l,h;return r.disabled?l=e===n?ut.gray().underline(r.title):ut.strikethrough().gray(r.title):(l=e===n?ut.cyan().underline(r.title):r.title,e===n&&r.description&&(h=` - ${r.description}`,(a.length+l.length+h.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(h=`
80
- `+_T(r.description,{margin:a.length,width:this.out.columns})))),a+l+ut.gray(h||"")}paginateOptions(e){if(e.length===0)return ut.red("No matches for this query.");let{startIndex:r,endIndex:n}=vT(this.cursor,e.length,this.optionsPerPage),o,a=[];for(let l=r;l<n;l++)l===r&&r>0?o=zt.arrowUp:l===n-1&&n<e.length?o=zt.arrowDown:o=" ",a.push(this.renderOption(this.cursor,e[l],l,o));return`
81
- `+a.join(`
82
- `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[ut.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(ut.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(yT.hide),super.render();let e=[pf.symbol(this.done,this.aborted),ut.bold(this.msg),pf.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=ut.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=mf(e,this.out.columns)}};gf.exports=xa});var vf=S((BP,_f)=>{"use strict";var Cs=Z(),ST=Tt(),{erase:TT,cursor:bf}=X(),{style:ka,clear:yf,figures:Ea,wrap:RT,entriesToDisplay:xT}=Ze(),wf=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),CT=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),kT=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},Pa=class extends ST{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:kT(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=ka.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=yf("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=wf(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let r=this.completing=this.suggest(this.input,this.choices),n=await r;if(this.completing!==r)return;this.suggestions=n.map((a,l,h)=>({title:CT(h,l),value:wf(h,l),description:a.description})),this.completing=!1;let o=Math.max(n.length-1,0);this.moveSelect(Math.min(o,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
79
+ `:"")+" enter/return: Complete answer":""}renderOption(e,r,n,o){let u=(r.selected?st.green($t.radioOn):$t.radioOff)+" "+o+" ",l,h;return r.disabled?l=e===n?st.gray().underline(r.title):st.strikethrough().gray(r.title):(l=e===n?st.cyan().underline(r.title):r.title,e===n&&r.description&&(h=` - ${r.description}`,(u.length+l.length+h.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(h=`
80
+ `+Kv(r.description,{margin:u.length,width:this.out.columns})))),u+l+st.gray(h||"")}paginateOptions(e){if(e.length===0)return st.red("No matches for this query.");let{startIndex:r,endIndex:n}=Zv(this.cursor,e.length,this.optionsPerPage),o,u=[];for(let l=r;l<n;l++)l===r&&r>0?o=$t.arrowUp:l===n-1&&n<e.length?o=$t.arrowDown:o=" ",u.push(this.renderOption(this.cursor,e[l],l,o));return`
81
+ `+u.join(`
82
+ `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[st.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(st.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Qv.hide),super.render();let e=[Wd.symbol(this.done,this.aborted),st.bold(this.msg),Wd.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=st.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=Ud(e,this.out.columns)}};zd.exports=la});var Qd=S((jk,Yd)=>{"use strict";var vs=Z(),Xv=yt(),{erase:eS,cursor:Hd}=X(),{style:ha,clear:Gd,figures:da,wrap:tS,entriesToDisplay:rS}=Ye(),Vd=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),sS=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),nS=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},fa=class extends Xv{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:nS(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=ha.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Gd("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Vd(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let r=this.completing=this.suggest(this.input,this.choices),n=await r;if(this.completing!==r)return;this.suggestions=n.map((u,l,h)=>({title:sS(h,l),value:Vd(h,l),description:u.description})),this.completing=!1;let o=Math.max(n.length-1,0);this.moveSelect(Math.min(o,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
83
83
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
84
84
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
85
- `),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),o=this.input.slice(this.cursor);this.input=`${n}${e}${o}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,o){let a,l=n?Ea.arrowUp:o?Ea.arrowDown:" ",h=r?Cs.cyan().underline(e.title):e.title;return l=(r?Cs.cyan(Ea.pointer)+" ":" ")+l,e.description&&(a=` - ${e.description}`,(l.length+h.length+a.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(a=`
86
- `+RT(e.description,{margin:3,width:this.out.columns}))),l+" "+h+Cs.gray(a||"")}render(){if(this.closed)return;this.firstRender?this.out.write(bf.hide):this.out.write(yf(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=xT(this.select,this.choices.length,this.limit);if(this.outputText=[ka.symbol(this.done,this.aborted,this.exited),Cs.bold(this.msg),ka.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let n=this.suggestions.slice(e,r).map((o,a)=>this.renderOption(o,this.select===a+e,a===0&&e>0,a+e===r-1&&r<this.choices.length)).join(`
85
+ `),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),o=this.input.slice(this.cursor);this.input=`${n}${e}${o}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,o){let u,l=n?da.arrowUp:o?da.arrowDown:" ",h=r?vs.cyan().underline(e.title):e.title;return l=(r?vs.cyan(da.pointer)+" ":" ")+l,e.description&&(u=` - ${e.description}`,(l.length+h.length+u.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(u=`
86
+ `+tS(e.description,{margin:3,width:this.out.columns}))),l+" "+h+vs.gray(u||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Hd.hide):this.out.write(Gd(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=rS(this.select,this.choices.length,this.limit);if(this.outputText=[ha.symbol(this.done,this.aborted,this.exited),vs.bold(this.msg),ha.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let n=this.suggestions.slice(e,r).map((o,u)=>this.renderOption(o,this.select===u+e,u===0&&e>0,u+e===r-1&&r<this.choices.length)).join(`
87
87
  `);this.outputText+=`
88
- `+(n||Cs.gray(this.fallback.title))}this.out.write(TT.line+bf.to(0)+this.outputText)}};_f.exports=Pa});var xf=S(($P,Rf)=>{"use strict";var xt=Z(),{cursor:ET}=X(),PT=Ca(),{clear:Sf,style:Tf,figures:Mr}=Ze(),Aa=class extends PT{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Sf("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
88
+ `+(n||vs.gray(this.fallback.title))}this.out.write(eS.line+Hd.to(0)+this.outputText)}};Yd.exports=fa});var Xd=S((Lk,Zd)=>{"use strict";var wt=Z(),{cursor:iS}=X(),oS=ca(),{clear:Jd,style:Kd,figures:Ar}=Ye(),ma=class extends oS{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Jd("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
89
89
  Instructions:
90
- ${Mr.arrowUp}/${Mr.arrowDown}: Highlight option
91
- ${Mr.arrowLeft}/${Mr.arrowRight}/[space]: Toggle selection
90
+ ${Ar.arrowUp}/${Ar.arrowDown}: Highlight option
91
+ ${Ar.arrowLeft}/${Ar.arrowRight}/[space]: Toggle selection
92
92
  [a,b,c]/delete: Filter choices
93
93
  enter/return: Complete answer
94
94
  `:""}renderCurrentInput(){return`
95
- Filtered results for: ${this.inputValue?this.inputValue:xt.gray("Enter something to filter")}
96
- `}renderOption(e,r,n){let o;return r.disabled?o=e===n?xt.gray().underline(r.title):xt.strikethrough().gray(r.title):o=e===n?xt.cyan().underline(r.title):r.title,(r.selected?xt.green(Mr.radioOn):Mr.radioOff)+" "+o}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[xt.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(xt.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(ET.hide),super.render();let e=[Tf.symbol(this.done,this.aborted),xt.bold(this.msg),Tf.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=xt.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Sf(e,this.out.columns)}};Rf.exports=Aa});var Af=S((jP,Pf)=>{"use strict";var Cf=Z(),AT=Tt(),{style:kf,clear:OT}=Ze(),{erase:IT,cursor:Ef}=X(),Oa=class extends AT{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
95
+ Filtered results for: ${this.inputValue?this.inputValue:wt.gray("Enter something to filter")}
96
+ `}renderOption(e,r,n){let o;return r.disabled?o=e===n?wt.gray().underline(r.title):wt.strikethrough().gray(r.title):o=e===n?wt.cyan().underline(r.title):r.title,(r.selected?wt.green(Ar.radioOn):Ar.radioOff)+" "+o}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[wt.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(wt.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(iS.hide),super.render();let e=[Kd.symbol(this.done,this.aborted),wt.bold(this.msg),Kd.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=wt.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Jd(e,this.out.columns)}};Zd.exports=ma});var nf=S((Nk,sf)=>{"use strict";var ef=Z(),aS=yt(),{style:tf,clear:uS}=Ye(),{erase:lS,cursor:rf}=X(),pa=class extends aS{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
97
97
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
98
- `),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Ef.hide):this.out.write(OT(this.outputText,this.out.columns)),super.render(),this.outputText=[kf.symbol(this.done,this.aborted),Cf.bold(this.msg),kf.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Cf.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(IT.line+Ef.to(0)+this.outputText))}};Pf.exports=Oa});var If=S((LP,Of)=>{"use strict";Of.exports={TextPrompt:Ed(),SelectPrompt:Id(),TogglePrompt:Fd(),DatePrompt:lf(),NumberPrompt:ff(),MultiselectPrompt:Ca(),AutocompletePrompt:vf(),AutocompleteMultiselectPrompt:xf(),ConfirmPrompt:Af()}});var Mf=S(qf=>{"use strict";var ye=qf,qT=If(),Wn=t=>t;function lt(t,e,r={}){return new Promise((n,o)=>{let a=new qT[t](e),l=r.onAbort||Wn,h=r.onSubmit||Wn,d=r.onExit||Wn;a.on("state",e.onState||Wn),a.on("submit",f=>n(h(f))),a.on("exit",f=>n(d(f))),a.on("abort",f=>o(l(f)))})}ye.text=t=>lt("TextPrompt",t);ye.password=t=>(t.style="password",ye.text(t));ye.invisible=t=>(t.style="invisible",ye.text(t));ye.number=t=>lt("NumberPrompt",t);ye.date=t=>lt("DatePrompt",t);ye.confirm=t=>lt("ConfirmPrompt",t);ye.list=t=>{let e=t.separator||",";return lt("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};ye.toggle=t=>lt("TogglePrompt",t);ye.select=t=>lt("SelectPrompt",t);ye.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return lt("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};ye.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return lt("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var MT=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));ye.autocomplete=t=>(t.suggest=t.suggest||MT,t.choices=[].concat(t.choices||[]),lt("AutocompletePrompt",t))});var Bf=S((UP,Ff)=>{"use strict";var Ia=Mf(),DT=["suggest","format","onState","validate","onRender","type"],Df=()=>{};async function Ht(t=[],{onSubmit:e=Df,onCancel:r=Df}={}){let n={},o=Ht._override||{};t=[].concat(t);let a,l,h,d,f,p,w=async(_,T,y=!1)=>{if(!(!y&&_.validate&&_.validate(T)!==!0))return _.format?await _.format(T,n):T};for(l of t)if({name:d,type:f}=l,typeof f=="function"&&(f=await f(a,{...n},l),l.type=f),!!f){for(let _ in l){if(DT.includes(_))continue;let T=l[_];l[_]=typeof T=="function"?await T(a,{...n},p):T}if(p=l,typeof l.message!="string")throw new Error("prompt message is required");if({name:d,type:f}=l,Ia[f]===void 0)throw new Error(`prompt type (${f}) is not defined`);if(o[l.name]!==void 0&&(a=await w(l,o[l.name]),a!==void 0)){n[d]=a;continue}try{a=Ht._injected?FT(Ht._injected,l.initial):await Ia[f](l),n[d]=a=await w(l,a,!0),h=await e(l,a,n)}catch{h=!await r(l,n)}if(h)return n}return n}function FT(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function BT(t){Ht._injected=(Ht._injected||[]).concat(t)}function $T(t){Ht._override=Object.assign({},t)}Ff.exports=Object.assign(Ht,{prompt:Ht,prompts:Ia,inject:BT,override:$T})});var Ct=S((WP,$f)=>{"use strict";function jT(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let e=0,r=process.versions.node.split(".").map(Number);for(;e<t.length;e++){if(r[e]>t[e])return!1;if(t[e]>r[e])return!0}return!1}$f.exports=jT("8.6.0")?ud():Bf()});var Ma=S((zP,qa)=>{"use strict";var Hn=process||{},jf=Hn.argv||[],zn=Hn.env||{},LT=!(zn.NO_COLOR||jf.includes("--no-color"))&&(!!zn.FORCE_COLOR||jf.includes("--color")||Hn.platform==="win32"||(Hn.stdout||{}).isTTY&&zn.TERM!=="dumb"||!!zn.CI),NT=(t,e,r=t)=>n=>{let o=""+n,a=o.indexOf(e,t.length);return~a?t+UT(o,e,r,a)+e:t+o+e},UT=(t,e,r,n)=>{let o="",a=0;do o+=t.substring(a,n)+r,a=n+e.length,n=t.indexOf(e,a);while(~n);return o+t.substring(a)},Lf=(t=LT)=>{let e=t?NT:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};qa.exports=Lf();qa.exports.createColors=Lf});var Uf=S((HP,Nf)=>{"use strict";var Dr=1e3,Fr=Dr*60,Br=Fr*60,ar=Br*24,WT=ar*7,zT=ar*365.25;Nf.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return HT(t);if(r==="number"&&isFinite(t))return e.long?VT(t):GT(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function HT(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*zT;case"weeks":case"week":case"w":return r*WT;case"days":case"day":case"d":return r*ar;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Br;case"minutes":case"minute":case"mins":case"min":case"m":return r*Fr;case"seconds":case"second":case"secs":case"sec":case"s":return r*Dr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function GT(t){var e=Math.abs(t);return e>=ar?Math.round(t/ar)+"d":e>=Br?Math.round(t/Br)+"h":e>=Fr?Math.round(t/Fr)+"m":e>=Dr?Math.round(t/Dr)+"s":t+"ms"}function VT(t){var e=Math.abs(t);return e>=ar?Gn(t,e,ar,"day"):e>=Br?Gn(t,e,Br,"hour"):e>=Fr?Gn(t,e,Fr,"minute"):e>=Dr?Gn(t,e,Dr,"second"):t+" ms"}function Gn(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Da=S((GP,Wf)=>{"use strict";function YT(t){r.debug=r,r.default=r,r.coerce=d,r.disable=l,r.enable=o,r.enabled=h,r.humanize=Uf(),r.destroy=f,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let w=0;for(let _=0;_<p.length;_++)w=(w<<5)-w+p.charCodeAt(_),w|=0;return r.colors[Math.abs(w)%r.colors.length]}r.selectColor=e;function r(p){let w,_=null,T,y;function M(...k){if(!M.enabled)return;let E=M,L=Number(new Date),K=L-(w||L);E.diff=K,E.prev=w,E.curr=L,w=L,k[0]=r.coerce(k[0]),typeof k[0]!="string"&&k.unshift("%O");let j=0;k[0]=k[0].replace(/%([a-zA-Z%])/g,(z,De)=>{if(z==="%%")return"%";j++;let rt=r.formatters[De];if(typeof rt=="function"){let Jt=k[j];z=rt.call(E,Jt),k.splice(j,1),j--}return z}),r.formatArgs.call(E,k),(E.log||r.log).apply(E,k)}return M.namespace=p,M.useColors=r.useColors(),M.color=r.selectColor(p),M.extend=n,M.destroy=r.destroy,Object.defineProperty(M,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(T!==r.namespaces&&(T=r.namespaces,y=r.enabled(p)),y),set:k=>{_=k}}),typeof r.init=="function"&&r.init(M),M}function n(p,w){let _=r(this.namespace+(typeof w>"u"?":":w)+p);return _.log=this.log,_}function o(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let w=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of w)_[0]==="-"?r.skips.push(_.slice(1)):r.names.push(_)}function a(p,w){let _=0,T=0,y=-1,M=0;for(;_<p.length;)if(T<w.length&&(w[T]===p[_]||w[T]==="*"))w[T]==="*"?(y=T,M=_,T++):(_++,T++);else if(y!==-1)T=y+1,M++,_=M;else return!1;for(;T<w.length&&w[T]==="*";)T++;return T===w.length}function l(){let p=[...r.names,...r.skips.map(w=>"-"+w)].join(",");return r.enable(""),p}function h(p){for(let w of r.skips)if(a(p,w))return!1;for(let w of r.names)if(a(p,w))return!0;return!1}function d(p){return p instanceof Error?p.stack||p.message:p}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Wf.exports=YT});var zf=S((we,Vn)=>{"use strict";we.formatArgs=JT;we.save=KT;we.load=ZT;we.useColors=QT;we.storage=XT();we.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();we.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function QT(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function JT(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Vn.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}we.log=console.debug||console.log||(()=>{});function KT(t){try{t?we.storage.setItem("debug",t):we.storage.removeItem("debug")}catch{}}function ZT(){let t;try{t=we.storage.getItem("debug")||we.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function XT(){try{return localStorage}catch{}}Vn.exports=Da()(we);var{formatters:eR}=Vn.exports;eR.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Gf=S((VP,Hf)=>{"use strict";Hf.exports=(t,e)=>{e=e||process.argv;let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var Yf=S((YP,Vf)=>{"use strict";var tR=require("os"),Xe=Gf(),ce=process.env,$r;Xe("no-color")||Xe("no-colors")||Xe("color=false")?$r=!1:(Xe("color")||Xe("colors")||Xe("color=true")||Xe("color=always"))&&($r=!0);"FORCE_COLOR"in ce&&($r=ce.FORCE_COLOR.length===0||parseInt(ce.FORCE_COLOR,10)!==0);function rR(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function sR(t){if($r===!1)return 0;if(Xe("color=16m")||Xe("color=full")||Xe("color=truecolor"))return 3;if(Xe("color=256"))return 2;if(t&&!t.isTTY&&$r!==!0)return 0;let e=$r?1:0;if(process.platform==="win32"){let r=tR.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in ce)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(r=>r in ce)||ce.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in ce)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ce.TEAMCITY_VERSION)?1:0;if(ce.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ce){let r=parseInt((ce.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ce.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ce.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ce.TERM)||"COLORTERM"in ce?1:(ce.TERM==="dumb",e)}function Fa(t){let e=sR(t);return rR(e)}Vf.exports={supportsColor:Fa,stdout:Fa(process.stdout),stderr:Fa(process.stderr)}});var Jf=S((oe,Qn)=>{"use strict";var nR=require("tty"),Yn=require("util");oe.init=hR;oe.log=uR;oe.formatArgs=oR;oe.save=lR;oe.load=cR;oe.useColors=iR;oe.destroy=Yn.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");oe.colors=[6,2,3,4,5,1];try{let t=Yf();t&&(t.stderr||t).level>=2&&(oe.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}oe.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,a)=>a.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function iR(){return"colors"in oe.inspectOpts?!!oe.inspectOpts.colors:nR.isatty(process.stderr.fd)}function oR(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),a=` ${o};1m${e} \x1B[0m`;t[0]=a+t[0].split(`
98
+ `),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(rf.hide):this.out.write(uS(this.outputText,this.out.columns)),super.render(),this.outputText=[tf.symbol(this.done,this.aborted),ef.bold(this.msg),tf.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:ef.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(lS.line+rf.to(0)+this.outputText))}};sf.exports=pa});var af=S((Uk,of)=>{"use strict";of.exports={TextPrompt:sd(),SelectPrompt:ad(),TogglePrompt:hd(),DatePrompt:Fd(),NumberPrompt:Nd(),MultiselectPrompt:ca(),AutocompletePrompt:Qd(),AutocompleteMultiselectPrompt:Xd(),ConfirmPrompt:nf()}});var lf=S(uf=>{"use strict";var _e=uf,cS=af(),Mn=t=>t;function nt(t,e,r={}){return new Promise((n,o)=>{let u=new cS[t](e),l=r.onAbort||Mn,h=r.onSubmit||Mn,d=r.onExit||Mn;u.on("state",e.onState||Mn),u.on("submit",m=>n(h(m))),u.on("exit",m=>n(d(m))),u.on("abort",m=>o(l(m)))})}_e.text=t=>nt("TextPrompt",t);_e.password=t=>(t.style="password",_e.text(t));_e.invisible=t=>(t.style="invisible",_e.text(t));_e.number=t=>nt("NumberPrompt",t);_e.date=t=>nt("DatePrompt",t);_e.confirm=t=>nt("ConfirmPrompt",t);_e.list=t=>{let e=t.separator||",";return nt("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};_e.toggle=t=>nt("TogglePrompt",t);_e.select=t=>nt("SelectPrompt",t);_e.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return nt("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};_e.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return nt("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var hS=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));_e.autocomplete=t=>(t.suggest=t.suggest||hS,t.choices=[].concat(t.choices||[]),nt("AutocompletePrompt",t))});var df=S((zk,hf)=>{"use strict";var ga=lf(),dS=["suggest","format","onState","validate","onRender","type"],cf=()=>{};async function jt(t=[],{onSubmit:e=cf,onCancel:r=cf}={}){let n={},o=jt._override||{};t=[].concat(t);let u,l,h,d,m,p,w=async(_,R,y=!1)=>{if(!(!y&&_.validate&&_.validate(R)!==!0))return _.format?await _.format(R,n):R};for(l of t)if({name:d,type:m}=l,typeof m=="function"&&(m=await m(u,{...n},l),l.type=m),!!m){for(let _ in l){if(dS.includes(_))continue;let R=l[_];l[_]=typeof R=="function"?await R(u,{...n},p):R}if(p=l,typeof l.message!="string")throw new Error("prompt message is required");if({name:d,type:m}=l,ga[m]===void 0)throw new Error(`prompt type (${m}) is not defined`);if(o[l.name]!==void 0&&(u=await w(l,o[l.name]),u!==void 0)){n[d]=u;continue}try{u=jt._injected?fS(jt._injected,l.initial):await ga[m](l),n[d]=u=await w(l,u,!0),h=await e(l,u,n)}catch{h=!await r(l,n)}if(h)return n}return n}function fS(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function mS(t){jt._injected=(jt._injected||[]).concat(t)}function pS(t){jt._override=Object.assign({},t)}hf.exports=Object.assign(jt,{prompt:jt,prompts:ga,inject:mS,override:pS})});var Bn=S((Hk,ff)=>{"use strict";function gS(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let e=0,r=process.versions.node.split(".").map(Number);for(;e<t.length;e++){if(r[e]>t[e])return!1;if(t[e]>r[e])return!0}return!1}ff.exports=gS("8.6.0")?Fh():df()});var ya=S((Gk,ba)=>{"use strict";var $n=process||{},mf=$n.argv||[],Fn=$n.env||{},bS=!(Fn.NO_COLOR||mf.includes("--no-color"))&&(!!Fn.FORCE_COLOR||mf.includes("--color")||$n.platform==="win32"||($n.stdout||{}).isTTY&&Fn.TERM!=="dumb"||!!Fn.CI),yS=(t,e,r=t)=>n=>{let o=""+n,u=o.indexOf(e,t.length);return~u?t+_S(o,e,r,u)+e:t+o+e},_S=(t,e,r,n)=>{let o="",u=0;do o+=t.substring(u,n)+r,u=n+e.length,n=t.indexOf(e,u);while(~n);return o+t.substring(u)},pf=(t=bS)=>{let e=t?yS:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};ba.exports=pf();ba.exports.createColors=pf});var bf=S((Vk,gf)=>{"use strict";var Or=1e3,Ir=Or*60,qr=Ir*60,tr=qr*24,wS=tr*7,vS=tr*365.25;gf.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return SS(t);if(r==="number"&&isFinite(t))return e.long?RS(t):TS(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function SS(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*vS;case"weeks":case"week":case"w":return r*wS;case"days":case"day":case"d":return r*tr;case"hours":case"hour":case"hrs":case"hr":case"h":return r*qr;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ir;case"seconds":case"second":case"secs":case"sec":case"s":return r*Or;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function TS(t){var e=Math.abs(t);return e>=tr?Math.round(t/tr)+"d":e>=qr?Math.round(t/qr)+"h":e>=Ir?Math.round(t/Ir)+"m":e>=Or?Math.round(t/Or)+"s":t+"ms"}function RS(t){var e=Math.abs(t);return e>=tr?jn(t,e,tr,"day"):e>=qr?jn(t,e,qr,"hour"):e>=Ir?jn(t,e,Ir,"minute"):e>=Or?jn(t,e,Or,"second"):t+" ms"}function jn(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var _a=S((Yk,yf)=>{"use strict";function CS(t){r.debug=r,r.default=r,r.coerce=d,r.disable=l,r.enable=o,r.enabled=h,r.humanize=bf(),r.destroy=m,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let w=0;for(let _=0;_<p.length;_++)w=(w<<5)-w+p.charCodeAt(_),w|=0;return r.colors[Math.abs(w)%r.colors.length]}r.selectColor=e;function r(p){let w,_=null,R,y;function D(...k){if(!D.enabled)return;let P=D,j=Number(new Date),J=j-(w||j);P.diff=J,P.prev=w,P.curr=j,w=j,k[0]=r.coerce(k[0]),typeof k[0]!="string"&&k.unshift("%O");let $=0;k[0]=k[0].replace(/%([a-zA-Z%])/g,(U,Oe)=>{if(U==="%%")return"%";$++;let Ke=r.formatters[Oe];if(typeof Ke=="function"){let Wt=k[$];U=Ke.call(P,Wt),k.splice($,1),$--}return U}),r.formatArgs.call(P,k),(P.log||r.log).apply(P,k)}return D.namespace=p,D.useColors=r.useColors(),D.color=r.selectColor(p),D.extend=n,D.destroy=r.destroy,Object.defineProperty(D,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(R!==r.namespaces&&(R=r.namespaces,y=r.enabled(p)),y),set:k=>{_=k}}),typeof r.init=="function"&&r.init(D),D}function n(p,w){let _=r(this.namespace+(typeof w>"u"?":":w)+p);return _.log=this.log,_}function o(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let w=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of w)_[0]==="-"?r.skips.push(_.slice(1)):r.names.push(_)}function u(p,w){let _=0,R=0,y=-1,D=0;for(;_<p.length;)if(R<w.length&&(w[R]===p[_]||w[R]==="*"))w[R]==="*"?(y=R,D=_,R++):(_++,R++);else if(y!==-1)R=y+1,D++,_=D;else return!1;for(;R<w.length&&w[R]==="*";)R++;return R===w.length}function l(){let p=[...r.names,...r.skips.map(w=>"-"+w)].join(",");return r.enable(""),p}function h(p){for(let w of r.skips)if(u(p,w))return!1;for(let w of r.names)if(u(p,w))return!0;return!1}function d(p){return p instanceof Error?p.stack||p.message:p}function m(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}yf.exports=CS});var _f=S((we,Ln)=>{"use strict";we.formatArgs=kS;we.save=PS;we.load=ES;we.useColors=xS;we.storage=AS();we.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();we.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xS(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function kS(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Ln.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}we.log=console.debug||console.log||(()=>{});function PS(t){try{t?we.storage.setItem("debug",t):we.storage.removeItem("debug")}catch{}}function ES(){let t;try{t=we.storage.getItem("debug")||we.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function AS(){try{return localStorage}catch{}}Ln.exports=_a()(we);var{formatters:OS}=Ln.exports;OS.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var vf=S((Qk,wf)=>{"use strict";wf.exports=(t,e)=>{e=e||process.argv;let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var Tf=S((Jk,Sf)=>{"use strict";var IS=require("os"),Qe=vf(),le=process.env,Dr;Qe("no-color")||Qe("no-colors")||Qe("color=false")?Dr=!1:(Qe("color")||Qe("colors")||Qe("color=true")||Qe("color=always"))&&(Dr=!0);"FORCE_COLOR"in le&&(Dr=le.FORCE_COLOR.length===0||parseInt(le.FORCE_COLOR,10)!==0);function qS(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function DS(t){if(Dr===!1)return 0;if(Qe("color=16m")||Qe("color=full")||Qe("color=truecolor"))return 3;if(Qe("color=256"))return 2;if(t&&!t.isTTY&&Dr!==!0)return 0;let e=Dr?1:0;if(process.platform==="win32"){let r=IS.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in le)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(r=>r in le)||le.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in le)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(le.TEAMCITY_VERSION)?1:0;if(le.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in le){let r=parseInt((le.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(le.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(le.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(le.TERM)||"COLORTERM"in le?1:(le.TERM==="dumb",e)}function wa(t){let e=DS(t);return qS(e)}Sf.exports={supportsColor:wa,stdout:wa(process.stdout),stderr:wa(process.stderr)}});var Cf=S((oe,Un)=>{"use strict";var MS=require("tty"),Nn=require("util");oe.init=US;oe.log=jS;oe.formatArgs=FS;oe.save=LS;oe.load=NS;oe.useColors=BS;oe.destroy=Nn.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");oe.colors=[6,2,3,4,5,1];try{let t=Tf();t&&(t.stderr||t).level>=2&&(oe.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}oe.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,u)=>u.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function BS(){return"colors"in oe.inspectOpts?!!oe.inspectOpts.colors:MS.isatty(process.stderr.fd)}function FS(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${o};1m${e} \x1B[0m`;t[0]=u+t[0].split(`
99
99
  `).join(`
100
- `+a),t.push(o+"m+"+Qn.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=aR()+e+" "+t[0]}function aR(){return oe.inspectOpts.hideDate?"":new Date().toISOString()+" "}function uR(...t){return process.stderr.write(Yn.formatWithOptions(oe.inspectOpts,...t)+`
101
- `)}function lR(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function cR(){return process.env.DEBUG}function hR(t){t.inspectOpts={};let e=Object.keys(oe.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=oe.inspectOpts[e[r]]}Qn.exports=Da()(oe);var{formatters:Qf}=Qn.exports;Qf.o=function(t){return this.inspectOpts.colors=this.useColors,Yn.inspect(t,this.inspectOpts).split(`
102
- `).map(e=>e.trim()).join(" ")};Qf.O=function(t){return this.inspectOpts.colors=this.useColors,Yn.inspect(t,this.inspectOpts)}});var $a=S((QP,Ba)=>{"use strict";typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ba.exports=zf():Ba.exports=Jf()});var Kf=S(Ee=>{"use strict";var dR=Ee&&Ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ee,"__esModule",{value:!0});var fR=require("fs"),mR=dR($a()),jr=mR.default("@kwsites/file-exists");function pR(t,e,r){jr("checking %s",t);try{let n=fR.statSync(t);return n.isFile()&&e?(jr("[OK] path represents a file"),!0):n.isDirectory()&&r?(jr("[OK] path represents a directory"),!0):(jr("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return jr("[FAIL] path is not accessible: %o",n),!1;throw jr("[FATAL] %o",n),n}}function gR(t,e=Ee.READABLE){return pR(t,(e&Ee.FILE)>0,(e&Ee.FOLDER)>0)}Ee.exists=gR;Ee.FILE=1;Ee.FOLDER=2;Ee.READABLE=Ee.FILE+Ee.FOLDER});var Zf=S(Jn=>{"use strict";function bR(t){for(var e in t)Jn.hasOwnProperty(e)||(Jn[e]=t[e])}Object.defineProperty(Jn,"__esModule",{value:!0});bR(Kf())});var La=S(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.createDeferred=ur.deferred=void 0;function ja(){let t,e,r="pending";return{promise:new Promise((o,a)=>{t=o,e=a}),done(o){r==="pending"&&(r="resolved",t(o))},fail(o){r==="pending"&&(r="rejected",e(o))},get fulfilled(){return r!=="pending"},get status(){return r}}}ur.deferred=ja;ur.createDeferred=ja;ur.default=ja});var Jg=S((vi,Qg)=>{"use strict";(function(t,e){typeof vi=="object"&&typeof Qg<"u"?e(vi):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(vi,(function(t){"use strict";function e(){}function r(s){return typeof s=="object"&&s!==null||typeof s=="function"}let n=e;function o(s,i){try{Object.defineProperty(s,"name",{value:i,configurable:!0})}catch{}}let a=Promise,l=Promise.prototype.then,h=Promise.reject.bind(a);function d(s){return new a(s)}function f(s){return d(i=>i(s))}function p(s){return h(s)}function w(s,i,u){return l.call(s,i,u)}function _(s,i,u){w(w(s,i,u),void 0,n)}function T(s,i){_(s,i)}function y(s,i){_(s,void 0,i)}function M(s,i,u){return w(s,i,u)}function k(s){w(s,void 0,n)}let E=s=>{if(typeof queueMicrotask=="function")E=queueMicrotask;else{let i=f(void 0);E=u=>w(i,u)}return E(s)};function L(s,i,u){if(typeof s!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(s,i,u)}function K(s,i,u){try{return f(L(s,i,u))}catch(c){return p(c)}}let j=16384;class U{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(i){let u=this._back,c=u;u._elements.length===j-1&&(c={_elements:[],_next:void 0}),u._elements.push(i),c!==u&&(this._back=c,u._next=c),++this._size}shift(){let i=this._front,u=i,c=this._cursor,m=c+1,g=i._elements,b=g[c];return m===j&&(u=i._next,m=0),--this._size,this._cursor=m,i!==u&&(this._front=u),g[c]=void 0,b}forEach(i){let u=this._cursor,c=this._front,m=c._elements;for(;(u!==m.length||c._next!==void 0)&&!(u===m.length&&(c=c._next,m=c._elements,u=0,m.length===0));)i(m[u]),++u}peek(){let i=this._front,u=this._cursor;return i._elements[u]}}let z=Symbol("[[AbortSteps]]"),De=Symbol("[[ErrorSteps]]"),rt=Symbol("[[CancelSteps]]"),Jt=Symbol("[[PullSteps]]"),Xr=Symbol("[[ReleaseSteps]]");function Vs(s,i){s._ownerReadableStream=i,i._reader=s,i._state==="readable"?ts(s):i._state==="closed"?Li(s):Ys(s,i._storedError)}function es(s,i){let u=s._ownerReadableStream;return Qe(u,i)}function Ge(s){let i=s._ownerReadableStream;i._state==="readable"?rs(s,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):Ni(s,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),i._readableStreamController[Xr](),i._reader=void 0,s._ownerReadableStream=void 0}function yr(s){return new TypeError("Cannot "+s+" a stream using a released reader")}function ts(s){s._closedPromise=d((i,u)=>{s._closedPromise_resolve=i,s._closedPromise_reject=u})}function Ys(s,i){ts(s),rs(s,i)}function Li(s){ts(s),Qs(s)}function rs(s,i){s._closedPromise_reject!==void 0&&(k(s._closedPromise),s._closedPromise_reject(i),s._closedPromise_resolve=void 0,s._closedPromise_reject=void 0)}function Ni(s,i){Ys(s,i)}function Qs(s){s._closedPromise_resolve!==void 0&&(s._closedPromise_resolve(void 0),s._closedPromise_resolve=void 0,s._closedPromise_reject=void 0)}let Js=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},Ui=Math.trunc||function(s){return s<0?Math.ceil(s):Math.floor(s)};function Wi(s){return typeof s=="object"||typeof s=="function"}function Fe(s,i){if(s!==void 0&&!Wi(s))throw new TypeError(`${i} is not an object.`)}function me(s,i){if(typeof s!="function")throw new TypeError(`${i} is not a function.`)}function zi(s){return typeof s=="object"&&s!==null||typeof s=="function"}function Ks(s,i){if(!zi(s))throw new TypeError(`${i} is not an object.`)}function Ve(s,i,u){if(s===void 0)throw new TypeError(`Parameter ${i} is required in '${u}'.`)}function ss(s,i,u){if(s===void 0)throw new TypeError(`${i} is required in '${u}'.`)}function ns(s){return Number(s)}function Zs(s){return s===0?0:s}function Be(s){return Zs(Ui(s))}function A(s,i){let c=Number.MAX_SAFE_INTEGER,m=Number(s);if(m=Zs(m),!Js(m))throw new TypeError(`${i} is not a finite number`);if(m=Be(m),m<0||m>c)throw new TypeError(`${i} is outside the accepted range of 0 to ${c}, inclusive`);return!Js(m)||m===0?0:m}function wr(s,i){if(!$t(s))throw new TypeError(`${i} is not a ReadableStream.`)}function v(s){return new $e(s)}function C(s,i){s._reader._readRequests.push(i)}function W(s,i,u){let m=s._reader._readRequests.shift();u?m._closeSteps():m._chunkSteps(i)}function ne(s){return s._reader._readRequests.length}function pe(s){let i=s._reader;return!(i===void 0||!qt(i))}class $e{constructor(i){if(Ve(i,1,"ReadableStreamDefaultReader"),wr(i,"First parameter"),jt(i))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Vs(this,i),this._readRequests=new U}get closed(){return qt(this)?this._closedPromise:p(Xs("closed"))}cancel(i=void 0){return qt(this)?this._ownerReadableStream===void 0?p(yr("cancel")):es(this,i):p(Xs("cancel"))}read(){if(!qt(this))return p(Xs("read"));if(this._ownerReadableStream===void 0)return p(yr("read from"));let i,u,c=d((g,b)=>{i=g,u=b});return is(this,{_chunkSteps:g=>i({value:g,done:!1}),_closeSteps:()=>i({value:void 0,done:!0}),_errorSteps:g=>u(g)}),c}releaseLock(){if(!qt(this))throw Xs("releaseLock");this._ownerReadableStream!==void 0&&Gy(this)}}Object.defineProperties($e.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),o($e.prototype.cancel,"cancel"),o($e.prototype.read,"read"),o($e.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty($e.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function qt(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_readRequests")?!1:s instanceof $e}function is(s,i){let u=s._ownerReadableStream;u._disturbed=!0,u._state==="closed"?i._closeSteps():u._state==="errored"?i._errorSteps(u._storedError):u._readableStreamController[Jt](i)}function Gy(s){Ge(s);let i=new TypeError("Reader was released");tl(s,i)}function tl(s,i){let u=s._readRequests;s._readRequests=new U,u.forEach(c=>{c._errorSteps(i)})}function Xs(s){return new TypeError(`ReadableStreamDefaultReader.prototype.${s} can only be used on a ReadableStreamDefaultReader`)}let Vy=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class rl{constructor(i,u){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=i,this._preventCancel=u}next(){let i=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?M(this._ongoingPromise,i,i):i(),this._ongoingPromise}return(i){let u=()=>this._returnSteps(i);return this._ongoingPromise?M(this._ongoingPromise,u,u):u()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let i=this._reader,u,c,m=d((b,x)=>{u=b,c=x});return is(i,{_chunkSteps:b=>{this._ongoingPromise=void 0,E(()=>u({value:b,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Ge(i),u({value:void 0,done:!0})},_errorSteps:b=>{this._ongoingPromise=void 0,this._isFinished=!0,Ge(i),c(b)}}),m}_returnSteps(i){if(this._isFinished)return Promise.resolve({value:i,done:!0});this._isFinished=!0;let u=this._reader;if(!this._preventCancel){let c=es(u,i);return Ge(u),M(c,()=>({value:i,done:!0}))}return Ge(u),f({value:i,done:!0})}}let sl={next(){return nl(this)?this._asyncIteratorImpl.next():p(il("next"))},return(s){return nl(this)?this._asyncIteratorImpl.return(s):p(il("return"))}};Object.setPrototypeOf(sl,Vy);function Yy(s,i){let u=v(s),c=new rl(u,i),m=Object.create(sl);return m._asyncIteratorImpl=c,m}function nl(s){if(!r(s)||!Object.prototype.hasOwnProperty.call(s,"_asyncIteratorImpl"))return!1;try{return s._asyncIteratorImpl instanceof rl}catch{return!1}}function il(s){return new TypeError(`ReadableStreamAsyncIterator.${s} can only be used on a ReadableSteamAsyncIterator`)}let ol=Number.isNaN||function(s){return s!==s};var Hi,Gi,Vi;function os(s){return s.slice()}function al(s,i,u,c,m){new Uint8Array(s).set(new Uint8Array(u,c,m),i)}let ft=s=>(typeof s.transfer=="function"?ft=i=>i.transfer():typeof structuredClone=="function"?ft=i=>structuredClone(i,{transfer:[i]}):ft=i=>i,ft(s)),Mt=s=>(typeof s.detached=="boolean"?Mt=i=>i.detached:Mt=i=>i.byteLength===0,Mt(s));function ul(s,i,u){if(s.slice)return s.slice(i,u);let c=u-i,m=new ArrayBuffer(c);return al(m,0,s,i,c),m}function en(s,i){let u=s[i];if(u!=null){if(typeof u!="function")throw new TypeError(`${String(i)} is not a function`);return u}}function Qy(s){let i={[Symbol.iterator]:()=>s.iterator},u=(async function*(){return yield*i})(),c=u.next;return{iterator:u,nextMethod:c,done:!1}}let Yi=(Vi=(Hi=Symbol.asyncIterator)!==null&&Hi!==void 0?Hi:(Gi=Symbol.for)===null||Gi===void 0?void 0:Gi.call(Symbol,"Symbol.asyncIterator"))!==null&&Vi!==void 0?Vi:"@@asyncIterator";function ll(s,i="sync",u){if(u===void 0)if(i==="async"){if(u=en(s,Yi),u===void 0){let g=en(s,Symbol.iterator),b=ll(s,"sync",g);return Qy(b)}}else u=en(s,Symbol.iterator);if(u===void 0)throw new TypeError("The object is not iterable");let c=L(u,s,[]);if(!r(c))throw new TypeError("The iterator method must return an object");let m=c.next;return{iterator:c,nextMethod:m,done:!1}}function Jy(s){let i=L(s.nextMethod,s.iterator,[]);if(!r(i))throw new TypeError("The iterator.next() method must return an object");return i}function Ky(s){return!!s.done}function Zy(s){return s.value}function Xy(s){return!(typeof s!="number"||ol(s)||s<0)}function cl(s){let i=ul(s.buffer,s.byteOffset,s.byteOffset+s.byteLength);return new Uint8Array(i)}function Qi(s){let i=s._queue.shift();return s._queueTotalSize-=i.size,s._queueTotalSize<0&&(s._queueTotalSize=0),i.value}function Ji(s,i,u){if(!Xy(u)||u===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");s._queue.push({value:i,size:u}),s._queueTotalSize+=u}function ew(s){return s._queue.peek().value}function Dt(s){s._queue=new U,s._queueTotalSize=0}function hl(s){return s===DataView}function tw(s){return hl(s.constructor)}function rw(s){return hl(s)?1:s.BYTES_PER_ELEMENT}class Kt{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Ki(this))throw ro("view");return this._view}respond(i){if(!Ki(this))throw ro("respond");if(Ve(i,1,"respond"),i=A(i,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(Mt(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");nn(this._associatedReadableByteStreamController,i)}respondWithNewView(i){if(!Ki(this))throw ro("respondWithNewView");if(Ve(i,1,"respondWithNewView"),!ArrayBuffer.isView(i))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(Mt(i.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");on(this._associatedReadableByteStreamController,i)}}Object.defineProperties(Kt.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),o(Kt.prototype.respond,"respond"),o(Kt.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Kt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class mt{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Zt(this))throw us("byobRequest");return to(this)}get desiredSize(){if(!Zt(this))throw us("desiredSize");return vl(this)}close(){if(!Zt(this))throw us("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let i=this._controlledReadableByteStream._state;if(i!=="readable")throw new TypeError(`The stream (in ${i} state) is not in the readable state and cannot be closed`);as(this)}enqueue(i){if(!Zt(this))throw us("enqueue");if(Ve(i,1,"enqueue"),!ArrayBuffer.isView(i))throw new TypeError("chunk must be an array buffer view");if(i.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(i.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let u=this._controlledReadableByteStream._state;if(u!=="readable")throw new TypeError(`The stream (in ${u} state) is not in the readable state and cannot be enqueued to`);sn(this,i)}error(i=void 0){if(!Zt(this))throw us("error");je(this,i)}[rt](i){dl(this),Dt(this);let u=this._cancelAlgorithm(i);return rn(this),u}[Jt](i){let u=this._controlledReadableByteStream;if(this._queueTotalSize>0){_l(this,i);return}let c=this._autoAllocateChunkSize;if(c!==void 0){let m;try{m=new ArrayBuffer(c)}catch(b){i._errorSteps(b);return}let g={buffer:m,bufferByteLength:c,byteOffset:0,byteLength:c,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(g)}C(u,i),Xt(this)}[Xr](){if(this._pendingPullIntos.length>0){let i=this._pendingPullIntos.peek();i.readerType="none",this._pendingPullIntos=new U,this._pendingPullIntos.push(i)}}}Object.defineProperties(mt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),o(mt.prototype.close,"close"),o(mt.prototype.enqueue,"enqueue"),o(mt.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(mt.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Zt(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_controlledReadableByteStream")?!1:s instanceof mt}function Ki(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_associatedReadableByteStreamController")?!1:s instanceof Kt}function Xt(s){if(!aw(s))return;if(s._pulling){s._pullAgain=!0;return}s._pulling=!0;let u=s._pullAlgorithm();_(u,()=>(s._pulling=!1,s._pullAgain&&(s._pullAgain=!1,Xt(s)),null),c=>(je(s,c),null))}function dl(s){Xi(s),s._pendingPullIntos=new U}function Zi(s,i){let u=!1;s._state==="closed"&&(u=!0);let c=fl(i);i.readerType==="default"?W(s,c,u):fw(s,c,u)}function fl(s){let i=s.bytesFilled,u=s.elementSize;return new s.viewConstructor(s.buffer,s.byteOffset,i/u)}function tn(s,i,u,c){s._queue.push({buffer:i,byteOffset:u,byteLength:c}),s._queueTotalSize+=c}function ml(s,i,u,c){let m;try{m=ul(i,u,u+c)}catch(g){throw je(s,g),g}tn(s,m,0,c)}function pl(s,i){i.bytesFilled>0&&ml(s,i.buffer,i.byteOffset,i.bytesFilled),_r(s)}function gl(s,i){let u=Math.min(s._queueTotalSize,i.byteLength-i.bytesFilled),c=i.bytesFilled+u,m=u,g=!1,b=c%i.elementSize,x=c-b;x>=i.minimumFill&&(m=x-i.bytesFilled,g=!0);let I=s._queue;for(;m>0;){let P=I.peek(),F=Math.min(m,P.byteLength),$=i.byteOffset+i.bytesFilled;al(i.buffer,$,P.buffer,P.byteOffset,F),P.byteLength===F?I.shift():(P.byteOffset+=F,P.byteLength-=F),s._queueTotalSize-=F,bl(s,F,i),m-=F}return g}function bl(s,i,u){u.bytesFilled+=i}function yl(s){s._queueTotalSize===0&&s._closeRequested?(rn(s),ms(s._controlledReadableByteStream)):Xt(s)}function Xi(s){s._byobRequest!==null&&(s._byobRequest._associatedReadableByteStreamController=void 0,s._byobRequest._view=null,s._byobRequest=null)}function eo(s){for(;s._pendingPullIntos.length>0;){if(s._queueTotalSize===0)return;let i=s._pendingPullIntos.peek();gl(s,i)&&(_r(s),Zi(s._controlledReadableByteStream,i))}}function sw(s){let i=s._controlledReadableByteStream._reader;for(;i._readRequests.length>0;){if(s._queueTotalSize===0)return;let u=i._readRequests.shift();_l(s,u)}}function nw(s,i,u,c){let m=s._controlledReadableByteStream,g=i.constructor,b=rw(g),{byteOffset:x,byteLength:I}=i,P=u*b,F;try{F=ft(i.buffer)}catch(G){c._errorSteps(G);return}let $={buffer:F,bufferByteLength:F.byteLength,byteOffset:x,byteLength:I,bytesFilled:0,minimumFill:P,elementSize:b,viewConstructor:g,readerType:"byob"};if(s._pendingPullIntos.length>0){s._pendingPullIntos.push($),Rl(m,c);return}if(m._state==="closed"){let G=new g($.buffer,$.byteOffset,0);c._closeSteps(G);return}if(s._queueTotalSize>0){if(gl(s,$)){let G=fl($);yl(s),c._chunkSteps(G);return}if(s._closeRequested){let G=new TypeError("Insufficient bytes to fill elements in the given buffer");je(s,G),c._errorSteps(G);return}}s._pendingPullIntos.push($),Rl(m,c),Xt(s)}function iw(s,i){i.readerType==="none"&&_r(s);let u=s._controlledReadableByteStream;if(so(u))for(;xl(u)>0;){let c=_r(s);Zi(u,c)}}function ow(s,i,u){if(bl(s,i,u),u.readerType==="none"){pl(s,u),eo(s);return}if(u.bytesFilled<u.minimumFill)return;_r(s);let c=u.bytesFilled%u.elementSize;if(c>0){let m=u.byteOffset+u.bytesFilled;ml(s,u.buffer,m-c,c)}u.bytesFilled-=c,Zi(s._controlledReadableByteStream,u),eo(s)}function wl(s,i){let u=s._pendingPullIntos.peek();Xi(s),s._controlledReadableByteStream._state==="closed"?iw(s,u):ow(s,i,u),Xt(s)}function _r(s){return s._pendingPullIntos.shift()}function aw(s){let i=s._controlledReadableByteStream;return i._state!=="readable"||s._closeRequested||!s._started?!1:!!(pe(i)&&ne(i)>0||so(i)&&xl(i)>0||vl(s)>0)}function rn(s){s._pullAlgorithm=void 0,s._cancelAlgorithm=void 0}function as(s){let i=s._controlledReadableByteStream;if(!(s._closeRequested||i._state!=="readable")){if(s._queueTotalSize>0){s._closeRequested=!0;return}if(s._pendingPullIntos.length>0){let u=s._pendingPullIntos.peek();if(u.bytesFilled%u.elementSize!==0){let c=new TypeError("Insufficient bytes to fill elements in the given buffer");throw je(s,c),c}}rn(s),ms(i)}}function sn(s,i){let u=s._controlledReadableByteStream;if(s._closeRequested||u._state!=="readable")return;let{buffer:c,byteOffset:m,byteLength:g}=i;if(Mt(c))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let b=ft(c);if(s._pendingPullIntos.length>0){let x=s._pendingPullIntos.peek();if(Mt(x.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Xi(s),x.buffer=ft(x.buffer),x.readerType==="none"&&pl(s,x)}if(pe(u))if(sw(s),ne(u)===0)tn(s,b,m,g);else{s._pendingPullIntos.length>0&&_r(s);let x=new Uint8Array(b,m,g);W(u,x,!1)}else so(u)?(tn(s,b,m,g),eo(s)):tn(s,b,m,g);Xt(s)}function je(s,i){let u=s._controlledReadableByteStream;u._state==="readable"&&(dl(s),Dt(s),rn(s),Ql(u,i))}function _l(s,i){let u=s._queue.shift();s._queueTotalSize-=u.byteLength,yl(s);let c=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);i._chunkSteps(c)}function to(s){if(s._byobRequest===null&&s._pendingPullIntos.length>0){let i=s._pendingPullIntos.peek(),u=new Uint8Array(i.buffer,i.byteOffset+i.bytesFilled,i.byteLength-i.bytesFilled),c=Object.create(Kt.prototype);lw(c,s,u),s._byobRequest=c}return s._byobRequest}function vl(s){let i=s._controlledReadableByteStream._state;return i==="errored"?null:i==="closed"?0:s._strategyHWM-s._queueTotalSize}function nn(s,i){let u=s._pendingPullIntos.peek();if(s._controlledReadableByteStream._state==="closed"){if(i!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(i===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(u.bytesFilled+i>u.byteLength)throw new RangeError("bytesWritten out of range")}u.buffer=ft(u.buffer),wl(s,i)}function on(s,i){let u=s._pendingPullIntos.peek();if(s._controlledReadableByteStream._state==="closed"){if(i.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(i.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(u.byteOffset+u.bytesFilled!==i.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(u.bufferByteLength!==i.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(u.bytesFilled+i.byteLength>u.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let m=i.byteLength;u.buffer=ft(i.buffer),wl(s,m)}function Sl(s,i,u,c,m,g,b){i._controlledReadableByteStream=s,i._pullAgain=!1,i._pulling=!1,i._byobRequest=null,i._queue=i._queueTotalSize=void 0,Dt(i),i._closeRequested=!1,i._started=!1,i._strategyHWM=g,i._pullAlgorithm=c,i._cancelAlgorithm=m,i._autoAllocateChunkSize=b,i._pendingPullIntos=new U,s._readableStreamController=i;let x=u();_(f(x),()=>(i._started=!0,Xt(i),null),I=>(je(i,I),null))}function uw(s,i,u){let c=Object.create(mt.prototype),m,g,b;i.start!==void 0?m=()=>i.start(c):m=()=>{},i.pull!==void 0?g=()=>i.pull(c):g=()=>f(void 0),i.cancel!==void 0?b=I=>i.cancel(I):b=()=>f(void 0);let x=i.autoAllocateChunkSize;if(x===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");Sl(s,c,m,g,b,u,x)}function lw(s,i,u){s._associatedReadableByteStreamController=i,s._view=u}function ro(s){return new TypeError(`ReadableStreamBYOBRequest.prototype.${s} can only be used on a ReadableStreamBYOBRequest`)}function us(s){return new TypeError(`ReadableByteStreamController.prototype.${s} can only be used on a ReadableByteStreamController`)}function cw(s,i){Fe(s,i);let u=s?.mode;return{mode:u===void 0?void 0:hw(u,`${i} has member 'mode' that`)}}function hw(s,i){if(s=`${s}`,s!=="byob")throw new TypeError(`${i} '${s}' is not a valid enumeration value for ReadableStreamReaderMode`);return s}function dw(s,i){var u;Fe(s,i);let c=(u=s?.min)!==null&&u!==void 0?u:1;return{min:A(c,`${i} has member 'min' that`)}}function Tl(s){return new Ft(s)}function Rl(s,i){s._reader._readIntoRequests.push(i)}function fw(s,i,u){let m=s._reader._readIntoRequests.shift();u?m._closeSteps(i):m._chunkSteps(i)}function xl(s){return s._reader._readIntoRequests.length}function so(s){let i=s._reader;return!(i===void 0||!er(i))}class Ft{constructor(i){if(Ve(i,1,"ReadableStreamBYOBReader"),wr(i,"First parameter"),jt(i))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Zt(i._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Vs(this,i),this._readIntoRequests=new U}get closed(){return er(this)?this._closedPromise:p(an("closed"))}cancel(i=void 0){return er(this)?this._ownerReadableStream===void 0?p(yr("cancel")):es(this,i):p(an("cancel"))}read(i,u={}){if(!er(this))return p(an("read"));if(!ArrayBuffer.isView(i))return p(new TypeError("view must be an array buffer view"));if(i.byteLength===0)return p(new TypeError("view must have non-zero byteLength"));if(i.buffer.byteLength===0)return p(new TypeError("view's buffer must have non-zero byteLength"));if(Mt(i.buffer))return p(new TypeError("view's buffer has been detached"));let c;try{c=dw(u,"options")}catch(P){return p(P)}let m=c.min;if(m===0)return p(new TypeError("options.min must be greater than 0"));if(tw(i)){if(m>i.byteLength)return p(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(m>i.length)return p(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return p(yr("read from"));let g,b,x=d((P,F)=>{g=P,b=F});return Cl(this,i,m,{_chunkSteps:P=>g({value:P,done:!1}),_closeSteps:P=>g({value:P,done:!0}),_errorSteps:P=>b(P)}),x}releaseLock(){if(!er(this))throw an("releaseLock");this._ownerReadableStream!==void 0&&mw(this)}}Object.defineProperties(Ft.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),o(Ft.prototype.cancel,"cancel"),o(Ft.prototype.read,"read"),o(Ft.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ft.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function er(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_readIntoRequests")?!1:s instanceof Ft}function Cl(s,i,u,c){let m=s._ownerReadableStream;m._disturbed=!0,m._state==="errored"?c._errorSteps(m._storedError):nw(m._readableStreamController,i,u,c)}function mw(s){Ge(s);let i=new TypeError("Reader was released");kl(s,i)}function kl(s,i){let u=s._readIntoRequests;s._readIntoRequests=new U,u.forEach(c=>{c._errorSteps(i)})}function an(s){return new TypeError(`ReadableStreamBYOBReader.prototype.${s} can only be used on a ReadableStreamBYOBReader`)}function ls(s,i){let{highWaterMark:u}=s;if(u===void 0)return i;if(ol(u)||u<0)throw new RangeError("Invalid highWaterMark");return u}function un(s){let{size:i}=s;return i||(()=>1)}function ln(s,i){Fe(s,i);let u=s?.highWaterMark,c=s?.size;return{highWaterMark:u===void 0?void 0:ns(u),size:c===void 0?void 0:pw(c,`${i} has member 'size' that`)}}function pw(s,i){return me(s,i),u=>ns(s(u))}function gw(s,i){Fe(s,i);let u=s?.abort,c=s?.close,m=s?.start,g=s?.type,b=s?.write;return{abort:u===void 0?void 0:bw(u,s,`${i} has member 'abort' that`),close:c===void 0?void 0:yw(c,s,`${i} has member 'close' that`),start:m===void 0?void 0:ww(m,s,`${i} has member 'start' that`),write:b===void 0?void 0:_w(b,s,`${i} has member 'write' that`),type:g}}function bw(s,i,u){return me(s,u),c=>K(s,i,[c])}function yw(s,i,u){return me(s,u),()=>K(s,i,[])}function ww(s,i,u){return me(s,u),c=>L(s,i,[c])}function _w(s,i,u){return me(s,u),(c,m)=>K(s,i,[c,m])}function El(s,i){if(!vr(s))throw new TypeError(`${i} is not a WritableStream.`)}function vw(s){if(typeof s!="object"||s===null)return!1;try{return typeof s.aborted=="boolean"}catch{return!1}}let Sw=typeof AbortController=="function";function Tw(){if(Sw)return new AbortController}class Bt{constructor(i={},u={}){i===void 0?i=null:Ks(i,"First parameter");let c=ln(u,"Second parameter"),m=gw(i,"First parameter");if(Al(this),m.type!==void 0)throw new RangeError("Invalid type is specified");let b=un(c),x=ls(c,1);Bw(this,m,x,b)}get locked(){if(!vr(this))throw mn("locked");return Sr(this)}abort(i=void 0){return vr(this)?Sr(this)?p(new TypeError("Cannot abort a stream that already has a writer")):cn(this,i):p(mn("abort"))}close(){return vr(this)?Sr(this)?p(new TypeError("Cannot close a stream that already has a writer")):st(this)?p(new TypeError("Cannot close an already-closing stream")):Ol(this):p(mn("close"))}getWriter(){if(!vr(this))throw mn("getWriter");return Pl(this)}}Object.defineProperties(Bt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),o(Bt.prototype.abort,"abort"),o(Bt.prototype.close,"close"),o(Bt.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Bt.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function Pl(s){return new pt(s)}function Rw(s,i,u,c,m=1,g=()=>1){let b=Object.create(Bt.prototype);Al(b);let x=Object.create(Tr.prototype);return Bl(b,x,s,i,u,c,m,g),b}function Al(s){s._state="writable",s._storedError=void 0,s._writer=void 0,s._writableStreamController=void 0,s._writeRequests=new U,s._inFlightWriteRequest=void 0,s._closeRequest=void 0,s._inFlightCloseRequest=void 0,s._pendingAbortRequest=void 0,s._backpressure=!1}function vr(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_writableStreamController")?!1:s instanceof Bt}function Sr(s){return s._writer!==void 0}function cn(s,i){var u;if(s._state==="closed"||s._state==="errored")return f(void 0);s._writableStreamController._abortReason=i,(u=s._writableStreamController._abortController)===null||u===void 0||u.abort(i);let c=s._state;if(c==="closed"||c==="errored")return f(void 0);if(s._pendingAbortRequest!==void 0)return s._pendingAbortRequest._promise;let m=!1;c==="erroring"&&(m=!0,i=void 0);let g=d((b,x)=>{s._pendingAbortRequest={_promise:void 0,_resolve:b,_reject:x,_reason:i,_wasAlreadyErroring:m}});return s._pendingAbortRequest._promise=g,m||io(s,i),g}function Ol(s){let i=s._state;if(i==="closed"||i==="errored")return p(new TypeError(`The stream (in ${i} state) is not in the writable state and cannot be closed`));let u=d((m,g)=>{let b={_resolve:m,_reject:g};s._closeRequest=b}),c=s._writer;return c!==void 0&&s._backpressure&&i==="writable"&&mo(c),$w(s._writableStreamController),u}function xw(s){return d((u,c)=>{let m={_resolve:u,_reject:c};s._writeRequests.push(m)})}function no(s,i){if(s._state==="writable"){io(s,i);return}oo(s)}function io(s,i){let u=s._writableStreamController;s._state="erroring",s._storedError=i;let c=s._writer;c!==void 0&&ql(c,i),!Aw(s)&&u._started&&oo(s)}function oo(s){s._state="errored",s._writableStreamController[De]();let i=s._storedError;if(s._writeRequests.forEach(m=>{m._reject(i)}),s._writeRequests=new U,s._pendingAbortRequest===void 0){hn(s);return}let u=s._pendingAbortRequest;if(s._pendingAbortRequest=void 0,u._wasAlreadyErroring){u._reject(i),hn(s);return}let c=s._writableStreamController[z](u._reason);_(c,()=>(u._resolve(),hn(s),null),m=>(u._reject(m),hn(s),null))}function Cw(s){s._inFlightWriteRequest._resolve(void 0),s._inFlightWriteRequest=void 0}function kw(s,i){s._inFlightWriteRequest._reject(i),s._inFlightWriteRequest=void 0,no(s,i)}function Ew(s){s._inFlightCloseRequest._resolve(void 0),s._inFlightCloseRequest=void 0,s._state==="erroring"&&(s._storedError=void 0,s._pendingAbortRequest!==void 0&&(s._pendingAbortRequest._resolve(),s._pendingAbortRequest=void 0)),s._state="closed";let u=s._writer;u!==void 0&&Nl(u)}function Pw(s,i){s._inFlightCloseRequest._reject(i),s._inFlightCloseRequest=void 0,s._pendingAbortRequest!==void 0&&(s._pendingAbortRequest._reject(i),s._pendingAbortRequest=void 0),no(s,i)}function st(s){return!(s._closeRequest===void 0&&s._inFlightCloseRequest===void 0)}function Aw(s){return!(s._inFlightWriteRequest===void 0&&s._inFlightCloseRequest===void 0)}function Ow(s){s._inFlightCloseRequest=s._closeRequest,s._closeRequest=void 0}function Iw(s){s._inFlightWriteRequest=s._writeRequests.shift()}function hn(s){s._closeRequest!==void 0&&(s._closeRequest._reject(s._storedError),s._closeRequest=void 0);let i=s._writer;i!==void 0&&ho(i,s._storedError)}function ao(s,i){let u=s._writer;u!==void 0&&i!==s._backpressure&&(i?Hw(u):mo(u)),s._backpressure=i}class pt{constructor(i){if(Ve(i,1,"WritableStreamDefaultWriter"),El(i,"First parameter"),Sr(i))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=i,i._writer=this;let u=i._state;if(u==="writable")!st(i)&&i._backpressure?gn(this):Ul(this),pn(this);else if(u==="erroring")fo(this,i._storedError),pn(this);else if(u==="closed")Ul(this),Ww(this);else{let c=i._storedError;fo(this,c),Ll(this,c)}}get closed(){return tr(this)?this._closedPromise:p(rr("closed"))}get desiredSize(){if(!tr(this))throw rr("desiredSize");if(this._ownerWritableStream===void 0)throw hs("desiredSize");return Fw(this)}get ready(){return tr(this)?this._readyPromise:p(rr("ready"))}abort(i=void 0){return tr(this)?this._ownerWritableStream===void 0?p(hs("abort")):qw(this,i):p(rr("abort"))}close(){if(!tr(this))return p(rr("close"));let i=this._ownerWritableStream;return i===void 0?p(hs("close")):st(i)?p(new TypeError("Cannot close an already-closing stream")):Il(this)}releaseLock(){if(!tr(this))throw rr("releaseLock");this._ownerWritableStream!==void 0&&Ml(this)}write(i=void 0){return tr(this)?this._ownerWritableStream===void 0?p(hs("write to")):Dl(this,i):p(rr("write"))}}Object.defineProperties(pt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),o(pt.prototype.abort,"abort"),o(pt.prototype.close,"close"),o(pt.prototype.releaseLock,"releaseLock"),o(pt.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(pt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function tr(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_ownerWritableStream")?!1:s instanceof pt}function qw(s,i){let u=s._ownerWritableStream;return cn(u,i)}function Il(s){let i=s._ownerWritableStream;return Ol(i)}function Mw(s){let i=s._ownerWritableStream,u=i._state;return st(i)||u==="closed"?f(void 0):u==="errored"?p(i._storedError):Il(s)}function Dw(s,i){s._closedPromiseState==="pending"?ho(s,i):zw(s,i)}function ql(s,i){s._readyPromiseState==="pending"?Wl(s,i):Gw(s,i)}function Fw(s){let i=s._ownerWritableStream,u=i._state;return u==="errored"||u==="erroring"?null:u==="closed"?0:$l(i._writableStreamController)}function Ml(s){let i=s._ownerWritableStream,u=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");ql(s,u),Dw(s,u),i._writer=void 0,s._ownerWritableStream=void 0}function Dl(s,i){let u=s._ownerWritableStream,c=u._writableStreamController,m=jw(c,i);if(u!==s._ownerWritableStream)return p(hs("write to"));let g=u._state;if(g==="errored")return p(u._storedError);if(st(u)||g==="closed")return p(new TypeError("The stream is closing or closed and cannot be written to"));if(g==="erroring")return p(u._storedError);let b=xw(u);return Lw(c,i,m),b}let Fl={};class Tr{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!uo(this))throw co("abortReason");return this._abortReason}get signal(){if(!uo(this))throw co("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(i=void 0){if(!uo(this))throw co("error");this._controlledWritableStream._state==="writable"&&jl(this,i)}[z](i){let u=this._abortAlgorithm(i);return dn(this),u}[De](){Dt(this)}}Object.defineProperties(Tr.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Tr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function uo(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_controlledWritableStream")?!1:s instanceof Tr}function Bl(s,i,u,c,m,g,b,x){i._controlledWritableStream=s,s._writableStreamController=i,i._queue=void 0,i._queueTotalSize=void 0,Dt(i),i._abortReason=void 0,i._abortController=Tw(),i._started=!1,i._strategySizeAlgorithm=x,i._strategyHWM=b,i._writeAlgorithm=c,i._closeAlgorithm=m,i._abortAlgorithm=g;let I=lo(i);ao(s,I);let P=u(),F=f(P);_(F,()=>(i._started=!0,fn(i),null),$=>(i._started=!0,no(s,$),null))}function Bw(s,i,u,c){let m=Object.create(Tr.prototype),g,b,x,I;i.start!==void 0?g=()=>i.start(m):g=()=>{},i.write!==void 0?b=P=>i.write(P,m):b=()=>f(void 0),i.close!==void 0?x=()=>i.close():x=()=>f(void 0),i.abort!==void 0?I=P=>i.abort(P):I=()=>f(void 0),Bl(s,m,g,b,x,I,u,c)}function dn(s){s._writeAlgorithm=void 0,s._closeAlgorithm=void 0,s._abortAlgorithm=void 0,s._strategySizeAlgorithm=void 0}function $w(s){Ji(s,Fl,0),fn(s)}function jw(s,i){try{return s._strategySizeAlgorithm(i)}catch(u){return cs(s,u),1}}function $l(s){return s._strategyHWM-s._queueTotalSize}function Lw(s,i,u){try{Ji(s,i,u)}catch(m){cs(s,m);return}let c=s._controlledWritableStream;if(!st(c)&&c._state==="writable"){let m=lo(s);ao(c,m)}fn(s)}function fn(s){let i=s._controlledWritableStream;if(!s._started||i._inFlightWriteRequest!==void 0)return;if(i._state==="erroring"){oo(i);return}if(s._queue.length===0)return;let c=ew(s);c===Fl?Nw(s):Uw(s,c)}function cs(s,i){s._controlledWritableStream._state==="writable"&&jl(s,i)}function Nw(s){let i=s._controlledWritableStream;Ow(i),Qi(s);let u=s._closeAlgorithm();dn(s),_(u,()=>(Ew(i),null),c=>(Pw(i,c),null))}function Uw(s,i){let u=s._controlledWritableStream;Iw(u);let c=s._writeAlgorithm(i);_(c,()=>{Cw(u);let m=u._state;if(Qi(s),!st(u)&&m==="writable"){let g=lo(s);ao(u,g)}return fn(s),null},m=>(u._state==="writable"&&dn(s),kw(u,m),null))}function lo(s){return $l(s)<=0}function jl(s,i){let u=s._controlledWritableStream;dn(s),io(u,i)}function mn(s){return new TypeError(`WritableStream.prototype.${s} can only be used on a WritableStream`)}function co(s){return new TypeError(`WritableStreamDefaultController.prototype.${s} can only be used on a WritableStreamDefaultController`)}function rr(s){return new TypeError(`WritableStreamDefaultWriter.prototype.${s} can only be used on a WritableStreamDefaultWriter`)}function hs(s){return new TypeError("Cannot "+s+" a stream using a released writer")}function pn(s){s._closedPromise=d((i,u)=>{s._closedPromise_resolve=i,s._closedPromise_reject=u,s._closedPromiseState="pending"})}function Ll(s,i){pn(s),ho(s,i)}function Ww(s){pn(s),Nl(s)}function ho(s,i){s._closedPromise_reject!==void 0&&(k(s._closedPromise),s._closedPromise_reject(i),s._closedPromise_resolve=void 0,s._closedPromise_reject=void 0,s._closedPromiseState="rejected")}function zw(s,i){Ll(s,i)}function Nl(s){s._closedPromise_resolve!==void 0&&(s._closedPromise_resolve(void 0),s._closedPromise_resolve=void 0,s._closedPromise_reject=void 0,s._closedPromiseState="resolved")}function gn(s){s._readyPromise=d((i,u)=>{s._readyPromise_resolve=i,s._readyPromise_reject=u}),s._readyPromiseState="pending"}function fo(s,i){gn(s),Wl(s,i)}function Ul(s){gn(s),mo(s)}function Wl(s,i){s._readyPromise_reject!==void 0&&(k(s._readyPromise),s._readyPromise_reject(i),s._readyPromise_resolve=void 0,s._readyPromise_reject=void 0,s._readyPromiseState="rejected")}function Hw(s){gn(s)}function Gw(s,i){fo(s,i)}function mo(s){s._readyPromise_resolve!==void 0&&(s._readyPromise_resolve(void 0),s._readyPromise_resolve=void 0,s._readyPromise_reject=void 0,s._readyPromiseState="fulfilled")}function Vw(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof global<"u")return global}let po=Vw();function Yw(s){if(!(typeof s=="function"||typeof s=="object")||s.name!=="DOMException")return!1;try{return new s,!0}catch{return!1}}function Qw(){let s=po?.DOMException;return Yw(s)?s:void 0}function Jw(){let s=function(u,c){this.message=u||"",this.name=c||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return o(s,"DOMException"),s.prototype=Object.create(Error.prototype),Object.defineProperty(s.prototype,"constructor",{value:s,writable:!0,configurable:!0}),s}let Kw=Qw()||Jw();function zl(s,i,u,c,m,g){let b=v(s),x=Pl(i);s._disturbed=!0;let I=!1,P=f(void 0);return d((F,$)=>{let G;if(g!==void 0){if(G=()=>{let O=g.reason!==void 0?g.reason:new Kw("Aborted","AbortError"),N=[];c||N.push(()=>i._state==="writable"?cn(i,O):f(void 0)),m||N.push(()=>s._state==="readable"?Qe(s,O):f(void 0)),ge(()=>Promise.all(N.map(V=>V())),!0,O)},g.aborted){G();return}g.addEventListener("abort",G)}function Je(){return d((O,N)=>{function V(ke){ke?O():w(kr(),V,N)}V(!1)})}function kr(){return I?f(!0):w(x._readyPromise,()=>d((O,N)=>{is(b,{_chunkSteps:V=>{P=w(Dl(x,V),void 0,e),O(!1)},_closeSteps:()=>O(!0),_errorSteps:N})}))}if(bt(s,b._closedPromise,O=>(c?Le(!0,O):ge(()=>cn(i,O),!0,O),null)),bt(i,x._closedPromise,O=>(m?Le(!0,O):ge(()=>Qe(s,O),!0,O),null)),he(s,b._closedPromise,()=>(u?Le():ge(()=>Mw(x)),null)),st(i)||i._state==="closed"){let O=new TypeError("the destination writable stream closed before all data could be piped to it");m?Le(!0,O):ge(()=>Qe(s,O),!0,O)}k(Je());function Nt(){let O=P;return w(P,()=>O!==P?Nt():void 0)}function bt(O,N,V){O._state==="errored"?V(O._storedError):y(N,V)}function he(O,N,V){O._state==="closed"?V():T(N,V)}function ge(O,N,V){if(I)return;I=!0,i._state==="writable"&&!st(i)?T(Nt(),ke):ke();function ke(){return _(O(),()=>yt(N,V),Er=>yt(!0,Er)),null}}function Le(O,N){I||(I=!0,i._state==="writable"&&!st(i)?T(Nt(),()=>yt(O,N)):yt(O,N))}function yt(O,N){return Ml(x),Ge(b),g!==void 0&&g.removeEventListener("abort",G),O?$(N):F(void 0),null}})}class gt{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!bn(this))throw wn("desiredSize");return go(this)}close(){if(!bn(this))throw wn("close");if(!xr(this))throw new TypeError("The stream is not in a state that permits close");sr(this)}enqueue(i=void 0){if(!bn(this))throw wn("enqueue");if(!xr(this))throw new TypeError("The stream is not in a state that permits enqueue");return Rr(this,i)}error(i=void 0){if(!bn(this))throw wn("error");Ye(this,i)}[rt](i){Dt(this);let u=this._cancelAlgorithm(i);return yn(this),u}[Jt](i){let u=this._controlledReadableStream;if(this._queue.length>0){let c=Qi(this);this._closeRequested&&this._queue.length===0?(yn(this),ms(u)):ds(this),i._chunkSteps(c)}else C(u,i),ds(this)}[Xr](){}}Object.defineProperties(gt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),o(gt.prototype.close,"close"),o(gt.prototype.enqueue,"enqueue"),o(gt.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(gt.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function bn(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_controlledReadableStream")?!1:s instanceof gt}function ds(s){if(!Hl(s))return;if(s._pulling){s._pullAgain=!0;return}s._pulling=!0;let u=s._pullAlgorithm();_(u,()=>(s._pulling=!1,s._pullAgain&&(s._pullAgain=!1,ds(s)),null),c=>(Ye(s,c),null))}function Hl(s){let i=s._controlledReadableStream;return!xr(s)||!s._started?!1:!!(jt(i)&&ne(i)>0||go(s)>0)}function yn(s){s._pullAlgorithm=void 0,s._cancelAlgorithm=void 0,s._strategySizeAlgorithm=void 0}function sr(s){if(!xr(s))return;let i=s._controlledReadableStream;s._closeRequested=!0,s._queue.length===0&&(yn(s),ms(i))}function Rr(s,i){if(!xr(s))return;let u=s._controlledReadableStream;if(jt(u)&&ne(u)>0)W(u,i,!1);else{let c;try{c=s._strategySizeAlgorithm(i)}catch(m){throw Ye(s,m),m}try{Ji(s,i,c)}catch(m){throw Ye(s,m),m}}ds(s)}function Ye(s,i){let u=s._controlledReadableStream;u._state==="readable"&&(Dt(s),yn(s),Ql(u,i))}function go(s){let i=s._controlledReadableStream._state;return i==="errored"?null:i==="closed"?0:s._strategyHWM-s._queueTotalSize}function Zw(s){return!Hl(s)}function xr(s){let i=s._controlledReadableStream._state;return!s._closeRequested&&i==="readable"}function Gl(s,i,u,c,m,g,b){i._controlledReadableStream=s,i._queue=void 0,i._queueTotalSize=void 0,Dt(i),i._started=!1,i._closeRequested=!1,i._pullAgain=!1,i._pulling=!1,i._strategySizeAlgorithm=b,i._strategyHWM=g,i._pullAlgorithm=c,i._cancelAlgorithm=m,s._readableStreamController=i;let x=u();_(f(x),()=>(i._started=!0,ds(i),null),I=>(Ye(i,I),null))}function Xw(s,i,u,c){let m=Object.create(gt.prototype),g,b,x;i.start!==void 0?g=()=>i.start(m):g=()=>{},i.pull!==void 0?b=()=>i.pull(m):b=()=>f(void 0),i.cancel!==void 0?x=I=>i.cancel(I):x=()=>f(void 0),Gl(s,m,g,b,x,u,c)}function wn(s){return new TypeError(`ReadableStreamDefaultController.prototype.${s} can only be used on a ReadableStreamDefaultController`)}function e_(s,i){return Zt(s._readableStreamController)?r_(s):t_(s)}function t_(s,i){let u=v(s),c=!1,m=!1,g=!1,b=!1,x,I,P,F,$,G=d(he=>{$=he});function Je(){return c?(m=!0,f(void 0)):(c=!0,is(u,{_chunkSteps:ge=>{E(()=>{m=!1;let Le=ge,yt=ge;g||Rr(P._readableStreamController,Le),b||Rr(F._readableStreamController,yt),c=!1,m&&Je()})},_closeSteps:()=>{c=!1,g||sr(P._readableStreamController),b||sr(F._readableStreamController),(!g||!b)&&$(void 0)},_errorSteps:()=>{c=!1}}),f(void 0))}function kr(he){if(g=!0,x=he,b){let ge=os([x,I]),Le=Qe(s,ge);$(Le)}return G}function Nt(he){if(b=!0,I=he,g){let ge=os([x,I]),Le=Qe(s,ge);$(Le)}return G}function bt(){}return P=fs(bt,Je,kr),F=fs(bt,Je,Nt),y(u._closedPromise,he=>(Ye(P._readableStreamController,he),Ye(F._readableStreamController,he),(!g||!b)&&$(void 0),null)),[P,F]}function r_(s){let i=v(s),u=!1,c=!1,m=!1,g=!1,b=!1,x,I,P,F,$,G=d(O=>{$=O});function Je(O){y(O._closedPromise,N=>(O!==i||(je(P._readableStreamController,N),je(F._readableStreamController,N),(!g||!b)&&$(void 0)),null))}function kr(){er(i)&&(Ge(i),i=v(s),Je(i)),is(i,{_chunkSteps:N=>{E(()=>{c=!1,m=!1;let V=N,ke=N;if(!g&&!b)try{ke=cl(N)}catch(Er){je(P._readableStreamController,Er),je(F._readableStreamController,Er),$(Qe(s,Er));return}g||sn(P._readableStreamController,V),b||sn(F._readableStreamController,ke),u=!1,c?bt():m&&he()})},_closeSteps:()=>{u=!1,g||as(P._readableStreamController),b||as(F._readableStreamController),P._readableStreamController._pendingPullIntos.length>0&&nn(P._readableStreamController,0),F._readableStreamController._pendingPullIntos.length>0&&nn(F._readableStreamController,0),(!g||!b)&&$(void 0)},_errorSteps:()=>{u=!1}})}function Nt(O,N){qt(i)&&(Ge(i),i=Tl(s),Je(i));let V=N?F:P,ke=N?P:F;Cl(i,O,1,{_chunkSteps:Pr=>{E(()=>{c=!1,m=!1;let Ar=N?b:g;if(N?g:b)Ar||on(V._readableStreamController,Pr);else{let uc;try{uc=cl(Pr)}catch(vo){je(V._readableStreamController,vo),je(ke._readableStreamController,vo),$(Qe(s,vo));return}Ar||on(V._readableStreamController,Pr),sn(ke._readableStreamController,uc)}u=!1,c?bt():m&&he()})},_closeSteps:Pr=>{u=!1;let Ar=N?b:g,kn=N?g:b;Ar||as(V._readableStreamController),kn||as(ke._readableStreamController),Pr!==void 0&&(Ar||on(V._readableStreamController,Pr),!kn&&ke._readableStreamController._pendingPullIntos.length>0&&nn(ke._readableStreamController,0)),(!Ar||!kn)&&$(void 0)},_errorSteps:()=>{u=!1}})}function bt(){if(u)return c=!0,f(void 0);u=!0;let O=to(P._readableStreamController);return O===null?kr():Nt(O._view,!1),f(void 0)}function he(){if(u)return m=!0,f(void 0);u=!0;let O=to(F._readableStreamController);return O===null?kr():Nt(O._view,!0),f(void 0)}function ge(O){if(g=!0,x=O,b){let N=os([x,I]),V=Qe(s,N);$(V)}return G}function Le(O){if(b=!0,I=O,g){let N=os([x,I]),V=Qe(s,N);$(V)}return G}function yt(){}return P=Yl(yt,bt,ge),F=Yl(yt,he,Le),Je(i),[P,F]}function s_(s){return r(s)&&typeof s.getReader<"u"}function n_(s){return s_(s)?o_(s.getReader()):i_(s)}function i_(s){let i,u=ll(s,"async"),c=e;function m(){let b;try{b=Jy(u)}catch(I){return p(I)}let x=f(b);return M(x,I=>{if(!r(I))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(Ky(I))sr(i._readableStreamController);else{let F=Zy(I);Rr(i._readableStreamController,F)}})}function g(b){let x=u.iterator,I;try{I=en(x,"return")}catch($){return p($)}if(I===void 0)return f(void 0);let P;try{P=L(I,x,[b])}catch($){return p($)}let F=f(P);return M(F,$=>{if(!r($))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return i=fs(c,m,g,0),i}function o_(s){let i,u=e;function c(){let g;try{g=s.read()}catch(b){return p(b)}return M(g,b=>{if(!r(b))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(b.done)sr(i._readableStreamController);else{let x=b.value;Rr(i._readableStreamController,x)}})}function m(g){try{return f(s.cancel(g))}catch(b){return p(b)}}return i=fs(u,c,m,0),i}function a_(s,i){Fe(s,i);let u=s,c=u?.autoAllocateChunkSize,m=u?.cancel,g=u?.pull,b=u?.start,x=u?.type;return{autoAllocateChunkSize:c===void 0?void 0:A(c,`${i} has member 'autoAllocateChunkSize' that`),cancel:m===void 0?void 0:u_(m,u,`${i} has member 'cancel' that`),pull:g===void 0?void 0:l_(g,u,`${i} has member 'pull' that`),start:b===void 0?void 0:c_(b,u,`${i} has member 'start' that`),type:x===void 0?void 0:h_(x,`${i} has member 'type' that`)}}function u_(s,i,u){return me(s,u),c=>K(s,i,[c])}function l_(s,i,u){return me(s,u),c=>K(s,i,[c])}function c_(s,i,u){return me(s,u),c=>L(s,i,[c])}function h_(s,i){if(s=`${s}`,s!=="bytes")throw new TypeError(`${i} '${s}' is not a valid enumeration value for ReadableStreamType`);return s}function d_(s,i){return Fe(s,i),{preventCancel:!!s?.preventCancel}}function Vl(s,i){Fe(s,i);let u=s?.preventAbort,c=s?.preventCancel,m=s?.preventClose,g=s?.signal;return g!==void 0&&f_(g,`${i} has member 'signal' that`),{preventAbort:!!u,preventCancel:!!c,preventClose:!!m,signal:g}}function f_(s,i){if(!vw(s))throw new TypeError(`${i} is not an AbortSignal.`)}function m_(s,i){Fe(s,i);let u=s?.readable;ss(u,"readable","ReadableWritablePair"),wr(u,`${i} has member 'readable' that`);let c=s?.writable;return ss(c,"writable","ReadableWritablePair"),El(c,`${i} has member 'writable' that`),{readable:u,writable:c}}class le{constructor(i={},u={}){i===void 0?i=null:Ks(i,"First parameter");let c=ln(u,"Second parameter"),m=a_(i,"First parameter");if(bo(this),m.type==="bytes"){if(c.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let g=ls(c,0);uw(this,m,g)}else{let g=un(c),b=ls(c,1);Xw(this,m,b,g)}}get locked(){if(!$t(this))throw nr("locked");return jt(this)}cancel(i=void 0){return $t(this)?jt(this)?p(new TypeError("Cannot cancel a stream that already has a reader")):Qe(this,i):p(nr("cancel"))}getReader(i=void 0){if(!$t(this))throw nr("getReader");return cw(i,"First parameter").mode===void 0?v(this):Tl(this)}pipeThrough(i,u={}){if(!$t(this))throw nr("pipeThrough");Ve(i,1,"pipeThrough");let c=m_(i,"First parameter"),m=Vl(u,"Second parameter");if(jt(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Sr(c.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let g=zl(this,c.writable,m.preventClose,m.preventAbort,m.preventCancel,m.signal);return k(g),c.readable}pipeTo(i,u={}){if(!$t(this))return p(nr("pipeTo"));if(i===void 0)return p("Parameter 1 is required in 'pipeTo'.");if(!vr(i))return p(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let c;try{c=Vl(u,"Second parameter")}catch(m){return p(m)}return jt(this)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Sr(i)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):zl(this,i,c.preventClose,c.preventAbort,c.preventCancel,c.signal)}tee(){if(!$t(this))throw nr("tee");let i=e_(this);return os(i)}values(i=void 0){if(!$t(this))throw nr("values");let u=d_(i,"First parameter");return Yy(this,u.preventCancel)}[Yi](i){return this.values(i)}static from(i){return n_(i)}}Object.defineProperties(le,{from:{enumerable:!0}}),Object.defineProperties(le.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),o(le.from,"from"),o(le.prototype.cancel,"cancel"),o(le.prototype.getReader,"getReader"),o(le.prototype.pipeThrough,"pipeThrough"),o(le.prototype.pipeTo,"pipeTo"),o(le.prototype.tee,"tee"),o(le.prototype.values,"values"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(le.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(le.prototype,Yi,{value:le.prototype.values,writable:!0,configurable:!0});function fs(s,i,u,c=1,m=()=>1){let g=Object.create(le.prototype);bo(g);let b=Object.create(gt.prototype);return Gl(g,b,s,i,u,c,m),g}function Yl(s,i,u){let c=Object.create(le.prototype);bo(c);let m=Object.create(mt.prototype);return Sl(c,m,s,i,u,0,void 0),c}function bo(s){s._state="readable",s._reader=void 0,s._storedError=void 0,s._disturbed=!1}function $t(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_readableStreamController")?!1:s instanceof le}function jt(s){return s._reader!==void 0}function Qe(s,i){if(s._disturbed=!0,s._state==="closed")return f(void 0);if(s._state==="errored")return p(s._storedError);ms(s);let u=s._reader;if(u!==void 0&&er(u)){let m=u._readIntoRequests;u._readIntoRequests=new U,m.forEach(g=>{g._closeSteps(void 0)})}let c=s._readableStreamController[rt](i);return M(c,e)}function ms(s){s._state="closed";let i=s._reader;if(i!==void 0&&(Qs(i),qt(i))){let u=i._readRequests;i._readRequests=new U,u.forEach(c=>{c._closeSteps()})}}function Ql(s,i){s._state="errored",s._storedError=i;let u=s._reader;u!==void 0&&(rs(u,i),qt(u)?tl(u,i):kl(u,i))}function nr(s){return new TypeError(`ReadableStream.prototype.${s} can only be used on a ReadableStream`)}function Jl(s,i){Fe(s,i);let u=s?.highWaterMark;return ss(u,"highWaterMark","QueuingStrategyInit"),{highWaterMark:ns(u)}}let Kl=s=>s.byteLength;o(Kl,"size");class _n{constructor(i){Ve(i,1,"ByteLengthQueuingStrategy"),i=Jl(i,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=i.highWaterMark}get highWaterMark(){if(!Xl(this))throw Zl("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Xl(this))throw Zl("size");return Kl}}Object.defineProperties(_n.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(_n.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Zl(s){return new TypeError(`ByteLengthQueuingStrategy.prototype.${s} can only be used on a ByteLengthQueuingStrategy`)}function Xl(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_byteLengthQueuingStrategyHighWaterMark")?!1:s instanceof _n}let ec=()=>1;o(ec,"size");class vn{constructor(i){Ve(i,1,"CountQueuingStrategy"),i=Jl(i,"First parameter"),this._countQueuingStrategyHighWaterMark=i.highWaterMark}get highWaterMark(){if(!rc(this))throw tc("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!rc(this))throw tc("size");return ec}}Object.defineProperties(vn.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(vn.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function tc(s){return new TypeError(`CountQueuingStrategy.prototype.${s} can only be used on a CountQueuingStrategy`)}function rc(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_countQueuingStrategyHighWaterMark")?!1:s instanceof vn}function p_(s,i){Fe(s,i);let u=s?.cancel,c=s?.flush,m=s?.readableType,g=s?.start,b=s?.transform,x=s?.writableType;return{cancel:u===void 0?void 0:w_(u,s,`${i} has member 'cancel' that`),flush:c===void 0?void 0:g_(c,s,`${i} has member 'flush' that`),readableType:m,start:g===void 0?void 0:b_(g,s,`${i} has member 'start' that`),transform:b===void 0?void 0:y_(b,s,`${i} has member 'transform' that`),writableType:x}}function g_(s,i,u){return me(s,u),c=>K(s,i,[c])}function b_(s,i,u){return me(s,u),c=>L(s,i,[c])}function y_(s,i,u){return me(s,u),(c,m)=>K(s,i,[c,m])}function w_(s,i,u){return me(s,u),c=>K(s,i,[c])}class Sn{constructor(i={},u={},c={}){i===void 0&&(i=null);let m=ln(u,"Second parameter"),g=ln(c,"Third parameter"),b=p_(i,"First parameter");if(b.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(b.writableType!==void 0)throw new RangeError("Invalid writableType specified");let x=ls(g,0),I=un(g),P=ls(m,1),F=un(m),$,G=d(Je=>{$=Je});__(this,G,P,F,x,I),S_(this,b),b.start!==void 0?$(b.start(this._transformStreamController)):$(void 0)}get readable(){if(!sc(this))throw ac("readable");return this._readable}get writable(){if(!sc(this))throw ac("writable");return this._writable}}Object.defineProperties(Sn.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Sn.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function __(s,i,u,c,m,g){function b(){return i}function x(G){return x_(s,G)}function I(G){return C_(s,G)}function P(){return k_(s)}s._writable=Rw(b,x,P,I,u,c);function F(){return E_(s)}function $(G){return P_(s,G)}s._readable=fs(b,F,$,m,g),s._backpressure=void 0,s._backpressureChangePromise=void 0,s._backpressureChangePromise_resolve=void 0,Tn(s,!0),s._transformStreamController=void 0}function sc(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_transformStreamController")?!1:s instanceof Sn}function nc(s,i){Ye(s._readable._readableStreamController,i),yo(s,i)}function yo(s,i){xn(s._transformStreamController),cs(s._writable._writableStreamController,i),wo(s)}function wo(s){s._backpressure&&Tn(s,!1)}function Tn(s,i){s._backpressureChangePromise!==void 0&&s._backpressureChangePromise_resolve(),s._backpressureChangePromise=d(u=>{s._backpressureChangePromise_resolve=u}),s._backpressure=i}class Lt{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Rn(this))throw Cn("desiredSize");let i=this._controlledTransformStream._readable._readableStreamController;return go(i)}enqueue(i=void 0){if(!Rn(this))throw Cn("enqueue");ic(this,i)}error(i=void 0){if(!Rn(this))throw Cn("error");T_(this,i)}terminate(){if(!Rn(this))throw Cn("terminate");R_(this)}}Object.defineProperties(Lt.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),o(Lt.prototype.enqueue,"enqueue"),o(Lt.prototype.error,"error"),o(Lt.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Lt.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function Rn(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_controlledTransformStream")?!1:s instanceof Lt}function v_(s,i,u,c,m){i._controlledTransformStream=s,s._transformStreamController=i,i._transformAlgorithm=u,i._flushAlgorithm=c,i._cancelAlgorithm=m,i._finishPromise=void 0,i._finishPromise_resolve=void 0,i._finishPromise_reject=void 0}function S_(s,i){let u=Object.create(Lt.prototype),c,m,g;i.transform!==void 0?c=b=>i.transform(b,u):c=b=>{try{return ic(u,b),f(void 0)}catch(x){return p(x)}},i.flush!==void 0?m=()=>i.flush(u):m=()=>f(void 0),i.cancel!==void 0?g=b=>i.cancel(b):g=()=>f(void 0),v_(s,u,c,m,g)}function xn(s){s._transformAlgorithm=void 0,s._flushAlgorithm=void 0,s._cancelAlgorithm=void 0}function ic(s,i){let u=s._controlledTransformStream,c=u._readable._readableStreamController;if(!xr(c))throw new TypeError("Readable side is not in a state that permits enqueue");try{Rr(c,i)}catch(g){throw yo(u,g),u._readable._storedError}Zw(c)!==u._backpressure&&Tn(u,!0)}function T_(s,i){nc(s._controlledTransformStream,i)}function oc(s,i){let u=s._transformAlgorithm(i);return M(u,void 0,c=>{throw nc(s._controlledTransformStream,c),c})}function R_(s){let i=s._controlledTransformStream,u=i._readable._readableStreamController;sr(u);let c=new TypeError("TransformStream terminated");yo(i,c)}function x_(s,i){let u=s._transformStreamController;if(s._backpressure){let c=s._backpressureChangePromise;return M(c,()=>{let m=s._writable;if(m._state==="erroring")throw m._storedError;return oc(u,i)})}return oc(u,i)}function C_(s,i){let u=s._transformStreamController;if(u._finishPromise!==void 0)return u._finishPromise;let c=s._readable;u._finishPromise=d((g,b)=>{u._finishPromise_resolve=g,u._finishPromise_reject=b});let m=u._cancelAlgorithm(i);return xn(u),_(m,()=>(c._state==="errored"?Cr(u,c._storedError):(Ye(c._readableStreamController,i),_o(u)),null),g=>(Ye(c._readableStreamController,g),Cr(u,g),null)),u._finishPromise}function k_(s){let i=s._transformStreamController;if(i._finishPromise!==void 0)return i._finishPromise;let u=s._readable;i._finishPromise=d((m,g)=>{i._finishPromise_resolve=m,i._finishPromise_reject=g});let c=i._flushAlgorithm();return xn(i),_(c,()=>(u._state==="errored"?Cr(i,u._storedError):(sr(u._readableStreamController),_o(i)),null),m=>(Ye(u._readableStreamController,m),Cr(i,m),null)),i._finishPromise}function E_(s){return Tn(s,!1),s._backpressureChangePromise}function P_(s,i){let u=s._transformStreamController;if(u._finishPromise!==void 0)return u._finishPromise;let c=s._writable;u._finishPromise=d((g,b)=>{u._finishPromise_resolve=g,u._finishPromise_reject=b});let m=u._cancelAlgorithm(i);return xn(u),_(m,()=>(c._state==="errored"?Cr(u,c._storedError):(cs(c._writableStreamController,i),wo(s),_o(u)),null),g=>(cs(c._writableStreamController,g),wo(s),Cr(u,g),null)),u._finishPromise}function Cn(s){return new TypeError(`TransformStreamDefaultController.prototype.${s} can only be used on a TransformStreamDefaultController`)}function _o(s){s._finishPromise_resolve!==void 0&&(s._finishPromise_resolve(),s._finishPromise_resolve=void 0,s._finishPromise_reject=void 0)}function Cr(s,i){s._finishPromise_reject!==void 0&&(k(s._finishPromise),s._finishPromise_reject(i),s._finishPromise_resolve=void 0,s._finishPromise_reject=void 0)}function ac(s){return new TypeError(`TransformStream.prototype.${s} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=_n,t.CountQueuingStrategy=vn,t.ReadableByteStreamController=mt,t.ReadableStream=le,t.ReadableStreamBYOBReader=Ft,t.ReadableStreamBYOBRequest=Kt,t.ReadableStreamDefaultController=gt,t.ReadableStreamDefaultReader=$e,t.TransformStream=Sn,t.TransformStreamDefaultController=Lt,t.WritableStream=Bt,t.WritableStreamDefaultController=Tr,t.WritableStreamDefaultWriter=pt}))});var Kg=S(()=>{"use strict";if(!globalThis.ReadableStream)try{let t=require("process"),{emitWarning:e}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,require("stream/web")),t.emitWarning=e}catch(r){throw t.emitWarning=e,r}}catch{Object.assign(globalThis,Jg())}try{let{Blob:t}=require("buffer");t&&!t.prototype.stream&&(t.prototype.stream=function(r){let n=0,o=this;return new ReadableStream({type:"bytes",async pull(a){let h=await o.slice(n,Math.min(o.size,n+65536)).arrayBuffer();n+=h.byteLength,a.enqueue(new Uint8Array(h)),n===o.size&&a.close()}})})}catch{}});async function*Iu(t,e=!0){for(let r of t)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(e){let n=r.byteOffset,o=r.byteOffset+r.byteLength;for(;n!==o;){let a=Math.min(o-n,Zg),l=r.buffer.slice(n,n+a);n+=l.byteLength,yield new Uint8Array(l)}}else yield r;else{let n=0,o=r;for(;n!==o.size;){let l=await o.slice(n,Math.min(o.size,n+Zg)).arrayBuffer();n+=l.byteLength,yield new Uint8Array(l)}}}var jA,Zg,Xg,IC,Pt,Fs=ps(()=>{"use strict";jA=B(Kg(),1);Zg=65536;Xg=class qu{#e=[];#t="";#r=0;#s="transparent";constructor(e=[],r={}){if(typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof e[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&typeof r!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");r===null&&(r={});let n=new TextEncoder;for(let a of e){let l;ArrayBuffer.isView(a)?l=new Uint8Array(a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)):a instanceof ArrayBuffer?l=new Uint8Array(a.slice(0)):a instanceof qu?l=a:l=n.encode(`${a}`),this.#r+=ArrayBuffer.isView(l)?l.byteLength:l.size,this.#e.push(l)}this.#s=`${r.endings===void 0?"transparent":r.endings}`;let o=r.type===void 0?"":String(r.type);this.#t=/^[\x20-\x7E]*$/.test(o)?o:""}get size(){return this.#r}get type(){return this.#t}async text(){let e=new TextDecoder,r="";for await(let n of Iu(this.#e,!1))r+=e.decode(n,{stream:!0});return r+=e.decode(),r}async arrayBuffer(){let e=new Uint8Array(this.size),r=0;for await(let n of Iu(this.#e,!1))e.set(n,r),r+=n.length;return e.buffer}stream(){let e=Iu(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let n=await e.next();n.done?r.close():r.enqueue(n.value)},async cancel(){await e.return()}})}slice(e=0,r=this.size,n=""){let{size:o}=this,a=e<0?Math.max(o+e,0):Math.min(e,o),l=r<0?Math.max(o+r,0):Math.min(r,o),h=Math.max(l-a,0),d=this.#e,f=[],p=0;for(let _ of d){if(p>=h)break;let T=ArrayBuffer.isView(_)?_.byteLength:_.size;if(a&&T<=a)a-=T,l-=T;else{let y;ArrayBuffer.isView(_)?(y=_.subarray(a,Math.min(T,l)),p+=y.byteLength):(y=_.slice(a,Math.min(T,l)),p+=y.size),l-=T,f.push(y),a=0}}let w=new qu([],{type:String(n).toLowerCase()});return w.#r=h,w.#e=f,w}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&typeof e=="object"&&typeof e.constructor=="function"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}};Object.defineProperties(Xg.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});IC=Xg,Pt=IC});var qC,MC,Gr,Mu=ps(()=>{"use strict";Fs();qC=class extends Pt{#e=0;#t="";constructor(e,r,n={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(e,n),n===null&&(n={});let o=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(o)||(this.#e=o),this.#t=String(r)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](e){return!!e&&e instanceof Pt&&/^(File)$/.test(e[Symbol.toStringTag])}},MC=qC,Gr=MC});function rb(t,e=Pt){var r=`${eb()}${eb()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),n=[],o=`--${r}\r
103
- Content-Disposition: form-data; name="`;return t.forEach((a,l)=>typeof a=="string"?n.push(o+Du(l)+`"\r
100
+ `+u),t.push(o+"m+"+Un.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=$S()+e+" "+t[0]}function $S(){return oe.inspectOpts.hideDate?"":new Date().toISOString()+" "}function jS(...t){return process.stderr.write(Nn.formatWithOptions(oe.inspectOpts,...t)+`
101
+ `)}function LS(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function NS(){return process.env.DEBUG}function US(t){t.inspectOpts={};let e=Object.keys(oe.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=oe.inspectOpts[e[r]]}Un.exports=_a()(oe);var{formatters:Rf}=Un.exports;Rf.o=function(t){return this.inspectOpts.colors=this.useColors,Nn.inspect(t,this.inspectOpts).split(`
102
+ `).map(e=>e.trim()).join(" ")};Rf.O=function(t){return this.inspectOpts.colors=this.useColors,Nn.inspect(t,this.inspectOpts)}});var Sa=S((Kk,va)=>{"use strict";typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?va.exports=_f():va.exports=Cf()});var xf=S(xe=>{"use strict";var WS=xe&&xe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xe,"__esModule",{value:!0});var zS=require("fs"),HS=WS(Sa()),Mr=HS.default("@kwsites/file-exists");function GS(t,e,r){Mr("checking %s",t);try{let n=zS.statSync(t);return n.isFile()&&e?(Mr("[OK] path represents a file"),!0):n.isDirectory()&&r?(Mr("[OK] path represents a directory"),!0):(Mr("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return Mr("[FAIL] path is not accessible: %o",n),!1;throw Mr("[FATAL] %o",n),n}}function VS(t,e=xe.READABLE){return GS(t,(e&xe.FILE)>0,(e&xe.FOLDER)>0)}xe.exists=VS;xe.FILE=1;xe.FOLDER=2;xe.READABLE=xe.FILE+xe.FOLDER});var kf=S(Wn=>{"use strict";function YS(t){for(var e in t)Wn.hasOwnProperty(e)||(Wn[e]=t[e])}Object.defineProperty(Wn,"__esModule",{value:!0});YS(xf())});var Ca=S(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.createDeferred=rr.deferred=void 0;function Ra(){let t,e,r="pending";return{promise:new Promise((o,u)=>{t=o,e=u}),done(o){r==="pending"&&(r="resolved",t(o))},fail(o){r==="pending"&&(r="rejected",e(o))},get fulfilled(){return r!=="pending"},get status(){return r}}}rr.deferred=Ra;rr.createDeferred=Ra;rr.default=Ra});var Ig=S((di,Og)=>{"use strict";(function(t,e){typeof di=="object"&&typeof Og<"u"?e(di):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(di,(function(t){"use strict";function e(){}function r(s){return typeof s=="object"&&s!==null||typeof s=="function"}let n=e;function o(s,i){try{Object.defineProperty(s,"name",{value:i,configurable:!0})}catch{}}let u=Promise,l=Promise.prototype.then,h=Promise.reject.bind(u);function d(s){return new u(s)}function m(s){return d(i=>i(s))}function p(s){return h(s)}function w(s,i,a){return l.call(s,i,a)}function _(s,i,a){w(w(s,i,a),void 0,n)}function R(s,i){_(s,i)}function y(s,i){_(s,void 0,i)}function D(s,i,a){return w(s,i,a)}function k(s){w(s,void 0,n)}let P=s=>{if(typeof queueMicrotask=="function")P=queueMicrotask;else{let i=m(void 0);P=a=>w(i,a)}return P(s)};function j(s,i,a){if(typeof s!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(s,i,a)}function J(s,i,a){try{return m(j(s,i,a))}catch(c){return p(c)}}let $=16384;class N{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(i){let a=this._back,c=a;a._elements.length===$-1&&(c={_elements:[],_next:void 0}),a._elements.push(i),c!==a&&(this._back=c,a._next=c),++this._size}shift(){let i=this._front,a=i,c=this._cursor,f=c+1,g=i._elements,b=g[c];return f===$&&(a=i._next,f=0),--this._size,this._cursor=f,i!==a&&(this._front=a),g[c]=void 0,b}forEach(i){let a=this._cursor,c=this._front,f=c._elements;for(;(a!==f.length||c._next!==void 0)&&!(a===f.length&&(c=c._next,f=c._elements,a=0,f.length===0));)i(f[a]),++a}peek(){let i=this._front,a=this._cursor;return i._elements[a]}}let U=Symbol("[[AbortSteps]]"),Oe=Symbol("[[ErrorSteps]]"),Ke=Symbol("[[CancelSteps]]"),Wt=Symbol("[[PullSteps]]"),Qr=Symbol("[[ReleaseSteps]]");function js(s,i){s._ownerReadableStream=i,i._reader=s,i._state==="readable"?Kr(s):i._state==="closed"?Ri(s):Ls(s,i._storedError)}function Jr(s,i){let a=s._ownerReadableStream;return He(a,i)}function Ue(s){let i=s._ownerReadableStream;i._state==="readable"?Zr(s,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):Ci(s,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),i._readableStreamController[Qr](),i._reader=void 0,s._ownerReadableStream=void 0}function pr(s){return new TypeError("Cannot "+s+" a stream using a released reader")}function Kr(s){s._closedPromise=d((i,a)=>{s._closedPromise_resolve=i,s._closedPromise_reject=a})}function Ls(s,i){Kr(s),Zr(s,i)}function Ri(s){Kr(s),Ns(s)}function Zr(s,i){s._closedPromise_reject!==void 0&&(k(s._closedPromise),s._closedPromise_reject(i),s._closedPromise_resolve=void 0,s._closedPromise_reject=void 0)}function Ci(s,i){Ls(s,i)}function Ns(s){s._closedPromise_resolve!==void 0&&(s._closedPromise_resolve(void 0),s._closedPromise_resolve=void 0,s._closedPromise_reject=void 0)}let Us=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},xi=Math.trunc||function(s){return s<0?Math.ceil(s):Math.floor(s)};function ki(s){return typeof s=="object"||typeof s=="function"}function Ie(s,i){if(s!==void 0&&!ki(s))throw new TypeError(`${i} is not an object.`)}function me(s,i){if(typeof s!="function")throw new TypeError(`${i} is not a function.`)}function Pi(s){return typeof s=="object"&&s!==null||typeof s=="function"}function Ws(s,i){if(!Pi(s))throw new TypeError(`${i} is not an object.`)}function We(s,i,a){if(s===void 0)throw new TypeError(`Parameter ${i} is required in '${a}'.`)}function Xr(s,i,a){if(s===void 0)throw new TypeError(`${i} is required in '${a}'.`)}function pe(s){return Number(s)}function O(s){return s===0?0:s}function v(s){return O(xi(s))}function x(s,i){let c=Number.MAX_SAFE_INTEGER,f=Number(s);if(f=O(f),!Us(f))throw new TypeError(`${i} is not a finite number`);if(f=v(f),f<0||f>c)throw new TypeError(`${i} is outside the accepted range of 0 to ${c}, inclusive`);return!Us(f)||f===0?0:f}function W(s,i){if(!It(s))throw new TypeError(`${i} is not a ReadableStream.`)}function se(s){return new xt(s)}function ge(s,i){s._reader._readRequests.push(i)}function zt(s,i,a){let f=s._reader._readRequests.shift();a?f._closeSteps():f._chunkSteps(i)}function zs(s){return s._reader._readRequests.length}function Eu(s){let i=s._reader;return!(i===void 0||!kt(i))}class xt{constructor(i){if(We(i,1,"ReadableStreamDefaultReader"),W(i,"First parameter"),qt(i))throw new TypeError("This stream has already been locked for exclusive reading by another reader");js(this,i),this._readRequests=new N}get closed(){return kt(this)?this._closedPromise:p(Hs("closed"))}cancel(i=void 0){return kt(this)?this._ownerReadableStream===void 0?p(pr("cancel")):Jr(this,i):p(Hs("cancel"))}read(){if(!kt(this))return p(Hs("read"));if(this._ownerReadableStream===void 0)return p(pr("read from"));let i,a,c=d((g,b)=>{i=g,a=b});return es(this,{_chunkSteps:g=>i({value:g,done:!1}),_closeSteps:()=>i({value:void 0,done:!0}),_errorSteps:g=>a(g)}),c}releaseLock(){if(!kt(this))throw Hs("releaseLock");this._ownerReadableStream!==void 0&&Tb(this)}}Object.defineProperties(xt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),o(xt.prototype.cancel,"cancel"),o(xt.prototype.read,"read"),o(xt.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(xt.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function kt(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_readRequests")?!1:s instanceof xt}function es(s,i){let a=s._ownerReadableStream;a._disturbed=!0,a._state==="closed"?i._closeSteps():a._state==="errored"?i._errorSteps(a._storedError):a._readableStreamController[Wt](i)}function Tb(s){Ue(s);let i=new TypeError("Reader was released");Au(s,i)}function Au(s,i){let a=s._readRequests;s._readRequests=new N,a.forEach(c=>{c._errorSteps(i)})}function Hs(s){return new TypeError(`ReadableStreamDefaultReader.prototype.${s} can only be used on a ReadableStreamDefaultReader`)}let Rb=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class Ou{constructor(i,a){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=i,this._preventCancel=a}next(){let i=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?D(this._ongoingPromise,i,i):i(),this._ongoingPromise}return(i){let a=()=>this._returnSteps(i);return this._ongoingPromise?D(this._ongoingPromise,a,a):a()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let i=this._reader,a,c,f=d((b,C)=>{a=b,c=C});return es(i,{_chunkSteps:b=>{this._ongoingPromise=void 0,P(()=>a({value:b,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Ue(i),a({value:void 0,done:!0})},_errorSteps:b=>{this._ongoingPromise=void 0,this._isFinished=!0,Ue(i),c(b)}}),f}_returnSteps(i){if(this._isFinished)return Promise.resolve({value:i,done:!0});this._isFinished=!0;let a=this._reader;if(!this._preventCancel){let c=Jr(a,i);return Ue(a),D(c,()=>({value:i,done:!0}))}return Ue(a),m({value:i,done:!0})}}let Iu={next(){return qu(this)?this._asyncIteratorImpl.next():p(Du("next"))},return(s){return qu(this)?this._asyncIteratorImpl.return(s):p(Du("return"))}};Object.setPrototypeOf(Iu,Rb);function Cb(s,i){let a=se(s),c=new Ou(a,i),f=Object.create(Iu);return f._asyncIteratorImpl=c,f}function qu(s){if(!r(s)||!Object.prototype.hasOwnProperty.call(s,"_asyncIteratorImpl"))return!1;try{return s._asyncIteratorImpl instanceof Ou}catch{return!1}}function Du(s){return new TypeError(`ReadableStreamAsyncIterator.${s} can only be used on a ReadableSteamAsyncIterator`)}let Mu=Number.isNaN||function(s){return s!==s};var Ei,Ai,Oi;function ts(s){return s.slice()}function Bu(s,i,a,c,f){new Uint8Array(s).set(new Uint8Array(a,c,f),i)}let ut=s=>(typeof s.transfer=="function"?ut=i=>i.transfer():typeof structuredClone=="function"?ut=i=>structuredClone(i,{transfer:[i]}):ut=i=>i,ut(s)),Pt=s=>(typeof s.detached=="boolean"?Pt=i=>i.detached:Pt=i=>i.byteLength===0,Pt(s));function Fu(s,i,a){if(s.slice)return s.slice(i,a);let c=a-i,f=new ArrayBuffer(c);return Bu(f,0,s,i,c),f}function Gs(s,i){let a=s[i];if(a!=null){if(typeof a!="function")throw new TypeError(`${String(i)} is not a function`);return a}}function xb(s){let i={[Symbol.iterator]:()=>s.iterator},a=(async function*(){return yield*i})(),c=a.next;return{iterator:a,nextMethod:c,done:!1}}let Ii=(Oi=(Ei=Symbol.asyncIterator)!==null&&Ei!==void 0?Ei:(Ai=Symbol.for)===null||Ai===void 0?void 0:Ai.call(Symbol,"Symbol.asyncIterator"))!==null&&Oi!==void 0?Oi:"@@asyncIterator";function $u(s,i="sync",a){if(a===void 0)if(i==="async"){if(a=Gs(s,Ii),a===void 0){let g=Gs(s,Symbol.iterator),b=$u(s,"sync",g);return xb(b)}}else a=Gs(s,Symbol.iterator);if(a===void 0)throw new TypeError("The object is not iterable");let c=j(a,s,[]);if(!r(c))throw new TypeError("The iterator method must return an object");let f=c.next;return{iterator:c,nextMethod:f,done:!1}}function kb(s){let i=j(s.nextMethod,s.iterator,[]);if(!r(i))throw new TypeError("The iterator.next() method must return an object");return i}function Pb(s){return!!s.done}function Eb(s){return s.value}function Ab(s){return!(typeof s!="number"||Mu(s)||s<0)}function ju(s){let i=Fu(s.buffer,s.byteOffset,s.byteOffset+s.byteLength);return new Uint8Array(i)}function qi(s){let i=s._queue.shift();return s._queueTotalSize-=i.size,s._queueTotalSize<0&&(s._queueTotalSize=0),i.value}function Di(s,i,a){if(!Ab(a)||a===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");s._queue.push({value:i,size:a}),s._queueTotalSize+=a}function Ob(s){return s._queue.peek().value}function Et(s){s._queue=new N,s._queueTotalSize=0}function Lu(s){return s===DataView}function Ib(s){return Lu(s.constructor)}function qb(s){return Lu(s)?1:s.BYTES_PER_ELEMENT}class Ht{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Mi(this))throw Li("view");return this._view}respond(i){if(!Mi(this))throw Li("respond");if(We(i,1,"respond"),i=x(i,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(Pt(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Js(this._associatedReadableByteStreamController,i)}respondWithNewView(i){if(!Mi(this))throw Li("respondWithNewView");if(We(i,1,"respondWithNewView"),!ArrayBuffer.isView(i))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(Pt(i.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Ks(this._associatedReadableByteStreamController,i)}}Object.defineProperties(Ht.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),o(Ht.prototype.respond,"respond"),o(Ht.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ht.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class lt{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Gt(this))throw ss("byobRequest");return ji(this)}get desiredSize(){if(!Gt(this))throw ss("desiredSize");return Ju(this)}close(){if(!Gt(this))throw ss("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let i=this._controlledReadableByteStream._state;if(i!=="readable")throw new TypeError(`The stream (in ${i} state) is not in the readable state and cannot be closed`);rs(this)}enqueue(i){if(!Gt(this))throw ss("enqueue");if(We(i,1,"enqueue"),!ArrayBuffer.isView(i))throw new TypeError("chunk must be an array buffer view");if(i.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(i.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let a=this._controlledReadableByteStream._state;if(a!=="readable")throw new TypeError(`The stream (in ${a} state) is not in the readable state and cannot be enqueued to`);Qs(this,i)}error(i=void 0){if(!Gt(this))throw ss("error");qe(this,i)}[Ke](i){Nu(this),Et(this);let a=this._cancelAlgorithm(i);return Ys(this),a}[Wt](i){let a=this._controlledReadableByteStream;if(this._queueTotalSize>0){Qu(this,i);return}let c=this._autoAllocateChunkSize;if(c!==void 0){let f;try{f=new ArrayBuffer(c)}catch(b){i._errorSteps(b);return}let g={buffer:f,bufferByteLength:c,byteOffset:0,byteLength:c,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(g)}ge(a,i),Vt(this)}[Qr](){if(this._pendingPullIntos.length>0){let i=this._pendingPullIntos.peek();i.readerType="none",this._pendingPullIntos=new N,this._pendingPullIntos.push(i)}}}Object.defineProperties(lt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),o(lt.prototype.close,"close"),o(lt.prototype.enqueue,"enqueue"),o(lt.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(lt.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Gt(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_controlledReadableByteStream")?!1:s instanceof lt}function Mi(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_associatedReadableByteStreamController")?!1:s instanceof Ht}function Vt(s){if(!$b(s))return;if(s._pulling){s._pullAgain=!0;return}s._pulling=!0;let a=s._pullAlgorithm();_(a,()=>(s._pulling=!1,s._pullAgain&&(s._pullAgain=!1,Vt(s)),null),c=>(qe(s,c),null))}function Nu(s){Fi(s),s._pendingPullIntos=new N}function Bi(s,i){let a=!1;s._state==="closed"&&(a=!0);let c=Uu(i);i.readerType==="default"?zt(s,c,a):zb(s,c,a)}function Uu(s){let i=s.bytesFilled,a=s.elementSize;return new s.viewConstructor(s.buffer,s.byteOffset,i/a)}function Vs(s,i,a,c){s._queue.push({buffer:i,byteOffset:a,byteLength:c}),s._queueTotalSize+=c}function Wu(s,i,a,c){let f;try{f=Fu(i,a,a+c)}catch(g){throw qe(s,g),g}Vs(s,f,0,c)}function zu(s,i){i.bytesFilled>0&&Wu(s,i.buffer,i.byteOffset,i.bytesFilled),gr(s)}function Hu(s,i){let a=Math.min(s._queueTotalSize,i.byteLength-i.bytesFilled),c=i.bytesFilled+a,f=a,g=!1,b=c%i.elementSize,C=c-b;C>=i.minimumFill&&(f=C-i.bytesFilled,g=!0);let I=s._queue;for(;f>0;){let E=I.peek(),B=Math.min(f,E.byteLength),F=i.byteOffset+i.bytesFilled;Bu(i.buffer,F,E.buffer,E.byteOffset,B),E.byteLength===B?I.shift():(E.byteOffset+=B,E.byteLength-=B),s._queueTotalSize-=B,Gu(s,B,i),f-=B}return g}function Gu(s,i,a){a.bytesFilled+=i}function Vu(s){s._queueTotalSize===0&&s._closeRequested?(Ys(s),ls(s._controlledReadableByteStream)):Vt(s)}function Fi(s){s._byobRequest!==null&&(s._byobRequest._associatedReadableByteStreamController=void 0,s._byobRequest._view=null,s._byobRequest=null)}function $i(s){for(;s._pendingPullIntos.length>0;){if(s._queueTotalSize===0)return;let i=s._pendingPullIntos.peek();Hu(s,i)&&(gr(s),Bi(s._controlledReadableByteStream,i))}}function Db(s){let i=s._controlledReadableByteStream._reader;for(;i._readRequests.length>0;){if(s._queueTotalSize===0)return;let a=i._readRequests.shift();Qu(s,a)}}function Mb(s,i,a,c){let f=s._controlledReadableByteStream,g=i.constructor,b=qb(g),{byteOffset:C,byteLength:I}=i,E=a*b,B;try{B=ut(i.buffer)}catch(H){c._errorSteps(H);return}let F={buffer:B,bufferByteLength:B.byteLength,byteOffset:C,byteLength:I,bytesFilled:0,minimumFill:E,elementSize:b,viewConstructor:g,readerType:"byob"};if(s._pendingPullIntos.length>0){s._pendingPullIntos.push(F),Xu(f,c);return}if(f._state==="closed"){let H=new g(F.buffer,F.byteOffset,0);c._closeSteps(H);return}if(s._queueTotalSize>0){if(Hu(s,F)){let H=Uu(F);Vu(s),c._chunkSteps(H);return}if(s._closeRequested){let H=new TypeError("Insufficient bytes to fill elements in the given buffer");qe(s,H),c._errorSteps(H);return}}s._pendingPullIntos.push(F),Xu(f,c),Vt(s)}function Bb(s,i){i.readerType==="none"&&gr(s);let a=s._controlledReadableByteStream;if(Ni(a))for(;el(a)>0;){let c=gr(s);Bi(a,c)}}function Fb(s,i,a){if(Gu(s,i,a),a.readerType==="none"){zu(s,a),$i(s);return}if(a.bytesFilled<a.minimumFill)return;gr(s);let c=a.bytesFilled%a.elementSize;if(c>0){let f=a.byteOffset+a.bytesFilled;Wu(s,a.buffer,f-c,c)}a.bytesFilled-=c,Bi(s._controlledReadableByteStream,a),$i(s)}function Yu(s,i){let a=s._pendingPullIntos.peek();Fi(s),s._controlledReadableByteStream._state==="closed"?Bb(s,a):Fb(s,i,a),Vt(s)}function gr(s){return s._pendingPullIntos.shift()}function $b(s){let i=s._controlledReadableByteStream;return i._state!=="readable"||s._closeRequested||!s._started?!1:!!(Eu(i)&&zs(i)>0||Ni(i)&&el(i)>0||Ju(s)>0)}function Ys(s){s._pullAlgorithm=void 0,s._cancelAlgorithm=void 0}function rs(s){let i=s._controlledReadableByteStream;if(!(s._closeRequested||i._state!=="readable")){if(s._queueTotalSize>0){s._closeRequested=!0;return}if(s._pendingPullIntos.length>0){let a=s._pendingPullIntos.peek();if(a.bytesFilled%a.elementSize!==0){let c=new TypeError("Insufficient bytes to fill elements in the given buffer");throw qe(s,c),c}}Ys(s),ls(i)}}function Qs(s,i){let a=s._controlledReadableByteStream;if(s._closeRequested||a._state!=="readable")return;let{buffer:c,byteOffset:f,byteLength:g}=i;if(Pt(c))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let b=ut(c);if(s._pendingPullIntos.length>0){let C=s._pendingPullIntos.peek();if(Pt(C.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Fi(s),C.buffer=ut(C.buffer),C.readerType==="none"&&zu(s,C)}if(Eu(a))if(Db(s),zs(a)===0)Vs(s,b,f,g);else{s._pendingPullIntos.length>0&&gr(s);let C=new Uint8Array(b,f,g);zt(a,C,!1)}else Ni(a)?(Vs(s,b,f,g),$i(s)):Vs(s,b,f,g);Vt(s)}function qe(s,i){let a=s._controlledReadableByteStream;a._state==="readable"&&(Nu(s),Et(s),Ys(s),Rl(a,i))}function Qu(s,i){let a=s._queue.shift();s._queueTotalSize-=a.byteLength,Vu(s);let c=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);i._chunkSteps(c)}function ji(s){if(s._byobRequest===null&&s._pendingPullIntos.length>0){let i=s._pendingPullIntos.peek(),a=new Uint8Array(i.buffer,i.byteOffset+i.bytesFilled,i.byteLength-i.bytesFilled),c=Object.create(Ht.prototype);Lb(c,s,a),s._byobRequest=c}return s._byobRequest}function Ju(s){let i=s._controlledReadableByteStream._state;return i==="errored"?null:i==="closed"?0:s._strategyHWM-s._queueTotalSize}function Js(s,i){let a=s._pendingPullIntos.peek();if(s._controlledReadableByteStream._state==="closed"){if(i!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(i===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(a.bytesFilled+i>a.byteLength)throw new RangeError("bytesWritten out of range")}a.buffer=ut(a.buffer),Yu(s,i)}function Ks(s,i){let a=s._pendingPullIntos.peek();if(s._controlledReadableByteStream._state==="closed"){if(i.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(i.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(a.byteOffset+a.bytesFilled!==i.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(a.bufferByteLength!==i.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(a.bytesFilled+i.byteLength>a.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let f=i.byteLength;a.buffer=ut(i.buffer),Yu(s,f)}function Ku(s,i,a,c,f,g,b){i._controlledReadableByteStream=s,i._pullAgain=!1,i._pulling=!1,i._byobRequest=null,i._queue=i._queueTotalSize=void 0,Et(i),i._closeRequested=!1,i._started=!1,i._strategyHWM=g,i._pullAlgorithm=c,i._cancelAlgorithm=f,i._autoAllocateChunkSize=b,i._pendingPullIntos=new N,s._readableStreamController=i;let C=a();_(m(C),()=>(i._started=!0,Vt(i),null),I=>(qe(i,I),null))}function jb(s,i,a){let c=Object.create(lt.prototype),f,g,b;i.start!==void 0?f=()=>i.start(c):f=()=>{},i.pull!==void 0?g=()=>i.pull(c):g=()=>m(void 0),i.cancel!==void 0?b=I=>i.cancel(I):b=()=>m(void 0);let C=i.autoAllocateChunkSize;if(C===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");Ku(s,c,f,g,b,a,C)}function Lb(s,i,a){s._associatedReadableByteStreamController=i,s._view=a}function Li(s){return new TypeError(`ReadableStreamBYOBRequest.prototype.${s} can only be used on a ReadableStreamBYOBRequest`)}function ss(s){return new TypeError(`ReadableByteStreamController.prototype.${s} can only be used on a ReadableByteStreamController`)}function Nb(s,i){Ie(s,i);let a=s?.mode;return{mode:a===void 0?void 0:Ub(a,`${i} has member 'mode' that`)}}function Ub(s,i){if(s=`${s}`,s!=="byob")throw new TypeError(`${i} '${s}' is not a valid enumeration value for ReadableStreamReaderMode`);return s}function Wb(s,i){var a;Ie(s,i);let c=(a=s?.min)!==null&&a!==void 0?a:1;return{min:x(c,`${i} has member 'min' that`)}}function Zu(s){return new At(s)}function Xu(s,i){s._reader._readIntoRequests.push(i)}function zb(s,i,a){let f=s._reader._readIntoRequests.shift();a?f._closeSteps(i):f._chunkSteps(i)}function el(s){return s._reader._readIntoRequests.length}function Ni(s){let i=s._reader;return!(i===void 0||!Yt(i))}class At{constructor(i){if(We(i,1,"ReadableStreamBYOBReader"),W(i,"First parameter"),qt(i))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Gt(i._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");js(this,i),this._readIntoRequests=new N}get closed(){return Yt(this)?this._closedPromise:p(Zs("closed"))}cancel(i=void 0){return Yt(this)?this._ownerReadableStream===void 0?p(pr("cancel")):Jr(this,i):p(Zs("cancel"))}read(i,a={}){if(!Yt(this))return p(Zs("read"));if(!ArrayBuffer.isView(i))return p(new TypeError("view must be an array buffer view"));if(i.byteLength===0)return p(new TypeError("view must have non-zero byteLength"));if(i.buffer.byteLength===0)return p(new TypeError("view's buffer must have non-zero byteLength"));if(Pt(i.buffer))return p(new TypeError("view's buffer has been detached"));let c;try{c=Wb(a,"options")}catch(E){return p(E)}let f=c.min;if(f===0)return p(new TypeError("options.min must be greater than 0"));if(Ib(i)){if(f>i.byteLength)return p(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(f>i.length)return p(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return p(pr("read from"));let g,b,C=d((E,B)=>{g=E,b=B});return tl(this,i,f,{_chunkSteps:E=>g({value:E,done:!1}),_closeSteps:E=>g({value:E,done:!0}),_errorSteps:E=>b(E)}),C}releaseLock(){if(!Yt(this))throw Zs("releaseLock");this._ownerReadableStream!==void 0&&Hb(this)}}Object.defineProperties(At.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),o(At.prototype.cancel,"cancel"),o(At.prototype.read,"read"),o(At.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(At.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Yt(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_readIntoRequests")?!1:s instanceof At}function tl(s,i,a,c){let f=s._ownerReadableStream;f._disturbed=!0,f._state==="errored"?c._errorSteps(f._storedError):Mb(f._readableStreamController,i,a,c)}function Hb(s){Ue(s);let i=new TypeError("Reader was released");rl(s,i)}function rl(s,i){let a=s._readIntoRequests;s._readIntoRequests=new N,a.forEach(c=>{c._errorSteps(i)})}function Zs(s){return new TypeError(`ReadableStreamBYOBReader.prototype.${s} can only be used on a ReadableStreamBYOBReader`)}function ns(s,i){let{highWaterMark:a}=s;if(a===void 0)return i;if(Mu(a)||a<0)throw new RangeError("Invalid highWaterMark");return a}function Xs(s){let{size:i}=s;return i||(()=>1)}function en(s,i){Ie(s,i);let a=s?.highWaterMark,c=s?.size;return{highWaterMark:a===void 0?void 0:pe(a),size:c===void 0?void 0:Gb(c,`${i} has member 'size' that`)}}function Gb(s,i){return me(s,i),a=>pe(s(a))}function Vb(s,i){Ie(s,i);let a=s?.abort,c=s?.close,f=s?.start,g=s?.type,b=s?.write;return{abort:a===void 0?void 0:Yb(a,s,`${i} has member 'abort' that`),close:c===void 0?void 0:Qb(c,s,`${i} has member 'close' that`),start:f===void 0?void 0:Jb(f,s,`${i} has member 'start' that`),write:b===void 0?void 0:Kb(b,s,`${i} has member 'write' that`),type:g}}function Yb(s,i,a){return me(s,a),c=>J(s,i,[c])}function Qb(s,i,a){return me(s,a),()=>J(s,i,[])}function Jb(s,i,a){return me(s,a),c=>j(s,i,[c])}function Kb(s,i,a){return me(s,a),(c,f)=>J(s,i,[c,f])}function sl(s,i){if(!br(s))throw new TypeError(`${i} is not a WritableStream.`)}function Zb(s){if(typeof s!="object"||s===null)return!1;try{return typeof s.aborted=="boolean"}catch{return!1}}let Xb=typeof AbortController=="function";function ey(){if(Xb)return new AbortController}class Ot{constructor(i={},a={}){i===void 0?i=null:Ws(i,"First parameter");let c=en(a,"Second parameter"),f=Vb(i,"First parameter");if(il(this),f.type!==void 0)throw new RangeError("Invalid type is specified");let b=Xs(c),C=ns(c,1);my(this,f,C,b)}get locked(){if(!br(this))throw on("locked");return yr(this)}abort(i=void 0){return br(this)?yr(this)?p(new TypeError("Cannot abort a stream that already has a writer")):tn(this,i):p(on("abort"))}close(){return br(this)?yr(this)?p(new TypeError("Cannot close a stream that already has a writer")):Ze(this)?p(new TypeError("Cannot close an already-closing stream")):ol(this):p(on("close"))}getWriter(){if(!br(this))throw on("getWriter");return nl(this)}}Object.defineProperties(Ot.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),o(Ot.prototype.abort,"abort"),o(Ot.prototype.close,"close"),o(Ot.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ot.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function nl(s){return new ct(s)}function ty(s,i,a,c,f=1,g=()=>1){let b=Object.create(Ot.prototype);il(b);let C=Object.create(_r.prototype);return dl(b,C,s,i,a,c,f,g),b}function il(s){s._state="writable",s._storedError=void 0,s._writer=void 0,s._writableStreamController=void 0,s._writeRequests=new N,s._inFlightWriteRequest=void 0,s._closeRequest=void 0,s._inFlightCloseRequest=void 0,s._pendingAbortRequest=void 0,s._backpressure=!1}function br(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_writableStreamController")?!1:s instanceof Ot}function yr(s){return s._writer!==void 0}function tn(s,i){var a;if(s._state==="closed"||s._state==="errored")return m(void 0);s._writableStreamController._abortReason=i,(a=s._writableStreamController._abortController)===null||a===void 0||a.abort(i);let c=s._state;if(c==="closed"||c==="errored")return m(void 0);if(s._pendingAbortRequest!==void 0)return s._pendingAbortRequest._promise;let f=!1;c==="erroring"&&(f=!0,i=void 0);let g=d((b,C)=>{s._pendingAbortRequest={_promise:void 0,_resolve:b,_reject:C,_reason:i,_wasAlreadyErroring:f}});return s._pendingAbortRequest._promise=g,f||Wi(s,i),g}function ol(s){let i=s._state;if(i==="closed"||i==="errored")return p(new TypeError(`The stream (in ${i} state) is not in the writable state and cannot be closed`));let a=d((f,g)=>{let b={_resolve:f,_reject:g};s._closeRequest=b}),c=s._writer;return c!==void 0&&s._backpressure&&i==="writable"&&Ki(c),py(s._writableStreamController),a}function ry(s){return d((a,c)=>{let f={_resolve:a,_reject:c};s._writeRequests.push(f)})}function Ui(s,i){if(s._state==="writable"){Wi(s,i);return}zi(s)}function Wi(s,i){let a=s._writableStreamController;s._state="erroring",s._storedError=i;let c=s._writer;c!==void 0&&ul(c,i),!ay(s)&&a._started&&zi(s)}function zi(s){s._state="errored",s._writableStreamController[Oe]();let i=s._storedError;if(s._writeRequests.forEach(f=>{f._reject(i)}),s._writeRequests=new N,s._pendingAbortRequest===void 0){rn(s);return}let a=s._pendingAbortRequest;if(s._pendingAbortRequest=void 0,a._wasAlreadyErroring){a._reject(i),rn(s);return}let c=s._writableStreamController[U](a._reason);_(c,()=>(a._resolve(),rn(s),null),f=>(a._reject(f),rn(s),null))}function sy(s){s._inFlightWriteRequest._resolve(void 0),s._inFlightWriteRequest=void 0}function ny(s,i){s._inFlightWriteRequest._reject(i),s._inFlightWriteRequest=void 0,Ui(s,i)}function iy(s){s._inFlightCloseRequest._resolve(void 0),s._inFlightCloseRequest=void 0,s._state==="erroring"&&(s._storedError=void 0,s._pendingAbortRequest!==void 0&&(s._pendingAbortRequest._resolve(),s._pendingAbortRequest=void 0)),s._state="closed";let a=s._writer;a!==void 0&&gl(a)}function oy(s,i){s._inFlightCloseRequest._reject(i),s._inFlightCloseRequest=void 0,s._pendingAbortRequest!==void 0&&(s._pendingAbortRequest._reject(i),s._pendingAbortRequest=void 0),Ui(s,i)}function Ze(s){return!(s._closeRequest===void 0&&s._inFlightCloseRequest===void 0)}function ay(s){return!(s._inFlightWriteRequest===void 0&&s._inFlightCloseRequest===void 0)}function uy(s){s._inFlightCloseRequest=s._closeRequest,s._closeRequest=void 0}function ly(s){s._inFlightWriteRequest=s._writeRequests.shift()}function rn(s){s._closeRequest!==void 0&&(s._closeRequest._reject(s._storedError),s._closeRequest=void 0);let i=s._writer;i!==void 0&&Qi(i,s._storedError)}function Hi(s,i){let a=s._writer;a!==void 0&&i!==s._backpressure&&(i?Sy(a):Ki(a)),s._backpressure=i}class ct{constructor(i){if(We(i,1,"WritableStreamDefaultWriter"),sl(i,"First parameter"),yr(i))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=i,i._writer=this;let a=i._state;if(a==="writable")!Ze(i)&&i._backpressure?un(this):bl(this),an(this);else if(a==="erroring")Ji(this,i._storedError),an(this);else if(a==="closed")bl(this),wy(this);else{let c=i._storedError;Ji(this,c),pl(this,c)}}get closed(){return Qt(this)?this._closedPromise:p(Jt("closed"))}get desiredSize(){if(!Qt(this))throw Jt("desiredSize");if(this._ownerWritableStream===void 0)throw os("desiredSize");return fy(this)}get ready(){return Qt(this)?this._readyPromise:p(Jt("ready"))}abort(i=void 0){return Qt(this)?this._ownerWritableStream===void 0?p(os("abort")):cy(this,i):p(Jt("abort"))}close(){if(!Qt(this))return p(Jt("close"));let i=this._ownerWritableStream;return i===void 0?p(os("close")):Ze(i)?p(new TypeError("Cannot close an already-closing stream")):al(this)}releaseLock(){if(!Qt(this))throw Jt("releaseLock");this._ownerWritableStream!==void 0&&ll(this)}write(i=void 0){return Qt(this)?this._ownerWritableStream===void 0?p(os("write to")):cl(this,i):p(Jt("write"))}}Object.defineProperties(ct.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),o(ct.prototype.abort,"abort"),o(ct.prototype.close,"close"),o(ct.prototype.releaseLock,"releaseLock"),o(ct.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ct.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function Qt(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_ownerWritableStream")?!1:s instanceof ct}function cy(s,i){let a=s._ownerWritableStream;return tn(a,i)}function al(s){let i=s._ownerWritableStream;return ol(i)}function hy(s){let i=s._ownerWritableStream,a=i._state;return Ze(i)||a==="closed"?m(void 0):a==="errored"?p(i._storedError):al(s)}function dy(s,i){s._closedPromiseState==="pending"?Qi(s,i):vy(s,i)}function ul(s,i){s._readyPromiseState==="pending"?yl(s,i):Ty(s,i)}function fy(s){let i=s._ownerWritableStream,a=i._state;return a==="errored"||a==="erroring"?null:a==="closed"?0:fl(i._writableStreamController)}function ll(s){let i=s._ownerWritableStream,a=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");ul(s,a),dy(s,a),i._writer=void 0,s._ownerWritableStream=void 0}function cl(s,i){let a=s._ownerWritableStream,c=a._writableStreamController,f=gy(c,i);if(a!==s._ownerWritableStream)return p(os("write to"));let g=a._state;if(g==="errored")return p(a._storedError);if(Ze(a)||g==="closed")return p(new TypeError("The stream is closing or closed and cannot be written to"));if(g==="erroring")return p(a._storedError);let b=ry(a);return by(c,i,f),b}let hl={};class _r{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Gi(this))throw Yi("abortReason");return this._abortReason}get signal(){if(!Gi(this))throw Yi("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(i=void 0){if(!Gi(this))throw Yi("error");this._controlledWritableStream._state==="writable"&&ml(this,i)}[U](i){let a=this._abortAlgorithm(i);return sn(this),a}[Oe](){Et(this)}}Object.defineProperties(_r.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(_r.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Gi(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_controlledWritableStream")?!1:s instanceof _r}function dl(s,i,a,c,f,g,b,C){i._controlledWritableStream=s,s._writableStreamController=i,i._queue=void 0,i._queueTotalSize=void 0,Et(i),i._abortReason=void 0,i._abortController=ey(),i._started=!1,i._strategySizeAlgorithm=C,i._strategyHWM=b,i._writeAlgorithm=c,i._closeAlgorithm=f,i._abortAlgorithm=g;let I=Vi(i);Hi(s,I);let E=a(),B=m(E);_(B,()=>(i._started=!0,nn(i),null),F=>(i._started=!0,Ui(s,F),null))}function my(s,i,a,c){let f=Object.create(_r.prototype),g,b,C,I;i.start!==void 0?g=()=>i.start(f):g=()=>{},i.write!==void 0?b=E=>i.write(E,f):b=()=>m(void 0),i.close!==void 0?C=()=>i.close():C=()=>m(void 0),i.abort!==void 0?I=E=>i.abort(E):I=()=>m(void 0),dl(s,f,g,b,C,I,a,c)}function sn(s){s._writeAlgorithm=void 0,s._closeAlgorithm=void 0,s._abortAlgorithm=void 0,s._strategySizeAlgorithm=void 0}function py(s){Di(s,hl,0),nn(s)}function gy(s,i){try{return s._strategySizeAlgorithm(i)}catch(a){return is(s,a),1}}function fl(s){return s._strategyHWM-s._queueTotalSize}function by(s,i,a){try{Di(s,i,a)}catch(f){is(s,f);return}let c=s._controlledWritableStream;if(!Ze(c)&&c._state==="writable"){let f=Vi(s);Hi(c,f)}nn(s)}function nn(s){let i=s._controlledWritableStream;if(!s._started||i._inFlightWriteRequest!==void 0)return;if(i._state==="erroring"){zi(i);return}if(s._queue.length===0)return;let c=Ob(s);c===hl?yy(s):_y(s,c)}function is(s,i){s._controlledWritableStream._state==="writable"&&ml(s,i)}function yy(s){let i=s._controlledWritableStream;uy(i),qi(s);let a=s._closeAlgorithm();sn(s),_(a,()=>(iy(i),null),c=>(oy(i,c),null))}function _y(s,i){let a=s._controlledWritableStream;ly(a);let c=s._writeAlgorithm(i);_(c,()=>{sy(a);let f=a._state;if(qi(s),!Ze(a)&&f==="writable"){let g=Vi(s);Hi(a,g)}return nn(s),null},f=>(a._state==="writable"&&sn(s),ny(a,f),null))}function Vi(s){return fl(s)<=0}function ml(s,i){let a=s._controlledWritableStream;sn(s),Wi(a,i)}function on(s){return new TypeError(`WritableStream.prototype.${s} can only be used on a WritableStream`)}function Yi(s){return new TypeError(`WritableStreamDefaultController.prototype.${s} can only be used on a WritableStreamDefaultController`)}function Jt(s){return new TypeError(`WritableStreamDefaultWriter.prototype.${s} can only be used on a WritableStreamDefaultWriter`)}function os(s){return new TypeError("Cannot "+s+" a stream using a released writer")}function an(s){s._closedPromise=d((i,a)=>{s._closedPromise_resolve=i,s._closedPromise_reject=a,s._closedPromiseState="pending"})}function pl(s,i){an(s),Qi(s,i)}function wy(s){an(s),gl(s)}function Qi(s,i){s._closedPromise_reject!==void 0&&(k(s._closedPromise),s._closedPromise_reject(i),s._closedPromise_resolve=void 0,s._closedPromise_reject=void 0,s._closedPromiseState="rejected")}function vy(s,i){pl(s,i)}function gl(s){s._closedPromise_resolve!==void 0&&(s._closedPromise_resolve(void 0),s._closedPromise_resolve=void 0,s._closedPromise_reject=void 0,s._closedPromiseState="resolved")}function un(s){s._readyPromise=d((i,a)=>{s._readyPromise_resolve=i,s._readyPromise_reject=a}),s._readyPromiseState="pending"}function Ji(s,i){un(s),yl(s,i)}function bl(s){un(s),Ki(s)}function yl(s,i){s._readyPromise_reject!==void 0&&(k(s._readyPromise),s._readyPromise_reject(i),s._readyPromise_resolve=void 0,s._readyPromise_reject=void 0,s._readyPromiseState="rejected")}function Sy(s){un(s)}function Ty(s,i){Ji(s,i)}function Ki(s){s._readyPromise_resolve!==void 0&&(s._readyPromise_resolve(void 0),s._readyPromise_resolve=void 0,s._readyPromise_reject=void 0,s._readyPromiseState="fulfilled")}function Ry(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof global<"u")return global}let Zi=Ry();function Cy(s){if(!(typeof s=="function"||typeof s=="object")||s.name!=="DOMException")return!1;try{return new s,!0}catch{return!1}}function xy(){let s=Zi?.DOMException;return Cy(s)?s:void 0}function ky(){let s=function(a,c){this.message=a||"",this.name=c||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return o(s,"DOMException"),s.prototype=Object.create(Error.prototype),Object.defineProperty(s.prototype,"constructor",{value:s,writable:!0,configurable:!0}),s}let Py=xy()||ky();function _l(s,i,a,c,f,g){let b=se(s),C=nl(i);s._disturbed=!0;let I=!1,E=m(void 0);return d((B,F)=>{let H;if(g!==void 0){if(H=()=>{let A=g.reason!==void 0?g.reason:new Py("Aborted","AbortError"),L=[];c||L.push(()=>i._state==="writable"?tn(i,A):m(void 0)),f||L.push(()=>s._state==="readable"?He(s,A):m(void 0)),be(()=>Promise.all(L.map(G=>G())),!0,A)},g.aborted){H();return}g.addEventListener("abort",H)}function Ge(){return d((A,L)=>{function G(Ce){Ce?A():w(Tr(),G,L)}G(!1)})}function Tr(){return I?m(!0):w(C._readyPromise,()=>d((A,L)=>{es(b,{_chunkSteps:G=>{E=w(cl(C,G),void 0,e),A(!1)},_closeSteps:()=>A(!0),_errorSteps:L})}))}if(dt(s,b._closedPromise,A=>(c?De(!0,A):be(()=>tn(i,A),!0,A),null)),dt(i,C._closedPromise,A=>(f?De(!0,A):be(()=>He(s,A),!0,A),null)),he(s,b._closedPromise,()=>(a?De():be(()=>hy(C)),null)),Ze(i)||i._state==="closed"){let A=new TypeError("the destination writable stream closed before all data could be piped to it");f?De(!0,A):be(()=>He(s,A),!0,A)}k(Ge());function Mt(){let A=E;return w(E,()=>A!==E?Mt():void 0)}function dt(A,L,G){A._state==="errored"?G(A._storedError):y(L,G)}function he(A,L,G){A._state==="closed"?G():R(L,G)}function be(A,L,G){if(I)return;I=!0,i._state==="writable"&&!Ze(i)?R(Mt(),Ce):Ce();function Ce(){return _(A(),()=>ft(L,G),Rr=>ft(!0,Rr)),null}}function De(A,L){I||(I=!0,i._state==="writable"&&!Ze(i)?R(Mt(),()=>ft(A,L)):ft(A,L))}function ft(A,L){return ll(C),Ue(b),g!==void 0&&g.removeEventListener("abort",H),A?F(L):B(void 0),null}})}class ht{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!ln(this))throw hn("desiredSize");return Xi(this)}close(){if(!ln(this))throw hn("close");if(!vr(this))throw new TypeError("The stream is not in a state that permits close");Kt(this)}enqueue(i=void 0){if(!ln(this))throw hn("enqueue");if(!vr(this))throw new TypeError("The stream is not in a state that permits enqueue");return wr(this,i)}error(i=void 0){if(!ln(this))throw hn("error");ze(this,i)}[Ke](i){Et(this);let a=this._cancelAlgorithm(i);return cn(this),a}[Wt](i){let a=this._controlledReadableStream;if(this._queue.length>0){let c=qi(this);this._closeRequested&&this._queue.length===0?(cn(this),ls(a)):as(this),i._chunkSteps(c)}else ge(a,i),as(this)}[Qr](){}}Object.defineProperties(ht.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),o(ht.prototype.close,"close"),o(ht.prototype.enqueue,"enqueue"),o(ht.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ht.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function ln(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_controlledReadableStream")?!1:s instanceof ht}function as(s){if(!wl(s))return;if(s._pulling){s._pullAgain=!0;return}s._pulling=!0;let a=s._pullAlgorithm();_(a,()=>(s._pulling=!1,s._pullAgain&&(s._pullAgain=!1,as(s)),null),c=>(ze(s,c),null))}function wl(s){let i=s._controlledReadableStream;return!vr(s)||!s._started?!1:!!(qt(i)&&zs(i)>0||Xi(s)>0)}function cn(s){s._pullAlgorithm=void 0,s._cancelAlgorithm=void 0,s._strategySizeAlgorithm=void 0}function Kt(s){if(!vr(s))return;let i=s._controlledReadableStream;s._closeRequested=!0,s._queue.length===0&&(cn(s),ls(i))}function wr(s,i){if(!vr(s))return;let a=s._controlledReadableStream;if(qt(a)&&zs(a)>0)zt(a,i,!1);else{let c;try{c=s._strategySizeAlgorithm(i)}catch(f){throw ze(s,f),f}try{Di(s,i,c)}catch(f){throw ze(s,f),f}}as(s)}function ze(s,i){let a=s._controlledReadableStream;a._state==="readable"&&(Et(s),cn(s),Rl(a,i))}function Xi(s){let i=s._controlledReadableStream._state;return i==="errored"?null:i==="closed"?0:s._strategyHWM-s._queueTotalSize}function Ey(s){return!wl(s)}function vr(s){let i=s._controlledReadableStream._state;return!s._closeRequested&&i==="readable"}function vl(s,i,a,c,f,g,b){i._controlledReadableStream=s,i._queue=void 0,i._queueTotalSize=void 0,Et(i),i._started=!1,i._closeRequested=!1,i._pullAgain=!1,i._pulling=!1,i._strategySizeAlgorithm=b,i._strategyHWM=g,i._pullAlgorithm=c,i._cancelAlgorithm=f,s._readableStreamController=i;let C=a();_(m(C),()=>(i._started=!0,as(i),null),I=>(ze(i,I),null))}function Ay(s,i,a,c){let f=Object.create(ht.prototype),g,b,C;i.start!==void 0?g=()=>i.start(f):g=()=>{},i.pull!==void 0?b=()=>i.pull(f):b=()=>m(void 0),i.cancel!==void 0?C=I=>i.cancel(I):C=()=>m(void 0),vl(s,f,g,b,C,a,c)}function hn(s){return new TypeError(`ReadableStreamDefaultController.prototype.${s} can only be used on a ReadableStreamDefaultController`)}function Oy(s,i){return Gt(s._readableStreamController)?qy(s):Iy(s)}function Iy(s,i){let a=se(s),c=!1,f=!1,g=!1,b=!1,C,I,E,B,F,H=d(he=>{F=he});function Ge(){return c?(f=!0,m(void 0)):(c=!0,es(a,{_chunkSteps:be=>{P(()=>{f=!1;let De=be,ft=be;g||wr(E._readableStreamController,De),b||wr(B._readableStreamController,ft),c=!1,f&&Ge()})},_closeSteps:()=>{c=!1,g||Kt(E._readableStreamController),b||Kt(B._readableStreamController),(!g||!b)&&F(void 0)},_errorSteps:()=>{c=!1}}),m(void 0))}function Tr(he){if(g=!0,C=he,b){let be=ts([C,I]),De=He(s,be);F(De)}return H}function Mt(he){if(b=!0,I=he,g){let be=ts([C,I]),De=He(s,be);F(De)}return H}function dt(){}return E=us(dt,Ge,Tr),B=us(dt,Ge,Mt),y(a._closedPromise,he=>(ze(E._readableStreamController,he),ze(B._readableStreamController,he),(!g||!b)&&F(void 0),null)),[E,B]}function qy(s){let i=se(s),a=!1,c=!1,f=!1,g=!1,b=!1,C,I,E,B,F,H=d(A=>{F=A});function Ge(A){y(A._closedPromise,L=>(A!==i||(qe(E._readableStreamController,L),qe(B._readableStreamController,L),(!g||!b)&&F(void 0)),null))}function Tr(){Yt(i)&&(Ue(i),i=se(s),Ge(i)),es(i,{_chunkSteps:L=>{P(()=>{c=!1,f=!1;let G=L,Ce=L;if(!g&&!b)try{Ce=ju(L)}catch(Rr){qe(E._readableStreamController,Rr),qe(B._readableStreamController,Rr),F(He(s,Rr));return}g||Qs(E._readableStreamController,G),b||Qs(B._readableStreamController,Ce),a=!1,c?dt():f&&he()})},_closeSteps:()=>{a=!1,g||rs(E._readableStreamController),b||rs(B._readableStreamController),E._readableStreamController._pendingPullIntos.length>0&&Js(E._readableStreamController,0),B._readableStreamController._pendingPullIntos.length>0&&Js(B._readableStreamController,0),(!g||!b)&&F(void 0)},_errorSteps:()=>{a=!1}})}function Mt(A,L){kt(i)&&(Ue(i),i=Zu(s),Ge(i));let G=L?B:E,Ce=L?E:B;tl(i,A,1,{_chunkSteps:Cr=>{P(()=>{c=!1,f=!1;let xr=L?b:g;if(L?g:b)xr||Ks(G._readableStreamController,Cr);else{let Fl;try{Fl=ju(Cr)}catch(no){qe(G._readableStreamController,no),qe(Ce._readableStreamController,no),F(He(s,no));return}xr||Ks(G._readableStreamController,Cr),Qs(Ce._readableStreamController,Fl)}a=!1,c?dt():f&&he()})},_closeSteps:Cr=>{a=!1;let xr=L?b:g,_n=L?g:b;xr||rs(G._readableStreamController),_n||rs(Ce._readableStreamController),Cr!==void 0&&(xr||Ks(G._readableStreamController,Cr),!_n&&Ce._readableStreamController._pendingPullIntos.length>0&&Js(Ce._readableStreamController,0)),(!xr||!_n)&&F(void 0)},_errorSteps:()=>{a=!1}})}function dt(){if(a)return c=!0,m(void 0);a=!0;let A=ji(E._readableStreamController);return A===null?Tr():Mt(A._view,!1),m(void 0)}function he(){if(a)return f=!0,m(void 0);a=!0;let A=ji(B._readableStreamController);return A===null?Tr():Mt(A._view,!0),m(void 0)}function be(A){if(g=!0,C=A,b){let L=ts([C,I]),G=He(s,L);F(G)}return H}function De(A){if(b=!0,I=A,g){let L=ts([C,I]),G=He(s,L);F(G)}return H}function ft(){}return E=Tl(ft,dt,be),B=Tl(ft,he,De),Ge(i),[E,B]}function Dy(s){return r(s)&&typeof s.getReader<"u"}function My(s){return Dy(s)?Fy(s.getReader()):By(s)}function By(s){let i,a=$u(s,"async"),c=e;function f(){let b;try{b=kb(a)}catch(I){return p(I)}let C=m(b);return D(C,I=>{if(!r(I))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(Pb(I))Kt(i._readableStreamController);else{let B=Eb(I);wr(i._readableStreamController,B)}})}function g(b){let C=a.iterator,I;try{I=Gs(C,"return")}catch(F){return p(F)}if(I===void 0)return m(void 0);let E;try{E=j(I,C,[b])}catch(F){return p(F)}let B=m(E);return D(B,F=>{if(!r(F))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return i=us(c,f,g,0),i}function Fy(s){let i,a=e;function c(){let g;try{g=s.read()}catch(b){return p(b)}return D(g,b=>{if(!r(b))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(b.done)Kt(i._readableStreamController);else{let C=b.value;wr(i._readableStreamController,C)}})}function f(g){try{return m(s.cancel(g))}catch(b){return p(b)}}return i=us(a,c,f,0),i}function $y(s,i){Ie(s,i);let a=s,c=a?.autoAllocateChunkSize,f=a?.cancel,g=a?.pull,b=a?.start,C=a?.type;return{autoAllocateChunkSize:c===void 0?void 0:x(c,`${i} has member 'autoAllocateChunkSize' that`),cancel:f===void 0?void 0:jy(f,a,`${i} has member 'cancel' that`),pull:g===void 0?void 0:Ly(g,a,`${i} has member 'pull' that`),start:b===void 0?void 0:Ny(b,a,`${i} has member 'start' that`),type:C===void 0?void 0:Uy(C,`${i} has member 'type' that`)}}function jy(s,i,a){return me(s,a),c=>J(s,i,[c])}function Ly(s,i,a){return me(s,a),c=>J(s,i,[c])}function Ny(s,i,a){return me(s,a),c=>j(s,i,[c])}function Uy(s,i){if(s=`${s}`,s!=="bytes")throw new TypeError(`${i} '${s}' is not a valid enumeration value for ReadableStreamType`);return s}function Wy(s,i){return Ie(s,i),{preventCancel:!!s?.preventCancel}}function Sl(s,i){Ie(s,i);let a=s?.preventAbort,c=s?.preventCancel,f=s?.preventClose,g=s?.signal;return g!==void 0&&zy(g,`${i} has member 'signal' that`),{preventAbort:!!a,preventCancel:!!c,preventClose:!!f,signal:g}}function zy(s,i){if(!Zb(s))throw new TypeError(`${i} is not an AbortSignal.`)}function Hy(s,i){Ie(s,i);let a=s?.readable;Xr(a,"readable","ReadableWritablePair"),W(a,`${i} has member 'readable' that`);let c=s?.writable;return Xr(c,"writable","ReadableWritablePair"),sl(c,`${i} has member 'writable' that`),{readable:a,writable:c}}class ue{constructor(i={},a={}){i===void 0?i=null:Ws(i,"First parameter");let c=en(a,"Second parameter"),f=$y(i,"First parameter");if(eo(this),f.type==="bytes"){if(c.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let g=ns(c,0);jb(this,f,g)}else{let g=Xs(c),b=ns(c,1);Ay(this,f,b,g)}}get locked(){if(!It(this))throw Zt("locked");return qt(this)}cancel(i=void 0){return It(this)?qt(this)?p(new TypeError("Cannot cancel a stream that already has a reader")):He(this,i):p(Zt("cancel"))}getReader(i=void 0){if(!It(this))throw Zt("getReader");return Nb(i,"First parameter").mode===void 0?se(this):Zu(this)}pipeThrough(i,a={}){if(!It(this))throw Zt("pipeThrough");We(i,1,"pipeThrough");let c=Hy(i,"First parameter"),f=Sl(a,"Second parameter");if(qt(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(yr(c.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let g=_l(this,c.writable,f.preventClose,f.preventAbort,f.preventCancel,f.signal);return k(g),c.readable}pipeTo(i,a={}){if(!It(this))return p(Zt("pipeTo"));if(i===void 0)return p("Parameter 1 is required in 'pipeTo'.");if(!br(i))return p(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let c;try{c=Sl(a,"Second parameter")}catch(f){return p(f)}return qt(this)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):yr(i)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):_l(this,i,c.preventClose,c.preventAbort,c.preventCancel,c.signal)}tee(){if(!It(this))throw Zt("tee");let i=Oy(this);return ts(i)}values(i=void 0){if(!It(this))throw Zt("values");let a=Wy(i,"First parameter");return Cb(this,a.preventCancel)}[Ii](i){return this.values(i)}static from(i){return My(i)}}Object.defineProperties(ue,{from:{enumerable:!0}}),Object.defineProperties(ue.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),o(ue.from,"from"),o(ue.prototype.cancel,"cancel"),o(ue.prototype.getReader,"getReader"),o(ue.prototype.pipeThrough,"pipeThrough"),o(ue.prototype.pipeTo,"pipeTo"),o(ue.prototype.tee,"tee"),o(ue.prototype.values,"values"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ue.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(ue.prototype,Ii,{value:ue.prototype.values,writable:!0,configurable:!0});function us(s,i,a,c=1,f=()=>1){let g=Object.create(ue.prototype);eo(g);let b=Object.create(ht.prototype);return vl(g,b,s,i,a,c,f),g}function Tl(s,i,a){let c=Object.create(ue.prototype);eo(c);let f=Object.create(lt.prototype);return Ku(c,f,s,i,a,0,void 0),c}function eo(s){s._state="readable",s._reader=void 0,s._storedError=void 0,s._disturbed=!1}function It(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_readableStreamController")?!1:s instanceof ue}function qt(s){return s._reader!==void 0}function He(s,i){if(s._disturbed=!0,s._state==="closed")return m(void 0);if(s._state==="errored")return p(s._storedError);ls(s);let a=s._reader;if(a!==void 0&&Yt(a)){let f=a._readIntoRequests;a._readIntoRequests=new N,f.forEach(g=>{g._closeSteps(void 0)})}let c=s._readableStreamController[Ke](i);return D(c,e)}function ls(s){s._state="closed";let i=s._reader;if(i!==void 0&&(Ns(i),kt(i))){let a=i._readRequests;i._readRequests=new N,a.forEach(c=>{c._closeSteps()})}}function Rl(s,i){s._state="errored",s._storedError=i;let a=s._reader;a!==void 0&&(Zr(a,i),kt(a)?Au(a,i):rl(a,i))}function Zt(s){return new TypeError(`ReadableStream.prototype.${s} can only be used on a ReadableStream`)}function Cl(s,i){Ie(s,i);let a=s?.highWaterMark;return Xr(a,"highWaterMark","QueuingStrategyInit"),{highWaterMark:pe(a)}}let xl=s=>s.byteLength;o(xl,"size");class dn{constructor(i){We(i,1,"ByteLengthQueuingStrategy"),i=Cl(i,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=i.highWaterMark}get highWaterMark(){if(!Pl(this))throw kl("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Pl(this))throw kl("size");return xl}}Object.defineProperties(dn.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(dn.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function kl(s){return new TypeError(`ByteLengthQueuingStrategy.prototype.${s} can only be used on a ByteLengthQueuingStrategy`)}function Pl(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_byteLengthQueuingStrategyHighWaterMark")?!1:s instanceof dn}let El=()=>1;o(El,"size");class fn{constructor(i){We(i,1,"CountQueuingStrategy"),i=Cl(i,"First parameter"),this._countQueuingStrategyHighWaterMark=i.highWaterMark}get highWaterMark(){if(!Ol(this))throw Al("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Ol(this))throw Al("size");return El}}Object.defineProperties(fn.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(fn.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Al(s){return new TypeError(`CountQueuingStrategy.prototype.${s} can only be used on a CountQueuingStrategy`)}function Ol(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_countQueuingStrategyHighWaterMark")?!1:s instanceof fn}function Gy(s,i){Ie(s,i);let a=s?.cancel,c=s?.flush,f=s?.readableType,g=s?.start,b=s?.transform,C=s?.writableType;return{cancel:a===void 0?void 0:Jy(a,s,`${i} has member 'cancel' that`),flush:c===void 0?void 0:Vy(c,s,`${i} has member 'flush' that`),readableType:f,start:g===void 0?void 0:Yy(g,s,`${i} has member 'start' that`),transform:b===void 0?void 0:Qy(b,s,`${i} has member 'transform' that`),writableType:C}}function Vy(s,i,a){return me(s,a),c=>J(s,i,[c])}function Yy(s,i,a){return me(s,a),c=>j(s,i,[c])}function Qy(s,i,a){return me(s,a),(c,f)=>J(s,i,[c,f])}function Jy(s,i,a){return me(s,a),c=>J(s,i,[c])}class mn{constructor(i={},a={},c={}){i===void 0&&(i=null);let f=en(a,"Second parameter"),g=en(c,"Third parameter"),b=Gy(i,"First parameter");if(b.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(b.writableType!==void 0)throw new RangeError("Invalid writableType specified");let C=ns(g,0),I=Xs(g),E=ns(f,1),B=Xs(f),F,H=d(Ge=>{F=Ge});Ky(this,H,E,B,C,I),Xy(this,b),b.start!==void 0?F(b.start(this._transformStreamController)):F(void 0)}get readable(){if(!Il(this))throw Bl("readable");return this._readable}get writable(){if(!Il(this))throw Bl("writable");return this._writable}}Object.defineProperties(mn.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(mn.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function Ky(s,i,a,c,f,g){function b(){return i}function C(H){return r_(s,H)}function I(H){return s_(s,H)}function E(){return n_(s)}s._writable=ty(b,C,E,I,a,c);function B(){return i_(s)}function F(H){return o_(s,H)}s._readable=us(b,B,F,f,g),s._backpressure=void 0,s._backpressureChangePromise=void 0,s._backpressureChangePromise_resolve=void 0,pn(s,!0),s._transformStreamController=void 0}function Il(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_transformStreamController")?!1:s instanceof mn}function ql(s,i){ze(s._readable._readableStreamController,i),to(s,i)}function to(s,i){bn(s._transformStreamController),is(s._writable._writableStreamController,i),ro(s)}function ro(s){s._backpressure&&pn(s,!1)}function pn(s,i){s._backpressureChangePromise!==void 0&&s._backpressureChangePromise_resolve(),s._backpressureChangePromise=d(a=>{s._backpressureChangePromise_resolve=a}),s._backpressure=i}class Dt{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!gn(this))throw yn("desiredSize");let i=this._controlledTransformStream._readable._readableStreamController;return Xi(i)}enqueue(i=void 0){if(!gn(this))throw yn("enqueue");Dl(this,i)}error(i=void 0){if(!gn(this))throw yn("error");e_(this,i)}terminate(){if(!gn(this))throw yn("terminate");t_(this)}}Object.defineProperties(Dt.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),o(Dt.prototype.enqueue,"enqueue"),o(Dt.prototype.error,"error"),o(Dt.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Dt.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function gn(s){return!r(s)||!Object.prototype.hasOwnProperty.call(s,"_controlledTransformStream")?!1:s instanceof Dt}function Zy(s,i,a,c,f){i._controlledTransformStream=s,s._transformStreamController=i,i._transformAlgorithm=a,i._flushAlgorithm=c,i._cancelAlgorithm=f,i._finishPromise=void 0,i._finishPromise_resolve=void 0,i._finishPromise_reject=void 0}function Xy(s,i){let a=Object.create(Dt.prototype),c,f,g;i.transform!==void 0?c=b=>i.transform(b,a):c=b=>{try{return Dl(a,b),m(void 0)}catch(C){return p(C)}},i.flush!==void 0?f=()=>i.flush(a):f=()=>m(void 0),i.cancel!==void 0?g=b=>i.cancel(b):g=()=>m(void 0),Zy(s,a,c,f,g)}function bn(s){s._transformAlgorithm=void 0,s._flushAlgorithm=void 0,s._cancelAlgorithm=void 0}function Dl(s,i){let a=s._controlledTransformStream,c=a._readable._readableStreamController;if(!vr(c))throw new TypeError("Readable side is not in a state that permits enqueue");try{wr(c,i)}catch(g){throw to(a,g),a._readable._storedError}Ey(c)!==a._backpressure&&pn(a,!0)}function e_(s,i){ql(s._controlledTransformStream,i)}function Ml(s,i){let a=s._transformAlgorithm(i);return D(a,void 0,c=>{throw ql(s._controlledTransformStream,c),c})}function t_(s){let i=s._controlledTransformStream,a=i._readable._readableStreamController;Kt(a);let c=new TypeError("TransformStream terminated");to(i,c)}function r_(s,i){let a=s._transformStreamController;if(s._backpressure){let c=s._backpressureChangePromise;return D(c,()=>{let f=s._writable;if(f._state==="erroring")throw f._storedError;return Ml(a,i)})}return Ml(a,i)}function s_(s,i){let a=s._transformStreamController;if(a._finishPromise!==void 0)return a._finishPromise;let c=s._readable;a._finishPromise=d((g,b)=>{a._finishPromise_resolve=g,a._finishPromise_reject=b});let f=a._cancelAlgorithm(i);return bn(a),_(f,()=>(c._state==="errored"?Sr(a,c._storedError):(ze(c._readableStreamController,i),so(a)),null),g=>(ze(c._readableStreamController,g),Sr(a,g),null)),a._finishPromise}function n_(s){let i=s._transformStreamController;if(i._finishPromise!==void 0)return i._finishPromise;let a=s._readable;i._finishPromise=d((f,g)=>{i._finishPromise_resolve=f,i._finishPromise_reject=g});let c=i._flushAlgorithm();return bn(i),_(c,()=>(a._state==="errored"?Sr(i,a._storedError):(Kt(a._readableStreamController),so(i)),null),f=>(ze(a._readableStreamController,f),Sr(i,f),null)),i._finishPromise}function i_(s){return pn(s,!1),s._backpressureChangePromise}function o_(s,i){let a=s._transformStreamController;if(a._finishPromise!==void 0)return a._finishPromise;let c=s._writable;a._finishPromise=d((g,b)=>{a._finishPromise_resolve=g,a._finishPromise_reject=b});let f=a._cancelAlgorithm(i);return bn(a),_(f,()=>(c._state==="errored"?Sr(a,c._storedError):(is(c._writableStreamController,i),ro(s),so(a)),null),g=>(is(c._writableStreamController,g),ro(s),Sr(a,g),null)),a._finishPromise}function yn(s){return new TypeError(`TransformStreamDefaultController.prototype.${s} can only be used on a TransformStreamDefaultController`)}function so(s){s._finishPromise_resolve!==void 0&&(s._finishPromise_resolve(),s._finishPromise_resolve=void 0,s._finishPromise_reject=void 0)}function Sr(s,i){s._finishPromise_reject!==void 0&&(k(s._finishPromise),s._finishPromise_reject(i),s._finishPromise_resolve=void 0,s._finishPromise_reject=void 0)}function Bl(s){return new TypeError(`TransformStream.prototype.${s} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=dn,t.CountQueuingStrategy=fn,t.ReadableByteStreamController=lt,t.ReadableStream=ue,t.ReadableStreamBYOBReader=At,t.ReadableStreamBYOBRequest=Ht,t.ReadableStreamDefaultController=ht,t.ReadableStreamDefaultReader=xt,t.TransformStream=mn,t.TransformStreamDefaultController=Dt,t.WritableStream=Ot,t.WritableStreamDefaultController=_r,t.WritableStreamDefaultWriter=ct}))});var qg=S(()=>{"use strict";if(!globalThis.ReadableStream)try{let t=require("process"),{emitWarning:e}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,require("stream/web")),t.emitWarning=e}catch(r){throw t.emitWarning=e,r}}catch{Object.assign(globalThis,Ig())}try{let{Blob:t}=require("buffer");t&&!t.prototype.stream&&(t.prototype.stream=function(r){let n=0,o=this;return new ReadableStream({type:"bytes",async pull(u){let h=await o.slice(n,Math.min(o.size,n+65536)).arrayBuffer();n+=h.byteLength,u.enqueue(new Uint8Array(h)),n===o.size&&u.close()}})})}catch{}});async function*yu(t,e=!0){for(let r of t)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(e){let n=r.byteOffset,o=r.byteOffset+r.byteLength;for(;n!==o;){let u=Math.min(o-n,Dg),l=r.buffer.slice(n,n+u);n+=l.byteLength,yield new Uint8Array(l)}}else yield r;else{let n=0,o=r;for(;n!==o.size;){let l=await o.slice(n,Math.min(o.size,n+Dg)).arrayBuffer();n+=l.byteLength,yield new Uint8Array(l)}}}var KP,Dg,Mg,qC,St,Os=cs(()=>{"use strict";KP=ie(qg(),1);Dg=65536;Mg=class _u{#e=[];#t="";#r=0;#s="transparent";constructor(e=[],r={}){if(typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof e[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&typeof r!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");r===null&&(r={});let n=new TextEncoder;for(let u of e){let l;ArrayBuffer.isView(u)?l=new Uint8Array(u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength)):u instanceof ArrayBuffer?l=new Uint8Array(u.slice(0)):u instanceof _u?l=u:l=n.encode(`${u}`),this.#r+=ArrayBuffer.isView(l)?l.byteLength:l.size,this.#e.push(l)}this.#s=`${r.endings===void 0?"transparent":r.endings}`;let o=r.type===void 0?"":String(r.type);this.#t=/^[\x20-\x7E]*$/.test(o)?o:""}get size(){return this.#r}get type(){return this.#t}async text(){let e=new TextDecoder,r="";for await(let n of yu(this.#e,!1))r+=e.decode(n,{stream:!0});return r+=e.decode(),r}async arrayBuffer(){let e=new Uint8Array(this.size),r=0;for await(let n of yu(this.#e,!1))e.set(n,r),r+=n.length;return e.buffer}stream(){let e=yu(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let n=await e.next();n.done?r.close():r.enqueue(n.value)},async cancel(){await e.return()}})}slice(e=0,r=this.size,n=""){let{size:o}=this,u=e<0?Math.max(o+e,0):Math.min(e,o),l=r<0?Math.max(o+r,0):Math.min(r,o),h=Math.max(l-u,0),d=this.#e,m=[],p=0;for(let _ of d){if(p>=h)break;let R=ArrayBuffer.isView(_)?_.byteLength:_.size;if(u&&R<=u)u-=R,l-=R;else{let y;ArrayBuffer.isView(_)?(y=_.subarray(u,Math.min(R,l)),p+=y.byteLength):(y=_.slice(u,Math.min(R,l)),p+=y.size),l-=R,m.push(y),u=0}}let w=new _u([],{type:String(n).toLowerCase()});return w.#r=h,w.#e=m,w}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&typeof e=="object"&&typeof e.constructor=="function"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}};Object.defineProperties(Mg.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});qC=Mg,St=qC});var DC,MC,Hr,wu=cs(()=>{"use strict";Os();DC=class extends St{#e=0;#t="";constructor(e,r,n={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(e,n),n===null&&(n={});let o=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(o)||(this.#e=o),this.#t=String(r)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](e){return!!e&&e instanceof St&&/^(File)$/.test(e[Symbol.toStringTag])}},MC=DC,Hr=MC});function $g(t,e=St){var r=`${Bg()}${Bg()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),n=[],o=`--${r}\r
103
+ Content-Disposition: form-data; name="`;return t.forEach((u,l)=>typeof u=="string"?n.push(o+vu(l)+`"\r
104
104
  \r
105
- ${a.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
105
+ ${u.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
106
106
  `)}\r
107
- `):n.push(o+Du(l)+`"; filename="${Du(a.name,1)}"\r
108
- Content-Type: ${a.type||"application/octet-stream"}\r
107
+ `):n.push(o+vu(l)+`"; filename="${vu(u.name,1)}"\r
108
+ Content-Type: ${u.type||"application/octet-stream"}\r
109
109
  \r
110
- `,a,`\r
111
- `)),n.push(`--${r}--`),new e(n,{type:"multipart/form-data; boundary="+r})}var Bs,DC,FC,eb,BC,tb,Du,fr,mr,Si=ps(()=>{"use strict";Fs();Mu();({toStringTag:Bs,iterator:DC,hasInstance:FC}=Symbol),eb=Math.random,BC="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),tb=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[Bs])?[(r=r!==void 0?r+"":e[Bs]=="File"?e.name:"blob",t),e.name!==r||e[Bs]=="blob"?new Gr([e],r,e):e]:[t,e+""]),Du=(t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
112
- `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),fr=(t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},mr=class{#e=[];constructor(...e){if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Bs](){return"FormData"}[DC](){return this.entries()}static[FC](e){return e&&typeof e=="object"&&e[Bs]==="FormData"&&!BC.some(r=>typeof e[r]!="function")}append(...e){fr("append",arguments,2),this.#e.push(tb(...e))}delete(e){fr("delete",arguments,1),e+="",this.#e=this.#e.filter(([r])=>r!==e)}get(e){fr("get",arguments,1),e+="";for(var r=this.#e,n=r.length,o=0;o<n;o++)if(r[o][0]===e)return r[o][1];return null}getAll(e,r){return fr("getAll",arguments,1),r=[],e+="",this.#e.forEach(n=>n[0]===e&&r.push(n[1])),r}has(e){return fr("has",arguments,1),e+="",this.#e.some(r=>r[0]===e)}forEach(e,r){fr("forEach",arguments,1);for(var[n,o]of this)e.call(r,o,n,this)}set(...e){fr("set",arguments,2);var r=[],n=!0;e=tb(...e),this.#e.forEach(o=>{o[0]===e[0]?n&&(n=!r.push(e)):r.push(o)}),n&&r.push(e),this.#e=r}*entries(){yield*this.#e}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}}});var ab=S((ZA,ob)=>{"use strict";if(!globalThis.DOMException)try{let{MessageChannel:t}=require("worker_threads"),e=new t().port1,r=new ArrayBuffer;e.postMessage(r,[r,r])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}ob.exports=globalThis.DOMException});var Ri,$C,jC,tO,Bu=ps(()=>{"use strict";Ri=require("fs"),$C=require("path"),jC=B(ab(),1);Mu();Fs();({stat:tO}=Ri.promises)});var lb={};D_(lb,{toFormData:()=>GC});function HC(t){let e=t.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!e)return;let r=e[2]||e[3]||"",n=r.slice(r.lastIndexOf("\\")+1);return n=n.replace(/%22/g,'"'),n=n.replace(/&#(\d{4});/g,(o,a)=>String.fromCharCode(a)),n}async function GC(t,e){if(!/multipart/i.test(e))throw new TypeError("Failed to fetch");let r=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw new TypeError("no or bad content-type header, no multipart boundary");let n=new $u(r[1]||r[2]),o,a,l,h,d,f,p=[],w=new mr,_=E=>{l+=k.decode(E,{stream:!0})},T=E=>{p.push(E)},y=()=>{let E=new Gr(p,f,{type:d});w.append(h,E)},M=()=>{w.append(h,l)},k=new TextDecoder("utf-8");k.decode(),n.onPartBegin=function(){n.onPartData=_,n.onPartEnd=M,o="",a="",l="",h="",d="",f=null,p.length=0},n.onHeaderField=function(E){o+=k.decode(E,{stream:!0})},n.onHeaderValue=function(E){a+=k.decode(E,{stream:!0})},n.onHeaderEnd=function(){if(a+=k.decode(),o=o.toLowerCase(),o==="content-disposition"){let E=a.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);E&&(h=E[2]||E[3]||""),f=HC(a),f&&(n.onPartData=T,n.onPartEnd=y)}else o==="content-type"&&(d=a);a="",o=""};for await(let E of t)n.write(E);return n.end(),w}var ht,J,ub,Yt,xi,Ci,LC,js,NC,UC,WC,zC,pr,$u,cb=ps(()=>{"use strict";Bu();Si();ht=0,J={START_BOUNDARY:ht++,HEADER_FIELD_START:ht++,HEADER_FIELD:ht++,HEADER_VALUE_START:ht++,HEADER_VALUE:ht++,HEADER_VALUE_ALMOST_DONE:ht++,HEADERS_ALMOST_DONE:ht++,PART_DATA_START:ht++,PART_DATA:ht++,END:ht++},ub=1,Yt={PART_BOUNDARY:ub,LAST_BOUNDARY:ub*=2},xi=10,Ci=13,LC=32,js=45,NC=58,UC=97,WC=122,zC=t=>t|32,pr=()=>{},$u=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=pr,this.onHeaderField=pr,this.onHeadersEnd=pr,this.onHeaderValue=pr,this.onPartBegin=pr,this.onPartData=pr,this.onPartEnd=pr,this.boundaryChars={},e=`\r
113
- --`+e;let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n),this.boundaryChars[r[n]]=!0;this.boundary=r,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=J.START_BOUNDARY}write(e){let r=0,n=e.length,o=this.index,{lookbehind:a,boundary:l,boundaryChars:h,index:d,state:f,flags:p}=this,w=this.boundary.length,_=w-1,T=e.length,y,M,k=j=>{this[j+"Mark"]=r},E=j=>{delete this[j+"Mark"]},L=(j,U,z,De)=>{(U===void 0||U!==z)&&this[j](De&&De.subarray(U,z))},K=(j,U)=>{let z=j+"Mark";z in this&&(U?(L(j,this[z],r,e),delete this[z]):(L(j,this[z],e.length,e),this[z]=0))};for(r=0;r<n;r++)switch(y=e[r],f){case J.START_BOUNDARY:if(d===l.length-2){if(y===js)p|=Yt.LAST_BOUNDARY;else if(y!==Ci)return;d++;break}else if(d-1===l.length-2){if(p&Yt.LAST_BOUNDARY&&y===js)f=J.END,p=0;else if(!(p&Yt.LAST_BOUNDARY)&&y===xi)d=0,L("onPartBegin"),f=J.HEADER_FIELD_START;else return;break}y!==l[d+2]&&(d=-2),y===l[d+2]&&d++;break;case J.HEADER_FIELD_START:f=J.HEADER_FIELD,k("onHeaderField"),d=0;case J.HEADER_FIELD:if(y===Ci){E("onHeaderField"),f=J.HEADERS_ALMOST_DONE;break}if(d++,y===js)break;if(y===NC){if(d===1)return;K("onHeaderField",!0),f=J.HEADER_VALUE_START;break}if(M=zC(y),M<UC||M>WC)return;break;case J.HEADER_VALUE_START:if(y===LC)break;k("onHeaderValue"),f=J.HEADER_VALUE;case J.HEADER_VALUE:y===Ci&&(K("onHeaderValue",!0),L("onHeaderEnd"),f=J.HEADER_VALUE_ALMOST_DONE);break;case J.HEADER_VALUE_ALMOST_DONE:if(y!==xi)return;f=J.HEADER_FIELD_START;break;case J.HEADERS_ALMOST_DONE:if(y!==xi)return;L("onHeadersEnd"),f=J.PART_DATA_START;break;case J.PART_DATA_START:f=J.PART_DATA,k("onPartData");case J.PART_DATA:if(o=d,d===0){for(r+=_;r<T&&!(e[r]in h);)r+=w;r-=_,y=e[r]}if(d<l.length)l[d]===y?(d===0&&K("onPartData",!0),d++):d=0;else if(d===l.length)d++,y===Ci?p|=Yt.PART_BOUNDARY:y===js?p|=Yt.LAST_BOUNDARY:d=0;else if(d-1===l.length)if(p&Yt.PART_BOUNDARY){if(d=0,y===xi){p&=~Yt.PART_BOUNDARY,L("onPartEnd"),L("onPartBegin"),f=J.HEADER_FIELD_START;break}}else p&Yt.LAST_BOUNDARY&&y===js?(L("onPartEnd"),f=J.END,p=0):d=0;if(d>0)a[d-1]=y;else if(o>0){let j=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);L("onPartData",0,o,j),o=0,k("onPartData"),r--}break;case J.END:break;default:throw new Error(`Unexpected state entered: ${f}`)}K("onHeaderField"),K("onHeaderValue"),K("onPartData"),this.index=d,this.state=f,this.flags=p}end(){if(this.state===J.HEADER_FIELD_START&&this.index===0||this.state===J.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==J.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var Wy=B(Ct());var Ws=B(Ma());var Im=require("buffer"),ui=B(Zf(),1),ii=B($a(),1),Sp=require("child_process"),ig=B(La(),1),gg=require("path"),Lr=B(La(),1),qg=require("events"),au=Object.defineProperty,yR=Object.getOwnPropertyDescriptor,uu=Object.getOwnPropertyNames,wR=Object.prototype.hasOwnProperty,R=(t,e)=>function(){return t&&(e=(0,t[uu(t)[0]])(t=0)),e},_R=(t,e)=>function(){return e||(0,t[uu(t)[0]])((e={exports:{}}).exports,e),e.exports},se=(t,e)=>{for(var r in e)au(t,r,{get:e[r],enumerable:!0})},vR=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of uu(e))!wR.call(t,o)&&o!==r&&au(t,o,{get:()=>e[o],enumerable:!(n=yR(e,o))||n.enumerable});return t},ee=t=>vR(au({},"__esModule",{value:!0}),t);function SR(...t){let e=new String(t);return ai.set(e,t),e}function ri(t){return t instanceof String&&ai.has(t)}function Xf(t){return ai.get(t)||[]}var ai,As=R({"src/lib/args/pathspec.ts"(){"use strict";ai=new WeakMap}}),Et,Vt=R({"src/lib/errors/git-error.ts"(){"use strict";Et=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),Os,Ur=R({"src/lib/errors/git-response-error.ts"(){"use strict";Vt(),Os=class extends Et{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),Am,Om=R({"src/lib/errors/task-configuration-error.ts"(){"use strict";Vt(),Am=class extends Et{constructor(t){super(void 0,t)}}}});function qm(t){return typeof t!="function"?hr:t}function Mm(t){return typeof t=="function"&&t!==hr}function Dm(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function Fm(t,e=0){return Bm(t)&&t.length>e?t[e]:void 0}function cr(t,e=0){if(Bm(t)&&t.length>e)return t[t.length-1-e]}function Bm(t){return di(t)}function Is(t="",e=!0,r=`
114
- `){return t.split(r).reduce((n,o)=>{let a=e?o.trim():o;return a&&n.push(a),n},[])}function lu(t,e){return Is(t,!0).map(r=>e(r))}function cu(t){return(0,ui.exists)(t,ui.FOLDER)}function Ne(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function $m(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function li(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function ct(t){return Array.isArray(t)?t:[t]}function jm(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function Wr(t){return ct(t).map(e=>e instanceof String?e:String(e))}function Q(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function Es(t,e){let r=[];for(let n=0,o=t.length;n<o;n++)r.push(e,t[n]);return r}function Ps(t){return(Array.isArray(t)?Im.Buffer.concat(t):t).toString("utf-8")}function Lm(t,e){let r={};return e.forEach(n=>{t[n]!==void 0&&(r[n]=t[n])}),r}function Va(t=0){return new Promise(e=>setTimeout(e,t))}function Ya(t){if(t!==!1)return t}var Nr,hr,qs,ci=R({"src/lib/utils/util.ts"(){"use strict";hu(),Nr="\0",hr=()=>{},qs=Object.prototype.toString.call.bind(Object.prototype.toString)}});function Ae(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function Qa(t,e){let r=ri(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function hi(t){return!!t&&qs(t)==="[object Object]"}function Nm(t){return typeof t=="function"}var Ms,Um,ae,si,di,hu=R({"src/lib/utils/argument-filters.ts"(){"use strict";As(),ci(),Ms=t=>Array.isArray(t),Um=t=>typeof t=="number",ae=t=>typeof t=="string",si=t=>ae(t)||Array.isArray(t)&&t.every(ae),di=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),Ja,TR=R({"src/lib/utils/exit-codes.ts"(){"use strict";Ja=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Ja||{})}}),ni,RR=R({"src/lib/utils/git-output-streams.ts"(){"use strict";ni=class Wm{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new Wm(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function xR(){throw new Error("LineParser:useMatches not implemented")}var D,Gt,CR=R({"src/lib/utils/line-parser.ts"(){"use strict";D=class{constructor(t,e){this.matches=[],this.useMatches=xR,this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((o,a)=>this.addMatch(o,a,r(a)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},Gt=class extends D{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function zm(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...Hm},...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var Hm,kR=R({"src/lib/utils/simple-git-options.ts"(){"use strict";Hm={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function du(t,e=[]){return hi(t)?Object.keys(t).reduce((r,n)=>{let o=t[n];if(ri(o))r.push(o);else if(Qa(o,["boolean"]))r.push(n+"="+o);else if(Array.isArray(o))for(let a of o)Qa(a,["string","number"])||r.push(n+"="+a);else r.push(n);return r},e):e}function _e(t,e=0,r=!1){let n=[];for(let o=0,a=e<0?t.length:e;o<a;o++)"string|number".includes(typeof t[o])&&n.push(String(t[o]));return du(fu(t),n),r||n.push(...ER(t)),n}function ER(t){let e=typeof cr(t)=="function";return Wr(Ae(cr(t,e?1:0),Ms,[]))}function fu(t){let e=Nm(cr(t));return Ae(cr(t,e?1:0),hi)}function te(t,e=!0){let r=qm(cr(t));return e||Mm(r)?r:void 0}var PR=R({"src/lib/utils/task-options.ts"(){"use strict";hu(),ci(),As()}});function Ka(t,e){return t(e.stdOut,e.stdErr)}function Se(t,e,r,n=!0){return ct(r).forEach(o=>{for(let a=Is(o,n),l=0,h=a.length;l<h;l++){let d=(f=0)=>{if(!(l+f>=h))return a[l+f]};e.some(({parse:f})=>f(d,t))}}),t}var AR=R({"src/lib/utils/task-parser.ts"(){"use strict";ci()}}),Gm={};se(Gm,{ExitCodes:()=>Ja,GitOutputStreams:()=>ni,LineParser:()=>D,NOOP:()=>hr,NULL:()=>Nr,RemoteLineParser:()=>Gt,append:()=>Ne,appendTaskOptions:()=>du,asArray:()=>ct,asCamelCase:()=>jm,asFunction:()=>qm,asNumber:()=>Q,asStringArray:()=>Wr,bufferToString:()=>Ps,callTaskParser:()=>Ka,createInstanceConfig:()=>zm,delay:()=>Va,filterArray:()=>Ms,filterFunction:()=>Nm,filterHasLength:()=>di,filterNumber:()=>Um,filterPlainObject:()=>hi,filterPrimitives:()=>Qa,filterString:()=>ae,filterStringOrStringArray:()=>si,filterType:()=>Ae,first:()=>Fm,folderExists:()=>cu,forEachLineWithContent:()=>lu,getTrailingOptions:()=>_e,including:()=>$m,isUserFunction:()=>Mm,last:()=>cr,objectToString:()=>qs,orVoid:()=>Ya,parseStringResponse:()=>Se,pick:()=>Lm,prefixedArray:()=>Es,remove:()=>li,splitOn:()=>Dm,toLinesWithContent:()=>Is,trailingFunctionArgument:()=>te,trailingOptionsArgument:()=>fu});var q=R({"src/lib/utils/index.ts"(){"use strict";hu(),TR(),RR(),CR(),kR(),PR(),AR(),ci()}}),Vm={};se(Vm,{CheckRepoActions:()=>Za,checkIsBareRepoTask:()=>Qm,checkIsRepoRootTask:()=>Ym,checkIsRepoTask:()=>OR});function OR(t){switch(t){case"bare":return Qm();case"root":return Ym()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:fi,parser:mu}}function Ym(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:fi,parser(e){return/^\.(git)?$/.test(e.trim())}}}function Qm(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:fi,parser:mu}}function IR(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var Za,fi,mu,Jm=R({"src/lib/tasks/check-is-repo.ts"(){"use strict";q(),Za=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(Za||{}),fi=({exitCode:t},e,r,n)=>{if(t===128&&IR(e))return r(Buffer.from("false"));n(e)},mu=t=>t.trim()==="true"}});function qR(t,e){let r=new Km(t),n=t?Xm:Zm;return Is(e).forEach(o=>{let a=o.replace(n,"");r.paths.push(a),(ep.test(a)?r.folders:r.files).push(a)}),r}var Km,Zm,Xm,ep,MR=R({"src/lib/responses/CleanSummary.ts"(){"use strict";q(),Km=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},Zm=/^[a-z]+\s*/i,Xm=/^[a-z]+\s+[a-z]+\s*/i,ep=/\/$/}}),Xa={};se(Xa,{EMPTY_COMMANDS:()=>mi,adhocExecTask:()=>tp,configurationErrorTask:()=>ve,isBufferTask:()=>sp,isEmptyTask:()=>np,straightThroughBufferTask:()=>rp,straightThroughStringTask:()=>de});function tp(t){return{commands:mi,format:"empty",parser:t}}function ve(t){return{commands:mi,format:"empty",parser(){throw typeof t=="string"?new Am(t):t}}}function de(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function rp(t){return{commands:t,format:"buffer",parser(e){return e}}}function sp(t){return t.format==="buffer"}function np(t){return t.format==="empty"||!t.commands.length}var mi,re=R({"src/lib/tasks/task.ts"(){"use strict";Om(),mi=[]}}),ip={};se(ip,{CONFIG_ERROR_INTERACTIVE_MODE:()=>pu,CONFIG_ERROR_MODE_REQUIRED:()=>gu,CONFIG_ERROR_UNKNOWN_OPTION:()=>bu,CleanOptions:()=>Zn,cleanTask:()=>op,cleanWithOptionsTask:()=>DR,isCleanOptionsArray:()=>FR});function DR(t,e){let{cleanMode:r,options:n,valid:o}=BR(t);return r?o.options?(n.push(...e),n.some(LR)?ve(pu):op(r,n)):ve(bu+JSON.stringify(t)):ve(gu)}function op(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(n){return qR(t==="n",n)}}}function FR(t){return Array.isArray(t)&&t.every(e=>yu.has(e))}function BR(t){let e,r=[],n={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(o=>{$R(o)?(e=o,n.cleanMode=!0):n.options=n.options&&jR(r[r.length]=`-${o}`)}),{cleanMode:e,options:r,valid:n}}function $R(t){return t==="f"||t==="n"}function jR(t){return/^-[a-z]$/i.test(t)&&yu.has(t.charAt(1))}function LR(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var pu,gu,bu,Zn,yu,ap=R({"src/lib/tasks/clean.ts"(){"use strict";MR(),q(),re(),pu="Git clean interactive mode is not supported",gu='Git clean mode parameter ("n" or "f") is required',bu="Git clean unknown option found in: ",Zn=(t=>(t.DRY_RUN="n",t.FORCE="f",t.IGNORED_INCLUDED="x",t.IGNORED_ONLY="X",t.EXCLUDING="e",t.QUIET="q",t.RECURSIVE="d",t))(Zn||{}),yu=new Set(["i",...Wr(Object.values(Zn))])}});function NR(t){let e=new lp;for(let r of up(t))e.addValue(r.file,String(r.key),r.value);return e}function UR(t,e){let r=null,n=[],o=new Map;for(let a of up(t,e))a.key===e&&(n.push(r=a.value),o.has(a.file)||o.set(a.file,[]),o.get(a.file).push(r));return{key:e,paths:Array.from(o.keys()),scopes:o,value:r,values:n}}function WR(t){return t.replace(/^(file):/,"")}function*up(t,e=null){let r=t.split("\0");for(let n=0,o=r.length-1;n<o;){let a=WR(r[n++]),l=r[n++],h=e;if(l.includes(`
115
- `)){let d=Dm(l,`
116
- `);h=d[0],l=d[1]}yield{file:a,key:h,value:l}}}var lp,zR=R({"src/lib/responses/ConfigList.ts"(){"use strict";q(),lp=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=cr(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);Object.hasOwn(n,e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function Na(t,e){return typeof t=="string"&&Object.hasOwn(eu,t)?t:e}function HR(t,e,r,n){let o=["config",`--${n}`];return r&&o.push("--add"),o.push(t,e),{commands:o,format:"utf-8",parser(a){return a}}}function GR(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return UR(n,t)}}}function VR(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return NR(r)}}}function YR(){return{addConfig(t,e,...r){return this._runTask(HR(t,e,r[0]===!0,Na(r[1],"local")),te(arguments))},getConfig(t,e){return this._runTask(GR(t,Na(e,void 0)),te(arguments))},listConfig(...t){return this._runTask(VR(Na(t[0],void 0)),te(arguments))}}}var eu,cp=R({"src/lib/tasks/config.ts"(){"use strict";zR(),q(),eu=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(eu||{})}});function QR(t){return hp.has(t)}var Ua,hp,dp=R({"src/lib/tasks/diff-name-status.ts"(){"use strict";Ua=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(Ua||{}),hp=new Set(Object.values(Ua))}});function JR(...t){return new mp().param(...t)}function KR(t){let e=new Set,r={};return lu(t,n=>{let[o,a,l]=n.split(Nr);e.add(o),(r[o]=r[o]||[]).push({line:Q(a),path:o,preview:l})}),{paths:e,results:r}}function ZR(){return{grep(t){let e=te(arguments),r=_e(arguments);for(let o of fp)if(r.includes(o))return this._runTask(ve(`git.grep: use of "${o}" is not supported.`),e);typeof t=="string"&&(t=JR().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(o){return KR(o)}},e)}}}var fp,ks,em,mp,pp=R({"src/lib/tasks/grep.ts"(){"use strict";q(),re(),fp=["-h"],ks=Symbol("grepQuery"),mp=class{constructor(){this[em]=[]}*[(em=ks,Symbol.iterator)](){for(let t of this[ks])yield t}and(...t){return t.length&&this[ks].push("--and","(",...Es(t,"-e"),")"),this}param(...t){return this[ks].push(...Es(t,"-e")),this}}}}),gp={};se(gp,{ResetMode:()=>Xn,getResetMode:()=>e0,resetTask:()=>XR});function XR(t,e){let r=["reset"];return bp(t)&&r.push(`--${t}`),r.push(...e),de(r)}function e0(t){if(bp(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function bp(t){return typeof t=="string"&&yp.includes(t)}var Xn,yp,wp=R({"src/lib/tasks/reset.ts"(){"use strict";q(),re(),Xn=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Xn||{}),yp=Wr(Object.values(Xn))}});function t0(){return(0,ii.default)("simple-git")}function tm(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...o)=>{t(n,...o),r(n,...o)}:t:(n,...o)=>{t(`%s ${n}`,e,...o),r&&r(n,...o)}}function r0(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function wu(t,e,r,n=t0()){let o=t&&`[${t}]`||"",a=[],l=typeof e=="string"?n.extend(e):e,h=r0(Ae(e,ae),l,n);return f(r);function d(p,w){return Ne(a,wu(t,h.replace(/^[^:]+/,p),w,n))}function f(p){let w=p&&`[${p}]`||"",_=l&&tm(l,w)||hr,T=tm(n,`${o} ${w}`,_);return Object.assign(l?_:T,{label:t,sibling:d,info:T,step:f})}}var _p=R({"src/lib/git-logger.ts"(){"use strict";q(),ii.default.formatters.L=t=>String(di(t)?t.length:"-"),ii.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):qs(t)}}),vp,s0=R({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";Vt(),_p(),vp=class tu{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){let r=tu.getName(e.commands[0]),n=wu(this.logLabel,r);return{task:e,logger:n,name:r}}push(e){let r=this.createProgress(e);return r.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,r),r}fatal(e){for(let[r,{logger:n}]of Array.from(this._queue.entries()))r===e.task?(n.info("Failed %o",e),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",e.message),this.complete(r);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let r=this.withProgress(e);if(!r)throw new Et(void 0,"TasksPendingQueue: attempt called for an unknown task");return r.logger("Starting task"),r}static getName(e="empty"){return`task:${e}:${++tu.counter}`}static{this.counter=0}}}});function lr(t,e){return{method:Fm(t.commands)||"",commands:e}}function n0(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}function rm(t,e,r,n){return o=>{r("%s received %L bytes",e,o),n("%B",o),t.push(o)}}var ru,i0=R({"src/lib/runners/git-executor-chain.ts"(){"use strict";Vt(),re(),q(),s0(),ru=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new vp}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}async attemptTask(t){let e=await this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:n}=this._queue.attempt(t);return await(np(t)?this.attemptEmptyTask(t,n):this.attemptRemoteTask(t,n))}catch(n){throw this.onFatalException(t,n)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof Et?Object.assign(e,{task:t}):new Et(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(t,e){let r=this._plugins.exec("spawn.binary","",lr(t,t.commands)),n=this._plugins.exec("spawn.args",[...t.commands],lr(t,t.commands)),o=await this.gitResponse(t,r,n,this.outputHandler,e.step("SPAWN")),a=await this.handleTaskData(t,n,o,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),sp(t)?Ka(t.parser,a):Ka(t.parser,a.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,n){let{exitCode:o,rejection:a,stdOut:l,stdErr:h}=r;return new Promise((d,f)=>{n("Preparing to handle process response exitCode=%d stdOut=",o);let{error:p}=this._plugins.exec("task.error",{error:a},{...lr(t,e),...r});if(p&&t.onError)return n.info("exitCode=%s handling with custom error handler"),t.onError(r,p,w=>{n.info("custom error handler treated as success"),n("custom error returned a %s",qs(w)),d(new ni(Array.isArray(w)?Buffer.concat(w):w,Buffer.concat(h)))},f);if(p)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",o,h.length,a),f(p);n.info("retrieving task output complete"),d(new ni(Buffer.concat(l),Buffer.concat(h)))})}async gitResponse(t,e,r,n,o){let a=o.sibling("output"),l=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},lr(t,t.commands));return new Promise(h=>{let d=[],f=[];o.info("%s %o",e,r),o("%O",l);let p=this._beforeSpawn(t,r);if(p)return h({stdOut:d,stdErr:f,exitCode:9901,rejection:p});this._plugins.exec("spawn.before",void 0,{...lr(t,r),kill(_){p=_||p}});let w=(0,Sp.spawn)(e,r,l);w.stdout.on("data",rm(d,"stdOut",o,a.step("stdOut"))),w.stderr.on("data",rm(f,"stdErr",o,a.step("stdErr"))),w.on("error",n0(f,o)),n&&(o("Passing child process stdOut/stdErr to custom outputHandler"),n(e,w.stdout,w.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...lr(t,r),spawned:w,close(_,T){h({stdOut:d,stdErr:f,exitCode:_,rejection:p||T})},kill(_){w.killed||(p=_,w.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...lr(t,e),kill(n){r=n||r}}),r}}}}),Tp={};se(Tp,{GitExecutor:()=>Rp});var Rp,o0=R({"src/lib/runners/git-executor.ts"(){"use strict";i0(),Rp=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new ru(this,this._scheduler,this._plugins)}chain(){return new ru(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function a0(t,e,r=hr){let n=a=>{r(null,a)},o=a=>{a?.task===t&&r(a instanceof Os?u0(a):a,void 0)};e.then(n,o)}function u0(t){let e=n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),e=hr};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(n,o){return o in t||(n[o]={enumerable:!1,configurable:!1,get(){return e(o),t.git[o]}}),n}}var l0=R({"src/lib/task-callback.ts"(){"use strict";Ur(),q()}});function sm(t,e){return tp(r=>{if(!cu(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var c0=R({"src/lib/tasks/change-working-directory.ts"(){"use strict";q(),re()}});function Wa(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=li(e,"-B")),de(e)}function h0(){return{checkout(){return this._runTask(Wa(_e(arguments,1)),te(arguments))},checkoutBranch(t,e){return this._runTask(Wa(["-b",t,e,..._e(arguments)]),te(arguments))},checkoutLocalBranch(t){return this._runTask(Wa(["-b",t,..._e(arguments)]),te(arguments))}}}var d0=R({"src/lib/tasks/checkout.ts"(){"use strict";q(),re()}});function f0(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function m0(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return Se(f0(),[xp],t)}})}}}var xp,p0=R({"src/lib/tasks/count-objects.ts"(){"use strict";q(),xp=new D(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let n=jm(e);Object.hasOwn(t,n)&&(t[n]=Q(r))})}});function g0(t){return Se({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},Cp,t)}var Cp,b0=R({"src/lib/parsers/parse-commit.ts"(){"use strict";q(),Cp=[new D(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,n])=>{t.branch=e,t.commit=n,t.root=!!r}),new D(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),n=r.pop();!n||!n.includes("@")||(t.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new D(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(n,10)||0}),new D(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0;let o=parseInt(r,10)||0;n==="-"?t.summary.deletions=o:n==="+"&&(t.summary.insertions=o)})]}});function y0(t,e,r){return{commands:["-c","core.abbrev=40","commit",...Es(t,"-m"),...e,...r],format:"utf-8",parser:g0}}function w0(){return{commit(e,...r){let n=te(arguments),o=t(e)||y0(ct(e),ct(Ae(r[0],si,[])),[...Wr(Ae(r[1],Ms,[])),..._e(arguments,0,!0)]);return this._runTask(o,n)}};function t(e){return!si(e)&&ve("git.commit: requires the commit message to be supplied as a string/string[]")}}var _0=R({"src/lib/tasks/commit.ts"(){"use strict";b0(),q(),re()}});function v0(){return{firstCommit(){return this._runTask(de(["rev-list","--max-parents=0","HEAD"],!0),te(arguments))}}}var S0=R({"src/lib/tasks/first-commit.ts"(){"use strict";q(),re()}});function T0(t,e){let r=["hash-object",t];return e&&r.push("-w"),de(r,!0)}var R0=R({"src/lib/tasks/hash-object.ts"(){"use strict";re()}});function x0(t,e,r){let n=String(r).trim(),o;if(o=kp.exec(n))return new ei(t,e,!1,o[1]);if(o=Ep.exec(n))return new ei(t,e,!0,o[1]);let a="",l=n.split(" ");for(;l.length;)if(l.shift()==="in"){a=l.join(" ");break}return new ei(t,e,/^re/i.test(n),a)}var ei,kp,Ep,C0=R({"src/lib/responses/InitSummary.ts"(){"use strict";ei=class{constructor(t,e,r,n){this.bare=t,this.path=e,this.existing=r,this.gitDir=n}},kp=/^Init.+ repository in (.+)$/,Ep=/^Rein.+ in (.+)$/}});function k0(t){return t.includes(_u)}function E0(t=!1,e,r){let n=["init",...r];return t&&!k0(n)&&n.splice(1,0,_u),{commands:n,format:"utf-8",parser(o){return x0(n.includes("--bare"),e,o)}}}var _u,P0=R({"src/lib/tasks/init.ts"(){"use strict";C0(),_u="--bare"}});function vu(t){for(let e=0;e<t.length;e++){let r=Su.exec(t[e]);if(r)return`--${r[1]}`}return""}function A0(t){return Su.test(t)}var Su,Ds=R({"src/lib/args/log-format.ts"(){"use strict";Su=/^--(stat|numstat|name-only|name-status)(=|$)/}}),Pp,O0=R({"src/lib/responses/DiffSummary.ts"(){"use strict";Pp=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function Ap(t=""){let e=Op[t];return r=>Se(new Pp,e,r,!1)}var za,nm,im,om,Op,Ip=R({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Ds(),O0(),dp(),q(),za=[new D(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,n=""])=>{t.files.push({file:e.trim(),changes:Q(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new D(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,n])=>{t.files.push({file:e.trim(),before:Q(r),after:Q(n),binary:!0})}),new D(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let n=/(\d+) i/.exec(r),o=/(\d+) d/.exec(r);t.changed=Q(e),t.insertions=Q(n?.[1]),t.deletions=Q(o?.[1])})],nm=[new D(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,n])=>{let o=Q(e),a=Q(r);t.changed++,t.insertions+=o,t.deletions+=a,t.files.push({file:n,changes:o+a,insertions:o,deletions:a,binary:!1})}),new D(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],im=[new D(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],om=[new D(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,n,o,a])=>{t.changed++,t.files.push({file:a??n,changes:0,insertions:0,deletions:0,binary:!1,status:Ya(QR(e)&&e),from:Ya(!!a&&n!==a&&n),similarity:Q(r)})})],Op={"":za,"--stat":za,"--numstat":nm,"--name-status":om,"--name-only":im}}});function I0(t,e){return e.reduce((r,n,o)=>(r[n]=t[o]||"",r),Object.create({diff:null}))}function qp(t=xu,e=Mp,r=""){let n=Ap(r);return function(o){let a=Is(o.trim(),!1,Tu).map(function(l){let h=l.split(Ru),d=I0(h[0].split(t),e);return h.length>1&&h[1].trim()&&(d.diff=n(h[1])),d});return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var Tu,Ru,xu,Mp,Dp=R({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";q(),Ip(),Ds(),Tu="\xF2\xF2\xF2\xF2\xF2\xF2 ",Ru=" \xF2\xF2",xu=" \xF2 ",Mp=["hash","date","message","refs","author_name","author_email"]}}),Fp={};se(Fp,{diffSummaryTask:()=>q0,validateLogFormatConfig:()=>pi});function q0(t){let e=vu(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),pi(r)||{commands:r,format:"utf-8",parser:Ap(e)}}function pi(t){let e=t.filter(A0);if(e.length>1)return ve(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return ve(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var Cu=R({"src/lib/tasks/diff.ts"(){"use strict";Ds(),Ip(),re()}});function M0(t,e){let r=[],n=[];return Object.keys(t).forEach(o=>{r.push(o),n.push(String(t[o]))}),[r,n.join(e)]}function D0(t){return Object.keys(t).reduce((e,r)=>(r in su||(e[r]=t[r]),e),{})}function Bp(t={},e=[]){let r=Ae(t.splitter,ae,xu),n=hi(t.format)?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[o,a]=M0(n,r),l=[],h=[`--pretty=format:${Tu}${a}${Ru}`,...e],d=t.n||t["max-count"]||t.maxCount;if(d&&h.push(`--max-count=${d}`),t.from||t.to){let f=t.symmetric!==!1?"...":"..";l.push(`${t.from||""}${f}${t.to||""}`)}return ae(t.file)&&h.push("--follow",SR(t.file)),du(D0(t),h),{fields:o,splitter:r,commands:[...h,...l]}}function F0(t,e,r){let n=qp(t,e,vu(r));return{commands:["log",...r],format:"utf-8",parser:n}}function B0(){return{log(...r){let n=te(arguments),o=Bp(fu(arguments),Wr(Ae(arguments[0],Ms,[]))),a=e(...r)||pi(o.commands)||t(o);return this._runTask(a,n)}};function t(r){return F0(r.splitter,r.fields,r.commands)}function e(r,n){return ae(r)&&ae(n)&&ve("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var su,$p=R({"src/lib/tasks/log.ts"(){"use strict";Ds(),As(),Dp(),q(),re(),Cu(),su=(t=>(t[t["--pretty"]=0]="--pretty",t[t["max-count"]=1]="max-count",t[t.maxCount=2]="maxCount",t[t.n=3]="n",t[t.file=4]="file",t[t.format=5]="format",t[t.from=6]="from",t[t.to=7]="to",t[t.splitter=8]="splitter",t[t.symmetric=9]="symmetric",t[t.mailMap=10]="mailMap",t[t.multiLine=11]="multiLine",t[t.strictDate=12]="strictDate",t))(su||{})}}),ti,jp,$0=R({"src/lib/responses/MergeSummary.ts"(){"use strict";ti=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},jp=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),nu,Lp,j0=R({"src/lib/responses/PullSummary.ts"(){"use strict";nu=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},Lp=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Ha(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function am(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:Q(e&&e[1]||"0"),delta:Q(r&&r[1]||"0")}}var Np,L0=R({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";q(),Np=[new Gt(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let n=e.toLowerCase(),o=Ha(t.remoteMessages);Object.assign(o,{[n]:Q(r)})}),new Gt(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let n=e.toLowerCase(),o=Ha(t.remoteMessages);Object.assign(o,{[n]:Q(r)})}),new Gt(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,n])=>{let o=Ha(t.remoteMessages);o.total=am(e),o.reused=am(r),o.packReused=Q(n)})]}});function Up(t,e){return Se({remoteMessages:new zp},Wp,e)}var Wp,zp,Hp=R({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";q(),L0(),Wp=[new Gt(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...Np,new Gt([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new Gt([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,n])=>{t.remoteMessages.vulnerabilities={count:Q(e),summary:r,url:n}})],zp=class{constructor(){this.all=[]}}}});function N0(t,e){let r=Se(new Lp,Gp,[t,e]);return r.message&&r}var um,lm,cm,hm,Gp,dm,ku,Vp=R({"src/lib/parsers/parse-pull.ts"(){"use strict";j0(),q(),Hp(),um=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,lm=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,cm=/^(create|delete) mode \d+ (.+)/,hm=[new D(um,(t,[e,r,n])=>{t.files.push(e),r&&(t.insertions[e]=r.length),n&&(t.deletions[e]=n.length)}),new D(lm,(t,[e,,r,,n])=>r!==void 0||n!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+n||0,!0):!1),new D(cm,(t,[e,r])=>{Ne(t.files,r),Ne(e==="create"?t.created:t.deleted,r)})],Gp=[new D(/^from\s(.+)$/i,(t,[e])=>{t.remote=e}),new D(/^fatal:\s(.+)$/,(t,[e])=>{t.message=e}),new D(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,n,o])=>{t.branch.local=n,t.hash.local=e,t.branch.remote=o,t.hash.remote=r})],dm=(t,e)=>Se(new nu,hm,[t,e]),ku=(t,e)=>Object.assign(new nu,dm(t,e),Up(t,e))}}),fm,Yp,mm,U0=R({"src/lib/parsers/parse-merge.ts"(){"use strict";$0(),q(),Vp(),fm=[new D(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new D(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new ti(e,r))}),new D(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,n])=>{t.conflicts.push(new ti(e,r,{deleteRef:n}))}),new D(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new ti(e,null))}),new D(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],Yp=(t,e)=>Object.assign(mm(t,e),ku(t,e)),mm=t=>Se(new jp,fm,t)}});function pm(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let n=Yp(e,r);if(n.failed)throw new Os(n);return n}}:ve("Git.merge requires at least one option")}var W0=R({"src/lib/tasks/merge.ts"(){"use strict";Ur(),U0(),re()}});function z0(t,e,r){let n=r.includes("deleted"),o=r.includes("tag")||/^refs\/tags/.test(t),a=!r.includes("new");return{deleted:n,tag:o,branch:!o,new:!a,alreadyUpdated:a,local:t,remote:e}}var gm,Qp,bm,H0=R({"src/lib/parsers/parse-push.ts"(){"use strict";q(),Hp(),gm=[new D(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new D(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new D(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,n])=>{t.pushed.push(z0(e,r,n))}),new D(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,n])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:n}}),new D(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,n,o])=>{t.update={head:{local:e,remote:r},hash:{from:n,to:o}}})],Qp=(t,e)=>{let r=bm(t,e),n=Up(t,e);return{...r,...n}},bm=(t,e)=>Se({pushed:[]},gm,[t,e])}}),Jp={};se(Jp,{pushTagsTask:()=>G0,pushTask:()=>Eu});function G0(t={},e){return Ne(e,"--tags"),Eu(t,e)}function Eu(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),li(r,"-v"),Ne(r,"--verbose"),Ne(r,"--porcelain"),{commands:r,format:"utf-8",parser:Qp}}var Kp=R({"src/lib/tasks/push.ts"(){"use strict";H0(),q()}});function V0(){return{showBuffer(){let t=["show",..._e(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(rp(t),te(arguments))},show(){let t=["show",..._e(arguments,1)];return this._runTask(de(t),te(arguments))}}}var Y0=R({"src/lib/tasks/show.ts"(){"use strict";q(),re()}}),ym,Zp,Q0=R({"src/lib/responses/FileStatusSummary.ts"(){"use strict";ym=/^(.+)\0(.+)$/,Zp=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let n=ym.exec(t)||[null,t,t];this.from=n[2]||"",this.path=n[1]||""}}}}});function wm(t){let[e,r]=t.split(Nr);return{from:r||e,to:e}}function Pe(t,e,r){return[`${t}${e}`,r]}function Ga(t,...e){return e.map(r=>Pe(t,r,(n,o)=>n.conflicted.push(o)))}function J0(t,e){let r=e.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.slice(3));case r.charAt(1):return n(" ",r.charAt(0),r.slice(2));default:return}function n(o,a,l){let h=`${o}${a}`,d=Xp.get(h);d&&d(t,l),h!=="##"&&h!=="!!"&&t.files.push(new Zp(l,o,a))}}var _m,Xp,eg,K0=R({"src/lib/responses/StatusSummary.ts"(){"use strict";q(),Q0(),_m=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},Xp=new Map([Pe(" ","A",(t,e)=>t.created.push(e)),Pe(" ","D",(t,e)=>t.deleted.push(e)),Pe(" ","M",(t,e)=>t.modified.push(e)),Pe("A"," ",(t,e)=>{t.created.push(e),t.staged.push(e)}),Pe("A","M",(t,e)=>{t.created.push(e),t.staged.push(e),t.modified.push(e)}),Pe("D"," ",(t,e)=>{t.deleted.push(e),t.staged.push(e)}),Pe("M"," ",(t,e)=>{t.modified.push(e),t.staged.push(e)}),Pe("M","M",(t,e)=>{t.modified.push(e),t.staged.push(e)}),Pe("R"," ",(t,e)=>{t.renamed.push(wm(e))}),Pe("R","M",(t,e)=>{let r=wm(e);t.renamed.push(r),t.modified.push(r.to)}),Pe("!","!",(t,e)=>{(t.ignored=t.ignored||[]).push(e)}),Pe("?","?",(t,e)=>t.not_added.push(e)),...Ga("A","A","U"),...Ga("D","D","U"),...Ga("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,o=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,l=/\son\s(\S+?)(?=\.{3}|$)/,h=r.exec(e);t.ahead=h&&+h[1]||0,h=n.exec(e),t.behind=h&&+h[1]||0,h=o.exec(e),t.current=Ae(h?.[1],ae,null),h=a.exec(e),t.tracking=Ae(h?.[1],ae,null),h=l.exec(e),h&&(t.current=Ae(h?.[1],ae,t.current)),t.detached=/\(no branch\)/.test(e)}]]),eg=function(t){let e=t.split(Nr),r=new _m;for(let n=0,o=e.length;n<o;){let a=e[n++].trim();a&&(a.charAt(0)==="R"&&(a+=Nr+(e[n++]||"")),J0(r,a))}return r}}});function Z0(t){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...t.filter(r=>!tg.includes(r))],parser(r){return eg(r)}}}var tg,X0=R({"src/lib/tasks/status.ts"(){"use strict";K0(),tg=["--null","-z"]}});function oi(t=0,e=0,r=0,n="",o=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:n,installed:o},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function ex(){return oi(0,0,0,"",!1)}function tx(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:rx,onError(t,e,r,n){if(t.exitCode===-2)return r(Buffer.from(Pu));n(e)}})}}}function rx(t){return t===Pu?ex():Se(oi(0,0,0,t),rg,t)}var Pu,rg,sx=R({"src/lib/tasks/version.ts"(){"use strict";q(),Pu="installed=false",rg=[new D(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,n,o=""])=>{Object.assign(t,oi(Q(e),Q(r),Q(n),o))}),new D(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,n,o=""])=>{Object.assign(t,oi(Q(e),Q(r),n,o))})]}}),sg={};se(sg,{SimpleGitApi:()=>iu});var iu,nx=R({"src/lib/simple-git-api.ts"(){"use strict";l0(),c0(),d0(),p0(),_0(),cp(),S0(),pp(),R0(),P0(),$p(),W0(),Kp(),Y0(),X0(),re(),sx(),q(),iu=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),n=r.push(t);return e&&a0(t,n,e),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(t){return this._runTask(de(["add",...ct(t)]),te(arguments))}cwd(t){let e=te(arguments);return typeof t=="string"?this._runTask(sm(t,this._executor),e):typeof t?.path=="string"?this._runTask(sm(t.path,t.root&&this._executor||void 0),e):this._runTask(ve("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(T0(t,e===!0),te(arguments))}init(t){return this._runTask(E0(t===!0,this._executor.cwd,_e(arguments)),te(arguments))}merge(){return this._runTask(pm(_e(arguments)),te(arguments))}mergeFromTo(t,e){return ae(t)&&ae(e)?this._runTask(pm([t,e,..._e(arguments)]),te(arguments,!1)):this._runTask(ve("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=Eu({remote:Ae(arguments[0],ae),branch:Ae(arguments[1],ae)},_e(arguments));return this._runTask(t,te(arguments))}stash(){return this._runTask(de(["stash",..._e(arguments)]),te(arguments))}status(){return this._runTask(Z0(_e(arguments)),te(arguments))}},Object.assign(iu.prototype,h0(),w0(),YR(),m0(),v0(),ZR(),B0(),V0(),tx())}}),ng={};se(ng,{Scheduler:()=>og});var vm,og,ix=R({"src/lib/runners/scheduler.ts"(){"use strict";q(),_p(),vm=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,ig.createDeferred)();return{promise:e,done:r,id:t}}})(),og=class{constructor(t=2){this.concurrency=t,this.logger=wu("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let t=Ne(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),li(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=Ne(this.pending,vm());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),ag={};se(ag,{applyPatchTask:()=>ox});function ox(t,e){return de(["apply",...e,...t])}var ax=R({"src/lib/tasks/apply-patch.ts"(){"use strict";re()}});function ux(t,e){return{branch:t,hash:e,success:!0}}function lx(t){return{branch:t,hash:null,success:!1}}var ug,cx=R({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";ug=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function lg(t,e){return e===1&&ou.test(t)}var Sm,ou,Tm,gi,hx=R({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";cx(),q(),Sm=/(\S+)\s+\(\S+\s([^)]+)\)/,ou=/^error[^']+'([^']+)'/m,Tm=[new D(Sm,(t,[e,r])=>{let n=ux(e,r);t.all.push(n),t.branches[e]=n}),new D(ou,(t,[e])=>{let r=lx(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],gi=(t,e)=>Se(new ug,Tm,[t,e])}}),cg,dx=R({"src/lib/responses/BranchSummary.ts"(){"use strict";cg=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,n,o){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:n,label:o}}}}});function Rm(t){return t?t.charAt(0):""}function hg(t,e=!1){return Se(new cg,e?[fg]:dg,t)}var dg,fg,fx=R({"src/lib/parsers/parse-branch.ts"(){"use strict";dx(),q(),dg=[new D(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,n,o])=>{t.push(Rm(e),!0,r,n,o)}),new D(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,n,o])=>{t.push(Rm(e),!1,r,n,o)})],fg=new D(/^(\S+)$/s,(t,[e])=>{t.push("*",!1,e,"","")})}}),mg={};se(mg,{branchLocalTask:()=>px,branchTask:()=>mx,containsDeleteBranchCommand:()=>pg,deleteBranchTask:()=>bx,deleteBranchesTask:()=>gx});function pg(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function mx(t){let e=pg(t),r=t.includes("--show-current"),n=["branch",...t];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(o,a){return e?gi(o,a).all[0]:hg(o,r)}}}function px(){return{format:"utf-8",commands:["branch","-v"],parser(t){return hg(t)}}}function gx(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,n){return gi(r,n)},onError({exitCode:r,stdOut:n},o,a,l){if(!lg(String(o),r))return l(o);a(n)}}}function bx(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(n,o){return gi(n,o).branches[t]},onError({exitCode:n,stdErr:o,stdOut:a},l,h,d){if(!lg(String(l),n))return d(l);throw new Os(r.parser(Ps(a),Ps(o)),String(l))}};return r}var yx=R({"src/lib/tasks/branch.ts"(){"use strict";Ur(),hx(),fx(),q()}});function wx(t){let e=t.trim().replace(/^["']|["']$/g,"");return e&&(0,gg.normalize)(e)}var bg,_x=R({"src/lib/responses/CheckIgnore.ts"(){"use strict";bg=t=>t.split(/\n/g).map(wx).filter(Boolean)}}),yg={};se(yg,{checkIgnoreTask:()=>vx});function vx(t){return{commands:["check-ignore",...t],format:"utf-8",parser:bg}}var Sx=R({"src/lib/tasks/check-ignore.ts"(){"use strict";_x()}}),wg={};se(wg,{cloneMirrorTask:()=>Rx,cloneTask:()=>_g});function Tx(t){return/^--upload-pack(=|$)/.test(t)}function _g(t,e,r){let n=["clone",...r];return ae(t)&&n.push(t),ae(e)&&n.push(e),n.find(Tx)?ve("git.fetch: potential exploit argument blocked."):de(n)}function Rx(t,e,r){return Ne(r,"--mirror"),_g(t,e,r)}var xx=R({"src/lib/tasks/clone.ts"(){"use strict";re(),q()}});function Cx(t,e){return Se({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},vg,[t,e])}var vg,kx=R({"src/lib/parsers/parse-fetch.ts"(){"use strict";q(),vg=[new D(/From (.+)$/,(t,[e])=>{t.remote=e}),new D(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new D(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new D(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new D(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,n,o])=>{t.updated.push({name:n,tracking:o,to:r,from:e})})]}}),Sg={};se(Sg,{fetchTask:()=>Px});function Ex(t){return/^--upload-pack(=|$)/.test(t)}function Px(t,e,r){let n=["fetch",...r];return t&&e&&n.push(t,e),n.find(Ex)?ve("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:Cx}}var Ax=R({"src/lib/tasks/fetch.ts"(){"use strict";kx(),re()}});function Ox(t){return Se({moves:[]},Tg,t)}var Tg,Ix=R({"src/lib/parsers/parse-move.ts"(){"use strict";q(),Tg=[new D(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),Rg={};se(Rg,{moveTask:()=>qx});function qx(t,e){return{commands:["mv","-v",...ct(t),e],format:"utf-8",parser:Ox}}var Mx=R({"src/lib/tasks/move.ts"(){"use strict";Ix(),q()}}),xg={};se(xg,{pullTask:()=>Dx});function Dx(t,e,r){let n=["pull",...r];return t&&e&&n.splice(1,0,t,e),{commands:n,format:"utf-8",parser(o,a){return ku(o,a)},onError(o,a,l,h){let d=N0(Ps(o.stdOut),Ps(o.stdErr));if(d)return h(new Os(d));h(a)}}}var Fx=R({"src/lib/tasks/pull.ts"(){"use strict";Ur(),Vp(),q()}});function Bx(t){let e={};return Cg(t,([r])=>e[r]={name:r}),Object.values(e)}function $x(t){let e={};return Cg(t,([r,n,o])=>{Object.hasOwn(e,r)||(e[r]={name:r,refs:{fetch:"",push:""}}),o&&n&&(e[r].refs[o.replace(/[^a-z]/g,"")]=n)}),Object.values(e)}function Cg(t,e){lu(t,r=>e(r.split(/\s+/)))}var jx=R({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";q()}}),kg={};se(kg,{addRemoteTask:()=>Lx,getRemotesTask:()=>Nx,listRemotesTask:()=>Ux,remoteTask:()=>Wx,removeRemoteTask:()=>zx});function Lx(t,e,r){return de(["remote","add",...r,t,e])}function Nx(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?$x:Bx}}function Ux(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),de(e)}function Wx(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),de(e)}function zx(t){return de(["remote","remove",t])}var Hx=R({"src/lib/tasks/remote.ts"(){"use strict";jx(),re()}}),Eg={};se(Eg,{stashListTask:()=>Gx});function Gx(t={},e){let r=Bp(t),n=["stash","list",...r.commands,...e],o=qp(r.splitter,r.fields,vu(n));return pi(n)||{commands:n,format:"utf-8",parser:o}}var Vx=R({"src/lib/tasks/stash-list.ts"(){"use strict";Ds(),Dp(),Cu(),$p()}}),Pg={};se(Pg,{addSubModuleTask:()=>Yx,initSubModuleTask:()=>Qx,subModuleTask:()=>bi,updateSubModuleTask:()=>Jx});function Yx(t,e){return bi(["add",t,e])}function Qx(t){return bi(["init",...t])}function bi(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),de(e)}function Jx(t){return bi(["update",...t])}var Kx=R({"src/lib/tasks/sub-module.ts"(){"use strict";re()}});function Zx(t,e){let r=Number.isNaN(t),n=Number.isNaN(e);return r!==n?r?1:-1:r?Ag(t,e):0}function Ag(t,e){return t===e?0:t>e?1:-1}function Xx(t){return t.trim()}function Kn(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var xm,Og,eC=R({"src/lib/responses/TagList.ts"(){"use strict";xm=class{constructor(t,e){this.all=t,this.latest=e}},Og=function(t,e=!1){let r=t.split(`
117
- `).map(Xx).filter(Boolean);e||r.sort(function(o,a){let l=o.split("."),h=a.split(".");if(l.length===1||h.length===1)return Zx(Kn(l[0]),Kn(h[0]));for(let d=0,f=Math.max(l.length,h.length);d<f;d++){let p=Ag(Kn(l[d]),Kn(h[d]));if(p)return p}return 0});let n=e?r[0]:[...r].reverse().find(o=>o.indexOf(".")>=0);return new xm(r,n)}}}),Ig={};se(Ig,{addAnnotatedTagTask:()=>sC,addTagTask:()=>rC,tagListTask:()=>tC});function tC(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return Og(r,e)}}}function rC(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function sC(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var nC=R({"src/lib/tasks/tag.ts"(){"use strict";eC()}}),iC=_R({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(o0(),ee(Tp)),{SimpleGitApi:n}=(nx(),ee(sg)),{Scheduler:o}=(ix(),ee(ng)),{adhocExecTask:a,configurationErrorTask:l}=(re(),ee(Xa)),{asArray:h,filterArray:d,filterPrimitives:f,filterString:p,filterStringOrStringArray:w,filterType:_,getTrailingOptions:T,trailingFunctionArgument:y,trailingOptionsArgument:M}=(q(),ee(Gm)),{applyPatchTask:k}=(ax(),ee(ag)),{branchTask:E,branchLocalTask:L,deleteBranchesTask:K,deleteBranchTask:j}=(yx(),ee(mg)),{checkIgnoreTask:U}=(Sx(),ee(yg)),{checkIsRepoTask:z}=(Jm(),ee(Vm)),{cloneTask:De,cloneMirrorTask:rt}=(xx(),ee(wg)),{cleanWithOptionsTask:Jt,isCleanOptionsArray:Xr}=(ap(),ee(ip)),{diffSummaryTask:Vs}=(Cu(),ee(Fp)),{fetchTask:es}=(Ax(),ee(Sg)),{moveTask:Ge}=(Mx(),ee(Rg)),{pullTask:yr}=(Fx(),ee(xg)),{pushTagsTask:ts}=(Kp(),ee(Jp)),{addRemoteTask:Ys,getRemotesTask:Li,listRemotesTask:rs,remoteTask:Ni,removeRemoteTask:Qs}=(Hx(),ee(kg)),{getResetMode:Js,resetTask:Ui}=(wp(),ee(gp)),{stashListTask:Wi}=(Vx(),ee(Eg)),{addSubModuleTask:Fe,initSubModuleTask:me,subModuleTask:zi,updateSubModuleTask:Ks}=(Kx(),ee(Pg)),{addAnnotatedTagTask:Ve,addTagTask:ss,tagListTask:ns}=(nC(),ee(Ig)),{straightThroughBufferTask:Zs,straightThroughStringTask:Be}=(re(),ee(Xa));function A(v,C){this._plugins=C,this._executor=new r(v.baseDir,new o(v.maxConcurrentProcesses),C),this._trimmed=v.trimmed}(A.prototype=Object.create(n.prototype)).constructor=A,A.prototype.customBinary=function(v){return this._plugins.reconfigure("binary",v),this},A.prototype.env=function(v,C){return arguments.length===1&&typeof v=="object"?this._executor.env=v:(this._executor.env=this._executor.env||{})[v]=C,this},A.prototype.stashList=function(v){return this._runTask(Wi(M(arguments)||{},d(v)&&v||[]),y(arguments))};function wr(v,C,W,ne){return typeof W!="string"?l(`git.${v}() requires a string 'repoPath'`):C(W,_(ne,p),T(arguments))}A.prototype.clone=function(){return this._runTask(wr("clone",De,...arguments),y(arguments))},A.prototype.mirror=function(){return this._runTask(wr("mirror",rt,...arguments),y(arguments))},A.prototype.mv=function(v,C){return this._runTask(Ge(v,C),y(arguments))},A.prototype.checkoutLatestTag=function(v){var C=this;return this.pull(function(){C.tags(function(W,ne){C.checkout(ne.latest,v)})})},A.prototype.pull=function(v,C,W,ne){return this._runTask(yr(_(v,p),_(C,p),T(arguments)),y(arguments))},A.prototype.fetch=function(v,C){return this._runTask(es(_(v,p),_(C,p),T(arguments)),y(arguments))},A.prototype.silent=function(v){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},A.prototype.tags=function(v,C){return this._runTask(ns(T(arguments)),y(arguments))},A.prototype.rebase=function(){return this._runTask(Be(["rebase",...T(arguments)]),y(arguments))},A.prototype.reset=function(v){return this._runTask(Ui(Js(v),T(arguments)),y(arguments))},A.prototype.revert=function(v){let C=y(arguments);return typeof v!="string"?this._runTask(l("Commit must be a string"),C):this._runTask(Be(["revert",...T(arguments,0,!0),v]),C)},A.prototype.addTag=function(v){let C=typeof v=="string"?ss(v):l("Git.addTag requires a tag name");return this._runTask(C,y(arguments))},A.prototype.addAnnotatedTag=function(v,C){return this._runTask(Ve(v,C),y(arguments))},A.prototype.deleteLocalBranch=function(v,C,W){return this._runTask(j(v,typeof C=="boolean"?C:!1),y(arguments))},A.prototype.deleteLocalBranches=function(v,C,W){return this._runTask(K(v,typeof C=="boolean"?C:!1),y(arguments))},A.prototype.branch=function(v,C){return this._runTask(E(T(arguments)),y(arguments))},A.prototype.branchLocal=function(v){return this._runTask(L(),y(arguments))},A.prototype.raw=function(v){let C=!Array.isArray(v),W=[].slice.call(C?arguments:v,0);for(let pe=0;pe<W.length&&C;pe++)if(!f(W[pe])){W.splice(pe,W.length-pe);break}W.push(...T(arguments,0,!0));var ne=y(arguments);return W.length?this._runTask(Be(W,this._trimmed),ne):this._runTask(l("Raw: must supply one or more command to execute"),ne)},A.prototype.submoduleAdd=function(v,C,W){return this._runTask(Fe(v,C),y(arguments))},A.prototype.submoduleUpdate=function(v,C){return this._runTask(Ks(T(arguments,!0)),y(arguments))},A.prototype.submoduleInit=function(v,C){return this._runTask(me(T(arguments,!0)),y(arguments))},A.prototype.subModule=function(v,C){return this._runTask(zi(T(arguments)),y(arguments))},A.prototype.listRemote=function(){return this._runTask(rs(T(arguments)),y(arguments))},A.prototype.addRemote=function(v,C,W){return this._runTask(Ys(v,C,T(arguments)),y(arguments))},A.prototype.removeRemote=function(v,C){return this._runTask(Qs(v),y(arguments))},A.prototype.getRemotes=function(v,C){return this._runTask(Li(v===!0),y(arguments))},A.prototype.remote=function(v,C){return this._runTask(Ni(T(arguments)),y(arguments))},A.prototype.tag=function(v,C){let W=T(arguments);return W[0]!=="tag"&&W.unshift("tag"),this._runTask(Be(W),y(arguments))},A.prototype.updateServerInfo=function(v){return this._runTask(Be(["update-server-info"]),y(arguments))},A.prototype.pushTags=function(v,C){let W=ts({remote:_(v,p)},T(arguments));return this._runTask(W,y(arguments))},A.prototype.rm=function(v){return this._runTask(Be(["rm","-f",...h(v)]),y(arguments))},A.prototype.rmKeepLocal=function(v){return this._runTask(Be(["rm","--cached",...h(v)]),y(arguments))},A.prototype.catFile=function(v,C){return this._catFile("utf-8",arguments)},A.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},A.prototype._catFile=function(v,C){var W=y(C),ne=["cat-file"],pe=C[0];if(typeof pe=="string")return this._runTask(l("Git.catFile: options must be supplied as an array of strings"),W);Array.isArray(pe)&&ne.push.apply(ne,pe);let $e=v==="buffer"?Zs(ne):Be(ne);return this._runTask($e,W)},A.prototype.diff=function(v,C){let W=p(v)?l("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):Be(["diff",...T(arguments)]);return this._runTask(W,y(arguments))},A.prototype.diffSummary=function(){return this._runTask(Vs(T(arguments,1)),y(arguments))},A.prototype.applyPatch=function(v){let C=w(v)?k(h(v),T([].slice.call(arguments,1))):l("git.applyPatch requires one or more string patches as the first argument");return this._runTask(C,y(arguments))},A.prototype.revparse=function(){let v=["rev-parse",...T(arguments,!0)];return this._runTask(Be(v,!0),y(arguments))},A.prototype.clean=function(v,C,W){let ne=Xr(v),pe=ne&&v.join("")||_(v,p)||"",$e=T([].slice.call(arguments,ne?1:0));return this._runTask(Jt(pe,$e),y(arguments))},A.prototype.exec=function(v){let C={commands:[],format:"utf-8",parser(){typeof v=="function"&&v()}};return this._runTask(C)},A.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},A.prototype.checkIgnore=function(v,C){return this._runTask(U(h(_(v,w,[]))),y(arguments))},A.prototype.checkIsRepo=function(v,C){return this._runTask(z(_(v,p)),y(arguments))},e.exports=A}});As();Vt();var oC=class extends Et{constructor(t,e){super(void 0,e),this.config=t}};Vt();Vt();var kt=class extends Et{constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};Ur();Om();Jm();ap();cp();dp();pp();wp();function aC(t){return t?[{type:"spawn.before",action(n,o){t.aborted&&o.kill(new kt(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(n,o){function a(){o.kill(new kt(void 0,"abort","Abort signal received"))}t.addEventListener("abort",a),o.spawned.on("close",()=>t.removeEventListener("abort",a))}}]:void 0}function uC(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function lC(t,e){if(typeof e!="string"||!e.includes(t))return!1;let r=e.replace(/\0g/,"").replace(/^(--no)?-{1,2}/,"");return/^[\dlsqvnobucj]+\b/.test(r)}function cC(t,e){if(uC(t)&&/^\s*protocol(.[a-z]+)?.allow/i.test(e))throw new kt(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function hC(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new kt(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&lC("u",t))throw new kt(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(e==="push"&&/^\s*--exec\b/.test(t))throw new kt(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function dC({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(r,n){return r.forEach((o,a)=>{let l=a<r.length?r[a+1]:"";t||cC(o,l),e||hC(o,n.method)}),r}}}q();function fC(t){let e=Es(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}q();var Cm=(0,Lr.deferred)().promise;function mC({onClose:t=!0,onExit:e=50}={}){function r(){let o=-1,a={close:(0,Lr.deferred)(),closeTimeout:(0,Lr.deferred)(),exit:(0,Lr.deferred)(),exitTimeout:(0,Lr.deferred)()},l=Promise.race([t===!1?Cm:a.closeTimeout.promise,e===!1?Cm:a.exitTimeout.promise]);return n(t,a.close,a.closeTimeout),n(e,a.exit,a.exitTimeout),{close(h){o=h,a.close.done()},exit(h){o=h,a.exit.done()},get exitCode(){return o},result:l}}function n(o,a,l){o!==!1&&(o===!0?a.promise:a.promise.then(()=>Va(o))).then(l.done)}return{type:"spawn.after",async action(o,{spawned:a,close:l}){let h=r(),d=!0,f=()=>{d=!1};a.stdout?.on("data",f),a.stderr?.on("data",f),a.on("error",f),a.on("close",p=>h.close(p)),a.on("exit",p=>h.exit(p));try{await h.result,d&&await Va(50),l(h.exitCode)}catch(p){l(h.exitCode,p)}}}}q();var pC="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",km="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function gC(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(t)}function Em(t,e){if(t.length<1||t.length>2)throw new kt(void 0,"binary",pC);if(t.some(gC))if(e)console.warn(km);else throw new kt(void 0,"binary",km);let[n,o]=t;return{binary:n,prefix:o}}function bC(t,e=["git"],r=!1){let n=Em(ct(e),r);t.on("binary",o=>{n=Em(ct(o),r)}),t.append("spawn.binary",()=>n.binary),t.append("spawn.args",o=>n.prefix?[n.prefix,...o]:o)}Vt();function yC(t){return!!(t.exitCode&&t.stdErr.length)}function wC(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function _C(t=!1,e=yC,r=wC){return(n,o)=>!t&&n||!e(o)?n:r(o)}function Pm(t){return{type:"task.error",action(e,r){let n=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new Et(void 0,n.toString("utf-8"))}:{error:n}}}}q();var vC=class{constructor(){this.plugins=new Set,this.events=new qg.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=Ne(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return ct(t).forEach(r=>r&&this.plugins.add(Ne(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let n=e,o=Object.freeze(Object.create(r));for(let a of this.plugins)a.type===t&&(n=a.action(n,o));return n}};q();function SC(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(a,l){return r.includes(l.method)?$m(a,e):a}},{type:"spawn.after",action(a,l){l.commands.includes(e)&&l.spawned.stderr?.on("data",h=>{let d=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(h.toString("utf8"));d&&t({method:l.method,stage:TC(d[1]),progress:Q(d[2]),processed:Q(d[3]),total:Q(d[4])})})}}]}function TC(t){return String(t.toLowerCase().split(" ",1))||"unknown"}q();function RC(t){let e=Lm(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function xC({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(n,o){let a;function l(){a&&clearTimeout(a),a=setTimeout(d,t)}function h(){o.spawned.stdout?.off("data",l),o.spawned.stderr?.off("data",l),o.spawned.off("exit",h),o.spawned.off("close",h),a&&clearTimeout(a)}function d(){h(),o.kill(new kt(void 0,"timeout","block timeout reached"))}r&&o.spawned.stdout?.on("data",l),e&&o.spawned.stderr?.on("data",l),o.spawned.on("exit",h),o.spawned.on("close",h),l()}}}As();function CC(){return{type:"spawn.args",action(t){let e=[],r;function n(o){(r=r||[]).push(...o)}for(let o=0;o<t.length;o++){let a=t[o];if(ri(a)){n(Xf(a));continue}if(a==="--"){n(t.slice(o+1).flatMap(l=>ri(l)&&Xf(l)||l));break}e.push(a)}return r?[...e,"--",...r.map(String)]:e}}}q();var kC=iC();function EC(t,e){let r=new vC,n=zm(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!cu(n.baseDir))throw new oC(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(fC(n.config)),r.add(dC(n.unsafe)),r.add(CC()),r.add(mC(n.completion)),n.abort&&r.add(aC(n.abort)),n.progress&&r.add(SC(n.progress)),n.timeout&&r.add(xC(n.timeout)),n.spawnOptions&&r.add(RC(n.spawnOptions)),r.add(Pm(_C(!0))),n.errors&&r.add(Pm(n.errors)),bC(r,n.binary,n.unsafe?.allowUnsafeCustomBinary),new kC(n,r)}Ur();var ie=EC;var Ii=B(Ct());var PC=t=>t?.trim().normalize("NFD").replace(/\[.*]\s/,"").replace(/\+\s/,"").replace(/-\s/,"").replace(/\./,"").replace(/>/g,"").replace(/</g,"").replace(/:/g,"").replace(/"/g,"").replace(/&/g,"").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").replace(/\s/g,"-").toLowerCase(),AC=t=>t==="Epic"?"story":t==="Bug"?"fix":"feat",Mg=t=>{let{id:e,name:r,type:n}=t,o=AC(n),a=PC(r);return[`${o}/${e}_${a}`,`${o}/${e}`,`${e}`]};var Dg=B(require("os")),zr=require("fs/promises"),Fg=require("fs"),et=()=>Dg.default.homedir(),Bg=()=>process.cwd(),yi=async t=>{await(0,zr.mkdir)(t,{recursive:!0})},Hr=t=>(0,Fg.existsSync)(t),wi=async(t,e)=>{await(0,zr.writeFile)(t,e)},Au=async t=>(await(0,zr.readFile)(t)).toString();var Ou={tools:{jira:{domain:process.env.JIRA_DOMAIN??"",authorization:process.env.JIRA_AUTHORIZATION??""},github:{token:process.env.GITHUB_TOKEN??"",organization:process.env.GITHUB_ORGANIZATION??""},ai:{model:"gpt-4o-mini",bigModel:"gpt-4.1",token:"",url:"https://api.openai.com/v1"}},projects:{},advanced:!1,debug:!1,experimental:!1,version:"0.0.0"};var $g=t=>btoa(t);var jg=()=>Hr(`${et()}/.mytools/config`),Lg=async()=>{Hr(`${et()}/.mytools/config`)||(Hr(`${et()}/.mytools`)||await yi(`${et()}/.mytools`),await _i(Ou))},Ng=async()=>{let t=await dr(),{tools:e,...r}=t,{ai:n}=e,{tools:o,...a}=Ou,{ai:l}=o;await _i({...a,...r,tools:{...o,...e,ai:{...l,...n}}})},Ug=async()=>{let t=await dr();await _i({...t,projects:{}})},Wg=async()=>{let t=$g(Bg()),e=await dr(),r=e.tools.jira,n=e.projects[t]?.tools.jira;return n?n.domain&&n.authorization:r.domain&&r.authorization},zg=async()=>{let{experimental:t}=await dr();return t},Hg=async()=>{let{version:t}=await Vg(),[e,r,n]=t.split(".").map(d=>parseInt(d)),{version:o}=await dr();if(!o)return!0;let[a,l,h]=o.split(".").map(d=>parseInt(d));return e>a||r>l||n>h},Gg=async()=>{let{version:t}=await Vg(),e=await dr();await _i({...e,version:t})},Ue=async()=>{let t=await dr(),{tools:e}=t,{ai:r}=e;return r},Vg=async()=>{let t=await Au(`${__dirname}/../package.json`);return JSON.parse(t)},dr=async()=>{let t=await Au(`${et()}/.mytools/config`);return JSON.parse(t)},_i=async t=>{let e=JSON.stringify(t,null,2);await wi(`${et()}/.mytools/config`,e)};var xb=B(require("http"),1),Cb=B(require("https"),1),br=B(require("zlib"),1),qe=B(require("stream"),1),Us=require("buffer");function OC(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),n="",o=!1,a=r[0]||"text/plain",l=a;for(let p=1;p<r.length;p++)r[p]==="base64"?o=!0:r[p]&&(l+=`;${r[p]}`,r[p].indexOf("charset=")===0&&(n=r[p].substring(8)));!r[0]&&!n.length&&(l+=";charset=US-ASCII",n="US-ASCII");let h=o?"base64":"ascii",d=unescape(t.substring(e+1)),f=Buffer.from(d,h);return f.type=a,f.typeFull=l,f.charset=n,f}var Yg=OC;var We=B(require("stream"),1),Ot=require("util"),Oe=require("buffer");Fs();Si();var At=class extends Error{constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var Te=class extends At{constructor(e,r,n){super(e,r),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}};var Ti=Symbol.toStringTag,Fu=t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[Ti]==="URLSearchParams",$s=t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[Ti]),sb=t=>typeof t=="object"&&(t[Ti]==="AbortSignal"||t[Ti]==="EventTarget"),nb=(t,e)=>{let r=new URL(e).hostname,n=new URL(t).hostname;return r===n||r.endsWith(`.${n}`)},ib=(t,e)=>{let r=new URL(e).protocol,n=new URL(t).protocol;return r===n};var VC=(0,Ot.promisify)(We.default.pipeline),Re=Symbol("Body internals"),dt=class{constructor(e,{size:r=0}={}){let n=null;e===null?e=null:Fu(e)?e=Oe.Buffer.from(e.toString()):$s(e)||Oe.Buffer.isBuffer(e)||(Ot.types.isAnyArrayBuffer(e)?e=Oe.Buffer.from(e):ArrayBuffer.isView(e)?e=Oe.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof We.default||(e instanceof mr?(e=rb(e),n=e.type.split("=")[1]):e=Oe.Buffer.from(String(e))));let o=e;Oe.Buffer.isBuffer(e)?o=We.default.Readable.from(e):$s(e)&&(o=We.default.Readable.from(e.stream())),this[Re]={body:e,stream:o,boundary:n,disturbed:!1,error:null},this.size=r,e instanceof We.default&&e.on("error",a=>{let l=a instanceof At?a:new Te(`Invalid response body while trying to fetch ${this.url}: ${a.message}`,"system",a);this[Re].error=l})}get body(){return this[Re].stream}get bodyUsed(){return this[Re].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:n}=await ju(this);return e.slice(r,r+n)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let n=new mr,o=new URLSearchParams(await this.text());for(let[a,l]of o)n.append(a,l);return n}let{toFormData:r}=await Promise.resolve().then(()=>(cb(),lb));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Re].body&&this[Re].body.type||"",r=await this.arrayBuffer();return new Pt([r],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await ju(this);return new TextDecoder().decode(e)}buffer(){return ju(this)}};dt.prototype.buffer=(0,Ot.deprecate)(dt.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(dt.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Ot.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function ju(t){if(t[Re].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Re].disturbed=!0,t[Re].error)throw t[Re].error;let{body:e}=t;if(e===null)return Oe.Buffer.alloc(0);if(!(e instanceof We.default))return Oe.Buffer.alloc(0);let r=[],n=0;try{for await(let o of e){if(t.size>0&&n+o.length>t.size){let a=new Te(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(a),a}n+=o.length,r.push(o)}}catch(o){throw o instanceof At?o:new Te(`Invalid response body while trying to fetch ${t.url}: ${o.message}`,"system",o)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(o=>typeof o=="string")?Oe.Buffer.from(r.join("")):Oe.Buffer.concat(r,n)}catch(o){throw new Te(`Could not create Buffer from response body for ${t.url}: ${o.message}`,"system",o)}else throw new Te(`Premature close of server response while trying to fetch ${t.url}`)}var Vr=(t,e)=>{let r,n,{body:o}=t[Re];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof We.default&&typeof o.getBoundary!="function"&&(r=new We.PassThrough({highWaterMark:e}),n=new We.PassThrough({highWaterMark:e}),o.pipe(r),o.pipe(n),t[Re].stream=r,o=n),o},YC=(0,Ot.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),ki=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Fu(t)?"application/x-www-form-urlencoded;charset=UTF-8":$s(t)?t.type||null:Oe.Buffer.isBuffer(t)||Ot.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof mr?`multipart/form-data; boundary=${e[Re].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${YC(t)}`:t instanceof We.default?null:"text/plain;charset=UTF-8",hb=t=>{let{body:e}=t[Re];return e===null?0:$s(e)?e.size:Oe.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},db=async(t,{body:e})=>{e===null?t.end():await VC(e,t)};var Lu=require("util"),Ls=B(require("http"),1),Ei=typeof Ls.default.validateHeaderName=="function"?Ls.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},Nu=typeof Ls.default.validateHeaderValue=="function"?Ls.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Ie=class t extends URLSearchParams{constructor(e){let r=[];if(e instanceof t){let n=e.raw();for(let[o,a]of Object.entries(n))r.push(...a.map(l=>[o,l]))}else if(e!=null)if(typeof e=="object"&&!Lu.types.isBoxedPrimitive(e)){let n=e[Symbol.iterator];if(n==null)r.push(...Object.entries(e));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(o=>{if(typeof o!="object"||Lu.types.isBoxedPrimitive(o))throw new TypeError("Each header pair must be an iterable object");return[...o]}).map(o=>{if(o.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([n,o])=>(Ei(n),Nu(n,String(o)),[String(n).toLowerCase(),String(o)])):void 0,super(r),new Proxy(this,{get(n,o,a){switch(o){case"append":case"set":return(l,h)=>(Ei(l),Nu(l,String(h)),URLSearchParams.prototype[o].call(n,String(l).toLowerCase(),String(h)));case"delete":case"has":case"getAll":return l=>(Ei(l),URLSearchParams.prototype[o].call(n,String(l).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,o,a)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let n=r.join(", ");return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,r=void 0){for(let n of this.keys())Reflect.apply(e,r,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let n=this.getAll(r);return r==="host"?e[r]=n[0]:e[r]=n.length>1?n:n[0],e},{})}};Object.defineProperties(Ie.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function fb(t=[]){return new Ie(t.reduce((e,r,n,o)=>(n%2===0&&e.push(o.slice(n,n+2)),e),[]).filter(([e,r])=>{try{return Ei(e),Nu(e,String(r)),!0}catch{return!1}}))}var QC=new Set([301,302,303,307,308]),Pi=t=>QC.has(t);var tt=Symbol("Response internals"),ze=class t extends dt{constructor(e=null,r={}){super(e,r);let n=r.status!=null?r.status:200,o=new Ie(r.headers);if(e!==null&&!o.has("Content-Type")){let a=ki(e,this);a&&o.append("Content-Type",a)}this[tt]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[tt].type}get url(){return this[tt].url||""}get status(){return this[tt].status}get ok(){return this[tt].status>=200&&this[tt].status<300}get redirected(){return this[tt].counter>0}get statusText(){return this[tt].statusText}get headers(){return this[tt].headers}get highWaterMark(){return this[tt].highWaterMark}clone(){return new t(Vr(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!Pi(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new t(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new t(null,{status:0,statusText:""});return e[tt].type="error",e}static json(e=void 0,r={}){let n=JSON.stringify(e);if(n===void 0)throw new TypeError("data is not JSON serializable");let o=new Ie(r&&r.headers);return o.has("content-type")||o.set("content-type","application/json"),new t(n,{...r,headers:o})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(ze.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var Sb=require("url"),Tb=require("util");var mb=t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""};var gb=require("net");function pb(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}var bb=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),yb="strict-origin-when-cross-origin";function wb(t){if(!bb.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function JC(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,gb.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:t.host==="localhost"||t.host.endsWith(".localhost")?!1:t.protocol==="file:"}function Yr(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:JC(t)}function _b(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let n=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let o=t.referrer,a=pb(o),l=pb(o,!0);a.toString().length>4096&&(a=l),e&&(a=e(a)),r&&(l=r(l));let h=new URL(t.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return l;case"unsafe-url":return a;case"strict-origin":return Yr(a)&&!Yr(h)?"no-referrer":l.toString();case"strict-origin-when-cross-origin":return a.origin===h.origin?a:Yr(a)&&!Yr(h)?"no-referrer":l;case"same-origin":return a.origin===h.origin?a:"no-referrer";case"origin-when-cross-origin":return a.origin===h.origin?a:l;case"no-referrer-when-downgrade":return Yr(a)&&!Yr(h)?"no-referrer":a;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function vb(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of e)n&&bb.has(n)&&(r=n);return r}var ue=Symbol("Request internals"),Ns=t=>typeof t=="object"&&typeof t[ue]=="object",KC=(0,Tb.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),gr=class t extends dt{constructor(e,r={}){let n;if(Ns(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let o=r.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)&&(o=o.toUpperCase()),!Ns(r)&&"data"in r&&KC(),(r.body!=null||Ns(e)&&e.body!==null)&&(o==="GET"||o==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let a=r.body?r.body:Ns(e)&&e.body!==null?Vr(e):null;super(a,{size:r.size||e.size||0});let l=new Ie(r.headers||e.headers||{});if(a!==null&&!l.has("Content-Type")){let f=ki(a,this);f&&l.set("Content-Type",f)}let h=Ns(e)?e.signal:null;if("signal"in r&&(h=r.signal),h!=null&&!sb(h))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=r.referrer==null?e.referrer:r.referrer;if(d==="")d="no-referrer";else if(d){let f=new URL(d);d=/^about:(\/\/)?client$/.test(f)?"client":f}else d=void 0;this[ue]={method:o,redirect:r.redirect||e.redirect||"follow",headers:l,parsedURL:n,signal:h,referrer:d},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[ue].method}get url(){return(0,Sb.format)(this[ue].parsedURL)}get headers(){return this[ue].headers}get redirect(){return this[ue].redirect}get signal(){return this[ue].signal}get referrer(){if(this[ue].referrer==="no-referrer")return"";if(this[ue].referrer==="client")return"about:client";if(this[ue].referrer)return this[ue].referrer.toString()}get referrerPolicy(){return this[ue].referrerPolicy}set referrerPolicy(e){this[ue].referrerPolicy=wb(e)}clone(){return new t(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(gr.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var Rb=t=>{let{parsedURL:e}=t[ue],r=new Ie(t[ue].headers);r.has("Accept")||r.set("Accept","*/*");let n=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(n="0"),t.body!==null){let h=hb(t);typeof h=="number"&&!Number.isNaN(h)&&(n=String(h))}n&&r.set("Content-Length",n),t.referrerPolicy===""&&(t.referrerPolicy=yb),t.referrer&&t.referrer!=="no-referrer"?t[ue].referrer=_b(t):t[ue].referrer="no-referrer",t[ue].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip, deflate, br");let{agent:o}=t;typeof o=="function"&&(o=o(e));let a=mb(e),l={path:e.pathname+a,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:o};return{parsedURL:e,options:l}};var Ai=class extends At{constructor(e,r="aborted"){super(e,r)}};Si();Bu();var ZC=new Set(["data:","http:","https:"]);async function It(t,e){return new Promise((r,n)=>{let o=new gr(t,e),{parsedURL:a,options:l}=Rb(o);if(!ZC.has(a.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${a.protocol.replace(/:$/,"")}" is not supported.`);if(a.protocol==="data:"){let y=Yg(o.url),M=new ze(y,{headers:{"Content-Type":y.typeFull}});r(M);return}let h=(a.protocol==="https:"?Cb.default:xb.default).request,{signal:d}=o,f=null,p=()=>{let y=new Ai("The operation was aborted.");n(y),o.body&&o.body instanceof qe.default.Readable&&o.body.destroy(y),!(!f||!f.body)&&f.body.emit("error",y)};if(d&&d.aborted){p();return}let w=()=>{p(),T()},_=h(a.toString(),l);d&&d.addEventListener("abort",w);let T=()=>{_.abort(),d&&d.removeEventListener("abort",w)};_.on("error",y=>{n(new Te(`request to ${o.url} failed, reason: ${y.message}`,"system",y)),T()}),XC(_,y=>{f&&f.body&&f.body.destroy(y)}),process.version<"v14"&&_.on("socket",y=>{let M;y.prependListener("end",()=>{M=y._eventsCount}),y.prependListener("close",k=>{if(f&&M<y._eventsCount&&!k){let E=new Error("Premature close");E.code="ERR_STREAM_PREMATURE_CLOSE",f.body.emit("error",E)}})}),_.on("response",y=>{_.setTimeout(0);let M=fb(y.rawHeaders);if(Pi(y.statusCode)){let j=M.get("Location"),U=null;try{U=j===null?null:new URL(j,o.url)}catch{if(o.redirect!=="manual"){n(new Te(`uri requested responds with an invalid redirect URL: ${j}`,"invalid-redirect")),T();return}}switch(o.redirect){case"error":n(new Te(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),T();return;case"manual":break;case"follow":{if(U===null)break;if(o.counter>=o.follow){n(new Te(`maximum redirect reached at: ${o.url}`,"max-redirect")),T();return}let z={headers:new Ie(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:Vr(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!nb(o.url,U)||!ib(o.url,U))for(let rt of["authorization","www-authenticate","cookie","cookie2"])z.headers.delete(rt);if(y.statusCode!==303&&o.body&&e.body instanceof qe.default.Readable){n(new Te("Cannot follow redirect with body being a readable stream","unsupported-redirect")),T();return}(y.statusCode===303||(y.statusCode===301||y.statusCode===302)&&o.method==="POST")&&(z.method="GET",z.body=void 0,z.headers.delete("content-length"));let De=vb(M);De&&(z.referrerPolicy=De),r(It(new gr(U,z))),T();return}default:return n(new TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}d&&y.once("end",()=>{d.removeEventListener("abort",w)});let k=(0,qe.pipeline)(y,new qe.PassThrough,j=>{j&&n(j)});process.version<"v12.10"&&y.on("aborted",w);let E={url:o.url,status:y.statusCode,statusText:y.statusMessage,headers:M,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},L=M.get("Content-Encoding");if(!o.compress||o.method==="HEAD"||L===null||y.statusCode===204||y.statusCode===304){f=new ze(k,E),r(f);return}let K={flush:br.default.Z_SYNC_FLUSH,finishFlush:br.default.Z_SYNC_FLUSH};if(L==="gzip"||L==="x-gzip"){k=(0,qe.pipeline)(k,br.default.createGunzip(K),j=>{j&&n(j)}),f=new ze(k,E),r(f);return}if(L==="deflate"||L==="x-deflate"){let j=(0,qe.pipeline)(y,new qe.PassThrough,U=>{U&&n(U)});j.once("data",U=>{(U[0]&15)===8?k=(0,qe.pipeline)(k,br.default.createInflate(),z=>{z&&n(z)}):k=(0,qe.pipeline)(k,br.default.createInflateRaw(),z=>{z&&n(z)}),f=new ze(k,E),r(f)}),j.once("end",()=>{f||(f=new ze(k,E),r(f))});return}if(L==="br"){k=(0,qe.pipeline)(k,br.default.createBrotliDecompress(),j=>{j&&n(j)}),f=new ze(k,E),r(f);return}f=new ze(k,E),r(f)}),db(_,o).catch(n)})}function XC(t,e){let r=Us.Buffer.from(`0\r
110
+ `,u,`\r
111
+ `)),n.push(`--${r}--`),new e(n,{type:"multipart/form-data; boundary="+r})}var Is,BC,FC,Bg,$C,Fg,vu,ur,lr,fi=cs(()=>{"use strict";Os();wu();({toStringTag:Is,iterator:BC,hasInstance:FC}=Symbol),Bg=Math.random,$C="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),Fg=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[Is])?[(r=r!==void 0?r+"":e[Is]=="File"?e.name:"blob",t),e.name!==r||e[Is]=="blob"?new Hr([e],r,e):e]:[t,e+""]),vu=(t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
112
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),ur=(t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},lr=class{#e=[];constructor(...e){if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Is](){return"FormData"}[BC](){return this.entries()}static[FC](e){return e&&typeof e=="object"&&e[Is]==="FormData"&&!$C.some(r=>typeof e[r]!="function")}append(...e){ur("append",arguments,2),this.#e.push(Fg(...e))}delete(e){ur("delete",arguments,1),e+="",this.#e=this.#e.filter(([r])=>r!==e)}get(e){ur("get",arguments,1),e+="";for(var r=this.#e,n=r.length,o=0;o<n;o++)if(r[o][0]===e)return r[o][1];return null}getAll(e,r){return ur("getAll",arguments,1),r=[],e+="",this.#e.forEach(n=>n[0]===e&&r.push(n[1])),r}has(e){return ur("has",arguments,1),e+="",this.#e.some(r=>r[0]===e)}forEach(e,r){ur("forEach",arguments,1);for(var[n,o]of this)e.call(r,o,n,this)}set(...e){ur("set",arguments,2);var r=[],n=!0;e=Fg(...e),this.#e.forEach(o=>{o[0]===e[0]?n&&(n=!r.push(e)):r.push(o)}),n&&r.push(e),this.#e=r}*entries(){yield*this.#e}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}}});var Wg=S((cE,Ug)=>{"use strict";if(!globalThis.DOMException)try{let{MessageChannel:t}=require("worker_threads"),e=new t().port1,r=new ArrayBuffer;e.postMessage(r,[r,r])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}Ug.exports=globalThis.DOMException});var pi,jC,LC,fE,Tu=cs(()=>{"use strict";pi=require("fs"),jC=require("path"),LC=ie(Wg(),1);wu();Os();({stat:fE}=pi.promises)});var Hg={};d_(Hg,{toFormData:()=>VC});function GC(t){let e=t.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!e)return;let r=e[2]||e[3]||"",n=r.slice(r.lastIndexOf("\\")+1);return n=n.replace(/%22/g,'"'),n=n.replace(/&#(\d{4});/g,(o,u)=>String.fromCharCode(u)),n}async function VC(t,e){if(!/multipart/i.test(e))throw new TypeError("Failed to fetch");let r=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw new TypeError("no or bad content-type header, no multipart boundary");let n=new Ru(r[1]||r[2]),o,u,l,h,d,m,p=[],w=new lr,_=P=>{l+=k.decode(P,{stream:!0})},R=P=>{p.push(P)},y=()=>{let P=new Hr(p,m,{type:d});w.append(h,P)},D=()=>{w.append(h,l)},k=new TextDecoder("utf-8");k.decode(),n.onPartBegin=function(){n.onPartData=_,n.onPartEnd=D,o="",u="",l="",h="",d="",m=null,p.length=0},n.onHeaderField=function(P){o+=k.decode(P,{stream:!0})},n.onHeaderValue=function(P){u+=k.decode(P,{stream:!0})},n.onHeaderEnd=function(){if(u+=k.decode(),o=o.toLowerCase(),o==="content-disposition"){let P=u.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);P&&(h=P[2]||P[3]||""),m=GC(u),m&&(n.onPartData=R,n.onPartEnd=y)}else o==="content-type"&&(d=u);u="",o=""};for await(let P of t)n.write(P);return n.end(),w}var ot,Q,zg,Ut,gi,bi,NC,Ds,UC,WC,zC,HC,cr,Ru,Gg=cs(()=>{"use strict";Tu();fi();ot=0,Q={START_BOUNDARY:ot++,HEADER_FIELD_START:ot++,HEADER_FIELD:ot++,HEADER_VALUE_START:ot++,HEADER_VALUE:ot++,HEADER_VALUE_ALMOST_DONE:ot++,HEADERS_ALMOST_DONE:ot++,PART_DATA_START:ot++,PART_DATA:ot++,END:ot++},zg=1,Ut={PART_BOUNDARY:zg,LAST_BOUNDARY:zg*=2},gi=10,bi=13,NC=32,Ds=45,UC=58,WC=97,zC=122,HC=t=>t|32,cr=()=>{},Ru=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=cr,this.onHeaderField=cr,this.onHeadersEnd=cr,this.onHeaderValue=cr,this.onPartBegin=cr,this.onPartData=cr,this.onPartEnd=cr,this.boundaryChars={},e=`\r
113
+ --`+e;let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n),this.boundaryChars[r[n]]=!0;this.boundary=r,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=Q.START_BOUNDARY}write(e){let r=0,n=e.length,o=this.index,{lookbehind:u,boundary:l,boundaryChars:h,index:d,state:m,flags:p}=this,w=this.boundary.length,_=w-1,R=e.length,y,D,k=$=>{this[$+"Mark"]=r},P=$=>{delete this[$+"Mark"]},j=($,N,U,Oe)=>{(N===void 0||N!==U)&&this[$](Oe&&Oe.subarray(N,U))},J=($,N)=>{let U=$+"Mark";U in this&&(N?(j($,this[U],r,e),delete this[U]):(j($,this[U],e.length,e),this[U]=0))};for(r=0;r<n;r++)switch(y=e[r],m){case Q.START_BOUNDARY:if(d===l.length-2){if(y===Ds)p|=Ut.LAST_BOUNDARY;else if(y!==bi)return;d++;break}else if(d-1===l.length-2){if(p&Ut.LAST_BOUNDARY&&y===Ds)m=Q.END,p=0;else if(!(p&Ut.LAST_BOUNDARY)&&y===gi)d=0,j("onPartBegin"),m=Q.HEADER_FIELD_START;else return;break}y!==l[d+2]&&(d=-2),y===l[d+2]&&d++;break;case Q.HEADER_FIELD_START:m=Q.HEADER_FIELD,k("onHeaderField"),d=0;case Q.HEADER_FIELD:if(y===bi){P("onHeaderField"),m=Q.HEADERS_ALMOST_DONE;break}if(d++,y===Ds)break;if(y===UC){if(d===1)return;J("onHeaderField",!0),m=Q.HEADER_VALUE_START;break}if(D=HC(y),D<WC||D>zC)return;break;case Q.HEADER_VALUE_START:if(y===NC)break;k("onHeaderValue"),m=Q.HEADER_VALUE;case Q.HEADER_VALUE:y===bi&&(J("onHeaderValue",!0),j("onHeaderEnd"),m=Q.HEADER_VALUE_ALMOST_DONE);break;case Q.HEADER_VALUE_ALMOST_DONE:if(y!==gi)return;m=Q.HEADER_FIELD_START;break;case Q.HEADERS_ALMOST_DONE:if(y!==gi)return;j("onHeadersEnd"),m=Q.PART_DATA_START;break;case Q.PART_DATA_START:m=Q.PART_DATA,k("onPartData");case Q.PART_DATA:if(o=d,d===0){for(r+=_;r<R&&!(e[r]in h);)r+=w;r-=_,y=e[r]}if(d<l.length)l[d]===y?(d===0&&J("onPartData",!0),d++):d=0;else if(d===l.length)d++,y===bi?p|=Ut.PART_BOUNDARY:y===Ds?p|=Ut.LAST_BOUNDARY:d=0;else if(d-1===l.length)if(p&Ut.PART_BOUNDARY){if(d=0,y===gi){p&=~Ut.PART_BOUNDARY,j("onPartEnd"),j("onPartBegin"),m=Q.HEADER_FIELD_START;break}}else p&Ut.LAST_BOUNDARY&&y===Ds?(j("onPartEnd"),m=Q.END,p=0):d=0;if(d>0)u[d-1]=y;else if(o>0){let $=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);j("onPartData",0,o,$),o=0,k("onPartData"),r--}break;case Q.END:break;default:throw new Error(`Unexpected state entered: ${m}`)}J("onHeaderField"),J("onHeaderValue"),J("onPartData"),this.index=d,this.state=m,this.flags=p}end(){if(this.state===Q.HEADER_FIELD_START&&this.index===0||this.state===Q.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Q.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var wb=ie(Bn());var $s=ie(ya());var Xn=ie(kf(),1);var Ta=new WeakMap;function Br(...t){let e=new String(t);return Ta.set(e,t),e}function Me(t){return t instanceof String&&Ta.has(t)}function Fr(t){return Ta.get(t)??[]}var Kn=ie(Sa(),1),sp=require("child_process");var Np=ie(Ca(),1),Zp=require("path");function*Pf(t,e){let r=e==="global";for(let n of t)n.isGlobal===r&&(yield n)}var QS=new Set(["--add","--edit","--remove-section","--rename-section","--replace-all","--unset","--unset-all","-e"]),JS=new Set(["--get","--get-all","--get-color","--get-colorbool","--get-regexp","--get-urlmatch","--list","-l"]),KS=new Set(["edit","remove-section","rename-section","set","unset"]),ZS=new Set(["get","get-color","get-colorbool","list"]);function XS(t,e){for(let{name:n}of Pf(t,"task")){if(QS.has(n))return $r(!0,e);if(JS.has(n))return $r(!1,e)}let r=e.at(0)?.toLowerCase();return r===void 0?null:KS.has(r)?$r(!0,e.slice(1)):ZS.has(r)?$r(!1,e.slice(1)):e.length===1?$r(!1,e):$r(!0,e)}function $r(t=!1,e=[]){let r=e.at(0)?.toLowerCase();return r===void 0?null:{isWrite:t,isRead:!t,key:r,value:e.at(1)}}function eT(t,e){return e.isWrite&&e.value!==void 0?{key:e.key,value:e.value,scope:t}:{key:e.key,scope:t}}function tT(t){let e=t?.indexOf("=")||-1;return!t||e<0?null:{key:t.slice(0,e).trim().toLowerCase(),value:t.slice(e+1)}}function rT(t){for(let{name:e}of Pf(t,"task"))switch(e){case"--global":return"global";case"--system":return"system";case"--worktree":return"worktree";case"--local":return"local";case"--file":case"-f":return"file"}return"local"}function sT({name:t}){if(t==="-c"||t==="--config")return"inline";if(t==="--config-env")return"env"}function*nT(t){for(let e of t){let r=sT(e),n=r&&tT(e.value);n&&(yield{...n,scope:r})}}function iT(t,e,r){let n={read:[],write:[...nT(e)]};return t==="config"&&oT(n,rT(e),XS(e,r)),n}function oT(t,e,r){if(r===null)return;let n=eT(e,r);r.isWrite?t.write.push(n):t.read.push(n)}var Ef={short:new Map([["c",!0]])},aT={short:new Map([["C",!0],["P",!1],["h",!1],["p",!1],["v",!1],...Ef.short.entries()]),long:new Set(["attr-source","config-env","exec-path","git-dir","list-cmds","namespace","super-prefix","work-tree"])},uT={clone:{short:new Map([["b",!0],["j",!0],["l",!1],["n",!1],["o",!0],["q",!1],["s",!1],["u",!0]]),long:new Set(["branch","config","jobs","origin","upload-pack","u","template"])},commit:{short:new Map([["C",!0],["F",!0],["c",!0],["m",!0],["t",!0]]),long:new Set(["file","message","reedit-message","reuse-message","template"])},config:{short:new Map([["e",!1],["f",!0],["l",!1]]),long:new Set(["blob","comment","default","file","type","value"])},fetch:{short:new Map,long:new Set(["upload-pack"])},init:{short:new Map,long:new Set(["template"])},pull:{short:new Map,long:new Set(["upload-pack"])},push:{short:new Map,long:new Set(["exec","receive-pack"])}},lT={short:new Map,long:new Set};function cT(t){let e=uT[t??""]??lT;return{short:new Map([...Ef.short.entries(),...e.short.entries()]),long:e.long}}function Af(t,e=aT){if(t.startsWith("--")){let r=t.indexOf("=");if(r>2)return[{name:t.slice(0,r),value:t.slice(r+1),needsNext:!1}];let n=t.slice(2);return[{name:t,needsNext:e.long.has(n)}]}if(t.length===2){let r=t.charAt(1),n=e.short.get(r);return[{name:t,needsNext:n===!0}]}return hT(t,e.short)}function hT(t,e){let r=t.slice(1).split(""),n=[];for(let o=0;o<r.length;o++){let u=r[o],l=e.get(u);if(l===void 0)return[{name:t,needsNext:!1}];if(l){let h=r.slice(o+1).join("");if(h&&![...h].every(d=>e.has(d)))return n.push({name:`-${u}`,value:h,needsNext:!1}),n}n.push({name:`-${u}`,needsNext:l})}return n}function dT(t,e=[]){let r=0;for(;r<t.length;){let n=String(t[r]);if(!n.startsWith("-")||n.length<2)break;let o=Af(n),u=r+1;for(let l of o){let h={name:l.name,value:l.value,absorbedNext:!1,isGlobal:!0};l.needsNext&&h.value===void 0&&u<t.length&&(h.value=String(t[u]),h.absorbedNext=!0,u++),e.push(h)}r=u}return{flags:e,taskIndex:r}}function fT(t,e,r=[]){let n=cT(e),o=[],u=[],l=0;for(;l<t.length;){let h=t[l];if(Me(h)){u.push(...Fr(h)),l++;continue}let d=String(h);if(d==="--"){for(let w=l+1;w<t.length;w++){let _=t[w];Me(_)?u.push(...Fr(_)):u.push(String(_))}break}if(!d.startsWith("-")||d.length<2){o.push(d),l++;continue}let m=Af(d,n),p=l+1;for(let w of m){let _={name:w.name,value:w.value,absorbedNext:!1,isGlobal:!1};w.needsNext&&_.value===void 0&&p<t.length&&!Me(t[p])&&(_.value=String(t[p]),_.absorbedNext=!0,p++),r.push(_)}l=p}return{flags:r,positionals:o,pathspecs:u}}function*mT({write:t}){for(let e of t)for(let r of pT){let n=r(e.key);n&&(yield n)}}function Fe(t,e,r=String(t)){let n=typeof t=="string"?new RegExp(`\\s*${t.toLowerCase()}`):t;return function(o){if(n.test(o))return{category:e,message:`Configuring ${r} is not permitted without enabling ${e}`}}}function Be(t,e){let r=new RegExp(`\\s*${t.toLowerCase().replace(/\./g,"(..+)?.")}`);return Fe(r,e,t)}var pT=[Fe("alias","allowUnsafeAlias"),Fe("core.askPass","allowUnsafeAskPass"),Fe("core.editor","allowUnsafeEditor"),Fe("core.fsmonitor","allowUnsafeFsMonitor"),Fe("core.gitProxy","allowUnsafeGitProxy"),Fe("core.hooksPath","allowUnsafeHooksPath"),Fe("core.pager","allowUnsafePager"),Fe("core.sshCommand","allowUnsafeSshCommand"),Be("credential.helper","allowUnsafeCredentialHelper"),Be("diff.command","allowUnsafeDiffExternal"),Fe("diff.external","allowUnsafeDiffExternal"),Be("diff.textconv","allowUnsafeDiffTextConv"),Be("filter.clean","allowUnsafeFilter"),Be("filter.smudge","allowUnsafeFilter"),Be("gpg.program","allowUnsafeGpgProgram"),Fe("init.templateDir","allowUnsafeTemplateDir"),Be("merge.driver","allowUnsafeMergeDriver"),Be("mergetool.path","allowUnsafeMergeDriver"),Be("mergetool.cmd","allowUnsafeMergeDriver"),Be("protocol.allow","allowUnsafeProtocolOverride"),Be("remote.receivepack","allowUnsafePack"),Be("remote.uploadpack","allowUnsafePack"),Fe("sequence.editor","allowUnsafeEditor")];function*gT(t,e){for(let r of e)for(let n of bT){let o=n(t,r.name);o&&(yield o)}}function Ss(t,e,r,n=String(e)){let o=typeof e=="string"?new RegExp(`\\s*${e.toLowerCase()}`):e,u=`Use of ${t?`${t} with option `:""}${n} is not permitted without enabling ${r}`;return function(l,h){if((!t||l===t)&&o.test(h))return{category:r,message:u}}}var bT=[Ss(null,/--(upload|receive)-pack/,"allowUnsafePack","--upload-pack or --receive-pack"),Ss("clone",/^-\w*u/,"allowUnsafePack"),Ss("clone","--u","allowUnsafePack"),Ss("push","--exec","allowUnsafePack"),Ss(null,"--template","allowUnsafeTemplateDir")];function Of(t,e,r){return[...gT(t,e),...mT(r)]}function yT(...t){let{flags:e,taskIndex:r}=dT(t),n=r<t.length?String(t[r]).toLowerCase():null,o=n!==null?t.slice(r+1):[],{positionals:u,pathspecs:l}=fT(o,n,e),h=iT(n,e,u);return{task:n,flags:e.map(wT),paths:l,config:h,vulnerabilities:_T(Of(n,e,h))}}function _T(t){return Object.defineProperty(t,"vulnerabilities",{value:t})}function wT({value:t,name:e}){return t!==void 0?{name:e,value:t}:{name:e}}var If={editor:"allowUnsafeEditor",git_askpass:"allowUnsafeAskPass",git_config_global:"allowUnsafeConfigPaths",git_config_system:"allowUnsafeConfigPaths",git_config_count:"allowUnsafeConfigEnvCount",git_config:"allowUnsafeConfigPaths",git_editor:"allowUnsafeEditor",git_exec_path:"allowUnsafeConfigPaths",git_external_diff:"allowUnsafeDiffExternal",git_pager:"allowUnsafePager",git_proxy_command:"allowUnsafeGitProxy",git_template_dir:"allowUnsafeTemplateDir",git_sequence_editor:"allowUnsafeEditor",git_ssh:"allowUnsafeSshCommand",git_ssh_command:"allowUnsafeSshCommand",pager:"allowUnsafePager",prefix:"allowUnsafeConfigPaths",ssh_askpass:"allowUnsafeAskPass"};function*vT(t){let e=parseInt(t.git_config_count??"0",10);for(let r=0;r<e;r++){let n=t[`git_config_key_${r}`],o=t[`git_config_value_${r}`];n!==void 0&&(yield{key:n.toLowerCase().trim(),value:o,scope:"env"})}}function*ST(t){for(let e of Object.keys(t))if(qf(e)){let r=If[e];yield{category:r,message:`Use of "${e.toUpperCase()}" is not permitted without enabling ${r}`}}}function qf(t){return Object.hasOwn(If,t)}function TT(t){let e={};for(let[r,n]of Object.entries(t)){let o=r.toLowerCase().trim();(qf(o)||o.startsWith("git"))&&(e[o]=String(n))}return e}function RT(t){let e=TT(t),r={read:[],write:[...vT(e)]},n=[...ST(e),...Of(null,[],r)];return{config:r,vulnerabilities:n}}function Df(t,e){return[...yT(...t).vulnerabilities,...RT(e).vulnerabilities]}var jr=ie(Ca(),1),fg=require("events");var Va=Object.defineProperty,CT=Object.getOwnPropertyDescriptor,Ya=Object.getOwnPropertyNames,xT=Object.prototype.hasOwnProperty,T=(t,e)=>function(){return t&&(e=(0,t[Ya(t)[0]])(t=0)),e},kT=(t,e)=>function(){return e||(0,t[Ya(t)[0]])((e={exports:{}}).exports,e),e.exports},ne=(t,e)=>{for(var r in e)Va(t,r,{get:e[r],enumerable:!0})},PT=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ya(e))!xT.call(t,o)&&o!==r&&Va(t,o,{get:()=>e[o],enumerable:!(n=CT(e,o))||n.enumerable});return t},te=t=>PT(Va({},"__esModule",{value:!0}),t),vt,Nt=T({"src/lib/errors/git-error.ts"(){"use strict";vt=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),xs,Ur=T({"src/lib/errors/git-response-error.ts"(){"use strict";Nt(),xs=class extends vt{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),dm,fm=T({"src/lib/errors/task-configuration-error.ts"(){"use strict";Nt(),dm=class extends vt{constructor(t){super(void 0,t)}}}});function mm(t){return typeof t!="function"?ir:t}function pm(t){return typeof t=="function"&&t!==ir}function gm(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function bm(t,e=0){return ym(t)&&t.length>e?t[e]:void 0}function nr(t,e=0){if(ym(t)&&t.length>e)return t[t.length-1-e]}function ym(t){return si(t)}function ks(t="",e=!0,r=`
114
+ `){return t.split(r).reduce((n,o)=>{let u=e?o.trim():o;return u&&n.push(u),n},[])}function Qa(t,e){return ks(t,!0).map(r=>e(r))}function Ja(t){return(0,Xn.exists)(t,Xn.FOLDER)}function $e(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function _m(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ei(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function it(t){return Array.isArray(t)?t:[t]}function wm(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function Wr(t){return it(t).map(e=>e instanceof String?e:String(e))}function Y(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function Rs(t,e){let r=[];for(let n=0,o=t.length;n<o;n++)r.push(e,t[n]);return r}function Cs(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function vm(t,e){let r={};return e.forEach(n=>{t[n]!==void 0&&(r[n]=t[n])}),r}function Ia(t=0){return new Promise(e=>setTimeout(e,t))}function qa(t){if(t!==!1)return t}var Lr,ir,Ps,ti=T({"src/lib/utils/util.ts"(){"use strict";Ka(),Lr="\0",ir=()=>{},Ps=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ce(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function Da(t,e){let r=Me(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function ri(t){return!!t&&Ps(t)==="[object Object]"}function Sm(t){return typeof t=="function"}var Es,Tm,ee,Qn,si,Ka=T({"src/lib/utils/argument-filters.ts"(){"use strict";ti(),Es=t=>Array.isArray(t),Tm=t=>typeof t=="number",ee=t=>typeof t=="string"||Me(t),Qn=t=>ee(t)||Array.isArray(t)&&t.every(ee),si=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),Ma,ET=T({"src/lib/utils/exit-codes.ts"(){"use strict";Ma=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Ma||{})}}),Jn,AT=T({"src/lib/utils/git-output-streams.ts"(){"use strict";Jn=class Rm{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new Rm(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function OT(){throw new Error("LineParser:useMatches not implemented")}var M,Lt,IT=T({"src/lib/utils/line-parser.ts"(){"use strict";M=class{constructor(t,e){this.matches=[],this.useMatches=OT,this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((o,u)=>this.addMatch(o,u,r(u)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},Lt=class extends M{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function Cm(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...xm},...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var xm,qT=T({"src/lib/utils/simple-git-options.ts"(){"use strict";xm={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Za(t,e=[]){return ri(t)?Object.keys(t).reduce((r,n)=>{let o=t[n];if(Me(o))r.push(o);else if(Da(o,["boolean"]))r.push(n+"="+o);else if(Array.isArray(o))for(let u of o)Da(u,["string","number"])||r.push(n+"="+u);else r.push(n);return r},e):e}function de(t,e=0,r=!1){let n=[];for(let o=0,u=e<0?t.length:e;o<u;o++)"string|number".includes(typeof t[o])&&n.push(String(t[o]));return Za(Xa(t),n),r||n.push(...DT(t)),n}function DT(t){let e=typeof nr(t)=="function";return Wr(ce(nr(t,e?1:0),Es,[]))}function Xa(t){let e=Sm(nr(t));return ce(nr(t,e?1:0),ri)}function K(t,e=!0){let r=mm(nr(t));return e||pm(r)?r:void 0}var MT=T({"src/lib/utils/task-options.ts"(){"use strict";Ka(),ti()}});function Ba(t,e){return t(e.stdOut,e.stdErr)}function Se(t,e,r,n=!0){return it(r).forEach(o=>{for(let u=ks(o,n),l=0,h=u.length;l<h;l++){let d=(m=0)=>{if(!(l+m>=h))return u[l+m]};e.some(({parse:m})=>m(d,t))}}),t}var BT=T({"src/lib/utils/task-parser.ts"(){"use strict";ti()}}),km={};ne(km,{ExitCodes:()=>Ma,GitOutputStreams:()=>Jn,LineParser:()=>M,NOOP:()=>ir,NULL:()=>Lr,RemoteLineParser:()=>Lt,append:()=>$e,appendTaskOptions:()=>Za,asArray:()=>it,asCamelCase:()=>wm,asFunction:()=>mm,asNumber:()=>Y,asStringArray:()=>Wr,bufferToString:()=>Cs,callTaskParser:()=>Ba,createInstanceConfig:()=>Cm,delay:()=>Ia,filterArray:()=>Es,filterFunction:()=>Sm,filterHasLength:()=>si,filterNumber:()=>Tm,filterPlainObject:()=>ri,filterPrimitives:()=>Da,filterString:()=>ee,filterStringOrStringArray:()=>Qn,filterType:()=>ce,first:()=>bm,folderExists:()=>Ja,forEachLineWithContent:()=>Qa,getTrailingOptions:()=>de,including:()=>_m,isUserFunction:()=>pm,last:()=>nr,objectToString:()=>Ps,orVoid:()=>qa,parseStringResponse:()=>Se,pick:()=>vm,prefixedArray:()=>Rs,remove:()=>ei,splitOn:()=>gm,toLinesWithContent:()=>ks,trailingFunctionArgument:()=>K,trailingOptionsArgument:()=>Xa});var q=T({"src/lib/utils/index.ts"(){"use strict";Ka(),ET(),AT(),IT(),qT(),MT(),BT(),ti()}}),Pm={};ne(Pm,{CheckRepoActions:()=>Fa,checkIsBareRepoTask:()=>Am,checkIsRepoRootTask:()=>Em,checkIsRepoTask:()=>FT});function FT(t){switch(t){case"bare":return Am();case"root":return Em()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:ni,parser:eu}}function Em(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:ni,parser(e){return/^\.(git)?$/.test(e.trim())}}}function Am(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:ni,parser:eu}}function $T(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var Fa,ni,eu,Om=T({"src/lib/tasks/check-is-repo.ts"(){"use strict";q(),Fa=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(Fa||{}),ni=({exitCode:t},e,r,n)=>{if(t===128&&$T(e))return r(Buffer.from("false"));n(e)},eu=t=>t.trim()==="true"}});function jT(t,e){let r=new Im(t),n=t?Dm:qm;return ks(e).forEach(o=>{let u=o.replace(n,"");r.paths.push(u),(Mm.test(u)?r.folders:r.files).push(u)}),r}var Im,qm,Dm,Mm,LT=T({"src/lib/responses/CleanSummary.ts"(){"use strict";q(),Im=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},qm=/^[a-z]+\s*/i,Dm=/^[a-z]+\s+[a-z]+\s*/i,Mm=/\/$/}}),$a={};ne($a,{EMPTY_COMMANDS:()=>ii,adhocExecTask:()=>Bm,configurationErrorTask:()=>ve,isBufferTask:()=>$m,isEmptyTask:()=>jm,straightThroughBufferTask:()=>Fm,straightThroughStringTask:()=>fe});function Bm(t){return{commands:ii,format:"empty",parser:t}}function ve(t){return{commands:ii,format:"empty",parser(){throw typeof t=="string"?new dm(t):t}}}function fe(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function Fm(t){return{commands:t,format:"buffer",parser(e){return e}}}function $m(t){return t.format==="buffer"}function jm(t){return t.format==="empty"||!t.commands.length}var ii,re=T({"src/lib/tasks/task.ts"(){"use strict";fm(),ii=[]}}),Lm={};ne(Lm,{CONFIG_ERROR_INTERACTIVE_MODE:()=>tu,CONFIG_ERROR_MODE_REQUIRED:()=>ru,CONFIG_ERROR_UNKNOWN_OPTION:()=>su,CleanOptions:()=>Hn,cleanTask:()=>Nm,cleanWithOptionsTask:()=>NT,isCleanOptionsArray:()=>UT});function NT(t,e){let{cleanMode:r,options:n,valid:o}=WT(t);return r?o.options?(n.push(...e),n.some(GT)?ve(tu):Nm(r,n)):ve(su+JSON.stringify(t)):ve(ru)}function Nm(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(n){return jT(t==="n",n)}}}function UT(t){return Array.isArray(t)&&t.every(e=>nu.has(e))}function WT(t){let e,r=[],n={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(o=>{zT(o)?(e=o,n.cleanMode=!0):n.options=n.options&&HT(r[r.length]=`-${o}`)}),{cleanMode:e,options:r,valid:n}}function zT(t){return t==="f"||t==="n"}function HT(t){return/^-[a-z]$/i.test(t)&&nu.has(t.charAt(1))}function GT(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var tu,ru,su,Hn,nu,Um=T({"src/lib/tasks/clean.ts"(){"use strict";LT(),q(),re(),tu="Git clean interactive mode is not supported",ru='Git clean mode parameter ("n" or "f") is required',su="Git clean unknown option found in: ",Hn=(t=>(t.DRY_RUN="n",t.FORCE="f",t.IGNORED_INCLUDED="x",t.IGNORED_ONLY="X",t.EXCLUDING="e",t.QUIET="q",t.RECURSIVE="d",t))(Hn||{}),nu=new Set(["i",...Wr(Object.values(Hn))])}});function VT(t){let e=new zm;for(let r of Wm(t))e.addValue(r.file,String(r.key),r.value);return e}function YT(t,e){let r=null,n=[],o=new Map;for(let u of Wm(t,e))u.key===e&&(n.push(r=u.value),o.has(u.file)||o.set(u.file,[]),o.get(u.file).push(r));return{key:e,paths:Array.from(o.keys()),scopes:o,value:r,values:n}}function QT(t){return t.replace(/^(file):/,"")}function*Wm(t,e=null){let r=t.split("\0");for(let n=0,o=r.length-1;n<o;){let u=QT(r[n++]),l=r[n++],h=e;if(l.includes(`
115
+ `)){let d=gm(l,`
116
+ `);h=d[0],l=d[1]}yield{file:u,key:h,value:l}}}var zm,JT=T({"src/lib/responses/ConfigList.ts"(){"use strict";q(),zm=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=nr(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);Object.hasOwn(n,e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function xa(t,e){return typeof t=="string"&&Object.hasOwn(ja,t)?t:e}function KT(t,e,r,n){let o=["config",`--${n}`];return r&&o.push("--add"),o.push(t,e),{commands:o,format:"utf-8",parser(u){return u}}}function ZT(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return YT(n,t)}}}function XT(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return VT(r)}}}function eR(){return{addConfig(t,e,...r){return this._runTask(KT(t,e,r[0]===!0,xa(r[1],"local")),K(arguments))},getConfig(t,e){return this._runTask(ZT(t,xa(e,void 0)),K(arguments))},listConfig(...t){return this._runTask(XT(xa(t[0],void 0)),K(arguments))}}}var ja,Hm=T({"src/lib/tasks/config.ts"(){"use strict";JT(),q(),ja=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(ja||{})}});function tR(t){return Gm.has(t)}var ka,Gm,Vm=T({"src/lib/tasks/diff-name-status.ts"(){"use strict";ka=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(ka||{}),Gm=new Set(Object.values(ka))}});function rR(...t){return new Qm().param(...t)}function sR(t){let e=new Set,r={};return Qa(t,n=>{let[o,u,l]=n.split(Lr);e.add(o),(r[o]=r[o]||[]).push({line:Y(u),path:o,preview:l})}),{paths:e,results:r}}function nR(){return{grep(t){let e=K(arguments),r=de(arguments);for(let o of Ym)if(r.includes(o))return this._runTask(ve(`git.grep: use of "${o}" is not supported.`),e);typeof t=="string"&&(t=rR().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(o){return sR(o)}},e)}}}var Ym,Ts,Mf,Qm,Jm=T({"src/lib/tasks/grep.ts"(){"use strict";q(),re(),Ym=["-h"],Ts=Symbol("grepQuery"),Qm=class{constructor(){this[Mf]=[]}*[(Mf=Ts,Symbol.iterator)](){for(let t of this[Ts])yield t}and(...t){return t.length&&this[Ts].push("--and","(",...Rs(t,"-e"),")"),this}param(...t){return this[Ts].push(...Rs(t,"-e")),this}}}}),Km={};ne(Km,{ResetMode:()=>Gn,getResetMode:()=>oR,resetTask:()=>iR});function iR(t,e){let r=["reset"];return Zm(t)&&r.push(`--${t}`),r.push(...e),fe(r)}function oR(t){if(Zm(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function Zm(t){return typeof t=="string"&&Xm.includes(t)}var Gn,Xm,ep=T({"src/lib/tasks/reset.ts"(){"use strict";q(),re(),Gn=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Gn||{}),Xm=Wr(Object.values(Gn))}});function aR(){return(0,Kn.default)("simple-git")}function Bf(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...o)=>{t(n,...o),r(n,...o)}:t:(n,...o)=>{t(`%s ${n}`,e,...o),r&&r(n,...o)}}function uR(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function iu(t,e,r,n=aR()){let o=t&&`[${t}]`||"",u=[],l=typeof e=="string"?n.extend(e):e,h=uR(ce(e,ee),l,n);return m(r);function d(p,w){return $e(u,iu(t,h.replace(/^[^:]+/,p),w,n))}function m(p){let w=p&&`[${p}]`||"",_=l&&Bf(l,w)||ir,R=Bf(n,`${o} ${w}`,_);return Object.assign(l?_:R,{label:t,sibling:d,info:R,step:m})}}var tp=T({"src/lib/git-logger.ts"(){"use strict";q(),Kn.default.formatters.L=t=>String(si(t)?t.length:"-"),Kn.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):Ps(t)}}),rp,lR=T({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";Nt(),tp(),rp=class La{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){let r=La.getName(e.commands[0]),n=iu(this.logLabel,r);return{task:e,logger:n,name:r}}push(e){let r=this.createProgress(e);return r.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,r),r}fatal(e){for(let[r,{logger:n}]of Array.from(this._queue.entries()))r===e.task?(n.info("Failed %o",e),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",e.message),this.complete(r);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let r=this.withProgress(e);if(!r)throw new vt(void 0,"TasksPendingQueue: attempt called for an unknown task");return r.logger("Starting task"),r}static getName(e="empty"){return`task:${e}:${++La.counter}`}static{this.counter=0}}}});function sr(t,e){return{method:bm(t.commands)||"",commands:e}}function cR(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}function Ff(t,e,r,n){return o=>{r("%s received %L bytes",e,o),n("%B",o),t.push(o)}}var Na,hR=T({"src/lib/runners/git-executor-chain.ts"(){"use strict";Nt(),re(),q(),lR(),Na=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new rp}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}async attemptTask(t){let e=await this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:n}=this._queue.attempt(t);return await(jm(t)?this.attemptEmptyTask(t,n):this.attemptRemoteTask(t,n))}catch(n){throw this.onFatalException(t,n)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof vt?Object.assign(e,{task:t}):new vt(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(t,e){let r=this._plugins.exec("spawn.binary","",sr(t,t.commands)),n=this._plugins.exec("spawn.args",[...t.commands],{...sr(t,t.commands),env:{...this.env}}),o=await this.gitResponse(t,r,n,this.outputHandler,e.step("SPAWN")),u=await this.handleTaskData(t,n,o,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),$m(t)?Ba(t.parser,u):Ba(t.parser,u.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,n){let{exitCode:o,rejection:u,stdOut:l,stdErr:h}=r;return new Promise((d,m)=>{n("Preparing to handle process response exitCode=%d stdOut=",o);let{error:p}=this._plugins.exec("task.error",{error:u},{...sr(t,e),...r});if(p&&t.onError)return n.info("exitCode=%s handling with custom error handler"),t.onError(r,p,w=>{n.info("custom error handler treated as success"),n("custom error returned a %s",Ps(w)),d(new Jn(Array.isArray(w)?Buffer.concat(w):w,Buffer.concat(h)))},m);if(p)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",o,h.length,u),m(p);n.info("retrieving task output complete"),d(new Jn(Buffer.concat(l),Buffer.concat(h)))})}async gitResponse(t,e,r,n,o){let u=o.sibling("output"),l=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},sr(t,t.commands));return new Promise(h=>{let d=[],m=[];o.info("%s %o",e,r),o("%O",l);let p=this._beforeSpawn(t,r);if(p)return h({stdOut:d,stdErr:m,exitCode:9901,rejection:p});this._plugins.exec("spawn.before",void 0,{...sr(t,r),kill(_){p=_||p}});let w=(0,sp.spawn)(e,r,l);w.stdout.on("data",Ff(d,"stdOut",o,u.step("stdOut"))),w.stderr.on("data",Ff(m,"stdErr",o,u.step("stdErr"))),w.on("error",cR(m,o)),n&&(o("Passing child process stdOut/stdErr to custom outputHandler"),n(e,w.stdout,w.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...sr(t,r),spawned:w,close(_,R){h({stdOut:d,stdErr:m,exitCode:_,rejection:p||R})},kill(_){w.killed||(p=_,w.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...sr(t,e),kill(n){r=n||r}}),r}}}}),np={};ne(np,{GitExecutor:()=>ip});var ip,dR=T({"src/lib/runners/git-executor.ts"(){"use strict";hR(),ip=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new Na(this,this._scheduler,this._plugins)}chain(){return new Na(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function fR(t,e,r=ir){let n=u=>{r(null,u)},o=u=>{u?.task===t&&r(u instanceof xs?mR(u):u,void 0)};e.then(n,o)}function mR(t){let e=n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),e=ir};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(n,o){return o in t||(n[o]={enumerable:!1,configurable:!1,get(){return e(o),t.git[o]}}),n}}var pR=T({"src/lib/task-callback.ts"(){"use strict";Ur(),q()}});function $f(t,e){return Bm(r=>{if(!Ja(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var gR=T({"src/lib/tasks/change-working-directory.ts"(){"use strict";q(),re()}});function Pa(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=ei(e,"-B")),fe(e)}function bR(){return{checkout(){return this._runTask(Pa(de(arguments,1)),K(arguments))},checkoutBranch(t,e){return this._runTask(Pa(["-b",t,e,...de(arguments)]),K(arguments))},checkoutLocalBranch(t){return this._runTask(Pa(["-b",t,...de(arguments)]),K(arguments))}}}var yR=T({"src/lib/tasks/checkout.ts"(){"use strict";q(),re()}});function _R(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function wR(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return Se(_R(),[op],t)}})}}}var op,vR=T({"src/lib/tasks/count-objects.ts"(){"use strict";q(),op=new M(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let n=wm(e);Object.hasOwn(t,n)&&(t[n]=Y(r))})}});function SR(t){return Se({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},ap,t)}var ap,TR=T({"src/lib/parsers/parse-commit.ts"(){"use strict";q(),ap=[new M(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,n])=>{t.branch=e,t.commit=n,t.root=!!r}),new M(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),n=r.pop();!n||!n.includes("@")||(t.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new M(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(n,10)||0}),new M(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0;let o=parseInt(r,10)||0;n==="-"?t.summary.deletions=o:n==="+"&&(t.summary.insertions=o)})]}});function RR(t,e,r){return{commands:["-c","core.abbrev=40","commit",...Rs(t,"-m"),...e,...r],format:"utf-8",parser:SR}}function CR(){return{commit(e,...r){let n=K(arguments),o=t(e)||RR(it(e),it(ce(r[0],Qn,[])),[...Wr(ce(r[1],Es,[])),...de(arguments,0,!0)]);return this._runTask(o,n)}};function t(e){return!Qn(e)&&ve("git.commit: requires the commit message to be supplied as a string/string[]")}}var xR=T({"src/lib/tasks/commit.ts"(){"use strict";TR(),q(),re()}});function kR(){return{firstCommit(){return this._runTask(fe(["rev-list","--max-parents=0","HEAD"],!0),K(arguments))}}}var PR=T({"src/lib/tasks/first-commit.ts"(){"use strict";q(),re()}});function ER(t,e){let r=["hash-object",t];return e&&r.push("-w"),fe(r,!0)}var AR=T({"src/lib/tasks/hash-object.ts"(){"use strict";re()}});function OR(t,e,r){let n=String(r).trim(),o;if(o=up.exec(n))return new Vn(t,e,!1,o[1]);if(o=lp.exec(n))return new Vn(t,e,!0,o[1]);let u="",l=n.split(" ");for(;l.length;)if(l.shift()==="in"){u=l.join(" ");break}return new Vn(t,e,/^re/i.test(n),u)}var Vn,up,lp,IR=T({"src/lib/responses/InitSummary.ts"(){"use strict";Vn=class{constructor(t,e,r,n){this.bare=t,this.path=e,this.existing=r,this.gitDir=n}},up=/^Init.+ repository in (.+)$/,lp=/^Rein.+ in (.+)$/}});function qR(t){return t.includes(ou)}function DR(t=!1,e,r){let n=["init",...r];return t&&!qR(n)&&n.splice(1,0,ou),{commands:n,format:"utf-8",parser(o){return OR(n.includes("--bare"),e,o)}}}var ou,MR=T({"src/lib/tasks/init.ts"(){"use strict";IR(),ou="--bare"}});function au(t){for(let e=0;e<t.length;e++){let r=uu.exec(t[e]);if(r)return`--${r[1]}`}return""}function BR(t){return uu.test(t)}var uu,As=T({"src/lib/args/log-format.ts"(){"use strict";uu=/^--(stat|numstat|name-only|name-status)(=|$)/}}),cp,FR=T({"src/lib/responses/DiffSummary.ts"(){"use strict";cp=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function hp(t=""){let e=dp[t];return r=>Se(new cp,e,r,!1)}var Ea,jf,Lf,Nf,dp,fp=T({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";As(),FR(),Vm(),q(),Ea=[new M(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,n=""])=>{t.files.push({file:e.trim(),changes:Y(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new M(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,n])=>{t.files.push({file:e.trim(),before:Y(r),after:Y(n),binary:!0})}),new M(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let n=/(\d+) i/.exec(r),o=/(\d+) d/.exec(r);t.changed=Y(e),t.insertions=Y(n?.[1]),t.deletions=Y(o?.[1])})],jf=[new M(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,n])=>{let o=Y(e),u=Y(r);t.changed++,t.insertions+=o,t.deletions+=u,t.files.push({file:n,changes:o+u,insertions:o,deletions:u,binary:!1})}),new M(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],Lf=[new M(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],Nf=[new M(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,n,o,u])=>{t.changed++,t.files.push({file:u??n,changes:0,insertions:0,deletions:0,binary:!1,status:qa(tR(e)&&e),from:qa(!!u&&n!==u&&n),similarity:Y(r)})})],dp={"":Ea,"--stat":Ea,"--numstat":jf,"--name-status":Nf,"--name-only":Lf}}});function $R(t,e){return e.reduce((r,n,o)=>(r[n]=t[o]||"",r),Object.create({diff:null}))}function mp(t=hu,e=pp,r=""){let n=hp(r);return function(o){let u=ks(o.trim(),!1,lu).map(function(l){let h=l.split(cu),d=$R(h[0].split(t),e);return h.length>1&&h[1].trim()&&(d.diff=n(h[1])),d});return{all:u,latest:u.length&&u[0]||null,total:u.length}}}var lu,cu,hu,pp,gp=T({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";q(),fp(),As(),lu="\xF2\xF2\xF2\xF2\xF2\xF2 ",cu=" \xF2\xF2",hu=" \xF2 ",pp=["hash","date","message","refs","author_name","author_email"]}}),bp={};ne(bp,{diffSummaryTask:()=>jR,validateLogFormatConfig:()=>oi});function jR(t){let e=au(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),oi(r)||{commands:r,format:"utf-8",parser:hp(e)}}function oi(t){let e=t.filter(BR);if(e.length>1)return ve(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return ve(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var du=T({"src/lib/tasks/diff.ts"(){"use strict";As(),fp(),re()}});function LR(t,e){let r=[],n=[];return Object.keys(t).forEach(o=>{r.push(o),n.push(String(t[o]))}),[r,n.join(e)]}function NR(t){return Object.keys(t).reduce((e,r)=>(r in Ua||(e[r]=t[r]),e),{})}function yp(t={},e=[]){let r=ce(t.splitter,ee,hu),n=ri(t.format)?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[o,u]=LR(n,r),l=[],h=[`--pretty=format:${lu}${u}${cu}`,...e],d=t.n||t["max-count"]||t.maxCount;if(d&&h.push(`--max-count=${d}`),t.from||t.to){let m=t.symmetric!==!1?"...":"..";l.push(`${t.from||""}${m}${t.to||""}`)}return ee(t.file)&&h.push("--follow",Br(t.file)),Za(NR(t),h),{fields:o,splitter:r,commands:[...h,...l]}}function UR(t,e,r){let n=mp(t,e,au(r));return{commands:["log",...r],format:"utf-8",parser:n}}function WR(){return{log(...r){let n=K(arguments),o=yp(Xa(arguments),Wr(ce(arguments[0],Es,[]))),u=e(...r)||oi(o.commands)||t(o);return this._runTask(u,n)}};function t(r){return UR(r.splitter,r.fields,r.commands)}function e(r,n){return ee(r)&&ee(n)&&ve("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Ua,_p=T({"src/lib/tasks/log.ts"(){"use strict";As(),gp(),q(),re(),du(),Ua=(t=>(t[t["--pretty"]=0]="--pretty",t[t["max-count"]=1]="max-count",t[t.maxCount=2]="maxCount",t[t.n=3]="n",t[t.file=4]="file",t[t.format=5]="format",t[t.from=6]="from",t[t.to=7]="to",t[t.splitter=8]="splitter",t[t.symmetric=9]="symmetric",t[t.mailMap=10]="mailMap",t[t.multiLine=11]="multiLine",t[t.strictDate=12]="strictDate",t))(Ua||{})}}),Yn,wp,zR=T({"src/lib/responses/MergeSummary.ts"(){"use strict";Yn=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},wp=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),Wa,vp,HR=T({"src/lib/responses/PullSummary.ts"(){"use strict";Wa=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},vp=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Aa(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function Uf(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:Y(e&&e[1]||"0"),delta:Y(r&&r[1]||"0")}}var Sp,GR=T({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";q(),Sp=[new Lt(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let n=e.toLowerCase(),o=Aa(t.remoteMessages);Object.assign(o,{[n]:Y(r)})}),new Lt(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let n=e.toLowerCase(),o=Aa(t.remoteMessages);Object.assign(o,{[n]:Y(r)})}),new Lt(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,n])=>{let o=Aa(t.remoteMessages);o.total=Uf(e),o.reused=Uf(r),o.packReused=Y(n)})]}});function Tp(t,e){return Se({remoteMessages:new Cp},Rp,e)}var Rp,Cp,xp=T({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";q(),GR(),Rp=[new Lt(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...Sp,new Lt([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new Lt([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,n])=>{t.remoteMessages.vulnerabilities={count:Y(e),summary:r,url:n}})],Cp=class{constructor(){this.all=[]}}}});function VR(t,e){let r=Se(new vp,kp,[t,e]);return r.message&&r}var Wf,zf,Hf,Gf,kp,Vf,fu,Pp=T({"src/lib/parsers/parse-pull.ts"(){"use strict";HR(),q(),xp(),Wf=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,zf=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,Hf=/^(create|delete) mode \d+ (.+)/,Gf=[new M(Wf,(t,[e,r,n])=>{t.files.push(e),r&&(t.insertions[e]=r.length),n&&(t.deletions[e]=n.length)}),new M(zf,(t,[e,,r,,n])=>r!==void 0||n!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+n||0,!0):!1),new M(Hf,(t,[e,r])=>{$e(t.files,r),$e(e==="create"?t.created:t.deleted,r)})],kp=[new M(/^from\s(.+)$/i,(t,[e])=>{t.remote=e}),new M(/^fatal:\s(.+)$/,(t,[e])=>{t.message=e}),new M(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,n,o])=>{t.branch.local=n,t.hash.local=e,t.branch.remote=o,t.hash.remote=r})],Vf=(t,e)=>Se(new Wa,Gf,[t,e]),fu=(t,e)=>Object.assign(new Wa,Vf(t,e),Tp(t,e))}}),Yf,Ep,Qf,YR=T({"src/lib/parsers/parse-merge.ts"(){"use strict";zR(),q(),Pp(),Yf=[new M(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new M(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new Yn(e,r))}),new M(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,n])=>{t.conflicts.push(new Yn(e,r,{deleteRef:n}))}),new M(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new Yn(e,null))}),new M(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],Ep=(t,e)=>Object.assign(Qf(t,e),fu(t,e)),Qf=t=>Se(new wp,Yf,t)}});function Jf(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let n=Ep(e,r);if(n.failed)throw new xs(n);return n}}:ve("Git.merge requires at least one option")}var QR=T({"src/lib/tasks/merge.ts"(){"use strict";Ur(),YR(),re()}});function JR(t,e,r){let n=r.includes("deleted"),o=r.includes("tag")||/^refs\/tags/.test(t),u=!r.includes("new");return{deleted:n,tag:o,branch:!o,new:!u,alreadyUpdated:u,local:t,remote:e}}var Kf,Ap,Zf,KR=T({"src/lib/parsers/parse-push.ts"(){"use strict";q(),xp(),Kf=[new M(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new M(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new M(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,n])=>{t.pushed.push(JR(e,r,n))}),new M(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,n])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:n}}),new M(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,n,o])=>{t.update={head:{local:e,remote:r},hash:{from:n,to:o}}})],Ap=(t,e)=>{let r=Zf(t,e),n=Tp(t,e);return{...r,...n}},Zf=(t,e)=>Se({pushed:[]},Kf,[t,e])}}),Op={};ne(Op,{pushTagsTask:()=>ZR,pushTask:()=>mu});function ZR(t={},e){return $e(e,"--tags"),mu(t,e)}function mu(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),ei(r,"-v"),$e(r,"--verbose"),$e(r,"--porcelain"),{commands:r,format:"utf-8",parser:Ap}}var Ip=T({"src/lib/tasks/push.ts"(){"use strict";KR(),q()}});function XR(){return{showBuffer(){let t=["show",...de(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(Fm(t),K(arguments))},show(){let t=["show",...de(arguments,1)];return this._runTask(fe(t),K(arguments))}}}var e0=T({"src/lib/tasks/show.ts"(){"use strict";q(),re()}}),Xf,qp,t0=T({"src/lib/responses/FileStatusSummary.ts"(){"use strict";Xf=/^(.+)\0(.+)$/,qp=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let n=Xf.exec(t)||[null,t,t];this.from=n[2]||"",this.path=n[1]||""}}}}});function em(t){let[e,r]=t.split(Lr);return{from:r||e,to:e}}function ke(t,e,r){return[`${t}${e}`,r]}function Oa(t,...e){return e.map(r=>ke(t,r,(n,o)=>n.conflicted.push(o)))}function r0(t,e){let r=e.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.slice(3));case r.charAt(1):return n(" ",r.charAt(0),r.slice(2));default:return}function n(o,u,l){let h=`${o}${u}`,d=Dp.get(h);d&&d(t,l),h!=="##"&&h!=="!!"&&t.files.push(new qp(l,o,u))}}var tm,Dp,Mp,s0=T({"src/lib/responses/StatusSummary.ts"(){"use strict";q(),t0(),tm=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},Dp=new Map([ke(" ","A",(t,e)=>t.created.push(e)),ke(" ","D",(t,e)=>t.deleted.push(e)),ke(" ","M",(t,e)=>t.modified.push(e)),ke("A"," ",(t,e)=>{t.created.push(e),t.staged.push(e)}),ke("A","M",(t,e)=>{t.created.push(e),t.staged.push(e),t.modified.push(e)}),ke("D"," ",(t,e)=>{t.deleted.push(e),t.staged.push(e)}),ke("M"," ",(t,e)=>{t.modified.push(e),t.staged.push(e)}),ke("M","M",(t,e)=>{t.modified.push(e),t.staged.push(e)}),ke("R"," ",(t,e)=>{t.renamed.push(em(e))}),ke("R","M",(t,e)=>{let r=em(e);t.renamed.push(r),t.modified.push(r.to)}),ke("!","!",(t,e)=>{(t.ignored=t.ignored||[]).push(e)}),ke("?","?",(t,e)=>t.not_added.push(e)),...Oa("A","A","U"),...Oa("D","D","U"),...Oa("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,o=/^(.+?(?=(?:\.{3}|\s|$)))/,u=/\.{3}(\S*)/,l=/\son\s(\S+?)(?=\.{3}|$)/,h=r.exec(e);t.ahead=h&&+h[1]||0,h=n.exec(e),t.behind=h&&+h[1]||0,h=o.exec(e),t.current=ce(h?.[1],ee,null),h=u.exec(e),t.tracking=ce(h?.[1],ee,null),h=l.exec(e),h&&(t.current=ce(h?.[1],ee,t.current)),t.detached=/\(no branch\)/.test(e)}]]),Mp=function(t){let e=t.split(Lr),r=new tm;for(let n=0,o=e.length;n<o;){let u=e[n++].trim();u&&(u.charAt(0)==="R"&&(u+=Lr+(e[n++]||"")),r0(r,u))}return r}}});function n0(t){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...t.filter(r=>!Bp.includes(r))],parser(r){return Mp(r)}}}var Bp,i0=T({"src/lib/tasks/status.ts"(){"use strict";s0(),Bp=["--null","-z"]}});function Zn(t=0,e=0,r=0,n="",o=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:n,installed:o},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function o0(){return Zn(0,0,0,"",!1)}function a0(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:u0,onError(t,e,r,n){if(t.exitCode===-2)return r(Buffer.from(pu));n(e)}})}}}function u0(t){return t===pu?o0():Se(Zn(0,0,0,t),Fp,t)}var pu,Fp,l0=T({"src/lib/tasks/version.ts"(){"use strict";q(),pu="installed=false",Fp=[new M(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,n,o=""])=>{Object.assign(t,Zn(Y(e),Y(r),Y(n),o))}),new M(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,n,o=""])=>{Object.assign(t,Zn(Y(e),Y(r),n,o))})]}});function rm(t,e,r,...n){return ee(r)?e(r,ce(n[0],ee),de(arguments)):ve(`git.${t}() requires a string 'repoPath'`)}function c0(){return{clone(t,...e){return this._runTask(rm("clone",za,ce(t,ee),...e),K(arguments))},mirror(t,...e){return this._runTask(rm("mirror",$p,ce(t,ee),...e),K(arguments))}}}var za,$p,h0=T({"src/lib/tasks/clone.ts"(){"use strict";re(),q(),za=(t,e,r)=>{let n=["clone",...r];return ee(t)&&n.push(Br(t)),ee(e)&&n.push(Br(e)),fe(n)},$p=(t,e,r)=>($e(r,"--mirror"),za(t,e,r))}}),jp={};ne(jp,{SimpleGitApi:()=>Ha});var Ha,d0=T({"src/lib/simple-git-api.ts"(){"use strict";pR(),gR(),yR(),vR(),xR(),Hm(),PR(),Jm(),AR(),MR(),_p(),QR(),Ip(),e0(),i0(),re(),l0(),q(),h0(),Ha=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),n=r.push(t);return e&&fR(t,n,e),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(t){return this._runTask(fe(["add",...it(t)]),K(arguments))}cwd(t){let e=K(arguments);return typeof t=="string"?this._runTask($f(t,this._executor),e):typeof t?.path=="string"?this._runTask($f(t.path,t.root&&this._executor||void 0),e):this._runTask(ve("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(ER(t,e===!0),K(arguments))}init(t){return this._runTask(DR(t===!0,this._executor.cwd,de(arguments)),K(arguments))}merge(){return this._runTask(Jf(de(arguments)),K(arguments))}mergeFromTo(t,e){return ee(t)&&ee(e)?this._runTask(Jf([t,e,...de(arguments)]),K(arguments,!1)):this._runTask(ve("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=mu({remote:ce(arguments[0],ee),branch:ce(arguments[1],ee)},de(arguments));return this._runTask(t,K(arguments))}stash(){return this._runTask(fe(["stash",...de(arguments)]),K(arguments))}status(){return this._runTask(n0(de(arguments)),K(arguments))}},Object.assign(Ha.prototype,bR(),c0(),CR(),eR(),wR(),kR(),nR(),WR(),XR(),a0())}}),Lp={};ne(Lp,{Scheduler:()=>Up});var sm,Up,f0=T({"src/lib/runners/scheduler.ts"(){"use strict";q(),tp(),sm=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,Np.createDeferred)();return{promise:e,done:r,id:t}}})(),Up=class{constructor(t=2){this.concurrency=t,this.logger=iu("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let t=$e(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),ei(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=$e(this.pending,sm());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),Wp={};ne(Wp,{applyPatchTask:()=>m0});function m0(t,e){return fe(["apply",...e,...t])}var p0=T({"src/lib/tasks/apply-patch.ts"(){"use strict";re()}});function g0(t,e){return{branch:t,hash:e,success:!0}}function b0(t){return{branch:t,hash:null,success:!1}}var zp,y0=T({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";zp=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function Hp(t,e){return e===1&&Ga.test(t)}var nm,Ga,im,ai,_0=T({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";y0(),q(),nm=/(\S+)\s+\(\S+\s([^)]+)\)/,Ga=/^error[^']+'([^']+)'/m,im=[new M(nm,(t,[e,r])=>{let n=g0(e,r);t.all.push(n),t.branches[e]=n}),new M(Ga,(t,[e])=>{let r=b0(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],ai=(t,e)=>Se(new zp,im,[t,e])}}),Gp,w0=T({"src/lib/responses/BranchSummary.ts"(){"use strict";Gp=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,n,o){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:n,label:o}}}}});function om(t){return t?t.charAt(0):""}function Vp(t,e=!1){return Se(new Gp,e?[Qp]:Yp,t)}var Yp,Qp,v0=T({"src/lib/parsers/parse-branch.ts"(){"use strict";w0(),q(),Yp=[new M(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,n,o])=>{t.push(om(e),!0,r,n,o)}),new M(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,n,o])=>{t.push(om(e),!1,r,n,o)})],Qp=new M(/^(\S+)$/s,(t,[e])=>{t.push("*",!1,e,"","")})}}),Jp={};ne(Jp,{branchLocalTask:()=>T0,branchTask:()=>S0,containsDeleteBranchCommand:()=>Kp,deleteBranchTask:()=>C0,deleteBranchesTask:()=>R0});function Kp(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function S0(t){let e=Kp(t),r=t.includes("--show-current"),n=["branch",...t];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(o,u){return e?ai(o,u).all[0]:Vp(o,r)}}}function T0(){return{format:"utf-8",commands:["branch","-v"],parser(t){return Vp(t)}}}function R0(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,n){return ai(r,n)},onError({exitCode:r,stdOut:n},o,u,l){if(!Hp(String(o),r))return l(o);u(n)}}}function C0(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(n,o){return ai(n,o).branches[t]},onError({exitCode:n,stdErr:o,stdOut:u},l,h,d){if(!Hp(String(l),n))return d(l);throw new xs(r.parser(Cs(u),Cs(o)),String(l))}};return r}var x0=T({"src/lib/tasks/branch.ts"(){"use strict";Ur(),_0(),v0(),q()}});function k0(t){let e=t.trim().replace(/^["']|["']$/g,"");return e&&(0,Zp.normalize)(e)}var Xp,P0=T({"src/lib/responses/CheckIgnore.ts"(){"use strict";Xp=t=>t.split(/\n/g).map(k0).filter(Boolean)}}),eg={};ne(eg,{checkIgnoreTask:()=>E0});function E0(t){return{commands:["check-ignore",...t],format:"utf-8",parser:Xp}}var A0=T({"src/lib/tasks/check-ignore.ts"(){"use strict";P0()}});function O0(t,e){return Se({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},tg,[t,e])}var tg,I0=T({"src/lib/parsers/parse-fetch.ts"(){"use strict";q(),tg=[new M(/From (.+)$/,(t,[e])=>{t.remote=e}),new M(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new M(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new M(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new M(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,n,o])=>{t.updated.push({name:n,tracking:o,to:r,from:e})})]}}),rg={};ne(rg,{fetchTask:()=>D0});function q0(t){return/^--upload-pack(=|$)/.test(t)}function D0(t,e,r){let n=["fetch",...r];return t&&e&&n.push(t,e),n.find(q0)?ve("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:O0}}var M0=T({"src/lib/tasks/fetch.ts"(){"use strict";I0(),re()}});function B0(t){return Se({moves:[]},sg,t)}var sg,F0=T({"src/lib/parsers/parse-move.ts"(){"use strict";q(),sg=[new M(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),ng={};ne(ng,{moveTask:()=>$0});function $0(t,e){return{commands:["mv","-v",...it(t),e],format:"utf-8",parser:B0}}var j0=T({"src/lib/tasks/move.ts"(){"use strict";F0(),q()}}),ig={};ne(ig,{pullTask:()=>L0});function L0(t,e,r){let n=["pull",...r];return t&&e&&n.splice(1,0,t,e),{commands:n,format:"utf-8",parser(o,u){return fu(o,u)},onError(o,u,l,h){let d=VR(Cs(o.stdOut),Cs(o.stdErr));if(d)return h(new xs(d));h(u)}}}var N0=T({"src/lib/tasks/pull.ts"(){"use strict";Ur(),Pp(),q()}});function U0(t){let e={};return og(t,([r])=>e[r]={name:r}),Object.values(e)}function W0(t){let e={};return og(t,([r,n,o])=>{Object.hasOwn(e,r)||(e[r]={name:r,refs:{fetch:"",push:""}}),o&&n&&(e[r].refs[o.replace(/[^a-z]/g,"")]=n)}),Object.values(e)}function og(t,e){Qa(t,r=>e(r.split(/\s+/)))}var z0=T({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";q()}}),ag={};ne(ag,{addRemoteTask:()=>H0,getRemotesTask:()=>G0,listRemotesTask:()=>V0,remoteTask:()=>Y0,removeRemoteTask:()=>Q0});function H0(t,e,r){return fe(["remote","add",...r,t,e])}function G0(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?W0:U0}}function V0(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),fe(e)}function Y0(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),fe(e)}function Q0(t){return fe(["remote","remove",t])}var J0=T({"src/lib/tasks/remote.ts"(){"use strict";z0(),re()}}),ug={};ne(ug,{stashListTask:()=>K0});function K0(t={},e){let r=yp(t),n=["stash","list",...r.commands,...e],o=mp(r.splitter,r.fields,au(n));return oi(n)||{commands:n,format:"utf-8",parser:o}}var Z0=T({"src/lib/tasks/stash-list.ts"(){"use strict";As(),gp(),du(),_p()}}),lg={};ne(lg,{addSubModuleTask:()=>X0,initSubModuleTask:()=>eC,subModuleTask:()=>ui,updateSubModuleTask:()=>tC});function X0(t,e){return ui(["add",t,e])}function eC(t){return ui(["init",...t])}function ui(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),fe(e)}function tC(t){return ui(["update",...t])}var rC=T({"src/lib/tasks/sub-module.ts"(){"use strict";re()}});function sC(t,e){let r=Number.isNaN(t),n=Number.isNaN(e);return r!==n?r?1:-1:r?cg(t,e):0}function cg(t,e){return t===e?0:t>e?1:-1}function nC(t){return t.trim()}function zn(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var am,hg,iC=T({"src/lib/responses/TagList.ts"(){"use strict";am=class{constructor(t,e){this.all=t,this.latest=e}},hg=function(t,e=!1){let r=t.split(`
117
+ `).map(nC).filter(Boolean);e||r.sort(function(o,u){let l=o.split("."),h=u.split(".");if(l.length===1||h.length===1)return sC(zn(l[0]),zn(h[0]));for(let d=0,m=Math.max(l.length,h.length);d<m;d++){let p=cg(zn(l[d]),zn(h[d]));if(p)return p}return 0});let n=e?r[0]:[...r].reverse().find(o=>o.indexOf(".")>=0);return new am(r,n)}}}),dg={};ne(dg,{addAnnotatedTagTask:()=>uC,addTagTask:()=>aC,tagListTask:()=>oC});function oC(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return hg(r,e)}}}function aC(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function uC(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var lC=T({"src/lib/tasks/tag.ts"(){"use strict";iC()}}),cC=kT({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(dR(),te(np)),{SimpleGitApi:n}=(d0(),te(jp)),{Scheduler:o}=(f0(),te(Lp)),{adhocExecTask:u,configurationErrorTask:l}=(re(),te($a)),{asArray:h,filterArray:d,filterPrimitives:m,filterString:p,filterStringOrStringArray:w,filterType:_,getTrailingOptions:R,trailingFunctionArgument:y,trailingOptionsArgument:D}=(q(),te(km)),{applyPatchTask:k}=(p0(),te(Wp)),{branchTask:P,branchLocalTask:j,deleteBranchesTask:J,deleteBranchTask:$}=(x0(),te(Jp)),{checkIgnoreTask:N}=(A0(),te(eg)),{checkIsRepoTask:U}=(Om(),te(Pm)),{cleanWithOptionsTask:Oe,isCleanOptionsArray:Ke}=(Um(),te(Lm)),{diffSummaryTask:Wt}=(du(),te(bp)),{fetchTask:Qr}=(M0(),te(rg)),{moveTask:js}=(j0(),te(ng)),{pullTask:Jr}=(N0(),te(ig)),{pushTagsTask:Ue}=(Ip(),te(Op)),{addRemoteTask:pr,getRemotesTask:Kr,listRemotesTask:Ls,remoteTask:Ri,removeRemoteTask:Zr}=(J0(),te(ag)),{getResetMode:Ci,resetTask:Ns}=(ep(),te(Km)),{stashListTask:Us}=(Z0(),te(ug)),{addSubModuleTask:xi,initSubModuleTask:ki,subModuleTask:Ie,updateSubModuleTask:me}=(rC(),te(lg)),{addAnnotatedTagTask:Pi,addTagTask:Ws,tagListTask:We}=(lC(),te(dg)),{straightThroughBufferTask:Xr,straightThroughStringTask:pe}=(re(),te($a));function O(v,x){this._plugins=x,this._executor=new r(v.baseDir,new o(v.maxConcurrentProcesses),x),this._trimmed=v.trimmed}(O.prototype=Object.create(n.prototype)).constructor=O,O.prototype.customBinary=function(v){return this._plugins.reconfigure("binary",v),this},O.prototype.env=function(v,x){return arguments.length===1&&typeof v=="object"?this._executor.env=v:(this._executor.env=this._executor.env||{})[v]=x,this},O.prototype.stashList=function(v){return this._runTask(Us(D(arguments)||{},d(v)&&v||[]),y(arguments))},O.prototype.mv=function(v,x){return this._runTask(js(v,x),y(arguments))},O.prototype.checkoutLatestTag=function(v){var x=this;return this.pull(function(){x.tags(function(W,se){x.checkout(se.latest,v)})})},O.prototype.pull=function(v,x,W,se){return this._runTask(Jr(_(v,p),_(x,p),R(arguments)),y(arguments))},O.prototype.fetch=function(v,x){return this._runTask(Qr(_(v,p),_(x,p),R(arguments)),y(arguments))},O.prototype.silent=function(v){return this._runTask(u(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},O.prototype.tags=function(v,x){return this._runTask(We(R(arguments)),y(arguments))},O.prototype.rebase=function(){return this._runTask(pe(["rebase",...R(arguments)]),y(arguments))},O.prototype.reset=function(v){return this._runTask(Ns(Ci(v),R(arguments)),y(arguments))},O.prototype.revert=function(v){let x=y(arguments);return typeof v!="string"?this._runTask(l("Commit must be a string"),x):this._runTask(pe(["revert",...R(arguments,0,!0),v]),x)},O.prototype.addTag=function(v){let x=typeof v=="string"?Ws(v):l("Git.addTag requires a tag name");return this._runTask(x,y(arguments))},O.prototype.addAnnotatedTag=function(v,x){return this._runTask(Pi(v,x),y(arguments))},O.prototype.deleteLocalBranch=function(v,x,W){return this._runTask($(v,typeof x=="boolean"?x:!1),y(arguments))},O.prototype.deleteLocalBranches=function(v,x,W){return this._runTask(J(v,typeof x=="boolean"?x:!1),y(arguments))},O.prototype.branch=function(v,x){return this._runTask(P(R(arguments)),y(arguments))},O.prototype.branchLocal=function(v){return this._runTask(j(),y(arguments))},O.prototype.raw=function(v){let x=!Array.isArray(v),W=[].slice.call(x?arguments:v,0);for(let ge=0;ge<W.length&&x;ge++)if(!m(W[ge])){W.splice(ge,W.length-ge);break}W.push(...R(arguments,0,!0));var se=y(arguments);return W.length?this._runTask(pe(W,this._trimmed),se):this._runTask(l("Raw: must supply one or more command to execute"),se)},O.prototype.submoduleAdd=function(v,x,W){return this._runTask(xi(v,x),y(arguments))},O.prototype.submoduleUpdate=function(v,x){return this._runTask(me(R(arguments,!0)),y(arguments))},O.prototype.submoduleInit=function(v,x){return this._runTask(ki(R(arguments,!0)),y(arguments))},O.prototype.subModule=function(v,x){return this._runTask(Ie(R(arguments)),y(arguments))},O.prototype.listRemote=function(){return this._runTask(Ls(R(arguments)),y(arguments))},O.prototype.addRemote=function(v,x,W){return this._runTask(pr(v,x,R(arguments)),y(arguments))},O.prototype.removeRemote=function(v,x){return this._runTask(Zr(v),y(arguments))},O.prototype.getRemotes=function(v,x){return this._runTask(Kr(v===!0),y(arguments))},O.prototype.remote=function(v,x){return this._runTask(Ri(R(arguments)),y(arguments))},O.prototype.tag=function(v,x){let W=R(arguments);return W[0]!=="tag"&&W.unshift("tag"),this._runTask(pe(W),y(arguments))},O.prototype.updateServerInfo=function(v){return this._runTask(pe(["update-server-info"]),y(arguments))},O.prototype.pushTags=function(v,x){let W=Ue({remote:_(v,p)},R(arguments));return this._runTask(W,y(arguments))},O.prototype.rm=function(v){return this._runTask(pe(["rm","-f",...h(v)]),y(arguments))},O.prototype.rmKeepLocal=function(v){return this._runTask(pe(["rm","--cached",...h(v)]),y(arguments))},O.prototype.catFile=function(v,x){return this._catFile("utf-8",arguments)},O.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},O.prototype._catFile=function(v,x){var W=y(x),se=["cat-file"],ge=x[0];if(typeof ge=="string")return this._runTask(l("Git.catFile: options must be supplied as an array of strings"),W);Array.isArray(ge)&&se.push.apply(se,ge);let zt=v==="buffer"?Xr(se):pe(se);return this._runTask(zt,W)},O.prototype.diff=function(v,x){let W=p(v)?l("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):pe(["diff",...R(arguments)]);return this._runTask(W,y(arguments))},O.prototype.diffSummary=function(){return this._runTask(Wt(R(arguments,1)),y(arguments))},O.prototype.applyPatch=function(v){let x=w(v)?k(h(v),R([].slice.call(arguments,1))):l("git.applyPatch requires one or more string patches as the first argument");return this._runTask(x,y(arguments))},O.prototype.revparse=function(){let v=["rev-parse",...R(arguments,!0)];return this._runTask(pe(v,!0),y(arguments))},O.prototype.clean=function(v,x,W){let se=Ke(v),ge=se&&v.join("")||_(v,p)||"",zt=R([].slice.call(arguments,se?1:0));return this._runTask(Oe(ge,zt),y(arguments))},O.prototype.exec=function(v){let x={commands:[],format:"utf-8",parser(){typeof v=="function"&&v()}};return this._runTask(x)},O.prototype.clearQueue=function(){return this._runTask(u(()=>console.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},O.prototype.checkIgnore=function(v,x){return this._runTask(N(h(_(v,w,[]))),y(arguments))},O.prototype.checkIsRepo=function(v,x){return this._runTask(U(_(v,p)),y(arguments))},e.exports=O}});Nt();var hC=class extends vt{constructor(t,e){super(void 0,e),this.config=t}};Nt();Nt();var Nr=class extends vt{constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};Ur();fm();Om();Um();Hm();Vm();Jm();ep();function dC(t){return t?[{type:"spawn.before",action(n,o){t.aborted&&o.kill(new Nr(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(n,o){function u(){o.kill(new Nr(void 0,"abort","Abort signal received"))}t.addEventListener("abort",u),o.spawned.on("close",()=>t.removeEventListener("abort",u))}}]:void 0}function fC(t={}){return{type:"spawn.args",action(e,{env:r}){for(let n of Df(e,r))if(t[n.category]!==!0)throw new Nr(void 0,"unsafe",n.message);return e}}}q();function mC(t){let e=Rs(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}q();var um=(0,jr.deferred)().promise;function pC({onClose:t=!0,onExit:e=50}={}){function r(){let o=-1,u={close:(0,jr.deferred)(),closeTimeout:(0,jr.deferred)(),exit:(0,jr.deferred)(),exitTimeout:(0,jr.deferred)()},l=Promise.race([t===!1?um:u.closeTimeout.promise,e===!1?um:u.exitTimeout.promise]);return n(t,u.close,u.closeTimeout),n(e,u.exit,u.exitTimeout),{close(h){o=h,u.close.done()},exit(h){o=h,u.exit.done()},get exitCode(){return o},result:l}}function n(o,u,l){o!==!1&&(o===!0?u.promise:u.promise.then(()=>Ia(o))).then(l.done)}return{type:"spawn.after",async action(o,{spawned:u,close:l}){let h=r(),d=!0,m=()=>{d=!1};u.stdout?.on("data",m),u.stderr?.on("data",m),u.on("error",m),u.on("close",p=>h.close(p)),u.on("exit",p=>h.exit(p));try{await h.result,d&&await Ia(50),l(h.exitCode)}catch(p){l(h.exitCode,p)}}}}q();var gC="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",lm="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function bC(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(t)}function cm(t,e){if(t.length<1||t.length>2)throw new Nr(void 0,"binary",gC);if(t.some(bC))if(e)console.warn(lm);else throw new Nr(void 0,"binary",lm);let[n,o]=t;return{binary:n,prefix:o}}function yC(t,e=["git"],r=!1){let n=cm(it(e),r);t.on("binary",o=>{n=cm(it(o),r)}),t.append("spawn.binary",()=>n.binary),t.append("spawn.args",o=>n.prefix?[n.prefix,...o]:o)}Nt();function _C(t){return!!(t.exitCode&&t.stdErr.length)}function wC(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function vC(t=!1,e=_C,r=wC){return(n,o)=>!t&&n||!e(o)?n:r(o)}function hm(t){return{type:"task.error",action(e,r){let n=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new vt(void 0,n.toString("utf-8"))}:{error:n}}}}q();var SC=class{constructor(){this.plugins=new Set,this.events=new fg.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=$e(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return it(t).forEach(r=>r&&this.plugins.add($e(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let n=e,o=Object.freeze(Object.create(r));for(let u of this.plugins)u.type===t&&(n=u.action(n,o));return n}};q();function TC(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(u,l){return r.includes(l.method)?_m(u,e):u}},{type:"spawn.after",action(u,l){l.commands.includes(e)&&l.spawned.stderr?.on("data",h=>{let d=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(h.toString("utf8"));d&&t({method:l.method,stage:RC(d[1]),progress:Y(d[2]),processed:Y(d[3]),total:Y(d[4])})})}}]}function RC(t){return String(t.toLowerCase().split(" ",1))||"unknown"}q();function CC(t){let e=vm(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function xC({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(n,o){let u;function l(){u&&clearTimeout(u),u=setTimeout(d,t)}function h(){o.spawned.stdout?.off("data",l),o.spawned.stderr?.off("data",l),o.spawned.off("exit",h),o.spawned.off("close",h),u&&clearTimeout(u)}function d(){h(),o.kill(new Nr(void 0,"timeout","block timeout reached"))}r&&o.spawned.stdout?.on("data",l),e&&o.spawned.stderr?.on("data",l),o.spawned.on("exit",h),o.spawned.on("close",h),l()}}}function kC(){return{type:"spawn.args",action(t){let e=[],r;function n(o){(r=r||[]).push(...o)}for(let o=0;o<t.length;o++){let u=t[o];if(Me(u)){n(Fr(u));continue}if(u==="--"){n(t.slice(o+1).flatMap(l=>Me(l)&&Fr(l)||l));break}e.push(u)}return r?[...e,"--",...r.map(String)]:e}}}q();var PC=cC();function EC(t,e){let r=new SC,n=Cm(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Ja(n.baseDir))throw new hC(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(mC(n.config)),r.add(fC(n.unsafe)),r.add(pC(n.completion)),n.abort&&r.add(dC(n.abort)),n.progress&&r.add(TC(n.progress)),n.timeout&&r.add(xC(n.timeout)),n.spawnOptions&&r.add(CC(n.spawnOptions)),r.add(kC()),r.add(hm(vC(!0))),n.errors&&r.add(hm(n.errors)),yC(r,n.binary,n.unsafe?.allowUnsafeCustomBinary),new PC(n,r)}Ur();var je=EC;var Si=ie(Bn());var AC=t=>t?.trim().normalize("NFD").replace(/\[.*]\s/,"").replace(/\+\s/,"").replace(/-\s/,"").replace(/\./,"").replace(/>/g,"").replace(/</g,"").replace(/:/g,"").replace(/"/g,"").replace(/&/g,"").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").replace(/\s/g,"-").toLowerCase(),OC=t=>t==="Epic"?"story":t==="Bug"?"fix":"feat",mg=t=>{let{id:e,name:r,type:n}=t,o=OC(n),u=AC(r);return[`${o}/${e}_${u}`,`${o}/${e}`,`${e}`]};var pg=ie(require("os")),zr=require("fs/promises"),gg=require("fs"),or=()=>pg.default.homedir(),bg=()=>process.cwd(),yg=async t=>{await(0,zr.mkdir)(t,{recursive:!0})},li=t=>(0,gg.existsSync)(t),_g=async(t,e)=>{await(0,zr.writeFile)(t,e)},gu=async t=>(await(0,zr.readFile)(t)).toString();var bu={tools:{jira:{domain:process.env.JIRA_DOMAIN??"",authorization:process.env.JIRA_AUTHORIZATION??""},github:{token:process.env.GITHUB_TOKEN??"",organization:process.env.GITHUB_ORGANIZATION??""},ai:{model:"gpt-4o-mini",token:"",url:"https://api.openai.com/v1"}},projects:{},advanced:!1,debug:!1,experimental:!1,version:"0.0.0"};var wg=t=>btoa(t);var vg=()=>li(`${or()}/.mytools/config`),Sg=async()=>{li(`${or()}/.mytools/config`)||(li(`${or()}/.mytools`)||await yg(`${or()}/.mytools`),await hi(bu))},Tg=async()=>{let t=await ar(),{tools:e,...r}=t,{ai:n}=e,{tools:o,...u}=bu,{ai:l}=o;await hi({...u,...r,tools:{...o,...e,ai:{...l,...n}}})},Rg=async()=>{let t=await ar();await hi({...t,projects:{}})},Cg=async()=>{let t=wg(bg()),e=await ar(),r=e.tools.jira,n=e.projects[t]?.tools.jira;return n?n.domain&&n.authorization:r.domain&&r.authorization},xg=async()=>{let{experimental:t}=await ar();return t},kg=async()=>{let{version:t}=await Eg(),[e,r,n]=t.split(".").map(d=>parseInt(d)),{version:o}=await ar();if(!o)return!0;let[u,l,h]=o.split(".").map(d=>parseInt(d));return e>u||r>l||n>h},Pg=async()=>{let{version:t}=await Eg(),e=await ar();await hi({...e,version:t})},ci=async()=>{let t=await ar(),{tools:e}=t,{ai:r}=e;return r},Eg=async()=>{let t=await gu(`${__dirname}/../package.json`);return JSON.parse(t)},ar=async()=>{let t=await gu(`${or()}/.mytools/config`);return JSON.parse(t)},hi=async t=>{let e=JSON.stringify(t,null,2);await _g(`${or()}/.mytools/config`,e)};var ab=ie(require("http"),1),ub=ie(require("https"),1),dr=ie(require("zlib"),1),Ae=ie(require("stream"),1),Fs=require("buffer");function IC(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),n="",o=!1,u=r[0]||"text/plain",l=u;for(let p=1;p<r.length;p++)r[p]==="base64"?o=!0:r[p]&&(l+=`;${r[p]}`,r[p].indexOf("charset=")===0&&(n=r[p].substring(8)));!r[0]&&!n.length&&(l+=";charset=US-ASCII",n="US-ASCII");let h=o?"base64":"ascii",d=unescape(t.substring(e+1)),m=Buffer.from(d,h);return m.type=u,m.typeFull=l,m.charset=n,m}var Ag=IC;var Le=ie(require("stream"),1),Rt=require("util"),Pe=require("buffer");Os();fi();var Tt=class extends Error{constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var Te=class extends Tt{constructor(e,r,n){super(e,r),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}};var mi=Symbol.toStringTag,Su=t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[mi]==="URLSearchParams",qs=t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[mi]),jg=t=>typeof t=="object"&&(t[mi]==="AbortSignal"||t[mi]==="EventTarget"),Lg=(t,e)=>{let r=new URL(e).hostname,n=new URL(t).hostname;return r===n||r.endsWith(`.${n}`)},Ng=(t,e)=>{let r=new URL(e).protocol,n=new URL(t).protocol;return r===n};var YC=(0,Rt.promisify)(Le.default.pipeline),Re=Symbol("Body internals"),at=class{constructor(e,{size:r=0}={}){let n=null;e===null?e=null:Su(e)?e=Pe.Buffer.from(e.toString()):qs(e)||Pe.Buffer.isBuffer(e)||(Rt.types.isAnyArrayBuffer(e)?e=Pe.Buffer.from(e):ArrayBuffer.isView(e)?e=Pe.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof Le.default||(e instanceof lr?(e=$g(e),n=e.type.split("=")[1]):e=Pe.Buffer.from(String(e))));let o=e;Pe.Buffer.isBuffer(e)?o=Le.default.Readable.from(e):qs(e)&&(o=Le.default.Readable.from(e.stream())),this[Re]={body:e,stream:o,boundary:n,disturbed:!1,error:null},this.size=r,e instanceof Le.default&&e.on("error",u=>{let l=u instanceof Tt?u:new Te(`Invalid response body while trying to fetch ${this.url}: ${u.message}`,"system",u);this[Re].error=l})}get body(){return this[Re].stream}get bodyUsed(){return this[Re].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:n}=await Cu(this);return e.slice(r,r+n)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let n=new lr,o=new URLSearchParams(await this.text());for(let[u,l]of o)n.append(u,l);return n}let{toFormData:r}=await Promise.resolve().then(()=>(Gg(),Hg));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Re].body&&this[Re].body.type||"",r=await this.arrayBuffer();return new St([r],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await Cu(this);return new TextDecoder().decode(e)}buffer(){return Cu(this)}};at.prototype.buffer=(0,Rt.deprecate)(at.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(at.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Rt.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function Cu(t){if(t[Re].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Re].disturbed=!0,t[Re].error)throw t[Re].error;let{body:e}=t;if(e===null)return Pe.Buffer.alloc(0);if(!(e instanceof Le.default))return Pe.Buffer.alloc(0);let r=[],n=0;try{for await(let o of e){if(t.size>0&&n+o.length>t.size){let u=new Te(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(u),u}n+=o.length,r.push(o)}}catch(o){throw o instanceof Tt?o:new Te(`Invalid response body while trying to fetch ${t.url}: ${o.message}`,"system",o)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(o=>typeof o=="string")?Pe.Buffer.from(r.join("")):Pe.Buffer.concat(r,n)}catch(o){throw new Te(`Could not create Buffer from response body for ${t.url}: ${o.message}`,"system",o)}else throw new Te(`Premature close of server response while trying to fetch ${t.url}`)}var Gr=(t,e)=>{let r,n,{body:o}=t[Re];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof Le.default&&typeof o.getBoundary!="function"&&(r=new Le.PassThrough({highWaterMark:e}),n=new Le.PassThrough({highWaterMark:e}),o.pipe(r),o.pipe(n),t[Re].stream=r,o=n),o},QC=(0,Rt.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),yi=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Su(t)?"application/x-www-form-urlencoded;charset=UTF-8":qs(t)?t.type||null:Pe.Buffer.isBuffer(t)||Rt.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof lr?`multipart/form-data; boundary=${e[Re].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${QC(t)}`:t instanceof Le.default?null:"text/plain;charset=UTF-8",Vg=t=>{let{body:e}=t[Re];return e===null?0:qs(e)?e.size:Pe.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},Yg=async(t,{body:e})=>{e===null?t.end():await YC(e,t)};var xu=require("util"),Ms=ie(require("http"),1),_i=typeof Ms.default.validateHeaderName=="function"?Ms.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},ku=typeof Ms.default.validateHeaderValue=="function"?Ms.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Ee=class t extends URLSearchParams{constructor(e){let r=[];if(e instanceof t){let n=e.raw();for(let[o,u]of Object.entries(n))r.push(...u.map(l=>[o,l]))}else if(e!=null)if(typeof e=="object"&&!xu.types.isBoxedPrimitive(e)){let n=e[Symbol.iterator];if(n==null)r.push(...Object.entries(e));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(o=>{if(typeof o!="object"||xu.types.isBoxedPrimitive(o))throw new TypeError("Each header pair must be an iterable object");return[...o]}).map(o=>{if(o.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([n,o])=>(_i(n),ku(n,String(o)),[String(n).toLowerCase(),String(o)])):void 0,super(r),new Proxy(this,{get(n,o,u){switch(o){case"append":case"set":return(l,h)=>(_i(l),ku(l,String(h)),URLSearchParams.prototype[o].call(n,String(l).toLowerCase(),String(h)));case"delete":case"has":case"getAll":return l=>(_i(l),URLSearchParams.prototype[o].call(n,String(l).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,o,u)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let n=r.join(", ");return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,r=void 0){for(let n of this.keys())Reflect.apply(e,r,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let n=this.getAll(r);return r==="host"?e[r]=n[0]:e[r]=n.length>1?n:n[0],e},{})}};Object.defineProperties(Ee.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function Qg(t=[]){return new Ee(t.reduce((e,r,n,o)=>(n%2===0&&e.push(o.slice(n,n+2)),e),[]).filter(([e,r])=>{try{return _i(e),ku(e,String(r)),!0}catch{return!1}}))}var JC=new Set([301,302,303,307,308]),wi=t=>JC.has(t);var Je=Symbol("Response internals"),Ne=class t extends at{constructor(e=null,r={}){super(e,r);let n=r.status!=null?r.status:200,o=new Ee(r.headers);if(e!==null&&!o.has("Content-Type")){let u=yi(e,this);u&&o.append("Content-Type",u)}this[Je]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Je].type}get url(){return this[Je].url||""}get status(){return this[Je].status}get ok(){return this[Je].status>=200&&this[Je].status<300}get redirected(){return this[Je].counter>0}get statusText(){return this[Je].statusText}get headers(){return this[Je].headers}get highWaterMark(){return this[Je].highWaterMark}clone(){return new t(Gr(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!wi(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new t(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new t(null,{status:0,statusText:""});return e[Je].type="error",e}static json(e=void 0,r={}){let n=JSON.stringify(e);if(n===void 0)throw new TypeError("data is not JSON serializable");let o=new Ee(r&&r.headers);return o.has("content-type")||o.set("content-type","application/json"),new t(n,{...r,headers:o})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Ne.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var nb=require("url"),ib=require("util");var Jg=t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""};var Zg=require("net");function Kg(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}var Xg=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),eb="strict-origin-when-cross-origin";function tb(t){if(!Xg.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function KC(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,Zg.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:t.host==="localhost"||t.host.endsWith(".localhost")?!1:t.protocol==="file:"}function Vr(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:KC(t)}function rb(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let n=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let o=t.referrer,u=Kg(o),l=Kg(o,!0);u.toString().length>4096&&(u=l),e&&(u=e(u)),r&&(l=r(l));let h=new URL(t.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return l;case"unsafe-url":return u;case"strict-origin":return Vr(u)&&!Vr(h)?"no-referrer":l.toString();case"strict-origin-when-cross-origin":return u.origin===h.origin?u:Vr(u)&&!Vr(h)?"no-referrer":l;case"same-origin":return u.origin===h.origin?u:"no-referrer";case"origin-when-cross-origin":return u.origin===h.origin?u:l;case"no-referrer-when-downgrade":return Vr(u)&&!Vr(h)?"no-referrer":u;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function sb(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of e)n&&Xg.has(n)&&(r=n);return r}var ae=Symbol("Request internals"),Bs=t=>typeof t=="object"&&typeof t[ae]=="object",ZC=(0,ib.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),hr=class t extends at{constructor(e,r={}){let n;if(Bs(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let o=r.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)&&(o=o.toUpperCase()),!Bs(r)&&"data"in r&&ZC(),(r.body!=null||Bs(e)&&e.body!==null)&&(o==="GET"||o==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let u=r.body?r.body:Bs(e)&&e.body!==null?Gr(e):null;super(u,{size:r.size||e.size||0});let l=new Ee(r.headers||e.headers||{});if(u!==null&&!l.has("Content-Type")){let m=yi(u,this);m&&l.set("Content-Type",m)}let h=Bs(e)?e.signal:null;if("signal"in r&&(h=r.signal),h!=null&&!jg(h))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=r.referrer==null?e.referrer:r.referrer;if(d==="")d="no-referrer";else if(d){let m=new URL(d);d=/^about:(\/\/)?client$/.test(m)?"client":m}else d=void 0;this[ae]={method:o,redirect:r.redirect||e.redirect||"follow",headers:l,parsedURL:n,signal:h,referrer:d},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[ae].method}get url(){return(0,nb.format)(this[ae].parsedURL)}get headers(){return this[ae].headers}get redirect(){return this[ae].redirect}get signal(){return this[ae].signal}get referrer(){if(this[ae].referrer==="no-referrer")return"";if(this[ae].referrer==="client")return"about:client";if(this[ae].referrer)return this[ae].referrer.toString()}get referrerPolicy(){return this[ae].referrerPolicy}set referrerPolicy(e){this[ae].referrerPolicy=tb(e)}clone(){return new t(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(hr.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var ob=t=>{let{parsedURL:e}=t[ae],r=new Ee(t[ae].headers);r.has("Accept")||r.set("Accept","*/*");let n=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(n="0"),t.body!==null){let h=Vg(t);typeof h=="number"&&!Number.isNaN(h)&&(n=String(h))}n&&r.set("Content-Length",n),t.referrerPolicy===""&&(t.referrerPolicy=eb),t.referrer&&t.referrer!=="no-referrer"?t[ae].referrer=rb(t):t[ae].referrer="no-referrer",t[ae].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip, deflate, br");let{agent:o}=t;typeof o=="function"&&(o=o(e));let u=Jg(e),l={path:e.pathname+u,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:o};return{parsedURL:e,options:l}};var vi=class extends Tt{constructor(e,r="aborted"){super(e,r)}};fi();Tu();var XC=new Set(["data:","http:","https:"]);async function fr(t,e){return new Promise((r,n)=>{let o=new hr(t,e),{parsedURL:u,options:l}=ob(o);if(!XC.has(u.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${u.protocol.replace(/:$/,"")}" is not supported.`);if(u.protocol==="data:"){let y=Ag(o.url),D=new Ne(y,{headers:{"Content-Type":y.typeFull}});r(D);return}let h=(u.protocol==="https:"?ub.default:ab.default).request,{signal:d}=o,m=null,p=()=>{let y=new vi("The operation was aborted.");n(y),o.body&&o.body instanceof Ae.default.Readable&&o.body.destroy(y),!(!m||!m.body)&&m.body.emit("error",y)};if(d&&d.aborted){p();return}let w=()=>{p(),R()},_=h(u.toString(),l);d&&d.addEventListener("abort",w);let R=()=>{_.abort(),d&&d.removeEventListener("abort",w)};_.on("error",y=>{n(new Te(`request to ${o.url} failed, reason: ${y.message}`,"system",y)),R()}),ex(_,y=>{m&&m.body&&m.body.destroy(y)}),process.version<"v14"&&_.on("socket",y=>{let D;y.prependListener("end",()=>{D=y._eventsCount}),y.prependListener("close",k=>{if(m&&D<y._eventsCount&&!k){let P=new Error("Premature close");P.code="ERR_STREAM_PREMATURE_CLOSE",m.body.emit("error",P)}})}),_.on("response",y=>{_.setTimeout(0);let D=Qg(y.rawHeaders);if(wi(y.statusCode)){let $=D.get("Location"),N=null;try{N=$===null?null:new URL($,o.url)}catch{if(o.redirect!=="manual"){n(new Te(`uri requested responds with an invalid redirect URL: ${$}`,"invalid-redirect")),R();return}}switch(o.redirect){case"error":n(new Te(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),R();return;case"manual":break;case"follow":{if(N===null)break;if(o.counter>=o.follow){n(new Te(`maximum redirect reached at: ${o.url}`,"max-redirect")),R();return}let U={headers:new Ee(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:Gr(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!Lg(o.url,N)||!Ng(o.url,N))for(let Ke of["authorization","www-authenticate","cookie","cookie2"])U.headers.delete(Ke);if(y.statusCode!==303&&o.body&&e.body instanceof Ae.default.Readable){n(new Te("Cannot follow redirect with body being a readable stream","unsupported-redirect")),R();return}(y.statusCode===303||(y.statusCode===301||y.statusCode===302)&&o.method==="POST")&&(U.method="GET",U.body=void 0,U.headers.delete("content-length"));let Oe=sb(D);Oe&&(U.referrerPolicy=Oe),r(fr(new hr(N,U))),R();return}default:return n(new TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}d&&y.once("end",()=>{d.removeEventListener("abort",w)});let k=(0,Ae.pipeline)(y,new Ae.PassThrough,$=>{$&&n($)});process.version<"v12.10"&&y.on("aborted",w);let P={url:o.url,status:y.statusCode,statusText:y.statusMessage,headers:D,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},j=D.get("Content-Encoding");if(!o.compress||o.method==="HEAD"||j===null||y.statusCode===204||y.statusCode===304){m=new Ne(k,P),r(m);return}let J={flush:dr.default.Z_SYNC_FLUSH,finishFlush:dr.default.Z_SYNC_FLUSH};if(j==="gzip"||j==="x-gzip"){k=(0,Ae.pipeline)(k,dr.default.createGunzip(J),$=>{$&&n($)}),m=new Ne(k,P),r(m);return}if(j==="deflate"||j==="x-deflate"){let $=(0,Ae.pipeline)(y,new Ae.PassThrough,N=>{N&&n(N)});$.once("data",N=>{(N[0]&15)===8?k=(0,Ae.pipeline)(k,dr.default.createInflate(),U=>{U&&n(U)}):k=(0,Ae.pipeline)(k,dr.default.createInflateRaw(),U=>{U&&n(U)}),m=new Ne(k,P),r(m)}),$.once("end",()=>{m||(m=new Ne(k,P),r(m))});return}if(j==="br"){k=(0,Ae.pipeline)(k,dr.default.createBrotliDecompress(),$=>{$&&n($)}),m=new Ne(k,P),r(m);return}m=new Ne(k,P),r(m)}),Yg(_,o).catch(n)})}function ex(t,e){let r=Fs.Buffer.from(`0\r
118
118
  \r
119
- `),n=!1,o=!1,a;t.on("response",l=>{let{headers:h}=l;n=h["transfer-encoding"]==="chunked"&&!h["content-length"]}),t.on("socket",l=>{let h=()=>{if(n&&!o){let f=new Error("Premature close");f.code="ERR_STREAM_PREMATURE_CLOSE",e(f)}},d=f=>{o=Us.Buffer.compare(f.slice(-5),r)===0,!o&&a&&(o=Us.Buffer.compare(a.slice(-3),r.slice(0,3))===0&&Us.Buffer.compare(f.slice(-2),r.slice(3))===0),a=f};l.prependListener("close",h),l.on("data",d),t.on("close",()=>{l.removeListener("close",h),l.removeListener("data",d)})})}var ek=t=>{let e='status = "In Progress"';return t===1?`${e} AND assignee = currentUser()`:e},kb=async t=>{let e=`${process.env.JIRA_DOMAIN}/rest/api/3/search/jql`,r={expand:"names",maxResults:50,fieldsByKeys:!1,fields:["summary","issuetype","status"],jql:ek(t)},n=await It(e,{method:"post",body:JSON.stringify(r),headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Basic ${process.env.JIRA_AUTHORIZATION}`}});if(!n.ok)return[];let o=await n.json(),{issues:a=[]}=o;return a.map(l=>{let{fields:{summary:h,issuetype:{name:d},status:{name:f}},key:p,self:w}=l;return{id:p.trim(),name:h.trim(),type:d.trim(),url:w.trim(),status:f}})};var Qr=B(Ma()),Uu=require("marked"),Eb=B(require("marked-terminal")),Me=t=>console.log(`\u{1F437} ${(0,Qr.green)("[SUCCESS]")} ${t}`),xe=t=>console.log(`\u{1F437} ${(0,Qr.cyan)("[INFO]")} ${t}`),Wu=t=>console.log(`\u{1F437} ${(0,Qr.red)("[ERROR]")} ${t}`),Pb=t=>console.log(`
120
- \u{1F916} > ${t}
121
- `),Ce=t=>console.log(` ${t}`),Oi=async t=>{Uu.marked.setOptions({renderer:new Eb.default}),console.log(`
122
- ${await(0,Uu.marked)(t)}`)};async function tk(){xe("making a git fetch..."),await ie().fetch(),Me("git fetch completed")}async function rk(){xe("pulling branches..."),await ie().pull(),Me("pull branches completed")}async function sk(t){return xe("requesting task in progress..."),await kb(t)}async function nk(){let{ownership:t}=await(0,Ii.default)({type:"select",name:"ownership",message:"What kind of task do you want to search?",choices:[{title:"My tasks",value:1},{title:"All tasks",value:2}],initial:0});return t}async function ik(t){let{task:e}=await(0,Ii.default)({type:"select",name:"task",message:"What task do you want to start?",choices:t.map(r=>({title:`${(0,Ws.cyan)(r.id)} => ${r.name} => ${(0,Ws.yellow)(r.type)}`,value:r}))});return e}async function ok(t){let{branchName:e}=await(0,Ii.default)({type:"select",name:"branchName",message:"What name of brunch do you like?",choices:t.map(r=>({title:r,value:r}))});return e}async function ak(t){xe(`creating new branch ${(0,Ws.yellow)(t)}`),await ie().checkoutLocalBranch(t)}var uk=async()=>{if(!await Wg())return Promise.reject("The envs JIRA_DOMAIN or JIRA_AUTHORIZATION not exist. More info in doc")},lk=async()=>{await uk(),await tk(),await rk();let t=await nk(),e=await sk(t);if(!e.length)return Promise.reject("There are not in progress tasks");let r=await ik(e),n=Mg(r),o=await ok(n);await ak(o)},Ab=lk;var Mi=B(Ct());var qi=async()=>{let t=await It(`https://api.github.com/orgs/${process.env.GITHUB_ORGANIZATION}/repos?sort=full_name&per_page=100`,{method:"get",headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!t.ok){let{message:r}=await t.json();return Promise.reject(`Fail to find projects in github -> ${t.statusText}: ${r}`)}return(await t.json()).map(({id:r,name:n})=>({id:r,name:n}))},Ob=async t=>{let e=await It(`https://api.github.com/repos/${process.env.GITHUB_ORGANIZATION}/${t.repo}/pulls`,{method:"post",body:JSON.stringify({title:t.title,body:t.body,head:t.head,base:t.base,draft:!0}),headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!e.ok){let{message:n}=await e.json();return Promise.reject(`Fail to create PR in github -> ${e.statusText}: ${n}`)}let r=await e.json();return{id:r.id,number:r.number,url:r.html_url,state:r.state,title:r.title,body:r.body,headSha:r.head.sha,head:r.head.ref,baseSha:r.base.sha,base:r.base.ref,repo:r.base.repo.name}},Ib=async t=>{let e=await It(`https://api.github.com/repos/${process.env.GITHUB_ORGANIZATION}/${t}/pulls`,{method:"get",headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!e.ok){let{message:n}=await e.json();return Promise.reject(`Fail to list PR in github -> ${e.statusText}: ${n}`)}return(await e.json()).map(n=>({id:n.id,number:n.number,url:n.html_url,state:n.state,title:n.title,body:n.body,headSha:n.head.sha,head:n.head.ref,baseSha:n.base.sha,base:n.base.ref,repo:n.base.repo.name}))},qb=async(t,e,r)=>{let n=await It(`https://api.github.com/repos/${process.env.GITHUB_ORGANIZATION}/${t}/issues/${e}/comments`,{method:"post",body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github.raw+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!n.ok){let{message:o}=await n.json();return Promise.reject(`Fail to create comment issue in github -> ${n.statusText}: ${o}`)}};async function ck(){xe("making a git fetch..."),await ie().fetch(),Me("git fetch completed")}var hk=async t=>{let{baseBranch:e}=await(0,Mi.default)({type:"select",name:"baseBranch",message:"What base branch?",choices:t.map(r=>({title:r,value:r}))});return e},dk=async()=>{let{current:t,all:e}=await ie().branch();return[t,e]},fk=async()=>{if(!process.env.GITHUB_TOKEN||!process.env.GITHUB_ORGANIZATION)return Promise.reject("The envs GITHUB_TOKEN or GITHUB_ORGANIZATION not exist. More info in doc")},mk=async()=>{let{current:t,all:e}=await ie().branch();if(!e.find(r=>r===`remotes/origin/${t}`))return Promise.reject("Current branch not found at origin")},pk=async(t,e,r)=>{let{url:n}=await Ob({title:`${t} pull request`,body:`Esta PR [cierra, soluciona, resuelve] [#000](https://zityhub.atlassian.net/browse/000)
119
+ `),n=!1,o=!1,u;t.on("response",l=>{let{headers:h}=l;n=h["transfer-encoding"]==="chunked"&&!h["content-length"]}),t.on("socket",l=>{let h=()=>{if(n&&!o){let m=new Error("Premature close");m.code="ERR_STREAM_PREMATURE_CLOSE",e(m)}},d=m=>{o=Fs.Buffer.compare(m.slice(-5),r)===0,!o&&u&&(o=Fs.Buffer.compare(u.slice(-3),r.slice(0,3))===0&&Fs.Buffer.compare(m.slice(-2),r.slice(3))===0),u=m};l.prependListener("close",h),l.on("data",d),t.on("close",()=>{l.removeListener("close",h),l.removeListener("data",d)})})}var tx=t=>{let e='status = "In Progress"';return t===1?`${e} AND assignee = currentUser()`:e},lb=async t=>{let e=`${process.env.JIRA_DOMAIN}/rest/api/3/search/jql`,r={expand:"names",maxResults:50,fieldsByKeys:!1,fields:["summary","issuetype","status"],jql:tx(t)},n=await fr(e,{method:"post",body:JSON.stringify(r),headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Basic ${process.env.JIRA_AUTHORIZATION}`}});if(!n.ok)return[];let o=await n.json(),{issues:u=[]}=o;return u.map(l=>{let{fields:{summary:h,issuetype:{name:d},status:{name:m}},key:p,self:w}=l;return{id:p.trim(),name:h.trim(),type:d.trim(),url:w.trim(),status:m}})};var Yr=ie(ya()),Ct=t=>console.log(`\u{1F437} ${(0,Yr.green)("[SUCCESS]")} ${t}`),mr=t=>console.log(`\u{1F437} ${(0,Yr.cyan)("[INFO]")} ${t}`),Pu=t=>console.log(`\u{1F437} ${(0,Yr.red)("[ERROR]")} ${t}`);async function rx(){mr("making a git fetch..."),await je().fetch(),Ct("git fetch completed")}async function sx(){mr("pulling branches..."),await je().pull(),Ct("pull branches completed")}async function nx(t){return mr("requesting task in progress..."),await lb(t)}async function ix(){let{ownership:t}=await(0,Si.default)({type:"select",name:"ownership",message:"What kind of task do you want to search?",choices:[{title:"My tasks",value:1},{title:"All tasks",value:2}],initial:0});return t}async function ox(t){let{task:e}=await(0,Si.default)({type:"select",name:"task",message:"What task do you want to start?",choices:t.map(r=>({title:`${(0,$s.cyan)(r.id)} => ${r.name} => ${(0,$s.yellow)(r.type)}`,value:r}))});return e}async function ax(t){let{branchName:e}=await(0,Si.default)({type:"select",name:"branchName",message:"What name of brunch do you like?",choices:t.map(r=>({title:r,value:r}))});return e}async function ux(t){mr(`creating new branch ${(0,$s.yellow)(t)}`),await je().checkoutLocalBranch(t)}var lx=async()=>{if(!await Cg())return Promise.reject("The envs JIRA_DOMAIN or JIRA_AUTHORIZATION not exist. More info in doc")},cx=async()=>{await lx(),await rx(),await sx();let t=await ix(),e=await nx(t);if(!e.length)return Promise.reject("There are not in progress tasks");let r=await ox(e),n=mg(r),o=await ax(n);await ux(o)},cb=cx;var Ti=ie(Bn());var hb=async()=>{let t=await fr(`https://api.github.com/orgs/${process.env.GITHUB_ORGANIZATION}/repos?sort=full_name&per_page=100`,{method:"get",headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!t.ok){let{message:r}=await t.json();return Promise.reject(`Fail to find projects in github -> ${t.statusText}: ${r}`)}return(await t.json()).map(({id:r,name:n})=>({id:r,name:n}))},db=async t=>{let e=await fr(`https://api.github.com/repos/${process.env.GITHUB_ORGANIZATION}/${t.repo}/pulls`,{method:"post",body:JSON.stringify({title:t.title,body:t.body,head:t.head,base:t.base,draft:!0}),headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!e.ok){let{message:n}=await e.json();return Promise.reject(`Fail to create PR in github -> ${e.statusText}: ${n}`)}let r=await e.json();return{id:r.id,number:r.number,url:r.html_url,state:r.state,title:r.title,body:r.body,headSha:r.head.sha,head:r.head.ref,baseSha:r.base.sha,base:r.base.ref,repo:r.base.repo.name}};async function hx(){mr("making a git fetch..."),await je().fetch(),Ct("git fetch completed")}var dx=async t=>{let{baseBranch:e}=await(0,Ti.default)({type:"select",name:"baseBranch",message:"What base branch?",choices:t.map(r=>({title:r,value:r}))});return e},fx=async()=>{let{current:t,all:e}=await je().branch();return[t,e]},mx=async()=>{if(!process.env.GITHUB_TOKEN||!process.env.GITHUB_ORGANIZATION)return Promise.reject("The envs GITHUB_TOKEN or GITHUB_ORGANIZATION not exist. More info in doc")},px=async()=>{let{current:t,all:e}=await je().branch();if(!e.find(r=>r===`remotes/origin/${t}`))return Promise.reject("Current branch not found at origin")},gx=async(t,e,r)=>{let{url:n}=await db({title:`${t} pull request`,body:`Esta PR [cierra, soluciona, resuelve] [#000](https://zityhub.atlassian.net/browse/000)
123
120
 
124
121
  ![required gif]()
125
122
 
@@ -135,8 +132,8 @@ ${await(0,Uu.marked)(t)}`)};async function tk(){xe("making a git fetch..."),awai
135
132
 
136
133
  - M\xE1s info
137
134
 
138
- `,head:t,base:e,repo:r});Me(n)};function gk(t){let e="remotes/origin/";return t.filter(r=>r.includes(e)).map(r=>r.replace(e,""))}var bk=(t,e)=>e.filter(r=>r!==t),yk=async t=>{let{project:e}=await(0,Mi.default)({type:"select",name:"project",message:"What project?",choices:t.map(({name:r})=>({title:r,value:r}))});return e},wk=async(t,e,r)=>{let{confirmed:n}=await(0,Mi.default)({type:"confirm",name:"confirmed",message:`Do you want to create PR in "${t}" from "${r}" to "${e}"?`});return n},_k=async()=>{await fk(),await ck(),await mk();let t=await qi(),e=await yk(t),[r,n]=await dk(),o=gk(n),a=bk(r,o),l=await hk(a);await wk(e,l,r)&&await pk(r,l,e)},Mb=_k;var Db=require("ai"),Fb=require("@ai-sdk/openai");var vk=async()=>(await ie().diff()).split(`
139
- `).filter(e=>e.startsWith("+")&&e.includes("it(")).map(e=>{let r=e.match(/it\(\s*'([^']+)'\s*,/);return r?r[1]:null}).filter(Boolean),Sk=async t=>{let{url:e,token:r,model:n}=await Ue(),o=(0,Fb.createOpenAI)({baseURL:e,apiKey:r}),{text:a}=await(0,Db.generateText)({model:o(n),system:`Eres un experto en gram\xE1tica y redacci\xF3n en ingl\xE9s. Tu tarea es revisar los nombres de tests unitarios de un
135
+ `,head:t,base:e,repo:r});Ct(n)};function bx(t){let e="remotes/origin/";return t.filter(r=>r.includes(e)).map(r=>r.replace(e,""))}var yx=(t,e)=>e.filter(r=>r!==t),_x=async t=>{let{project:e}=await(0,Ti.default)({type:"select",name:"project",message:"What project?",choices:t.map(({name:r})=>({title:r,value:r}))});return e},wx=async(t,e,r)=>{let{confirmed:n}=await(0,Ti.default)({type:"confirm",name:"confirmed",message:`Do you want to create PR in "${t}" from "${r}" to "${e}"?`});return n},vx=async()=>{await mx(),await hx(),await px();let t=await hb(),e=await _x(t),[r,n]=await fx(),o=bx(n),u=yx(r,o),l=await dx(u);await wx(e,l,r)&&await gx(r,l,e)},fb=vx;var mb=require("ai"),pb=require("@ai-sdk/openai");var Sx=async()=>(await je().diff()).split(`
136
+ `).filter(e=>e.startsWith("+")&&e.includes("it(")).map(e=>{let r=e.match(/it\(\s*'([^']+)'\s*,/);return r?r[1]:null}).filter(Boolean),Tx=async t=>{let{url:e,token:r,model:n}=await ci(),o=(0,pb.createOpenAI)({baseURL:e,apiKey:r}),{text:u}=await(0,mb.generateText)({model:o(n),system:`Eres un experto en gram\xE1tica y redacci\xF3n en ingl\xE9s. Tu tarea es revisar los nombres de tests unitarios de un
140
137
  proyecto y corregirlos si tienen errores gramaticales o de estilo. Siempre debes responder con una lista numerada en
141
138
  el siguiente formato:
142
139
  1. **Nombre original:** \`<nombre_original>\`
@@ -147,7 +144,7 @@ ${await(0,Uu.marked)(t)}`)};async function tk(){xe("making a git fetch..."),awai
147
144
  corrige cualquier error si es necesario, siguiendo el formato indicado:
148
145
  ${t.join(`
149
146
  `)}
150
- Por favor, proporciona la lista con las correcciones y explicaciones en espa\xF1ol.`}],temperature:.8,maxOutputTokens:4096});return a},Tk=async()=>{let t=await vk(),e=await Sk(t);console.log(e)},Bb=Tk;var $b=require("ai"),jb=require("@ai-sdk/openai");var Rk=async()=>ie().diff(),xk=async t=>{let{url:e,token:r,model:n}=await Ue(),o=(0,jb.createOpenAI)({baseURL:e,apiKey:r}),{text:a}=await(0,$b.generateText)({model:o(n),system:`Eres un experto en control de versiones y buenas pr\xE1cticas de desarrollo.
147
+ Por favor, proporciona la lista con las correcciones y explicaciones en espa\xF1ol.`}],temperature:.8,maxOutputTokens:4096});return u},Rx=async()=>{let t=await Sx(),e=await Tx(t);console.log(e)},gb=Rx;var bb=require("ai"),yb=require("@ai-sdk/openai");var Cx=async()=>je().diff(),xx=async t=>{let{url:e,token:r,model:n}=await ci(),o=(0,yb.createOpenAI)({baseURL:e,apiKey:r}),{text:u}=await(0,bb.generateText)({model:o(n),system:`Eres un experto en control de versiones y buenas pr\xE1cticas de desarrollo.
151
148
  Tu tarea es analizar un diff de Git y proponer un mensaje de commit **natural, breve y descriptivo**, sin prefijos como "feat:" o "fix:".
152
149
  El mensaje debe:
153
150
  - Resumir qu\xE9 se hizo (a\xF1adido, modificado, eliminado, refactorizado, etc.)
@@ -155,136 +152,7 @@ ${await(0,Uu.marked)(t)}`)};async function tk(){xe("making a git fetch..."),awai
155
152
  - Estar en un solo rengl\xF3n y en tono imperativo (por ejemplo: "Update user validation", "Remove unused imports").
156
153
  No incluyas c\xF3digo, explicaciones ni formato adicional, solo el mensaje final.`,messages:[{role:"user",content:`Analiza este diff y genera un mensaje de commit breve y claro:
157
154
 
158
- ${t}`}],temperature:.8,maxOutputTokens:500});return a},Ck=async()=>{let t=await Rk(),e=await xk(t);console.log(e)},Lb=Ck;var zb=require("ai"),Hb=require("@ai-sdk/openai");var Gb=B(Ct());var Di=`Eres un revisor de c\xF3digo senior especializado en JavaScript, TypeScript y Node.js.
159
- Vas a analizar un diff completo de Git y devolver un *code review* claro, breve y \xFAtil.
160
-
161
- Instrucciones estrictas:
162
- - Comenta **solo** sobre problemas reales y observables en el diff.
163
- - No inventes escenarios hipot\xE9ticos, no uses expresiones como:
164
- "si esto no est\xE1 definido...", "podr\xEDa romper algo...", "es posible que..."
165
- - Conc\xE9ntrate \xFAnicamente en lo que **s\xED est\xE1 en el diff**.
166
- - Revisa:
167
- - Errores reales de TypeScript o tipos inconsistentes.
168
- - L\xF3gica incorrecta o dudosa.
169
- - Uso incorrecto de async/await, promesas o side-effects.
170
- - C\xF3digo innecesario, duplicado o mal organizado.
171
- - Falta de validaciones evidentes en el diff (sin suponer m\xE1s).
172
- - Sugiere refactor **solo si hay una mejora clara basada en lo que se ve**.
173
- - No reescribas el c\xF3digo completo ni pegues el diff.
174
- - Mant\xE9n siempre esta estructura de salida en markdown:
175
- 1. **Problemas encontrados**
176
- 2. **Refactor obvio (solo si aplica)**
177
- 3. **Recomendaciones generales**
178
-
179
- S\xE9 directo, concreto y centrado exclusivamente en el diff proporcionado.`,Nb=`
180
- Eres un revisor senior de c\xF3digo especializado en JavaScript, TypeScript, Node.js y React.
181
-
182
- Analiza exclusivamente el c\xF3digo proporcionado y responde seg\xFAn la pregunta del usuario.
183
-
184
- Reglas obligatorias:
185
- - No inventes contexto, imports, dependencias ni ficheros externos.
186
- - No hagas suposiciones sobre c\xF3digo no visible.
187
- - Si algo no puede determinarse con certeza, responde:
188
- "No se puede determinar con el c\xF3digo proporcionado."
189
-
190
- Qu\xE9 debes detectar:
191
- - Errores reales de JS/TS.
192
- - Tipos incorrectos o incompletos.
193
- - Problemas claros de async/await o l\xF3gica.
194
- - C\xF3digo duplicado, innecesario o mal organizado.
195
- - Oportunidades claras de refactor o mejora.
196
-
197
- Refactors:
198
- - Sugiere cambios solo si aportan claridad, seguridad o mantenibilidad.
199
- - Usa snippets m\xEDnimos (nunca el fichero completo).
200
- - No inventes imports ni librer\xEDas.
201
-
202
- Formato de respuesta (Markdown):
203
- ## Respuesta
204
- ## Problemas (si hay)
205
- ## Refactors (si aportan valor)
206
-
207
- S\xE9 directo, t\xE9cnico y conciso.`,Ub=`
208
- You are PigCode, the best coding agent on the planet.
209
-
210
- You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
211
-
212
- ## Editing constraints
213
- - Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.
214
- - Only add comments if they are necessary to make a non-obvious block easier to understand.
215
- - Try to use apply_patch for single file edits, but it is fine to explore other options to make the edit if it does not work well. Do not use apply_patch for changes that are auto-generated (i.e. generating package.json or running a lint or format command like gofmt) or when scripting is more efficient (such as search and replacing a string across a codebase).
216
-
217
- ## Tool usage
218
- - Prefer specialized tools over shell for file operations:
219
- - Use Read to view files, Edit to modify files, and Write only when needed.
220
- - Use Glob to find files by name and Grep to search file contents.
221
- - Use Bash for terminal operations (git, bun, builds, tests, running scripts).
222
- - Run tool calls in parallel when neither call needs the other's output; otherwise run sequentially.
223
-
224
- ## Git and workspace hygiene
225
- - You may be in a dirty git worktree.
226
- * NEVER revert existing changes you did not make unless explicitly requested.
227
- * If asked to make a commit or code edits and there are unrelated changes, don't revert those changes.
228
- - Do not amend commits unless explicitly requested.
229
- - **NEVER** use destructive commands like \`git reset --hard\` or \`git checkout --\` unless specifically requested.
230
-
231
- ## Presenting your work and final message
232
- - Default: be very concise; friendly coding teammate tone.
233
- - Default: do the work without asking questions.
234
- - Skip heavy formatting for simple confirmations.
235
- - Don't dump large files you've written; reference paths only.
236
- - Offer logical next steps (tests, commits, build) briefly.
237
- `,Wb=`
238
- CRITICAL - MAXIMUM STEPS REACHED
239
-
240
- The maximum number of steps allowed for this task has been reached. Tools are disabled until next user input. Respond with text only.
241
-
242
- STRICT REQUIREMENTS:
243
- 1. Do NOT make any tool calls
244
- 2. MUST provide a text response summarizing work done so far
245
-
246
- Response must include:
247
- - Summary of what has been accomplished so far
248
- - List of any remaining tasks that were not completed
249
- - Recommendations for what should be done next
250
- `;async function kk(){xe("making a git fetch..."),await ie().fetch(),Me("git fetch completed")}var Ek=async()=>(await ie().branch(["-r"])).all,Pk=async t=>{let{baseBranch:e}=await(0,Gb.default)({type:"select",name:"baseBranch",message:"What base branch?",choices:t.map(r=>({title:r,value:r}))});return e},Ak=async t=>ie().diff([`${t}...HEAD`,"--unified=0","--ignore-all-space","--ignore-blank-lines","--",":!*.lock",":!dist",":!coverage"]),Ok=async t=>{let{url:e,token:r,bigModel:n}=await Ue(),o=(0,Hb.createOpenAI)({baseURL:e,apiKey:r}),{text:a}=await(0,zb.generateText)({model:o(n),system:Di,messages:[{role:"user",content:`Analiza este diff y dame un code review \xFAtil y conciso:
251
-
252
- ${t}`}],temperature:.1});await Oi(a)},Ik=async()=>{await kk();let t=await Ek(),e=await Pk(t),r=await Ak(e);await Ok(r)},Vb=Ik;var Yb=require("ai"),Qb=require("@ai-sdk/openai");var zu=B(Ct());var qk=async()=>{if(!process.env.GITHUB_TOKEN||!process.env.GITHUB_ORGANIZATION)return Promise.reject("The envs GITHUB_TOKEN or GITHUB_ORGANIZATION not exist. More info in doc")};async function Mk(){xe("making a git fetch..."),await ie().fetch(),Me("git fetch completed")}var Dk=async t=>{let{project:e}=await(0,zu.default)({type:"select",name:"project",message:"What project?",choices:t.map(({name:r})=>({title:r,value:r}))});return e},Fk=async(t,e)=>ie().diff([`${t}...${e}`,"--unified=0","--ignore-all-space","--ignore-blank-lines","--",":!*.lock",":!dist",":!coverage"]),Bk=async t=>{let{pullRequestId:e}=await(0,zu.default)({type:"select",name:"pullRequestId",message:"What pull request?",choices:t.map(r=>({title:r.title,value:r.id}))});return t.find(r=>r.id===e)},$k=async t=>{let{url:e,token:r,bigModel:n}=await Ue(),o=(0,Qb.createOpenAI)({baseURL:e,apiKey:r}),{text:a}=await(0,Yb.generateText)({model:o(n),system:Di,messages:[{role:"user",content:`Analiza este diff y dame un code review \xFAtil y conciso:
253
-
254
- ${t}`}],temperature:.1});return a},jk=async()=>{await qk(),await Mk();let t=await qi(),e=await Dk(t),r=await Ib(e),n=await Bk(r);if(!n)return;let o=await Fk(n.baseSha,n.headSha);if(!o)return;let a=await $k(o);await qb(e,n.number,`### Esta review esta generada por IA y todav\xEDa est\xE1 en fase de testing, no hacerle mucho caso
255
-
256
- ${a}`)},Jb=jk;var Kb=require("fs/promises"),Hu=B(require("path")),Zb=B(require("fast-glob")),Xb=require("ai"),ey=require("@ai-sdk/openai");var Gu=B(Ct()),ty=B(require("ora")),Lk=async()=>{let t=process.cwd(),r=(await(0,Zb.default)("**/*.{ts,js,tsx,jsx,json}",{cwd:t,onlyFiles:!0,dot:!1,ignore:["node_modules/**",".git/**","dist/**","build/**","coverage/**","tmp/**"],absolute:!0})).map(n=>({title:Hu.default.relative(t,n),value:n}));for(;;){let{selectedFiles:n}=await(0,Gu.default)({type:"autocompleteMultiselect",name:"selectedFiles",message:"Select files to review",choices:r,limit:10},{onCancel:()=>{throw new Error("User cancelled")}});if(n?.length>0)return n;xe("You must select at least one file")}},Nk=async()=>{xe("Type /exit to quit");let{question:t}=await(0,Gu.default)({type:"text",name:"question",initial:"Qu\xE9 te parece este c\xF3digo?",message:"What would you like to ask?"},{onCancel:()=>{throw new Error("User cancelled")}});return t},Uk=async t=>{Hr(`${et()}/.mytools/ia`)||await yi(`${et()}/.mytools/ia`);let e=new Date,r=o=>String(o).padStart(2,"0"),n=e.getFullYear()+r(e.getMonth()+1)+r(e.getDate())+r(e.getHours())+r(e.getMinutes())+r(e.getSeconds());await wi(`${et()}/.mytools/ia/${n}-code-assistance.md`,t)},Wk=async t=>{let e=o=>o.replace(/\n{3,}/g,`
257
-
258
- `).replace(/[ \t]+$/gm,""),r=o=>e(o);return(await Promise.all(t.map(o=>(0,Kb.readFile)(o,"utf8")))).map((o,a)=>{let l=Hu.default.basename(t[a]),h=r(o);return`FICHERO: ${l}
259
- ${h}
260
- --- END FILE ---`}).join(`
261
-
262
- `)},zk=async(t,e)=>{let r=(0,ty.default)("Analyzing code...").start(),{url:n,token:o,bigModel:a}=await Ue(),l=(0,ey.createOpenAI)({baseURL:n,apiKey:o}),{text:h,usage:d}=await(0,Xb.generateText)({model:l(a),system:Nb,messages:[{role:"user",content:`${t}
263
-
264
- ${e}`}],temperature:.1});return r.succeed(`Analysis completed. Tokens ${d?.totalTokens} used.`),h},Hk=async()=>{let t=await Lk();for(;;){let e=await Wk(t);if(!e)return;let r=await Nk();if(r.trim()==="/exit")return;let n=await zk(r,e);await Uk(n),await Oi(n)}},ry=Hk;var By=require("ai");var $y=B(Ct());var sy=B(require("fast-glob")),ny=require("ai"),Vu=B(require("zod"));var iy=async t=>{Ce(`[tool] glob(${t})`);let e=await(0,sy.default)(t,{cwd:process.cwd(),onlyFiles:!1,ignore:["node_modules/**",".git/**","dist/**",".next/**","build/**"],deep:8}),r=e.slice(0,200),n=e.length>200?`
265
- ... (${e.length-200} more)`:"";return r.join(`
266
- `)+n||"(no results)"},oy={glob:(0,ny.tool)({description:"Find files matching a glob pattern. Use this to explore the project structure, find specific file types, or locate files by name. Returns matching file paths. Examples: '**/*.ts', 'src/**/*.tsx', '**/package.json'",inputSchema:Vu.default.object({pattern:Vu.default.string().describe("Glob pattern to match files (e.g. '**/*.ts', 'src/**/*')")})})};var uy=B(require("fs/promises")),ly=require("ai"),Kr=B(require("zod"));var Yu=B(require("path")),Gk=3e4,ay=process.cwd(),Qt=t=>t instanceof Error?`ERROR: ${t.message}`:"ERROR: Unknown error",Jr=t=>{let e=Yu.default.resolve(ay,t);if(!e.startsWith(Yu.default.resolve(ay)))throw new Error("Invalid file path");return e},Fi=(t,e=Gk)=>t.length>e?t.slice(0,e)+`
267
- ... (truncated, file too large)`:t;var Vk=(t,e,r)=>{let n=t.split(`
268
- `),o=Math.max(1,e),a=o-1,l=r!==void 0?a+Math.max(0,r):n.length;return n.slice(a,l).map((h,d)=>`${String(o+d).padStart(6)} ${h}`).join(`
269
- `)},cy=async(t,e,r)=>{Ce(`[tool] read(${t}, ${e}, ${r})`);try{let n=Jr(t),o=await uy.default.readFile(n,"utf-8"),a=Vk(o,e??1,r);return Fi(a)}catch(n){return Qt(n)}},hy={read:(0,ly.tool)({description:"Read the contents of a file. Path must be relative to the project directory. Always read a file before editing it to understand its contents and conventions. For large files, use offset and limit to read specific sections.",inputSchema:Kr.default.object({file_path:Kr.default.string().describe("Relative path to the file (e.g. 'package.json', 'src/index.ts')"),offset:Kr.default.number().optional().describe("Line number to start reading from (1-based). Optional."),limit:Kr.default.number().optional().describe("Maximum number of lines to read. Optional, defaults to entire file.")}),outputSchema:Kr.default.string()})};var dy=require("child_process");var fy=require("ai"),zs=B(require("zod"));var Bi=100,Yk=2e3,Qk=(t,e)=>{let r=Jk(t,e);return(0,dy.execFileSync)("rg",r,{cwd:process.cwd(),timeout:1e4,encoding:"utf-8",maxBuffer:20*1024*1024})},Jk=(t,e)=>{let r=["-nH","--hidden","--no-messages","--field-match-separator=|","--glob=!.git/*","--glob=!node_modules/*","--glob=!dist/*","--glob=!build/*","--glob=!.next/*","--regexp",t];return e&&r.push("--glob",e),r.push("."),r},Kk=t=>t.trim().split(/\r?\n/).flatMap(e=>{if(!e)return[];let[r,n,...o]=e.split("|"),a=Number(n);return!r||!n||Number.isNaN(a)||o.length===0?[]:[{file:r,line:a,text:Fi(o.join("|"),Yk)}]}),Zk=t=>{let e=t.length>Bi,r=e?t.slice(0,Bi):t,n=[];n.push(`Found ${t.length} matches${e?` (showing first ${Bi})`:""}`);let o=null;for(let a of r)a.file!==o&&(o!==null&&n.push(""),o=a.file,n.push(`${a.file}:`)),n.push(` Line ${a.line}: ${a.text}`);return e&&(n.push(""),n.push(`(Results truncated: showing ${Bi} of ${t.length} matches. Use a more specific pattern or file_glob.)`)),n.join(`
270
- `)},my=async(t,e)=>{Ce(`[tool] grep(${t}, ${e||"all files"})`);try{let r=Qk(t,e);if(!r.trim())return"(no results)";let n=Kk(r);return n.length===0?"(no results)":Zk(n)}catch(r){return r?.status===1?"(no results)":Qt(r)}},py={grep:(0,fy.tool)({description:"Search for a regex pattern across project files. Returns matching lines with file path and line number. Use this to find function definitions, usages, imports, string occurrences, etc.",inputSchema:zs.default.object({pattern:zs.default.string().describe("Regex pattern to search for in file contents"),file_glob:zs.default.string().optional().describe("Optional glob to filter which files to search (e.g. '*.ts', '*.tsx')")}),outputSchema:zs.default.string()})};var wy=require("ai"),Zr=B(require("zod"));function Xk(t,e){if(t===""||e==="")return Math.max(t.length,e.length);let r=Array.from({length:t.length+1},(n,o)=>Array.from({length:e.length+1},(a,l)=>o===0?l:l===0?o:0));for(let n=1;n<=t.length;n++)for(let o=1;o<=e.length;o++){let a=t[n-1]===e[o-1]?0:1;r[n][o]=Math.min(r[n-1][o]+1,r[n][o-1]+1,r[n-1][o-1]+a)}return r[t.length][e.length]}var fe=t=>t.split(`
271
- `),eE=t=>{let e=fe(t);return e[e.length-1]===""&&e.pop(),e},by=t=>{let e=[0];for(let r of t)e.push(e[e.length-1]+r.length+1);return e},Qu=(t,e,r)=>{let n=e[r.startLine],o=e[r.endLine+1]-1;return t.substring(n,o)},tE=(t,e,r)=>{let n=[];for(let o=0;o<t.length;o++)if(t[o].trim()===e){for(let a=o+2;a<t.length;a++)if(t[a].trim()===r){n.push({startLine:o,endLine:a});break}}return n},rE=(t,e)=>{let r=t.trim(),n=e.trim(),o=Math.max(r.length,n.length);return o===0?0:1-Xk(r,n)/o},gy=(t,e,r,n)=>{let o=e.length,a=r.endLine-r.startLine+1,l=Math.min(o-2,a-2);if(l<=0)return 1;let h=0;for(let d=1;d<o-1&&d<a-1&&(h+=rE(t[r.startLine+d],e[d])/l,!(n&&h>=0));d++);return h},sE=function*(t,e){yield e},nE=function*(t,e){let r=fe(t),n=eE(e),o=by(r);for(let a=0;a<=r.length-n.length;a++){let l=!0;for(let h=0;h<n.length;h++)if(r[a+h].trim()!==n[h].trim()){l=!1;break}l&&(yield Qu(t,o,{startLine:a,endLine:a+n.length-1}))}},iE=function*(t,e){let r=fe(t),n=fe(e);if(n.length<3)return;n[n.length-1]===""&&n.pop();let o=n[0].trim(),a=n[n.length-1].trim(),l=by(r),h=tE(r,o,a);if(h.length===0)return;if(h.length===1){let p=h[0];gy(r,n,p,!0)>=0&&(yield Qu(t,l,p));return}let d=null,f=-1;for(let p of h){let w=gy(r,n,p,!1);w>f&&(f=w,d=p)}f>=.3&&d&&(yield Qu(t,l,d))},oE=function*(t,e){let r=l=>l.replace(/\s+/g," ").trim(),n=r(e),o=fe(t);for(let l of o)if(r(l)===n)yield l;else if(r(l).includes(n)){let d=e.trim().split(/\s+/);if(d.length>0){let f=d.map(p=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("\\s+");try{let p=l.match(new RegExp(f));p&&(yield p[0])}catch{}}}let a=fe(e);if(a.length>1)for(let l=0;l<=o.length-a.length;l++){let h=o.slice(l,l+a.length);r(h.join(`
272
- `))===n&&(yield h.join(`
273
- `))}},aE=function*(t,e){let r=l=>{let h=fe(l),d=h.filter(p=>p.trim().length>0);if(d.length===0)return l;let f=Math.min(...d.map(p=>{let w=p.match(/^(\s*)/);return w?w[1].length:0}));return h.map(p=>p.trim().length===0?p:p.slice(f)).join(`
274
- `)},n=r(e),o=fe(t),a=fe(e);for(let l=0;l<=o.length-a.length;l++){let h=o.slice(l,l+a.length).join(`
275
- `);r(h)===n&&(yield h)}},uE=function*(t,e){let r=l=>l.replace(/\\(n|t|r|'|"|`|\\|\n|\$)/g,(h,d)=>({n:`
276
- `,t:" ",r:"\r","'":"'",'"':'"',"`":"`","\\":"\\","\n":`
277
- `,$:"$"})[d]??h),n=r(e);t.includes(n)&&(yield n);let o=fe(t),a=fe(n);for(let l=0;l<=o.length-a.length;l++){let h=o.slice(l,l+a.length).join(`
278
- `);r(h)===n&&(yield h)}},lE=function*(t,e){let r=e.trim();if(r===e)return;t.includes(r)&&(yield r);let n=fe(t),o=fe(e);for(let a=0;a<=n.length-o.length;a++){let l=n.slice(a,a+o.length).join(`
279
- `);l.trim()===r&&(yield l)}},cE=function*(t,e){let r=fe(e);if(r.length<3)return;r[r.length-1]===""&&r.pop();let n=fe(t),o=r[0].trim(),a=r[r.length-1].trim();for(let l=0;l<n.length;l++)if(n[l].trim()===o){for(let h=l+2;h<n.length;h++)if(n[h].trim()===a){let d=n.slice(l,h+1);if(d.length===r.length){let f=0,p=0;for(let w=1;w<d.length-1;w++){let _=d[w].trim(),T=r[w].trim();(_.length>0||T.length>0)&&(p++,_===T&&f++)}if(p===0||f/p>=.5){yield d.join(`
280
- `);break}}break}}},hE=[sE,nE,iE,oE,aE,uE,lE,cE];function yy(t,e,r){if(e===r)throw new Error("oldString and newString are identical");let n=!0;for(let o of hE)for(let a of o(t,e)){let l=t.indexOf(a);if(l===-1)continue;n=!1;let h=t.lastIndexOf(a);if(l===h)return t.substring(0,l)+r+t.substring(l+a.length)}throw n?new Error("Could not find oldString in the file. It must match exactly, including whitespace, indentation, and line endings."):new Error("Found multiple matches for oldString. Provide more surrounding context to make the match unique.")}var Ju=B(require("fs/promises"));var _y=async(t,e,r)=>{try{Ce(`[tool] edit(${t})`);let n=Jr(t),o=await Ju.default.readFile(n,"utf-8"),a=yy(o,e,r);return await Ju.default.writeFile(n,a,"utf-8"),`File edited: ${t}`}catch(n){return Qt(n)}},vy={edit:(0,wy.tool)({description:"Replace a specific string in a file with new content. The old_string must match EXACTLY (including whitespace and indentation). If the string is not unique, provide more surrounding context to make it unique. Always read the file first before editing.",inputSchema:Zr.default.object({file_path:Zr.default.string().describe("Relative path to the file to edit"),old_string:Zr.default.string().describe("The exact string to find and replace"),new_string:Zr.default.string().describe("The replacement string")}),outputSchema:Zr.default.string()})};var Sy=require("ai"),Hs=B(require("zod"));var Ku=B(require("fs/promises")),Ty=B(require("path"));var Ry=async(t,e)=>{Ce(`[tool] write(${t})`);try{let r=Jr(t);return await Ku.default.mkdir(Ty.default.dirname(r),{recursive:!0}),await Ku.default.writeFile(r,e,"utf-8"),`File written: ${t} (${e.length} bytes)`}catch(r){return Qt(r)}},xy={write:(0,Sy.tool)({description:"Write full content to a file. Creates the file if it doesn't exist, overwrites if it does. Creates parent directories automatically. Prefer edit over write for modifying existing files.",inputSchema:Hs.default.object({file_path:Hs.default.string().describe("Relative path where to write the file"),content:Hs.default.string().describe("Full content of the file")}),outputSchema:Hs.default.string()})};var Cy=require("ai"),Gs=B(require("zod")),ky=require("child_process");var Ey=async(t,e)=>{Ce(`[tool] bash(${t}, ${e})`);let r=Math.min(e||6e4,6e5);try{return(0,ky.execSync)(t,{cwd:process.cwd(),timeout:r,encoding:"utf-8",env:{...process.env,PATH:process.env.PATH}}).slice(0,2e4)||"(command executed with no output)"}catch(n){let{message:o}=n,a=n.stderr||o||"",l=n.stdout||"";return`ERROR (exit ${n.status??"unknown"}):
281
- ${(l+`
282
- `+a).slice(0,1e4)}`}},Py={bash:(0,Cy.tool)({description:"Execute a shell command in the project directory. Use for: git operations, running npm/pnpm scripts, builds, tests, linters, installing packages, and any terminal operation. Do NOT use for file reading (use read) or file writing (use write).",inputSchema:Gs.default.object({command:Gs.default.string().describe("Shell command to execute"),timeout:Gs.default.number().optional().describe("Timeout in milliseconds. Default: 60000 (60s). Max: 600000 (10min).")}),outputSchema:Gs.default.string()})};var He=B(require("zod")),Ay=require("ai"),ji=B(Ct());var $i="__custom__",dE=t=>[...t.map(e=>({title:e.label,description:e.description,value:e.label})),{title:"Other (type your own)",description:"Provide a custom answer",value:$i}],Oy=async()=>(await(0,ji.default)({type:"text",name:"value",message:"Your answer:"})).value||null,fE=async(t,e)=>{let n=(await(0,ji.default)({type:"select",name:"selected",message:t,choices:e})).selected;if(!n)return[];if(n!==$i)return[n];let o=await Oy();return o?[o]:[]},mE=async(t,e)=>{let n=(await(0,ji.default)({type:"multiselect",name:"selected",message:t,choices:e,hint:"Space to select, Enter to confirm"})).selected||[];if(!n.includes($i))return n;n=n.filter(a=>a!==$i);let o=await Oy();return o&&n.push(o),n},pE=(t,e)=>t.map((r,n)=>{let o=e[n]?.length?e[n].join(", "):"Unanswered";return`"${r.question}" = "${o}"`}).join(", "),Iy=async t=>{Ce("[tool] question()");let e=[];for(let n of t){console.log(`
283
- \x1B[36m${n.header}\x1B[0m`);let o=dE(n.options);n.multiple?e.push(await mE(n.question,o)):e.push(await fE(n.question,o))}return`User has answered your questions: ${pE(t,e)}. Continue with the user's answers in mind.`},qy={question:(0,Ay.tool)({description:'Ask the user questions during execution. Use this to gather preferences, clarify ambiguous instructions, get decisions on implementation choices, or offer choices about what direction to take. Answers are returned as arrays of labels. If you recommend a specific option, make it the first option and add "(Recommended)" at the end of the label.',inputSchema:He.default.object({questions:He.default.array(He.default.object({question:He.default.string().describe("The complete question to ask the user"),header:He.default.string().describe("Short label for the question (max 30 chars)"),options:He.default.array(He.default.object({label:He.default.string().describe("Display text for this option (1-5 words)"),description:He.default.string().describe("Explanation of what this option means")})).min(2).max(5).describe("Available choices for this question"),multiple:He.default.boolean().optional().describe("Allow selecting multiple options. Default: false (single select)")})).min(1).max(4).describe("Questions to ask the user (1-4 questions)")}),outputSchema:He.default.string()})};var gE={glob:t=>iy(t.pattern),read:t=>cy(t.file_path,t.offset,t.limit),grep:t=>my(t.pattern,t.file_glob),edit:t=>_y(t.file_path,t.old_string,t.new_string),write:t=>Ry(t.file_path,t.content),bash:t=>Ey(t.command,t.timeout),question:t=>Iy(t.questions)},My=async(t,e)=>{let r=gE[t];return r?r(e):`Tool ${t} not found`},Dy={...oy,...hy,...py,...vy,...xy,...Py,...qy};var Xu=B(require("path")),jy=require("child_process"),Ly=require("@ai-sdk/openai");var Ny=B(require("fs")),el=Xu.default.resolve(process.argv[2]||process.cwd()),Fy=100,Zu=[],bE=["AGENTS.md","CLAUDE.md","CONTEXT.md"],yE=async()=>{let{question:t}=await(0,$y.default)({type:"text",name:"question",message:"\u{1FAC0}"},{onCancel:()=>{throw new Error("User cancelled")}});return t};function wE(){try{return(0,jy.execSync)("git rev-parse --is-inside-work-tree",{cwd:el,encoding:"utf-8"}),!0}catch{return!1}}function _E(t){return[`You are powered by the model named ${t}. The exact model ID is ${t}`,"Here is some useful information about the environment you are running in:","<env>",` Working directory: ${el}`,` Is directory a git repo: ${wE()?"yes":"no"}`,` Platform: ${process.platform}`,` Today's date: ${new Date().toDateString()}`,"</env>"].join(`
284
- `)}function vE(){for(let t of bE){let e=Xu.default.join(el,t);try{let r=Ny.default.readFileSync(e,"utf-8");return`Instructions from: ${e}
285
- ${r}`}catch{}}return""}function SE(t){return[Ub,_E(t),vE()].filter(Boolean).join(`
286
-
287
- `)}var TE=async(t,e)=>{for(let r=1;r<=Fy;r++){let n=r===Fy,o=await(0,By.generateText)({model:e,messages:n?[...t,{role:"assistant",content:Wb}]:t,tools:n?void 0:Dy,toolChoice:n?void 0:"auto"}),a=o.response.messages;if(t.push(...a),o.text&&Pb(o.text),n||o.finishReason==="stop"||o.toolCalls.length===0)return;for(let l of o.toolCalls){let{toolName:h,input:d}=l,f=await My(h,d);t.push({role:"tool",content:[{type:"tool-result",toolCallId:l.toolCallId,toolName:h,output:{type:"text",value:f}}]})}}},RE=async()=>{let{url:t,token:e,bigModel:r}=await Ue(),o=(0,Ly.createOpenAI)({baseURL:t,apiKey:e}).chat(r);for(Zu.push({role:"system",content:SE(r)});;){let a=await yE();Zu.push({role:"user",content:a}),await TE(Zu,o)}},xE=async()=>{await RE()},Uy=xE;var zy=()=>process.exit(0);process.on("SIGINT",zy);process.on("SIGTERM",zy);var Hy=[{title:"Create branch",value:"create-branch",isExperimental:!1,fn:Ab},{title:"Create PR",value:"create-pull-request",isExperimental:!1,fn:Mb},{title:"[IA] Check name test",value:"ia-check-name-test",isExperimental:!0,fn:Bb},{title:"[IA] Generate title commit",value:"ia-generate-title-commit",isExperimental:!0,fn:Lb},{title:"[IA] Code review assistant",value:"ia-code-review-assistant",isExperimental:!0,fn:Vb},{title:"[IA] Pull Request code review assistant",value:"ia-pull-request-code-review-assistant",isExperimental:!0,fn:Jb},{title:"[IA] Code assistant",value:"ia-code-assistant",isExperimental:!0,fn:ry},{title:"[IA] Agent",value:"ia-agent",isExperimental:!0,fn:Uy},{title:"Exit",value:"exit",isExperimental:!1,fn:async()=>{}}],CE=async()=>{jg()&&!await Hg()||(await Lg(),await Ng(),await Ug(),Me("new version detected"),await Gg())},kE=async()=>{let t=await zg(),e=Hy.filter(({isExperimental:n})=>t||!n).map(({title:n,value:o})=>({title:n,description:"",value:o})),{task:r}=await(0,Wy.default)({type:"select",name:"task",message:"What do you want to do?",choices:e,initial:0});return r},EE=async t=>{let e=Hy.find(({value:r})=>r===t);if(!e)throw new Error(`Unknown task: ${t}`);await e.fn()},PE=async()=>{await CE();let t=await kE();await EE(t)};PE().then(()=>{Me("process completed"),process.exit()}).catch(t=>{Wu("aborting"),Wu(`${t}`),process.exit(1)});
155
+ ${t}`}],temperature:.8,maxOutputTokens:500});return u},kx=async()=>{let t=await Cx(),e=await xx(t);console.log(e)},_b=kx;var vb=()=>process.exit(0);process.on("SIGINT",vb);process.on("SIGTERM",vb);var Sb=[{title:"Create branch",value:"create-branch",isExperimental:!1,fn:cb},{title:"Create PR",value:"create-pull-request",isExperimental:!1,fn:fb},{title:"[IA] Check name test",value:"ia-check-name-test",isExperimental:!0,fn:gb},{title:"[IA] Generate title commit",value:"ia-generate-title-commit",isExperimental:!0,fn:_b},{title:"Exit",value:"exit",isExperimental:!1,fn:async()=>{}}],Px=async()=>{vg()&&!await kg()||(await Sg(),await Tg(),await Rg(),Ct("new version detected"),await Pg())},Ex=async()=>{let t=await xg(),e=Sb.filter(({isExperimental:n})=>t||!n).map(({title:n,value:o})=>({title:n,description:"",value:o})),{task:r}=await(0,wb.default)({type:"select",name:"task",message:"What do you want to do?",choices:e,initial:0});return r},Ax=async t=>{let e=Sb.find(({value:r})=>r===t);if(!e)throw new Error(`Unknown task: ${t}`);await e.fn()},Ox=async()=>{await Px();let t=await Ex();await Ax(t)};Ox().then(()=>{Ct("process completed"),process.exit()}).catch(t=>{Pu("aborting"),Pu(`${t}`),process.exit(1)});
288
156
  /*! Bundled license information:
289
157
 
290
158
  web-streams-polyfill/dist/ponyfill.es2018.js: