glance-cli 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +122 -160
- package/dist/cli.js +151 -136
- package/package.json +2 -2
- package/src/cli/commands.ts +679 -74
- package/src/cli/config.ts +1 -1
- package/src/cli/index.ts +29 -2
- package/src/cli/utils.ts +3 -2
- package/src/core/summarizer.ts +106 -51
package/dist/cli.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as ZZ}from"node:module";var sq=Object.create;var{getPrototypeOf:eq,defineProperty:t2,getOwnPropertyNames:_Z}=Object;var $Z=Object.prototype.hasOwnProperty;var D1=(_,$,q)=>{q=_!=null?sq(eq(_)):{};let Z=$||!_||!_.__esModule?t2(q,"default",{value:_,enumerable:!0}):q;for(let Q of _Z(_))if(!$Z.call(Z,Q))t2(Z,Q,{get:()=>_[Q],enumerable:!0});return Z};var x=(_,$)=>()=>($||_(($={exports:{}}).exports,$),$.exports);var qZ=(_,$)=>{for(var q in $)t2(_,q,{get:$[q],enumerable:!0,configurable:!0,set:(Z)=>$[q]=()=>Z})};var v=ZZ(import.meta.url);var Q4=x((mG,Z4)=>{Z4.exports=q4;q4.sync=CQ;var _4=v("fs");function MQ(_,$){var q=$.pathExt!==void 0?$.pathExt:process.env.PATHEXT;if(!q)return!0;if(q=q.split(";"),q.indexOf("")!==-1)return!0;for(var Z=0;Z<q.length;Z++){var Q=q[Z].toLowerCase();if(Q&&_.substr(-Q.length).toLowerCase()===Q)return!0}return!1}function $4(_,$,q){if(!_.isSymbolicLink()&&!_.isFile())return!1;return MQ($,q)}function q4(_,$,q){_4.stat(_,function(Z,Q){q(Z,Z?!1:$4(Q,_,$))})}function CQ(_,$){return $4(_4.statSync(_),_,$)}});var H4=x((dG,K4)=>{K4.exports=J4;J4.sync=wQ;var X4=v("fs");function J4(_,$,q){X4.stat(_,function(Z,Q){q(Z,Z?!1:Y4(Q,$))})}function wQ(_,$){return Y4(X4.statSync(_),$)}function Y4(_,$){return _.isFile()&&TQ(_,$)}function TQ(_,$){var{mode:q,uid:Z,gid:Q}=_,X=$.uid!==void 0?$.uid:process.getuid&&process.getuid(),J=$.gid!==void 0?$.gid:process.getgid&&process.getgid(),Y=parseInt("100",8),K=parseInt("010",8),H=parseInt("001",8),B=Y|K,V=q&H||q&K&&Q===J||q&Y&&Z===X||q&B&&X===0;return V}});var U4=x((lG,B4)=>{var cG=v("fs"),h1;if(process.platform==="win32"||global.TESTING_WINDOWS)h1=Q4();else h1=H4();B4.exports=z6;z6.sync=IQ;function z6(_,$,q){if(typeof $==="function")q=$,$={};if(!q){if(typeof Promise!=="function")throw new TypeError("callback not provided");return new Promise(function(Z,Q){z6(_,$||{},function(X,J){if(X)Q(X);else Z(J)})})}h1(_,$||{},function(Z,Q){if(Z){if(Z.code==="EACCES"||$&&$.ignoreErrors)Z=null,Q=!1}q(Z,Q)})}function IQ(_,$){try{return h1.sync(_,$||{})}catch(q){if($&&$.ignoreErrors||q.code==="EACCES")return!1;else throw q}}});var R4=x((pG,L4)=>{var S0=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",V4=v("path"),OQ=S0?";":":",G4=U4(),F4=(_)=>Object.assign(new Error(`not found: ${_}`),{code:"ENOENT"}),W4=(_,$)=>{let q=$.colon||OQ,Z=_.match(/\//)||S0&&_.match(/\\/)?[""]:[...S0?[process.cwd()]:[],...($.path||process.env.PATH||"").split(q)],Q=S0?$.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",X=S0?Q.split(q):[""];if(S0){if(_.indexOf(".")!==-1&&X[0]!=="")X.unshift("")}return{pathEnv:Z,pathExt:X,pathExtExe:Q}},z4=(_,$,q)=>{if(typeof $==="function")q=$,$={};if(!$)$={};let{pathEnv:Z,pathExt:Q,pathExtExe:X}=W4(_,$),J=[],Y=(H)=>new Promise((B,V)=>{if(H===Z.length)return $.all&&J.length?B(J):V(F4(_));let F=Z[H],G=/^".*"$/.test(F)?F.slice(1,-1):F,W=V4.join(G,_),L=!G&&/^\.[\\\/]/.test(_)?_.slice(0,2)+W:W;B(K(L,H,0))}),K=(H,B,V)=>new Promise((F,G)=>{if(V===Q.length)return F(Y(B+1));let W=Q[V];G4(H+W,{pathExt:X},(L,D)=>{if(!L&&D)if($.all)J.push(H+W);else return F(H+W);return F(K(H,B,V+1))})});return q?Y(0).then((H)=>q(null,H),q):Y(0)},EQ=(_,$)=>{$=$||{};let{pathEnv:q,pathExt:Z,pathExtExe:Q}=W4(_,$),X=[];for(let J=0;J<q.length;J++){let Y=q[J],K=/^".*"$/.test(Y)?Y.slice(1,-1):Y,H=V4.join(K,_),B=!K&&/^\.[\\\/]/.test(_)?_.slice(0,2)+H:H;for(let V=0;V<Z.length;V++){let F=B+Z[V];try{if(G4.sync(F,{pathExt:Q}))if($.all)X.push(F);else return F}catch(G){}}}if($.all&&X.length)return X;if($.nothrow)return null;throw F4(_)};L4.exports=z4;z4.sync=EQ});var j4=x((aG,L6)=>{var D4=(_={})=>{let $=_.env||process.env;if((_.platform||process.platform)!=="win32")return"PATH";return Object.keys($).reverse().find((Z)=>Z.toUpperCase()==="PATH")||"Path"};L6.exports=D4;L6.exports.default=D4});var M4=x((iG,P4)=>{var k4=v("path"),xQ=R4(),NQ=j4();function A4(_,$){let q=_.options.env||process.env,Z=process.cwd(),Q=_.options.cwd!=null,X=Q&&process.chdir!==void 0&&!process.chdir.disabled;if(X)try{process.chdir(_.options.cwd)}catch(Y){}let J;try{J=xQ.sync(_.command,{path:q[NQ({env:q})],pathExt:$?k4.delimiter:void 0})}catch(Y){}finally{if(X)process.chdir(Z)}if(J)J=k4.resolve(Q?_.options.cwd:"",J);return J}function yQ(_){return A4(_)||A4(_,!0)}P4.exports=yQ});var C4=x((SQ,D6)=>{var R6=/([()\][%!^"`<>&|;, *?])/g;function vQ(_){return _=_.replace(R6,"^$1"),_}function hQ(_,$){if(_=`${_}`,_=_.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),_=_.replace(/(?=(\\+?)?)\1$/,"$1$1"),_=`"${_}"`,_=_.replace(R6,"^$1"),$)_=_.replace(R6,"^$1");return _}SQ.command=vQ;SQ.argument=hQ});var T4=x((nG,w4)=>{w4.exports=/^#!(.*)/});var O4=x((oG,I4)=>{var gQ=T4();I4.exports=(_="")=>{let $=_.match(gQ);if(!$)return null;let[q,Z]=$[0].replace(/#! ?/,"").split(" "),Q=q.split("/").pop();if(Q==="env")return Z;return Z?`${Q} ${Z}`:Q}});var x4=x((rG,E4)=>{var j6=v("fs"),uQ=O4();function mQ(_){let q=Buffer.alloc(150),Z;try{Z=j6.openSync(_,"r"),j6.readSync(Z,q,0,150,0),j6.closeSync(Z)}catch(Q){}return uQ(q.toString())}E4.exports=mQ});var h4=x((tG,v4)=>{var dQ=v("path"),N4=M4(),y4=C4(),cQ=x4(),lQ=process.platform==="win32",pQ=/\.(?:com|exe)$/i,aQ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function iQ(_){_.file=N4(_);let $=_.file&&cQ(_.file);if($)return _.args.unshift(_.file),_.command=$,N4(_);return _.file}function nQ(_){if(!lQ)return _;let $=iQ(_),q=!pQ.test($);if(_.options.forceShell||q){let Z=aQ.test($);_.command=dQ.normalize(_.command),_.command=y4.command(_.command),_.args=_.args.map((X)=>y4.argument(X,Z));let Q=[_.command].concat(_.args).join(" ");_.args=["/d","/s","/c",`"${Q}"`],_.command=process.env.comspec||"cmd.exe",_.options.windowsVerbatimArguments=!0}return _}function oQ(_,$,q){if($&&!Array.isArray($))q=$,$=null;$=$?$.slice(0):[],q=Object.assign({},q);let Z={command:_,args:$,options:q,file:void 0,original:{command:_,args:$}};return q.shell?Z:nQ(Z)}v4.exports=oQ});var f4=x((sG,b4)=>{var k6=process.platform==="win32";function A6(_,$){return Object.assign(new Error(`${$} ${_.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${$} ${_.command}`,path:_.command,spawnargs:_.args})}function rQ(_,$){if(!k6)return;let q=_.emit;_.emit=function(Z,Q){if(Z==="exit"){let X=S4(Q,$);if(X)return q.call(_,"error",X)}return q.apply(_,arguments)}}function S4(_,$){if(k6&&_===1&&!$.file)return A6($.original,"spawn");return null}function tQ(_,$){if(k6&&_===1&&!$.file)return A6($.original,"spawnSync");return null}b4.exports={hookChildProcess:rQ,verifyENOENT:S4,verifyENOENTSync:tQ,notFoundError:A6}});var m4=x((eG,b0)=>{var g4=v("child_process"),P6=h4(),M6=f4();function u4(_,$,q){let Z=P6(_,$,q),Q=g4.spawn(Z.command,Z.args,Z.options);return M6.hookChildProcess(Q,Z),Q}function sQ(_,$,q){let Z=P6(_,$,q),Q=g4.spawnSync(Z.command,Z.args,Z.options);return Q.error=Q.error||M6.verifyENOENTSync(Q.status,Z),Q}b0.exports=u4;b0.exports.spawn=u4;b0.exports.sync=sQ;b0.exports._parse=P6;b0.exports._enoent=M6});import{parseArgs as vU}from"node:util";var K5=(_=0)=>($)=>`\x1B[${$+_}m`,H5=(_=0)=>($)=>`\x1B[${38+_};5;${$}m`,B5=(_=0)=>($,q,Z)=>`\x1B[${38+_};2;${$};${q};${Z}m`,A={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},fU=Object.keys(A.modifier),QZ=Object.keys(A.color),XZ=Object.keys(A.bgColor),gU=[...QZ,...XZ];function JZ(){let _=new Map;for(let[$,q]of Object.entries(A)){for(let[Z,Q]of Object.entries(q))A[Z]={open:`\x1B[${Q[0]}m`,close:`\x1B[${Q[1]}m`},q[Z]=A[Z],_.set(Q[0],Q[1]);Object.defineProperty(A,$,{value:q,enumerable:!1})}return Object.defineProperty(A,"codes",{value:_,enumerable:!1}),A.color.close="\x1B[39m",A.bgColor.close="\x1B[49m",A.color.ansi=K5(),A.color.ansi256=H5(),A.color.ansi16m=B5(),A.bgColor.ansi=K5(10),A.bgColor.ansi256=H5(10),A.bgColor.ansi16m=B5(10),Object.defineProperties(A,{rgbToAnsi256:{value($,q,Z){if($===q&&q===Z){if($<8)return 16;if($>248)return 231;return Math.round(($-8)/247*24)+232}return 16+36*Math.round($/255*5)+6*Math.round(q/255*5)+Math.round(Z/255*5)},enumerable:!1},hexToRgb:{value($){let q=/[a-f\d]{6}|[a-f\d]{3}/i.exec($.toString(16));if(!q)return[0,0,0];let[Z]=q;if(Z.length===3)Z=[...Z].map((X)=>X+X).join("");let Q=Number.parseInt(Z,16);return[Q>>16&255,Q>>8&255,Q&255]},enumerable:!1},hexToAnsi256:{value:($)=>A.rgbToAnsi256(...A.hexToRgb($)),enumerable:!1},ansi256ToAnsi:{value($){if($<8)return 30+$;if($<16)return 90+($-8);let q,Z,Q;if($>=232)q=(($-232)*10+8)/255,Z=q,Q=q;else{$-=16;let Y=$%36;q=Math.floor($/36)/5,Z=Math.floor(Y/6)/5,Q=Y%6/5}let X=Math.max(q,Z,Q)*2;if(X===0)return 30;let J=30+(Math.round(Q)<<2|Math.round(Z)<<1|Math.round(q));if(X===2)J+=60;return J},enumerable:!1},rgbToAnsi:{value:($,q,Z)=>A.ansi256ToAnsi(A.rgbToAnsi256($,q,Z)),enumerable:!1},hexToAnsi:{value:($)=>A.ansi256ToAnsi(A.hexToAnsi256($)),enumerable:!1}}),A}var YZ=JZ(),f=YZ;import s2 from"node:process";import KZ from"node:os";import U5 from"node:tty";function h(_,$=globalThis.Deno?globalThis.Deno.args:s2.argv){let q=_.startsWith("-")?"":_.length===1?"-":"--",Z=$.indexOf(q+_),Q=$.indexOf("--");return Z!==-1&&(Q===-1||Z<Q)}var{env:P}=s2,j1;if(h("no-color")||h("no-colors")||h("color=false")||h("color=never"))j1=0;else if(h("color")||h("colors")||h("color=true")||h("color=always"))j1=1;function HZ(){if("FORCE_COLOR"in P){if(P.FORCE_COLOR==="true")return 1;if(P.FORCE_COLOR==="false")return 0;return P.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(P.FORCE_COLOR,10),3)}}function BZ(_){if(_===0)return!1;return{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function UZ(_,{streamIsTTY:$,sniffFlags:q=!0}={}){let Z=HZ();if(Z!==void 0)j1=Z;let Q=q?j1:Z;if(Q===0)return 0;if(q){if(h("color=16m")||h("color=full")||h("color=truecolor"))return 3;if(h("color=256"))return 2}if("TF_BUILD"in P&&"AGENT_NAME"in P)return 1;if(_&&!$&&Q===void 0)return 0;let X=Q||0;if(P.TERM==="dumb")return X;if(s2.platform==="win32"){let J=KZ.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in P){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((J)=>(J in P)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((J)=>(J in P))||P.CI_NAME==="codeship")return 1;return X}if("TEAMCITY_VERSION"in P)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(P.TEAMCITY_VERSION)?1:0;if(P.COLORTERM==="truecolor")return 3;if(P.TERM==="xterm-kitty")return 3;if(P.TERM==="xterm-ghostty")return 3;if(P.TERM==="wezterm")return 3;if("TERM_PROGRAM"in P){let J=Number.parseInt((P.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(P.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(P.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(P.TERM))return 1;if("COLORTERM"in P)return 1;return X}function V5(_,$={}){let q=UZ(_,{streamIsTTY:_&&_.isTTY,...$});return BZ(q)}var VZ={stdout:V5({isTTY:U5.isatty(1)}),stderr:V5({isTTY:U5.isatty(2)})},G5=VZ;function F5(_,$,q){let Z=_.indexOf($);if(Z===-1)return _;let Q=$.length,X=0,J="";do J+=_.slice(X,Z)+$+q,X=Z+Q,Z=_.indexOf($,X);while(Z!==-1);return J+=_.slice(X),J}function W5(_,$,q,Z){let Q=0,X="";do{let J=_[Z-1]==="\r";X+=_.slice(Q,J?Z-1:Z)+$+(J?`\r
|
|
2
|
+
import{createRequire as JZ}from"node:module";var $Z=Object.create;var{getPrototypeOf:qZ,defineProperty:_6,getOwnPropertyNames:ZZ}=Object;var QZ=Object.prototype.hasOwnProperty;var A1=(_,$,q)=>{q=_!=null?$Z(qZ(_)):{};let Z=$||!_||!_.__esModule?_6(q,"default",{value:_,enumerable:!0}):q;for(let Q of ZZ(_))if(!QZ.call(Z,Q))_6(Z,Q,{get:()=>_[Q],enumerable:!0});return Z};var h=(_,$)=>()=>($||_(($={exports:{}}).exports,$),$.exports);var XZ=(_,$)=>{for(var q in $)_6(_,q,{get:$[q],enumerable:!0,configurable:!0,set:(Z)=>$[q]=()=>Z})};var b=JZ(import.meta.url);var H4=h((iU,K4)=>{K4.exports=Y4;Y4.sync=IQ;var X4=b("fs");function kQ(_,$){var q=$.pathExt!==void 0?$.pathExt:process.env.PATHEXT;if(!q)return!0;if(q=q.split(";"),q.indexOf("")!==-1)return!0;for(var Z=0;Z<q.length;Z++){var Q=q[Z].toLowerCase();if(Q&&_.substr(-Q.length).toLowerCase()===Q)return!0}return!1}function J4(_,$,q){if(!_.isSymbolicLink()&&!_.isFile())return!1;return kQ($,q)}function Y4(_,$,q){X4.stat(_,function(Z,Q){q(Z,Z?!1:J4(Q,_,$))})}function IQ(_,$){return J4(X4.statSync(_),_,$)}});var F4=h((nU,U4)=>{U4.exports=V4;V4.sync=OQ;var B4=b("fs");function V4(_,$,q){B4.stat(_,function(Z,Q){q(Z,Z?!1:G4(Q,$))})}function OQ(_,$){return G4(B4.statSync(_),$)}function G4(_,$){return _.isFile()&&EQ(_,$)}function EQ(_,$){var{mode:q,uid:Z,gid:Q}=_,X=$.uid!==void 0?$.uid:process.getuid&&process.getuid(),J=$.gid!==void 0?$.gid:process.getgid&&process.getgid(),Y=parseInt("100",8),K=parseInt("010",8),H=parseInt("001",8),V=Y|K,G=q&H||q&K&&Q===J||q&Y&&Z===X||q&V&&X===0;return G}});var z4=h((rU,W4)=>{var oU=b("fs"),b1;if(process.platform==="win32"||global.TESTING_WINDOWS)b1=H4();else b1=F4();W4.exports=D6;D6.sync=NQ;function D6(_,$,q){if(typeof $==="function")q=$,$={};if(!q){if(typeof Promise!=="function")throw new TypeError("callback not provided");return new Promise(function(Z,Q){D6(_,$||{},function(X,J){if(X)Q(X);else Z(J)})})}b1(_,$||{},function(Z,Q){if(Z){if(Z.code==="EACCES"||$&&$.ignoreErrors)Z=null,Q=!1}q(Z,Q)})}function NQ(_,$){try{return b1.sync(_,$||{})}catch(q){if($&&$.ignoreErrors||q.code==="EACCES")return!1;else throw q}}});var P4=h((tU,M4)=>{var b0=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",L4=b("path"),xQ=b0?";":":",R4=z4(),D4=(_)=>Object.assign(new Error(`not found: ${_}`),{code:"ENOENT"}),j4=(_,$)=>{let q=$.colon||xQ,Z=_.match(/\//)||b0&&_.match(/\\/)?[""]:[...b0?[process.cwd()]:[],...($.path||process.env.PATH||"").split(q)],Q=b0?$.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",X=b0?Q.split(q):[""];if(b0){if(_.indexOf(".")!==-1&&X[0]!=="")X.unshift("")}return{pathEnv:Z,pathExt:X,pathExtExe:Q}},A4=(_,$,q)=>{if(typeof $==="function")q=$,$={};if(!$)$={};let{pathEnv:Z,pathExt:Q,pathExtExe:X}=j4(_,$),J=[],Y=(H)=>new Promise((V,G)=>{if(H===Z.length)return $.all&&J.length?V(J):G(D4(_));let U=Z[H],F=/^".*"$/.test(U)?U.slice(1,-1):U,W=L4.join(F,_),L=!F&&/^\.[\\\/]/.test(_)?_.slice(0,2)+W:W;V(K(L,H,0))}),K=(H,V,G)=>new Promise((U,F)=>{if(G===Q.length)return U(Y(V+1));let W=Q[G];R4(H+W,{pathExt:X},(L,A)=>{if(!L&&A)if($.all)J.push(H+W);else return U(H+W);return U(K(H,V,G+1))})});return q?Y(0).then((H)=>q(null,H),q):Y(0)},yQ=(_,$)=>{$=$||{};let{pathEnv:q,pathExt:Z,pathExtExe:Q}=j4(_,$),X=[];for(let J=0;J<q.length;J++){let Y=q[J],K=/^".*"$/.test(Y)?Y.slice(1,-1):Y,H=L4.join(K,_),V=!K&&/^\.[\\\/]/.test(_)?_.slice(0,2)+H:H;for(let G=0;G<Z.length;G++){let U=V+Z[G];try{if(R4.sync(U,{pathExt:Q}))if($.all)X.push(U);else return U}catch(F){}}}if($.all&&X.length)return X;if($.nothrow)return null;throw D4(_)};M4.exports=A4;A4.sync=yQ});var C4=h((sU,j6)=>{var w4=(_={})=>{let $=_.env||process.env;if((_.platform||process.platform)!=="win32")return"PATH";return Object.keys($).reverse().find((Z)=>Z.toUpperCase()==="PATH")||"Path"};j6.exports=w4;j6.exports.default=w4});var O4=h((eU,I4)=>{var T4=b("path"),vQ=P4(),hQ=C4();function k4(_,$){let q=_.options.env||process.env,Z=process.cwd(),Q=_.options.cwd!=null,X=Q&&process.chdir!==void 0&&!process.chdir.disabled;if(X)try{process.chdir(_.options.cwd)}catch(Y){}let J;try{J=vQ.sync(_.command,{path:q[hQ({env:q})],pathExt:$?T4.delimiter:void 0})}catch(Y){}finally{if(X)process.chdir(Z)}if(J)J=T4.resolve(Q?_.options.cwd:"",J);return J}function SQ(_){return k4(_)||k4(_,!0)}I4.exports=SQ});var E4=h((gQ,M6)=>{var A6=/([()\][%!^"`<>&|;, *?])/g;function bQ(_){return _=_.replace(A6,"^$1"),_}function fQ(_,$){if(_=`${_}`,_=_.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),_=_.replace(/(?=(\\+?)?)\1$/,"$1$1"),_=`"${_}"`,_=_.replace(A6,"^$1"),$)_=_.replace(A6,"^$1");return _}gQ.command=bQ;gQ.argument=fQ});var x4=h((_F,N4)=>{N4.exports=/^#!(.*)/});var v4=h(($F,y4)=>{var dQ=x4();y4.exports=(_="")=>{let $=_.match(dQ);if(!$)return null;let[q,Z]=$[0].replace(/#! ?/,"").split(" "),Q=q.split("/").pop();if(Q==="env")return Z;return Z?`${Q} ${Z}`:Q}});var S4=h((qF,h4)=>{var P6=b("fs"),cQ=v4();function pQ(_){let q=Buffer.alloc(150),Z;try{Z=P6.openSync(_,"r"),P6.readSync(Z,q,0,150,0),P6.closeSync(Z)}catch(Q){}return cQ(q.toString())}h4.exports=pQ});var u4=h((ZF,g4)=>{var lQ=b("path"),b4=O4(),f4=E4(),aQ=S4(),iQ=process.platform==="win32",nQ=/\.(?:com|exe)$/i,oQ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function rQ(_){_.file=b4(_);let $=_.file&&aQ(_.file);if($)return _.args.unshift(_.file),_.command=$,b4(_);return _.file}function tQ(_){if(!iQ)return _;let $=rQ(_),q=!nQ.test($);if(_.options.forceShell||q){let Z=oQ.test($);_.command=lQ.normalize(_.command),_.command=f4.command(_.command),_.args=_.args.map((X)=>f4.argument(X,Z));let Q=[_.command].concat(_.args).join(" ");_.args=["/d","/s","/c",`"${Q}"`],_.command=process.env.comspec||"cmd.exe",_.options.windowsVerbatimArguments=!0}return _}function sQ(_,$,q){if($&&!Array.isArray($))q=$,$=null;$=$?$.slice(0):[],q=Object.assign({},q);let Z={command:_,args:$,options:q,file:void 0,original:{command:_,args:$}};return q.shell?Z:tQ(Z)}g4.exports=sQ});var c4=h((QF,d4)=>{var w6=process.platform==="win32";function C6(_,$){return Object.assign(new Error(`${$} ${_.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${$} ${_.command}`,path:_.command,spawnargs:_.args})}function eQ(_,$){if(!w6)return;let q=_.emit;_.emit=function(Z,Q){if(Z==="exit"){let X=m4(Q,$);if(X)return q.call(_,"error",X)}return q.apply(_,arguments)}}function m4(_,$){if(w6&&_===1&&!$.file)return C6($.original,"spawn");return null}function _X(_,$){if(w6&&_===1&&!$.file)return C6($.original,"spawnSync");return null}d4.exports={hookChildProcess:eQ,verifyENOENT:m4,verifyENOENTSync:_X,notFoundError:C6}});var a4=h((XF,f0)=>{var p4=b("child_process"),T6=u4(),k6=c4();function l4(_,$,q){let Z=T6(_,$,q),Q=p4.spawn(Z.command,Z.args,Z.options);return k6.hookChildProcess(Q,Z),Q}function $X(_,$,q){let Z=T6(_,$,q),Q=p4.spawnSync(Z.command,Z.args,Z.options);return Q.error=Q.error||k6.verifyENOENTSync(Q.status,Z),Q}f0.exports=l4;f0.exports.spawn=l4;f0.exports.sync=$X;f0.exports._parse=T6;f0.exports._enoent=k6});import{parseArgs as uV}from"node:util";var U5=(_=0)=>($)=>`\x1B[${$+_}m`,F5=(_=0)=>($)=>`\x1B[${38+_};5;${$}m`,W5=(_=0)=>($,q,Z)=>`\x1B[${38+_};2;${$};${q};${Z}m`,C={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},pV=Object.keys(C.modifier),YZ=Object.keys(C.color),KZ=Object.keys(C.bgColor),lV=[...YZ,...KZ];function HZ(){let _=new Map;for(let[$,q]of Object.entries(C)){for(let[Z,Q]of Object.entries(q))C[Z]={open:`\x1B[${Q[0]}m`,close:`\x1B[${Q[1]}m`},q[Z]=C[Z],_.set(Q[0],Q[1]);Object.defineProperty(C,$,{value:q,enumerable:!1})}return Object.defineProperty(C,"codes",{value:_,enumerable:!1}),C.color.close="\x1B[39m",C.bgColor.close="\x1B[49m",C.color.ansi=U5(),C.color.ansi256=F5(),C.color.ansi16m=W5(),C.bgColor.ansi=U5(10),C.bgColor.ansi256=F5(10),C.bgColor.ansi16m=W5(10),Object.defineProperties(C,{rgbToAnsi256:{value($,q,Z){if($===q&&q===Z){if($<8)return 16;if($>248)return 231;return Math.round(($-8)/247*24)+232}return 16+36*Math.round($/255*5)+6*Math.round(q/255*5)+Math.round(Z/255*5)},enumerable:!1},hexToRgb:{value($){let q=/[a-f\d]{6}|[a-f\d]{3}/i.exec($.toString(16));if(!q)return[0,0,0];let[Z]=q;if(Z.length===3)Z=[...Z].map((X)=>X+X).join("");let Q=Number.parseInt(Z,16);return[Q>>16&255,Q>>8&255,Q&255]},enumerable:!1},hexToAnsi256:{value:($)=>C.rgbToAnsi256(...C.hexToRgb($)),enumerable:!1},ansi256ToAnsi:{value($){if($<8)return 30+$;if($<16)return 90+($-8);let q,Z,Q;if($>=232)q=(($-232)*10+8)/255,Z=q,Q=q;else{$-=16;let Y=$%36;q=Math.floor($/36)/5,Z=Math.floor(Y/6)/5,Q=Y%6/5}let X=Math.max(q,Z,Q)*2;if(X===0)return 30;let J=30+(Math.round(Q)<<2|Math.round(Z)<<1|Math.round(q));if(X===2)J+=60;return J},enumerable:!1},rgbToAnsi:{value:($,q,Z)=>C.ansi256ToAnsi(C.rgbToAnsi256($,q,Z)),enumerable:!1},hexToAnsi:{value:($)=>C.ansi256ToAnsi(C.hexToAnsi256($)),enumerable:!1}}),C}var BZ=HZ(),c=BZ;import $6 from"node:process";import VZ from"node:os";import z5 from"node:tty";function f(_,$=globalThis.Deno?globalThis.Deno.args:$6.argv){let q=_.startsWith("-")?"":_.length===1?"-":"--",Z=$.indexOf(q+_),Q=$.indexOf("--");return Z!==-1&&(Q===-1||Z<Q)}var{env:T}=$6,M1;if(f("no-color")||f("no-colors")||f("color=false")||f("color=never"))M1=0;else if(f("color")||f("colors")||f("color=true")||f("color=always"))M1=1;function GZ(){if("FORCE_COLOR"in T){if(T.FORCE_COLOR==="true")return 1;if(T.FORCE_COLOR==="false")return 0;return T.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(T.FORCE_COLOR,10),3)}}function UZ(_){if(_===0)return!1;return{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function FZ(_,{streamIsTTY:$,sniffFlags:q=!0}={}){let Z=GZ();if(Z!==void 0)M1=Z;let Q=q?M1:Z;if(Q===0)return 0;if(q){if(f("color=16m")||f("color=full")||f("color=truecolor"))return 3;if(f("color=256"))return 2}if("TF_BUILD"in T&&"AGENT_NAME"in T)return 1;if(_&&!$&&Q===void 0)return 0;let X=Q||0;if(T.TERM==="dumb")return X;if($6.platform==="win32"){let J=VZ.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in T){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((J)=>(J in T)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((J)=>(J in T))||T.CI_NAME==="codeship")return 1;return X}if("TEAMCITY_VERSION"in T)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(T.TEAMCITY_VERSION)?1:0;if(T.COLORTERM==="truecolor")return 3;if(T.TERM==="xterm-kitty")return 3;if(T.TERM==="xterm-ghostty")return 3;if(T.TERM==="wezterm")return 3;if("TERM_PROGRAM"in T){let J=Number.parseInt((T.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(T.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(T.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(T.TERM))return 1;if("COLORTERM"in T)return 1;return X}function L5(_,$={}){let q=FZ(_,{streamIsTTY:_&&_.isTTY,...$});return UZ(q)}var WZ={stdout:L5({isTTY:z5.isatty(1)}),stderr:L5({isTTY:z5.isatty(2)})},R5=WZ;function D5(_,$,q){let Z=_.indexOf($);if(Z===-1)return _;let Q=$.length,X=0,J="";do J+=_.slice(X,Z)+$+q,X=Z+Q,Z=_.indexOf($,X);while(Z!==-1);return J+=_.slice(X),J}function j5(_,$,q,Z){let Q=0,X="";do{let J=_[Z-1]==="\r";X+=_.slice(Q,J?Z-1:Z)+$+(J?`\r
|
|
3
3
|
`:`
|
|
4
4
|
`)+q,Q=Z+1,Z=_.indexOf(`
|
|
5
|
-
`,Q)}while(Z!==-1);return X+=_.slice(Q),X}var{stdout:
|
|
6
|
-
`);if(X!==-1)$=
|
|
7
|
-
`)J-=1,Y+=1;else if(H==="u"&&$[Y+2]==="{")Y=$.indexOf("}",Y+3);else Y+=
|
|
8
|
-
`]),
|
|
5
|
+
`,Q)}while(Z!==-1);return X+=_.slice(Q),X}var{stdout:A5,stderr:M5}=R5,q6=Symbol("GENERATOR"),x0=Symbol("STYLER"),e0=Symbol("IS_EMPTY"),P5=["ansi","ansi","ansi256","ansi16m"],y0=Object.create(null),zZ=(_,$={})=>{if($.level&&!(Number.isInteger($.level)&&$.level>=0&&$.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let q=A5?A5.level:0;_.level=$.level===void 0?q:$.level};var LZ=(_)=>{let $=(...q)=>q.join(" ");return zZ($,_),Object.setPrototypeOf($,_1.prototype),$};function _1(_){return LZ(_)}Object.setPrototypeOf(_1.prototype,Function.prototype);for(let[_,$]of Object.entries(c))y0[_]={get(){let q=P1(this,Q6($.open,$.close,this[x0]),this[e0]);return Object.defineProperty(this,_,{value:q}),q}};y0.visible={get(){let _=P1(this,this[x0],!0);return Object.defineProperty(this,"visible",{value:_}),_}};var Z6=(_,$,q,...Z)=>{if(_==="rgb"){if($==="ansi16m")return c[q].ansi16m(...Z);if($==="ansi256")return c[q].ansi256(c.rgbToAnsi256(...Z));return c[q].ansi(c.rgbToAnsi(...Z))}if(_==="hex")return Z6("rgb",$,q,...c.hexToRgb(...Z));return c[q][_](...Z)},RZ=["rgb","hex","ansi256"];for(let _ of RZ){y0[_]={get(){let{level:q}=this;return function(...Z){let Q=Q6(Z6(_,P5[q],"color",...Z),c.color.close,this[x0]);return P1(this,Q,this[e0])}}};let $="bg"+_[0].toUpperCase()+_.slice(1);y0[$]={get(){let{level:q}=this;return function(...Z){let Q=Q6(Z6(_,P5[q],"bgColor",...Z),c.bgColor.close,this[x0]);return P1(this,Q,this[e0])}}}}var DZ=Object.defineProperties(()=>{},{...y0,level:{enumerable:!0,get(){return this[q6].level},set(_){this[q6].level=_}}}),Q6=(_,$,q)=>{let Z,Q;if(q===void 0)Z=_,Q=$;else Z=q.openAll+_,Q=$+q.closeAll;return{open:_,close:$,openAll:Z,closeAll:Q,parent:q}},P1=(_,$,q)=>{let Z=(...Q)=>jZ(Z,Q.length===1?""+Q[0]:Q.join(" "));return Object.setPrototypeOf(Z,DZ),Z[q6]=_,Z[x0]=$,Z[e0]=q,Z},jZ=(_,$)=>{if(_.level<=0||!$)return _[e0]?"":$;let q=_[x0];if(q===void 0)return $;let{openAll:Z,closeAll:Q}=q;if($.includes("\x1B"))while(q!==void 0)$=D5($,q.close,q.open),q=q.parent;let X=$.indexOf(`
|
|
6
|
+
`);if(X!==-1)$=j5($,Q,Z,X);return Z+$+Q};Object.defineProperties(_1.prototype,y0);var AZ=_1(),$G=_1({level:M5?M5.level:0});var B=AZ;import{writeFile as NV}from"node:fs/promises";import{createInterface as xV}from"node:readline";import{parseArgs as yV}from"node:util";import*as nq from"cheerio";import Yq from"node:process";import T5 from"node:process";import TZ from"node:os";import kZ from"node:fs";import wZ from"node:fs";import w5 from"node:fs";var X6;function MZ(){try{return w5.statSync("/.dockerenv"),!0}catch{return!1}}function PZ(){try{return w5.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function J6(){if(X6===void 0)X6=MZ()||PZ();return X6}var Y6,CZ=()=>{try{return wZ.statSync("/run/.containerenv"),!0}catch{return!1}};function w1(){if(Y6===void 0)Y6=CZ()||J6();return Y6}var C5=()=>{if(T5.platform!=="linux")return!1;if(TZ.release().toLowerCase().includes("microsoft")){if(w1())return!1;return!0}try{return kZ.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!w1():!1}catch{return!1}},k5=T5.env.__IS_WSL_TEST__?C5:C5();import K6 from"node:process";function H6(){if(K6.platform!=="linux")return!1;if(K6.env.WAYLAND_DISPLAY)return!0;if(K6.env.XDG_SESSION_TYPE==="wayland")return!0;return!1}function I(_){if(typeof _!=="object"||_===null)return!1;let $=Object.getPrototypeOf(_);return($===null||$===Object.prototype||Object.getPrototypeOf($)===null)&&!(Symbol.toStringTag in _)&&!(Symbol.iterator in _)}import{fileURLToPath as IZ}from"node:url";var v0=(_,$)=>{let q=V6(OZ(_));if(typeof q!=="string")throw new TypeError(`${$} must be a string or a file URL: ${q}.`);return q},OZ=(_)=>B6(_)?_.toString():_,B6=(_)=>typeof _!=="string"&&_&&Object.getPrototypeOf(_)===String.prototype,V6=(_)=>_ instanceof URL?IZ(_):_;var C1=(_,$=[],q={})=>{let Z=v0(_,"First argument"),[Q,X]=I($)?[[],$]:[$,q];if(!Array.isArray(Q))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${Q}`);if(Q.some((K)=>typeof K==="object"&&K!==null))throw new TypeError(`Second argument must be an array of strings: ${Q}`);let J=Q.map(String),Y=J.find((K)=>K.includes("\x00"));if(Y!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${Y}`);if(!I(X))throw new TypeError(`Last argument must be an options object: ${X}`);return[Z,J,X]};import{ChildProcess as SZ}from"node:child_process";import{StringDecoder as EZ}from"node:string_decoder";var{toString:I5}=Object.prototype,O5=(_)=>I5.call(_)==="[object ArrayBuffer]",O=(_)=>I5.call(_)==="[object Uint8Array]",$0=(_)=>new Uint8Array(_.buffer,_.byteOffset,_.byteLength),NZ=new TextEncoder,E5=(_)=>NZ.encode(_),xZ=new TextDecoder,T1=(_)=>xZ.decode(_),N5=(_,$)=>{return yZ(_,$).join("")},yZ=(_,$)=>{if($==="utf8"&&_.every((X)=>typeof X==="string"))return _;let q=new EZ($),Z=_.map((X)=>typeof X==="string"?E5(X):X).map((X)=>q.write(X)),Q=q.end();return Q===""?Z:[...Z,Q]},$1=(_)=>{if(_.length===1&&O(_[0]))return _[0];return G6(vZ(_))},vZ=(_)=>_.map(($)=>typeof $==="string"?E5($):$),G6=(_)=>{let $=new Uint8Array(hZ(_)),q=0;for(let Z of _)$.set(Z,q),q+=Z.length;return $},hZ=(_)=>{let $=0;for(let q of _)$+=q.length;return $};var h5=(_)=>Array.isArray(_)&&Array.isArray(_.raw),S5=(_,$)=>{let q=[];for(let[X,J]of _.entries())q=bZ({templates:_,expressions:$,tokens:q,index:X,template:J});if(q.length===0)throw new TypeError("Template script must not be empty");let[Z,...Q]=q;return[Z,Q,{}]},bZ=({templates:_,expressions:$,tokens:q,index:Z,template:Q})=>{if(Q===void 0)throw new TypeError(`Invalid backslash sequence: ${_.raw[Z]}`);let{nextTokens:X,leadingWhitespaces:J,trailingWhitespaces:Y}=fZ(Q,_.raw[Z]),K=y5(q,X,J);if(Z===$.length)return K;let H=$[Z],V=Array.isArray(H)?H.map((G)=>v5(G)):[v5(H)];return y5(K,V,Y)},fZ=(_,$)=>{if($.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let q=[],Z=0,Q=x5.has($[0]);for(let J=0,Y=0;J<_.length;J+=1,Y+=1){let K=$[Y];if(x5.has(K)){if(Z!==J)q.push(_.slice(Z,J));Z=J+1}else if(K==="\\"){let H=$[Y+1];if(H===`
|
|
7
|
+
`)J-=1,Y+=1;else if(H==="u"&&$[Y+2]==="{")Y=$.indexOf("}",Y+3);else Y+=gZ[H]??1}}let X=Z===_.length;if(!X)q.push(_.slice(Z));return{nextTokens:q,leadingWhitespaces:Q,trailingWhitespaces:X}},x5=new Set([" ","\t","\r",`
|
|
8
|
+
`]),gZ={x:3,u:5},y5=(_,$,q)=>q||_.length===0||$.length===0?[..._,...$]:[..._.slice(0,-1),`${_.at(-1)}${$[0]}`,...$.slice(1)],v5=(_)=>{let $=typeof _;if($==="string")return _;if($==="number")return String(_);if(I(_)&&(("stdout"in _)||("isMaxBuffer"in _)))return uZ(_);if(_ instanceof SZ||Object.prototype.toString.call(_)==="[object Promise]")throw new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.");throw new TypeError(`Unexpected "${$}" in template expression`)},uZ=({stdout:_})=>{if(typeof _==="string")return _;if(O(_))return T1(_);if(_===void 0)throw new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`);throw new TypeError(`Unexpected "${typeof _}" stdout in template expression`)};import{spawnSync as iY}from"node:child_process";import{debuglog as mZ}from"node:util";import U6 from"node:process";var p=(_)=>k1.includes(_),k1=[U6.stdin,U6.stdout,U6.stderr],g=["stdin","stdout","stderr"],I1=(_)=>g[_]??`stdio[${_}]`;var f5=(_)=>{let $={..._};for(let q of z6)$[q]=F6(_,q);return $},F6=(_,$)=>{let q=Array.from({length:dZ(_)+1}),Z=cZ(_[$],q,$);return nZ(Z,$)},dZ=({stdio:_})=>Array.isArray(_)?Math.max(_.length,g.length):g.length,cZ=(_,$,q)=>I(_)?pZ(_,$,q):$.fill(_),pZ=(_,$,q)=>{for(let Z of Object.keys(_).sort(lZ))for(let Q of aZ(Z,q,$))$[Q]=_[Z];return $},lZ=(_,$)=>b5(_)<b5($)?1:-1,b5=(_)=>{if(_==="stdout"||_==="stderr")return 0;return _==="all"?2:1},aZ=(_,$,q)=>{if(_==="ipc")return[q.length-1];let Z=W6(_);if(Z===void 0||Z===0)throw new TypeError(`"${$}.${_}" is invalid.
|
|
9
9
|
It must be "${$}.stdout", "${$}.stderr", "${$}.all", "${$}.ipc", or "${$}.fd3", "${$}.fd4" (and so on).`);if(Z>=q.length)throw new TypeError(`"${$}.${_}" is invalid: that file descriptor does not exist.
|
|
10
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);return Z==="all"?[1,2]:[Z]},
|
|
11
|
-
`).map(($)=>
|
|
12
|
-
`),
|
|
10
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return Z==="all"?[1,2]:[Z]},W6=(_)=>{if(_==="all")return _;if(g.includes(_))return g.indexOf(_);let $=iZ.exec(_);if($!==null)return Number($[1])},iZ=/^fd(\d+)$/,nZ=(_,$)=>_.map((q)=>q===void 0?rZ[$]:q),oZ=mZ("execa").enabled?"full":"none",rZ={lines:!1,buffer:!0,maxBuffer:1e8,verbose:oZ,stripFinalNewline:!0},z6=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],q0=(_,$)=>$==="ipc"?_.at(-1):_[$];var h0=({verbose:_},$)=>L6(_,$)!=="none",S0=({verbose:_},$)=>!["none","short"].includes(L6(_,$)),g5=({verbose:_},$)=>{let q=L6(_,$);return O1(q)?q:void 0},L6=(_,$)=>$===void 0?tZ(_):q0(_,$),tZ=(_)=>_.find(($)=>O1($))??E1.findLast(($)=>_.includes($)),O1=(_)=>typeof _==="function",E1=["none","short","full"];import{inspect as DQ}from"node:util";import{platform as sZ}from"node:process";import{stripVTControlCharacters as eZ}from"node:util";var u5=(_,$)=>{let q=[_,...$],Z=q.join(" "),Q=q.map((X)=>XQ(m5(X))).join(" ");return{command:Z,escapedCommand:Q}},q1=(_)=>eZ(_).split(`
|
|
11
|
+
`).map(($)=>m5($)).join(`
|
|
12
|
+
`),m5=(_)=>_.replaceAll(qQ,($)=>_Q($)),_Q=(_)=>{let $=ZQ[_];if($!==void 0)return $;let q=_.codePointAt(0),Z=q.toString(16);return q<=QQ?`\\u${Z.padStart(4,"0")}`:`\\U${Z}`},$Q=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},qQ=$Q(),ZQ={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},QQ=65535,XQ=(_)=>{if(JQ.test(_))return _;return sZ==="win32"?`"${_.replaceAll('"','""')}"`:`'${_.replaceAll("'","'\\''")}'`},JQ=/^[\w./-]+$/;import d5 from"node:process";function j0(){let{env:_}=d5,{TERM:$,TERM_PROGRAM:q}=_;if(d5.platform!=="win32")return $!=="linux";return Boolean(_.WT_SESSION)||Boolean(_.TERMINUS_SUBLIME)||_.ConEmuTask==="{cmd::Cmder}"||q==="Terminus-Sublime"||q==="vscode"||$==="xterm-256color"||$==="alacritty"||$==="rxvt-unicode"||$==="rxvt-unicode-256color"||_.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var c5={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},p5={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},YQ={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},KQ={...c5,...p5},HQ={...c5,...YQ},BQ=j0(),VQ=BQ?KQ:HQ,N1=VQ,mG=Object.entries(p5);import GQ from"node:tty";var UQ=GQ?.WriteStream?.prototype?.hasColors?.()??!1,M=(_,$)=>{if(!UQ)return(Q)=>Q;let q=`\x1B[${_}m`,Z=`\x1B[${$}m`;return(Q)=>{let X=Q+"",J=X.indexOf(Z);if(J===-1)return q+X+Z;let Y=q,K=0,V=($===22?Z:"")+q;while(J!==-1)Y+=X.slice(K,J)+V,K=J+Z.length,J=X.indexOf(Z,K);return Y+=X.slice(K)+Z,Y}},pG=M(0,0),l5=M(1,22),lG=M(2,22),aG=M(3,23),iG=M(4,24),nG=M(53,55),oG=M(7,27),rG=M(8,28),tG=M(9,29),sG=M(30,39),a5=M(31,39),i5=M(32,39),n5=M(33,39),o5=M(34,39),eG=M(35,39),_U=M(36,39),$U=M(37,39),x1=M(90,39),qU=M(40,49),ZU=M(41,49),QU=M(42,49),XU=M(43,49),JU=M(44,49),YU=M(45,49),KU=M(46,49),HU=M(47,49),BU=M(100,49),r5=M(91,39),VU=M(92,39),t5=M(93,39),GU=M(94,39),UU=M(95,39),FU=M(96,39),WU=M(97,39),zU=M(101,49),LU=M(102,49),RU=M(103,49),DU=M(104,49),jU=M(105,49),AU=M(106,49),MU=M(107,49);var _4=({type:_,message:$,timestamp:q,piped:Z,commandId:Q,result:{failed:X=!1}={},options:{reject:J=!0}})=>{let Y=FQ(q),K=WQ[_]({failed:X,reject:J,piped:Z}),H=zQ[_]({reject:J});return`${x1(`[${Y}]`)} ${x1(`[${Q}]`)} ${H(K)} ${H($)}`},FQ=(_)=>`${y1(_.getHours(),2)}:${y1(_.getMinutes(),2)}:${y1(_.getSeconds(),2)}.${y1(_.getMilliseconds(),3)}`,y1=(_,$)=>String(_).padStart($,"0"),s5=({failed:_,reject:$})=>{if(!_)return N1.tick;return $?N1.cross:N1.warning},WQ={command:({piped:_})=>_?"|":"$",output:()=>" ",ipc:()=>"*",error:s5,duration:s5},e5=(_)=>_,zQ={command:()=>l5,output:()=>e5,ipc:()=>e5,error:({reject:_})=>_?r5:t5,duration:()=>x1};var $4=(_,$,q)=>{let Z=g5($,q);return _.map(({verboseLine:Q,verboseObject:X})=>LQ(Q,X,Z)).filter((Q)=>Q!==void 0).map((Q)=>RQ(Q)).join("")},LQ=(_,$,q)=>{if(q===void 0)return _;let Z=q(_,$);if(typeof Z==="string")return Z},RQ=(_)=>_.endsWith(`
|
|
13
13
|
`)?_:`${_}
|
|
14
|
-
`;var
|
|
15
|
-
`).map((q)=>
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
Available signal numbers: ${
|
|
14
|
+
`;var n=({type:_,verboseMessage:$,fdNumber:q,verboseInfo:Z,result:Q})=>{let X=jQ({type:_,result:Q,verboseInfo:Z}),J=AQ($,X),Y=$4(J,Z,q);if(Y!=="")console.warn(Y.slice(0,-1))},jQ=({type:_,result:$,verboseInfo:{escapedCommand:q,commandId:Z,rawOptions:{piped:Q=!1,...X}}})=>({type:_,escapedCommand:q,commandId:`${Z}`,timestamp:new Date,piped:Q,result:$,options:X}),AQ=(_,$)=>_.split(`
|
|
15
|
+
`).map((q)=>MQ({...$,message:q})),MQ=(_)=>{return{verboseLine:_4(_),verboseObject:_}},v1=(_)=>{let $=typeof _==="string"?_:DQ(_);return q1($).replaceAll("\t"," ".repeat(PQ))},PQ=2;var q4=(_,$)=>{if(!h0($))return;n({type:"command",verboseMessage:_,verboseInfo:$})};var Z4=(_,$,q)=>{TQ(_);let Z=wQ(_);return{verbose:_,escapedCommand:$,commandId:Z,rawOptions:q}},wQ=(_)=>h0({verbose:_})?CQ++:void 0,CQ=0n,TQ=(_)=>{for(let $ of _){if($===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if($===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!E1.includes($)&&!O1($)){let q=E1.map((Z)=>`'${Z}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${$}. Allowed values are: ${q} or a function.`)}}};import{hrtime as Q4}from"node:process";var h1=()=>Q4.bigint(),R6=(_)=>Number(Q4.bigint()-_)/1e6;var S1=(_,$,q)=>{let Z=h1(),{command:Q,escapedCommand:X}=u5(_,$),J=F6(q,"verbose"),Y=Z4(J,X,{...q});return q4(X,Y),{command:Q,escapedCommand:X,startTime:Z,verboseInfo:Y}};var q_=A1(a4(),1);import GJ from"node:path";import $_ from"node:process";import u1 from"node:process";import A0 from"node:path";function f1(_={}){let{env:$=process.env,platform:q=process.platform}=_;if(q!=="win32")return"PATH";return Object.keys($).reverse().find((Z)=>Z.toUpperCase()==="PATH")||"Path"}import{promisify as qX}from"node:util";import{execFile as ZX,execFileSync as HF}from"node:child_process";import i4 from"node:path";import{fileURLToPath as QX}from"node:url";var GF=qX(ZX);function g1(_){return _ instanceof URL?QX(_):_}function n4(_){return{*[Symbol.iterator](){let $=i4.resolve(g1(_)),q;while(q!==$)yield $,q=$,$=i4.resolve($,"..")}}}var XX=({cwd:_=u1.cwd(),path:$=u1.env[f1()],preferLocal:q=!0,execPath:Z=u1.execPath,addExecPath:Q=!0}={})=>{let X=A0.resolve(g1(_)),J=[],Y=$.split(A0.delimiter);if(q)JX(J,Y,X);if(Q)YX(J,Y,Z,X);return $===""||$===A0.delimiter?`${J.join(A0.delimiter)}${$}`:[...J,$].join(A0.delimiter)},JX=(_,$,q)=>{for(let Z of n4(q)){let Q=A0.join(Z,"node_modules/.bin");if(!$.includes(Q))_.push(Q)}},YX=(_,$,q,Z)=>{let Q=A0.resolve(Z,g1(q),"..");if(!$.includes(Q))_.push(Q)},o4=({env:_=u1.env,...$}={})=>{_={..._};let q=f1({env:_});return $.path=_[q],_[q]=XX($),_};import{setTimeout as MX}from"node:timers/promises";var r4=(_,$,q)=>{let Z=q?d1:m1,Q=_ instanceof o?{}:{cause:_};return new Z($,Q)};class o extends Error{}var t4=(_,$)=>{Object.defineProperty(_.prototype,"name",{value:$,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,e4,{value:!0,writable:!1,enumerable:!1,configurable:!1})},s4=(_)=>c1(_)&&(e4 in _),e4=Symbol("isExecaError"),c1=(_)=>Object.prototype.toString.call(_)==="[object Error]";class m1 extends Error{}t4(m1,m1.name);class d1 extends Error{}t4(d1,d1.name);import{constants as Z1}from"node:os";import{constants as VX}from"node:os";var _8=()=>{let _=I6-$8+1;return Array.from({length:_},KX)},KX=(_,$)=>({name:`SIGRT${$+1}`,number:$8+$,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),$8=34,I6=64;import{constants as HX}from"node:os";var q8=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var O6=()=>{let _=_8();return[...q8,..._].map(BX)},BX=({name:_,number:$,description:q,action:Z,forced:Q=!1,standard:X})=>{let{signals:{[_]:J}}=HX,Y=J!==void 0;return{name:_,number:Y?J:$,description:q,supported:Y,action:Z,forced:Q,standard:X}};var GX=()=>{let _=O6();return Object.fromEntries(_.map(UX))},UX=({name:_,number:$,description:q,supported:Z,action:Q,forced:X,standard:J})=>[_,{name:_,number:$,description:q,supported:Z,action:Q,forced:X,standard:J}],Z8=GX(),FX=()=>{let _=O6(),$=I6+1,q=Array.from({length:$},(Z,Q)=>WX(Q,_));return Object.assign({},...q)},WX=(_,$)=>{let q=zX(_,$);if(q===void 0)return{};let{name:Z,description:Q,supported:X,action:J,forced:Y,standard:K}=q;return{[_]:{name:Z,number:_,description:Q,supported:X,action:J,forced:Y,standard:K}}},zX=(_,$)=>{let q=$.find(({name:Z})=>VX.signals[Z]===_);if(q!==void 0)return q;return $.find((Z)=>Z.number===_)},EF=FX();var X8=(_)=>{if(_===0)throw new TypeError("Invalid option `killSignal`: 0 cannot be used.");return Y8(_,"option `killSignal`")},J8=(_)=>_===0?_:Y8(_,"`subprocess.kill()`'s argument"),Y8=(_,$)=>{if(Number.isInteger(_))return LX(_,$);if(typeof _==="string")return DX(_,$);throw new TypeError(`Invalid ${$} ${String(_)}: it must be a string or an integer.
|
|
16
|
+
${E6()}`)},LX=(_,$)=>{if(Q8.has(_))return Q8.get(_);throw new TypeError(`Invalid ${$} ${_}: this signal integer does not exist.
|
|
17
|
+
${E6()}`)},RX=()=>new Map(Object.entries(Z1.signals).reverse().map(([_,$])=>[$,_])),Q8=RX(),DX=(_,$)=>{if(_ in Z1.signals)return _;if(_.toUpperCase()in Z1.signals)throw new TypeError(`Invalid ${$} '${_}': please rename it to '${_.toUpperCase()}'.`);throw new TypeError(`Invalid ${$} '${_}': this signal name does not exist.
|
|
18
|
+
${E6()}`)},E6=()=>`Available signal names: ${jX()}.
|
|
19
|
+
Available signal numbers: ${AX()}.`,jX=()=>Object.keys(Z1.signals).sort().map((_)=>`'${_}'`).join(", "),AX=()=>[...new Set(Object.values(Z1.signals).sort((_,$)=>_-$))].join(", "),p1=(_)=>Z8[_].description;var K8=(_)=>{if(_===!1)return _;if(_===!0)return PX;if(!Number.isFinite(_)||_<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${_}\` (${typeof _})`);return _},PX=5000,H8=({kill:_,options:{forceKillAfterDelay:$,killSignal:q},onInternalError:Z,context:Q,controller:X},J,Y)=>{let{signal:K,error:H}=wX(J,Y,q);CX(H,Z);let V=_(K);return TX({kill:_,signal:K,forceKillAfterDelay:$,killSignal:q,killResult:V,context:Q,controller:X}),V},wX=(_,$,q)=>{let[Z=q,Q]=c1(_)?[void 0,_]:[_,$];if(typeof Z!=="string"&&!Number.isInteger(Z))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(Z)}`);if(Q!==void 0&&!c1(Q))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${Q}`);return{signal:J8(Z),error:Q}},CX=(_,$)=>{if(_!==void 0)$.reject(_)},TX=async({kill:_,signal:$,forceKillAfterDelay:q,killSignal:Z,killResult:Q,context:X,controller:J})=>{if($===Z&&Q)N6({kill:_,forceKillAfterDelay:q,context:X,controllerSignal:J.signal})},N6=async({kill:_,forceKillAfterDelay:$,context:q,controllerSignal:Z})=>{if($===!1)return;try{if(await MX($,void 0,{signal:Z}),_("SIGKILL"))q.isForcefullyTerminated??=!0}catch{}};import{once as kX}from"node:events";var l1=async(_,$)=>{if(!_.aborted)await kX(_,"abort",{signal:$})};var B8=({cancelSignal:_})=>{if(_!==void 0&&Object.prototype.toString.call(_)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(_)}`)},V8=({subprocess:_,cancelSignal:$,gracefulCancel:q,context:Z,controller:Q})=>$===void 0||q?[]:[IX(_,$,Z,Q)],IX=async(_,$,q,{signal:Z})=>{throw await l1($,Z),q.terminationReason??="cancel",_.kill(),$.reason};import{scheduler as oX}from"node:timers/promises";import{promisify as aX}from"node:util";var g0=({methodName:_,isSubprocess:$,ipc:q,isConnected:Z})=>{OX(_,$,q),x6(_,$,Z)},OX=(_,$,q)=>{if(!q)throw new Error(`${l(_,$)} can only be used if the \`ipc\` option is \`true\`.`)},x6=(_,$,q)=>{if(!q)throw new Error(`${l(_,$)} cannot be used: the ${B0($)} has already exited or disconnected.`)},G8=(_)=>{throw new Error(`${l("getOneMessage",_)} could not complete: the ${B0(_)} exited or disconnected.`)},U8=(_)=>{throw new Error(`${l("sendMessage",_)} failed: the ${B0(_)} is sending a message too, instead of listening to incoming messages.
|
|
20
20
|
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
21
21
|
|
|
22
22
|
const [receivedMessage] = await Promise.all([
|
|
23
|
-
${
|
|
24
|
-
${
|
|
25
|
-
]);`)},
|
|
23
|
+
${l("getOneMessage",_)},
|
|
24
|
+
${l("sendMessage",_,"message, {strict: true}")},
|
|
25
|
+
]);`)},a1=(_,$)=>new Error(`${l("sendMessage",$)} failed when sending an acknowledgment response to the ${B0($)}.`,{cause:_}),F8=(_)=>{throw new Error(`${l("sendMessage",_)} failed: the ${B0(_)} is not listening to incoming messages.`)},W8=(_)=>{throw new Error(`${l("sendMessage",_)} failed: the ${B0(_)} exited without listening to incoming messages.`)},z8=()=>new Error(`\`cancelSignal\` aborted: the ${B0(!0)} disconnected.`),L8=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},R8=({error:_,methodName:$,isSubprocess:q})=>{if(_.code==="EPIPE")throw new Error(`${l($,q)} cannot be used: the ${B0(q)} is disconnecting.`,{cause:_})},D8=({error:_,methodName:$,isSubprocess:q,message:Z})=>{if(EX(_))throw new Error(`${l($,q)}'s argument type is invalid: the message cannot be serialized: ${String(Z)}.`,{cause:_})},EX=({code:_,message:$})=>NX.has(_)||xX.some((q)=>$.includes(q)),NX=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),xX=["could not be cloned","circular structure","call stack size exceeded"],l=(_,$,q="")=>_==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${yX($)}${_}(${q})`,yX=(_)=>_?"":"subprocess.",B0=(_)=>_?"parent process":"subprocess",u0=(_)=>{if(_.connected)_.disconnect()};var r=()=>{let _={},$=new Promise((q,Z)=>{Object.assign(_,{resolve:q,reject:Z})});return Object.assign($,_)};var n1=(_,$="stdin")=>{let{options:Z,fileDescriptors:Q}=t.get(_),X=j8(Q,$,!0),J=_.stdio[X];if(J===null)throw new TypeError(A8(X,$,Z,!0));return J},m0=(_,$="stdout")=>{let{options:Z,fileDescriptors:Q}=t.get(_),X=j8(Q,$,!1),J=X==="all"?_.all:_.stdio[X];if(J===null||J===void 0)throw new TypeError(A8(X,$,Z,!1));return J},t=new WeakMap,j8=(_,$,q)=>{let Z=vX($,q);return hX(Z,$,q,_),Z},vX=(_,$)=>{let q=W6(_);if(q!==void 0)return q;let{validOptions:Z,defaultValue:Q}=$?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Q1($)}" must not be "${_}".
|
|
26
26
|
It must be ${Z} or "fd3", "fd4" (and so on).
|
|
27
|
-
It is optional and defaults to "${Q}".`)},
|
|
28
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);if(Q.direction==="input"&&!q)throw new TypeError(`"${Q1(q)}" must not be ${$}. It must be a readable stream, not writable.`);if(Q.direction!=="input"&&q)throw new TypeError(`"${Q1(q)}" must not be ${$}. It must be a writable stream, not readable.`)},
|
|
29
|
-
Please set this option with "pipe" instead.`},
|
|
30
|
-
Please rename it to ${
|
|
31
|
-
Please rename it to one of: ${q}.`)},
|
|
32
|
-
${_.message}`,_}},
|
|
27
|
+
It is optional and defaults to "${Q}".`)},hX=(_,$,q,Z)=>{let Q=Z[M8(_)];if(Q===void 0)throw new TypeError(`"${Q1(q)}" must not be ${$}. That file descriptor does not exist.
|
|
28
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);if(Q.direction==="input"&&!q)throw new TypeError(`"${Q1(q)}" must not be ${$}. It must be a readable stream, not writable.`);if(Q.direction!=="input"&&q)throw new TypeError(`"${Q1(q)}" must not be ${$}. It must be a writable stream, not readable.`)},A8=(_,$,q,Z)=>{if(_==="all"&&!q.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:Q,optionValue:X}=SX(_,q);return`The "${Q}: ${i1(X)}" option is incompatible with using "${Q1(Z)}: ${i1($)}".
|
|
29
|
+
Please set this option with "pipe" instead.`},SX=(_,{stdin:$,stdout:q,stderr:Z,stdio:Q})=>{let X=M8(_);if(X===0&&$!==void 0)return{optionName:"stdin",optionValue:$};if(X===1&&q!==void 0)return{optionName:"stdout",optionValue:q};if(X===2&&Z!==void 0)return{optionName:"stderr",optionValue:Z};return{optionName:`stdio[${X}]`,optionValue:Q[X]}},M8=(_)=>_==="all"?1:_,Q1=(_)=>_?"to":"from",i1=(_)=>{if(typeof _==="string")return`'${_}'`;return typeof _==="number"?`${_}`:"Stream"};import{once as dX}from"node:events";import{addAbortListener as bX}from"node:events";var M0=(_,$,q)=>{let Z=_.getMaxListeners();if(Z===0||Z===Number.POSITIVE_INFINITY)return;_.setMaxListeners(Z+$),bX(q,()=>{_.setMaxListeners(_.getMaxListeners()-$)})};import{EventEmitter as uX}from"node:events";import{once as fX}from"node:events";import{scheduler as gX}from"node:timers/promises";var o1=(_,$)=>{if($)y6(_)},y6=(_)=>{_.refCounted()},r1=(_,$)=>{if($)v6(_)},v6=(_)=>{_.unrefCounted()},P8=(_,$)=>{if($)v6(_),v6(_)},w8=(_,$)=>{if($)y6(_),y6(_)};var C8=async({anyProcess:_,channel:$,isSubprocess:q,ipcEmitter:Z},Q)=>{if(I8(Q)||E8(Q))return;if(!t1.has(_))t1.set(_,[]);let X=t1.get(_);if(X.push(Q),X.length>1)return;while(X.length>0){await O8(_,Z,Q),await gX.yield();let J=await k8({wrappedMessage:X[0],anyProcess:_,channel:$,isSubprocess:q,ipcEmitter:Z});X.shift(),Z.emit("message",J),Z.emit("message:done")}},T8=async({anyProcess:_,channel:$,isSubprocess:q,ipcEmitter:Z,boundOnMessage:Q})=>{h6();let X=t1.get(_);while(X?.length>0)await fX(Z,"message:done");_.removeListener("message",Q),w8($,q),Z.connected=!1,Z.emit("disconnect")},t1=new WeakMap;var V0=(_,$,q)=>{if(s1.has(_))return s1.get(_);let Z=new uX;return Z.connected=!0,s1.set(_,Z),mX({ipcEmitter:Z,anyProcess:_,channel:$,isSubprocess:q}),Z},s1=new WeakMap,mX=({ipcEmitter:_,anyProcess:$,channel:q,isSubprocess:Z})=>{let Q=C8.bind(void 0,{anyProcess:$,channel:q,isSubprocess:Z,ipcEmitter:_});$.on("message",Q),$.once("disconnect",T8.bind(void 0,{anyProcess:$,channel:q,isSubprocess:Z,ipcEmitter:_,boundOnMessage:Q})),P8(q,Z)},e1=(_)=>{let $=s1.get(_);return $===void 0?_.channel!==null:$.connected};var N8=({anyProcess:_,channel:$,isSubprocess:q,message:Z,strict:Q})=>{if(!Q)return Z;let X=V0(_,$,q),J=q2(_,X);return{id:cX++,type:$2,message:Z,hasListeners:J}},cX=0n,x8=(_,$)=>{if($?.type!==$2||$.hasListeners)return;for(let{id:q}of _)if(q!==void 0)_2[q].resolve({isDeadlock:!0,hasListeners:!1})},k8=async({wrappedMessage:_,anyProcess:$,channel:q,isSubprocess:Z,ipcEmitter:Q})=>{if(_?.type!==$2||!$.connected)return _;let{id:X,message:J}=_,Y={id:X,type:v8,message:q2($,Q)};try{await Z2({anyProcess:$,channel:q,isSubprocess:Z,ipc:!0},Y)}catch(K){Q.emit("strict:error",K)}return J},I8=(_)=>{if(_?.type!==v8)return!1;let{id:$,message:q}=_;return _2[$]?.resolve({isDeadlock:!1,hasListeners:q}),!0},y8=async(_,$,q)=>{if(_?.type!==$2)return;let Z=r();_2[_.id]=Z;let Q=new AbortController;try{let{isDeadlock:X,hasListeners:J}=await Promise.race([Z,pX($,q,Q)]);if(X)U8(q);if(!J)F8(q)}finally{Q.abort(),delete _2[_.id]}},_2={},pX=async(_,$,{signal:q})=>{M0(_,1,q),await dX(_,"disconnect",{signal:q}),W8($)},$2="execa:ipc:request",v8="execa:ipc:response";var h8=(_,$,q)=>{if(!X1.has(_))X1.set(_,new Set);let Z=X1.get(_),Q=r(),X=q?$.id:void 0,J={onMessageSent:Q,id:X};return Z.add(J),{outgoingMessages:Z,outgoingMessage:J}},S8=({outgoingMessages:_,outgoingMessage:$})=>{_.delete($),$.onMessageSent.resolve()},O8=async(_,$,q)=>{while(!q2(_,$)&&X1.get(_)?.size>0){let Z=[...X1.get(_)];x8(Z,q),await Promise.all(Z.map(({onMessageSent:Q})=>Q))}},X1=new WeakMap,q2=(_,$)=>$.listenerCount("message")>lX(_),lX=(_)=>t.has(_)&&!q0(t.get(_).options.buffer,"ipc")?1:0;var Z2=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z},Q,{strict:X=!1}={})=>{return g0({methodName:"sendMessage",isSubprocess:q,ipc:Z,isConnected:_.connected}),iX({anyProcess:_,channel:$,methodName:"sendMessage",isSubprocess:q,message:Q,strict:X})},iX=async({anyProcess:_,channel:$,methodName:q,isSubprocess:Z,message:Q,strict:X})=>{let J=N8({anyProcess:_,channel:$,isSubprocess:Z,message:Q,strict:X}),Y=h8(_,J,X);try{await b6({anyProcess:_,methodName:q,isSubprocess:Z,wrappedMessage:J,message:Q})}catch(K){throw u0(_),K}finally{S8(Y)}},b6=async({anyProcess:_,methodName:$,isSubprocess:q,wrappedMessage:Z,message:Q})=>{let X=nX(_);try{await Promise.all([y8(Z,_,q),X(Z)])}catch(J){throw R8({error:J,methodName:$,isSubprocess:q}),D8({error:J,methodName:$,isSubprocess:q,message:Q}),J}},nX=(_)=>{if(S6.has(_))return S6.get(_);let $=aX(_.send.bind(_));return S6.set(_,$),$},S6=new WeakMap;var f8=(_,$)=>{return x6("cancelSignal",!1,_.connected),b6({anyProcess:_,methodName:"cancelSignal",isSubprocess:!1,wrappedMessage:{type:u8,message:$},message:$})},g8=async({anyProcess:_,channel:$,isSubprocess:q,ipc:Z})=>{return await rX({anyProcess:_,channel:$,isSubprocess:q,ipc:Z}),f6.signal},rX=async({anyProcess:_,channel:$,isSubprocess:q,ipc:Z})=>{if(b8)return;if(b8=!0,!Z){L8();return}if($===null){h6();return}V0(_,$,q),await oX.yield()},b8=!1,E8=(_)=>{if(_?.type!==u8)return!1;return f6.abort(_.message),!0},u8="execa:ipc:cancel",h6=()=>{f6.abort(z8())},f6=new AbortController;var m8=({gracefulCancel:_,cancelSignal:$,ipc:q,serialization:Z})=>{if(!_)return;if($===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!q)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(Z==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")},d8=({subprocess:_,cancelSignal:$,gracefulCancel:q,forceKillAfterDelay:Z,context:Q,controller:X})=>q?[tX({subprocess:_,cancelSignal:$,forceKillAfterDelay:Z,context:Q,controller:X})]:[],tX=async({subprocess:_,cancelSignal:$,forceKillAfterDelay:q,context:Z,controller:{signal:Q}})=>{await l1($,Q);let X=sX($);throw await f8(_,X),N6({kill:_.kill,forceKillAfterDelay:q,context:Z,controllerSignal:Q}),Z.terminationReason??="gracefulCancel",$.reason},sX=({reason:_})=>{if(!(_ instanceof DOMException))return _;let $=new Error(_.message);return Object.defineProperty($,"stack",{value:_.stack,enumerable:!1,configurable:!0,writable:!0}),$};import{setTimeout as eX}from"node:timers/promises";var c8=({timeout:_})=>{if(_!==void 0&&(!Number.isFinite(_)||_<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${_}\` (${typeof _})`)},p8=(_,$,q,Z)=>$===0||$===void 0?[]:[_J(_,$,q,Z)],_J=async(_,$,q,{signal:Z})=>{throw await eX($,void 0,{signal:Z}),q.terminationReason??="timeout",_.kill(),new o};import{execPath as $J,execArgv as qJ}from"node:process";import l8 from"node:path";var a8=({options:_})=>{if(_.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{..._,node:!0}}},i8=(_,$,{node:q=!1,nodePath:Z=$J,nodeOptions:Q=qJ.filter((K)=>!K.startsWith("--inspect")),cwd:X,execPath:J,...Y})=>{if(J!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let K=v0(Z,'The "nodePath" option'),H=l8.resolve(X,K),V={...Y,nodePath:H,node:q,cwd:X};if(!q)return[_,$,V];if(l8.basename(_,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[H,[...Q,_,...$],{ipc:!0,...V,shell:!1}]};import{serialize as ZJ}from"node:v8";var n8=({ipcInput:_,ipc:$,serialization:q})=>{if(_===void 0)return;if(!$)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");JJ[q](_)},QJ=(_)=>{try{ZJ(_)}catch($){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:$})}},XJ=(_)=>{try{JSON.stringify(_)}catch($){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:$})}},JJ={advanced:QJ,json:XJ},o8=async(_,$)=>{if($===void 0)return;await _.sendMessage($)};var t8=({encoding:_})=>{if(g6.has(_))return;let $=KJ(_);if($!==void 0)throw new TypeError(`Invalid option \`encoding: ${Q2(_)}\`.
|
|
30
|
+
Please rename it to ${Q2($)}.`);let q=[...g6].map((Z)=>Q2(Z)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Q2(_)}\`.
|
|
31
|
+
Please rename it to one of: ${q}.`)},YJ=new Set(["utf8","utf16le"]),S=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),g6=new Set([...YJ,...S]),KJ=(_)=>{if(_===null)return"buffer";if(typeof _!=="string")return;let $=_.toLowerCase();if($ in r8)return r8[$];if(g6.has($))return $},r8={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Q2=(_)=>typeof _==="string"?`"${_}"`:String(_);import{statSync as HJ}from"node:fs";import BJ from"node:path";import VJ from"node:process";var s8=(_=e8())=>{let $=v0(_,'The "cwd" option');return BJ.resolve($)},e8=()=>{try{return VJ.cwd()}catch(_){throw _.message=`The current directory does not exist.
|
|
32
|
+
${_.message}`,_}},__=(_,$)=>{if($===e8())return _;let q;try{q=HJ($)}catch(Z){return`The "cwd" option is invalid: ${$}.
|
|
33
33
|
${Z.message}
|
|
34
34
|
${_}`}if(!q.isDirectory())return`The "cwd" option is not a directory: ${$}.
|
|
35
|
-
${_}`;return _};var
|
|
36
|
-
`,
|
|
37
|
-
${
|
|
38
|
-
`)].map((
|
|
39
|
-
|
|
40
|
-
`);return{originalMessage:
|
|
41
|
-
`):L_(_),L_=(_)=>{if(typeof _==="string")return _;if(w(_))return M1(_);return""};var G2=({command:_,escapedCommand:$,stdio:q,all:Z,ipcOutput:Q,options:{cwd:X},startTime:J})=>D_({command:_,escapedCommand:$,cwd:X,durationMs:W6(J),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:q[1],stderr:q[2],all:Z,stdio:q,ipcOutput:Q,pipedFrom:[]}),c0=({error:_,command:$,escapedCommand:q,fileDescriptors:Z,options:Q,startTime:X,isSync:J})=>K1({error:_,command:$,escapedCommand:q,startTime:X,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:Z.length}),ipcOutput:[],options:Q,isSync:J}),K1=({error:_,command:$,escapedCommand:q,startTime:Z,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isMaxBuffer:Y,isForcefullyTerminated:K,exitCode:H,signal:B,stdio:V,all:F,ipcOutput:G,options:{timeoutDuration:W,timeout:L=W,forceKillAfterDelay:D,killSignal:z,cwd:j,maxBuffer:C},isSync:y})=>{let{exitCode:t,signal:J0,signalDescription:R0}=sJ(H,B),{originalMessage:E0,shortMessage:Y0,message:r2}=R_({stdio:V,all:F,ipcOutput:G,originalError:_,signal:J0,signalDescription:R0,exitCode:t,escapedCommand:q,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isMaxBuffer:Y,isForcefullyTerminated:K,forceKillAfterDelay:D,killSignal:z,maxBuffer:C,timeout:L,cwd:j}),s0=p4(_,r2,y);return Object.assign(s0,tJ({error:s0,command:$,escapedCommand:q,startTime:Z,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isMaxBuffer:Y,isForcefullyTerminated:K,exitCode:t,signal:J0,signalDescription:R0,stdio:V,all:F,ipcOutput:G,cwd:j,originalMessage:E0,shortMessage:Y0})),s0},tJ=({error:_,command:$,escapedCommand:q,startTime:Z,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isMaxBuffer:Y,isForcefullyTerminated:K,exitCode:H,signal:B,signalDescription:V,stdio:F,all:G,ipcOutput:W,cwd:L,originalMessage:D,shortMessage:z})=>D_({shortMessage:z,originalMessage:D,command:$,escapedCommand:q,cwd:L,durationMs:W6(Z),failed:!0,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isTerminated:B!==void 0,isMaxBuffer:Y,isForcefullyTerminated:K,exitCode:H,signal:B,signalDescription:V,code:_.cause?.code,stdout:F[1],stderr:F[2],all:G,stdio:F,ipcOutput:W,pipedFrom:[]}),D_=(_)=>Object.fromEntries(Object.entries(_).filter(([,$])=>$!==void 0)),sJ=(_,$)=>{let q=_===null?void 0:_,Z=$===null?void 0:$,Q=Z===void 0?void 0:d1($);return{exitCode:q,signal:Z,signalDescription:Q}};var j_=(_)=>Number.isFinite(_)?_:0;function eJ(_){return{days:Math.trunc(_/86400000),hours:Math.trunc(_/3600000%24),minutes:Math.trunc(_/60000%60),seconds:Math.trunc(_/1000%60),milliseconds:Math.trunc(_%1000),microseconds:Math.trunc(j_(_*1000)%1000),nanoseconds:Math.trunc(j_(_*1e6)%1000)}}function _9(_){return{days:_/86400000n,hours:_/3600000n%24n,minutes:_/60000n%60n,seconds:_/1000n%60n,milliseconds:_%1000n,microseconds:0n,nanoseconds:0n}}function m6(_){switch(typeof _){case"number":{if(Number.isFinite(_))return eJ(_);break}case"bigint":return _9(_)}throw new TypeError("Expected a finite number or bigint")}var $9=(_)=>_===0||_===0n,q9=(_,$)=>$===1||$===1n?_:`${_}s`,Z9=0.0000001,Q9=24n*60n*60n*1000n;function d6(_,$){let q=typeof _==="bigint";if(!q&&!Number.isFinite(_))throw new TypeError("Expected a finite number or bigint");$={...$};let Z=_<0?"-":"";if(_=_<0?-_:_,$.colonNotation)$.compact=!1,$.formatSubMilliseconds=!1,$.separateMilliseconds=!1,$.verbose=!1;if($.compact)$.unitCount=1,$.secondsDecimalDigits=0,$.millisecondsDecimalDigits=0;let Q=[],X=(B,V)=>{let F=Math.floor(B*10**V+Z9);return(Math.round(F)/10**V).toFixed(V)},J=(B,V,F,G)=>{if((Q.length===0||!$.colonNotation)&&$9(B)&&!($.colonNotation&&F==="m"))return;if(G??=String(B),$.colonNotation){let W=G.includes(".")?G.split(".")[0].length:G.length,L=Q.length>0?2:1;G="0".repeat(Math.max(0,L-W))+G}else G+=$.verbose?" "+q9(V,B):F;Q.push(G)},Y=m6(_),K=BigInt(Y.days);if($.hideYearAndDays)J(BigInt(K)*24n+BigInt(Y.hours),"hour","h");else{if($.hideYear)J(K,"day","d");else J(K/365n,"year","y"),J(K%365n,"day","d");J(Number(Y.hours),"hour","h")}if(J(Number(Y.minutes),"minute","m"),!$.hideSeconds)if($.separateMilliseconds||$.formatSubMilliseconds||!$.colonNotation&&_<1000&&!$.subSecondsAsDecimals){let B=Number(Y.seconds),V=Number(Y.milliseconds),F=Number(Y.microseconds),G=Number(Y.nanoseconds);if(J(B,"second","s"),$.formatSubMilliseconds)J(V,"millisecond","ms"),J(F,"microsecond","µs"),J(G,"nanosecond","ns");else{let W=V+F/1000+G/1e6,L=typeof $.millisecondsDecimalDigits==="number"?$.millisecondsDecimalDigits:0,D=W>=1?Math.round(W):Math.ceil(W),z=L?W.toFixed(L):D;J(Number.parseFloat(z),"millisecond","ms",z)}}else{let B=(q?Number(_%Q9):_)/1000%60,V=typeof $.secondsDecimalDigits==="number"?$.secondsDecimalDigits:1,F=X(B,V),G=$.keepDecimalsOnWholeSeconds?F:F.replace(/\.0+$/,"");J(Number.parseFloat(G),"second","s",G)}if(Q.length===0)return Z+"0"+($.verbose?" milliseconds":"ms");let H=$.colonNotation?":":" ";if(typeof $.unitCount==="number")Q=Q.slice(0,Math.max($.unitCount,1));return Z+Q.join(H)}var k_=(_,$)=>{if(_.failed)c({type:"error",verboseMessage:_.shortMessage,verboseInfo:$,result:_})};var A_=(_,$)=>{if(!v0($))return;k_(_,$),X9(_,$)},X9=(_,$)=>{let q=`(done in ${d6(_.durationMs)})`;c({type:"duration",verboseMessage:q,verboseInfo:$,result:_})};var l0=(_,$,{reject:q})=>{if(A_(_,$),_.failed&&q)throw _;return _};import{readFileSync as o_}from"node:fs";var C_=(_,$)=>{if(P0(_))return"asyncGenerator";if(I_(_))return"generator";if(F2(_))return"fileUrl";if(B9(_))return"filePath";if(G9(_))return"webStream";if(m(_,{checkOpen:!1}))return"native";if(w(_))return"uint8Array";if(F9(_))return"asyncIterable";if(W9(_))return"iterable";if(p6(_))return w_({transform:_},$);if(H9(_))return J9(_,$);return"native"},J9=(_,$)=>{if(f6(_.transform,{checkOpen:!1}))return Y9(_,$);if(p6(_.transform))return w_(_,$);return K9(_,$)},Y9=(_,$)=>{return T_(_,$,"Duplex stream"),"duplex"},w_=(_,$)=>{return T_(_,$,"web TransformStream"),"webTransform"},T_=({final:_,binary:$,objectMode:q},Z,Q)=>{P_(_,`${Z}.final`,Q),P_($,`${Z}.binary`,Q),c6(q,`${Z}.objectMode`)},P_=(_,$,q)=>{if(_!==void 0)throw new TypeError(`The \`${$}\` option can only be defined when using a generator, not a ${q}.`)},K9=({transform:_,final:$,binary:q,objectMode:Z},Q)=>{if(_!==void 0&&!M_(_))throw new TypeError(`The \`${Q}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(f6($,{checkOpen:!1}))throw new TypeError(`The \`${Q}.final\` option must not be a Duplex stream.`);if(p6($))throw new TypeError(`The \`${Q}.final\` option must not be a web TransformStream.`);if($!==void 0&&!M_($))throw new TypeError(`The \`${Q}.final\` option must be a generator.`);return c6(q,`${Q}.binary`),c6(Z,`${Q}.objectMode`),P0(_)||P0($)?"asyncGenerator":"generator"},c6=(_,$)=>{if(_!==void 0&&typeof _!=="boolean")throw new TypeError(`The \`${$}\` option must use a boolean.`)},M_=(_)=>P0(_)||I_(_),P0=(_)=>Object.prototype.toString.call(_)==="[object AsyncGeneratorFunction]",I_=(_)=>Object.prototype.toString.call(_)==="[object GeneratorFunction]",H9=(_)=>M(_)&&(_.transform!==void 0||_.final!==void 0),F2=(_)=>Object.prototype.toString.call(_)==="[object URL]",O_=(_)=>F2(_)&&_.protocol!=="file:",B9=(_)=>M(_)&&Object.keys(_).length>0&&Object.keys(_).every(($)=>U9.has($))&&l6(_.file),U9=new Set(["file","append"]),l6=(_)=>typeof _==="string",E_=(_,$)=>_==="native"&&typeof $==="string"&&!V9.has($),V9=new Set(["ipc","ignore","inherit","overlapped","pipe"]),x_=(_)=>Object.prototype.toString.call(_)==="[object ReadableStream]",W2=(_)=>Object.prototype.toString.call(_)==="[object WritableStream]",G9=(_)=>x_(_)||W2(_),p6=(_)=>x_(_?.readable)&&W2(_?.writable),F9=(_)=>N_(_)&&typeof _[Symbol.asyncIterator]==="function",W9=(_)=>N_(_)&&typeof _[Symbol.iterator]==="function",N_=(_)=>typeof _==="object"&&_!==null,b=new Set(["generator","asyncGenerator","duplex","webTransform"]),z2=new Set(["fileUrl","filePath","fileNumber"]),a6=new Set(["fileUrl","filePath"]),y_=new Set([...a6,"webStream","nodeStream"]),v_=new Set(["webTransform","duplex"]),B0={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var i6=(_,$,q,Z)=>Z==="output"?z9(_,$,q):L9(_,$,q),z9=(_,$,q)=>{let Z=$!==0&&q[$-1].value.readableObjectMode;return{writableObjectMode:Z,readableObjectMode:_??Z}},L9=(_,$,q)=>{let Z=$===0?_===!0:q[$-1].value.readableObjectMode,Q=$!==q.length-1&&(_??Z);return{writableObjectMode:Z,readableObjectMode:Q}},h_=(_,$)=>{let q=_.findLast(({type:Z})=>b.has(Z));if(q===void 0)return!1;return $==="input"?q.value.writableObjectMode:q.value.readableObjectMode};var S_=(_,$,q,Z)=>[..._.filter(({type:Q})=>!b.has(Q)),...R9(_,$,q,Z)],R9=(_,$,q,{encoding:Z})=>{let Q=_.filter(({type:J})=>b.has(J)),X=Array.from({length:Q.length});for(let[J,Y]of Object.entries(Q))X[J]=D9({stdioItem:Y,index:Number(J),newTransforms:X,optionName:$,direction:q,encoding:Z});return P9(X,q)},D9=({stdioItem:_,stdioItem:{type:$},index:q,newTransforms:Z,optionName:Q,direction:X,encoding:J})=>{if($==="duplex")return j9({stdioItem:_,optionName:Q});if($==="webTransform")return k9({stdioItem:_,index:q,newTransforms:Z,direction:X});return A9({stdioItem:_,index:q,newTransforms:Z,direction:X,encoding:J})},j9=({stdioItem:_,stdioItem:{value:{transform:$,transform:{writableObjectMode:q,readableObjectMode:Z},objectMode:Q=Z}},optionName:X})=>{if(Q&&!Z)throw new TypeError(`The \`${X}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!Q&&Z)throw new TypeError(`The \`${X}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{..._,value:{transform:$,writableObjectMode:q,readableObjectMode:Z}}},k9=({stdioItem:_,stdioItem:{value:$},index:q,newTransforms:Z,direction:Q})=>{let{transform:X,objectMode:J}=M($)?$:{transform:$},{writableObjectMode:Y,readableObjectMode:K}=i6(J,q,Z,Q);return{..._,value:{transform:X,writableObjectMode:Y,readableObjectMode:K}}},A9=({stdioItem:_,stdioItem:{value:$},index:q,newTransforms:Z,direction:Q,encoding:X})=>{let{transform:J,final:Y,binary:K=!1,preserveNewlines:H=!1,objectMode:B}=M($)?$:{transform:$},V=K||N.has(X),{writableObjectMode:F,readableObjectMode:G}=i6(B,q,Z,Q);return{..._,value:{transform:J,final:Y,binary:V,preserveNewlines:H,writableObjectMode:F,readableObjectMode:G}}},P9=(_,$)=>$==="input"?_.reverse():_;import n6 from"node:process";var b_=(_,$,q)=>{let Z=_.map((Q)=>M9(Q,$));if(Z.includes("input")&&Z.includes("output"))throw new TypeError(`The \`${q}\` option must not be an array of both readable and writable values.`);return Z.find(Boolean)??T9},M9=({type:_,value:$},q)=>C9[q]??f_[_]($),C9=["input","output","output"],p0=()=>{return},o6=()=>"input",f_={generator:p0,asyncGenerator:p0,fileUrl:p0,filePath:p0,iterable:o6,asyncIterable:o6,uint8Array:o6,webStream:(_)=>W2(_)?"output":"input",nodeStream(_){if(!A0(_,{checkOpen:!1}))return"output";return b6(_,{checkOpen:!1})?void 0:"input"},webTransform:p0,duplex:p0,native(_){let $=w9(_);if($!==void 0)return $;if(m(_,{checkOpen:!1}))return f_.nodeStream(_)}},w9=(_)=>{if([0,n6.stdin].includes(_))return"input";if([1,2,n6.stdout,n6.stderr].includes(_))return"output"},T9="output";var g_=(_,$)=>$&&!_.includes("ipc")?[..._,"ipc"]:_;var u_=({stdio:_,ipc:$,buffer:q,...Z},Q,X)=>{let J=I9(_,Z).map((Y,K)=>m_(Y,K));return X?E9(J,q,Q):g_(J,$)},I9=(_,$)=>{if(_===void 0)return S.map((Z)=>$[Z]);if(O9($))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${S.map((Z)=>`\`${Z}\``).join(", ")}`);if(typeof _==="string")return[_,_,_];if(!Array.isArray(_))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof _}\``);let q=Math.max(_.length,S.length);return Array.from({length:q},(Z,Q)=>_[Q])},O9=(_)=>S.some(($)=>_[$]!==void 0),m_=(_,$)=>{if(Array.isArray(_))return _.map((q)=>m_(q,$));if(_===null||_===void 0)return $>=S.length?"ignore":"pipe";return _},E9=(_,$,q)=>_.map((Z,Q)=>!$[Q]&&Q!==0&&!h0(q,Q)&&x9(Z)?"ignore":Z),x9=(_)=>_==="pipe"||Array.isArray(_)&&_.every(($)=>$==="pipe");import{readFileSync as N9}from"node:fs";import y9 from"node:tty";var c_=({stdioItem:_,stdioItem:{type:$},isStdioArray:q,fdNumber:Z,direction:Q,isSync:X})=>{if(!q||$!=="native")return _;return X?v9({stdioItem:_,fdNumber:Z,direction:Q}):b9({stdioItem:_,fdNumber:Z})},v9=({stdioItem:_,stdioItem:{value:$,optionName:q},fdNumber:Z,direction:Q})=>{let X=h9({value:$,optionName:q,fdNumber:Z,direction:Q});if(X!==void 0)return X;if(m($,{checkOpen:!1}))throw new TypeError(`The \`${q}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return _},h9=({value:_,optionName:$,fdNumber:q,direction:Z})=>{let Q=S9(_,q);if(Q===void 0)return;if(Z==="output")return{type:"fileNumber",value:Q,optionName:$};if(y9.isatty(Q))throw new TypeError(`The \`${$}: ${p1(_)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:s(N9(Q)),optionName:$}},S9=(_,$)=>{if(_==="inherit")return $;if(typeof _==="number")return _;let q=C1.indexOf(_);if(q!==-1)return q},b9=({stdioItem:_,stdioItem:{value:$,optionName:q},fdNumber:Z})=>{if($==="inherit")return{type:"nodeStream",value:d_(Z,$,q),optionName:q};if(typeof $==="number")return{type:"nodeStream",value:d_($,$,q),optionName:q};if(m($,{checkOpen:!1}))return{type:"nodeStream",value:$,optionName:q};return _},d_=(_,$,q)=>{let Z=C1[_];if(Z===void 0)throw new TypeError(`The \`${q}: ${$}\` option is invalid: no such standard stream.`);return Z};var l_=({input:_,inputFile:$},q)=>q===0?[...f9(_),...u9($)]:[],f9=(_)=>_===void 0?[]:[{type:g9(_),value:_,optionName:"input"}],g9=(_)=>{if(A0(_,{checkOpen:!1}))return"nodeStream";if(typeof _==="string")return"string";if(w(_))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},u9=(_)=>_===void 0?[]:[{...m9(_),optionName:"inputFile"}],m9=(_)=>{if(F2(_))return{type:"fileUrl",value:_};if(l6(_))return{type:"filePath",value:{file:_}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};var p_=(_)=>_.filter(($,q)=>_.every((Z,Q)=>$.value!==Z.value||q>=Q||$.type==="generator"||$.type==="asyncGenerator")),a_=({stdioItem:{type:_,value:$,optionName:q},direction:Z,fileDescriptors:Q,isSync:X})=>{let J=d9(Q,_);if(J.length===0)return;if(X){c9({otherStdioItems:J,type:_,value:$,optionName:q,direction:Z});return}if(y_.has(_))return i_({otherStdioItems:J,type:_,value:$,optionName:q,direction:Z});if(v_.has(_))p9({otherStdioItems:J,type:_,value:$,optionName:q})},d9=(_,$)=>_.flatMap(({direction:q,stdioItems:Z})=>Z.filter((Q)=>Q.type===$).map((Q)=>({...Q,direction:q}))),c9=({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})=>{if(a6.has($))i_({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})},i_=({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})=>{let X=_.filter((Y)=>l9(Y,q));if(X.length===0)return;let J=X.find((Y)=>Y.direction!==Q);return n_(J,Z,$),Q==="output"?X[0].stream:void 0},l9=({type:_,value:$},q)=>{if(_==="filePath")return $.file===q.file;if(_==="fileUrl")return $.href===q.href;return $===q},p9=({otherStdioItems:_,type:$,value:q,optionName:Z})=>{let Q=_.find(({value:{transform:X}})=>X===q.transform);n_(Q,Z,$)},n_=(_,$,q)=>{if(_!==void 0)throw new TypeError(`The \`${_.optionName}\` and \`${$}\` options must not target ${B0[q]} that is the same.`)};var L2=(_,$,q,Z)=>{let X=u_($,q,Z).map((Y,K)=>a9({stdioOption:Y,fdNumber:K,options:$,isSync:Z})),J=_Y({initialFileDescriptors:X,addProperties:_,options:$,isSync:Z});return $.stdio=J.map(({stdioItems:Y})=>ZY(Y)),J},a9=({stdioOption:_,fdNumber:$,options:q,isSync:Z})=>{let Q=w1($),{stdioItems:X,isStdioArray:J}=i9({stdioOption:_,fdNumber:$,options:q,optionName:Q}),Y=b_(X,$,Q),K=X.map((V)=>c_({stdioItem:V,isStdioArray:J,fdNumber:$,direction:Y,isSync:Z})),H=S_(K,Q,Y,q),B=h_(H,Y);return e9(H,B),{direction:Y,objectMode:B,stdioItems:H}},i9=({stdioOption:_,fdNumber:$,options:q,optionName:Z})=>{let X=[...(Array.isArray(_)?_:[_]).map((K)=>n9(K,Z)),...l_(q,$)],J=p_(X),Y=J.length>1;return o9(J,Y,Z),t9(J),{stdioItems:J,isStdioArray:Y}},n9=(_,$)=>({type:C_(_,$),value:_,optionName:$}),o9=(_,$,q)=>{if(_.length===0)throw new TypeError(`The \`${q}\` option must not be an empty array.`);if(!$)return;for(let{value:Z,optionName:Q}of _)if(r9.has(Z))throw new Error(`The \`${Q}\` option must not include \`${Z}\`.`)},r9=new Set(["ignore","ipc"]),t9=(_)=>{for(let $ of _)s9($)},s9=({type:_,value:$,optionName:q})=>{if(O_($))throw new TypeError(`The \`${q}: URL\` option must use the \`file:\` scheme.
|
|
42
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(
|
|
43
|
-
`){let J=
|
|
35
|
+
${_}`;return _};var X2=(_,$,q)=>{q.cwd=s8(q.cwd);let[Z,Q,X]=i8(_,$,q),{command:J,args:Y,options:K}=q_.default._parse(Z,Q,X),H=f5(K),V=UJ(H);if(c8(V),t8(V),n8(V),B8(V),m8(V),V.shell=V6(V.shell),V.env=FJ(V),V.killSignal=X8(V.killSignal),V.forceKillAfterDelay=K8(V.forceKillAfterDelay),V.lines=V.lines.map((G,U)=>G&&!S.has(V.encoding)&&V.buffer[U]),$_.platform==="win32"&&GJ.basename(J,".exe")==="cmd")Y.unshift("/q");return{file:J,commandArguments:Y,options:V}},UJ=({extendEnv:_=!0,preferLocal:$=!1,cwd:q,localDir:Z=q,encoding:Q="utf8",reject:X=!0,cleanup:J=!0,all:Y=!1,windowsHide:K=!0,killSignal:H="SIGTERM",forceKillAfterDelay:V=!0,gracefulCancel:G=!1,ipcInput:U,ipc:F=U!==void 0||G,serialization:W="advanced",...L})=>({...L,extendEnv:_,preferLocal:$,cwd:q,localDirectory:Z,encoding:Q,reject:X,cleanup:J,all:Y,windowsHide:K,killSignal:H,forceKillAfterDelay:V,gracefulCancel:G,ipcInput:U,ipc:F,serialization:W}),FJ=({env:_,extendEnv:$,preferLocal:q,node:Z,localDirectory:Q,nodePath:X})=>{let J=$?{...$_.env,..._}:_;if(q||Z)return o4({env:J,cwd:Q,execPath:X,preferLocal:q,addExecPath:Z});return J};var J2=(_,$,q)=>q.shell&&$.length>0?[[_,...$].join(" "),[],q]:[_,$,q];import{inspect as nJ}from"node:util";function d0(_){if(typeof _==="string")return WJ(_);if(!(ArrayBuffer.isView(_)&&_.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return zJ(_)}var WJ=(_)=>_.at(-1)===Z_?_.slice(0,_.at(-2)===Q_?-2:-1):_,zJ=(_)=>_.at(-1)===LJ?_.subarray(0,_.at(-2)===RJ?-2:-1):_,Z_=`
|
|
36
|
+
`,LJ=Z_.codePointAt(0),Q_="\r",RJ=Q_.codePointAt(0);import{on as pJ}from"node:events";import{finished as lJ}from"node:stream/promises";function a(_,{checkOpen:$=!0}={}){return _!==null&&typeof _==="object"&&(_.writable||_.readable||!$||_.writable===void 0&&_.readable===void 0)&&typeof _.pipe==="function"}function u6(_,{checkOpen:$=!0}={}){return a(_,{checkOpen:$})&&(_.writable||!$)&&typeof _.write==="function"&&typeof _.end==="function"&&typeof _.writable==="boolean"&&typeof _.writableObjectMode==="boolean"&&typeof _.destroy==="function"&&typeof _.destroyed==="boolean"}function P0(_,{checkOpen:$=!0}={}){return a(_,{checkOpen:$})&&(_.readable||!$)&&typeof _.read==="function"&&typeof _.readable==="boolean"&&typeof _.readableObjectMode==="boolean"&&typeof _.destroy==="function"&&typeof _.destroyed==="boolean"}function m6(_,$){return u6(_,$)&&P0(_,$)}var DJ=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class X_{#Z;#$;#_=!1;#q=void 0;constructor(_,$){this.#Z=_,this.#$=$}next(){let _=()=>this.#Y();return this.#q=this.#q?this.#q.then(_,_):_(),this.#q}return(_){let $=()=>this.#J(_);return this.#q?this.#q.then($,$):$()}async#Y(){if(this.#_)return{done:!0,value:void 0};let _;try{_=await this.#Z.read()}catch($){throw this.#q=void 0,this.#_=!0,this.#Z.releaseLock(),$}return _.done&&(this.#q=void 0,this.#_=!0,this.#Z.releaseLock()),_}async#J(_){if(this.#_)return{done:!0,value:_};if(this.#_=!0,!this.#$){let $=this.#Z.cancel(_);return this.#Z.releaseLock(),await $,{done:!0,value:_}}return this.#Z.releaseLock(),{done:!0,value:_}}}var d6=Symbol();function J_(){return this[d6].next()}Object.defineProperty(J_,"name",{value:"next"});function Y_(_){return this[d6].return(_)}Object.defineProperty(Y_,"name",{value:"return"});var jJ=Object.create(DJ,{next:{enumerable:!0,configurable:!0,writable:!0,value:J_},return:{enumerable:!0,configurable:!0,writable:!0,value:Y_}});function c6({preventCancel:_=!1}={}){let $=this.getReader(),q=new X_($,_),Z=Object.create(jJ);return Z[d6]=q,Z}var K_=(_)=>{if(P0(_,{checkOpen:!1})&&J1.on!==void 0)return MJ(_);if(typeof _?.[Symbol.asyncIterator]==="function")return _;if(AJ.call(_)==="[object ReadableStream]")return c6.call(_);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:AJ}=Object.prototype,MJ=async function*(_){let $=new AbortController,q={};PJ(_,$,q);try{for await(let[Z]of J1.on(_,"data",{signal:$.signal}))yield Z}catch(Z){if(q.error!==void 0)throw q.error;else if(!$.signal.aborted)throw Z}finally{_.destroy()}},PJ=async(_,$,q)=>{try{await J1.finished(_,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(Z){q.error=Z}finally{$.abort()}},J1={};var c0=async(_,{init:$,convertChunk:q,getSize:Z,truncateChunk:Q,addChunk:X,getFinalChunk:J,finalize:Y},{maxBuffer:K=Number.POSITIVE_INFINITY}={})=>{let H=K_(_),V=$();V.length=0;try{for await(let G of H){let U=CJ(G),F=q[U](G,V);V_({convertedChunk:F,state:V,getSize:Z,truncateChunk:Q,addChunk:X,maxBuffer:K})}return wJ({state:V,convertChunk:q,getSize:Z,truncateChunk:Q,addChunk:X,getFinalChunk:J,maxBuffer:K}),Y(V)}catch(G){let U=typeof G==="object"&&G!==null?G:new Error(G);throw U.bufferedData=Y(V),U}},wJ=({state:_,getSize:$,truncateChunk:q,addChunk:Z,getFinalChunk:Q,maxBuffer:X})=>{let J=Q(_);if(J!==void 0)V_({convertedChunk:J,state:_,getSize:$,truncateChunk:q,addChunk:Z,maxBuffer:X})},V_=({convertedChunk:_,state:$,getSize:q,truncateChunk:Z,addChunk:Q,maxBuffer:X})=>{let J=q(_),Y=$.length+J;if(Y<=X){H_(_,$,Q,Y);return}let K=Z(_,X-$.length);if(K!==void 0)H_(K,$,Q,X);throw new Z0},H_=(_,$,q,Z)=>{$.contents=q(_,$,Z),$.length=Z},CJ=(_)=>{let $=typeof _;if($==="string")return"string";if($!=="object"||_===null)return"others";if(globalThis.Buffer?.isBuffer(_))return"buffer";let q=B_.call(_);if(q==="[object ArrayBuffer]")return"arrayBuffer";if(q==="[object DataView]")return"dataView";if(Number.isInteger(_.byteLength)&&Number.isInteger(_.byteOffset)&&B_.call(_.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},{toString:B_}=Object.prototype;class Z0 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}var Q0=(_)=>_,Y1=()=>{return},Y2=({contents:_})=>_,K2=(_)=>{throw new Error(`Streams in object mode are not supported: ${String(_)}`)},H2=(_)=>_.length;async function B2(_,$){return c0(_,OJ,$)}var TJ=()=>({contents:[]}),kJ=()=>1,IJ=(_,{contents:$})=>{return $.push(_),$},OJ={init:TJ,convertChunk:{string:Q0,buffer:Q0,arrayBuffer:Q0,dataView:Q0,typedArray:Q0,others:Q0},getSize:kJ,truncateChunk:Y1,addChunk:IJ,getFinalChunk:Y1,finalize:Y2};async function V2(_,$){return c0(_,fJ,$)}var EJ=()=>({contents:new ArrayBuffer(0)}),NJ=(_)=>xJ.encode(_),xJ=new TextEncoder,G_=(_)=>new Uint8Array(_),U_=(_)=>new Uint8Array(_.buffer,_.byteOffset,_.byteLength),yJ=(_,$)=>_.slice(0,$),vJ=(_,{contents:$,length:q},Z)=>{let Q=z_()?SJ($,Z):hJ($,Z);return new Uint8Array(Q).set(_,q),Q},hJ=(_,$)=>{if($<=_.byteLength)return _;let q=new ArrayBuffer(W_($));return new Uint8Array(q).set(new Uint8Array(_),0),q},SJ=(_,$)=>{if($<=_.maxByteLength)return _.resize($),_;let q=new ArrayBuffer($,{maxByteLength:W_($)});return new Uint8Array(q).set(new Uint8Array(_),0),q},W_=(_)=>F_**Math.ceil(Math.log(_)/Math.log(F_)),F_=2,bJ=({contents:_,length:$})=>z_()?_:_.slice(0,$),z_=()=>("resize"in ArrayBuffer.prototype),fJ={init:EJ,convertChunk:{string:NJ,buffer:G_,arrayBuffer:G_,dataView:U_,typedArray:U_,others:K2},getSize:H2,truncateChunk:yJ,addChunk:vJ,getFinalChunk:Y1,finalize:bJ};async function U2(_,$){return c0(_,cJ,$)}var gJ=()=>({contents:"",textDecoder:new TextDecoder}),G2=(_,{textDecoder:$})=>$.decode(_,{stream:!0}),uJ=(_,{contents:$})=>$+_,mJ=(_,$)=>_.slice(0,$),dJ=({textDecoder:_})=>{let $=_.decode();return $===""?void 0:$},cJ={init:gJ,convertChunk:{string:Q0,buffer:G2,arrayBuffer:G2,dataView:G2,typedArray:G2,others:K2},getSize:H2,truncateChunk:mJ,addChunk:uJ,getFinalChunk:dJ,finalize:Y2};Object.assign(J1,{on:pJ,finished:lJ});var L_=({error:_,stream:$,readableObjectMode:q,lines:Z,encoding:Q,fdNumber:X})=>{if(!(_ instanceof Z0))throw _;if(X==="all")return _;let J=aJ(q,Z,Q);throw _.maxBufferInfo={fdNumber:X,unit:J},$.destroy(),_},aJ=(_,$,q)=>{if(_)return"objects";if($)return"lines";if(q==="buffer")return"bytes";return"characters"},R_=(_,$,q)=>{if($.length!==q)return;let Z=new Z0;throw Z.maxBufferInfo={fdNumber:"ipc"},Z},D_=(_,$)=>{let{streamName:q,threshold:Z,unit:Q}=iJ(_,$);return`Command's ${q} was larger than ${Z} ${Q}`},iJ=(_,$)=>{if(_?.maxBufferInfo===void 0)return{streamName:"output",threshold:$[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:q,unit:Z}}=_;delete _.maxBufferInfo;let Q=q0($,q);if(q==="ipc")return{streamName:"IPC output",threshold:Q,unit:"messages"};return{streamName:I1(q),threshold:Q,unit:Z}},j_=(_,$,q)=>_?.code==="ENOBUFS"&&$!==null&&$.some((Z)=>Z!==null&&Z.length>F2(q)),A_=(_,$,q)=>{if(!$)return _;let Z=F2(q);return _.length>Z?_.slice(0,Z):_},F2=([,_])=>_;var P_=({stdio:_,all:$,ipcOutput:q,originalError:Z,signal:Q,signalDescription:X,exitCode:J,escapedCommand:Y,timedOut:K,isCanceled:H,isGracefullyCanceled:V,isMaxBuffer:G,isForcefullyTerminated:U,forceKillAfterDelay:F,killSignal:W,maxBuffer:L,timeout:A,cwd:z})=>{let D=Z?.code,j=oJ({originalError:Z,timedOut:K,timeout:A,isMaxBuffer:G,maxBuffer:L,errorCode:D,signal:Q,signalDescription:X,exitCode:J,isCanceled:H,isGracefullyCanceled:V,isForcefullyTerminated:U,forceKillAfterDelay:F,killSignal:W}),P=tJ(Z,z),R=P===void 0?"":`
|
|
37
|
+
${P}`,k=`${j}: ${Y}${R}`,y=$===void 0?[_[2],_[1]]:[$],i=[k,...y,..._.slice(3),q.map((H0)=>sJ(H0)).join(`
|
|
38
|
+
`)].map((H0)=>q1(d0(eJ(H0)))).filter(Boolean).join(`
|
|
39
|
+
|
|
40
|
+
`);return{originalMessage:P,shortMessage:k,message:i}},oJ=({originalError:_,timedOut:$,timeout:q,isMaxBuffer:Z,maxBuffer:Q,errorCode:X,signal:J,signalDescription:Y,exitCode:K,isCanceled:H,isGracefullyCanceled:V,isForcefullyTerminated:G,forceKillAfterDelay:U,killSignal:F})=>{let W=rJ(G,U);if($)return`Command timed out after ${q} milliseconds${W}`;if(V){if(J===void 0)return`Command was gracefully canceled with exit code ${K}`;return G?`Command was gracefully canceled${W}`:`Command was gracefully canceled with ${J} (${Y})`}if(H)return`Command was canceled${W}`;if(Z)return`${D_(_,Q)}${W}`;if(X!==void 0)return`Command failed with ${X}${W}`;if(G)return`Command was killed with ${F} (${p1(F)})${W}`;if(J!==void 0)return`Command was killed with ${J} (${Y})`;if(K!==void 0)return`Command failed with exit code ${K}`;return"Command failed"},rJ=(_,$)=>_?` and was forcefully terminated after ${$} milliseconds`:"",tJ=(_,$)=>{if(_ instanceof o)return;let q=s4(_)?_.originalMessage:String(_?.message??_),Z=q1(__(q,$));return Z===""?void 0:Z},sJ=(_)=>typeof _==="string"?_:nJ(_),eJ=(_)=>Array.isArray(_)?_.map(($)=>d0(M_($))).filter(Boolean).join(`
|
|
41
|
+
`):M_(_),M_=(_)=>{if(typeof _==="string")return _;if(O(_))return T1(_);return""};var W2=({command:_,escapedCommand:$,stdio:q,all:Z,ipcOutput:Q,options:{cwd:X},startTime:J})=>w_({command:_,escapedCommand:$,cwd:X,durationMs:R6(J),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:q[1],stderr:q[2],all:Z,stdio:q,ipcOutput:Q,pipedFrom:[]}),p0=({error:_,command:$,escapedCommand:q,fileDescriptors:Z,options:Q,startTime:X,isSync:J})=>K1({error:_,command:$,escapedCommand:q,startTime:X,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:Z.length}),ipcOutput:[],options:Q,isSync:J}),K1=({error:_,command:$,escapedCommand:q,startTime:Z,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isMaxBuffer:Y,isForcefullyTerminated:K,exitCode:H,signal:V,stdio:G,all:U,ipcOutput:F,options:{timeoutDuration:W,timeout:L=W,forceKillAfterDelay:A,killSignal:z,cwd:D,maxBuffer:j},isSync:P})=>{let{exitCode:R,signal:k,signalDescription:y}=$9(H,V),{originalMessage:i,shortMessage:H0,message:e2}=P_({stdio:G,all:U,ipcOutput:F,originalError:_,signal:k,signalDescription:y,exitCode:R,escapedCommand:q,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isMaxBuffer:Y,isForcefullyTerminated:K,forceKillAfterDelay:A,killSignal:z,maxBuffer:j,timeout:L,cwd:D}),s0=r4(_,e2,P);return Object.assign(s0,_9({error:s0,command:$,escapedCommand:q,startTime:Z,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isMaxBuffer:Y,isForcefullyTerminated:K,exitCode:R,signal:k,signalDescription:y,stdio:G,all:U,ipcOutput:F,cwd:D,originalMessage:i,shortMessage:H0})),s0},_9=({error:_,command:$,escapedCommand:q,startTime:Z,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isMaxBuffer:Y,isForcefullyTerminated:K,exitCode:H,signal:V,signalDescription:G,stdio:U,all:F,ipcOutput:W,cwd:L,originalMessage:A,shortMessage:z})=>w_({shortMessage:z,originalMessage:A,command:$,escapedCommand:q,cwd:L,durationMs:R6(Z),failed:!0,timedOut:Q,isCanceled:X,isGracefullyCanceled:J,isTerminated:V!==void 0,isMaxBuffer:Y,isForcefullyTerminated:K,exitCode:H,signal:V,signalDescription:G,code:_.cause?.code,stdout:U[1],stderr:U[2],all:F,stdio:U,ipcOutput:W,pipedFrom:[]}),w_=(_)=>Object.fromEntries(Object.entries(_).filter(([,$])=>$!==void 0)),$9=(_,$)=>{let q=_===null?void 0:_,Z=$===null?void 0:$,Q=Z===void 0?void 0:p1($);return{exitCode:q,signal:Z,signalDescription:Q}};var C_=(_)=>Number.isFinite(_)?_:0;function q9(_){return{days:Math.trunc(_/86400000),hours:Math.trunc(_/3600000%24),minutes:Math.trunc(_/60000%60),seconds:Math.trunc(_/1000%60),milliseconds:Math.trunc(_%1000),microseconds:Math.trunc(C_(_*1000)%1000),nanoseconds:Math.trunc(C_(_*1e6)%1000)}}function Z9(_){return{days:_/86400000n,hours:_/3600000n%24n,minutes:_/60000n%60n,seconds:_/1000n%60n,milliseconds:_%1000n,microseconds:0n,nanoseconds:0n}}function p6(_){switch(typeof _){case"number":{if(Number.isFinite(_))return q9(_);break}case"bigint":return Z9(_)}throw new TypeError("Expected a finite number or bigint")}var Q9=(_)=>_===0||_===0n,X9=(_,$)=>$===1||$===1n?_:`${_}s`,J9=0.0000001,Y9=24n*60n*60n*1000n;function l6(_,$){let q=typeof _==="bigint";if(!q&&!Number.isFinite(_))throw new TypeError("Expected a finite number or bigint");$={...$};let Z=_<0?"-":"";if(_=_<0?-_:_,$.colonNotation)$.compact=!1,$.formatSubMilliseconds=!1,$.separateMilliseconds=!1,$.verbose=!1;if($.compact)$.unitCount=1,$.secondsDecimalDigits=0,$.millisecondsDecimalDigits=0;let Q=[],X=(V,G)=>{let U=Math.floor(V*10**G+J9);return(Math.round(U)/10**G).toFixed(G)},J=(V,G,U,F)=>{if((Q.length===0||!$.colonNotation)&&Q9(V)&&!($.colonNotation&&U==="m"))return;if(F??=String(V),$.colonNotation){let W=F.includes(".")?F.split(".")[0].length:F.length,L=Q.length>0?2:1;F="0".repeat(Math.max(0,L-W))+F}else F+=$.verbose?" "+X9(G,V):U;Q.push(F)},Y=p6(_),K=BigInt(Y.days);if($.hideYearAndDays)J(BigInt(K)*24n+BigInt(Y.hours),"hour","h");else{if($.hideYear)J(K,"day","d");else J(K/365n,"year","y"),J(K%365n,"day","d");J(Number(Y.hours),"hour","h")}if(J(Number(Y.minutes),"minute","m"),!$.hideSeconds)if($.separateMilliseconds||$.formatSubMilliseconds||!$.colonNotation&&_<1000&&!$.subSecondsAsDecimals){let V=Number(Y.seconds),G=Number(Y.milliseconds),U=Number(Y.microseconds),F=Number(Y.nanoseconds);if(J(V,"second","s"),$.formatSubMilliseconds)J(G,"millisecond","ms"),J(U,"microsecond","µs"),J(F,"nanosecond","ns");else{let W=G+U/1000+F/1e6,L=typeof $.millisecondsDecimalDigits==="number"?$.millisecondsDecimalDigits:0,A=W>=1?Math.round(W):Math.ceil(W),z=L?W.toFixed(L):A;J(Number.parseFloat(z),"millisecond","ms",z)}}else{let V=(q?Number(_%Y9):_)/1000%60,G=typeof $.secondsDecimalDigits==="number"?$.secondsDecimalDigits:1,U=X(V,G),F=$.keepDecimalsOnWholeSeconds?U:U.replace(/\.0+$/,"");J(Number.parseFloat(F),"second","s",F)}if(Q.length===0)return Z+"0"+($.verbose?" milliseconds":"ms");let H=$.colonNotation?":":" ";if(typeof $.unitCount==="number")Q=Q.slice(0,Math.max($.unitCount,1));return Z+Q.join(H)}var T_=(_,$)=>{if(_.failed)n({type:"error",verboseMessage:_.shortMessage,verboseInfo:$,result:_})};var k_=(_,$)=>{if(!h0($))return;T_(_,$),K9(_,$)},K9=(_,$)=>{let q=`(done in ${l6(_.durationMs)})`;n({type:"duration",verboseMessage:q,verboseInfo:$,result:_})};var l0=(_,$,{reject:q})=>{if(k_(_,$),_.failed&&q)throw _;return _};import{readFileSync as _7}from"node:fs";var E_=(_,$)=>{if(w0(_))return"asyncGenerator";if(y_(_))return"generator";if(z2(_))return"fileUrl";if(U9(_))return"filePath";if(z9(_))return"webStream";if(a(_,{checkOpen:!1}))return"native";if(O(_))return"uint8Array";if(L9(_))return"asyncIterable";if(R9(_))return"iterable";if(n6(_))return N_({transform:_},$);if(G9(_))return H9(_,$);return"native"},H9=(_,$)=>{if(m6(_.transform,{checkOpen:!1}))return B9(_,$);if(n6(_.transform))return N_(_,$);return V9(_,$)},B9=(_,$)=>{return x_(_,$,"Duplex stream"),"duplex"},N_=(_,$)=>{return x_(_,$,"web TransformStream"),"webTransform"},x_=({final:_,binary:$,objectMode:q},Z,Q)=>{I_(_,`${Z}.final`,Q),I_($,`${Z}.binary`,Q),a6(q,`${Z}.objectMode`)},I_=(_,$,q)=>{if(_!==void 0)throw new TypeError(`The \`${$}\` option can only be defined when using a generator, not a ${q}.`)},V9=({transform:_,final:$,binary:q,objectMode:Z},Q)=>{if(_!==void 0&&!O_(_))throw new TypeError(`The \`${Q}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(m6($,{checkOpen:!1}))throw new TypeError(`The \`${Q}.final\` option must not be a Duplex stream.`);if(n6($))throw new TypeError(`The \`${Q}.final\` option must not be a web TransformStream.`);if($!==void 0&&!O_($))throw new TypeError(`The \`${Q}.final\` option must be a generator.`);return a6(q,`${Q}.binary`),a6(Z,`${Q}.objectMode`),w0(_)||w0($)?"asyncGenerator":"generator"},a6=(_,$)=>{if(_!==void 0&&typeof _!=="boolean")throw new TypeError(`The \`${$}\` option must use a boolean.`)},O_=(_)=>w0(_)||y_(_),w0=(_)=>Object.prototype.toString.call(_)==="[object AsyncGeneratorFunction]",y_=(_)=>Object.prototype.toString.call(_)==="[object GeneratorFunction]",G9=(_)=>I(_)&&(_.transform!==void 0||_.final!==void 0),z2=(_)=>Object.prototype.toString.call(_)==="[object URL]",v_=(_)=>z2(_)&&_.protocol!=="file:",U9=(_)=>I(_)&&Object.keys(_).length>0&&Object.keys(_).every(($)=>F9.has($))&&i6(_.file),F9=new Set(["file","append"]),i6=(_)=>typeof _==="string",h_=(_,$)=>_==="native"&&typeof $==="string"&&!W9.has($),W9=new Set(["ipc","ignore","inherit","overlapped","pipe"]),S_=(_)=>Object.prototype.toString.call(_)==="[object ReadableStream]",L2=(_)=>Object.prototype.toString.call(_)==="[object WritableStream]",z9=(_)=>S_(_)||L2(_),n6=(_)=>S_(_?.readable)&&L2(_?.writable),L9=(_)=>b_(_)&&typeof _[Symbol.asyncIterator]==="function",R9=(_)=>b_(_)&&typeof _[Symbol.iterator]==="function",b_=(_)=>typeof _==="object"&&_!==null,u=new Set(["generator","asyncGenerator","duplex","webTransform"]),R2=new Set(["fileUrl","filePath","fileNumber"]),o6=new Set(["fileUrl","filePath"]),f_=new Set([...o6,"webStream","nodeStream"]),g_=new Set(["webTransform","duplex"]),G0={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var r6=(_,$,q,Z)=>Z==="output"?D9(_,$,q):j9(_,$,q),D9=(_,$,q)=>{let Z=$!==0&&q[$-1].value.readableObjectMode;return{writableObjectMode:Z,readableObjectMode:_??Z}},j9=(_,$,q)=>{let Z=$===0?_===!0:q[$-1].value.readableObjectMode,Q=$!==q.length-1&&(_??Z);return{writableObjectMode:Z,readableObjectMode:Q}},u_=(_,$)=>{let q=_.findLast(({type:Z})=>u.has(Z));if(q===void 0)return!1;return $==="input"?q.value.writableObjectMode:q.value.readableObjectMode};var m_=(_,$,q,Z)=>[..._.filter(({type:Q})=>!u.has(Q)),...A9(_,$,q,Z)],A9=(_,$,q,{encoding:Z})=>{let Q=_.filter(({type:J})=>u.has(J)),X=Array.from({length:Q.length});for(let[J,Y]of Object.entries(Q))X[J]=M9({stdioItem:Y,index:Number(J),newTransforms:X,optionName:$,direction:q,encoding:Z});return T9(X,q)},M9=({stdioItem:_,stdioItem:{type:$},index:q,newTransforms:Z,optionName:Q,direction:X,encoding:J})=>{if($==="duplex")return P9({stdioItem:_,optionName:Q});if($==="webTransform")return w9({stdioItem:_,index:q,newTransforms:Z,direction:X});return C9({stdioItem:_,index:q,newTransforms:Z,direction:X,encoding:J})},P9=({stdioItem:_,stdioItem:{value:{transform:$,transform:{writableObjectMode:q,readableObjectMode:Z},objectMode:Q=Z}},optionName:X})=>{if(Q&&!Z)throw new TypeError(`The \`${X}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!Q&&Z)throw new TypeError(`The \`${X}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{..._,value:{transform:$,writableObjectMode:q,readableObjectMode:Z}}},w9=({stdioItem:_,stdioItem:{value:$},index:q,newTransforms:Z,direction:Q})=>{let{transform:X,objectMode:J}=I($)?$:{transform:$},{writableObjectMode:Y,readableObjectMode:K}=r6(J,q,Z,Q);return{..._,value:{transform:X,writableObjectMode:Y,readableObjectMode:K}}},C9=({stdioItem:_,stdioItem:{value:$},index:q,newTransforms:Z,direction:Q,encoding:X})=>{let{transform:J,final:Y,binary:K=!1,preserveNewlines:H=!1,objectMode:V}=I($)?$:{transform:$},G=K||S.has(X),{writableObjectMode:U,readableObjectMode:F}=r6(V,q,Z,Q);return{..._,value:{transform:J,final:Y,binary:G,preserveNewlines:H,writableObjectMode:U,readableObjectMode:F}}},T9=(_,$)=>$==="input"?_.reverse():_;import t6 from"node:process";var d_=(_,$,q)=>{let Z=_.map((Q)=>k9(Q,$));if(Z.includes("input")&&Z.includes("output"))throw new TypeError(`The \`${q}\` option must not be an array of both readable and writable values.`);return Z.find(Boolean)??E9},k9=({type:_,value:$},q)=>I9[q]??c_[_]($),I9=["input","output","output"],a0=()=>{return},s6=()=>"input",c_={generator:a0,asyncGenerator:a0,fileUrl:a0,filePath:a0,iterable:s6,asyncIterable:s6,uint8Array:s6,webStream:(_)=>L2(_)?"output":"input",nodeStream(_){if(!P0(_,{checkOpen:!1}))return"output";return u6(_,{checkOpen:!1})?void 0:"input"},webTransform:a0,duplex:a0,native(_){let $=O9(_);if($!==void 0)return $;if(a(_,{checkOpen:!1}))return c_.nodeStream(_)}},O9=(_)=>{if([0,t6.stdin].includes(_))return"input";if([1,2,t6.stdout,t6.stderr].includes(_))return"output"},E9="output";var p_=(_,$)=>$&&!_.includes("ipc")?[..._,"ipc"]:_;var l_=({stdio:_,ipc:$,buffer:q,...Z},Q,X)=>{let J=N9(_,Z).map((Y,K)=>a_(Y,K));return X?y9(J,q,Q):p_(J,$)},N9=(_,$)=>{if(_===void 0)return g.map((Z)=>$[Z]);if(x9($))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${g.map((Z)=>`\`${Z}\``).join(", ")}`);if(typeof _==="string")return[_,_,_];if(!Array.isArray(_))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof _}\``);let q=Math.max(_.length,g.length);return Array.from({length:q},(Z,Q)=>_[Q])},x9=(_)=>g.some(($)=>_[$]!==void 0),a_=(_,$)=>{if(Array.isArray(_))return _.map((q)=>a_(q,$));if(_===null||_===void 0)return $>=g.length?"ignore":"pipe";return _},y9=(_,$,q)=>_.map((Z,Q)=>!$[Q]&&Q!==0&&!S0(q,Q)&&v9(Z)?"ignore":Z),v9=(_)=>_==="pipe"||Array.isArray(_)&&_.every(($)=>$==="pipe");import{readFileSync as h9}from"node:fs";import S9 from"node:tty";var n_=({stdioItem:_,stdioItem:{type:$},isStdioArray:q,fdNumber:Z,direction:Q,isSync:X})=>{if(!q||$!=="native")return _;return X?b9({stdioItem:_,fdNumber:Z,direction:Q}):u9({stdioItem:_,fdNumber:Z})},b9=({stdioItem:_,stdioItem:{value:$,optionName:q},fdNumber:Z,direction:Q})=>{let X=f9({value:$,optionName:q,fdNumber:Z,direction:Q});if(X!==void 0)return X;if(a($,{checkOpen:!1}))throw new TypeError(`The \`${q}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return _},f9=({value:_,optionName:$,fdNumber:q,direction:Z})=>{let Q=g9(_,q);if(Q===void 0)return;if(Z==="output")return{type:"fileNumber",value:Q,optionName:$};if(S9.isatty(Q))throw new TypeError(`The \`${$}: ${i1(_)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:$0(h9(Q)),optionName:$}},g9=(_,$)=>{if(_==="inherit")return $;if(typeof _==="number")return _;let q=k1.indexOf(_);if(q!==-1)return q},u9=({stdioItem:_,stdioItem:{value:$,optionName:q},fdNumber:Z})=>{if($==="inherit")return{type:"nodeStream",value:i_(Z,$,q),optionName:q};if(typeof $==="number")return{type:"nodeStream",value:i_($,$,q),optionName:q};if(a($,{checkOpen:!1}))return{type:"nodeStream",value:$,optionName:q};return _},i_=(_,$,q)=>{let Z=k1[_];if(Z===void 0)throw new TypeError(`The \`${q}: ${$}\` option is invalid: no such standard stream.`);return Z};var o_=({input:_,inputFile:$},q)=>q===0?[...m9(_),...c9($)]:[],m9=(_)=>_===void 0?[]:[{type:d9(_),value:_,optionName:"input"}],d9=(_)=>{if(P0(_,{checkOpen:!1}))return"nodeStream";if(typeof _==="string")return"string";if(O(_))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},c9=(_)=>_===void 0?[]:[{...p9(_),optionName:"inputFile"}],p9=(_)=>{if(z2(_))return{type:"fileUrl",value:_};if(i6(_))return{type:"filePath",value:{file:_}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};var r_=(_)=>_.filter(($,q)=>_.every((Z,Q)=>$.value!==Z.value||q>=Q||$.type==="generator"||$.type==="asyncGenerator")),t_=({stdioItem:{type:_,value:$,optionName:q},direction:Z,fileDescriptors:Q,isSync:X})=>{let J=l9(Q,_);if(J.length===0)return;if(X){a9({otherStdioItems:J,type:_,value:$,optionName:q,direction:Z});return}if(f_.has(_))return s_({otherStdioItems:J,type:_,value:$,optionName:q,direction:Z});if(g_.has(_))n9({otherStdioItems:J,type:_,value:$,optionName:q})},l9=(_,$)=>_.flatMap(({direction:q,stdioItems:Z})=>Z.filter((Q)=>Q.type===$).map((Q)=>({...Q,direction:q}))),a9=({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})=>{if(o6.has($))s_({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})},s_=({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})=>{let X=_.filter((Y)=>i9(Y,q));if(X.length===0)return;let J=X.find((Y)=>Y.direction!==Q);return e_(J,Z,$),Q==="output"?X[0].stream:void 0},i9=({type:_,value:$},q)=>{if(_==="filePath")return $.file===q.file;if(_==="fileUrl")return $.href===q.href;return $===q},n9=({otherStdioItems:_,type:$,value:q,optionName:Z})=>{let Q=_.find(({value:{transform:X}})=>X===q.transform);e_(Q,Z,$)},e_=(_,$,q)=>{if(_!==void 0)throw new TypeError(`The \`${_.optionName}\` and \`${$}\` options must not target ${G0[q]} that is the same.`)};var D2=(_,$,q,Z)=>{let X=l_($,q,Z).map((Y,K)=>o9({stdioOption:Y,fdNumber:K,options:$,isSync:Z})),J=ZY({initialFileDescriptors:X,addProperties:_,options:$,isSync:Z});return $.stdio=J.map(({stdioItems:Y})=>JY(Y)),J},o9=({stdioOption:_,fdNumber:$,options:q,isSync:Z})=>{let Q=I1($),{stdioItems:X,isStdioArray:J}=r9({stdioOption:_,fdNumber:$,options:q,optionName:Q}),Y=d_(X,$,Q),K=X.map((G)=>n_({stdioItem:G,isStdioArray:J,fdNumber:$,direction:Y,isSync:Z})),H=m_(K,Q,Y,q),V=u_(H,Y);return qY(H,V),{direction:Y,objectMode:V,stdioItems:H}},r9=({stdioOption:_,fdNumber:$,options:q,optionName:Z})=>{let X=[...(Array.isArray(_)?_:[_]).map((K)=>t9(K,Z)),...o_(q,$)],J=r_(X),Y=J.length>1;return s9(J,Y,Z),_Y(J),{stdioItems:J,isStdioArray:Y}},t9=(_,$)=>({type:E_(_,$),value:_,optionName:$}),s9=(_,$,q)=>{if(_.length===0)throw new TypeError(`The \`${q}\` option must not be an empty array.`);if(!$)return;for(let{value:Z,optionName:Q}of _)if(e9.has(Z))throw new Error(`The \`${Q}\` option must not include \`${Z}\`.`)},e9=new Set(["ignore","ipc"]),_Y=(_)=>{for(let $ of _)$Y($)},$Y=({type:_,value:$,optionName:q})=>{if(v_($))throw new TypeError(`The \`${q}: URL\` option must use the \`file:\` scheme.
|
|
42
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(h_(_,$))throw new TypeError(`The \`${q}: { file: '...' }\` option must be used instead of \`${q}: '...'\`.`)},qY=(_,$)=>{if(!$)return;let q=_.find(({type:Z})=>R2.has(Z));if(q!==void 0)throw new TypeError(`The \`${q.optionName}\` option cannot use both files and transforms in objectMode.`)},ZY=({initialFileDescriptors:_,addProperties:$,options:q,isSync:Z})=>{let Q=[];try{for(let X of _)Q.push(QY({fileDescriptor:X,fileDescriptors:Q,addProperties:$,options:q,isSync:Z}));return Q}catch(X){throw e6(Q),X}},QY=({fileDescriptor:{direction:_,objectMode:$,stdioItems:q},fileDescriptors:Z,addProperties:Q,options:X,isSync:J})=>{let Y=q.map((K)=>XY({stdioItem:K,addProperties:Q,direction:_,options:X,fileDescriptors:Z,isSync:J}));return{direction:_,objectMode:$,stdioItems:Y}},XY=({stdioItem:_,addProperties:$,direction:q,options:Z,fileDescriptors:Q,isSync:X})=>{let J=t_({stdioItem:_,direction:q,fileDescriptors:Q,isSync:X});if(J!==void 0)return{..._,stream:J};return{..._,...$[q][_.type](_,Z)}},e6=(_)=>{for(let{stdioItems:$}of _)for(let{stream:q}of $)if(q!==void 0&&!p(q))q.destroy()},JY=(_)=>{if(_.length>1)return _.some(({value:Z})=>Z==="overlapped")?"overlapped":"pipe";let[{type:$,value:q}]=_;return $==="native"?q:"pipe"};var q7=(_,$)=>D2(KY,_,$,!0),s=({type:_,optionName:$})=>{Z7($,G0[_])},YY=({optionName:_,value:$})=>{if($==="ipc"||$==="overlapped")Z7(_,`"${$}"`);return{}},Z7=(_,$)=>{throw new TypeError(`The \`${_}\` option cannot be ${$} with synchronous methods.`)},$7={generator(){},asyncGenerator:s,webStream:s,nodeStream:s,webTransform:s,duplex:s,asyncIterable:s,native:YY},KY={input:{...$7,fileUrl:({value:_})=>({contents:[$0(_7(_))]}),filePath:({value:{file:_}})=>({contents:[$0(_7(_))]}),fileNumber:s,iterable:({value:_})=>({contents:[..._]}),string:({value:_})=>({contents:[_]}),uint8Array:({value:_})=>({contents:[_]})},output:{...$7,fileUrl:({value:_})=>({path:_}),filePath:({value:{file:_,append:$}})=>({path:_,append:$}),fileNumber:({value:_})=>({path:_}),iterable:s,string:s,uint8Array:s}};var X0=(_,{stripFinalNewline:$},q)=>_3($,q)&&_!==void 0&&!Array.isArray(_)?d0(_):_,_3=(_,$)=>$==="all"?_[1]||_[2]:_[$];import{Transform as OY,getDefaultHighWaterMark as F7}from"node:stream";var j2=(_,$,q,Z)=>_||q?void 0:X7($,Z),q3=(_,$,q)=>q?_.flatMap((Z)=>Q7(Z,$)):Q7(_,$),Q7=(_,$)=>{let{transform:q,final:Z}=X7($,{});return[...q(_),...Z()]},X7=(_,$)=>{return $.previousChunks="",{transform:HY.bind(void 0,$,_),final:VY.bind(void 0,$)}},HY=function*(_,$,q){if(typeof q!=="string"){yield q;return}let{previousChunks:Z}=_,Q=-1;for(let X=0;X<q.length;X+=1)if(q[X]===`
|
|
43
|
+
`){let J=BY(q,X,$,_),Y=q.slice(Q+1,X+1-J);if(Z.length>0)Y=$3(Z,Y),Z="";yield Y,Q=X}if(Q!==q.length-1)Z=$3(Z,q.slice(Q+1));_.previousChunks=Z},BY=(_,$,q,Z)=>{if(q)return 0;return Z.isWindowsNewline=$!==0&&_[$-1]==="\r",Z.isWindowsNewline?2:1},VY=function*({previousChunks:_}){if(_.length>0)yield _},J7=({binary:_,preserveNewlines:$,readableObjectMode:q,state:Z})=>_||$||q?void 0:{transform:GY.bind(void 0,Z)},GY=function*({isWindowsNewline:_=!1},$){let{unixNewline:q,windowsNewline:Z,LF:Q,concatBytes:X}=typeof $==="string"?UY:WY;if($.at(-1)===Q){yield $;return}yield X($,_?Z:q)},$3=(_,$)=>`${_}${$}`,UY={windowsNewline:`\r
|
|
44
44
|
`,unixNewline:`
|
|
45
45
|
`,LF:`
|
|
46
|
-
`,concatBytes
|
|
46
|
+
`,concatBytes:$3},FY=(_,$)=>{let q=new Uint8Array(_.length+$.length);return q.set(_,0),q.set($,_.length),q},WY={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:FY};import{Buffer as zY}from"node:buffer";var Y7=(_,$)=>_?void 0:LY.bind(void 0,$),LY=function*(_,$){if(typeof $!=="string"&&!O($)&&!zY.isBuffer($))throw new TypeError(`The \`${_}\` option's transform must use "objectMode: true" to receive as input: ${typeof $}.`);yield $},K7=(_,$)=>_?RY.bind(void 0,$):DY.bind(void 0,$),RY=function*(_,$){H7(_,$),yield $},DY=function*(_,$){if(H7(_,$),typeof $!=="string"&&!O($))throw new TypeError(`The \`${_}\` option's function must yield a string or an Uint8Array, not ${typeof $}.`);yield $},H7=(_,$)=>{if($===null||$===void 0)throw new TypeError(`The \`${_}\` option's function must not call \`yield ${$}\`.
|
|
47
47
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
48
|
-
if (condition) { yield value; }`)};import{Buffer as LY}from"node:buffer";import{StringDecoder as RY}from"node:string_decoder";var D2=(_,$,q)=>{if(q)return;if(_)return{transform:DY.bind(void 0,new TextEncoder)};let Z=new RY($);return{transform:jY.bind(void 0,Z),final:kY.bind(void 0,Z)}},DY=function*(_,$){if(LY.isBuffer($))yield s($);else if(typeof $==="string")yield _.encode($);else yield $},jY=function*(_,$){yield w($)?_.write($):$},kY=function*(_){let $=_.end();if($!=="")yield $};import{callbackify as X7}from"node:util";var _3=X7(async(_,$,q,Z)=>{$.currentIterable=_(...q);try{for await(let Q of $.currentIterable)Z.push(Q)}finally{delete $.currentIterable}}),j2=async function*(_,$,q){if(q===$.length){yield _;return}let{transform:Z=PY}=$[q];for await(let Q of Z(_))yield*j2(Q,$,q+1)},J7=async function*(_){for(let[$,{final:q}]of Object.entries(_))yield*AY(q,Number($),_)},AY=async function*(_,$,q){if(_===void 0)return;for await(let Z of _())yield*j2(Z,q,$+1)},Y7=X7(async({currentIterable:_},$)=>{if(_!==void 0){await($?_.throw($):_.return());return}if($)throw $}),PY=function*(_){yield _};var $3=(_,$,q,Z)=>{try{for(let Q of _(...$))q.push(Q);Z()}catch(Q){Z(Q)}},K7=(_,$)=>[...$.flatMap((q)=>[...M0(q,_,0)]),...H1(_)],M0=function*(_,$,q){if(q===$.length){yield _;return}let{transform:Z=CY}=$[q];for(let Q of Z(_))yield*M0(Q,$,q+1)},H1=function*(_){for(let[$,{final:q}]of Object.entries(_))yield*MY(q,Number($),_)},MY=function*(_,$,q){if(_===void 0)return;for(let Z of _())yield*M0(Z,q,$+1)},CY=function*(_){yield _};var q3=({value:_,value:{transform:$,final:q,writableObjectMode:Z,readableObjectMode:Q},optionName:X},{encoding:J})=>{let Y={},K=B7(_,J,X),H=P0($),B=P0(q),V=H?_3.bind(void 0,j2,Y):$3.bind(void 0,M0),F=H||B?_3.bind(void 0,J7,Y):$3.bind(void 0,H1),G=H||B?Y7.bind(void 0,Y):void 0;return{stream:new wY({writableObjectMode:Z,writableHighWaterMark:H7(Z),readableObjectMode:Q,readableHighWaterMark:H7(Q),transform(L,D,z){V([L,K,0],this,z)},flush(L){F([K],this,L)},destroy:G})}},k2=(_,$,q,Z)=>{let Q=$.filter(({type:J})=>J==="generator"),X=Z?Q.reverse():Q;for(let{value:J,optionName:Y}of X){let K=B7(J,q,Y);_=K7(K,_)}return _},B7=({transform:_,final:$,binary:q,writableObjectMode:Z,readableObjectMode:Q,preserveNewlines:X},J,Y)=>{let K={};return[{transform:q7(Z,Y)},D2(q,J,Z),R2(q,X,Z,K),{transform:_,final:$},{transform:Z7(Q,Y)},$7({binary:q,preserveNewlines:X,readableObjectMode:Q,state:K})].filter(Boolean)};var U7=(_,$)=>{for(let q of TY(_))IY(_,q,$)},TY=(_)=>new Set(Object.entries(_).filter(([,{direction:$}])=>$==="input").map(([$])=>Number($))),IY=(_,$,q)=>{let{stdioItems:Z}=_[$],Q=Z.filter(({contents:Y})=>Y!==void 0);if(Q.length===0)return;if($!==0){let[{type:Y,optionName:K}]=Q;throw new TypeError(`Only the \`stdin\` option, not \`${K}\`, can be ${B0[Y]} with synchronous methods.`)}let J=Q.map(({contents:Y})=>Y).map((Y)=>OY(Y,Z));q.input=$1(J)},OY=(_,$)=>{let q=k2(_,$,"utf8",!0);return EY(q),$1(q)},EY=(_)=>{let $=_.find((q)=>typeof q!=="string"&&!w(q));if($!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${$}.`)};import{writeFileSync as vY,appendFileSync as hY}from"node:fs";var A2=({stdioItems:_,encoding:$,verboseInfo:q,fdNumber:Z})=>Z!=="all"&&h0(q,Z)&&!N.has($)&&xY(Z)&&(_.some(({type:Q,value:X})=>Q==="native"&&NY.has(X))||_.every(({type:Q})=>b.has(Q))),xY=(_)=>_===1||_===2,NY=new Set(["pipe","overlapped"]),V7=async(_,$,q,Z)=>{for await(let Q of _)if(!yY($))F7(Q,q,Z)},G7=(_,$,q)=>{for(let Z of _)F7(Z,$,q)},yY=(_)=>_._readableState.pipes.length>0,F7=(_,$,q)=>{let Z=N1(_);c({type:"output",verboseMessage:Z,fdNumber:$,verboseInfo:q})};var W7=({fileDescriptors:_,syncResult:{output:$},options:q,isMaxBuffer:Z,verboseInfo:Q})=>{if($===null)return{output:Array.from({length:3})};let X={},J=new Set([]);return{output:$.map((K,H)=>SY({result:K,fileDescriptors:_,fdNumber:H,state:X,outputFiles:J,isMaxBuffer:Z,verboseInfo:Q},q)),...X}},SY=({result:_,fileDescriptors:$,fdNumber:q,state:Z,outputFiles:Q,isMaxBuffer:X,verboseInfo:J},{buffer:Y,encoding:K,lines:H,stripFinalNewline:B,maxBuffer:V})=>{if(_===null)return;let F=z_(_,X,V),G=s(F),{stdioItems:W,objectMode:L}=$[q],D=bY([G],W,K,Z),{serializedResult:z,finalResult:j=z}=fY({chunks:D,objectMode:L,encoding:K,lines:H,stripFinalNewline:B,fdNumber:q});gY({serializedResult:z,fdNumber:q,state:Z,verboseInfo:J,encoding:K,stdioItems:W,objectMode:L});let C=Y[q]?j:void 0;try{if(Z.error===void 0)uY(z,W,Q);return C}catch(y){return Z.error=y,C}},bY=(_,$,q,Z)=>{try{return k2(_,$,q,!1)}catch(Q){return Z.error=Q,_}},fY=({chunks:_,objectMode:$,encoding:q,lines:Z,stripFinalNewline:Q,fdNumber:X})=>{if($)return{serializedResult:_};if(q==="buffer")return{serializedResult:$1(_)};let J=w5(_,q);if(Z[X])return{serializedResult:J,finalResult:e6(J,!Q[X],$)};return{serializedResult:J}},gY=({serializedResult:_,fdNumber:$,state:q,verboseInfo:Z,encoding:Q,stdioItems:X,objectMode:J})=>{if(!A2({stdioItems:X,encoding:Q,verboseInfo:Z,fdNumber:$}))return;let Y=e6(_,!1,J);try{G7(Y,$,Z)}catch(K){q.error??=K}},uY=(_,$,q)=>{for(let{path:Z,append:Q}of $.filter(({type:X})=>z2.has(X))){let X=typeof Z==="string"?Z:Z.toString();if(Q||q.has(X))hY(Z,_);else q.add(X),vY(Z,_)}};var z7=([,_,$],q)=>{if(!q.all)return;if(_===void 0)return $;if($===void 0)return _;if(Array.isArray(_))return Array.isArray($)?[..._,...$]:[..._,q0($,q,"all")];if(Array.isArray($))return[q0(_,q,"all"),...$];if(w(_)&&w($))return H6([_,$]);return`${_}${$}`};import{once as Z3}from"node:events";var L7=async(_,$)=>{let[q,Z]=await mY(_);return $.isForcefullyTerminated??=!1,[q,Z]},mY=async(_)=>{let[$,q]=await Promise.allSettled([Z3(_,"spawn"),Z3(_,"exit")]);if($.status==="rejected")return[];return q.status==="rejected"?R7(_):q.value},R7=async(_)=>{try{return await Z3(_,"exit")}catch{return R7(_)}},D7=async(_)=>{let[$,q]=await _;if(!dY($,q)&&Q3($,q))throw new l;return[$,q]},dY=(_,$)=>_===void 0&&$===void 0,Q3=(_,$)=>_!==0||$!==null;var j7=({error:_,status:$,signal:q,output:Z},{maxBuffer:Q})=>{let X=cY(_,$,q),J=X?.code==="ETIMEDOUT",Y=W_(X,Z,Q);return{resultError:X,exitCode:$,signal:q,timedOut:J,isMaxBuffer:Y}},cY=(_,$,q)=>{if(_!==void 0)return _;return Q3($,q)?new l:void 0};var k7=(_,$,q)=>{let{file:Z,commandArguments:Q,command:X,escapedCommand:J,startTime:Y,verboseInfo:K,options:H,fileDescriptors:B}=pY(_,$,q),V=nY({file:Z,commandArguments:Q,options:H,command:X,escapedCommand:J,verboseInfo:K,fileDescriptors:B,startTime:Y});return l0(V,K,H)},pY=(_,$,q)=>{let{command:Z,escapedCommand:Q,startTime:X,verboseInfo:J}=v1(_,$,q),Y=aY(q),{file:K,commandArguments:H,options:B}=Z2(_,$,Y);iY(B);let V=t_(B,J);return{file:K,commandArguments:H,command:Z,escapedCommand:Q,startTime:X,verboseInfo:J,options:B,fileDescriptors:V}},aY=(_)=>_.node&&!_.ipc?{..._,ipc:!1}:_,iY=({ipc:_,ipcInput:$,detached:q,cancelSignal:Z})=>{if($)P2("ipcInput");if(_)P2("ipc: true");if(q)P2("detached: true");if(Z)P2("cancelSignal")},P2=(_)=>{throw new TypeError(`The "${_}" option cannot be used with synchronous methods.`)},nY=({file:_,commandArguments:$,options:q,command:Z,escapedCommand:Q,verboseInfo:X,fileDescriptors:J,startTime:Y})=>{let K=oY({file:_,commandArguments:$,options:q,command:Z,escapedCommand:Q,fileDescriptors:J,startTime:Y});if(K.failed)return K;let{resultError:H,exitCode:B,signal:V,timedOut:F,isMaxBuffer:G}=j7(K,q),{output:W,error:L=H}=W7({fileDescriptors:J,syncResult:K,options:q,isMaxBuffer:G,verboseInfo:X}),D=W.map((j,C)=>q0(j,q,C)),z=q0(z7(W,q),q,"all");return tY({error:L,exitCode:B,signal:V,timedOut:F,isMaxBuffer:G,stdio:D,all:z,options:q,command:Z,escapedCommand:Q,startTime:Y})},oY=({file:_,commandArguments:$,options:q,command:Z,escapedCommand:Q,fileDescriptors:X,startTime:J})=>{try{U7(X,q);let Y=rY(q);return lY(...Q2(_,$,Y))}catch(Y){return c0({error:Y,command:Z,escapedCommand:Q,fileDescriptors:X,options:q,startTime:J,isSync:!0})}},rY=({encoding:_,maxBuffer:$,...q})=>({...q,encoding:"buffer",maxBuffer:V2($)}),tY=({error:_,exitCode:$,signal:q,timedOut:Z,isMaxBuffer:Q,stdio:X,all:J,options:Y,command:K,escapedCommand:H,startTime:B})=>_===void 0?G2({command:K,escapedCommand:H,stdio:X,all:J,ipcOutput:[],options:Y,startTime:B}):K1({error:_,command:K,escapedCommand:H,timedOut:Z,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:Q,isForcefullyTerminated:!1,exitCode:$,signal:q,stdio:X,all:J,ipcOutput:[],options:Y,startTime:B,isSync:!0});import{setMaxListeners as fH}from"node:events";import{spawn as gH}from"node:child_process";import w7 from"node:process";import{once as X3,on as sY}from"node:events";var A7=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z},{reference:Q=!0,filter:X}={})=>{return f0({methodName:"getOneMessage",isSubprocess:q,ipc:Z,isConnected:t1(_)}),eY({anyProcess:_,channel:$,isSubprocess:q,filter:X,reference:Q})},eY=async({anyProcess:_,channel:$,isSubprocess:q,filter:Z,reference:Q})=>{i1($,Q);let X=H0(_,$,q),J=new AbortController;try{return await Promise.race([_K(X,Z,J),$K(X,q,J),qK(X,q,J)])}catch(Y){throw g0(_),Y}finally{J.abort(),n1($,Q)}},_K=async(_,$,{signal:q})=>{if($===void 0){let[Z]=await X3(_,"message",{signal:q});return Z}for await(let[Z]of sY(_,"message",{signal:q}))if($(Z))return Z},$K=async(_,$,{signal:q})=>{await X3(_,"disconnect",{signal:q}),Y8($)},qK=async(_,$,{signal:q})=>{let[Z]=await X3(_,"strict:error",{signal:q});throw l1(Z,$)};import{once as M7,on as ZK}from"node:events";var C7=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z},{reference:Q=!0}={})=>J3({anyProcess:_,channel:$,isSubprocess:q,ipc:Z,shouldAwait:!q,reference:Q}),J3=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z,shouldAwait:Q,reference:X})=>{f0({methodName:"getEachMessage",isSubprocess:q,ipc:Z,isConnected:t1(_)}),i1($,X);let J=H0(_,$,q),Y=new AbortController,K={};return QK(_,J,Y),XK({ipcEmitter:J,isSubprocess:q,controller:Y,state:K}),JK({anyProcess:_,channel:$,ipcEmitter:J,isSubprocess:q,shouldAwait:Q,controller:Y,state:K,reference:X})},QK=async(_,$,q)=>{try{await M7($,"disconnect",{signal:q.signal}),q.abort()}catch{}},XK=async({ipcEmitter:_,isSubprocess:$,controller:q,state:Z})=>{try{let[Q]=await M7(_,"strict:error",{signal:q.signal});Z.error=l1(Q,$),q.abort()}catch{}},JK=async function*({anyProcess:_,channel:$,ipcEmitter:q,isSubprocess:Z,shouldAwait:Q,controller:X,state:J,reference:Y}){try{for await(let[K]of ZK(q,"message",{signal:X.signal}))P7(J),yield K}catch{P7(J)}finally{if(X.abort(),n1($,Y),!Z)g0(_);if(Q)await _}},P7=({error:_})=>{if(_)throw _};var T7=(_,{ipc:$})=>{Object.assign(_,O7(_,!1,$))},I7=()=>{let _=w7,$=!0,q=w7.channel!==void 0;return{...O7(_,!0,q),getCancelSignal:v8.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:!0,ipc:q})}},O7=(_,$,q)=>({sendMessage:$2.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q}),getOneMessage:A7.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q}),getEachMessage:C7.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q})});import{ChildProcess as YK}from"node:child_process";import{PassThrough as KK,Readable as HK,Writable as BK,Duplex as UK}from"node:stream";var E7=({error:_,command:$,escapedCommand:q,fileDescriptors:Z,options:Q,startTime:X,verboseInfo:J})=>{r6(Z);let Y=new YK;VK(Y,Z),Object.assign(Y,{readable:GK,writable:FK,duplex:WK});let K=c0({error:_,command:$,escapedCommand:q,fileDescriptors:Z,options:Q,startTime:X,isSync:!1}),H=zK(K,J,Q);return{subprocess:Y,promise:H}},VK=(_,$)=>{let q=B1(),Z=B1(),Q=B1(),X=Array.from({length:$.length-3},B1),J=B1(),Y=[q,Z,Q,...X];Object.assign(_,{stdin:q,stdout:Z,stderr:Q,all:J,stdio:Y})},B1=()=>{let _=new KK;return _.end(),_},GK=()=>new HK({read(){}}),FK=()=>new BK({write(){}}),WK=()=>new UK({read(){},write(){}}),zK=async(_,$,q)=>l0(_,$,q);import{createReadStream as x7,createWriteStream as N7}from"node:fs";import{Buffer as LK}from"node:buffer";import{Readable as U1,Writable as RK,Duplex as DK}from"node:stream";var v7=(_,$)=>L2(jK,_,$,!1),V1=({type:_,optionName:$})=>{throw new TypeError(`The \`${$}\` option cannot be ${B0[_]}.`)},y7={fileNumber:V1,generator:q3,asyncGenerator:q3,nodeStream:({value:_})=>({stream:_}),webTransform({value:{transform:_,writableObjectMode:$,readableObjectMode:q}}){let Z=$||q;return{stream:DK.fromWeb(_,{objectMode:Z})}},duplex:({value:{transform:_}})=>({stream:_}),native(){}},jK={input:{...y7,fileUrl:({value:_})=>({stream:x7(_)}),filePath:({value:{file:_}})=>({stream:x7(_)}),webStream:({value:_})=>({stream:U1.fromWeb(_)}),iterable:({value:_})=>({stream:U1.from(_)}),asyncIterable:({value:_})=>({stream:U1.from(_)}),string:({value:_})=>({stream:U1.from(_)}),uint8Array:({value:_})=>({stream:U1.from(LK.from(_))})},output:{...y7,fileUrl:({value:_})=>({stream:N7(_)}),filePath:({value:{file:_,append:$}})=>({stream:N7(_,$?{flags:"a"}:{})}),webStream:({value:_})=>({stream:RK.fromWeb(_)}),iterable:V1,asyncIterable:V1,string:V1,uint8Array:V1}};import{on as kK,once as h7}from"node:events";import{PassThrough as AK,getDefaultHighWaterMark as PK}from"node:stream";import{finished as f7}from"node:stream/promises";function C0(_){if(!Array.isArray(_))throw new TypeError(`Expected an array, got \`${typeof _}\`.`);for(let Q of _)Y3(Q);let $=_.some(({readableObjectMode:Q})=>Q),q=MK(_,$),Z=new g7({objectMode:$,writableHighWaterMark:q,readableHighWaterMark:q});for(let Q of _)Z.add(Q);return Z}var MK=(_,$)=>{if(_.length===0)return PK($);let q=_.filter(({readableObjectMode:Z})=>Z===$).map(({readableHighWaterMark:Z})=>Z);return Math.max(...q)};class g7 extends AK{#Z=new Set([]);#$=new Set([]);#_=new Set([]);#q;#Y=Symbol("unpipe");#J=new WeakMap;add(_){if(Y3(_),this.#Z.has(_))return;this.#Z.add(_),this.#q??=CK(this,this.#Z,this.#Y);let $=IK({passThroughStream:this,stream:_,streams:this.#Z,ended:this.#$,aborted:this.#_,onFinished:this.#q,unpipeEvent:this.#Y});this.#J.set(_,$),_.pipe(this,{end:!1})}async remove(_){if(Y3(_),!this.#Z.has(_))return!1;let $=this.#J.get(_);if($===void 0)return!1;return this.#J.delete(_),_.unpipe(this),await $,!0}}var CK=async(_,$,q)=>{M2(_,S7);let Z=new AbortController;try{await Promise.race([wK(_,Z),TK(_,$,q,Z)])}finally{Z.abort(),M2(_,-S7)}},wK=async(_,{signal:$})=>{try{await f7(_,{signal:$,cleanup:!0})}catch(q){throw u7(_,q),q}},TK=async(_,$,q,{signal:Z})=>{for await(let[Q]of kK(_,"unpipe",{signal:Z}))if($.has(Q))Q.emit(q)},Y3=(_)=>{if(typeof _?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof _}\`.`)},IK=async({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,onFinished:X,unpipeEvent:J})=>{M2(_,b7);let Y=new AbortController;try{await Promise.race([OK(X,$,Y),EK({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,controller:Y}),xK({stream:$,streams:q,ended:Z,aborted:Q,unpipeEvent:J,controller:Y})])}finally{Y.abort(),M2(_,-b7)}if(q.size>0&&q.size===Z.size+Q.size)if(Z.size===0&&Q.size>0)K3(_);else NK(_)},OK=async(_,$,{signal:q})=>{try{if(await _,!q.aborted)K3($)}catch(Z){if(!q.aborted)u7($,Z)}},EK=async({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,controller:{signal:X}})=>{try{if(await f7($,{signal:X,cleanup:!0,readable:!0,writable:!1}),q.has($))Z.add($)}catch(J){if(X.aborted||!q.has($))return;if(m7(J))Q.add($);else d7(_,J)}},xK=async({stream:_,streams:$,ended:q,aborted:Z,unpipeEvent:Q,controller:{signal:X}})=>{if(await h7(_,Q,{signal:X}),!_.readable)return h7(X,"abort",{signal:X});$.delete(_),q.delete(_),Z.delete(_)},NK=(_)=>{if(_.writable)_.end()},u7=(_,$)=>{if(m7($))K3(_);else d7(_,$)},m7=(_)=>_?.code==="ERR_STREAM_PREMATURE_CLOSE",K3=(_)=>{if(_.readable||_.writable)_.destroy()},d7=(_,$)=>{if(!_.destroyed)_.once("error",yK),_.destroy($)},yK=()=>{},M2=(_,$)=>{let q=_.getMaxListeners();if(q!==0&&q!==Number.POSITIVE_INFINITY)_.setMaxListeners(q+$)},S7=2,b7=1;import{finished as c7}from"node:stream/promises";var a0=(_,$)=>{_.pipe($),vK(_,$),hK(_,$)},vK=async(_,$)=>{if(g(_)||g($))return;try{await c7(_,{cleanup:!0,readable:!0,writable:!1})}catch{}H3($)},H3=(_)=>{if(_.writable)_.end()},hK=async(_,$)=>{if(g(_)||g($))return;try{await c7($,{cleanup:!0,readable:!1,writable:!0})}catch{}B3(_)},B3=(_)=>{if(_.readable)_.destroy()};var l7=(_,$,q)=>{let Z=new Map;for(let[Q,{stdioItems:X,direction:J}]of Object.entries($)){for(let{stream:Y}of X.filter(({type:K})=>b.has(K)))SK(_,Y,J,Q);for(let{stream:Y}of X.filter(({type:K})=>!b.has(K)))fK({subprocess:_,stream:Y,direction:J,fdNumber:Q,pipeGroups:Z,controller:q})}for(let[Q,X]of Z.entries()){let J=X.length===1?X[0]:C0(X);a0(J,Q)}},SK=(_,$,q,Z)=>{if(q==="output")a0(_.stdio[Z],$);else a0($,_.stdio[Z]);let Q=bK[Z];if(Q!==void 0)_[Q]=$;_.stdio[Z]=$},bK=["stdin","stdout","stderr"],fK=({subprocess:_,stream:$,direction:q,fdNumber:Z,pipeGroups:Q,controller:X})=>{if($===void 0)return;gK($,X);let[J,Y]=q==="output"?[$,_.stdio[Z]]:[_.stdio[Z],$],K=Q.get(J)??[];Q.set(J,[...K,Y])},gK=(_,{signal:$})=>{if(g(_))k0(_,uK,$)},uK=2;import{addAbortListener as cK}from"node:events";var w0=[];w0.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")w0.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")w0.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var C2=(_)=>!!_&&typeof _==="object"&&typeof _.removeListener==="function"&&typeof _.emit==="function"&&typeof _.reallyExit==="function"&&typeof _.listeners==="function"&&typeof _.kill==="function"&&typeof _.pid==="number"&&typeof _.on==="function",U3=Symbol.for("signal-exit emitter"),V3=globalThis,mK=Object.defineProperty.bind(Object);class p7{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(V3[U3])return V3[U3];mK(V3,U3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(_,$){this.listeners[_].push($)}removeListener(_,$){let q=this.listeners[_],Z=q.indexOf($);if(Z===-1)return;if(Z===0&&q.length===1)q.length=0;else q.splice(Z,1)}emit(_,$,q){if(this.emitted[_])return!1;this.emitted[_]=!0;let Z=!1;for(let Q of this.listeners[_])Z=Q($,q)===!0||Z;if(_==="exit")Z=this.emit("afterExit",$,q)||Z;return Z}}class F3{}var dK=(_)=>{return{onExit($,q){return _.onExit($,q)},load(){return _.load()},unload(){return _.unload()}}};class a7 extends F3{onExit(){return()=>{}}load(){}unload(){}}class i7 extends F3{#Z=G3.platform==="win32"?"SIGINT":"SIGHUP";#$=new p7;#_;#q;#Y;#J={};#Q=!1;constructor(_){super();this.#_=_,this.#J={};for(let $ of w0)this.#J[$]=()=>{let q=this.#_.listeners($),{count:Z}=this.#$,Q=_;if(typeof Q.__signal_exit_emitter__==="object"&&typeof Q.__signal_exit_emitter__.count==="number")Z+=Q.__signal_exit_emitter__.count;if(q.length===Z){this.unload();let X=this.#$.emit("exit",null,$),J=$==="SIGHUP"?this.#Z:$;if(!X)_.kill(_.pid,J)}};this.#Y=_.reallyExit,this.#q=_.emit}onExit(_,$){if(!C2(this.#_))return()=>{};if(this.#Q===!1)this.load();let q=$?.alwaysLast?"afterExit":"exit";return this.#$.on(q,_),()=>{if(this.#$.removeListener(q,_),this.#$.listeners.exit.length===0&&this.#$.listeners.afterExit.length===0)this.unload()}}load(){if(this.#Q)return;this.#Q=!0,this.#$.count+=1;for(let _ of w0)try{let $=this.#J[_];if($)this.#_.on(_,$)}catch($){}this.#_.emit=(_,...$)=>{return this.#X(_,...$)},this.#_.reallyExit=(_)=>{return this.#K(_)}}unload(){if(!this.#Q)return;this.#Q=!1,w0.forEach((_)=>{let $=this.#J[_];if(!$)throw new Error("Listener not defined for signal: "+_);try{this.#_.removeListener(_,$)}catch(q){}}),this.#_.emit=this.#q,this.#_.reallyExit=this.#Y,this.#$.count-=1}#K(_){if(!C2(this.#_))return 0;return this.#_.exitCode=_||0,this.#$.emit("exit",this.#_.exitCode,null),this.#Y.call(this.#_,this.#_.exitCode)}#X(_,...$){let q=this.#q;if(_==="exit"&&C2(this.#_)){if(typeof $[0]==="number")this.#_.exitCode=$[0];let Z=q.call(this.#_,_,...$);return this.#$.emit("exit",this.#_.exitCode,null),Z}else return q.call(this.#_,_,...$)}}var G3=globalThis.process,{onExit:n7,load:Yj,unload:Kj}=dK(C2(G3)?new i7(G3):new a7);var o7=(_,{cleanup:$,detached:q},{signal:Z})=>{if(!$||q)return;let Q=n7(()=>{_.kill()});cK(Z,()=>{Q()})};var t7=({source:_,sourcePromise:$,boundOptions:q,createNested:Z},...Q)=>{let X=y1(),{destination:J,destinationStream:Y,destinationError:K,from:H,unpipeSignal:B}=lK(q,Z,Q),{sourceStream:V,sourceError:F}=aK(_,H),{options:G,fileDescriptors:W}=a.get(_);return{sourcePromise:$,sourceStream:V,sourceOptions:G,sourceError:F,destination:J,destinationStream:Y,destinationError:K,unpipeSignal:B,fileDescriptors:W,startTime:X}},lK=(_,$,q)=>{try{let{destination:Z,pipeOptions:{from:Q,to:X,unpipeSignal:J}={}}=pK(_,$,...q),Y=a1(Z,X);return{destination:Z,destinationStream:Y,from:Q,unpipeSignal:J}}catch(Z){return{destinationError:Z}}},pK=(_,$,q,...Z)=>{if(Array.isArray(q))return{destination:$(r7,_)(q,...Z),pipeOptions:_};if(typeof q==="string"||q instanceof URL||Y6(q)){if(Object.keys(_).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[Q,X,J]=P1(q,...Z);return{destination:$(r7)(Q,X,J),pipeOptions:J}}if(a.has(q)){if(Object.keys(_).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:q,pipeOptions:Z[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${q}`)},r7=({options:_})=>({options:{..._,stdin:"pipe",piped:!0}}),aK=(_,$)=>{try{return{sourceStream:u0(_,$)}}catch(q){return{sourceError:q}}};var e7=({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z,fileDescriptors:Q,sourceOptions:X,startTime:J})=>{let Y=iK({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z});if(Y!==void 0)throw W3({error:Y,fileDescriptors:Q,sourceOptions:X,startTime:J})},iK=({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z})=>{if($!==void 0&&Z!==void 0)return Z;if(Z!==void 0)return B3(_),Z;if($!==void 0)return H3(q),$},W3=({error:_,fileDescriptors:$,sourceOptions:q,startTime:Z})=>c0({error:_,command:s7,escapedCommand:s7,fileDescriptors:$,options:q,startTime:Z,isSync:!1}),s7="source.pipe(destination)";var _$=async(_)=>{let[{status:$,reason:q,value:Z=q},{status:Q,reason:X,value:J=X}]=await _;if(!J.pipedFrom.includes(Z))J.pipedFrom.push(Z);if(Q==="rejected")throw J;if($==="rejected")throw Z;return J};import{finished as nK}from"node:stream/promises";var $$=(_,$,q)=>{let Z=w2.has($)?rK(_,$):oK(_,$);return k0(_,sK,q.signal),k0($,eK,q.signal),tK($),Z},oK=(_,$)=>{let q=C0([_]);return a0(q,$),w2.set($,q),q},rK=(_,$)=>{let q=w2.get($);return q.add(_),q},tK=async(_)=>{try{await nK(_,{cleanup:!0,readable:!1,writable:!0})}catch{}w2.delete(_)},w2=new WeakMap,sK=2,eK=1;import{aborted as _H}from"node:util";var q$=(_,$)=>_===void 0?[]:[$H(_,$)],$H=async(_,{sourceStream:$,mergedStream:q,fileDescriptors:Z,sourceOptions:Q,startTime:X})=>{await _H(_,$),await q.remove($);let J=new Error("Pipe canceled by `unpipeSignal` option.");throw W3({error:J,fileDescriptors:Z,sourceOptions:Q,startTime:X})};var T2=(_,...$)=>{if(M($[0]))return T2.bind(void 0,{..._,boundOptions:{..._.boundOptions,...$[0]}});let{destination:q,...Z}=t7(_,...$),Q=qH({...Z,destination:q});return Q.pipe=T2.bind(void 0,{..._,source:q,sourcePromise:Q,boundOptions:{}}),Q},qH=async({sourcePromise:_,sourceStream:$,sourceOptions:q,sourceError:Z,destination:Q,destinationStream:X,destinationError:J,unpipeSignal:Y,fileDescriptors:K,startTime:H})=>{let B=ZH(_,Q);e7({sourceStream:$,sourceError:Z,destinationStream:X,destinationError:J,fileDescriptors:K,sourceOptions:q,startTime:H});let V=new AbortController;try{let F=$$($,X,V);return await Promise.race([_$(B),...q$(Y,{sourceStream:$,mergedStream:F,sourceOptions:q,fileDescriptors:K,startTime:H})])}finally{V.abort()}},ZH=(_,$)=>Promise.allSettled([_,$]);import{setImmediate as BH}from"node:timers/promises";import{on as QH}from"node:events";import{getDefaultHighWaterMark as XH}from"node:stream";var I2=({subprocessStdout:_,subprocess:$,binary:q,shouldEncode:Z,encoding:Q,preserveNewlines:X})=>{let J=new AbortController;return JH($,J),Q$({stream:_,controller:J,binary:q,shouldEncode:!_.readableObjectMode&&Z,encoding:Q,shouldSplit:!_.readableObjectMode,preserveNewlines:X})},JH=async(_,$)=>{try{await _}catch{}finally{$.abort()}},z3=({stream:_,onStreamEnd:$,lines:q,encoding:Z,stripFinalNewline:Q,allMixed:X})=>{let J=new AbortController;YH($,J,_);let Y=_.readableObjectMode&&!X;return Q$({stream:_,controller:J,binary:Z==="buffer",shouldEncode:!Y,encoding:Z,shouldSplit:!Y&&q,preserveNewlines:!Q})},YH=async(_,$,q)=>{try{await _}catch{q.destroy()}finally{$.abort()}},Q$=({stream:_,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J})=>{let Y=QH(_,"data",{signal:$.signal,highWaterMark:Z$,highWatermark:Z$});return KH({onStdoutChunk:Y,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J})},L3=XH(!0),Z$=L3,KH=async function*({onStdoutChunk:_,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J}){let Y=HH({binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J});try{for await(let[K]of _)yield*M0(K,Y,0)}catch(K){if(!$.signal.aborted)throw K}finally{yield*H1(Y)}},HH=({binary:_,shouldEncode:$,encoding:q,shouldSplit:Z,preserveNewlines:Q})=>[D2(_,q,!$),R2(_,Q,!Z,{})].filter(Boolean);var X$=async({stream:_,onStreamEnd:$,fdNumber:q,encoding:Z,buffer:Q,maxBuffer:X,lines:J,allMixed:Y,stripFinalNewline:K,verboseInfo:H,streamInfo:B})=>{let V=UH({stream:_,onStreamEnd:$,fdNumber:q,encoding:Z,allMixed:Y,verboseInfo:H,streamInfo:B});if(!Q){await Promise.all([VH(_),V]);return}let F=t6(K,q),G=z3({stream:_,onStreamEnd:$,lines:J,encoding:Z,stripFinalNewline:F,allMixed:Y}),[W]=await Promise.all([GH({stream:_,iterable:G,fdNumber:q,encoding:Z,maxBuffer:X,lines:J}),V]);return W},UH=async({stream:_,onStreamEnd:$,fdNumber:q,encoding:Z,allMixed:Q,verboseInfo:X,streamInfo:{fileDescriptors:J}})=>{if(!A2({stdioItems:J[q]?.stdioItems,encoding:Z,verboseInfo:X,fdNumber:q}))return;let Y=z3({stream:_,onStreamEnd:$,lines:!0,encoding:Z,stripFinalNewline:!0,allMixed:Q});await V7(Y,_,q,X)},VH=async(_)=>{if(await BH(),_.readableFlowing===null)_.resume()},GH=async({stream:_,stream:{readableObjectMode:$},iterable:q,fdNumber:Z,encoding:Q,maxBuffer:X,lines:J})=>{try{if($||J)return await K2(q,{maxBuffer:X});if(Q==="buffer")return new Uint8Array(await H2(q,{maxBuffer:X}));return await U2(q,{maxBuffer:X})}catch(Y){return J$(V_({error:Y,stream:_,readableObjectMode:$,lines:J,encoding:Q,fdNumber:Z}))}},R3=async(_)=>{try{return await _}catch($){return J$($)}},J$=({bufferedData:_})=>M5(_)?new Uint8Array(_):_;import{finished as FH}from"node:stream/promises";var G1=async(_,$,q,{isSameDirection:Z,stopOnExit:Q=!1}={})=>{let X=WH(_,q),J=new AbortController;try{await Promise.race([...Q?[q.exitPromise]:[],FH(_,{cleanup:!0,signal:J.signal})])}catch(Y){if(!X.stdinCleanedUp)RH(Y,$,q,Z)}finally{J.abort()}},WH=(_,{originalStreams:[$],subprocess:q})=>{let Z={stdinCleanedUp:!1};if(_===$)zH(_,q,Z);return Z},zH=(_,$,q)=>{let{_destroy:Z}=_;_._destroy=(...Q)=>{LH($,q),Z.call(_,...Q)}},LH=({exitCode:_,signalCode:$},q)=>{if(_!==null||$!==null)q.stdinCleanedUp=!0},RH=(_,$,q,Z)=>{if(!DH(_,$,q,Z))throw _},DH=(_,$,q,Z=!0)=>{if(q.propagating)return Y$(_)||O2(_);return q.propagating=!0,D3(q,$)===Z?Y$(_):O2(_)},D3=({fileDescriptors:_},$)=>$!=="all"&&_[$].direction==="input",O2=(_)=>_?.code==="ERR_STREAM_PREMATURE_CLOSE",Y$=(_)=>_?.code==="EPIPE";var K$=({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})=>_.stdio.map((K,H)=>j3({stream:K,fdNumber:H,encoding:$,buffer:q[H],maxBuffer:Z[H],lines:Q[H],allMixed:!1,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})),j3=async({stream:_,fdNumber:$,encoding:q,buffer:Z,maxBuffer:Q,lines:X,allMixed:J,stripFinalNewline:Y,verboseInfo:K,streamInfo:H})=>{if(!_)return;let B=G1(_,$,H);if(D3(H,$)){await B;return}let[V]=await Promise.all([X$({stream:_,onStreamEnd:B,fdNumber:$,encoding:q,buffer:Z,maxBuffer:Q,lines:X,allMixed:J,stripFinalNewline:Y,verboseInfo:K,streamInfo:H}),B]);return V};var H$=({stdout:_,stderr:$},{all:q})=>q&&(_||$)?C0([_,$].filter(Boolean)):void 0,B$=({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})=>j3({...jH(_,q),fdNumber:"all",encoding:$,maxBuffer:Z[1]+Z[2],lines:Q[1]||Q[2],allMixed:kH(_),stripFinalNewline:X,verboseInfo:J,streamInfo:Y}),jH=({stdout:_,stderr:$,all:q},[,Z,Q])=>{let X=Z||Q;if(!X)return{stream:q,buffer:X};if(!Z)return{stream:$,buffer:X};if(!Q)return{stream:_,buffer:X};return{stream:q,buffer:X}},kH=({all:_,stdout:$,stderr:q})=>_&&$&&q&&$.readableObjectMode!==q.readableObjectMode;import{once as AH}from"node:events";var U$=(_)=>h0(_,"ipc"),V$=(_,$)=>{let q=N1(_);c({type:"ipc",verboseMessage:q,fdNumber:"ipc",verboseInfo:$})};var G$=async({subprocess:_,buffer:$,maxBuffer:q,ipc:Z,ipcOutput:Q,verboseInfo:X})=>{if(!Z)return Q;let J=U$(X),Y=e($,"ipc"),K=e(q,"ipc");for await(let H of J3({anyProcess:_,channel:_.channel,isSubprocess:!1,ipc:Z,shouldAwait:!1,reference:!0})){if(Y)G_(_,Q,K),Q.push(H);if(J)V$(H,X)}return Q},F$=async(_,$)=>{return await Promise.allSettled([_]),$};var W$=async({subprocess:_,options:{encoding:$,buffer:q,maxBuffer:Z,lines:Q,timeoutDuration:X,cancelSignal:J,gracefulCancel:Y,forceKillAfterDelay:K,stripFinalNewline:H,ipc:B,ipcInput:V},context:F,verboseInfo:G,fileDescriptors:W,originalStreams:L,onInternalError:D,controller:z})=>{let j=L7(_,F),C={originalStreams:L,fileDescriptors:W,subprocess:_,exitPromise:j,propagating:!1},y=K$({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:H,verboseInfo:G,streamInfo:C}),t=B$({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:H,verboseInfo:G,streamInfo:C}),J0=[],R0=G$({subprocess:_,buffer:q,maxBuffer:Z,ipc:B,ipcOutput:J0,verboseInfo:G}),E0=PH(L,_,C),Y0=MH(W,C);try{return await Promise.race([Promise.all([{},D7(j),Promise.all(y),t,R0,l8(_,V),...E0,...Y0]),D,CH(_,z),...g8(_,X,F,z),...J8({subprocess:_,cancelSignal:J,gracefulCancel:Y,context:F,controller:z}),...b8({subprocess:_,cancelSignal:J,gracefulCancel:Y,forceKillAfterDelay:K,context:F,controller:z})])}catch(r2){return F.terminationReason??="other",Promise.all([{error:r2},j,Promise.all(y.map((s0)=>R3(s0))),R3(t),F$(R0,J0),Promise.allSettled(E0),Promise.allSettled(Y0)])}},PH=(_,$,q)=>_.map((Z,Q)=>Z===$.stdio[Q]?void 0:G1(Z,Q,q)),MH=(_,$)=>_.flatMap(({stdioItems:q},Z)=>q.filter(({value:Q,stream:X=Q})=>m(X,{checkOpen:!1})&&!g(X)).map(({type:Q,value:X,stream:J=X})=>G1(J,Z,$,{isSameDirection:b.has(Q),stopOnExit:Q==="native"}))),CH=async(_,{signal:$})=>{let[q]=await AH(_,"error",{signal:$});throw q};var z$=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),F1=(_,$,q)=>{let Z=_[q];if(!Z.has($))Z.set($,[]);let Q=Z.get($),X=p();return Q.push(X),{resolve:X.resolve.bind(X),promises:Q}},i0=async({resolve:_,promises:$},q)=>{_();let[Z]=await Promise.race([Promise.allSettled([!0,q]),Promise.all([!1,...$])]);return!Z};import{Readable as wH}from"node:stream";import{callbackify as TH}from"node:util";import{finished as L$}from"node:stream/promises";var k3=async(_)=>{if(_===void 0)return;try{await A3(_)}catch{}},R$=async(_)=>{if(_===void 0)return;try{await P3(_)}catch{}},A3=async(_)=>{await L$(_,{cleanup:!0,readable:!1,writable:!0})},P3=async(_)=>{await L$(_,{cleanup:!0,readable:!0,writable:!1})},E2=async(_,$)=>{if(await _,$)throw $},x2=(_,$,q)=>{if(q&&!O2(q))_.destroy(q);else if($)_.destroy()};var D$=({subprocess:_,concurrentStreams:$,encoding:q},{from:Z,binary:Q=!0,preserveNewlines:X=!0}={})=>{let J=Q||N.has(q),{subprocessStdout:Y,waitReadableDestroy:K}=M3(_,Z,$),{readableEncoding:H,readableObjectMode:B,readableHighWaterMark:V}=C3(Y,J),{read:F,onStdoutDataDone:G}=w3({subprocessStdout:Y,subprocess:_,binary:J,encoding:q,preserveNewlines:X}),W=new wH({read:F,destroy:TH(I3.bind(void 0,{subprocessStdout:Y,subprocess:_,waitReadableDestroy:K})),highWaterMark:V,objectMode:B,encoding:H});return T3({subprocessStdout:Y,onStdoutDataDone:G,readable:W,subprocess:_}),W},M3=(_,$,q)=>{let Z=u0(_,$),Q=F1(q,Z,"readableDestroy");return{subprocessStdout:Z,waitReadableDestroy:Q}},C3=({readableEncoding:_,readableObjectMode:$,readableHighWaterMark:q},Z)=>Z?{readableEncoding:_,readableObjectMode:$,readableHighWaterMark:q}:{readableEncoding:_,readableObjectMode:!0,readableHighWaterMark:L3},w3=({subprocessStdout:_,subprocess:$,binary:q,encoding:Z,preserveNewlines:Q})=>{let X=p(),J=I2({subprocessStdout:_,subprocess:$,binary:q,shouldEncode:!q,encoding:Z,preserveNewlines:Q});return{read(){IH(this,J,X)},onStdoutDataDone:X}},IH=async(_,$,q)=>{try{let{value:Z,done:Q}=await $.next();if(Q)q.resolve();else _.push(Z)}catch{}},T3=async({subprocessStdout:_,onStdoutDataDone:$,readable:q,subprocess:Z,subprocessStdin:Q})=>{try{if(await P3(_),await Z,await k3(Q),await $,q.readable)q.push(null)}catch(X){await k3(Q),j$(q,X)}},I3=async({subprocessStdout:_,subprocess:$,waitReadableDestroy:q},Z)=>{if(await i0(q,$))j$(_,Z),await E2($,Z)},j$=(_,$)=>{x2(_,_.readable,$)};import{Writable as OH}from"node:stream";import{callbackify as k$}from"node:util";var A$=({subprocess:_,concurrentStreams:$},{to:q}={})=>{let{subprocessStdin:Z,waitWritableFinal:Q,waitWritableDestroy:X}=O3(_,q,$),J=new OH({...E3(Z,_,Q),destroy:k$(N3.bind(void 0,{subprocessStdin:Z,subprocess:_,waitWritableFinal:Q,waitWritableDestroy:X})),highWaterMark:Z.writableHighWaterMark,objectMode:Z.writableObjectMode});return x3(Z,J),J},O3=(_,$,q)=>{let Z=a1(_,$),Q=F1(q,Z,"writableFinal"),X=F1(q,Z,"writableDestroy");return{subprocessStdin:Z,waitWritableFinal:Q,waitWritableDestroy:X}},E3=(_,$,q)=>({write:EH.bind(void 0,_),final:k$(xH.bind(void 0,_,$,q))}),EH=(_,$,q,Z)=>{if(_.write($,q))Z();else _.once("drain",Z)},xH=async(_,$,q)=>{if(await i0(q,$)){if(_.writable)_.end();await $}},x3=async(_,$,q)=>{try{if(await A3(_),$.writable)$.end()}catch(Z){await R$(q),P$($,Z)}},N3=async({subprocessStdin:_,subprocess:$,waitWritableFinal:q,waitWritableDestroy:Z},Q)=>{if(await i0(q,$),await i0(Z,$))P$(_,Q),await E2($,Q)},P$=(_,$)=>{x2(_,_.writable,$)};import{Duplex as NH}from"node:stream";import{callbackify as yH}from"node:util";var M$=({subprocess:_,concurrentStreams:$,encoding:q},{from:Z,to:Q,binary:X=!0,preserveNewlines:J=!0}={})=>{let Y=X||N.has(q),{subprocessStdout:K,waitReadableDestroy:H}=M3(_,Z,$),{subprocessStdin:B,waitWritableFinal:V,waitWritableDestroy:F}=O3(_,Q,$),{readableEncoding:G,readableObjectMode:W,readableHighWaterMark:L}=C3(K,Y),{read:D,onStdoutDataDone:z}=w3({subprocessStdout:K,subprocess:_,binary:Y,encoding:q,preserveNewlines:J}),j=new NH({read:D,...E3(B,_,V),destroy:yH(vH.bind(void 0,{subprocessStdout:K,subprocessStdin:B,subprocess:_,waitReadableDestroy:H,waitWritableFinal:V,waitWritableDestroy:F})),readableHighWaterMark:L,writableHighWaterMark:B.writableHighWaterMark,readableObjectMode:W,writableObjectMode:B.writableObjectMode,encoding:G});return T3({subprocessStdout:K,onStdoutDataDone:z,readable:j,subprocess:_,subprocessStdin:B}),x3(B,j,K),j},vH=async({subprocessStdout:_,subprocessStdin:$,subprocess:q,waitReadableDestroy:Z,waitWritableFinal:Q,waitWritableDestroy:X},J)=>{await Promise.all([I3({subprocessStdout:_,subprocess:q,waitReadableDestroy:Z},J),N3({subprocessStdin:$,subprocess:q,waitWritableFinal:Q,waitWritableDestroy:X},J)])};var y3=(_,$,{from:q,binary:Z=!1,preserveNewlines:Q=!1}={})=>{let X=Z||N.has($),J=u0(_,q),Y=I2({subprocessStdout:J,subprocess:_,binary:X,shouldEncode:!0,encoding:$,preserveNewlines:Q});return hH(Y,J,_)},hH=async function*(_,$,q){try{yield*_}finally{if($.readable)$.destroy();await q}};var C$=(_,{encoding:$})=>{let q=z$();_.readable=D$.bind(void 0,{subprocess:_,concurrentStreams:q,encoding:$}),_.writable=A$.bind(void 0,{subprocess:_,concurrentStreams:q}),_.duplex=M$.bind(void 0,{subprocess:_,concurrentStreams:q,encoding:$}),_.iterable=y3.bind(void 0,_,$),_[Symbol.asyncIterator]=y3.bind(void 0,_,$,{})};var w$=(_,$)=>{for(let[q,Z]of bH){let Q=Z.value.bind($);Reflect.defineProperty(_,q,{...Z,value:Q})}},SH=(async()=>{})().constructor.prototype,bH=["then","catch","finally"].map((_)=>[_,Reflect.getOwnPropertyDescriptor(SH,_)]);var T$=(_,$,q,Z)=>{let{file:Q,commandArguments:X,command:J,escapedCommand:Y,startTime:K,verboseInfo:H,options:B,fileDescriptors:V}=uH(_,$,q),{subprocess:F,promise:G}=dH({file:Q,commandArguments:X,options:B,startTime:K,verboseInfo:H,command:J,escapedCommand:Y,fileDescriptors:V});return F.pipe=T2.bind(void 0,{source:F,sourcePromise:G,boundOptions:{},createNested:Z}),w$(F,G),a.set(F,{options:B,fileDescriptors:V}),F},uH=(_,$,q)=>{let{command:Z,escapedCommand:Q,startTime:X,verboseInfo:J}=v1(_,$,q),{file:Y,commandArguments:K,options:H}=Z2(_,$,q),B=mH(H),V=v7(B,J);return{file:Y,commandArguments:K,command:Z,escapedCommand:Q,startTime:X,verboseInfo:J,options:B,fileDescriptors:V}},mH=({timeout:_,signal:$,...q})=>{if($!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...q,timeoutDuration:_}},dH=({file:_,commandArguments:$,options:q,startTime:Z,verboseInfo:Q,command:X,escapedCommand:J,fileDescriptors:Y})=>{let K;try{K=gH(...Q2(_,$,q))}catch(W){return E7({error:W,command:X,escapedCommand:J,fileDescriptors:Y,options:q,startTime:Z,verboseInfo:Q})}let H=new AbortController;fH(Number.POSITIVE_INFINITY,H.signal);let B=[...K.stdio];l7(K,Y,H),o7(K,q,H);let V={},F=p();K.kill=Q8.bind(void 0,{kill:K.kill.bind(K),options:q,onInternalError:F,context:V,controller:H}),K.all=H$(K,q),C$(K,q),T7(K,q);let G=cH({subprocess:K,options:q,startTime:Z,verboseInfo:Q,fileDescriptors:Y,originalStreams:B,command:X,escapedCommand:J,context:V,onInternalError:F,controller:H});return{subprocess:K,promise:G}},cH=async({subprocess:_,options:$,startTime:q,verboseInfo:Z,fileDescriptors:Q,originalStreams:X,command:J,escapedCommand:Y,context:K,onInternalError:H,controller:B})=>{let[V,[F,G],W,L,D]=await W$({subprocess:_,options:$,context:K,verboseInfo:Z,fileDescriptors:Q,originalStreams:X,onInternalError:H,controller:B});B.abort(),H.resolve();let z=W.map((y,t)=>q0(y,$,t)),j=q0(L,$,"all"),C=lH({errorInfo:V,exitCode:F,signal:G,stdio:z,all:j,ipcOutput:D,context:K,options:$,command:J,escapedCommand:Y,startTime:q});return l0(C,Z,$)},lH=({errorInfo:_,exitCode:$,signal:q,stdio:Z,all:Q,ipcOutput:X,context:J,options:Y,command:K,escapedCommand:H,startTime:B})=>("error"in _)?K1({error:_.error,command:K,escapedCommand:H,timedOut:J.terminationReason==="timeout",isCanceled:J.terminationReason==="cancel"||J.terminationReason==="gracefulCancel",isGracefullyCanceled:J.terminationReason==="gracefulCancel",isMaxBuffer:_.error instanceof _0,isForcefullyTerminated:J.isForcefullyTerminated,exitCode:$,signal:q,stdio:Z,all:Q,ipcOutput:X,options:Y,startTime:B,isSync:!1}):G2({command:K,escapedCommand:H,stdio:Z,all:Q,ipcOutput:X,options:Y,startTime:B});var N2=(_,$)=>{let q=Object.fromEntries(Object.entries($).map(([Z,Q])=>[Z,pH(Z,_[Z],Q)]));return{..._,...q}},pH=(_,$,q)=>{if(aH.has(_)&&M($)&&M(q))return{...$,...q};return q},aH=new Set(["env",...G6]);var U0=(_,$,q,Z)=>{let Q=(J,Y,K)=>U0(J,Y,q,K),X=(...J)=>iH({mapArguments:_,deepOptions:q,boundOptions:$,setBoundExeca:Z,createNested:Q},...J);if(Z!==void 0)Z(X,Q,$);return X},iH=({mapArguments:_,deepOptions:$={},boundOptions:q={},setBoundExeca:Z,createNested:Q},X,...J)=>{if(M(X))return Q(_,N2(q,X),Z);let{file:Y,commandArguments:K,options:H,isSync:B}=nH({mapArguments:_,firstArgument:X,nextArguments:J,deepOptions:$,boundOptions:q});return B?k7(Y,K,H):T$(Y,K,H,Q)},nH=({mapArguments:_,firstArgument:$,nextArguments:q,deepOptions:Z,boundOptions:Q})=>{let X=E5($)?x5($,q):[$,...q],[J,Y,K]=P1(...X),H=N2(N2(Z,Q),K),{file:B=J,commandArguments:V=Y,options:F=H,isSync:G=!1}=_({file:J,commandArguments:Y,options:H});return{file:B,commandArguments:V,options:F,isSync:G}};var I$=({file:_,commandArguments:$})=>E$(_,$),O$=({file:_,commandArguments:$})=>({...E$(_,$),isSync:!0}),E$=(_,$)=>{if($.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${_} ${$}.`);let[q,...Z]=oH(_);return{file:q,commandArguments:Z}},oH=(_)=>{if(typeof _!=="string")throw new TypeError(`The command must be a string: ${String(_)}.`);let $=_.trim();if($==="")return[];let q=[];for(let Z of $.split(rH)){let Q=q.at(-1);if(Q&&Q.endsWith("\\"))q[q.length-1]=`${Q.slice(0,-1)} ${Z}`;else q.push(Z)}return q},rH=/ +/g;var x$=(_,$,q)=>{_.sync=$(tH,q),_.s=_.sync},N$=({options:_})=>y$(_),tH=({options:_})=>({...y$(_),isSync:!0}),y$=(_)=>({options:{...sH(_),..._}}),sH=({input:_,inputFile:$,stdio:q})=>_===void 0&&$===void 0&&q===void 0?{stdin:"inherit"}:{},v$={preferLocal:!0};var I=U0(()=>({})),O=U0(()=>({isSync:!0})),tA=U0(I$),sA=U0(O$),eA=U0(m8),_P=U0(N$,{},v$,x$),{sendMessage:$P,getOneMessage:qP,getEachMessage:ZP,getCancelSignal:QP}=I7();var y2=(_)=>{if(_.code==="ENOENT")throw new Error("Couldn't find the `termux-api` scripts. You can install them with: apt install termux-api");throw _},eH={async copy(_){try{await I("termux-clipboard-set",_)}catch($){y2($)}},async paste(_){try{let{stdout:$}=await I("termux-clipboard-get",_);return $}catch($){y2($)}},copySync(_){try{O("termux-clipboard-set",_)}catch($){y2($)}},pasteSync(_){try{return O("termux-clipboard-get",_).stdout}catch($){y2($)}}},h$=eH;import u$ from"node:path";import{fileURLToPath as _B}from"node:url";var $B=u$.dirname(_B(import.meta.url)),m$="xsel",d$=u$.join($B,"../fallbacks/linux/xsel"),S$=["--clipboard","--input"],b$=["--clipboard","--output"],c$=(_,$)=>{let q=_.code==="ENOENT"?"Couldn't find the `xsel` binary and fallback didn't work. On Debian/Ubuntu you can install xsel with: sudo apt install xsel":"Both xsel and fallback failed",Z=new Error(q);if(_.code!=="ENOENT")Z.xselError=_;return Z.fallbackError=$,Z},f$=async(_,$)=>{try{let{stdout:q}=await I(m$,_,$);return q}catch(q){try{let{stdout:Z}=await I(d$,_,$);return Z}catch(Z){throw c$(q,Z)}}},g$=(_,$)=>{try{return O(m$,_,$).stdout}catch(q){try{return O(d$,_,$).stdout}catch(Z){throw c$(q,Z)}}},qB={async copy(_){await f$(S$,_)},copySync(_){g$(S$,_)},paste:(_)=>f$(b$,_),pasteSync:(_)=>g$(b$,_)},T0=qB;var v2=["--type","text/plain"],a$=(_,$)=>{if($.code==="ENOENT")return new Error(`Couldn't find the \`${_}\` binary. On Debian/Ubuntu you can install wl-clipboard with: sudo apt install wl-clipboard`);return new Error(`Command \`${_}\` failed: ${$.message}`)},l$=async(_,$,q,Z)=>{try{return(await I(_,$,q)).stdout}catch(Q){if(_==="wl-paste"&&/nothing is copied|no selection|selection owner/i.test(Q.stderr||""))return"";if(Q.code==="ENOENT"||/wayland|wayland_display|failed to connect|display/i.test(Q.stderr||""))return Z(q);throw a$(_,Q)}},p$=(_,$,q,Z)=>{try{return O(_,$,q).stdout}catch(Q){if(_==="wl-paste"&&/nothing is copied|no selection|selection owner/i.test(Q.stderr||""))return"";if(Q.code==="ENOENT"||/wayland|wayland_display|failed to connect|display/i.test(Q.stderr||""))return Z(q);throw a$(_,Q)}},ZB={async copy(_){await l$("wl-copy",v2,_,T0.copy)},copySync(_){p$("wl-copy",v2,_,T0.copySync)},async paste(_){return l$("wl-paste",[...v2,"--no-newline"],_,T0.paste)},pasteSync(_){return p$("wl-paste",[...v2,"--no-newline"],_,T0.pasteSync)}},i$=ZB;var h2={LC_CTYPE:"UTF-8"},QB={copy:async(_)=>I("pbcopy",{..._,env:h2}),async paste(_){let{stdout:$}=await I("pbpaste",{..._,env:h2});return $},copySync:(_)=>O("pbcopy",{..._,env:h2}),pasteSync:(_)=>O("pbpaste",{..._,env:h2}).stdout},n$=QB;import{Buffer as KB}from"node:buffer";import $q from"node:path";import{fileURLToPath as HB}from"node:url";import{promisify as XB}from"node:util";import JB from"node:process";import W1 from"node:child_process";var jP=XB(W1.execFile);function o$(){let{arch:_,platform:$,env:q}=JB;if($==="darwin"&&_==="x64")return W1.execFileSync("sysctl",["-inq","sysctl.proc_translated"],{encoding:"utf8"}).trim()==="1"?"arm64":"x64";if(_==="arm64"||_==="x64")return _;if($==="win32"&&Object.hasOwn(q,"PROCESSOR_ARCHITEW6432"))return"x64";if($==="linux"){if(W1.execFileSync("getconf",["LONG_BIT"],{encoding:"utf8"}).trim()==="64")return"x64"}return _}var YB=new Set(["arm64","x64","ppc64","riscv64"]);function r$(){return YB.has(o$())}var BB=$q.dirname(HB(import.meta.url)),UB=r$()?"x86_64":"i686",S2=$q.join(BB,`../fallbacks/windows/clipboard_${UB}.exe`),b2="powershell.exe",VB=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass"],f2=(_)=>{let $=KB.from(_,"utf16le").toString("base64");return[...VB,"-EncodedCommand",$]},t$=`
|
|
48
|
+
if (condition) { yield value; }`)};import{Buffer as jY}from"node:buffer";import{StringDecoder as AY}from"node:string_decoder";var A2=(_,$,q)=>{if(q)return;if(_)return{transform:MY.bind(void 0,new TextEncoder)};let Z=new AY($);return{transform:PY.bind(void 0,Z),final:wY.bind(void 0,Z)}},MY=function*(_,$){if(jY.isBuffer($))yield $0($);else if(typeof $==="string")yield _.encode($);else yield $},PY=function*(_,$){yield O($)?_.write($):$},wY=function*(_){let $=_.end();if($!=="")yield $};import{callbackify as B7}from"node:util";var Z3=B7(async(_,$,q,Z)=>{$.currentIterable=_(...q);try{for await(let Q of $.currentIterable)Z.push(Q)}finally{delete $.currentIterable}}),M2=async function*(_,$,q){if(q===$.length){yield _;return}let{transform:Z=TY}=$[q];for await(let Q of Z(_))yield*M2(Q,$,q+1)},V7=async function*(_){for(let[$,{final:q}]of Object.entries(_))yield*CY(q,Number($),_)},CY=async function*(_,$,q){if(_===void 0)return;for await(let Z of _())yield*M2(Z,q,$+1)},G7=B7(async({currentIterable:_},$)=>{if(_!==void 0){await($?_.throw($):_.return());return}if($)throw $}),TY=function*(_){yield _};var Q3=(_,$,q,Z)=>{try{for(let Q of _(...$))q.push(Q);Z()}catch(Q){Z(Q)}},U7=(_,$)=>[...$.flatMap((q)=>[...C0(q,_,0)]),...H1(_)],C0=function*(_,$,q){if(q===$.length){yield _;return}let{transform:Z=IY}=$[q];for(let Q of Z(_))yield*C0(Q,$,q+1)},H1=function*(_){for(let[$,{final:q}]of Object.entries(_))yield*kY(q,Number($),_)},kY=function*(_,$,q){if(_===void 0)return;for(let Z of _())yield*C0(Z,q,$+1)},IY=function*(_){yield _};var X3=({value:_,value:{transform:$,final:q,writableObjectMode:Z,readableObjectMode:Q},optionName:X},{encoding:J})=>{let Y={},K=W7(_,J,X),H=w0($),V=w0(q),G=H?Z3.bind(void 0,M2,Y):Q3.bind(void 0,C0),U=H||V?Z3.bind(void 0,V7,Y):Q3.bind(void 0,H1),F=H||V?G7.bind(void 0,Y):void 0;return{stream:new OY({writableObjectMode:Z,writableHighWaterMark:F7(Z),readableObjectMode:Q,readableHighWaterMark:F7(Q),transform(L,A,z){G([L,K,0],this,z)},flush(L){U([K],this,L)},destroy:F})}},P2=(_,$,q,Z)=>{let Q=$.filter(({type:J})=>J==="generator"),X=Z?Q.reverse():Q;for(let{value:J,optionName:Y}of X){let K=W7(J,q,Y);_=U7(K,_)}return _},W7=({transform:_,final:$,binary:q,writableObjectMode:Z,readableObjectMode:Q,preserveNewlines:X},J,Y)=>{let K={};return[{transform:Y7(Z,Y)},A2(q,J,Z),j2(q,X,Z,K),{transform:_,final:$},{transform:K7(Q,Y)},J7({binary:q,preserveNewlines:X,readableObjectMode:Q,state:K})].filter(Boolean)};var z7=(_,$)=>{for(let q of EY(_))NY(_,q,$)},EY=(_)=>new Set(Object.entries(_).filter(([,{direction:$}])=>$==="input").map(([$])=>Number($))),NY=(_,$,q)=>{let{stdioItems:Z}=_[$],Q=Z.filter(({contents:Y})=>Y!==void 0);if(Q.length===0)return;if($!==0){let[{type:Y,optionName:K}]=Q;throw new TypeError(`Only the \`stdin\` option, not \`${K}\`, can be ${G0[Y]} with synchronous methods.`)}let J=Q.map(({contents:Y})=>Y).map((Y)=>xY(Y,Z));q.input=$1(J)},xY=(_,$)=>{let q=P2(_,$,"utf8",!0);return yY(q),$1(q)},yY=(_)=>{let $=_.find((q)=>typeof q!=="string"&&!O(q));if($!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${$}.`)};import{writeFileSync as bY,appendFileSync as fY}from"node:fs";var w2=({stdioItems:_,encoding:$,verboseInfo:q,fdNumber:Z})=>Z!=="all"&&S0(q,Z)&&!S.has($)&&vY(Z)&&(_.some(({type:Q,value:X})=>Q==="native"&&hY.has(X))||_.every(({type:Q})=>u.has(Q))),vY=(_)=>_===1||_===2,hY=new Set(["pipe","overlapped"]),L7=async(_,$,q,Z)=>{for await(let Q of _)if(!SY($))D7(Q,q,Z)},R7=(_,$,q)=>{for(let Z of _)D7(Z,$,q)},SY=(_)=>_._readableState.pipes.length>0,D7=(_,$,q)=>{let Z=v1(_);n({type:"output",verboseMessage:Z,fdNumber:$,verboseInfo:q})};var j7=({fileDescriptors:_,syncResult:{output:$},options:q,isMaxBuffer:Z,verboseInfo:Q})=>{if($===null)return{output:Array.from({length:3})};let X={},J=new Set([]);return{output:$.map((K,H)=>gY({result:K,fileDescriptors:_,fdNumber:H,state:X,outputFiles:J,isMaxBuffer:Z,verboseInfo:Q},q)),...X}},gY=({result:_,fileDescriptors:$,fdNumber:q,state:Z,outputFiles:Q,isMaxBuffer:X,verboseInfo:J},{buffer:Y,encoding:K,lines:H,stripFinalNewline:V,maxBuffer:G})=>{if(_===null)return;let U=A_(_,X,G),F=$0(U),{stdioItems:W,objectMode:L}=$[q],A=uY([F],W,K,Z),{serializedResult:z,finalResult:D=z}=mY({chunks:A,objectMode:L,encoding:K,lines:H,stripFinalNewline:V,fdNumber:q});dY({serializedResult:z,fdNumber:q,state:Z,verboseInfo:J,encoding:K,stdioItems:W,objectMode:L});let j=Y[q]?D:void 0;try{if(Z.error===void 0)cY(z,W,Q);return j}catch(P){return Z.error=P,j}},uY=(_,$,q,Z)=>{try{return P2(_,$,q,!1)}catch(Q){return Z.error=Q,_}},mY=({chunks:_,objectMode:$,encoding:q,lines:Z,stripFinalNewline:Q,fdNumber:X})=>{if($)return{serializedResult:_};if(q==="buffer")return{serializedResult:$1(_)};let J=N5(_,q);if(Z[X])return{serializedResult:J,finalResult:q3(J,!Q[X],$)};return{serializedResult:J}},dY=({serializedResult:_,fdNumber:$,state:q,verboseInfo:Z,encoding:Q,stdioItems:X,objectMode:J})=>{if(!w2({stdioItems:X,encoding:Q,verboseInfo:Z,fdNumber:$}))return;let Y=q3(_,!1,J);try{R7(Y,$,Z)}catch(K){q.error??=K}},cY=(_,$,q)=>{for(let{path:Z,append:Q}of $.filter(({type:X})=>R2.has(X))){let X=typeof Z==="string"?Z:Z.toString();if(Q||q.has(X))fY(Z,_);else q.add(X),bY(Z,_)}};var A7=([,_,$],q)=>{if(!q.all)return;if(_===void 0)return $;if($===void 0)return _;if(Array.isArray(_))return Array.isArray($)?[..._,...$]:[..._,X0($,q,"all")];if(Array.isArray($))return[X0(_,q,"all"),...$];if(O(_)&&O($))return G6([_,$]);return`${_}${$}`};import{once as J3}from"node:events";var M7=async(_,$)=>{let[q,Z]=await pY(_);return $.isForcefullyTerminated??=!1,[q,Z]},pY=async(_)=>{let[$,q]=await Promise.allSettled([J3(_,"spawn"),J3(_,"exit")]);if($.status==="rejected")return[];return q.status==="rejected"?P7(_):q.value},P7=async(_)=>{try{return await J3(_,"exit")}catch{return P7(_)}},w7=async(_)=>{let[$,q]=await _;if(!lY($,q)&&Y3($,q))throw new o;return[$,q]},lY=(_,$)=>_===void 0&&$===void 0,Y3=(_,$)=>_!==0||$!==null;var C7=({error:_,status:$,signal:q,output:Z},{maxBuffer:Q})=>{let X=aY(_,$,q),J=X?.code==="ETIMEDOUT",Y=j_(X,Z,Q);return{resultError:X,exitCode:$,signal:q,timedOut:J,isMaxBuffer:Y}},aY=(_,$,q)=>{if(_!==void 0)return _;return Y3($,q)?new o:void 0};var T7=(_,$,q)=>{let{file:Z,commandArguments:Q,command:X,escapedCommand:J,startTime:Y,verboseInfo:K,options:H,fileDescriptors:V}=nY(_,$,q),G=tY({file:Z,commandArguments:Q,options:H,command:X,escapedCommand:J,verboseInfo:K,fileDescriptors:V,startTime:Y});return l0(G,K,H)},nY=(_,$,q)=>{let{command:Z,escapedCommand:Q,startTime:X,verboseInfo:J}=S1(_,$,q),Y=oY(q),{file:K,commandArguments:H,options:V}=X2(_,$,Y);rY(V);let G=q7(V,J);return{file:K,commandArguments:H,command:Z,escapedCommand:Q,startTime:X,verboseInfo:J,options:V,fileDescriptors:G}},oY=(_)=>_.node&&!_.ipc?{..._,ipc:!1}:_,rY=({ipc:_,ipcInput:$,detached:q,cancelSignal:Z})=>{if($)C2("ipcInput");if(_)C2("ipc: true");if(q)C2("detached: true");if(Z)C2("cancelSignal")},C2=(_)=>{throw new TypeError(`The "${_}" option cannot be used with synchronous methods.`)},tY=({file:_,commandArguments:$,options:q,command:Z,escapedCommand:Q,verboseInfo:X,fileDescriptors:J,startTime:Y})=>{let K=sY({file:_,commandArguments:$,options:q,command:Z,escapedCommand:Q,fileDescriptors:J,startTime:Y});if(K.failed)return K;let{resultError:H,exitCode:V,signal:G,timedOut:U,isMaxBuffer:F}=C7(K,q),{output:W,error:L=H}=j7({fileDescriptors:J,syncResult:K,options:q,isMaxBuffer:F,verboseInfo:X}),A=W.map((D,j)=>X0(D,q,j)),z=X0(A7(W,q),q,"all");return _K({error:L,exitCode:V,signal:G,timedOut:U,isMaxBuffer:F,stdio:A,all:z,options:q,command:Z,escapedCommand:Q,startTime:Y})},sY=({file:_,commandArguments:$,options:q,command:Z,escapedCommand:Q,fileDescriptors:X,startTime:J})=>{try{z7(X,q);let Y=eY(q);return iY(...J2(_,$,Y))}catch(Y){return p0({error:Y,command:Z,escapedCommand:Q,fileDescriptors:X,options:q,startTime:J,isSync:!0})}},eY=({encoding:_,maxBuffer:$,...q})=>({...q,encoding:"buffer",maxBuffer:F2($)}),_K=({error:_,exitCode:$,signal:q,timedOut:Z,isMaxBuffer:Q,stdio:X,all:J,options:Y,command:K,escapedCommand:H,startTime:V})=>_===void 0?W2({command:K,escapedCommand:H,stdio:X,all:J,ipcOutput:[],options:Y,startTime:V}):K1({error:_,command:K,escapedCommand:H,timedOut:Z,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:Q,isForcefullyTerminated:!1,exitCode:$,signal:q,stdio:X,all:J,ipcOutput:[],options:Y,startTime:V,isSync:!0});import{setMaxListeners as mH}from"node:events";import{spawn as dH}from"node:child_process";import N7 from"node:process";import{once as K3,on as $K}from"node:events";var k7=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z},{reference:Q=!0,filter:X}={})=>{return g0({methodName:"getOneMessage",isSubprocess:q,ipc:Z,isConnected:e1(_)}),qK({anyProcess:_,channel:$,isSubprocess:q,filter:X,reference:Q})},qK=async({anyProcess:_,channel:$,isSubprocess:q,filter:Z,reference:Q})=>{o1($,Q);let X=V0(_,$,q),J=new AbortController;try{return await Promise.race([ZK(X,Z,J),QK(X,q,J),XK(X,q,J)])}catch(Y){throw u0(_),Y}finally{J.abort(),r1($,Q)}},ZK=async(_,$,{signal:q})=>{if($===void 0){let[Z]=await K3(_,"message",{signal:q});return Z}for await(let[Z]of $K(_,"message",{signal:q}))if($(Z))return Z},QK=async(_,$,{signal:q})=>{await K3(_,"disconnect",{signal:q}),G8($)},XK=async(_,$,{signal:q})=>{let[Z]=await K3(_,"strict:error",{signal:q});throw a1(Z,$)};import{once as O7,on as JK}from"node:events";var E7=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z},{reference:Q=!0}={})=>H3({anyProcess:_,channel:$,isSubprocess:q,ipc:Z,shouldAwait:!q,reference:Q}),H3=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z,shouldAwait:Q,reference:X})=>{g0({methodName:"getEachMessage",isSubprocess:q,ipc:Z,isConnected:e1(_)}),o1($,X);let J=V0(_,$,q),Y=new AbortController,K={};return YK(_,J,Y),KK({ipcEmitter:J,isSubprocess:q,controller:Y,state:K}),HK({anyProcess:_,channel:$,ipcEmitter:J,isSubprocess:q,shouldAwait:Q,controller:Y,state:K,reference:X})},YK=async(_,$,q)=>{try{await O7($,"disconnect",{signal:q.signal}),q.abort()}catch{}},KK=async({ipcEmitter:_,isSubprocess:$,controller:q,state:Z})=>{try{let[Q]=await O7(_,"strict:error",{signal:q.signal});Z.error=a1(Q,$),q.abort()}catch{}},HK=async function*({anyProcess:_,channel:$,ipcEmitter:q,isSubprocess:Z,shouldAwait:Q,controller:X,state:J,reference:Y}){try{for await(let[K]of JK(q,"message",{signal:X.signal}))I7(J),yield K}catch{I7(J)}finally{if(X.abort(),r1($,Y),!Z)u0(_);if(Q)await _}},I7=({error:_})=>{if(_)throw _};var x7=(_,{ipc:$})=>{Object.assign(_,v7(_,!1,$))},y7=()=>{let _=N7,$=!0,q=N7.channel!==void 0;return{...v7(_,!0,q),getCancelSignal:g8.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:!0,ipc:q})}},v7=(_,$,q)=>({sendMessage:Z2.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q}),getOneMessage:k7.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q}),getEachMessage:E7.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q})});import{ChildProcess as BK}from"node:child_process";import{PassThrough as VK,Readable as GK,Writable as UK,Duplex as FK}from"node:stream";var h7=({error:_,command:$,escapedCommand:q,fileDescriptors:Z,options:Q,startTime:X,verboseInfo:J})=>{e6(Z);let Y=new BK;WK(Y,Z),Object.assign(Y,{readable:zK,writable:LK,duplex:RK});let K=p0({error:_,command:$,escapedCommand:q,fileDescriptors:Z,options:Q,startTime:X,isSync:!1}),H=DK(K,J,Q);return{subprocess:Y,promise:H}},WK=(_,$)=>{let q=B1(),Z=B1(),Q=B1(),X=Array.from({length:$.length-3},B1),J=B1(),Y=[q,Z,Q,...X];Object.assign(_,{stdin:q,stdout:Z,stderr:Q,all:J,stdio:Y})},B1=()=>{let _=new VK;return _.end(),_},zK=()=>new GK({read(){}}),LK=()=>new UK({write(){}}),RK=()=>new FK({read(){},write(){}}),DK=async(_,$,q)=>l0(_,$,q);import{createReadStream as S7,createWriteStream as b7}from"node:fs";import{Buffer as jK}from"node:buffer";import{Readable as V1,Writable as AK,Duplex as MK}from"node:stream";var g7=(_,$)=>D2(PK,_,$,!1),G1=({type:_,optionName:$})=>{throw new TypeError(`The \`${$}\` option cannot be ${G0[_]}.`)},f7={fileNumber:G1,generator:X3,asyncGenerator:X3,nodeStream:({value:_})=>({stream:_}),webTransform({value:{transform:_,writableObjectMode:$,readableObjectMode:q}}){let Z=$||q;return{stream:MK.fromWeb(_,{objectMode:Z})}},duplex:({value:{transform:_}})=>({stream:_}),native(){}},PK={input:{...f7,fileUrl:({value:_})=>({stream:S7(_)}),filePath:({value:{file:_}})=>({stream:S7(_)}),webStream:({value:_})=>({stream:V1.fromWeb(_)}),iterable:({value:_})=>({stream:V1.from(_)}),asyncIterable:({value:_})=>({stream:V1.from(_)}),string:({value:_})=>({stream:V1.from(_)}),uint8Array:({value:_})=>({stream:V1.from(jK.from(_))})},output:{...f7,fileUrl:({value:_})=>({stream:b7(_)}),filePath:({value:{file:_,append:$}})=>({stream:b7(_,$?{flags:"a"}:{})}),webStream:({value:_})=>({stream:AK.fromWeb(_)}),iterable:G1,asyncIterable:G1,string:G1,uint8Array:G1}};import{on as wK,once as u7}from"node:events";import{PassThrough as CK,getDefaultHighWaterMark as TK}from"node:stream";import{finished as c7}from"node:stream/promises";function T0(_){if(!Array.isArray(_))throw new TypeError(`Expected an array, got \`${typeof _}\`.`);for(let Q of _)B3(Q);let $=_.some(({readableObjectMode:Q})=>Q),q=kK(_,$),Z=new p7({objectMode:$,writableHighWaterMark:q,readableHighWaterMark:q});for(let Q of _)Z.add(Q);return Z}var kK=(_,$)=>{if(_.length===0)return TK($);let q=_.filter(({readableObjectMode:Z})=>Z===$).map(({readableHighWaterMark:Z})=>Z);return Math.max(...q)};class p7 extends CK{#Z=new Set([]);#$=new Set([]);#_=new Set([]);#q;#Y=Symbol("unpipe");#J=new WeakMap;add(_){if(B3(_),this.#Z.has(_))return;this.#Z.add(_),this.#q??=IK(this,this.#Z,this.#Y);let $=NK({passThroughStream:this,stream:_,streams:this.#Z,ended:this.#$,aborted:this.#_,onFinished:this.#q,unpipeEvent:this.#Y});this.#J.set(_,$),_.pipe(this,{end:!1})}async remove(_){if(B3(_),!this.#Z.has(_))return!1;let $=this.#J.get(_);if($===void 0)return!1;return this.#J.delete(_),_.unpipe(this),await $,!0}}var IK=async(_,$,q)=>{T2(_,m7);let Z=new AbortController;try{await Promise.race([OK(_,Z),EK(_,$,q,Z)])}finally{Z.abort(),T2(_,-m7)}},OK=async(_,{signal:$})=>{try{await c7(_,{signal:$,cleanup:!0})}catch(q){throw l7(_,q),q}},EK=async(_,$,q,{signal:Z})=>{for await(let[Q]of wK(_,"unpipe",{signal:Z}))if($.has(Q))Q.emit(q)},B3=(_)=>{if(typeof _?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof _}\`.`)},NK=async({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,onFinished:X,unpipeEvent:J})=>{T2(_,d7);let Y=new AbortController;try{await Promise.race([xK(X,$,Y),yK({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,controller:Y}),vK({stream:$,streams:q,ended:Z,aborted:Q,unpipeEvent:J,controller:Y})])}finally{Y.abort(),T2(_,-d7)}if(q.size>0&&q.size===Z.size+Q.size)if(Z.size===0&&Q.size>0)V3(_);else hK(_)},xK=async(_,$,{signal:q})=>{try{if(await _,!q.aborted)V3($)}catch(Z){if(!q.aborted)l7($,Z)}},yK=async({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,controller:{signal:X}})=>{try{if(await c7($,{signal:X,cleanup:!0,readable:!0,writable:!1}),q.has($))Z.add($)}catch(J){if(X.aborted||!q.has($))return;if(a7(J))Q.add($);else i7(_,J)}},vK=async({stream:_,streams:$,ended:q,aborted:Z,unpipeEvent:Q,controller:{signal:X}})=>{if(await u7(_,Q,{signal:X}),!_.readable)return u7(X,"abort",{signal:X});$.delete(_),q.delete(_),Z.delete(_)},hK=(_)=>{if(_.writable)_.end()},l7=(_,$)=>{if(a7($))V3(_);else i7(_,$)},a7=(_)=>_?.code==="ERR_STREAM_PREMATURE_CLOSE",V3=(_)=>{if(_.readable||_.writable)_.destroy()},i7=(_,$)=>{if(!_.destroyed)_.once("error",SK),_.destroy($)},SK=()=>{},T2=(_,$)=>{let q=_.getMaxListeners();if(q!==0&&q!==Number.POSITIVE_INFINITY)_.setMaxListeners(q+$)},m7=2,d7=1;import{finished as n7}from"node:stream/promises";var i0=(_,$)=>{_.pipe($),bK(_,$),fK(_,$)},bK=async(_,$)=>{if(p(_)||p($))return;try{await n7(_,{cleanup:!0,readable:!0,writable:!1})}catch{}G3($)},G3=(_)=>{if(_.writable)_.end()},fK=async(_,$)=>{if(p(_)||p($))return;try{await n7($,{cleanup:!0,readable:!1,writable:!0})}catch{}U3(_)},U3=(_)=>{if(_.readable)_.destroy()};var o7=(_,$,q)=>{let Z=new Map;for(let[Q,{stdioItems:X,direction:J}]of Object.entries($)){for(let{stream:Y}of X.filter(({type:K})=>u.has(K)))gK(_,Y,J,Q);for(let{stream:Y}of X.filter(({type:K})=>!u.has(K)))mK({subprocess:_,stream:Y,direction:J,fdNumber:Q,pipeGroups:Z,controller:q})}for(let[Q,X]of Z.entries()){let J=X.length===1?X[0]:T0(X);i0(J,Q)}},gK=(_,$,q,Z)=>{if(q==="output")i0(_.stdio[Z],$);else i0($,_.stdio[Z]);let Q=uK[Z];if(Q!==void 0)_[Q]=$;_.stdio[Z]=$},uK=["stdin","stdout","stderr"],mK=({subprocess:_,stream:$,direction:q,fdNumber:Z,pipeGroups:Q,controller:X})=>{if($===void 0)return;dK($,X);let[J,Y]=q==="output"?[$,_.stdio[Z]]:[_.stdio[Z],$],K=Q.get(J)??[];Q.set(J,[...K,Y])},dK=(_,{signal:$})=>{if(p(_))M0(_,cK,$)},cK=2;import{addAbortListener as aK}from"node:events";var k0=[];k0.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")k0.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")k0.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var k2=(_)=>!!_&&typeof _==="object"&&typeof _.removeListener==="function"&&typeof _.emit==="function"&&typeof _.reallyExit==="function"&&typeof _.listeners==="function"&&typeof _.kill==="function"&&typeof _.pid==="number"&&typeof _.on==="function",F3=Symbol.for("signal-exit emitter"),W3=globalThis,pK=Object.defineProperty.bind(Object);class r7{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(W3[F3])return W3[F3];pK(W3,F3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(_,$){this.listeners[_].push($)}removeListener(_,$){let q=this.listeners[_],Z=q.indexOf($);if(Z===-1)return;if(Z===0&&q.length===1)q.length=0;else q.splice(Z,1)}emit(_,$,q){if(this.emitted[_])return!1;this.emitted[_]=!0;let Z=!1;for(let Q of this.listeners[_])Z=Q($,q)===!0||Z;if(_==="exit")Z=this.emit("afterExit",$,q)||Z;return Z}}class L3{}var lK=(_)=>{return{onExit($,q){return _.onExit($,q)},load(){return _.load()},unload(){return _.unload()}}};class t7 extends L3{onExit(){return()=>{}}load(){}unload(){}}class s7 extends L3{#Z=z3.platform==="win32"?"SIGINT":"SIGHUP";#$=new r7;#_;#q;#Y;#J={};#Q=!1;constructor(_){super();this.#_=_,this.#J={};for(let $ of k0)this.#J[$]=()=>{let q=this.#_.listeners($),{count:Z}=this.#$,Q=_;if(typeof Q.__signal_exit_emitter__==="object"&&typeof Q.__signal_exit_emitter__.count==="number")Z+=Q.__signal_exit_emitter__.count;if(q.length===Z){this.unload();let X=this.#$.emit("exit",null,$),J=$==="SIGHUP"?this.#Z:$;if(!X)_.kill(_.pid,J)}};this.#Y=_.reallyExit,this.#q=_.emit}onExit(_,$){if(!k2(this.#_))return()=>{};if(this.#Q===!1)this.load();let q=$?.alwaysLast?"afterExit":"exit";return this.#$.on(q,_),()=>{if(this.#$.removeListener(q,_),this.#$.listeners.exit.length===0&&this.#$.listeners.afterExit.length===0)this.unload()}}load(){if(this.#Q)return;this.#Q=!0,this.#$.count+=1;for(let _ of k0)try{let $=this.#J[_];if($)this.#_.on(_,$)}catch($){}this.#_.emit=(_,...$)=>{return this.#X(_,...$)},this.#_.reallyExit=(_)=>{return this.#K(_)}}unload(){if(!this.#Q)return;this.#Q=!1,k0.forEach((_)=>{let $=this.#J[_];if(!$)throw new Error("Listener not defined for signal: "+_);try{this.#_.removeListener(_,$)}catch(q){}}),this.#_.emit=this.#q,this.#_.reallyExit=this.#Y,this.#$.count-=1}#K(_){if(!k2(this.#_))return 0;return this.#_.exitCode=_||0,this.#$.emit("exit",this.#_.exitCode,null),this.#Y.call(this.#_,this.#_.exitCode)}#X(_,...$){let q=this.#q;if(_==="exit"&&k2(this.#_)){if(typeof $[0]==="number")this.#_.exitCode=$[0];let Z=q.call(this.#_,_,...$);return this.#$.emit("exit",this.#_.exitCode,null),Z}else return q.call(this.#_,_,...$)}}var z3=globalThis.process,{onExit:e7,load:Uj,unload:Fj}=lK(k2(z3)?new s7(z3):new t7);var _$=(_,{cleanup:$,detached:q},{signal:Z})=>{if(!$||q)return;let Q=e7(()=>{_.kill()});aK(Z,()=>{Q()})};var q$=({source:_,sourcePromise:$,boundOptions:q,createNested:Z},...Q)=>{let X=h1(),{destination:J,destinationStream:Y,destinationError:K,from:H,unpipeSignal:V}=iK(q,Z,Q),{sourceStream:G,sourceError:U}=oK(_,H),{options:F,fileDescriptors:W}=t.get(_);return{sourcePromise:$,sourceStream:G,sourceOptions:F,sourceError:U,destination:J,destinationStream:Y,destinationError:K,unpipeSignal:V,fileDescriptors:W,startTime:X}},iK=(_,$,q)=>{try{let{destination:Z,pipeOptions:{from:Q,to:X,unpipeSignal:J}={}}=nK(_,$,...q),Y=n1(Z,X);return{destination:Z,destinationStream:Y,from:Q,unpipeSignal:J}}catch(Z){return{destinationError:Z}}},nK=(_,$,q,...Z)=>{if(Array.isArray(q))return{destination:$($$,_)(q,...Z),pipeOptions:_};if(typeof q==="string"||q instanceof URL||B6(q)){if(Object.keys(_).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[Q,X,J]=C1(q,...Z);return{destination:$($$)(Q,X,J),pipeOptions:J}}if(t.has(q)){if(Object.keys(_).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:q,pipeOptions:Z[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${q}`)},$$=({options:_})=>({options:{..._,stdin:"pipe",piped:!0}}),oK=(_,$)=>{try{return{sourceStream:m0(_,$)}}catch(q){return{sourceError:q}}};var Q$=({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z,fileDescriptors:Q,sourceOptions:X,startTime:J})=>{let Y=rK({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z});if(Y!==void 0)throw R3({error:Y,fileDescriptors:Q,sourceOptions:X,startTime:J})},rK=({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z})=>{if($!==void 0&&Z!==void 0)return Z;if(Z!==void 0)return U3(_),Z;if($!==void 0)return G3(q),$},R3=({error:_,fileDescriptors:$,sourceOptions:q,startTime:Z})=>p0({error:_,command:Z$,escapedCommand:Z$,fileDescriptors:$,options:q,startTime:Z,isSync:!1}),Z$="source.pipe(destination)";var X$=async(_)=>{let[{status:$,reason:q,value:Z=q},{status:Q,reason:X,value:J=X}]=await _;if(!J.pipedFrom.includes(Z))J.pipedFrom.push(Z);if(Q==="rejected")throw J;if($==="rejected")throw Z;return J};import{finished as tK}from"node:stream/promises";var J$=(_,$,q)=>{let Z=I2.has($)?eK(_,$):sK(_,$);return M0(_,$H,q.signal),M0($,qH,q.signal),_H($),Z},sK=(_,$)=>{let q=T0([_]);return i0(q,$),I2.set($,q),q},eK=(_,$)=>{let q=I2.get($);return q.add(_),q},_H=async(_)=>{try{await tK(_,{cleanup:!0,readable:!1,writable:!0})}catch{}I2.delete(_)},I2=new WeakMap,$H=2,qH=1;import{aborted as ZH}from"node:util";var Y$=(_,$)=>_===void 0?[]:[QH(_,$)],QH=async(_,{sourceStream:$,mergedStream:q,fileDescriptors:Z,sourceOptions:Q,startTime:X})=>{await ZH(_,$),await q.remove($);let J=new Error("Pipe canceled by `unpipeSignal` option.");throw R3({error:J,fileDescriptors:Z,sourceOptions:Q,startTime:X})};var O2=(_,...$)=>{if(I($[0]))return O2.bind(void 0,{..._,boundOptions:{..._.boundOptions,...$[0]}});let{destination:q,...Z}=q$(_,...$),Q=XH({...Z,destination:q});return Q.pipe=O2.bind(void 0,{..._,source:q,sourcePromise:Q,boundOptions:{}}),Q},XH=async({sourcePromise:_,sourceStream:$,sourceOptions:q,sourceError:Z,destination:Q,destinationStream:X,destinationError:J,unpipeSignal:Y,fileDescriptors:K,startTime:H})=>{let V=JH(_,Q);Q$({sourceStream:$,sourceError:Z,destinationStream:X,destinationError:J,fileDescriptors:K,sourceOptions:q,startTime:H});let G=new AbortController;try{let U=J$($,X,G);return await Promise.race([X$(V),...Y$(Y,{sourceStream:$,mergedStream:U,sourceOptions:q,fileDescriptors:K,startTime:H})])}finally{G.abort()}},JH=(_,$)=>Promise.allSettled([_,$]);import{setImmediate as UH}from"node:timers/promises";import{on as YH}from"node:events";import{getDefaultHighWaterMark as KH}from"node:stream";var E2=({subprocessStdout:_,subprocess:$,binary:q,shouldEncode:Z,encoding:Q,preserveNewlines:X})=>{let J=new AbortController;return HH($,J),H$({stream:_,controller:J,binary:q,shouldEncode:!_.readableObjectMode&&Z,encoding:Q,shouldSplit:!_.readableObjectMode,preserveNewlines:X})},HH=async(_,$)=>{try{await _}catch{}finally{$.abort()}},D3=({stream:_,onStreamEnd:$,lines:q,encoding:Z,stripFinalNewline:Q,allMixed:X})=>{let J=new AbortController;BH($,J,_);let Y=_.readableObjectMode&&!X;return H$({stream:_,controller:J,binary:Z==="buffer",shouldEncode:!Y,encoding:Z,shouldSplit:!Y&&q,preserveNewlines:!Q})},BH=async(_,$,q)=>{try{await _}catch{q.destroy()}finally{$.abort()}},H$=({stream:_,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J})=>{let Y=YH(_,"data",{signal:$.signal,highWaterMark:K$,highWatermark:K$});return VH({onStdoutChunk:Y,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J})},j3=KH(!0),K$=j3,VH=async function*({onStdoutChunk:_,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J}){let Y=GH({binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J});try{for await(let[K]of _)yield*C0(K,Y,0)}catch(K){if(!$.signal.aborted)throw K}finally{yield*H1(Y)}},GH=({binary:_,shouldEncode:$,encoding:q,shouldSplit:Z,preserveNewlines:Q})=>[A2(_,q,!$),j2(_,Q,!Z,{})].filter(Boolean);var B$=async({stream:_,onStreamEnd:$,fdNumber:q,encoding:Z,buffer:Q,maxBuffer:X,lines:J,allMixed:Y,stripFinalNewline:K,verboseInfo:H,streamInfo:V})=>{let G=FH({stream:_,onStreamEnd:$,fdNumber:q,encoding:Z,allMixed:Y,verboseInfo:H,streamInfo:V});if(!Q){await Promise.all([WH(_),G]);return}let U=_3(K,q),F=D3({stream:_,onStreamEnd:$,lines:J,encoding:Z,stripFinalNewline:U,allMixed:Y}),[W]=await Promise.all([zH({stream:_,iterable:F,fdNumber:q,encoding:Z,maxBuffer:X,lines:J}),G]);return W},FH=async({stream:_,onStreamEnd:$,fdNumber:q,encoding:Z,allMixed:Q,verboseInfo:X,streamInfo:{fileDescriptors:J}})=>{if(!w2({stdioItems:J[q]?.stdioItems,encoding:Z,verboseInfo:X,fdNumber:q}))return;let Y=D3({stream:_,onStreamEnd:$,lines:!0,encoding:Z,stripFinalNewline:!0,allMixed:Q});await L7(Y,_,q,X)},WH=async(_)=>{if(await UH(),_.readableFlowing===null)_.resume()},zH=async({stream:_,stream:{readableObjectMode:$},iterable:q,fdNumber:Z,encoding:Q,maxBuffer:X,lines:J})=>{try{if($||J)return await B2(q,{maxBuffer:X});if(Q==="buffer")return new Uint8Array(await V2(q,{maxBuffer:X}));return await U2(q,{maxBuffer:X})}catch(Y){return V$(L_({error:Y,stream:_,readableObjectMode:$,lines:J,encoding:Q,fdNumber:Z}))}},A3=async(_)=>{try{return await _}catch($){return V$($)}},V$=({bufferedData:_})=>O5(_)?new Uint8Array(_):_;import{finished as LH}from"node:stream/promises";var U1=async(_,$,q,{isSameDirection:Z,stopOnExit:Q=!1}={})=>{let X=RH(_,q),J=new AbortController;try{await Promise.race([...Q?[q.exitPromise]:[],LH(_,{cleanup:!0,signal:J.signal})])}catch(Y){if(!X.stdinCleanedUp)AH(Y,$,q,Z)}finally{J.abort()}},RH=(_,{originalStreams:[$],subprocess:q})=>{let Z={stdinCleanedUp:!1};if(_===$)DH(_,q,Z);return Z},DH=(_,$,q)=>{let{_destroy:Z}=_;_._destroy=(...Q)=>{jH($,q),Z.call(_,...Q)}},jH=({exitCode:_,signalCode:$},q)=>{if(_!==null||$!==null)q.stdinCleanedUp=!0},AH=(_,$,q,Z)=>{if(!MH(_,$,q,Z))throw _},MH=(_,$,q,Z=!0)=>{if(q.propagating)return G$(_)||N2(_);return q.propagating=!0,M3(q,$)===Z?G$(_):N2(_)},M3=({fileDescriptors:_},$)=>$!=="all"&&_[$].direction==="input",N2=(_)=>_?.code==="ERR_STREAM_PREMATURE_CLOSE",G$=(_)=>_?.code==="EPIPE";var U$=({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})=>_.stdio.map((K,H)=>P3({stream:K,fdNumber:H,encoding:$,buffer:q[H],maxBuffer:Z[H],lines:Q[H],allMixed:!1,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})),P3=async({stream:_,fdNumber:$,encoding:q,buffer:Z,maxBuffer:Q,lines:X,allMixed:J,stripFinalNewline:Y,verboseInfo:K,streamInfo:H})=>{if(!_)return;let V=U1(_,$,H);if(M3(H,$)){await V;return}let[G]=await Promise.all([B$({stream:_,onStreamEnd:V,fdNumber:$,encoding:q,buffer:Z,maxBuffer:Q,lines:X,allMixed:J,stripFinalNewline:Y,verboseInfo:K,streamInfo:H}),V]);return G};var F$=({stdout:_,stderr:$},{all:q})=>q&&(_||$)?T0([_,$].filter(Boolean)):void 0,W$=({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})=>P3({...PH(_,q),fdNumber:"all",encoding:$,maxBuffer:Z[1]+Z[2],lines:Q[1]||Q[2],allMixed:wH(_),stripFinalNewline:X,verboseInfo:J,streamInfo:Y}),PH=({stdout:_,stderr:$,all:q},[,Z,Q])=>{let X=Z||Q;if(!X)return{stream:q,buffer:X};if(!Z)return{stream:$,buffer:X};if(!Q)return{stream:_,buffer:X};return{stream:q,buffer:X}},wH=({all:_,stdout:$,stderr:q})=>_&&$&&q&&$.readableObjectMode!==q.readableObjectMode;import{once as CH}from"node:events";var z$=(_)=>S0(_,"ipc"),L$=(_,$)=>{let q=v1(_);n({type:"ipc",verboseMessage:q,fdNumber:"ipc",verboseInfo:$})};var R$=async({subprocess:_,buffer:$,maxBuffer:q,ipc:Z,ipcOutput:Q,verboseInfo:X})=>{if(!Z)return Q;let J=z$(X),Y=q0($,"ipc"),K=q0(q,"ipc");for await(let H of H3({anyProcess:_,channel:_.channel,isSubprocess:!1,ipc:Z,shouldAwait:!1,reference:!0})){if(Y)R_(_,Q,K),Q.push(H);if(J)L$(H,X)}return Q},D$=async(_,$)=>{return await Promise.allSettled([_]),$};var j$=async({subprocess:_,options:{encoding:$,buffer:q,maxBuffer:Z,lines:Q,timeoutDuration:X,cancelSignal:J,gracefulCancel:Y,forceKillAfterDelay:K,stripFinalNewline:H,ipc:V,ipcInput:G},context:U,verboseInfo:F,fileDescriptors:W,originalStreams:L,onInternalError:A,controller:z})=>{let D=M7(_,U),j={originalStreams:L,fileDescriptors:W,subprocess:_,exitPromise:D,propagating:!1},P=U$({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:H,verboseInfo:F,streamInfo:j}),R=W$({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:H,verboseInfo:F,streamInfo:j}),k=[],y=R$({subprocess:_,buffer:q,maxBuffer:Z,ipc:V,ipcOutput:k,verboseInfo:F}),i=TH(L,_,j),H0=kH(W,j);try{return await Promise.race([Promise.all([{},w7(D),Promise.all(P),R,y,o8(_,G),...i,...H0]),A,IH(_,z),...p8(_,X,U,z),...V8({subprocess:_,cancelSignal:J,gracefulCancel:Y,context:U,controller:z}),...d8({subprocess:_,cancelSignal:J,gracefulCancel:Y,forceKillAfterDelay:K,context:U,controller:z})])}catch(e2){return U.terminationReason??="other",Promise.all([{error:e2},D,Promise.all(P.map((s0)=>A3(s0))),A3(R),D$(y,k),Promise.allSettled(i),Promise.allSettled(H0)])}},TH=(_,$,q)=>_.map((Z,Q)=>Z===$.stdio[Q]?void 0:U1(Z,Q,q)),kH=(_,$)=>_.flatMap(({stdioItems:q},Z)=>q.filter(({value:Q,stream:X=Q})=>a(X,{checkOpen:!1})&&!p(X)).map(({type:Q,value:X,stream:J=X})=>U1(J,Z,$,{isSameDirection:u.has(Q),stopOnExit:Q==="native"}))),IH=async(_,{signal:$})=>{let[q]=await CH(_,"error",{signal:$});throw q};var A$=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),F1=(_,$,q)=>{let Z=_[q];if(!Z.has($))Z.set($,[]);let Q=Z.get($),X=r();return Q.push(X),{resolve:X.resolve.bind(X),promises:Q}},n0=async({resolve:_,promises:$},q)=>{_();let[Z]=await Promise.race([Promise.allSettled([!0,q]),Promise.all([!1,...$])]);return!Z};import{Readable as OH}from"node:stream";import{callbackify as EH}from"node:util";import{finished as M$}from"node:stream/promises";var w3=async(_)=>{if(_===void 0)return;try{await C3(_)}catch{}},P$=async(_)=>{if(_===void 0)return;try{await T3(_)}catch{}},C3=async(_)=>{await M$(_,{cleanup:!0,readable:!1,writable:!0})},T3=async(_)=>{await M$(_,{cleanup:!0,readable:!0,writable:!1})},x2=async(_,$)=>{if(await _,$)throw $},y2=(_,$,q)=>{if(q&&!N2(q))_.destroy(q);else if($)_.destroy()};var w$=({subprocess:_,concurrentStreams:$,encoding:q},{from:Z,binary:Q=!0,preserveNewlines:X=!0}={})=>{let J=Q||S.has(q),{subprocessStdout:Y,waitReadableDestroy:K}=k3(_,Z,$),{readableEncoding:H,readableObjectMode:V,readableHighWaterMark:G}=I3(Y,J),{read:U,onStdoutDataDone:F}=O3({subprocessStdout:Y,subprocess:_,binary:J,encoding:q,preserveNewlines:X}),W=new OH({read:U,destroy:EH(N3.bind(void 0,{subprocessStdout:Y,subprocess:_,waitReadableDestroy:K})),highWaterMark:G,objectMode:V,encoding:H});return E3({subprocessStdout:Y,onStdoutDataDone:F,readable:W,subprocess:_}),W},k3=(_,$,q)=>{let Z=m0(_,$),Q=F1(q,Z,"readableDestroy");return{subprocessStdout:Z,waitReadableDestroy:Q}},I3=({readableEncoding:_,readableObjectMode:$,readableHighWaterMark:q},Z)=>Z?{readableEncoding:_,readableObjectMode:$,readableHighWaterMark:q}:{readableEncoding:_,readableObjectMode:!0,readableHighWaterMark:j3},O3=({subprocessStdout:_,subprocess:$,binary:q,encoding:Z,preserveNewlines:Q})=>{let X=r(),J=E2({subprocessStdout:_,subprocess:$,binary:q,shouldEncode:!q,encoding:Z,preserveNewlines:Q});return{read(){NH(this,J,X)},onStdoutDataDone:X}},NH=async(_,$,q)=>{try{let{value:Z,done:Q}=await $.next();if(Q)q.resolve();else _.push(Z)}catch{}},E3=async({subprocessStdout:_,onStdoutDataDone:$,readable:q,subprocess:Z,subprocessStdin:Q})=>{try{if(await T3(_),await Z,await w3(Q),await $,q.readable)q.push(null)}catch(X){await w3(Q),C$(q,X)}},N3=async({subprocessStdout:_,subprocess:$,waitReadableDestroy:q},Z)=>{if(await n0(q,$))C$(_,Z),await x2($,Z)},C$=(_,$)=>{y2(_,_.readable,$)};import{Writable as xH}from"node:stream";import{callbackify as T$}from"node:util";var k$=({subprocess:_,concurrentStreams:$},{to:q}={})=>{let{subprocessStdin:Z,waitWritableFinal:Q,waitWritableDestroy:X}=x3(_,q,$),J=new xH({...y3(Z,_,Q),destroy:T$(h3.bind(void 0,{subprocessStdin:Z,subprocess:_,waitWritableFinal:Q,waitWritableDestroy:X})),highWaterMark:Z.writableHighWaterMark,objectMode:Z.writableObjectMode});return v3(Z,J),J},x3=(_,$,q)=>{let Z=n1(_,$),Q=F1(q,Z,"writableFinal"),X=F1(q,Z,"writableDestroy");return{subprocessStdin:Z,waitWritableFinal:Q,waitWritableDestroy:X}},y3=(_,$,q)=>({write:yH.bind(void 0,_),final:T$(vH.bind(void 0,_,$,q))}),yH=(_,$,q,Z)=>{if(_.write($,q))Z();else _.once("drain",Z)},vH=async(_,$,q)=>{if(await n0(q,$)){if(_.writable)_.end();await $}},v3=async(_,$,q)=>{try{if(await C3(_),$.writable)$.end()}catch(Z){await P$(q),I$($,Z)}},h3=async({subprocessStdin:_,subprocess:$,waitWritableFinal:q,waitWritableDestroy:Z},Q)=>{if(await n0(q,$),await n0(Z,$))I$(_,Q),await x2($,Q)},I$=(_,$)=>{y2(_,_.writable,$)};import{Duplex as hH}from"node:stream";import{callbackify as SH}from"node:util";var O$=({subprocess:_,concurrentStreams:$,encoding:q},{from:Z,to:Q,binary:X=!0,preserveNewlines:J=!0}={})=>{let Y=X||S.has(q),{subprocessStdout:K,waitReadableDestroy:H}=k3(_,Z,$),{subprocessStdin:V,waitWritableFinal:G,waitWritableDestroy:U}=x3(_,Q,$),{readableEncoding:F,readableObjectMode:W,readableHighWaterMark:L}=I3(K,Y),{read:A,onStdoutDataDone:z}=O3({subprocessStdout:K,subprocess:_,binary:Y,encoding:q,preserveNewlines:J}),D=new hH({read:A,...y3(V,_,G),destroy:SH(bH.bind(void 0,{subprocessStdout:K,subprocessStdin:V,subprocess:_,waitReadableDestroy:H,waitWritableFinal:G,waitWritableDestroy:U})),readableHighWaterMark:L,writableHighWaterMark:V.writableHighWaterMark,readableObjectMode:W,writableObjectMode:V.writableObjectMode,encoding:F});return E3({subprocessStdout:K,onStdoutDataDone:z,readable:D,subprocess:_,subprocessStdin:V}),v3(V,D,K),D},bH=async({subprocessStdout:_,subprocessStdin:$,subprocess:q,waitReadableDestroy:Z,waitWritableFinal:Q,waitWritableDestroy:X},J)=>{await Promise.all([N3({subprocessStdout:_,subprocess:q,waitReadableDestroy:Z},J),h3({subprocessStdin:$,subprocess:q,waitWritableFinal:Q,waitWritableDestroy:X},J)])};var S3=(_,$,{from:q,binary:Z=!1,preserveNewlines:Q=!1}={})=>{let X=Z||S.has($),J=m0(_,q),Y=E2({subprocessStdout:J,subprocess:_,binary:X,shouldEncode:!0,encoding:$,preserveNewlines:Q});return fH(Y,J,_)},fH=async function*(_,$,q){try{yield*_}finally{if($.readable)$.destroy();await q}};var E$=(_,{encoding:$})=>{let q=A$();_.readable=w$.bind(void 0,{subprocess:_,concurrentStreams:q,encoding:$}),_.writable=k$.bind(void 0,{subprocess:_,concurrentStreams:q}),_.duplex=O$.bind(void 0,{subprocess:_,concurrentStreams:q,encoding:$}),_.iterable=S3.bind(void 0,_,$),_[Symbol.asyncIterator]=S3.bind(void 0,_,$,{})};var N$=(_,$)=>{for(let[q,Z]of uH){let Q=Z.value.bind($);Reflect.defineProperty(_,q,{...Z,value:Q})}},gH=(async()=>{})().constructor.prototype,uH=["then","catch","finally"].map((_)=>[_,Reflect.getOwnPropertyDescriptor(gH,_)]);var x$=(_,$,q,Z)=>{let{file:Q,commandArguments:X,command:J,escapedCommand:Y,startTime:K,verboseInfo:H,options:V,fileDescriptors:G}=cH(_,$,q),{subprocess:U,promise:F}=lH({file:Q,commandArguments:X,options:V,startTime:K,verboseInfo:H,command:J,escapedCommand:Y,fileDescriptors:G});return U.pipe=O2.bind(void 0,{source:U,sourcePromise:F,boundOptions:{},createNested:Z}),N$(U,F),t.set(U,{options:V,fileDescriptors:G}),U},cH=(_,$,q)=>{let{command:Z,escapedCommand:Q,startTime:X,verboseInfo:J}=S1(_,$,q),{file:Y,commandArguments:K,options:H}=X2(_,$,q),V=pH(H),G=g7(V,J);return{file:Y,commandArguments:K,command:Z,escapedCommand:Q,startTime:X,verboseInfo:J,options:V,fileDescriptors:G}},pH=({timeout:_,signal:$,...q})=>{if($!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...q,timeoutDuration:_}},lH=({file:_,commandArguments:$,options:q,startTime:Z,verboseInfo:Q,command:X,escapedCommand:J,fileDescriptors:Y})=>{let K;try{K=dH(...J2(_,$,q))}catch(W){return h7({error:W,command:X,escapedCommand:J,fileDescriptors:Y,options:q,startTime:Z,verboseInfo:Q})}let H=new AbortController;mH(Number.POSITIVE_INFINITY,H.signal);let V=[...K.stdio];o7(K,Y,H),_$(K,q,H);let G={},U=r();K.kill=H8.bind(void 0,{kill:K.kill.bind(K),options:q,onInternalError:U,context:G,controller:H}),K.all=F$(K,q),E$(K,q),x7(K,q);let F=aH({subprocess:K,options:q,startTime:Z,verboseInfo:Q,fileDescriptors:Y,originalStreams:V,command:X,escapedCommand:J,context:G,onInternalError:U,controller:H});return{subprocess:K,promise:F}},aH=async({subprocess:_,options:$,startTime:q,verboseInfo:Z,fileDescriptors:Q,originalStreams:X,command:J,escapedCommand:Y,context:K,onInternalError:H,controller:V})=>{let[G,[U,F],W,L,A]=await j$({subprocess:_,options:$,context:K,verboseInfo:Z,fileDescriptors:Q,originalStreams:X,onInternalError:H,controller:V});V.abort(),H.resolve();let z=W.map((P,R)=>X0(P,$,R)),D=X0(L,$,"all"),j=iH({errorInfo:G,exitCode:U,signal:F,stdio:z,all:D,ipcOutput:A,context:K,options:$,command:J,escapedCommand:Y,startTime:q});return l0(j,Z,$)},iH=({errorInfo:_,exitCode:$,signal:q,stdio:Z,all:Q,ipcOutput:X,context:J,options:Y,command:K,escapedCommand:H,startTime:V})=>("error"in _)?K1({error:_.error,command:K,escapedCommand:H,timedOut:J.terminationReason==="timeout",isCanceled:J.terminationReason==="cancel"||J.terminationReason==="gracefulCancel",isGracefullyCanceled:J.terminationReason==="gracefulCancel",isMaxBuffer:_.error instanceof Z0,isForcefullyTerminated:J.isForcefullyTerminated,exitCode:$,signal:q,stdio:Z,all:Q,ipcOutput:X,options:Y,startTime:V,isSync:!1}):W2({command:K,escapedCommand:H,stdio:Z,all:Q,ipcOutput:X,options:Y,startTime:V});var v2=(_,$)=>{let q=Object.fromEntries(Object.entries($).map(([Z,Q])=>[Z,nH(Z,_[Z],Q)]));return{..._,...q}},nH=(_,$,q)=>{if(oH.has(_)&&I($)&&I(q))return{...$,...q};return q},oH=new Set(["env",...z6]);var U0=(_,$,q,Z)=>{let Q=(J,Y,K)=>U0(J,Y,q,K),X=(...J)=>rH({mapArguments:_,deepOptions:q,boundOptions:$,setBoundExeca:Z,createNested:Q},...J);if(Z!==void 0)Z(X,Q,$);return X},rH=({mapArguments:_,deepOptions:$={},boundOptions:q={},setBoundExeca:Z,createNested:Q},X,...J)=>{if(I(X))return Q(_,v2(q,X),Z);let{file:Y,commandArguments:K,options:H,isSync:V}=tH({mapArguments:_,firstArgument:X,nextArguments:J,deepOptions:$,boundOptions:q});return V?T7(Y,K,H):x$(Y,K,H,Q)},tH=({mapArguments:_,firstArgument:$,nextArguments:q,deepOptions:Z,boundOptions:Q})=>{let X=h5($)?S5($,q):[$,...q],[J,Y,K]=C1(...X),H=v2(v2(Z,Q),K),{file:V=J,commandArguments:G=Y,options:U=H,isSync:F=!1}=_({file:J,commandArguments:Y,options:H});return{file:V,commandArguments:G,options:U,isSync:F}};var y$=({file:_,commandArguments:$})=>h$(_,$),v$=({file:_,commandArguments:$})=>({...h$(_,$),isSync:!0}),h$=(_,$)=>{if($.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${_} ${$}.`);let[q,...Z]=sH(_);return{file:q,commandArguments:Z}},sH=(_)=>{if(typeof _!=="string")throw new TypeError(`The command must be a string: ${String(_)}.`);let $=_.trim();if($==="")return[];let q=[];for(let Z of $.split(eH)){let Q=q.at(-1);if(Q&&Q.endsWith("\\"))q[q.length-1]=`${Q.slice(0,-1)} ${Z}`;else q.push(Z)}return q},eH=/ +/g;var S$=(_,$,q)=>{_.sync=$(_B,q),_.s=_.sync},b$=({options:_})=>f$(_),_B=({options:_})=>({...f$(_),isSync:!0}),f$=(_)=>({options:{...$B(_),..._}}),$B=({input:_,inputFile:$,stdio:q})=>_===void 0&&$===void 0&&q===void 0?{stdin:"inherit"}:{},g$={preferLocal:!0};var N=U0(()=>({})),x=U0(()=>({isSync:!0})),ZP=U0(y$),QP=U0(v$),XP=U0(a8),JP=U0(b$,{},g$,S$),{sendMessage:YP,getOneMessage:KP,getEachMessage:HP,getCancelSignal:BP}=y7();var h2=(_)=>{if(_.code==="ENOENT")throw new Error("Couldn't find the `termux-api` scripts. You can install them with: apt install termux-api");throw _},qB={async copy(_){try{await N("termux-clipboard-set",_)}catch($){h2($)}},async paste(_){try{let{stdout:$}=await N("termux-clipboard-get",_);return $}catch($){h2($)}},copySync(_){try{x("termux-clipboard-set",_)}catch($){h2($)}},pasteSync(_){try{return x("termux-clipboard-get",_).stdout}catch($){h2($)}}},u$=qB;import l$ from"node:path";import{fileURLToPath as ZB}from"node:url";var QB=l$.dirname(ZB(import.meta.url)),a$="xsel",i$=l$.join(QB,"../fallbacks/linux/xsel"),m$=["--clipboard","--input"],d$=["--clipboard","--output"],n$=(_,$)=>{let q=_.code==="ENOENT"?"Couldn't find the `xsel` binary and fallback didn't work. On Debian/Ubuntu you can install xsel with: sudo apt install xsel":"Both xsel and fallback failed",Z=new Error(q);if(_.code!=="ENOENT")Z.xselError=_;return Z.fallbackError=$,Z},c$=async(_,$)=>{try{let{stdout:q}=await N(a$,_,$);return q}catch(q){try{let{stdout:Z}=await N(i$,_,$);return Z}catch(Z){throw n$(q,Z)}}},p$=(_,$)=>{try{return x(a$,_,$).stdout}catch(q){try{return x(i$,_,$).stdout}catch(Z){throw n$(q,Z)}}},XB={async copy(_){await c$(m$,_)},copySync(_){p$(m$,_)},paste:(_)=>c$(d$,_),pasteSync:(_)=>p$(d$,_)},I0=XB;var S2=["--type","text/plain"],t$=(_,$)=>{if($.code==="ENOENT")return new Error(`Couldn't find the \`${_}\` binary. On Debian/Ubuntu you can install wl-clipboard with: sudo apt install wl-clipboard`);return new Error(`Command \`${_}\` failed: ${$.message}`)},o$=async(_,$,q,Z)=>{try{return(await N(_,$,q)).stdout}catch(Q){if(_==="wl-paste"&&/nothing is copied|no selection|selection owner/i.test(Q.stderr||""))return"";if(Q.code==="ENOENT"||/wayland|wayland_display|failed to connect|display/i.test(Q.stderr||""))return Z(q);throw t$(_,Q)}},r$=(_,$,q,Z)=>{try{return x(_,$,q).stdout}catch(Q){if(_==="wl-paste"&&/nothing is copied|no selection|selection owner/i.test(Q.stderr||""))return"";if(Q.code==="ENOENT"||/wayland|wayland_display|failed to connect|display/i.test(Q.stderr||""))return Z(q);throw t$(_,Q)}},JB={async copy(_){await o$("wl-copy",S2,_,I0.copy)},copySync(_){r$("wl-copy",S2,_,I0.copySync)},async paste(_){return o$("wl-paste",[...S2,"--no-newline"],_,I0.paste)},pasteSync(_){return r$("wl-paste",[...S2,"--no-newline"],_,I0.pasteSync)}},s$=JB;var b2={LC_CTYPE:"UTF-8"},YB={copy:async(_)=>N("pbcopy",{..._,env:b2}),async paste(_){let{stdout:$}=await N("pbpaste",{..._,env:b2});return $},copySync:(_)=>x("pbcopy",{..._,env:b2}),pasteSync:(_)=>x("pbpaste",{..._,env:b2}).stdout},e$=YB;import{Buffer as VB}from"node:buffer";import Jq from"node:path";import{fileURLToPath as GB}from"node:url";import{promisify as KB}from"node:util";import HB from"node:process";import W1 from"node:child_process";var TP=KB(W1.execFile);function _q(){let{arch:_,platform:$,env:q}=HB;if($==="darwin"&&_==="x64")return W1.execFileSync("sysctl",["-inq","sysctl.proc_translated"],{encoding:"utf8"}).trim()==="1"?"arm64":"x64";if(_==="arm64"||_==="x64")return _;if($==="win32"&&Object.hasOwn(q,"PROCESSOR_ARCHITEW6432"))return"x64";if($==="linux"){if(W1.execFileSync("getconf",["LONG_BIT"],{encoding:"utf8"}).trim()==="64")return"x64"}return _}var BB=new Set(["arm64","x64","ppc64","riscv64"]);function $q(){return BB.has(_q())}var UB=Jq.dirname(GB(import.meta.url)),FB=$q()?"x86_64":"i686",f2=Jq.join(UB,`../fallbacks/windows/clipboard_${FB}.exe`),g2="powershell.exe",WB=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass"],u2=(_)=>{let $=VB.from(_,"utf16le").toString("base64");return[...WB,"-EncodedCommand",$]},qq=`
|
|
49
49
|
try {
|
|
50
50
|
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
|
|
51
51
|
$input = [Console]::In.ReadToEnd()
|
|
@@ -55,7 +55,7 @@ try {
|
|
|
55
55
|
Write-Error "Failed to set clipboard: $($_.Exception.Message)"
|
|
56
56
|
exit 1
|
|
57
57
|
}
|
|
58
|
-
`.trim(),
|
|
58
|
+
`.trim(),Zq=`
|
|
59
59
|
try {
|
|
60
60
|
$content = Get-Clipboard -Raw -ErrorAction Stop
|
|
61
61
|
if ($content -eq $null) { $content = '' }
|
|
@@ -65,7 +65,7 @@ try {
|
|
|
65
65
|
Write-Error "Failed to get clipboard: $($_.Exception.Message)"
|
|
66
66
|
exit 1
|
|
67
67
|
}
|
|
68
|
-
`.trim(),
|
|
68
|
+
`.trim(),Qq=async(_,$)=>{try{return await _()}catch{return $()}},Xq=(_,$)=>{try{return _()}catch{return $()}},zB={copy:async(_)=>Qq(async()=>N(g2,u2(qq),_),async()=>N(f2,["--copy"],_)),async paste(_){let{stdout:$}=await Qq(async()=>N(g2,u2(Zq),_),async()=>N(f2,["--paste"],_));return $},copySync:(_)=>Xq(()=>x(g2,u2(qq),_),()=>x(f2,["--copy"],_)),pasteSync:(_)=>Xq(()=>x(g2,u2(Zq),_),()=>x(f2,["--paste"],_)).stdout},b3=zB;var m2=(()=>{switch(Yq.platform){case"darwin":return e$;case"win32":return b3;case"android":{if(Yq.env.TERMUX_VERSION===void 0)throw new Error("You need to install Termux for this module to work on Android: https://termux.com");return u$}default:{if(k5)return b3;if(H6())return s$;return I0}}})(),LB={async write(_){if(typeof _!=="string")throw new TypeError(`Expected a string, got ${typeof _}`);await m2.copy({input:_})},async read(){return m2.paste({stripFinalNewline:!1})},writeSync(_){if(typeof _!=="string")throw new TypeError(`Expected a string, got ${typeof _}`);m2.copySync({input:_})},readSync(){return m2.pasteSync({stripFinalNewline:!1})}},Kq=LB;import*as c2 from"cheerio";var d2={MIN_CONTENT_LENGTH:200,MIN_PARAGRAPH_LENGTH:50,MAX_LINK_TEXT_RATIO:0.5,READING_WORDS_PER_MINUTE:200},RB=[{selector:"article",score:100},{selector:"[role='main']",score:95},{selector:"main",score:90},{selector:".post-content",score:85},{selector:".entry-content",score:85},{selector:".article-content",score:85},{selector:".content-body",score:80},{selector:"#content",score:75},{selector:".content",score:70},{selector:".post",score:65},{selector:".markdown-body",score:90},{selector:"[itemprop='articleBody']",score:95}],DB=["script","style","noscript","iframe","nav","header:not(article header)","footer:not(article footer)","aside",".advertisement",".ad",".ads",".social-share",".comments",".related-posts",".sidebar","[role='navigation']","[role='banner']","[role='complementary']","[class*='cookie']","[id*='cookie']","[class*='popup']","[class*='modal']","[class*='newsletter']",".hidden","[hidden]","[aria-hidden='true']"].join(", ");function f3(_){if(!_||typeof _!=="string"||_.trim().length===0||!_.includes("<"))throw new Error("Invalid or empty HTML")}function Hq(_,$){let q=0,Q=$.text().trim().length;if(Q<d2.MIN_CONTENT_LENGTH)return 0;if(q+=Math.min(Q/10,100),q+=$.find("p").length*5,(Q>0?$.find("a").text().length/Q:0)>d2.MAX_LINK_TEXT_RATIO)q-=50;if($.find("h1,h2,h3").length>0)q+=10;if($.find("p").length>3)q+=10;if($.find("blockquote").length>0)q+=5;if($.find("ul,ol").length>0)q+=5;if($.find(".comments,.comment").length>0)q-=20;if($.find("form").length>2)q-=15;return q}function jB(_){let $=null,q=0;for(let{selector:Z,score:Q}of RB)_(Z).each((X,J)=>{let Y=_(J),K=Hq(_,Y)+Q;if(K>q)q=K,$=Y});if(!$||q<100)_("div").each((Z,Q)=>{let X=_(Q),J=Hq(_,X);if(J>q)q=J,$=X});return $}function Vq(_){return _.replace(/[\x00-\x1F\x7F-\x9F\uFFFD\uFEFF\u200B-\u200D\u2060]/g,"").replace(/’/g,"'").replace(/“/g,'"').replace(/â€\x9D/g,'"').replace(/â€"/g,"—").replace(/â€\x93/g,"–").replace(/ /g," ").replace(/â¢/g,"•").replace(/é/g,"é").replace(/á/g,"á").replace(/Ã/g,"í").replace(/ó/g,"ó").replace(/ú/g,"ú").replace(/ñ/g,"ñ").replace(/Ã\x87/g,"Ç").replace(/[^\x00-\x7F\u00A0-\uFFFF]/g,"").replace(/[ \t\r\f]+/g," ").replace(/\n{3,}/g,`
|
|
69
69
|
|
|
70
70
|
`).replace(/ +\n/g,`
|
|
71
71
|
`).replace(/\n +/g,`
|
|
@@ -75,7 +75,7 @@ try {
|
|
|
75
75
|
|
|
76
76
|
`).replace(/\n{3,}/g,`
|
|
77
77
|
|
|
78
|
-
`).replace(/^\n+|\n+$/g,"").trim()}function
|
|
78
|
+
`).replace(/^\n+|\n+$/g,"").trim()}function Bq(_,$){let q=$.clone();return q.find("h1,h2,h3,h4,h5,h6").each((Z,Q)=>{let X=_(Q);if(X.text().trim())X.before(`
|
|
79
79
|
|
|
80
80
|
`).after(`
|
|
81
81
|
|
|
@@ -86,23 +86,23 @@ try {
|
|
|
86
86
|
`)}),q.find("div,blockquote,pre,ul,ol,dl").each((Z,Q)=>{let X=_(Q);if(X.text().trim())X.before(`
|
|
87
87
|
`).after(`
|
|
88
88
|
`)}),q.find("li").each((Z,Q)=>{let X=_(Q);if(X.text().trim())X.prepend("• ").before(`
|
|
89
|
-
`)}),Jq(q.text())}function S3(_){h3(_);let $=m2.load(_);$(zB).remove();let q=LB($),Z=q?.length?Xq($,q):Xq($,$("body"));if(Z.length<u2.MIN_CONTENT_LENGTH)Z=Jq($("body").text());return Z}function Yq(_,$){h3(_);let q=m2.load(_),Z=[],Q=new Set;return q("a[href]").each((X,J)=>{let Y=q(J).attr("href")?.trim();if(!Y||Y.startsWith("javascript:")||Q.has(Y))return;let K=q(J).text().trim()||Y;if($&&!Y.startsWith("http"))try{Y=new URL(Y,$).href}catch{return}if(!Y.startsWith("http"))return;Q.add(Y);let H="external";if($)try{let B=new URL(Y),V=new URL($);if(B.hostname===V.hostname)H="internal"}catch{}if(Y.includes("#"))H="anchor";Z.push({href:Y,text:K,title:q(J).attr("title")?.trim(),rel:q(J).attr("rel")?.trim(),type:H})}),Z}function Kq(_){h3(_);let $=m2.load(_),q=(L)=>$(L).attr("content")?.trim(),Z={};$("meta[property^='og:']").each((L,D)=>{let z=$(D).attr("property")?.replace("og:",""),j=$(D).attr("content");if(z&&j)Z[z]=j.trim()});let Q={};$("meta[name^='twitter:']").each((L,D)=>{let z=$(D).attr("name")?.replace("twitter:",""),j=$(D).attr("content");if(z&&j)Q[z]=j.trim()});let X=[];$("script[type='application/ld+json']").each((L,D)=>{try{X.push(JSON.parse($(D).html()||"{}"))}catch{}});let J=(q("meta[name='keywords']")||"").split(",").map((L)=>L.trim()).filter(Boolean),Y=$("title").first().text().trim()||Z.title||q("meta[property='og:title']")||$("h1").first().text().trim()||"",K=q("meta[name='description']")||Z.description||q("meta[property='og:description']")||"",H=q("meta[name='author']")||q("meta[property='article:author']")||$("[rel='author']").text().trim(),B=q("meta[property='article:published_time']")||$("time[datetime]").first().attr("datetime"),V=q("meta[property='article:modified_time']"),G=S3(_).split(/\s+/).filter(Boolean).length,W=Math.max(1,Math.ceil(G/u2.READING_WORDS_PER_MINUTE));return{title:Y,description:K,keywords:J,language:$("html").attr("lang")||q("meta[name='language']"),author:H,publishDate:B,modifiedDate:V,publisher:Z.site_name,og:Z,twitter:Q,structuredData:X.length>0?X:void 0,siteName:Z.site_name||q("meta[property='og:site_name']"),type:Z.type||"website",url:Z.url||$("link[rel='canonical']").attr("href"),image:Z.image||q("meta[name='twitter:image']"),canonical:$("link[rel='canonical']").attr("href"),robots:q("meta[name='robots']"),viewport:q("meta[name='viewport']"),wordCount:G,readingTime:W}}async function RB(_){let q=(_.headers.get("content-type")||"").match(/charset=([^;]+)/i),Z=q?q[1]?.toLowerCase().trim()??null:null;try{let Q=await _.arrayBuffer(),X=new Uint8Array(Q),J=Z;if(!J&&X.length>0){let H=new TextDecoder("utf-8",{fatal:!1}).decode(X.slice(0,Math.min(512,X.length))),B=H.match(/<meta[^>]*charset[=\s]*["']?([^"'\s>]+)/i);if(B)J=B[1]?.toLowerCase().trim()??null;else{let V=H.match(/<meta[^>]*http-equiv[=\s]*["']?content-type["']?[^>]*content[=\s]*["']?[^"']*charset[=\s]*([^"'\s;]+)/i);if(V)J=V[1]?.toLowerCase().trim()??null}}if(!J)J="utf-8";let Y=DB(J);try{let H=new TextDecoder(Y,{fatal:!1}).decode(X);return b3(H)}catch{let H=new TextDecoder("utf-8",{fatal:!1}).decode(X);return b3(H)}}catch{let Q=await _.text();return b3(Q)}}function DB(_){let $=_.toLowerCase().replace(/[-_\s]/g,"");return{iso88591:"iso-8859-1",latin1:"iso-8859-1",utf8:"utf-8",windows1252:"windows-1252",cp1252:"windows-1252",ascii:"us-ascii",usascii:"us-ascii",gb2312:"gb18030",gbk:"gb18030"}[$]||_}function b3(_){return _.replace(/\x00/g,"").replace(/\x7F/g,"").replace(/[\x01-\x08\x0B\x0C\x0E-\x1F]/g,"").replace(/\uFFFD/g,"").replace(/\uFEFF/g,"").replace(/[\u200B-\u200D\u2060]/g,"").replace(/’/g,"'").replace(/“/g,'"').replace(/â€\x9D/g,'"').replace(/â€"/g,"—").replace(/â€\x93/g,"–").replace(/ /g," ").replace(/â¢/g,"•").replace(/é/g,"é").replace(/á/g,"á").replace(/Ã/g,"í").replace(/ó/g,"ó").replace(/ú/gu,"ú").replace(/ñ/g,"ñ").replace(/Ã\x87/g,"Ç").replace(/[^\x00-\x7F\u00A0-\uFFFF]/g,"")}var Z0={SIMPLE_FETCH_TIMEOUT:30000,FULL_RENDER_TIMEOUT:60000,PAGE_LOAD_TIMEOUT:45000,MAX_CONTENT_SIZE:52428800,MAX_REDIRECTS:10,MAX_RETRIES:3,RETRY_DELAY:1000,USER_AGENTS:["glance-cli/1.0[](https://github.com/jkenley/glance-cli)","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"],VALID_CONTENT_TYPES:["text/html","application/xhtml+xml","application/xml","text/plain"]};class k extends Error{code;userMessage;recoverable;hint;statusCode;constructor(_,$,q,Z=!1,Q,X){super(_);this.code=$;this.userMessage=q;this.recoverable=Z;this.hint=Q;this.statusCode=X;this.name="FetchError"}}function jB(_){if(!_||typeof _!=="string")throw new k("Invalid URL: empty or not a string","INVALID_URL","Invalid URL provided",!1,"URL must be a non-empty string starting with http:// or https://");try{let $=new URL(_);if(!["http:","https:"].includes($.protocol))throw new k(`Invalid protocol: ${$.protocol}`,"INVALID_PROTOCOL","Invalid URL protocol",!1,"URL must start with http:// or https://")}catch($){if($ instanceof k)throw $;throw new k(`Malformed URL: ${$.message}`,"MALFORMED_URL","Invalid URL format",!1,"URL must be properly formatted (e.g., https://example.com)")}}function kB(_){if(!_)return;let $=_.split(";")[0]?.trim().toLowerCase()||"";if(!Z0.VALID_CONTENT_TYPES.some((q)=>$.includes(q)))throw new k(`Invalid content type: ${_}`,"INVALID_CONTENT_TYPE","Page is not HTML",!1,`Expected HTML but got ${$}. This URL may point to a file download or API endpoint.`)}function f3(_,$){if(_>$){let q=(_/1024/1024).toFixed(1),Z=($/1024/1024).toFixed(1);throw new k(`Content too large: ${q}MB`,"CONTENT_TOO_LARGE","Page is too large",!1,`Page size (${q}MB) exceeds maximum (${Z}MB).`)}}function g3(_){if(_)return _;return Z0.USER_AGENTS[0]}async function AB(_,$){let q=new AbortController,Z=setTimeout(()=>q.abort(),$.timeout);try{let Q=await fetch(_,{headers:{"User-Agent":g3($.userAgent),Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"en-US,en;q=0.9","Accept-Encoding":"gzip, deflate, br","Cache-Control":"no-cache",Pragma:"no-cache"},redirect:$.followRedirects?"follow":"manual",signal:q.signal});if(clearTimeout(Z),!Q.ok){let H=Q.status;if(H===404)throw new k("HTTP 404: Not Found","NOT_FOUND","Page not found",!1,"The URL doesn't exist. Check for typos.",404);if(H===403)throw new k("HTTP 403: Forbidden","FORBIDDEN","Access denied",!1,"The server is blocking access. Try with --full-render.",403);if(H===401)throw new k("HTTP 401: Unauthorized","UNAUTHORIZED","Authentication required",!1,"This page requires login.",401);if(H===429)throw new k("HTTP 429: Too Many Requests","RATE_LIMITED","Rate limited",!0,"The server is rate limiting requests. Wait a moment.",429);if(H>=500)throw new k(`HTTP ${H}: ${Q.statusText}`,"SERVER_ERROR","Server error",!0,"The server is experiencing issues. Try again later.",H);throw new k(`HTTP ${H}: ${Q.statusText}`,"HTTP_ERROR",`HTTP ${H} error`,H>=500,void 0,H)}let X=Q.headers.get("content-type");kB(X);let J=Q.headers.get("content-length");if(J){let H=parseInt(J,10);f3(H,$.maxSize)}let Y=await RB(Q),K=new TextEncoder().encode(Y).length;if(f3(K,$.maxSize),!Y.trim())throw new k("Empty response","EMPTY_RESPONSE","Page is empty",!1,"The server returned an empty page. The URL may be incorrect.");return Y}catch(Q){if(clearTimeout(Z),Q instanceof k)throw Q;if(Q.name==="AbortError")throw new k("Request timeout","TIMEOUT","Request timed out",!0,`Page took too long (>${$.timeout/1000}s).`);if(Q.message?.includes("fetch failed")||Q.cause?.code==="ENOTFOUND")throw new k(Q.message,"DNS_ERROR","Cannot resolve domain",!1,"Check domain and internet connection.");if(Q.cause?.code==="ECONNREFUSED")throw new k(Q.message,"CONNECTION_REFUSED","Connection refused",!1,"The server refused the connection.");if(Q.cause?.code==="ECONNRESET"||Q.message?.includes("socket hang up"))throw new k(Q.message,"CONNECTION_RESET","Connection reset",!0,"The connection was reset.");if(Q.cause?.code==="ETIMEDOUT")throw new k(Q.message,"NETWORK_TIMEOUT","Network timeout",!0,"Network connection timed out.");if(Q.message?.includes("certificate")||Q.cause?.code?.includes("CERT"))throw new k(Q.message,"SSL_ERROR","SSL/TLS error",!1,"Invalid SSL certificate.");throw new k(Q.message,"NETWORK_ERROR","Network error",!0,"A network error occurred.")}}async function PB(_,$,q){let Z,Q;try{Z=await q.default.launch({headless:!0,args:["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage","--disable-accelerated-2d-canvas","--no-first-run","--no-zygote","--disable-gpu","--disable-web-security","--disable-features=IsolateOrigins,site-per-process","--disable-background-timer-throttling","--disable-renderer-backgrounding","--disable-backgrounding-occluded-windows"],timeout:1e4}),Q=await Z.newPage(),await Q.setUserAgent(g3($.userAgent)),await Q.setViewport({width:1920,height:1080,deviceScaleFactor:1}),Q.setDefaultTimeout($.timeout),Q.setDefaultNavigationTimeout(Z0.PAGE_LOAD_TIMEOUT),await Q.goto(_,{waitUntil:$.waitUntil,timeout:Z0.PAGE_LOAD_TIMEOUT});let X=await Q.content(),J=new TextEncoder().encode(X).length;if(f3(J,$.maxSize),!X.trim())throw new k("Empty page","EMPTY_PAGE","Page is empty",!1,"The page rendered but is empty.");return await Q.close(),await Z.close(),X}catch(X){if(Q)await Q.close().catch(()=>{});if(Z)await Z.close().catch(()=>{});if(X instanceof k)throw X;if(X.message?.includes("Could not find")||X.message?.includes("Chromium"))throw new k(X.message,"BROWSER_NOT_FOUND","Chromium not found",!1,"Reinstall: bun install puppeteer");if(X.message?.includes("Failed to launch"))throw new k(X.message,"BROWSER_LAUNCH_FAILED","Failed to launch browser",!1,"Check system resources.");throw new k(X.message,"RENDER_ERROR","Page rendering failed",!0,"Full render failed.")}}async function Hq(_,$,q=1){try{if($.fullRender){let Z=await import("puppeteer");return await PB(_,$,Z)}return await AB(_,$)}catch(Z){if(Z instanceof k&&!Z.recoverable)throw Z;if(q>=$.maxRetries)throw Z;let Q=Z0.RETRY_DELAY*2**(q-1);return await new Promise((X)=>setTimeout(X,Q)),Hq(_,$,q+1)}}async function Bq(_,$={}){jB(_);let q={fullRender:$.fullRender??!1,timeout:$.timeout??($.fullRender?Z0.FULL_RENDER_TIMEOUT:Z0.SIMPLE_FETCH_TIMEOUT),userAgent:$.userAgent??g3(),followRedirects:$.followRedirects??!0,maxSize:$.maxSize??Z0.MAX_CONTENT_SIZE,waitUntil:$.waitUntil??"networkidle2",maxRetries:$.maxRetries??Z0.MAX_RETRIES};return await Hq(_,q)}function V0(_){if(!_||typeof _!=="string")return"";let $=_.split(`
|
|
89
|
+
`)}),Vq(q.text())}function g3(_){f3(_);let $=c2.load(_);$(DB).remove();let q=jB($),Z=q?.length?Bq($,q):Bq($,$("body"));if(Z.length<d2.MIN_CONTENT_LENGTH)Z=Vq($("body").text());return Z}function Gq(_,$){f3(_);let q=c2.load(_),Z=[],Q=new Set;return q("a[href]").each((X,J)=>{let Y=q(J).attr("href")?.trim();if(!Y||Y.startsWith("javascript:")||Q.has(Y))return;let K=q(J).text().trim()||Y;if($&&!Y.startsWith("http"))try{Y=new URL(Y,$).href}catch{return}if(!Y.startsWith("http"))return;Q.add(Y);let H="external";if($)try{let V=new URL(Y),G=new URL($);if(V.hostname===G.hostname)H="internal"}catch{}if(Y.includes("#"))H="anchor";Z.push({href:Y,text:K,title:q(J).attr("title")?.trim(),rel:q(J).attr("rel")?.trim(),type:H})}),Z}function z1(_){f3(_);let $=c2.load(_),q=(L)=>$(L).attr("content")?.trim(),Z={};$("meta[property^='og:']").each((L,A)=>{let z=$(A).attr("property")?.replace("og:",""),D=$(A).attr("content");if(z&&D)Z[z]=D.trim()});let Q={};$("meta[name^='twitter:']").each((L,A)=>{let z=$(A).attr("name")?.replace("twitter:",""),D=$(A).attr("content");if(z&&D)Q[z]=D.trim()});let X=[];$("script[type='application/ld+json']").each((L,A)=>{try{X.push(JSON.parse($(A).html()||"{}"))}catch{}});let J=(q("meta[name='keywords']")||"").split(",").map((L)=>L.trim()).filter(Boolean),Y=$("title").first().text().trim()||Z.title||q("meta[property='og:title']")||$("h1").first().text().trim()||"",K=q("meta[name='description']")||Z.description||q("meta[property='og:description']")||"",H=q("meta[name='author']")||q("meta[property='article:author']")||$("[rel='author']").text().trim(),V=q("meta[property='article:published_time']")||$("time[datetime]").first().attr("datetime"),G=q("meta[property='article:modified_time']"),F=g3(_).split(/\s+/).filter(Boolean).length,W=Math.max(1,Math.ceil(F/d2.READING_WORDS_PER_MINUTE));return{title:Y,description:K,keywords:J,language:$("html").attr("lang")||q("meta[name='language']"),author:H,publishDate:V,modifiedDate:G,publisher:Z.site_name,og:Z,twitter:Q,structuredData:X.length>0?X:void 0,siteName:Z.site_name||q("meta[property='og:site_name']"),type:Z.type||"website",url:Z.url||$("link[rel='canonical']").attr("href"),image:Z.image||q("meta[name='twitter:image']"),canonical:$("link[rel='canonical']").attr("href"),robots:q("meta[name='robots']"),viewport:q("meta[name='viewport']"),wordCount:F,readingTime:W}}async function AB(_){let q=(_.headers.get("content-type")||"").match(/charset=([^;]+)/i),Z=q?q[1]?.toLowerCase().trim()??null:null;try{let Q=await _.arrayBuffer(),X=new Uint8Array(Q),J=Z;if(!J&&X.length>0){let H=new TextDecoder("utf-8",{fatal:!1}).decode(X.slice(0,Math.min(512,X.length))),V=H.match(/<meta[^>]*charset[=\s]*["']?([^"'\s>]+)/i);if(V)J=V[1]?.toLowerCase().trim()??null;else{let G=H.match(/<meta[^>]*http-equiv[=\s]*["']?content-type["']?[^>]*content[=\s]*["']?[^"']*charset[=\s]*([^"'\s;]+)/i);if(G)J=G[1]?.toLowerCase().trim()??null}}if(!J)J="utf-8";let Y=MB(J);try{let H=new TextDecoder(Y,{fatal:!1}).decode(X);return u3(H)}catch{let H=new TextDecoder("utf-8",{fatal:!1}).decode(X);return u3(H)}}catch{let Q=await _.text();return u3(Q)}}function MB(_){let $=_.toLowerCase().replace(/[-_\s]/g,"");return{iso88591:"iso-8859-1",latin1:"iso-8859-1",utf8:"utf-8",windows1252:"windows-1252",cp1252:"windows-1252",ascii:"us-ascii",usascii:"us-ascii",gb2312:"gb18030",gbk:"gb18030"}[$]||_}function u3(_){return _.replace(/\x00/g,"").replace(/\x7F/g,"").replace(/[\x01-\x08\x0B\x0C\x0E-\x1F]/g,"").replace(/\uFFFD/g,"").replace(/\uFEFF/g,"").replace(/[\u200B-\u200D\u2060]/g,"").replace(/’/g,"'").replace(/“/g,'"').replace(/â€\x9D/g,'"').replace(/â€"/g,"—").replace(/â€\x93/g,"–").replace(/ /g," ").replace(/â¢/g,"•").replace(/é/g,"é").replace(/á/g,"á").replace(/Ã/g,"í").replace(/ó/g,"ó").replace(/ú/gu,"ú").replace(/ñ/g,"ñ").replace(/Ã\x87/g,"Ç").replace(/[^\x00-\x7F\u00A0-\uFFFF]/g,"")}var J0={SIMPLE_FETCH_TIMEOUT:30000,FULL_RENDER_TIMEOUT:60000,PAGE_LOAD_TIMEOUT:45000,MAX_CONTENT_SIZE:52428800,MAX_REDIRECTS:10,MAX_RETRIES:3,RETRY_DELAY:1000,USER_AGENTS:["glance-cli/1.0[](https://github.com/jkenley/glance-cli)","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"],VALID_CONTENT_TYPES:["text/html","application/xhtml+xml","application/xml","text/plain"]};class w extends Error{code;userMessage;recoverable;hint;statusCode;constructor(_,$,q,Z=!1,Q,X){super(_);this.code=$;this.userMessage=q;this.recoverable=Z;this.hint=Q;this.statusCode=X;this.name="FetchError"}}function PB(_){if(!_||typeof _!=="string")throw new w("Invalid URL: empty or not a string","INVALID_URL","Invalid URL provided",!1,"URL must be a non-empty string starting with http:// or https://");try{let $=new URL(_);if(!["http:","https:"].includes($.protocol))throw new w(`Invalid protocol: ${$.protocol}`,"INVALID_PROTOCOL","Invalid URL protocol",!1,"URL must start with http:// or https://")}catch($){if($ instanceof w)throw $;throw new w(`Malformed URL: ${$.message}`,"MALFORMED_URL","Invalid URL format",!1,"URL must be properly formatted (e.g., https://example.com)")}}function wB(_){if(!_)return;let $=_.split(";")[0]?.trim().toLowerCase()||"";if(!J0.VALID_CONTENT_TYPES.some((q)=>$.includes(q)))throw new w(`Invalid content type: ${_}`,"INVALID_CONTENT_TYPE","Page is not HTML",!1,`Expected HTML but got ${$}. This URL may point to a file download or API endpoint.`)}function m3(_,$){if(_>$){let q=(_/1024/1024).toFixed(1),Z=($/1024/1024).toFixed(1);throw new w(`Content too large: ${q}MB`,"CONTENT_TOO_LARGE","Page is too large",!1,`Page size (${q}MB) exceeds maximum (${Z}MB).`)}}function d3(_){if(_)return _;return J0.USER_AGENTS[0]}async function CB(_,$){let q=new AbortController,Z=setTimeout(()=>q.abort(),$.timeout);try{let Q=await fetch(_,{headers:{"User-Agent":d3($.userAgent),Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"en-US,en;q=0.9","Accept-Encoding":"gzip, deflate, br","Cache-Control":"no-cache",Pragma:"no-cache"},redirect:$.followRedirects?"follow":"manual",signal:q.signal});if(clearTimeout(Z),!Q.ok){let H=Q.status;if(H===404)throw new w("HTTP 404: Not Found","NOT_FOUND","Page not found",!1,"The URL doesn't exist. Check for typos.",404);if(H===403)throw new w("HTTP 403: Forbidden","FORBIDDEN","Access denied",!1,"The server is blocking access. Try with --full-render.",403);if(H===401)throw new w("HTTP 401: Unauthorized","UNAUTHORIZED","Authentication required",!1,"This page requires login.",401);if(H===429)throw new w("HTTP 429: Too Many Requests","RATE_LIMITED","Rate limited",!0,"The server is rate limiting requests. Wait a moment.",429);if(H>=500)throw new w(`HTTP ${H}: ${Q.statusText}`,"SERVER_ERROR","Server error",!0,"The server is experiencing issues. Try again later.",H);throw new w(`HTTP ${H}: ${Q.statusText}`,"HTTP_ERROR",`HTTP ${H} error`,H>=500,void 0,H)}let X=Q.headers.get("content-type");wB(X);let J=Q.headers.get("content-length");if(J){let H=parseInt(J,10);m3(H,$.maxSize)}let Y=await AB(Q),K=new TextEncoder().encode(Y).length;if(m3(K,$.maxSize),!Y.trim())throw new w("Empty response","EMPTY_RESPONSE","Page is empty",!1,"The server returned an empty page. The URL may be incorrect.");return Y}catch(Q){if(clearTimeout(Z),Q instanceof w)throw Q;if(Q.name==="AbortError")throw new w("Request timeout","TIMEOUT","Request timed out",!0,`Page took too long (>${$.timeout/1000}s).`);if(Q.message?.includes("fetch failed")||Q.cause?.code==="ENOTFOUND")throw new w(Q.message,"DNS_ERROR","Cannot resolve domain",!1,"Check domain and internet connection.");if(Q.cause?.code==="ECONNREFUSED")throw new w(Q.message,"CONNECTION_REFUSED","Connection refused",!1,"The server refused the connection.");if(Q.cause?.code==="ECONNRESET"||Q.message?.includes("socket hang up"))throw new w(Q.message,"CONNECTION_RESET","Connection reset",!0,"The connection was reset.");if(Q.cause?.code==="ETIMEDOUT")throw new w(Q.message,"NETWORK_TIMEOUT","Network timeout",!0,"Network connection timed out.");if(Q.message?.includes("certificate")||Q.cause?.code?.includes("CERT"))throw new w(Q.message,"SSL_ERROR","SSL/TLS error",!1,"Invalid SSL certificate.");throw new w(Q.message,"NETWORK_ERROR","Network error",!0,"A network error occurred.")}}async function TB(_,$,q){let Z,Q;try{Z=await q.default.launch({headless:!0,args:["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage","--disable-accelerated-2d-canvas","--no-first-run","--no-zygote","--disable-gpu","--disable-web-security","--disable-features=IsolateOrigins,site-per-process","--disable-background-timer-throttling","--disable-renderer-backgrounding","--disable-backgrounding-occluded-windows"],timeout:1e4}),Q=await Z.newPage(),await Q.setUserAgent(d3($.userAgent)),await Q.setViewport({width:1920,height:1080,deviceScaleFactor:1}),Q.setDefaultTimeout($.timeout),Q.setDefaultNavigationTimeout(J0.PAGE_LOAD_TIMEOUT),await Q.goto(_,{waitUntil:$.waitUntil,timeout:J0.PAGE_LOAD_TIMEOUT});let X=await Q.content(),J=new TextEncoder().encode(X).length;if(m3(J,$.maxSize),!X.trim())throw new w("Empty page","EMPTY_PAGE","Page is empty",!1,"The page rendered but is empty.");return await Q.close(),await Z.close(),X}catch(X){if(Q)await Q.close().catch(()=>{});if(Z)await Z.close().catch(()=>{});if(X instanceof w)throw X;if(X.message?.includes("Could not find")||X.message?.includes("Chromium"))throw new w(X.message,"BROWSER_NOT_FOUND","Chromium not found",!1,"Reinstall: bun install puppeteer");if(X.message?.includes("Failed to launch"))throw new w(X.message,"BROWSER_LAUNCH_FAILED","Failed to launch browser",!1,"Check system resources.");throw new w(X.message,"RENDER_ERROR","Page rendering failed",!0,"Full render failed.")}}async function Uq(_,$,q=1){try{if($.fullRender){let Z=await import("puppeteer");return await TB(_,$,Z)}return await CB(_,$)}catch(Z){if(Z instanceof w&&!Z.recoverable)throw Z;if(q>=$.maxRetries)throw Z;let Q=J0.RETRY_DELAY*2**(q-1);return await new Promise((X)=>setTimeout(X,Q)),Uq(_,$,q+1)}}async function L1(_,$={}){PB(_);let q={fullRender:$.fullRender??!1,timeout:$.timeout??($.fullRender?J0.FULL_RENDER_TIMEOUT:J0.SIMPLE_FETCH_TIMEOUT),userAgent:$.userAgent??d3(),followRedirects:$.followRedirects??!0,maxSize:$.maxSize??J0.MAX_CONTENT_SIZE,waitUntil:$.waitUntil??"networkidle2",maxRetries:$.maxRetries??J0.MAX_RETRIES};return await Uq(_,q)}function F0(_){if(!_||typeof _!=="string")return"";let $=_.split(`
|
|
90
90
|
`),q=[];for(let Q of $)if(Q=Q.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,""),Q=Q.replace(/[\x80-\xFF]+/g,""),Q=Q.replace(/[\uFFFD\uFEFF\u200B-\u200D\u2060]/g,""),Q=Q.replace(/\bconsole\.log\b/g,""),Q=Q.replace(/\bconsole\.warn\b/g,""),Q=Q.replace(/\bTextDecoder\b/g,""),Q=Q.replace(/\bDecompression failed\b/g,""),Q=Q.replace(/\baccessCount:\s*\d+/g,""),Q=Q.replace(/\blastAccessedAt:\s*[\d-]+/g,""),Q=Q.replace(/\b_Cache get error\b/g,""),Q=Q.replace(/\berror\.message\b/g,""),Q=Q.replace(/0x[0-9A-Fa-f]+/g,""),Q=Q.replace(/[0-9A-Fa-f]{8,}/g,""),Q=Q.replace(/@@[A-Z@]+@@/g,""),Q=Q.replace(/[^\w\s]{3,}/g,""),Q=Q.replace(/(.)\1{5,}/g,"$1"),Q=Q.replace(/[A-Za-z]\d+[A-Za-z]\d+/g,""),Q=Q.replace(/\d+[^\w\s]\d+[^\w\s]/g,""),Q=Q.replace(/’/g,"'"),Q=Q.replace(/“/g,'"'),Q=Q.replace(/â€\x9D/g,'"'),Q=Q.replace(/â€"/g,"—"),Q=Q.replace(/â€\x93/g,"–"),Q=Q.replace(/ /g," "),Q=Q.replace(/[^\x09\x20-\x7E\u00A0-\u024F]/g,""),Q=Q.replace(/\s+/g," ").trim(),Q.length>0&&!/^[\s\W]*$/.test(Q))q.push(Q);let Z=q.join(`
|
|
91
91
|
`);return Z=Z.replace(/\n{3,}/g,`
|
|
92
92
|
|
|
93
|
-
`).replace(/^\s+|\s+$/g,"").replace(/[\x80-\xFF]/g,""),Z}function
|
|
94
|
-
`)}function
|
|
95
|
-
`)}function
|
|
93
|
+
`).replace(/^\s+|\s+$/g,"").replace(/[\x80-\xFF]/g,""),Z}function R1(_){if(!_||typeof _!=="string")return"";return _.replace(/\bconsole\.(log|warn|error)\b/gi,"").replace(/\b(TextDecoder|Buffer|ArrayBuffer)\b/gi,"").replace(/\b(lastAccessed|accessCount|Decompression)\b/gi,"").replace(/\b(failed|error)\s*:/gi,"").replace(/[0-9A-Fa-f]{8,}/g,"").replace(/\b0x[0-9A-Fa-f]+/g,"").replace(/[^\w\s]{4,}/g,"").replace(/ {2,}/g," ").replace(/\t/g," ").trim()}function W0(_){if(!_)return!1;return[/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/,/[\x80-\xFF]{3,}/,/[0-9A-Fa-f]{8,}/,/\b(console\.|TextDecoder|_Cache)\b/i,/[^\w\s]{5,}/].some((q)=>q.test(_))}var Y0={source:"\uD83C\uDF10",title:"\uD83D\uDCC4",summary:"✨",answer:"\uD83D\uDCA1",question:"❓",metadata:"ℹ️",time:"⏱️",model:"\uD83E\uDD16",cache:"⚡",date:"\uD83D\uDCC5"};var kB=100;function IB(_){try{return new URL(_).href}catch{return _}}function z0(_,$){if(!_)return"";let q=_.trim();if(q=q.replace(/\x00/g,""),q=q.replace(/[\x01-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,""),q=q.replace(/[\uFFFD\uFEFF]/g,""),q=q.replace(/[\u200B-\u200D\u2060\uFEFF]/g,""),q=q.replace(/’/g,"'").replace(/“/g,'"').replace(/â€\x9D/g,'"').replace(/â€"/g,"—").replace(/â€\x93/g,"–").replace(/ /g," ").replace(/â¢/g,"•").replace(/é/g,"é").replace(/á/g,"á").replace(/Ã/g,"í").replace(/ó/g,"ó").replace(/ú/g,"ú").replace(/ñ/g,"ñ").replace(/Ã\x87/g,"Ç"),q=q.replace(/[^\x00-\x7F\u00A0-\uFFFF]/g,""),$&&q.length>$)q=`${q.slice(0,$-3)}...`;return q}function OB(_){if(!_||typeof _!=="object")return{};return{title:z0(_.title,kB),description:z0(_.description,500),author:z0(_.author,100),publishDate:z0(_.publishDate,50),keywords:Array.isArray(_.keywords)?_.keywords.slice(0,10).map(($)=>z0(String($),50)):void 0,language:z0(_.language,10),siteName:z0(_.siteName,100),type:z0(_.type,50)}}function EB(_,$){let q=[];if($.customQuestion)q.push(B.bold.yellow(`${Y0.question} Question: `)+B.white($.customQuestion)),q.push("");q.push(B.bold.cyan(`${Y0.source} Source: `)+B.underline($.url));let Z=$.metadata;if(Z.title)q.push(B.bold.green(`${Y0.title} Title: `)+B.white(Z.title));if($.includeMetadata&&!$.compact){if(Z.author)q.push(B.gray(` Author: ${Z.author}`));if(Z.publishDate)q.push(B.gray(` Published: ${Z.publishDate}`));if(Z.siteName)q.push(B.gray(` Site: ${Z.siteName}`))}if(!$.compact){let J=[];if($.model)J.push(`${Y0.model} ${$.model}`);if($.processingTime!==void 0)J.push(`${Y0.time} ${($.processingTime/1000).toFixed(1)}s`);if($.fromCache)J.push(`${Y0.cache} cached`);if(J.length>0)q.push(B.dim(J.join(" | ")))}q.push("");let Q=$.customQuestion?"Answer":$.isFullContent?"Full Content":$.customTitle||"Summary",X=$.customQuestion?Y0.answer:$.isFullContent?"\uD83D\uDCD6":Y0.summary;if(q.push(B.bold.magenta(`${X} ${Q}:`)),q.push(""),q.push(B.white(_)),$.includeTimestamp&&!$.compact)q.push(""),q.push(B.dim(`${Y0.date} Generated: ${new Date().toLocaleString()}`));return q.join(`
|
|
94
|
+
`)}function NB(_,$){let q=[],Z=$.customQuestion?"Answer":$.customTitle||"Summary";if(q.push(`# ${Z}`),q.push(""),$.customQuestion)q.push(`**Question:** ${$.customQuestion}`),q.push("");q.push(`**Source:** [${$.url}](${$.url})`);let Q=$.metadata;if(Q.title)q.push(`**Title:** ${Q.title}`);if($.includeMetadata){if(Q.author)q.push(`**Author:** ${Q.author}`);if(Q.publishDate)q.push(`**Published:** ${Q.publishDate}`);if(Q.description)q.push(`**Description:** ${Q.description}`)}if(q.push(""),$.model||$.processingTime!==void 0){let X=[];if($.model)X.push(`Model: ${$.model}`);if($.processingTime!==void 0)X.push(`Time: ${($.processingTime/1000).toFixed(1)}s`);if($.fromCache)X.push("Cached: Yes");if(X.length>0)q.push(`*${X.join(" | ")}*`),q.push("")}if(q.push("---"),q.push(""),q.push(_),$.includeTimestamp)q.push(""),q.push("---"),q.push(`*Generated: ${new Date().toISOString()}*`);return q.join(`
|
|
95
|
+
`)}function xB(_,$){let q={url:$.url,content:_,metadata:{title:$.metadata.title||null,description:$.metadata.description||null,author:$.metadata.author||null,publishDate:$.metadata.publishDate||null}};if($.customQuestion)q.question=$.customQuestion,q.type="answer";else if($.isFullContent)q.type="full_content";else q.type="summary";if($.includeMetadata)q.metadata={...q.metadata,...$.metadata};if($.model)q.model=$.model;if($.processingTime!==void 0)q.processingTimeMs=$.processingTime;if($.fromCache!==void 0)q.fromCache=$.fromCache;if($.includeTimestamp)q.generatedAt=new Date().toISOString();return JSON.stringify(q,null,$.compact?0:2)}function yB(_,$){let q=$.metadata,Z=$.customQuestion?"Answer":$.customTitle||"Summary",Q=(Y)=>Y.replace(/[&<>"']/g,(K)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[K]||K),X=[];if(X.push("<!DOCTYPE html>"),X.push('<html lang="en">'),X.push("<head>"),X.push(' <meta charset="UTF-8">'),X.push(' <meta name="viewport" content="width=device-width, initial-scale=1.0">'),X.push(` <title>${Q(q.title||Z)}</title>`),X.push(" <style>"),X.push(" body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 800px; margin: 40px auto; padding: 20px; line-height: 1.6; color: #333; }"),X.push(" h1 { color: #2c3e50; border-bottom: 3px solid #3498db; padding-bottom: 10px; }"),X.push(" .metadata { background: #f8f9fa; padding: 15px; border-radius: 5px; margin: 20px 0; }"),X.push(" .metadata p { margin: 5px 0; color: #666; }"),X.push(" .content { margin: 30px 0; }"),X.push(" .question { background: #fff3cd; padding: 15px; border-left: 4px solid #ffc107; margin: 20px 0; }"),X.push(" .footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid #ddd; font-size: 0.9em; color: #666; }"),X.push(" a { color: #3498db; text-decoration: none; }"),X.push(" a:hover { text-decoration: underline; }"),X.push(" </style>"),X.push("</head>"),X.push("<body>"),X.push(` <h1>${Q(Z)}</h1>`),$.customQuestion)X.push(' <div class="question">'),X.push(` <strong>Question:</strong> ${Q($.customQuestion)}`),X.push(" </div>");if(X.push(' <div class="metadata">'),X.push(` <p><strong>Source:</strong> <a href="${Q($.url)}" target="_blank">${Q($.url)}</a></p>`),q.title)X.push(` <p><strong>Title:</strong> ${Q(q.title)}</p>`);if($.includeMetadata){if(q.author)X.push(` <p><strong>Author:</strong> ${Q(q.author)}</p>`);if(q.publishDate)X.push(` <p><strong>Published:</strong> ${Q(q.publishDate)}</p>`)}if($.model)X.push(` <p><strong>Model:</strong> ${Q($.model)}</p>`);if(X.push(" </div>"),X.push(' <div class="content">'),_.split(`
|
|
96
96
|
|
|
97
97
|
`).forEach((Y)=>{if(Y.trim())X.push(` <p>${Q(Y).replace(/\n/g,"<br>")}</p>`)}),X.push(" </div>"),$.includeTimestamp)X.push(' <div class="footer">'),X.push(` <p>Generated: ${new Date().toLocaleString()}</p>`),X.push(" </div>");return X.push("</body>"),X.push("</html>"),X.join(`
|
|
98
|
-
`)}function
|
|
99
|
-
`)}function u3(_,$){if(!_||typeof _!=="string")throw new Error("Summary must be a non-empty string");if(!$||typeof $!=="object")throw new Error("Options must be an object");if(!$.url)throw new Error("URL is required in options");let q=_.trim();if(G0(q))console.error("⚠️ Binary artifacts detected in summary, applying nuclear cleaning..."),q=V0(q);else q=q.replace(/\b(console|warn|error|log|TextDecoder|Buffer|ArrayBuffer)\b/gi,"").replace(/\b(cache|hits|lastAccessed|accessCount|Decompression)\b/gi,"").replace(/\b0x[0-9A-Fa-f]+/g,"").replace(/ {2,}/g," ").replace(/\t/g," ").trim();let Z=CB($.url),Q=wB($.metadata),X="terminal";if($.format)X=$.format;else if($.json)X="json";else if($.markdown)X="markdown";let J={format:X,markdown:$.markdown??!1,json:$.json??!1,metadata:Q,url:Z,customQuestion:$.customQuestion||"",includeMetadata:$.includeMetadata??!1,includeTimestamp:$.includeTimestamp??!1,model:$.model||"",processingTime:$.processingTime||0,fromCache:$.fromCache||!1,compact:$.compact??!1,customTitle:$.customTitle||"",isFullContent:$.isFullContent??!1},Y;switch(X){case"markdown":Y=IB(q,J);break;case"json":Y=OB(q,J);break;case"html":Y=EB(q,J);break;case"plain":Y=xB(q,J);break;default:Y=TB(q,J);break}return Y}import*as Uq from"cheerio";var n0={en:"English",fr:"French",es:"Spanish",ht:"Haitian Creole"};function NB(_){let $=new URL(_),q=$.pathname.toLowerCase().split("/").filter(Boolean);for(let J of q){if(J==="fr"||J==="french")return{lang:"fr",confidence:"high"};if(J==="es"||J==="spanish"||J==="espanol")return{lang:"es",confidence:"high"};if(J==="ht"||J==="haitian"||J==="kreyol")return{lang:"ht",confidence:"high"};if(J==="en"||J==="english")return{lang:"en",confidence:"high"}}let Z=$.searchParams.get("lang")||$.searchParams.get("language")||$.searchParams.get("locale")||$.searchParams.get("hl");if(Z){let J=Z.toLowerCase().slice(0,2);if(J in n0)return{lang:J,confidence:"high"}}let Q=$.hostname.toLowerCase();if(Q.endsWith(".fr"))return{lang:"fr",confidence:"medium"};if(Q.endsWith(".es"))return{lang:"es",confidence:"medium"};if(Q.endsWith(".ht"))return{lang:"ht",confidence:"medium"};let X=Q.split(".")[0];if(X==="fr")return{lang:"fr",confidence:"medium"};if(X==="es")return{lang:"es",confidence:"medium"};if(X==="ht")return{lang:"ht",confidence:"medium"};return{lang:null,confidence:"medium"}}function yB(_){try{let $=Uq.load(_),q=$("html").attr("lang")?.toLowerCase().slice(0,2);if(q&&q in n0)return{lang:q,confidence:"high"};let Z=$('meta[http-equiv="content-language"]').attr("content")?.toLowerCase().slice(0,2);if(Z&&Z in n0)return{lang:Z,confidence:"high"};let Q=$('meta[property="og:locale"]').attr("content")?.toLowerCase().slice(0,2);if(Q&&Q in n0)return{lang:Q,confidence:"medium"};let X=$('meta[name="language"]').attr("content")?.toLowerCase().slice(0,2);if(X&&X in n0)return{lang:X,confidence:"medium"}}catch($){}return{lang:null,confidence:"medium"}}function vB(_){let $=_.toLowerCase().slice(0,1000),q={fr:{words:["le","la","les","de","et","est","un","une","pour","dans","avec","sur","par","vous","nous","ils","elle"],patterns:[/\bqu'/g,/\bd'/g,/\bl'/g,/\bc'/g],score:0},es:{words:["el","la","los","las","de","y","es","en","por","para","con","un","una","que","del"],patterns:[/ñ/g,/¿/g,/¡/g],score:0},ht:{words:["nan","ak","pou","yo","li","nou","mwen","ou","se","ki","gen","bay","fè","ka"],patterns:[/\bm'/g,/\bl'/g,/\bn'/g],score:0},en:{words:["the","is","at","of","and","to","in","for","with","on","by","from","up","about","into"],patterns:[/\b(you|your|you're|you'll)\b/g,/\b(it's|isn't|aren't|won't)\b/g],score:0}};for(let[K,H]of Object.entries(q)){for(let B of H.words){let V=new RegExp(`\\b${B}\\b`,"gi"),F=$.match(V);if(F)H.score+=F.length*2}for(let B of H.patterns){let V=$.match(B);if(V)H.score+=V.length}}let Z=null,Q=10;for(let[K,H]of Object.entries(q))if(H.score>Q)Q=H.score,Z=K;let X=Object.values(q).map((K)=>K.score).sort((K,H)=>H-K),Y=X[0]-X[1]>20?"medium":"low";return{lang:Z,confidence:Y}}function Vq(_,$,q,Z){let Q=[];if(Z&&Z in n0)return{detected:Z,confidence:"high",source:"url",signals:["user-specified"]};let X=NB(_);if(X.lang){if(Q.push(`URL: ${X.lang}`),X.confidence==="high")return{detected:X.lang,confidence:"high",source:"url",signals:Q}}if($){let J=yB($);if(J.lang){if(Q.push(`HTML: ${J.lang}`),J.confidence==="high")return{detected:J.lang,confidence:X.lang===J.lang?"high":"medium",source:"html",signals:Q}}}if(q){let J=vB(q);if(J.lang){Q.push(`Content: ${J.lang}`);let Y=X.lang===J.lang?"medium":J.confidence;return{detected:J.lang,confidence:Y,source:"content",signals:Q}}}if(X.lang)return{detected:X.lang,confidence:"low",source:"url",signals:Q};return{detected:"en",confidence:"low",source:"default",signals:["fallback to English"]}}function Gq(){return process.env.DISABLE_LANGUAGE_DETECTION!=="true"}import Fq from"node:path";var W0={DEFAULT_TIMEOUT:30000,PAGE_LOAD_TIMEOUT:20000,VIEWPORT_WIDTH:1920,VIEWPORT_HEIGHT:1080,DEFAULT_FORMAT:"png",JPEG_QUALITY:90,MAX_RETRIES:2,RETRY_DELAY:1000};class E extends Error{code;userMessage;hint;constructor(_,$,q,Z){super(_);this.code=$;this.userMessage=q;this.hint=Z;this.name="ScreenshotError"}}function Wq(_){switch(Fq.extname(_).toLowerCase()){case".jpg":case".jpeg":return"jpeg";case".webp":return"webp";default:return"png"}}function hB(_){try{let $=new URL(_);if(!["http:","https:"].includes($.protocol))throw new Error("Invalid protocol")}catch{throw new E(`Invalid URL: ${_}`,"INVALID_URL","Invalid URL format","URL must start with http:// or https://")}}function SB(_){let $=Fq.extname(_).toLowerCase(),q=[".png",".jpg",".jpeg",".webp"];if(!q.includes($))throw new E(`Invalid file extension: ${$}`,"INVALID_EXTENSION","Unsupported image format",`Supported formats: ${q.join(", ")}`)}async function bB(_){try{return await _.default.launch({headless:!0,args:["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage","--disable-accelerated-2d-canvas","--no-first-run","--no-zygote","--disable-gpu"],timeout:1e4})}catch($){if($ instanceof Error&&($.message.includes("Could not find")||$.message.includes("Chromium")))throw new E($.message,"BROWSER_NOT_FOUND","Chromium browser not found","Puppeteer's Chromium is missing. Reinstall: bun install puppeteer");let q=$ instanceof Error?$.message:String($);throw new E(q,"BROWSER_LAUNCH_FAILED","Failed to launch browser","Check if you have enough system resources (memory, disk space)")}}async function zq(_,$,q,Z=1){let Q,X;try{Q=await bB(q),X=await Q.newPage(),await X.setViewport({width:$.width,height:$.height,deviceScaleFactor:1}),X.setDefaultTimeout($.timeout),X.setDefaultNavigationTimeout(W0.PAGE_LOAD_TIMEOUT);try{await X.goto(_,{waitUntil:$.waitUntil,timeout:W0.PAGE_LOAD_TIMEOUT})}catch(K){if(K instanceof Error&&K.message.includes("net::ERR_NAME_NOT_RESOLVED"))throw new E(K.message,"DNS_ERROR","Cannot resolve domain name",`Check if ${new URL(_).hostname} is accessible`);if(K instanceof Error&&K.message.includes("net::ERR_CONNECTION_REFUSED"))throw new E(K.message,"CONNECTION_REFUSED","Connection refused","The server is not accepting connections. Check if the URL is correct.");if(K instanceof Error&&(K.message.includes("Timeout")||K.message.includes("timeout")))throw new E(K.message,"PAGE_TIMEOUT","Page took too long to load","The page is slow or unresponsive. Try again or check your connection.");let H=K instanceof Error?K.message:String(K);throw new E(H,"NAVIGATION_ERROR","Failed to load page","The page may be blocking automated access or has loading issues.")}let J=Wq($.filePath),Y={path:$.filePath,fullPage:$.fullPage,type:J};if(J==="jpeg"||J==="webp")Y.quality=$.quality;await X.screenshot(Y),await X.close(),await Q.close()}catch(J){if(X)try{await X.close()}catch{}if(Q)try{await Q.close()}catch{}if(J instanceof E&&J.code==="PAGE_TIMEOUT"){if(Z<W0.MAX_RETRIES){let K=W0.RETRY_DELAY*2**(Z-1);return await new Promise((H)=>setTimeout(H,K)),zq(_,$,q,Z+1)}}if(J instanceof E)throw J;let Y=J instanceof Error?J.message:String(J);throw new E(Y||"Unknown error","SCREENSHOT_FAILED","Screenshot capture failed","An unexpected error occurred. Try again or check the URL.")}}async function Lq(_,$={}){let q=typeof $==="string"?{filePath:$}:$,Z={filePath:q.filePath||"screenshot.png",fullPage:q.fullPage??!0,width:q.width||W0.VIEWPORT_WIDTH,height:q.height||W0.VIEWPORT_HEIGHT,quality:q.quality||W0.JPEG_QUALITY,timeout:q.timeout||W0.DEFAULT_TIMEOUT,waitUntil:q.waitUntil||"networkidle2"};if(hB(_),SB(Z.filePath),Z.width<=0||Z.height<=0)throw new E("Invalid dimensions","INVALID_DIMENSIONS","Width and height must be positive","Use values like width: 1920, height: 1080");let Q=Wq(Z.filePath);if((Q==="jpeg"||Q==="webp")&&(Z.quality<0||Z.quality>100))throw new E("Invalid quality","INVALID_QUALITY","Quality must be between 0-100","Use values like quality: 90");try{let X=await import("puppeteer");await zq(_,Z,X)}catch(X){let J=X instanceof Error?X.message:String(X);throw new E(`Puppeteer not available: ${J}`,"PUPPETEER_MISSING","Screenshot functionality unavailable","Install Puppeteer: npm install puppeteer")}}async function fB(_="http://localhost:11434"){try{let $=new AbortController,q=setTimeout(()=>$.abort(),2000),Z=await fetch(`${_}/api/tags`,{signal:$.signal});if(clearTimeout(q),Z.ok){if(((await Z.json()).models||[]).length===0)return{available:!1,name:"Ollama",type:"free",reason:"No models installed. Run: ollama pull llama3"};return{available:!0,name:"Ollama",type:"free"}}return{available:!1,name:"Ollama",type:"free",reason:"Server not responding"}}catch($){return{available:!1,name:"Ollama",type:"free",reason:"Not running. Start with: ollama serve"}}}function gB(){if(!process.env.OPENAI_API_KEY)return{available:!1,name:"OpenAI",type:"paid",reason:"OPENAI_API_KEY not set"};return{available:!0,name:"OpenAI",type:"paid"}}function uB(){if(!process.env.GEMINI_API_KEY&&!process.env.GOOGLE_API_KEY)return{available:!1,name:"Google Gemini",type:"paid",reason:"GEMINI_API_KEY not set"};return{available:!0,name:"Google Gemini",type:"paid"}}function mB(){if(!process.env.ELEVENLABS_API_KEY)return{available:!1,name:"ElevenLabs",type:"paid",reason:"ELEVENLABS_API_KEY not set"};return{available:!0,name:"ElevenLabs",type:"paid"}}async function dB(){let _=process.platform;if(_==="darwin")return{available:!0,name:"macOS Say",type:"free"};else if(_==="win32")return{available:!0,name:"Windows SAPI",type:"free"};else try{let{spawn:$}=await import("node:child_process");return new Promise((q)=>{$("which",["espeak"]).on("close",(Q)=>{if(Q===0)q({available:!0,name:"espeak",type:"free"});else $("which",["festival"]).on("close",(J)=>{if(J===0)q({available:!0,name:"festival",type:"free"});else q({available:!1,name:"Linux TTS",type:"free",reason:"Install espeak or festival"})})})})}catch{return{available:!1,name:"Linux TTS",type:"free",reason:"Unable to detect TTS engine"}}}async function cB(_={}){let{preferFree:$=!0,ollamaEndpoint:q,verbose:Z=!1}=_,[Q,X,J,Y,K]=await Promise.all([fB(q),gB(),uB(),mB(),dB()]),H=[Q,X,J],B=H.filter((z)=>z.available),V=[];if($)V=[...Q.available?["ollama"]:[],...X.available?["openai"]:[],...J.available?["google"]:[]];else V=[...X.available?["openai"]:[],...J.available?["google"]:[],...Q.available?["ollama"]:[]];let F=[K,Y],G=F.filter((z)=>z.available),W=[];if($)W=[...K.available?["local"]:[],...Y.available?["elevenlabs"]:[]];else W=[...Y.available?["elevenlabs"]:[],...K.available?["local"]:[]];let L=V[0]||"none",D=W[0]||"none";if(Z){if(console.log(U.cyan(`
|
|
98
|
+
`)}function vB(_,$){let q=[],Z=$.customQuestion?"ANSWER":($.customTitle||"SUMMARY").toUpperCase();if(q.push(Z),q.push("=".repeat(Z.length)),q.push(""),$.customQuestion)q.push(`Question: ${$.customQuestion}`),q.push("");q.push(`Source: ${$.url}`);let Q=$.metadata;if(Q.title)q.push(`Title: ${Q.title}`);if($.includeMetadata){if(Q.author)q.push(`Author: ${Q.author}`);if(Q.publishDate)q.push(`Published: ${Q.publishDate}`)}if(q.push(""),q.push("-".repeat(60)),q.push(""),q.push(_),$.includeTimestamp)q.push(""),q.push("-".repeat(60)),q.push(`Generated: ${new Date().toISOString()}`);return q.join(`
|
|
99
|
+
`)}function c3(_,$){if(!_||typeof _!=="string")throw new Error("Summary must be a non-empty string");if(!$||typeof $!=="object")throw new Error("Options must be an object");if(!$.url)throw new Error("URL is required in options");let q=_.trim();if(W0(q))console.error("⚠️ Binary artifacts detected in summary, applying nuclear cleaning..."),q=F0(q);else q=q.replace(/\b(console|warn|error|log|TextDecoder|Buffer|ArrayBuffer)\b/gi,"").replace(/\b(cache|hits|lastAccessed|accessCount|Decompression)\b/gi,"").replace(/\b0x[0-9A-Fa-f]+/g,"").replace(/ {2,}/g," ").replace(/\t/g," ").trim();let Z=IB($.url),Q=OB($.metadata),X="terminal";if($.format)X=$.format;else if($.json)X="json";else if($.markdown)X="markdown";let J={format:X,markdown:$.markdown??!1,json:$.json??!1,metadata:Q,url:Z,customQuestion:$.customQuestion||"",includeMetadata:$.includeMetadata??!1,includeTimestamp:$.includeTimestamp??!1,model:$.model||"",processingTime:$.processingTime||0,fromCache:$.fromCache||!1,compact:$.compact??!1,customTitle:$.customTitle||"",isFullContent:$.isFullContent??!1},Y;switch(X){case"markdown":Y=NB(q,J);break;case"json":Y=xB(q,J);break;case"html":Y=yB(q,J);break;case"plain":Y=vB(q,J);break;default:Y=EB(q,J);break}return Y}import*as Fq from"cheerio";var o0={en:"English",fr:"French",es:"Spanish",ht:"Haitian Creole"};function hB(_){let $=new URL(_),q=$.pathname.toLowerCase().split("/").filter(Boolean);for(let J of q){if(J==="fr"||J==="french")return{lang:"fr",confidence:"high"};if(J==="es"||J==="spanish"||J==="espanol")return{lang:"es",confidence:"high"};if(J==="ht"||J==="haitian"||J==="kreyol")return{lang:"ht",confidence:"high"};if(J==="en"||J==="english")return{lang:"en",confidence:"high"}}let Z=$.searchParams.get("lang")||$.searchParams.get("language")||$.searchParams.get("locale")||$.searchParams.get("hl");if(Z){let J=Z.toLowerCase().slice(0,2);if(J in o0)return{lang:J,confidence:"high"}}let Q=$.hostname.toLowerCase();if(Q.endsWith(".fr"))return{lang:"fr",confidence:"medium"};if(Q.endsWith(".es"))return{lang:"es",confidence:"medium"};if(Q.endsWith(".ht"))return{lang:"ht",confidence:"medium"};let X=Q.split(".")[0];if(X==="fr")return{lang:"fr",confidence:"medium"};if(X==="es")return{lang:"es",confidence:"medium"};if(X==="ht")return{lang:"ht",confidence:"medium"};return{lang:null,confidence:"medium"}}function SB(_){try{let $=Fq.load(_),q=$("html").attr("lang")?.toLowerCase().slice(0,2);if(q&&q in o0)return{lang:q,confidence:"high"};let Z=$('meta[http-equiv="content-language"]').attr("content")?.toLowerCase().slice(0,2);if(Z&&Z in o0)return{lang:Z,confidence:"high"};let Q=$('meta[property="og:locale"]').attr("content")?.toLowerCase().slice(0,2);if(Q&&Q in o0)return{lang:Q,confidence:"medium"};let X=$('meta[name="language"]').attr("content")?.toLowerCase().slice(0,2);if(X&&X in o0)return{lang:X,confidence:"medium"}}catch($){}return{lang:null,confidence:"medium"}}function bB(_){let $=_.toLowerCase().slice(0,1000),q={fr:{words:["le","la","les","de","et","est","un","une","pour","dans","avec","sur","par","vous","nous","ils","elle"],patterns:[/\bqu'/g,/\bd'/g,/\bl'/g,/\bc'/g],score:0},es:{words:["el","la","los","las","de","y","es","en","por","para","con","un","una","que","del"],patterns:[/ñ/g,/¿/g,/¡/g],score:0},ht:{words:["nan","ak","pou","yo","li","nou","mwen","ou","se","ki","gen","bay","fè","ka"],patterns:[/\bm'/g,/\bl'/g,/\bn'/g],score:0},en:{words:["the","is","at","of","and","to","in","for","with","on","by","from","up","about","into"],patterns:[/\b(you|your|you're|you'll)\b/g,/\b(it's|isn't|aren't|won't)\b/g],score:0}};for(let[K,H]of Object.entries(q)){for(let V of H.words){let G=new RegExp(`\\b${V}\\b`,"gi"),U=$.match(G);if(U)H.score+=U.length*2}for(let V of H.patterns){let G=$.match(V);if(G)H.score+=G.length}}let Z=null,Q=10;for(let[K,H]of Object.entries(q))if(H.score>Q)Q=H.score,Z=K;let X=Object.values(q).map((K)=>K.score).sort((K,H)=>H-K),Y=X[0]-X[1]>20?"medium":"low";return{lang:Z,confidence:Y}}function Wq(_,$,q,Z){let Q=[];if(Z&&Z in o0)return{detected:Z,confidence:"high",source:"url",signals:["user-specified"]};let X=hB(_);if(X.lang){if(Q.push(`URL: ${X.lang}`),X.confidence==="high")return{detected:X.lang,confidence:"high",source:"url",signals:Q}}if($){let J=SB($);if(J.lang){if(Q.push(`HTML: ${J.lang}`),J.confidence==="high")return{detected:J.lang,confidence:X.lang===J.lang?"high":"medium",source:"html",signals:Q}}}if(q){let J=bB(q);if(J.lang){Q.push(`Content: ${J.lang}`);let Y=X.lang===J.lang?"medium":J.confidence;return{detected:J.lang,confidence:Y,source:"content",signals:Q}}}if(X.lang)return{detected:X.lang,confidence:"low",source:"url",signals:Q};return{detected:"en",confidence:"low",source:"default",signals:["fallback to English"]}}function zq(){return process.env.DISABLE_LANGUAGE_DETECTION!=="true"}import Lq from"node:path";var L0={DEFAULT_TIMEOUT:30000,PAGE_LOAD_TIMEOUT:20000,VIEWPORT_WIDTH:1920,VIEWPORT_HEIGHT:1080,DEFAULT_FORMAT:"png",JPEG_QUALITY:90,MAX_RETRIES:2,RETRY_DELAY:1000};class v extends Error{code;userMessage;hint;constructor(_,$,q,Z){super(_);this.code=$;this.userMessage=q;this.hint=Z;this.name="ScreenshotError"}}function Rq(_){switch(Lq.extname(_).toLowerCase()){case".jpg":case".jpeg":return"jpeg";case".webp":return"webp";default:return"png"}}function fB(_){try{let $=new URL(_);if(!["http:","https:"].includes($.protocol))throw new Error("Invalid protocol")}catch{throw new v(`Invalid URL: ${_}`,"INVALID_URL","Invalid URL format","URL must start with http:// or https://")}}function gB(_){let $=Lq.extname(_).toLowerCase(),q=[".png",".jpg",".jpeg",".webp"];if(!q.includes($))throw new v(`Invalid file extension: ${$}`,"INVALID_EXTENSION","Unsupported image format",`Supported formats: ${q.join(", ")}`)}async function uB(_){try{return await _.default.launch({headless:!0,args:["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage","--disable-accelerated-2d-canvas","--no-first-run","--no-zygote","--disable-gpu"],timeout:1e4})}catch($){if($ instanceof Error&&($.message.includes("Could not find")||$.message.includes("Chromium")))throw new v($.message,"BROWSER_NOT_FOUND","Chromium browser not found","Puppeteer's Chromium is missing. Reinstall: bun install puppeteer");let q=$ instanceof Error?$.message:String($);throw new v(q,"BROWSER_LAUNCH_FAILED","Failed to launch browser","Check if you have enough system resources (memory, disk space)")}}async function Dq(_,$,q,Z=1){let Q,X;try{Q=await uB(q),X=await Q.newPage(),await X.setViewport({width:$.width,height:$.height,deviceScaleFactor:1}),X.setDefaultTimeout($.timeout),X.setDefaultNavigationTimeout(L0.PAGE_LOAD_TIMEOUT);try{await X.goto(_,{waitUntil:$.waitUntil,timeout:L0.PAGE_LOAD_TIMEOUT})}catch(K){if(K instanceof Error&&K.message.includes("net::ERR_NAME_NOT_RESOLVED"))throw new v(K.message,"DNS_ERROR","Cannot resolve domain name",`Check if ${new URL(_).hostname} is accessible`);if(K instanceof Error&&K.message.includes("net::ERR_CONNECTION_REFUSED"))throw new v(K.message,"CONNECTION_REFUSED","Connection refused","The server is not accepting connections. Check if the URL is correct.");if(K instanceof Error&&(K.message.includes("Timeout")||K.message.includes("timeout")))throw new v(K.message,"PAGE_TIMEOUT","Page took too long to load","The page is slow or unresponsive. Try again or check your connection.");let H=K instanceof Error?K.message:String(K);throw new v(H,"NAVIGATION_ERROR","Failed to load page","The page may be blocking automated access or has loading issues.")}let J=Rq($.filePath),Y={path:$.filePath,fullPage:$.fullPage,type:J};if(J==="jpeg"||J==="webp")Y.quality=$.quality;await X.screenshot(Y),await X.close(),await Q.close()}catch(J){if(X)try{await X.close()}catch{}if(Q)try{await Q.close()}catch{}if(J instanceof v&&J.code==="PAGE_TIMEOUT"){if(Z<L0.MAX_RETRIES){let K=L0.RETRY_DELAY*2**(Z-1);return await new Promise((H)=>setTimeout(H,K)),Dq(_,$,q,Z+1)}}if(J instanceof v)throw J;let Y=J instanceof Error?J.message:String(J);throw new v(Y||"Unknown error","SCREENSHOT_FAILED","Screenshot capture failed","An unexpected error occurred. Try again or check the URL.")}}async function jq(_,$={}){let q=typeof $==="string"?{filePath:$}:$,Z={filePath:q.filePath||"screenshot.png",fullPage:q.fullPage??!0,width:q.width||L0.VIEWPORT_WIDTH,height:q.height||L0.VIEWPORT_HEIGHT,quality:q.quality||L0.JPEG_QUALITY,timeout:q.timeout||L0.DEFAULT_TIMEOUT,waitUntil:q.waitUntil||"networkidle2"};if(fB(_),gB(Z.filePath),Z.width<=0||Z.height<=0)throw new v("Invalid dimensions","INVALID_DIMENSIONS","Width and height must be positive","Use values like width: 1920, height: 1080");let Q=Rq(Z.filePath);if((Q==="jpeg"||Q==="webp")&&(Z.quality<0||Z.quality>100))throw new v("Invalid quality","INVALID_QUALITY","Quality must be between 0-100","Use values like quality: 90");try{let X=await import("puppeteer");await Dq(_,Z,X)}catch(X){let J=X instanceof Error?X.message:String(X);throw new v(`Puppeteer not available: ${J}`,"PUPPETEER_MISSING","Screenshot functionality unavailable","Install Puppeteer: npm install puppeteer")}}async function mB(_="http://localhost:11434"){try{let $=new AbortController,q=setTimeout(()=>$.abort(),2000),Z=await fetch(`${_}/api/tags`,{signal:$.signal});if(clearTimeout(q),Z.ok){if(((await Z.json()).models||[]).length===0)return{available:!1,name:"Ollama",type:"free",reason:"No models installed. Run: ollama pull llama3"};return{available:!0,name:"Ollama",type:"free"}}return{available:!1,name:"Ollama",type:"free",reason:"Server not responding"}}catch($){return{available:!1,name:"Ollama",type:"free",reason:"Not running. Start with: ollama serve"}}}function dB(){if(!process.env.OPENAI_API_KEY)return{available:!1,name:"OpenAI",type:"paid",reason:"OPENAI_API_KEY not set"};return{available:!0,name:"OpenAI",type:"paid"}}function cB(){if(!process.env.GEMINI_API_KEY&&!process.env.GOOGLE_API_KEY)return{available:!1,name:"Google Gemini",type:"paid",reason:"GEMINI_API_KEY not set"};return{available:!0,name:"Google Gemini",type:"paid"}}function pB(){if(!process.env.ELEVENLABS_API_KEY)return{available:!1,name:"ElevenLabs",type:"paid",reason:"ELEVENLABS_API_KEY not set"};return{available:!0,name:"ElevenLabs",type:"paid"}}async function lB(){let _=process.platform;if(_==="darwin")return{available:!0,name:"macOS Say",type:"free"};else if(_==="win32")return{available:!0,name:"Windows SAPI",type:"free"};else try{let{spawn:$}=await import("node:child_process");return new Promise((q)=>{$("which",["espeak"]).on("close",(Q)=>{if(Q===0)q({available:!0,name:"espeak",type:"free"});else $("which",["festival"]).on("close",(J)=>{if(J===0)q({available:!0,name:"festival",type:"free"});else q({available:!1,name:"Linux TTS",type:"free",reason:"Install espeak or festival"})})})})}catch{return{available:!1,name:"Linux TTS",type:"free",reason:"Unable to detect TTS engine"}}}async function aB(_={}){let{preferFree:$=!0,ollamaEndpoint:q,verbose:Z=!1}=_,[Q,X,J,Y,K]=await Promise.all([mB(q),dB(),cB(),pB(),lB()]),H=[Q,X,J],V=H.filter((z)=>z.available),G=[];if($)G=[...Q.available?["ollama"]:[],...X.available?["openai"]:[],...J.available?["google"]:[]];else G=[...X.available?["openai"]:[],...J.available?["google"]:[],...Q.available?["ollama"]:[]];let U=[K,Y],F=U.filter((z)=>z.available),W=[];if($)W=[...K.available?["local"]:[],...Y.available?["elevenlabs"]:[]];else W=[...Y.available?["elevenlabs"]:[],...K.available?["local"]:[]];let L=G[0]||"none",A=W[0]||"none";if(Z){if(console.log(B.cyan(`
|
|
100
100
|
\uD83D\uDCCA Service Detection Report:
|
|
101
|
-
`)),console.log(
|
|
102
|
-
Voice Services:`)),
|
|
103
|
-
\uD83C\uDFAF Selected:`)),console.log(` AI: ${L!=="none"?
|
|
104
|
-
\uD83D\uDCA1 Tip: Using free services by default. Use --prefer-quality for premium services.`))}return{ai:{preferred:L,available:H,fallbackChain:
|
|
105
|
-
⚠️ ${q[_]}`))}import{GoogleGenAI as
|
|
101
|
+
`)),console.log(B.bold("AI Services:")),H.forEach((z)=>{let D=z.available?"✅":"❌",j=z.type==="free"?B.green("[FREE]"):B.yellow("[PAID]");console.log(` ${D} ${z.name} ${j} ${z.reason?B.dim(`- ${z.reason}`):""}`)}),console.log(B.bold(`
|
|
102
|
+
Voice Services:`)),U.forEach((z)=>{let D=z.available?"✅":"❌",j=z.type==="free"?B.green("[FREE]"):B.yellow("[PAID]");console.log(` ${D} ${z.name} ${j} ${z.reason?B.dim(`- ${z.reason}`):""}`)}),console.log(B.bold(`
|
|
103
|
+
\uD83C\uDFAF Selected:`)),console.log(` AI: ${L!=="none"?B.green(L):B.red("No AI service available")}`),console.log(` Voice: ${A!=="none"?B.green(A):B.red("No voice service available")}`),$&&(X.available||J.available||Y.available))console.log(B.dim(`
|
|
104
|
+
\uD83D\uDCA1 Tip: Using free services by default. Use --prefer-quality for premium services.`))}return{ai:{preferred:L,available:H,fallbackChain:G},voice:{preferred:A,available:U,fallbackChain:W}}}async function p3(_,$){switch((await aB({ollamaEndpoint:_,verbose:!1,preferFree:!$})).ai.preferred){case"ollama":try{let Z=await fetch(`${_||"http://localhost:11434"}/api/tags`);if(Z.ok){let X=(await Z.json()).models||[];if(X.length>0)return X.find((Y)=>Y.name.includes("llama3"))?.name||X[0]?.name||"llama3"}}catch{}return"llama3";case"openai":return"gpt-4o-mini";case"google":return"gemini-2.0-flash-exp";default:return"llama3"}}function Aq(_,$){let q={openai:`Using OpenAI (${$||"gpt-4o-mini"}) - This will consume API credits! Use --model llama3 for free local processing.`,google:`Using Google Gemini (${$||"gemini-2.0-flash-exp"}) - This may consume API credits! Use --model llama3 for free local processing.`,elevenlabs:"Using ElevenLabs voices - This will consume API credits! Use --read without API key for free local TTS."};if(q[_])console.log(B.yellow(`
|
|
105
|
+
⚠️ ${q[_]}`))}import{GoogleGenAI as iB}from"@google/genai";import nB from"openai";var l3={en:"English",fr:"French",es:"Spanish",ht:"Haitian Creole"};function oB(_){if(!l3[_])throw new Error(`Unsupported language: "${_}". Use: en, fr, es, ht`)}var a3=(_)=>{let $=_.toLowerCase();if($.startsWith("gpt-")&&!$.startsWith("gpt-oss")||$.startsWith("o1-"))return"openai";if($.startsWith("gemini-"))return"google";return"ollama"},K0={systemInstruction:(_)=>`You are an expert content analyst and summarizer with deep expertise in extracting, analyzing, and presenting information clearly and accurately.
|
|
106
106
|
|
|
107
107
|
**Core Capabilities:**
|
|
108
108
|
- Extract key information with precision and context
|
|
@@ -301,16 +301,16 @@ Voice Services:`)),F.forEach((z)=>{let j=z.available?"✅":"❌",C=z.type==="fre
|
|
|
301
301
|
- Start directly with the content
|
|
302
302
|
- End when content is complete
|
|
303
303
|
|
|
304
|
-
Begin your response now:`};function
|
|
304
|
+
Begin your response now:`};function rB(_,$){let q=l3[$.language],Z=K0.systemInstruction(q||"English");if(Z+=`
|
|
305
305
|
|
|
306
306
|
---
|
|
307
307
|
|
|
308
|
-
`,$.translate)Z+=
|
|
308
|
+
`,$.translate)Z+=K0.translation(q||"English");else if($.format)Z+=K0.smartFormatting();else if($.customQuestion)Z+=K0.customQuestion($.customQuestion,!1);else if($.tldr)Z+=K0.tldr(!1);else if($.keyPoints)Z+=K0.keyPoints(!1);else if($.eli5)Z+=K0.eli5(!1);else Z+=K0.standardSummary(!1);if($.language&&$.language!=="en"){let J=l3[$.language];Z+=`
|
|
309
309
|
|
|
310
310
|
**IMPORTANT LANGUAGE REQUIREMENT:**
|
|
311
311
|
- You MUST write your ENTIRE response in ${J}
|
|
312
312
|
- Do NOT use any other language
|
|
313
|
-
- All output must be in ${J}`}Z+=
|
|
313
|
+
- All output must be in ${J}`}Z+=K0.outputInstruction();let Q=1e5,X=_.length>Q?_.slice(0,Q)+`
|
|
314
314
|
|
|
315
315
|
[Content truncated due to length...]`:_;return Z+=`
|
|
316
316
|
|
|
@@ -318,126 +318,141 @@ Voice Services:`)),F.forEach((z)=>{let j=z.available?"✅":"❌",C=z.type==="fre
|
|
|
318
318
|
|
|
319
319
|
**WEBPAGE CONTENT:**
|
|
320
320
|
|
|
321
|
-
${X}`,Z}async function
|
|
322
|
-
`),K}let J=(await q.chat.completions.create({model:$.model,messages:[{role:"user",content:_}],temperature:Z,max_tokens:$.maxTokens??Q,top_p:0.95})).choices[0]?.message?.content?.trim()??"";if(
|
|
323
|
-
`)}return Y}async function
|
|
324
|
-
`).filter(Boolean);for(let
|
|
325
|
-
`),
|
|
321
|
+
${X}`,Z}async function i3(_,$){oB($.language);let q=a3($.model),Z=rB(_,$);switch(q){case"openai":return await tB(Z,$);case"google":return await sB(Z,$);case"ollama":return await eB(Z,$);default:throw new Error("Invalid provider")}}async function tB(_,$){if(!process.env.OPENAI_API_KEY)throw new Error("Missing OPENAI_API_KEY");let q=new nB({apiKey:process.env.OPENAI_API_KEY}),Z=$.eli5?0.7:0.3,Q=$.tldr?100:$.keyPoints?800:$.eli5?600:1200;if($.stream){let Y=await q.chat.completions.create({model:$.model,messages:[{role:"user",content:_}],temperature:Z,max_tokens:$.maxTokens??Q,stream:!0}),K="";for await(let H of Y){let V=H.choices[0]?.delta?.content||"";process.stdout.write(B.gray(V)),K+=V}return process.stdout.write(`
|
|
322
|
+
`),K}let J=(await q.chat.completions.create({model:$.model,messages:[{role:"user",content:_}],temperature:Z,max_tokens:$.maxTokens??Q,top_p:0.95})).choices[0]?.message?.content?.trim()??"";if(W0(J))return console.error("\uD83D\uDEA8 CRITICAL: Binary artifacts in OpenAI response! Applying emergency cleaning..."),F0(J);return J.replace(/\b(console|warn|error|log|TextDecoder|Buffer|ArrayBuffer)\b/gi,"").replace(/\b0x[0-9A-Fa-f]+/g,"").replace(/ {2,}/g," ").replace(/\t/g," ").trim()}async function sB(_,$){let q=process.env.GEMINI_API_KEY;if(!q)throw new Error("Missing GEMINI_API_KEY");let Z=new iB({apiKey:q}),Q=$.eli5?0.7:0.3,J=(await Z.models.generateContent({model:$.model,contents:_,config:{temperature:Q,topP:0.95,topK:40}})).text?.trim()??"",Y=J;if(W0(J))console.error("\uD83D\uDEA8 CRITICAL: Binary artifacts in Gemini response! Applying emergency cleaning..."),Y=F0(J);else Y=J.replace(/\b(console|warn|error|log|TextDecoder|Buffer|ArrayBuffer)\b/gi,"").replace(/\b0x[0-9A-Fa-f]+/g,"").replace(/ {2,}/g," ").replace(/\t/g," ").trim();if($.stream){for(let K of Y)process.stdout.write(B.gray(K)),await new Promise((H)=>setTimeout(H,4));process.stdout.write(`
|
|
323
|
+
`)}return Y}async function eB(_,$){let q=$.eli5?0.7:0.3,Z=$.tldr?100:$.keyPoints?800:$.eli5?600:1200,Q=JSON.stringify({model:$.model,messages:[{role:"user",content:_}],stream:$.stream??!1,options:{temperature:q,num_predict:$.maxTokens??Z,top_p:0.95,top_k:40}}),X=120000,J=new AbortController,Y=setTimeout(()=>J.abort(),120000);try{let K=await fetch("http://localhost:11434/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:Q,signal:J.signal});if(clearTimeout(Y),!K.ok){let U=await K.text();throw new Error(`Ollama error: ${K.status} - ${U}`)}if($.stream){let U="",F=K.body?.getReader(),W=new TextDecoder;while(!0){if(!F)throw new Error("Reader is not available");let{done:L,value:A}=await F.read();if(L)break;let D=W.decode(A).split(`
|
|
324
|
+
`).filter(Boolean);for(let j of D)try{let R=JSON.parse(j).message?.content||"";process.stdout.write(B.gray(R)),U+=R}catch{}}return process.stdout.write(`
|
|
325
|
+
`),U}let V=(await K.json()).message,G=V?.content?.trim()??"";if(!G&&V?.thinking?.trim()){let U=V.thinking.trim(),F=U.match(/"([^"]+)"$/);if(F)G=F[1]??"";else{let W=U.split(/[.!?]+/).filter((L)=>L.trim().length>10);if(W.length>0)G=`${W[W.length-1]?.trim()}.`;else G=U.slice(0,500)+(U.length>500?"...":"")}}if(W0(G))return console.error("\uD83D\uDEA8 CRITICAL: Binary artifacts in Ollama response! Applying emergency cleaning..."),F0(G);return G.replace(/\b(console|warn|error|log|TextDecoder|Buffer|ArrayBuffer)\b/gi,"").replace(/\b0x[0-9A-Fa-f]+/g,"").replace(/ {2,}/g," ").replace(/\t/g," ").trim()}catch(K){if(clearTimeout(Y),K.name==="AbortError")throw new Error("Ollama timeout: Large model took longer than 120s to respond");throw K}}import{spawn as R0}from"node:child_process";import{unlink as _V,writeFile as $V}from"node:fs/promises";import{tmpdir as qV}from"node:os";import{join as ZV}from"node:path";import{ElevenLabsClient as QV}from"@elevenlabs/elevenlabs-js";var D0={en:{alloy:"21m00Tcm4TlvDq8ikWAM",echo:"jsCqWAovK2LkecY7zXl4",nova:"IKne3meq5aSn9XLyUdCD",shimmer:"LcfcDJNUP1GQjkzn1xUU",onyx:"N2lVS1w4EtoT3dr4eOWO",fable:"jBpfuIE2acCO8z3wKNLl",default:"21m00Tcm4TlvDq8ikWAM"},fr:{antoine:"ErXwobaYiN019PkySvjV",charlotte:"XB0fDUnXU5powFXDhCwa",henri:"qhFERWI2CUBNq3XOLfRE",marie:"VR6AewLTigWG4xSOukaG",default:"XB0fDUnXU5powFXDhCwa"},es:{antonio:"gcLjJkVW4MZ7xQjpwQrO",isabella:"TxGEqnHWrfWFTfGW9XjX",pablo:"flq6f7yk4E4fJM5XTYuZ",sofia:"pMsXgVXv3BLzUgSXRplE",default:"TxGEqnHWrfWFTfGW9XjX"},ht:{default:"21m00Tcm4TlvDq8ikWAM"}},Mq={alloy:"21m00Tcm4TlvDq8ikWAM",echo:"jsCqWAovK2LkecY7zXl4",nova:"IKne3meq5aSn9XLyUdCD",shimmer:"LcfcDJNUP1GQjkzn1xUU",onyx:"N2lVS1w4EtoT3dr4eOWO",fable:"jBpfuIE2acCO8z3wKNLl"},Pq={en:"eleven_monolingual_v1",fr:"eleven_multilingual_v2",es:"eleven_multilingual_v2",ht:"eleven_multilingual_v2",default:"eleven_monolingual_v1"};class wq{client;apiKey;constructor(_){if(this.apiKey=_||process.env.ELEVENLABS_API_KEY,this.apiKey)this.client=new QV({apiKey:this.apiKey})}async synthesize(_,$={}){let q=this.cleanTextForSpeech(_);if(this.client&&this.apiKey)try{return await this.synthesizeWithElevenLabs(q,$)}catch(Z){console.warn(B.yellow("⚠️ ElevenLabs failed, falling back to local TTS")),console.error(Z)}return await this.synthesizeWithLocalTTS(q,$)}async synthesizeCleanedText(_,$={}){if(this.client&&this.apiKey)try{return await this.synthesizeWithElevenLabs(_,$)}catch(q){console.warn(B.yellow("⚠️ ElevenLabs failed, falling back to local TTS")),console.error(q)}return await this.synthesizeWithLocalTTS(_,$)}async synthesizeWithElevenLabs(_,$){if(!this.client)throw new Error("ElevenLabs client not initialized");try{let{voiceId:q,model:Z,voiceSettings:Q}=this.getOptimalVoiceConfig($),X=await this.client.textToSpeech.convert(q,{text:_,modelId:Z,voiceSettings:Q}),J=[];for await(let H of X)J.push(Buffer.from(H));let Y=Buffer.concat(J),K=$.outputFile||ZV(qV(),`glance-audio-${Date.now()}.mp3`);if(await $V(K,Y),!$.outputFile)await this.playAudio(K),setTimeout(()=>_V(K).catch(()=>{}),5000);return{success:!0,outputFile:K}}catch(q){return{success:!1,error:q instanceof Error?q.message:"Unknown error"}}}async synthesizeWithLocalTTS(_,$){let q=process.platform;try{if(q==="darwin")return await this.useMacOSSay(_,$);else if(q==="win32")return await this.useWindowsTTS(_,$);else return await this.useLinuxTTS(_,$)}catch(Z){return{success:!1,error:`Local TTS failed: ${Z instanceof Error?Z.message:"Unknown error"}`}}}async useMacOSSay(_,$){return new Promise((q)=>{let Z=[],Q={fr:"Thomas",es:"Jorge",ht:"Thomas",en:"Alex"};if($.voice)Z.push("-v",$.voice);else if($.language){let J=Q[$.language];if(J)Z.push("-v",J)}if($.outputFile)Z.push("-o",$.outputFile);Z.push(_);let X=R0("say",Z);X.on("error",(J)=>{q({success:!1,error:`macOS say command failed: ${J.message}`})}),X.on("close",(J)=>{if(J===0)q({success:!0,outputFile:$.outputFile});else q({success:!1,error:`macOS say command exited with code ${J}`})})})}async useWindowsTTS(_,$){return new Promise((q)=>{let Z=`
|
|
326
326
|
Add-Type -AssemblyName System.Speech
|
|
327
327
|
$synthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
|
328
328
|
${$.outputFile?`$synthesizer.SetOutputToWaveFile("${$.outputFile}")`:""}
|
|
329
329
|
$synthesizer.Speak("${_.replace(/"/g,'""')}")
|
|
330
|
-
`,Q=
|
|
330
|
+
`,Q=R0("powershell",["-Command",Z]);Q.on("error",(X)=>{q({success:!1,error:`Windows TTS failed: ${X.message}`})}),Q.on("close",(X)=>{if(X===0)q({success:!0,outputFile:$.outputFile});else q({success:!1,error:`Windows TTS exited with code ${X}`})})})}async useLinuxTTS(_,$){return new Promise((q)=>{let Z=[];if($.outputFile)Z.push("-w",$.outputFile);Z.push(_);let Q=R0("espeak",Z);Q.on("error",()=>{let X=R0("festival",["--tts"]);X.stdin.write(_),X.stdin.end(),X.on("error",(J)=>{q({success:!1,error:`Linux TTS failed: ${J.message}`})}),X.on("close",(J)=>{if(J===0)q({success:!0,outputFile:$.outputFile});else q({success:!1,error:`Linux TTS exited with code ${J}`})})}),Q.on("close",(X)=>{if(X===0)q({success:!0,outputFile:$.outputFile});else q({success:!1,error:`espeak exited with code ${X}`})})})}async playAudio(_){let $=process.platform;return new Promise((q,Z)=>{let Q,X=[_];if($==="darwin")Q="afplay";else if($==="win32")Q="powershell",X=["-c",`(New-Object Media.SoundPlayer "${_}").PlaySync()`];else Q="aplay";let J=R0(Q,X);J.on("error",(Y)=>{if($==="linux"){let K=R0("mpv",["--no-video",_]);K.on("error",()=>{let H=R0("ffplay",["-nodisp","-autoexit",_]);H.on("error",()=>Z(Y)),H.on("close",()=>q())}),K.on("close",()=>q())}else Z(Y)}),J.on("close",()=>q())})}getOptimalVoiceConfig(_){let $=_.language||"en",q=_.voice,Z=D0[$]||D0.en,Q;if(q)if(q in Z)Q=Z[q];else if(q in Mq)Q=Mq[q];else Q=q;else Q=Z.default||Z[Object.keys(Z)[0]];let X=_.model||Pq[$]||Pq.default,J=this.getLanguageOptimizedSettings($,_);return{voiceId:Q,model:X,voiceSettings:J}}getLanguageOptimizedSettings(_,$){let q={stability:$.stability??0.5,similarity_boost:$.similarityBoost??0.75,style:$.style??0,use_speaker_boost:$.speakerBoost??!0};switch(_){case"fr":return{...q,stability:$.stability??0.6,similarity_boost:$.similarityBoost??0.8,style:$.style??0.1};case"es":return{...q,stability:$.stability??0.55,similarity_boost:$.similarityBoost??0.85,style:$.style??0.15};case"ht":return{...q,stability:$.stability??0.7,similarity_boost:$.similarityBoost??0.6,style:$.style??0};default:return q}}getVoiceDescription(_){return{alloy:"Warm, Friendly (Rachel)",echo:"Professional, Clear (Clyde)",nova:"Energetic, Enthusiastic (Charlie)",shimmer:"Clear, Articulate (Charlotte)",onyx:"Deep, Authoritative (Callum)",fable:"Expressive, Dynamic (Gigi)",antoine:"French Male, Natural",charlotte:"French Female, Clear",henri:"French Male, Professional",marie:"French Female, Warm",antonio:"Spanish Male, Neutral",isabella:"Spanish Female, Clear",pablo:"Spanish Male, Energetic",sofia:"Spanish Female, Professional"}[_]||"Available Voice"}cleanTextForSpeech(_){let $=_.replace(/#{1,6}\s/g,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^[-*+]\s/gm,"").replace(/^\d+\.\s/gm,"");$=$.replace(/\n{3,}/g,`
|
|
331
331
|
|
|
332
|
-
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}async listVoices(_){let $=process.platform;if(this.client&&this.apiKey)try{let q=await this.client.voices.getAll(),Z=[];if(Z.push("\uD83C\uDFA4 Available Voices (use name or voice ID):"),Z.push(""),Z.push("\uD83C\uDDFA\uD83C\uDDF8 ENGLISH VOICES:"),Object.entries(
|
|
333
|
-
`).filter((J)=>J.trim()).map((J)=>{let Y=J.split(/\s+/),K=Y[0],H=Y.slice(1).join(" ");return`${K} - ${H} [LOCAL]`});q(X)}),Z.on("error",()=>{q([])})});return[]}}function
|
|
332
|
+
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}async listVoices(_){let $=process.platform;if(this.client&&this.apiKey)try{let q=await this.client.voices.getAll(),Z=[];if(Z.push("\uD83C\uDFA4 Available Voices (use name or voice ID):"),Z.push(""),Z.push("\uD83C\uDDFA\uD83C\uDDF8 ENGLISH VOICES:"),Object.entries(D0.en).forEach(([Q,X])=>{if(Q!=="default"){if(q.voices.find((Y)=>Y.voiceId===X))Z.push(` • ${Q} → ${this.getVoiceDescription(Q)}`)}}),Z.push(""),D0.fr){let Q=[];if(Object.entries(D0.fr).forEach(([X,J])=>{if(X!=="default"){if(q.voices.find((K)=>K.voiceId===J))Q.push(` • ${X} → ${this.getVoiceDescription(X)}`)}}),Q.length>0)Z.push("\uD83C\uDDEB\uD83C\uDDF7 FRENCH VOICES:"),Z.push(...Q),Z.push("")}if(D0.es){let Q=[];if(Object.entries(D0.es).forEach(([X,J])=>{if(X!=="default"){if(q.voices.find((K)=>K.voiceId===J))Q.push(` • ${X} → ${this.getVoiceDescription(X)}`)}}),Q.length>0)Z.push("\uD83C\uDDEA\uD83C\uDDF8 SPANISH VOICES:"),Z.push(...Q),Z.push("")}if(D0.ht)Z.push("\uD83C\uDDED\uD83C\uDDF9 HAITIAN CREOLE:"),Z.push(" • Uses English voice with optimized settings"),Z.push("");return Z.push("\uD83D\uDCA1 USAGE EXAMPLES:"),Z.push(" glance https://example.com --voice nova --read"),Z.push(" glance https://example.com --voice antoine -l fr --read"),Z.push(" glance https://example.com --voice isabella -l es --read"),Z.push(""),Z.push("⚠️ NOTE: Only the voices listed above work with simple names."),Z.push(" For other voices, use the full voice ID (long string)."),Z.push(""),Z.push("\uD83D\uDD0D ALL AVAILABLE VOICES IN YOUR ACCOUNT:"),q.voices.forEach((Q)=>{Z.push(` ${Q.name} (${Q.voiceId})`)}),Z}catch(q){console.warn("Failed to fetch ElevenLabs voices:",q)}if($==="darwin")return new Promise((q)=>{let Z=R0("say",["-v","?"]),Q="";Z.stdout.on("data",(X)=>{Q+=X.toString()}),Z.on("close",()=>{let X=Q.split(`
|
|
333
|
+
`).filter((J)=>J.trim()).map((J)=>{let Y=J.split(/\s+/),K=Y[0],H=Y.slice(1).join(" ");return`${K} - ${H} [LOCAL]`});q(X)}),Z.on("error",()=>{q([])})});return[]}}function n3(_){return new wq(_)}function Cq(_){let $=_.replace(/#{1,6}\s/g,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^[-*+]\s/gm,"").replace(/^\d+\.\s/gm,"");$=$.replace(/\n{3,}/g,`
|
|
334
334
|
|
|
335
|
-
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}var
|
|
336
|
-
${
|
|
335
|
+
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}var e={VERSION:"0.16.0",MAX_CONTENT_SIZE:10485760,FETCH_TIMEOUT:30000,RETRY_ATTEMPTS:3,RETRY_DELAY:1000,OLLAMA_ENDPOINT:process.env.OLLAMA_ENDPOINT||"http://localhost:11434"},r0={en:"English",fr:"French",es:"Spanish",ht:"Haitian Creole"},Ww=Object.keys(r0);function Tq(){console.log(`
|
|
336
|
+
${B.bold("glance")} v${e.VERSION} – AI-powered web reader
|
|
337
337
|
|
|
338
|
-
${
|
|
338
|
+
${B.bold("Usage:")}
|
|
339
339
|
glance <url> [options]
|
|
340
340
|
|
|
341
|
-
${
|
|
342
|
-
${
|
|
343
|
-
${
|
|
341
|
+
${B.bold("Options:")}
|
|
342
|
+
${B.cyan("--help, -h")} Show this help message
|
|
343
|
+
${B.cyan("--version, -v")} Show version number
|
|
344
344
|
|
|
345
|
-
${
|
|
346
|
-
${
|
|
347
|
-
${
|
|
348
|
-
${
|
|
349
|
-
${
|
|
350
|
-
${
|
|
345
|
+
${B.bold("Summary Options:")}
|
|
346
|
+
${B.cyan("--tldr")} Get a one-sentence summary
|
|
347
|
+
${B.cyan("--key-points")} Extract key points as bullet points
|
|
348
|
+
${B.cyan("--eli5")} Explain like I'm five
|
|
349
|
+
${B.cyan("--full")} Read complete article without summarization ${B.green("(NEW!)")}
|
|
350
|
+
${B.cyan("--ask, -q <question>")} Ask a specific question about the content
|
|
351
351
|
|
|
352
|
-
${
|
|
353
|
-
${
|
|
354
|
-
${
|
|
355
|
-
${
|
|
356
|
-
${
|
|
357
|
-
${
|
|
352
|
+
${B.bold("Language & Voice:")}
|
|
353
|
+
${B.cyan("--language, -l <lang>")} Output language (en, fr, es, ht)
|
|
354
|
+
${B.cyan("--read, -r")} Read the summary aloud using text-to-speech
|
|
355
|
+
${B.cyan("--voice <voice>")} Select voice for speech synthesis (e.g., nova, antoine)
|
|
356
|
+
${B.cyan("--list-voices")} List all available voices by language
|
|
357
|
+
${B.cyan("--audio-output <file>")} Save audio to file (mp3/wav)
|
|
358
358
|
|
|
359
|
-
${
|
|
360
|
-
${
|
|
361
|
-
${
|
|
362
|
-
${
|
|
363
|
-
${
|
|
364
|
-
${
|
|
365
|
-
${
|
|
359
|
+
${B.bold("AI Provider Options:")}
|
|
360
|
+
${B.cyan("--model, -m <model>")} Specify AI model (e.g., gpt-4o-mini, gemini-2.0-flash-exp, llama3)
|
|
361
|
+
${B.cyan("--list-models")} List available Ollama models
|
|
362
|
+
${B.cyan("--stream")} Stream the response as it's generated
|
|
363
|
+
${B.cyan("--max-tokens <n>")} Maximum tokens for response (1-100000)
|
|
364
|
+
${B.cyan("--free-only")} Only use free services (never use paid APIs)
|
|
365
|
+
${B.cyan("--prefer-quality")} Prefer paid services for better quality
|
|
366
366
|
|
|
367
|
-
${
|
|
368
|
-
${
|
|
367
|
+
${B.bold("Service Management:")}
|
|
368
|
+
${B.cyan("--check-services")} Check available AI services and their status
|
|
369
369
|
|
|
370
|
-
${
|
|
371
|
-
${
|
|
372
|
-
${
|
|
373
|
-
${
|
|
370
|
+
${B.bold("Output Format:")}
|
|
371
|
+
${B.cyan("--format <type>")} Output format: md, json, plain (default: terminal)
|
|
372
|
+
${B.cyan("--output, -o <file>")} Save to file (auto-detects format from extension)
|
|
373
|
+
${B.cyan("--copy, -c")} Copy summary to clipboard
|
|
374
374
|
|
|
375
|
-
${
|
|
376
|
-
${
|
|
377
|
-
${
|
|
378
|
-
${
|
|
379
|
-
${
|
|
380
|
-
${
|
|
381
|
-
|
|
382
|
-
${
|
|
383
|
-
${
|
|
375
|
+
${B.bold("Advanced Options:")}
|
|
376
|
+
${B.cyan("--full-render")} Enable JavaScript rendering (slower, for SPAs)
|
|
377
|
+
${B.cyan("--screenshot <file>")} Capture a screenshot of the page
|
|
378
|
+
${B.cyan("--metadata")} Show page metadata (author, dates, etc.)
|
|
379
|
+
${B.cyan("--links")} Extract all links from the page
|
|
380
|
+
${B.cyan("--debug")} Enable debug output
|
|
381
|
+
|
|
382
|
+
${B.bold("Examples:")}
|
|
383
|
+
${B.gray("# Quick summary")}
|
|
384
384
|
glance https://www.ayiti.ai
|
|
385
385
|
|
|
386
|
-
${
|
|
386
|
+
${B.gray("# One-sentence summary with voice")}
|
|
387
387
|
glance https://news.site/article --tldr --read
|
|
388
388
|
|
|
389
|
-
${
|
|
389
|
+
${B.gray("# Read full article with AI formatting")}
|
|
390
390
|
glance https://blog.com/post --full --read
|
|
391
391
|
|
|
392
|
-
${
|
|
392
|
+
${B.gray("# Ask a specific question")}
|
|
393
393
|
glance https://docs.site/api --ask "How do I authenticate?"
|
|
394
394
|
|
|
395
|
-
${
|
|
395
|
+
${B.gray("# French summary with French voice")}
|
|
396
396
|
glance https://www.ayiti.ai -l fr --voice antoine --read
|
|
397
397
|
|
|
398
|
-
${
|
|
398
|
+
${B.gray("# Use specific AI model")}
|
|
399
399
|
glance https://www.ayiti.ai --model gpt-4o-mini
|
|
400
400
|
|
|
401
|
-
${
|
|
401
|
+
${B.gray("# Check available services")}
|
|
402
402
|
glance --check-services
|
|
403
403
|
|
|
404
|
-
${
|
|
405
|
-
${
|
|
406
|
-
${
|
|
407
|
-
${
|
|
408
|
-
${
|
|
404
|
+
${B.bold("Environment Variables:")}
|
|
405
|
+
${B.cyan("OPENAI_API_KEY")} API key for OpenAI
|
|
406
|
+
${B.cyan("GEMINI_API_KEY")} API key for Google Gemini
|
|
407
|
+
${B.cyan("ELEVENLABS_API_KEY")} API key for ElevenLabs voice synthesis
|
|
408
|
+
${B.cyan("OLLAMA_ENDPOINT")} Custom Ollama endpoint (default: http://localhost:11434)
|
|
409
409
|
|
|
410
|
-
${
|
|
411
|
-
`)}function
|
|
410
|
+
${B.dim("For more information: https://github.com/jkenley/glance-cli")}
|
|
411
|
+
`)}function kq(){console.log(`glance v${e.VERSION}`)}function Iq(_){if(_&&typeof _==="object"&&"code"in _&&_.code==="ENOTFOUND")return B.red("Cannot reach the website. Please check your internet connection and the URL.");if(_&&typeof _==="object"&&"code"in _&&_.code==="ETIMEDOUT")return B.red("Request timed out. The website might be slow or unresponsive.");if(_&&typeof _==="object"&&"userMessage"in _)return B.red(String(_.userMessage));let $=_ instanceof Error?_.message:String(_);return B.red(`Error: ${$||"Unknown error occurred"}`)}function o3(_){if(!_){console.error(B.red("Service detection failed - no services information available"));return}console.log(B.bold(`
|
|
412
412
|
\uD83D\uDD0D Service Detection Results:
|
|
413
|
-
`));let $=(q)=>q?
|
|
414
|
-
Voice Services:`)),_.elevenlabs)console.log(` ElevenLabs: ${$(_.elevenlabs.available)} ${_.elevenlabs.available&&_.elevenlabs.voices?
|
|
415
|
-
Default Configuration:`)),console.log(` Default AI Model: ${
|
|
416
|
-
\uD83D\uDCA1 Recommendations:`)),_.recommendations.forEach((q)=>{console.log(` • ${q}`)});console.log(
|
|
417
|
-
For setup instructions, visit: https://github.com/jkenley/glance-cli#setup`))}class
|
|
418
|
-
${$}`,JU=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),YU=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),KU=(_,$,q)=>{let Z=q===""?"":`with ${q.trim()}() `,Q=XU.bind(null,Z,$.toString());Object.defineProperty(Q,"name",YU);let{writable:X,enumerable:J,configurable:Y}=JU;Object.defineProperty(_,"toString",{value:Q,writable:X,enumerable:J,configurable:Y})};function i3(_,$,{ignoreNonConfigurable:q=!1}={}){let{name:Z}=_;for(let Q of Reflect.ownKeys($))qU(_,$,Q,q);return QU(_,$),KU(_,$,Z),_}var d2=new WeakMap,Tq=(_,$={})=>{if(typeof _!=="function")throw new TypeError("Expected a function");let q,Z=0,Q=_.displayName||_.name||"<anonymous>",X=function(...J){if(d2.set(X,++Z),Z===1)q=_.apply(this,J),_=void 0;else if($.throw===!0)throw new Error(`Function \`${Q}\` can only be called once`);return q};return i3(X,_),d2.set(X,Z),X};Tq.callCount=(_)=>{if(!d2.has(_))throw new Error(`The given function \`${_.name}\` is not wrapped by the \`onetime\` package`);return d2.get(_)};var Iq=Tq;var I0=[];I0.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")I0.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")I0.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var c2=(_)=>!!_&&typeof _==="object"&&typeof _.removeListener==="function"&&typeof _.emit==="function"&&typeof _.reallyExit==="function"&&typeof _.listeners==="function"&&typeof _.kill==="function"&&typeof _.pid==="number"&&typeof _.on==="function",n3=Symbol.for("signal-exit emitter"),o3=globalThis,HU=Object.defineProperty.bind(Object);class Oq{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(o3[n3])return o3[n3];HU(o3,n3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(_,$){this.listeners[_].push($)}removeListener(_,$){let q=this.listeners[_],Z=q.indexOf($);if(Z===-1)return;if(Z===0&&q.length===1)q.length=0;else q.splice(Z,1)}emit(_,$,q){if(this.emitted[_])return!1;this.emitted[_]=!0;let Z=!1;for(let Q of this.listeners[_])Z=Q($,q)===!0||Z;if(_==="exit")Z=this.emit("afterExit",$,q)||Z;return Z}}class t3{}var BU=(_)=>{return{onExit($,q){return _.onExit($,q)},load(){return _.load()},unload(){return _.unload()}}};class Eq extends t3{onExit(){return()=>{}}load(){}unload(){}}class xq extends t3{#Z=r3.platform==="win32"?"SIGINT":"SIGHUP";#$=new Oq;#_;#q;#Y;#J={};#Q=!1;constructor(_){super();this.#_=_,this.#J={};for(let $ of I0)this.#J[$]=()=>{let q=this.#_.listeners($),{count:Z}=this.#$,Q=_;if(typeof Q.__signal_exit_emitter__==="object"&&typeof Q.__signal_exit_emitter__.count==="number")Z+=Q.__signal_exit_emitter__.count;if(q.length===Z){this.unload();let X=this.#$.emit("exit",null,$),J=$==="SIGHUP"?this.#Z:$;if(!X)_.kill(_.pid,J)}};this.#Y=_.reallyExit,this.#q=_.emit}onExit(_,$){if(!c2(this.#_))return()=>{};if(this.#Q===!1)this.load();let q=$?.alwaysLast?"afterExit":"exit";return this.#$.on(q,_),()=>{if(this.#$.removeListener(q,_),this.#$.listeners.exit.length===0&&this.#$.listeners.afterExit.length===0)this.unload()}}load(){if(this.#Q)return;this.#Q=!0,this.#$.count+=1;for(let _ of I0)try{let $=this.#J[_];if($)this.#_.on(_,$)}catch($){}this.#_.emit=(_,...$)=>{return this.#X(_,...$)},this.#_.reallyExit=(_)=>{return this.#K(_)}}unload(){if(!this.#Q)return;this.#Q=!1,I0.forEach((_)=>{let $=this.#J[_];if(!$)throw new Error("Listener not defined for signal: "+_);try{this.#_.removeListener(_,$)}catch(q){}}),this.#_.emit=this.#q,this.#_.reallyExit=this.#Y,this.#$.count-=1}#K(_){if(!c2(this.#_))return 0;return this.#_.exitCode=_||0,this.#$.emit("exit",this.#_.exitCode,null),this.#Y.call(this.#_,this.#_.exitCode)}#X(_,...$){let q=this.#q;if(_==="exit"&&c2(this.#_)){if(typeof $[0]==="number")this.#_.exitCode=$[0];let Z=q.call(this.#_,_,...$);return this.#$.emit("exit",this.#_.exitCode,null),Z}else return q.call(this.#_,_,...$)}}var r3=globalThis.process,{onExit:Nq,load:AM,unload:PM}=BU(c2(r3)?new xq(r3):new Eq);var yq=l2.stderr.isTTY?l2.stderr:l2.stdout.isTTY?l2.stdout:void 0,UU=yq?Iq(()=>{Nq(()=>{yq.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},vq=UU;var p2=!1,t0={};t0.show=(_=hq.stderr)=>{if(!_.isTTY)return;p2=!1,_.write("\x1B[?25h")};t0.hide=(_=hq.stderr)=>{if(!_.isTTY)return;vq(),p2=!0,_.write("\x1B[?25l")};t0.toggle=(_,$)=>{if(_!==void 0)p2=_;if(p2)t0.show($);else t0.hide($)};var s3=t0;var e3={dots:{interval:80,frames:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},dots2:{interval:80,frames:["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},dots3:{interval:80,frames:["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},dots4:{interval:80,frames:["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},dots5:{interval:80,frames:["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},dots6:{interval:80,frames:["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},dots7:{interval:80,frames:["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},dots8:{interval:80,frames:["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},dots9:{interval:80,frames:["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},dots10:{interval:80,frames:["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},dots11:{interval:100,frames:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},dots12:{interval:80,frames:["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},dots13:{interval:80,frames:["⣼","⣹","⢻","⠿","⡟","⣏","⣧","⣶"]},dots14:{interval:80,frames:["⠉⠉","⠈⠙","⠀⠹","⠀⢸","⠀⣰","⢀⣠","⣀⣀","⣄⡀","⣆⠀","⡇⠀","⠏⠀","⠋⠁"]},dots8Bit:{interval:80,frames:["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},dotsCircle:{interval:80,frames:["⢎ ","⠎⠁","⠊⠑","⠈⠱"," ⡱","⢀⡰","⢄⡠","⢆⡀"]},sand:{interval:80,frames:["⠁","⠂","⠄","⡀","⡈","⡐","⡠","⣀","⣁","⣂","⣄","⣌","⣔","⣤","⣥","⣦","⣮","⣶","⣷","⣿","⡿","⠿","⢟","⠟","⡛","⠛","⠫","⢋","⠋","⠍","⡉","⠉","⠑","⠡","⢁"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["⠂","-","–","—","–","-"]},rollingLine:{interval:80,frames:["/ "," - "," \\ "," |"," |"," \\ "," - ","/ "]},pipe:{interval:100,frames:["┤","┘","┴","└","├","┌","┬","┐"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["✶","✸","✹","✺","✹","✷"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","´","-","_","_","_"]},hamburger:{interval:100,frames:["☱","☲","☴"]},growVertical:{interval:120,frames:["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},growHorizontal:{interval:120,frames:["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","°","O","o","."]},noise:{interval:100,frames:["▓","▒","░"]},bounce:{interval:120,frames:["⠁","⠂","⠄","⠂"]},boxBounce:{interval:120,frames:["▖","▘","▝","▗"]},boxBounce2:{interval:100,frames:["▌","▀","▐","▄"]},triangle:{interval:50,frames:["◢","◣","◤","◥"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["◜","◠","◝","◞","◡","◟"]},circle:{interval:120,frames:["◡","⊙","◠"]},squareCorners:{interval:180,frames:["◰","◳","◲","◱"]},circleQuarters:{interval:120,frames:["◴","◷","◶","◵"]},circleHalves:{interval:50,frames:["◐","◓","◑","◒"]},squish:{interval:100,frames:["╫","╪"]},toggle:{interval:250,frames:["⊶","⊷"]},toggle2:{interval:80,frames:["▫","▪"]},toggle3:{interval:120,frames:["□","■"]},toggle4:{interval:100,frames:["■","□","▪","▫"]},toggle5:{interval:100,frames:["▮","▯"]},toggle6:{interval:300,frames:["ဝ","၀"]},toggle7:{interval:80,frames:["⦾","⦿"]},toggle8:{interval:100,frames:["◍","◌"]},toggle9:{interval:100,frames:["◉","◎"]},toggle10:{interval:100,frames:["㊂","㊀","㊁"]},toggle11:{interval:50,frames:["⧇","⧆"]},toggle12:{interval:120,frames:["☗","☖"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["←","↖","↑","↗","→","↘","↓","↙"]},arrow2:{interval:80,frames:["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},arrow3:{interval:120,frames:["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},smiley:{interval:200,frames:["😄 ","😝 "]},monkey:{interval:300,frames:["🙈 ","🙈 ","🙉 ","🙊 "]},hearts:{interval:100,frames:["💛 ","💙 ","💜 ","💚 ","💗 "]},clock:{interval:100,frames:["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},earth:{interval:180,frames:["🌍 ","🌎 ","🌏 "]},material:{interval:17,frames:["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███████▁▁▁▁▁▁▁▁▁▁▁▁▁","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","██████████▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","█████████████▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁██████████████▁▁▁▁","▁▁▁██████████████▁▁▁","▁▁▁▁█████████████▁▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁▁▁████████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","██████▁▁▁▁▁▁▁▁▁▁▁▁▁█","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁▁█████████████▁▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁▁███████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁▁█████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"]},moon:{interval:80,frames:["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},runner:{interval:140,frames:["🚶 ","🏃 "]},pong:{interval:80,frames:["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},shark:{interval:120,frames:["▐|\\____________▌","▐_|\\___________▌","▐__|\\__________▌","▐___|\\_________▌","▐____|\\________▌","▐_____|\\_______▌","▐______|\\______▌","▐_______|\\_____▌","▐________|\\____▌","▐_________|\\___▌","▐__________|\\__▌","▐___________|\\_▌","▐____________|\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},christmas:{interval:400,frames:["🌲","🎄"]},grenade:{interval:80,frames:["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},point:{interval:125,frames:["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},layer:{interval:150,frames:["-","=","≡"]},betaWave:{interval:80,frames:["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]},fingerDance:{interval:160,frames:["🤘 ","🤟 ","🖖 ","✋ ","🤚 ","👆 "]},fistBump:{interval:80,frames:["🤜 🤛 ","🤜 🤛 ","🤜 🤛 "," 🤜 🤛 "," 🤜🤛 "," 🤜✨🤛 ","🤜 ✨ 🤛 "]},soccerHeader:{interval:80,frames:[" 🧑⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 "]},mindblown:{interval:160,frames:["😐 ","😐 ","😮 ","😮 ","😦 ","😦 ","😧 ","😧 ","🤯 ","💥 ","✨ "," "," "," "]},speaker:{interval:160,frames:["🔈 ","🔉 ","🔊 ","🔉 "]},orangePulse:{interval:100,frames:["🔸 ","🔶 ","🟠 ","🟠 ","🔶 "]},bluePulse:{interval:100,frames:["🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},orangeBluePulse:{interval:100,frames:["🔸 ","🔶 ","🟠 ","🟠 ","🔶 ","🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},timeTravel:{interval:100,frames:["🕛 ","🕚 ","🕙 ","🕘 ","🕗 ","🕖 ","🕕 ","🕔 ","🕓 ","🕒 ","🕑 ","🕐 "]},aesthetic:{interval:80,frames:["▰▱▱▱▱▱▱","▰▰▱▱▱▱▱","▰▰▰▱▱▱▱","▰▰▰▰▱▱▱","▰▰▰▰▰▱▱","▰▰▰▰▰▰▱","▰▰▰▰▰▰▰","▰▱▱▱▱▱▱"]},dwarfFortress:{interval:80,frames:[" ██████£££ ","☺██████£££ ","☺██████£££ ","☺▓█████£££ ","☺▓█████£££ ","☺▒█████£££ ","☺▒█████£££ ","☺░█████£££ ","☺░█████£££ ","☺ █████£££ "," ☺█████£££ "," ☺█████£££ "," ☺▓████£££ "," ☺▓████£££ "," ☺▒████£££ "," ☺▒████£££ "," ☺░████£££ "," ☺░████£££ "," ☺ ████£££ "," ☺████£££ "," ☺████£££ "," ☺▓███£££ "," ☺▓███£££ "," ☺▒███£££ "," ☺▒███£££ "," ☺░███£££ "," ☺░███£££ "," ☺ ███£££ "," ☺███£££ "," ☺███£££ "," ☺▓██£££ "," ☺▓██£££ "," ☺▒██£££ "," ☺▒██£££ "," ☺░██£££ "," ☺░██£££ "," ☺ ██£££ "," ☺██£££ "," ☺██£££ "," ☺▓█£££ "," ☺▓█£££ "," ☺▒█£££ "," ☺▒█£££ "," ☺░█£££ "," ☺░█£££ "," ☺ █£££ "," ☺█£££ "," ☺█£££ "," ☺▓£££ "," ☺▓£££ "," ☺▒£££ "," ☺▒£££ "," ☺░£££ "," ☺░£££ "," ☺ £££ "," ☺£££ "," ☺£££ "," ☺▓££ "," ☺▓££ "," ☺▒££ "," ☺▒££ "," ☺░££ "," ☺░££ "," ☺ ££ "," ☺££ "," ☺££ "," ☺▓£ "," ☺▓£ "," ☺▒£ "," ☺▒£ "," ☺░£ "," ☺░£ "," ☺ £ "," ☺£ "," ☺£ "," ☺▓ "," ☺▓ "," ☺▒ "," ☺▒ "," ☺░ "," ☺░ "," ☺ "," ☺ &"," ☺ ☼&"," ☺ ☼ &"," ☺☼ &"," ☺☼ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & ","‼ & "," & "," & "," & ░ "," & ▒ "," & ▓ "," & £ "," & ░£ "," & ▒£ "," & ▓£ "," & ££ "," & ░££ "," & ▒££ ","& ▓££ ","& £££ "," ░£££ "," ▒£££ "," ▓£££ "," █£££ "," ░█£££ "," ▒█£££ "," ▓█£££ "," ██£££ "," ░██£££ "," ▒██£££ "," ▓██£££ "," ███£££ "," ░███£££ "," ▒███£££ "," ▓███£££ "," ████£££ "," ░████£££ "," ▒████£££ "," ▓████£££ "," █████£££ "," ░█████£££ "," ▒█████£££ "," ▓█████£££ "," ██████£££ "," ██████£££ "]}};var L1=e3,vM=Object.keys(e3);var O0={};qZ(O0,{warning:()=>WU,success:()=>FU,info:()=>GU,error:()=>zU});var a2=D0(),GU=l5(a2?"ℹ":"i"),FU=d5(a2?"✔":"√"),WU=c5(a2?"⚠":"‼"),zU=m5(a2?"✖":"×");function _5({onlyFirst:_=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",_?void 0:"g")}var LU=_5();function R1(_){if(typeof _!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof _}\``);return _.replace(LU,"")}function Sq(_){return _===161||_===164||_===167||_===168||_===170||_===173||_===174||_>=176&&_<=180||_>=182&&_<=186||_>=188&&_<=191||_===198||_===208||_===215||_===216||_>=222&&_<=225||_===230||_>=232&&_<=234||_===236||_===237||_===240||_===242||_===243||_>=247&&_<=250||_===252||_===254||_===257||_===273||_===275||_===283||_===294||_===295||_===299||_>=305&&_<=307||_===312||_>=319&&_<=322||_===324||_>=328&&_<=331||_===333||_===338||_===339||_===358||_===359||_===363||_===462||_===464||_===466||_===468||_===470||_===472||_===474||_===476||_===593||_===609||_===708||_===711||_>=713&&_<=715||_===717||_===720||_>=728&&_<=731||_===733||_===735||_>=768&&_<=879||_>=913&&_<=929||_>=931&&_<=937||_>=945&&_<=961||_>=963&&_<=969||_===1025||_>=1040&&_<=1103||_===1105||_===8208||_>=8211&&_<=8214||_===8216||_===8217||_===8220||_===8221||_>=8224&&_<=8226||_>=8228&&_<=8231||_===8240||_===8242||_===8243||_===8245||_===8251||_===8254||_===8308||_===8319||_>=8321&&_<=8324||_===8364||_===8451||_===8453||_===8457||_===8467||_===8470||_===8481||_===8482||_===8486||_===8491||_===8531||_===8532||_>=8539&&_<=8542||_>=8544&&_<=8555||_>=8560&&_<=8569||_===8585||_>=8592&&_<=8601||_===8632||_===8633||_===8658||_===8660||_===8679||_===8704||_===8706||_===8707||_===8711||_===8712||_===8715||_===8719||_===8721||_===8725||_===8730||_>=8733&&_<=8736||_===8739||_===8741||_>=8743&&_<=8748||_===8750||_>=8756&&_<=8759||_===8764||_===8765||_===8776||_===8780||_===8786||_===8800||_===8801||_>=8804&&_<=8807||_===8810||_===8811||_===8814||_===8815||_===8834||_===8835||_===8838||_===8839||_===8853||_===8857||_===8869||_===8895||_===8978||_>=9312&&_<=9449||_>=9451&&_<=9547||_>=9552&&_<=9587||_>=9600&&_<=9615||_>=9618&&_<=9621||_===9632||_===9633||_>=9635&&_<=9641||_===9650||_===9651||_===9654||_===9655||_===9660||_===9661||_===9664||_===9665||_>=9670&&_<=9672||_===9675||_>=9678&&_<=9681||_>=9698&&_<=9701||_===9711||_===9733||_===9734||_===9737||_===9742||_===9743||_===9756||_===9758||_===9792||_===9794||_===9824||_===9825||_>=9827&&_<=9829||_>=9831&&_<=9834||_===9836||_===9837||_===9839||_===9886||_===9887||_===9919||_>=9926&&_<=9933||_>=9935&&_<=9939||_>=9941&&_<=9953||_===9955||_===9960||_===9961||_>=9963&&_<=9969||_===9972||_>=9974&&_<=9977||_===9979||_===9980||_===9982||_===9983||_===10045||_>=10102&&_<=10111||_>=11094&&_<=11097||_>=12872&&_<=12879||_>=57344&&_<=63743||_>=65024&&_<=65039||_===65533||_>=127232&&_<=127242||_>=127248&&_<=127277||_>=127280&&_<=127337||_>=127344&&_<=127373||_===127375||_===127376||_>=127387&&_<=127404||_>=917760&&_<=917999||_>=983040&&_<=1048573||_>=1048576&&_<=1114109}function bq(_){return _===12288||_>=65281&&_<=65376||_>=65504&&_<=65510}function fq(_){return _>=4352&&_<=4447||_===8986||_===8987||_===9001||_===9002||_>=9193&&_<=9196||_===9200||_===9203||_===9725||_===9726||_===9748||_===9749||_>=9776&&_<=9783||_>=9800&&_<=9811||_===9855||_>=9866&&_<=9871||_===9875||_===9889||_===9898||_===9899||_===9917||_===9918||_===9924||_===9925||_===9934||_===9940||_===9962||_===9970||_===9971||_===9973||_===9978||_===9981||_===9989||_===9994||_===9995||_===10024||_===10060||_===10062||_>=10067&&_<=10069||_===10071||_>=10133&&_<=10135||_===10160||_===10175||_===11035||_===11036||_===11088||_===11093||_>=11904&&_<=11929||_>=11931&&_<=12019||_>=12032&&_<=12245||_>=12272&&_<=12287||_>=12289&&_<=12350||_>=12353&&_<=12438||_>=12441&&_<=12543||_>=12549&&_<=12591||_>=12593&&_<=12686||_>=12688&&_<=12773||_>=12783&&_<=12830||_>=12832&&_<=12871||_>=12880&&_<=42124||_>=42128&&_<=42182||_>=43360&&_<=43388||_>=44032&&_<=55203||_>=63744&&_<=64255||_>=65040&&_<=65049||_>=65072&&_<=65106||_>=65108&&_<=65126||_>=65128&&_<=65131||_>=94176&&_<=94180||_>=94192&&_<=94198||_>=94208&&_<=101589||_>=101631&&_<=101662||_>=101760&&_<=101874||_>=110576&&_<=110579||_>=110581&&_<=110587||_===110589||_===110590||_>=110592&&_<=110882||_===110898||_>=110928&&_<=110930||_===110933||_>=110948&&_<=110951||_>=110960&&_<=111355||_>=119552&&_<=119638||_>=119648&&_<=119670||_===126980||_===127183||_===127374||_>=127377&&_<=127386||_>=127488&&_<=127490||_>=127504&&_<=127547||_>=127552&&_<=127560||_===127568||_===127569||_>=127584&&_<=127589||_>=127744&&_<=127776||_>=127789&&_<=127797||_>=127799&&_<=127868||_>=127870&&_<=127891||_>=127904&&_<=127946||_>=127951&&_<=127955||_>=127968&&_<=127984||_===127988||_>=127992&&_<=128062||_===128064||_>=128066&&_<=128252||_>=128255&&_<=128317||_>=128331&&_<=128334||_>=128336&&_<=128359||_===128378||_===128405||_===128406||_===128420||_>=128507&&_<=128591||_>=128640&&_<=128709||_===128716||_>=128720&&_<=128722||_>=128725&&_<=128728||_>=128732&&_<=128735||_===128747||_===128748||_>=128756&&_<=128764||_>=128992&&_<=129003||_===129008||_>=129292&&_<=129338||_>=129340&&_<=129349||_>=129351&&_<=129535||_>=129648&&_<=129660||_>=129664&&_<=129674||_>=129678&&_<=129734||_===129736||_>=129741&&_<=129756||_>=129759&&_<=129770||_>=129775&&_<=129784||_>=131072&&_<=196605||_>=196608&&_<=262141}function RU(_){if(!Number.isSafeInteger(_))throw new TypeError(`Expected a code point, got \`${typeof _}\`.`)}function $5(_,{ambiguousAsWide:$=!1}={}){if(RU(_),bq(_)||fq(_)||$&&Sq(_))return 2;return 1}var DU=new Intl.Segmenter,jU=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,kU=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,AU=/^\p{RGI_Emoji}$/v;function PU(_){return _.replace(kU,"")}function MU(_){return jU.test(_)}function CU(_,$){let q=0;if(_.length>1){for(let Z of _.slice(1))if(Z>=""&&Z<="")q+=$5(Z.codePointAt(0),$)}return q}function q5(_,$={}){if(typeof _!=="string"||_.length===0)return 0;let{ambiguousIsNarrow:q=!0,countAnsiEscapeCodes:Z=!1}=$,Q=_;if(!Z)Q=R1(Q);if(Q.length===0)return 0;let X=0,J={ambiguousAsWide:!q};for(let{segment:Y}of DU.segment(Q)){if(MU(Y))continue;if(AU.test(Y)){X+=2;continue}let K=PU(Y).codePointAt(0);X+=$5(K,J),X+=CU(Y,J)}return X}function Z5({stream:_=process.stdout}={}){return Boolean(_&&_.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import o from"node:process";var wU=3;class gq{#Z=0;start(){if(this.#Z++,this.#Z===1)this.#$()}stop(){if(this.#Z<=0)throw new Error("`stop` called more times than `start`");if(this.#Z--,this.#Z===0)this.#_()}#$(){if(o.platform==="win32"||!o.stdin.isTTY)return;o.stdin.setRawMode(!0),o.stdin.on("data",this.#q),o.stdin.resume()}#_(){if(!o.stdin.isTTY)return;o.stdin.off("data",this.#q),o.stdin.pause(),o.stdin.setRawMode(!1)}#q(_){if(_[0]===wU)o.emit("SIGINT")}}var TU=new gq,Q5=TU;class uq{#Z=0;#$=!1;#_=0;#q=-1;#Y=0;#J=0;#Q;#K;#X;#F;#L;#H;#G;#B;#W;#U;#V;color;constructor(_){if(typeof _==="string")_={text:_};if(this.#Q={color:"cyan",stream:i2.stderr,discardStdin:!0,hideCursor:!0,..._},this.color=this.#Q.color,this.spinner=this.#Q.spinner,this.#L=this.#Q.interval,this.#X=this.#Q.stream,this.#H=typeof this.#Q.isEnabled==="boolean"?this.#Q.isEnabled:Z5({stream:this.#X}),this.#G=typeof this.#Q.isSilent==="boolean"?this.#Q.isSilent:!1,this.text=this.#Q.text,this.prefixText=this.#Q.prefixText,this.suffixText=this.#Q.suffixText,this.indent=this.#Q.indent,i2.env.NODE_ENV==="test")this._stream=this.#X,this._isEnabled=this.#H,Object.defineProperty(this,"_linesToClear",{get(){return this.#Z},set($){this.#Z=$}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#q}}),Object.defineProperty(this,"_lineCount",{get(){return this.#_}})}get indent(){return this.#B}set indent(_=0){if(!(_>=0&&Number.isInteger(_)))throw new Error("The `indent` option must be an integer from 0 and up");this.#B=_,this.#z()}get interval(){return this.#L??this.#K.interval??100}get spinner(){return this.#K}set spinner(_){if(this.#q=-1,this.#L=void 0,typeof _==="object"){if(!Array.isArray(_.frames)||_.frames.length===0||_.frames.some(($)=>typeof $!=="string"))throw new Error("The given spinner must have a non-empty `frames` array of strings");if(_.interval!==void 0&&!(Number.isInteger(_.interval)&&_.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided");this.#K=_}else if(!D0())this.#K=L1.line;else if(_===void 0)this.#K=L1.dots;else if(_!=="default"&&L1[_])this.#K=L1[_];else throw new Error(`There is no built-in spinner named '${_}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#W}set text(_=""){this.#W=_,this.#z()}get prefixText(){return this.#U}set prefixText(_=""){this.#U=_,this.#z()}get suffixText(){return this.#V}set suffixText(_=""){this.#V=_,this.#z()}get isSpinning(){return this.#F!==void 0}#k(_,$,q=!1){let Z=typeof _==="function"?_():_;if(typeof Z==="string"&&Z!=="")return q?$+Z:Z+$;return""}#R(_=this.#U,$=" "){return this.#k(_,$,!1)}#D(_=this.#V,$=" "){return this.#k(_,$,!0)}#j(_,$){let q=0;for(let Z of R1(_).split(`
|
|
419
|
-
`))q+=Math.max(1,Math.ceil(
|
|
413
|
+
`));let $=(q)=>q?B.green("✅ Available"):B.gray("❌ Not Available");if(console.log(B.bold("AI Services:")),_.ollama)console.log(` Ollama (Local): ${$(_.ollama.available)} ${_.ollama.available&&_.ollama.models?B.gray(`(${_.ollama.models.length} models)`):""}`);if(_.openai)console.log(` OpenAI: ${$(_.openai.available)}`);if(_.gemini)console.log(` Google Gemini: ${$(_.gemini.available)}`);if(console.log(B.bold(`
|
|
414
|
+
Voice Services:`)),_.elevenlabs)console.log(` ElevenLabs: ${$(_.elevenlabs.available)} ${_.elevenlabs.available&&_.elevenlabs.voices?B.gray(`(${_.elevenlabs.voices.length} voices)`):""}`);if(console.log(` System TTS: ${$(!0)} ${B.gray("(fallback)")}`),console.log(B.bold(`
|
|
415
|
+
Default Configuration:`)),console.log(` Default AI Model: ${B.cyan(_.defaultModel||"None available")}`),console.log(` Priority: ${B.cyan(_.priority||"Free services first")}`),_.recommendations&&_.recommendations.length>0)console.log(B.bold(`
|
|
416
|
+
\uD83D\uDCA1 Recommendations:`)),_.recommendations.forEach((q)=>{console.log(` • ${q}`)});console.log(B.dim(`
|
|
417
|
+
For setup instructions, visit: https://github.com/jkenley/glance-cli#setup`))}class m extends Error{code;userMessage;recoverable;hint;constructor(_,$,q,Z=!1,Q){super(_);this.code=$;this.userMessage=q;this.recoverable=Z;this.hint=Q;this.name="GlanceError"}}var O0={INVALID_URL:"INVALID_URL",INVALID_LANGUAGE:"INVALID_LANGUAGE",INVALID_MAX_TOKENS:"INVALID_MAX_TOKENS",API_KEY_MISSING:"API_KEY_MISSING",API_KEY_INVALID:"API_KEY_INVALID",FETCH_FAILED:"FETCH_FAILED",CONTENT_TOO_LARGE:"CONTENT_TOO_LARGE",SUMMARIZE_FAILED:"SUMMARIZE_FAILED",CACHE_ERROR:"CACHE_ERROR",VOICE_SYNTHESIS_FAILED:"VOICE_SYNTHESIS_FAILED",SCREENSHOT_FAILED:"SCREENSHOT_FAILED",EXPORT_FAILED:"EXPORT_FAILED"};class Oq{level="info";setLevel(_){this.level=_}getLevel(){return this.level}debug(..._){if(this.level==="debug")console.log(B.gray("[DEBUG]"),..._)}info(..._){if(["debug","info"].includes(this.level))console.log(B.blue("[INFO]"),..._)}warn(..._){if(["debug","info","warn"].includes(this.level))console.warn(B.yellow("[WARN]"),..._)}error(..._){console.error(B.red("[ERROR]"),..._)}}var E=new Oq;import o2 from"node:process";import fq from"node:process";import a2 from"node:process";var XV=(_,$,q,Z)=>{if(q==="length"||q==="prototype")return;if(q==="arguments"||q==="caller")return;let Q=Object.getOwnPropertyDescriptor(_,q),X=Object.getOwnPropertyDescriptor($,q);if(!JV(Q,X)&&Z)return;Object.defineProperty(_,q,X)},JV=function(_,$){return _===void 0||_.configurable||_.writable===$.writable&&_.enumerable===$.enumerable&&_.configurable===$.configurable&&(_.writable||_.value===$.value)},YV=(_,$)=>{let q=Object.getPrototypeOf($);if(q===Object.getPrototypeOf(_))return;Object.setPrototypeOf(_,q)},KV=(_,$)=>`/* Wrapped ${_}*/
|
|
418
|
+
${$}`,HV=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),BV=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),VV=(_,$,q)=>{let Z=q===""?"":`with ${q.trim()}() `,Q=KV.bind(null,Z,$.toString());Object.defineProperty(Q,"name",BV);let{writable:X,enumerable:J,configurable:Y}=HV;Object.defineProperty(_,"toString",{value:Q,writable:X,enumerable:J,configurable:Y})};function r3(_,$,{ignoreNonConfigurable:q=!1}={}){let{name:Z}=_;for(let Q of Reflect.ownKeys($))XV(_,$,Q,q);return YV(_,$),VV(_,$,Z),_}var p2=new WeakMap,Eq=(_,$={})=>{if(typeof _!=="function")throw new TypeError("Expected a function");let q,Z=0,Q=_.displayName||_.name||"<anonymous>",X=function(...J){if(p2.set(X,++Z),Z===1)q=_.apply(this,J),_=void 0;else if($.throw===!0)throw new Error(`Function \`${Q}\` can only be called once`);return q};return r3(X,_),p2.set(X,Z),X};Eq.callCount=(_)=>{if(!p2.has(_))throw new Error(`The given function \`${_.name}\` is not wrapped by the \`onetime\` package`);return p2.get(_)};var Nq=Eq;var E0=[];E0.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")E0.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")E0.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var l2=(_)=>!!_&&typeof _==="object"&&typeof _.removeListener==="function"&&typeof _.emit==="function"&&typeof _.reallyExit==="function"&&typeof _.listeners==="function"&&typeof _.kill==="function"&&typeof _.pid==="number"&&typeof _.on==="function",t3=Symbol.for("signal-exit emitter"),s3=globalThis,GV=Object.defineProperty.bind(Object);class xq{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(s3[t3])return s3[t3];GV(s3,t3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(_,$){this.listeners[_].push($)}removeListener(_,$){let q=this.listeners[_],Z=q.indexOf($);if(Z===-1)return;if(Z===0&&q.length===1)q.length=0;else q.splice(Z,1)}emit(_,$,q){if(this.emitted[_])return!1;this.emitted[_]=!0;let Z=!1;for(let Q of this.listeners[_])Z=Q($,q)===!0||Z;if(_==="exit")Z=this.emit("afterExit",$,q)||Z;return Z}}class _5{}var UV=(_)=>{return{onExit($,q){return _.onExit($,q)},load(){return _.load()},unload(){return _.unload()}}};class yq extends _5{onExit(){return()=>{}}load(){}unload(){}}class vq extends _5{#Z=e3.platform==="win32"?"SIGINT":"SIGHUP";#$=new xq;#_;#q;#Y;#J={};#Q=!1;constructor(_){super();this.#_=_,this.#J={};for(let $ of E0)this.#J[$]=()=>{let q=this.#_.listeners($),{count:Z}=this.#$,Q=_;if(typeof Q.__signal_exit_emitter__==="object"&&typeof Q.__signal_exit_emitter__.count==="number")Z+=Q.__signal_exit_emitter__.count;if(q.length===Z){this.unload();let X=this.#$.emit("exit",null,$),J=$==="SIGHUP"?this.#Z:$;if(!X)_.kill(_.pid,J)}};this.#Y=_.reallyExit,this.#q=_.emit}onExit(_,$){if(!l2(this.#_))return()=>{};if(this.#Q===!1)this.load();let q=$?.alwaysLast?"afterExit":"exit";return this.#$.on(q,_),()=>{if(this.#$.removeListener(q,_),this.#$.listeners.exit.length===0&&this.#$.listeners.afterExit.length===0)this.unload()}}load(){if(this.#Q)return;this.#Q=!0,this.#$.count+=1;for(let _ of E0)try{let $=this.#J[_];if($)this.#_.on(_,$)}catch($){}this.#_.emit=(_,...$)=>{return this.#X(_,...$)},this.#_.reallyExit=(_)=>{return this.#K(_)}}unload(){if(!this.#Q)return;this.#Q=!1,E0.forEach((_)=>{let $=this.#J[_];if(!$)throw new Error("Listener not defined for signal: "+_);try{this.#_.removeListener(_,$)}catch(q){}}),this.#_.emit=this.#q,this.#_.reallyExit=this.#Y,this.#$.count-=1}#K(_){if(!l2(this.#_))return 0;return this.#_.exitCode=_||0,this.#$.emit("exit",this.#_.exitCode,null),this.#Y.call(this.#_,this.#_.exitCode)}#X(_,...$){let q=this.#q;if(_==="exit"&&l2(this.#_)){if(typeof $[0]==="number")this.#_.exitCode=$[0];let Z=q.call(this.#_,_,...$);return this.#$.emit("exit",this.#_.exitCode,null),Z}else return q.call(this.#_,_,...$)}}var e3=globalThis.process,{onExit:hq,load:Iw,unload:Ow}=UV(l2(e3)?new vq(e3):new yq);var Sq=a2.stderr.isTTY?a2.stderr:a2.stdout.isTTY?a2.stdout:void 0,FV=Sq?Nq(()=>{hq(()=>{Sq.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},bq=FV;var i2=!1,t0={};t0.show=(_=fq.stderr)=>{if(!_.isTTY)return;i2=!1,_.write("\x1B[?25h")};t0.hide=(_=fq.stderr)=>{if(!_.isTTY)return;bq(),i2=!0,_.write("\x1B[?25l")};t0.toggle=(_,$)=>{if(_!==void 0)i2=_;if(i2)t0.show($);else t0.hide($)};var $5=t0;var q5={dots:{interval:80,frames:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},dots2:{interval:80,frames:["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},dots3:{interval:80,frames:["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},dots4:{interval:80,frames:["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},dots5:{interval:80,frames:["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},dots6:{interval:80,frames:["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},dots7:{interval:80,frames:["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},dots8:{interval:80,frames:["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},dots9:{interval:80,frames:["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},dots10:{interval:80,frames:["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},dots11:{interval:100,frames:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},dots12:{interval:80,frames:["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},dots13:{interval:80,frames:["⣼","⣹","⢻","⠿","⡟","⣏","⣧","⣶"]},dots14:{interval:80,frames:["⠉⠉","⠈⠙","⠀⠹","⠀⢸","⠀⣰","⢀⣠","⣀⣀","⣄⡀","⣆⠀","⡇⠀","⠏⠀","⠋⠁"]},dots8Bit:{interval:80,frames:["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},dotsCircle:{interval:80,frames:["⢎ ","⠎⠁","⠊⠑","⠈⠱"," ⡱","⢀⡰","⢄⡠","⢆⡀"]},sand:{interval:80,frames:["⠁","⠂","⠄","⡀","⡈","⡐","⡠","⣀","⣁","⣂","⣄","⣌","⣔","⣤","⣥","⣦","⣮","⣶","⣷","⣿","⡿","⠿","⢟","⠟","⡛","⠛","⠫","⢋","⠋","⠍","⡉","⠉","⠑","⠡","⢁"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["⠂","-","–","—","–","-"]},rollingLine:{interval:80,frames:["/ "," - "," \\ "," |"," |"," \\ "," - ","/ "]},pipe:{interval:100,frames:["┤","┘","┴","└","├","┌","┬","┐"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["✶","✸","✹","✺","✹","✷"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","´","-","_","_","_"]},hamburger:{interval:100,frames:["☱","☲","☴"]},growVertical:{interval:120,frames:["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},growHorizontal:{interval:120,frames:["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","°","O","o","."]},noise:{interval:100,frames:["▓","▒","░"]},bounce:{interval:120,frames:["⠁","⠂","⠄","⠂"]},boxBounce:{interval:120,frames:["▖","▘","▝","▗"]},boxBounce2:{interval:100,frames:["▌","▀","▐","▄"]},triangle:{interval:50,frames:["◢","◣","◤","◥"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["◜","◠","◝","◞","◡","◟"]},circle:{interval:120,frames:["◡","⊙","◠"]},squareCorners:{interval:180,frames:["◰","◳","◲","◱"]},circleQuarters:{interval:120,frames:["◴","◷","◶","◵"]},circleHalves:{interval:50,frames:["◐","◓","◑","◒"]},squish:{interval:100,frames:["╫","╪"]},toggle:{interval:250,frames:["⊶","⊷"]},toggle2:{interval:80,frames:["▫","▪"]},toggle3:{interval:120,frames:["□","■"]},toggle4:{interval:100,frames:["■","□","▪","▫"]},toggle5:{interval:100,frames:["▮","▯"]},toggle6:{interval:300,frames:["ဝ","၀"]},toggle7:{interval:80,frames:["⦾","⦿"]},toggle8:{interval:100,frames:["◍","◌"]},toggle9:{interval:100,frames:["◉","◎"]},toggle10:{interval:100,frames:["㊂","㊀","㊁"]},toggle11:{interval:50,frames:["⧇","⧆"]},toggle12:{interval:120,frames:["☗","☖"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["←","↖","↑","↗","→","↘","↓","↙"]},arrow2:{interval:80,frames:["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},arrow3:{interval:120,frames:["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},smiley:{interval:200,frames:["😄 ","😝 "]},monkey:{interval:300,frames:["🙈 ","🙈 ","🙉 ","🙊 "]},hearts:{interval:100,frames:["💛 ","💙 ","💜 ","💚 ","💗 "]},clock:{interval:100,frames:["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},earth:{interval:180,frames:["🌍 ","🌎 ","🌏 "]},material:{interval:17,frames:["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███████▁▁▁▁▁▁▁▁▁▁▁▁▁","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","██████████▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","█████████████▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁██████████████▁▁▁▁","▁▁▁██████████████▁▁▁","▁▁▁▁█████████████▁▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁▁▁████████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","██████▁▁▁▁▁▁▁▁▁▁▁▁▁█","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁▁█████████████▁▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁▁███████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁▁█████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"]},moon:{interval:80,frames:["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},runner:{interval:140,frames:["🚶 ","🏃 "]},pong:{interval:80,frames:["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},shark:{interval:120,frames:["▐|\\____________▌","▐_|\\___________▌","▐__|\\__________▌","▐___|\\_________▌","▐____|\\________▌","▐_____|\\_______▌","▐______|\\______▌","▐_______|\\_____▌","▐________|\\____▌","▐_________|\\___▌","▐__________|\\__▌","▐___________|\\_▌","▐____________|\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},christmas:{interval:400,frames:["🌲","🎄"]},grenade:{interval:80,frames:["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},point:{interval:125,frames:["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},layer:{interval:150,frames:["-","=","≡"]},betaWave:{interval:80,frames:["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]},fingerDance:{interval:160,frames:["🤘 ","🤟 ","🖖 ","✋ ","🤚 ","👆 "]},fistBump:{interval:80,frames:["🤜 🤛 ","🤜 🤛 ","🤜 🤛 "," 🤜 🤛 "," 🤜🤛 "," 🤜✨🤛 ","🤜 ✨ 🤛 "]},soccerHeader:{interval:80,frames:[" 🧑⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 "]},mindblown:{interval:160,frames:["😐 ","😐 ","😮 ","😮 ","😦 ","😦 ","😧 ","😧 ","🤯 ","💥 ","✨ "," "," "," "]},speaker:{interval:160,frames:["🔈 ","🔉 ","🔊 ","🔉 "]},orangePulse:{interval:100,frames:["🔸 ","🔶 ","🟠 ","🟠 ","🔶 "]},bluePulse:{interval:100,frames:["🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},orangeBluePulse:{interval:100,frames:["🔸 ","🔶 ","🟠 ","🟠 ","🔶 ","🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},timeTravel:{interval:100,frames:["🕛 ","🕚 ","🕙 ","🕘 ","🕗 ","🕖 ","🕕 ","🕔 ","🕓 ","🕒 ","🕑 ","🕐 "]},aesthetic:{interval:80,frames:["▰▱▱▱▱▱▱","▰▰▱▱▱▱▱","▰▰▰▱▱▱▱","▰▰▰▰▱▱▱","▰▰▰▰▰▱▱","▰▰▰▰▰▰▱","▰▰▰▰▰▰▰","▰▱▱▱▱▱▱"]},dwarfFortress:{interval:80,frames:[" ██████£££ ","☺██████£££ ","☺██████£££ ","☺▓█████£££ ","☺▓█████£££ ","☺▒█████£££ ","☺▒█████£££ ","☺░█████£££ ","☺░█████£££ ","☺ █████£££ "," ☺█████£££ "," ☺█████£££ "," ☺▓████£££ "," ☺▓████£££ "," ☺▒████£££ "," ☺▒████£££ "," ☺░████£££ "," ☺░████£££ "," ☺ ████£££ "," ☺████£££ "," ☺████£££ "," ☺▓███£££ "," ☺▓███£££ "," ☺▒███£££ "," ☺▒███£££ "," ☺░███£££ "," ☺░███£££ "," ☺ ███£££ "," ☺███£££ "," ☺███£££ "," ☺▓██£££ "," ☺▓██£££ "," ☺▒██£££ "," ☺▒██£££ "," ☺░██£££ "," ☺░██£££ "," ☺ ██£££ "," ☺██£££ "," ☺██£££ "," ☺▓█£££ "," ☺▓█£££ "," ☺▒█£££ "," ☺▒█£££ "," ☺░█£££ "," ☺░█£££ "," ☺ █£££ "," ☺█£££ "," ☺█£££ "," ☺▓£££ "," ☺▓£££ "," ☺▒£££ "," ☺▒£££ "," ☺░£££ "," ☺░£££ "," ☺ £££ "," ☺£££ "," ☺£££ "," ☺▓££ "," ☺▓££ "," ☺▒££ "," ☺▒££ "," ☺░££ "," ☺░££ "," ☺ ££ "," ☺££ "," ☺££ "," ☺▓£ "," ☺▓£ "," ☺▒£ "," ☺▒£ "," ☺░£ "," ☺░£ "," ☺ £ "," ☺£ "," ☺£ "," ☺▓ "," ☺▓ "," ☺▒ "," ☺▒ "," ☺░ "," ☺░ "," ☺ "," ☺ &"," ☺ ☼&"," ☺ ☼ &"," ☺☼ &"," ☺☼ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & ","‼ & "," & "," & "," & ░ "," & ▒ "," & ▓ "," & £ "," & ░£ "," & ▒£ "," & ▓£ "," & ££ "," & ░££ "," & ▒££ ","& ▓££ ","& £££ "," ░£££ "," ▒£££ "," ▓£££ "," █£££ "," ░█£££ "," ▒█£££ "," ▓█£££ "," ██£££ "," ░██£££ "," ▒██£££ "," ▓██£££ "," ███£££ "," ░███£££ "," ▒███£££ "," ▓███£££ "," ████£££ "," ░████£££ "," ▒████£££ "," ▓████£££ "," █████£££ "," ░█████£££ "," ▒█████£££ "," ▓█████£££ "," ██████£££ "," ██████£££ "]}};var D1=q5,uw=Object.keys(q5);var N0={};XZ(N0,{warning:()=>RV,success:()=>LV,info:()=>zV,error:()=>DV});var n2=j0(),zV=o5(n2?"ℹ":"i"),LV=i5(n2?"✔":"√"),RV=n5(n2?"⚠":"‼"),DV=a5(n2?"✖":"×");function Z5({onlyFirst:_=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",_?void 0:"g")}var jV=Z5();function j1(_){if(typeof _!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof _}\``);return _.replace(jV,"")}function gq(_){return _===161||_===164||_===167||_===168||_===170||_===173||_===174||_>=176&&_<=180||_>=182&&_<=186||_>=188&&_<=191||_===198||_===208||_===215||_===216||_>=222&&_<=225||_===230||_>=232&&_<=234||_===236||_===237||_===240||_===242||_===243||_>=247&&_<=250||_===252||_===254||_===257||_===273||_===275||_===283||_===294||_===295||_===299||_>=305&&_<=307||_===312||_>=319&&_<=322||_===324||_>=328&&_<=331||_===333||_===338||_===339||_===358||_===359||_===363||_===462||_===464||_===466||_===468||_===470||_===472||_===474||_===476||_===593||_===609||_===708||_===711||_>=713&&_<=715||_===717||_===720||_>=728&&_<=731||_===733||_===735||_>=768&&_<=879||_>=913&&_<=929||_>=931&&_<=937||_>=945&&_<=961||_>=963&&_<=969||_===1025||_>=1040&&_<=1103||_===1105||_===8208||_>=8211&&_<=8214||_===8216||_===8217||_===8220||_===8221||_>=8224&&_<=8226||_>=8228&&_<=8231||_===8240||_===8242||_===8243||_===8245||_===8251||_===8254||_===8308||_===8319||_>=8321&&_<=8324||_===8364||_===8451||_===8453||_===8457||_===8467||_===8470||_===8481||_===8482||_===8486||_===8491||_===8531||_===8532||_>=8539&&_<=8542||_>=8544&&_<=8555||_>=8560&&_<=8569||_===8585||_>=8592&&_<=8601||_===8632||_===8633||_===8658||_===8660||_===8679||_===8704||_===8706||_===8707||_===8711||_===8712||_===8715||_===8719||_===8721||_===8725||_===8730||_>=8733&&_<=8736||_===8739||_===8741||_>=8743&&_<=8748||_===8750||_>=8756&&_<=8759||_===8764||_===8765||_===8776||_===8780||_===8786||_===8800||_===8801||_>=8804&&_<=8807||_===8810||_===8811||_===8814||_===8815||_===8834||_===8835||_===8838||_===8839||_===8853||_===8857||_===8869||_===8895||_===8978||_>=9312&&_<=9449||_>=9451&&_<=9547||_>=9552&&_<=9587||_>=9600&&_<=9615||_>=9618&&_<=9621||_===9632||_===9633||_>=9635&&_<=9641||_===9650||_===9651||_===9654||_===9655||_===9660||_===9661||_===9664||_===9665||_>=9670&&_<=9672||_===9675||_>=9678&&_<=9681||_>=9698&&_<=9701||_===9711||_===9733||_===9734||_===9737||_===9742||_===9743||_===9756||_===9758||_===9792||_===9794||_===9824||_===9825||_>=9827&&_<=9829||_>=9831&&_<=9834||_===9836||_===9837||_===9839||_===9886||_===9887||_===9919||_>=9926&&_<=9933||_>=9935&&_<=9939||_>=9941&&_<=9953||_===9955||_===9960||_===9961||_>=9963&&_<=9969||_===9972||_>=9974&&_<=9977||_===9979||_===9980||_===9982||_===9983||_===10045||_>=10102&&_<=10111||_>=11094&&_<=11097||_>=12872&&_<=12879||_>=57344&&_<=63743||_>=65024&&_<=65039||_===65533||_>=127232&&_<=127242||_>=127248&&_<=127277||_>=127280&&_<=127337||_>=127344&&_<=127373||_===127375||_===127376||_>=127387&&_<=127404||_>=917760&&_<=917999||_>=983040&&_<=1048573||_>=1048576&&_<=1114109}function uq(_){return _===12288||_>=65281&&_<=65376||_>=65504&&_<=65510}function mq(_){return _>=4352&&_<=4447||_===8986||_===8987||_===9001||_===9002||_>=9193&&_<=9196||_===9200||_===9203||_===9725||_===9726||_===9748||_===9749||_>=9776&&_<=9783||_>=9800&&_<=9811||_===9855||_>=9866&&_<=9871||_===9875||_===9889||_===9898||_===9899||_===9917||_===9918||_===9924||_===9925||_===9934||_===9940||_===9962||_===9970||_===9971||_===9973||_===9978||_===9981||_===9989||_===9994||_===9995||_===10024||_===10060||_===10062||_>=10067&&_<=10069||_===10071||_>=10133&&_<=10135||_===10160||_===10175||_===11035||_===11036||_===11088||_===11093||_>=11904&&_<=11929||_>=11931&&_<=12019||_>=12032&&_<=12245||_>=12272&&_<=12287||_>=12289&&_<=12350||_>=12353&&_<=12438||_>=12441&&_<=12543||_>=12549&&_<=12591||_>=12593&&_<=12686||_>=12688&&_<=12773||_>=12783&&_<=12830||_>=12832&&_<=12871||_>=12880&&_<=42124||_>=42128&&_<=42182||_>=43360&&_<=43388||_>=44032&&_<=55203||_>=63744&&_<=64255||_>=65040&&_<=65049||_>=65072&&_<=65106||_>=65108&&_<=65126||_>=65128&&_<=65131||_>=94176&&_<=94180||_>=94192&&_<=94198||_>=94208&&_<=101589||_>=101631&&_<=101662||_>=101760&&_<=101874||_>=110576&&_<=110579||_>=110581&&_<=110587||_===110589||_===110590||_>=110592&&_<=110882||_===110898||_>=110928&&_<=110930||_===110933||_>=110948&&_<=110951||_>=110960&&_<=111355||_>=119552&&_<=119638||_>=119648&&_<=119670||_===126980||_===127183||_===127374||_>=127377&&_<=127386||_>=127488&&_<=127490||_>=127504&&_<=127547||_>=127552&&_<=127560||_===127568||_===127569||_>=127584&&_<=127589||_>=127744&&_<=127776||_>=127789&&_<=127797||_>=127799&&_<=127868||_>=127870&&_<=127891||_>=127904&&_<=127946||_>=127951&&_<=127955||_>=127968&&_<=127984||_===127988||_>=127992&&_<=128062||_===128064||_>=128066&&_<=128252||_>=128255&&_<=128317||_>=128331&&_<=128334||_>=128336&&_<=128359||_===128378||_===128405||_===128406||_===128420||_>=128507&&_<=128591||_>=128640&&_<=128709||_===128716||_>=128720&&_<=128722||_>=128725&&_<=128728||_>=128732&&_<=128735||_===128747||_===128748||_>=128756&&_<=128764||_>=128992&&_<=129003||_===129008||_>=129292&&_<=129338||_>=129340&&_<=129349||_>=129351&&_<=129535||_>=129648&&_<=129660||_>=129664&&_<=129674||_>=129678&&_<=129734||_===129736||_>=129741&&_<=129756||_>=129759&&_<=129770||_>=129775&&_<=129784||_>=131072&&_<=196605||_>=196608&&_<=262141}function AV(_){if(!Number.isSafeInteger(_))throw new TypeError(`Expected a code point, got \`${typeof _}\`.`)}function Q5(_,{ambiguousAsWide:$=!1}={}){if(AV(_),uq(_)||mq(_)||$&&gq(_))return 2;return 1}var MV=new Intl.Segmenter,PV=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,wV=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,CV=/^\p{RGI_Emoji}$/v;function TV(_){return _.replace(wV,"")}function kV(_){return PV.test(_)}function IV(_,$){let q=0;if(_.length>1){for(let Z of _.slice(1))if(Z>=""&&Z<="")q+=Q5(Z.codePointAt(0),$)}return q}function X5(_,$={}){if(typeof _!=="string"||_.length===0)return 0;let{ambiguousIsNarrow:q=!0,countAnsiEscapeCodes:Z=!1}=$,Q=_;if(!Z)Q=j1(Q);if(Q.length===0)return 0;let X=0,J={ambiguousAsWide:!q};for(let{segment:Y}of MV.segment(Q)){if(kV(Y))continue;if(CV.test(Y)){X+=2;continue}let K=TV(Y).codePointAt(0);X+=Q5(K,J),X+=IV(Y,J)}return X}function J5({stream:_=process.stdout}={}){return Boolean(_&&_.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import _0 from"node:process";var OV=3;class dq{#Z=0;start(){if(this.#Z++,this.#Z===1)this.#$()}stop(){if(this.#Z<=0)throw new Error("`stop` called more times than `start`");if(this.#Z--,this.#Z===0)this.#_()}#$(){if(_0.platform==="win32"||!_0.stdin.isTTY)return;_0.stdin.setRawMode(!0),_0.stdin.on("data",this.#q),_0.stdin.resume()}#_(){if(!_0.stdin.isTTY)return;_0.stdin.off("data",this.#q),_0.stdin.pause(),_0.stdin.setRawMode(!1)}#q(_){if(_[0]===OV)_0.emit("SIGINT")}}var EV=new dq,Y5=EV;class cq{#Z=0;#$=!1;#_=0;#q=-1;#Y=0;#J=0;#Q;#K;#X;#F;#L;#H;#U;#B;#W;#V;#G;color;constructor(_){if(typeof _==="string")_={text:_};if(this.#Q={color:"cyan",stream:o2.stderr,discardStdin:!0,hideCursor:!0,..._},this.color=this.#Q.color,this.spinner=this.#Q.spinner,this.#L=this.#Q.interval,this.#X=this.#Q.stream,this.#H=typeof this.#Q.isEnabled==="boolean"?this.#Q.isEnabled:J5({stream:this.#X}),this.#U=typeof this.#Q.isSilent==="boolean"?this.#Q.isSilent:!1,this.text=this.#Q.text,this.prefixText=this.#Q.prefixText,this.suffixText=this.#Q.suffixText,this.indent=this.#Q.indent,o2.env.NODE_ENV==="test")this._stream=this.#X,this._isEnabled=this.#H,Object.defineProperty(this,"_linesToClear",{get(){return this.#Z},set($){this.#Z=$}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#q}}),Object.defineProperty(this,"_lineCount",{get(){return this.#_}})}get indent(){return this.#B}set indent(_=0){if(!(_>=0&&Number.isInteger(_)))throw new Error("The `indent` option must be an integer from 0 and up");this.#B=_,this.#z()}get interval(){return this.#L??this.#K.interval??100}get spinner(){return this.#K}set spinner(_){if(this.#q=-1,this.#L=void 0,typeof _==="object"){if(!Array.isArray(_.frames)||_.frames.length===0||_.frames.some(($)=>typeof $!=="string"))throw new Error("The given spinner must have a non-empty `frames` array of strings");if(_.interval!==void 0&&!(Number.isInteger(_.interval)&&_.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided");this.#K=_}else if(!j0())this.#K=D1.line;else if(_===void 0)this.#K=D1.dots;else if(_!=="default"&&D1[_])this.#K=D1[_];else throw new Error(`There is no built-in spinner named '${_}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#W}set text(_=""){this.#W=_,this.#z()}get prefixText(){return this.#V}set prefixText(_=""){this.#V=_,this.#z()}get suffixText(){return this.#G}set suffixText(_=""){this.#G=_,this.#z()}get isSpinning(){return this.#F!==void 0}#A(_,$,q=!1){let Z=typeof _==="function"?_():_;if(typeof Z==="string"&&Z!=="")return q?$+Z:Z+$;return""}#R(_=this.#V,$=" "){return this.#A(_,$,!1)}#D(_=this.#G,$=" "){return this.#A(_,$,!0)}#j(_,$){let q=0;for(let Z of j1(_).split(`
|
|
419
|
+
`))q+=Math.max(1,Math.ceil(X5(Z)/$));return q}#z(){let _=this.#X.columns??80,$=typeof this.#V==="function"?"":this.#V,q=typeof this.#G==="function"?"":this.#G,Z=typeof $==="string"&&$!==""?$+" ":"",Q=typeof q==="string"&&q!==""?" "+q:"",X="-",J=" ".repeat(this.#B)+Z+"-"+(typeof this.#W==="string"?" "+this.#W:"")+Q;this.#_=this.#j(J,_)}get isEnabled(){return this.#H&&!this.#U}set isEnabled(_){if(typeof _!=="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#H=_}get isSilent(){return this.#U}set isSilent(_){if(typeof _!=="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#U=_}frame(){let _=Date.now();if(this.#q===-1||_-this.#Y>=this.interval)this.#q=++this.#q%this.#K.frames.length,this.#Y=_;let{frames:$}=this.#K,q=$[this.#q];if(this.color)q=B[this.color](q);let Z=this.#R(this.#V," "),Q=typeof this.text==="string"?" "+this.text:"",X=this.#D(this.#G," ");return Z+q+Q+X}clear(){if(!this.#H||!this.#X.isTTY)return this;this.#X.cursorTo(0);for(let _=0;_<this.#Z;_++){if(_>0)this.#X.moveCursor(0,-1);this.#X.clearLine(1)}if(this.#B||this.#J!==this.#B)this.#X.cursorTo(this.#B);return this.#J=this.#B,this.#Z=0,this}render(){if(!this.#H||this.#U)return this;this.clear();let _=this.frame(),$=this.#X.columns??80,q=this.#j(_,$),Z=this.#X.rows;if(Z&&Z>1&&q>Z){let Q=_.split(`
|
|
420
420
|
`),X=Z-1;_=[...Q.slice(0,X),"... (content truncated to fit terminal)"].join(`
|
|
421
|
-
`)}return this.#X.write(_),this.#Z=this.#j(_,$),this}start(_){if(_)this.text=_;if(this.#
|
|
422
|
-
`);return this}if(this.isSpinning)return this;if(this.#Q.hideCursor)
|
|
423
|
-
`;return this.stop(),this.#X.write(H),this}}function
|
|
421
|
+
`)}return this.#X.write(_),this.#Z=this.#j(_,$),this}start(_){if(_)this.text=_;if(this.#U)return this;if(!this.#H){let $=" ".repeat(this.#B)+this.#R(this.#V," ")+(this.text?`- ${this.text}`:"")+this.#D(this.#G," ");if($.trim()!=="")this.#X.write($+`
|
|
422
|
+
`);return this}if(this.isSpinning)return this;if(this.#Q.hideCursor)$5.hide(this.#X);if(this.#Q.discardStdin&&o2.stdin.isTTY)this.#$=!0,Y5.start();return this.render(),this.#F=setInterval(this.render.bind(this),this.interval),this}stop(){if(clearInterval(this.#F),this.#F=void 0,this.#q=0,this.#H){if(this.clear(),this.#Q.hideCursor)$5.show(this.#X)}if(this.#Q.discardStdin&&o2.stdin.isTTY&&this.#$)Y5.stop(),this.#$=!1;return this}succeed(_){return this.stopAndPersist({symbol:N0.success,text:_})}fail(_){return this.stopAndPersist({symbol:N0.error,text:_})}warn(_){return this.stopAndPersist({symbol:N0.warning,text:_})}info(_){return this.stopAndPersist({symbol:N0.info,text:_})}stopAndPersist(_={}){if(this.#U)return this;let $=_.prefixText??this.#V,q=this.#R($," "),Z=_.symbol??" ",Q=_.text??this.text,J=typeof Q==="string"?(Z?" ":"")+Q:"",Y=_.suffixText??this.#G,K=this.#D(Y," "),H=q+Z+J+K+`
|
|
423
|
+
`;return this.stop(),this.#X.write(H),this}}function K5(_){return new cq(_)}function pq(_){let $=/\x1b\[[0-9;]*m/g,q=[],Z=_,Q;while((Q=$.exec(_))!==null)q.push(Q[0]);if(W0(_))E.warn("Binary artifacts detected, applying nuclear cleaning"),Z=F0(R1(_));else Z=_.replace(/\0/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"").replace(/’/g,"'").replace(/â€"/g,"—").replace(/“/g,'"').replace(/â€�/g,'"').replace(/‘/g,"'").replace(/…/g,"...").replace(/é/g,"é").replace(/è/g,"è").replace(/à /g,"à").replace(/â/g,"â").replace(/î/g,"î").replace(/ô/g,"ô").replace(/ç/g,"ç").replace(/\r\n/g,`
|
|
424
424
|
`).replace(/\r/g,`
|
|
425
425
|
`).replace(/\n{4,}/g,`
|
|
426
426
|
|
|
427
427
|
|
|
428
|
-
`).trim();return Z}async function
|
|
429
|
-
\uD83D\uDCCA Page Metadata:`)),console.log(JSON.stringify(
|
|
430
|
-
\uD83D\uDD17 Found ${
|
|
428
|
+
`).trim();return Z}async function H5(_,$={}){let{attempts:q=e.RETRY_ATTEMPTS,delay:Z=e.RETRY_DELAY,backoff:Q=2,onRetry:X}=$,J;for(let Y=1;Y<=q;Y++)try{return await _()}catch(K){if(J=K,K instanceof m&&!K.recoverable)throw K;if(K&&typeof K==="object"&&"status"in K&&typeof K.status==="number"&&[400,401,403,404].includes(K.status))throw K;if(Y<q){let H=Z*Q**(Y-1);if(X)X(Y,K);else E.debug(`Retry attempt ${Y}/${q} after ${H}ms`);await new Promise((V)=>setTimeout(V,H))}}throw J}function d(_,$=!1){return K5({text:_,spinner:"dots",color:"cyan",discardStdin:!$})}function r2(_){let $=["B","KB","MB","GB"],q=_,Z=0;while(q>=1024&&Z<$.length-1)q/=1024,Z++;return`${q.toFixed(2)} ${$[Z]}`}function lq(_){let $=_.split(".");return $.length>1?$[$.length-1]?.toLowerCase()??"":""}function B5(_){try{let $=new URL(_);if(!["http:","https:"].includes($.protocol))return{valid:!1,error:"Only HTTP and HTTPS URLs are supported"};if(!$.hostname||$.hostname.length<3)return{valid:!1,error:"Invalid hostname"};return{valid:!0}}catch($){return{valid:!1,error:"Invalid URL format. Please provide a valid URL starting with http:// or https://"}}}function aq(_){let $=Object.keys(r0);if(!$.includes(_))return{valid:!1,error:`Language '${_}' is not supported. Supported languages: ${$.join(", ")}`};return{valid:!0}}function iq(_){if(!_)return{valid:!0};let $=parseInt(_,10);if(Number.isNaN($))return{valid:!1,error:"max-tokens must be a valid number"};if($<1||$>1e5)return{valid:!1,error:"max-tokens must be between 1 and 100000"};return{valid:!0,parsed:$}}async function t2(_){switch(_){case"openai":{let $=process.env.OPENAI_API_KEY;if(!$)return{valid:!1,error:"OpenAI API key not found",hint:"Set your API key with: export OPENAI_API_KEY=sk-..."};if(!$.startsWith("sk-"))return{valid:!1,error:"Invalid OpenAI API key format",hint:"OpenAI API keys should start with 'sk-'"};if($.length<40)return{valid:!1,error:"OpenAI API key appears to be incomplete",hint:"Make sure you've copied the entire API key"};return{valid:!0}}case"google":{let $=process.env.GEMINI_API_KEY||process.env.GOOGLE_API_KEY;if(!$)return{valid:!1,error:"Gemini API key not found",hint:"Set your API key with: export GEMINI_API_KEY=..."};if($.length<30)return{valid:!1,error:"Gemini API key appears to be incomplete",hint:"Make sure you've copied the entire API key"};return{valid:!0}}case"ollama":{let $=process.env.OLLAMA_ENDPOINT||"http://localhost:11434";try{let q=new AbortController,Z=setTimeout(()=>q.abort(),5000),Q=await fetch(`${$}/api/version`,{signal:q.signal});if(clearTimeout(Z),!Q.ok)return{valid:!1,error:`Ollama is not responding at ${$}`,hint:"Make sure Ollama is running. Start it with: ollama serve"};return{valid:!0}}catch(q){return{valid:!1,error:`Cannot connect to Ollama at ${$}`,hint:"Install and start Ollama: https://ollama.ai/download"}}}default:return{valid:!1,error:`Unknown provider: ${_}`}}}async function s2(_,$={}){let q=Date.now();if($.debug)E.setLevel("debug");let Z=$.language||"en",Q=r0[Z]||"English",X=d("Fetching webpage...",$.disableStdinHandling);X.start();let J;try{J=await H5(()=>L1(_,{fullRender:$.fullRender}),{onRetry:(F,W)=>{X.text=`Fetching webpage... (retry ${F})`}}),X.succeed("Webpage fetched successfully")}catch(F){throw X.fail("Failed to fetch webpage"),new m(F instanceof Error?F.message:String(F),O0.FETCH_FAILED,"Could not fetch the webpage. Please check the URL and your internet connection.",!0,"Try again or use --full-render for JavaScript-heavy sites")}let Y=d("Extracting content...",$.disableStdinHandling);Y.start();let K=g3(J);if(!$.language&&zq()){let F=Wq(_,J,K,$.language);if(Z=F.detected,Q=r0[Z]||"English",F.confidence!=="high"&&F.source!=="default")E.info(`Auto-detected language: ${Q}`);if($.debug)E.debug(`Language detected: ${Z} (${F.confidence} confidence from ${F.source})`),E.debug(`Detection signals: ${F.signals.join(", ")}`)}if(K.length>e.MAX_CONTENT_SIZE)throw Y.fail("Content too large"),new m(`Content size (${r2(K.length)}) exceeds maximum allowed`,O0.CONTENT_TOO_LARGE,`The webpage content is too large to process (>${r2(e.MAX_CONTENT_SIZE)})`,!1);if(Y.succeed(`Content extracted (${r2(K.length)})`),$.metadata){let F=z1(J);console.log(B.bold(`
|
|
429
|
+
\uD83D\uDCCA Page Metadata:`)),console.log(JSON.stringify(F,null,2))}if($.links){let F=Gq(J);console.log(B.bold(`
|
|
430
|
+
\uD83D\uDD17 Found ${F.length} links:`)),F.forEach((W)=>{let L=W.text?`${W.text} (${W.href})`:W.href;console.log(B.cyan(` • ${L}`))})}if($.screenshot)await fV(_,$.screenshot);if($.full)return await hV(K,{...$,language:Z});let{rawSummary:H,formattedSummary:V}=await SV(K,_,{...$,language:Z});if($.read||$.audioOutput){console.log(V),console.log("");let F=Cq(H);return await bV(F,{...$,language:Z}),V}let G=V;if($.output)await rq(G,$.output);if($.copy){let F=$.format==="json"||$.format==="markdown"?G:H||G;await vV(F)}let U=Date.now()-q;return E.debug(`Total execution time: ${U}ms`),G}function oq(_){if(_.format)return{md:"markdown",json:"json",plain:"plain",markdown:"markdown",terminal:"terminal"}[_.format.toLowerCase()]||"terminal";if(_.output){let $=lq(_.output).toLowerCase(),Z={md:"markdown",markdown:"markdown",json:"json",txt:"plain",text:"plain"}[$];if(Z)return Z}return"terminal"}async function rq(_,$){try{await NV($,_,"utf-8"),E.info(`Content saved to ${$}`)}catch(q){throw new m(q instanceof Error?q.message:String(q),O0.EXPORT_FAILED,`Failed to save content to ${$}`,!1)}}async function vV(_){try{await Kq.write(_),E.info(B.green("✓ Copied to clipboard"))}catch($){E.warn(B.yellow("⚠ Could not copy to clipboard:"),$ instanceof Error?$.message:String($))}}async function hV(_,$){let q=_,Z=$.language&&$.language!=="en",Q=d(Z?"\uD83C\uDF0D Translating and formatting full content...":"\uD83E\uDDFE Applying smart formatting...",$.disableStdinHandling);Q.start();try{let J=$.model||await p3(void 0,!!$.preferQuality),Y=a3(J),K={model:J,language:$.language,stream:!1,maxTokens:$.maxTokens||8000,translate:Z,format:!0},H=await i3(q,{model:K.model,language:K.language,stream:K.stream,maxTokens:K.maxTokens,translate:K.translate,format:K.format});q=R1(H),Q.succeed(Z?"Translation and formatting complete":"Smart formatting applied")}catch(J){Q.fail(Z?"Translation failed - showing original content":"Smart formatting failed - showing original content"),E.error("Full content processing error:",J)}let X=c3(q,{format:oq($),url:"full-content",isFullContent:!0});if($.output)await rq(X,$.output);return X}async function SV(_,$,q){let Z=q.model||await p3(void 0,!!q.preferQuality);if(!q.freeOnly)await Aq(Z);let Q=q.stream?null:d(`Processing with ${Z}...`,q.disableStdinHandling);Q?.start();try{let X=await H5(()=>i3(_,{model:Z,tldr:q.tldr,keyPoints:q.keyPoints,eli5:q.eli5,language:q.language,stream:q.stream,maxTokens:q.maxTokens,customQuestion:q.customQuestion}),{attempts:2,onRetry:(K)=>{if(Q)Q.text=`Processing with ${Z}... (retry ${K})`}});Q?.succeed("Summary generated successfully");let J=pq(R1(X)),Y=c3(J,{format:oq(q),url:$,customQuestion:q.customQuestion});return{rawSummary:J,formattedSummary:Y}}catch(X){throw Q?.fail("Failed to generate summary"),new m(X instanceof Error?X.message:String(X),O0.SUMMARIZE_FAILED,"Failed to generate summary. The AI service might be unavailable.",!0,"Try a different model with --model or check your API keys")}}async function bV(_,$){try{let q=n3();if($.audioOutput){let Z=d(`\uD83C\uDFB5 Generating audio file: ${$.audioOutput}`,$.disableStdinHandling);Z.start();let Q=await q.synthesizeCleanedText(_,{voice:$.voice,language:$.language,outputFile:$.audioOutput});if(!Q.success)throw new Error(Q.error||"Voice synthesis failed");Z.succeed(`\uD83C\uDFB5 Audio saved to ${$.audioOutput}`)}else{let Z=d("\uD83C\uDFA4 Generating speech and preparing to read aloud...",$.disableStdinHandling);Z.start();let Q=await q.synthesizeCleanedText(_,{voice:$.voice,language:$.language});if(!Q.success)throw new Error(Q.error||"Voice synthesis failed");Z.succeed("\uD83C\uDFA4 Reading aloud completed")}}catch(q){throw E.error("Voice synthesis failed:",q),new m(q instanceof Error?q.message:String(q),O0.VOICE_SYNTHESIS_FAILED,"Failed to synthesize voice. Check your voice settings or try a different voice.",!1)}}async function fV(_,$){let q=d(`Capturing screenshot: ${$}`);q.start();try{await jq(_,$),q.succeed(`Screenshot saved to ${$}`)}catch(Z){q.fail("Failed to capture screenshot"),E.error("Screenshot error:",Z)}}async function tq(){try{let _=n3(),$=await _.listVoices("en"),q=await _.listVoices("fr"),Z=await _.listVoices("es"),Q=await _.listVoices("ht");if(console.log(B.bold(`
|
|
431
431
|
\uD83C\uDFA4 Available Voices by Language:
|
|
432
|
-
`)),$.length>0){console.log(
|
|
433
|
-
\uD83C\uDDEB\uD83C\uDDF7 French:`));for(let X of q)console.log(` ${X}`)}if(Z.length>0){console.log(
|
|
434
|
-
\uD83C\uDDEA\uD83C\uDDF8 Spanish:`));for(let X of Z)console.log(` ${X}`)}if(Q.length>0){console.log(
|
|
435
|
-
\uD83C\uDDED\uD83C\uDDF9 Haitian Creole:`));for(let X of Q)console.log(` ${X}`)}console.log(
|
|
436
|
-
Use with: glance <url> --voice <voice-name> --read`))}catch(_){throw
|
|
437
|
-
No models found. Install models with:`)),console.log(
|
|
432
|
+
`)),$.length>0){console.log(B.bold("\uD83C\uDDFA\uD83C\uDDF8 English:"));for(let X of $)console.log(` ${X}`)}if(q.length>0){console.log(B.bold(`
|
|
433
|
+
\uD83C\uDDEB\uD83C\uDDF7 French:`));for(let X of q)console.log(` ${X}`)}if(Z.length>0){console.log(B.bold(`
|
|
434
|
+
\uD83C\uDDEA\uD83C\uDDF8 Spanish:`));for(let X of Z)console.log(` ${X}`)}if(Q.length>0){console.log(B.bold(`
|
|
435
|
+
\uD83C\uDDED\uD83C\uDDF9 Haitian Creole:`));for(let X of Q)console.log(` ${X}`)}console.log(B.dim(`
|
|
436
|
+
Use with: glance <url> --voice <voice-name> --read`))}catch(_){throw E.error("Failed to list voices:",_),_}}async function sq(){let _=d("Detecting available services...");_.start();try{let[$,q,Z]=await Promise.all([t2("ollama").catch(()=>({valid:!1,error:"Connection failed"})),t2("openai").catch(()=>({valid:!1,error:"API key missing"})),t2("google").catch(()=>({valid:!1,error:"API key missing"}))]),Q=[];if($.valid)try{let Y=process.env.OLLAMA_ENDPOINT||"http://localhost:11434",K=await fetch(`${Y}/api/tags`);if(K.ok)Q=(await K.json()).models?.map((V)=>V.name)||[]}catch{}let X={valid:!!process.env.ELEVENLABS_API_KEY,error:process.env.ELEVENLABS_API_KEY?void 0:"API key missing"};_.succeed("Service detection complete");let J={ollama:{available:$.valid,models:Q,error:$.error},openai:{available:q.valid,error:q.error},gemini:{available:Z.valid,error:Z.error},elevenlabs:{available:X.valid,voices:[],error:X.error},defaultModel:$.valid?"ollama":q.valid?"gpt-4o-mini":Z.valid?"gemini-2.0-flash-exp":"None available",priority:"Free services first",recommendations:[]};if(!J.ollama.available)J.recommendations?.push("Install Ollama for free local AI");if(!J.openai.available)J.recommendations?.push("Add OpenAI API key for premium quality");if(!J.elevenlabs.available)J.recommendations?.push("Add ElevenLabs API key for natural voice synthesis");o3(J)}catch($){throw _.fail("Service detection failed"),E.error("Service detection error:",$),o3({ollama:{available:!1,error:"Detection failed"},openai:{available:!1,error:"Detection failed"},gemini:{available:!1,error:"Detection failed"},elevenlabs:{available:!1,error:"Detection failed"},recommendations:["Check your internet connection and try again"]}),$}}async function eq(){let _=process.env.OLLAMA_ENDPOINT||e.OLLAMA_ENDPOINT,$=d("Fetching Ollama models...");$.start();try{let q=await fetch(`${_}/api/tags`);if(!q.ok)throw new Error(`Failed to fetch models: ${q.statusText}`);let Z=await q.json();if($.succeed("Models fetched successfully"),!Z.models||Z.models.length===0){console.log(B.yellow(`
|
|
437
|
+
No models found. Install models with:`)),console.log(B.cyan(" ollama pull llama3")),console.log(B.cyan(" ollama pull mistral"));return}console.log(B.bold(`
|
|
438
438
|
\uD83D\uDCE6 Available Ollama Models (${Z.models.length}):
|
|
439
|
-
`)),Z.models.forEach((Q)=>{let X=Q.size?`(${(Q.size/1e9).toFixed(1)}GB)`:"";if(console.log(` ${
|
|
440
|
-
Use any model with: glance <url> --model <model-name>`))}catch(q){throw $.fail("Failed to fetch models"),console.error(
|
|
441
|
-
Cannot connect to Ollama. Make sure it's running:`)),console.log(
|
|
442
|
-
|
|
443
|
-
|
|
439
|
+
`)),Z.models.forEach((Q)=>{let X=Q.size?`(${(Q.size/1e9).toFixed(1)}GB)`:"";if(console.log(` ${B.cyan(Q.name)} ${B.gray(X)}`),Q.details?.parameter_size)console.log(` ${B.gray(Q.details.parameter_size)} parameters`)}),console.log(B.dim(`
|
|
440
|
+
Use any model with: glance <url> --model <model-name>`))}catch(q){throw $.fail("Failed to fetch models"),console.error(B.red(`
|
|
441
|
+
Cannot connect to Ollama. Make sure it's running:`)),console.log(B.cyan(" ollama serve")),q}}function V5(_,$){let q=nq.load(_),Z=new Set,Q={navigation:[],external:[]},X={content:[],footer:[]},J=(Y)=>{let K=q(Y),H=K.attr("href")?.trim()||"";if(!H||H.startsWith("javascript:")||H.startsWith("mailto:")||H.startsWith("tel:")||H==="#"||H.startsWith("#"))return;let V="",G=K.text().trim()||"",U=(z)=>{return z.startsWith(".css-")||z.includes("{")||z.includes("}")||z.includes("@media")||z.includes("::")||z.includes("var(--")||/^\.[a-z]+-[a-z0-9]+/i.test(z)||/^#[a-z]+-[a-z0-9]+/i.test(z)};if(!U(G))V=G;else{let z=K.find("img").attr("alt")||"",D=K.attr("aria-label")||"",j=K.attr("title")||"";if(D&&!U(D))V=D;else if(j&&!U(j))V=j;else if(z&&!U(z))V=z;else{let P=K.clone();P.find("style").remove(),P.find('[class*="css-"]').remove();let R=P.text().trim()||"";if(R&&!U(R))V=R}}if(!V||U(V))try{let z=new URL(H.startsWith("http")?H:new URL(H,$).href),D=z.hostname.replace("www.",""),j=z.pathname;if(j&&j!=="/"){let P=j.split("/").filter((R)=>R&&!R.match(/^\d+$/));if(P.length>0)V=(P[P.length-1]||"").replace(/[-_]/g," ").replace(/\.[^.]+$/,"").split(" ").map((k)=>k.charAt(0).toUpperCase()+k.slice(1).toLowerCase()).join(" ")}if(!V)V=D.charAt(0).toUpperCase()+D.slice(1)}catch{V="Link"}if(V=V.replace(/\s+/g," ").trim(),V.length>100)V=V.substring(0,97)+"...";try{if(!H.startsWith("http"))H=new URL(H,$).href}catch{return}if(!H.startsWith("https://"))return;try{let z=new URL(H);if(H=`${z.protocol}//${z.hostname}${z.pathname}`,z.pathname==="/")H=`${z.protocol}//${z.hostname}`}catch{}if(Z.has(H))return;Z.add(H);let F=new URL(H),W=new URL($),L=F.hostname===W.hostname,A={href:H,text:V};if(L)Q.navigation.push(A);else Q.external.push(A)};return q("a[href]").each((Y,K)=>{J(K)}),{navigation:Q.navigation,external:Q.external,content:X.content,footer:X.footer}}async function _Z(_){console.log(B.bold("\uD83C\uDF10 Browse Mode - Interactive Link Navigation")),console.log(B.dim(`Navigate through links on the webpage interactively
|
|
442
|
+
`));try{let $=d("Fetching webpage...");$.start();let q=await L1(_,{fullRender:!1});$.succeed("Webpage fetched");let Z=d("Extracting and categorizing links...");Z.start();let Q=V5(q,_),X=[...Q.navigation,...Q.content,...Q.external,...Q.footer];if(Z.succeed(`Found ${X.length} links`),X.length===0){console.log(B.yellow("No links found on this page."));return}let J=z1(q),Y=J.title||_;if(console.log(B.bold(`
|
|
443
|
+
Current Page: ${Y}`)),J.description)console.log(B.dim(`Description: ${J.description}`));console.log(""),await gV(Q,_,Y)}catch($){throw new m($ instanceof Error?$.message:String($),O0.FETCH_FAILED,"Failed to start browse mode",!1)}}async function gV(_,$,q){let Z=xV({input:process.stdin,output:process.stdout}),Q=[$],X=_,J=$,Y=q,K="all",H=()=>{let U=1,F=new Map;if(K==="all"||K==="nav"){if(X.navigation.length>0){if(K==="nav")console.log(B.magenta(`
|
|
444
|
+
\uD83E\uDDED Navigation Links Only (${X.navigation.length} total):`));else console.log(B.magenta(`
|
|
445
|
+
Navigation Links (${X.navigation.length} total):`));X.navigation.forEach((W)=>{let L=W.text||"Link";console.log(B.cyan(` ${U}. `)+B.blue.underline(W.href)),F.set(U,{href:W.href,text:W.text}),U++})}}if(K==="all"||K==="external"){if(X.external.length>0){if(K==="external")console.log(B.yellow(`
|
|
446
|
+
\uD83C\uDF0D External Links Only (${X.external.length} total):`));else console.log(B.yellow(`
|
|
447
|
+
External Links (${X.external.length} total):`));X.external.forEach((W)=>{let L=W.text||"Link";console.log(B.cyan(` ${U}. `)+B.blue.underline(W.href)),F.set(U,{href:W.href,text:W.text}),U++})}}return F},V=null,G=null;while(!0){console.clear(),console.log(B.bold.cyan(`
|
|
448
|
+
Current Page: ${q}`));let U=H(),F=U.size;if(G&&V)console.log(""),console.log(B.dim("─".repeat(60))),console.log(B.cyan("Last command: ")+B.yellow(G)),console.log(""),console.log(V),console.log(B.dim("─".repeat(60)));console.log(B.dim(`
|
|
449
|
+
Commands:`)),console.log(B.dim(` 1-${F}: Navigate to link`)),console.log(B.dim(" 'n': Show only navigation links")),console.log(B.dim(" 'e': Show only external links")),console.log(B.dim(" 'a': Show all links")),console.log(B.dim(" 'b': Go back")),console.log(B.dim(" 'h': History")),console.log(B.dim(" 'q': Quit")),console.log(B.dim(`
|
|
450
|
+
Enhanced Commands:`)),console.log(B.dim(" '1 --read -l fr': Navigate to link 1 and read in French")),console.log(B.dim(" '2 --tldr --copy': Navigate to link 2, get TLDR and copy")),console.log(B.dim(" '3 --eli5 -m gemini': Navigate to link 3, ELI5 with Gemini"));let W;try{W=await new Promise((D,j)=>{if(Z.question(B.yellow(`
|
|
451
|
+
> `),(P)=>{D(P)}),Z.closed)j(new Error("Readline interface was closed"))})}catch(D){console.log(B.yellow("Browse mode ended"));break}let L=W.trim().toLowerCase();if(L==="q"||L==="quit"){console.log(B.green(`
|
|
452
|
+
\uD83D\uDC4B Exiting browse mode`));break}if(L==="n"){K="nav",G=null,V=null;continue}if(L==="e"){K="external",G=null,V=null;continue}if(L==="a"){K="all",G=null,V=null;continue}if(L==="b"||L==="back"){if(Q.length>1){Q.pop();let D=Q[Q.length-1];try{let j=await L1(D,{fullRender:!1});X=V5(j,D),J=D,K="all",Y=z1(j).title||J,q=Y,G=null,V=null}catch(j){G="b",V=B.red("Failed to go back to previous page"),Q.push(J)}}else G="b",V=B.yellow("No previous page in history");continue}if(L==="h"||L==="history"){let D=B.bold(`\uD83D\uDCDA Browsing History:
|
|
453
|
+
`);Q.forEach((j,P)=>{let R=P===Q.length-1?"→ ":" ";D+=B.cyan(R)+B.white(j)+`
|
|
454
|
+
`}),G="h",V=D.trim();continue}let A=W.trim().split(/\s+/),z=Number.parseInt(A[0]||"");if(z>=1&&z<=F){let D=U.get(z);if(D){let j=new URL(D.href,J).href;if(A.length>1)try{let P=A.slice(1),{values:R}=yV({args:P,allowPositionals:!1,options:{tldr:{type:"boolean"},"key-points":{type:"boolean"},eli5:{type:"boolean"},full:{type:"boolean"},ask:{type:"string",short:"q"},language:{type:"string",short:"l"},read:{type:"boolean",short:"r"},voice:{type:"string"},"audio-output":{type:"string"},model:{type:"string",short:"m"},stream:{type:"boolean"},"max-tokens":{type:"string"},"free-only":{type:"boolean"},"prefer-quality":{type:"boolean"},format:{type:"string"},output:{type:"string",short:"o"},copy:{type:"boolean",short:"c"},"full-render":{type:"boolean"},screenshot:{type:"string"},metadata:{type:"boolean"},links:{type:"boolean"}}});console.log(B.blue(`\uD83D\uDCCD Processing: ${j}`));let k=[];if(R.tldr)k.push("TLDR");if(R.eli5)k.push("ELI5");if(R["key-points"])k.push("Key Points");if(R.full)k.push("Full Content");if(R.read)k.push("Read Aloud");if(R.language)k.push(`Language: ${R.language}`);if(R.copy)k.push("Copy to Clipboard");if(R.model)k.push(`Model: ${R.model}`);if(k.length>0)console.log(B.dim(`\uD83D\uDD27 Options: ${k.join(", ")}`));console.log("");let y={model:R.model,language:R.language,tldr:R.tldr,keyPoints:R["key-points"],eli5:R.eli5,full:R.full,customQuestion:R.ask,stream:R.stream,maxTokens:R["max-tokens"]?Number.parseInt(R["max-tokens"]):void 0,format:R.format,output:R.output,screenshot:R.screenshot,fullRender:R["full-render"],metadata:R.metadata,links:R.links,read:R.read,voice:R.voice,audioOutput:R["audio-output"],freeOnly:R["free-only"],preferQuality:R["prefer-quality"],copy:R.copy,disableStdinHandling:!0},i=await s2(j,y);if(G=A[0]+" "+A.slice(1).join(" "),y.output)V=B.green(`✅ Content saved to ${y.output}`);else if(!y.stream&&!y.read&&!y.audioOutput)V=B.bold.green(`\uD83C\uDFAF Result:
|
|
455
|
+
`)+i;else V=B.green("✅ Processing completed")}catch(P){console.log(B.red(`Invalid options: ${P instanceof Error?P.message:String(P)}`)),console.log(B.dim("Example: 5 --read -l fr"))}else{console.log(B.blue(`\uD83D\uDCCD Navigating to: ${j}`));try{let P=await L1(j,{fullRender:!1}),R=V5(P,j);Q.push(j),X=R,J=j,K="all",Y=z1(P).title||j,q=Y;let y=R.navigation.length+R.external.length,i=await s2(j,{tldr:!0,disableStdinHandling:!0});G=A[0]||"",V=B.bold.green(`\uD83D\uDCC4 Summary:
|
|
456
|
+
`)+i}catch(P){console.log(B.red("Failed to navigate to that link"))}}}}else if(z>0)console.log(B.yellow(`Invalid link number. Please choose 1-${F}`));else console.log(B.yellow("Invalid command. Type 'q' to quit or a number to navigate."))}Z.close()}function mV(){try{let{values:_,positionals:$}=uV({args:process.argv.slice(2),allowPositionals:!0,options:{help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"},tldr:{type:"boolean"},"key-points":{type:"boolean"},eli5:{type:"boolean"},full:{type:"boolean"},ask:{type:"string",short:"q"},language:{type:"string",short:"l"},read:{type:"boolean",short:"r"},voice:{type:"string"},"list-voices":{type:"boolean"},"audio-output":{type:"string"},model:{type:"string",short:"m"},"list-models":{type:"boolean"},stream:{type:"boolean"},"max-tokens":{type:"string"},"check-services":{type:"boolean"},"free-only":{type:"boolean"},"prefer-quality":{type:"boolean"},format:{type:"string"},output:{type:"string",short:"o"},copy:{type:"boolean",short:"c"},"full-render":{type:"boolean"},screenshot:{type:"string"},metadata:{type:"boolean"},links:{type:"boolean"},browse:{type:"boolean"},debug:{type:"boolean"}}});return{values:_,positionals:$}}catch(_){let $=_ instanceof Error?_.message:String(_);console.error(B.red(`Error parsing arguments: ${$}`)),console.log(B.dim("Run 'glance --help' for usage information")),process.exit(1)}}async function G5(){try{let{values:_,positionals:$}=mV();if(_.help)Tq(),process.exit(0);if(_.version)kq(),process.exit(0);if(_["list-voices"])await tq(),process.exit(0);if(_["check-services"])await sq(),process.exit(0);if(_["list-models"])await eq(),process.exit(0);if(_.browse){if($.length===0)console.error(B.red("Error: No URL provided for browse mode")),console.log(B.dim("Usage: glance <url> --browse")),process.exit(1);let Y=$[0];if(!Y)console.error(B.red("Error: URL is required for browse mode.")),process.exit(1);let K=B5(Y);if(!K.valid)console.error(B.red(`Error: ${K.error}`)),process.exit(1);await _Z(Y),process.exit(0)}if($.length===0)console.error(B.red("Error: No URL provided")),console.log(B.dim("Usage: glance <url> [options]")),console.log(B.dim("Run 'glance --help' for more information")),process.exit(1);let q=$[0];if(!q)console.error(B.red("Error: URL is required.")),process.exit(1);let Z=B5(q);if(!Z.valid)console.error(B.red(`Error: ${Z.error}`)),process.exit(1);if(_.language){let Y=aq(_.language);if(!Y.valid)console.error(B.red(`Error: ${Y.error}`)),process.exit(1)}let Q;if(_["max-tokens"]){let Y=iq(_["max-tokens"]);if(!Y.valid)console.error(B.red(`Error: ${Y.error}`)),process.exit(1);Q=Y.parsed}let X={model:_.model,language:_.language,tldr:_.tldr,keyPoints:_["key-points"],eli5:_.eli5,full:_.full,customQuestion:_.ask,stream:_.stream,maxTokens:Q,format:_.format,output:_.output,screenshot:_.screenshot,fullRender:_["full-render"],metadata:_.metadata,links:_.links,read:_.read,voice:_.voice,audioOutput:_["audio-output"],freeOnly:_["free-only"],preferQuality:_["prefer-quality"],debug:_.debug,copy:_.copy,browse:_.browse},J=await s2(q,X);if(!X.stream&&!X.read&&!X.audioOutput)console.log(J)}catch(_){if(_ instanceof m){if(console.error(Iq(_)),_.hint)console.log(B.yellow(`
|
|
457
|
+
\uD83D\uDCA1 Hint: ${_.hint}`))}else{let $=_ instanceof Error?_.message:String(_);if(console.error(B.red(`
|
|
458
|
+
❌ Unexpected error: ${$}`)),E.getLevel()==="debug"&&_ instanceof Error)console.error(_.stack);else console.log(B.dim("Run with --debug for more details"))}process.exit(1)}}if(typeof process!=="undefined"&&process.argv&&process.argv[1]&&process.argv[1].endsWith("index.ts"))G5();G5().catch((_)=>{console.error("Fatal error:",_),process.exit(1)});
|