chrome-tools 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chrome_abe_decrypt.exe +0 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
|
Binary file
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ var $i=Object.create;var rr=Object.defineProperty;var Ii=Object.getOwnPropertyDe
|
|
|
5
5
|
`)!=-1,n=this._styles,i=n.length;i--;){var o=ue[n[i]];e=o.open+e.replace(o.closeRe,o.open)+o.close,t&&(e=e.replace(Lo,function(s){return o.close+s+o.open}))}return e}E.setTheme=function(r){if(typeof r=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in r)(function(t){E[t]=function(n){if(typeof r[t]=="object"){var i=n;for(var o in r[t])i=E[r[t][o]](i);return i}return E[r[t]](n)}})(e)};function Mo(){var r={};return Object.keys(on).forEach(function(e){r[e]={get:function(){return nn([e])}}}),r}var Wo=function(e,t){var n=t.split("");return n=n.map(e),n.join("")};E.trap=Gr();E.zalgo=Kr();E.maps={};E.maps.america=zr()(E);E.maps.zebra=Jr()(E);E.maps.rainbow=Qr()(E);E.maps.random=en()(E);for(tn in E.maps)(function(r){E[r]=function(e){return Wo(E.maps[r],e)}})(tn);var tn;rn(E,Mo())});var ln=O((ol,an)=>{"use strict";var jo=un();an.exports=jo});var pn=O((sl,Qe)=>{"use strict";var{info:Ho,debug:dn}=Je(),V=St(),Ot=class r{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","bigint","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let t=e.content;if(["boolean","number","bigint","string"].indexOf(typeof t)!==-1)this.content=String(t);else if(!t)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof t);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,t){this.cells=t;let n=this.options.chars||{},i=e.chars,o=this.chars={};Go.forEach(function(u){At(n,i,u,o)}),this.truncate=this.options.truncate||e.truncate;let s=this.options.style=this.options.style||{},a=e.style;At(s,a,"padding-left",this),At(s,a,"padding-right",this),this.head=s.head||a.head,this.border=s.border||a.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=V.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){let t=e.wordWrap||e.textWrap,{wordWrap:n=t}=this.options;if(this.fixedWidth&&n){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let s=1;for(;s<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+s],s++}let{wrapOnWordBoundary:i=!0}=e,{wrapOnWordBoundary:o=i}=this.options;return this.wrapLines(V.wordWrap(this.fixedWidth,this.content,o))}return this.wrapLines(this.content.split(`
|
|
6
6
|
`))}wrapLines(e){let t=V.colorizeLines(e);return this.href?t.map(n=>V.hyperlink(this.href,n)):t}init(e){let t=this.x,n=this.y;this.widths=e.colWidths.slice(t,t+this.colSpan),this.heights=e.rowHeights.slice(n,n+this.rowSpan),this.width=this.widths.reduce(fn,-1),this.height=this.heights.reduce(fn,-1),this.hAlign=this.options.hAlign||e.colAligns[t],this.vAlign=this.options.vAlign||e.rowAligns[n],this.drawRight=t+this.colSpan==e.colWidths.length}draw(e,t){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let n=V.truncate(this.content,10,this.truncate);e||Ho(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${n}`);let i=Math.max(this.height-this.lines.length,0),o;switch(this.vAlign){case"center":o=Math.ceil(i/2);break;case"bottom":o=i;break;default:o=0}if(e<o||e>=o+this.lines.length)return this.drawEmpty(this.drawRight,t);let s=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-o,this.drawRight,s,t)}drawTop(e){let t=[];return this.cells?this.widths.forEach(function(n,i){t.push(this._topLeftChar(i)),t.push(V.repeat(this.chars[this.y==0?"top":"mid"],n))},this):(t.push(this._topLeftChar(0)),t.push(V.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&t.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",t.join(""))}_topLeftChar(e){let t=this.x+e,n;if(this.y==0)n=t==0?"topLeft":e==0?"topMid":"top";else if(t==0)n="leftMid";else if(n=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][t]instanceof r.ColSpanCell&&(n=e==0?"topMid":"mid"),e==0)){let o=1;for(;this.cells[this.y][t-o]instanceof r.ColSpanCell;)o++;this.cells[this.y][t-o]instanceof r.RowSpanCell&&(n="leftMid")}return this.chars[n]}wrapWithStyleColors(e,t){if(this[e]&&this[e].length)try{let n=ln();for(let i=this[e].length-1;i>=0;i--)n=n[this[e][i]];return n(t)}catch{return t}else return t}drawLine(e,t,n,i){let o=this.chars[this.x==0?"left":"middle"];if(this.x&&i&&this.cells){let d=this.cells[this.y+i][this.x-1];for(;d instanceof Le;)d=this.cells[d.y][d.x-1];d instanceof Pe||(o=this.chars.rightMid)}let s=V.repeat(" ",this.paddingLeft),a=t?this.chars.right:"",u=V.repeat(" ",this.paddingRight),c=this.lines[e],l=this.width-(this.paddingLeft+this.paddingRight);n&&(c+=this.truncate||"\u2026");let f=V.truncate(c,l,this.truncate);return f=V.pad(f,l," ",this.hAlign),f=s+f+u,this.stylizeLine(o,f,a)}stylizeLine(e,t,n){return e=this.wrapWithStyleColors("border",e),n=this.wrapWithStyleColors("border",n),this.y===0&&(t=this.wrapWithStyleColors("head",t)),e+t+n}drawBottom(e){let t=this.chars[this.x==0?"bottomLeft":"bottomMid"],n=V.repeat(this.chars.bottom,this.width),i=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",t+n+i)}drawEmpty(e,t){let n=this.chars[this.x==0?"left":"middle"];if(this.x&&t&&this.cells){let s=this.cells[this.y+t][this.x-1];for(;s instanceof Le;)s=this.cells[s.y][s.x-1];s instanceof Pe||(n=this.chars.rightMid)}let i=e?this.chars.right:"",o=V.repeat(" ",this.width);return this.stylizeLine(n,o,i)}},Le=class{constructor(){}draw(e){return typeof e=="number"&&dn(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},Pe=class{constructor(e){this.originalCell=e}init(e){let t=this.y,n=this.originalCell.y;this.cellOffset=t-n,this.offset=Vo(e.rowHeights,n,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(dn(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}};function cn(...r){return r.filter(e=>e!=null).shift()}function At(r,e,t,n){let i=t.split("-");i.length>1?(i[1]=i[1].charAt(0).toUpperCase()+i[1].substr(1),i=i.join(""),n[i]=cn(r[i],r[t],e[i],e[t])):n[t]=cn(r[t],e[t])}function Vo(r,e,t){let n=r[e];for(let i=1;i<t;i++)n+=1+r[e+i];return n}function fn(r,e){return r+e+1}var Go=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];Qe.exports=Ot;Qe.exports.ColSpanCell=Le;Qe.exports.RowSpanCell=Pe});var Dn=O((ul,mn)=>{"use strict";var{warn:Uo,debug:Ko}=Je(),vt=pn(),{ColSpanCell:qo,RowSpanCell:zo}=vt;(function(){function r(m,p){return m[p]>0?r(m,p+1):p}function e(m){let p={};m.forEach(function(h,g){let y=0;h.forEach(function(C){C.y=g,C.x=g?r(p,y):y;let T=C.rowSpan||1,_=C.colSpan||1;if(T>1)for(let k=0;k<_;k++)p[C.x+k]=T;y=C.x+_}),Object.keys(p).forEach(C=>{p[C]--,p[C]<1&&delete p[C]})})}function t(m){let p=0;return m.forEach(function(h){h.forEach(function(g){p=Math.max(p,g.x+(g.colSpan||1))})}),p}function n(m){return m.length}function i(m,p){let h=m.y,g=m.y-1+(m.rowSpan||1),y=p.y,C=p.y-1+(p.rowSpan||1),T=!(h>C||y>g),_=m.x,k=m.x-1+(m.colSpan||1),Q=p.x,mt=p.x-1+(p.colSpan||1),v=!(_>mt||Q>k);return T&&v}function o(m,p,h){let g=Math.min(m.length-1,h),y={x:p,y:h};for(let C=0;C<=g;C++){let T=m[C];for(let _=0;_<T.length;_++)if(i(y,T[_]))return!0}return!1}function s(m,p,h,g){for(let y=h;y<g;y++)if(o(m,y,p))return!1;return!0}function a(m){m.forEach(function(p,h){p.forEach(function(g){for(let y=1;y<g.rowSpan;y++){let C=new zo(g);C.x=g.x,C.y=g.y+y,C.colSpan=g.colSpan,c(C,m[h+y])}})})}function u(m){for(let p=m.length-1;p>=0;p--){let h=m[p];for(let g=0;g<h.length;g++){let y=h[g];for(let C=1;C<y.colSpan;C++){let T=new qo;T.x=y.x+C,T.y=y.y,h.splice(g+1,0,T)}}}}function c(m,p){let h=0;for(;h<p.length&&p[h].x<m.x;)h++;p.splice(h,0,m)}function l(m){let p=n(m),h=t(m);Ko(`Max rows: ${p}; Max cols: ${h}`);for(let g=0;g<p;g++)for(let y=0;y<h;y++)if(!o(m,y,g)){let C={x:y,y:g,colSpan:1,rowSpan:1};for(y++;y<h&&!o(m,y,g);)C.colSpan++,y++;let T=g+1;for(;T<p&&s(m,T,C.x,C.x+C.colSpan);)C.rowSpan++,T++;let _=new vt(C);_.x=C.x,_.y=C.y,Uo(`Missing cell at ${_.y}-${_.x}.`),c(_,m[g])}}function f(m){return m.map(function(p){if(!Array.isArray(p)){let h=Object.keys(p)[0];p=p[h],Array.isArray(p)?(p=p.slice(),p.unshift(h)):p=[h,p]}return p.map(function(h){return new vt(h)})})}function d(m){let p=f(m);return e(p),l(p),a(p),u(p),p}mn.exports={makeTableLayout:d,layoutTable:e,addRowSpanCells:a,maxWidth:t,fillInTable:l,computeWidths:hn("colSpan","desiredWidth","x",1),computeHeights:hn("rowSpan","desiredHeight","y",1)}})();function hn(r,e,t,n){return function(i,o){let s=[],a=[],u={};o.forEach(function(c){c.forEach(function(l){(l[r]||1)>1?a.push(l):s[l[t]]=Math.max(s[l[t]]||0,l[e]||0,n)})}),i.forEach(function(c,l){typeof c=="number"&&(s[l]=c)});for(let c=a.length-1;c>=0;c--){let l=a[c],f=l[r],d=l[t],m=s[d],p=typeof i[d]=="number"?0:1;if(typeof m=="number")for(let h=1;h<f;h++)m+=1+s[d+h],typeof i[d+h]!="number"&&p++;else m=e==="desiredWidth"?l.desiredWidth-1:1,(!u[d]||u[d]<m)&&(u[d]=m);if(l[e]>m){let h=0;for(;p>0&&l[e]>m;){if(typeof i[d+h]!="number"){let g=Math.round((l[e]-m)/p);m+=g,s[d+h]+=g,p--}h++}}}Object.assign(i,s,u);for(let c=0;c<i.length;c++)i[c]=Math.max(n,i[c]||0)}}});var yn=O((al,gn)=>{"use strict";var te=Je(),Yo=St(),kt=Dn(),Ze=class extends Array{constructor(e){super();let t=Yo.mergeOptions(e);if(Object.defineProperty(this,"options",{value:t,enumerable:t.debug}),t.debug){switch(typeof t.debug){case"boolean":te.setDebugLevel(te.WARN);break;case"number":te.setDebugLevel(t.debug);break;case"string":te.setDebugLevel(parseInt(t.debug,10));break;default:te.setDebugLevel(te.WARN),te.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof t.debug}`)}Object.defineProperty(this,"messages",{get(){return te.debugMessages()}})}}toString(){let e=this,t=this.options.head&&this.options.head.length;t?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let n=kt.makeTableLayout(e);n.forEach(function(o){o.forEach(function(s){s.mergeTableOptions(this.options,n)},this)},this),kt.computeWidths(this.options.colWidths,n),kt.computeHeights(this.options.rowHeights,n),n.forEach(function(o){o.forEach(function(s){s.init(this.options)},this)},this);let i=[];for(let o=0;o<n.length;o++){let s=n[o],a=this.options.rowHeights[o];(o===0||!this.options.style.compact||o==1&&t)&&Rt(s,"top",i);for(let u=0;u<a;u++)Rt(s,u,i);o+1==n.length&&Rt(s,"bottom",i)}return i.join(`
|
|
7
7
|
`)}get width(){return this.toString().split(`
|
|
8
|
-
`)[0].length}};Ze.reset=()=>te.reset();function Rt(r,e,t){let n=[];r.forEach(function(o){n.push(o.draw(e))});let i=n.join("");i.length&&t.push(i)}gn.exports=Ze});var En=O((ll,Cn)=>{"use strict";Cn.exports=yn()});var ir={name:"chrome-tools",version:"1.2.
|
|
8
|
+
`)[0].length}};Ze.reset=()=>te.reset();function Rt(r,e,t){let n=[];r.forEach(function(o){n.push(o.draw(e))});let i=n.join("");i.length&&t.push(i)}gn.exports=Ze});var En=O((ll,Cn)=>{"use strict";Cn.exports=yn()});var ir={name:"chrome-tools",version:"1.2.4",description:"CLI & Node.js library for chrome",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./passwords":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./bookmarks":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./history":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./cookies":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./local-storage":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./autofill":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./downloads":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./extensions":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./search-engines":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./top-sites":{types:"./dist/index.d.ts",import:"./dist/index.js"}},bin:{"chrome-tools":"dist/cli.js"},files:["dist"],scripts:{build:"node scripts/clean.mjs && tsup && tsc -p tsconfig.types.json && node scripts/finalize.mjs && node scripts/verify-dist.mjs",typecheck:"tsc --noEmit",lint:"oxlint --deny-warnings .",start:"node dist/cli.js",test:"npm run build && npm run typecheck && node scripts/test-unit.mjs && node dist/cli.js --help","test:chrome":"node test/compatibility/chrome.mjs","test:package":"node test/compatibility/package.mjs",release:"node scripts/release.mjs"},keywords:["chrome","bookmarks","history","cookies","autofill","browser","macos","windows","linux","cross-platform","keychain","dpapi","cli"],author:"",license:"MIT",packageManager:"pnpm@11.9.0",engines:{node:">=22.16.0"},devDependencies:{"@types/node":"^26.6.6",chalk:"^6.0.1","cli-table3":"^0.6.5",commander:"^15.1.0",oxlint:"1.77.0",tsup:"^8.5.1",tsx:"^4.23.15",typescript:"^7.0.2"}};var ne=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Z=class extends ne{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Se=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Z(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Ge(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}import{EventEmitter as qi}from"node:events";import gt from"node:child_process";import ee from"node:path";import Ke from"node:fs";import b from"node:process";import{stripVTControlCharacters as zi}from"node:util";import{stripVTControlCharacters as Gi}from"node:util";var xe=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,o)=>i.name().localeCompare(o.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?t.push(n):n.long&&!o?t.push(e.createOption(n.long,n.description).helpGroup(n.helpGroupHeading)):n.short&&!i&&t.push(e.createOption(n.short,n.description).helpGroup(n.helpGroupHeading))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>Ge(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),t.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function o(f,d){return t.formatItem(f,n,d,t)}let s=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(s=s.concat([t.boxWrap(t.styleCommandDescription(a),i),""]));let u=t.visibleArguments(e).map(f=>o(t.styleArgumentTerm(t.argumentTerm(f)),t.styleArgumentDescription(t.argumentDescription(f))));if(s=s.concat(this.formatItemList("Arguments:",u,t)),this.groupItems(e.options,t.visibleOptions(e),f=>f.helpGroupHeading??"Options:").forEach((f,d)=>{let m=f.map(p=>o(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));s=s.concat(this.formatItemList(d,m,t))}),t.showGlobalOptions){let f=t.visibleGlobalOptions(e).map(d=>o(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));s=s.concat(this.formatItemList("Global Options:",f,t))}return this.groupItems(e.commands,t.visibleCommands(e),f=>f.helpGroup()||"Commands:").forEach((f,d)=>{let m=f.map(p=>o(t.styleSubcommandTerm(t.subcommandTerm(p)),t.styleSubcommandDescription(t.subcommandDescription(p))));s=s.concat(this.formatItemList(d,m,t))}),s.join(`
|
|
9
9
|
`)}displayWidth(e){return Gi(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(t+e.length-i.displayWidth(e)),u=2,l=(this.helpWidth??80)-t-u-2,f;return l<this.minWidthToWrap||i.preformatted(n)?f=n:f=i.boxWrap(n,l).replace(/\n/g,`
|
|
10
10
|
`+" ".repeat(t+u)),s+a+" ".repeat(u)+f.replace(/\n/g,`
|
|
11
11
|
${s}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,o=[];return n.forEach(s=>{let a=s.match(i);if(a===null){o.push("");return}let u=[a.shift()],c=this.displayWidth(u[0]);a.forEach(l=>{let f=this.displayWidth(l);if(c+f<=t){u.push(l),c+=f;return}o.push(u.join(""));let d=l.trimStart();u=[d],c=this.displayWidth(d)}),o.push(u.join(""))}),o.join(`
|