glance-cli 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +83 -77
- package/package.json +1 -1
- package/src/cli/config.ts +1 -1
- package/src/core/formatter.ts +74 -5
package/dist/cli.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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
|
|
2
|
+
import{createRequire as YZ}from"node:module";var qZ=Object.create;var{getPrototypeOf:ZZ,defineProperty:$6,getOwnPropertyNames:QZ}=Object;var XZ=Object.prototype.hasOwnProperty;var M1=(_,$,q)=>{q=_!=null?qZ(ZZ(_)):{};let Z=$||!_||!_.__esModule?$6(q,"default",{value:_,enumerable:!0}):q;for(let Q of QZ(_))if(!XZ.call(Z,Q))$6(Z,Q,{get:()=>_[Q],enumerable:!0});return Z};var h=(_,$)=>()=>($||_(($={exports:{}}).exports,$),$.exports);var JZ=(_,$)=>{for(var q in $)$6(_,q,{get:$[q],enumerable:!0,configurable:!0,set:(Z)=>$[q]=()=>Z})};var b=YZ(import.meta.url);var B4=h((nU,H4)=>{H4.exports=K4;K4.sync=OQ;var J4=b("fs");function IQ(_,$){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 Y4(_,$,q){if(!_.isSymbolicLink()&&!_.isFile())return!1;return IQ($,q)}function K4(_,$,q){J4.stat(_,function(Z,Q){q(Z,Z?!1:Y4(Q,_,$))})}function OQ(_,$){return Y4(J4.statSync(_),_,$)}});var F4=h((oU,W4)=>{W4.exports=G4;G4.sync=EQ;var V4=b("fs");function G4(_,$,q){V4.stat(_,function(Z,Q){q(Z,Z?!1:U4(Q,$))})}function EQ(_,$){return U4(V4.statSync(_),$)}function U4(_,$){return _.isFile()&&NQ(_,$)}function NQ(_,$){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 L4=h((tU,z4)=>{var rU=b("fs"),f1;if(process.platform==="win32"||global.TESTING_WINDOWS)f1=B4();else f1=F4();z4.exports=j6;j6.sync=xQ;function j6(_,$,q){if(typeof $==="function")q=$,$={};if(!q){if(typeof Promise!=="function")throw new TypeError("callback not provided");return new Promise(function(Z,Q){j6(_,$||{},function(X,J){if(X)Q(X);else Z(J)})})}f1(_,$||{},function(Z,Q){if(Z){if(Z.code==="EACCES"||$&&$.ignoreErrors)Z=null,Q=!1}q(Z,Q)})}function xQ(_,$){try{return f1.sync(_,$||{})}catch(q){if($&&$.ignoreErrors||q.code==="EACCES")return!1;else throw q}}});var w4=h((sU,P4)=>{var b0=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",R4=b("path"),yQ=b0?";":":",D4=L4(),j4=(_)=>Object.assign(new Error(`not found: ${_}`),{code:"ENOENT"}),A4=(_,$)=>{let q=$.colon||yQ,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}},M4=(_,$,q)=>{if(typeof $==="function")q=$,$={};if(!$)$={};let{pathEnv:Z,pathExt:Q,pathExtExe:X}=A4(_,$),J=[],Y=(H)=>new Promise((V,G)=>{if(H===Z.length)return $.all&&J.length?V(J):G(j4(_));let U=Z[H],W=/^".*"$/.test(U)?U.slice(1,-1):U,F=R4.join(W,_),L=!W&&/^\.[\\\/]/.test(_)?_.slice(0,2)+F:F;V(K(L,H,0))}),K=(H,V,G)=>new Promise((U,W)=>{if(G===Q.length)return U(Y(V+1));let F=Q[G];D4(H+F,{pathExt:X},(L,A)=>{if(!L&&A)if($.all)J.push(H+F);else return U(H+F);return U(K(H,V,G+1))})});return q?Y(0).then((H)=>q(null,H),q):Y(0)},vQ=(_,$)=>{$=$||{};let{pathEnv:q,pathExt:Z,pathExtExe:Q}=A4(_,$),X=[];for(let J=0;J<q.length;J++){let Y=q[J],K=/^".*"$/.test(Y)?Y.slice(1,-1):Y,H=R4.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(D4.sync(U,{pathExt:Q}))if($.all)X.push(U);else return U}catch(W){}}}if($.all&&X.length)return X;if($.nothrow)return null;throw j4(_)};P4.exports=M4;M4.sync=vQ});var T4=h((eU,A6)=>{var C4=(_={})=>{let $=_.env||process.env;if((_.platform||process.platform)!=="win32")return"PATH";return Object.keys($).reverse().find((Z)=>Z.toUpperCase()==="PATH")||"Path"};A6.exports=C4;A6.exports.default=C4});var E4=h((_W,O4)=>{var k4=b("path"),hQ=w4(),SQ=T4();function I4(_,$){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=hQ.sync(_.command,{path:q[SQ({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 bQ(_){return I4(_)||I4(_,!0)}O4.exports=bQ});var N4=h((uQ,P6)=>{var M6=/([()\][%!^"`<>&|;, *?])/g;function fQ(_){return _=_.replace(M6,"^$1"),_}function gQ(_,$){if(_=`${_}`,_=_.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),_=_.replace(/(?=(\\+?)?)\1$/,"$1$1"),_=`"${_}"`,_=_.replace(M6,"^$1"),$)_=_.replace(M6,"^$1");return _}uQ.command=fQ;uQ.argument=gQ});var y4=h(($W,x4)=>{x4.exports=/^#!(.*)/});var h4=h((qW,v4)=>{var cQ=y4();v4.exports=(_="")=>{let $=_.match(cQ);if(!$)return null;let[q,Z]=$[0].replace(/#! ?/,"").split(" "),Q=q.split("/").pop();if(Q==="env")return Z;return Z?`${Q} ${Z}`:Q}});var b4=h((ZW,S4)=>{var w6=b("fs"),pQ=h4();function lQ(_){let q=Buffer.alloc(150),Z;try{Z=w6.openSync(_,"r"),w6.readSync(Z,q,0,150,0),w6.closeSync(Z)}catch(Q){}return pQ(q.toString())}S4.exports=lQ});var m4=h((QW,u4)=>{var aQ=b("path"),f4=E4(),g4=N4(),iQ=b4(),nQ=process.platform==="win32",oQ=/\.(?:com|exe)$/i,rQ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function tQ(_){_.file=f4(_);let $=_.file&&iQ(_.file);if($)return _.args.unshift(_.file),_.command=$,f4(_);return _.file}function sQ(_){if(!nQ)return _;let $=tQ(_),q=!oQ.test($);if(_.options.forceShell||q){let Z=rQ.test($);_.command=aQ.normalize(_.command),_.command=g4.command(_.command),_.args=_.args.map((X)=>g4.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 eQ(_,$,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:sQ(Z)}u4.exports=eQ});var p4=h((XW,c4)=>{var C6=process.platform==="win32";function T6(_,$){return Object.assign(new Error(`${$} ${_.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${$} ${_.command}`,path:_.command,spawnargs:_.args})}function _X(_,$){if(!C6)return;let q=_.emit;_.emit=function(Z,Q){if(Z==="exit"){let X=d4(Q,$);if(X)return q.call(_,"error",X)}return q.apply(_,arguments)}}function d4(_,$){if(C6&&_===1&&!$.file)return T6($.original,"spawn");return null}function $X(_,$){if(C6&&_===1&&!$.file)return T6($.original,"spawnSync");return null}c4.exports={hookChildProcess:_X,verifyENOENT:d4,verifyENOENTSync:$X,notFoundError:T6}});var i4=h((JW,f0)=>{var l4=b("child_process"),k6=m4(),I6=p4();function a4(_,$,q){let Z=k6(_,$,q),Q=l4.spawn(Z.command,Z.args,Z.options);return I6.hookChildProcess(Q,Z),Q}function qX(_,$,q){let Z=k6(_,$,q),Q=l4.spawnSync(Z.command,Z.args,Z.options);return Q.error=Q.error||I6.verifyENOENTSync(Q.status,Z),Q}f0.exports=a4;f0.exports.spawn=a4;f0.exports.sync=qX;f0.exports._parse=k6;f0.exports._enoent=I6});import{parseArgs as mV}from"node:util";var W5=(_=0)=>($)=>`\x1B[${$+_}m`,F5=(_=0)=>($)=>`\x1B[${38+_};5;${$}m`,z5=(_=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]}},lV=Object.keys(C.modifier),KZ=Object.keys(C.color),HZ=Object.keys(C.bgColor),aV=[...KZ,...HZ];function BZ(){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=W5(),C.color.ansi256=F5(),C.color.ansi16m=z5(),C.bgColor.ansi=W5(10),C.bgColor.ansi256=F5(10),C.bgColor.ansi16m=z5(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 VZ=BZ(),c=VZ;import q6 from"node:process";import GZ from"node:os";import L5 from"node:tty";function f(_,$=globalThis.Deno?globalThis.Deno.args:q6.argv){let q=_.startsWith("-")?"":_.length===1?"-":"--",Z=$.indexOf(q+_),Q=$.indexOf("--");return Z!==-1&&(Q===-1||Z<Q)}var{env:T}=q6,P1;if(f("no-color")||f("no-colors")||f("color=false")||f("color=never"))P1=0;else if(f("color")||f("colors")||f("color=true")||f("color=always"))P1=1;function UZ(){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 WZ(_){if(_===0)return!1;return{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function FZ(_,{streamIsTTY:$,sniffFlags:q=!0}={}){let Z=UZ();if(Z!==void 0)P1=Z;let Q=q?P1: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(q6.platform==="win32"){let J=GZ.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 R5(_,$={}){let q=FZ(_,{streamIsTTY:_&&_.isTTY,...$});return WZ(q)}var zZ={stdout:R5({isTTY:L5.isatty(1)}),stderr:R5({isTTY:L5.isatty(2)})},D5=zZ;function j5(_,$,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 A5(_,$,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:M5,stderr:P5}=D5,Z6=Symbol("GENERATOR"),x0=Symbol("STYLER"),e0=Symbol("IS_EMPTY"),w5=["ansi","ansi","ansi256","ansi16m"],y0=Object.create(null),LZ=(_,$={})=>{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=M5?M5.level:0;_.level=$.level===void 0?q:$.level};var RZ=(_)=>{let $=(...q)=>q.join(" ");return LZ($,_),Object.setPrototypeOf($,_1.prototype),$};function _1(_){return RZ(_)}Object.setPrototypeOf(_1.prototype,Function.prototype);for(let[_,$]of Object.entries(c))y0[_]={get(){let q=w1(this,X6($.open,$.close,this[x0]),this[e0]);return Object.defineProperty(this,_,{value:q}),q}};y0.visible={get(){let _=w1(this,this[x0],!0);return Object.defineProperty(this,"visible",{value:_}),_}};var Q6=(_,$,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 Q6("rgb",$,q,...c.hexToRgb(...Z));return c[q][_](...Z)},DZ=["rgb","hex","ansi256"];for(let _ of DZ){y0[_]={get(){let{level:q}=this;return function(...Z){let Q=X6(Q6(_,w5[q],"color",...Z),c.color.close,this[x0]);return w1(this,Q,this[e0])}}};let $="bg"+_[0].toUpperCase()+_.slice(1);y0[$]={get(){let{level:q}=this;return function(...Z){let Q=X6(Q6(_,w5[q],"bgColor",...Z),c.bgColor.close,this[x0]);return w1(this,Q,this[e0])}}}}var jZ=Object.defineProperties(()=>{},{...y0,level:{enumerable:!0,get(){return this[Z6].level},set(_){this[Z6].level=_}}}),X6=(_,$,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}},w1=(_,$,q)=>{let Z=(...Q)=>AZ(Z,Q.length===1?""+Q[0]:Q.join(" "));return Object.setPrototypeOf(Z,jZ),Z[Z6]=_,Z[x0]=$,Z[e0]=q,Z},AZ=(_,$)=>{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)$=j5($,q.close,q.open),q=q.parent;let X=$.indexOf(`
|
|
6
|
+
`);if(X!==-1)$=A5($,Q,Z,X);return Z+$+Q};Object.defineProperties(_1.prototype,y0);var MZ=_1(),qG=_1({level:P5?P5.level:0});var B=MZ;import{writeFile as xV}from"node:fs/promises";import{createInterface as yV}from"node:readline";import{parseArgs as vV}from"node:util";import*as oq from"cheerio";import Kq from"node:process";import k5 from"node:process";import kZ from"node:os";import IZ from"node:fs";import CZ from"node:fs";import C5 from"node:fs";var J6;function PZ(){try{return C5.statSync("/.dockerenv"),!0}catch{return!1}}function wZ(){try{return C5.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Y6(){if(J6===void 0)J6=PZ()||wZ();return J6}var K6,TZ=()=>{try{return CZ.statSync("/run/.containerenv"),!0}catch{return!1}};function C1(){if(K6===void 0)K6=TZ()||Y6();return K6}var T5=()=>{if(k5.platform!=="linux")return!1;if(kZ.release().toLowerCase().includes("microsoft")){if(C1())return!1;return!0}try{return IZ.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!C1():!1}catch{return!1}},I5=k5.env.__IS_WSL_TEST__?T5:T5();import H6 from"node:process";function B6(){if(H6.platform!=="linux")return!1;if(H6.env.WAYLAND_DISPLAY)return!0;if(H6.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 OZ}from"node:url";var v0=(_,$)=>{let q=G6(EZ(_));if(typeof q!=="string")throw new TypeError(`${$} must be a string or a file URL: ${q}.`);return q},EZ=(_)=>V6(_)?_.toString():_,V6=(_)=>typeof _!=="string"&&_&&Object.getPrototypeOf(_)===String.prototype,G6=(_)=>_ instanceof URL?OZ(_):_;var T1=(_,$=[],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 bZ}from"node:child_process";import{StringDecoder as NZ}from"node:string_decoder";var{toString:O5}=Object.prototype,E5=(_)=>O5.call(_)==="[object ArrayBuffer]",O=(_)=>O5.call(_)==="[object Uint8Array]",$0=(_)=>new Uint8Array(_.buffer,_.byteOffset,_.byteLength),xZ=new TextEncoder,N5=(_)=>xZ.encode(_),yZ=new TextDecoder,k1=(_)=>yZ.decode(_),x5=(_,$)=>{return vZ(_,$).join("")},vZ=(_,$)=>{if($==="utf8"&&_.every((X)=>typeof X==="string"))return _;let q=new NZ($),Z=_.map((X)=>typeof X==="string"?N5(X):X).map((X)=>q.write(X)),Q=q.end();return Q===""?Z:[...Z,Q]},$1=(_)=>{if(_.length===1&&O(_[0]))return _[0];return U6(hZ(_))},hZ=(_)=>_.map(($)=>typeof $==="string"?N5($):$),U6=(_)=>{let $=new Uint8Array(SZ(_)),q=0;for(let Z of _)$.set(Z,q),q+=Z.length;return $},SZ=(_)=>{let $=0;for(let q of _)$+=q.length;return $};var S5=(_)=>Array.isArray(_)&&Array.isArray(_.raw),b5=(_,$)=>{let q=[];for(let[X,J]of _.entries())q=fZ({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,{}]},fZ=({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}=gZ(Q,_.raw[Z]),K=v5(q,X,J);if(Z===$.length)return K;let H=$[Z],V=Array.isArray(H)?H.map((G)=>h5(G)):[h5(H)];return v5(K,V,Y)},gZ=(_,$)=>{if($.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let q=[],Z=0,Q=y5.has($[0]);for(let J=0,Y=0;J<_.length;J+=1,Y+=1){let K=$[Y];if(y5.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+=uZ[H]??1}}let X=Z===_.length;if(!X)q.push(_.slice(Z));return{nextTokens:q,leadingWhitespaces:Q,trailingWhitespaces:X}},y5=new Set([" ","\t","\r",`
|
|
8
|
+
`]),uZ={x:3,u:5},v5=(_,$,q)=>q||_.length===0||$.length===0?[..._,...$]:[..._.slice(0,-1),`${_.at(-1)}${$[0]}`,...$.slice(1)],h5=(_)=>{let $=typeof _;if($==="string")return _;if($==="number")return String(_);if(I(_)&&(("stdout"in _)||("isMaxBuffer"in _)))return mZ(_);if(_ instanceof bZ||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`)},mZ=({stdout:_})=>{if(typeof _==="string")return _;if(O(_))return k1(_);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 nY}from"node:child_process";import{debuglog as dZ}from"node:util";import W6 from"node:process";var p=(_)=>I1.includes(_),I1=[W6.stdin,W6.stdout,W6.stderr],g=["stdin","stdout","stderr"],O1=(_)=>g[_]??`stdio[${_}]`;var g5=(_)=>{let $={..._};for(let q of L6)$[q]=F6(_,q);return $},F6=(_,$)=>{let q=Array.from({length:cZ(_)+1}),Z=pZ(_[$],q,$);return oZ(Z,$)},cZ=({stdio:_})=>Array.isArray(_)?Math.max(_.length,g.length):g.length,pZ=(_,$,q)=>I(_)?lZ(_,$,q):$.fill(_),lZ=(_,$,q)=>{for(let Z of Object.keys(_).sort(aZ))for(let Q of iZ(Z,q,$))$[Q]=_[Z];return $},aZ=(_,$)=>f5(_)<f5($)?1:-1,f5=(_)=>{if(_==="stdout"||_==="stderr")return 0;return _==="all"?2:1},iZ=(_,$,q)=>{if(_==="ipc")return[q.length-1];let Z=z6(_);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]},z6=(_)=>{if(_==="all")return _;if(g.includes(_))return g.indexOf(_);let $=nZ.exec(_);if($!==null)return Number($[1])},nZ=/^fd(\d+)$/,oZ=(_,$)=>_.map((q)=>q===void 0?tZ[$]:q),rZ=dZ("execa").enabled?"full":"none",tZ={lines:!1,buffer:!0,maxBuffer:1e8,verbose:rZ,stripFinalNewline:!0},L6=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],q0=(_,$)=>$==="ipc"?_.at(-1):_[$];var h0=({verbose:_},$)=>R6(_,$)!=="none",S0=({verbose:_},$)=>!["none","short"].includes(R6(_,$)),u5=({verbose:_},$)=>{let q=R6(_,$);return E1(q)?q:void 0},R6=(_,$)=>$===void 0?sZ(_):q0(_,$),sZ=(_)=>_.find(($)=>E1($))??N1.findLast(($)=>_.includes($)),E1=(_)=>typeof _==="function",N1=["none","short","full"];import{inspect as jQ}from"node:util";import{platform as eZ}from"node:process";import{stripVTControlCharacters as _Q}from"node:util";var m5=(_,$)=>{let q=[_,...$],Z=q.join(" "),Q=q.map((X)=>JQ(d5(X))).join(" ");return{command:Z,escapedCommand:Q}},q1=(_)=>_Q(_).split(`
|
|
11
|
+
`).map(($)=>d5($)).join(`
|
|
12
|
+
`),d5=(_)=>_.replaceAll(ZQ,($)=>$Q($)),$Q=(_)=>{let $=QQ[_];if($!==void 0)return $;let q=_.codePointAt(0),Z=q.toString(16);return q<=XQ?`\\u${Z.padStart(4,"0")}`:`\\U${Z}`},qQ=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ZQ=qQ(),QQ={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},XQ=65535,JQ=(_)=>{if(YQ.test(_))return _;return eZ==="win32"?`"${_.replaceAll('"','""')}"`:`'${_.replaceAll("'","'\\''")}'`},YQ=/^[\w./-]+$/;import c5 from"node:process";function j0(){let{env:_}=c5,{TERM:$,TERM_PROGRAM:q}=_;if(c5.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 p5={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:"╱"},l5={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:"⅒"},KQ={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"},HQ={...p5,...l5},BQ={...p5,...KQ},VQ=j0(),GQ=VQ?HQ:BQ,x1=GQ,dG=Object.entries(l5);import UQ from"node:tty";var WQ=UQ?.WriteStream?.prototype?.hasColors?.()??!1,M=(_,$)=>{if(!WQ)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}},lG=M(0,0),a5=M(1,22),aG=M(2,22),iG=M(3,23),nG=M(4,24),oG=M(53,55),rG=M(7,27),tG=M(8,28),sG=M(9,29),eG=M(30,39),i5=M(31,39),n5=M(32,39),o5=M(33,39),r5=M(34,39),_U=M(35,39),$U=M(36,39),qU=M(37,39),y1=M(90,39),ZU=M(40,49),QU=M(41,49),XU=M(42,49),JU=M(43,49),YU=M(44,49),KU=M(45,49),HU=M(46,49),BU=M(47,49),VU=M(100,49),t5=M(91,39),GU=M(92,39),s5=M(93,39),UU=M(94,39),WU=M(95,39),FU=M(96,39),zU=M(97,39),LU=M(101,49),RU=M(102,49),DU=M(103,49),jU=M(104,49),AU=M(105,49),MU=M(106,49),PU=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=zQ[_]({failed:X,reject:J,piped:Z}),H=LQ[_]({reject:J});return`${y1(`[${Y}]`)} ${y1(`[${Q}]`)} ${H(K)} ${H($)}`},FQ=(_)=>`${v1(_.getHours(),2)}:${v1(_.getMinutes(),2)}:${v1(_.getSeconds(),2)}.${v1(_.getMilliseconds(),3)}`,v1=(_,$)=>String(_).padStart($,"0"),e5=({failed:_,reject:$})=>{if(!_)return x1.tick;return $?x1.cross:x1.warning},zQ={command:({piped:_})=>_?"|":"$",output:()=>" ",ipc:()=>"*",error:e5,duration:e5},_4=(_)=>_,LQ={command:()=>a5,output:()=>_4,ipc:()=>_4,error:({reject:_})=>_?t5:s5,duration:()=>y1};var q4=(_,$,q)=>{let Z=u5($,q);return _.map(({verboseLine:Q,verboseObject:X})=>RQ(Q,X,Z)).filter((Q)=>Q!==void 0).map((Q)=>DQ(Q)).join("")},RQ=(_,$,q)=>{if(q===void 0)return _;let Z=q(_,$);if(typeof Z==="string")return Z},DQ=(_)=>_.endsWith(`
|
|
13
13
|
`)?_:`${_}
|
|
14
|
-
`;var n=({type:_,verboseMessage:$,fdNumber:q,verboseInfo:Z,result:Q})=>{let X=
|
|
15
|
-
`).map((q)=>
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
Available signal numbers: ${
|
|
14
|
+
`;var n=({type:_,verboseMessage:$,fdNumber:q,verboseInfo:Z,result:Q})=>{let X=AQ({type:_,result:Q,verboseInfo:Z}),J=MQ($,X),Y=q4(J,Z,q);if(Y!=="")console.warn(Y.slice(0,-1))},AQ=({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}),MQ=(_,$)=>_.split(`
|
|
15
|
+
`).map((q)=>PQ({...$,message:q})),PQ=(_)=>{return{verboseLine:$4(_),verboseObject:_}},h1=(_)=>{let $=typeof _==="string"?_:jQ(_);return q1($).replaceAll("\t"," ".repeat(wQ))},wQ=2;var Z4=(_,$)=>{if(!h0($))return;n({type:"command",verboseMessage:_,verboseInfo:$})};var Q4=(_,$,q)=>{kQ(_);let Z=CQ(_);return{verbose:_,escapedCommand:$,commandId:Z,rawOptions:q}},CQ=(_)=>h0({verbose:_})?TQ++:void 0,TQ=0n,kQ=(_)=>{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(!N1.includes($)&&!E1($)){let q=N1.map((Z)=>`'${Z}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${$}. Allowed values are: ${q} or a function.`)}}};import{hrtime as X4}from"node:process";var S1=()=>X4.bigint(),D6=(_)=>Number(X4.bigint()-_)/1e6;var b1=(_,$,q)=>{let Z=S1(),{command:Q,escapedCommand:X}=m5(_,$),J=F6(q,"verbose"),Y=Q4(J,X,{...q});return Z4(X,Y),{command:Q,escapedCommand:X,startTime:Z,verboseInfo:Y}};var Z_=M1(i4(),1);import UJ from"node:path";import q_ from"node:process";import m1 from"node:process";import A0 from"node:path";function g1(_={}){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 ZX}from"node:util";import{execFile as QX,execFileSync as BW}from"node:child_process";import n4 from"node:path";import{fileURLToPath as XX}from"node:url";var UW=ZX(QX);function u1(_){return _ instanceof URL?XX(_):_}function o4(_){return{*[Symbol.iterator](){let $=n4.resolve(u1(_)),q;while(q!==$)yield $,q=$,$=n4.resolve($,"..")}}}var JX=({cwd:_=m1.cwd(),path:$=m1.env[g1()],preferLocal:q=!0,execPath:Z=m1.execPath,addExecPath:Q=!0}={})=>{let X=A0.resolve(u1(_)),J=[],Y=$.split(A0.delimiter);if(q)YX(J,Y,X);if(Q)KX(J,Y,Z,X);return $===""||$===A0.delimiter?`${J.join(A0.delimiter)}${$}`:[...J,$].join(A0.delimiter)},YX=(_,$,q)=>{for(let Z of o4(q)){let Q=A0.join(Z,"node_modules/.bin");if(!$.includes(Q))_.push(Q)}},KX=(_,$,q,Z)=>{let Q=A0.resolve(Z,u1(q),"..");if(!$.includes(Q))_.push(Q)},r4=({env:_=m1.env,...$}={})=>{_={..._};let q=g1({env:_});return $.path=_[q],_[q]=JX($),_};import{setTimeout as PX}from"node:timers/promises";var t4=(_,$,q)=>{let Z=q?c1:d1,Q=_ instanceof o?{}:{cause:_};return new Z($,Q)};class o extends Error{}var s4=(_,$)=>{Object.defineProperty(_.prototype,"name",{value:$,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,_8,{value:!0,writable:!1,enumerable:!1,configurable:!1})},e4=(_)=>p1(_)&&(_8 in _),_8=Symbol("isExecaError"),p1=(_)=>Object.prototype.toString.call(_)==="[object Error]";class d1 extends Error{}s4(d1,d1.name);class c1 extends Error{}s4(c1,c1.name);import{constants as Z1}from"node:os";import{constants as GX}from"node:os";var $8=()=>{let _=O6-q8+1;return Array.from({length:_},HX)},HX=(_,$)=>({name:`SIGRT${$+1}`,number:q8+$,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),q8=34,O6=64;import{constants as BX}from"node:os";var Z8=[{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 E6=()=>{let _=$8();return[...Z8,..._].map(VX)},VX=({name:_,number:$,description:q,action:Z,forced:Q=!1,standard:X})=>{let{signals:{[_]:J}}=BX,Y=J!==void 0;return{name:_,number:Y?J:$,description:q,supported:Y,action:Z,forced:Q,standard:X}};var UX=()=>{let _=E6();return Object.fromEntries(_.map(WX))},WX=({name:_,number:$,description:q,supported:Z,action:Q,forced:X,standard:J})=>[_,{name:_,number:$,description:q,supported:Z,action:Q,forced:X,standard:J}],Q8=UX(),FX=()=>{let _=E6(),$=O6+1,q=Array.from({length:$},(Z,Q)=>zX(Q,_));return Object.assign({},...q)},zX=(_,$)=>{let q=LX(_,$);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}}},LX=(_,$)=>{let q=$.find(({name:Z})=>GX.signals[Z]===_);if(q!==void 0)return q;return $.find((Z)=>Z.number===_)},NW=FX();var J8=(_)=>{if(_===0)throw new TypeError("Invalid option `killSignal`: 0 cannot be used.");return K8(_,"option `killSignal`")},Y8=(_)=>_===0?_:K8(_,"`subprocess.kill()`'s argument"),K8=(_,$)=>{if(Number.isInteger(_))return RX(_,$);if(typeof _==="string")return jX(_,$);throw new TypeError(`Invalid ${$} ${String(_)}: it must be a string or an integer.
|
|
16
|
+
${N6()}`)},RX=(_,$)=>{if(X8.has(_))return X8.get(_);throw new TypeError(`Invalid ${$} ${_}: this signal integer does not exist.
|
|
17
|
+
${N6()}`)},DX=()=>new Map(Object.entries(Z1.signals).reverse().map(([_,$])=>[$,_])),X8=DX(),jX=(_,$)=>{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
|
+
${N6()}`)},N6=()=>`Available signal names: ${AX()}.
|
|
19
|
+
Available signal numbers: ${MX()}.`,AX=()=>Object.keys(Z1.signals).sort().map((_)=>`'${_}'`).join(", "),MX=()=>[...new Set(Object.values(Z1.signals).sort((_,$)=>_-$))].join(", "),l1=(_)=>Q8[_].description;var H8=(_)=>{if(_===!1)return _;if(_===!0)return wX;if(!Number.isFinite(_)||_<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${_}\` (${typeof _})`);return _},wX=5000,B8=({kill:_,options:{forceKillAfterDelay:$,killSignal:q},onInternalError:Z,context:Q,controller:X},J,Y)=>{let{signal:K,error:H}=CX(J,Y,q);TX(H,Z);let V=_(K);return kX({kill:_,signal:K,forceKillAfterDelay:$,killSignal:q,killResult:V,context:Q,controller:X}),V},CX=(_,$,q)=>{let[Z=q,Q]=p1(_)?[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&&!p1(Q))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${Q}`);return{signal:Y8(Z),error:Q}},TX=(_,$)=>{if(_!==void 0)$.reject(_)},kX=async({kill:_,signal:$,forceKillAfterDelay:q,killSignal:Z,killResult:Q,context:X,controller:J})=>{if($===Z&&Q)x6({kill:_,forceKillAfterDelay:q,context:X,controllerSignal:J.signal})},x6=async({kill:_,forceKillAfterDelay:$,context:q,controllerSignal:Z})=>{if($===!1)return;try{if(await PX($,void 0,{signal:Z}),_("SIGKILL"))q.isForcefullyTerminated??=!0}catch{}};import{once as IX}from"node:events";var a1=async(_,$)=>{if(!_.aborted)await IX(_,"abort",{signal:$})};var V8=({cancelSignal:_})=>{if(_!==void 0&&Object.prototype.toString.call(_)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(_)}`)},G8=({subprocess:_,cancelSignal:$,gracefulCancel:q,context:Z,controller:Q})=>$===void 0||q?[]:[OX(_,$,Z,Q)],OX=async(_,$,q,{signal:Z})=>{throw await a1($,Z),q.terminationReason??="cancel",_.kill(),$.reason};import{scheduler as rX}from"node:timers/promises";import{promisify as iX}from"node:util";var g0=({methodName:_,isSubprocess:$,ipc:q,isConnected:Z})=>{EX(_,$,q),y6(_,$,Z)},EX=(_,$,q)=>{if(!q)throw new Error(`${l(_,$)} can only be used if the \`ipc\` option is \`true\`.`)},y6=(_,$,q)=>{if(!q)throw new Error(`${l(_,$)} cannot be used: the ${B0($)} has already exited or disconnected.`)},U8=(_)=>{throw new Error(`${l("getOneMessage",_)} could not complete: the ${B0(_)} exited or disconnected.`)},W8=(_)=>{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
23
|
${l("getOneMessage",_)},
|
|
24
24
|
${l("sendMessage",_,"message, {strict: true}")},
|
|
25
|
-
]);`)},
|
|
25
|
+
]);`)},i1=(_,$)=>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.`)},z8=(_)=>{throw new Error(`${l("sendMessage",_)} failed: the ${B0(_)} exited without listening to incoming messages.`)},L8=()=>new Error(`\`cancelSignal\` aborted: the ${B0(!0)} disconnected.`),R8=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},D8=({error:_,methodName:$,isSubprocess:q})=>{if(_.code==="EPIPE")throw new Error(`${l($,q)} cannot be used: the ${B0(q)} is disconnecting.`,{cause:_})},j8=({error:_,methodName:$,isSubprocess:q,message:Z})=>{if(NX(_))throw new Error(`${l($,q)}'s argument type is invalid: the message cannot be serialized: ${String(Z)}.`,{cause:_})},NX=({code:_,message:$})=>xX.has(_)||yX.some((q)=>$.includes(q)),xX=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),yX=["could not be cloned","circular structure","call stack size exceeded"],l=(_,$,q="")=>_==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${vX($)}${_}(${q})`,vX=(_)=>_?"":"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 o1=(_,$="stdin")=>{let{options:Z,fileDescriptors:Q}=t.get(_),X=A8(Q,$,!0),J=_.stdio[X];if(J===null)throw new TypeError(M8(X,$,Z,!0));return J},m0=(_,$="stdout")=>{let{options:Z,fileDescriptors:Q}=t.get(_),X=A8(Q,$,!1),J=X==="all"?_.all:_.stdio[X];if(J===null||J===void 0)throw new TypeError(M8(X,$,Z,!1));return J},t=new WeakMap,A8=(_,$,q)=>{let Z=hX($,q);return SX(Z,$,q,_),Z},hX=(_,$)=>{let q=z6(_);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}".`)},SX=(_,$,q,Z)=>{let Q=Z[P8(_)];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.`)},M8=(_,$,q,Z)=>{if(_==="all"&&!q.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:Q,optionValue:X}=bX(_,q);return`The "${Q}: ${n1(X)}" option is incompatible with using "${Q1(Z)}: ${n1($)}".
|
|
29
|
+
Please set this option with "pipe" instead.`},bX=(_,{stdin:$,stdout:q,stderr:Z,stdio:Q})=>{let X=P8(_);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]}},P8=(_)=>_==="all"?1:_,Q1=(_)=>_?"to":"from",n1=(_)=>{if(typeof _==="string")return`'${_}'`;return typeof _==="number"?`${_}`:"Stream"};import{once as cX}from"node:events";import{addAbortListener as fX}from"node:events";var M0=(_,$,q)=>{let Z=_.getMaxListeners();if(Z===0||Z===Number.POSITIVE_INFINITY)return;_.setMaxListeners(Z+$),fX(q,()=>{_.setMaxListeners(_.getMaxListeners()-$)})};import{EventEmitter as mX}from"node:events";import{once as gX}from"node:events";import{scheduler as uX}from"node:timers/promises";var r1=(_,$)=>{if($)v6(_)},v6=(_)=>{_.refCounted()},t1=(_,$)=>{if($)h6(_)},h6=(_)=>{_.unrefCounted()},w8=(_,$)=>{if($)h6(_),h6(_)},C8=(_,$)=>{if($)v6(_),v6(_)};var T8=async({anyProcess:_,channel:$,isSubprocess:q,ipcEmitter:Z},Q)=>{if(O8(Q)||N8(Q))return;if(!s1.has(_))s1.set(_,[]);let X=s1.get(_);if(X.push(Q),X.length>1)return;while(X.length>0){await E8(_,Z,Q),await uX.yield();let J=await I8({wrappedMessage:X[0],anyProcess:_,channel:$,isSubprocess:q,ipcEmitter:Z});X.shift(),Z.emit("message",J),Z.emit("message:done")}},k8=async({anyProcess:_,channel:$,isSubprocess:q,ipcEmitter:Z,boundOnMessage:Q})=>{S6();let X=s1.get(_);while(X?.length>0)await gX(Z,"message:done");_.removeListener("message",Q),C8($,q),Z.connected=!1,Z.emit("disconnect")},s1=new WeakMap;var V0=(_,$,q)=>{if(e1.has(_))return e1.get(_);let Z=new mX;return Z.connected=!0,e1.set(_,Z),dX({ipcEmitter:Z,anyProcess:_,channel:$,isSubprocess:q}),Z},e1=new WeakMap,dX=({ipcEmitter:_,anyProcess:$,channel:q,isSubprocess:Z})=>{let Q=T8.bind(void 0,{anyProcess:$,channel:q,isSubprocess:Z,ipcEmitter:_});$.on("message",Q),$.once("disconnect",k8.bind(void 0,{anyProcess:$,channel:q,isSubprocess:Z,ipcEmitter:_,boundOnMessage:Q})),w8(q,Z)},_2=(_)=>{let $=e1.get(_);return $===void 0?_.channel!==null:$.connected};var x8=({anyProcess:_,channel:$,isSubprocess:q,message:Z,strict:Q})=>{if(!Q)return Z;let X=V0(_,$,q),J=Z2(_,X);return{id:pX++,type:q2,message:Z,hasListeners:J}},pX=0n,y8=(_,$)=>{if($?.type!==q2||$.hasListeners)return;for(let{id:q}of _)if(q!==void 0)$2[q].resolve({isDeadlock:!0,hasListeners:!1})},I8=async({wrappedMessage:_,anyProcess:$,channel:q,isSubprocess:Z,ipcEmitter:Q})=>{if(_?.type!==q2||!$.connected)return _;let{id:X,message:J}=_,Y={id:X,type:h8,message:Z2($,Q)};try{await Q2({anyProcess:$,channel:q,isSubprocess:Z,ipc:!0},Y)}catch(K){Q.emit("strict:error",K)}return J},O8=(_)=>{if(_?.type!==h8)return!1;let{id:$,message:q}=_;return $2[$]?.resolve({isDeadlock:!1,hasListeners:q}),!0},v8=async(_,$,q)=>{if(_?.type!==q2)return;let Z=r();$2[_.id]=Z;let Q=new AbortController;try{let{isDeadlock:X,hasListeners:J}=await Promise.race([Z,lX($,q,Q)]);if(X)W8(q);if(!J)F8(q)}finally{Q.abort(),delete $2[_.id]}},$2={},lX=async(_,$,{signal:q})=>{M0(_,1,q),await cX(_,"disconnect",{signal:q}),z8($)},q2="execa:ipc:request",h8="execa:ipc:response";var S8=(_,$,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}},b8=({outgoingMessages:_,outgoingMessage:$})=>{_.delete($),$.onMessageSent.resolve()},E8=async(_,$,q)=>{while(!Z2(_,$)&&X1.get(_)?.size>0){let Z=[...X1.get(_)];y8(Z,q),await Promise.all(Z.map(({onMessageSent:Q})=>Q))}},X1=new WeakMap,Z2=(_,$)=>$.listenerCount("message")>aX(_),aX=(_)=>t.has(_)&&!q0(t.get(_).options.buffer,"ipc")?1:0;var Q2=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z},Q,{strict:X=!1}={})=>{return g0({methodName:"sendMessage",isSubprocess:q,ipc:Z,isConnected:_.connected}),nX({anyProcess:_,channel:$,methodName:"sendMessage",isSubprocess:q,message:Q,strict:X})},nX=async({anyProcess:_,channel:$,methodName:q,isSubprocess:Z,message:Q,strict:X})=>{let J=x8({anyProcess:_,channel:$,isSubprocess:Z,message:Q,strict:X}),Y=S8(_,J,X);try{await f6({anyProcess:_,methodName:q,isSubprocess:Z,wrappedMessage:J,message:Q})}catch(K){throw u0(_),K}finally{b8(Y)}},f6=async({anyProcess:_,methodName:$,isSubprocess:q,wrappedMessage:Z,message:Q})=>{let X=oX(_);try{await Promise.all([v8(Z,_,q),X(Z)])}catch(J){throw D8({error:J,methodName:$,isSubprocess:q}),j8({error:J,methodName:$,isSubprocess:q,message:Q}),J}},oX=(_)=>{if(b6.has(_))return b6.get(_);let $=iX(_.send.bind(_));return b6.set(_,$),$},b6=new WeakMap;var g8=(_,$)=>{return y6("cancelSignal",!1,_.connected),f6({anyProcess:_,methodName:"cancelSignal",isSubprocess:!1,wrappedMessage:{type:m8,message:$},message:$})},u8=async({anyProcess:_,channel:$,isSubprocess:q,ipc:Z})=>{return await tX({anyProcess:_,channel:$,isSubprocess:q,ipc:Z}),g6.signal},tX=async({anyProcess:_,channel:$,isSubprocess:q,ipc:Z})=>{if(f8)return;if(f8=!0,!Z){R8();return}if($===null){S6();return}V0(_,$,q),await rX.yield()},f8=!1,N8=(_)=>{if(_?.type!==m8)return!1;return g6.abort(_.message),!0},m8="execa:ipc:cancel",S6=()=>{g6.abort(L8())},g6=new AbortController;var d8=({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.")},c8=({subprocess:_,cancelSignal:$,gracefulCancel:q,forceKillAfterDelay:Z,context:Q,controller:X})=>q?[sX({subprocess:_,cancelSignal:$,forceKillAfterDelay:Z,context:Q,controller:X})]:[],sX=async({subprocess:_,cancelSignal:$,forceKillAfterDelay:q,context:Z,controller:{signal:Q}})=>{await a1($,Q);let X=eX($);throw await g8(_,X),x6({kill:_.kill,forceKillAfterDelay:q,context:Z,controllerSignal:Q}),Z.terminationReason??="gracefulCancel",$.reason},eX=({reason:_})=>{if(!(_ instanceof DOMException))return _;let $=new Error(_.message);return Object.defineProperty($,"stack",{value:_.stack,enumerable:!1,configurable:!0,writable:!0}),$};import{setTimeout as _J}from"node:timers/promises";var p8=({timeout:_})=>{if(_!==void 0&&(!Number.isFinite(_)||_<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${_}\` (${typeof _})`)},l8=(_,$,q,Z)=>$===0||$===void 0?[]:[$J(_,$,q,Z)],$J=async(_,$,q,{signal:Z})=>{throw await _J($,void 0,{signal:Z}),q.terminationReason??="timeout",_.kill(),new o};import{execPath as qJ,execArgv as ZJ}from"node:process";import a8 from"node:path";var i8=({options:_})=>{if(_.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{..._,node:!0}}},n8=(_,$,{node:q=!1,nodePath:Z=qJ,nodeOptions:Q=ZJ.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=a8.resolve(X,K),V={...Y,nodePath:H,node:q,cwd:X};if(!q)return[_,$,V];if(a8.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 QJ}from"node:v8";var o8=({ipcInput:_,ipc:$,serialization:q})=>{if(_===void 0)return;if(!$)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");YJ[q](_)},XJ=(_)=>{try{QJ(_)}catch($){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:$})}},JJ=(_)=>{try{JSON.stringify(_)}catch($){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:$})}},YJ={advanced:XJ,json:JJ},r8=async(_,$)=>{if($===void 0)return;await _.sendMessage($)};var s8=({encoding:_})=>{if(u6.has(_))return;let $=HJ(_);if($!==void 0)throw new TypeError(`Invalid option \`encoding: ${X2(_)}\`.
|
|
30
|
+
Please rename it to ${X2($)}.`);let q=[...u6].map((Z)=>X2(Z)).join(", ");throw new TypeError(`Invalid option \`encoding: ${X2(_)}\`.
|
|
31
|
+
Please rename it to one of: ${q}.`)},KJ=new Set(["utf8","utf16le"]),S=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),u6=new Set([...KJ,...S]),HJ=(_)=>{if(_===null)return"buffer";if(typeof _!=="string")return;let $=_.toLowerCase();if($ in t8)return t8[$];if(u6.has($))return $},t8={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},X2=(_)=>typeof _==="string"?`"${_}"`:String(_);import{statSync as BJ}from"node:fs";import VJ from"node:path";import GJ from"node:process";var e8=(_=__())=>{let $=v0(_,'The "cwd" option');return VJ.resolve($)},__=()=>{try{return GJ.cwd()}catch(_){throw _.message=`The current directory does not exist.
|
|
32
|
+
${_.message}`,_}},$_=(_,$)=>{if($===__())return _;let q;try{q=BJ($)}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
|
-
${P}`,k=`${j}: ${Y}${R}`,y=$===void 0?[_[2],_[1]]:[$],i=[k,...y,..._.slice(3),q.map((H0)=>
|
|
38
|
-
`)].map((H0)=>q1(d0(
|
|
39
|
-
|
|
40
|
-
`);return{originalMessage:P,shortMessage:k,message:i}},
|
|
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(
|
|
43
|
-
`){let J=
|
|
35
|
+
${_}`;return _};var J2=(_,$,q)=>{q.cwd=e8(q.cwd);let[Z,Q,X]=n8(_,$,q),{command:J,args:Y,options:K}=Z_.default._parse(Z,Q,X),H=g5(K),V=WJ(H);if(p8(V),s8(V),o8(V),V8(V),d8(V),V.shell=G6(V.shell),V.env=FJ(V),V.killSignal=J8(V.killSignal),V.forceKillAfterDelay=H8(V.forceKillAfterDelay),V.lines=V.lines.map((G,U)=>G&&!S.has(V.encoding)&&V.buffer[U]),q_.platform==="win32"&&UJ.basename(J,".exe")==="cmd")Y.unshift("/q");return{file:J,commandArguments:Y,options:V}},WJ=({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:W=U!==void 0||G,serialization:F="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:W,serialization:F}),FJ=({env:_,extendEnv:$,preferLocal:q,node:Z,localDirectory:Q,nodePath:X})=>{let J=$?{...q_.env,..._}:_;if(q||Z)return r4({env:J,cwd:Q,execPath:X,preferLocal:q,addExecPath:Z});return J};var Y2=(_,$,q)=>q.shell&&$.length>0?[[_,...$].join(" "),[],q]:[_,$,q];import{inspect as oJ}from"node:util";function d0(_){if(typeof _==="string")return zJ(_);if(!(ArrayBuffer.isView(_)&&_.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return LJ(_)}var zJ=(_)=>_.at(-1)===Q_?_.slice(0,_.at(-2)===X_?-2:-1):_,LJ=(_)=>_.at(-1)===RJ?_.subarray(0,_.at(-2)===DJ?-2:-1):_,Q_=`
|
|
36
|
+
`,RJ=Q_.codePointAt(0),X_="\r",DJ=X_.codePointAt(0);import{on as lJ}from"node:events";import{finished as aJ}from"node:stream/promises";function a(_,{checkOpen:$=!0}={}){return _!==null&&typeof _==="object"&&(_.writable||_.readable||!$||_.writable===void 0&&_.readable===void 0)&&typeof _.pipe==="function"}function m6(_,{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 d6(_,$){return m6(_,$)&&P0(_,$)}var jJ=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class J_{#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 c6=Symbol();function Y_(){return this[c6].next()}Object.defineProperty(Y_,"name",{value:"next"});function K_(_){return this[c6].return(_)}Object.defineProperty(K_,"name",{value:"return"});var AJ=Object.create(jJ,{next:{enumerable:!0,configurable:!0,writable:!0,value:Y_},return:{enumerable:!0,configurable:!0,writable:!0,value:K_}});function p6({preventCancel:_=!1}={}){let $=this.getReader(),q=new J_($,_),Z=Object.create(AJ);return Z[c6]=q,Z}var H_=(_)=>{if(P0(_,{checkOpen:!1})&&J1.on!==void 0)return PJ(_);if(typeof _?.[Symbol.asyncIterator]==="function")return _;if(MJ.call(_)==="[object ReadableStream]")return p6.call(_);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:MJ}=Object.prototype,PJ=async function*(_){let $=new AbortController,q={};wJ(_,$,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()}},wJ=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=H_(_),V=$();V.length=0;try{for await(let G of H){let U=TJ(G),W=q[U](G,V);G_({convertedChunk:W,state:V,getSize:Z,truncateChunk:Q,addChunk:X,maxBuffer:K})}return CJ({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}},CJ=({state:_,getSize:$,truncateChunk:q,addChunk:Z,getFinalChunk:Q,maxBuffer:X})=>{let J=Q(_);if(J!==void 0)G_({convertedChunk:J,state:_,getSize:$,truncateChunk:q,addChunk:Z,maxBuffer:X})},G_=({convertedChunk:_,state:$,getSize:q,truncateChunk:Z,addChunk:Q,maxBuffer:X})=>{let J=q(_),Y=$.length+J;if(Y<=X){B_(_,$,Q,Y);return}let K=Z(_,X-$.length);if(K!==void 0)B_(K,$,Q,X);throw new Z0},B_=(_,$,q,Z)=>{$.contents=q(_,$,Z),$.length=Z},TJ=(_)=>{let $=typeof _;if($==="string")return"string";if($!=="object"||_===null)return"others";if(globalThis.Buffer?.isBuffer(_))return"buffer";let q=V_.call(_);if(q==="[object ArrayBuffer]")return"arrayBuffer";if(q==="[object DataView]")return"dataView";if(Number.isInteger(_.byteLength)&&Number.isInteger(_.byteOffset)&&V_.call(_.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},{toString:V_}=Object.prototype;class Z0 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}var Q0=(_)=>_,Y1=()=>{return},K2=({contents:_})=>_,H2=(_)=>{throw new Error(`Streams in object mode are not supported: ${String(_)}`)},B2=(_)=>_.length;async function V2(_,$){return c0(_,EJ,$)}var kJ=()=>({contents:[]}),IJ=()=>1,OJ=(_,{contents:$})=>{return $.push(_),$},EJ={init:kJ,convertChunk:{string:Q0,buffer:Q0,arrayBuffer:Q0,dataView:Q0,typedArray:Q0,others:Q0},getSize:IJ,truncateChunk:Y1,addChunk:OJ,getFinalChunk:Y1,finalize:K2};async function G2(_,$){return c0(_,gJ,$)}var NJ=()=>({contents:new ArrayBuffer(0)}),xJ=(_)=>yJ.encode(_),yJ=new TextEncoder,U_=(_)=>new Uint8Array(_),W_=(_)=>new Uint8Array(_.buffer,_.byteOffset,_.byteLength),vJ=(_,$)=>_.slice(0,$),hJ=(_,{contents:$,length:q},Z)=>{let Q=L_()?bJ($,Z):SJ($,Z);return new Uint8Array(Q).set(_,q),Q},SJ=(_,$)=>{if($<=_.byteLength)return _;let q=new ArrayBuffer(z_($));return new Uint8Array(q).set(new Uint8Array(_),0),q},bJ=(_,$)=>{if($<=_.maxByteLength)return _.resize($),_;let q=new ArrayBuffer($,{maxByteLength:z_($)});return new Uint8Array(q).set(new Uint8Array(_),0),q},z_=(_)=>F_**Math.ceil(Math.log(_)/Math.log(F_)),F_=2,fJ=({contents:_,length:$})=>L_()?_:_.slice(0,$),L_=()=>("resize"in ArrayBuffer.prototype),gJ={init:NJ,convertChunk:{string:xJ,buffer:U_,arrayBuffer:U_,dataView:W_,typedArray:W_,others:H2},getSize:B2,truncateChunk:vJ,addChunk:hJ,getFinalChunk:Y1,finalize:fJ};async function W2(_,$){return c0(_,pJ,$)}var uJ=()=>({contents:"",textDecoder:new TextDecoder}),U2=(_,{textDecoder:$})=>$.decode(_,{stream:!0}),mJ=(_,{contents:$})=>$+_,dJ=(_,$)=>_.slice(0,$),cJ=({textDecoder:_})=>{let $=_.decode();return $===""?void 0:$},pJ={init:uJ,convertChunk:{string:Q0,buffer:U2,arrayBuffer:U2,dataView:U2,typedArray:U2,others:H2},getSize:B2,truncateChunk:dJ,addChunk:mJ,getFinalChunk:cJ,finalize:K2};Object.assign(J1,{on:lJ,finished:aJ});var R_=({error:_,stream:$,readableObjectMode:q,lines:Z,encoding:Q,fdNumber:X})=>{if(!(_ instanceof Z0))throw _;if(X==="all")return _;let J=iJ(q,Z,Q);throw _.maxBufferInfo={fdNumber:X,unit:J},$.destroy(),_},iJ=(_,$,q)=>{if(_)return"objects";if($)return"lines";if(q==="buffer")return"bytes";return"characters"},D_=(_,$,q)=>{if($.length!==q)return;let Z=new Z0;throw Z.maxBufferInfo={fdNumber:"ipc"},Z},j_=(_,$)=>{let{streamName:q,threshold:Z,unit:Q}=nJ(_,$);return`Command's ${q} was larger than ${Z} ${Q}`},nJ=(_,$)=>{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:O1(q),threshold:Q,unit:Z}},A_=(_,$,q)=>_?.code==="ENOBUFS"&&$!==null&&$.some((Z)=>Z!==null&&Z.length>F2(q)),M_=(_,$,q)=>{if(!$)return _;let Z=F2(q);return _.length>Z?_.slice(0,Z):_},F2=([,_])=>_;var w_=({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:W,killSignal:F,maxBuffer:L,timeout:A,cwd:z})=>{let D=Z?.code,j=rJ({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:W,killSignal:F}),P=sJ(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)=>eJ(H0)).join(`
|
|
38
|
+
`)].map((H0)=>q1(d0(_9(H0)))).filter(Boolean).join(`
|
|
39
|
+
|
|
40
|
+
`);return{originalMessage:P,shortMessage:k,message:i}},rJ=({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:W})=>{let F=tJ(G,U);if($)return`Command timed out after ${q} milliseconds${F}`;if(V){if(J===void 0)return`Command was gracefully canceled with exit code ${K}`;return G?`Command was gracefully canceled${F}`:`Command was gracefully canceled with ${J} (${Y})`}if(H)return`Command was canceled${F}`;if(Z)return`${j_(_,Q)}${F}`;if(X!==void 0)return`Command failed with ${X}${F}`;if(G)return`Command was killed with ${W} (${l1(W)})${F}`;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"},tJ=(_,$)=>_?` and was forcefully terminated after ${$} milliseconds`:"",sJ=(_,$)=>{if(_ instanceof o)return;let q=e4(_)?_.originalMessage:String(_?.message??_),Z=q1($_(q,$));return Z===""?void 0:Z},eJ=(_)=>typeof _==="string"?_:oJ(_),_9=(_)=>Array.isArray(_)?_.map(($)=>d0(P_($))).filter(Boolean).join(`
|
|
41
|
+
`):P_(_),P_=(_)=>{if(typeof _==="string")return _;if(O(_))return k1(_);return""};var z2=({command:_,escapedCommand:$,stdio:q,all:Z,ipcOutput:Q,options:{cwd:X},startTime:J})=>C_({command:_,escapedCommand:$,cwd:X,durationMs:D6(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:W,options:{timeoutDuration:F,timeout:L=F,forceKillAfterDelay:A,killSignal:z,cwd:D,maxBuffer:j},isSync:P})=>{let{exitCode:R,signal:k,signalDescription:y}=q9(H,V),{originalMessage:i,shortMessage:H0,message:_6}=w_({stdio:G,all:U,ipcOutput:W,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=t4(_,_6,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:W,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:W,ipcOutput:F,cwd:L,originalMessage:A,shortMessage:z})=>C_({shortMessage:z,originalMessage:A,command:$,escapedCommand:q,cwd:L,durationMs:D6(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:W,stdio:U,ipcOutput:F,pipedFrom:[]}),C_=(_)=>Object.fromEntries(Object.entries(_).filter(([,$])=>$!==void 0)),q9=(_,$)=>{let q=_===null?void 0:_,Z=$===null?void 0:$,Q=Z===void 0?void 0:l1($);return{exitCode:q,signal:Z,signalDescription:Q}};var T_=(_)=>Number.isFinite(_)?_:0;function Z9(_){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(T_(_*1000)%1000),nanoseconds:Math.trunc(T_(_*1e6)%1000)}}function Q9(_){return{days:_/86400000n,hours:_/3600000n%24n,minutes:_/60000n%60n,seconds:_/1000n%60n,milliseconds:_%1000n,microseconds:0n,nanoseconds:0n}}function l6(_){switch(typeof _){case"number":{if(Number.isFinite(_))return Z9(_);break}case"bigint":return Q9(_)}throw new TypeError("Expected a finite number or bigint")}var X9=(_)=>_===0||_===0n,J9=(_,$)=>$===1||$===1n?_:`${_}s`,Y9=0.0000001,K9=24n*60n*60n*1000n;function a6(_,$){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+Y9);return(Math.round(U)/10**G).toFixed(G)},J=(V,G,U,W)=>{if((Q.length===0||!$.colonNotation)&&X9(V)&&!($.colonNotation&&U==="m"))return;if(W??=String(V),$.colonNotation){let F=W.includes(".")?W.split(".")[0].length:W.length,L=Q.length>0?2:1;W="0".repeat(Math.max(0,L-F))+W}else W+=$.verbose?" "+J9(G,V):U;Q.push(W)},Y=l6(_),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),W=Number(Y.nanoseconds);if(J(V,"second","s"),$.formatSubMilliseconds)J(G,"millisecond","ms"),J(U,"microsecond","µs"),J(W,"nanosecond","ns");else{let F=G+U/1000+W/1e6,L=typeof $.millisecondsDecimalDigits==="number"?$.millisecondsDecimalDigits:0,A=F>=1?Math.round(F):Math.ceil(F),z=L?F.toFixed(L):A;J(Number.parseFloat(z),"millisecond","ms",z)}}else{let V=(q?Number(_%K9):_)/1000%60,G=typeof $.secondsDecimalDigits==="number"?$.secondsDecimalDigits:1,U=X(V,G),W=$.keepDecimalsOnWholeSeconds?U:U.replace(/\.0+$/,"");J(Number.parseFloat(W),"second","s",W)}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)n({type:"error",verboseMessage:_.shortMessage,verboseInfo:$,result:_})};var I_=(_,$)=>{if(!h0($))return;k_(_,$),H9(_,$)},H9=(_,$)=>{let q=`(done in ${a6(_.durationMs)})`;n({type:"duration",verboseMessage:q,verboseInfo:$,result:_})};var l0=(_,$,{reject:q})=>{if(I_(_,$),_.failed&&q)throw _;return _};import{readFileSync as $7}from"node:fs";var N_=(_,$)=>{if(w0(_))return"asyncGenerator";if(v_(_))return"generator";if(L2(_))return"fileUrl";if(W9(_))return"filePath";if(L9(_))return"webStream";if(a(_,{checkOpen:!1}))return"native";if(O(_))return"uint8Array";if(R9(_))return"asyncIterable";if(D9(_))return"iterable";if(o6(_))return x_({transform:_},$);if(U9(_))return B9(_,$);return"native"},B9=(_,$)=>{if(d6(_.transform,{checkOpen:!1}))return V9(_,$);if(o6(_.transform))return x_(_,$);return G9(_,$)},V9=(_,$)=>{return y_(_,$,"Duplex stream"),"duplex"},x_=(_,$)=>{return y_(_,$,"web TransformStream"),"webTransform"},y_=({final:_,binary:$,objectMode:q},Z,Q)=>{O_(_,`${Z}.final`,Q),O_($,`${Z}.binary`,Q),i6(q,`${Z}.objectMode`)},O_=(_,$,q)=>{if(_!==void 0)throw new TypeError(`The \`${$}\` option can only be defined when using a generator, not a ${q}.`)},G9=({transform:_,final:$,binary:q,objectMode:Z},Q)=>{if(_!==void 0&&!E_(_))throw new TypeError(`The \`${Q}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(d6($,{checkOpen:!1}))throw new TypeError(`The \`${Q}.final\` option must not be a Duplex stream.`);if(o6($))throw new TypeError(`The \`${Q}.final\` option must not be a web TransformStream.`);if($!==void 0&&!E_($))throw new TypeError(`The \`${Q}.final\` option must be a generator.`);return i6(q,`${Q}.binary`),i6(Z,`${Q}.objectMode`),w0(_)||w0($)?"asyncGenerator":"generator"},i6=(_,$)=>{if(_!==void 0&&typeof _!=="boolean")throw new TypeError(`The \`${$}\` option must use a boolean.`)},E_=(_)=>w0(_)||v_(_),w0=(_)=>Object.prototype.toString.call(_)==="[object AsyncGeneratorFunction]",v_=(_)=>Object.prototype.toString.call(_)==="[object GeneratorFunction]",U9=(_)=>I(_)&&(_.transform!==void 0||_.final!==void 0),L2=(_)=>Object.prototype.toString.call(_)==="[object URL]",h_=(_)=>L2(_)&&_.protocol!=="file:",W9=(_)=>I(_)&&Object.keys(_).length>0&&Object.keys(_).every(($)=>F9.has($))&&n6(_.file),F9=new Set(["file","append"]),n6=(_)=>typeof _==="string",S_=(_,$)=>_==="native"&&typeof $==="string"&&!z9.has($),z9=new Set(["ipc","ignore","inherit","overlapped","pipe"]),b_=(_)=>Object.prototype.toString.call(_)==="[object ReadableStream]",R2=(_)=>Object.prototype.toString.call(_)==="[object WritableStream]",L9=(_)=>b_(_)||R2(_),o6=(_)=>b_(_?.readable)&&R2(_?.writable),R9=(_)=>f_(_)&&typeof _[Symbol.asyncIterator]==="function",D9=(_)=>f_(_)&&typeof _[Symbol.iterator]==="function",f_=(_)=>typeof _==="object"&&_!==null,u=new Set(["generator","asyncGenerator","duplex","webTransform"]),D2=new Set(["fileUrl","filePath","fileNumber"]),r6=new Set(["fileUrl","filePath"]),g_=new Set([...r6,"webStream","nodeStream"]),u_=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 t6=(_,$,q,Z)=>Z==="output"?j9(_,$,q):A9(_,$,q),j9=(_,$,q)=>{let Z=$!==0&&q[$-1].value.readableObjectMode;return{writableObjectMode:Z,readableObjectMode:_??Z}},A9=(_,$,q)=>{let Z=$===0?_===!0:q[$-1].value.readableObjectMode,Q=$!==q.length-1&&(_??Z);return{writableObjectMode:Z,readableObjectMode:Q}},m_=(_,$)=>{let q=_.findLast(({type:Z})=>u.has(Z));if(q===void 0)return!1;return $==="input"?q.value.writableObjectMode:q.value.readableObjectMode};var d_=(_,$,q,Z)=>[..._.filter(({type:Q})=>!u.has(Q)),...M9(_,$,q,Z)],M9=(_,$,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]=P9({stdioItem:Y,index:Number(J),newTransforms:X,optionName:$,direction:q,encoding:Z});return k9(X,q)},P9=({stdioItem:_,stdioItem:{type:$},index:q,newTransforms:Z,optionName:Q,direction:X,encoding:J})=>{if($==="duplex")return w9({stdioItem:_,optionName:Q});if($==="webTransform")return C9({stdioItem:_,index:q,newTransforms:Z,direction:X});return T9({stdioItem:_,index:q,newTransforms:Z,direction:X,encoding:J})},w9=({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}}},C9=({stdioItem:_,stdioItem:{value:$},index:q,newTransforms:Z,direction:Q})=>{let{transform:X,objectMode:J}=I($)?$:{transform:$},{writableObjectMode:Y,readableObjectMode:K}=t6(J,q,Z,Q);return{..._,value:{transform:X,writableObjectMode:Y,readableObjectMode:K}}},T9=({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:W}=t6(V,q,Z,Q);return{..._,value:{transform:J,final:Y,binary:G,preserveNewlines:H,writableObjectMode:U,readableObjectMode:W}}},k9=(_,$)=>$==="input"?_.reverse():_;import s6 from"node:process";var c_=(_,$,q)=>{let Z=_.map((Q)=>I9(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)??N9},I9=({type:_,value:$},q)=>O9[q]??p_[_]($),O9=["input","output","output"],a0=()=>{return},e6=()=>"input",p_={generator:a0,asyncGenerator:a0,fileUrl:a0,filePath:a0,iterable:e6,asyncIterable:e6,uint8Array:e6,webStream:(_)=>R2(_)?"output":"input",nodeStream(_){if(!P0(_,{checkOpen:!1}))return"output";return m6(_,{checkOpen:!1})?void 0:"input"},webTransform:a0,duplex:a0,native(_){let $=E9(_);if($!==void 0)return $;if(a(_,{checkOpen:!1}))return p_.nodeStream(_)}},E9=(_)=>{if([0,s6.stdin].includes(_))return"input";if([1,2,s6.stdout,s6.stderr].includes(_))return"output"},N9="output";var l_=(_,$)=>$&&!_.includes("ipc")?[..._,"ipc"]:_;var a_=({stdio:_,ipc:$,buffer:q,...Z},Q,X)=>{let J=x9(_,Z).map((Y,K)=>i_(Y,K));return X?v9(J,q,Q):l_(J,$)},x9=(_,$)=>{if(_===void 0)return g.map((Z)=>$[Z]);if(y9($))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])},y9=(_)=>g.some(($)=>_[$]!==void 0),i_=(_,$)=>{if(Array.isArray(_))return _.map((q)=>i_(q,$));if(_===null||_===void 0)return $>=g.length?"ignore":"pipe";return _},v9=(_,$,q)=>_.map((Z,Q)=>!$[Q]&&Q!==0&&!S0(q,Q)&&h9(Z)?"ignore":Z),h9=(_)=>_==="pipe"||Array.isArray(_)&&_.every(($)=>$==="pipe");import{readFileSync as S9}from"node:fs";import b9 from"node:tty";var o_=({stdioItem:_,stdioItem:{type:$},isStdioArray:q,fdNumber:Z,direction:Q,isSync:X})=>{if(!q||$!=="native")return _;return X?f9({stdioItem:_,fdNumber:Z,direction:Q}):m9({stdioItem:_,fdNumber:Z})},f9=({stdioItem:_,stdioItem:{value:$,optionName:q},fdNumber:Z,direction:Q})=>{let X=g9({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 _},g9=({value:_,optionName:$,fdNumber:q,direction:Z})=>{let Q=u9(_,q);if(Q===void 0)return;if(Z==="output")return{type:"fileNumber",value:Q,optionName:$};if(b9.isatty(Q))throw new TypeError(`The \`${$}: ${n1(_)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:$0(S9(Q)),optionName:$}},u9=(_,$)=>{if(_==="inherit")return $;if(typeof _==="number")return _;let q=I1.indexOf(_);if(q!==-1)return q},m9=({stdioItem:_,stdioItem:{value:$,optionName:q},fdNumber:Z})=>{if($==="inherit")return{type:"nodeStream",value:n_(Z,$,q),optionName:q};if(typeof $==="number")return{type:"nodeStream",value:n_($,$,q),optionName:q};if(a($,{checkOpen:!1}))return{type:"nodeStream",value:$,optionName:q};return _},n_=(_,$,q)=>{let Z=I1[_];if(Z===void 0)throw new TypeError(`The \`${q}: ${$}\` option is invalid: no such standard stream.`);return Z};var r_=({input:_,inputFile:$},q)=>q===0?[...d9(_),...p9($)]:[],d9=(_)=>_===void 0?[]:[{type:c9(_),value:_,optionName:"input"}],c9=(_)=>{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.")},p9=(_)=>_===void 0?[]:[{...l9(_),optionName:"inputFile"}],l9=(_)=>{if(L2(_))return{type:"fileUrl",value:_};if(n6(_))return{type:"filePath",value:{file:_}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};var t_=(_)=>_.filter(($,q)=>_.every((Z,Q)=>$.value!==Z.value||q>=Q||$.type==="generator"||$.type==="asyncGenerator")),s_=({stdioItem:{type:_,value:$,optionName:q},direction:Z,fileDescriptors:Q,isSync:X})=>{let J=a9(Q,_);if(J.length===0)return;if(X){i9({otherStdioItems:J,type:_,value:$,optionName:q,direction:Z});return}if(g_.has(_))return e_({otherStdioItems:J,type:_,value:$,optionName:q,direction:Z});if(u_.has(_))o9({otherStdioItems:J,type:_,value:$,optionName:q})},a9=(_,$)=>_.flatMap(({direction:q,stdioItems:Z})=>Z.filter((Q)=>Q.type===$).map((Q)=>({...Q,direction:q}))),i9=({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})=>{if(r6.has($))e_({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})},e_=({otherStdioItems:_,type:$,value:q,optionName:Z,direction:Q})=>{let X=_.filter((Y)=>n9(Y,q));if(X.length===0)return;let J=X.find((Y)=>Y.direction!==Q);return _7(J,Z,$),Q==="output"?X[0].stream:void 0},n9=({type:_,value:$},q)=>{if(_==="filePath")return $.file===q.file;if(_==="fileUrl")return $.href===q.href;return $===q},o9=({otherStdioItems:_,type:$,value:q,optionName:Z})=>{let Q=_.find(({value:{transform:X}})=>X===q.transform);_7(Q,Z,$)},_7=(_,$,q)=>{if(_!==void 0)throw new TypeError(`The \`${_.optionName}\` and \`${$}\` options must not target ${G0[q]} that is the same.`)};var j2=(_,$,q,Z)=>{let X=a_($,q,Z).map((Y,K)=>r9({stdioOption:Y,fdNumber:K,options:$,isSync:Z})),J=QY({initialFileDescriptors:X,addProperties:_,options:$,isSync:Z});return $.stdio=J.map(({stdioItems:Y})=>YY(Y)),J},r9=({stdioOption:_,fdNumber:$,options:q,isSync:Z})=>{let Q=O1($),{stdioItems:X,isStdioArray:J}=t9({stdioOption:_,fdNumber:$,options:q,optionName:Q}),Y=c_(X,$,Q),K=X.map((G)=>o_({stdioItem:G,isStdioArray:J,fdNumber:$,direction:Y,isSync:Z})),H=d_(K,Q,Y,q),V=m_(H,Y);return ZY(H,V),{direction:Y,objectMode:V,stdioItems:H}},t9=({stdioOption:_,fdNumber:$,options:q,optionName:Z})=>{let X=[...(Array.isArray(_)?_:[_]).map((K)=>s9(K,Z)),...r_(q,$)],J=t_(X),Y=J.length>1;return e9(J,Y,Z),$Y(J),{stdioItems:J,isStdioArray:Y}},s9=(_,$)=>({type:N_(_,$),value:_,optionName:$}),e9=(_,$,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(_Y.has(Z))throw new Error(`The \`${Q}\` option must not include \`${Z}\`.`)},_Y=new Set(["ignore","ipc"]),$Y=(_)=>{for(let $ of _)qY($)},qY=({type:_,value:$,optionName:q})=>{if(h_($))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(S_(_,$))throw new TypeError(`The \`${q}: { file: '...' }\` option must be used instead of \`${q}: '...'\`.`)},ZY=(_,$)=>{if(!$)return;let q=_.find(({type:Z})=>D2.has(Z));if(q!==void 0)throw new TypeError(`The \`${q.optionName}\` option cannot use both files and transforms in objectMode.`)},QY=({initialFileDescriptors:_,addProperties:$,options:q,isSync:Z})=>{let Q=[];try{for(let X of _)Q.push(XY({fileDescriptor:X,fileDescriptors:Q,addProperties:$,options:q,isSync:Z}));return Q}catch(X){throw _3(Q),X}},XY=({fileDescriptor:{direction:_,objectMode:$,stdioItems:q},fileDescriptors:Z,addProperties:Q,options:X,isSync:J})=>{let Y=q.map((K)=>JY({stdioItem:K,addProperties:Q,direction:_,options:X,fileDescriptors:Z,isSync:J}));return{direction:_,objectMode:$,stdioItems:Y}},JY=({stdioItem:_,addProperties:$,direction:q,options:Z,fileDescriptors:Q,isSync:X})=>{let J=s_({stdioItem:_,direction:q,fileDescriptors:Q,isSync:X});if(J!==void 0)return{..._,stream:J};return{..._,...$[q][_.type](_,Z)}},_3=(_)=>{for(let{stdioItems:$}of _)for(let{stream:q}of $)if(q!==void 0&&!p(q))q.destroy()},YY=(_)=>{if(_.length>1)return _.some(({value:Z})=>Z==="overlapped")?"overlapped":"pipe";let[{type:$,value:q}]=_;return $==="native"?q:"pipe"};var Z7=(_,$)=>j2(HY,_,$,!0),s=({type:_,optionName:$})=>{Q7($,G0[_])},KY=({optionName:_,value:$})=>{if($==="ipc"||$==="overlapped")Q7(_,`"${$}"`);return{}},Q7=(_,$)=>{throw new TypeError(`The \`${_}\` option cannot be ${$} with synchronous methods.`)},q7={generator(){},asyncGenerator:s,webStream:s,nodeStream:s,webTransform:s,duplex:s,asyncIterable:s,native:KY},HY={input:{...q7,fileUrl:({value:_})=>({contents:[$0($7(_))]}),filePath:({value:{file:_}})=>({contents:[$0($7(_))]}),fileNumber:s,iterable:({value:_})=>({contents:[..._]}),string:({value:_})=>({contents:[_]}),uint8Array:({value:_})=>({contents:[_]})},output:{...q7,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 EY,getDefaultHighWaterMark as F7}from"node:stream";var A2=(_,$,q,Z)=>_||q?void 0:J7($,Z),Z3=(_,$,q)=>q?_.flatMap((Z)=>X7(Z,$)):X7(_,$),X7=(_,$)=>{let{transform:q,final:Z}=J7($,{});return[...q(_),...Z()]},J7=(_,$)=>{return $.previousChunks="",{transform:BY.bind(void 0,$,_),final:GY.bind(void 0,$)}},BY=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=VY(q,X,$,_),Y=q.slice(Q+1,X+1-J);if(Z.length>0)Y=q3(Z,Y),Z="";yield Y,Q=X}if(Q!==q.length-1)Z=q3(Z,q.slice(Q+1));_.previousChunks=Z},VY=(_,$,q,Z)=>{if(q)return 0;return Z.isWindowsNewline=$!==0&&_[$-1]==="\r",Z.isWindowsNewline?2:1},GY=function*({previousChunks:_}){if(_.length>0)yield _},Y7=({binary:_,preserveNewlines:$,readableObjectMode:q,state:Z})=>_||$||q?void 0:{transform:UY.bind(void 0,Z)},UY=function*({isWindowsNewline:_=!1},$){let{unixNewline:q,windowsNewline:Z,LF:Q,concatBytes:X}=typeof $==="string"?WY:zY;if($.at(-1)===Q){yield $;return}yield X($,_?Z:q)},q3=(_,$)=>`${_}${$}`,WY={windowsNewline:`\r
|
|
44
44
|
`,unixNewline:`
|
|
45
45
|
`,LF:`
|
|
46
|
-
`,concatBytes
|
|
46
|
+
`,concatBytes:q3},FY=(_,$)=>{let q=new Uint8Array(_.length+$.length);return q.set(_,0),q.set($,_.length),q},zY={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:FY};import{Buffer as LY}from"node:buffer";var K7=(_,$)=>_?void 0:RY.bind(void 0,$),RY=function*(_,$){if(typeof $!=="string"&&!O($)&&!LY.isBuffer($))throw new TypeError(`The \`${_}\` option's transform must use "objectMode: true" to receive as input: ${typeof $}.`);yield $},H7=(_,$)=>_?DY.bind(void 0,$):jY.bind(void 0,$),DY=function*(_,$){B7(_,$),yield $},jY=function*(_,$){if(B7(_,$),typeof $!=="string"&&!O($))throw new TypeError(`The \`${_}\` option's function must yield a string or an Uint8Array, not ${typeof $}.`);yield $},B7=(_,$)=>{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 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=`
|
|
48
|
+
if (condition) { yield value; }`)};import{Buffer as AY}from"node:buffer";import{StringDecoder as MY}from"node:string_decoder";var M2=(_,$,q)=>{if(q)return;if(_)return{transform:PY.bind(void 0,new TextEncoder)};let Z=new MY($);return{transform:wY.bind(void 0,Z),final:CY.bind(void 0,Z)}},PY=function*(_,$){if(AY.isBuffer($))yield $0($);else if(typeof $==="string")yield _.encode($);else yield $},wY=function*(_,$){yield O($)?_.write($):$},CY=function*(_){let $=_.end();if($!=="")yield $};import{callbackify as V7}from"node:util";var Q3=V7(async(_,$,q,Z)=>{$.currentIterable=_(...q);try{for await(let Q of $.currentIterable)Z.push(Q)}finally{delete $.currentIterable}}),P2=async function*(_,$,q){if(q===$.length){yield _;return}let{transform:Z=kY}=$[q];for await(let Q of Z(_))yield*P2(Q,$,q+1)},G7=async function*(_){for(let[$,{final:q}]of Object.entries(_))yield*TY(q,Number($),_)},TY=async function*(_,$,q){if(_===void 0)return;for await(let Z of _())yield*P2(Z,q,$+1)},U7=V7(async({currentIterable:_},$)=>{if(_!==void 0){await($?_.throw($):_.return());return}if($)throw $}),kY=function*(_){yield _};var X3=(_,$,q,Z)=>{try{for(let Q of _(...$))q.push(Q);Z()}catch(Q){Z(Q)}},W7=(_,$)=>[...$.flatMap((q)=>[...C0(q,_,0)]),...H1(_)],C0=function*(_,$,q){if(q===$.length){yield _;return}let{transform:Z=OY}=$[q];for(let Q of Z(_))yield*C0(Q,$,q+1)},H1=function*(_){for(let[$,{final:q}]of Object.entries(_))yield*IY(q,Number($),_)},IY=function*(_,$,q){if(_===void 0)return;for(let Z of _())yield*C0(Z,q,$+1)},OY=function*(_){yield _};var J3=({value:_,value:{transform:$,final:q,writableObjectMode:Z,readableObjectMode:Q},optionName:X},{encoding:J})=>{let Y={},K=z7(_,J,X),H=w0($),V=w0(q),G=H?Q3.bind(void 0,P2,Y):X3.bind(void 0,C0),U=H||V?Q3.bind(void 0,G7,Y):X3.bind(void 0,H1),W=H||V?U7.bind(void 0,Y):void 0;return{stream:new EY({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:W})}},w2=(_,$,q,Z)=>{let Q=$.filter(({type:J})=>J==="generator"),X=Z?Q.reverse():Q;for(let{value:J,optionName:Y}of X){let K=z7(J,q,Y);_=W7(K,_)}return _},z7=({transform:_,final:$,binary:q,writableObjectMode:Z,readableObjectMode:Q,preserveNewlines:X},J,Y)=>{let K={};return[{transform:K7(Z,Y)},M2(q,J,Z),A2(q,X,Z,K),{transform:_,final:$},{transform:H7(Q,Y)},Y7({binary:q,preserveNewlines:X,readableObjectMode:Q,state:K})].filter(Boolean)};var L7=(_,$)=>{for(let q of NY(_))xY(_,q,$)},NY=(_)=>new Set(Object.entries(_).filter(([,{direction:$}])=>$==="input").map(([$])=>Number($))),xY=(_,$,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)=>yY(Y,Z));q.input=$1(J)},yY=(_,$)=>{let q=w2(_,$,"utf8",!0);return vY(q),$1(q)},vY=(_)=>{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 fY,appendFileSync as gY}from"node:fs";var C2=({stdioItems:_,encoding:$,verboseInfo:q,fdNumber:Z})=>Z!=="all"&&S0(q,Z)&&!S.has($)&&hY(Z)&&(_.some(({type:Q,value:X})=>Q==="native"&&SY.has(X))||_.every(({type:Q})=>u.has(Q))),hY=(_)=>_===1||_===2,SY=new Set(["pipe","overlapped"]),R7=async(_,$,q,Z)=>{for await(let Q of _)if(!bY($))j7(Q,q,Z)},D7=(_,$,q)=>{for(let Z of _)j7(Z,$,q)},bY=(_)=>_._readableState.pipes.length>0,j7=(_,$,q)=>{let Z=h1(_);n({type:"output",verboseMessage:Z,fdNumber:$,verboseInfo:q})};var A7=({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)=>uY({result:K,fileDescriptors:_,fdNumber:H,state:X,outputFiles:J,isMaxBuffer:Z,verboseInfo:Q},q)),...X}},uY=({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=M_(_,X,G),W=$0(U),{stdioItems:F,objectMode:L}=$[q],A=mY([W],F,K,Z),{serializedResult:z,finalResult:D=z}=dY({chunks:A,objectMode:L,encoding:K,lines:H,stripFinalNewline:V,fdNumber:q});cY({serializedResult:z,fdNumber:q,state:Z,verboseInfo:J,encoding:K,stdioItems:F,objectMode:L});let j=Y[q]?D:void 0;try{if(Z.error===void 0)pY(z,F,Q);return j}catch(P){return Z.error=P,j}},mY=(_,$,q,Z)=>{try{return w2(_,$,q,!1)}catch(Q){return Z.error=Q,_}},dY=({chunks:_,objectMode:$,encoding:q,lines:Z,stripFinalNewline:Q,fdNumber:X})=>{if($)return{serializedResult:_};if(q==="buffer")return{serializedResult:$1(_)};let J=x5(_,q);if(Z[X])return{serializedResult:J,finalResult:Z3(J,!Q[X],$)};return{serializedResult:J}},cY=({serializedResult:_,fdNumber:$,state:q,verboseInfo:Z,encoding:Q,stdioItems:X,objectMode:J})=>{if(!C2({stdioItems:X,encoding:Q,verboseInfo:Z,fdNumber:$}))return;let Y=Z3(_,!1,J);try{D7(Y,$,Z)}catch(K){q.error??=K}},pY=(_,$,q)=>{for(let{path:Z,append:Q}of $.filter(({type:X})=>D2.has(X))){let X=typeof Z==="string"?Z:Z.toString();if(Q||q.has(X))gY(Z,_);else q.add(X),fY(Z,_)}};var M7=([,_,$],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 U6([_,$]);return`${_}${$}`};import{once as Y3}from"node:events";var P7=async(_,$)=>{let[q,Z]=await lY(_);return $.isForcefullyTerminated??=!1,[q,Z]},lY=async(_)=>{let[$,q]=await Promise.allSettled([Y3(_,"spawn"),Y3(_,"exit")]);if($.status==="rejected")return[];return q.status==="rejected"?w7(_):q.value},w7=async(_)=>{try{return await Y3(_,"exit")}catch{return w7(_)}},C7=async(_)=>{let[$,q]=await _;if(!aY($,q)&&K3($,q))throw new o;return[$,q]},aY=(_,$)=>_===void 0&&$===void 0,K3=(_,$)=>_!==0||$!==null;var T7=({error:_,status:$,signal:q,output:Z},{maxBuffer:Q})=>{let X=iY(_,$,q),J=X?.code==="ETIMEDOUT",Y=A_(X,Z,Q);return{resultError:X,exitCode:$,signal:q,timedOut:J,isMaxBuffer:Y}},iY=(_,$,q)=>{if(_!==void 0)return _;return K3($,q)?new o:void 0};var k7=(_,$,q)=>{let{file:Z,commandArguments:Q,command:X,escapedCommand:J,startTime:Y,verboseInfo:K,options:H,fileDescriptors:V}=oY(_,$,q),G=sY({file:Z,commandArguments:Q,options:H,command:X,escapedCommand:J,verboseInfo:K,fileDescriptors:V,startTime:Y});return l0(G,K,H)},oY=(_,$,q)=>{let{command:Z,escapedCommand:Q,startTime:X,verboseInfo:J}=b1(_,$,q),Y=rY(q),{file:K,commandArguments:H,options:V}=J2(_,$,Y);tY(V);let G=Z7(V,J);return{file:K,commandArguments:H,command:Z,escapedCommand:Q,startTime:X,verboseInfo:J,options:V,fileDescriptors:G}},rY=(_)=>_.node&&!_.ipc?{..._,ipc:!1}:_,tY=({ipc:_,ipcInput:$,detached:q,cancelSignal:Z})=>{if($)T2("ipcInput");if(_)T2("ipc: true");if(q)T2("detached: true");if(Z)T2("cancelSignal")},T2=(_)=>{throw new TypeError(`The "${_}" option cannot be used with synchronous methods.`)},sY=({file:_,commandArguments:$,options:q,command:Z,escapedCommand:Q,verboseInfo:X,fileDescriptors:J,startTime:Y})=>{let K=eY({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:W}=T7(K,q),{output:F,error:L=H}=A7({fileDescriptors:J,syncResult:K,options:q,isMaxBuffer:W,verboseInfo:X}),A=F.map((D,j)=>X0(D,q,j)),z=X0(M7(F,q),q,"all");return $K({error:L,exitCode:V,signal:G,timedOut:U,isMaxBuffer:W,stdio:A,all:z,options:q,command:Z,escapedCommand:Q,startTime:Y})},eY=({file:_,commandArguments:$,options:q,command:Z,escapedCommand:Q,fileDescriptors:X,startTime:J})=>{try{L7(X,q);let Y=_K(q);return nY(...Y2(_,$,Y))}catch(Y){return p0({error:Y,command:Z,escapedCommand:Q,fileDescriptors:X,options:q,startTime:J,isSync:!0})}},_K=({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?z2({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 dH}from"node:events";import{spawn as cH}from"node:child_process";import x7 from"node:process";import{once as H3,on as qK}from"node:events";var I7=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z},{reference:Q=!0,filter:X}={})=>{return g0({methodName:"getOneMessage",isSubprocess:q,ipc:Z,isConnected:_2(_)}),ZK({anyProcess:_,channel:$,isSubprocess:q,filter:X,reference:Q})},ZK=async({anyProcess:_,channel:$,isSubprocess:q,filter:Z,reference:Q})=>{r1($,Q);let X=V0(_,$,q),J=new AbortController;try{return await Promise.race([QK(X,Z,J),XK(X,q,J),JK(X,q,J)])}catch(Y){throw u0(_),Y}finally{J.abort(),t1($,Q)}},QK=async(_,$,{signal:q})=>{if($===void 0){let[Z]=await H3(_,"message",{signal:q});return Z}for await(let[Z]of qK(_,"message",{signal:q}))if($(Z))return Z},XK=async(_,$,{signal:q})=>{await H3(_,"disconnect",{signal:q}),U8($)},JK=async(_,$,{signal:q})=>{let[Z]=await H3(_,"strict:error",{signal:q});throw i1(Z,$)};import{once as E7,on as YK}from"node:events";var N7=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z},{reference:Q=!0}={})=>B3({anyProcess:_,channel:$,isSubprocess:q,ipc:Z,shouldAwait:!q,reference:Q}),B3=({anyProcess:_,channel:$,isSubprocess:q,ipc:Z,shouldAwait:Q,reference:X})=>{g0({methodName:"getEachMessage",isSubprocess:q,ipc:Z,isConnected:_2(_)}),r1($,X);let J=V0(_,$,q),Y=new AbortController,K={};return KK(_,J,Y),HK({ipcEmitter:J,isSubprocess:q,controller:Y,state:K}),BK({anyProcess:_,channel:$,ipcEmitter:J,isSubprocess:q,shouldAwait:Q,controller:Y,state:K,reference:X})},KK=async(_,$,q)=>{try{await E7($,"disconnect",{signal:q.signal}),q.abort()}catch{}},HK=async({ipcEmitter:_,isSubprocess:$,controller:q,state:Z})=>{try{let[Q]=await E7(_,"strict:error",{signal:q.signal});Z.error=i1(Q,$),q.abort()}catch{}},BK=async function*({anyProcess:_,channel:$,ipcEmitter:q,isSubprocess:Z,shouldAwait:Q,controller:X,state:J,reference:Y}){try{for await(let[K]of YK(q,"message",{signal:X.signal}))O7(J),yield K}catch{O7(J)}finally{if(X.abort(),t1($,Y),!Z)u0(_);if(Q)await _}},O7=({error:_})=>{if(_)throw _};var y7=(_,{ipc:$})=>{Object.assign(_,h7(_,!1,$))},v7=()=>{let _=x7,$=!0,q=x7.channel!==void 0;return{...h7(_,!0,q),getCancelSignal:u8.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:!0,ipc:q})}},h7=(_,$,q)=>({sendMessage:Q2.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q}),getOneMessage:I7.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q}),getEachMessage:N7.bind(void 0,{anyProcess:_,channel:_.channel,isSubprocess:$,ipc:q})});import{ChildProcess as VK}from"node:child_process";import{PassThrough as GK,Readable as UK,Writable as WK,Duplex as FK}from"node:stream";var S7=({error:_,command:$,escapedCommand:q,fileDescriptors:Z,options:Q,startTime:X,verboseInfo:J})=>{_3(Z);let Y=new VK;zK(Y,Z),Object.assign(Y,{readable:LK,writable:RK,duplex:DK});let K=p0({error:_,command:$,escapedCommand:q,fileDescriptors:Z,options:Q,startTime:X,isSync:!1}),H=jK(K,J,Q);return{subprocess:Y,promise:H}},zK=(_,$)=>{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 GK;return _.end(),_},LK=()=>new UK({read(){}}),RK=()=>new WK({write(){}}),DK=()=>new FK({read(){},write(){}}),jK=async(_,$,q)=>l0(_,$,q);import{createReadStream as b7,createWriteStream as f7}from"node:fs";import{Buffer as AK}from"node:buffer";import{Readable as V1,Writable as MK,Duplex as PK}from"node:stream";var u7=(_,$)=>j2(wK,_,$,!1),G1=({type:_,optionName:$})=>{throw new TypeError(`The \`${$}\` option cannot be ${G0[_]}.`)},g7={fileNumber:G1,generator:J3,asyncGenerator:J3,nodeStream:({value:_})=>({stream:_}),webTransform({value:{transform:_,writableObjectMode:$,readableObjectMode:q}}){let Z=$||q;return{stream:PK.fromWeb(_,{objectMode:Z})}},duplex:({value:{transform:_}})=>({stream:_}),native(){}},wK={input:{...g7,fileUrl:({value:_})=>({stream:b7(_)}),filePath:({value:{file:_}})=>({stream:b7(_)}),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(AK.from(_))})},output:{...g7,fileUrl:({value:_})=>({stream:f7(_)}),filePath:({value:{file:_,append:$}})=>({stream:f7(_,$?{flags:"a"}:{})}),webStream:({value:_})=>({stream:MK.fromWeb(_)}),iterable:G1,asyncIterable:G1,string:G1,uint8Array:G1}};import{on as CK,once as m7}from"node:events";import{PassThrough as TK,getDefaultHighWaterMark as kK}from"node:stream";import{finished as p7}from"node:stream/promises";function T0(_){if(!Array.isArray(_))throw new TypeError(`Expected an array, got \`${typeof _}\`.`);for(let Q of _)V3(Q);let $=_.some(({readableObjectMode:Q})=>Q),q=IK(_,$),Z=new l7({objectMode:$,writableHighWaterMark:q,readableHighWaterMark:q});for(let Q of _)Z.add(Q);return Z}var IK=(_,$)=>{if(_.length===0)return kK($);let q=_.filter(({readableObjectMode:Z})=>Z===$).map(({readableHighWaterMark:Z})=>Z);return Math.max(...q)};class l7 extends TK{#Z=new Set([]);#$=new Set([]);#_=new Set([]);#q;#Y=Symbol("unpipe");#J=new WeakMap;add(_){if(V3(_),this.#Z.has(_))return;this.#Z.add(_),this.#q??=OK(this,this.#Z,this.#Y);let $=xK({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(V3(_),!this.#Z.has(_))return!1;let $=this.#J.get(_);if($===void 0)return!1;return this.#J.delete(_),_.unpipe(this),await $,!0}}var OK=async(_,$,q)=>{k2(_,d7);let Z=new AbortController;try{await Promise.race([EK(_,Z),NK(_,$,q,Z)])}finally{Z.abort(),k2(_,-d7)}},EK=async(_,{signal:$})=>{try{await p7(_,{signal:$,cleanup:!0})}catch(q){throw a7(_,q),q}},NK=async(_,$,q,{signal:Z})=>{for await(let[Q]of CK(_,"unpipe",{signal:Z}))if($.has(Q))Q.emit(q)},V3=(_)=>{if(typeof _?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof _}\`.`)},xK=async({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,onFinished:X,unpipeEvent:J})=>{k2(_,c7);let Y=new AbortController;try{await Promise.race([yK(X,$,Y),vK({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,controller:Y}),hK({stream:$,streams:q,ended:Z,aborted:Q,unpipeEvent:J,controller:Y})])}finally{Y.abort(),k2(_,-c7)}if(q.size>0&&q.size===Z.size+Q.size)if(Z.size===0&&Q.size>0)G3(_);else SK(_)},yK=async(_,$,{signal:q})=>{try{if(await _,!q.aborted)G3($)}catch(Z){if(!q.aborted)a7($,Z)}},vK=async({passThroughStream:_,stream:$,streams:q,ended:Z,aborted:Q,controller:{signal:X}})=>{try{if(await p7($,{signal:X,cleanup:!0,readable:!0,writable:!1}),q.has($))Z.add($)}catch(J){if(X.aborted||!q.has($))return;if(i7(J))Q.add($);else n7(_,J)}},hK=async({stream:_,streams:$,ended:q,aborted:Z,unpipeEvent:Q,controller:{signal:X}})=>{if(await m7(_,Q,{signal:X}),!_.readable)return m7(X,"abort",{signal:X});$.delete(_),q.delete(_),Z.delete(_)},SK=(_)=>{if(_.writable)_.end()},a7=(_,$)=>{if(i7($))G3(_);else n7(_,$)},i7=(_)=>_?.code==="ERR_STREAM_PREMATURE_CLOSE",G3=(_)=>{if(_.readable||_.writable)_.destroy()},n7=(_,$)=>{if(!_.destroyed)_.once("error",bK),_.destroy($)},bK=()=>{},k2=(_,$)=>{let q=_.getMaxListeners();if(q!==0&&q!==Number.POSITIVE_INFINITY)_.setMaxListeners(q+$)},d7=2,c7=1;import{finished as o7}from"node:stream/promises";var i0=(_,$)=>{_.pipe($),fK(_,$),gK(_,$)},fK=async(_,$)=>{if(p(_)||p($))return;try{await o7(_,{cleanup:!0,readable:!0,writable:!1})}catch{}U3($)},U3=(_)=>{if(_.writable)_.end()},gK=async(_,$)=>{if(p(_)||p($))return;try{await o7($,{cleanup:!0,readable:!1,writable:!0})}catch{}W3(_)},W3=(_)=>{if(_.readable)_.destroy()};var r7=(_,$,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)))uK(_,Y,J,Q);for(let{stream:Y}of X.filter(({type:K})=>!u.has(K)))dK({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)}},uK=(_,$,q,Z)=>{if(q==="output")i0(_.stdio[Z],$);else i0($,_.stdio[Z]);let Q=mK[Z];if(Q!==void 0)_[Q]=$;_.stdio[Z]=$},mK=["stdin","stdout","stderr"],dK=({subprocess:_,stream:$,direction:q,fdNumber:Z,pipeGroups:Q,controller:X})=>{if($===void 0)return;cK($,X);let[J,Y]=q==="output"?[$,_.stdio[Z]]:[_.stdio[Z],$],K=Q.get(J)??[];Q.set(J,[...K,Y])},cK=(_,{signal:$})=>{if(p(_))M0(_,pK,$)},pK=2;import{addAbortListener as iK}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 I2=(_)=>!!_&&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"),z3=globalThis,lK=Object.defineProperty.bind(Object);class t7{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(z3[F3])return z3[F3];lK(z3,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 R3{}var aK=(_)=>{return{onExit($,q){return _.onExit($,q)},load(){return _.load()},unload(){return _.unload()}}};class s7 extends R3{onExit(){return()=>{}}load(){}unload(){}}class e7 extends R3{#Z=L3.platform==="win32"?"SIGINT":"SIGHUP";#$=new t7;#_;#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(!I2(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(!I2(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"&&I2(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 L3=globalThis.process,{onExit:_$,load:Wj,unload:Fj}=aK(I2(L3)?new e7(L3):new s7);var $$=(_,{cleanup:$,detached:q},{signal:Z})=>{if(!$||q)return;let Q=_$(()=>{_.kill()});iK(Z,()=>{Q()})};var Z$=({source:_,sourcePromise:$,boundOptions:q,createNested:Z},...Q)=>{let X=S1(),{destination:J,destinationStream:Y,destinationError:K,from:H,unpipeSignal:V}=nK(q,Z,Q),{sourceStream:G,sourceError:U}=rK(_,H),{options:W,fileDescriptors:F}=t.get(_);return{sourcePromise:$,sourceStream:G,sourceOptions:W,sourceError:U,destination:J,destinationStream:Y,destinationError:K,unpipeSignal:V,fileDescriptors:F,startTime:X}},nK=(_,$,q)=>{try{let{destination:Z,pipeOptions:{from:Q,to:X,unpipeSignal:J}={}}=oK(_,$,...q),Y=o1(Z,X);return{destination:Z,destinationStream:Y,from:Q,unpipeSignal:J}}catch(Z){return{destinationError:Z}}},oK=(_,$,q,...Z)=>{if(Array.isArray(q))return{destination:$(q$,_)(q,...Z),pipeOptions:_};if(typeof q==="string"||q instanceof URL||V6(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]=T1(q,...Z);return{destination:$(q$)(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}`)},q$=({options:_})=>({options:{..._,stdin:"pipe",piped:!0}}),rK=(_,$)=>{try{return{sourceStream:m0(_,$)}}catch(q){return{sourceError:q}}};var X$=({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z,fileDescriptors:Q,sourceOptions:X,startTime:J})=>{let Y=tK({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z});if(Y!==void 0)throw D3({error:Y,fileDescriptors:Q,sourceOptions:X,startTime:J})},tK=({sourceStream:_,sourceError:$,destinationStream:q,destinationError:Z})=>{if($!==void 0&&Z!==void 0)return Z;if(Z!==void 0)return W3(_),Z;if($!==void 0)return U3(q),$},D3=({error:_,fileDescriptors:$,sourceOptions:q,startTime:Z})=>p0({error:_,command:Q$,escapedCommand:Q$,fileDescriptors:$,options:q,startTime:Z,isSync:!1}),Q$="source.pipe(destination)";var J$=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 sK}from"node:stream/promises";var Y$=(_,$,q)=>{let Z=O2.has($)?_H(_,$):eK(_,$);return M0(_,qH,q.signal),M0($,ZH,q.signal),$H($),Z},eK=(_,$)=>{let q=T0([_]);return i0(q,$),O2.set($,q),q},_H=(_,$)=>{let q=O2.get($);return q.add(_),q},$H=async(_)=>{try{await sK(_,{cleanup:!0,readable:!1,writable:!0})}catch{}O2.delete(_)},O2=new WeakMap,qH=2,ZH=1;import{aborted as QH}from"node:util";var K$=(_,$)=>_===void 0?[]:[XH(_,$)],XH=async(_,{sourceStream:$,mergedStream:q,fileDescriptors:Z,sourceOptions:Q,startTime:X})=>{await QH(_,$),await q.remove($);let J=new Error("Pipe canceled by `unpipeSignal` option.");throw D3({error:J,fileDescriptors:Z,sourceOptions:Q,startTime:X})};var E2=(_,...$)=>{if(I($[0]))return E2.bind(void 0,{..._,boundOptions:{..._.boundOptions,...$[0]}});let{destination:q,...Z}=Z$(_,...$),Q=JH({...Z,destination:q});return Q.pipe=E2.bind(void 0,{..._,source:q,sourcePromise:Q,boundOptions:{}}),Q},JH=async({sourcePromise:_,sourceStream:$,sourceOptions:q,sourceError:Z,destination:Q,destinationStream:X,destinationError:J,unpipeSignal:Y,fileDescriptors:K,startTime:H})=>{let V=YH(_,Q);X$({sourceStream:$,sourceError:Z,destinationStream:X,destinationError:J,fileDescriptors:K,sourceOptions:q,startTime:H});let G=new AbortController;try{let U=Y$($,X,G);return await Promise.race([J$(V),...K$(Y,{sourceStream:$,mergedStream:U,sourceOptions:q,fileDescriptors:K,startTime:H})])}finally{G.abort()}},YH=(_,$)=>Promise.allSettled([_,$]);import{setImmediate as WH}from"node:timers/promises";import{on as KH}from"node:events";import{getDefaultHighWaterMark as HH}from"node:stream";var N2=({subprocessStdout:_,subprocess:$,binary:q,shouldEncode:Z,encoding:Q,preserveNewlines:X})=>{let J=new AbortController;return BH($,J),B$({stream:_,controller:J,binary:q,shouldEncode:!_.readableObjectMode&&Z,encoding:Q,shouldSplit:!_.readableObjectMode,preserveNewlines:X})},BH=async(_,$)=>{try{await _}catch{}finally{$.abort()}},j3=({stream:_,onStreamEnd:$,lines:q,encoding:Z,stripFinalNewline:Q,allMixed:X})=>{let J=new AbortController;VH($,J,_);let Y=_.readableObjectMode&&!X;return B$({stream:_,controller:J,binary:Z==="buffer",shouldEncode:!Y,encoding:Z,shouldSplit:!Y&&q,preserveNewlines:!Q})},VH=async(_,$,q)=>{try{await _}catch{q.destroy()}finally{$.abort()}},B$=({stream:_,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J})=>{let Y=KH(_,"data",{signal:$.signal,highWaterMark:H$,highWatermark:H$});return GH({onStdoutChunk:Y,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J})},A3=HH(!0),H$=A3,GH=async function*({onStdoutChunk:_,controller:$,binary:q,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J}){let Y=UH({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)}},UH=({binary:_,shouldEncode:$,encoding:q,shouldSplit:Z,preserveNewlines:Q})=>[M2(_,q,!$),A2(_,Q,!Z,{})].filter(Boolean);var V$=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([zH(_),G]);return}let U=$3(K,q),W=j3({stream:_,onStreamEnd:$,lines:J,encoding:Z,stripFinalNewline:U,allMixed:Y}),[F]=await Promise.all([LH({stream:_,iterable:W,fdNumber:q,encoding:Z,maxBuffer:X,lines:J}),G]);return F},FH=async({stream:_,onStreamEnd:$,fdNumber:q,encoding:Z,allMixed:Q,verboseInfo:X,streamInfo:{fileDescriptors:J}})=>{if(!C2({stdioItems:J[q]?.stdioItems,encoding:Z,verboseInfo:X,fdNumber:q}))return;let Y=j3({stream:_,onStreamEnd:$,lines:!0,encoding:Z,stripFinalNewline:!0,allMixed:Q});await R7(Y,_,q,X)},zH=async(_)=>{if(await WH(),_.readableFlowing===null)_.resume()},LH=async({stream:_,stream:{readableObjectMode:$},iterable:q,fdNumber:Z,encoding:Q,maxBuffer:X,lines:J})=>{try{if($||J)return await V2(q,{maxBuffer:X});if(Q==="buffer")return new Uint8Array(await G2(q,{maxBuffer:X}));return await W2(q,{maxBuffer:X})}catch(Y){return G$(R_({error:Y,stream:_,readableObjectMode:$,lines:J,encoding:Q,fdNumber:Z}))}},M3=async(_)=>{try{return await _}catch($){return G$($)}},G$=({bufferedData:_})=>E5(_)?new Uint8Array(_):_;import{finished as RH}from"node:stream/promises";var U1=async(_,$,q,{isSameDirection:Z,stopOnExit:Q=!1}={})=>{let X=DH(_,q),J=new AbortController;try{await Promise.race([...Q?[q.exitPromise]:[],RH(_,{cleanup:!0,signal:J.signal})])}catch(Y){if(!X.stdinCleanedUp)MH(Y,$,q,Z)}finally{J.abort()}},DH=(_,{originalStreams:[$],subprocess:q})=>{let Z={stdinCleanedUp:!1};if(_===$)jH(_,q,Z);return Z},jH=(_,$,q)=>{let{_destroy:Z}=_;_._destroy=(...Q)=>{AH($,q),Z.call(_,...Q)}},AH=({exitCode:_,signalCode:$},q)=>{if(_!==null||$!==null)q.stdinCleanedUp=!0},MH=(_,$,q,Z)=>{if(!PH(_,$,q,Z))throw _},PH=(_,$,q,Z=!0)=>{if(q.propagating)return U$(_)||x2(_);return q.propagating=!0,P3(q,$)===Z?U$(_):x2(_)},P3=({fileDescriptors:_},$)=>$!=="all"&&_[$].direction==="input",x2=(_)=>_?.code==="ERR_STREAM_PREMATURE_CLOSE",U$=(_)=>_?.code==="EPIPE";var W$=({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})=>_.stdio.map((K,H)=>w3({stream:K,fdNumber:H,encoding:$,buffer:q[H],maxBuffer:Z[H],lines:Q[H],allMixed:!1,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})),w3=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(P3(H,$)){await V;return}let[G]=await Promise.all([V$({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,z$=({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:X,verboseInfo:J,streamInfo:Y})=>w3({...wH(_,q),fdNumber:"all",encoding:$,maxBuffer:Z[1]+Z[2],lines:Q[1]||Q[2],allMixed:CH(_),stripFinalNewline:X,verboseInfo:J,streamInfo:Y}),wH=({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}},CH=({all:_,stdout:$,stderr:q})=>_&&$&&q&&$.readableObjectMode!==q.readableObjectMode;import{once as TH}from"node:events";var L$=(_)=>S0(_,"ipc"),R$=(_,$)=>{let q=h1(_);n({type:"ipc",verboseMessage:q,fdNumber:"ipc",verboseInfo:$})};var D$=async({subprocess:_,buffer:$,maxBuffer:q,ipc:Z,ipcOutput:Q,verboseInfo:X})=>{if(!Z)return Q;let J=L$(X),Y=q0($,"ipc"),K=q0(q,"ipc");for await(let H of B3({anyProcess:_,channel:_.channel,isSubprocess:!1,ipc:Z,shouldAwait:!1,reference:!0})){if(Y)D_(_,Q,K),Q.push(H);if(J)R$(H,X)}return Q},j$=async(_,$)=>{return await Promise.allSettled([_]),$};var A$=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:W,fileDescriptors:F,originalStreams:L,onInternalError:A,controller:z})=>{let D=P7(_,U),j={originalStreams:L,fileDescriptors:F,subprocess:_,exitPromise:D,propagating:!1},P=W$({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:H,verboseInfo:W,streamInfo:j}),R=z$({subprocess:_,encoding:$,buffer:q,maxBuffer:Z,lines:Q,stripFinalNewline:H,verboseInfo:W,streamInfo:j}),k=[],y=D$({subprocess:_,buffer:q,maxBuffer:Z,ipc:V,ipcOutput:k,verboseInfo:W}),i=kH(L,_,j),H0=IH(F,j);try{return await Promise.race([Promise.all([{},C7(D),Promise.all(P),R,y,r8(_,G),...i,...H0]),A,OH(_,z),...l8(_,X,U,z),...G8({subprocess:_,cancelSignal:J,gracefulCancel:Y,context:U,controller:z}),...c8({subprocess:_,cancelSignal:J,gracefulCancel:Y,forceKillAfterDelay:K,context:U,controller:z})])}catch(_6){return U.terminationReason??="other",Promise.all([{error:_6},D,Promise.all(P.map((s0)=>M3(s0))),M3(R),j$(y,k),Promise.allSettled(i),Promise.allSettled(H0)])}},kH=(_,$,q)=>_.map((Z,Q)=>Z===$.stdio[Q]?void 0:U1(Z,Q,q)),IH=(_,$)=>_.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"}))),OH=async(_,{signal:$})=>{let[q]=await TH(_,"error",{signal:$});throw q};var M$=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),W1=(_,$,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 EH}from"node:stream";import{callbackify as NH}from"node:util";import{finished as P$}from"node:stream/promises";var C3=async(_)=>{if(_===void 0)return;try{await T3(_)}catch{}},w$=async(_)=>{if(_===void 0)return;try{await k3(_)}catch{}},T3=async(_)=>{await P$(_,{cleanup:!0,readable:!1,writable:!0})},k3=async(_)=>{await P$(_,{cleanup:!0,readable:!0,writable:!1})},y2=async(_,$)=>{if(await _,$)throw $},v2=(_,$,q)=>{if(q&&!x2(q))_.destroy(q);else if($)_.destroy()};var C$=({subprocess:_,concurrentStreams:$,encoding:q},{from:Z,binary:Q=!0,preserveNewlines:X=!0}={})=>{let J=Q||S.has(q),{subprocessStdout:Y,waitReadableDestroy:K}=I3(_,Z,$),{readableEncoding:H,readableObjectMode:V,readableHighWaterMark:G}=O3(Y,J),{read:U,onStdoutDataDone:W}=E3({subprocessStdout:Y,subprocess:_,binary:J,encoding:q,preserveNewlines:X}),F=new EH({read:U,destroy:NH(x3.bind(void 0,{subprocessStdout:Y,subprocess:_,waitReadableDestroy:K})),highWaterMark:G,objectMode:V,encoding:H});return N3({subprocessStdout:Y,onStdoutDataDone:W,readable:F,subprocess:_}),F},I3=(_,$,q)=>{let Z=m0(_,$),Q=W1(q,Z,"readableDestroy");return{subprocessStdout:Z,waitReadableDestroy:Q}},O3=({readableEncoding:_,readableObjectMode:$,readableHighWaterMark:q},Z)=>Z?{readableEncoding:_,readableObjectMode:$,readableHighWaterMark:q}:{readableEncoding:_,readableObjectMode:!0,readableHighWaterMark:A3},E3=({subprocessStdout:_,subprocess:$,binary:q,encoding:Z,preserveNewlines:Q})=>{let X=r(),J=N2({subprocessStdout:_,subprocess:$,binary:q,shouldEncode:!q,encoding:Z,preserveNewlines:Q});return{read(){xH(this,J,X)},onStdoutDataDone:X}},xH=async(_,$,q)=>{try{let{value:Z,done:Q}=await $.next();if(Q)q.resolve();else _.push(Z)}catch{}},N3=async({subprocessStdout:_,onStdoutDataDone:$,readable:q,subprocess:Z,subprocessStdin:Q})=>{try{if(await k3(_),await Z,await C3(Q),await $,q.readable)q.push(null)}catch(X){await C3(Q),T$(q,X)}},x3=async({subprocessStdout:_,subprocess:$,waitReadableDestroy:q},Z)=>{if(await n0(q,$))T$(_,Z),await y2($,Z)},T$=(_,$)=>{v2(_,_.readable,$)};import{Writable as yH}from"node:stream";import{callbackify as k$}from"node:util";var I$=({subprocess:_,concurrentStreams:$},{to:q}={})=>{let{subprocessStdin:Z,waitWritableFinal:Q,waitWritableDestroy:X}=y3(_,q,$),J=new yH({...v3(Z,_,Q),destroy:k$(S3.bind(void 0,{subprocessStdin:Z,subprocess:_,waitWritableFinal:Q,waitWritableDestroy:X})),highWaterMark:Z.writableHighWaterMark,objectMode:Z.writableObjectMode});return h3(Z,J),J},y3=(_,$,q)=>{let Z=o1(_,$),Q=W1(q,Z,"writableFinal"),X=W1(q,Z,"writableDestroy");return{subprocessStdin:Z,waitWritableFinal:Q,waitWritableDestroy:X}},v3=(_,$,q)=>({write:vH.bind(void 0,_),final:k$(hH.bind(void 0,_,$,q))}),vH=(_,$,q,Z)=>{if(_.write($,q))Z();else _.once("drain",Z)},hH=async(_,$,q)=>{if(await n0(q,$)){if(_.writable)_.end();await $}},h3=async(_,$,q)=>{try{if(await T3(_),$.writable)$.end()}catch(Z){await w$(q),O$($,Z)}},S3=async({subprocessStdin:_,subprocess:$,waitWritableFinal:q,waitWritableDestroy:Z},Q)=>{if(await n0(q,$),await n0(Z,$))O$(_,Q),await y2($,Q)},O$=(_,$)=>{v2(_,_.writable,$)};import{Duplex as SH}from"node:stream";import{callbackify as bH}from"node:util";var E$=({subprocess:_,concurrentStreams:$,encoding:q},{from:Z,to:Q,binary:X=!0,preserveNewlines:J=!0}={})=>{let Y=X||S.has(q),{subprocessStdout:K,waitReadableDestroy:H}=I3(_,Z,$),{subprocessStdin:V,waitWritableFinal:G,waitWritableDestroy:U}=y3(_,Q,$),{readableEncoding:W,readableObjectMode:F,readableHighWaterMark:L}=O3(K,Y),{read:A,onStdoutDataDone:z}=E3({subprocessStdout:K,subprocess:_,binary:Y,encoding:q,preserveNewlines:J}),D=new SH({read:A,...v3(V,_,G),destroy:bH(fH.bind(void 0,{subprocessStdout:K,subprocessStdin:V,subprocess:_,waitReadableDestroy:H,waitWritableFinal:G,waitWritableDestroy:U})),readableHighWaterMark:L,writableHighWaterMark:V.writableHighWaterMark,readableObjectMode:F,writableObjectMode:V.writableObjectMode,encoding:W});return N3({subprocessStdout:K,onStdoutDataDone:z,readable:D,subprocess:_,subprocessStdin:V}),h3(V,D,K),D},fH=async({subprocessStdout:_,subprocessStdin:$,subprocess:q,waitReadableDestroy:Z,waitWritableFinal:Q,waitWritableDestroy:X},J)=>{await Promise.all([x3({subprocessStdout:_,subprocess:q,waitReadableDestroy:Z},J),S3({subprocessStdin:$,subprocess:q,waitWritableFinal:Q,waitWritableDestroy:X},J)])};var b3=(_,$,{from:q,binary:Z=!1,preserveNewlines:Q=!1}={})=>{let X=Z||S.has($),J=m0(_,q),Y=N2({subprocessStdout:J,subprocess:_,binary:X,shouldEncode:!0,encoding:$,preserveNewlines:Q});return gH(Y,J,_)},gH=async function*(_,$,q){try{yield*_}finally{if($.readable)$.destroy();await q}};var N$=(_,{encoding:$})=>{let q=M$();_.readable=C$.bind(void 0,{subprocess:_,concurrentStreams:q,encoding:$}),_.writable=I$.bind(void 0,{subprocess:_,concurrentStreams:q}),_.duplex=E$.bind(void 0,{subprocess:_,concurrentStreams:q,encoding:$}),_.iterable=b3.bind(void 0,_,$),_[Symbol.asyncIterator]=b3.bind(void 0,_,$,{})};var x$=(_,$)=>{for(let[q,Z]of mH){let Q=Z.value.bind($);Reflect.defineProperty(_,q,{...Z,value:Q})}},uH=(async()=>{})().constructor.prototype,mH=["then","catch","finally"].map((_)=>[_,Reflect.getOwnPropertyDescriptor(uH,_)]);var y$=(_,$,q,Z)=>{let{file:Q,commandArguments:X,command:J,escapedCommand:Y,startTime:K,verboseInfo:H,options:V,fileDescriptors:G}=pH(_,$,q),{subprocess:U,promise:W}=aH({file:Q,commandArguments:X,options:V,startTime:K,verboseInfo:H,command:J,escapedCommand:Y,fileDescriptors:G});return U.pipe=E2.bind(void 0,{source:U,sourcePromise:W,boundOptions:{},createNested:Z}),x$(U,W),t.set(U,{options:V,fileDescriptors:G}),U},pH=(_,$,q)=>{let{command:Z,escapedCommand:Q,startTime:X,verboseInfo:J}=b1(_,$,q),{file:Y,commandArguments:K,options:H}=J2(_,$,q),V=lH(H),G=u7(V,J);return{file:Y,commandArguments:K,command:Z,escapedCommand:Q,startTime:X,verboseInfo:J,options:V,fileDescriptors:G}},lH=({timeout:_,signal:$,...q})=>{if($!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...q,timeoutDuration:_}},aH=({file:_,commandArguments:$,options:q,startTime:Z,verboseInfo:Q,command:X,escapedCommand:J,fileDescriptors:Y})=>{let K;try{K=cH(...Y2(_,$,q))}catch(F){return S7({error:F,command:X,escapedCommand:J,fileDescriptors:Y,options:q,startTime:Z,verboseInfo:Q})}let H=new AbortController;dH(Number.POSITIVE_INFINITY,H.signal);let V=[...K.stdio];r7(K,Y,H),$$(K,q,H);let G={},U=r();K.kill=B8.bind(void 0,{kill:K.kill.bind(K),options:q,onInternalError:U,context:G,controller:H}),K.all=F$(K,q),N$(K,q),y7(K,q);let W=iH({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:W}},iH=async({subprocess:_,options:$,startTime:q,verboseInfo:Z,fileDescriptors:Q,originalStreams:X,command:J,escapedCommand:Y,context:K,onInternalError:H,controller:V})=>{let[G,[U,W],F,L,A]=await A$({subprocess:_,options:$,context:K,verboseInfo:Z,fileDescriptors:Q,originalStreams:X,onInternalError:H,controller:V});V.abort(),H.resolve();let z=F.map((P,R)=>X0(P,$,R)),D=X0(L,$,"all"),j=nH({errorInfo:G,exitCode:U,signal:W,stdio:z,all:D,ipcOutput:A,context:K,options:$,command:J,escapedCommand:Y,startTime:q});return l0(j,Z,$)},nH=({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}):z2({command:K,escapedCommand:H,stdio:Z,all:Q,ipcOutput:X,options:Y,startTime:V});var h2=(_,$)=>{let q=Object.fromEntries(Object.entries($).map(([Z,Q])=>[Z,oH(Z,_[Z],Q)]));return{..._,...q}},oH=(_,$,q)=>{if(rH.has(_)&&I($)&&I(q))return{...$,...q};return q},rH=new Set(["env",...L6]);var U0=(_,$,q,Z)=>{let Q=(J,Y,K)=>U0(J,Y,q,K),X=(...J)=>tH({mapArguments:_,deepOptions:q,boundOptions:$,setBoundExeca:Z,createNested:Q},...J);if(Z!==void 0)Z(X,Q,$);return X},tH=({mapArguments:_,deepOptions:$={},boundOptions:q={},setBoundExeca:Z,createNested:Q},X,...J)=>{if(I(X))return Q(_,h2(q,X),Z);let{file:Y,commandArguments:K,options:H,isSync:V}=sH({mapArguments:_,firstArgument:X,nextArguments:J,deepOptions:$,boundOptions:q});return V?k7(Y,K,H):y$(Y,K,H,Q)},sH=({mapArguments:_,firstArgument:$,nextArguments:q,deepOptions:Z,boundOptions:Q})=>{let X=S5($)?b5($,q):[$,...q],[J,Y,K]=T1(...X),H=h2(h2(Z,Q),K),{file:V=J,commandArguments:G=Y,options:U=H,isSync:W=!1}=_({file:J,commandArguments:Y,options:H});return{file:V,commandArguments:G,options:U,isSync:W}};var v$=({file:_,commandArguments:$})=>S$(_,$),h$=({file:_,commandArguments:$})=>({...S$(_,$),isSync:!0}),S$=(_,$)=>{if($.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${_} ${$}.`);let[q,...Z]=eH(_);return{file:q,commandArguments:Z}},eH=(_)=>{if(typeof _!=="string")throw new TypeError(`The command must be a string: ${String(_)}.`);let $=_.trim();if($==="")return[];let q=[];for(let Z of $.split(_B)){let Q=q.at(-1);if(Q&&Q.endsWith("\\"))q[q.length-1]=`${Q.slice(0,-1)} ${Z}`;else q.push(Z)}return q},_B=/ +/g;var b$=(_,$,q)=>{_.sync=$($B,q),_.s=_.sync},f$=({options:_})=>g$(_),$B=({options:_})=>({...g$(_),isSync:!0}),g$=(_)=>({options:{...qB(_),..._}}),qB=({input:_,inputFile:$,stdio:q})=>_===void 0&&$===void 0&&q===void 0?{stdin:"inherit"}:{},u$={preferLocal:!0};var N=U0(()=>({})),x=U0(()=>({isSync:!0})),QP=U0(v$),XP=U0(h$),JP=U0(i8),YP=U0(f$,{},u$,b$),{sendMessage:KP,getOneMessage:HP,getEachMessage:BP,getCancelSignal:VP}=v7();var S2=(_)=>{if(_.code==="ENOENT")throw new Error("Couldn't find the `termux-api` scripts. You can install them with: apt install termux-api");throw _},ZB={async copy(_){try{await N("termux-clipboard-set",_)}catch($){S2($)}},async paste(_){try{let{stdout:$}=await N("termux-clipboard-get",_);return $}catch($){S2($)}},copySync(_){try{x("termux-clipboard-set",_)}catch($){S2($)}},pasteSync(_){try{return x("termux-clipboard-get",_).stdout}catch($){S2($)}}},m$=ZB;import a$ from"node:path";import{fileURLToPath as QB}from"node:url";var XB=a$.dirname(QB(import.meta.url)),i$="xsel",n$=a$.join(XB,"../fallbacks/linux/xsel"),d$=["--clipboard","--input"],c$=["--clipboard","--output"],o$=(_,$)=>{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},p$=async(_,$)=>{try{let{stdout:q}=await N(i$,_,$);return q}catch(q){try{let{stdout:Z}=await N(n$,_,$);return Z}catch(Z){throw o$(q,Z)}}},l$=(_,$)=>{try{return x(i$,_,$).stdout}catch(q){try{return x(n$,_,$).stdout}catch(Z){throw o$(q,Z)}}},JB={async copy(_){await p$(d$,_)},copySync(_){l$(d$,_)},paste:(_)=>p$(c$,_),pasteSync:(_)=>l$(c$,_)},I0=JB;var b2=["--type","text/plain"],s$=(_,$)=>{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}`)},r$=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 s$(_,Q)}},t$=(_,$,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 s$(_,Q)}},YB={async copy(_){await r$("wl-copy",b2,_,I0.copy)},copySync(_){t$("wl-copy",b2,_,I0.copySync)},async paste(_){return r$("wl-paste",[...b2,"--no-newline"],_,I0.paste)},pasteSync(_){return t$("wl-paste",[...b2,"--no-newline"],_,I0.pasteSync)}},e$=YB;var f2={LC_CTYPE:"UTF-8"},KB={copy:async(_)=>N("pbcopy",{..._,env:f2}),async paste(_){let{stdout:$}=await N("pbpaste",{..._,env:f2});return $},copySync:(_)=>x("pbcopy",{..._,env:f2}),pasteSync:(_)=>x("pbpaste",{..._,env:f2}).stdout},_q=KB;import{Buffer as GB}from"node:buffer";import Yq from"node:path";import{fileURLToPath as UB}from"node:url";import{promisify as HB}from"node:util";import BB from"node:process";import F1 from"node:child_process";var kP=HB(F1.execFile);function $q(){let{arch:_,platform:$,env:q}=BB;if($==="darwin"&&_==="x64")return F1.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(F1.execFileSync("getconf",["LONG_BIT"],{encoding:"utf8"}).trim()==="64")return"x64"}return _}var VB=new Set(["arm64","x64","ppc64","riscv64"]);function qq(){return VB.has($q())}var WB=Yq.dirname(UB(import.meta.url)),FB=qq()?"x86_64":"i686",g2=Yq.join(WB,`../fallbacks/windows/clipboard_${FB}.exe`),u2="powershell.exe",zB=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass"],m2=(_)=>{let $=GB.from(_,"utf16le").toString("base64");return[...zB,"-EncodedCommand",$]},Zq=`
|
|
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(),Qq=`
|
|
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(),Xq=async(_,$)=>{try{return await _()}catch{return $()}},Jq=(_,$)=>{try{return _()}catch{return $()}},LB={copy:async(_)=>Xq(async()=>N(u2,m2(Zq),_),async()=>N(g2,["--copy"],_)),async paste(_){let{stdout:$}=await Xq(async()=>N(u2,m2(Qq),_),async()=>N(g2,["--paste"],_));return $},copySync:(_)=>Jq(()=>x(u2,m2(Zq),_),()=>x(g2,["--copy"],_)),pasteSync:(_)=>Jq(()=>x(u2,m2(Qq),_),()=>x(g2,["--paste"],_)).stdout},f3=LB;var d2=(()=>{switch(Kq.platform){case"darwin":return _q;case"win32":return f3;case"android":{if(Kq.env.TERMUX_VERSION===void 0)throw new Error("You need to install Termux for this module to work on Android: https://termux.com");return m$}default:{if(I5)return f3;if(B6())return e$;return I0}}})(),RB={async write(_){if(typeof _!=="string")throw new TypeError(`Expected a string, got ${typeof _}`);await d2.copy({input:_})},async read(){return d2.paste({stripFinalNewline:!1})},writeSync(_){if(typeof _!=="string")throw new TypeError(`Expected a string, got ${typeof _}`);d2.copySync({input:_})},readSync(){return d2.pasteSync({stripFinalNewline:!1})}},Hq=RB;import*as p2 from"cheerio";var c2={MIN_CONTENT_LENGTH:200,MIN_PARAGRAPH_LENGTH:50,MAX_LINK_TEXT_RATIO:0.5,READING_WORDS_PER_MINUTE:200},DB=[{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}],jB=["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 g3(_){if(!_||typeof _!=="string"||_.trim().length===0||!_.includes("<"))throw new Error("Invalid or empty HTML")}function Bq(_,$){let q=0,Q=$.text().trim().length;if(Q<c2.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)>c2.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 AB(_){let $=null,q=0;for(let{selector:Z,score:Q}of DB)_(Z).each((X,J)=>{let Y=_(J),K=Bq(_,Y)+Q;if(K>q)q=K,$=Y});if(!$||q<100)_("div").each((Z,Q)=>{let X=_(Q),J=Bq(_,X);if(J>q)q=J,$=X});return $}function Gq(_){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 Vq(_,$){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,29 @@ 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
|
-
`)}),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(`
|
|
89
|
+
`)}),Gq(q.text())}function u3(_){g3(_);let $=p2.load(_);$(jB).remove();let q=AB($),Z=q?.length?Vq($,q):Vq($,$("body"));if(Z.length<c2.MIN_CONTENT_LENGTH)Z=Gq($("body").text());return Z}function Uq(_,$){g3(_);let q=p2.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(_){g3(_);let $=p2.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']"),W=u3(_).split(/\s+/).filter(Boolean).length,F=Math.max(1,Math.ceil(W/c2.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:W,readingTime:F}}async function MB(_){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=PB(J);try{let H=new TextDecoder(Y,{fatal:!1}).decode(X);return m3(H)}catch{let H=new TextDecoder("utf-8",{fatal:!1}).decode(X);return m3(H)}}catch{let Q=await _.text();return m3(Q)}}function PB(_){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 m3(_){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 wB(_){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 CB(_){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 d3(_,$){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 c3(_){if(_)return _;return J0.USER_AGENTS[0]}async function TB(_,$){let q=new AbortController,Z=setTimeout(()=>q.abort(),$.timeout);try{let Q=await fetch(_,{headers:{"User-Agent":c3($.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");CB(X);let J=Q.headers.get("content-length");if(J){let H=parseInt(J,10);d3(H,$.maxSize)}let Y=await MB(Q),K=new TextEncoder().encode(Y).length;if(d3(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 kB(_,$,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(c3($.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(d3(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 Wq(_,$,q=1){try{if($.fullRender){let Z=await import("puppeteer");return await kB(_,$,Z)}return await TB(_,$)}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)),Wq(_,$,q+1)}}async function L1(_,$={}){wB(_);let q={fullRender:$.fullRender??!1,timeout:$.timeout??($.fullRender?J0.FULL_RENDER_TIMEOUT:J0.SIMPLE_FETCH_TIMEOUT),userAgent:$.userAgent??c3(),followRedirects:$.followRedirects??!0,maxSize:$.maxSize??J0.MAX_CONTENT_SIZE,waitUntil:$.waitUntil??"networkidle2",maxRetries:$.maxRetries??J0.MAX_RETRIES};return await Wq(_,q)}function W0(_){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 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
|
|
94
|
-
`
|
|
95
|
-
`
|
|
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 F0(_){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 IB=100;function OB(_){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 EB(_){if(!_||typeof _!=="object")return{};return{title:z0(_.title,IB),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 D1(_){if(!_||typeof _!=="string")return _;let $=_.trim();$=$.replace(/^(\d+\.\s+.+)$/gm,(Q,X)=>{return`${X}
|
|
94
|
+
`}),$=$.replace(/^([-*•]\s+.+)$/gm,(Q,X)=>{return`${X}
|
|
95
|
+
`});let q=$.split(`
|
|
96
|
+
`),Z=[];for(let Q=0;Q<q.length;Q++){let X=q[Q].trim(),J=q[Q+1]?.trim();if(Z.push(X),X&&J){let Y=X.length>80,K=/[.!?:]$/.test(X),H=/^\d+\.\s/.test(J),V=/^[-*•]\s/.test(J),G=/^\d+\.\s/.test(X);if(Y&&K||H||V||G&&J.length>40)Z.push("")}}return $=Z.join(`
|
|
97
|
+
`).replace(/\n{3,}/g,`
|
|
98
|
+
|
|
99
|
+
`),$}function NB(_,$){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 Y=[];if($.model)Y.push(`${Y0.model} ${$.model}`);if($.processingTime!==void 0)Y.push(`${Y0.time} ${($.processingTime/1000).toFixed(1)}s`);if($.fromCache)Y.push(`${Y0.cache} cached`);if(Y.length>0)q.push(B.dim(Y.join(" | ")))}q.push("");let Q=$.customQuestion?"Answer":$.isFullContent?"Full Content":$.customTitle||"Summary",X=$.customQuestion?Y0.answer:$.isFullContent?"\uD83D\uDCD6":Y0.summary;q.push(B.bold.magenta(`${X} ${Q}:`)),q.push("");let J=D1(_);if(q.push(B.white(J)),$.includeTimestamp&&!$.compact)q.push(""),q.push(B.dim(`${Y0.date} Generated: ${new Date().toLocaleString()}`));return q.join(`
|
|
100
|
+
`)}function xB(_,$){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 J=[];if($.model)J.push(`Model: ${$.model}`);if($.processingTime!==void 0)J.push(`Time: ${($.processingTime/1000).toFixed(1)}s`);if($.fromCache)J.push("Cached: Yes");if(J.length>0)q.push(`*${J.join(" | ")}*`),q.push("")}q.push("---"),q.push("");let X=D1(_);if(q.push(X),$.includeTimestamp)q.push(""),q.push("---"),q.push(`*Generated: ${new Date().toISOString()}*`);return q.join(`
|
|
101
|
+
`)}function yB(_,$){let q=D1(_),Z={url:$.url,content:q,metadata:{title:$.metadata.title||null,description:$.metadata.description||null,author:$.metadata.author||null,publishDate:$.metadata.publishDate||null}};if($.customQuestion)Z.question=$.customQuestion,Z.type="answer";else if($.isFullContent)Z.type="full_content";else Z.type="summary";if($.includeMetadata)Z.metadata={...Z.metadata,...$.metadata};if($.model)Z.model=$.model;if($.processingTime!==void 0)Z.processingTimeMs=$.processingTime;if($.fromCache!==void 0)Z.fromCache=$.fromCache;if($.includeTimestamp)Z.generatedAt=new Date().toISOString();return JSON.stringify(Z,null,$.compact?0:2)}function vB(_,$){let q=$.metadata,Z=$.customQuestion?"Answer":$.customTitle||"Summary",Q=(K)=>K.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H]||H),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">'),D1(_).split(`
|
|
96
102
|
|
|
97
|
-
`).forEach((
|
|
98
|
-
`)}function
|
|
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(`
|
|
103
|
+
`).forEach((K)=>{if(K.trim())X.push(` <p>${Q(K).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(`
|
|
104
|
+
`)}function hB(_,$){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}`)}q.push(""),q.push("-".repeat(60)),q.push("");let X=D1(_);if(q.push(X),$.includeTimestamp)q.push(""),q.push("-".repeat(60)),q.push(`Generated: ${new Date().toISOString()}`);return q.join(`
|
|
105
|
+
`)}function p3(_,$){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(F0(q))console.error("⚠️ Binary artifacts detected in summary, applying nuclear cleaning..."),q=W0(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=OB($.url),Q=EB($.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=xB(q,J);break;case"json":Y=yB(q,J);break;case"html":Y=vB(q,J);break;case"plain":Y=hB(q,J);break;default:Y=NB(q,J);break}return Y}import*as Fq from"cheerio";var o0={en:"English",fr:"French",es:"Spanish",ht:"Haitian Creole"};function SB(_){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 bB(_){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 fB(_){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 zq(_,$,q,Z){let Q=[];if(Z&&Z in o0)return{detected:Z,confidence:"high",source:"url",signals:["user-specified"]};let X=SB(_);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=bB($);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=fB(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 Lq(){return process.env.DISABLE_LANGUAGE_DETECTION!=="true"}import Rq 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 Dq(_){switch(Rq.extname(_).toLowerCase()){case".jpg":case".jpeg":return"jpeg";case".webp":return"webp";default:return"png"}}function gB(_){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 uB(_){let $=Rq.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 mB(_){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 jq(_,$,q,Z=1){let Q,X;try{Q=await mB(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=Dq($.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)),jq(_,$,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 Aq(_,$={}){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(gB(_),uB(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=Dq(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 jq(_,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 dB(_="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 cB(){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 pB(){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 lB(){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 aB(){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 iB(_={}){let{preferFree:$=!0,ollamaEndpoint:q,verbose:Z=!1}=_,[Q,X,J,Y,K]=await Promise.all([dB(q),cB(),pB(),lB(),aB()]),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],W=U.filter((z)=>z.available),F=[];if($)F=[...K.available?["local"]:[],...Y.available?["elevenlabs"]:[]];else F=[...Y.available?["elevenlabs"]:[],...K.available?["local"]:[]];let L=G[0]||"none",A=F[0]||"none";if(Z){if(console.log(B.cyan(`
|
|
100
106
|
\uD83D\uDCCA Service Detection Report:
|
|
101
107
|
`)),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
108
|
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
109
|
\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:
|
|
105
|
-
⚠️ ${q[_]}`))}import{GoogleGenAI as
|
|
110
|
+
\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:F}}}async function l3(_,$){switch((await iB({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 Mq(_,$){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(`
|
|
111
|
+
⚠️ ${q[_]}`))}import{GoogleGenAI as nB}from"@google/genai";import oB from"openai";var a3={en:"English",fr:"French",es:"Spanish",ht:"Haitian Creole"};function rB(_){if(!a3[_])throw new Error(`Unsupported language: "${_}". Use: en, fr, es, ht`)}var i3=(_)=>{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
112
|
|
|
107
113
|
**Core Capabilities:**
|
|
108
114
|
- Extract key information with precision and context
|
|
@@ -301,11 +307,11 @@ Voice Services:`)),U.forEach((z)=>{let D=z.available?"✅":"❌",j=z.type==="fre
|
|
|
301
307
|
- Start directly with the content
|
|
302
308
|
- End when content is complete
|
|
303
309
|
|
|
304
|
-
Begin your response now:`};function
|
|
310
|
+
Begin your response now:`};function tB(_,$){let q=a3[$.language],Z=K0.systemInstruction(q||"English");if(Z+=`
|
|
305
311
|
|
|
306
312
|
---
|
|
307
313
|
|
|
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=
|
|
314
|
+
`,$.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=a3[$.language];Z+=`
|
|
309
315
|
|
|
310
316
|
**IMPORTANT LANGUAGE REQUIREMENT:**
|
|
311
317
|
- You MUST write your ENTIRE response in ${J}
|
|
@@ -318,21 +324,21 @@ Voice Services:`)),U.forEach((z)=>{let D=z.available?"✅":"❌",j=z.type==="fre
|
|
|
318
324
|
|
|
319
325
|
**WEBPAGE CONTENT:**
|
|
320
326
|
|
|
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
|
|
327
|
+
${X}`,Z}async function n3(_,$){rB($.language);let q=i3($.model),Z=tB(_,$);switch(q){case"openai":return await sB(Z,$);case"google":return await eB(Z,$);case"ollama":return await _V(Z,$);default:throw new Error("Invalid provider")}}async function sB(_,$){if(!process.env.OPENAI_API_KEY)throw new Error("Missing OPENAI_API_KEY");let q=new oB({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(`
|
|
328
|
+
`),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(F0(J))return console.error("\uD83D\uDEA8 CRITICAL: Binary artifacts in OpenAI response! Applying emergency cleaning..."),W0(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 eB(_,$){let q=process.env.GEMINI_API_KEY;if(!q)throw new Error("Missing GEMINI_API_KEY");let Z=new nB({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(F0(J))console.error("\uD83D\uDEA8 CRITICAL: Binary artifacts in Gemini response! Applying emergency cleaning..."),Y=W0(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(`
|
|
329
|
+
`)}return Y}async function _V(_,$){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="",W=K.body?.getReader(),F=new TextDecoder;while(!0){if(!W)throw new Error("Reader is not available");let{done:L,value:A}=await W.read();if(L)break;let D=F.decode(A).split(`
|
|
324
330
|
`).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(),
|
|
331
|
+
`),U}let V=(await K.json()).message,G=V?.content?.trim()??"";if(!G&&V?.thinking?.trim()){let U=V.thinking.trim(),W=U.match(/"([^"]+)"$/);if(W)G=W[1]??"";else{let F=U.split(/[.!?]+/).filter((L)=>L.trim().length>10);if(F.length>0)G=`${F[F.length-1]?.trim()}.`;else G=U.slice(0,500)+(U.length>500?"...":"")}}if(F0(G))return console.error("\uD83D\uDEA8 CRITICAL: Binary artifacts in Ollama response! Applying emergency cleaning..."),W0(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 qV}from"node:fs/promises";import{tmpdir as ZV}from"node:os";import{join as QV}from"node:path";import{ElevenLabsClient as XV}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"}},Pq={alloy:"21m00Tcm4TlvDq8ikWAM",echo:"jsCqWAovK2LkecY7zXl4",nova:"IKne3meq5aSn9XLyUdCD",shimmer:"LcfcDJNUP1GQjkzn1xUU",onyx:"N2lVS1w4EtoT3dr4eOWO",fable:"jBpfuIE2acCO8z3wKNLl"},wq={en:"eleven_monolingual_v1",fr:"eleven_multilingual_v2",es:"eleven_multilingual_v2",ht:"eleven_multilingual_v2",default:"eleven_monolingual_v1"};class Cq{client;apiKey;constructor(_){if(this.apiKey=_||process.env.ELEVENLABS_API_KEY,this.apiKey)this.client=new XV({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||QV(ZV(),`glance-audio-${Date.now()}.mp3`);if(await qV(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
332
|
Add-Type -AssemblyName System.Speech
|
|
327
333
|
$synthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
|
328
334
|
${$.outputFile?`$synthesizer.SetOutputToWaveFile("${$.outputFile}")`:""}
|
|
329
335
|
$synthesizer.Speak("${_.replace(/"/g,'""')}")
|
|
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
|
|
336
|
+
`,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 Pq)Q=Pq[q];else Q=q;else Q=Z.default||Z[Object.keys(Z)[0]];let X=_.model||wq[$]||wq.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
337
|
|
|
332
338
|
`).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
|
|
339
|
+
`).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 o3(_){return new Cq(_)}function Tq(_){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
340
|
|
|
335
|
-
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}var e={VERSION:"0.16.
|
|
341
|
+
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}var e={VERSION:"0.16.1",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"},zw=Object.keys(r0);function kq(){console.log(`
|
|
336
342
|
${B.bold("glance")} v${e.VERSION} – AI-powered web reader
|
|
337
343
|
|
|
338
344
|
${B.bold("Usage:")}
|
|
@@ -408,51 +414,51 @@ ${B.bold("Environment Variables:")}
|
|
|
408
414
|
${B.cyan("OLLAMA_ENDPOINT")} Custom Ollama endpoint (default: http://localhost:11434)
|
|
409
415
|
|
|
410
416
|
${B.dim("For more information: https://github.com/jkenley/glance-cli")}
|
|
411
|
-
`)}function
|
|
417
|
+
`)}function Iq(){console.log(`glance v${e.VERSION}`)}function Oq(_){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 r3(_){if(!_){console.error(B.red("Service detection failed - no services information available"));return}console.log(B.bold(`
|
|
412
418
|
\uD83D\uDD0D Service Detection Results:
|
|
413
419
|
`));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
420
|
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
421
|
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
422
|
\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
|
|
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(
|
|
423
|
+
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 Eq{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 Eq;import r2 from"node:process";import gq from"node:process";import i2 from"node:process";var JV=(_,$,q,Z)=>{if(q==="length"||q==="prototype")return;if(q==="arguments"||q==="caller")return;let Q=Object.getOwnPropertyDescriptor(_,q),X=Object.getOwnPropertyDescriptor($,q);if(!YV(Q,X)&&Z)return;Object.defineProperty(_,q,X)},YV=function(_,$){return _===void 0||_.configurable||_.writable===$.writable&&_.enumerable===$.enumerable&&_.configurable===$.configurable&&(_.writable||_.value===$.value)},KV=(_,$)=>{let q=Object.getPrototypeOf($);if(q===Object.getPrototypeOf(_))return;Object.setPrototypeOf(_,q)},HV=(_,$)=>`/* Wrapped ${_}*/
|
|
424
|
+
${$}`,BV=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),VV=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),GV=(_,$,q)=>{let Z=q===""?"":`with ${q.trim()}() `,Q=HV.bind(null,Z,$.toString());Object.defineProperty(Q,"name",VV);let{writable:X,enumerable:J,configurable:Y}=BV;Object.defineProperty(_,"toString",{value:Q,writable:X,enumerable:J,configurable:Y})};function t3(_,$,{ignoreNonConfigurable:q=!1}={}){let{name:Z}=_;for(let Q of Reflect.ownKeys($))JV(_,$,Q,q);return KV(_,$),GV(_,$,Z),_}var l2=new WeakMap,Nq=(_,$={})=>{if(typeof _!=="function")throw new TypeError("Expected a function");let q,Z=0,Q=_.displayName||_.name||"<anonymous>",X=function(...J){if(l2.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 t3(X,_),l2.set(X,Z),X};Nq.callCount=(_)=>{if(!l2.has(_))throw new Error(`The given function \`${_.name}\` is not wrapped by the \`onetime\` package`);return l2.get(_)};var xq=Nq;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 a2=(_)=>!!_&&typeof _==="object"&&typeof _.removeListener==="function"&&typeof _.emit==="function"&&typeof _.reallyExit==="function"&&typeof _.listeners==="function"&&typeof _.kill==="function"&&typeof _.pid==="number"&&typeof _.on==="function",s3=Symbol.for("signal-exit emitter"),e3=globalThis,UV=Object.defineProperty.bind(Object);class yq{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(e3[s3])return e3[s3];UV(e3,s3,{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 WV=(_)=>{return{onExit($,q){return _.onExit($,q)},load(){return _.load()},unload(){return _.unload()}}};class vq extends $5{onExit(){return()=>{}}load(){}unload(){}}class hq extends $5{#Z=_5.platform==="win32"?"SIGINT":"SIGHUP";#$=new yq;#_;#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(!a2(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(!a2(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"&&a2(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 _5=globalThis.process,{onExit:Sq,load:Ow,unload:Ew}=WV(a2(_5)?new hq(_5):new vq);var bq=i2.stderr.isTTY?i2.stderr:i2.stdout.isTTY?i2.stdout:void 0,FV=bq?xq(()=>{Sq(()=>{bq.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},fq=FV;var n2=!1,t0={};t0.show=(_=gq.stderr)=>{if(!_.isTTY)return;n2=!1,_.write("\x1B[?25h")};t0.hide=(_=gq.stderr)=>{if(!_.isTTY)return;fq(),n2=!0,_.write("\x1B[?25l")};t0.toggle=(_,$)=>{if(_!==void 0)n2=_;if(n2)t0.show($);else t0.hide($)};var q5=t0;var Z5={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 j1=Z5,mw=Object.keys(Z5);var N0={};JZ(N0,{warning:()=>DV,success:()=>RV,info:()=>LV,error:()=>jV});var o2=j0(),LV=r5(o2?"ℹ":"i"),RV=n5(o2?"✔":"√"),DV=o5(o2?"⚠":"‼"),jV=i5(o2?"✖":"×");function Q5({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 AV=Q5();function A1(_){if(typeof _!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof _}\``);return _.replace(AV,"")}function uq(_){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 mq(_){return _===12288||_>=65281&&_<=65376||_>=65504&&_<=65510}function dq(_){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 MV(_){if(!Number.isSafeInteger(_))throw new TypeError(`Expected a code point, got \`${typeof _}\`.`)}function X5(_,{ambiguousAsWide:$=!1}={}){if(MV(_),mq(_)||dq(_)||$&&uq(_))return 2;return 1}var PV=new Intl.Segmenter,wV=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,CV=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,TV=/^\p{RGI_Emoji}$/v;function kV(_){return _.replace(CV,"")}function IV(_){return wV.test(_)}function OV(_,$){let q=0;if(_.length>1){for(let Z of _.slice(1))if(Z>=""&&Z<="")q+=X5(Z.codePointAt(0),$)}return q}function J5(_,$={}){if(typeof _!=="string"||_.length===0)return 0;let{ambiguousIsNarrow:q=!0,countAnsiEscapeCodes:Z=!1}=$,Q=_;if(!Z)Q=A1(Q);if(Q.length===0)return 0;let X=0,J={ambiguousAsWide:!q};for(let{segment:Y}of PV.segment(Q)){if(IV(Y))continue;if(TV.test(Y)){X+=2;continue}let K=kV(Y).codePointAt(0);X+=X5(K,J),X+=OV(Y,J)}return X}function Y5({stream:_=process.stdout}={}){return Boolean(_&&_.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import _0 from"node:process";var EV=3;class cq{#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]===EV)_0.emit("SIGINT")}}var NV=new cq,K5=NV;class pq{#Z=0;#$=!1;#_=0;#q=-1;#Y=0;#J=0;#Q;#K;#X;#W;#L;#H;#U;#B;#F;#V;#G;color;constructor(_){if(typeof _==="string")_={text:_};if(this.#Q={color:"cyan",stream:r2.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:Y5({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,r2.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=j1.line;else if(_===void 0)this.#K=j1.dots;else if(_!=="default"&&j1[_])this.#K=j1[_];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.#F}set text(_=""){this.#F=_,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.#W!==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 A1(_).split(`
|
|
425
|
+
`))q+=Math.max(1,Math.ceil(J5(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.#F==="string"?" "+this.#F:"")+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
426
|
`),X=Z-1;_=[...Q.slice(0,X),"... (content truncated to fit terminal)"].join(`
|
|
421
427
|
`)}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)
|
|
423
|
-
`;return this.stop(),this.#X.write(H),this}}function
|
|
428
|
+
`);return this}if(this.isSpinning)return this;if(this.#Q.hideCursor)q5.hide(this.#X);if(this.#Q.discardStdin&&r2.stdin.isTTY)this.#$=!0,K5.start();return this.render(),this.#W=setInterval(this.render.bind(this),this.interval),this}stop(){if(clearInterval(this.#W),this.#W=void 0,this.#q=0,this.#H){if(this.clear(),this.#Q.hideCursor)q5.show(this.#X)}if(this.#Q.discardStdin&&r2.stdin.isTTY&&this.#$)K5.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+`
|
|
429
|
+
`;return this.stop(),this.#X.write(H),this}}function H5(_){return new pq(_)}function lq(_){let $=/\x1b\[[0-9;]*m/g,q=[],Z=_,Q;while((Q=$.exec(_))!==null)q.push(Q[0]);if(F0(_))E.warn("Binary artifacts detected, applying nuclear cleaning"),Z=W0(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
430
|
`).replace(/\r/g,`
|
|
425
431
|
`).replace(/\n{4,}/g,`
|
|
426
432
|
|
|
427
433
|
|
|
428
|
-
`).trim();return Z}async function
|
|
429
|
-
\uD83D\uDCCA Page Metadata:`)),console.log(JSON.stringify(
|
|
430
|
-
\uD83D\uDD17 Found ${
|
|
434
|
+
`).trim();return Z}async function B5(_,$={}){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 H5({text:_,spinner:"dots",color:"cyan",discardStdin:!$})}function t2(_){let $=["B","KB","MB","GB"],q=_,Z=0;while(q>=1024&&Z<$.length-1)q/=1024,Z++;return`${q.toFixed(2)} ${$[Z]}`}function aq(_){let $=_.split(".");return $.length>1?$[$.length-1]?.toLowerCase()??"":""}function V5(_){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 iq(_){let $=Object.keys(r0);if(!$.includes(_))return{valid:!1,error:`Language '${_}' is not supported. Supported languages: ${$.join(", ")}`};return{valid:!0}}function nq(_){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 s2(_){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 e2(_,$={}){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 B5(()=>L1(_,{fullRender:$.fullRender}),{onRetry:(W,F)=>{X.text=`Fetching webpage... (retry ${W})`}}),X.succeed("Webpage fetched successfully")}catch(W){throw X.fail("Failed to fetch webpage"),new m(W instanceof Error?W.message:String(W),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=u3(J);if(!$.language&&Lq()){let W=zq(_,J,K,$.language);if(Z=W.detected,Q=r0[Z]||"English",W.confidence!=="high"&&W.source!=="default")E.info(`Auto-detected language: ${Q}`);if($.debug)E.debug(`Language detected: ${Z} (${W.confidence} confidence from ${W.source})`),E.debug(`Detection signals: ${W.signals.join(", ")}`)}if(K.length>e.MAX_CONTENT_SIZE)throw Y.fail("Content too large"),new m(`Content size (${t2(K.length)}) exceeds maximum allowed`,O0.CONTENT_TOO_LARGE,`The webpage content is too large to process (>${t2(e.MAX_CONTENT_SIZE)})`,!1);if(Y.succeed(`Content extracted (${t2(K.length)})`),$.metadata){let W=z1(J);console.log(B.bold(`
|
|
435
|
+
\uD83D\uDCCA Page Metadata:`)),console.log(JSON.stringify(W,null,2))}if($.links){let W=Uq(J);console.log(B.bold(`
|
|
436
|
+
\uD83D\uDD17 Found ${W.length} links:`)),W.forEach((F)=>{let L=F.text?`${F.text} (${F.href})`:F.href;console.log(B.cyan(` • ${L}`))})}if($.screenshot)await gV(_,$.screenshot);if($.full)return await SV(K,{...$,language:Z});let{rawSummary:H,formattedSummary:V}=await bV(K,_,{...$,language:Z});if($.read||$.audioOutput){console.log(V),console.log("");let W=Tq(H);return await fV(W,{...$,language:Z}),V}let G=V;if($.output)await tq(G,$.output);if($.copy){let W=$.format==="json"||$.format==="markdown"?G:H||G;await hV(W)}let U=Date.now()-q;return E.debug(`Total execution time: ${U}ms`),G}function rq(_){if(_.format)return{md:"markdown",json:"json",plain:"plain",markdown:"markdown",terminal:"terminal"}[_.format.toLowerCase()]||"terminal";if(_.output){let $=aq(_.output).toLowerCase(),Z={md:"markdown",markdown:"markdown",json:"json",txt:"plain",text:"plain"}[$];if(Z)return Z}return"terminal"}async function tq(_,$){try{await xV($,_,"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 hV(_){try{await Hq.write(_),E.info(B.green("✓ Copied to clipboard"))}catch($){E.warn(B.yellow("⚠ Could not copy to clipboard:"),$ instanceof Error?$.message:String($))}}async function SV(_,$){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 l3(void 0,!!$.preferQuality),Y=i3(J),K={model:J,language:$.language,stream:!1,maxTokens:$.maxTokens||8000,translate:Z,format:!0},H=await n3(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=p3(q,{format:rq($),url:"full-content",isFullContent:!0});if($.output)await tq(X,$.output);return X}async function bV(_,$,q){let Z=q.model||await l3(void 0,!!q.preferQuality);if(!q.freeOnly)await Mq(Z);let Q=q.stream?null:d(`Processing with ${Z}...`,q.disableStdinHandling);Q?.start();try{let X=await B5(()=>n3(_,{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=lq(R1(X)),Y=p3(J,{format:rq(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 fV(_,$){try{let q=o3();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 gV(_,$){let q=d(`Capturing screenshot: ${$}`);q.start();try{await Aq(_,$),q.succeed(`Screenshot saved to ${$}`)}catch(Z){q.fail("Failed to capture screenshot"),E.error("Screenshot error:",Z)}}async function sq(){try{let _=o3(),$=await _.listVoices("en"),q=await _.listVoices("fr"),Z=await _.listVoices("es"),Q=await _.listVoices("ht");if(console.log(B.bold(`
|
|
431
437
|
\uD83C\uDFA4 Available Voices by Language:
|
|
432
438
|
`)),$.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
439
|
\uD83C\uDDEB\uD83C\uDDF7 French:`));for(let X of q)console.log(` ${X}`)}if(Z.length>0){console.log(B.bold(`
|
|
434
440
|
\uD83C\uDDEA\uD83C\uDDF8 Spanish:`));for(let X of Z)console.log(` ${X}`)}if(Q.length>0){console.log(B.bold(`
|
|
435
441
|
\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
|
|
442
|
+
Use with: glance <url> --voice <voice-name> --read`))}catch(_){throw E.error("Failed to list voices:",_),_}}async function eq(){let _=d("Detecting available services...");_.start();try{let[$,q,Z]=await Promise.all([s2("ollama").catch(()=>({valid:!1,error:"Connection failed"})),s2("openai").catch(()=>({valid:!1,error:"API key missing"})),s2("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");r3(J)}catch($){throw _.fail("Service detection failed"),E.error("Service detection error:",$),r3({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 _Z(){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
443
|
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
444
|
\uD83D\uDCE6 Available Ollama Models (${Z.models.length}):
|
|
439
445
|
`)),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
446
|
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
|
|
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=
|
|
443
|
-
Current Page: ${Y}`)),J.description)console.log(B.dim(`Description: ${J.description}`));console.log(""),await
|
|
447
|
+
Cannot connect to Ollama. Make sure it's running:`)),console.log(B.cyan(" ollama serve")),q}}function G5(_,$){let q=oq.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 W=new URL(H),F=new URL($),L=W.hostname===F.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
|
|
448
|
+
`));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=G5(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(`
|
|
449
|
+
Current Page: ${Y}`)),J.description)console.log(B.dim(`Description: ${J.description}`));console.log(""),await uV(Q,_,Y)}catch($){throw new m($ instanceof Error?$.message:String($),O0.FETCH_FAILED,"Failed to start browse mode",!1)}}async function uV(_,$,q){let Z=yV({input:process.stdin,output:process.stdout}),Q=[$],X=_,J=$,Y=q,K="all",H=()=>{let U=1,W=new Map;if(K==="all"||K==="nav"){if(X.navigation.length>0){if(K==="nav")console.log(B.magenta(`
|
|
444
450
|
\uD83E\uDDED Navigation Links Only (${X.navigation.length} total):`));else console.log(B.magenta(`
|
|
445
|
-
Navigation Links (${X.navigation.length} total):`));X.navigation.forEach((
|
|
451
|
+
Navigation Links (${X.navigation.length} total):`));X.navigation.forEach((F)=>{let L=F.text||"Link";console.log(B.cyan(` ${U}. `)+B.blue.underline(F.href)),W.set(U,{href:F.href,text:F.text}),U++})}}if(K==="all"||K==="external"){if(X.external.length>0){if(K==="external")console.log(B.yellow(`
|
|
446
452
|
\uD83C\uDF0D External Links Only (${X.external.length} total):`));else console.log(B.yellow(`
|
|
447
|
-
External Links (${X.external.length} total):`));X.external.forEach((
|
|
448
|
-
Current Page: ${q}`));let U=H(),
|
|
449
|
-
Commands:`)),console.log(B.dim(` 1-${
|
|
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
|
|
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=
|
|
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=
|
|
453
|
+
External Links (${X.external.length} total):`));X.external.forEach((F)=>{let L=F.text||"Link";console.log(B.cyan(` ${U}. `)+B.blue.underline(F.href)),W.set(U,{href:F.href,text:F.text}),U++})}}return W},V=null,G=null;while(!0){console.clear(),console.log(B.bold.cyan(`
|
|
454
|
+
Current Page: ${q}`));let U=H(),W=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(`
|
|
455
|
+
Commands:`)),console.log(B.dim(` 1-${W}: 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(`
|
|
456
|
+
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 F;try{F=await new Promise((D,j)=>{if(Z.question(B.yellow(`
|
|
457
|
+
> `),(P)=>{D(P)}),Z.closed)j(new Error("Readline interface was closed"))})}catch(D){console.log(B.yellow("Browse mode ended"));break}let L=F.trim().toLowerCase();if(L==="q"||L==="quit"){console.log(B.green(`
|
|
458
|
+
\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=G5(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
459
|
`);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=
|
|
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=
|
|
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-${
|
|
460
|
+
`}),G="h",V=D.trim();continue}let A=F.trim().split(/\s+/),z=Number.parseInt(A[0]||"");if(z>=1&&z<=W){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}=vV({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 e2(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:
|
|
461
|
+
`)+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=G5(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 e2(j,{tldr:!0,disableStdinHandling:!0});G=A[0]||"",V=B.bold.green(`\uD83D\uDCC4 Summary:
|
|
462
|
+
`)+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-${W}`));else console.log(B.yellow("Invalid command. Type 'q' to quit or a number to navigate."))}Z.close()}function dV(){try{let{values:_,positionals:$}=mV({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 U5(){try{let{values:_,positionals:$}=dV();if(_.help)kq(),process.exit(0);if(_.version)Iq(),process.exit(0);if(_["list-voices"])await sq(),process.exit(0);if(_["check-services"])await eq(),process.exit(0);if(_["list-models"])await _Z(),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=V5(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=V5(q);if(!Z.valid)console.error(B.red(`Error: ${Z.error}`)),process.exit(1);if(_.language){let Y=iq(_.language);if(!Y.valid)console.error(B.red(`Error: ${Y.error}`)),process.exit(1)}let Q;if(_["max-tokens"]){let Y=nq(_["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 e2(q,X);if(!X.stream&&!X.read&&!X.audioOutput)console.log(J)}catch(_){if(_ instanceof m){if(console.error(Oq(_)),_.hint)console.log(B.yellow(`
|
|
457
463
|
\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"))
|
|
464
|
+
❌ 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"))U5();U5().catch((_)=>{console.error("Fatal error:",_),process.exit(1)});
|