mytools-tasks 0.12.0 → 0.12.2

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 +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,4 +3,4 @@
3
3
  /*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
4
4
  if(!globalThis.DOMException){try{const{MessageChannel:t}=i(1267),r=(new t).port1,o=new ArrayBuffer;r.postMessage(o,[o,o])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}}t.exports=globalThis.DOMException},6399:(t,r,i)=>{let o=i(6224);let a=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||o.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env);let formatter=(t,r,i=t)=>o=>{let a=""+o;let l=a.indexOf(r,t.length);return~l?t+replaceClose(a,r,i,l)+r:t+a+r};let replaceClose=(t,r,i,o)=>{let a=t.substring(0,o)+i;let l=t.substring(o+r.length);let u=l.indexOf(r);return~u?a+replaceClose(l,r,i,u):a+l};let createColors=(t=a)=>({isColorSupported:t,reset:t?t=>`${t}`:String,bold:t?formatter("","",""):String,dim:t?formatter("","",""):String,italic:t?formatter("",""):String,underline:t?formatter("",""):String,inverse:t?formatter("",""):String,hidden:t?formatter("",""):String,strikethrough:t?formatter("",""):String,black:t?formatter("",""):String,red:t?formatter("",""):String,green:t?formatter("",""):String,yellow:t?formatter("",""):String,blue:t?formatter("",""):String,magenta:t?formatter("",""):String,cyan:t?formatter("",""):String,white:t?formatter("",""):String,gray:t?formatter("",""):String,bgBlack:t?formatter("",""):String,bgRed:t?formatter("",""):String,bgGreen:t?formatter("",""):String,bgYellow:t?formatter("",""):String,bgBlue:t?formatter("",""):String,bgMagenta:t?formatter("",""):String,bgCyan:t?formatter("",""):String,bgWhite:t?formatter("",""):String});t.exports=createColors();t.exports.createColors=createColors},3:t=>{"use strict";class DatePart{constructor({token:t,date:r,parts:i,locales:o}){this.token=t;this.date=r||new Date;this.parts=i||[this];this.locales=o||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find(((r,i)=>i>t&&r instanceof DatePart))}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const r=t.indexOf(this);return t.find(((t,i)=>i>r&&t instanceof DatePart))}toString(){return String(this.date)}}t.exports=DatePart},9265:(t,r,i)=>{"use strict";const o=i(3);const pos=t=>{t=t%10;return t===1?"st":t===2?"nd":t===3?"rd":"th"};class Day extends o{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate();let r=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+pos(t):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:t}}t.exports=Day},4169:(t,r,i)=>{"use strict";const o=i(3);class Hours extends o{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();if(/h/.test(this.token))t=t%12||12;return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Hours},1373:(t,r,i)=>{"use strict";t.exports={DatePart:i(3),Meridiem:i(2065),Day:i(9265),Hours:i(4169),Milliseconds:i(8589),Minutes:i(2781),Month:i(7025),Seconds:i(5246),Year:i(9301)}},2065:(t,r,i)=>{"use strict";const o=i(3);class Meridiem extends o{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}t.exports=Meridiem},8589:(t,r,i)=>{"use strict";const o=i(3);class Milliseconds extends o{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}t.exports=Milliseconds},2781:(t,r,i)=>{"use strict";const o=i(3);class Minutes extends o{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Minutes},7025:(t,r,i)=>{"use strict";const o=i(3);class Month extends o{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth();let r=this.token.length;return r===2?String(t+1).padStart(2,"0"):r===3?this.locales.monthsShort[t]:r===4?this.locales.months[t]:String(t+1)}}t.exports=Month},5246:(t,r,i)=>{"use strict";const o=i(3);class Seconds extends o{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Seconds},9301:(t,r,i)=>{"use strict";const o=i(3);class Year extends o{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}t.exports=Year},4804:(t,r,i)=>{"use strict";function asyncGeneratorStep(t,r,i,o,a,l,u){try{var c=t[l](u);var d=c.value}catch(t){i(t);return}if(c.done){r(d)}else{Promise.resolve(d).then(o,a)}}function _asyncToGenerator(t){return function(){var r=this,i=arguments;return new Promise((function(o,a){var l=t.apply(r,i);function _next(t){asyncGeneratorStep(l,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=i(1081);const a=i(2547);const l=i(5624),u=l.erase,c=l.cursor;const d=i(5970),h=d.style,p=d.clear,m=d.figures,g=d.wrap,b=d.entriesToDisplay;const getVal=(t,r)=>t[r]&&(t[r].value||t[r].title||t[r]);const getTitle=(t,r)=>t[r]&&(t[r].title||t[r].value||t[r]);const getIndex=(t,r)=>{const i=t.findIndex((t=>t.value===r||t.title===r));return i>-1?i:undefined};class AutocompletePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.suggest=t.suggest;this.choices=t.choices;this.initial=typeof t.initial==="number"?t.initial:getIndex(t.choices,t.initial);this.select=this.initial||t.cursor||0;this.i18n={noMatches:t.noMatches||"no matches found"};this.fallback=t.fallback||this.initial;this.clearFirst=t.clearFirst||false;this.suggestions=[];this.input="";this.limit=t.limit||10;this.cursor=0;this.transform=h.render(t.style);this.scale=this.transform.scale;this.render=this.render.bind(this);this.complete=this.complete.bind(this);this.clear=p("",this.out.columns);this.complete(this.render);this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;if(typeof this._fb==="number")t=this.choices[this._fb];else if(typeof this._fb==="string")t={title:this._fb};return t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t;if(this.suggestions.length>0)this.value=getVal(this.suggestions,t);else this.value=this.fallback.value;this.fire()}complete(t){var r=this;return _asyncToGenerator((function*(){const i=r.completing=r.suggest(r.input,r.choices);const o=yield i;if(r.completing!==i)return;r.suggestions=o.map(((t,r,i)=>({title:getTitle(i,r),value:getVal(i,r),description:t.description})));r.completing=false;const a=Math.max(o.length-1,0);r.moveSelect(Math.min(a,r.select));t&&t()}))()}reset(){this.input="";this.complete((()=>{this.moveSelect(this.initial!==void 0?this.initial:0);this.render()}));this.render()}exit(){if(this.clearFirst&&this.input.length>0){this.reset()}else{this.done=this.exited=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}}abort(){this.done=this.aborted=true;this.exited=false;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=this.exited=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,r){let i=this.input.slice(0,this.cursor);let o=this.input.slice(this.cursor);this.input=`${i}${t}${o}`;this.cursor=i.length+1;this.complete(this.render);this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1);let r=this.input.slice(this.cursor);this.input=`${t}${r}`;this.complete(this.render);this.cursor=this.cursor-1;this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor);let r=this.input.slice(this.cursor+1);this.input=`${t}${r}`;this.complete(this.render);this.render()}first(){this.moveSelect(0);this.render()}last(){this.moveSelect(this.suggestions.length-1);this.render()}up(){if(this.select===0){this.moveSelect(this.suggestions.length-1)}else{this.moveSelect(this.select-1)}this.render()}down(){if(this.select===this.suggestions.length-1){this.moveSelect(0)}else{this.moveSelect(this.select+1)}this.render()}next(){if(this.select===this.suggestions.length-1){this.moveSelect(0)}else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1));this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0));this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1;this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1;this.render()}renderOption(t,r,i,a){let l;let u=i?m.arrowUp:a?m.arrowDown:" ";let c=r?o.cyan().underline(t.title):t.title;u=(r?o.cyan(m.pointer)+" ":" ")+u;if(t.description){l=` - ${t.description}`;if(u.length+c.length+l.length>=this.out.columns||t.description.split(/\r?\n/).length>1){l="\n"+g(t.description,{margin:3,width:this.out.columns})}}return u+" "+c+o.gray(l||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(c.hide);else this.out.write(p(this.outputText,this.out.columns));super.render();let t=b(this.select,this.choices.length,this.limit),r=t.startIndex,i=t.endIndex;this.outputText=[h.symbol(this.done,this.aborted,this.exited),o.bold(this.msg),h.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" ");if(!this.done){const t=this.suggestions.slice(r,i).map(((t,o)=>this.renderOption(t,this.select===o+r,o===0&&r>0,o+r===i-1&&i<this.choices.length))).join("\n");this.outputText+=`\n`+(t||o.gray(this.fallback.title))}this.out.write(u.line+c.to(0)+this.outputText)}}t.exports=AutocompletePrompt},6463:(t,r,i)=>{"use strict";const o=i(1081);const a=i(5624),l=a.cursor;const u=i(4562);const c=i(5970),d=c.clear,h=c.style,p=c.figures;class AutocompleteMultiselectPrompt extends u{constructor(t={}){t.overrideRender=true;super(t);this.inputValue="";this.clear=d("",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(){if(this.cursor===0){this.cursor=this.filteredOptions.length-1}else{this.cursor--}this.render()}down(){if(this.cursor===this.filteredOptions.length-1){this.cursor=0}else{this.cursor++}this.render()}left(){this.filteredOptions[this.cursor].selected=false;this.render()}right(){if(this.value.filter((t=>t.selected)).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true;this.render()}delete(){if(this.inputValue.length){this.inputValue=this.inputValue.substr(0,this.inputValue.length-1);this.updateFilteredOptions()}}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((t=>{if(this.inputValue){if(typeof t.title==="string"){if(t.title.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}if(typeof t.value==="string"){if(t.value.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}return false}return true}));const r=this.filteredOptions.findIndex((r=>r===t));this.cursor=r<0?0:r;this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter((t=>t.selected)).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t;this.updateFilteredOptions()}_(t,r){if(t===" "){this.handleSpaceToggle()}else{this.handleInputChange(t)}}renderInstructions(){if(this.instructions===undefined||this.instructions){if(typeof this.instructions==="string"){return this.instructions}return`\nInstructions:\n ${p.arrowUp}/${p.arrowDown}: Highlight option\n ${p.arrowLeft}/${p.arrowRight}/[space]: Toggle selection\n [a,b,c]/delete: Filter choices\n enter/return: Complete answer\n`}return""}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:o.gray("Enter something to filter")}\n`}renderOption(t,r,i){let a;if(r.disabled)a=t===i?o.gray().underline(r.title):o.strikethrough().gray(r.title);else a=t===i?o.cyan().underline(r.title):r.title;return(r.selected?o.green(p.radioOn):p.radioOff)+" "+a}renderDoneOrInstructions(){if(this.done){return this.value.filter((t=>t.selected)).map((t=>t.title)).join(", ")}const t=[o.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled){t.push(o.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(l.hide);super.render();let t=[h.symbol(this.done,this.aborted),o.bold(this.msg),h.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=o.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.filteredOptions);this.out.write(this.clear+t);this.clear=d(t,this.out.columns)}}t.exports=AutocompleteMultiselectPrompt},8547:(t,r,i)=>{"use strict";const o=i(1081);const a=i(2547);const l=i(5970),u=l.style,c=l.clear;const d=i(5624),h=d.erase,p=d.cursor;class ConfirmPrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.value=t.initial;this.initialValue=!!t.initial;this.yesMsg=t.yes||"yes";this.yesOption=t.yesOption||"(Y/n)";this.noMsg=t.no||"no";this.noOption=t.noOption||"(y/N)";this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.value=this.value||false;this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,r){if(t.toLowerCase()==="y"){this.value=true;return this.submit()}if(t.toLowerCase()==="n"){this.value=false;return this.submit()}return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(p.hide);else this.out.write(c(this.outputText,this.out.columns));super.render();this.outputText=[u.symbol(this.done,this.aborted),o.bold(this.msg),u.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:o.gray(this.initialValue?this.yesOption:this.noOption)].join(" ");this.out.write(h.line+p.to(0)+this.outputText)}}t.exports=ConfirmPrompt},6947:(t,r,i)=>{"use strict";function asyncGeneratorStep(t,r,i,o,a,l,u){try{var c=t[l](u);var d=c.value}catch(t){i(t);return}if(c.done){r(d)}else{Promise.resolve(d).then(o,a)}}function _asyncToGenerator(t){return function(){var r=this,i=arguments;return new Promise((function(o,a){var l=t.apply(r,i);function _next(t){asyncGeneratorStep(l,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=i(1081);const a=i(2547);const l=i(5970),u=l.style,c=l.clear,d=l.figures;const h=i(5624),p=h.erase,m=h.cursor;const g=i(1373),b=g.DatePart,y=g.Meridiem,S=g.Day,w=g.Hours,v=g.Milliseconds,R=g.Minutes,_=g.Month,C=g.Seconds,T=g.Year;const k=/\\(.)|"((?:\\["\\]|[^"])+)"|(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;const P={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new S(t),3:t=>new _(t),4:t=>new T(t),5:t=>new y(t),6:t=>new w(t),7:t=>new R(t),8:t=>new C(t),9:t=>new v(t)};const E={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(",")};class DatePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.cursor=0;this.typed="";this.locales=Object.assign(E,t.locales);this._date=t.initial||new Date;this.errorMsg=t.error||"Please Enter A Valid Value";this.validator=t.validate||(()=>true);this.mask=t.mask||"YYYY-MM-DD HH:mm:ss";this.clear=c("",this.out.columns);this.render()}get value(){return this.date}get date(){return this._date}set date(t){if(t)this._date.setTime(t.getTime())}set mask(t){let r;this.parts=[];while(r=k.exec(t)){let t=r.shift();let i=r.findIndex((t=>t!=null));this.parts.push(i in P?P[i]({token:r[i]||t,date:this.date,parts:this.parts,locales:this.locales}):r[i]||t)}let i=this.parts.reduce(((t,r)=>{if(typeof r==="string"&&typeof t[t.length-1]==="string")t[t.length-1]+=r;else t.push(r);return t}),[]);this.parts.splice(0);this.parts.push(...i);this.reset()}moveCursor(t){this.typed="";this.cursor=t;this.fire()}reset(){this.moveCursor(this.parts.findIndex((t=>t instanceof b)));this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write("\n");this.close()}validate(){var t=this;return _asyncToGenerator((function*(){let r=yield t.validator(t.value);if(typeof r==="string"){t.errorMsg=r;r=false}t.error=!r}))()}submit(){var t=this;return _asyncToGenerator((function*(){yield t.validate();if(t.error){t.color="red";t.fire();t.render();return}t.done=true;t.aborted=false;t.fire();t.render();t.out.write("\n");t.close()}))()}up(){this.typed="";this.parts[this.cursor].up();this.render()}down(){this.typed="";this.parts[this.cursor].down();this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex((t=>t instanceof b)));this.render()}_(t){if(/\d/.test(t)){this.typed+=t;this.parts[this.cursor].setTo(this.typed);this.render()}}render(){if(this.closed)return;if(this.firstRender)this.out.write(m.hide);else this.out.write(c(this.outputText,this.out.columns));super.render();this.outputText=[u.symbol(this.done,this.aborted),o.bold(this.msg),u.delimiter(false),this.parts.reduce(((t,r,i)=>t.concat(i===this.cursor&&!this.done?o.cyan().underline(r.toString()):r)),[]).join("")].join(" ");if(this.error){this.outputText+=this.errorMsg.split("\n").reduce(((t,r,i)=>t+`\n${i?` `:d.pointerSmall} ${o.red().italic(r)}`),``)}this.out.write(p.line+m.to(0)+this.outputText)}}t.exports=DatePrompt},8595:(t,r,i)=>{"use strict";t.exports={TextPrompt:i(7740),SelectPrompt:i(2999),TogglePrompt:i(4641),DatePrompt:i(6947),NumberPrompt:i(4827),MultiselectPrompt:i(4562),AutocompletePrompt:i(4804),AutocompleteMultiselectPrompt:i(6463),ConfirmPrompt:i(8547)}},4562:(t,r,i)=>{"use strict";const o=i(1081);const a=i(5624),l=a.cursor;const u=i(2547);const c=i(5970),d=c.clear,h=c.figures,p=c.style,m=c.wrap,g=c.entriesToDisplay;class MultiselectPrompt extends u{constructor(t={}){super(t);this.msg=t.message;this.cursor=t.cursor||0;this.scrollIndex=t.cursor||0;this.hint=t.hint||"";this.warn=t.warn||"- This option is disabled -";this.minSelected=t.min;this.showMinError=false;this.maxChoices=t.max;this.instructions=t.instructions;this.optionsPerPage=t.optionsPerPage||10;this.value=t.choices.map(((t,r)=>{if(typeof t==="string")t={title:t,value:r};return{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===undefined?r:t.value),selected:t&&t.selected,disabled:t&&t.disabled}}));this.clear=d("",this.out.columns);if(!t.overrideRender){this.render()}}reset(){this.value.map((t=>!t.selected));this.cursor=0;this.fire();this.render()}selected(){return this.value.filter((t=>t.selected))}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){const t=this.value.filter((t=>t.selected));if(this.minSelected&&t.length<this.minSelected){this.showMinError=true;this.render()}else{this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");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(){if(this.cursor===0){this.cursor=this.value.length-1}else{this.cursor--}this.render()}down(){if(this.cursor===this.value.length-1){this.cursor=0}else{this.cursor++}this.render()}left(){this.value[this.cursor].selected=false;this.render()}right(){if(this.value.filter((t=>t.selected)).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true;this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter((t=>t.selected)).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}toggleAll(){if(this.maxChoices!==undefined||this.value[this.cursor].disabled){return this.bell()}const t=!this.value[this.cursor].selected;this.value.filter((t=>!t.disabled)).forEach((r=>r.selected=t));this.render()}_(t,r){if(t===" "){this.handleSpaceToggle()}else if(t==="a"){this.toggleAll()}else{return this.bell()}}renderInstructions(){if(this.instructions===undefined||this.instructions){if(typeof this.instructions==="string"){return this.instructions}return"\nInstructions:\n"+` ${h.arrowUp}/${h.arrowDown}: Highlight option\n`+` ${h.arrowLeft}/${h.arrowRight}/[space]: Toggle selection\n`+(this.maxChoices===undefined?` a: Toggle all\n`:"")+` enter/return: Complete answer`}return""}renderOption(t,r,i,a){const l=(r.selected?o.green(h.radioOn):h.radioOff)+" "+a+" ";let u,c;if(r.disabled){u=t===i?o.gray().underline(r.title):o.strikethrough().gray(r.title)}else{u=t===i?o.cyan().underline(r.title):r.title;if(t===i&&r.description){c=` - ${r.description}`;if(l.length+u.length+c.length>=this.out.columns||r.description.split(/\r?\n/).length>1){c="\n"+m(r.description,{margin:l.length,width:this.out.columns})}}}return l+u+o.gray(c||"")}paginateOptions(t){if(t.length===0){return o.red("No matches for this query.")}let r=g(this.cursor,t.length,this.optionsPerPage),i=r.startIndex,a=r.endIndex;let l,u=[];for(let r=i;r<a;r++){if(r===i&&i>0){l=h.arrowUp}else if(r===a-1&&a<t.length){l=h.arrowDown}else{l=" "}u.push(this.renderOption(this.cursor,t[r],r,l))}return"\n"+u.join("\n")}renderOptions(t){if(!this.done){return this.paginateOptions(t)}return""}renderDoneOrInstructions(){if(this.done){return this.value.filter((t=>t.selected)).map((t=>t.title)).join(", ")}const t=[o.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled){t.push(o.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(l.hide);super.render();let t=[p.symbol(this.done,this.aborted),o.bold(this.msg),p.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=o.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.value);this.out.write(this.clear+t);this.clear=d(t,this.out.columns)}}t.exports=MultiselectPrompt},4827:(t,r,i)=>{"use strict";function asyncGeneratorStep(t,r,i,o,a,l,u){try{var c=t[l](u);var d=c.value}catch(t){i(t);return}if(c.done){r(d)}else{Promise.resolve(d).then(o,a)}}function _asyncToGenerator(t){return function(){var r=this,i=arguments;return new Promise((function(o,a){var l=t.apply(r,i);function _next(t){asyncGeneratorStep(l,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=i(1081);const a=i(2547);const l=i(5624),u=l.cursor,c=l.erase;const d=i(5970),h=d.style,p=d.figures,m=d.clear,g=d.lines;const b=/[0-9]/;const isDef=t=>t!==undefined;const round=(t,r)=>{let i=Math.pow(10,r);return Math.round(t*i)/i};class NumberPrompt extends a{constructor(t={}){super(t);this.transform=h.render(t.style);this.msg=t.message;this.initial=isDef(t.initial)?t.initial:"";this.float=!!t.float;this.round=t.round||2;this.inc=t.increment||1;this.min=isDef(t.min)?t.min:-Infinity;this.max=isDef(t.max)?t.max:Infinity;this.errorMsg=t.error||`Please Enter A Valid Value`;this.validator=t.validate||(()=>true);this.color=`cyan`;this.value=``;this.typed=``;this.lastHit=0;this.render()}set value(t){if(!t&&t!==0){this.placeholder=true;this.rendered=o.gray(this.transform.render(`${this.initial}`));this._value=``}else{this.placeholder=false;this.rendered=this.transform.render(`${round(t,this.round)}`);this._value=round(t,this.round)}this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t===`-`||t===`.`&&this.float||b.test(t)}reset(){this.typed=``;this.value=``;this.fire();this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==``?t:this.initial;this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}validate(){var t=this;return _asyncToGenerator((function*(){let r=yield t.validator(t.value);if(typeof r===`string`){t.errorMsg=r;r=false}t.error=!r}))()}submit(){var t=this;return _asyncToGenerator((function*(){yield t.validate();if(t.error){t.color=`red`;t.fire();t.render();return}let r=t.value;t.value=r!==``?r:t.initial;t.done=true;t.aborted=false;t.error=false;t.fire();t.render();t.out.write(`\n`);t.close()}))()}up(){this.typed=``;if(this.value===""){this.value=this.min-this.inc}if(this.value>=this.max)return this.bell();this.value+=this.inc;this.color=`cyan`;this.fire();this.render()}down(){this.typed=``;if(this.value===""){this.value=this.min+this.inc}if(this.value<=this.min)return this.bell();this.value-=this.inc;this.color=`cyan`;this.fire();this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||``;if(this.value!==""&&this.value<this.min){this.value=this.min}this.color=`cyan`;this.fire();this.render()}next(){this.value=this.initial;this.fire();this.render()}_(t,r){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3)this.typed=``;this.typed+=t;this.lastHit=i;this.color=`cyan`;if(t===`.`)return this.fire();this.value=Math.min(this.parse(this.typed),this.max);if(this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire();this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(u.down(g(this.outputError,this.out.columns)-1)+m(this.outputError,this.out.columns));this.out.write(m(this.outputText,this.out.columns))}super.render();this.outputError="";this.outputText=[h.symbol(this.done,this.aborted),o.bold(this.msg),h.delimiter(this.done),!this.done||!this.done&&!this.placeholder?o[this.color]().underline(this.rendered):this.rendered].join(` `);if(this.error){this.outputError+=this.errorMsg.split(`\n`).reduce(((t,r,i)=>t+`\n${i?` `:p.pointerSmall} ${o.red().italic(r)}`),``)}this.out.write(c.line+u.to(0)+this.outputText+u.save+this.outputError+u.restore)}}t.exports=NumberPrompt},2547:(t,r,i)=>{"use strict";const o=i(4521);const a=i(5970),l=a.action;const u=i(2361);const c=i(5624),d=c.beep,h=c.cursor;const p=i(1081);class Prompt extends u{constructor(t={}){super();this.firstRender=true;this.in=t.stdin||process.stdin;this.out=t.stdout||process.stdout;this.onRender=(t.onRender||(()=>void 0)).bind(this);const r=o.createInterface({input:this.in,escapeCodeTimeout:50});o.emitKeypressEvents(this.in,r);if(this.in.isTTY)this.in.setRawMode(true);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1;const keypress=(t,r)=>{let o=l(r,i);if(o===false){this._&&this._(t,r)}else if(typeof this[o]==="function"){this[o](r)}else{this.bell()}};this.close=()=>{this.out.write(h.show);this.in.removeListener("keypress",keypress);if(this.in.isTTY)this.in.setRawMode(false);r.close();this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value);this.closed=true};this.in.on("keypress",keypress)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(d)}render(){this.onRender(p);if(this.firstRender)this.firstRender=false}}t.exports=Prompt},2999:(t,r,i)=>{"use strict";const o=i(1081);const a=i(2547);const l=i(5970),u=l.style,c=l.clear,d=l.figures,h=l.wrap,p=l.entriesToDisplay;const m=i(5624),g=m.cursor;class SelectPrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.hint=t.hint||"- Use arrow-keys. Return to submit.";this.warn=t.warn||"- This option is disabled";this.cursor=t.initial||0;this.choices=t.choices.map(((t,r)=>{if(typeof t==="string")t={title:t,value:r};return{title:t&&(t.title||t.value||t),value:t&&(t.value===undefined?r:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled}}));this.optionsPerPage=t.optionsPerPage||10;this.value=(this.choices[this.cursor]||{}).value;this.clear=c("",this.out.columns);this.render()}moveCursor(t){this.cursor=t;this.value=this.choices[t].value;this.fire()}reset(){this.moveCursor(0);this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){if(!this.selection.disabled){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}else this.bell()}first(){this.moveCursor(0);this.render()}last(){this.moveCursor(this.choices.length-1);this.render()}up(){if(this.cursor===0){this.moveCursor(this.choices.length-1)}else{this.moveCursor(this.cursor-1)}this.render()}down(){if(this.cursor===this.choices.length-1){this.moveCursor(0)}else{this.moveCursor(this.cursor+1)}this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length);this.render()}_(t,r){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(g.hide);else this.out.write(c(this.outputText,this.out.columns));super.render();let t=p(this.cursor,this.choices.length,this.optionsPerPage),r=t.startIndex,i=t.endIndex;this.outputText=[u.symbol(this.done,this.aborted),o.bold(this.msg),u.delimiter(false),this.done?this.selection.title:this.selection.disabled?o.yellow(this.warn):o.gray(this.hint)].join(" ");if(!this.done){this.outputText+="\n";for(let t=r;t<i;t++){let a,l,u="",c=this.choices[t];if(t===r&&r>0){l=d.arrowUp}else if(t===i-1&&i<this.choices.length){l=d.arrowDown}else{l=" "}if(c.disabled){a=this.cursor===t?o.gray().underline(c.title):o.strikethrough().gray(c.title);l=(this.cursor===t?o.bold().gray(d.pointer)+" ":" ")+l}else{a=this.cursor===t?o.cyan().underline(c.title):c.title;l=(this.cursor===t?o.cyan(d.pointer)+" ":" ")+l;if(c.description&&this.cursor===t){u=` - ${c.description}`;if(l.length+a.length+u.length>=this.out.columns||c.description.split(/\r?\n/).length>1){u="\n"+h(c.description,{margin:3,width:this.out.columns})}}}this.outputText+=`${l} ${a}${o.gray(u)}\n`}}this.out.write(this.outputText)}}t.exports=SelectPrompt},7740:(t,r,i)=>{"use strict";function asyncGeneratorStep(t,r,i,o,a,l,u){try{var c=t[l](u);var d=c.value}catch(t){i(t);return}if(c.done){r(d)}else{Promise.resolve(d).then(o,a)}}function _asyncToGenerator(t){return function(){var r=this,i=arguments;return new Promise((function(o,a){var l=t.apply(r,i);function _next(t){asyncGeneratorStep(l,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=i(1081);const a=i(2547);const l=i(5624),u=l.erase,c=l.cursor;const d=i(5970),h=d.style,p=d.clear,m=d.lines,g=d.figures;class TextPrompt extends a{constructor(t={}){super(t);this.transform=h.render(t.style);this.scale=this.transform.scale;this.msg=t.message;this.initial=t.initial||``;this.validator=t.validate||(()=>true);this.value=``;this.errorMsg=t.error||`Please Enter A Valid Value`;this.cursor=Number(!!this.initial);this.cursorOffset=0;this.clear=p(``,this.out.columns);this.render()}set value(t){if(!t&&this.initial){this.placeholder=true;this.rendered=o.gray(this.transform.render(this.initial))}else{this.placeholder=false;this.rendered=this.transform.render(t)}this._value=t;this.fire()}get value(){return this._value}reset(){this.value=``;this.cursor=Number(!!this.initial);this.cursorOffset=0;this.fire();this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial;this.done=this.aborted=true;this.error=false;this.red=false;this.fire();this.render();this.out.write("\n");this.close()}validate(){var t=this;return _asyncToGenerator((function*(){let r=yield t.validator(t.value);if(typeof r===`string`){t.errorMsg=r;r=false}t.error=!r}))()}submit(){var t=this;return _asyncToGenerator((function*(){t.value=t.value||t.initial;t.cursorOffset=0;t.cursor=t.rendered.length;yield t.validate();if(t.error){t.red=true;t.fire();t.render();return}t.done=true;t.aborted=false;t.fire();t.render();t.out.write("\n");t.close()}))()}next(){if(!this.placeholder)return this.bell();this.value=this.initial;this.cursor=this.rendered.length;this.fire();this.render()}moveCursor(t){if(this.placeholder)return;this.cursor=this.cursor+t;this.cursorOffset+=t}_(t,r){let i=this.value.slice(0,this.cursor);let o=this.value.slice(this.cursor);this.value=`${i}${t}${o}`;this.red=false;this.cursor=this.placeholder?0:i.length+1;this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1);let r=this.value.slice(this.cursor);this.value=`${t}${r}`;this.red=false;if(this.isCursorAtStart()){this.cursorOffset=0}else{this.cursorOffset++;this.moveCursor(-1)}this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor);let r=this.value.slice(this.cursor+1);this.value=`${t}${r}`;this.red=false;if(this.isCursorAtEnd()){this.cursorOffset=0}else{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(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(c.down(m(this.outputError,this.out.columns)-1)+p(this.outputError,this.out.columns));this.out.write(p(this.outputText,this.out.columns))}super.render();this.outputError="";this.outputText=[h.symbol(this.done,this.aborted),o.bold(this.msg),h.delimiter(this.done),this.red?o.red(this.rendered):this.rendered].join(` `);if(this.error){this.outputError+=this.errorMsg.split(`\n`).reduce(((t,r,i)=>t+`\n${i?" ":g.pointerSmall} ${o.red().italic(r)}`),``)}this.out.write(u.line+c.to(0)+this.outputText+c.save+this.outputError+c.restore+c.move(this.cursorOffset,0))}}t.exports=TextPrompt},4641:(t,r,i)=>{"use strict";const o=i(1081);const a=i(2547);const l=i(5970),u=l.style,c=l.clear;const d=i(5624),h=d.cursor,p=d.erase;class TogglePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.value=!!t.initial;this.active=t.active||"on";this.inactive=t.inactive||"off";this.initialValue=this.value;this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}deactivate(){if(this.value===false)return this.bell();this.value=false;this.render()}activate(){if(this.value===true)return this.bell();this.value=true;this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value;this.fire();this.render()}_(t,r){if(t===" "){this.value=!this.value}else if(t==="1"){this.value=true}else if(t==="0"){this.value=false}else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(h.hide);else this.out.write(c(this.outputText,this.out.columns));super.render();this.outputText=[u.symbol(this.done,this.aborted),o.bold(this.msg),u.delimiter(this.done),this.value?this.inactive:o.cyan().underline(this.inactive),o.gray("/"),this.value?o.cyan().underline(this.active):this.active].join(" ");this.out.write(p.line+h.to(0)+this.outputText)}}t.exports=TogglePrompt},9037:(t,r,i)=>{"use strict";function ownKeys(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);if(r){o=o.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))}i.push.apply(i,o)}return i}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};if(r%2){ownKeys(Object(i),true).forEach((function(r){_defineProperty(t,r,i[r])}))}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))}else{ownKeys(Object(i)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))}))}}return t}function _defineProperty(t,r,i){if(r in t){Object.defineProperty(t,r,{value:i,enumerable:true,configurable:true,writable:true})}else{t[r]=i}return t}function _createForOfIteratorHelper(t,r){var i=typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=_unsupportedIterableToArray(t))||r&&t&&typeof t.length==="number"){if(i)t=i;var o=0;var a=function F(){};return{s:a,n:function n(){if(o>=t.length)return{done:true};return{done:false,value:t[o++]}},e:function e(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l=true,u=false,c;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();l=t.done;return t},e:function e(t){u=true;c=t},f:function f(){try{if(!l&&i.return!=null)i.return()}finally{if(u)throw c}}}}function _unsupportedIterableToArray(t,r){if(!t)return;if(typeof t==="string")return _arrayLikeToArray(t,r);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor)i=t.constructor.name;if(i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return _arrayLikeToArray(t,r)}function _arrayLikeToArray(t,r){if(r==null||r>t.length)r=t.length;for(var i=0,o=new Array(r);i<r;i++)o[i]=t[i];return o}function asyncGeneratorStep(t,r,i,o,a,l,u){try{var c=t[l](u);var d=c.value}catch(t){i(t);return}if(c.done){r(d)}else{Promise.resolve(d).then(o,a)}}function _asyncToGenerator(t){return function(){var r=this,i=arguments;return new Promise((function(o,a){var l=t.apply(r,i);function _next(t){asyncGeneratorStep(l,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=i(8078);const a=["suggest","format","onState","validate","onRender","type"];const noop=()=>{};function prompt(){return _prompt.apply(this,arguments)}function _prompt(){_prompt=_asyncToGenerator((function*(t=[],{onSubmit:r=noop,onCancel:i=noop}={}){const l={};const u=prompt._override||{};t=[].concat(t);let c,d,h,p,m,g;const b=function(){var t=_asyncToGenerator((function*(t,r,i=false){if(!i&&t.validate&&t.validate(r)!==true){return}return t.format?yield t.format(r,l):r}));return function getFormattedAnswer(r,i){return t.apply(this,arguments)}}();var y=_createForOfIteratorHelper(t),S;try{for(y.s();!(S=y.n()).done;){d=S.value;var w=d;p=w.name;m=w.type;if(typeof m==="function"){m=yield m(c,_objectSpread({},l),d);d["type"]=m}if(!m)continue;for(let t in d){if(a.includes(t))continue;let r=d[t];d[t]=typeof r==="function"?yield r(c,_objectSpread({},l),g):r}g=d;if(typeof d.message!=="string"){throw new Error("prompt message is required")}var v=d;p=v.name;m=v.type;if(o[m]===void 0){throw new Error(`prompt type (${m}) is not defined`)}if(u[d.name]!==undefined){c=yield b(d,u[d.name]);if(c!==undefined){l[p]=c;continue}}try{c=prompt._injected?getInjectedAnswer(prompt._injected,d.initial):yield o[m](d);l[p]=c=yield b(d,c,true);h=yield r(d,c,l)}catch(t){h=!(yield i(d,l))}if(h)return l}}catch(t){y.e(t)}finally{y.f()}return l}));return _prompt.apply(this,arguments)}function getInjectedAnswer(t,r){const i=t.shift();if(i instanceof Error){throw i}return i===undefined?r:i}function inject(t){prompt._injected=(prompt._injected||[]).concat(t)}function override(t){prompt._override=Object.assign({},t)}t.exports=Object.assign(prompt,{prompt:prompt,prompts:o,inject:inject,override:override})},8078:(t,r,i)=>{"use strict";const o=r;const a=i(8595);const noop=t=>t;function toPrompt(t,r,i={}){return new Promise(((o,l)=>{const u=new a[t](r);const c=i.onAbort||noop;const d=i.onSubmit||noop;const h=i.onExit||noop;u.on("state",r.onState||noop);u.on("submit",(t=>o(d(t))));u.on("exit",(t=>o(h(t))));u.on("abort",(t=>l(c(t))))}))}o.text=t=>toPrompt("TextPrompt",t);o.password=t=>{t.style="password";return o.text(t)};o.invisible=t=>{t.style="invisible";return o.text(t)};o.number=t=>toPrompt("NumberPrompt",t);o.date=t=>toPrompt("DatePrompt",t);o.confirm=t=>toPrompt("ConfirmPrompt",t);o.list=t=>{const r=t.separator||",";return toPrompt("TextPrompt",t,{onSubmit:t=>t.split(r).map((t=>t.trim()))})};o.toggle=t=>toPrompt("TogglePrompt",t);o.select=t=>toPrompt("SelectPrompt",t);o.multiselect=t=>{t.choices=[].concat(t.choices||[]);const toSelected=t=>t.filter((t=>t.selected)).map((t=>t.value));return toPrompt("MultiselectPrompt",t,{onAbort:toSelected,onSubmit:toSelected})};o.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);const toSelected=t=>t.filter((t=>t.selected)).map((t=>t.value));return toPrompt("AutocompleteMultiselectPrompt",t,{onAbort:toSelected,onSubmit:toSelected})};const byTitle=(t,r)=>Promise.resolve(r.filter((r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase())));o.autocomplete=t=>{t.suggest=t.suggest||byTitle;t.choices=[].concat(t.choices||[]);return toPrompt("AutocompletePrompt",t)}},8075:t=>{"use strict";t.exports=(t,r)=>{if(t.meta&&t.name!=="escape")return;if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c")return"abort";if(t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(r){if(t.name==="j")return"down";if(t.name==="k")return"up"}if(t.name==="return")return"submit";if(t.name==="enter")return"submit";if(t.name==="backspace")return"delete";if(t.name==="delete")return"deleteForward";if(t.name==="abort")return"abort";if(t.name==="escape")return"exit";if(t.name==="tab")return"next";if(t.name==="pagedown")return"nextPage";if(t.name==="pageup")return"prevPage";if(t.name==="home")return"home";if(t.name==="end")return"end";if(t.name==="up")return"up";if(t.name==="down")return"down";if(t.name==="right")return"right";if(t.name==="left")return"left";return false}},7640:(t,r,i)=>{"use strict";function _createForOfIteratorHelper(t,r){var i=typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=_unsupportedIterableToArray(t))||r&&t&&typeof t.length==="number"){if(i)t=i;var o=0;var a=function F(){};return{s:a,n:function n(){if(o>=t.length)return{done:true};return{done:false,value:t[o++]}},e:function e(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l=true,u=false,c;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();l=t.done;return t},e:function e(t){u=true;c=t},f:function f(){try{if(!l&&i.return!=null)i.return()}finally{if(u)throw c}}}}function _unsupportedIterableToArray(t,r){if(!t)return;if(typeof t==="string")return _arrayLikeToArray(t,r);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor)i=t.constructor.name;if(i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return _arrayLikeToArray(t,r)}function _arrayLikeToArray(t,r){if(r==null||r>t.length)r=t.length;for(var i=0,o=new Array(r);i<r;i++)o[i]=t[i];return o}const o=i(6375);const a=i(5624),l=a.erase,u=a.cursor;const width=t=>[...o(t)].length;t.exports=function(t,r){if(!r)return l.line+u.to(0);let i=0;const o=t.split(/\r?\n/);var a=_createForOfIteratorHelper(o),c;try{for(a.s();!(c=a.n()).done;){let t=c.value;i+=1+Math.floor(Math.max(width(t)-1,0)/r)}}catch(t){a.e(t)}finally{a.f()}return l.lines(i)}},1899:t=>{"use strict";t.exports=(t,r,i)=>{i=i||r;let o=Math.min(r-i,t-Math.floor(i/2));if(o<0)o=0;let a=Math.min(o+i,r);return{startIndex:o,endIndex:a}}},171:t=>{"use strict";const r={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"};const i={arrowUp:r.arrowUp,arrowDown:r.arrowDown,arrowLeft:r.arrowLeft,arrowRight:r.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"};const o=process.platform==="win32"?i:r;t.exports=o},5970:(t,r,i)=>{"use strict";t.exports={action:i(8075),clear:i(7640),style:i(3392),strip:i(6375),figures:i(171),lines:i(1496),wrap:i(6328),entriesToDisplay:i(1899)}},1496:(t,r,i)=>{"use strict";const o=i(6375);t.exports=function(t,r){let i=String(o(t)||"").split(/\r?\n/);if(!r)return i.length;return i.map((t=>Math.ceil(t.length/r))).reduce(((t,r)=>t+r))}},6375:t=>{"use strict";t.exports=t=>{const r=["[\\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("|");const i=new RegExp(r,"g");return typeof t==="string"?t.replace(i,""):t}},3392:(t,r,i)=>{"use strict";const o=i(1081);const a=i(171);const l=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"😃".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}});const render=t=>l[t]||l.default;const u=Object.freeze({aborted:o.red(a.cross),done:o.green(a.tick),exited:o.yellow(a.cross),default:o.cyan("?")});const symbol=(t,r,i)=>r?u.aborted:i?u.exited:t?u.done:u.default;const delimiter=t=>o.gray(t?a.ellipsis:a.pointerSmall);const item=(t,r)=>o.gray(t?r?a.pointerSmall:"+":a.line);t.exports={styles:l,render:render,symbols:u,symbol:symbol,delimiter:delimiter,item:item}},6328:t=>{"use strict";t.exports=(t,r={})=>{const i=Number.isSafeInteger(parseInt(r.margin))?new Array(parseInt(r.margin)).fill(" ").join(""):r.margin||"";const o=r.width;return(t||"").split(/\r?\n/g).map((t=>t.split(/\s+/g).reduce(((t,r)=>{if(r.length+i.length>=o||t[t.length-1].length+r.length+1<o)t[t.length-1]+=` ${r}`;else t.push(`${i}${r}`);return t}),[i]).join("\n"))).join("\n")}},5918:(t,r,i)=>{function isNodeLT(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let r=0,i=process.versions.node.split(".").map(Number);for(;r<t.length;r++){if(i[r]>t[r])return false;if(t[r]>i[r])return true}return false}t.exports=isNodeLT("8.6.0")?i(9037):i(8837)},9611:t=>{"use strict";class DatePart{constructor({token:t,date:r,parts:i,locales:o}){this.token=t;this.date=r||new Date;this.parts=i||[this];this.locales=o||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find(((r,i)=>i>t&&r instanceof DatePart))}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const r=t.indexOf(this);return t.find(((t,i)=>i>r&&t instanceof DatePart))}toString(){return String(this.date)}}t.exports=DatePart},6205:(t,r,i)=>{"use strict";const o=i(9611);const pos=t=>{t=t%10;return t===1?"st":t===2?"nd":t===3?"rd":"th"};class Day extends o{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate();let r=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+pos(t):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:t}}t.exports=Day},1428:(t,r,i)=>{"use strict";const o=i(9611);class Hours extends o{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();if(/h/.test(this.token))t=t%12||12;return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Hours},5876:(t,r,i)=>{"use strict";t.exports={DatePart:i(9611),Meridiem:i(3437),Day:i(6205),Hours:i(1428),Milliseconds:i(7908),Minutes:i(1745),Month:i(8043),Seconds:i(8331),Year:i(2197)}},3437:(t,r,i)=>{"use strict";const o=i(9611);class Meridiem extends o{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}t.exports=Meridiem},7908:(t,r,i)=>{"use strict";const o=i(9611);class Milliseconds extends o{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}t.exports=Milliseconds},1745:(t,r,i)=>{"use strict";const o=i(9611);class Minutes extends o{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Minutes},8043:(t,r,i)=>{"use strict";const o=i(9611);class Month extends o{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth();let r=this.token.length;return r===2?String(t+1).padStart(2,"0"):r===3?this.locales.monthsShort[t]:r===4?this.locales.months[t]:String(t+1)}}t.exports=Month},8331:(t,r,i)=>{"use strict";const o=i(9611);class Seconds extends o{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Seconds},2197:(t,r,i)=>{"use strict";const o=i(9611);class Year extends o{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}t.exports=Year},4485:(t,r,i)=>{"use strict";const o=i(1081);const a=i(432);const{erase:l,cursor:u}=i(5624);const{style:c,clear:d,figures:h,wrap:p,entriesToDisplay:m}=i(1202);const getVal=(t,r)=>t[r]&&(t[r].value||t[r].title||t[r]);const getTitle=(t,r)=>t[r]&&(t[r].title||t[r].value||t[r]);const getIndex=(t,r)=>{const i=t.findIndex((t=>t.value===r||t.title===r));return i>-1?i:undefined};class AutocompletePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.suggest=t.suggest;this.choices=t.choices;this.initial=typeof t.initial==="number"?t.initial:getIndex(t.choices,t.initial);this.select=this.initial||t.cursor||0;this.i18n={noMatches:t.noMatches||"no matches found"};this.fallback=t.fallback||this.initial;this.clearFirst=t.clearFirst||false;this.suggestions=[];this.input="";this.limit=t.limit||10;this.cursor=0;this.transform=c.render(t.style);this.scale=this.transform.scale;this.render=this.render.bind(this);this.complete=this.complete.bind(this);this.clear=d("",this.out.columns);this.complete(this.render);this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;if(typeof this._fb==="number")t=this.choices[this._fb];else if(typeof this._fb==="string")t={title:this._fb};return t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t;if(this.suggestions.length>0)this.value=getVal(this.suggestions,t);else this.value=this.fallback.value;this.fire()}async complete(t){const r=this.completing=this.suggest(this.input,this.choices);const i=await r;if(this.completing!==r)return;this.suggestions=i.map(((t,r,i)=>({title:getTitle(i,r),value:getVal(i,r),description:t.description})));this.completing=false;const o=Math.max(i.length-1,0);this.moveSelect(Math.min(o,this.select));t&&t()}reset(){this.input="";this.complete((()=>{this.moveSelect(this.initial!==void 0?this.initial:0);this.render()}));this.render()}exit(){if(this.clearFirst&&this.input.length>0){this.reset()}else{this.done=this.exited=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}}abort(){this.done=this.aborted=true;this.exited=false;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=this.exited=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,r){let i=this.input.slice(0,this.cursor);let o=this.input.slice(this.cursor);this.input=`${i}${t}${o}`;this.cursor=i.length+1;this.complete(this.render);this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1);let r=this.input.slice(this.cursor);this.input=`${t}${r}`;this.complete(this.render);this.cursor=this.cursor-1;this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor);let r=this.input.slice(this.cursor+1);this.input=`${t}${r}`;this.complete(this.render);this.render()}first(){this.moveSelect(0);this.render()}last(){this.moveSelect(this.suggestions.length-1);this.render()}up(){if(this.select===0){this.moveSelect(this.suggestions.length-1)}else{this.moveSelect(this.select-1)}this.render()}down(){if(this.select===this.suggestions.length-1){this.moveSelect(0)}else{this.moveSelect(this.select+1)}this.render()}next(){if(this.select===this.suggestions.length-1){this.moveSelect(0)}else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1));this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0));this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1;this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1;this.render()}renderOption(t,r,i,a){let l;let u=i?h.arrowUp:a?h.arrowDown:" ";let c=r?o.cyan().underline(t.title):t.title;u=(r?o.cyan(h.pointer)+" ":" ")+u;if(t.description){l=` - ${t.description}`;if(u.length+c.length+l.length>=this.out.columns||t.description.split(/\r?\n/).length>1){l="\n"+p(t.description,{margin:3,width:this.out.columns})}}return u+" "+c+o.gray(l||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(u.hide);else this.out.write(d(this.outputText,this.out.columns));super.render();let{startIndex:t,endIndex:r}=m(this.select,this.choices.length,this.limit);this.outputText=[c.symbol(this.done,this.aborted,this.exited),o.bold(this.msg),c.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" ");if(!this.done){const i=this.suggestions.slice(t,r).map(((i,o)=>this.renderOption(i,this.select===o+t,o===0&&t>0,o+t===r-1&&r<this.choices.length))).join("\n");this.outputText+=`\n`+(i||o.gray(this.fallback.title))}this.out.write(l.line+u.to(0)+this.outputText)}}t.exports=AutocompletePrompt},6061:(t,r,i)=>{"use strict";const o=i(1081);const{cursor:a}=i(5624);const l=i(244);const{clear:u,style:c,figures:d}=i(1202);class AutocompleteMultiselectPrompt extends l{constructor(t={}){t.overrideRender=true;super(t);this.inputValue="";this.clear=u("",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(){if(this.cursor===0){this.cursor=this.filteredOptions.length-1}else{this.cursor--}this.render()}down(){if(this.cursor===this.filteredOptions.length-1){this.cursor=0}else{this.cursor++}this.render()}left(){this.filteredOptions[this.cursor].selected=false;this.render()}right(){if(this.value.filter((t=>t.selected)).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true;this.render()}delete(){if(this.inputValue.length){this.inputValue=this.inputValue.substr(0,this.inputValue.length-1);this.updateFilteredOptions()}}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((t=>{if(this.inputValue){if(typeof t.title==="string"){if(t.title.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}if(typeof t.value==="string"){if(t.value.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}return false}return true}));const r=this.filteredOptions.findIndex((r=>r===t));this.cursor=r<0?0:r;this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter((t=>t.selected)).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t;this.updateFilteredOptions()}_(t,r){if(t===" "){this.handleSpaceToggle()}else{this.handleInputChange(t)}}renderInstructions(){if(this.instructions===undefined||this.instructions){if(typeof this.instructions==="string"){return this.instructions}return`\nInstructions:\n ${d.arrowUp}/${d.arrowDown}: Highlight option\n ${d.arrowLeft}/${d.arrowRight}/[space]: Toggle selection\n [a,b,c]/delete: Filter choices\n enter/return: Complete answer\n`}return""}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:o.gray("Enter something to filter")}\n`}renderOption(t,r,i){let a;if(r.disabled)a=t===i?o.gray().underline(r.title):o.strikethrough().gray(r.title);else a=t===i?o.cyan().underline(r.title):r.title;return(r.selected?o.green(d.radioOn):d.radioOff)+" "+a}renderDoneOrInstructions(){if(this.done){return this.value.filter((t=>t.selected)).map((t=>t.title)).join(", ")}const t=[o.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled){t.push(o.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(a.hide);super.render();let t=[c.symbol(this.done,this.aborted),o.bold(this.msg),c.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=o.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.filteredOptions);this.out.write(this.clear+t);this.clear=u(t,this.out.columns)}}t.exports=AutocompleteMultiselectPrompt},3223:(t,r,i)=>{const o=i(1081);const a=i(432);const{style:l,clear:u}=i(1202);const{erase:c,cursor:d}=i(5624);class ConfirmPrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.value=t.initial;this.initialValue=!!t.initial;this.yesMsg=t.yes||"yes";this.yesOption=t.yesOption||"(Y/n)";this.noMsg=t.no||"no";this.noOption=t.noOption||"(y/N)";this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.value=this.value||false;this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,r){if(t.toLowerCase()==="y"){this.value=true;return this.submit()}if(t.toLowerCase()==="n"){this.value=false;return this.submit()}return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(d.hide);else this.out.write(u(this.outputText,this.out.columns));super.render();this.outputText=[l.symbol(this.done,this.aborted),o.bold(this.msg),l.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:o.gray(this.initialValue?this.yesOption:this.noOption)].join(" ");this.out.write(c.line+d.to(0)+this.outputText)}}t.exports=ConfirmPrompt},4233:(t,r,i)=>{"use strict";const o=i(1081);const a=i(432);const{style:l,clear:u,figures:c}=i(1202);const{erase:d,cursor:h}=i(5624);const{DatePart:p,Meridiem:m,Day:g,Hours:b,Milliseconds:y,Minutes:S,Month:w,Seconds:v,Year:R}=i(5876);const _=/\\(.)|"((?:\\["\\]|[^"])+)"|(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;const C={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new g(t),3:t=>new w(t),4:t=>new R(t),5:t=>new m(t),6:t=>new b(t),7:t=>new S(t),8:t=>new v(t),9:t=>new y(t)};const T={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(",")};class DatePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.cursor=0;this.typed="";this.locales=Object.assign(T,t.locales);this._date=t.initial||new Date;this.errorMsg=t.error||"Please Enter A Valid Value";this.validator=t.validate||(()=>true);this.mask=t.mask||"YYYY-MM-DD HH:mm:ss";this.clear=u("",this.out.columns);this.render()}get value(){return this.date}get date(){return this._date}set date(t){if(t)this._date.setTime(t.getTime())}set mask(t){let r;this.parts=[];while(r=_.exec(t)){let t=r.shift();let i=r.findIndex((t=>t!=null));this.parts.push(i in C?C[i]({token:r[i]||t,date:this.date,parts:this.parts,locales:this.locales}):r[i]||t)}let i=this.parts.reduce(((t,r)=>{if(typeof r==="string"&&typeof t[t.length-1]==="string")t[t.length-1]+=r;else t.push(r);return t}),[]);this.parts.splice(0);this.parts.push(...i);this.reset()}moveCursor(t){this.typed="";this.cursor=t;this.fire()}reset(){this.moveCursor(this.parts.findIndex((t=>t instanceof p)));this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write("\n");this.close()}async validate(){let t=await this.validator(this.value);if(typeof t==="string"){this.errorMsg=t;t=false}this.error=!t}async submit(){await this.validate();if(this.error){this.color="red";this.fire();this.render();return}this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}up(){this.typed="";this.parts[this.cursor].up();this.render()}down(){this.typed="";this.parts[this.cursor].down();this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex((t=>t instanceof p)));this.render()}_(t){if(/\d/.test(t)){this.typed+=t;this.parts[this.cursor].setTo(this.typed);this.render()}}render(){if(this.closed)return;if(this.firstRender)this.out.write(h.hide);else this.out.write(u(this.outputText,this.out.columns));super.render();this.outputText=[l.symbol(this.done,this.aborted),o.bold(this.msg),l.delimiter(false),this.parts.reduce(((t,r,i)=>t.concat(i===this.cursor&&!this.done?o.cyan().underline(r.toString()):r)),[]).join("")].join(" ");if(this.error){this.outputText+=this.errorMsg.split("\n").reduce(((t,r,i)=>t+`\n${i?` `:c.pointerSmall} ${o.red().italic(r)}`),``)}this.out.write(d.line+h.to(0)+this.outputText)}}t.exports=DatePrompt},3022:(t,r,i)=>{"use strict";t.exports={TextPrompt:i(321),SelectPrompt:i(5238),TogglePrompt:i(5362),DatePrompt:i(4233),NumberPrompt:i(9146),MultiselectPrompt:i(244),AutocompletePrompt:i(4485),AutocompleteMultiselectPrompt:i(6061),ConfirmPrompt:i(3223)}},244:(t,r,i)=>{"use strict";const o=i(1081);const{cursor:a}=i(5624);const l=i(432);const{clear:u,figures:c,style:d,wrap:h,entriesToDisplay:p}=i(1202);class MultiselectPrompt extends l{constructor(t={}){super(t);this.msg=t.message;this.cursor=t.cursor||0;this.scrollIndex=t.cursor||0;this.hint=t.hint||"";this.warn=t.warn||"- This option is disabled -";this.minSelected=t.min;this.showMinError=false;this.maxChoices=t.max;this.instructions=t.instructions;this.optionsPerPage=t.optionsPerPage||10;this.value=t.choices.map(((t,r)=>{if(typeof t==="string")t={title:t,value:r};return{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===undefined?r:t.value),selected:t&&t.selected,disabled:t&&t.disabled}}));this.clear=u("",this.out.columns);if(!t.overrideRender){this.render()}}reset(){this.value.map((t=>!t.selected));this.cursor=0;this.fire();this.render()}selected(){return this.value.filter((t=>t.selected))}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){const t=this.value.filter((t=>t.selected));if(this.minSelected&&t.length<this.minSelected){this.showMinError=true;this.render()}else{this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");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(){if(this.cursor===0){this.cursor=this.value.length-1}else{this.cursor--}this.render()}down(){if(this.cursor===this.value.length-1){this.cursor=0}else{this.cursor++}this.render()}left(){this.value[this.cursor].selected=false;this.render()}right(){if(this.value.filter((t=>t.selected)).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true;this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter((t=>t.selected)).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}toggleAll(){if(this.maxChoices!==undefined||this.value[this.cursor].disabled){return this.bell()}const t=!this.value[this.cursor].selected;this.value.filter((t=>!t.disabled)).forEach((r=>r.selected=t));this.render()}_(t,r){if(t===" "){this.handleSpaceToggle()}else if(t==="a"){this.toggleAll()}else{return this.bell()}}renderInstructions(){if(this.instructions===undefined||this.instructions){if(typeof this.instructions==="string"){return this.instructions}return"\nInstructions:\n"+` ${c.arrowUp}/${c.arrowDown}: Highlight option\n`+` ${c.arrowLeft}/${c.arrowRight}/[space]: Toggle selection\n`+(this.maxChoices===undefined?` a: Toggle all\n`:"")+` enter/return: Complete answer`}return""}renderOption(t,r,i,a){const l=(r.selected?o.green(c.radioOn):c.radioOff)+" "+a+" ";let u,d;if(r.disabled){u=t===i?o.gray().underline(r.title):o.strikethrough().gray(r.title)}else{u=t===i?o.cyan().underline(r.title):r.title;if(t===i&&r.description){d=` - ${r.description}`;if(l.length+u.length+d.length>=this.out.columns||r.description.split(/\r?\n/).length>1){d="\n"+h(r.description,{margin:l.length,width:this.out.columns})}}}return l+u+o.gray(d||"")}paginateOptions(t){if(t.length===0){return o.red("No matches for this query.")}let{startIndex:r,endIndex:i}=p(this.cursor,t.length,this.optionsPerPage);let a,l=[];for(let o=r;o<i;o++){if(o===r&&r>0){a=c.arrowUp}else if(o===i-1&&i<t.length){a=c.arrowDown}else{a=" "}l.push(this.renderOption(this.cursor,t[o],o,a))}return"\n"+l.join("\n")}renderOptions(t){if(!this.done){return this.paginateOptions(t)}return""}renderDoneOrInstructions(){if(this.done){return this.value.filter((t=>t.selected)).map((t=>t.title)).join(", ")}const t=[o.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled){t.push(o.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(a.hide);super.render();let t=[d.symbol(this.done,this.aborted),o.bold(this.msg),d.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=o.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.value);this.out.write(this.clear+t);this.clear=u(t,this.out.columns)}}t.exports=MultiselectPrompt},9146:(t,r,i)=>{const o=i(1081);const a=i(432);const{cursor:l,erase:u}=i(5624);const{style:c,figures:d,clear:h,lines:p}=i(1202);const m=/[0-9]/;const isDef=t=>t!==undefined;const round=(t,r)=>{let i=Math.pow(10,r);return Math.round(t*i)/i};class NumberPrompt extends a{constructor(t={}){super(t);this.transform=c.render(t.style);this.msg=t.message;this.initial=isDef(t.initial)?t.initial:"";this.float=!!t.float;this.round=t.round||2;this.inc=t.increment||1;this.min=isDef(t.min)?t.min:-Infinity;this.max=isDef(t.max)?t.max:Infinity;this.errorMsg=t.error||`Please Enter A Valid Value`;this.validator=t.validate||(()=>true);this.color=`cyan`;this.value=``;this.typed=``;this.lastHit=0;this.render()}set value(t){if(!t&&t!==0){this.placeholder=true;this.rendered=o.gray(this.transform.render(`${this.initial}`));this._value=``}else{this.placeholder=false;this.rendered=this.transform.render(`${round(t,this.round)}`);this._value=round(t,this.round)}this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t===`-`||t===`.`&&this.float||m.test(t)}reset(){this.typed=``;this.value=``;this.fire();this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==``?t:this.initial;this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}async validate(){let t=await this.validator(this.value);if(typeof t===`string`){this.errorMsg=t;t=false}this.error=!t}async submit(){await this.validate();if(this.error){this.color=`red`;this.fire();this.render();return}let t=this.value;this.value=t!==``?t:this.initial;this.done=true;this.aborted=false;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}up(){this.typed=``;if(this.value===""){this.value=this.min-this.inc}if(this.value>=this.max)return this.bell();this.value+=this.inc;this.color=`cyan`;this.fire();this.render()}down(){this.typed=``;if(this.value===""){this.value=this.min+this.inc}if(this.value<=this.min)return this.bell();this.value-=this.inc;this.color=`cyan`;this.fire();this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||``;if(this.value!==""&&this.value<this.min){this.value=this.min}this.color=`cyan`;this.fire();this.render()}next(){this.value=this.initial;this.fire();this.render()}_(t,r){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3)this.typed=``;this.typed+=t;this.lastHit=i;this.color=`cyan`;if(t===`.`)return this.fire();this.value=Math.min(this.parse(this.typed),this.max);if(this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire();this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(l.down(p(this.outputError,this.out.columns)-1)+h(this.outputError,this.out.columns));this.out.write(h(this.outputText,this.out.columns))}super.render();this.outputError="";this.outputText=[c.symbol(this.done,this.aborted),o.bold(this.msg),c.delimiter(this.done),!this.done||!this.done&&!this.placeholder?o[this.color]().underline(this.rendered):this.rendered].join(` `);if(this.error){this.outputError+=this.errorMsg.split(`\n`).reduce(((t,r,i)=>t+`\n${i?` `:d.pointerSmall} ${o.red().italic(r)}`),``)}this.out.write(u.line+l.to(0)+this.outputText+l.save+this.outputError+l.restore)}}t.exports=NumberPrompt},432:(t,r,i)=>{"use strict";const o=i(4521);const{action:a}=i(1202);const l=i(2361);const{beep:u,cursor:c}=i(5624);const d=i(1081);class Prompt extends l{constructor(t={}){super();this.firstRender=true;this.in=t.stdin||process.stdin;this.out=t.stdout||process.stdout;this.onRender=(t.onRender||(()=>void 0)).bind(this);const r=o.createInterface({input:this.in,escapeCodeTimeout:50});o.emitKeypressEvents(this.in,r);if(this.in.isTTY)this.in.setRawMode(true);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1;const keypress=(t,r)=>{let o=a(r,i);if(o===false){this._&&this._(t,r)}else if(typeof this[o]==="function"){this[o](r)}else{this.bell()}};this.close=()=>{this.out.write(c.show);this.in.removeListener("keypress",keypress);if(this.in.isTTY)this.in.setRawMode(false);r.close();this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value);this.closed=true};this.in.on("keypress",keypress)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(u)}render(){this.onRender(d);if(this.firstRender)this.firstRender=false}}t.exports=Prompt},5238:(t,r,i)=>{"use strict";const o=i(1081);const a=i(432);const{style:l,clear:u,figures:c,wrap:d,entriesToDisplay:h}=i(1202);const{cursor:p}=i(5624);class SelectPrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.hint=t.hint||"- Use arrow-keys. Return to submit.";this.warn=t.warn||"- This option is disabled";this.cursor=t.initial||0;this.choices=t.choices.map(((t,r)=>{if(typeof t==="string")t={title:t,value:r};return{title:t&&(t.title||t.value||t),value:t&&(t.value===undefined?r:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled}}));this.optionsPerPage=t.optionsPerPage||10;this.value=(this.choices[this.cursor]||{}).value;this.clear=u("",this.out.columns);this.render()}moveCursor(t){this.cursor=t;this.value=this.choices[t].value;this.fire()}reset(){this.moveCursor(0);this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){if(!this.selection.disabled){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}else this.bell()}first(){this.moveCursor(0);this.render()}last(){this.moveCursor(this.choices.length-1);this.render()}up(){if(this.cursor===0){this.moveCursor(this.choices.length-1)}else{this.moveCursor(this.cursor-1)}this.render()}down(){if(this.cursor===this.choices.length-1){this.moveCursor(0)}else{this.moveCursor(this.cursor+1)}this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length);this.render()}_(t,r){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(p.hide);else this.out.write(u(this.outputText,this.out.columns));super.render();let{startIndex:t,endIndex:r}=h(this.cursor,this.choices.length,this.optionsPerPage);this.outputText=[l.symbol(this.done,this.aborted),o.bold(this.msg),l.delimiter(false),this.done?this.selection.title:this.selection.disabled?o.yellow(this.warn):o.gray(this.hint)].join(" ");if(!this.done){this.outputText+="\n";for(let i=t;i<r;i++){let a,l,u="",h=this.choices[i];if(i===t&&t>0){l=c.arrowUp}else if(i===r-1&&r<this.choices.length){l=c.arrowDown}else{l=" "}if(h.disabled){a=this.cursor===i?o.gray().underline(h.title):o.strikethrough().gray(h.title);l=(this.cursor===i?o.bold().gray(c.pointer)+" ":" ")+l}else{a=this.cursor===i?o.cyan().underline(h.title):h.title;l=(this.cursor===i?o.cyan(c.pointer)+" ":" ")+l;if(h.description&&this.cursor===i){u=` - ${h.description}`;if(l.length+a.length+u.length>=this.out.columns||h.description.split(/\r?\n/).length>1){u="\n"+d(h.description,{margin:3,width:this.out.columns})}}}this.outputText+=`${l} ${a}${o.gray(u)}\n`}}this.out.write(this.outputText)}}t.exports=SelectPrompt},321:(t,r,i)=>{const o=i(1081);const a=i(432);const{erase:l,cursor:u}=i(5624);const{style:c,clear:d,lines:h,figures:p}=i(1202);class TextPrompt extends a{constructor(t={}){super(t);this.transform=c.render(t.style);this.scale=this.transform.scale;this.msg=t.message;this.initial=t.initial||``;this.validator=t.validate||(()=>true);this.value=``;this.errorMsg=t.error||`Please Enter A Valid Value`;this.cursor=Number(!!this.initial);this.cursorOffset=0;this.clear=d(``,this.out.columns);this.render()}set value(t){if(!t&&this.initial){this.placeholder=true;this.rendered=o.gray(this.transform.render(this.initial))}else{this.placeholder=false;this.rendered=this.transform.render(t)}this._value=t;this.fire()}get value(){return this._value}reset(){this.value=``;this.cursor=Number(!!this.initial);this.cursorOffset=0;this.fire();this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial;this.done=this.aborted=true;this.error=false;this.red=false;this.fire();this.render();this.out.write("\n");this.close()}async validate(){let t=await this.validator(this.value);if(typeof t===`string`){this.errorMsg=t;t=false}this.error=!t}async submit(){this.value=this.value||this.initial;this.cursorOffset=0;this.cursor=this.rendered.length;await this.validate();if(this.error){this.red=true;this.fire();this.render();return}this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial;this.cursor=this.rendered.length;this.fire();this.render()}moveCursor(t){if(this.placeholder)return;this.cursor=this.cursor+t;this.cursorOffset+=t}_(t,r){let i=this.value.slice(0,this.cursor);let o=this.value.slice(this.cursor);this.value=`${i}${t}${o}`;this.red=false;this.cursor=this.placeholder?0:i.length+1;this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1);let r=this.value.slice(this.cursor);this.value=`${t}${r}`;this.red=false;if(this.isCursorAtStart()){this.cursorOffset=0}else{this.cursorOffset++;this.moveCursor(-1)}this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor);let r=this.value.slice(this.cursor+1);this.value=`${t}${r}`;this.red=false;if(this.isCursorAtEnd()){this.cursorOffset=0}else{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(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(u.down(h(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=[c.symbol(this.done,this.aborted),o.bold(this.msg),c.delimiter(this.done),this.red?o.red(this.rendered):this.rendered].join(` `);if(this.error){this.outputError+=this.errorMsg.split(`\n`).reduce(((t,r,i)=>t+`\n${i?" ":p.pointerSmall} ${o.red().italic(r)}`),``)}this.out.write(l.line+u.to(0)+this.outputText+u.save+this.outputError+u.restore+u.move(this.cursorOffset,0))}}t.exports=TextPrompt},5362:(t,r,i)=>{const o=i(1081);const a=i(432);const{style:l,clear:u}=i(1202);const{cursor:c,erase:d}=i(5624);class TogglePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.value=!!t.initial;this.active=t.active||"on";this.inactive=t.inactive||"off";this.initialValue=this.value;this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}deactivate(){if(this.value===false)return this.bell();this.value=false;this.render()}activate(){if(this.value===true)return this.bell();this.value=true;this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value;this.fire();this.render()}_(t,r){if(t===" "){this.value=!this.value}else if(t==="1"){this.value=true}else if(t==="0"){this.value=false}else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(c.hide);else this.out.write(u(this.outputText,this.out.columns));super.render();this.outputText=[l.symbol(this.done,this.aborted),o.bold(this.msg),l.delimiter(this.done),this.value?this.inactive:o.cyan().underline(this.inactive),o.gray("/"),this.value?o.cyan().underline(this.active):this.active].join(" ");this.out.write(d.line+c.to(0)+this.outputText)}}t.exports=TogglePrompt},8837:(t,r,i)=>{"use strict";const o=i(3017);const a=["suggest","format","onState","validate","onRender","type"];const noop=()=>{};async function prompt(t=[],{onSubmit:r=noop,onCancel:i=noop}={}){const l={};const u=prompt._override||{};t=[].concat(t);let c,d,h,p,m,g;const getFormattedAnswer=async(t,r,i=false)=>{if(!i&&t.validate&&t.validate(r)!==true){return}return t.format?await t.format(r,l):r};for(d of t){({name:p,type:m}=d);if(typeof m==="function"){m=await m(c,{...l},d);d["type"]=m}if(!m)continue;for(let t in d){if(a.includes(t))continue;let r=d[t];d[t]=typeof r==="function"?await r(c,{...l},g):r}g=d;if(typeof d.message!=="string"){throw new Error("prompt message is required")}({name:p,type:m}=d);if(o[m]===void 0){throw new Error(`prompt type (${m}) is not defined`)}if(u[d.name]!==undefined){c=await getFormattedAnswer(d,u[d.name]);if(c!==undefined){l[p]=c;continue}}try{c=prompt._injected?getInjectedAnswer(prompt._injected,d.initial):await o[m](d);l[p]=c=await getFormattedAnswer(d,c,true);h=await r(d,c,l)}catch(t){h=!await i(d,l)}if(h)return l}return l}function getInjectedAnswer(t,r){const i=t.shift();if(i instanceof Error){throw i}return i===undefined?r:i}function inject(t){prompt._injected=(prompt._injected||[]).concat(t)}function override(t){prompt._override=Object.assign({},t)}t.exports=Object.assign(prompt,{prompt:prompt,prompts:o,inject:inject,override:override})},3017:(t,r,i)=>{"use strict";const o=r;const a=i(3022);const noop=t=>t;function toPrompt(t,r,i={}){return new Promise(((o,l)=>{const u=new a[t](r);const c=i.onAbort||noop;const d=i.onSubmit||noop;const h=i.onExit||noop;u.on("state",r.onState||noop);u.on("submit",(t=>o(d(t))));u.on("exit",(t=>o(h(t))));u.on("abort",(t=>l(c(t))))}))}o.text=t=>toPrompt("TextPrompt",t);o.password=t=>{t.style="password";return o.text(t)};o.invisible=t=>{t.style="invisible";return o.text(t)};o.number=t=>toPrompt("NumberPrompt",t);o.date=t=>toPrompt("DatePrompt",t);o.confirm=t=>toPrompt("ConfirmPrompt",t);o.list=t=>{const r=t.separator||",";return toPrompt("TextPrompt",t,{onSubmit:t=>t.split(r).map((t=>t.trim()))})};o.toggle=t=>toPrompt("TogglePrompt",t);o.select=t=>toPrompt("SelectPrompt",t);o.multiselect=t=>{t.choices=[].concat(t.choices||[]);const toSelected=t=>t.filter((t=>t.selected)).map((t=>t.value));return toPrompt("MultiselectPrompt",t,{onAbort:toSelected,onSubmit:toSelected})};o.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);const toSelected=t=>t.filter((t=>t.selected)).map((t=>t.value));return toPrompt("AutocompleteMultiselectPrompt",t,{onAbort:toSelected,onSubmit:toSelected})};const byTitle=(t,r)=>Promise.resolve(r.filter((r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase())));o.autocomplete=t=>{t.suggest=t.suggest||byTitle;t.choices=[].concat(t.choices||[]);return toPrompt("AutocompletePrompt",t)}},1393:t=>{"use strict";t.exports=(t,r)=>{if(t.meta&&t.name!=="escape")return;if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c")return"abort";if(t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(r){if(t.name==="j")return"down";if(t.name==="k")return"up"}if(t.name==="return")return"submit";if(t.name==="enter")return"submit";if(t.name==="backspace")return"delete";if(t.name==="delete")return"deleteForward";if(t.name==="abort")return"abort";if(t.name==="escape")return"exit";if(t.name==="tab")return"next";if(t.name==="pagedown")return"nextPage";if(t.name==="pageup")return"prevPage";if(t.name==="home")return"home";if(t.name==="end")return"end";if(t.name==="up")return"up";if(t.name==="down")return"down";if(t.name==="right")return"right";if(t.name==="left")return"left";return false}},9837:(t,r,i)=>{"use strict";const o=i(8029);const{erase:a,cursor:l}=i(5624);const width=t=>[...o(t)].length;t.exports=function(t,r){if(!r)return a.line+l.to(0);let i=0;const o=t.split(/\r?\n/);for(let t of o){i+=1+Math.floor(Math.max(width(t)-1,0)/r)}return a.lines(i)}},3123:t=>{"use strict";t.exports=(t,r,i)=>{i=i||r;let o=Math.min(r-i,t-Math.floor(i/2));if(o<0)o=0;let a=Math.min(o+i,r);return{startIndex:o,endIndex:a}}},6098:t=>{"use strict";const r={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"};const i={arrowUp:r.arrowUp,arrowDown:r.arrowDown,arrowLeft:r.arrowLeft,arrowRight:r.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"};const o=process.platform==="win32"?i:r;t.exports=o},1202:(t,r,i)=>{"use strict";t.exports={action:i(1393),clear:i(9837),style:i(4677),strip:i(8029),figures:i(6098),lines:i(957),wrap:i(342),entriesToDisplay:i(3123)}},957:(t,r,i)=>{"use strict";const o=i(8029);t.exports=function(t,r){let i=String(o(t)||"").split(/\r?\n/);if(!r)return i.length;return i.map((t=>Math.ceil(t.length/r))).reduce(((t,r)=>t+r))}},8029:t=>{"use strict";t.exports=t=>{const r=["[\\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("|");const i=new RegExp(r,"g");return typeof t==="string"?t.replace(i,""):t}},4677:(t,r,i)=>{"use strict";const o=i(1081);const a=i(6098);const l=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"😃".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}});const render=t=>l[t]||l.default;const u=Object.freeze({aborted:o.red(a.cross),done:o.green(a.tick),exited:o.yellow(a.cross),default:o.cyan("?")});const symbol=(t,r,i)=>r?u.aborted:i?u.exited:t?u.done:u.default;const delimiter=t=>o.gray(t?a.ellipsis:a.pointerSmall);const item=(t,r)=>o.gray(t?r?a.pointerSmall:"+":a.line);t.exports={styles:l,render:render,symbols:u,symbol:symbol,delimiter:delimiter,item:item}},342:t=>{"use strict";t.exports=(t,r={})=>{const i=Number.isSafeInteger(parseInt(r.margin))?new Array(parseInt(r.margin)).fill(" ").join(""):r.margin||"";const o=r.width;return(t||"").split(/\r?\n/g).map((t=>t.split(/\s+/g).reduce(((t,r)=>{if(r.length+i.length>=o||t[t.length-1].length+r.length+1<o)t[t.length-1]+=` ${r}`;else t.push(`${i}${r}`);return t}),[i]).join("\n"))).join("\n")}},5624:t=>{"use strict";const r="";const i=`${r}[`;const o="";const a={to(t,r){if(!r)return`${i}${t+1}G`;return`${i}${r+1};${t+1}H`},move(t,r){let o="";if(t<0)o+=`${i}${-t}D`;else if(t>0)o+=`${i}${t}C`;if(r<0)o+=`${i}${-r}A`;else if(r>0)o+=`${i}${r}B`;return o},up:(t=1)=>`${i}${t}A`,down:(t=1)=>`${i}${t}B`,forward:(t=1)=>`${i}${t}C`,backward:(t=1)=>`${i}${t}D`,nextLine:(t=1)=>`${i}E`.repeat(t),prevLine:(t=1)=>`${i}F`.repeat(t),left:`${i}G`,hide:`${i}?25l`,show:`${i}?25h`,save:`${r}7`,restore:`${r}8`};const l={up:(t=1)=>`${i}S`.repeat(t),down:(t=1)=>`${i}T`.repeat(t)};const u={screen:`${i}2J`,up:(t=1)=>`${i}1J`.repeat(t),down:(t=1)=>`${i}J`.repeat(t),line:`${i}2K`,lineEnd:`${i}K`,lineStart:`${i}1K`,lines(t){let r="";for(let i=0;i<t;i++)r+=this.line+(i<t-1?a.up():"");if(t)r+=a.left;return r}};t.exports={cursor:a,scroll:l,erase:u,beep:o}},8018:(t,r,i)=>{"use strict";const o=i(2037);const a=i(2143);const l=process.env;let u;if(a("no-color")||a("no-colors")||a("color=false")){u=false}else if(a("color")||a("colors")||a("color=true")||a("color=always")){u=true}if("FORCE_COLOR"in l){u=l.FORCE_COLOR.length===0||parseInt(l.FORCE_COLOR,10)!==0}function translateLevel(t){if(t===0){return false}return{level:t,hasBasic:true,has256:t>=2,has16m:t>=3}}function supportsColor(t){if(u===false){return 0}if(a("color=16m")||a("color=full")||a("color=truecolor")){return 3}if(a("color=256")){return 2}if(t&&!t.isTTY&&u!==true){return 0}const r=u?1:0;if(process.platform==="win32"){const t=o.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586){return Number(t[2])>=14931?3:2}return 1}if("CI"in l){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((t=>t in l))||l.CI_NAME==="codeship"){return 1}return r}if("TEAMCITY_VERSION"in l){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(l.TEAMCITY_VERSION)?1:0}if(l.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in l){const t=parseInt((l.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(l.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(l.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(l.TERM)){return 1}if("COLORTERM"in l){return 1}if(l.TERM==="dumb"){return r}return r}function getSupportLevel(t){const r=supportsColor(t);return translateLevel(r)}t.exports={supportsColor:getSupportLevel,stdout:getSupportLevel(process.stdout),stderr:getSupportLevel(process.stderr)}},631:function(t,r){(function(t,i){true?i(r):0})(this,(function(t){"use strict";const r=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?Symbol:t=>`Symbol(${t})`;function noop(){return undefined}function getGlobals(){if(typeof self!=="undefined"){return self}else if(typeof window!=="undefined"){return window}else if(typeof global!=="undefined"){return global}return undefined}const i=getGlobals();function typeIsObject(t){return typeof t==="object"&&t!==null||typeof t==="function"}const o=noop;const a=Promise;const l=Promise.prototype.then;const u=Promise.resolve.bind(a);const c=Promise.reject.bind(a);function newPromise(t){return new a(t)}function promiseResolvedWith(t){return u(t)}function promiseRejectedWith(t){return c(t)}function PerformPromiseThen(t,r,i){return l.call(t,r,i)}function uponPromise(t,r,i){PerformPromiseThen(PerformPromiseThen(t,r,i),undefined,o)}function uponFulfillment(t,r){uponPromise(t,r)}function uponRejection(t,r){uponPromise(t,undefined,r)}function transformPromiseWith(t,r,i){return PerformPromiseThen(t,r,i)}function setPromiseIsHandledToTrue(t){PerformPromiseThen(t,undefined,o)}const d=(()=>{const t=i&&i.queueMicrotask;if(typeof t==="function"){return t}const r=promiseResolvedWith(undefined);return t=>PerformPromiseThen(r,t)})();function reflectCall(t,r,i){if(typeof t!=="function"){throw new TypeError("Argument is not a function")}return Function.prototype.apply.call(t,r,i)}function promiseCall(t,r,i){try{return promiseResolvedWith(reflectCall(t,r,i))}catch(t){return promiseRejectedWith(t)}}const h=16384;class SimpleQueue{constructor(){this._cursor=0;this._size=0;this._front={_elements:[],_next:undefined};this._back=this._front;this._cursor=0;this._size=0}get length(){return this._size}push(t){const r=this._back;let i=r;if(r._elements.length===h-1){i={_elements:[],_next:undefined}}r._elements.push(t);if(i!==r){this._back=i;r._next=i}++this._size}shift(){const t=this._front;let r=t;const i=this._cursor;let o=i+1;const a=t._elements;const l=a[i];if(o===h){r=t._next;o=0}--this._size;this._cursor=o;if(t!==r){this._front=r}a[i]=undefined;return l}forEach(t){let r=this._cursor;let i=this._front;let o=i._elements;while(r!==o.length||i._next!==undefined){if(r===o.length){i=i._next;o=i._elements;r=0;if(o.length===0){break}}t(o[r]);++r}}peek(){const t=this._front;const r=this._cursor;return t._elements[r]}}function ReadableStreamReaderGenericInitialize(t,r){t._ownerReadableStream=r;r._reader=t;if(r._state==="readable"){defaultReaderClosedPromiseInitialize(t)}else if(r._state==="closed"){defaultReaderClosedPromiseInitializeAsResolved(t)}else{defaultReaderClosedPromiseInitializeAsRejected(t,r._storedError)}}function ReadableStreamReaderGenericCancel(t,r){const i=t._ownerReadableStream;return ReadableStreamCancel(i,r)}function ReadableStreamReaderGenericRelease(t){if(t._ownerReadableStream._state==="readable"){defaultReaderClosedPromiseReject(t,new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`))}else{defaultReaderClosedPromiseResetToRejected(t,new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`))}t._ownerReadableStream._reader=undefined;t._ownerReadableStream=undefined}function readerLockException(t){return new TypeError("Cannot "+t+" a stream using a released reader")}function defaultReaderClosedPromiseInitialize(t){t._closedPromise=newPromise(((r,i)=>{t._closedPromise_resolve=r;t._closedPromise_reject=i}))}function defaultReaderClosedPromiseInitializeAsRejected(t,r){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseReject(t,r)}function defaultReaderClosedPromiseInitializeAsResolved(t){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseResolve(t)}function defaultReaderClosedPromiseReject(t,r){if(t._closedPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined}function defaultReaderClosedPromiseResetToRejected(t,r){defaultReaderClosedPromiseInitializeAsRejected(t,r)}function defaultReaderClosedPromiseResolve(t){if(t._closedPromise_resolve===undefined){return}t._closedPromise_resolve(undefined);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined}const p=r("[[AbortSteps]]");const m=r("[[ErrorSteps]]");const g=r("[[CancelSteps]]");const b=r("[[PullSteps]]");const y=Number.isFinite||function(t){return typeof t==="number"&&isFinite(t)};const S=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};function isDictionary(t){return typeof t==="object"||typeof t==="function"}function assertDictionary(t,r){if(t!==undefined&&!isDictionary(t)){throw new TypeError(`${r} is not an object.`)}}function assertFunction(t,r){if(typeof t!=="function"){throw new TypeError(`${r} is not a function.`)}}function isObject(t){return typeof t==="object"&&t!==null||typeof t==="function"}function assertObject(t,r){if(!isObject(t)){throw new TypeError(`${r} is not an object.`)}}function assertRequiredArgument(t,r,i){if(t===undefined){throw new TypeError(`Parameter ${r} is required in '${i}'.`)}}function assertRequiredField(t,r,i){if(t===undefined){throw new TypeError(`${r} is required in '${i}'.`)}}function convertUnrestrictedDouble(t){return Number(t)}function censorNegativeZero(t){return t===0?0:t}function integerPart(t){return censorNegativeZero(S(t))}function convertUnsignedLongLongWithEnforceRange(t,r){const i=0;const o=Number.MAX_SAFE_INTEGER;let a=Number(t);a=censorNegativeZero(a);if(!y(a)){throw new TypeError(`${r} is not a finite number`)}a=integerPart(a);if(a<i||a>o){throw new TypeError(`${r} is outside the accepted range of ${i} to ${o}, inclusive`)}if(!y(a)||a===0){return 0}return a}function assertReadableStream(t,r){if(!IsReadableStream(t)){throw new TypeError(`${r} is not a ReadableStream.`)}}function AcquireReadableStreamDefaultReader(t){return new ReadableStreamDefaultReader(t)}function ReadableStreamAddReadRequest(t,r){t._reader._readRequests.push(r)}function ReadableStreamFulfillReadRequest(t,r,i){const o=t._reader;const a=o._readRequests.shift();if(i){a._closeSteps()}else{a._chunkSteps(r)}}function ReadableStreamGetNumReadRequests(t){return t._reader._readRequests.length}function ReadableStreamHasDefaultReader(t){const r=t._reader;if(r===undefined){return false}if(!IsReadableStreamDefaultReader(r)){return false}return true}class ReadableStreamDefaultReader{constructor(t){assertRequiredArgument(t,1,"ReadableStreamDefaultReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive reading by another reader")}ReadableStreamReaderGenericInitialize(this,t);this._readRequests=new SimpleQueue}get closed(){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("closed"))}return this._closedPromise}cancel(t=undefined){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("cancel"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("cancel"))}return ReadableStreamReaderGenericCancel(this,t)}read(){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("read"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("read from"))}let t;let r;const i=newPromise(((i,o)=>{t=i;r=o}));const o={_chunkSteps:r=>t({value:r,done:false}),_closeSteps:()=>t({value:undefined,done:true}),_errorSteps:t=>r(t)};ReadableStreamDefaultReaderRead(this,o);return i}releaseLock(){if(!IsReadableStreamDefaultReader(this)){throw defaultReaderBrandCheckException("releaseLock")}if(this._ownerReadableStream===undefined){return}if(this._readRequests.length>0){throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled")}ReadableStreamReaderGenericRelease(this)}}Object.defineProperties(ReadableStreamDefaultReader.prototype,{cancel:{enumerable:true},read:{enumerable:true},releaseLock:{enumerable:true},closed:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamDefaultReader.prototype,r.toStringTag,{value:"ReadableStreamDefaultReader",configurable:true})}function IsReadableStreamDefaultReader(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readRequests")){return false}return t instanceof ReadableStreamDefaultReader}function ReadableStreamDefaultReaderRead(t,r){const i=t._ownerReadableStream;i._disturbed=true;if(i._state==="closed"){r._closeSteps()}else if(i._state==="errored"){r._errorSteps(i._storedError)}else{i._readableStreamController[b](r)}}function defaultReaderBrandCheckException(t){return new TypeError(`ReadableStreamDefaultReader.prototype.${t} can only be used on a ReadableStreamDefaultReader`)}const w=Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})).prototype);class ReadableStreamAsyncIteratorImpl{constructor(t,r){this._ongoingPromise=undefined;this._isFinished=false;this._reader=t;this._preventCancel=r}next(){const nextSteps=()=>this._nextSteps();this._ongoingPromise=this._ongoingPromise?transformPromiseWith(this._ongoingPromise,nextSteps,nextSteps):nextSteps();return this._ongoingPromise}return(t){const returnSteps=()=>this._returnSteps(t);return this._ongoingPromise?transformPromiseWith(this._ongoingPromise,returnSteps,returnSteps):returnSteps()}_nextSteps(){if(this._isFinished){return Promise.resolve({value:undefined,done:true})}const t=this._reader;if(t._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("iterate"))}let r;let i;const o=newPromise(((t,o)=>{r=t;i=o}));const a={_chunkSteps:t=>{this._ongoingPromise=undefined;d((()=>r({value:t,done:false})))},_closeSteps:()=>{this._ongoingPromise=undefined;this._isFinished=true;ReadableStreamReaderGenericRelease(t);r({value:undefined,done:true})},_errorSteps:r=>{this._ongoingPromise=undefined;this._isFinished=true;ReadableStreamReaderGenericRelease(t);i(r)}};ReadableStreamDefaultReaderRead(t,a);return o}_returnSteps(t){if(this._isFinished){return Promise.resolve({value:t,done:true})}this._isFinished=true;const r=this._reader;if(r._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("finish iterating"))}if(!this._preventCancel){const i=ReadableStreamReaderGenericCancel(r,t);ReadableStreamReaderGenericRelease(r);return transformPromiseWith(i,(()=>({value:t,done:true})))}ReadableStreamReaderGenericRelease(r);return promiseResolvedWith({value:t,done:true})}}const v={next(){if(!IsReadableStreamAsyncIterator(this)){return promiseRejectedWith(streamAsyncIteratorBrandCheckException("next"))}return this._asyncIteratorImpl.next()},return(t){if(!IsReadableStreamAsyncIterator(this)){return promiseRejectedWith(streamAsyncIteratorBrandCheckException("return"))}return this._asyncIteratorImpl.return(t)}};if(w!==undefined){Object.setPrototypeOf(v,w)}function AcquireReadableStreamAsyncIterator(t,r){const i=AcquireReadableStreamDefaultReader(t);const o=new ReadableStreamAsyncIteratorImpl(i,r);const a=Object.create(v);a._asyncIteratorImpl=o;return a}function IsReadableStreamAsyncIterator(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_asyncIteratorImpl")){return false}try{return t._asyncIteratorImpl instanceof ReadableStreamAsyncIteratorImpl}catch(t){return false}}function streamAsyncIteratorBrandCheckException(t){return new TypeError(`ReadableStreamAsyncIterator.${t} can only be used on a ReadableSteamAsyncIterator`)}const R=Number.isNaN||function(t){return t!==t};function CreateArrayFromList(t){return t.slice()}function CopyDataBlockBytes(t,r,i,o,a){new Uint8Array(t).set(new Uint8Array(i,o,a),r)}function TransferArrayBuffer(t){return t}function IsDetachedBuffer(t){return false}function ArrayBufferSlice(t,r,i){if(t.slice){return t.slice(r,i)}const o=i-r;const a=new ArrayBuffer(o);CopyDataBlockBytes(a,0,t,r,o);return a}function IsNonNegativeNumber(t){if(typeof t!=="number"){return false}if(R(t)){return false}if(t<0){return false}return true}function CloneAsUint8Array(t){const r=ArrayBufferSlice(t.buffer,t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(r)}function DequeueValue(t){const r=t._queue.shift();t._queueTotalSize-=r.size;if(t._queueTotalSize<0){t._queueTotalSize=0}return r.value}function EnqueueValueWithSize(t,r,i){if(!IsNonNegativeNumber(i)||i===Infinity){throw new RangeError("Size must be a finite, non-NaN, non-negative number.")}t._queue.push({value:r,size:i});t._queueTotalSize+=i}function PeekQueueValue(t){const r=t._queue.peek();return r.value}function ResetQueue(t){t._queue=new SimpleQueue;t._queueTotalSize=0}class ReadableStreamBYOBRequest{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("view")}return this._view}respond(t){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("respond")}assertRequiredArgument(t,1,"respond");t=convertUnsignedLongLongWithEnforceRange(t,"First parameter");if(this._associatedReadableByteStreamController===undefined){throw new TypeError("This BYOB request has been invalidated")}if(IsDetachedBuffer(this._view.buffer));ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("respondWithNewView")}assertRequiredArgument(t,1,"respondWithNewView");if(!ArrayBuffer.isView(t)){throw new TypeError("You can only respond with array buffer views")}if(this._associatedReadableByteStreamController===undefined){throw new TypeError("This BYOB request has been invalidated")}if(IsDetachedBuffer(t.buffer));ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController,t)}}Object.defineProperties(ReadableStreamBYOBRequest.prototype,{respond:{enumerable:true},respondWithNewView:{enumerable:true},view:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamBYOBRequest.prototype,r.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:true})}class ReadableByteStreamController{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("byobRequest")}return ReadableByteStreamControllerGetBYOBRequest(this)}get desiredSize(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("desiredSize")}return ReadableByteStreamControllerGetDesiredSize(this)}close(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("close")}if(this._closeRequested){throw new TypeError("The stream has already been closed; do not close it again!")}const t=this._controlledReadableByteStream._state;if(t!=="readable"){throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`)}ReadableByteStreamControllerClose(this)}enqueue(t){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("enqueue")}assertRequiredArgument(t,1,"enqueue");if(!ArrayBuffer.isView(t)){throw new TypeError("chunk must be an array buffer view")}if(t.byteLength===0){throw new TypeError("chunk must have non-zero byteLength")}if(t.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")}const r=this._controlledReadableByteStream._state;if(r!=="readable"){throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`)}ReadableByteStreamControllerEnqueue(this,t)}error(t=undefined){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("error")}ReadableByteStreamControllerError(this,t)}[g](t){ReadableByteStreamControllerClearPendingPullIntos(this);ResetQueue(this);const r=this._cancelAlgorithm(t);ReadableByteStreamControllerClearAlgorithms(this);return r}[b](t){const r=this._controlledReadableByteStream;if(this._queueTotalSize>0){const r=this._queue.shift();this._queueTotalSize-=r.byteLength;ReadableByteStreamControllerHandleQueueDrain(this);const i=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(i);return}const i=this._autoAllocateChunkSize;if(i!==undefined){let r;try{r=new ArrayBuffer(i)}catch(r){t._errorSteps(r);return}const o={buffer:r,bufferByteLength:i,byteOffset:0,byteLength:i,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}ReadableStreamAddReadRequest(r,t);ReadableByteStreamControllerCallPullIfNeeded(this)}}Object.defineProperties(ReadableByteStreamController.prototype,{close:{enumerable:true},enqueue:{enumerable:true},error:{enumerable:true},byobRequest:{enumerable:true},desiredSize:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableByteStreamController.prototype,r.toStringTag,{value:"ReadableByteStreamController",configurable:true})}function IsReadableByteStreamController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledReadableByteStream")){return false}return t instanceof ReadableByteStreamController}function IsReadableStreamBYOBRequest(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_associatedReadableByteStreamController")){return false}return t instanceof ReadableStreamBYOBRequest}function ReadableByteStreamControllerCallPullIfNeeded(t){const r=ReadableByteStreamControllerShouldCallPull(t);if(!r){return}if(t._pulling){t._pullAgain=true;return}t._pulling=true;const i=t._pullAlgorithm();uponPromise(i,(()=>{t._pulling=false;if(t._pullAgain){t._pullAgain=false;ReadableByteStreamControllerCallPullIfNeeded(t)}}),(r=>{ReadableByteStreamControllerError(t,r)}))}function ReadableByteStreamControllerClearPendingPullIntos(t){ReadableByteStreamControllerInvalidateBYOBRequest(t);t._pendingPullIntos=new SimpleQueue}function ReadableByteStreamControllerCommitPullIntoDescriptor(t,r){let i=false;if(t._state==="closed"){i=true}const o=ReadableByteStreamControllerConvertPullIntoDescriptor(r);if(r.readerType==="default"){ReadableStreamFulfillReadRequest(t,o,i)}else{ReadableStreamFulfillReadIntoRequest(t,o,i)}}function ReadableByteStreamControllerConvertPullIntoDescriptor(t){const r=t.bytesFilled;const i=t.elementSize;return new t.viewConstructor(t.buffer,t.byteOffset,r/i)}function ReadableByteStreamControllerEnqueueChunkToQueue(t,r,i,o){t._queue.push({buffer:r,byteOffset:i,byteLength:o});t._queueTotalSize+=o}function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r){const i=r.elementSize;const o=r.bytesFilled-r.bytesFilled%i;const a=Math.min(t._queueTotalSize,r.byteLength-r.bytesFilled);const l=r.bytesFilled+a;const u=l-l%i;let c=a;let d=false;if(u>o){c=u-r.bytesFilled;d=true}const h=t._queue;while(c>0){const i=h.peek();const o=Math.min(c,i.byteLength);const a=r.byteOffset+r.bytesFilled;CopyDataBlockBytes(r.buffer,a,i.buffer,i.byteOffset,o);if(i.byteLength===o){h.shift()}else{i.byteOffset+=o;i.byteLength-=o}t._queueTotalSize-=o;ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,o,r);c-=o}return d}function ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,r,i){i.bytesFilled+=r}function ReadableByteStreamControllerHandleQueueDrain(t){if(t._queueTotalSize===0&&t._closeRequested){ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(t._controlledReadableByteStream)}else{ReadableByteStreamControllerCallPullIfNeeded(t)}}function ReadableByteStreamControllerInvalidateBYOBRequest(t){if(t._byobRequest===null){return}t._byobRequest._associatedReadableByteStreamController=undefined;t._byobRequest._view=null;t._byobRequest=null}function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t){while(t._pendingPullIntos.length>0){if(t._queueTotalSize===0){return}const r=t._pendingPullIntos.peek();if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r)){ReadableByteStreamControllerShiftPendingPullInto(t);ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,r)}}}function ReadableByteStreamControllerPullInto(t,r,i){const o=t._controlledReadableByteStream;let a=1;if(r.constructor!==DataView){a=r.constructor.BYTES_PER_ELEMENT}const l=r.constructor;const u=TransferArrayBuffer(r.buffer);const c={buffer:u,bufferByteLength:u.byteLength,byteOffset:r.byteOffset,byteLength:r.byteLength,bytesFilled:0,elementSize:a,viewConstructor:l,readerType:"byob"};if(t._pendingPullIntos.length>0){t._pendingPullIntos.push(c);ReadableStreamAddReadIntoRequest(o,i);return}if(o._state==="closed"){const t=new l(c.buffer,c.byteOffset,0);i._closeSteps(t);return}if(t._queueTotalSize>0){if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,c)){const r=ReadableByteStreamControllerConvertPullIntoDescriptor(c);ReadableByteStreamControllerHandleQueueDrain(t);i._chunkSteps(r);return}if(t._closeRequested){const r=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,r);i._errorSteps(r);return}}t._pendingPullIntos.push(c);ReadableStreamAddReadIntoRequest(o,i);ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerRespondInClosedState(t,r){const i=t._controlledReadableByteStream;if(ReadableStreamHasBYOBReader(i)){while(ReadableStreamGetNumReadIntoRequests(i)>0){const r=ReadableByteStreamControllerShiftPendingPullInto(t);ReadableByteStreamControllerCommitPullIntoDescriptor(i,r)}}}function ReadableByteStreamControllerRespondInReadableState(t,r,i){ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,r,i);if(i.bytesFilled<i.elementSize){return}ReadableByteStreamControllerShiftPendingPullInto(t);const o=i.bytesFilled%i.elementSize;if(o>0){const r=i.byteOffset+i.bytesFilled;const a=ArrayBufferSlice(i.buffer,r-o,r);ReadableByteStreamControllerEnqueueChunkToQueue(t,a,0,a.byteLength)}i.bytesFilled-=o;ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,i);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}function ReadableByteStreamControllerRespondInternal(t,r){const i=t._pendingPullIntos.peek();ReadableByteStreamControllerInvalidateBYOBRequest(t);const o=t._controlledReadableByteStream._state;if(o==="closed"){ReadableByteStreamControllerRespondInClosedState(t)}else{ReadableByteStreamControllerRespondInReadableState(t,r,i)}ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerShiftPendingPullInto(t){const r=t._pendingPullIntos.shift();return r}function ReadableByteStreamControllerShouldCallPull(t){const r=t._controlledReadableByteStream;if(r._state!=="readable"){return false}if(t._closeRequested){return false}if(!t._started){return false}if(ReadableStreamHasDefaultReader(r)&&ReadableStreamGetNumReadRequests(r)>0){return true}if(ReadableStreamHasBYOBReader(r)&&ReadableStreamGetNumReadIntoRequests(r)>0){return true}const i=ReadableByteStreamControllerGetDesiredSize(t);if(i>0){return true}return false}function ReadableByteStreamControllerClearAlgorithms(t){t._pullAlgorithm=undefined;t._cancelAlgorithm=undefined}function ReadableByteStreamControllerClose(t){const r=t._controlledReadableByteStream;if(t._closeRequested||r._state!=="readable"){return}if(t._queueTotalSize>0){t._closeRequested=true;return}if(t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();if(r.bytesFilled>0){const r=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,r);throw r}}ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(r)}function ReadableByteStreamControllerEnqueue(t,r){const i=t._controlledReadableByteStream;if(t._closeRequested||i._state!=="readable"){return}const o=r.buffer;const a=r.byteOffset;const l=r.byteLength;const u=TransferArrayBuffer(o);if(t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();if(IsDetachedBuffer(r.buffer));r.buffer=TransferArrayBuffer(r.buffer)}ReadableByteStreamControllerInvalidateBYOBRequest(t);if(ReadableStreamHasDefaultReader(i)){if(ReadableStreamGetNumReadRequests(i)===0){ReadableByteStreamControllerEnqueueChunkToQueue(t,u,a,l)}else{if(t._pendingPullIntos.length>0){ReadableByteStreamControllerShiftPendingPullInto(t)}const r=new Uint8Array(u,a,l);ReadableStreamFulfillReadRequest(i,r,false)}}else if(ReadableStreamHasBYOBReader(i)){ReadableByteStreamControllerEnqueueChunkToQueue(t,u,a,l);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}else{ReadableByteStreamControllerEnqueueChunkToQueue(t,u,a,l)}ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerError(t,r){const i=t._controlledReadableByteStream;if(i._state!=="readable"){return}ReadableByteStreamControllerClearPendingPullIntos(t);ResetQueue(t);ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamError(i,r)}function ReadableByteStreamControllerGetBYOBRequest(t){if(t._byobRequest===null&&t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();const i=new Uint8Array(r.buffer,r.byteOffset+r.bytesFilled,r.byteLength-r.bytesFilled);const o=Object.create(ReadableStreamBYOBRequest.prototype);SetUpReadableStreamBYOBRequest(o,t,i);t._byobRequest=o}return t._byobRequest}function ReadableByteStreamControllerGetDesiredSize(t){const r=t._controlledReadableByteStream._state;if(r==="errored"){return null}if(r==="closed"){return 0}return t._strategyHWM-t._queueTotalSize}function ReadableByteStreamControllerRespond(t,r){const i=t._pendingPullIntos.peek();const o=t._controlledReadableByteStream._state;if(o==="closed"){if(r!==0){throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}}else{if(r===0){throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream")}if(i.bytesFilled+r>i.byteLength){throw new RangeError("bytesWritten out of range")}}i.buffer=TransferArrayBuffer(i.buffer);ReadableByteStreamControllerRespondInternal(t,r)}function ReadableByteStreamControllerRespondWithNewView(t,r){const i=t._pendingPullIntos.peek();const o=t._controlledReadableByteStream._state;if(o==="closed"){if(r.byteLength!==0){throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}}else{if(r.byteLength===0){throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream")}}if(i.byteOffset+i.bytesFilled!==r.byteOffset){throw new RangeError("The region specified by view does not match byobRequest")}if(i.bufferByteLength!==r.buffer.byteLength){throw new RangeError("The buffer of view has different capacity than byobRequest")}if(i.bytesFilled+r.byteLength>i.byteLength){throw new RangeError("The region specified by view is larger than byobRequest")}const a=r.byteLength;i.buffer=TransferArrayBuffer(r.buffer);ReadableByteStreamControllerRespondInternal(t,a)}function SetUpReadableByteStreamController(t,r,i,o,a,l,u){r._controlledReadableByteStream=t;r._pullAgain=false;r._pulling=false;r._byobRequest=null;r._queue=r._queueTotalSize=undefined;ResetQueue(r);r._closeRequested=false;r._started=false;r._strategyHWM=l;r._pullAlgorithm=o;r._cancelAlgorithm=a;r._autoAllocateChunkSize=u;r._pendingPullIntos=new SimpleQueue;t._readableStreamController=r;const c=i();uponPromise(promiseResolvedWith(c),(()=>{r._started=true;ReadableByteStreamControllerCallPullIfNeeded(r)}),(t=>{ReadableByteStreamControllerError(r,t)}))}function SetUpReadableByteStreamControllerFromUnderlyingSource(t,r,i){const o=Object.create(ReadableByteStreamController.prototype);let startAlgorithm=()=>undefined;let pullAlgorithm=()=>promiseResolvedWith(undefined);let cancelAlgorithm=()=>promiseResolvedWith(undefined);if(r.start!==undefined){startAlgorithm=()=>r.start(o)}if(r.pull!==undefined){pullAlgorithm=()=>r.pull(o)}if(r.cancel!==undefined){cancelAlgorithm=t=>r.cancel(t)}const a=r.autoAllocateChunkSize;if(a===0){throw new TypeError("autoAllocateChunkSize must be greater than 0")}SetUpReadableByteStreamController(t,o,startAlgorithm,pullAlgorithm,cancelAlgorithm,i,a)}function SetUpReadableStreamBYOBRequest(t,r,i){t._associatedReadableByteStreamController=r;t._view=i}function byobRequestBrandCheckException(t){return new TypeError(`ReadableStreamBYOBRequest.prototype.${t} can only be used on a ReadableStreamBYOBRequest`)}function byteStreamControllerBrandCheckException(t){return new TypeError(`ReadableByteStreamController.prototype.${t} can only be used on a ReadableByteStreamController`)}function AcquireReadableStreamBYOBReader(t){return new ReadableStreamBYOBReader(t)}function ReadableStreamAddReadIntoRequest(t,r){t._reader._readIntoRequests.push(r)}function ReadableStreamFulfillReadIntoRequest(t,r,i){const o=t._reader;const a=o._readIntoRequests.shift();if(i){a._closeSteps(r)}else{a._chunkSteps(r)}}function ReadableStreamGetNumReadIntoRequests(t){return t._reader._readIntoRequests.length}function ReadableStreamHasBYOBReader(t){const r=t._reader;if(r===undefined){return false}if(!IsReadableStreamBYOBReader(r)){return false}return true}class ReadableStreamBYOBReader{constructor(t){assertRequiredArgument(t,1,"ReadableStreamBYOBReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive reading by another reader")}if(!IsReadableByteStreamController(t._readableStreamController)){throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte "+"source")}ReadableStreamReaderGenericInitialize(this,t);this._readIntoRequests=new SimpleQueue}get closed(){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("closed"))}return this._closedPromise}cancel(t=undefined){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("cancel"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("cancel"))}return ReadableStreamReaderGenericCancel(this,t)}read(t){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("read"))}if(!ArrayBuffer.isView(t)){return promiseRejectedWith(new TypeError("view must be an array buffer view"))}if(t.byteLength===0){return promiseRejectedWith(new TypeError("view must have non-zero byteLength"))}if(t.buffer.byteLength===0){return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`))}if(IsDetachedBuffer(t.buffer));if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("read from"))}let r;let i;const o=newPromise(((t,o)=>{r=t;i=o}));const a={_chunkSteps:t=>r({value:t,done:false}),_closeSteps:t=>r({value:t,done:true}),_errorSteps:t=>i(t)};ReadableStreamBYOBReaderRead(this,t,a);return o}releaseLock(){if(!IsReadableStreamBYOBReader(this)){throw byobReaderBrandCheckException("releaseLock")}if(this._ownerReadableStream===undefined){return}if(this._readIntoRequests.length>0){throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled")}ReadableStreamReaderGenericRelease(this)}}Object.defineProperties(ReadableStreamBYOBReader.prototype,{cancel:{enumerable:true},read:{enumerable:true},releaseLock:{enumerable:true},closed:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamBYOBReader.prototype,r.toStringTag,{value:"ReadableStreamBYOBReader",configurable:true})}function IsReadableStreamBYOBReader(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readIntoRequests")){return false}return t instanceof ReadableStreamBYOBReader}function ReadableStreamBYOBReaderRead(t,r,i){const o=t._ownerReadableStream;o._disturbed=true;if(o._state==="errored"){i._errorSteps(o._storedError)}else{ReadableByteStreamControllerPullInto(o._readableStreamController,r,i)}}function byobReaderBrandCheckException(t){return new TypeError(`ReadableStreamBYOBReader.prototype.${t} can only be used on a ReadableStreamBYOBReader`)}function ExtractHighWaterMark(t,r){const{highWaterMark:i}=t;if(i===undefined){return r}if(R(i)||i<0){throw new RangeError("Invalid highWaterMark")}return i}function ExtractSizeAlgorithm(t){const{size:r}=t;if(!r){return()=>1}return r}function convertQueuingStrategy(t,r){assertDictionary(t,r);const i=t===null||t===void 0?void 0:t.highWaterMark;const o=t===null||t===void 0?void 0:t.size;return{highWaterMark:i===undefined?undefined:convertUnrestrictedDouble(i),size:o===undefined?undefined:convertQueuingStrategySize(o,`${r} has member 'size' that`)}}function convertQueuingStrategySize(t,r){assertFunction(t,r);return r=>convertUnrestrictedDouble(t(r))}function convertUnderlyingSink(t,r){assertDictionary(t,r);const i=t===null||t===void 0?void 0:t.abort;const o=t===null||t===void 0?void 0:t.close;const a=t===null||t===void 0?void 0:t.start;const l=t===null||t===void 0?void 0:t.type;const u=t===null||t===void 0?void 0:t.write;return{abort:i===undefined?undefined:convertUnderlyingSinkAbortCallback(i,t,`${r} has member 'abort' that`),close:o===undefined?undefined:convertUnderlyingSinkCloseCallback(o,t,`${r} has member 'close' that`),start:a===undefined?undefined:convertUnderlyingSinkStartCallback(a,t,`${r} has member 'start' that`),write:u===undefined?undefined:convertUnderlyingSinkWriteCallback(u,t,`${r} has member 'write' that`),type:l}}function convertUnderlyingSinkAbortCallback(t,r,i){assertFunction(t,i);return i=>promiseCall(t,r,[i])}function convertUnderlyingSinkCloseCallback(t,r,i){assertFunction(t,i);return()=>promiseCall(t,r,[])}function convertUnderlyingSinkStartCallback(t,r,i){assertFunction(t,i);return i=>reflectCall(t,r,[i])}function convertUnderlyingSinkWriteCallback(t,r,i){assertFunction(t,i);return(i,o)=>promiseCall(t,r,[i,o])}function assertWritableStream(t,r){if(!IsWritableStream(t)){throw new TypeError(`${r} is not a WritableStream.`)}}function isAbortSignal(t){if(typeof t!=="object"||t===null){return false}try{return typeof t.aborted==="boolean"}catch(t){return false}}const _=typeof AbortController==="function";function createAbortController(){if(_){return new AbortController}return undefined}class WritableStream{constructor(t={},r={}){if(t===undefined){t=null}else{assertObject(t,"First parameter")}const i=convertQueuingStrategy(r,"Second parameter");const o=convertUnderlyingSink(t,"First parameter");InitializeWritableStream(this);const a=o.type;if(a!==undefined){throw new RangeError("Invalid type is specified")}const l=ExtractSizeAlgorithm(i);const u=ExtractHighWaterMark(i,1);SetUpWritableStreamDefaultControllerFromUnderlyingSink(this,o,u,l)}get locked(){if(!IsWritableStream(this)){throw streamBrandCheckException$2("locked")}return IsWritableStreamLocked(this)}abort(t=undefined){if(!IsWritableStream(this)){return promiseRejectedWith(streamBrandCheckException$2("abort"))}if(IsWritableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot abort a stream that already has a writer"))}return WritableStreamAbort(this,t)}close(){if(!IsWritableStream(this)){return promiseRejectedWith(streamBrandCheckException$2("close"))}if(IsWritableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot close a stream that already has a writer"))}if(WritableStreamCloseQueuedOrInFlight(this)){return promiseRejectedWith(new TypeError("Cannot close an already-closing stream"))}return WritableStreamClose(this)}getWriter(){if(!IsWritableStream(this)){throw streamBrandCheckException$2("getWriter")}return AcquireWritableStreamDefaultWriter(this)}}Object.defineProperties(WritableStream.prototype,{abort:{enumerable:true},close:{enumerable:true},getWriter:{enumerable:true},locked:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStream.prototype,r.toStringTag,{value:"WritableStream",configurable:true})}function AcquireWritableStreamDefaultWriter(t){return new WritableStreamDefaultWriter(t)}function CreateWritableStream(t,r,i,o,a=1,l=(()=>1)){const u=Object.create(WritableStream.prototype);InitializeWritableStream(u);const c=Object.create(WritableStreamDefaultController.prototype);SetUpWritableStreamDefaultController(u,c,t,r,i,o,a,l);return u}function InitializeWritableStream(t){t._state="writable";t._storedError=undefined;t._writer=undefined;t._writableStreamController=undefined;t._writeRequests=new SimpleQueue;t._inFlightWriteRequest=undefined;t._closeRequest=undefined;t._inFlightCloseRequest=undefined;t._pendingAbortRequest=undefined;t._backpressure=false}function IsWritableStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_writableStreamController")){return false}return t instanceof WritableStream}function IsWritableStreamLocked(t){if(t._writer===undefined){return false}return true}function WritableStreamAbort(t,r){var i;if(t._state==="closed"||t._state==="errored"){return promiseResolvedWith(undefined)}t._writableStreamController._abortReason=r;(i=t._writableStreamController._abortController)===null||i===void 0?void 0:i.abort();const o=t._state;if(o==="closed"||o==="errored"){return promiseResolvedWith(undefined)}if(t._pendingAbortRequest!==undefined){return t._pendingAbortRequest._promise}let a=false;if(o==="erroring"){a=true;r=undefined}const l=newPromise(((i,o)=>{t._pendingAbortRequest={_promise:undefined,_resolve:i,_reject:o,_reason:r,_wasAlreadyErroring:a}}));t._pendingAbortRequest._promise=l;if(!a){WritableStreamStartErroring(t,r)}return l}function WritableStreamClose(t){const r=t._state;if(r==="closed"||r==="errored"){return promiseRejectedWith(new TypeError(`The stream (in ${r} state) is not in the writable state and cannot be closed`))}const i=newPromise(((r,i)=>{const o={_resolve:r,_reject:i};t._closeRequest=o}));const o=t._writer;if(o!==undefined&&t._backpressure&&r==="writable"){defaultWriterReadyPromiseResolve(o)}WritableStreamDefaultControllerClose(t._writableStreamController);return i}function WritableStreamAddWriteRequest(t){const r=newPromise(((r,i)=>{const o={_resolve:r,_reject:i};t._writeRequests.push(o)}));return r}function WritableStreamDealWithRejection(t,r){const i=t._state;if(i==="writable"){WritableStreamStartErroring(t,r);return}WritableStreamFinishErroring(t)}function WritableStreamStartErroring(t,r){const i=t._writableStreamController;t._state="erroring";t._storedError=r;const o=t._writer;if(o!==undefined){WritableStreamDefaultWriterEnsureReadyPromiseRejected(o,r)}if(!WritableStreamHasOperationMarkedInFlight(t)&&i._started){WritableStreamFinishErroring(t)}}function WritableStreamFinishErroring(t){t._state="errored";t._writableStreamController[m]();const r=t._storedError;t._writeRequests.forEach((t=>{t._reject(r)}));t._writeRequests=new SimpleQueue;if(t._pendingAbortRequest===undefined){WritableStreamRejectCloseAndClosedPromiseIfNeeded(t);return}const i=t._pendingAbortRequest;t._pendingAbortRequest=undefined;if(i._wasAlreadyErroring){i._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t);return}const o=t._writableStreamController[p](i._reason);uponPromise(o,(()=>{i._resolve();WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}),(r=>{i._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}))}function WritableStreamFinishInFlightWrite(t){t._inFlightWriteRequest._resolve(undefined);t._inFlightWriteRequest=undefined}function WritableStreamFinishInFlightWriteWithError(t,r){t._inFlightWriteRequest._reject(r);t._inFlightWriteRequest=undefined;WritableStreamDealWithRejection(t,r)}function WritableStreamFinishInFlightClose(t){t._inFlightCloseRequest._resolve(undefined);t._inFlightCloseRequest=undefined;const r=t._state;if(r==="erroring"){t._storedError=undefined;if(t._pendingAbortRequest!==undefined){t._pendingAbortRequest._resolve();t._pendingAbortRequest=undefined}}t._state="closed";const i=t._writer;if(i!==undefined){defaultWriterClosedPromiseResolve(i)}}function WritableStreamFinishInFlightCloseWithError(t,r){t._inFlightCloseRequest._reject(r);t._inFlightCloseRequest=undefined;if(t._pendingAbortRequest!==undefined){t._pendingAbortRequest._reject(r);t._pendingAbortRequest=undefined}WritableStreamDealWithRejection(t,r)}function WritableStreamCloseQueuedOrInFlight(t){if(t._closeRequest===undefined&&t._inFlightCloseRequest===undefined){return false}return true}function WritableStreamHasOperationMarkedInFlight(t){if(t._inFlightWriteRequest===undefined&&t._inFlightCloseRequest===undefined){return false}return true}function WritableStreamMarkCloseRequestInFlight(t){t._inFlightCloseRequest=t._closeRequest;t._closeRequest=undefined}function WritableStreamMarkFirstWriteRequestInFlight(t){t._inFlightWriteRequest=t._writeRequests.shift()}function WritableStreamRejectCloseAndClosedPromiseIfNeeded(t){if(t._closeRequest!==undefined){t._closeRequest._reject(t._storedError);t._closeRequest=undefined}const r=t._writer;if(r!==undefined){defaultWriterClosedPromiseReject(r,t._storedError)}}function WritableStreamUpdateBackpressure(t,r){const i=t._writer;if(i!==undefined&&r!==t._backpressure){if(r){defaultWriterReadyPromiseReset(i)}else{defaultWriterReadyPromiseResolve(i)}}t._backpressure=r}class WritableStreamDefaultWriter{constructor(t){assertRequiredArgument(t,1,"WritableStreamDefaultWriter");assertWritableStream(t,"First parameter");if(IsWritableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive writing by another writer")}this._ownerWritableStream=t;t._writer=this;const r=t._state;if(r==="writable"){if(!WritableStreamCloseQueuedOrInFlight(t)&&t._backpressure){defaultWriterReadyPromiseInitialize(this)}else{defaultWriterReadyPromiseInitializeAsResolved(this)}defaultWriterClosedPromiseInitialize(this)}else if(r==="erroring"){defaultWriterReadyPromiseInitializeAsRejected(this,t._storedError);defaultWriterClosedPromiseInitialize(this)}else if(r==="closed"){defaultWriterReadyPromiseInitializeAsResolved(this);defaultWriterClosedPromiseInitializeAsResolved(this)}else{const r=t._storedError;defaultWriterReadyPromiseInitializeAsRejected(this,r);defaultWriterClosedPromiseInitializeAsRejected(this,r)}}get closed(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("closed"))}return this._closedPromise}get desiredSize(){if(!IsWritableStreamDefaultWriter(this)){throw defaultWriterBrandCheckException("desiredSize")}if(this._ownerWritableStream===undefined){throw defaultWriterLockException("desiredSize")}return WritableStreamDefaultWriterGetDesiredSize(this)}get ready(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("ready"))}return this._readyPromise}abort(t=undefined){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("abort"))}if(this._ownerWritableStream===undefined){return promiseRejectedWith(defaultWriterLockException("abort"))}return WritableStreamDefaultWriterAbort(this,t)}close(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("close"))}const t=this._ownerWritableStream;if(t===undefined){return promiseRejectedWith(defaultWriterLockException("close"))}if(WritableStreamCloseQueuedOrInFlight(t)){return promiseRejectedWith(new TypeError("Cannot close an already-closing stream"))}return WritableStreamDefaultWriterClose(this)}releaseLock(){if(!IsWritableStreamDefaultWriter(this)){throw defaultWriterBrandCheckException("releaseLock")}const t=this._ownerWritableStream;if(t===undefined){return}WritableStreamDefaultWriterRelease(this)}write(t=undefined){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("write"))}if(this._ownerWritableStream===undefined){return promiseRejectedWith(defaultWriterLockException("write to"))}return WritableStreamDefaultWriterWrite(this,t)}}Object.defineProperties(WritableStreamDefaultWriter.prototype,{abort:{enumerable:true},close:{enumerable:true},releaseLock:{enumerable:true},write:{enumerable:true},closed:{enumerable:true},desiredSize:{enumerable:true},ready:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStreamDefaultWriter.prototype,r.toStringTag,{value:"WritableStreamDefaultWriter",configurable:true})}function IsWritableStreamDefaultWriter(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_ownerWritableStream")){return false}return t instanceof WritableStreamDefaultWriter}function WritableStreamDefaultWriterAbort(t,r){const i=t._ownerWritableStream;return WritableStreamAbort(i,r)}function WritableStreamDefaultWriterClose(t){const r=t._ownerWritableStream;return WritableStreamClose(r)}function WritableStreamDefaultWriterCloseWithErrorPropagation(t){const r=t._ownerWritableStream;const i=r._state;if(WritableStreamCloseQueuedOrInFlight(r)||i==="closed"){return promiseResolvedWith(undefined)}if(i==="errored"){return promiseRejectedWith(r._storedError)}return WritableStreamDefaultWriterClose(t)}function WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,r){if(t._closedPromiseState==="pending"){defaultWriterClosedPromiseReject(t,r)}else{defaultWriterClosedPromiseResetToRejected(t,r)}}function WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,r){if(t._readyPromiseState==="pending"){defaultWriterReadyPromiseReject(t,r)}else{defaultWriterReadyPromiseResetToRejected(t,r)}}function WritableStreamDefaultWriterGetDesiredSize(t){const r=t._ownerWritableStream;const i=r._state;if(i==="errored"||i==="erroring"){return null}if(i==="closed"){return 0}return WritableStreamDefaultControllerGetDesiredSize(r._writableStreamController)}function WritableStreamDefaultWriterRelease(t){const r=t._ownerWritableStream;const i=new TypeError(`Writer was released and can no longer be used to monitor the stream's closedness`);WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,i);WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,i);r._writer=undefined;t._ownerWritableStream=undefined}function WritableStreamDefaultWriterWrite(t,r){const i=t._ownerWritableStream;const o=i._writableStreamController;const a=WritableStreamDefaultControllerGetChunkSize(o,r);if(i!==t._ownerWritableStream){return promiseRejectedWith(defaultWriterLockException("write to"))}const l=i._state;if(l==="errored"){return promiseRejectedWith(i._storedError)}if(WritableStreamCloseQueuedOrInFlight(i)||l==="closed"){return promiseRejectedWith(new TypeError("The stream is closing or closed and cannot be written to"))}if(l==="erroring"){return promiseRejectedWith(i._storedError)}const u=WritableStreamAddWriteRequest(i);WritableStreamDefaultControllerWrite(o,r,a);return u}const C={};class WritableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("abortReason")}return this._abortReason}get signal(){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("signal")}if(this._abortController===undefined){throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported")}return this._abortController.signal}error(t=undefined){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("error")}const r=this._controlledWritableStream._state;if(r!=="writable"){return}WritableStreamDefaultControllerError(this,t)}[p](t){const r=this._abortAlgorithm(t);WritableStreamDefaultControllerClearAlgorithms(this);return r}[m](){ResetQueue(this)}}Object.defineProperties(WritableStreamDefaultController.prototype,{abortReason:{enumerable:true},signal:{enumerable:true},error:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStreamDefaultController.prototype,r.toStringTag,{value:"WritableStreamDefaultController",configurable:true})}function IsWritableStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledWritableStream")){return false}return t instanceof WritableStreamDefaultController}function SetUpWritableStreamDefaultController(t,r,i,o,a,l,u,c){r._controlledWritableStream=t;t._writableStreamController=r;r._queue=undefined;r._queueTotalSize=undefined;ResetQueue(r);r._abortReason=undefined;r._abortController=createAbortController();r._started=false;r._strategySizeAlgorithm=c;r._strategyHWM=u;r._writeAlgorithm=o;r._closeAlgorithm=a;r._abortAlgorithm=l;const d=WritableStreamDefaultControllerGetBackpressure(r);WritableStreamUpdateBackpressure(t,d);const h=i();const p=promiseResolvedWith(h);uponPromise(p,(()=>{r._started=true;WritableStreamDefaultControllerAdvanceQueueIfNeeded(r)}),(i=>{r._started=true;WritableStreamDealWithRejection(t,i)}))}function SetUpWritableStreamDefaultControllerFromUnderlyingSink(t,r,i,o){const a=Object.create(WritableStreamDefaultController.prototype);let startAlgorithm=()=>undefined;let writeAlgorithm=()=>promiseResolvedWith(undefined);let closeAlgorithm=()=>promiseResolvedWith(undefined);let abortAlgorithm=()=>promiseResolvedWith(undefined);if(r.start!==undefined){startAlgorithm=()=>r.start(a)}if(r.write!==undefined){writeAlgorithm=t=>r.write(t,a)}if(r.close!==undefined){closeAlgorithm=()=>r.close()}if(r.abort!==undefined){abortAlgorithm=t=>r.abort(t)}SetUpWritableStreamDefaultController(t,a,startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,i,o)}function WritableStreamDefaultControllerClearAlgorithms(t){t._writeAlgorithm=undefined;t._closeAlgorithm=undefined;t._abortAlgorithm=undefined;t._strategySizeAlgorithm=undefined}function WritableStreamDefaultControllerClose(t){EnqueueValueWithSize(t,C,0);WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}function WritableStreamDefaultControllerGetChunkSize(t,r){try{return t._strategySizeAlgorithm(r)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return 1}}function WritableStreamDefaultControllerGetDesiredSize(t){return t._strategyHWM-t._queueTotalSize}function WritableStreamDefaultControllerWrite(t,r,i){try{EnqueueValueWithSize(t,r,i)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return}const o=t._controlledWritableStream;if(!WritableStreamCloseQueuedOrInFlight(o)&&o._state==="writable"){const r=WritableStreamDefaultControllerGetBackpressure(t);WritableStreamUpdateBackpressure(o,r)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}function WritableStreamDefaultControllerAdvanceQueueIfNeeded(t){const r=t._controlledWritableStream;if(!t._started){return}if(r._inFlightWriteRequest!==undefined){return}const i=r._state;if(i==="erroring"){WritableStreamFinishErroring(r);return}if(t._queue.length===0){return}const o=PeekQueueValue(t);if(o===C){WritableStreamDefaultControllerProcessClose(t)}else{WritableStreamDefaultControllerProcessWrite(t,o)}}function WritableStreamDefaultControllerErrorIfNeeded(t,r){if(t._controlledWritableStream._state==="writable"){WritableStreamDefaultControllerError(t,r)}}function WritableStreamDefaultControllerProcessClose(t){const r=t._controlledWritableStream;WritableStreamMarkCloseRequestInFlight(r);DequeueValue(t);const i=t._closeAlgorithm();WritableStreamDefaultControllerClearAlgorithms(t);uponPromise(i,(()=>{WritableStreamFinishInFlightClose(r)}),(t=>{WritableStreamFinishInFlightCloseWithError(r,t)}))}function WritableStreamDefaultControllerProcessWrite(t,r){const i=t._controlledWritableStream;WritableStreamMarkFirstWriteRequestInFlight(i);const o=t._writeAlgorithm(r);uponPromise(o,(()=>{WritableStreamFinishInFlightWrite(i);const r=i._state;DequeueValue(t);if(!WritableStreamCloseQueuedOrInFlight(i)&&r==="writable"){const r=WritableStreamDefaultControllerGetBackpressure(t);WritableStreamUpdateBackpressure(i,r)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}),(r=>{if(i._state==="writable"){WritableStreamDefaultControllerClearAlgorithms(t)}WritableStreamFinishInFlightWriteWithError(i,r)}))}function WritableStreamDefaultControllerGetBackpressure(t){const r=WritableStreamDefaultControllerGetDesiredSize(t);return r<=0}function WritableStreamDefaultControllerError(t,r){const i=t._controlledWritableStream;WritableStreamDefaultControllerClearAlgorithms(t);WritableStreamStartErroring(i,r)}function streamBrandCheckException$2(t){return new TypeError(`WritableStream.prototype.${t} can only be used on a WritableStream`)}function defaultControllerBrandCheckException$2(t){return new TypeError(`WritableStreamDefaultController.prototype.${t} can only be used on a WritableStreamDefaultController`)}function defaultWriterBrandCheckException(t){return new TypeError(`WritableStreamDefaultWriter.prototype.${t} can only be used on a WritableStreamDefaultWriter`)}function defaultWriterLockException(t){return new TypeError("Cannot "+t+" a stream using a released writer")}function defaultWriterClosedPromiseInitialize(t){t._closedPromise=newPromise(((r,i)=>{t._closedPromise_resolve=r;t._closedPromise_reject=i;t._closedPromiseState="pending"}))}function defaultWriterClosedPromiseInitializeAsRejected(t,r){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseReject(t,r)}function defaultWriterClosedPromiseInitializeAsResolved(t){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseResolve(t)}function defaultWriterClosedPromiseReject(t,r){if(t._closedPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined;t._closedPromiseState="rejected"}function defaultWriterClosedPromiseResetToRejected(t,r){defaultWriterClosedPromiseInitializeAsRejected(t,r)}function defaultWriterClosedPromiseResolve(t){if(t._closedPromise_resolve===undefined){return}t._closedPromise_resolve(undefined);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined;t._closedPromiseState="resolved"}function defaultWriterReadyPromiseInitialize(t){t._readyPromise=newPromise(((r,i)=>{t._readyPromise_resolve=r;t._readyPromise_reject=i}));t._readyPromiseState="pending"}function defaultWriterReadyPromiseInitializeAsRejected(t,r){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseReject(t,r)}function defaultWriterReadyPromiseInitializeAsResolved(t){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseResolve(t)}function defaultWriterReadyPromiseReject(t,r){if(t._readyPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._readyPromise);t._readyPromise_reject(r);t._readyPromise_resolve=undefined;t._readyPromise_reject=undefined;t._readyPromiseState="rejected"}function defaultWriterReadyPromiseReset(t){defaultWriterReadyPromiseInitialize(t)}function defaultWriterReadyPromiseResetToRejected(t,r){defaultWriterReadyPromiseInitializeAsRejected(t,r)}function defaultWriterReadyPromiseResolve(t){if(t._readyPromise_resolve===undefined){return}t._readyPromise_resolve(undefined);t._readyPromise_resolve=undefined;t._readyPromise_reject=undefined;t._readyPromiseState="fulfilled"}const T=typeof DOMException!=="undefined"?DOMException:undefined;function isDOMExceptionConstructor(t){if(!(typeof t==="function"||typeof t==="object")){return false}try{new t;return true}catch(t){return false}}function createDOMExceptionPolyfill(){const t=function DOMException(t,r){this.message=t||"";this.name=r||"Error";if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}};t.prototype=Object.create(Error.prototype);Object.defineProperty(t.prototype,"constructor",{value:t,writable:true,configurable:true});return t}const k=isDOMExceptionConstructor(T)?T:createDOMExceptionPolyfill();function ReadableStreamPipeTo(t,r,i,o,a,l){const u=AcquireReadableStreamDefaultReader(t);const c=AcquireWritableStreamDefaultWriter(r);t._disturbed=true;let d=false;let h=promiseResolvedWith(undefined);return newPromise(((p,m)=>{let g;if(l!==undefined){g=()=>{const i=new k("Aborted","AbortError");const l=[];if(!o){l.push((()=>{if(r._state==="writable"){return WritableStreamAbort(r,i)}return promiseResolvedWith(undefined)}))}if(!a){l.push((()=>{if(t._state==="readable"){return ReadableStreamCancel(t,i)}return promiseResolvedWith(undefined)}))}shutdownWithAction((()=>Promise.all(l.map((t=>t())))),true,i)};if(l.aborted){g();return}l.addEventListener("abort",g)}function pipeLoop(){return newPromise(((t,r)=>{function next(i){if(i){t()}else{PerformPromiseThen(pipeStep(),next,r)}}next(false)}))}function pipeStep(){if(d){return promiseResolvedWith(true)}return PerformPromiseThen(c._readyPromise,(()=>newPromise(((t,r)=>{ReadableStreamDefaultReaderRead(u,{_chunkSteps:r=>{h=PerformPromiseThen(WritableStreamDefaultWriterWrite(c,r),undefined,noop);t(false)},_closeSteps:()=>t(true),_errorSteps:r})}))))}isOrBecomesErrored(t,u._closedPromise,(t=>{if(!o){shutdownWithAction((()=>WritableStreamAbort(r,t)),true,t)}else{shutdown(true,t)}}));isOrBecomesErrored(r,c._closedPromise,(r=>{if(!a){shutdownWithAction((()=>ReadableStreamCancel(t,r)),true,r)}else{shutdown(true,r)}}));isOrBecomesClosed(t,u._closedPromise,(()=>{if(!i){shutdownWithAction((()=>WritableStreamDefaultWriterCloseWithErrorPropagation(c)))}else{shutdown()}}));if(WritableStreamCloseQueuedOrInFlight(r)||r._state==="closed"){const r=new TypeError("the destination writable stream closed before all data could be piped to it");if(!a){shutdownWithAction((()=>ReadableStreamCancel(t,r)),true,r)}else{shutdown(true,r)}}setPromiseIsHandledToTrue(pipeLoop());function waitForWritesToFinish(){const t=h;return PerformPromiseThen(h,(()=>t!==h?waitForWritesToFinish():undefined))}function isOrBecomesErrored(t,r,i){if(t._state==="errored"){i(t._storedError)}else{uponRejection(r,i)}}function isOrBecomesClosed(t,r,i){if(t._state==="closed"){i()}else{uponFulfillment(r,i)}}function shutdownWithAction(t,i,o){if(d){return}d=true;if(r._state==="writable"&&!WritableStreamCloseQueuedOrInFlight(r)){uponFulfillment(waitForWritesToFinish(),doTheRest)}else{doTheRest()}function doTheRest(){uponPromise(t(),(()=>finalize(i,o)),(t=>finalize(true,t)))}}function shutdown(t,i){if(d){return}d=true;if(r._state==="writable"&&!WritableStreamCloseQueuedOrInFlight(r)){uponFulfillment(waitForWritesToFinish(),(()=>finalize(t,i)))}else{finalize(t,i)}}function finalize(t,r){WritableStreamDefaultWriterRelease(c);ReadableStreamReaderGenericRelease(u);if(l!==undefined){l.removeEventListener("abort",g)}if(t){m(r)}else{p(undefined)}}}))}class ReadableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("desiredSize")}return ReadableStreamDefaultControllerGetDesiredSize(this)}close(){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("close")}if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)){throw new TypeError("The stream is not in a state that permits close")}ReadableStreamDefaultControllerClose(this)}enqueue(t=undefined){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("enqueue")}if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)){throw new TypeError("The stream is not in a state that permits enqueue")}return ReadableStreamDefaultControllerEnqueue(this,t)}error(t=undefined){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("error")}ReadableStreamDefaultControllerError(this,t)}[g](t){ResetQueue(this);const r=this._cancelAlgorithm(t);ReadableStreamDefaultControllerClearAlgorithms(this);return r}[b](t){const r=this._controlledReadableStream;if(this._queue.length>0){const i=DequeueValue(this);if(this._closeRequested&&this._queue.length===0){ReadableStreamDefaultControllerClearAlgorithms(this);ReadableStreamClose(r)}else{ReadableStreamDefaultControllerCallPullIfNeeded(this)}t._chunkSteps(i)}else{ReadableStreamAddReadRequest(r,t);ReadableStreamDefaultControllerCallPullIfNeeded(this)}}}Object.defineProperties(ReadableStreamDefaultController.prototype,{close:{enumerable:true},enqueue:{enumerable:true},error:{enumerable:true},desiredSize:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamDefaultController.prototype,r.toStringTag,{value:"ReadableStreamDefaultController",configurable:true})}function IsReadableStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledReadableStream")){return false}return t instanceof ReadableStreamDefaultController}function ReadableStreamDefaultControllerCallPullIfNeeded(t){const r=ReadableStreamDefaultControllerShouldCallPull(t);if(!r){return}if(t._pulling){t._pullAgain=true;return}t._pulling=true;const i=t._pullAlgorithm();uponPromise(i,(()=>{t._pulling=false;if(t._pullAgain){t._pullAgain=false;ReadableStreamDefaultControllerCallPullIfNeeded(t)}}),(r=>{ReadableStreamDefaultControllerError(t,r)}))}function ReadableStreamDefaultControllerShouldCallPull(t){const r=t._controlledReadableStream;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return false}if(!t._started){return false}if(IsReadableStreamLocked(r)&&ReadableStreamGetNumReadRequests(r)>0){return true}const i=ReadableStreamDefaultControllerGetDesiredSize(t);if(i>0){return true}return false}function ReadableStreamDefaultControllerClearAlgorithms(t){t._pullAlgorithm=undefined;t._cancelAlgorithm=undefined;t._strategySizeAlgorithm=undefined}function ReadableStreamDefaultControllerClose(t){if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return}const r=t._controlledReadableStream;t._closeRequested=true;if(t._queue.length===0){ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamClose(r)}}function ReadableStreamDefaultControllerEnqueue(t,r){if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return}const i=t._controlledReadableStream;if(IsReadableStreamLocked(i)&&ReadableStreamGetNumReadRequests(i)>0){ReadableStreamFulfillReadRequest(i,r,false)}else{let i;try{i=t._strategySizeAlgorithm(r)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}try{EnqueueValueWithSize(t,r,i)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}}ReadableStreamDefaultControllerCallPullIfNeeded(t)}function ReadableStreamDefaultControllerError(t,r){const i=t._controlledReadableStream;if(i._state!=="readable"){return}ResetQueue(t);ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamError(i,r)}function ReadableStreamDefaultControllerGetDesiredSize(t){const r=t._controlledReadableStream._state;if(r==="errored"){return null}if(r==="closed"){return 0}return t._strategyHWM-t._queueTotalSize}function ReadableStreamDefaultControllerHasBackpressure(t){if(ReadableStreamDefaultControllerShouldCallPull(t)){return false}return true}function ReadableStreamDefaultControllerCanCloseOrEnqueue(t){const r=t._controlledReadableStream._state;if(!t._closeRequested&&r==="readable"){return true}return false}function SetUpReadableStreamDefaultController(t,r,i,o,a,l,u){r._controlledReadableStream=t;r._queue=undefined;r._queueTotalSize=undefined;ResetQueue(r);r._started=false;r._closeRequested=false;r._pullAgain=false;r._pulling=false;r._strategySizeAlgorithm=u;r._strategyHWM=l;r._pullAlgorithm=o;r._cancelAlgorithm=a;t._readableStreamController=r;const c=i();uponPromise(promiseResolvedWith(c),(()=>{r._started=true;ReadableStreamDefaultControllerCallPullIfNeeded(r)}),(t=>{ReadableStreamDefaultControllerError(r,t)}))}function SetUpReadableStreamDefaultControllerFromUnderlyingSource(t,r,i,o){const a=Object.create(ReadableStreamDefaultController.prototype);let startAlgorithm=()=>undefined;let pullAlgorithm=()=>promiseResolvedWith(undefined);let cancelAlgorithm=()=>promiseResolvedWith(undefined);if(r.start!==undefined){startAlgorithm=()=>r.start(a)}if(r.pull!==undefined){pullAlgorithm=()=>r.pull(a)}if(r.cancel!==undefined){cancelAlgorithm=t=>r.cancel(t)}SetUpReadableStreamDefaultController(t,a,startAlgorithm,pullAlgorithm,cancelAlgorithm,i,o)}function defaultControllerBrandCheckException$1(t){return new TypeError(`ReadableStreamDefaultController.prototype.${t} can only be used on a ReadableStreamDefaultController`)}function ReadableStreamTee(t,r){if(IsReadableByteStreamController(t._readableStreamController)){return ReadableByteStreamTee(t)}return ReadableStreamDefaultTee(t)}function ReadableStreamDefaultTee(t,r){const i=AcquireReadableStreamDefaultReader(t);let o=false;let a=false;let l=false;let u=false;let c;let h;let p;let m;let g;const b=newPromise((t=>{g=t}));function pullAlgorithm(){if(o){a=true;return promiseResolvedWith(undefined)}o=true;const t={_chunkSteps:t=>{d((()=>{a=false;const r=t;const i=t;if(!l){ReadableStreamDefaultControllerEnqueue(p._readableStreamController,r)}if(!u){ReadableStreamDefaultControllerEnqueue(m._readableStreamController,i)}o=false;if(a){pullAlgorithm()}}))},_closeSteps:()=>{o=false;if(!l){ReadableStreamDefaultControllerClose(p._readableStreamController)}if(!u){ReadableStreamDefaultControllerClose(m._readableStreamController)}if(!l||!u){g(undefined)}},_errorSteps:()=>{o=false}};ReadableStreamDefaultReaderRead(i,t);return promiseResolvedWith(undefined)}function cancel1Algorithm(r){l=true;c=r;if(u){const r=CreateArrayFromList([c,h]);const i=ReadableStreamCancel(t,r);g(i)}return b}function cancel2Algorithm(r){u=true;h=r;if(l){const r=CreateArrayFromList([c,h]);const i=ReadableStreamCancel(t,r);g(i)}return b}function startAlgorithm(){}p=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel1Algorithm);m=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel2Algorithm);uponRejection(i._closedPromise,(t=>{ReadableStreamDefaultControllerError(p._readableStreamController,t);ReadableStreamDefaultControllerError(m._readableStreamController,t);if(!l||!u){g(undefined)}}));return[p,m]}function ReadableByteStreamTee(t){let r=AcquireReadableStreamDefaultReader(t);let i=false;let o=false;let a=false;let l=false;let u=false;let c;let h;let p;let m;let g;const b=newPromise((t=>{g=t}));function forwardReaderError(t){uponRejection(t._closedPromise,(i=>{if(t!==r){return}ReadableByteStreamControllerError(p._readableStreamController,i);ReadableByteStreamControllerError(m._readableStreamController,i);if(!l||!u){g(undefined)}}))}function pullWithDefaultReader(){if(IsReadableStreamBYOBReader(r)){ReadableStreamReaderGenericRelease(r);r=AcquireReadableStreamDefaultReader(t);forwardReaderError(r)}const c={_chunkSteps:r=>{d((()=>{o=false;a=false;const c=r;let d=r;if(!l&&!u){try{d=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(p._readableStreamController,r);ReadableByteStreamControllerError(m._readableStreamController,r);g(ReadableStreamCancel(t,r));return}}if(!l){ReadableByteStreamControllerEnqueue(p._readableStreamController,c)}if(!u){ReadableByteStreamControllerEnqueue(m._readableStreamController,d)}i=false;if(o){pull1Algorithm()}else if(a){pull2Algorithm()}}))},_closeSteps:()=>{i=false;if(!l){ReadableByteStreamControllerClose(p._readableStreamController)}if(!u){ReadableByteStreamControllerClose(m._readableStreamController)}if(p._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(p._readableStreamController,0)}if(m._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(m._readableStreamController,0)}if(!l||!u){g(undefined)}},_errorSteps:()=>{i=false}};ReadableStreamDefaultReaderRead(r,c)}function pullWithBYOBReader(c,h){if(IsReadableStreamDefaultReader(r)){ReadableStreamReaderGenericRelease(r);r=AcquireReadableStreamBYOBReader(t);forwardReaderError(r)}const b=h?m:p;const y=h?p:m;const S={_chunkSteps:r=>{d((()=>{o=false;a=false;const c=h?u:l;const d=h?l:u;if(!d){let i;try{i=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(b._readableStreamController,r);ReadableByteStreamControllerError(y._readableStreamController,r);g(ReadableStreamCancel(t,r));return}if(!c){ReadableByteStreamControllerRespondWithNewView(b._readableStreamController,r)}ReadableByteStreamControllerEnqueue(y._readableStreamController,i)}else if(!c){ReadableByteStreamControllerRespondWithNewView(b._readableStreamController,r)}i=false;if(o){pull1Algorithm()}else if(a){pull2Algorithm()}}))},_closeSteps:t=>{i=false;const r=h?u:l;const o=h?l:u;if(!r){ReadableByteStreamControllerClose(b._readableStreamController)}if(!o){ReadableByteStreamControllerClose(y._readableStreamController)}if(t!==undefined){if(!r){ReadableByteStreamControllerRespondWithNewView(b._readableStreamController,t)}if(!o&&y._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(y._readableStreamController,0)}}if(!r||!o){g(undefined)}},_errorSteps:()=>{i=false}};ReadableStreamBYOBReaderRead(r,c,S)}function pull1Algorithm(){if(i){o=true;return promiseResolvedWith(undefined)}i=true;const t=ReadableByteStreamControllerGetBYOBRequest(p._readableStreamController);if(t===null){pullWithDefaultReader()}else{pullWithBYOBReader(t._view,false)}return promiseResolvedWith(undefined)}function pull2Algorithm(){if(i){a=true;return promiseResolvedWith(undefined)}i=true;const t=ReadableByteStreamControllerGetBYOBRequest(m._readableStreamController);if(t===null){pullWithDefaultReader()}else{pullWithBYOBReader(t._view,true)}return promiseResolvedWith(undefined)}function cancel1Algorithm(r){l=true;c=r;if(u){const r=CreateArrayFromList([c,h]);const i=ReadableStreamCancel(t,r);g(i)}return b}function cancel2Algorithm(r){u=true;h=r;if(l){const r=CreateArrayFromList([c,h]);const i=ReadableStreamCancel(t,r);g(i)}return b}function startAlgorithm(){return}p=CreateReadableByteStream(startAlgorithm,pull1Algorithm,cancel1Algorithm);m=CreateReadableByteStream(startAlgorithm,pull2Algorithm,cancel2Algorithm);forwardReaderError(r);return[p,m]}function convertUnderlyingDefaultOrByteSource(t,r){assertDictionary(t,r);const i=t;const o=i===null||i===void 0?void 0:i.autoAllocateChunkSize;const a=i===null||i===void 0?void 0:i.cancel;const l=i===null||i===void 0?void 0:i.pull;const u=i===null||i===void 0?void 0:i.start;const c=i===null||i===void 0?void 0:i.type;return{autoAllocateChunkSize:o===undefined?undefined:convertUnsignedLongLongWithEnforceRange(o,`${r} has member 'autoAllocateChunkSize' that`),cancel:a===undefined?undefined:convertUnderlyingSourceCancelCallback(a,i,`${r} has member 'cancel' that`),pull:l===undefined?undefined:convertUnderlyingSourcePullCallback(l,i,`${r} has member 'pull' that`),start:u===undefined?undefined:convertUnderlyingSourceStartCallback(u,i,`${r} has member 'start' that`),type:c===undefined?undefined:convertReadableStreamType(c,`${r} has member 'type' that`)}}function convertUnderlyingSourceCancelCallback(t,r,i){assertFunction(t,i);return i=>promiseCall(t,r,[i])}function convertUnderlyingSourcePullCallback(t,r,i){assertFunction(t,i);return i=>promiseCall(t,r,[i])}function convertUnderlyingSourceStartCallback(t,r,i){assertFunction(t,i);return i=>reflectCall(t,r,[i])}function convertReadableStreamType(t,r){t=`${t}`;if(t!=="bytes"){throw new TypeError(`${r} '${t}' is not a valid enumeration value for ReadableStreamType`)}return t}function convertReaderOptions(t,r){assertDictionary(t,r);const i=t===null||t===void 0?void 0:t.mode;return{mode:i===undefined?undefined:convertReadableStreamReaderMode(i,`${r} has member 'mode' that`)}}function convertReadableStreamReaderMode(t,r){t=`${t}`;if(t!=="byob"){throw new TypeError(`${r} '${t}' is not a valid enumeration value for ReadableStreamReaderMode`)}return t}function convertIteratorOptions(t,r){assertDictionary(t,r);const i=t===null||t===void 0?void 0:t.preventCancel;return{preventCancel:Boolean(i)}}function convertPipeOptions(t,r){assertDictionary(t,r);const i=t===null||t===void 0?void 0:t.preventAbort;const o=t===null||t===void 0?void 0:t.preventCancel;const a=t===null||t===void 0?void 0:t.preventClose;const l=t===null||t===void 0?void 0:t.signal;if(l!==undefined){assertAbortSignal(l,`${r} has member 'signal' that`)}return{preventAbort:Boolean(i),preventCancel:Boolean(o),preventClose:Boolean(a),signal:l}}function assertAbortSignal(t,r){if(!isAbortSignal(t)){throw new TypeError(`${r} is not an AbortSignal.`)}}function convertReadableWritablePair(t,r){assertDictionary(t,r);const i=t===null||t===void 0?void 0:t.readable;assertRequiredField(i,"readable","ReadableWritablePair");assertReadableStream(i,`${r} has member 'readable' that`);const o=t===null||t===void 0?void 0:t.writable;assertRequiredField(o,"writable","ReadableWritablePair");assertWritableStream(o,`${r} has member 'writable' that`);return{readable:i,writable:o}}class ReadableStream{constructor(t={},r={}){if(t===undefined){t=null}else{assertObject(t,"First parameter")}const i=convertQueuingStrategy(r,"Second parameter");const o=convertUnderlyingDefaultOrByteSource(t,"First parameter");InitializeReadableStream(this);if(o.type==="bytes"){if(i.size!==undefined){throw new RangeError("The strategy for a byte stream cannot have a size function")}const t=ExtractHighWaterMark(i,0);SetUpReadableByteStreamControllerFromUnderlyingSource(this,o,t)}else{const t=ExtractSizeAlgorithm(i);const r=ExtractHighWaterMark(i,1);SetUpReadableStreamDefaultControllerFromUnderlyingSource(this,o,r,t)}}get locked(){if(!IsReadableStream(this)){throw streamBrandCheckException$1("locked")}return IsReadableStreamLocked(this)}cancel(t=undefined){if(!IsReadableStream(this)){return promiseRejectedWith(streamBrandCheckException$1("cancel"))}if(IsReadableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot cancel a stream that already has a reader"))}return ReadableStreamCancel(this,t)}getReader(t=undefined){if(!IsReadableStream(this)){throw streamBrandCheckException$1("getReader")}const r=convertReaderOptions(t,"First parameter");if(r.mode===undefined){return AcquireReadableStreamDefaultReader(this)}return AcquireReadableStreamBYOBReader(this)}pipeThrough(t,r={}){if(!IsReadableStream(this)){throw streamBrandCheckException$1("pipeThrough")}assertRequiredArgument(t,1,"pipeThrough");const i=convertReadableWritablePair(t,"First parameter");const o=convertPipeOptions(r,"Second parameter");if(IsReadableStreamLocked(this)){throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream")}if(IsWritableStreamLocked(i.writable)){throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream")}const a=ReadableStreamPipeTo(this,i.writable,o.preventClose,o.preventAbort,o.preventCancel,o.signal);setPromiseIsHandledToTrue(a);return i.readable}pipeTo(t,r={}){if(!IsReadableStream(this)){return promiseRejectedWith(streamBrandCheckException$1("pipeTo"))}if(t===undefined){return promiseRejectedWith(`Parameter 1 is required in 'pipeTo'.`)}if(!IsWritableStream(t)){return promiseRejectedWith(new TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`))}let i;try{i=convertPipeOptions(r,"Second parameter")}catch(t){return promiseRejectedWith(t)}if(IsReadableStreamLocked(this)){return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"))}if(IsWritableStreamLocked(t)){return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"))}return ReadableStreamPipeTo(this,t,i.preventClose,i.preventAbort,i.preventCancel,i.signal)}tee(){if(!IsReadableStream(this)){throw streamBrandCheckException$1("tee")}const t=ReadableStreamTee(this);return CreateArrayFromList(t)}values(t=undefined){if(!IsReadableStream(this)){throw streamBrandCheckException$1("values")}const r=convertIteratorOptions(t,"First parameter");return AcquireReadableStreamAsyncIterator(this,r.preventCancel)}}Object.defineProperties(ReadableStream.prototype,{cancel:{enumerable:true},getReader:{enumerable:true},pipeThrough:{enumerable:true},pipeTo:{enumerable:true},tee:{enumerable:true},values:{enumerable:true},locked:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStream.prototype,r.toStringTag,{value:"ReadableStream",configurable:true})}if(typeof r.asyncIterator==="symbol"){Object.defineProperty(ReadableStream.prototype,r.asyncIterator,{value:ReadableStream.prototype.values,writable:true,configurable:true})}function CreateReadableStream(t,r,i,o=1,a=(()=>1)){const l=Object.create(ReadableStream.prototype);InitializeReadableStream(l);const u=Object.create(ReadableStreamDefaultController.prototype);SetUpReadableStreamDefaultController(l,u,t,r,i,o,a);return l}function CreateReadableByteStream(t,r,i){const o=Object.create(ReadableStream.prototype);InitializeReadableStream(o);const a=Object.create(ReadableByteStreamController.prototype);SetUpReadableByteStreamController(o,a,t,r,i,0,undefined);return o}function InitializeReadableStream(t){t._state="readable";t._reader=undefined;t._storedError=undefined;t._disturbed=false}function IsReadableStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readableStreamController")){return false}return t instanceof ReadableStream}function IsReadableStreamLocked(t){if(t._reader===undefined){return false}return true}function ReadableStreamCancel(t,r){t._disturbed=true;if(t._state==="closed"){return promiseResolvedWith(undefined)}if(t._state==="errored"){return promiseRejectedWith(t._storedError)}ReadableStreamClose(t);const i=t._reader;if(i!==undefined&&IsReadableStreamBYOBReader(i)){i._readIntoRequests.forEach((t=>{t._closeSteps(undefined)}));i._readIntoRequests=new SimpleQueue}const o=t._readableStreamController[g](r);return transformPromiseWith(o,noop)}function ReadableStreamClose(t){t._state="closed";const r=t._reader;if(r===undefined){return}defaultReaderClosedPromiseResolve(r);if(IsReadableStreamDefaultReader(r)){r._readRequests.forEach((t=>{t._closeSteps()}));r._readRequests=new SimpleQueue}}function ReadableStreamError(t,r){t._state="errored";t._storedError=r;const i=t._reader;if(i===undefined){return}defaultReaderClosedPromiseReject(i,r);if(IsReadableStreamDefaultReader(i)){i._readRequests.forEach((t=>{t._errorSteps(r)}));i._readRequests=new SimpleQueue}else{i._readIntoRequests.forEach((t=>{t._errorSteps(r)}));i._readIntoRequests=new SimpleQueue}}function streamBrandCheckException$1(t){return new TypeError(`ReadableStream.prototype.${t} can only be used on a ReadableStream`)}function convertQueuingStrategyInit(t,r){assertDictionary(t,r);const i=t===null||t===void 0?void 0:t.highWaterMark;assertRequiredField(i,"highWaterMark","QueuingStrategyInit");return{highWaterMark:convertUnrestrictedDouble(i)}}const byteLengthSizeFunction=t=>t.byteLength;try{Object.defineProperty(byteLengthSizeFunction,"name",{value:"size",configurable:true})}catch(t){}class ByteLengthQueuingStrategy{constructor(t){assertRequiredArgument(t,1,"ByteLengthQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!IsByteLengthQueuingStrategy(this)){throw byteLengthBrandCheckException("highWaterMark")}return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!IsByteLengthQueuingStrategy(this)){throw byteLengthBrandCheckException("size")}return byteLengthSizeFunction}}Object.defineProperties(ByteLengthQueuingStrategy.prototype,{highWaterMark:{enumerable:true},size:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ByteLengthQueuingStrategy.prototype,r.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:true})}function byteLengthBrandCheckException(t){return new TypeError(`ByteLengthQueuingStrategy.prototype.${t} can only be used on a ByteLengthQueuingStrategy`)}function IsByteLengthQueuingStrategy(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_byteLengthQueuingStrategyHighWaterMark")){return false}return t instanceof ByteLengthQueuingStrategy}const countSizeFunction=()=>1;try{Object.defineProperty(countSizeFunction,"name",{value:"size",configurable:true})}catch(t){}class CountQueuingStrategy{constructor(t){assertRequiredArgument(t,1,"CountQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!IsCountQueuingStrategy(this)){throw countBrandCheckException("highWaterMark")}return this._countQueuingStrategyHighWaterMark}get size(){if(!IsCountQueuingStrategy(this)){throw countBrandCheckException("size")}return countSizeFunction}}Object.defineProperties(CountQueuingStrategy.prototype,{highWaterMark:{enumerable:true},size:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(CountQueuingStrategy.prototype,r.toStringTag,{value:"CountQueuingStrategy",configurable:true})}function countBrandCheckException(t){return new TypeError(`CountQueuingStrategy.prototype.${t} can only be used on a CountQueuingStrategy`)}function IsCountQueuingStrategy(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_countQueuingStrategyHighWaterMark")){return false}return t instanceof CountQueuingStrategy}function convertTransformer(t,r){assertDictionary(t,r);const i=t===null||t===void 0?void 0:t.flush;const o=t===null||t===void 0?void 0:t.readableType;const a=t===null||t===void 0?void 0:t.start;const l=t===null||t===void 0?void 0:t.transform;const u=t===null||t===void 0?void 0:t.writableType;return{flush:i===undefined?undefined:convertTransformerFlushCallback(i,t,`${r} has member 'flush' that`),readableType:o,start:a===undefined?undefined:convertTransformerStartCallback(a,t,`${r} has member 'start' that`),transform:l===undefined?undefined:convertTransformerTransformCallback(l,t,`${r} has member 'transform' that`),writableType:u}}function convertTransformerFlushCallback(t,r,i){assertFunction(t,i);return i=>promiseCall(t,r,[i])}function convertTransformerStartCallback(t,r,i){assertFunction(t,i);return i=>reflectCall(t,r,[i])}function convertTransformerTransformCallback(t,r,i){assertFunction(t,i);return(i,o)=>promiseCall(t,r,[i,o])}class TransformStream{constructor(t={},r={},i={}){if(t===undefined){t=null}const o=convertQueuingStrategy(r,"Second parameter");const a=convertQueuingStrategy(i,"Third parameter");const l=convertTransformer(t,"First parameter");if(l.readableType!==undefined){throw new RangeError("Invalid readableType specified")}if(l.writableType!==undefined){throw new RangeError("Invalid writableType specified")}const u=ExtractHighWaterMark(a,0);const c=ExtractSizeAlgorithm(a);const d=ExtractHighWaterMark(o,1);const h=ExtractSizeAlgorithm(o);let p;const m=newPromise((t=>{p=t}));InitializeTransformStream(this,m,d,h,u,c);SetUpTransformStreamDefaultControllerFromTransformer(this,l);if(l.start!==undefined){p(l.start(this._transformStreamController))}else{p(undefined)}}get readable(){if(!IsTransformStream(this)){throw streamBrandCheckException("readable")}return this._readable}get writable(){if(!IsTransformStream(this)){throw streamBrandCheckException("writable")}return this._writable}}Object.defineProperties(TransformStream.prototype,{readable:{enumerable:true},writable:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(TransformStream.prototype,r.toStringTag,{value:"TransformStream",configurable:true})}function InitializeTransformStream(t,r,i,o,a,l){function startAlgorithm(){return r}function writeAlgorithm(r){return TransformStreamDefaultSinkWriteAlgorithm(t,r)}function abortAlgorithm(r){return TransformStreamDefaultSinkAbortAlgorithm(t,r)}function closeAlgorithm(){return TransformStreamDefaultSinkCloseAlgorithm(t)}t._writable=CreateWritableStream(startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,i,o);function pullAlgorithm(){return TransformStreamDefaultSourcePullAlgorithm(t)}function cancelAlgorithm(r){TransformStreamErrorWritableAndUnblockWrite(t,r);return promiseResolvedWith(undefined)}t._readable=CreateReadableStream(startAlgorithm,pullAlgorithm,cancelAlgorithm,a,l);t._backpressure=undefined;t._backpressureChangePromise=undefined;t._backpressureChangePromise_resolve=undefined;TransformStreamSetBackpressure(t,true);t._transformStreamController=undefined}function IsTransformStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_transformStreamController")){return false}return t instanceof TransformStream}function TransformStreamError(t,r){ReadableStreamDefaultControllerError(t._readable._readableStreamController,r);TransformStreamErrorWritableAndUnblockWrite(t,r)}function TransformStreamErrorWritableAndUnblockWrite(t,r){TransformStreamDefaultControllerClearAlgorithms(t._transformStreamController);WritableStreamDefaultControllerErrorIfNeeded(t._writable._writableStreamController,r);if(t._backpressure){TransformStreamSetBackpressure(t,false)}}function TransformStreamSetBackpressure(t,r){if(t._backpressureChangePromise!==undefined){t._backpressureChangePromise_resolve()}t._backpressureChangePromise=newPromise((r=>{t._backpressureChangePromise_resolve=r}));t._backpressure=r}class TransformStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("desiredSize")}const t=this._controlledTransformStream._readable._readableStreamController;return ReadableStreamDefaultControllerGetDesiredSize(t)}enqueue(t=undefined){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("enqueue")}TransformStreamDefaultControllerEnqueue(this,t)}error(t=undefined){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("error")}TransformStreamDefaultControllerError(this,t)}terminate(){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("terminate")}TransformStreamDefaultControllerTerminate(this)}}Object.defineProperties(TransformStreamDefaultController.prototype,{enqueue:{enumerable:true},error:{enumerable:true},terminate:{enumerable:true},desiredSize:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(TransformStreamDefaultController.prototype,r.toStringTag,{value:"TransformStreamDefaultController",configurable:true})}function IsTransformStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledTransformStream")){return false}return t instanceof TransformStreamDefaultController}function SetUpTransformStreamDefaultController(t,r,i,o){r._controlledTransformStream=t;t._transformStreamController=r;r._transformAlgorithm=i;r._flushAlgorithm=o}function SetUpTransformStreamDefaultControllerFromTransformer(t,r){const i=Object.create(TransformStreamDefaultController.prototype);let transformAlgorithm=t=>{try{TransformStreamDefaultControllerEnqueue(i,t);return promiseResolvedWith(undefined)}catch(t){return promiseRejectedWith(t)}};let flushAlgorithm=()=>promiseResolvedWith(undefined);if(r.transform!==undefined){transformAlgorithm=t=>r.transform(t,i)}if(r.flush!==undefined){flushAlgorithm=()=>r.flush(i)}SetUpTransformStreamDefaultController(t,i,transformAlgorithm,flushAlgorithm)}function TransformStreamDefaultControllerClearAlgorithms(t){t._transformAlgorithm=undefined;t._flushAlgorithm=undefined}function TransformStreamDefaultControllerEnqueue(t,r){const i=t._controlledTransformStream;const o=i._readable._readableStreamController;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(o)){throw new TypeError("Readable side is not in a state that permits enqueue")}try{ReadableStreamDefaultControllerEnqueue(o,r)}catch(t){TransformStreamErrorWritableAndUnblockWrite(i,t);throw i._readable._storedError}const a=ReadableStreamDefaultControllerHasBackpressure(o);if(a!==i._backpressure){TransformStreamSetBackpressure(i,true)}}function TransformStreamDefaultControllerError(t,r){TransformStreamError(t._controlledTransformStream,r)}function TransformStreamDefaultControllerPerformTransform(t,r){const i=t._transformAlgorithm(r);return transformPromiseWith(i,undefined,(r=>{TransformStreamError(t._controlledTransformStream,r);throw r}))}function TransformStreamDefaultControllerTerminate(t){const r=t._controlledTransformStream;const i=r._readable._readableStreamController;ReadableStreamDefaultControllerClose(i);const o=new TypeError("TransformStream terminated");TransformStreamErrorWritableAndUnblockWrite(r,o)}function TransformStreamDefaultSinkWriteAlgorithm(t,r){const i=t._transformStreamController;if(t._backpressure){const o=t._backpressureChangePromise;return transformPromiseWith(o,(()=>{const o=t._writable;const a=o._state;if(a==="erroring"){throw o._storedError}return TransformStreamDefaultControllerPerformTransform(i,r)}))}return TransformStreamDefaultControllerPerformTransform(i,r)}function TransformStreamDefaultSinkAbortAlgorithm(t,r){TransformStreamError(t,r);return promiseResolvedWith(undefined)}function TransformStreamDefaultSinkCloseAlgorithm(t){const r=t._readable;const i=t._transformStreamController;const o=i._flushAlgorithm();TransformStreamDefaultControllerClearAlgorithms(i);return transformPromiseWith(o,(()=>{if(r._state==="errored"){throw r._storedError}ReadableStreamDefaultControllerClose(r._readableStreamController)}),(i=>{TransformStreamError(t,i);throw r._storedError}))}function TransformStreamDefaultSourcePullAlgorithm(t){TransformStreamSetBackpressure(t,false);return t._backpressureChangePromise}function defaultControllerBrandCheckException(t){return new TypeError(`TransformStreamDefaultController.prototype.${t} can only be used on a TransformStreamDefaultController`)}function streamBrandCheckException(t){return new TypeError(`TransformStream.prototype.${t} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=ByteLengthQueuingStrategy;t.CountQueuingStrategy=CountQueuingStrategy;t.ReadableByteStreamController=ReadableByteStreamController;t.ReadableStream=ReadableStream;t.ReadableStreamBYOBReader=ReadableStreamBYOBReader;t.ReadableStreamBYOBRequest=ReadableStreamBYOBRequest;t.ReadableStreamDefaultController=ReadableStreamDefaultController;t.ReadableStreamDefaultReader=ReadableStreamDefaultReader;t.TransformStream=TransformStream;t.TransformStreamDefaultController=TransformStreamDefaultController;t.WritableStream=WritableStream;t.WritableStreamDefaultController=WritableStreamDefaultController;t.WritableStreamDefaultWriter=WritableStreamDefaultWriter;Object.defineProperty(t,"__esModule",{value:true})}))},4300:t=>{"use strict";t.exports=require("buffer")},2361:t=>{"use strict";t.exports=require("events")},7147:t=>{"use strict";t.exports=require("fs")},7561:t=>{"use strict";t.exports=require("node:fs")},7742:t=>{"use strict";t.exports=require("node:process")},2477:t=>{"use strict";t.exports=require("node:stream/web")},2037:t=>{"use strict";t.exports=require("os")},4521:t=>{"use strict";t.exports=require("readline")},6224:t=>{"use strict";t.exports=require("tty")},3837:t=>{"use strict";t.exports=require("util")},1267:t=>{"use strict";t.exports=require("worker_threads")},3126:(t,r,i)=>{const o=65536;if(!globalThis.ReadableStream){try{const t=i(7742);const{emitWarning:r}=t;try{t.emitWarning=()=>{};Object.assign(globalThis,i(2477));t.emitWarning=r}catch(i){t.emitWarning=r;throw i}}catch(t){Object.assign(globalThis,i(631))}}try{const{Blob:t}=i(4300);if(t&&!t.prototype.stream){t.prototype.stream=function name(t){let r=0;const i=this;return new ReadableStream({type:"bytes",async pull(t){const a=i.slice(r,Math.min(i.size,r+o));const l=await a.arrayBuffer();r+=l.byteLength;t.enqueue(new Uint8Array(l));if(r===i.size){t.close()}}})}}}catch(t){}},198:(t,r,i)=>{"use strict";i.d(r,{Z:()=>u});var o=i(7579);const a=class File extends o.Z{#e=0;#t="";constructor(t,r,i={}){if(arguments.length<2){throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)}super(t,i);if(i===null)i={};const o=i.lastModified===undefined?Date.now():Number(i.lastModified);if(!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](t){return!!t&&t instanceof o.Z&&/^(File)$/.test(t[Symbol.toStringTag])}};const l=a;const u=l},7210:(t,r,i)=>{"use strict";i.d(r,{$B:()=>u.Z});var o=i(7561);const a=require("node:path");var l=i(1297);var u=i(198);var c=i(7579);const{stat:d}=o.promises;const blobFromSync=(t,r)=>fromBlob(statSync(t),t,r);const blobFrom=(t,r)=>d(t).then((i=>fromBlob(i,t,r)));const fileFrom=(t,r)=>d(t).then((i=>fromFile(i,t,r)));const fileFromSync=(t,r)=>fromFile(statSync(t),t,r);const fromBlob=(t,r,i="")=>new Blob([new BlobDataItem({path:r,size:t.size,lastModified:t.mtimeMs,start:0})],{type:i});const fromFile=(t,r,i="")=>new File([new BlobDataItem({path:r,size:t.size,lastModified:t.mtimeMs,start:0})],basename(r),{type:i,lastModified:t.mtimeMs});class BlobDataItem{#r;#s;constructor(t){this.#r=t.path;this.#s=t.start;this.size=t.size;this.lastModified=t.lastModified}slice(t,r){return new BlobDataItem({path:this.#r,lastModified:this.lastModified,size:r-t,start:this.#s+t})}async*stream(){const{mtimeMs:t}=await d(this.#r);if(t>this.lastModified){throw new DOMException("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError")}yield*createReadStream(this.#r,{start:this.#s,end:this.#s+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}const h=null&&blobFromSync},7579:(t,r,i)=>{"use strict";i.d(r,{Z:()=>c});var o=i(3126);
5
5
  /*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */const a=65536;async function*toIterator(t,r=true){for(const i of t){if("stream"in i){yield*i.stream()}else if(ArrayBuffer.isView(i)){if(r){let t=i.byteOffset;const r=i.byteOffset+i.byteLength;while(t!==r){const o=Math.min(r-t,a);const l=i.buffer.slice(t,t+o);t+=l.byteLength;yield new Uint8Array(l)}}else{yield i}}else{let t=0,r=i;while(t!==r.size){const i=r.slice(t,Math.min(r.size,t+a));const o=await i.arrayBuffer();t+=o.byteLength;yield new Uint8Array(o)}}}}const l=class Blob{#n=[];#i="";#o=0;#a="transparent";constructor(t=[],r={}){if(typeof t!=="object"||t===null){throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.")}if(typeof t[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.")}if(r===null)r={};const i=new TextEncoder;for(const r of t){let t;if(ArrayBuffer.isView(r)){t=new Uint8Array(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength))}else if(r instanceof ArrayBuffer){t=new Uint8Array(r.slice(0))}else if(r instanceof Blob){t=r}else{t=i.encode(`${r}`)}this.#o+=ArrayBuffer.isView(t)?t.byteLength:t.size;this.#n.push(t)}this.#a=`${r.endings===undefined?"transparent":r.endings}`;const o=r.type===undefined?"":String(r.type);this.#i=/^[\x20-\x7E]*$/.test(o)?o:""}get size(){return this.#o}get type(){return this.#i}async text(){const t=new TextDecoder;let r="";for await(const i of toIterator(this.#n,false)){r+=t.decode(i,{stream:true})}r+=t.decode();return r}async arrayBuffer(){const t=new Uint8Array(this.size);let r=0;for await(const i of toIterator(this.#n,false)){t.set(i,r);r+=i.length}return t.buffer}stream(){const t=toIterator(this.#n,true);return new globalThis.ReadableStream({type:"bytes",async pull(r){const i=await t.next();i.done?r.close():r.enqueue(i.value)},async cancel(){await t.return()}})}slice(t=0,r=this.size,i=""){const{size:o}=this;let a=t<0?Math.max(o+t,0):Math.min(t,o);let l=r<0?Math.max(o+r,0):Math.min(r,o);const u=Math.max(l-a,0);const c=this.#n;const d=[];let h=0;for(const t of c){if(h>=u){break}const r=ArrayBuffer.isView(t)?t.byteLength:t.size;if(a&&r<=a){a-=r;l-=r}else{let i;if(ArrayBuffer.isView(t)){i=t.subarray(a,Math.min(r,l));h+=i.byteLength}else{i=t.slice(a,Math.min(r,l));h+=i.size}l-=r;d.push(i);a=0}}const p=new Blob([],{type:String(i).toLowerCase()});p.#o=u;p.#n=d;return p}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](t){return t&&typeof t==="object"&&typeof t.constructor==="function"&&(typeof t.stream==="function"||typeof t.arrayBuffer==="function")&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}};Object.defineProperties(l.prototype,{size:{enumerable:true},type:{enumerable:true},slice:{enumerable:true}});const u=l;const c=u},8809:(t,r,i)=>{"use strict";i.d(r,{Ct:()=>m,au:()=>formDataToBlob});var o=i(7579);var a=i(198);
6
- /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */var{toStringTag:l,iterator:u,hasInstance:c}=Symbol,d=Math.random,h="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),f=(t,r,i)=>(t+="",/^(Blob|File)$/.test(r&&r[l])?[(i=i!==void 0?i+"":r[l]=="File"?r.name:"blob",t),r.name!==i||r[l]=="blob"?new a.Z([r],i,r):r]:[t,r+""]),e=(t,r)=>(r?t:t.replace(/\r?\n|\r/g,"\r\n")).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),x=(t,r,i)=>{if(r.length<i){throw new TypeError(`Failed to execute '${t}' on 'FormData': ${i} arguments required, but only ${r.length} present.`)}};const p=null&&F;const m=class FormData{#l=[];constructor(...t){if(t.length)throw new TypeError(`Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.`)}get[l](){return"FormData"}[u](){return this.entries()}static[c](t){return t&&typeof t==="object"&&t[l]==="FormData"&&!h.some((r=>typeof t[r]!="function"))}append(...t){x("append",arguments,2);this.#l.push(f(...t))}delete(t){x("delete",arguments,1);t+="";this.#l=this.#l.filter((([r])=>r!==t))}get(t){x("get",arguments,1);t+="";for(var r=this.#l,i=r.length,o=0;o<i;o++)if(r[o][0]===t)return r[o][1];return null}getAll(t,r){x("getAll",arguments,1);r=[];t+="";this.#l.forEach((i=>i[0]===t&&r.push(i[1])));return r}has(t){x("has",arguments,1);t+="";return this.#l.some((r=>r[0]===t))}forEach(t,r){x("forEach",arguments,1);for(var[i,o]of this)t.call(r,o,i,this)}set(...t){x("set",arguments,2);var r=[],i=!0;t=f(...t);this.#l.forEach((o=>{o[0]===t[0]?i&&(i=!r.push(t)):r.push(o)}));i&&r.push(t);this.#l=r}*entries(){yield*this.#l}*keys(){for(var[t]of this)yield t}*values(){for(var[,t]of this)yield t}};function formDataToBlob(t,r=o.Z){var i=`${d()}${d()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),a=[],l=`--${i}\r\nContent-Disposition: form-data; name="`;t.forEach(((t,r)=>typeof t=="string"?a.push(l+e(r)+`"\r\n\r\n${t.replace(/\r(?!\n)|(?<!\r)\n/g,"\r\n")}\r\n`):a.push(l+e(r)+`"; filename="${e(t.name,1)}"\r\nContent-Type: ${t.type||"application/octet-stream"}\r\n\r\n`,t,"\r\n")));a.push(`--${i}--`);return new r(a,{type:"multipart/form-data; boundary="+i})}}};var r={};function __nccwpck_require__(i){var o=r[i];if(o!==undefined){return o.exports}var a=r[i]={exports:{}};var l=true;try{t[i].call(a.exports,a,a.exports,__nccwpck_require__);l=false}finally{if(l)delete r[i]}return a.exports}__nccwpck_require__.m=t;(()=>{__nccwpck_require__.n=t=>{var r=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(t,r)=>{for(var i in r){if(__nccwpck_require__.o(r,i)&&!__nccwpck_require__.o(t,i)){Object.defineProperty(t,i,{enumerable:true,get:r[i]})}}}})();(()=>{__nccwpck_require__.f={};__nccwpck_require__.e=t=>Promise.all(Object.keys(__nccwpck_require__.f).reduce(((r,i)=>{__nccwpck_require__.f[i](t,r);return r}),[]))})();(()=>{__nccwpck_require__.u=t=>""+t+".index.js"})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";(()=>{var t={179:1};var installChunk=r=>{var i=r.modules,o=r.ids,a=r.runtime;for(var l in i){if(__nccwpck_require__.o(i,l)){__nccwpck_require__.m[l]=i[l]}}if(a)a(__nccwpck_require__);for(var u=0;u<o.length;u++)t[o[u]]=1};__nccwpck_require__.f.require=(r,i)=>{if(!t[r]){if(true){installChunk(require("./"+__nccwpck_require__.u(r)))}else t[r]=1}}})();var i={};(()=>{"use strict";__nccwpck_require__.r(i);var t=__nccwpck_require__(5918);var r=__nccwpck_require__.n(t);var o=__nccwpck_require__(6399);var a=__nccwpck_require__(8903);var l=__nccwpck_require__(4492);const u=require("child_process");var c=__nccwpck_require__(9851);var d=Object.defineProperty;var h=Object.defineProperties;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertyNames;var b=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty;var S=Object.prototype.propertyIsEnumerable;var __defNormalProp=(t,r,i)=>r in t?d(t,r,{enumerable:true,configurable:true,writable:true,value:i}):t[r]=i;var __spreadValues=(t,r)=>{for(var i in r||(r={}))if(y.call(r,i))__defNormalProp(t,i,r[i]);if(b)for(var i of b(r)){if(S.call(r,i))__defNormalProp(t,i,r[i])}return t};var __spreadProps=(t,r)=>h(t,m(r));var __markAsModule=t=>d(t,"__esModule",{value:true});var __esm=(t,r)=>function __init(){return t&&(r=(0,t[g(t)[0]])(t=0)),r};var __commonJS=(t,r)=>function __require(){return r||(0,t[g(t)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(t,r)=>{for(var i in r)d(t,i,{get:r[i],enumerable:true})};var __reExport=(t,r,i,o)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let a of g(r))if(!y.call(t,a)&&(i||a!=="default"))d(t,a,{get:()=>r[a],enumerable:!(o=p(r,a))||o.enumerable})}return t};var w=(t=>(r,i)=>t&&t.get(r)||(i=__reExport(__markAsModule({}),r,1),t&&t.set(r,i),i))(typeof WeakMap!=="undefined"?new WeakMap:0);var __async=(t,r,i)=>new Promise(((o,a)=>{var fulfilled=t=>{try{step(i.next(t))}catch(t){a(t)}};var rejected=t=>{try{step(i.throw(t))}catch(t){a(t)}};var step=t=>t.done?o(t.value):Promise.resolve(t.value).then(fulfilled,rejected);step((i=i.apply(t,r)).next())}));function pathspec(...t){const r=new String(t);v.set(r,t);return r}function isPathSpec(t){return t instanceof String&&v.has(t)}function toPaths(t){return v.get(t)||[]}var v;var R=__esm({"src/lib/args/pathspec.ts"(){v=new WeakMap}});var _;var C=__esm({"src/lib/errors/git-error.ts"(){_=class extends Error{constructor(t,r){super(r);this.task=t;Object.setPrototypeOf(this,new.target.prototype)}}}});var T;var k=__esm({"src/lib/errors/git-response-error.ts"(){C();T=class extends _{constructor(t,r){super(void 0,r||String(t));this.git=t}}}});var P;var E=__esm({"src/lib/errors/task-configuration-error.ts"(){C();P=class extends _{constructor(t){super(void 0,t)}}}});function asFunction(t){return typeof t==="function"?t:A}function isUserFunction(t){return typeof t==="function"&&t!==A}function splitOn(t,r){const i=t.indexOf(r);if(i<=0){return[t,""]}return[t.substr(0,i),t.substr(i+1)]}function first(t,r=0){return isArrayLike(t)&&t.length>r?t[r]:void 0}function last(t,r=0){if(isArrayLike(t)&&t.length>r){return t[t.length-1-r]}}function isArrayLike(t){return!!(t&&typeof t.length==="number")}function toLinesWithContent(t="",r=true,i="\n"){return t.split(i).reduce(((t,i)=>{const o=r?i.trim():i;if(o){t.push(o)}return t}),[])}function forEachLineWithContent(t,r){return toLinesWithContent(t,true).map((t=>r(t)))}function folderExists(t){return(0,a.exists)(t,a.FOLDER)}function append(t,r){if(Array.isArray(t)){if(!t.includes(r)){t.push(r)}}else{t.add(r)}return r}function including(t,r){if(Array.isArray(t)&&!t.includes(r)){t.push(r)}return t}function remove(t,r){if(Array.isArray(t)){const i=t.indexOf(r);if(i>=0){t.splice(i,1)}}else{t.delete(r)}return r}function asArray(t){return Array.isArray(t)?t:[t]}function asStringArray(t){return asArray(t).map(String)}function asNumber(t,r=0){if(t==null){return r}const i=parseInt(t,10);return isNaN(i)?r:i}function prefixedArray(t,r){const i=[];for(let o=0,a=t.length;o<a;o++){i.push(r,t[o])}return i}function bufferToString(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function pick(t,r){return Object.assign({},...r.map((r=>r in t?{[r]:t[r]}:{})))}function delay(t=0){return new Promise((r=>setTimeout(r,t)))}function orVoid(t){if(t===false){return void 0}return t}var O,A,I;var D=__esm({"src/lib/utils/util.ts"(){O="\0";A=()=>{};I=Object.prototype.toString.call.bind(Object.prototype.toString)}});function filterType(t,r,i){if(r(t)){return t}return arguments.length>2?i:void 0}function filterPrimitives(t,r){const i=isPathSpec(t)?"string":typeof t;return/number|string|boolean/.test(i)&&(!r||!r.includes(i))}function filterPlainObject(t){return!!t&&I(t)==="[object Object]"}function filterFunction(t){return typeof t==="function"}var B,W,j,M,$;var q=__esm({"src/lib/utils/argument-filters.ts"(){D();R();B=t=>Array.isArray(t);W=t=>typeof t==="string";j=t=>Array.isArray(t)&&t.every(W);M=t=>W(t)||Array.isArray(t)&&t.every(W);$=t=>{if(t==null||"number|boolean|function".includes(typeof t)){return false}return Array.isArray(t)||typeof t==="string"||typeof t.length==="number"}}});var L;var N=__esm({"src/lib/utils/exit-codes.ts"(){L=(t=>{t[t["SUCCESS"]=0]="SUCCESS";t[t["ERROR"]=1]="ERROR";t[t["NOT_FOUND"]=-2]="NOT_FOUND";t[t["UNCLEAN"]=128]="UNCLEAN";return t})(L||{})}});var U;var z=__esm({"src/lib/utils/git-output-streams.ts"(){U=class{constructor(t,r){this.stdOut=t;this.stdErr=r}asStrings(){return new U(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});var G,H;var Y=__esm({"src/lib/utils/line-parser.ts"(){G=class{constructor(t,r){this.matches=[];this.parse=(t,r)=>{this.resetMatches();if(!this._regExp.every(((r,i)=>this.addMatch(r,i,t(i))))){return false}return this.useMatches(r,this.prepareMatches())!==false};this._regExp=Array.isArray(t)?t:[t];if(r){this.useMatches=r}}useMatches(t,r){throw new Error(`LineParser:useMatches not implemented`)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,r,i){const o=i&&t.exec(i);if(o){this.pushMatch(r,o)}return!!o}pushMatch(t,r){this.matches.push(...r.slice(1))}};H=class extends G{addMatch(t,r,i){return/^remote:\s/.test(String(i))&&super.addMatch(t,r,i)}pushMatch(t,r){if(t>0||r.length>1){super.pushMatch(t,r)}}}}});function createInstanceConfig(...t){const r=process.cwd();const i=Object.assign(__spreadValues({baseDir:r},Q),...t.filter((t=>typeof t==="object"&&t)));i.baseDir=i.baseDir||r;i.trimmed=i.trimmed===true;return i}var Q;var V=__esm({"src/lib/utils/simple-git-options.ts"(){Q={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:false}}});function appendTaskOptions(t,r=[]){if(!filterPlainObject(t)){return r}return Object.keys(t).reduce(((r,i)=>{const o=t[i];if(isPathSpec(o)){r.push(o)}else if(filterPrimitives(o,["boolean"])){r.push(i+"="+o)}else{r.push(i)}return r}),r)}function getTrailingOptions(t,r=0,i=false){const o=[];for(let i=0,a=r<0?t.length:r;i<a;i++){if("string|number".includes(typeof t[i])){o.push(String(t[i]))}}appendTaskOptions(trailingOptionsArgument(t),o);if(!i){o.push(...trailingArrayArgument(t))}return o}function trailingArrayArgument(t){const r=typeof last(t)==="function";return filterType(last(t,r?1:0),B,[])}function trailingOptionsArgument(t){const r=filterFunction(last(t));return filterType(last(t,r?1:0),filterPlainObject)}function trailingFunctionArgument(t,r=true){const i=asFunction(last(t));return r||isUserFunction(i)?i:void 0}var J=__esm({"src/lib/utils/task-options.ts"(){q();D();R()}});function callTaskParser(t,r){return t(r.stdOut,r.stdErr)}function parseStringResponse(t,r,i,o=true){asArray(i).forEach((i=>{for(let a=toLinesWithContent(i,o),l=0,u=a.length;l<u;l++){const line=(t=0)=>{if(l+t>=u){return}return a[l+t]};r.some((({parse:r})=>r(line,t)))}}));return t}var K=__esm({"src/lib/utils/task-parser.ts"(){D()}});var Z={};__export(Z,{ExitCodes:()=>L,GitOutputStreams:()=>U,LineParser:()=>G,NOOP:()=>A,NULL:()=>O,RemoteLineParser:()=>H,append:()=>append,appendTaskOptions:()=>appendTaskOptions,asArray:()=>asArray,asFunction:()=>asFunction,asNumber:()=>asNumber,asStringArray:()=>asStringArray,bufferToString:()=>bufferToString,callTaskParser:()=>callTaskParser,createInstanceConfig:()=>createInstanceConfig,delay:()=>delay,filterArray:()=>B,filterFunction:()=>filterFunction,filterHasLength:()=>$,filterPlainObject:()=>filterPlainObject,filterPrimitives:()=>filterPrimitives,filterString:()=>W,filterStringArray:()=>j,filterStringOrStringArray:()=>M,filterType:()=>filterType,first:()=>first,folderExists:()=>folderExists,forEachLineWithContent:()=>forEachLineWithContent,getTrailingOptions:()=>getTrailingOptions,including:()=>including,isUserFunction:()=>isUserFunction,last:()=>last,objectToString:()=>I,orVoid:()=>orVoid,parseStringResponse:()=>parseStringResponse,pick:()=>pick,prefixedArray:()=>prefixedArray,remove:()=>remove,splitOn:()=>splitOn,toLinesWithContent:()=>toLinesWithContent,trailingFunctionArgument:()=>trailingFunctionArgument,trailingOptionsArgument:()=>trailingOptionsArgument});var X=__esm({"src/lib/utils/index.ts"(){q();N();z();Y();V();J();K();D()}});var ee={};__export(ee,{CheckRepoActions:()=>te,checkIsBareRepoTask:()=>checkIsBareRepoTask,checkIsRepoRootTask:()=>checkIsRepoRootTask,checkIsRepoTask:()=>checkIsRepoTask});function checkIsRepoTask(t){switch(t){case"bare":return checkIsBareRepoTask();case"root":return checkIsRepoRootTask()}const r=["rev-parse","--is-inside-work-tree"];return{commands:r,format:"utf-8",onError:re,parser:se}}function checkIsRepoRootTask(){const t=["rev-parse","--git-dir"];return{commands:t,format:"utf-8",onError:re,parser(t){return/^\.(git)?$/.test(t.trim())}}}function checkIsBareRepoTask(){const t=["rev-parse","--is-bare-repository"];return{commands:t,format:"utf-8",onError:re,parser:se}}function isNotRepoMessage(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var te,re,se;var ne=__esm({"src/lib/tasks/check-is-repo.ts"(){X();te=(t=>{t["BARE"]="bare";t["IN_TREE"]="tree";t["IS_REPO_ROOT"]="root";return t})(te||{});re=({exitCode:t},r,i,o)=>{if(t===128&&isNotRepoMessage(r)){return i(Buffer.from("false"))}o(r)};se=t=>t.trim()==="true"}});function cleanSummaryParser(t,r){const i=new ie(t);const o=t?ae:oe;toLinesWithContent(r).forEach((t=>{const r=t.replace(o,"");i.paths.push(r);(le.test(r)?i.folders:i.files).push(r)}));return i}var ie,oe,ae,le;var ue=__esm({"src/lib/responses/CleanSummary.ts"(){X();ie=class{constructor(t){this.dryRun=t;this.paths=[];this.files=[];this.folders=[]}};oe=/^[a-z]+\s*/i;ae=/^[a-z]+\s+[a-z]+\s*/i;le=/\/$/}});var ce={};__export(ce,{EMPTY_COMMANDS:()=>de,adhocExecTask:()=>adhocExecTask,configurationErrorTask:()=>configurationErrorTask,isBufferTask:()=>isBufferTask,isEmptyTask:()=>isEmptyTask,straightThroughBufferTask:()=>straightThroughBufferTask,straightThroughStringTask:()=>straightThroughStringTask});function adhocExecTask(t){return{commands:de,format:"empty",parser:t}}function configurationErrorTask(t){return{commands:de,format:"empty",parser(){throw typeof t==="string"?new P(t):t}}}function straightThroughStringTask(t,r=false){return{commands:t,format:"utf-8",parser(t){return r?String(t).trim():t}}}function straightThroughBufferTask(t){return{commands:t,format:"buffer",parser(t){return t}}}function isBufferTask(t){return t.format==="buffer"}function isEmptyTask(t){return t.format==="empty"||!t.commands.length}var de;var he=__esm({"src/lib/tasks/task.ts"(){E();de=[]}});var fe={};__export(fe,{CONFIG_ERROR_INTERACTIVE_MODE:()=>pe,CONFIG_ERROR_MODE_REQUIRED:()=>me,CONFIG_ERROR_UNKNOWN_OPTION:()=>ge,CleanOptions:()=>be,cleanTask:()=>cleanTask,cleanWithOptionsTask:()=>cleanWithOptionsTask,isCleanOptionsArray:()=>isCleanOptionsArray});function cleanWithOptionsTask(t,r){const{cleanMode:i,options:o,valid:a}=getCleanOptions(t);if(!i){return configurationErrorTask(me)}if(!a.options){return configurationErrorTask(ge+JSON.stringify(t))}o.push(...r);if(o.some(isInteractiveMode)){return configurationErrorTask(pe)}return cleanTask(i,o)}function cleanTask(t,r){const i=["clean",`-${t}`,...r];return{commands:i,format:"utf-8",parser(r){return cleanSummaryParser(t==="n",r)}}}function isCleanOptionsArray(t){return Array.isArray(t)&&t.every((t=>ye.has(t)))}function getCleanOptions(t){let r;let i=[];let o={cleanMode:false,options:true};t.replace(/[^a-z]i/g,"").split("").forEach((t=>{if(isCleanMode(t)){r=t;o.cleanMode=true}else{o.options=o.options&&isKnownOption(i[i.length]=`-${t}`)}}));return{cleanMode:r,options:i,valid:o}}function isCleanMode(t){return t==="f"||t==="n"}function isKnownOption(t){return/^-[a-z]$/i.test(t)&&ye.has(t.charAt(1))}function isInteractiveMode(t){if(/^-[^\-]/.test(t)){return t.indexOf("i")>0}return t==="--interactive"}var pe,me,ge,be,ye;var Se=__esm({"src/lib/tasks/clean.ts"(){ue();X();he();pe="Git clean interactive mode is not supported";me='Git clean mode parameter ("n" or "f") is required';ge="Git clean unknown option found in: ";be=(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";return t})(be||{});ye=new Set(["i",...asStringArray(Object.values(be))])}});function configListParser(t){const r=new we;for(const i of configParser(t)){r.addValue(i.file,String(i.key),i.value)}return r}function configGetParser(t,r){let i=null;const o=[];const a=new Map;for(const l of configParser(t,r)){if(l.key!==r){continue}o.push(i=l.value);if(!a.has(l.file)){a.set(l.file,[])}a.get(l.file).push(i)}return{key:r,paths:Array.from(a.keys()),scopes:a,value:i,values:o}}function configFilePath(t){return t.replace(/^(file):/,"")}function*configParser(t,r=null){const i=t.split("\0");for(let t=0,o=i.length-1;t<o;){const o=configFilePath(i[t++]);let a=i[t++];let l=r;if(a.includes("\n")){const t=splitOn(a,"\n");l=t[0];a=t[1]}yield{file:o,key:l,value:a}}}var we;var ve=__esm({"src/lib/responses/ConfigList.ts"(){X();we=class{constructor(){this.files=[];this.values=Object.create(null)}get all(){if(!this._all){this._all=this.files.reduce(((t,r)=>Object.assign(t,this.values[r])),{})}return this._all}addFile(t){if(!(t in this.values)){const r=last(this.files);this.values[t]=r?Object.create(this.values[r]):{};this.files.push(t)}return this.values[t]}addValue(t,r,i){const o=this.addFile(t);if(!o.hasOwnProperty(r)){o[r]=i}else if(Array.isArray(o[r])){o[r].push(i)}else{o[r]=[o[r],i]}this._all=void 0}}}});function asConfigScope(t,r){if(typeof t==="string"&&Re.hasOwnProperty(t)){return t}return r}function addConfigTask(t,r,i,o){const a=["config",`--${o}`];if(i){a.push("--add")}a.push(t,r);return{commands:a,format:"utf-8",parser(t){return t}}}function getConfigTask(t,r){const i=["config","--null","--show-origin","--get-all",t];if(r){i.splice(1,0,`--${r}`)}return{commands:i,format:"utf-8",parser(r){return configGetParser(r,t)}}}function listConfigTask(t){const r=["config","--list","--show-origin","--null"];if(t){r.push(`--${t}`)}return{commands:r,format:"utf-8",parser(t){return configListParser(t)}}}function config_default(){return{addConfig(t,r,...i){return this._runTask(addConfigTask(t,r,i[0]===true,asConfigScope(i[1],"local")),trailingFunctionArgument(arguments))},getConfig(t,r){return this._runTask(getConfigTask(t,asConfigScope(r,void 0)),trailingFunctionArgument(arguments))},listConfig(...t){return this._runTask(listConfigTask(asConfigScope(t[0],void 0)),trailingFunctionArgument(arguments))}}}var Re;var _e=__esm({"src/lib/tasks/config.ts"(){ve();X();Re=(t=>{t["system"]="system";t["global"]="global";t["local"]="local";t["worktree"]="worktree";return t})(Re||{})}});function isDiffNameStatus(t){return Te.has(t)}var Ce,Te;var ke=__esm({"src/lib/tasks/diff-name-status.ts"(){Ce=(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";return t})(Ce||{});Te=new Set(Object.values(Ce))}});function grepQueryBuilder(...t){return(new Oe).param(...t)}function parseGrep(t){const r=new Set;const i={};forEachLineWithContent(t,(t=>{const[o,a,l]=t.split(O);r.add(o);(i[o]=i[o]||[]).push({line:asNumber(a),path:o,preview:l})}));return{paths:r,results:i}}function grep_default(){return{grep(t){const r=trailingFunctionArgument(arguments);const i=getTrailingOptions(arguments);for(const t of Pe){if(i.includes(t)){return this._runTask(configurationErrorTask(`git.grep: use of "${t}" is not supported.`),r)}}if(typeof t==="string"){t=grepQueryBuilder().param(t)}const o=["grep","--null","-n","--full-name",...i,...t];return this._runTask({commands:o,format:"utf-8",parser(t){return parseGrep(t)}},r)}}}var Pe,xe,Ee,Oe;var Ae=__esm({"src/lib/tasks/grep.ts"(){X();he();Pe=["-h"];xe=Symbol("grepQuery");Oe=class{constructor(){this[Ee]=[]}*[(Ee=xe,Symbol.iterator)](){for(const t of this[xe]){yield t}}and(...t){t.length&&this[xe].push("--and","(",...prefixedArray(t,"-e"),")");return this}param(...t){this[xe].push(...prefixedArray(t,"-e"));return this}}}});var Ie={};__export(Ie,{ResetMode:()=>De,getResetMode:()=>getResetMode,resetTask:()=>resetTask});function resetTask(t,r){const i=["reset"];if(isValidResetMode(t)){i.push(`--${t}`)}i.push(...r);return straightThroughStringTask(i)}function getResetMode(t){if(isValidResetMode(t)){return t}switch(typeof t){case"string":case"undefined":return"soft"}return}function isValidResetMode(t){return Be.includes(t)}var De,Be;var We=__esm({"src/lib/tasks/reset.ts"(){he();De=(t=>{t["MIXED"]="mixed";t["SOFT"]="soft";t["HARD"]="hard";t["MERGE"]="merge";t["KEEP"]="keep";return t})(De||{});Be=Array.from(Object.values(De))}});function createLog(){return l("simple-git")}function prefixedLogger(t,r,i){if(!r||!String(r).replace(/\s*/,"")){return!i?t:(r,...o)=>{t(r,...o);i(r,...o)}}return(o,...a)=>{t(`%s ${o}`,r,...a);if(i){i(o,...a)}}}function childLoggerName(t,r,{namespace:i}){if(typeof t==="string"){return t}const o=r&&r.namespace||"";if(o.startsWith(i)){return o.substr(i.length+1)}return o||i}function createLogger(t,r,i,o=createLog()){const a=t&&`[${t}]`||"";const l=[];const u=typeof r==="string"?o.extend(r):r;const c=childLoggerName(filterType(r,W),u,o);return step(i);function sibling(r,i){return append(l,createLogger(t,c.replace(/^[^:]+/,r),i,o))}function step(r){const i=r&&`[${r}]`||"";const l=u&&prefixedLogger(u,i)||A;const c=prefixedLogger(o,`${a} ${i}`,l);return Object.assign(u?l:c,{label:t,sibling:sibling,info:c,step:step})}}var je=__esm({"src/lib/git-logger.ts"(){X();l.formatters.L=t=>String($(t)?t.length:"-");l.formatters.B=t=>{if(Buffer.isBuffer(t)){return t.toString("utf8")}return I(t)}}});var Fe,Me;var $e=__esm({"src/lib/runners/tasks-pending-queue.ts"(){C();je();Fe=class{constructor(t="GitExecutor"){this.logLabel=t;this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){const r=Fe.getName(t.commands[0]);const i=createLogger(this.logLabel,r);return{task:t,logger:i,name:r}}push(t){const r=this.createProgress(t);r.logger("Adding task to the queue, commands = %o",t.commands);this._queue.set(t,r);return r}fatal(t){for(const[r,{logger:i}]of Array.from(this._queue.entries())){if(r===t.task){i.info(`Failed %o`,t);i(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)}else{i.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,t.message)}this.complete(r)}if(this._queue.size!==0){throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}}complete(t){const r=this.withProgress(t);if(r){this._queue.delete(t)}}attempt(t){const r=this.withProgress(t);if(!r){throw new _(void 0,"TasksPendingQueue: attempt called for an unknown task")}r.logger("Starting task");return r}static getName(t="empty"){return`task:${t}:${++Fe.counter}`}};Me=Fe;Me.counter=0}});function pluginContext(t,r){return{method:first(t.commands)||"",commands:r}}function onErrorReceived(t,r){return i=>{r(`[ERROR] child process exception %o`,i);t.push(Buffer.from(String(i.stack),"ascii"))}}function onDataReceived(t,r,i,o){return a=>{i(`%s received %L bytes`,r,a);o(`%B`,a);t.push(a)}}var qe;var Le=__esm({"src/lib/runners/git-executor-chain.ts"(){C();he();X();$e();qe=class{constructor(t,r,i){this._executor=t;this._scheduler=r;this._plugins=i;this._chain=Promise.resolve();this._queue=new Me}get binary(){return this._executor.binary}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){this._queue.push(t);return this._chain=this._chain.then((()=>this.attemptTask(t)))}attemptTask(t){return __async(this,null,(function*(){const r=yield this._scheduler.next();const onQueueComplete=()=>this._queue.complete(t);try{const{logger:r}=this._queue.attempt(t);return yield isEmptyTask(t)?this.attemptEmptyTask(t,r):this.attemptRemoteTask(t,r)}catch(r){throw this.onFatalException(t,r)}finally{onQueueComplete();r()}}))}onFatalException(t,r){const i=r instanceof _?Object.assign(r,{task:t}):new _(t,r&&String(r));this._chain=Promise.resolve();this._queue.fatal(i);return i}attemptRemoteTask(t,r){return __async(this,null,(function*(){const i=this._plugins.exec("spawn.args",[...t.commands],pluginContext(t,t.commands));const o=yield this.gitResponse(t,this.binary,i,this.outputHandler,r.step("SPAWN"));const a=yield this.handleTaskData(t,i,o,r.step("HANDLE"));r(`passing response to task's parser as a %s`,t.format);if(isBufferTask(t)){return callTaskParser(t.parser,a)}return callTaskParser(t.parser,a.asStrings())}))}attemptEmptyTask(t,r){return __async(this,null,(function*(){r(`empty task bypassing child process to call to task's parser`);return t.parser(this)}))}handleTaskData(t,r,i,o){const{exitCode:a,rejection:l,stdOut:u,stdErr:c}=i;return new Promise(((d,h)=>{o(`Preparing to handle process response exitCode=%d stdOut=`,a);const{error:p}=this._plugins.exec("task.error",{error:l},__spreadValues(__spreadValues({},pluginContext(t,r)),i));if(p&&t.onError){o.info(`exitCode=%s handling with custom error handler`);return t.onError(i,p,(t=>{o.info(`custom error handler treated as success`);o(`custom error returned a %s`,I(t));d(new U(Array.isArray(t)?Buffer.concat(t):t,Buffer.concat(c)))}),h)}if(p){o.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,a,c.length,l);return h(p)}o.info(`retrieving task output complete`);d(new U(Buffer.concat(u),Buffer.concat(c)))}))}gitResponse(t,r,i,o,a){return __async(this,null,(function*(){const l=a.sibling("output");const c=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:true},pluginContext(t,t.commands));return new Promise((d=>{const h=[];const p=[];a.info(`%s %o`,r,i);a("%O",c);let m=this._beforeSpawn(t,i);if(m){return d({stdOut:h,stdErr:p,exitCode:9901,rejection:m})}this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(t,i)),{kill(t){m=t||m}}));const g=(0,u.spawn)(r,i,c);g.stdout.on("data",onDataReceived(h,"stdOut",a,l.step("stdOut")));g.stderr.on("data",onDataReceived(p,"stdErr",a,l.step("stdErr")));g.on("error",onErrorReceived(p,a));if(o){a(`Passing child process stdOut/stdErr to custom outputHandler`);o(r,g.stdout,g.stderr,[...i])}this._plugins.exec("spawn.after",void 0,__spreadProps(__spreadValues({},pluginContext(t,i)),{spawned:g,close(t,r){d({stdOut:h,stdErr:p,exitCode:t,rejection:m||r})},kill(t){if(g.killed){return}m=t;g.kill("SIGINT")}}))}))}))}_beforeSpawn(t,r){let i;this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(t,r)),{kill(t){i=t||i}}));return i}}}});var Ne={};__export(Ne,{GitExecutor:()=>Ue});var Ue;var ze=__esm({"src/lib/runners/git-executor.ts"(){Le();Ue=class{constructor(t="git",r,i,o){this.binary=t;this.cwd=r;this._scheduler=i;this._plugins=o;this._chain=new qe(this,this._scheduler,this._plugins)}chain(){return new qe(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function taskCallback(t,r,i=A){const onSuccess=t=>{i(null,t)};const onError2=r=>{if((r==null?void 0:r.task)===t){i(r instanceof T?addDeprecationNoticeToError(r):r,void 0)}};r.then(onSuccess,onError2)}function addDeprecationNoticeToError(t){let log=t=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${t} should be GitResponseError.git.${t}, this will no longer be available in version 3`);log=A};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(descriptorReducer,{}));function descriptorReducer(r,i){if(i in t){return r}r[i]={enumerable:false,configurable:false,get(){log(i);return t.git[i]}};return r}}var Ge=__esm({"src/lib/task-callback.ts"(){k();X()}});function changeWorkingDirectoryTask(t,r){return adhocExecTask((i=>{if(!folderExists(t)){throw new Error(`Git.cwd: cannot change to non-directory "${t}"`)}return(r||i).cwd=t}))}var He=__esm({"src/lib/tasks/change-working-directory.ts"(){X();he()}});function checkoutTask(t){const r=["checkout",...t];if(r[1]==="-b"&&r.includes("-B")){r[1]=remove(r,"-B")}return straightThroughStringTask(r)}function checkout_default(){return{checkout(){return this._runTask(checkoutTask(getTrailingOptions(arguments,1)),trailingFunctionArgument(arguments))},checkoutBranch(t,r){return this._runTask(checkoutTask(["-b",t,r,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))},checkoutLocalBranch(t){return this._runTask(checkoutTask(["-b",t,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}}}var Ye=__esm({"src/lib/tasks/checkout.ts"(){X();he()}});function parseCommitResult(t){const r={author:null,branch:"",commit:"",root:false,summary:{changes:0,insertions:0,deletions:0}};return parseStringResponse(r,Qe,t)}var Qe;var Ve=__esm({"src/lib/parsers/parse-commit.ts"(){X();Qe=[new G(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,((t,[r,i,o])=>{t.branch=r;t.commit=o;t.root=!!i})),new G(/\s*Author:\s(.+)/i,((t,[r])=>{const i=r.split("<");const o=i.pop();if(!o||!o.includes("@")){return}t.author={email:o.substr(0,o.length-1),name:i.join("<").trim()}})),new G(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,((t,[r,i,o])=>{t.summary.changes=parseInt(r,10)||0;t.summary.insertions=parseInt(i,10)||0;t.summary.deletions=parseInt(o,10)||0})),new G(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,((t,[r,i,o])=>{t.summary.changes=parseInt(r,10)||0;const a=parseInt(i,10)||0;if(o==="-"){t.summary.deletions=a}else if(o==="+"){t.summary.insertions=a}}))]}});function commitTask(t,r,i){const o=["-c","core.abbrev=40","commit",...prefixedArray(t,"-m"),...r,...i];return{commands:o,format:"utf-8",parser:parseCommitResult}}function commit_default(){return{commit(t,...r){const i=trailingFunctionArgument(arguments);const o=rejectDeprecatedSignatures(t)||commitTask(asArray(t),asArray(filterType(r[0],M,[])),[...filterType(r[1],B,[]),...getTrailingOptions(arguments,0,true)]);return this._runTask(o,i)}};function rejectDeprecatedSignatures(t){return!M(t)&&configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Je=__esm({"src/lib/tasks/commit.ts"(){Ve();X();he()}});function first_commit_default(){return{firstCommit(){return this._runTask(straightThroughStringTask(["rev-list","--max-parents=0","HEAD"],true),trailingFunctionArgument(arguments))}}}var Ke=__esm({"src/lib/tasks/first-commit.ts"(){X();he()}});function hashObjectTask(t,r){const i=["hash-object",t];if(r){i.push("-w")}return straightThroughStringTask(i,true)}var Ze=__esm({"src/lib/tasks/hash-object.ts"(){he()}});function parseInit(t,r,i){const o=String(i).trim();let a;if(a=et.exec(o)){return new Xe(t,r,false,a[1])}if(a=tt.exec(o)){return new Xe(t,r,true,a[1])}let l="";const u=o.split(" ");while(u.length){const t=u.shift();if(t==="in"){l=u.join(" ");break}}return new Xe(t,r,/^re/i.test(o),l)}var Xe,et,tt;var rt=__esm({"src/lib/responses/InitSummary.ts"(){Xe=class{constructor(t,r,i,o){this.bare=t;this.path=r;this.existing=i;this.gitDir=o}};et=/^Init.+ repository in (.+)$/;tt=/^Rein.+ in (.+)$/}});function hasBareCommand(t){return t.includes(st)}function initTask(t=false,r,i){const o=["init",...i];if(t&&!hasBareCommand(o)){o.splice(1,0,st)}return{commands:o,format:"utf-8",parser(t){return parseInit(o.includes("--bare"),r,t)}}}var st;var nt=__esm({"src/lib/tasks/init.ts"(){rt();st="--bare"}});function logFormatFromCommand(t){for(let r=0;r<t.length;r++){const i=it.exec(t[r]);if(i){return`--${i[1]}`}}return""}function isLogFormat(t){return it.test(t)}var it;var ot=__esm({"src/lib/args/log-format.ts"(){it=/^--(stat|numstat|name-only|name-status)(=|$)/}});var at;var lt=__esm({"src/lib/responses/DiffSummary.ts"(){at=class{constructor(){this.changed=0;this.deletions=0;this.insertions=0;this.files=[]}}}});function getDiffParser(t=""){const r=ft[t];return t=>parseStringResponse(new at,r,t,false)}var ut,ct,dt,ht,ft;var pt=__esm({"src/lib/parsers/parse-diff-summary.ts"(){ot();lt();ke();X();ut=[new G(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,((t,[r,i,o=""])=>{t.files.push({file:r.trim(),changes:asNumber(i),insertions:o.replace(/[^+]/g,"").length,deletions:o.replace(/[^-]/g,"").length,binary:false})})),new G(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,((t,[r,i,o])=>{t.files.push({file:r.trim(),before:asNumber(i),after:asNumber(o),binary:true})})),new G(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,((t,[r,i])=>{const o=/(\d+) i/.exec(i);const a=/(\d+) d/.exec(i);t.changed=asNumber(r);t.insertions=asNumber(o==null?void 0:o[1]);t.deletions=asNumber(a==null?void 0:a[1])}))];ct=[new G(/(\d+)\t(\d+)\t(.+)$/,((t,[r,i,o])=>{const a=asNumber(r);const l=asNumber(i);t.changed++;t.insertions+=a;t.deletions+=l;t.files.push({file:o,changes:a+l,insertions:a,deletions:l,binary:false})})),new G(/-\t-\t(.+)$/,((t,[r])=>{t.changed++;t.files.push({file:r,after:0,before:0,binary:true})}))];dt=[new G(/(.+)$/,((t,[r])=>{t.changed++;t.files.push({file:r,changes:0,insertions:0,deletions:0,binary:false})}))];ht=[new G(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,((t,[r,i,o,a,l])=>{t.changed++;t.files.push({file:l!=null?l:o,changes:0,status:orVoid(isDiffNameStatus(r)&&r),insertions:0,deletions:0,binary:false})}))];ft={[""]:ut,["--stat"]:ut,["--numstat"]:ct,["--name-status"]:ht,["--name-only"]:dt}}});function lineBuilder(t,r){return r.reduce(((r,i,o)=>{r[i]=t[o]||"";return r}),Object.create({diff:null}))}function createListLogSummaryParser(t=bt,r=yt,i=""){const o=getDiffParser(i);return function(i){const a=toLinesWithContent(i,true,mt).map((function(i){const a=i.trim().split(gt);const l=lineBuilder(a[0].trim().split(t),r);if(a.length>1&&!!a[1].trim()){l.diff=o(a[1])}return l}));return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var mt,gt,bt,yt;var St=__esm({"src/lib/parsers/parse-list-log-summary.ts"(){X();pt();ot();mt="òòòòòò ";gt=" òò";bt=" ò ";yt=["hash","date","message","refs","author_name","author_email"]}});var wt={};__export(wt,{diffSummaryTask:()=>diffSummaryTask,validateLogFormatConfig:()=>validateLogFormatConfig});function diffSummaryTask(t){let r=logFormatFromCommand(t);const i=["diff"];if(r===""){r="--stat";i.push("--stat=4096")}i.push(...t);return validateLogFormatConfig(i)||{commands:i,format:"utf-8",parser:getDiffParser(r)}}function validateLogFormatConfig(t){const r=t.filter(isLogFormat);if(r.length>1){return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${r.join(",")}`)}if(r.length&&t.includes("-z")){return configurationErrorTask(`Summary flag ${r} parsing is not compatible with null termination option '-z'`)}}var vt=__esm({"src/lib/tasks/diff.ts"(){ot();pt();he()}});function prettyFormat(t,r){const i=[];const o=[];Object.keys(t).forEach((r=>{i.push(r);o.push(String(t[r]))}));return[i,o.join(r)]}function userOptions(t){return Object.keys(t).reduce(((r,i)=>{if(!(i in Rt)){r[i]=t[i]}return r}),{})}function parseLogOptions(t={},r=[]){const i=filterType(t.splitter,W,bt);const o=!filterPrimitives(t.format)&&t.format?t.format:{hash:"%H",date:t.strictDate===false?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==false?"%aN":"%an",author_email:t.mailMap!==false?"%aE":"%ae"};const[a,l]=prettyFormat(o,i);const u=[];const c=[`--pretty=format:${mt}${l}${gt}`,...r];const d=t.n||t["max-count"]||t.maxCount;if(d){c.push(`--max-count=${d}`)}if(t.from||t.to){const r=t.symmetric!==false?"...":"..";u.push(`${t.from||""}${r}${t.to||""}`)}if(W(t.file)){c.push("--follow",pathspec(t.file))}appendTaskOptions(userOptions(t),c);return{fields:a,splitter:i,commands:[...c,...u]}}function logTask(t,r,i){const o=createListLogSummaryParser(t,r,logFormatFromCommand(i));return{commands:["log",...i],format:"utf-8",parser:o}}function log_default(){return{log(...t){const r=trailingFunctionArgument(arguments);const i=parseLogOptions(trailingOptionsArgument(arguments),filterType(arguments[0],B));const o=rejectDeprecatedSignatures(...t)||validateLogFormatConfig(i.commands)||createLogTask(i);return this._runTask(o,r)}};function createLogTask(t){return logTask(t.splitter,t.fields,t.commands)}function rejectDeprecatedSignatures(t,r){return W(t)&&W(r)&&configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var Rt;var _t=__esm({"src/lib/tasks/log.ts"(){ot();R();St();X();he();vt();Rt=(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";return t})(Rt||{})}});var Ct,Tt;var kt=__esm({"src/lib/responses/MergeSummary.ts"(){Ct=class{constructor(t,r=null,i){this.reason=t;this.file=r;this.meta=i}toString(){return`${this.file}:${this.reason}`}};Tt=class{constructor(){this.conflicts=[];this.merges=[];this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){if(this.conflicts.length){return`CONFLICTS: ${this.conflicts.join(", ")}`}return"OK"}}}});var Pt,xt;var Et=__esm({"src/lib/responses/PullSummary.ts"(){Pt=class{constructor(){this.remoteMessages={all:[]};this.created=[];this.deleted=[];this.files=[];this.deletions={};this.insertions={};this.summary={changes:0,deletions:0,insertions:0}}};xt=class{constructor(){this.remote="";this.hash={local:"",remote:""};this.branch={local:"",remote:""};this.message=""}toString(){return this.message}}}});function objectEnumerationResult(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 asObjectCount(t){const r=/^\s*(\d+)/.exec(t);const i=/delta (\d+)/i.exec(t);return{count:asNumber(r&&r[1]||"0"),delta:asNumber(i&&i[1]||"0")}}var Ot;var At=__esm({"src/lib/parsers/parse-remote-objects.ts"(){X();Ot=[new H(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,((t,[r,i])=>{const o=r.toLowerCase();const a=objectEnumerationResult(t.remoteMessages);Object.assign(a,{[o]:asNumber(i)})})),new H(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,((t,[r,i])=>{const o=r.toLowerCase();const a=objectEnumerationResult(t.remoteMessages);Object.assign(a,{[o]:asNumber(i)})})),new H(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,((t,[r,i,o])=>{const a=objectEnumerationResult(t.remoteMessages);a.total=asObjectCount(r);a.reused=asObjectCount(i);a.packReused=asNumber(o)}))]}});function parseRemoteMessages(t,r){return parseStringResponse({remoteMessages:new Dt},It,r)}var It,Dt;var Bt=__esm({"src/lib/parsers/parse-remote-messages.ts"(){X();At();It=[new H(/^remote:\s*(.+)$/,((t,[r])=>{t.remoteMessages.all.push(r.trim());return false})),...Ot,new H([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],((t,[r])=>{t.remoteMessages.pullRequestUrl=r})),new H([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],((t,[r,i,o])=>{t.remoteMessages.vulnerabilities={count:asNumber(r),summary:i,url:o}}))];Dt=class{constructor(){this.all=[]}}}});function parsePullErrorResult(t,r){const i=parseStringResponse(new xt,$t,[t,r]);return i.message&&i}var Wt,jt,Ft,Mt,$t,qt,Lt;var Nt=__esm({"src/lib/parsers/parse-pull.ts"(){Et();X();Bt();Wt=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;jt=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;Ft=/^(create|delete) mode \d+ (.+)/;Mt=[new G(Wt,((t,[r,i,o])=>{t.files.push(r);if(i){t.insertions[r]=i.length}if(o){t.deletions[r]=o.length}})),new G(jt,((t,[r,,i,,o])=>{if(i!==void 0||o!==void 0){t.summary.changes=+r||0;t.summary.insertions=+i||0;t.summary.deletions=+o||0;return true}return false})),new G(Ft,((t,[r,i])=>{append(t.files,i);append(r==="create"?t.created:t.deleted,i)}))];$t=[new G(/^from\s(.+)$/i,((t,[r])=>void(t.remote=r))),new G(/^fatal:\s(.+)$/,((t,[r])=>void(t.message=r))),new G(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,((t,[r,i,o,a])=>{t.branch.local=o;t.hash.local=r;t.branch.remote=a;t.hash.remote=i}))];qt=(t,r)=>parseStringResponse(new Pt,Mt,[t,r]);Lt=(t,r)=>Object.assign(new Pt,qt(t,r),parseRemoteMessages(t,r))}});var Ut,zt,Gt;var Ht=__esm({"src/lib/parsers/parse-merge.ts"(){kt();X();Nt();Ut=[new G(/^Auto-merging\s+(.+)$/,((t,[r])=>{t.merges.push(r)})),new G(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,((t,[r,i])=>{t.conflicts.push(new Ct(r,i))})),new G(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,((t,[r,i,o])=>{t.conflicts.push(new Ct(r,i,{deleteRef:o}))})),new G(/^CONFLICT\s+\((.+)\):/,((t,[r])=>{t.conflicts.push(new Ct(r,null))})),new G(/^Automatic merge failed;\s+(.+)$/,((t,[r])=>{t.result=r}))];zt=(t,r)=>Object.assign(Gt(t,r),Lt(t,r));Gt=t=>parseStringResponse(new Tt,Ut,t)}});function mergeTask(t){if(!t.length){return configurationErrorTask("Git.merge requires at least one option")}return{commands:["merge",...t],format:"utf-8",parser(t,r){const i=zt(t,r);if(i.failed){throw new T(i)}return i}}}var Yt=__esm({"src/lib/tasks/merge.ts"(){k();Ht();he()}});function pushResultPushedItem(t,r,i){const o=i.includes("deleted");const a=i.includes("tag")||/^refs\/tags/.test(t);const l=!i.includes("new");return{deleted:o,tag:a,branch:!a,new:!l,alreadyUpdated:l,local:t,remote:r}}var Qt,Vt,Jt;var Kt=__esm({"src/lib/parsers/parse-push.ts"(){X();Bt();Qt=[new G(/^Pushing to (.+)$/,((t,[r])=>{t.repo=r})),new G(/^updating local tracking ref '(.+)'/,((t,[r])=>{t.ref=__spreadProps(__spreadValues({},t.ref||{}),{local:r})})),new G(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,((t,[r,i,o])=>{t.pushed.push(pushResultPushedItem(r,i,o))})),new G(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,((t,[r,i,o])=>{t.branch=__spreadProps(__spreadValues({},t.branch||{}),{local:r,remote:i,remoteName:o})})),new G(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,((t,[r,i,o,a])=>{t.update={head:{local:r,remote:i},hash:{from:o,to:a}}}))];Vt=(t,r)=>{const i=Jt(t,r);const o=parseRemoteMessages(t,r);return __spreadValues(__spreadValues({},i),o)};Jt=(t,r)=>parseStringResponse({pushed:[]},Qt,[t,r])}});var Zt={};__export(Zt,{pushTagsTask:()=>pushTagsTask,pushTask:()=>pushTask});function pushTagsTask(t={},r){append(r,"--tags");return pushTask(t,r)}function pushTask(t={},r){const i=["push",...r];if(t.branch){i.splice(1,0,t.branch)}if(t.remote){i.splice(1,0,t.remote)}remove(i,"-v");append(i,"--verbose");append(i,"--porcelain");return{commands:i,format:"utf-8",parser:Vt}}var Xt=__esm({"src/lib/tasks/push.ts"(){Kt();X()}});function show_default(){return{showBuffer(){const t=["show",...getTrailingOptions(arguments,1)];if(!t.includes("--binary")){t.splice(1,0,"--binary")}return this._runTask(straightThroughBufferTask(t),trailingFunctionArgument(arguments))},show(){const t=["show",...getTrailingOptions(arguments,1)];return this._runTask(straightThroughStringTask(t),trailingFunctionArgument(arguments))}}}var er=__esm({"src/lib/tasks/show.ts"(){X();he()}});var tr,rr;var sr=__esm({"src/lib/responses/FileStatusSummary.ts"(){tr=/^(.+) -> (.+)$/;rr=class{constructor(t,r,i){this.path=t;this.index=r;this.working_dir=i;if(r+i==="R"){const r=tr.exec(t)||[null,t,t];this.from=r[1]||"";this.path=r[2]||""}}}}});function renamedFile(t){const[r,i]=t.split(O);return{from:i||r,to:r}}function parser2(t,r,i){return[`${t}${r}`,i]}function conflicts(t,...r){return r.map((r=>parser2(t,r,((t,r)=>append(t.conflicted,r)))))}function splitLine(t,r){const i=r.trim();switch(" "){case i.charAt(2):return data(i.charAt(0),i.charAt(1),i.substr(3));case i.charAt(1):return data(" ",i.charAt(0),i.substr(2));default:return}function data(r,i,o){const a=`${r}${i}`;const l=ir.get(a);if(l){l(t,o)}if(a!=="##"&&a!=="!!"){t.files.push(new rr(o.replace(/\0.+$/,""),r,i))}}}var nr,ir,or;var ar=__esm({"src/lib/responses/StatusSummary.ts"(){X();sr();nr=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=false;this.isClean=()=>!this.files.length}};ir=new Map([parser2(" ","A",((t,r)=>append(t.created,r))),parser2(" ","D",((t,r)=>append(t.deleted,r))),parser2(" ","M",((t,r)=>append(t.modified,r))),parser2("A"," ",((t,r)=>append(t.created,r)&&append(t.staged,r))),parser2("A","M",((t,r)=>append(t.created,r)&&append(t.staged,r)&&append(t.modified,r))),parser2("D"," ",((t,r)=>append(t.deleted,r)&&append(t.staged,r))),parser2("M"," ",((t,r)=>append(t.modified,r)&&append(t.staged,r))),parser2("M","M",((t,r)=>append(t.modified,r)&&append(t.staged,r))),parser2("R"," ",((t,r)=>{append(t.renamed,renamedFile(r))})),parser2("R","M",((t,r)=>{const i=renamedFile(r);append(t.renamed,i);append(t.modified,i.to)})),parser2("!","!",((t,r)=>{append(t.ignored=t.ignored||[],r)})),parser2("?","?",((t,r)=>append(t.not_added,r))),...conflicts("A","A","U"),...conflicts("D","D","U"),...conflicts("U","A","D","U"),["##",(t,r)=>{const i=/ahead (\d+)/;const o=/behind (\d+)/;const a=/^(.+?(?=(?:\.{3}|\s|$)))/;const l=/\.{3}(\S*)/;const u=/\son\s([\S]+)$/;let c;c=i.exec(r);t.ahead=c&&+c[1]||0;c=o.exec(r);t.behind=c&&+c[1]||0;c=a.exec(r);t.current=c&&c[1];c=l.exec(r);t.tracking=c&&c[1];c=u.exec(r);t.current=c&&c[1]||t.current;t.detached=/\(no branch\)/.test(r)}]]);or=function(t){const r=t.split(O);const i=new nr;for(let t=0,o=r.length;t<o;){let o=r[t++].trim();if(!o){continue}if(o.charAt(0)==="R"){o+=O+(r[t++]||"")}splitLine(i,o)}return i}}});function statusTask(t){const r=["status","--porcelain","-b","-u","--null",...t.filter((t=>!lr.includes(t)))];return{format:"utf-8",commands:r,parser(t){return or(t)}}}var lr;var ur=__esm({"src/lib/tasks/status.ts"(){ar();lr=["--null","-z"]}});function versionResponse(t=0,r=0,i=0,o="",a=true){return Object.defineProperty({major:t,minor:r,patch:i,agent:o,installed:a},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:false,enumerable:false})}function notInstalledResponse(){return versionResponse(0,0,0,"",false)}function version_default(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:versionParser,onError(t,r,i,o){if(t.exitCode===-2){return i(Buffer.from(cr))}o(r)}})}}}function versionParser(t){if(t===cr){return notInstalledResponse()}return parseStringResponse(versionResponse(0,0,0,t),dr,t)}var cr,dr;var hr=__esm({"src/lib/tasks/version.ts"(){X();cr="installed=false";dr=[new G(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,((t,[r,i,o,a=""])=>{Object.assign(t,versionResponse(asNumber(r),asNumber(i),asNumber(o),a))})),new G(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,((t,[r,i,o,a=""])=>{Object.assign(t,versionResponse(asNumber(r),asNumber(i),o,a))}))]}});var fr={};__export(fr,{SimpleGitApi:()=>pr});var pr;var mr=__esm({"src/lib/simple-git-api.ts"(){Ge();He();Ye();Je();_e();Ke();Ae();Ze();nt();_t();Yt();Xt();er();ur();he();hr();X();pr=class{constructor(t){this._executor=t}_runTask(t,r){const i=this._executor.chain();const o=i.push(t);if(r){taskCallback(t,o,r)}return Object.create(this,{then:{value:o.then.bind(o)},catch:{value:o.catch.bind(o)},_executor:{value:i}})}add(t){return this._runTask(straightThroughStringTask(["add",...asArray(t)]),trailingFunctionArgument(arguments))}cwd(t){const r=trailingFunctionArgument(arguments);if(typeof t==="string"){return this._runTask(changeWorkingDirectoryTask(t,this._executor),r)}if(typeof(t==null?void 0:t.path)==="string"){return this._runTask(changeWorkingDirectoryTask(t.path,t.root&&this._executor||void 0),r)}return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),r)}hashObject(t,r){return this._runTask(hashObjectTask(t,r===true),trailingFunctionArgument(arguments))}init(t){return this._runTask(initTask(t===true,this._executor.cwd,getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}merge(){return this._runTask(mergeTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}mergeFromTo(t,r){if(!(W(t)&&W(r))){return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}return this._runTask(mergeTask([t,r,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments,false))}outputHandler(t){this._executor.outputHandler=t;return this}push(){const t=pushTask({remote:filterType(arguments[0],W),branch:filterType(arguments[1],W)},getTrailingOptions(arguments));return this._runTask(t,trailingFunctionArgument(arguments))}stash(){return this._runTask(straightThroughStringTask(["stash",...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}status(){return this._runTask(statusTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}};Object.assign(pr.prototype,checkout_default(),commit_default(),config_default(),first_commit_default(),grep_default(),log_default(),show_default(),version_default())}});var gr={};__export(gr,{Scheduler:()=>yr});var br,yr;var Sr=__esm({"src/lib/runners/scheduler.ts"(){X();je();br=(()=>{let t=0;return()=>{t++;const{promise:r,done:i}=(0,c.dD)();return{promise:r,done:i,id:t}}})();yr=class{constructor(t=2){this.concurrency=t;this.logger=createLogger("","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}const t=append(this.running,this.pending.shift());this.logger(`Attempting id=%s`,t.id);t.done((()=>{this.logger(`Completing id=`,t.id);remove(this.running,t);this.schedule()}))}next(){const{promise:t,id:r}=append(this.pending,br());this.logger(`Scheduling id=%s`,r);this.schedule();return t}}}});var wr={};__export(wr,{applyPatchTask:()=>applyPatchTask});function applyPatchTask(t,r){return straightThroughStringTask(["apply",...r,...t])}var vr=__esm({"src/lib/tasks/apply-patch.ts"(){he()}});function branchDeletionSuccess(t,r){return{branch:t,hash:r,success:true}}function branchDeletionFailure(t){return{branch:t,hash:null,success:false}}var Rr;var _r=__esm({"src/lib/responses/BranchDeleteSummary.ts"(){Rr=class{constructor(){this.all=[];this.branches={};this.errors=[]}get success(){return!this.errors.length}}}});function hasBranchDeletionError(t,r){return r===1&&Tr.test(t)}var Cr,Tr,kr,Pr;var xr=__esm({"src/lib/parsers/parse-branch-delete.ts"(){_r();X();Cr=/(\S+)\s+\(\S+\s([^)]+)\)/;Tr=/^error[^']+'([^']+)'/m;kr=[new G(Cr,((t,[r,i])=>{const o=branchDeletionSuccess(r,i);t.all.push(o);t.branches[r]=o})),new G(Tr,((t,[r])=>{const i=branchDeletionFailure(r);t.errors.push(i);t.all.push(i);t.branches[r]=i}))];Pr=(t,r)=>parseStringResponse(new Rr,kr,[t,r])}});var Er;var Or=__esm({"src/lib/responses/BranchSummary.ts"(){Er=class{constructor(){this.all=[];this.branches={};this.current="";this.detached=false}push(t,r,i,o,a){if(t==="*"){this.detached=r;this.current=i}this.all.push(i);this.branches[i]={current:t==="*",linkedWorkTree:t==="+",name:i,commit:o,label:a}}}}});function branchStatus(t){return t?t.charAt(0):""}function parseBranchSummary(t){return parseStringResponse(new Er,Ar,t)}var Ar;var Ir=__esm({"src/lib/parsers/parse-branch.ts"(){Or();X();Ar=[new G(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,((t,[r,i,o,a])=>{t.push(branchStatus(r),true,i,o,a)})),new G(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,((t,[r,i,o,a])=>{t.push(branchStatus(r),false,i,o,a)}))]}});var Dr={};__export(Dr,{branchLocalTask:()=>branchLocalTask,branchTask:()=>branchTask,containsDeleteBranchCommand:()=>containsDeleteBranchCommand,deleteBranchTask:()=>deleteBranchTask,deleteBranchesTask:()=>deleteBranchesTask});function containsDeleteBranchCommand(t){const r=["-d","-D","--delete"];return t.some((t=>r.includes(t)))}function branchTask(t){const r=containsDeleteBranchCommand(t);const i=["branch",...t];if(i.length===1){i.push("-a")}if(!i.includes("-v")){i.splice(1,0,"-v")}return{format:"utf-8",commands:i,parser(t,i){if(r){return Pr(t,i).all[0]}return parseBranchSummary(t)}}}function branchLocalTask(){const t=parseBranchSummary;return{format:"utf-8",commands:["branch","-v"],parser:t}}function deleteBranchesTask(t,r=false){return{format:"utf-8",commands:["branch","-v",r?"-D":"-d",...t],parser(t,r){return Pr(t,r)},onError({exitCode:t,stdOut:r},i,o,a){if(!hasBranchDeletionError(String(i),t)){return a(i)}o(r)}}}function deleteBranchTask(t,r=false){const i={format:"utf-8",commands:["branch","-v",r?"-D":"-d",t],parser(r,i){return Pr(r,i).branches[t]},onError({exitCode:t,stdErr:r,stdOut:o},a,l,u){if(!hasBranchDeletionError(String(a),t)){return u(a)}throw new T(i.parser(bufferToString(o),bufferToString(r)),String(a))}};return i}var Br=__esm({"src/lib/tasks/branch.ts"(){k();xr();Ir();X()}});var Wr;var jr=__esm({"src/lib/responses/CheckIgnore.ts"(){Wr=t=>t.split(/\n/g).map((t=>t.trim())).filter((t=>!!t))}});var Fr={};__export(Fr,{checkIgnoreTask:()=>checkIgnoreTask});function checkIgnoreTask(t){return{commands:["check-ignore",...t],format:"utf-8",parser:Wr}}var Mr=__esm({"src/lib/tasks/check-ignore.ts"(){jr()}});var $r={};__export($r,{cloneMirrorTask:()=>cloneMirrorTask,cloneTask:()=>cloneTask});function disallowedCommand(t){return/^--upload-pack(=|$)/.test(t)}function cloneTask(t,r,i){const o=["clone",...i];W(t)&&o.push(t);W(r)&&o.push(r);const a=o.find(disallowedCommand);if(a){return configurationErrorTask(`git.fetch: potential exploit argument blocked.`)}return straightThroughStringTask(o)}function cloneMirrorTask(t,r,i){append(i,"--mirror");return cloneTask(t,r,i)}var qr=__esm({"src/lib/tasks/clone.ts"(){he();X()}});function parseFetchResult(t,r){const i={raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]};return parseStringResponse(i,Lr,[t,r])}var Lr;var Nr=__esm({"src/lib/parsers/parse-fetch.ts"(){X();Lr=[new G(/From (.+)$/,((t,[r])=>{t.remote=r})),new G(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,((t,[r,i])=>{t.branches.push({name:r,tracking:i})})),new G(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,((t,[r,i])=>{t.tags.push({name:r,tracking:i})})),new G(/- \[deleted]\s+\S+\s*-> (.+)$/,((t,[r])=>{t.deleted.push({tracking:r})})),new G(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,((t,[r,i,o,a])=>{t.updated.push({name:o,tracking:a,to:i,from:r})}))]}});var Ur={};__export(Ur,{fetchTask:()=>fetchTask});function disallowedCommand2(t){return/^--upload-pack(=|$)/.test(t)}function fetchTask(t,r,i){const o=["fetch",...i];if(t&&r){o.push(t,r)}const a=o.find(disallowedCommand2);if(a){return configurationErrorTask(`git.fetch: potential exploit argument blocked.`)}return{commands:o,format:"utf-8",parser:parseFetchResult}}var zr=__esm({"src/lib/tasks/fetch.ts"(){Nr();he()}});function parseMoveResult(t){return parseStringResponse({moves:[]},Gr,t)}var Gr;var Hr=__esm({"src/lib/parsers/parse-move.ts"(){X();Gr=[new G(/^Renaming (.+) to (.+)$/,((t,[r,i])=>{t.moves.push({from:r,to:i})}))]}});var Yr={};__export(Yr,{moveTask:()=>moveTask});function moveTask(t,r){return{commands:["mv","-v",...asArray(t),r],format:"utf-8",parser:parseMoveResult}}var Qr=__esm({"src/lib/tasks/move.ts"(){Hr();X()}});var Vr={};__export(Vr,{pullTask:()=>pullTask});function pullTask(t,r,i){const o=["pull",...i];if(t&&r){o.splice(1,0,t,r)}return{commands:o,format:"utf-8",parser(t,r){return Lt(t,r)},onError(t,r,i,o){const a=parsePullErrorResult(bufferToString(t.stdOut),bufferToString(t.stdErr));if(a){return o(new T(a))}o(r)}}}var Jr=__esm({"src/lib/tasks/pull.ts"(){k();Nt();X()}});function parseGetRemotes(t){const r={};forEach(t,(([t])=>r[t]={name:t}));return Object.values(r)}function parseGetRemotesVerbose(t){const r={};forEach(t,(([t,i,o])=>{if(!r.hasOwnProperty(t)){r[t]={name:t,refs:{fetch:"",push:""}}}if(o&&i){r[t].refs[o.replace(/[^a-z]/g,"")]=i}}));return Object.values(r)}function forEach(t,r){forEachLineWithContent(t,(t=>r(t.split(/\s+/))))}var Kr=__esm({"src/lib/responses/GetRemoteSummary.ts"(){X()}});var Zr={};__export(Zr,{addRemoteTask:()=>addRemoteTask,getRemotesTask:()=>getRemotesTask,listRemotesTask:()=>listRemotesTask,remoteTask:()=>remoteTask,removeRemoteTask:()=>removeRemoteTask});function addRemoteTask(t,r,i=[]){return straightThroughStringTask(["remote","add",...i,t,r])}function getRemotesTask(t){const r=["remote"];if(t){r.push("-v")}return{commands:r,format:"utf-8",parser:t?parseGetRemotesVerbose:parseGetRemotes}}function listRemotesTask(t=[]){const r=[...t];if(r[0]!=="ls-remote"){r.unshift("ls-remote")}return straightThroughStringTask(r)}function remoteTask(t=[]){const r=[...t];if(r[0]!=="remote"){r.unshift("remote")}return straightThroughStringTask(r)}function removeRemoteTask(t){return straightThroughStringTask(["remote","remove",t])}var Xr=__esm({"src/lib/tasks/remote.ts"(){Kr();he()}});var es={};__export(es,{stashListTask:()=>stashListTask});function stashListTask(t={},r){const i=parseLogOptions(t);const o=["stash","list",...i.commands,...r];const a=createListLogSummaryParser(i.splitter,i.fields,logFormatFromCommand(o));return validateLogFormatConfig(o)||{commands:o,format:"utf-8",parser:a}}var ts=__esm({"src/lib/tasks/stash-list.ts"(){ot();St();vt();_t()}});var rs={};__export(rs,{addSubModuleTask:()=>addSubModuleTask,initSubModuleTask:()=>initSubModuleTask,subModuleTask:()=>subModuleTask,updateSubModuleTask:()=>updateSubModuleTask});function addSubModuleTask(t,r){return subModuleTask(["add",t,r])}function initSubModuleTask(t){return subModuleTask(["init",...t])}function subModuleTask(t){const r=[...t];if(r[0]!=="submodule"){r.unshift("submodule")}return straightThroughStringTask(r)}function updateSubModuleTask(t){return subModuleTask(["update",...t])}var ss=__esm({"src/lib/tasks/sub-module.ts"(){he()}});function singleSorted(t,r){const i=isNaN(t);const o=isNaN(r);if(i!==o){return i?1:-1}return i?sorted(t,r):0}function sorted(t,r){return t===r?0:t>r?1:-1}function trimmed(t){return t.trim()}function toNumber(t){if(typeof t==="string"){return parseInt(t.replace(/^\D+/g,""),10)||0}return 0}var ns,is;var os=__esm({"src/lib/responses/TagList.ts"(){ns=class{constructor(t,r){this.all=t;this.latest=r}};is=function(t,r=false){const i=t.split("\n").map(trimmed).filter(Boolean);if(!r){i.sort((function(t,r){const i=t.split(".");const o=r.split(".");if(i.length===1||o.length===1){return singleSorted(toNumber(i[0]),toNumber(o[0]))}for(let t=0,r=Math.max(i.length,o.length);t<r;t++){const r=sorted(toNumber(i[t]),toNumber(o[t]));if(r){return r}}return 0}))}const o=r?i[0]:[...i].reverse().find((t=>t.indexOf(".")>=0));return new ns(i,o)}}});var as={};__export(as,{addAnnotatedTagTask:()=>addAnnotatedTagTask,addTagTask:()=>addTagTask,tagListTask:()=>tagListTask});function tagListTask(t=[]){const r=t.some((t=>/^--sort=/.test(t)));return{format:"utf-8",commands:["tag","-l",...t],parser(t){return is(t,r)}}}function addTagTask(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function addAnnotatedTagTask(t,r){return{format:"utf-8",commands:["tag","-a","-m",r,t],parser(){return{name:t}}}}var ls=__esm({"src/lib/tasks/tag.ts"(){os()}});var us=__commonJS({"src/git.js"(t,r){var{GitExecutor:i}=(ze(),w(Ne));var{SimpleGitApi:o}=(mr(),w(fr));var{Scheduler:a}=(Sr(),w(gr));var{configurationErrorTask:l}=(he(),w(ce));var{asArray:u,filterArray:c,filterPrimitives:d,filterString:h,filterStringOrStringArray:p,filterType:m,getTrailingOptions:g,trailingFunctionArgument:b,trailingOptionsArgument:y}=(X(),w(Z));var{applyPatchTask:S}=(vr(),w(wr));var{branchTask:v,branchLocalTask:R,deleteBranchesTask:_,deleteBranchTask:C}=(Br(),w(Dr));var{checkIgnoreTask:T}=(Mr(),w(Fr));var{checkIsRepoTask:k}=(ne(),w(ee));var{cloneTask:P,cloneMirrorTask:E}=(qr(),w($r));var{cleanWithOptionsTask:O,isCleanOptionsArray:A}=(Se(),w(fe));var{diffSummaryTask:I}=(vt(),w(wt));var{fetchTask:D}=(zr(),w(Ur));var{moveTask:B}=(Qr(),w(Yr));var{pullTask:W}=(Jr(),w(Vr));var{pushTagsTask:j}=(Xt(),w(Zt));var{addRemoteTask:M,getRemotesTask:$,listRemotesTask:q,remoteTask:L,removeRemoteTask:N}=(Xr(),w(Zr));var{getResetMode:U,resetTask:z}=(We(),w(Ie));var{stashListTask:G}=(ts(),w(es));var{addSubModuleTask:H,initSubModuleTask:Y,subModuleTask:Q,updateSubModuleTask:V}=(ss(),w(rs));var{addAnnotatedTagTask:J,addTagTask:K,tagListTask:te}=(ls(),w(as));var{straightThroughBufferTask:re,straightThroughStringTask:se}=(he(),w(ce));function Git2(t,r){this._executor=new i(t.binary,t.baseDir,new a(t.maxConcurrentProcesses),r);this._trimmed=t.trimmed}(Git2.prototype=Object.create(o.prototype)).constructor=Git2;Git2.prototype.customBinary=function(t){this._executor.binary=t;return this};Git2.prototype.env=function(t,r){if(arguments.length===1&&typeof t==="object"){this._executor.env=t}else{(this._executor.env=this._executor.env||{})[t]=r}return this};Git2.prototype.stashList=function(t){return this._runTask(G(y(arguments)||{},c(t)&&t||[]),b(arguments))};function createCloneTask(t,r,i,o){if(typeof i!=="string"){return l(`git.${t}() requires a string 'repoPath'`)}return r(i,m(o,h),g(arguments))}Git2.prototype.clone=function(){return this._runTask(createCloneTask("clone",P,...arguments),b(arguments))};Git2.prototype.mirror=function(){return this._runTask(createCloneTask("mirror",E,...arguments),b(arguments))};Git2.prototype.mv=function(t,r){return this._runTask(B(t,r),b(arguments))};Git2.prototype.checkoutLatestTag=function(t){var r=this;return this.pull((function(){r.tags((function(i,o){r.checkout(o.latest,t)}))}))};Git2.prototype.pull=function(t,r,i,o){return this._runTask(W(m(t,h),m(r,h),g(arguments)),b(arguments))};Git2.prototype.fetch=function(t,r){return this._runTask(D(m(t,h),m(r,h),g(arguments)),b(arguments))};Git2.prototype.silent=function(t){console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3");return this};Git2.prototype.tags=function(t,r){return this._runTask(te(g(arguments)),b(arguments))};Git2.prototype.rebase=function(){return this._runTask(se(["rebase",...g(arguments)]),b(arguments))};Git2.prototype.reset=function(t){return this._runTask(z(U(t),g(arguments)),b(arguments))};Git2.prototype.revert=function(t){const r=b(arguments);if(typeof t!=="string"){return this._runTask(l("Commit must be a string"),r)}return this._runTask(se(["revert",...g(arguments,0,true),t]),r)};Git2.prototype.addTag=function(t){const r=typeof t==="string"?K(t):l("Git.addTag requires a tag name");return this._runTask(r,b(arguments))};Git2.prototype.addAnnotatedTag=function(t,r){return this._runTask(J(t,r),b(arguments))};Git2.prototype.deleteLocalBranch=function(t,r,i){return this._runTask(C(t,typeof r==="boolean"?r:false),b(arguments))};Git2.prototype.deleteLocalBranches=function(t,r,i){return this._runTask(_(t,typeof r==="boolean"?r:false),b(arguments))};Git2.prototype.branch=function(t,r){return this._runTask(v(g(arguments)),b(arguments))};Git2.prototype.branchLocal=function(t){return this._runTask(R(),b(arguments))};Git2.prototype.raw=function(t){const r=!Array.isArray(t);const i=[].slice.call(r?arguments:t,0);for(let t=0;t<i.length&&r;t++){if(!d(i[t])){i.splice(t,i.length-t);break}}i.push(...g(arguments,0,true));var o=b(arguments);if(!i.length){return this._runTask(l("Raw: must supply one or more command to execute"),o)}return this._runTask(se(i,this._trimmed),o)};Git2.prototype.submoduleAdd=function(t,r,i){return this._runTask(H(t,r),b(arguments))};Git2.prototype.submoduleUpdate=function(t,r){return this._runTask(V(g(arguments,true)),b(arguments))};Git2.prototype.submoduleInit=function(t,r){return this._runTask(Y(g(arguments,true)),b(arguments))};Git2.prototype.subModule=function(t,r){return this._runTask(Q(g(arguments)),b(arguments))};Git2.prototype.listRemote=function(){return this._runTask(q(g(arguments)),b(arguments))};Git2.prototype.addRemote=function(t,r,i){return this._runTask(M(t,r,g(arguments)),b(arguments))};Git2.prototype.removeRemote=function(t,r){return this._runTask(N(t),b(arguments))};Git2.prototype.getRemotes=function(t,r){return this._runTask($(t===true),b(arguments))};Git2.prototype.remote=function(t,r){return this._runTask(L(g(arguments)),b(arguments))};Git2.prototype.tag=function(t,r){const i=g(arguments);if(i[0]!=="tag"){i.unshift("tag")}return this._runTask(se(i),b(arguments))};Git2.prototype.updateServerInfo=function(t){return this._runTask(se(["update-server-info"]),b(arguments))};Git2.prototype.pushTags=function(t,r){const i=j({remote:m(t,h)},g(arguments));return this._runTask(i,b(arguments))};Git2.prototype.rm=function(t){return this._runTask(se(["rm","-f",...u(t)]),b(arguments))};Git2.prototype.rmKeepLocal=function(t){return this._runTask(se(["rm","--cached",...u(t)]),b(arguments))};Git2.prototype.catFile=function(t,r){return this._catFile("utf-8",arguments)};Git2.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)};Git2.prototype._catFile=function(t,r){var i=b(r);var o=["cat-file"];var a=r[0];if(typeof a==="string"){return this._runTask(l("Git.catFile: options must be supplied as an array of strings"),i)}if(Array.isArray(a)){o.push.apply(o,a)}const u=t==="buffer"?re(o):se(o);return this._runTask(u,i)};Git2.prototype.diff=function(t,r){const i=h(t)?l("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):se(["diff",...g(arguments)]);return this._runTask(i,b(arguments))};Git2.prototype.diffSummary=function(){return this._runTask(I(g(arguments,1)),b(arguments))};Git2.prototype.applyPatch=function(t){const r=!p(t)?l(`git.applyPatch requires one or more string patches as the first argument`):S(u(t),g([].slice.call(arguments,1)));return this._runTask(r,b(arguments))};Git2.prototype.revparse=function(){const t=["rev-parse",...g(arguments,true)];return this._runTask(se(t,true),b(arguments))};Git2.prototype.clean=function(t,r,i){const o=A(t);const a=o&&t.join("")||m(t,h)||"";const l=g([].slice.call(arguments,o?1:0));return this._runTask(O(a,l),b(arguments))};Git2.prototype.exec=function(t){const r={commands:[],format:"utf-8",parser(){if(typeof t==="function"){t()}}};return this._runTask(r)};Git2.prototype.clearQueue=function(){return this};Git2.prototype.checkIgnore=function(t,r){return this._runTask(T(u(m(t,p,[]))),b(arguments))};Git2.prototype.checkIsRepo=function(t,r){return this._runTask(k(m(t,h)),b(arguments))};r.exports=Git2}});R();C();var cs=class extends _{constructor(t,r){super(void 0,r);this.config=t}};C();C();var ds=class extends _{constructor(t,r,i){super(t,i);this.task=t;this.plugin=r;Object.setPrototypeOf(this,new.target.prototype)}};k();E();ne();Se();_e();ke();Ae();We();function abortPlugin(t){if(!t){return}const r={type:"spawn.after",action(r,i){function kill(){i.kill(new ds(void 0,"abort","Abort signal received"))}t.addEventListener("abort",kill);i.spawned.on("close",(()=>t.removeEventListener("abort",kill)))}};const i={type:"spawn.before",action(r,i){if(t.aborted){i.kill(new ds(void 0,"abort","Abort already signaled"))}}};return[i,r]}function isConfigSwitch(t){return typeof t==="string"&&t.trim().toLowerCase()==="-c"}function preventProtocolOverride(t,r){if(!isConfigSwitch(t)){return}if(!/^\s*protocol(.[a-z]+)?.allow/.test(r)){return}throw new ds(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function preventUploadPack(t,r){if(/^\s*--(upload|receive)-pack/.test(t)){throw new ds(void 0,"unsafe",`Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`)}if(r==="clone"&&/^\s*-u\b/.test(t)){throw new ds(void 0,"unsafe",`Use of clone with option -u is not permitted without enabling allowUnsafePack`)}if(r==="push"&&/^\s*--exec\b/.test(t)){throw new ds(void 0,"unsafe",`Use of push with option --exec is not permitted without enabling allowUnsafePack`)}}function blockUnsafeOperationsPlugin({allowUnsafeProtocolOverride:t=false,allowUnsafePack:r=false}={}){return{type:"spawn.args",action(i,o){i.forEach(((a,l)=>{const u=l<i.length?i[l+1]:"";t||preventProtocolOverride(a,u);r||preventUploadPack(a,o.method)}));return i}}}X();function commandConfigPrefixingPlugin(t){const r=prefixedArray(t,"-c");return{type:"spawn.args",action(t){return[...r,...t]}}}X();var hs=(0,c.gX)().promise;function completionDetectionPlugin({onClose:t=true,onExit:r=50}={}){function createEvents(){let i=-1;const o={close:(0,c.gX)(),closeTimeout:(0,c.gX)(),exit:(0,c.gX)(),exitTimeout:(0,c.gX)()};const a=Promise.race([t===false?hs:o.closeTimeout.promise,r===false?hs:o.exitTimeout.promise]);configureTimeout(t,o.close,o.closeTimeout);configureTimeout(r,o.exit,o.exitTimeout);return{close(t){i=t;o.close.done()},exit(t){i=t;o.exit.done()},get exitCode(){return i},result:a}}function configureTimeout(t,r,i){if(t===false){return}(t===true?r.promise:r.promise.then((()=>delay(t)))).then(i.done)}return{type:"spawn.after",action(t,r){return __async(this,arguments,(function*(t,{spawned:r,close:i}){var o,a;const l=createEvents();let u=true;let quickClose=()=>void(u=false);(o=r.stdout)==null?void 0:o.on("data",quickClose);(a=r.stderr)==null?void 0:a.on("data",quickClose);r.on("error",quickClose);r.on("close",(t=>l.close(t)));r.on("exit",(t=>l.exit(t)));try{yield l.result;if(u){yield delay(50)}i(l.exitCode)}catch(t){i(l.exitCode,t)}}))}}}C();function isTaskError(t){return!!(t.exitCode&&t.stdErr.length)}function getErrorMessage(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function errorDetectionHandler(t=false,r=isTaskError,i=getErrorMessage){return(o,a)=>{if(!t&&o||!r(a)){return o}return i(a)}}function errorDetectionPlugin(t){return{type:"task.error",action(r,i){const o=t(r.error,{stdErr:i.stdErr,stdOut:i.stdOut,exitCode:i.exitCode});if(Buffer.isBuffer(o)){return{error:new _(void 0,o.toString("utf-8"))}}return{error:o}}}}X();var fs=class{constructor(){this.plugins=new Set}add(t){const r=[];asArray(t).forEach((t=>t&&this.plugins.add(append(r,t))));return()=>{r.forEach((t=>this.plugins.delete(t)))}}exec(t,r,i){let o=r;const a=Object.freeze(Object.create(i));for(const r of this.plugins){if(r.type===t){o=r.action(o,a)}}return o}};X();function progressMonitorPlugin(t){const r="--progress";const i=["checkout","clone","fetch","pull","push"];const o={type:"spawn.after",action(i,o){var a;if(!o.commands.includes(r)){return}(a=o.spawned.stderr)==null?void 0:a.on("data",(r=>{const i=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(r.toString("utf8"));if(!i){return}t({method:o.method,stage:progressEventStage(i[1]),progress:asNumber(i[2]),processed:asNumber(i[3]),total:asNumber(i[4])})}))}};const a={type:"spawn.args",action(t,o){if(!i.includes(o.method)){return t}return including(t,r)}};return[a,o]}function progressEventStage(t){return String(t.toLowerCase().split(" ",1))||"unknown"}X();function spawnOptionsPlugin(t){const r=pick(t,["uid","gid"]);return{type:"spawn.options",action(t){return __spreadValues(__spreadValues({},r),t)}}}function timeoutPlugin({block:t,stdErr:r=true,stdOut:i=true}){if(t>0){return{type:"spawn.after",action(o,a){var l,u;let c;function wait(){c&&clearTimeout(c);c=setTimeout(kill,t)}function stop(){var t,r;(t=a.spawned.stdout)==null?void 0:t.off("data",wait);(r=a.spawned.stderr)==null?void 0:r.off("data",wait);a.spawned.off("exit",stop);a.spawned.off("close",stop);c&&clearTimeout(c)}function kill(){stop();a.kill(new ds(void 0,"timeout",`block timeout reached`))}i&&((l=a.spawned.stdout)==null?void 0:l.on("data",wait));r&&((u=a.spawned.stderr)==null?void 0:u.on("data",wait));a.spawned.on("exit",stop);a.spawned.on("close",stop);wait()}}}}R();function suffixPathsPlugin(){return{type:"spawn.args",action(t){const r=[];let i;function append2(t){(i=i||[]).push(...t)}for(let i=0;i<t.length;i++){const o=t[i];if(isPathSpec(o)){append2(toPaths(o));continue}if(o==="--"){append2(t.slice(i+1).flatMap((t=>isPathSpec(t)&&toPaths(t)||t)));break}r.push(o)}return!i?r:[...r,"--",...i.map(String)]}}}X();var ps=us();function gitInstanceFactory(t,r){const i=new fs;const o=createInstanceConfig(t&&(typeof t==="string"?{baseDir:t}:t)||{},r);if(!folderExists(o.baseDir)){throw new cs(o,`Cannot use simple-git on a directory that does not exist`)}if(Array.isArray(o.config)){i.add(commandConfigPrefixingPlugin(o.config))}i.add(blockUnsafeOperationsPlugin(o.unsafe));i.add(suffixPathsPlugin());i.add(completionDetectionPlugin(o.completion));o.abort&&i.add(abortPlugin(o.abort));o.progress&&i.add(progressMonitorPlugin(o.progress));o.timeout&&i.add(timeoutPlugin(o.timeout));o.spawnOptions&&i.add(spawnOptionsPlugin(o.spawnOptions));i.add(errorDetectionPlugin(errorDetectionHandler(true)));o.errors&&i.add(errorDetectionPlugin(o.errors));return new ps(o,i)}k();var ms=null&&["customBinary","env","outputHandler","silent"];var gs=null&&["add","addAnnotatedTag","addConfig","addRemote","addTag","applyPatch","binaryCatFile","branch","branchLocal","catFile","checkIgnore","checkIsRepo","checkout","checkoutBranch","checkoutLatestTag","checkoutLocalBranch","clean","clone","commit","cwd","deleteLocalBranch","deleteLocalBranches","diff","diffSummary","exec","fetch","getRemotes","init","listConfig","listRemote","log","merge","mergeFromTo","mirror","mv","pull","push","pushTags","raw","rebase","remote","removeRemote","reset","revert","revparse","rm","rmKeepLocal","show","stash","stashList","status","subModule","submoduleAdd","submoduleInit","submoduleUpdate","tag","tags","updateServerInfo"];function gitP(...t){let r;let i=Promise.resolve();try{r=gitInstanceFactory(...t)}catch(t){i=Promise.reject(t)}function builderReturn(){return o}function chainReturn(){return i}const o=[...ms,...gs].reduce(((t,i)=>{const o=gs.includes(i);const a=o?asyncWrapper(i,r):syncWrapper(i,r,t);const l=o?chainReturn:builderReturn;Object.defineProperty(t,i,{enumerable:false,configurable:false,value:r?a:l});return t}),{});return o;function asyncWrapper(t,r){return function(...o){if(typeof o[o.length]==="function"){throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to "+t)}return i.then((function(){return new Promise((function(i,a){const callback=(t,r)=>{if(t){return a(toError(t))}i(r)};o.push(callback);r[t].apply(r,o)}))}))}}function syncWrapper(t,r,i){return(...o)=>{r[t](...o);return i}}}function toError(t){if(t instanceof Error){return t}if(typeof t==="string"){return new Error(t)}return new T(t)}var bs=gitInstanceFactory;var ys=null&&gitInstanceFactory;const clearName=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();const getTypeTask=t=>{if(t==="Epic")return"story";if(t==="Bug")return"fix";return"feat"};const formatBranchName=t=>{const{id:r,name:i,type:o}=t;const a=getTypeTask(o);const l=clearName(i);return[`${a}/${r}_${l}`,`${a}/${r}`,`${r}`]};const Ss=require("node:os");var ws=__nccwpck_require__.n(Ss);const vs=require("node:fs/promises");var Rs=__nccwpck_require__(7561);const homeDir=()=>ws().homedir();const processDir=()=>process.cwd();const createDir=async t=>{await(0,vs.mkdir)(t,{recursive:true})};const pathExists=t=>(0,Rs.existsSync)(t);const writeFile=async(t,r)=>{await(0,vs.writeFile)(t,r)};const readFile=async t=>{const r=await(0,vs.readFile)(t);return r.toString()};var _s;(function(t){t["IN_PROGRESS"]="In Progress"})(_s||(_s={}));const Cs={tools:{jira:{domain:process.env.JIRA_DOMAIN??"",authorization:process.env.JIRA_AUTHORIZATION??""},github:{token:process.env.GITHUB_TOKEN??"",organization:process.env.GITHUB_ORGANIZATION??""}},projects:{},advanced:false,debug:false,experimental:false};const base64Encode=t=>btoa(t);const init=async()=>{if(pathExists(`${homeDir()}/.mytools/config`))return;if(!pathExists(`${homeDir()}/.mytools`))await createDir(`${homeDir()}/.mytools`);await writeConfig(Cs)};const ensureFormatConfigFile=async()=>{const t=await readConfig();await writeConfig({...Cs,...t})};const isJiraConfigured=async()=>{const t=base64Encode(processDir());const r=await readConfig();const i=r.tools.jira;const o=r.projects[t]?.tools.jira;if(o)return o.domain&&o.authorization;return i.domain&&i.authorization};const addCurrentProject=async()=>{const t=base64Encode(processDir());const r=await readConfig();const i=r.projects[t];if(!i){const i=new Date;r.projects[t]={tasks:[],createdAt:i.valueOf(),updatedAt:i.valueOf(),tools:{}};await writeConfig(r)}};const addTask=async t=>{await addCurrentProject();const r=base64Encode(processDir());const i=await readConfig();const o=i.projects[r];const a=new Date;o.tasks.push({jiraId:t.id,jiraName:t.name,jiraType:t.type,jiraUrl:t.url,status:_s.IN_PROGRESS,createdAt:a.valueOf(),updatedAt:a.valueOf()});await writeConfig(i)};const removeTask=async t=>{await addCurrentProject();const r=base64Encode(processDir());const i=await readConfig();const o=i.projects[r];const a=o.tasks;o.tasks=a.filter((r=>r.jiraId!==t.id));await writeConfig(i)};const isDebugMode=async()=>{const{debug:t}=await readConfig();return t};const isExperimentalMode=async()=>{const{experimental:t}=await readConfig();return t};const getInProgressTasks=async()=>{const t=base64Encode(processDir());const r=await readConfig();const i=r.projects[t];if(!i)return[];return i.tasks};const readConfig=async()=>{const t=await readFile(`${homeDir()}/.mytools/config`);return JSON.parse(t)};const writeConfig=async t=>{const r=JSON.stringify(t,null,2);await writeFile(`${homeDir()}/.mytools/config`,r)};const Ts=require("node:http");const ks=require("node:https");const Ps=require("node:zlib");const xs=require("node:stream");const Es=require("node:buffer");function dataUriToBuffer(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,"");const r=t.indexOf(",");if(r===-1||r<=4){throw new TypeError("malformed data: URI")}const i=t.substring(5,r).split(";");let o="";let a=false;const l=i[0]||"text/plain";let u=l;for(let t=1;t<i.length;t++){if(i[t]==="base64"){a=true}else if(i[t]){u+=`;${i[t]}`;if(i[t].indexOf("charset=")===0){o=i[t].substring(8)}}}if(!i[0]&&!o.length){u+=";charset=US-ASCII";o="US-ASCII"}const c=a?"base64":"ascii";const d=unescape(t.substring(r+1));const h=Buffer.from(d,c);h.type=l;h.typeFull=u;h.charset=o;return h}const Os=dataUriToBuffer;const As=require("node:util");var Is=__nccwpck_require__(7579);var Ds=__nccwpck_require__(8809);class FetchBaseError extends Error{constructor(t,r){super(t);Error.captureStackTrace(this,this.constructor);this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}class FetchError extends FetchBaseError{constructor(t,r,i){super(t,r);if(i){this.code=this.errno=i.code;this.erroredSysCall=i.syscall}}}const Bs=Symbol.toStringTag;const isURLSearchParameters=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[Bs]==="URLSearchParams";const isBlob=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[Bs]);const isAbortSignal=t=>typeof t==="object"&&(t[Bs]==="AbortSignal"||t[Bs]==="EventTarget");const isDomainOrSubdomain=(t,r)=>{const i=new URL(r).hostname;const o=new URL(t).hostname;return i===o||i.endsWith(`.${o}`)};const isSameProtocol=(t,r)=>{const i=new URL(r).protocol;const o=new URL(t).protocol;return i===o};const Ws=(0,As.promisify)(xs.pipeline);const js=Symbol("Body internals");class Body{constructor(t,{size:r=0}={}){let i=null;if(t===null){t=null}else if(isURLSearchParameters(t)){t=Es.Buffer.from(t.toString())}else if(isBlob(t)){}else if(Es.Buffer.isBuffer(t)){}else if(As.types.isAnyArrayBuffer(t)){t=Es.Buffer.from(t)}else if(ArrayBuffer.isView(t)){t=Es.Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(t instanceof xs){}else if(t instanceof Ds.Ct){t=(0,Ds.au)(t);i=t.type.split("=")[1]}else{t=Es.Buffer.from(String(t))}let o=t;if(Es.Buffer.isBuffer(t)){o=xs.Readable.from(t)}else if(isBlob(t)){o=xs.Readable.from(t.stream())}this[js]={body:t,stream:o,boundary:i,disturbed:false,error:null};this.size=r;if(t instanceof xs){t.on("error",(t=>{const r=t instanceof FetchBaseError?t:new FetchError(`Invalid response body while trying to fetch ${this.url}: ${t.message}`,"system",t);this[js].error=r}))}}get body(){return this[js].stream}get bodyUsed(){return this[js].disturbed}async arrayBuffer(){const{buffer:t,byteOffset:r,byteLength:i}=await consumeBody(this);return t.slice(r,r+i)}async formData(){const t=this.headers.get("content-type");if(t.startsWith("application/x-www-form-urlencoded")){const t=new Ds.Ct;const r=new URLSearchParams(await this.text());for(const[i,o]of r){t.append(i,o)}return t}const{toFormData:r}=await __nccwpck_require__.e(398).then(__nccwpck_require__.bind(__nccwpck_require__,4398));return r(this.body,t)}async blob(){const t=this.headers&&this.headers.get("content-type")||this[js].body&&this[js].body.type||"";const r=await this.arrayBuffer();return new Is.Z([r],{type:t})}async json(){const t=await this.text();return JSON.parse(t)}async text(){const t=await consumeBody(this);return(new TextDecoder).decode(t)}buffer(){return consumeBody(this)}}Body.prototype.buffer=(0,As.deprecate)(Body.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Body.prototype,{body:{enumerable:true},bodyUsed:{enumerable:true},arrayBuffer:{enumerable:true},blob:{enumerable:true},json:{enumerable:true},text:{enumerable:true},data:{get:(0,As.deprecate)((()=>{}),"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function consumeBody(t){if(t[js].disturbed){throw new TypeError(`body used already for: ${t.url}`)}t[js].disturbed=true;if(t[js].error){throw t[js].error}const{body:r}=t;if(r===null){return Es.Buffer.alloc(0)}if(!(r instanceof xs)){return Es.Buffer.alloc(0)}const i=[];let o=0;try{for await(const a of r){if(t.size>0&&o+a.length>t.size){const i=new FetchError(`content size at ${t.url} over limit: ${t.size}`,"max-size");r.destroy(i);throw i}o+=a.length;i.push(a)}}catch(r){const i=r instanceof FetchBaseError?r:new FetchError(`Invalid response body while trying to fetch ${t.url}: ${r.message}`,"system",r);throw i}if(r.readableEnded===true||r._readableState.ended===true){try{if(i.every((t=>typeof t==="string"))){return Es.Buffer.from(i.join(""))}return Es.Buffer.concat(i,o)}catch(r){throw new FetchError(`Could not create Buffer from response body for ${t.url}: ${r.message}`,"system",r)}}else{throw new FetchError(`Premature close of server response while trying to fetch ${t.url}`)}}const clone=(t,r)=>{let i;let o;let{body:a}=t[js];if(t.bodyUsed){throw new Error("cannot clone body after it is used")}if(a instanceof xs&&typeof a.getBoundary!=="function"){i=new xs.PassThrough({highWaterMark:r});o=new xs.PassThrough({highWaterMark:r});a.pipe(i);a.pipe(o);t[js].stream=i;a=o}return a};const Fs=(0,As.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");const extractContentType=(t,r)=>{if(t===null){return null}if(typeof t==="string"){return"text/plain;charset=UTF-8"}if(isURLSearchParameters(t)){return"application/x-www-form-urlencoded;charset=UTF-8"}if(isBlob(t)){return t.type||null}if(Es.Buffer.isBuffer(t)||As.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)){return null}if(t instanceof Ds.Ct){return`multipart/form-data; boundary=${r[js].boundary}`}if(t&&typeof t.getBoundary==="function"){return`multipart/form-data;boundary=${Fs(t)}`}if(t instanceof xs){return null}return"text/plain;charset=UTF-8"};const getTotalBytes=t=>{const{body:r}=t[js];if(r===null){return 0}if(isBlob(r)){return r.size}if(Es.Buffer.isBuffer(r)){return r.length}if(r&&typeof r.getLengthSync==="function"){return r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null}return null};const writeToStream=async(t,{body:r})=>{if(r===null){t.end()}else{await Ws(r,t)}};const Ms=typeof Ts.validateHeaderName==="function"?Ts.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){const r=new TypeError(`Header name must be a valid HTTP token [${t}]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_HTTP_TOKEN"});throw r}};const $s=typeof Ts.validateHeaderValue==="function"?Ts.validateHeaderValue:(t,r)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(r)){const r=new TypeError(`Invalid character in header content ["${t}"]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"});throw r}};class Headers extends URLSearchParams{constructor(t){let r=[];if(t instanceof Headers){const i=t.raw();for(const[t,o]of Object.entries(i)){r.push(...o.map((r=>[t,r])))}}else if(t==null){}else if(typeof t==="object"&&!As.types.isBoxedPrimitive(t)){const i=t[Symbol.iterator];if(i==null){r.push(...Object.entries(t))}else{if(typeof i!=="function"){throw new TypeError("Header pairs must be iterable")}r=[...t].map((t=>{if(typeof t!=="object"||As.types.isBoxedPrimitive(t)){throw new TypeError("Each header pair must be an iterable object")}return[...t]})).map((t=>{if(t.length!==2){throw new TypeError("Each header pair must be a name/value tuple")}return[...t]}))}}else{throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)")}r=r.length>0?r.map((([t,r])=>{Ms(t);$s(t,String(r));return[String(t).toLowerCase(),String(r)]})):undefined;super(r);return new Proxy(this,{get(t,r,i){switch(r){case"append":case"set":return(i,o)=>{Ms(i);$s(i,String(o));return URLSearchParams.prototype[r].call(t,String(i).toLowerCase(),String(o))};case"delete":case"has":case"getAll":return i=>{Ms(i);return URLSearchParams.prototype[r].call(t,String(i).toLowerCase())};case"keys":return()=>{t.sort();return new Set(URLSearchParams.prototype.keys.call(t)).keys()};default:return Reflect.get(t,r,i)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){const r=this.getAll(t);if(r.length===0){return null}let i=r.join(", ");if(/^content-encoding$/i.test(t)){i=i.toLowerCase()}return i}forEach(t,r=undefined){for(const i of this.keys()){Reflect.apply(t,r,[this.get(i),i,this])}}*values(){for(const t of this.keys()){yield this.get(t)}}*entries(){for(const t of this.keys()){yield[t,this.get(t)]}}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(((t,r)=>{t[r]=this.getAll(r);return t}),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(((t,r)=>{const i=this.getAll(r);if(r==="host"){t[r]=i[0]}else{t[r]=i.length>1?i:i[0]}return t}),{})}}Object.defineProperties(Headers.prototype,["get","entries","forEach","values"].reduce(((t,r)=>{t[r]={enumerable:true};return t}),{}));function fromRawHeaders(t=[]){return new Headers(t.reduce(((t,r,i,o)=>{if(i%2===0){t.push(o.slice(i,i+2))}return t}),[]).filter((([t,r])=>{try{Ms(t);$s(t,String(r));return true}catch{return false}})))}const qs=new Set([301,302,303,307,308]);const isRedirect=t=>qs.has(t);const Ls=Symbol("Response internals");class Response extends Body{constructor(t=null,r={}){super(t,r);const i=r.status!=null?r.status:200;const o=new Headers(r.headers);if(t!==null&&!o.has("Content-Type")){const r=extractContentType(t,this);if(r){o.append("Content-Type",r)}}this[Ls]={type:"default",url:r.url,status:i,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Ls].type}get url(){return this[Ls].url||""}get status(){return this[Ls].status}get ok(){return this[Ls].status>=200&&this[Ls].status<300}get redirected(){return this[Ls].counter>0}get statusText(){return this[Ls].statusText}get headers(){return this[Ls].headers}get highWaterMark(){return this[Ls].highWaterMark}clone(){return new Response(clone(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(t,r=302){if(!isRedirect(r)){throw new RangeError('Failed to execute "redirect" on "response": Invalid status code')}return new Response(null,{headers:{location:new URL(t).toString()},status:r})}static error(){const t=new Response(null,{status:0,statusText:""});t[Ls].type="error";return t}static json(t=undefined,r={}){const i=JSON.stringify(t);if(i===undefined){throw new TypeError("data is not JSON serializable")}const o=new Headers(r&&r.headers);if(!o.has("content-type")){o.set("content-type","application/json")}return new Response(i,{...r,headers:o})}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(Response.prototype,{type:{enumerable:true},url:{enumerable:true},status:{enumerable:true},ok:{enumerable:true},redirected:{enumerable:true},statusText:{enumerable:true},headers:{enumerable:true},clone:{enumerable:true}});const Ns=require("node:url");const getSearch=t=>{if(t.search){return t.search}const r=t.href.length-1;const i=t.hash||(t.href[r]==="#"?"#":"");return t.href[r-i.length]==="?"?"?":""};const Us=require("node:net");function stripURLForUseAsAReferrer(t,r=false){if(t==null){return"no-referrer"}t=new URL(t);if(/^(about|blob|data):$/.test(t.protocol)){return"no-referrer"}t.username="";t.password="";t.hash="";if(r){t.pathname="";t.search=""}return t}const zs=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);const Gs="strict-origin-when-cross-origin";function validateReferrerPolicy(t){if(!zs.has(t)){throw new TypeError(`Invalid referrerPolicy: ${t}`)}return t}function isOriginPotentiallyTrustworthy(t){if(/^(http|ws)s:$/.test(t.protocol)){return true}const r=t.host.replace(/(^\[)|(]$)/g,"");const i=(0,Us.isIP)(r);if(i===4&&/^127\./.test(r)){return true}if(i===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(r)){return true}if(t.host==="localhost"||t.host.endsWith(".localhost")){return false}if(t.protocol==="file:"){return true}return false}function isUrlPotentiallyTrustworthy(t){if(/^about:(blank|srcdoc)$/.test(t)){return true}if(t.protocol==="data:"){return true}if(/^(blob|filesystem):$/.test(t.protocol)){return true}return isOriginPotentiallyTrustworthy(t)}function determineRequestsReferrer(t,{referrerURLCallback:r,referrerOriginCallback:i}={}){if(t.referrer==="no-referrer"||t.referrerPolicy===""){return null}const o=t.referrerPolicy;if(t.referrer==="about:client"){return"no-referrer"}const a=t.referrer;let l=stripURLForUseAsAReferrer(a);let u=stripURLForUseAsAReferrer(a,true);if(l.toString().length>4096){l=u}if(r){l=r(l)}if(i){u=i(u)}const c=new URL(t.url);switch(o){case"no-referrer":return"no-referrer";case"origin":return u;case"unsafe-url":return l;case"strict-origin":if(isUrlPotentiallyTrustworthy(l)&&!isUrlPotentiallyTrustworthy(c)){return"no-referrer"}return u.toString();case"strict-origin-when-cross-origin":if(l.origin===c.origin){return l}if(isUrlPotentiallyTrustworthy(l)&&!isUrlPotentiallyTrustworthy(c)){return"no-referrer"}return u;case"same-origin":if(l.origin===c.origin){return l}return"no-referrer";case"origin-when-cross-origin":if(l.origin===c.origin){return l}return u;case"no-referrer-when-downgrade":if(isUrlPotentiallyTrustworthy(l)&&!isUrlPotentiallyTrustworthy(c)){return"no-referrer"}return l;default:throw new TypeError(`Invalid referrerPolicy: ${o}`)}}function parseReferrerPolicyFromHeader(t){const r=(t.get("referrer-policy")||"").split(/[,\s]+/);let i="";for(const t of r){if(t&&zs.has(t)){i=t}}return i}const Hs=Symbol("Request internals");const isRequest=t=>typeof t==="object"&&typeof t[Hs]==="object";const Ys=(0,As.deprecate)((()=>{}),".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");class Request extends Body{constructor(t,r={}){let i;if(isRequest(t)){i=new URL(t.url)}else{i=new URL(t);t={}}if(i.username!==""||i.password!==""){throw new TypeError(`${i} is an url with embedded credentials.`)}let o=r.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)){o=o.toUpperCase()}if(!isRequest(r)&&"data"in r){Ys()}if((r.body!=null||isRequest(t)&&t.body!==null)&&(o==="GET"||o==="HEAD")){throw new TypeError("Request with GET/HEAD method cannot have body")}const a=r.body?r.body:isRequest(t)&&t.body!==null?clone(t):null;super(a,{size:r.size||t.size||0});const l=new Headers(r.headers||t.headers||{});if(a!==null&&!l.has("Content-Type")){const t=extractContentType(a,this);if(t){l.set("Content-Type",t)}}let u=isRequest(t)?t.signal:null;if("signal"in r){u=r.signal}if(u!=null&&!isAbortSignal(u)){throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget")}let c=r.referrer==null?t.referrer:r.referrer;if(c===""){c="no-referrer"}else if(c){const t=new URL(c);c=/^about:(\/\/)?client$/.test(t)?"client":t}else{c=undefined}this[Hs]={method:o,redirect:r.redirect||t.redirect||"follow",headers:l,parsedURL:i,signal:u,referrer:c};this.follow=r.follow===undefined?t.follow===undefined?20:t.follow:r.follow;this.compress=r.compress===undefined?t.compress===undefined?true:t.compress:r.compress;this.counter=r.counter||t.counter||0;this.agent=r.agent||t.agent;this.highWaterMark=r.highWaterMark||t.highWaterMark||16384;this.insecureHTTPParser=r.insecureHTTPParser||t.insecureHTTPParser||false;this.referrerPolicy=r.referrerPolicy||t.referrerPolicy||""}get method(){return this[Hs].method}get url(){return(0,Ns.format)(this[Hs].parsedURL)}get headers(){return this[Hs].headers}get redirect(){return this[Hs].redirect}get signal(){return this[Hs].signal}get referrer(){if(this[Hs].referrer==="no-referrer"){return""}if(this[Hs].referrer==="client"){return"about:client"}if(this[Hs].referrer){return this[Hs].referrer.toString()}return undefined}get referrerPolicy(){return this[Hs].referrerPolicy}set referrerPolicy(t){this[Hs].referrerPolicy=validateReferrerPolicy(t)}clone(){return new Request(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(Request.prototype,{method:{enumerable:true},url:{enumerable:true},headers:{enumerable:true},redirect:{enumerable:true},clone:{enumerable:true},signal:{enumerable:true},referrer:{enumerable:true},referrerPolicy:{enumerable:true}});const getNodeRequestOptions=t=>{const{parsedURL:r}=t[Hs];const i=new Headers(t[Hs].headers);if(!i.has("Accept")){i.set("Accept","*/*")}let o=null;if(t.body===null&&/^(post|put)$/i.test(t.method)){o="0"}if(t.body!==null){const r=getTotalBytes(t);if(typeof r==="number"&&!Number.isNaN(r)){o=String(r)}}if(o){i.set("Content-Length",o)}if(t.referrerPolicy===""){t.referrerPolicy=Gs}if(t.referrer&&t.referrer!=="no-referrer"){t[Hs].referrer=determineRequestsReferrer(t)}else{t[Hs].referrer="no-referrer"}if(t[Hs].referrer instanceof URL){i.set("Referer",t.referrer)}if(!i.has("User-Agent")){i.set("User-Agent","node-fetch")}if(t.compress&&!i.has("Accept-Encoding")){i.set("Accept-Encoding","gzip, deflate, br")}let{agent:a}=t;if(typeof a==="function"){a=a(r)}const l=getSearch(r);const u={path:r.pathname+l,method:t.method,headers:i[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:a};return{parsedURL:r,options:u}};class AbortError extends FetchBaseError{constructor(t,r="aborted"){super(t,r)}}var Qs=__nccwpck_require__(7210);const Vs=new Set(["data:","http:","https:"]);async function fetch(t,r){return new Promise(((i,o)=>{const a=new Request(t,r);const{parsedURL:l,options:u}=getNodeRequestOptions(a);if(!Vs.has(l.protocol)){throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${l.protocol.replace(/:$/,"")}" is not supported.`)}if(l.protocol==="data:"){const t=Os(a.url);const r=new Response(t,{headers:{"Content-Type":t.typeFull}});i(r);return}const c=(l.protocol==="https:"?ks:Ts).request;const{signal:d}=a;let h=null;const abort=()=>{const t=new AbortError("The operation was aborted.");o(t);if(a.body&&a.body instanceof xs.Readable){a.body.destroy(t)}if(!h||!h.body){return}h.body.emit("error",t)};if(d&&d.aborted){abort();return}const abortAndFinalize=()=>{abort();finalize()};const p=c(l.toString(),u);if(d){d.addEventListener("abort",abortAndFinalize)}const finalize=()=>{p.abort();if(d){d.removeEventListener("abort",abortAndFinalize)}};p.on("error",(t=>{o(new FetchError(`request to ${a.url} failed, reason: ${t.message}`,"system",t));finalize()}));fixResponseChunkedTransferBadEnding(p,(t=>{if(h&&h.body){h.body.destroy(t)}}));if(process.version<"v14"){p.on("socket",(t=>{let r;t.prependListener("end",(()=>{r=t._eventsCount}));t.prependListener("close",(i=>{if(h&&r<t._eventsCount&&!i){const t=new Error("Premature close");t.code="ERR_STREAM_PREMATURE_CLOSE";h.body.emit("error",t)}}))}))}p.on("response",(t=>{p.setTimeout(0);const l=fromRawHeaders(t.rawHeaders);if(isRedirect(t.statusCode)){const u=l.get("Location");let c=null;try{c=u===null?null:new URL(u,a.url)}catch{if(a.redirect!=="manual"){o(new FetchError(`uri requested responds with an invalid redirect URL: ${u}`,"invalid-redirect"));finalize();return}}switch(a.redirect){case"error":o(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${a.url}`,"no-redirect"));finalize();return;case"manual":break;case"follow":{if(c===null){break}if(a.counter>=a.follow){o(new FetchError(`maximum redirect reached at: ${a.url}`,"max-redirect"));finalize();return}const u={headers:new Headers(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:clone(a),signal:a.signal,size:a.size,referrer:a.referrer,referrerPolicy:a.referrerPolicy};if(!isDomainOrSubdomain(a.url,c)||!isSameProtocol(a.url,c)){for(const t of["authorization","www-authenticate","cookie","cookie2"]){u.headers.delete(t)}}if(t.statusCode!==303&&a.body&&r.body instanceof xs.Readable){o(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect"));finalize();return}if(t.statusCode===303||(t.statusCode===301||t.statusCode===302)&&a.method==="POST"){u.method="GET";u.body=undefined;u.headers.delete("content-length")}const d=parseReferrerPolicyFromHeader(l);if(d){u.referrerPolicy=d}i(fetch(new Request(c,u)));finalize();return}default:return o(new TypeError(`Redirect option '${a.redirect}' is not a valid value of RequestRedirect`))}}if(d){t.once("end",(()=>{d.removeEventListener("abort",abortAndFinalize)}))}let u=(0,xs.pipeline)(t,new xs.PassThrough,(t=>{if(t){o(t)}}));if(process.version<"v12.10"){t.on("aborted",abortAndFinalize)}const c={url:a.url,status:t.statusCode,statusText:t.statusMessage,headers:l,size:a.size,counter:a.counter,highWaterMark:a.highWaterMark};const m=l.get("Content-Encoding");if(!a.compress||a.method==="HEAD"||m===null||t.statusCode===204||t.statusCode===304){h=new Response(u,c);i(h);return}const g={flush:Ps.Z_SYNC_FLUSH,finishFlush:Ps.Z_SYNC_FLUSH};if(m==="gzip"||m==="x-gzip"){u=(0,xs.pipeline)(u,Ps.createGunzip(g),(t=>{if(t){o(t)}}));h=new Response(u,c);i(h);return}if(m==="deflate"||m==="x-deflate"){const r=(0,xs.pipeline)(t,new xs.PassThrough,(t=>{if(t){o(t)}}));r.once("data",(t=>{if((t[0]&15)===8){u=(0,xs.pipeline)(u,Ps.createInflate(),(t=>{if(t){o(t)}}))}else{u=(0,xs.pipeline)(u,Ps.createInflateRaw(),(t=>{if(t){o(t)}}))}h=new Response(u,c);i(h)}));r.once("end",(()=>{if(!h){h=new Response(u,c);i(h)}}));return}if(m==="br"){u=(0,xs.pipeline)(u,Ps.createBrotliDecompress(),(t=>{if(t){o(t)}}));h=new Response(u,c);i(h);return}h=new Response(u,c);i(h)}));writeToStream(p,a).catch(o)}))}function fixResponseChunkedTransferBadEnding(t,r){const i=Es.Buffer.from("0\r\n\r\n");let o=false;let a=false;let l;t.on("response",(t=>{const{headers:r}=t;o=r["transfer-encoding"]==="chunked"&&!r["content-length"]}));t.on("socket",(u=>{const onSocketClose=()=>{if(o&&!a){const t=new Error("Premature close");t.code="ERR_STREAM_PREMATURE_CLOSE";r(t)}};const onData=t=>{a=Es.Buffer.compare(t.slice(-5),i)===0;if(!a&&l){a=Es.Buffer.compare(l.slice(-3),i.slice(0,3))===0&&Es.Buffer.compare(t.slice(-2),i.slice(3))===0}l=t};u.prependListener("close",onSocketClose);u.on("data",onData);t.on("close",(()=>{u.removeListener("close",onSocketClose);u.removeListener("data",onData)}))}))}var Js;(function(t){t[t["MY_TASKS"]=1]="MY_TASKS";t[t["ALL"]=2]="ALL"})(Js||(Js={}));const getQuery=t=>{const r='status = "In Progress"';if(t===Js.MY_TASKS)return`${r} AND assignee = currentUser()`;return r};const searchInProgressTasks=async t=>{const r=`${process.env.JIRA_DOMAIN}/rest/api/3/search`;const i={expand:["names"],maxResults:50,fieldsByKeys:false,fields:["summary","issuetype","status"],startAt:0,jql:getQuery(t)};const o=await fetch(r,{method:"post",body:JSON.stringify(i),headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Basic ${process.env.JIRA_AUTHORIZATION}`}});if(!o.ok)return[];const a=await o.json();const{issues:l=[]}=a;return l.map((t=>{const{fields:{summary:r,issuetype:{name:i},status:{name:o}},key:a,self:l}=t;return{id:a.trim(),name:r.trim(),type:i.trim(),url:l.trim(),status:o}}))};const findTask=async t=>{const r=`${process.env.JIRA_DOMAIN}/rest/api/3/issue/${t}`;const i=await fetch(r,{method:"get",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Basic ${process.env.JIRA_AUTHORIZATION}`}});if(!i.ok)return null;const o=await i.json();const{fields:{summary:a,issuetype:{name:l},status:{name:u}},key:c,self:d}=o;return{id:c.trim(),name:a.trim(),type:l.trim(),url:d.trim(),status:u}};async function gitFetch(){console.log(`🐷 ${(0,o.cyan)("info")} making a git fetch...`);await bs().fetch();console.log(`🐷 ${(0,o.green)("success")} git fetch completed`)}async function gitPull(){console.log(`🐷 ${(0,o.cyan)("info")} pulling branches...`);await bs().pull();console.log(`🐷 ${(0,o.green)("success")} pull branches completed`)}async function searchTasks(t){console.log(`🐷 ${(0,o.cyan)("info")} requesting task in progress...`);return await searchInProgressTasks(t)}async function askUserByTaskOwnership(){const{ownership:t}=await r()({type:"select",name:"ownership",message:"What kind of task do you want to search?",choices:[{title:"My tasks",value:Js.MY_TASKS},{title:"All tasks",value:Js.ALL}],initial:0});return t}async function askUserByTask(t){const{task:i}=await r()({type:"select",name:"task",message:"What task do you want to start?",choices:t.map((t=>{const r=`${(0,o.cyan)(t.id)} => ${t.name} => ${(0,o.yellow)(t.type)}`;const i=t;return{title:r,value:i}}))});return i}async function askUserByFormatBranch(t){const{branchName:i}=await r()({type:"select",name:"branchName",message:"What name of brunch do you like?",choices:t.map((t=>({title:t,value:t})))});return i}async function checkoutBranch(t){console.log(`🐷 ${(0,o.cyan)("info")} creating new branch ${(0,o.yellow)(t)}`);await bs().checkoutLocalBranch(t)}const ensureEnvs=async()=>{if(!await isJiraConfigured()){return Promise.reject("The envs JIRA_DOMAIN or JIRA_AUTHORIZATION not exist. More info in doc")}};const addTaskToFileConfig=async t=>{await addTask(t)};const run=async()=>{await addCurrentProject();await ensureEnvs();await gitFetch();await gitPull();const t=await askUserByTaskOwnership();const r=await searchTasks(t);if(!r.length)return Promise.reject("There are not in progress tasks");const i=await askUserByTask(r);const o=formatBranchName(i);const a=await askUserByFormatBranch(o);await checkoutBranch(a);await addTaskToFileConfig(i)};const Ks=run;var Zs;(function(t){t["HTTPSAPIGithubCOMUsersHubotEventsPrivacy"]="https://api.github.com/users/hubot/events{/privacy}";t["HTTPSAPIGithubCOMUsersOctocatEventsPrivacy"]="https://api.github.com/users/octocat/events{/privacy}";t["HTTPSAPIGithubCOMUsersOtherUserEventsPrivacy"]="https://api.github.com/users/other_user/events{/privacy}"})(Zs||(Zs={}));var Xs;(function(t){t["HTTPSAPIGithubCOMUsersHubotFollowingOtherUser"]="https://api.github.com/users/hubot/following{/other_user}";t["HTTPSAPIGithubCOMUsersOctocatFollowingOtherUser"]="https://api.github.com/users/octocat/following{/other_user}";t["HTTPSAPIGithubCOMUsersOtherUserFollowingOtherUser"]="https://api.github.com/users/other_user/following{/other_user}"})(Xs||(Xs={}));var en;(function(t){t["HTTPSAPIGithubCOMUsersHubotGistsGistID"]="https://api.github.com/users/hubot/gists{/gist_id}";t["HTTPSAPIGithubCOMUsersOctocatGistsGistID"]="https://api.github.com/users/octocat/gists{/gist_id}";t["HTTPSAPIGithubCOMUsersOtherUserGistsGistID"]="https://api.github.com/users/other_user/gists{/gist_id}"})(en||(en={}));var tn;(function(t){t["Hubot"]="hubot";t["Octocat"]="octocat";t["OtherUser"]="other_user"})(tn||(tn={}));var rn;(function(t){t["MDQ6VXNlcjE"]="MDQ6VXNlcjE="})(rn||(rn={}));var sn;(function(t){t["HTTPSAPIGithubCOMUsersHubotStarredOwnerRepo"]="https://api.github.com/users/hubot/starred{/owner}{/repo}";t["HTTPSAPIGithubCOMUsersOctocatStarredOwnerRepo"]="https://api.github.com/users/octocat/starred{/owner}{/repo}";t["HTTPSAPIGithubCOMUsersOtherUserStarredOwnerRepo"]="https://api.github.com/users/other_user/starred{/owner}{/repo}"})(sn||(sn={}));var nn;(function(t){t["User"]="User"})(nn||(nn={}));const getProjectList=async()=>{const t=await fetch(`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){const{message:r}=await t.json();return Promise.reject(`Fail to find projects in github -> ${t.statusText}: ${r}`)}const r=await t.json();return r.map((({id:t,name:r})=>({id:t,name:r})))};const createPullRequest=async t=>{const r=await fetch(`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:true}),headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!r.ok){const{message:t}=await r.json();return Promise.reject(`Fail to create PR in github -> ${r.statusText}: ${t}`)}const i=await r.json();return{id:i.id,number:i.number,url:i.html_url,state:i.state,title:i.title,body:i.body,head:i.head.ref,base:i.base.ref,repo:i.base.repo.name}};async function create_pull_request_gitFetch(){console.log(`🐷 ${(0,o.cyan)("info")} making a git fetch...`);await bs().fetch();console.log(`🐷 ${(0,o.green)("success")} git fetch completed`)}const askUserByBaseBranch=async t=>{const{baseBranch:i}=await r()({type:"select",name:"baseBranch",message:"What base branch?",choices:t.map((t=>({title:t,value:t})))});return i};const getBranchSummary=async()=>{const{current:t,all:r}=await bs().branch();return[t,r]};const ensureTokenGithub=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")}};const ensureCurrentBranchIsOrigin=async()=>{const{current:t,all:r}=await bs().branch();if(!r.find((r=>r===`remotes/origin/${t}`))){return Promise.reject("Current branch not found at origin")}};const create_pull_request_createPullRequest=async(t,r,i)=>{const{url:a}=await createPullRequest({title:`${t} pull request`,body:"Esta PR [cierra, soluciona, resuelve] [#000](https://zityhub.atlassian.net/browse/000)\n\n![required gif]()\n\n### Descripción\n\n- Sobre Esta PR\n\n### Aceptación\n\n- [ ] Hay que probar....\n\n### Información extra\n\n- Más info\n\n",head:t,base:r,repo:i});console.log(`🐷 ${(0,o.green)("success")} ${a}`)};function excludeLocalBranches(t){const r="remotes/origin/";return t.filter((t=>t.includes(r))).map((t=>t.replace(r,"")))}const excludeCurrentBranch=(t,r)=>r.filter((r=>r!==t));const askUserByProject=async t=>{const{project:i}=await r()({type:"select",name:"project",message:"What project?",choices:t.map((({name:t})=>({title:t,value:t})))});return i};const askUserByAllDataIsCorrect=async(t,i,o)=>{const{confirmed:a}=await r()({type:"confirm",name:"confirmed",message:`Do you want to create PR in "${t}" from "${o}" to "${i}"?`});return a};const create_pull_request_run=async()=>{await ensureTokenGithub();await create_pull_request_gitFetch();await ensureCurrentBranchIsOrigin();const t=await getProjectList();const r=await askUserByProject(t);const[i,o]=await getBranchSummary();const a=excludeLocalBranches(o);const l=excludeCurrentBranch(i,a);const u=await askUserByBaseBranch(l);const c=await askUserByAllDataIsCorrect(r,u,i);if(c)await create_pull_request_createPullRequest(i,u,r)};const on=create_pull_request_run;const check_in_progress_tasks_run=async()=>{const t=await getInProgressTasks();for(const i of t){const t=await findTask(i.jiraId);if(t===null)continue;console.log(t);const{id:o,name:a,status:l}=t;const{confirmed:u}=await r()({type:"confirm",name:"confirmed",message:`Do you want to close task "${a}" with status "${l}" and with id "${o}"?`});console.log(u);if(u)await removeTask(t)}};const an=check_in_progress_tasks_run;const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const install=async()=>{await init();await ensureFormatConfigFile()};const assUserByOption=async()=>{const t=[{title:"Create branch",description:"",value:"Create branch"},{title:"Create PR",description:"",value:"Create PR"},{title:"Exit",description:"",value:"Exit"}];if(await isExperimentalMode()){const r=(await getInProgressTasks()).length;t.push({title:`Check ${r} in progress tasks`,description:"",value:"Check in progress tasks"})}const{task:i}=await r()({type:"select",name:"task",message:"What do you want to do?",choices:t,initial:0});return i};const index_run=async()=>{await install();const t=await assUserByOption();if(t==="Create branch")await Ks();if(t==="Create PR")await on();if(t==="Check in progress tasks")await an()};index_run().then((()=>{console.log(`🐷 ${(0,o.green)("success")} process completed`);process.exit()})).catch((t=>{console.log(`🐷 ${(0,o.red)("error")} aborting`);console.log(`🐷 ${(0,o.red)("error")} ${t}`);process.exit(1)}))})();module.exports=i})();
6
+ /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */var{toStringTag:l,iterator:u,hasInstance:c}=Symbol,d=Math.random,h="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),f=(t,r,i)=>(t+="",/^(Blob|File)$/.test(r&&r[l])?[(i=i!==void 0?i+"":r[l]=="File"?r.name:"blob",t),r.name!==i||r[l]=="blob"?new a.Z([r],i,r):r]:[t,r+""]),e=(t,r)=>(r?t:t.replace(/\r?\n|\r/g,"\r\n")).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),x=(t,r,i)=>{if(r.length<i){throw new TypeError(`Failed to execute '${t}' on 'FormData': ${i} arguments required, but only ${r.length} present.`)}};const p=null&&F;const m=class FormData{#l=[];constructor(...t){if(t.length)throw new TypeError(`Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.`)}get[l](){return"FormData"}[u](){return this.entries()}static[c](t){return t&&typeof t==="object"&&t[l]==="FormData"&&!h.some((r=>typeof t[r]!="function"))}append(...t){x("append",arguments,2);this.#l.push(f(...t))}delete(t){x("delete",arguments,1);t+="";this.#l=this.#l.filter((([r])=>r!==t))}get(t){x("get",arguments,1);t+="";for(var r=this.#l,i=r.length,o=0;o<i;o++)if(r[o][0]===t)return r[o][1];return null}getAll(t,r){x("getAll",arguments,1);r=[];t+="";this.#l.forEach((i=>i[0]===t&&r.push(i[1])));return r}has(t){x("has",arguments,1);t+="";return this.#l.some((r=>r[0]===t))}forEach(t,r){x("forEach",arguments,1);for(var[i,o]of this)t.call(r,o,i,this)}set(...t){x("set",arguments,2);var r=[],i=!0;t=f(...t);this.#l.forEach((o=>{o[0]===t[0]?i&&(i=!r.push(t)):r.push(o)}));i&&r.push(t);this.#l=r}*entries(){yield*this.#l}*keys(){for(var[t]of this)yield t}*values(){for(var[,t]of this)yield t}};function formDataToBlob(t,r=o.Z){var i=`${d()}${d()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),a=[],l=`--${i}\r\nContent-Disposition: form-data; name="`;t.forEach(((t,r)=>typeof t=="string"?a.push(l+e(r)+`"\r\n\r\n${t.replace(/\r(?!\n)|(?<!\r)\n/g,"\r\n")}\r\n`):a.push(l+e(r)+`"; filename="${e(t.name,1)}"\r\nContent-Type: ${t.type||"application/octet-stream"}\r\n\r\n`,t,"\r\n")));a.push(`--${i}--`);return new r(a,{type:"multipart/form-data; boundary="+i})}}};var r={};function __nccwpck_require__(i){var o=r[i];if(o!==undefined){return o.exports}var a=r[i]={exports:{}};var l=true;try{t[i].call(a.exports,a,a.exports,__nccwpck_require__);l=false}finally{if(l)delete r[i]}return a.exports}__nccwpck_require__.m=t;(()=>{__nccwpck_require__.n=t=>{var r=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(t,r)=>{for(var i in r){if(__nccwpck_require__.o(r,i)&&!__nccwpck_require__.o(t,i)){Object.defineProperty(t,i,{enumerable:true,get:r[i]})}}}})();(()=>{__nccwpck_require__.f={};__nccwpck_require__.e=t=>Promise.all(Object.keys(__nccwpck_require__.f).reduce(((r,i)=>{__nccwpck_require__.f[i](t,r);return r}),[]))})();(()=>{__nccwpck_require__.u=t=>""+t+".index.js"})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";(()=>{var t={179:1};var installChunk=r=>{var i=r.modules,o=r.ids,a=r.runtime;for(var l in i){if(__nccwpck_require__.o(i,l)){__nccwpck_require__.m[l]=i[l]}}if(a)a(__nccwpck_require__);for(var u=0;u<o.length;u++)t[o[u]]=1};__nccwpck_require__.f.require=(r,i)=>{if(!t[r]){if(true){installChunk(require("./"+__nccwpck_require__.u(r)))}else t[r]=1}}})();var i={};(()=>{"use strict";__nccwpck_require__.r(i);var t=__nccwpck_require__(5918);var r=__nccwpck_require__.n(t);var o=__nccwpck_require__(6399);var a=__nccwpck_require__(8903);var l=__nccwpck_require__(4492);const u=require("child_process");var c=__nccwpck_require__(9851);var d=Object.defineProperty;var h=Object.defineProperties;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertyNames;var b=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty;var S=Object.prototype.propertyIsEnumerable;var __defNormalProp=(t,r,i)=>r in t?d(t,r,{enumerable:true,configurable:true,writable:true,value:i}):t[r]=i;var __spreadValues=(t,r)=>{for(var i in r||(r={}))if(y.call(r,i))__defNormalProp(t,i,r[i]);if(b)for(var i of b(r)){if(S.call(r,i))__defNormalProp(t,i,r[i])}return t};var __spreadProps=(t,r)=>h(t,m(r));var __markAsModule=t=>d(t,"__esModule",{value:true});var __esm=(t,r)=>function __init(){return t&&(r=(0,t[g(t)[0]])(t=0)),r};var __commonJS=(t,r)=>function __require(){return r||(0,t[g(t)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(t,r)=>{for(var i in r)d(t,i,{get:r[i],enumerable:true})};var __reExport=(t,r,i,o)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let a of g(r))if(!y.call(t,a)&&(i||a!=="default"))d(t,a,{get:()=>r[a],enumerable:!(o=p(r,a))||o.enumerable})}return t};var w=(t=>(r,i)=>t&&t.get(r)||(i=__reExport(__markAsModule({}),r,1),t&&t.set(r,i),i))(typeof WeakMap!=="undefined"?new WeakMap:0);var __async=(t,r,i)=>new Promise(((o,a)=>{var fulfilled=t=>{try{step(i.next(t))}catch(t){a(t)}};var rejected=t=>{try{step(i.throw(t))}catch(t){a(t)}};var step=t=>t.done?o(t.value):Promise.resolve(t.value).then(fulfilled,rejected);step((i=i.apply(t,r)).next())}));function pathspec(...t){const r=new String(t);v.set(r,t);return r}function isPathSpec(t){return t instanceof String&&v.has(t)}function toPaths(t){return v.get(t)||[]}var v;var R=__esm({"src/lib/args/pathspec.ts"(){v=new WeakMap}});var _;var C=__esm({"src/lib/errors/git-error.ts"(){_=class extends Error{constructor(t,r){super(r);this.task=t;Object.setPrototypeOf(this,new.target.prototype)}}}});var T;var k=__esm({"src/lib/errors/git-response-error.ts"(){C();T=class extends _{constructor(t,r){super(void 0,r||String(t));this.git=t}}}});var P;var E=__esm({"src/lib/errors/task-configuration-error.ts"(){C();P=class extends _{constructor(t){super(void 0,t)}}}});function asFunction(t){return typeof t==="function"?t:A}function isUserFunction(t){return typeof t==="function"&&t!==A}function splitOn(t,r){const i=t.indexOf(r);if(i<=0){return[t,""]}return[t.substr(0,i),t.substr(i+1)]}function first(t,r=0){return isArrayLike(t)&&t.length>r?t[r]:void 0}function last(t,r=0){if(isArrayLike(t)&&t.length>r){return t[t.length-1-r]}}function isArrayLike(t){return!!(t&&typeof t.length==="number")}function toLinesWithContent(t="",r=true,i="\n"){return t.split(i).reduce(((t,i)=>{const o=r?i.trim():i;if(o){t.push(o)}return t}),[])}function forEachLineWithContent(t,r){return toLinesWithContent(t,true).map((t=>r(t)))}function folderExists(t){return(0,a.exists)(t,a.FOLDER)}function append(t,r){if(Array.isArray(t)){if(!t.includes(r)){t.push(r)}}else{t.add(r)}return r}function including(t,r){if(Array.isArray(t)&&!t.includes(r)){t.push(r)}return t}function remove(t,r){if(Array.isArray(t)){const i=t.indexOf(r);if(i>=0){t.splice(i,1)}}else{t.delete(r)}return r}function asArray(t){return Array.isArray(t)?t:[t]}function asStringArray(t){return asArray(t).map(String)}function asNumber(t,r=0){if(t==null){return r}const i=parseInt(t,10);return isNaN(i)?r:i}function prefixedArray(t,r){const i=[];for(let o=0,a=t.length;o<a;o++){i.push(r,t[o])}return i}function bufferToString(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function pick(t,r){return Object.assign({},...r.map((r=>r in t?{[r]:t[r]}:{})))}function delay(t=0){return new Promise((r=>setTimeout(r,t)))}function orVoid(t){if(t===false){return void 0}return t}var O,A,I;var D=__esm({"src/lib/utils/util.ts"(){O="\0";A=()=>{};I=Object.prototype.toString.call.bind(Object.prototype.toString)}});function filterType(t,r,i){if(r(t)){return t}return arguments.length>2?i:void 0}function filterPrimitives(t,r){const i=isPathSpec(t)?"string":typeof t;return/number|string|boolean/.test(i)&&(!r||!r.includes(i))}function filterPlainObject(t){return!!t&&I(t)==="[object Object]"}function filterFunction(t){return typeof t==="function"}var B,W,j,M,$;var q=__esm({"src/lib/utils/argument-filters.ts"(){D();R();B=t=>Array.isArray(t);W=t=>typeof t==="string";j=t=>Array.isArray(t)&&t.every(W);M=t=>W(t)||Array.isArray(t)&&t.every(W);$=t=>{if(t==null||"number|boolean|function".includes(typeof t)){return false}return Array.isArray(t)||typeof t==="string"||typeof t.length==="number"}}});var L;var N=__esm({"src/lib/utils/exit-codes.ts"(){L=(t=>{t[t["SUCCESS"]=0]="SUCCESS";t[t["ERROR"]=1]="ERROR";t[t["NOT_FOUND"]=-2]="NOT_FOUND";t[t["UNCLEAN"]=128]="UNCLEAN";return t})(L||{})}});var U;var z=__esm({"src/lib/utils/git-output-streams.ts"(){U=class{constructor(t,r){this.stdOut=t;this.stdErr=r}asStrings(){return new U(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});var G,H;var Y=__esm({"src/lib/utils/line-parser.ts"(){G=class{constructor(t,r){this.matches=[];this.parse=(t,r)=>{this.resetMatches();if(!this._regExp.every(((r,i)=>this.addMatch(r,i,t(i))))){return false}return this.useMatches(r,this.prepareMatches())!==false};this._regExp=Array.isArray(t)?t:[t];if(r){this.useMatches=r}}useMatches(t,r){throw new Error(`LineParser:useMatches not implemented`)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,r,i){const o=i&&t.exec(i);if(o){this.pushMatch(r,o)}return!!o}pushMatch(t,r){this.matches.push(...r.slice(1))}};H=class extends G{addMatch(t,r,i){return/^remote:\s/.test(String(i))&&super.addMatch(t,r,i)}pushMatch(t,r){if(t>0||r.length>1){super.pushMatch(t,r)}}}}});function createInstanceConfig(...t){const r=process.cwd();const i=Object.assign(__spreadValues({baseDir:r},Q),...t.filter((t=>typeof t==="object"&&t)));i.baseDir=i.baseDir||r;i.trimmed=i.trimmed===true;return i}var Q;var V=__esm({"src/lib/utils/simple-git-options.ts"(){Q={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:false}}});function appendTaskOptions(t,r=[]){if(!filterPlainObject(t)){return r}return Object.keys(t).reduce(((r,i)=>{const o=t[i];if(isPathSpec(o)){r.push(o)}else if(filterPrimitives(o,["boolean"])){r.push(i+"="+o)}else{r.push(i)}return r}),r)}function getTrailingOptions(t,r=0,i=false){const o=[];for(let i=0,a=r<0?t.length:r;i<a;i++){if("string|number".includes(typeof t[i])){o.push(String(t[i]))}}appendTaskOptions(trailingOptionsArgument(t),o);if(!i){o.push(...trailingArrayArgument(t))}return o}function trailingArrayArgument(t){const r=typeof last(t)==="function";return filterType(last(t,r?1:0),B,[])}function trailingOptionsArgument(t){const r=filterFunction(last(t));return filterType(last(t,r?1:0),filterPlainObject)}function trailingFunctionArgument(t,r=true){const i=asFunction(last(t));return r||isUserFunction(i)?i:void 0}var J=__esm({"src/lib/utils/task-options.ts"(){q();D();R()}});function callTaskParser(t,r){return t(r.stdOut,r.stdErr)}function parseStringResponse(t,r,i,o=true){asArray(i).forEach((i=>{for(let a=toLinesWithContent(i,o),l=0,u=a.length;l<u;l++){const line=(t=0)=>{if(l+t>=u){return}return a[l+t]};r.some((({parse:r})=>r(line,t)))}}));return t}var K=__esm({"src/lib/utils/task-parser.ts"(){D()}});var Z={};__export(Z,{ExitCodes:()=>L,GitOutputStreams:()=>U,LineParser:()=>G,NOOP:()=>A,NULL:()=>O,RemoteLineParser:()=>H,append:()=>append,appendTaskOptions:()=>appendTaskOptions,asArray:()=>asArray,asFunction:()=>asFunction,asNumber:()=>asNumber,asStringArray:()=>asStringArray,bufferToString:()=>bufferToString,callTaskParser:()=>callTaskParser,createInstanceConfig:()=>createInstanceConfig,delay:()=>delay,filterArray:()=>B,filterFunction:()=>filterFunction,filterHasLength:()=>$,filterPlainObject:()=>filterPlainObject,filterPrimitives:()=>filterPrimitives,filterString:()=>W,filterStringArray:()=>j,filterStringOrStringArray:()=>M,filterType:()=>filterType,first:()=>first,folderExists:()=>folderExists,forEachLineWithContent:()=>forEachLineWithContent,getTrailingOptions:()=>getTrailingOptions,including:()=>including,isUserFunction:()=>isUserFunction,last:()=>last,objectToString:()=>I,orVoid:()=>orVoid,parseStringResponse:()=>parseStringResponse,pick:()=>pick,prefixedArray:()=>prefixedArray,remove:()=>remove,splitOn:()=>splitOn,toLinesWithContent:()=>toLinesWithContent,trailingFunctionArgument:()=>trailingFunctionArgument,trailingOptionsArgument:()=>trailingOptionsArgument});var X=__esm({"src/lib/utils/index.ts"(){q();N();z();Y();V();J();K();D()}});var ee={};__export(ee,{CheckRepoActions:()=>te,checkIsBareRepoTask:()=>checkIsBareRepoTask,checkIsRepoRootTask:()=>checkIsRepoRootTask,checkIsRepoTask:()=>checkIsRepoTask});function checkIsRepoTask(t){switch(t){case"bare":return checkIsBareRepoTask();case"root":return checkIsRepoRootTask()}const r=["rev-parse","--is-inside-work-tree"];return{commands:r,format:"utf-8",onError:re,parser:se}}function checkIsRepoRootTask(){const t=["rev-parse","--git-dir"];return{commands:t,format:"utf-8",onError:re,parser(t){return/^\.(git)?$/.test(t.trim())}}}function checkIsBareRepoTask(){const t=["rev-parse","--is-bare-repository"];return{commands:t,format:"utf-8",onError:re,parser:se}}function isNotRepoMessage(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var te,re,se;var ne=__esm({"src/lib/tasks/check-is-repo.ts"(){X();te=(t=>{t["BARE"]="bare";t["IN_TREE"]="tree";t["IS_REPO_ROOT"]="root";return t})(te||{});re=({exitCode:t},r,i,o)=>{if(t===128&&isNotRepoMessage(r)){return i(Buffer.from("false"))}o(r)};se=t=>t.trim()==="true"}});function cleanSummaryParser(t,r){const i=new ie(t);const o=t?ae:oe;toLinesWithContent(r).forEach((t=>{const r=t.replace(o,"");i.paths.push(r);(le.test(r)?i.folders:i.files).push(r)}));return i}var ie,oe,ae,le;var ue=__esm({"src/lib/responses/CleanSummary.ts"(){X();ie=class{constructor(t){this.dryRun=t;this.paths=[];this.files=[];this.folders=[]}};oe=/^[a-z]+\s*/i;ae=/^[a-z]+\s+[a-z]+\s*/i;le=/\/$/}});var ce={};__export(ce,{EMPTY_COMMANDS:()=>de,adhocExecTask:()=>adhocExecTask,configurationErrorTask:()=>configurationErrorTask,isBufferTask:()=>isBufferTask,isEmptyTask:()=>isEmptyTask,straightThroughBufferTask:()=>straightThroughBufferTask,straightThroughStringTask:()=>straightThroughStringTask});function adhocExecTask(t){return{commands:de,format:"empty",parser:t}}function configurationErrorTask(t){return{commands:de,format:"empty",parser(){throw typeof t==="string"?new P(t):t}}}function straightThroughStringTask(t,r=false){return{commands:t,format:"utf-8",parser(t){return r?String(t).trim():t}}}function straightThroughBufferTask(t){return{commands:t,format:"buffer",parser(t){return t}}}function isBufferTask(t){return t.format==="buffer"}function isEmptyTask(t){return t.format==="empty"||!t.commands.length}var de;var he=__esm({"src/lib/tasks/task.ts"(){E();de=[]}});var fe={};__export(fe,{CONFIG_ERROR_INTERACTIVE_MODE:()=>pe,CONFIG_ERROR_MODE_REQUIRED:()=>me,CONFIG_ERROR_UNKNOWN_OPTION:()=>ge,CleanOptions:()=>be,cleanTask:()=>cleanTask,cleanWithOptionsTask:()=>cleanWithOptionsTask,isCleanOptionsArray:()=>isCleanOptionsArray});function cleanWithOptionsTask(t,r){const{cleanMode:i,options:o,valid:a}=getCleanOptions(t);if(!i){return configurationErrorTask(me)}if(!a.options){return configurationErrorTask(ge+JSON.stringify(t))}o.push(...r);if(o.some(isInteractiveMode)){return configurationErrorTask(pe)}return cleanTask(i,o)}function cleanTask(t,r){const i=["clean",`-${t}`,...r];return{commands:i,format:"utf-8",parser(r){return cleanSummaryParser(t==="n",r)}}}function isCleanOptionsArray(t){return Array.isArray(t)&&t.every((t=>ye.has(t)))}function getCleanOptions(t){let r;let i=[];let o={cleanMode:false,options:true};t.replace(/[^a-z]i/g,"").split("").forEach((t=>{if(isCleanMode(t)){r=t;o.cleanMode=true}else{o.options=o.options&&isKnownOption(i[i.length]=`-${t}`)}}));return{cleanMode:r,options:i,valid:o}}function isCleanMode(t){return t==="f"||t==="n"}function isKnownOption(t){return/^-[a-z]$/i.test(t)&&ye.has(t.charAt(1))}function isInteractiveMode(t){if(/^-[^\-]/.test(t)){return t.indexOf("i")>0}return t==="--interactive"}var pe,me,ge,be,ye;var Se=__esm({"src/lib/tasks/clean.ts"(){ue();X();he();pe="Git clean interactive mode is not supported";me='Git clean mode parameter ("n" or "f") is required';ge="Git clean unknown option found in: ";be=(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";return t})(be||{});ye=new Set(["i",...asStringArray(Object.values(be))])}});function configListParser(t){const r=new we;for(const i of configParser(t)){r.addValue(i.file,String(i.key),i.value)}return r}function configGetParser(t,r){let i=null;const o=[];const a=new Map;for(const l of configParser(t,r)){if(l.key!==r){continue}o.push(i=l.value);if(!a.has(l.file)){a.set(l.file,[])}a.get(l.file).push(i)}return{key:r,paths:Array.from(a.keys()),scopes:a,value:i,values:o}}function configFilePath(t){return t.replace(/^(file):/,"")}function*configParser(t,r=null){const i=t.split("\0");for(let t=0,o=i.length-1;t<o;){const o=configFilePath(i[t++]);let a=i[t++];let l=r;if(a.includes("\n")){const t=splitOn(a,"\n");l=t[0];a=t[1]}yield{file:o,key:l,value:a}}}var we;var ve=__esm({"src/lib/responses/ConfigList.ts"(){X();we=class{constructor(){this.files=[];this.values=Object.create(null)}get all(){if(!this._all){this._all=this.files.reduce(((t,r)=>Object.assign(t,this.values[r])),{})}return this._all}addFile(t){if(!(t in this.values)){const r=last(this.files);this.values[t]=r?Object.create(this.values[r]):{};this.files.push(t)}return this.values[t]}addValue(t,r,i){const o=this.addFile(t);if(!o.hasOwnProperty(r)){o[r]=i}else if(Array.isArray(o[r])){o[r].push(i)}else{o[r]=[o[r],i]}this._all=void 0}}}});function asConfigScope(t,r){if(typeof t==="string"&&Re.hasOwnProperty(t)){return t}return r}function addConfigTask(t,r,i,o){const a=["config",`--${o}`];if(i){a.push("--add")}a.push(t,r);return{commands:a,format:"utf-8",parser(t){return t}}}function getConfigTask(t,r){const i=["config","--null","--show-origin","--get-all",t];if(r){i.splice(1,0,`--${r}`)}return{commands:i,format:"utf-8",parser(r){return configGetParser(r,t)}}}function listConfigTask(t){const r=["config","--list","--show-origin","--null"];if(t){r.push(`--${t}`)}return{commands:r,format:"utf-8",parser(t){return configListParser(t)}}}function config_default(){return{addConfig(t,r,...i){return this._runTask(addConfigTask(t,r,i[0]===true,asConfigScope(i[1],"local")),trailingFunctionArgument(arguments))},getConfig(t,r){return this._runTask(getConfigTask(t,asConfigScope(r,void 0)),trailingFunctionArgument(arguments))},listConfig(...t){return this._runTask(listConfigTask(asConfigScope(t[0],void 0)),trailingFunctionArgument(arguments))}}}var Re;var _e=__esm({"src/lib/tasks/config.ts"(){ve();X();Re=(t=>{t["system"]="system";t["global"]="global";t["local"]="local";t["worktree"]="worktree";return t})(Re||{})}});function isDiffNameStatus(t){return Te.has(t)}var Ce,Te;var ke=__esm({"src/lib/tasks/diff-name-status.ts"(){Ce=(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";return t})(Ce||{});Te=new Set(Object.values(Ce))}});function grepQueryBuilder(...t){return(new Oe).param(...t)}function parseGrep(t){const r=new Set;const i={};forEachLineWithContent(t,(t=>{const[o,a,l]=t.split(O);r.add(o);(i[o]=i[o]||[]).push({line:asNumber(a),path:o,preview:l})}));return{paths:r,results:i}}function grep_default(){return{grep(t){const r=trailingFunctionArgument(arguments);const i=getTrailingOptions(arguments);for(const t of Pe){if(i.includes(t)){return this._runTask(configurationErrorTask(`git.grep: use of "${t}" is not supported.`),r)}}if(typeof t==="string"){t=grepQueryBuilder().param(t)}const o=["grep","--null","-n","--full-name",...i,...t];return this._runTask({commands:o,format:"utf-8",parser(t){return parseGrep(t)}},r)}}}var Pe,xe,Ee,Oe;var Ae=__esm({"src/lib/tasks/grep.ts"(){X();he();Pe=["-h"];xe=Symbol("grepQuery");Oe=class{constructor(){this[Ee]=[]}*[(Ee=xe,Symbol.iterator)](){for(const t of this[xe]){yield t}}and(...t){t.length&&this[xe].push("--and","(",...prefixedArray(t,"-e"),")");return this}param(...t){this[xe].push(...prefixedArray(t,"-e"));return this}}}});var Ie={};__export(Ie,{ResetMode:()=>De,getResetMode:()=>getResetMode,resetTask:()=>resetTask});function resetTask(t,r){const i=["reset"];if(isValidResetMode(t)){i.push(`--${t}`)}i.push(...r);return straightThroughStringTask(i)}function getResetMode(t){if(isValidResetMode(t)){return t}switch(typeof t){case"string":case"undefined":return"soft"}return}function isValidResetMode(t){return Be.includes(t)}var De,Be;var We=__esm({"src/lib/tasks/reset.ts"(){he();De=(t=>{t["MIXED"]="mixed";t["SOFT"]="soft";t["HARD"]="hard";t["MERGE"]="merge";t["KEEP"]="keep";return t})(De||{});Be=Array.from(Object.values(De))}});function createLog(){return l("simple-git")}function prefixedLogger(t,r,i){if(!r||!String(r).replace(/\s*/,"")){return!i?t:(r,...o)=>{t(r,...o);i(r,...o)}}return(o,...a)=>{t(`%s ${o}`,r,...a);if(i){i(o,...a)}}}function childLoggerName(t,r,{namespace:i}){if(typeof t==="string"){return t}const o=r&&r.namespace||"";if(o.startsWith(i)){return o.substr(i.length+1)}return o||i}function createLogger(t,r,i,o=createLog()){const a=t&&`[${t}]`||"";const l=[];const u=typeof r==="string"?o.extend(r):r;const c=childLoggerName(filterType(r,W),u,o);return step(i);function sibling(r,i){return append(l,createLogger(t,c.replace(/^[^:]+/,r),i,o))}function step(r){const i=r&&`[${r}]`||"";const l=u&&prefixedLogger(u,i)||A;const c=prefixedLogger(o,`${a} ${i}`,l);return Object.assign(u?l:c,{label:t,sibling:sibling,info:c,step:step})}}var je=__esm({"src/lib/git-logger.ts"(){X();l.formatters.L=t=>String($(t)?t.length:"-");l.formatters.B=t=>{if(Buffer.isBuffer(t)){return t.toString("utf8")}return I(t)}}});var Fe,Me;var $e=__esm({"src/lib/runners/tasks-pending-queue.ts"(){C();je();Fe=class{constructor(t="GitExecutor"){this.logLabel=t;this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){const r=Fe.getName(t.commands[0]);const i=createLogger(this.logLabel,r);return{task:t,logger:i,name:r}}push(t){const r=this.createProgress(t);r.logger("Adding task to the queue, commands = %o",t.commands);this._queue.set(t,r);return r}fatal(t){for(const[r,{logger:i}]of Array.from(this._queue.entries())){if(r===t.task){i.info(`Failed %o`,t);i(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)}else{i.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,t.message)}this.complete(r)}if(this._queue.size!==0){throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}}complete(t){const r=this.withProgress(t);if(r){this._queue.delete(t)}}attempt(t){const r=this.withProgress(t);if(!r){throw new _(void 0,"TasksPendingQueue: attempt called for an unknown task")}r.logger("Starting task");return r}static getName(t="empty"){return`task:${t}:${++Fe.counter}`}};Me=Fe;Me.counter=0}});function pluginContext(t,r){return{method:first(t.commands)||"",commands:r}}function onErrorReceived(t,r){return i=>{r(`[ERROR] child process exception %o`,i);t.push(Buffer.from(String(i.stack),"ascii"))}}function onDataReceived(t,r,i,o){return a=>{i(`%s received %L bytes`,r,a);o(`%B`,a);t.push(a)}}var qe;var Le=__esm({"src/lib/runners/git-executor-chain.ts"(){C();he();X();$e();qe=class{constructor(t,r,i){this._executor=t;this._scheduler=r;this._plugins=i;this._chain=Promise.resolve();this._queue=new Me}get binary(){return this._executor.binary}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){this._queue.push(t);return this._chain=this._chain.then((()=>this.attemptTask(t)))}attemptTask(t){return __async(this,null,(function*(){const r=yield this._scheduler.next();const onQueueComplete=()=>this._queue.complete(t);try{const{logger:r}=this._queue.attempt(t);return yield isEmptyTask(t)?this.attemptEmptyTask(t,r):this.attemptRemoteTask(t,r)}catch(r){throw this.onFatalException(t,r)}finally{onQueueComplete();r()}}))}onFatalException(t,r){const i=r instanceof _?Object.assign(r,{task:t}):new _(t,r&&String(r));this._chain=Promise.resolve();this._queue.fatal(i);return i}attemptRemoteTask(t,r){return __async(this,null,(function*(){const i=this._plugins.exec("spawn.args",[...t.commands],pluginContext(t,t.commands));const o=yield this.gitResponse(t,this.binary,i,this.outputHandler,r.step("SPAWN"));const a=yield this.handleTaskData(t,i,o,r.step("HANDLE"));r(`passing response to task's parser as a %s`,t.format);if(isBufferTask(t)){return callTaskParser(t.parser,a)}return callTaskParser(t.parser,a.asStrings())}))}attemptEmptyTask(t,r){return __async(this,null,(function*(){r(`empty task bypassing child process to call to task's parser`);return t.parser(this)}))}handleTaskData(t,r,i,o){const{exitCode:a,rejection:l,stdOut:u,stdErr:c}=i;return new Promise(((d,h)=>{o(`Preparing to handle process response exitCode=%d stdOut=`,a);const{error:p}=this._plugins.exec("task.error",{error:l},__spreadValues(__spreadValues({},pluginContext(t,r)),i));if(p&&t.onError){o.info(`exitCode=%s handling with custom error handler`);return t.onError(i,p,(t=>{o.info(`custom error handler treated as success`);o(`custom error returned a %s`,I(t));d(new U(Array.isArray(t)?Buffer.concat(t):t,Buffer.concat(c)))}),h)}if(p){o.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,a,c.length,l);return h(p)}o.info(`retrieving task output complete`);d(new U(Buffer.concat(u),Buffer.concat(c)))}))}gitResponse(t,r,i,o,a){return __async(this,null,(function*(){const l=a.sibling("output");const c=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:true},pluginContext(t,t.commands));return new Promise((d=>{const h=[];const p=[];a.info(`%s %o`,r,i);a("%O",c);let m=this._beforeSpawn(t,i);if(m){return d({stdOut:h,stdErr:p,exitCode:9901,rejection:m})}this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(t,i)),{kill(t){m=t||m}}));const g=(0,u.spawn)(r,i,c);g.stdout.on("data",onDataReceived(h,"stdOut",a,l.step("stdOut")));g.stderr.on("data",onDataReceived(p,"stdErr",a,l.step("stdErr")));g.on("error",onErrorReceived(p,a));if(o){a(`Passing child process stdOut/stdErr to custom outputHandler`);o(r,g.stdout,g.stderr,[...i])}this._plugins.exec("spawn.after",void 0,__spreadProps(__spreadValues({},pluginContext(t,i)),{spawned:g,close(t,r){d({stdOut:h,stdErr:p,exitCode:t,rejection:m||r})},kill(t){if(g.killed){return}m=t;g.kill("SIGINT")}}))}))}))}_beforeSpawn(t,r){let i;this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(t,r)),{kill(t){i=t||i}}));return i}}}});var Ne={};__export(Ne,{GitExecutor:()=>Ue});var Ue;var ze=__esm({"src/lib/runners/git-executor.ts"(){Le();Ue=class{constructor(t="git",r,i,o){this.binary=t;this.cwd=r;this._scheduler=i;this._plugins=o;this._chain=new qe(this,this._scheduler,this._plugins)}chain(){return new qe(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function taskCallback(t,r,i=A){const onSuccess=t=>{i(null,t)};const onError2=r=>{if((r==null?void 0:r.task)===t){i(r instanceof T?addDeprecationNoticeToError(r):r,void 0)}};r.then(onSuccess,onError2)}function addDeprecationNoticeToError(t){let log=t=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${t} should be GitResponseError.git.${t}, this will no longer be available in version 3`);log=A};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(descriptorReducer,{}));function descriptorReducer(r,i){if(i in t){return r}r[i]={enumerable:false,configurable:false,get(){log(i);return t.git[i]}};return r}}var Ge=__esm({"src/lib/task-callback.ts"(){k();X()}});function changeWorkingDirectoryTask(t,r){return adhocExecTask((i=>{if(!folderExists(t)){throw new Error(`Git.cwd: cannot change to non-directory "${t}"`)}return(r||i).cwd=t}))}var He=__esm({"src/lib/tasks/change-working-directory.ts"(){X();he()}});function checkoutTask(t){const r=["checkout",...t];if(r[1]==="-b"&&r.includes("-B")){r[1]=remove(r,"-B")}return straightThroughStringTask(r)}function checkout_default(){return{checkout(){return this._runTask(checkoutTask(getTrailingOptions(arguments,1)),trailingFunctionArgument(arguments))},checkoutBranch(t,r){return this._runTask(checkoutTask(["-b",t,r,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))},checkoutLocalBranch(t){return this._runTask(checkoutTask(["-b",t,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}}}var Ye=__esm({"src/lib/tasks/checkout.ts"(){X();he()}});function parseCommitResult(t){const r={author:null,branch:"",commit:"",root:false,summary:{changes:0,insertions:0,deletions:0}};return parseStringResponse(r,Qe,t)}var Qe;var Ve=__esm({"src/lib/parsers/parse-commit.ts"(){X();Qe=[new G(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,((t,[r,i,o])=>{t.branch=r;t.commit=o;t.root=!!i})),new G(/\s*Author:\s(.+)/i,((t,[r])=>{const i=r.split("<");const o=i.pop();if(!o||!o.includes("@")){return}t.author={email:o.substr(0,o.length-1),name:i.join("<").trim()}})),new G(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,((t,[r,i,o])=>{t.summary.changes=parseInt(r,10)||0;t.summary.insertions=parseInt(i,10)||0;t.summary.deletions=parseInt(o,10)||0})),new G(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,((t,[r,i,o])=>{t.summary.changes=parseInt(r,10)||0;const a=parseInt(i,10)||0;if(o==="-"){t.summary.deletions=a}else if(o==="+"){t.summary.insertions=a}}))]}});function commitTask(t,r,i){const o=["-c","core.abbrev=40","commit",...prefixedArray(t,"-m"),...r,...i];return{commands:o,format:"utf-8",parser:parseCommitResult}}function commit_default(){return{commit(t,...r){const i=trailingFunctionArgument(arguments);const o=rejectDeprecatedSignatures(t)||commitTask(asArray(t),asArray(filterType(r[0],M,[])),[...filterType(r[1],B,[]),...getTrailingOptions(arguments,0,true)]);return this._runTask(o,i)}};function rejectDeprecatedSignatures(t){return!M(t)&&configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Je=__esm({"src/lib/tasks/commit.ts"(){Ve();X();he()}});function first_commit_default(){return{firstCommit(){return this._runTask(straightThroughStringTask(["rev-list","--max-parents=0","HEAD"],true),trailingFunctionArgument(arguments))}}}var Ke=__esm({"src/lib/tasks/first-commit.ts"(){X();he()}});function hashObjectTask(t,r){const i=["hash-object",t];if(r){i.push("-w")}return straightThroughStringTask(i,true)}var Ze=__esm({"src/lib/tasks/hash-object.ts"(){he()}});function parseInit(t,r,i){const o=String(i).trim();let a;if(a=et.exec(o)){return new Xe(t,r,false,a[1])}if(a=tt.exec(o)){return new Xe(t,r,true,a[1])}let l="";const u=o.split(" ");while(u.length){const t=u.shift();if(t==="in"){l=u.join(" ");break}}return new Xe(t,r,/^re/i.test(o),l)}var Xe,et,tt;var rt=__esm({"src/lib/responses/InitSummary.ts"(){Xe=class{constructor(t,r,i,o){this.bare=t;this.path=r;this.existing=i;this.gitDir=o}};et=/^Init.+ repository in (.+)$/;tt=/^Rein.+ in (.+)$/}});function hasBareCommand(t){return t.includes(st)}function initTask(t=false,r,i){const o=["init",...i];if(t&&!hasBareCommand(o)){o.splice(1,0,st)}return{commands:o,format:"utf-8",parser(t){return parseInit(o.includes("--bare"),r,t)}}}var st;var nt=__esm({"src/lib/tasks/init.ts"(){rt();st="--bare"}});function logFormatFromCommand(t){for(let r=0;r<t.length;r++){const i=it.exec(t[r]);if(i){return`--${i[1]}`}}return""}function isLogFormat(t){return it.test(t)}var it;var ot=__esm({"src/lib/args/log-format.ts"(){it=/^--(stat|numstat|name-only|name-status)(=|$)/}});var at;var lt=__esm({"src/lib/responses/DiffSummary.ts"(){at=class{constructor(){this.changed=0;this.deletions=0;this.insertions=0;this.files=[]}}}});function getDiffParser(t=""){const r=ft[t];return t=>parseStringResponse(new at,r,t,false)}var ut,ct,dt,ht,ft;var pt=__esm({"src/lib/parsers/parse-diff-summary.ts"(){ot();lt();ke();X();ut=[new G(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,((t,[r,i,o=""])=>{t.files.push({file:r.trim(),changes:asNumber(i),insertions:o.replace(/[^+]/g,"").length,deletions:o.replace(/[^-]/g,"").length,binary:false})})),new G(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,((t,[r,i,o])=>{t.files.push({file:r.trim(),before:asNumber(i),after:asNumber(o),binary:true})})),new G(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,((t,[r,i])=>{const o=/(\d+) i/.exec(i);const a=/(\d+) d/.exec(i);t.changed=asNumber(r);t.insertions=asNumber(o==null?void 0:o[1]);t.deletions=asNumber(a==null?void 0:a[1])}))];ct=[new G(/(\d+)\t(\d+)\t(.+)$/,((t,[r,i,o])=>{const a=asNumber(r);const l=asNumber(i);t.changed++;t.insertions+=a;t.deletions+=l;t.files.push({file:o,changes:a+l,insertions:a,deletions:l,binary:false})})),new G(/-\t-\t(.+)$/,((t,[r])=>{t.changed++;t.files.push({file:r,after:0,before:0,binary:true})}))];dt=[new G(/(.+)$/,((t,[r])=>{t.changed++;t.files.push({file:r,changes:0,insertions:0,deletions:0,binary:false})}))];ht=[new G(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,((t,[r,i,o,a,l])=>{t.changed++;t.files.push({file:l!=null?l:o,changes:0,status:orVoid(isDiffNameStatus(r)&&r),insertions:0,deletions:0,binary:false})}))];ft={[""]:ut,["--stat"]:ut,["--numstat"]:ct,["--name-status"]:ht,["--name-only"]:dt}}});function lineBuilder(t,r){return r.reduce(((r,i,o)=>{r[i]=t[o]||"";return r}),Object.create({diff:null}))}function createListLogSummaryParser(t=bt,r=yt,i=""){const o=getDiffParser(i);return function(i){const a=toLinesWithContent(i,true,mt).map((function(i){const a=i.trim().split(gt);const l=lineBuilder(a[0].trim().split(t),r);if(a.length>1&&!!a[1].trim()){l.diff=o(a[1])}return l}));return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var mt,gt,bt,yt;var St=__esm({"src/lib/parsers/parse-list-log-summary.ts"(){X();pt();ot();mt="òòòòòò ";gt=" òò";bt=" ò ";yt=["hash","date","message","refs","author_name","author_email"]}});var wt={};__export(wt,{diffSummaryTask:()=>diffSummaryTask,validateLogFormatConfig:()=>validateLogFormatConfig});function diffSummaryTask(t){let r=logFormatFromCommand(t);const i=["diff"];if(r===""){r="--stat";i.push("--stat=4096")}i.push(...t);return validateLogFormatConfig(i)||{commands:i,format:"utf-8",parser:getDiffParser(r)}}function validateLogFormatConfig(t){const r=t.filter(isLogFormat);if(r.length>1){return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${r.join(",")}`)}if(r.length&&t.includes("-z")){return configurationErrorTask(`Summary flag ${r} parsing is not compatible with null termination option '-z'`)}}var vt=__esm({"src/lib/tasks/diff.ts"(){ot();pt();he()}});function prettyFormat(t,r){const i=[];const o=[];Object.keys(t).forEach((r=>{i.push(r);o.push(String(t[r]))}));return[i,o.join(r)]}function userOptions(t){return Object.keys(t).reduce(((r,i)=>{if(!(i in Rt)){r[i]=t[i]}return r}),{})}function parseLogOptions(t={},r=[]){const i=filterType(t.splitter,W,bt);const o=!filterPrimitives(t.format)&&t.format?t.format:{hash:"%H",date:t.strictDate===false?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==false?"%aN":"%an",author_email:t.mailMap!==false?"%aE":"%ae"};const[a,l]=prettyFormat(o,i);const u=[];const c=[`--pretty=format:${mt}${l}${gt}`,...r];const d=t.n||t["max-count"]||t.maxCount;if(d){c.push(`--max-count=${d}`)}if(t.from||t.to){const r=t.symmetric!==false?"...":"..";u.push(`${t.from||""}${r}${t.to||""}`)}if(W(t.file)){c.push("--follow",pathspec(t.file))}appendTaskOptions(userOptions(t),c);return{fields:a,splitter:i,commands:[...c,...u]}}function logTask(t,r,i){const o=createListLogSummaryParser(t,r,logFormatFromCommand(i));return{commands:["log",...i],format:"utf-8",parser:o}}function log_default(){return{log(...t){const r=trailingFunctionArgument(arguments);const i=parseLogOptions(trailingOptionsArgument(arguments),filterType(arguments[0],B));const o=rejectDeprecatedSignatures(...t)||validateLogFormatConfig(i.commands)||createLogTask(i);return this._runTask(o,r)}};function createLogTask(t){return logTask(t.splitter,t.fields,t.commands)}function rejectDeprecatedSignatures(t,r){return W(t)&&W(r)&&configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var Rt;var _t=__esm({"src/lib/tasks/log.ts"(){ot();R();St();X();he();vt();Rt=(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";return t})(Rt||{})}});var Ct,Tt;var kt=__esm({"src/lib/responses/MergeSummary.ts"(){Ct=class{constructor(t,r=null,i){this.reason=t;this.file=r;this.meta=i}toString(){return`${this.file}:${this.reason}`}};Tt=class{constructor(){this.conflicts=[];this.merges=[];this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){if(this.conflicts.length){return`CONFLICTS: ${this.conflicts.join(", ")}`}return"OK"}}}});var Pt,xt;var Et=__esm({"src/lib/responses/PullSummary.ts"(){Pt=class{constructor(){this.remoteMessages={all:[]};this.created=[];this.deleted=[];this.files=[];this.deletions={};this.insertions={};this.summary={changes:0,deletions:0,insertions:0}}};xt=class{constructor(){this.remote="";this.hash={local:"",remote:""};this.branch={local:"",remote:""};this.message=""}toString(){return this.message}}}});function objectEnumerationResult(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 asObjectCount(t){const r=/^\s*(\d+)/.exec(t);const i=/delta (\d+)/i.exec(t);return{count:asNumber(r&&r[1]||"0"),delta:asNumber(i&&i[1]||"0")}}var Ot;var At=__esm({"src/lib/parsers/parse-remote-objects.ts"(){X();Ot=[new H(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,((t,[r,i])=>{const o=r.toLowerCase();const a=objectEnumerationResult(t.remoteMessages);Object.assign(a,{[o]:asNumber(i)})})),new H(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,((t,[r,i])=>{const o=r.toLowerCase();const a=objectEnumerationResult(t.remoteMessages);Object.assign(a,{[o]:asNumber(i)})})),new H(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,((t,[r,i,o])=>{const a=objectEnumerationResult(t.remoteMessages);a.total=asObjectCount(r);a.reused=asObjectCount(i);a.packReused=asNumber(o)}))]}});function parseRemoteMessages(t,r){return parseStringResponse({remoteMessages:new Dt},It,r)}var It,Dt;var Bt=__esm({"src/lib/parsers/parse-remote-messages.ts"(){X();At();It=[new H(/^remote:\s*(.+)$/,((t,[r])=>{t.remoteMessages.all.push(r.trim());return false})),...Ot,new H([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],((t,[r])=>{t.remoteMessages.pullRequestUrl=r})),new H([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],((t,[r,i,o])=>{t.remoteMessages.vulnerabilities={count:asNumber(r),summary:i,url:o}}))];Dt=class{constructor(){this.all=[]}}}});function parsePullErrorResult(t,r){const i=parseStringResponse(new xt,$t,[t,r]);return i.message&&i}var Wt,jt,Ft,Mt,$t,qt,Lt;var Nt=__esm({"src/lib/parsers/parse-pull.ts"(){Et();X();Bt();Wt=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;jt=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;Ft=/^(create|delete) mode \d+ (.+)/;Mt=[new G(Wt,((t,[r,i,o])=>{t.files.push(r);if(i){t.insertions[r]=i.length}if(o){t.deletions[r]=o.length}})),new G(jt,((t,[r,,i,,o])=>{if(i!==void 0||o!==void 0){t.summary.changes=+r||0;t.summary.insertions=+i||0;t.summary.deletions=+o||0;return true}return false})),new G(Ft,((t,[r,i])=>{append(t.files,i);append(r==="create"?t.created:t.deleted,i)}))];$t=[new G(/^from\s(.+)$/i,((t,[r])=>void(t.remote=r))),new G(/^fatal:\s(.+)$/,((t,[r])=>void(t.message=r))),new G(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,((t,[r,i,o,a])=>{t.branch.local=o;t.hash.local=r;t.branch.remote=a;t.hash.remote=i}))];qt=(t,r)=>parseStringResponse(new Pt,Mt,[t,r]);Lt=(t,r)=>Object.assign(new Pt,qt(t,r),parseRemoteMessages(t,r))}});var Ut,zt,Gt;var Ht=__esm({"src/lib/parsers/parse-merge.ts"(){kt();X();Nt();Ut=[new G(/^Auto-merging\s+(.+)$/,((t,[r])=>{t.merges.push(r)})),new G(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,((t,[r,i])=>{t.conflicts.push(new Ct(r,i))})),new G(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,((t,[r,i,o])=>{t.conflicts.push(new Ct(r,i,{deleteRef:o}))})),new G(/^CONFLICT\s+\((.+)\):/,((t,[r])=>{t.conflicts.push(new Ct(r,null))})),new G(/^Automatic merge failed;\s+(.+)$/,((t,[r])=>{t.result=r}))];zt=(t,r)=>Object.assign(Gt(t,r),Lt(t,r));Gt=t=>parseStringResponse(new Tt,Ut,t)}});function mergeTask(t){if(!t.length){return configurationErrorTask("Git.merge requires at least one option")}return{commands:["merge",...t],format:"utf-8",parser(t,r){const i=zt(t,r);if(i.failed){throw new T(i)}return i}}}var Yt=__esm({"src/lib/tasks/merge.ts"(){k();Ht();he()}});function pushResultPushedItem(t,r,i){const o=i.includes("deleted");const a=i.includes("tag")||/^refs\/tags/.test(t);const l=!i.includes("new");return{deleted:o,tag:a,branch:!a,new:!l,alreadyUpdated:l,local:t,remote:r}}var Qt,Vt,Jt;var Kt=__esm({"src/lib/parsers/parse-push.ts"(){X();Bt();Qt=[new G(/^Pushing to (.+)$/,((t,[r])=>{t.repo=r})),new G(/^updating local tracking ref '(.+)'/,((t,[r])=>{t.ref=__spreadProps(__spreadValues({},t.ref||{}),{local:r})})),new G(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,((t,[r,i,o])=>{t.pushed.push(pushResultPushedItem(r,i,o))})),new G(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,((t,[r,i,o])=>{t.branch=__spreadProps(__spreadValues({},t.branch||{}),{local:r,remote:i,remoteName:o})})),new G(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,((t,[r,i,o,a])=>{t.update={head:{local:r,remote:i},hash:{from:o,to:a}}}))];Vt=(t,r)=>{const i=Jt(t,r);const o=parseRemoteMessages(t,r);return __spreadValues(__spreadValues({},i),o)};Jt=(t,r)=>parseStringResponse({pushed:[]},Qt,[t,r])}});var Zt={};__export(Zt,{pushTagsTask:()=>pushTagsTask,pushTask:()=>pushTask});function pushTagsTask(t={},r){append(r,"--tags");return pushTask(t,r)}function pushTask(t={},r){const i=["push",...r];if(t.branch){i.splice(1,0,t.branch)}if(t.remote){i.splice(1,0,t.remote)}remove(i,"-v");append(i,"--verbose");append(i,"--porcelain");return{commands:i,format:"utf-8",parser:Vt}}var Xt=__esm({"src/lib/tasks/push.ts"(){Kt();X()}});function show_default(){return{showBuffer(){const t=["show",...getTrailingOptions(arguments,1)];if(!t.includes("--binary")){t.splice(1,0,"--binary")}return this._runTask(straightThroughBufferTask(t),trailingFunctionArgument(arguments))},show(){const t=["show",...getTrailingOptions(arguments,1)];return this._runTask(straightThroughStringTask(t),trailingFunctionArgument(arguments))}}}var er=__esm({"src/lib/tasks/show.ts"(){X();he()}});var tr,rr;var sr=__esm({"src/lib/responses/FileStatusSummary.ts"(){tr=/^(.+) -> (.+)$/;rr=class{constructor(t,r,i){this.path=t;this.index=r;this.working_dir=i;if(r+i==="R"){const r=tr.exec(t)||[null,t,t];this.from=r[1]||"";this.path=r[2]||""}}}}});function renamedFile(t){const[r,i]=t.split(O);return{from:i||r,to:r}}function parser2(t,r,i){return[`${t}${r}`,i]}function conflicts(t,...r){return r.map((r=>parser2(t,r,((t,r)=>append(t.conflicted,r)))))}function splitLine(t,r){const i=r.trim();switch(" "){case i.charAt(2):return data(i.charAt(0),i.charAt(1),i.substr(3));case i.charAt(1):return data(" ",i.charAt(0),i.substr(2));default:return}function data(r,i,o){const a=`${r}${i}`;const l=ir.get(a);if(l){l(t,o)}if(a!=="##"&&a!=="!!"){t.files.push(new rr(o.replace(/\0.+$/,""),r,i))}}}var nr,ir,or;var ar=__esm({"src/lib/responses/StatusSummary.ts"(){X();sr();nr=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=false;this.isClean=()=>!this.files.length}};ir=new Map([parser2(" ","A",((t,r)=>append(t.created,r))),parser2(" ","D",((t,r)=>append(t.deleted,r))),parser2(" ","M",((t,r)=>append(t.modified,r))),parser2("A"," ",((t,r)=>append(t.created,r)&&append(t.staged,r))),parser2("A","M",((t,r)=>append(t.created,r)&&append(t.staged,r)&&append(t.modified,r))),parser2("D"," ",((t,r)=>append(t.deleted,r)&&append(t.staged,r))),parser2("M"," ",((t,r)=>append(t.modified,r)&&append(t.staged,r))),parser2("M","M",((t,r)=>append(t.modified,r)&&append(t.staged,r))),parser2("R"," ",((t,r)=>{append(t.renamed,renamedFile(r))})),parser2("R","M",((t,r)=>{const i=renamedFile(r);append(t.renamed,i);append(t.modified,i.to)})),parser2("!","!",((t,r)=>{append(t.ignored=t.ignored||[],r)})),parser2("?","?",((t,r)=>append(t.not_added,r))),...conflicts("A","A","U"),...conflicts("D","D","U"),...conflicts("U","A","D","U"),["##",(t,r)=>{const i=/ahead (\d+)/;const o=/behind (\d+)/;const a=/^(.+?(?=(?:\.{3}|\s|$)))/;const l=/\.{3}(\S*)/;const u=/\son\s([\S]+)$/;let c;c=i.exec(r);t.ahead=c&&+c[1]||0;c=o.exec(r);t.behind=c&&+c[1]||0;c=a.exec(r);t.current=c&&c[1];c=l.exec(r);t.tracking=c&&c[1];c=u.exec(r);t.current=c&&c[1]||t.current;t.detached=/\(no branch\)/.test(r)}]]);or=function(t){const r=t.split(O);const i=new nr;for(let t=0,o=r.length;t<o;){let o=r[t++].trim();if(!o){continue}if(o.charAt(0)==="R"){o+=O+(r[t++]||"")}splitLine(i,o)}return i}}});function statusTask(t){const r=["status","--porcelain","-b","-u","--null",...t.filter((t=>!lr.includes(t)))];return{format:"utf-8",commands:r,parser(t){return or(t)}}}var lr;var ur=__esm({"src/lib/tasks/status.ts"(){ar();lr=["--null","-z"]}});function versionResponse(t=0,r=0,i=0,o="",a=true){return Object.defineProperty({major:t,minor:r,patch:i,agent:o,installed:a},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:false,enumerable:false})}function notInstalledResponse(){return versionResponse(0,0,0,"",false)}function version_default(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:versionParser,onError(t,r,i,o){if(t.exitCode===-2){return i(Buffer.from(cr))}o(r)}})}}}function versionParser(t){if(t===cr){return notInstalledResponse()}return parseStringResponse(versionResponse(0,0,0,t),dr,t)}var cr,dr;var hr=__esm({"src/lib/tasks/version.ts"(){X();cr="installed=false";dr=[new G(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,((t,[r,i,o,a=""])=>{Object.assign(t,versionResponse(asNumber(r),asNumber(i),asNumber(o),a))})),new G(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,((t,[r,i,o,a=""])=>{Object.assign(t,versionResponse(asNumber(r),asNumber(i),o,a))}))]}});var fr={};__export(fr,{SimpleGitApi:()=>pr});var pr;var mr=__esm({"src/lib/simple-git-api.ts"(){Ge();He();Ye();Je();_e();Ke();Ae();Ze();nt();_t();Yt();Xt();er();ur();he();hr();X();pr=class{constructor(t){this._executor=t}_runTask(t,r){const i=this._executor.chain();const o=i.push(t);if(r){taskCallback(t,o,r)}return Object.create(this,{then:{value:o.then.bind(o)},catch:{value:o.catch.bind(o)},_executor:{value:i}})}add(t){return this._runTask(straightThroughStringTask(["add",...asArray(t)]),trailingFunctionArgument(arguments))}cwd(t){const r=trailingFunctionArgument(arguments);if(typeof t==="string"){return this._runTask(changeWorkingDirectoryTask(t,this._executor),r)}if(typeof(t==null?void 0:t.path)==="string"){return this._runTask(changeWorkingDirectoryTask(t.path,t.root&&this._executor||void 0),r)}return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),r)}hashObject(t,r){return this._runTask(hashObjectTask(t,r===true),trailingFunctionArgument(arguments))}init(t){return this._runTask(initTask(t===true,this._executor.cwd,getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}merge(){return this._runTask(mergeTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}mergeFromTo(t,r){if(!(W(t)&&W(r))){return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}return this._runTask(mergeTask([t,r,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments,false))}outputHandler(t){this._executor.outputHandler=t;return this}push(){const t=pushTask({remote:filterType(arguments[0],W),branch:filterType(arguments[1],W)},getTrailingOptions(arguments));return this._runTask(t,trailingFunctionArgument(arguments))}stash(){return this._runTask(straightThroughStringTask(["stash",...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}status(){return this._runTask(statusTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}};Object.assign(pr.prototype,checkout_default(),commit_default(),config_default(),first_commit_default(),grep_default(),log_default(),show_default(),version_default())}});var gr={};__export(gr,{Scheduler:()=>yr});var br,yr;var Sr=__esm({"src/lib/runners/scheduler.ts"(){X();je();br=(()=>{let t=0;return()=>{t++;const{promise:r,done:i}=(0,c.dD)();return{promise:r,done:i,id:t}}})();yr=class{constructor(t=2){this.concurrency=t;this.logger=createLogger("","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}const t=append(this.running,this.pending.shift());this.logger(`Attempting id=%s`,t.id);t.done((()=>{this.logger(`Completing id=`,t.id);remove(this.running,t);this.schedule()}))}next(){const{promise:t,id:r}=append(this.pending,br());this.logger(`Scheduling id=%s`,r);this.schedule();return t}}}});var wr={};__export(wr,{applyPatchTask:()=>applyPatchTask});function applyPatchTask(t,r){return straightThroughStringTask(["apply",...r,...t])}var vr=__esm({"src/lib/tasks/apply-patch.ts"(){he()}});function branchDeletionSuccess(t,r){return{branch:t,hash:r,success:true}}function branchDeletionFailure(t){return{branch:t,hash:null,success:false}}var Rr;var _r=__esm({"src/lib/responses/BranchDeleteSummary.ts"(){Rr=class{constructor(){this.all=[];this.branches={};this.errors=[]}get success(){return!this.errors.length}}}});function hasBranchDeletionError(t,r){return r===1&&Tr.test(t)}var Cr,Tr,kr,Pr;var xr=__esm({"src/lib/parsers/parse-branch-delete.ts"(){_r();X();Cr=/(\S+)\s+\(\S+\s([^)]+)\)/;Tr=/^error[^']+'([^']+)'/m;kr=[new G(Cr,((t,[r,i])=>{const o=branchDeletionSuccess(r,i);t.all.push(o);t.branches[r]=o})),new G(Tr,((t,[r])=>{const i=branchDeletionFailure(r);t.errors.push(i);t.all.push(i);t.branches[r]=i}))];Pr=(t,r)=>parseStringResponse(new Rr,kr,[t,r])}});var Er;var Or=__esm({"src/lib/responses/BranchSummary.ts"(){Er=class{constructor(){this.all=[];this.branches={};this.current="";this.detached=false}push(t,r,i,o,a){if(t==="*"){this.detached=r;this.current=i}this.all.push(i);this.branches[i]={current:t==="*",linkedWorkTree:t==="+",name:i,commit:o,label:a}}}}});function branchStatus(t){return t?t.charAt(0):""}function parseBranchSummary(t){return parseStringResponse(new Er,Ar,t)}var Ar;var Ir=__esm({"src/lib/parsers/parse-branch.ts"(){Or();X();Ar=[new G(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,((t,[r,i,o,a])=>{t.push(branchStatus(r),true,i,o,a)})),new G(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,((t,[r,i,o,a])=>{t.push(branchStatus(r),false,i,o,a)}))]}});var Dr={};__export(Dr,{branchLocalTask:()=>branchLocalTask,branchTask:()=>branchTask,containsDeleteBranchCommand:()=>containsDeleteBranchCommand,deleteBranchTask:()=>deleteBranchTask,deleteBranchesTask:()=>deleteBranchesTask});function containsDeleteBranchCommand(t){const r=["-d","-D","--delete"];return t.some((t=>r.includes(t)))}function branchTask(t){const r=containsDeleteBranchCommand(t);const i=["branch",...t];if(i.length===1){i.push("-a")}if(!i.includes("-v")){i.splice(1,0,"-v")}return{format:"utf-8",commands:i,parser(t,i){if(r){return Pr(t,i).all[0]}return parseBranchSummary(t)}}}function branchLocalTask(){const t=parseBranchSummary;return{format:"utf-8",commands:["branch","-v"],parser:t}}function deleteBranchesTask(t,r=false){return{format:"utf-8",commands:["branch","-v",r?"-D":"-d",...t],parser(t,r){return Pr(t,r)},onError({exitCode:t,stdOut:r},i,o,a){if(!hasBranchDeletionError(String(i),t)){return a(i)}o(r)}}}function deleteBranchTask(t,r=false){const i={format:"utf-8",commands:["branch","-v",r?"-D":"-d",t],parser(r,i){return Pr(r,i).branches[t]},onError({exitCode:t,stdErr:r,stdOut:o},a,l,u){if(!hasBranchDeletionError(String(a),t)){return u(a)}throw new T(i.parser(bufferToString(o),bufferToString(r)),String(a))}};return i}var Br=__esm({"src/lib/tasks/branch.ts"(){k();xr();Ir();X()}});var Wr;var jr=__esm({"src/lib/responses/CheckIgnore.ts"(){Wr=t=>t.split(/\n/g).map((t=>t.trim())).filter((t=>!!t))}});var Fr={};__export(Fr,{checkIgnoreTask:()=>checkIgnoreTask});function checkIgnoreTask(t){return{commands:["check-ignore",...t],format:"utf-8",parser:Wr}}var Mr=__esm({"src/lib/tasks/check-ignore.ts"(){jr()}});var $r={};__export($r,{cloneMirrorTask:()=>cloneMirrorTask,cloneTask:()=>cloneTask});function disallowedCommand(t){return/^--upload-pack(=|$)/.test(t)}function cloneTask(t,r,i){const o=["clone",...i];W(t)&&o.push(t);W(r)&&o.push(r);const a=o.find(disallowedCommand);if(a){return configurationErrorTask(`git.fetch: potential exploit argument blocked.`)}return straightThroughStringTask(o)}function cloneMirrorTask(t,r,i){append(i,"--mirror");return cloneTask(t,r,i)}var qr=__esm({"src/lib/tasks/clone.ts"(){he();X()}});function parseFetchResult(t,r){const i={raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]};return parseStringResponse(i,Lr,[t,r])}var Lr;var Nr=__esm({"src/lib/parsers/parse-fetch.ts"(){X();Lr=[new G(/From (.+)$/,((t,[r])=>{t.remote=r})),new G(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,((t,[r,i])=>{t.branches.push({name:r,tracking:i})})),new G(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,((t,[r,i])=>{t.tags.push({name:r,tracking:i})})),new G(/- \[deleted]\s+\S+\s*-> (.+)$/,((t,[r])=>{t.deleted.push({tracking:r})})),new G(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,((t,[r,i,o,a])=>{t.updated.push({name:o,tracking:a,to:i,from:r})}))]}});var Ur={};__export(Ur,{fetchTask:()=>fetchTask});function disallowedCommand2(t){return/^--upload-pack(=|$)/.test(t)}function fetchTask(t,r,i){const o=["fetch",...i];if(t&&r){o.push(t,r)}const a=o.find(disallowedCommand2);if(a){return configurationErrorTask(`git.fetch: potential exploit argument blocked.`)}return{commands:o,format:"utf-8",parser:parseFetchResult}}var zr=__esm({"src/lib/tasks/fetch.ts"(){Nr();he()}});function parseMoveResult(t){return parseStringResponse({moves:[]},Gr,t)}var Gr;var Hr=__esm({"src/lib/parsers/parse-move.ts"(){X();Gr=[new G(/^Renaming (.+) to (.+)$/,((t,[r,i])=>{t.moves.push({from:r,to:i})}))]}});var Yr={};__export(Yr,{moveTask:()=>moveTask});function moveTask(t,r){return{commands:["mv","-v",...asArray(t),r],format:"utf-8",parser:parseMoveResult}}var Qr=__esm({"src/lib/tasks/move.ts"(){Hr();X()}});var Vr={};__export(Vr,{pullTask:()=>pullTask});function pullTask(t,r,i){const o=["pull",...i];if(t&&r){o.splice(1,0,t,r)}return{commands:o,format:"utf-8",parser(t,r){return Lt(t,r)},onError(t,r,i,o){const a=parsePullErrorResult(bufferToString(t.stdOut),bufferToString(t.stdErr));if(a){return o(new T(a))}o(r)}}}var Jr=__esm({"src/lib/tasks/pull.ts"(){k();Nt();X()}});function parseGetRemotes(t){const r={};forEach(t,(([t])=>r[t]={name:t}));return Object.values(r)}function parseGetRemotesVerbose(t){const r={};forEach(t,(([t,i,o])=>{if(!r.hasOwnProperty(t)){r[t]={name:t,refs:{fetch:"",push:""}}}if(o&&i){r[t].refs[o.replace(/[^a-z]/g,"")]=i}}));return Object.values(r)}function forEach(t,r){forEachLineWithContent(t,(t=>r(t.split(/\s+/))))}var Kr=__esm({"src/lib/responses/GetRemoteSummary.ts"(){X()}});var Zr={};__export(Zr,{addRemoteTask:()=>addRemoteTask,getRemotesTask:()=>getRemotesTask,listRemotesTask:()=>listRemotesTask,remoteTask:()=>remoteTask,removeRemoteTask:()=>removeRemoteTask});function addRemoteTask(t,r,i=[]){return straightThroughStringTask(["remote","add",...i,t,r])}function getRemotesTask(t){const r=["remote"];if(t){r.push("-v")}return{commands:r,format:"utf-8",parser:t?parseGetRemotesVerbose:parseGetRemotes}}function listRemotesTask(t=[]){const r=[...t];if(r[0]!=="ls-remote"){r.unshift("ls-remote")}return straightThroughStringTask(r)}function remoteTask(t=[]){const r=[...t];if(r[0]!=="remote"){r.unshift("remote")}return straightThroughStringTask(r)}function removeRemoteTask(t){return straightThroughStringTask(["remote","remove",t])}var Xr=__esm({"src/lib/tasks/remote.ts"(){Kr();he()}});var es={};__export(es,{stashListTask:()=>stashListTask});function stashListTask(t={},r){const i=parseLogOptions(t);const o=["stash","list",...i.commands,...r];const a=createListLogSummaryParser(i.splitter,i.fields,logFormatFromCommand(o));return validateLogFormatConfig(o)||{commands:o,format:"utf-8",parser:a}}var ts=__esm({"src/lib/tasks/stash-list.ts"(){ot();St();vt();_t()}});var rs={};__export(rs,{addSubModuleTask:()=>addSubModuleTask,initSubModuleTask:()=>initSubModuleTask,subModuleTask:()=>subModuleTask,updateSubModuleTask:()=>updateSubModuleTask});function addSubModuleTask(t,r){return subModuleTask(["add",t,r])}function initSubModuleTask(t){return subModuleTask(["init",...t])}function subModuleTask(t){const r=[...t];if(r[0]!=="submodule"){r.unshift("submodule")}return straightThroughStringTask(r)}function updateSubModuleTask(t){return subModuleTask(["update",...t])}var ss=__esm({"src/lib/tasks/sub-module.ts"(){he()}});function singleSorted(t,r){const i=isNaN(t);const o=isNaN(r);if(i!==o){return i?1:-1}return i?sorted(t,r):0}function sorted(t,r){return t===r?0:t>r?1:-1}function trimmed(t){return t.trim()}function toNumber(t){if(typeof t==="string"){return parseInt(t.replace(/^\D+/g,""),10)||0}return 0}var ns,is;var os=__esm({"src/lib/responses/TagList.ts"(){ns=class{constructor(t,r){this.all=t;this.latest=r}};is=function(t,r=false){const i=t.split("\n").map(trimmed).filter(Boolean);if(!r){i.sort((function(t,r){const i=t.split(".");const o=r.split(".");if(i.length===1||o.length===1){return singleSorted(toNumber(i[0]),toNumber(o[0]))}for(let t=0,r=Math.max(i.length,o.length);t<r;t++){const r=sorted(toNumber(i[t]),toNumber(o[t]));if(r){return r}}return 0}))}const o=r?i[0]:[...i].reverse().find((t=>t.indexOf(".")>=0));return new ns(i,o)}}});var as={};__export(as,{addAnnotatedTagTask:()=>addAnnotatedTagTask,addTagTask:()=>addTagTask,tagListTask:()=>tagListTask});function tagListTask(t=[]){const r=t.some((t=>/^--sort=/.test(t)));return{format:"utf-8",commands:["tag","-l",...t],parser(t){return is(t,r)}}}function addTagTask(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function addAnnotatedTagTask(t,r){return{format:"utf-8",commands:["tag","-a","-m",r,t],parser(){return{name:t}}}}var ls=__esm({"src/lib/tasks/tag.ts"(){os()}});var us=__commonJS({"src/git.js"(t,r){var{GitExecutor:i}=(ze(),w(Ne));var{SimpleGitApi:o}=(mr(),w(fr));var{Scheduler:a}=(Sr(),w(gr));var{configurationErrorTask:l}=(he(),w(ce));var{asArray:u,filterArray:c,filterPrimitives:d,filterString:h,filterStringOrStringArray:p,filterType:m,getTrailingOptions:g,trailingFunctionArgument:b,trailingOptionsArgument:y}=(X(),w(Z));var{applyPatchTask:S}=(vr(),w(wr));var{branchTask:v,branchLocalTask:R,deleteBranchesTask:_,deleteBranchTask:C}=(Br(),w(Dr));var{checkIgnoreTask:T}=(Mr(),w(Fr));var{checkIsRepoTask:k}=(ne(),w(ee));var{cloneTask:P,cloneMirrorTask:E}=(qr(),w($r));var{cleanWithOptionsTask:O,isCleanOptionsArray:A}=(Se(),w(fe));var{diffSummaryTask:I}=(vt(),w(wt));var{fetchTask:D}=(zr(),w(Ur));var{moveTask:B}=(Qr(),w(Yr));var{pullTask:W}=(Jr(),w(Vr));var{pushTagsTask:j}=(Xt(),w(Zt));var{addRemoteTask:M,getRemotesTask:$,listRemotesTask:q,remoteTask:L,removeRemoteTask:N}=(Xr(),w(Zr));var{getResetMode:U,resetTask:z}=(We(),w(Ie));var{stashListTask:G}=(ts(),w(es));var{addSubModuleTask:H,initSubModuleTask:Y,subModuleTask:Q,updateSubModuleTask:V}=(ss(),w(rs));var{addAnnotatedTagTask:J,addTagTask:K,tagListTask:te}=(ls(),w(as));var{straightThroughBufferTask:re,straightThroughStringTask:se}=(he(),w(ce));function Git2(t,r){this._executor=new i(t.binary,t.baseDir,new a(t.maxConcurrentProcesses),r);this._trimmed=t.trimmed}(Git2.prototype=Object.create(o.prototype)).constructor=Git2;Git2.prototype.customBinary=function(t){this._executor.binary=t;return this};Git2.prototype.env=function(t,r){if(arguments.length===1&&typeof t==="object"){this._executor.env=t}else{(this._executor.env=this._executor.env||{})[t]=r}return this};Git2.prototype.stashList=function(t){return this._runTask(G(y(arguments)||{},c(t)&&t||[]),b(arguments))};function createCloneTask(t,r,i,o){if(typeof i!=="string"){return l(`git.${t}() requires a string 'repoPath'`)}return r(i,m(o,h),g(arguments))}Git2.prototype.clone=function(){return this._runTask(createCloneTask("clone",P,...arguments),b(arguments))};Git2.prototype.mirror=function(){return this._runTask(createCloneTask("mirror",E,...arguments),b(arguments))};Git2.prototype.mv=function(t,r){return this._runTask(B(t,r),b(arguments))};Git2.prototype.checkoutLatestTag=function(t){var r=this;return this.pull((function(){r.tags((function(i,o){r.checkout(o.latest,t)}))}))};Git2.prototype.pull=function(t,r,i,o){return this._runTask(W(m(t,h),m(r,h),g(arguments)),b(arguments))};Git2.prototype.fetch=function(t,r){return this._runTask(D(m(t,h),m(r,h),g(arguments)),b(arguments))};Git2.prototype.silent=function(t){console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3");return this};Git2.prototype.tags=function(t,r){return this._runTask(te(g(arguments)),b(arguments))};Git2.prototype.rebase=function(){return this._runTask(se(["rebase",...g(arguments)]),b(arguments))};Git2.prototype.reset=function(t){return this._runTask(z(U(t),g(arguments)),b(arguments))};Git2.prototype.revert=function(t){const r=b(arguments);if(typeof t!=="string"){return this._runTask(l("Commit must be a string"),r)}return this._runTask(se(["revert",...g(arguments,0,true),t]),r)};Git2.prototype.addTag=function(t){const r=typeof t==="string"?K(t):l("Git.addTag requires a tag name");return this._runTask(r,b(arguments))};Git2.prototype.addAnnotatedTag=function(t,r){return this._runTask(J(t,r),b(arguments))};Git2.prototype.deleteLocalBranch=function(t,r,i){return this._runTask(C(t,typeof r==="boolean"?r:false),b(arguments))};Git2.prototype.deleteLocalBranches=function(t,r,i){return this._runTask(_(t,typeof r==="boolean"?r:false),b(arguments))};Git2.prototype.branch=function(t,r){return this._runTask(v(g(arguments)),b(arguments))};Git2.prototype.branchLocal=function(t){return this._runTask(R(),b(arguments))};Git2.prototype.raw=function(t){const r=!Array.isArray(t);const i=[].slice.call(r?arguments:t,0);for(let t=0;t<i.length&&r;t++){if(!d(i[t])){i.splice(t,i.length-t);break}}i.push(...g(arguments,0,true));var o=b(arguments);if(!i.length){return this._runTask(l("Raw: must supply one or more command to execute"),o)}return this._runTask(se(i,this._trimmed),o)};Git2.prototype.submoduleAdd=function(t,r,i){return this._runTask(H(t,r),b(arguments))};Git2.prototype.submoduleUpdate=function(t,r){return this._runTask(V(g(arguments,true)),b(arguments))};Git2.prototype.submoduleInit=function(t,r){return this._runTask(Y(g(arguments,true)),b(arguments))};Git2.prototype.subModule=function(t,r){return this._runTask(Q(g(arguments)),b(arguments))};Git2.prototype.listRemote=function(){return this._runTask(q(g(arguments)),b(arguments))};Git2.prototype.addRemote=function(t,r,i){return this._runTask(M(t,r,g(arguments)),b(arguments))};Git2.prototype.removeRemote=function(t,r){return this._runTask(N(t),b(arguments))};Git2.prototype.getRemotes=function(t,r){return this._runTask($(t===true),b(arguments))};Git2.prototype.remote=function(t,r){return this._runTask(L(g(arguments)),b(arguments))};Git2.prototype.tag=function(t,r){const i=g(arguments);if(i[0]!=="tag"){i.unshift("tag")}return this._runTask(se(i),b(arguments))};Git2.prototype.updateServerInfo=function(t){return this._runTask(se(["update-server-info"]),b(arguments))};Git2.prototype.pushTags=function(t,r){const i=j({remote:m(t,h)},g(arguments));return this._runTask(i,b(arguments))};Git2.prototype.rm=function(t){return this._runTask(se(["rm","-f",...u(t)]),b(arguments))};Git2.prototype.rmKeepLocal=function(t){return this._runTask(se(["rm","--cached",...u(t)]),b(arguments))};Git2.prototype.catFile=function(t,r){return this._catFile("utf-8",arguments)};Git2.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)};Git2.prototype._catFile=function(t,r){var i=b(r);var o=["cat-file"];var a=r[0];if(typeof a==="string"){return this._runTask(l("Git.catFile: options must be supplied as an array of strings"),i)}if(Array.isArray(a)){o.push.apply(o,a)}const u=t==="buffer"?re(o):se(o);return this._runTask(u,i)};Git2.prototype.diff=function(t,r){const i=h(t)?l("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):se(["diff",...g(arguments)]);return this._runTask(i,b(arguments))};Git2.prototype.diffSummary=function(){return this._runTask(I(g(arguments,1)),b(arguments))};Git2.prototype.applyPatch=function(t){const r=!p(t)?l(`git.applyPatch requires one or more string patches as the first argument`):S(u(t),g([].slice.call(arguments,1)));return this._runTask(r,b(arguments))};Git2.prototype.revparse=function(){const t=["rev-parse",...g(arguments,true)];return this._runTask(se(t,true),b(arguments))};Git2.prototype.clean=function(t,r,i){const o=A(t);const a=o&&t.join("")||m(t,h)||"";const l=g([].slice.call(arguments,o?1:0));return this._runTask(O(a,l),b(arguments))};Git2.prototype.exec=function(t){const r={commands:[],format:"utf-8",parser(){if(typeof t==="function"){t()}}};return this._runTask(r)};Git2.prototype.clearQueue=function(){return this};Git2.prototype.checkIgnore=function(t,r){return this._runTask(T(u(m(t,p,[]))),b(arguments))};Git2.prototype.checkIsRepo=function(t,r){return this._runTask(k(m(t,h)),b(arguments))};r.exports=Git2}});R();C();var cs=class extends _{constructor(t,r){super(void 0,r);this.config=t}};C();C();var ds=class extends _{constructor(t,r,i){super(t,i);this.task=t;this.plugin=r;Object.setPrototypeOf(this,new.target.prototype)}};k();E();ne();Se();_e();ke();Ae();We();function abortPlugin(t){if(!t){return}const r={type:"spawn.after",action(r,i){function kill(){i.kill(new ds(void 0,"abort","Abort signal received"))}t.addEventListener("abort",kill);i.spawned.on("close",(()=>t.removeEventListener("abort",kill)))}};const i={type:"spawn.before",action(r,i){if(t.aborted){i.kill(new ds(void 0,"abort","Abort already signaled"))}}};return[i,r]}function isConfigSwitch(t){return typeof t==="string"&&t.trim().toLowerCase()==="-c"}function preventProtocolOverride(t,r){if(!isConfigSwitch(t)){return}if(!/^\s*protocol(.[a-z]+)?.allow/.test(r)){return}throw new ds(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function preventUploadPack(t,r){if(/^\s*--(upload|receive)-pack/.test(t)){throw new ds(void 0,"unsafe",`Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`)}if(r==="clone"&&/^\s*-u\b/.test(t)){throw new ds(void 0,"unsafe",`Use of clone with option -u is not permitted without enabling allowUnsafePack`)}if(r==="push"&&/^\s*--exec\b/.test(t)){throw new ds(void 0,"unsafe",`Use of push with option --exec is not permitted without enabling allowUnsafePack`)}}function blockUnsafeOperationsPlugin({allowUnsafeProtocolOverride:t=false,allowUnsafePack:r=false}={}){return{type:"spawn.args",action(i,o){i.forEach(((a,l)=>{const u=l<i.length?i[l+1]:"";t||preventProtocolOverride(a,u);r||preventUploadPack(a,o.method)}));return i}}}X();function commandConfigPrefixingPlugin(t){const r=prefixedArray(t,"-c");return{type:"spawn.args",action(t){return[...r,...t]}}}X();var hs=(0,c.gX)().promise;function completionDetectionPlugin({onClose:t=true,onExit:r=50}={}){function createEvents(){let i=-1;const o={close:(0,c.gX)(),closeTimeout:(0,c.gX)(),exit:(0,c.gX)(),exitTimeout:(0,c.gX)()};const a=Promise.race([t===false?hs:o.closeTimeout.promise,r===false?hs:o.exitTimeout.promise]);configureTimeout(t,o.close,o.closeTimeout);configureTimeout(r,o.exit,o.exitTimeout);return{close(t){i=t;o.close.done()},exit(t){i=t;o.exit.done()},get exitCode(){return i},result:a}}function configureTimeout(t,r,i){if(t===false){return}(t===true?r.promise:r.promise.then((()=>delay(t)))).then(i.done)}return{type:"spawn.after",action(t,r){return __async(this,arguments,(function*(t,{spawned:r,close:i}){var o,a;const l=createEvents();let u=true;let quickClose=()=>void(u=false);(o=r.stdout)==null?void 0:o.on("data",quickClose);(a=r.stderr)==null?void 0:a.on("data",quickClose);r.on("error",quickClose);r.on("close",(t=>l.close(t)));r.on("exit",(t=>l.exit(t)));try{yield l.result;if(u){yield delay(50)}i(l.exitCode)}catch(t){i(l.exitCode,t)}}))}}}C();function isTaskError(t){return!!(t.exitCode&&t.stdErr.length)}function getErrorMessage(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function errorDetectionHandler(t=false,r=isTaskError,i=getErrorMessage){return(o,a)=>{if(!t&&o||!r(a)){return o}return i(a)}}function errorDetectionPlugin(t){return{type:"task.error",action(r,i){const o=t(r.error,{stdErr:i.stdErr,stdOut:i.stdOut,exitCode:i.exitCode});if(Buffer.isBuffer(o)){return{error:new _(void 0,o.toString("utf-8"))}}return{error:o}}}}X();var fs=class{constructor(){this.plugins=new Set}add(t){const r=[];asArray(t).forEach((t=>t&&this.plugins.add(append(r,t))));return()=>{r.forEach((t=>this.plugins.delete(t)))}}exec(t,r,i){let o=r;const a=Object.freeze(Object.create(i));for(const r of this.plugins){if(r.type===t){o=r.action(o,a)}}return o}};X();function progressMonitorPlugin(t){const r="--progress";const i=["checkout","clone","fetch","pull","push"];const o={type:"spawn.after",action(i,o){var a;if(!o.commands.includes(r)){return}(a=o.spawned.stderr)==null?void 0:a.on("data",(r=>{const i=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(r.toString("utf8"));if(!i){return}t({method:o.method,stage:progressEventStage(i[1]),progress:asNumber(i[2]),processed:asNumber(i[3]),total:asNumber(i[4])})}))}};const a={type:"spawn.args",action(t,o){if(!i.includes(o.method)){return t}return including(t,r)}};return[a,o]}function progressEventStage(t){return String(t.toLowerCase().split(" ",1))||"unknown"}X();function spawnOptionsPlugin(t){const r=pick(t,["uid","gid"]);return{type:"spawn.options",action(t){return __spreadValues(__spreadValues({},r),t)}}}function timeoutPlugin({block:t,stdErr:r=true,stdOut:i=true}){if(t>0){return{type:"spawn.after",action(o,a){var l,u;let c;function wait(){c&&clearTimeout(c);c=setTimeout(kill,t)}function stop(){var t,r;(t=a.spawned.stdout)==null?void 0:t.off("data",wait);(r=a.spawned.stderr)==null?void 0:r.off("data",wait);a.spawned.off("exit",stop);a.spawned.off("close",stop);c&&clearTimeout(c)}function kill(){stop();a.kill(new ds(void 0,"timeout",`block timeout reached`))}i&&((l=a.spawned.stdout)==null?void 0:l.on("data",wait));r&&((u=a.spawned.stderr)==null?void 0:u.on("data",wait));a.spawned.on("exit",stop);a.spawned.on("close",stop);wait()}}}}R();function suffixPathsPlugin(){return{type:"spawn.args",action(t){const r=[];let i;function append2(t){(i=i||[]).push(...t)}for(let i=0;i<t.length;i++){const o=t[i];if(isPathSpec(o)){append2(toPaths(o));continue}if(o==="--"){append2(t.slice(i+1).flatMap((t=>isPathSpec(t)&&toPaths(t)||t)));break}r.push(o)}return!i?r:[...r,"--",...i.map(String)]}}}X();var ps=us();function gitInstanceFactory(t,r){const i=new fs;const o=createInstanceConfig(t&&(typeof t==="string"?{baseDir:t}:t)||{},r);if(!folderExists(o.baseDir)){throw new cs(o,`Cannot use simple-git on a directory that does not exist`)}if(Array.isArray(o.config)){i.add(commandConfigPrefixingPlugin(o.config))}i.add(blockUnsafeOperationsPlugin(o.unsafe));i.add(suffixPathsPlugin());i.add(completionDetectionPlugin(o.completion));o.abort&&i.add(abortPlugin(o.abort));o.progress&&i.add(progressMonitorPlugin(o.progress));o.timeout&&i.add(timeoutPlugin(o.timeout));o.spawnOptions&&i.add(spawnOptionsPlugin(o.spawnOptions));i.add(errorDetectionPlugin(errorDetectionHandler(true)));o.errors&&i.add(errorDetectionPlugin(o.errors));return new ps(o,i)}k();var ms=null&&["customBinary","env","outputHandler","silent"];var gs=null&&["add","addAnnotatedTag","addConfig","addRemote","addTag","applyPatch","binaryCatFile","branch","branchLocal","catFile","checkIgnore","checkIsRepo","checkout","checkoutBranch","checkoutLatestTag","checkoutLocalBranch","clean","clone","commit","cwd","deleteLocalBranch","deleteLocalBranches","diff","diffSummary","exec","fetch","getRemotes","init","listConfig","listRemote","log","merge","mergeFromTo","mirror","mv","pull","push","pushTags","raw","rebase","remote","removeRemote","reset","revert","revparse","rm","rmKeepLocal","show","stash","stashList","status","subModule","submoduleAdd","submoduleInit","submoduleUpdate","tag","tags","updateServerInfo"];function gitP(...t){let r;let i=Promise.resolve();try{r=gitInstanceFactory(...t)}catch(t){i=Promise.reject(t)}function builderReturn(){return o}function chainReturn(){return i}const o=[...ms,...gs].reduce(((t,i)=>{const o=gs.includes(i);const a=o?asyncWrapper(i,r):syncWrapper(i,r,t);const l=o?chainReturn:builderReturn;Object.defineProperty(t,i,{enumerable:false,configurable:false,value:r?a:l});return t}),{});return o;function asyncWrapper(t,r){return function(...o){if(typeof o[o.length]==="function"){throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to "+t)}return i.then((function(){return new Promise((function(i,a){const callback=(t,r)=>{if(t){return a(toError(t))}i(r)};o.push(callback);r[t].apply(r,o)}))}))}}function syncWrapper(t,r,i){return(...o)=>{r[t](...o);return i}}}function toError(t){if(t instanceof Error){return t}if(typeof t==="string"){return new Error(t)}return new T(t)}var bs=gitInstanceFactory;var ys=null&&gitInstanceFactory;const clearName=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();const getTypeTask=t=>{if(t==="Epic")return"story";if(t==="Bug")return"fix";return"feat"};const formatBranchName=t=>{const{id:r,name:i,type:o}=t;const a=getTypeTask(o);const l=clearName(i);return[`${a}/${r}_${l}`,`${a}/${r}`,`${r}`]};const Ss=require("node:os");var ws=__nccwpck_require__.n(Ss);const vs=require("node:fs/promises");var Rs=__nccwpck_require__(7561);const homeDir=()=>ws().homedir();const processDir=()=>process.cwd();const createDir=async t=>{await(0,vs.mkdir)(t,{recursive:true})};const pathExists=t=>(0,Rs.existsSync)(t);const writeFile=async(t,r)=>{await(0,vs.writeFile)(t,r)};const readFile=async t=>{const r=await(0,vs.readFile)(t);return r.toString()};var _s;(function(t){t["IN_PROGRESS"]="In Progress";t["DONE"]="Done"})(_s||(_s={}));const Cs={tools:{jira:{domain:process.env.JIRA_DOMAIN??"",authorization:process.env.JIRA_AUTHORIZATION??""},github:{token:process.env.GITHUB_TOKEN??"",organization:process.env.GITHUB_ORGANIZATION??""}},projects:{},advanced:false,debug:false,experimental:false,version:"0.0.0"};const base64Encode=t=>btoa(t);const hasConfig=()=>pathExists(`${homeDir()}/.mytools/config`);const init=async()=>{if(pathExists(`${homeDir()}/.mytools/config`))return;if(!pathExists(`${homeDir()}/.mytools`))await createDir(`${homeDir()}/.mytools`);await writeConfig(Cs)};const ensureFormatConfigFile=async()=>{const t=await readConfig();await writeConfig({...Cs,...t})};const isJiraConfigured=async()=>{const t=base64Encode(processDir());const r=await readConfig();const i=r.tools.jira;const o=r.projects[t]?.tools.jira;if(o)return o.domain&&o.authorization;return i.domain&&i.authorization};const addCurrentProject=async()=>{const t=base64Encode(processDir());const r=await readConfig();const i=r.projects[t];if(!i){const i=new Date;r.projects[t]={tasks:[],createdAt:i.valueOf(),updatedAt:i.valueOf(),tools:{}};await writeConfig(r)}};const addTask=async t=>{await addCurrentProject();const r=base64Encode(processDir());const i=await readConfig();const o=i.projects[r];const a=new Date;o.tasks.push({jiraId:t.id,jiraName:t.name,jiraType:t.type,jiraUrl:t.url,status:_s.IN_PROGRESS,createdAt:a.valueOf(),updatedAt:a.valueOf()});await writeConfig(i)};const removeTask=async t=>{await addCurrentProject();const r=base64Encode(processDir());const i=await readConfig();const o=i.projects[r];const a=o.tasks;o.tasks=a.filter((r=>r.jiraId!==t.id));await writeConfig(i)};const isDebugMode=async()=>{const{debug:t}=await readConfig();return t};const isExperimentalMode=async()=>{const{experimental:t}=await readConfig();return t};const getInProgressTasks=async()=>{const t=base64Encode(processDir());const r=await readConfig();const i=r.projects[t];if(!i)return[];return i.tasks};const isNewVersion=async t=>{const[r,i,o]=t.split(".").map((t=>parseInt(t)));const{version:a}=await readConfig();if(!a)return true;const[l,u,c]=a.split(".").map((t=>parseInt(t)));return r>l||i>u||o>c};const updateVersion=async t=>{const r=await readConfig();await writeConfig({...r,version:t})};const readConfig=async()=>{const t=await readFile(`${homeDir()}/.mytools/config`);return JSON.parse(t)};const writeConfig=async t=>{const r=JSON.stringify(t,null,2);await writeFile(`${homeDir()}/.mytools/config`,r)};const Ts=require("node:http");const ks=require("node:https");const Ps=require("node:zlib");const xs=require("node:stream");const Es=require("node:buffer");function dataUriToBuffer(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,"");const r=t.indexOf(",");if(r===-1||r<=4){throw new TypeError("malformed data: URI")}const i=t.substring(5,r).split(";");let o="";let a=false;const l=i[0]||"text/plain";let u=l;for(let t=1;t<i.length;t++){if(i[t]==="base64"){a=true}else if(i[t]){u+=`;${i[t]}`;if(i[t].indexOf("charset=")===0){o=i[t].substring(8)}}}if(!i[0]&&!o.length){u+=";charset=US-ASCII";o="US-ASCII"}const c=a?"base64":"ascii";const d=unescape(t.substring(r+1));const h=Buffer.from(d,c);h.type=l;h.typeFull=u;h.charset=o;return h}const Os=dataUriToBuffer;const As=require("node:util");var Is=__nccwpck_require__(7579);var Ds=__nccwpck_require__(8809);class FetchBaseError extends Error{constructor(t,r){super(t);Error.captureStackTrace(this,this.constructor);this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}class FetchError extends FetchBaseError{constructor(t,r,i){super(t,r);if(i){this.code=this.errno=i.code;this.erroredSysCall=i.syscall}}}const Bs=Symbol.toStringTag;const isURLSearchParameters=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[Bs]==="URLSearchParams";const isBlob=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[Bs]);const isAbortSignal=t=>typeof t==="object"&&(t[Bs]==="AbortSignal"||t[Bs]==="EventTarget");const isDomainOrSubdomain=(t,r)=>{const i=new URL(r).hostname;const o=new URL(t).hostname;return i===o||i.endsWith(`.${o}`)};const isSameProtocol=(t,r)=>{const i=new URL(r).protocol;const o=new URL(t).protocol;return i===o};const Ws=(0,As.promisify)(xs.pipeline);const js=Symbol("Body internals");class Body{constructor(t,{size:r=0}={}){let i=null;if(t===null){t=null}else if(isURLSearchParameters(t)){t=Es.Buffer.from(t.toString())}else if(isBlob(t)){}else if(Es.Buffer.isBuffer(t)){}else if(As.types.isAnyArrayBuffer(t)){t=Es.Buffer.from(t)}else if(ArrayBuffer.isView(t)){t=Es.Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(t instanceof xs){}else if(t instanceof Ds.Ct){t=(0,Ds.au)(t);i=t.type.split("=")[1]}else{t=Es.Buffer.from(String(t))}let o=t;if(Es.Buffer.isBuffer(t)){o=xs.Readable.from(t)}else if(isBlob(t)){o=xs.Readable.from(t.stream())}this[js]={body:t,stream:o,boundary:i,disturbed:false,error:null};this.size=r;if(t instanceof xs){t.on("error",(t=>{const r=t instanceof FetchBaseError?t:new FetchError(`Invalid response body while trying to fetch ${this.url}: ${t.message}`,"system",t);this[js].error=r}))}}get body(){return this[js].stream}get bodyUsed(){return this[js].disturbed}async arrayBuffer(){const{buffer:t,byteOffset:r,byteLength:i}=await consumeBody(this);return t.slice(r,r+i)}async formData(){const t=this.headers.get("content-type");if(t.startsWith("application/x-www-form-urlencoded")){const t=new Ds.Ct;const r=new URLSearchParams(await this.text());for(const[i,o]of r){t.append(i,o)}return t}const{toFormData:r}=await __nccwpck_require__.e(398).then(__nccwpck_require__.bind(__nccwpck_require__,4398));return r(this.body,t)}async blob(){const t=this.headers&&this.headers.get("content-type")||this[js].body&&this[js].body.type||"";const r=await this.arrayBuffer();return new Is.Z([r],{type:t})}async json(){const t=await this.text();return JSON.parse(t)}async text(){const t=await consumeBody(this);return(new TextDecoder).decode(t)}buffer(){return consumeBody(this)}}Body.prototype.buffer=(0,As.deprecate)(Body.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Body.prototype,{body:{enumerable:true},bodyUsed:{enumerable:true},arrayBuffer:{enumerable:true},blob:{enumerable:true},json:{enumerable:true},text:{enumerable:true},data:{get:(0,As.deprecate)((()=>{}),"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function consumeBody(t){if(t[js].disturbed){throw new TypeError(`body used already for: ${t.url}`)}t[js].disturbed=true;if(t[js].error){throw t[js].error}const{body:r}=t;if(r===null){return Es.Buffer.alloc(0)}if(!(r instanceof xs)){return Es.Buffer.alloc(0)}const i=[];let o=0;try{for await(const a of r){if(t.size>0&&o+a.length>t.size){const i=new FetchError(`content size at ${t.url} over limit: ${t.size}`,"max-size");r.destroy(i);throw i}o+=a.length;i.push(a)}}catch(r){const i=r instanceof FetchBaseError?r:new FetchError(`Invalid response body while trying to fetch ${t.url}: ${r.message}`,"system",r);throw i}if(r.readableEnded===true||r._readableState.ended===true){try{if(i.every((t=>typeof t==="string"))){return Es.Buffer.from(i.join(""))}return Es.Buffer.concat(i,o)}catch(r){throw new FetchError(`Could not create Buffer from response body for ${t.url}: ${r.message}`,"system",r)}}else{throw new FetchError(`Premature close of server response while trying to fetch ${t.url}`)}}const clone=(t,r)=>{let i;let o;let{body:a}=t[js];if(t.bodyUsed){throw new Error("cannot clone body after it is used")}if(a instanceof xs&&typeof a.getBoundary!=="function"){i=new xs.PassThrough({highWaterMark:r});o=new xs.PassThrough({highWaterMark:r});a.pipe(i);a.pipe(o);t[js].stream=i;a=o}return a};const Fs=(0,As.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");const extractContentType=(t,r)=>{if(t===null){return null}if(typeof t==="string"){return"text/plain;charset=UTF-8"}if(isURLSearchParameters(t)){return"application/x-www-form-urlencoded;charset=UTF-8"}if(isBlob(t)){return t.type||null}if(Es.Buffer.isBuffer(t)||As.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)){return null}if(t instanceof Ds.Ct){return`multipart/form-data; boundary=${r[js].boundary}`}if(t&&typeof t.getBoundary==="function"){return`multipart/form-data;boundary=${Fs(t)}`}if(t instanceof xs){return null}return"text/plain;charset=UTF-8"};const getTotalBytes=t=>{const{body:r}=t[js];if(r===null){return 0}if(isBlob(r)){return r.size}if(Es.Buffer.isBuffer(r)){return r.length}if(r&&typeof r.getLengthSync==="function"){return r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null}return null};const writeToStream=async(t,{body:r})=>{if(r===null){t.end()}else{await Ws(r,t)}};const Ms=typeof Ts.validateHeaderName==="function"?Ts.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){const r=new TypeError(`Header name must be a valid HTTP token [${t}]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_HTTP_TOKEN"});throw r}};const $s=typeof Ts.validateHeaderValue==="function"?Ts.validateHeaderValue:(t,r)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(r)){const r=new TypeError(`Invalid character in header content ["${t}"]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"});throw r}};class Headers extends URLSearchParams{constructor(t){let r=[];if(t instanceof Headers){const i=t.raw();for(const[t,o]of Object.entries(i)){r.push(...o.map((r=>[t,r])))}}else if(t==null){}else if(typeof t==="object"&&!As.types.isBoxedPrimitive(t)){const i=t[Symbol.iterator];if(i==null){r.push(...Object.entries(t))}else{if(typeof i!=="function"){throw new TypeError("Header pairs must be iterable")}r=[...t].map((t=>{if(typeof t!=="object"||As.types.isBoxedPrimitive(t)){throw new TypeError("Each header pair must be an iterable object")}return[...t]})).map((t=>{if(t.length!==2){throw new TypeError("Each header pair must be a name/value tuple")}return[...t]}))}}else{throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)")}r=r.length>0?r.map((([t,r])=>{Ms(t);$s(t,String(r));return[String(t).toLowerCase(),String(r)]})):undefined;super(r);return new Proxy(this,{get(t,r,i){switch(r){case"append":case"set":return(i,o)=>{Ms(i);$s(i,String(o));return URLSearchParams.prototype[r].call(t,String(i).toLowerCase(),String(o))};case"delete":case"has":case"getAll":return i=>{Ms(i);return URLSearchParams.prototype[r].call(t,String(i).toLowerCase())};case"keys":return()=>{t.sort();return new Set(URLSearchParams.prototype.keys.call(t)).keys()};default:return Reflect.get(t,r,i)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){const r=this.getAll(t);if(r.length===0){return null}let i=r.join(", ");if(/^content-encoding$/i.test(t)){i=i.toLowerCase()}return i}forEach(t,r=undefined){for(const i of this.keys()){Reflect.apply(t,r,[this.get(i),i,this])}}*values(){for(const t of this.keys()){yield this.get(t)}}*entries(){for(const t of this.keys()){yield[t,this.get(t)]}}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(((t,r)=>{t[r]=this.getAll(r);return t}),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(((t,r)=>{const i=this.getAll(r);if(r==="host"){t[r]=i[0]}else{t[r]=i.length>1?i:i[0]}return t}),{})}}Object.defineProperties(Headers.prototype,["get","entries","forEach","values"].reduce(((t,r)=>{t[r]={enumerable:true};return t}),{}));function fromRawHeaders(t=[]){return new Headers(t.reduce(((t,r,i,o)=>{if(i%2===0){t.push(o.slice(i,i+2))}return t}),[]).filter((([t,r])=>{try{Ms(t);$s(t,String(r));return true}catch{return false}})))}const qs=new Set([301,302,303,307,308]);const isRedirect=t=>qs.has(t);const Ls=Symbol("Response internals");class Response extends Body{constructor(t=null,r={}){super(t,r);const i=r.status!=null?r.status:200;const o=new Headers(r.headers);if(t!==null&&!o.has("Content-Type")){const r=extractContentType(t,this);if(r){o.append("Content-Type",r)}}this[Ls]={type:"default",url:r.url,status:i,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Ls].type}get url(){return this[Ls].url||""}get status(){return this[Ls].status}get ok(){return this[Ls].status>=200&&this[Ls].status<300}get redirected(){return this[Ls].counter>0}get statusText(){return this[Ls].statusText}get headers(){return this[Ls].headers}get highWaterMark(){return this[Ls].highWaterMark}clone(){return new Response(clone(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(t,r=302){if(!isRedirect(r)){throw new RangeError('Failed to execute "redirect" on "response": Invalid status code')}return new Response(null,{headers:{location:new URL(t).toString()},status:r})}static error(){const t=new Response(null,{status:0,statusText:""});t[Ls].type="error";return t}static json(t=undefined,r={}){const i=JSON.stringify(t);if(i===undefined){throw new TypeError("data is not JSON serializable")}const o=new Headers(r&&r.headers);if(!o.has("content-type")){o.set("content-type","application/json")}return new Response(i,{...r,headers:o})}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(Response.prototype,{type:{enumerable:true},url:{enumerable:true},status:{enumerable:true},ok:{enumerable:true},redirected:{enumerable:true},statusText:{enumerable:true},headers:{enumerable:true},clone:{enumerable:true}});const Ns=require("node:url");const getSearch=t=>{if(t.search){return t.search}const r=t.href.length-1;const i=t.hash||(t.href[r]==="#"?"#":"");return t.href[r-i.length]==="?"?"?":""};const Us=require("node:net");function stripURLForUseAsAReferrer(t,r=false){if(t==null){return"no-referrer"}t=new URL(t);if(/^(about|blob|data):$/.test(t.protocol)){return"no-referrer"}t.username="";t.password="";t.hash="";if(r){t.pathname="";t.search=""}return t}const zs=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);const Gs="strict-origin-when-cross-origin";function validateReferrerPolicy(t){if(!zs.has(t)){throw new TypeError(`Invalid referrerPolicy: ${t}`)}return t}function isOriginPotentiallyTrustworthy(t){if(/^(http|ws)s:$/.test(t.protocol)){return true}const r=t.host.replace(/(^\[)|(]$)/g,"");const i=(0,Us.isIP)(r);if(i===4&&/^127\./.test(r)){return true}if(i===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(r)){return true}if(t.host==="localhost"||t.host.endsWith(".localhost")){return false}if(t.protocol==="file:"){return true}return false}function isUrlPotentiallyTrustworthy(t){if(/^about:(blank|srcdoc)$/.test(t)){return true}if(t.protocol==="data:"){return true}if(/^(blob|filesystem):$/.test(t.protocol)){return true}return isOriginPotentiallyTrustworthy(t)}function determineRequestsReferrer(t,{referrerURLCallback:r,referrerOriginCallback:i}={}){if(t.referrer==="no-referrer"||t.referrerPolicy===""){return null}const o=t.referrerPolicy;if(t.referrer==="about:client"){return"no-referrer"}const a=t.referrer;let l=stripURLForUseAsAReferrer(a);let u=stripURLForUseAsAReferrer(a,true);if(l.toString().length>4096){l=u}if(r){l=r(l)}if(i){u=i(u)}const c=new URL(t.url);switch(o){case"no-referrer":return"no-referrer";case"origin":return u;case"unsafe-url":return l;case"strict-origin":if(isUrlPotentiallyTrustworthy(l)&&!isUrlPotentiallyTrustworthy(c)){return"no-referrer"}return u.toString();case"strict-origin-when-cross-origin":if(l.origin===c.origin){return l}if(isUrlPotentiallyTrustworthy(l)&&!isUrlPotentiallyTrustworthy(c)){return"no-referrer"}return u;case"same-origin":if(l.origin===c.origin){return l}return"no-referrer";case"origin-when-cross-origin":if(l.origin===c.origin){return l}return u;case"no-referrer-when-downgrade":if(isUrlPotentiallyTrustworthy(l)&&!isUrlPotentiallyTrustworthy(c)){return"no-referrer"}return l;default:throw new TypeError(`Invalid referrerPolicy: ${o}`)}}function parseReferrerPolicyFromHeader(t){const r=(t.get("referrer-policy")||"").split(/[,\s]+/);let i="";for(const t of r){if(t&&zs.has(t)){i=t}}return i}const Hs=Symbol("Request internals");const isRequest=t=>typeof t==="object"&&typeof t[Hs]==="object";const Ys=(0,As.deprecate)((()=>{}),".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");class Request extends Body{constructor(t,r={}){let i;if(isRequest(t)){i=new URL(t.url)}else{i=new URL(t);t={}}if(i.username!==""||i.password!==""){throw new TypeError(`${i} is an url with embedded credentials.`)}let o=r.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)){o=o.toUpperCase()}if(!isRequest(r)&&"data"in r){Ys()}if((r.body!=null||isRequest(t)&&t.body!==null)&&(o==="GET"||o==="HEAD")){throw new TypeError("Request with GET/HEAD method cannot have body")}const a=r.body?r.body:isRequest(t)&&t.body!==null?clone(t):null;super(a,{size:r.size||t.size||0});const l=new Headers(r.headers||t.headers||{});if(a!==null&&!l.has("Content-Type")){const t=extractContentType(a,this);if(t){l.set("Content-Type",t)}}let u=isRequest(t)?t.signal:null;if("signal"in r){u=r.signal}if(u!=null&&!isAbortSignal(u)){throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget")}let c=r.referrer==null?t.referrer:r.referrer;if(c===""){c="no-referrer"}else if(c){const t=new URL(c);c=/^about:(\/\/)?client$/.test(t)?"client":t}else{c=undefined}this[Hs]={method:o,redirect:r.redirect||t.redirect||"follow",headers:l,parsedURL:i,signal:u,referrer:c};this.follow=r.follow===undefined?t.follow===undefined?20:t.follow:r.follow;this.compress=r.compress===undefined?t.compress===undefined?true:t.compress:r.compress;this.counter=r.counter||t.counter||0;this.agent=r.agent||t.agent;this.highWaterMark=r.highWaterMark||t.highWaterMark||16384;this.insecureHTTPParser=r.insecureHTTPParser||t.insecureHTTPParser||false;this.referrerPolicy=r.referrerPolicy||t.referrerPolicy||""}get method(){return this[Hs].method}get url(){return(0,Ns.format)(this[Hs].parsedURL)}get headers(){return this[Hs].headers}get redirect(){return this[Hs].redirect}get signal(){return this[Hs].signal}get referrer(){if(this[Hs].referrer==="no-referrer"){return""}if(this[Hs].referrer==="client"){return"about:client"}if(this[Hs].referrer){return this[Hs].referrer.toString()}return undefined}get referrerPolicy(){return this[Hs].referrerPolicy}set referrerPolicy(t){this[Hs].referrerPolicy=validateReferrerPolicy(t)}clone(){return new Request(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(Request.prototype,{method:{enumerable:true},url:{enumerable:true},headers:{enumerable:true},redirect:{enumerable:true},clone:{enumerable:true},signal:{enumerable:true},referrer:{enumerable:true},referrerPolicy:{enumerable:true}});const getNodeRequestOptions=t=>{const{parsedURL:r}=t[Hs];const i=new Headers(t[Hs].headers);if(!i.has("Accept")){i.set("Accept","*/*")}let o=null;if(t.body===null&&/^(post|put)$/i.test(t.method)){o="0"}if(t.body!==null){const r=getTotalBytes(t);if(typeof r==="number"&&!Number.isNaN(r)){o=String(r)}}if(o){i.set("Content-Length",o)}if(t.referrerPolicy===""){t.referrerPolicy=Gs}if(t.referrer&&t.referrer!=="no-referrer"){t[Hs].referrer=determineRequestsReferrer(t)}else{t[Hs].referrer="no-referrer"}if(t[Hs].referrer instanceof URL){i.set("Referer",t.referrer)}if(!i.has("User-Agent")){i.set("User-Agent","node-fetch")}if(t.compress&&!i.has("Accept-Encoding")){i.set("Accept-Encoding","gzip, deflate, br")}let{agent:a}=t;if(typeof a==="function"){a=a(r)}const l=getSearch(r);const u={path:r.pathname+l,method:t.method,headers:i[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:a};return{parsedURL:r,options:u}};class AbortError extends FetchBaseError{constructor(t,r="aborted"){super(t,r)}}var Qs=__nccwpck_require__(7210);const Vs=new Set(["data:","http:","https:"]);async function fetch(t,r){return new Promise(((i,o)=>{const a=new Request(t,r);const{parsedURL:l,options:u}=getNodeRequestOptions(a);if(!Vs.has(l.protocol)){throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${l.protocol.replace(/:$/,"")}" is not supported.`)}if(l.protocol==="data:"){const t=Os(a.url);const r=new Response(t,{headers:{"Content-Type":t.typeFull}});i(r);return}const c=(l.protocol==="https:"?ks:Ts).request;const{signal:d}=a;let h=null;const abort=()=>{const t=new AbortError("The operation was aborted.");o(t);if(a.body&&a.body instanceof xs.Readable){a.body.destroy(t)}if(!h||!h.body){return}h.body.emit("error",t)};if(d&&d.aborted){abort();return}const abortAndFinalize=()=>{abort();finalize()};const p=c(l.toString(),u);if(d){d.addEventListener("abort",abortAndFinalize)}const finalize=()=>{p.abort();if(d){d.removeEventListener("abort",abortAndFinalize)}};p.on("error",(t=>{o(new FetchError(`request to ${a.url} failed, reason: ${t.message}`,"system",t));finalize()}));fixResponseChunkedTransferBadEnding(p,(t=>{if(h&&h.body){h.body.destroy(t)}}));if(process.version<"v14"){p.on("socket",(t=>{let r;t.prependListener("end",(()=>{r=t._eventsCount}));t.prependListener("close",(i=>{if(h&&r<t._eventsCount&&!i){const t=new Error("Premature close");t.code="ERR_STREAM_PREMATURE_CLOSE";h.body.emit("error",t)}}))}))}p.on("response",(t=>{p.setTimeout(0);const l=fromRawHeaders(t.rawHeaders);if(isRedirect(t.statusCode)){const u=l.get("Location");let c=null;try{c=u===null?null:new URL(u,a.url)}catch{if(a.redirect!=="manual"){o(new FetchError(`uri requested responds with an invalid redirect URL: ${u}`,"invalid-redirect"));finalize();return}}switch(a.redirect){case"error":o(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${a.url}`,"no-redirect"));finalize();return;case"manual":break;case"follow":{if(c===null){break}if(a.counter>=a.follow){o(new FetchError(`maximum redirect reached at: ${a.url}`,"max-redirect"));finalize();return}const u={headers:new Headers(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:clone(a),signal:a.signal,size:a.size,referrer:a.referrer,referrerPolicy:a.referrerPolicy};if(!isDomainOrSubdomain(a.url,c)||!isSameProtocol(a.url,c)){for(const t of["authorization","www-authenticate","cookie","cookie2"]){u.headers.delete(t)}}if(t.statusCode!==303&&a.body&&r.body instanceof xs.Readable){o(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect"));finalize();return}if(t.statusCode===303||(t.statusCode===301||t.statusCode===302)&&a.method==="POST"){u.method="GET";u.body=undefined;u.headers.delete("content-length")}const d=parseReferrerPolicyFromHeader(l);if(d){u.referrerPolicy=d}i(fetch(new Request(c,u)));finalize();return}default:return o(new TypeError(`Redirect option '${a.redirect}' is not a valid value of RequestRedirect`))}}if(d){t.once("end",(()=>{d.removeEventListener("abort",abortAndFinalize)}))}let u=(0,xs.pipeline)(t,new xs.PassThrough,(t=>{if(t){o(t)}}));if(process.version<"v12.10"){t.on("aborted",abortAndFinalize)}const c={url:a.url,status:t.statusCode,statusText:t.statusMessage,headers:l,size:a.size,counter:a.counter,highWaterMark:a.highWaterMark};const m=l.get("Content-Encoding");if(!a.compress||a.method==="HEAD"||m===null||t.statusCode===204||t.statusCode===304){h=new Response(u,c);i(h);return}const g={flush:Ps.Z_SYNC_FLUSH,finishFlush:Ps.Z_SYNC_FLUSH};if(m==="gzip"||m==="x-gzip"){u=(0,xs.pipeline)(u,Ps.createGunzip(g),(t=>{if(t){o(t)}}));h=new Response(u,c);i(h);return}if(m==="deflate"||m==="x-deflate"){const r=(0,xs.pipeline)(t,new xs.PassThrough,(t=>{if(t){o(t)}}));r.once("data",(t=>{if((t[0]&15)===8){u=(0,xs.pipeline)(u,Ps.createInflate(),(t=>{if(t){o(t)}}))}else{u=(0,xs.pipeline)(u,Ps.createInflateRaw(),(t=>{if(t){o(t)}}))}h=new Response(u,c);i(h)}));r.once("end",(()=>{if(!h){h=new Response(u,c);i(h)}}));return}if(m==="br"){u=(0,xs.pipeline)(u,Ps.createBrotliDecompress(),(t=>{if(t){o(t)}}));h=new Response(u,c);i(h);return}h=new Response(u,c);i(h)}));writeToStream(p,a).catch(o)}))}function fixResponseChunkedTransferBadEnding(t,r){const i=Es.Buffer.from("0\r\n\r\n");let o=false;let a=false;let l;t.on("response",(t=>{const{headers:r}=t;o=r["transfer-encoding"]==="chunked"&&!r["content-length"]}));t.on("socket",(u=>{const onSocketClose=()=>{if(o&&!a){const t=new Error("Premature close");t.code="ERR_STREAM_PREMATURE_CLOSE";r(t)}};const onData=t=>{a=Es.Buffer.compare(t.slice(-5),i)===0;if(!a&&l){a=Es.Buffer.compare(l.slice(-3),i.slice(0,3))===0&&Es.Buffer.compare(t.slice(-2),i.slice(3))===0}l=t};u.prependListener("close",onSocketClose);u.on("data",onData);t.on("close",(()=>{u.removeListener("close",onSocketClose);u.removeListener("data",onData)}))}))}var Js;(function(t){t[t["MY_TASKS"]=1]="MY_TASKS";t[t["ALL"]=2]="ALL"})(Js||(Js={}));const getQuery=t=>{const r='status = "In Progress"';if(t===Js.MY_TASKS)return`${r} AND assignee = currentUser()`;return r};const searchInProgressTasks=async t=>{const r=`${process.env.JIRA_DOMAIN}/rest/api/3/search`;const i={expand:["names"],maxResults:50,fieldsByKeys:false,fields:["summary","issuetype","status"],startAt:0,jql:getQuery(t)};const o=await fetch(r,{method:"post",body:JSON.stringify(i),headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Basic ${process.env.JIRA_AUTHORIZATION}`}});if(!o.ok)return[];const a=await o.json();const{issues:l=[]}=a;return l.map((t=>{const{fields:{summary:r,issuetype:{name:i},status:{name:o}},key:a,self:l}=t;return{id:a.trim(),name:r.trim(),type:i.trim(),url:l.trim(),status:o}}))};const findTask=async t=>{const r=`${process.env.JIRA_DOMAIN}/rest/api/3/issue/${t}`;const i=await fetch(r,{method:"get",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Basic ${process.env.JIRA_AUTHORIZATION}`}});if(!i.ok)return null;const o=await i.json();const{fields:{summary:a,issuetype:{name:l},status:{name:u}},key:c,self:d}=o;return{id:c.trim(),name:a.trim(),type:l.trim(),url:d.trim(),status:u}};async function gitFetch(){console.log(`🐷 ${(0,o.cyan)("info")} making a git fetch...`);await bs().fetch();console.log(`🐷 ${(0,o.green)("success")} git fetch completed`)}async function gitPull(){console.log(`🐷 ${(0,o.cyan)("info")} pulling branches...`);await bs().pull();console.log(`🐷 ${(0,o.green)("success")} pull branches completed`)}async function searchTasks(t){console.log(`🐷 ${(0,o.cyan)("info")} requesting task in progress...`);return await searchInProgressTasks(t)}async function askUserByTaskOwnership(){const{ownership:t}=await r()({type:"select",name:"ownership",message:"What kind of task do you want to search?",choices:[{title:"My tasks",value:Js.MY_TASKS},{title:"All tasks",value:Js.ALL}],initial:0});return t}async function askUserByTask(t){const{task:i}=await r()({type:"select",name:"task",message:"What task do you want to start?",choices:t.map((t=>{const r=`${(0,o.cyan)(t.id)} => ${t.name} => ${(0,o.yellow)(t.type)}`;const i=t;return{title:r,value:i}}))});return i}async function askUserByFormatBranch(t){const{branchName:i}=await r()({type:"select",name:"branchName",message:"What name of brunch do you like?",choices:t.map((t=>({title:t,value:t})))});return i}async function checkoutBranch(t){console.log(`🐷 ${(0,o.cyan)("info")} creating new branch ${(0,o.yellow)(t)}`);await bs().checkoutLocalBranch(t)}const ensureEnvs=async()=>{if(!await isJiraConfigured()){return Promise.reject("The envs JIRA_DOMAIN or JIRA_AUTHORIZATION not exist. More info in doc")}};const addTaskToFileConfig=async t=>{await addTask(t)};const cleanFileConfig=async()=>{console.log(`🐷 ${(0,o.cyan)("info")} auto clean tasks`);const t=await getInProgressTasks();for(const r of t){const t=await findTask(r.jiraId);if(t===null)continue;const{status:i}=t;if(i===_s.DONE)await removeTask(t)}};const run=async()=>{await addCurrentProject();await ensureEnvs();await gitFetch();await gitPull();const t=await askUserByTaskOwnership();const r=await searchTasks(t);if(!r.length)return Promise.reject("There are not in progress tasks");const i=await askUserByTask(r);const o=formatBranchName(i);const a=await askUserByFormatBranch(o);await checkoutBranch(a);await addTaskToFileConfig(i);await cleanFileConfig()};const Ks=run;var Zs;(function(t){t["HTTPSAPIGithubCOMUsersHubotEventsPrivacy"]="https://api.github.com/users/hubot/events{/privacy}";t["HTTPSAPIGithubCOMUsersOctocatEventsPrivacy"]="https://api.github.com/users/octocat/events{/privacy}";t["HTTPSAPIGithubCOMUsersOtherUserEventsPrivacy"]="https://api.github.com/users/other_user/events{/privacy}"})(Zs||(Zs={}));var Xs;(function(t){t["HTTPSAPIGithubCOMUsersHubotFollowingOtherUser"]="https://api.github.com/users/hubot/following{/other_user}";t["HTTPSAPIGithubCOMUsersOctocatFollowingOtherUser"]="https://api.github.com/users/octocat/following{/other_user}";t["HTTPSAPIGithubCOMUsersOtherUserFollowingOtherUser"]="https://api.github.com/users/other_user/following{/other_user}"})(Xs||(Xs={}));var en;(function(t){t["HTTPSAPIGithubCOMUsersHubotGistsGistID"]="https://api.github.com/users/hubot/gists{/gist_id}";t["HTTPSAPIGithubCOMUsersOctocatGistsGistID"]="https://api.github.com/users/octocat/gists{/gist_id}";t["HTTPSAPIGithubCOMUsersOtherUserGistsGistID"]="https://api.github.com/users/other_user/gists{/gist_id}"})(en||(en={}));var tn;(function(t){t["Hubot"]="hubot";t["Octocat"]="octocat";t["OtherUser"]="other_user"})(tn||(tn={}));var rn;(function(t){t["MDQ6VXNlcjE"]="MDQ6VXNlcjE="})(rn||(rn={}));var sn;(function(t){t["HTTPSAPIGithubCOMUsersHubotStarredOwnerRepo"]="https://api.github.com/users/hubot/starred{/owner}{/repo}";t["HTTPSAPIGithubCOMUsersOctocatStarredOwnerRepo"]="https://api.github.com/users/octocat/starred{/owner}{/repo}";t["HTTPSAPIGithubCOMUsersOtherUserStarredOwnerRepo"]="https://api.github.com/users/other_user/starred{/owner}{/repo}"})(sn||(sn={}));var nn;(function(t){t["User"]="User"})(nn||(nn={}));const getProjectList=async()=>{const t=await fetch(`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){const{message:r}=await t.json();return Promise.reject(`Fail to find projects in github -> ${t.statusText}: ${r}`)}const r=await t.json();return r.map((({id:t,name:r})=>({id:t,name:r})))};const createPullRequest=async t=>{const r=await fetch(`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:true}),headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!r.ok){const{message:t}=await r.json();return Promise.reject(`Fail to create PR in github -> ${r.statusText}: ${t}`)}const i=await r.json();return{id:i.id,number:i.number,url:i.html_url,state:i.state,title:i.title,body:i.body,head:i.head.ref,base:i.base.ref,repo:i.base.repo.name}};async function create_pull_request_gitFetch(){console.log(`🐷 ${(0,o.cyan)("info")} making a git fetch...`);await bs().fetch();console.log(`🐷 ${(0,o.green)("success")} git fetch completed`)}const askUserByBaseBranch=async t=>{const{baseBranch:i}=await r()({type:"select",name:"baseBranch",message:"What base branch?",choices:t.map((t=>({title:t,value:t})))});return i};const getBranchSummary=async()=>{const{current:t,all:r}=await bs().branch();return[t,r]};const ensureTokenGithub=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")}};const ensureCurrentBranchIsOrigin=async()=>{const{current:t,all:r}=await bs().branch();if(!r.find((r=>r===`remotes/origin/${t}`))){return Promise.reject("Current branch not found at origin")}};const create_pull_request_createPullRequest=async(t,r,i)=>{const{url:a}=await createPullRequest({title:`${t} pull request`,body:"Esta PR [cierra, soluciona, resuelve] [#000](https://zityhub.atlassian.net/browse/000)\n\n![required gif]()\n\n### Descripción\n\n- Sobre Esta PR\n\n### Aceptación\n\n- [ ] Hay que probar....\n\n### Información extra\n\n- Más info\n\n",head:t,base:r,repo:i});console.log(`🐷 ${(0,o.green)("success")} ${a}`)};function excludeLocalBranches(t){const r="remotes/origin/";return t.filter((t=>t.includes(r))).map((t=>t.replace(r,"")))}const excludeCurrentBranch=(t,r)=>r.filter((r=>r!==t));const askUserByProject=async t=>{const{project:i}=await r()({type:"select",name:"project",message:"What project?",choices:t.map((({name:t})=>({title:t,value:t})))});return i};const askUserByAllDataIsCorrect=async(t,i,o)=>{const{confirmed:a}=await r()({type:"confirm",name:"confirmed",message:`Do you want to create PR in "${t}" from "${o}" to "${i}"?`});return a};const create_pull_request_run=async()=>{await ensureTokenGithub();await create_pull_request_gitFetch();await ensureCurrentBranchIsOrigin();const t=await getProjectList();const r=await askUserByProject(t);const[i,o]=await getBranchSummary();const a=excludeLocalBranches(o);const l=excludeCurrentBranch(i,a);const u=await askUserByBaseBranch(l);const c=await askUserByAllDataIsCorrect(r,u,i);if(c)await create_pull_request_createPullRequest(i,u,r)};const on=create_pull_request_run;const check_in_progress_tasks_run=async()=>{const t=await getInProgressTasks();for(const i of t){const t=await findTask(i.jiraId);if(t===null)continue;console.log(t);const{id:o,name:a,status:l}=t;const{confirmed:u}=await r()({type:"confirm",name:"confirmed",message:`Do you want to close task "${a}" with status "${l}" and with id "${o}"?`});console.log(u);if(u)await removeTask(t)}};const an=check_in_progress_tasks_run;const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const ln="0.12.2";const install=async()=>{if(hasConfig()&&!await isNewVersion(ln))return;await init();await ensureFormatConfigFile();console.log(`🐷 ${(0,o.green)("success")} new version detected`);await updateVersion(ln)};const assUserByOption=async()=>{const t=[{title:"Create branch",description:"",value:"Create branch"},{title:"Create PR",description:"",value:"Create PR"},{title:"Exit",description:"",value:"Exit"}];if(await isExperimentalMode()){const r=(await getInProgressTasks()).length;t.push({title:`Check ${r} in progress tasks`,description:"",value:"Check in progress tasks"})}const{task:i}=await r()({type:"select",name:"task",message:"What do you want to do?",choices:t,initial:0});return i};const index_run=async()=>{await install();const t=await assUserByOption();if(t==="Create branch")await Ks();if(t==="Create PR")await on();if(t==="Check in progress tasks")await an()};index_run().then((()=>{console.log(`🐷 ${(0,o.green)("success")} process completed`);process.exit()})).catch((t=>{console.log(`🐷 ${(0,o.red)("error")} aborting`);console.log(`🐷 ${(0,o.red)("error")} ${t}`);process.exit(1)}))})();module.exports=i})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mytools-tasks",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "license": "MIT",
5
5
  "repository": "diazdavid-info/my-tools",
6
6
  "author": {