@visulima/cerebro 1.1.30 → 1.1.32

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.
@@ -1,3 +1,374 @@
1
- var zt=Object.defineProperty;var v=(s,t)=>zt(s,"name",{value:t,configurable:!0});import{existsSync as wt,readFileSync as Dt,mkdirSync as Rt,writeFileSync as Gt}from"node:fs";import{findCacheDirSync as Bt}from"@visulima/find-cache-dir";import{get as Ut}from"node:https";var Ft=Object.defineProperty,Zt=v((s,t)=>Ft(s,"name",{value:t,configurable:!0}),"o$1");const _t=Zt((s,t)=>{const e=s.split(".").map(Number),i=t.split(".").map(Number);for(const[n,r]of e.entries()){if(r>i[n])return!0;if(r<i[n])return!1}return!1},"semverGt");var It=Object.defineProperty,x=v((s,t)=>It(s,"name",{value:t,configurable:!0}),"w"),Jt=Object.defineProperty,y=x((s,t)=>Jt(s,"name",{value:t,configurable:!0}),"y");function X(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}v(X,"Y");x(X,"Wt");y(X,"getDefaultExportFromCjs");var V,pt;function Y(){if(pt)return V;pt=1;var s=Object.defineProperty,t=y((r,o)=>s(r,"name",{value:o,configurable:!0}),"u");V=e;function e(r,o,a){r instanceof RegExp&&(r=i(r,a)),o instanceof RegExp&&(o=i(o,a));var h=n(r,o,a);return h&&{start:h[0],end:h[1],pre:a.slice(0,h[0]),body:a.slice(h[0]+r.length,h[1]),post:a.slice(h[1]+o.length)}}v(e,"e"),x(e,"e"),y(e,"balanced"),t(e,"balanced");function i(r,o){var a=o.match(r);return a?a[0]:null}v(i,"s"),x(i,"s"),y(i,"maybeMatch"),t(i,"maybeMatch"),e.range=n;function n(r,o,a){var h,c,l,g,u,p=a.indexOf(r),f=a.indexOf(o,p+1),m=p;if(p>=0&&f>0){if(r===o)return[p,f];for(h=[],l=a.length;m>=0&&!u;)m==p?(h.push(m),p=a.indexOf(r,m+1)):h.length==1?u=[h.pop(),f]:(c=h.pop(),c<l&&(l=c,g=f),f=a.indexOf(o,m+1)),m=p<f&&p>=0?p:f;h.length&&(u=[l,g])}return u}return v(n,"i"),x(n,"r"),y(n,"range"),t(n,"range"),V}v(Y,"xt");x(Y,"Ct");y(Y,"requireBalancedMatch");var K,ut;function tt(){if(ut)return K;ut=1;var s=Object.defineProperty,t=y((d,O)=>s(d,"name",{value:O,configurable:!0}),"o"),e=Y();K=u;var i="\0SLASH"+Math.random()+"\0",n="\0OPEN"+Math.random()+"\0",r="\0CLOSE"+Math.random()+"\0",o="\0COMMA"+Math.random()+"\0",a="\0PERIOD"+Math.random()+"\0";function h(d){return parseInt(d,10)==d?parseInt(d,10):d.charCodeAt(0)}v(h,"h"),x(h,"h"),y(h,"numeric"),t(h,"numeric");function c(d){return d.split("\\\\").join(i).split("\\{").join(n).split("\\}").join(r).split("\\,").join(o).split("\\.").join(a)}v(c,"c"),x(c,"c"),y(c,"escapeBraces"),t(c,"escapeBraces");function l(d){return d.split(i).join("\\").split(n).join("{").split(r).join("}").split(o).join(",").split(a).join(".")}v(l,"l"),x(l,"l"),y(l,"unescapeBraces"),t(l,"unescapeBraces");function g(d){if(!d)return[""];var O=[],S=e("{","}",d);if(!S)return d.split(",");var w=S.pre,G=S.body,W=S.post,P=w.split(",");P[P.length-1]+="{"+G+"}";var L=g(W);return W.length&&(P[P.length-1]+=L.shift(),P.push.apply(P,L)),O.push.apply(O,P),O}v(g,"g"),x(g,"g"),y(g,"parseCommaParts"),t(g,"parseCommaParts");function u(d){return d?(d.substr(0,2)==="{}"&&(d="\\{\\}"+d.substr(2)),j(c(d),!0).map(l)):[]}v(u,"u"),x(u,"u"),y(u,"expandTop"),t(u,"expandTop");function p(d){return"{"+d+"}"}v(p,"p"),x(p,"p"),y(p,"embrace"),t(p,"embrace");function f(d){return/^-?0\d/.test(d)}v(f,"f"),x(f,"f"),y(f,"isPadded"),t(f,"isPadded");function m(d,O){return d<=O}v(m,"m"),x(m,"m"),y(m,"lte"),t(m,"lte");function A(d,O){return d>=O}v(A,"O"),x(A,"M"),y(A,"gte"),t(A,"gte");function j(d,O){var S=[],w=e("{","}",d);if(!w)return[d];var G=w.pre,W=w.post.length?j(w.post,!1):[""];if(/\$$/.test(w.pre))for(var P=0;P<W.length;P++){var L=G+"{"+w.body+"}"+W[P];S.push(L)}else{var jt=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(w.body),rt=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(w.body),_=jt||rt,Tt=w.body.indexOf(",")>=0;if(!_&&!Tt)return w.post.match(/,.*\}/)?(d=w.pre+"{"+w.body+r+w.post,j(d)):[d];var $;if(_)$=w.body.split(/\.\./);else if($=g(w.body),$.length===1&&($=j($[0],!1).map(p),$.length===1))return W.map(function(Lt){return w.pre+$[0]+Lt});var z;if(_){var nt=h($[0]),ot=h($[1]),Ct=Math.max($[0].length,$[1].length),at=$.length==3?Math.abs(h($[2])):1,ht=m,kt=ot<nt;kt&&(at*=-1,ht=A);var Wt=$.some(f);z=[];for(var B=nt;ht(B,ot);B+=at){var k;if(rt)k=String.fromCharCode(B),k==="\\"&&(k="");else if(k=String(B),Wt){var ct=Ct-k.length;if(ct>0){var lt=new Array(ct+1).join("0");B<0?k="-"+lt+k.slice(1):k=lt+k}}z.push(k)}}else{z=[];for(var D=0;D<$.length;D++)z.push.apply(z,j($[D],!1))}for(var D=0;D<z.length;D++)for(var P=0;P<W.length;P++){var L=G+z[D]+W[P];(!O||_||L)&&S.push(L)}}return S}return v(j,"$"),x(j,"A"),y(j,"expand"),t(j,"expand"),K}v(tt,"St");x(tt,"Rt");y(tt,"requireBraceExpansion");var qt=tt();const Ht=X(qt);var Vt=Object.defineProperty,Kt=y((s,t)=>Vt(s,"name",{value:t,configurable:!0}),"r$1");const J=Kt(s=>{if(typeof s!="string")throw new TypeError("invalid pattern");if(s.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Qt=Object.defineProperty,q=y((s,t)=>Qt(s,"name",{value:t,configurable:!0}),"p$1");const Xt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},U=q(s=>s.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Yt=q(s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),ft=q(s=>s.join(""),"rangesToString"),te=q((s,t)=>{const e=t;if(s.charAt(e)!=="[")throw new Error("not in a brace expression");const i=[],n=[];let r=e+1,o=!1,a=!1,h=!1,c=!1,l=e,g="";t:for(;r<s.length;){const f=s.charAt(r);if((f==="!"||f==="^")&&r===e+1){c=!0,r++;continue}if(f==="]"&&o&&!h){l=r+1;break}if(o=!0,f==="\\"&&!h){h=!0,r++;continue}if(f==="["&&!h){for(const[m,[A,j,d]]of Object.entries(Xt))if(s.startsWith(m,r)){if(g)return["$.",!1,s.length-e,!0];r+=m.length,d?n.push(A):i.push(A),a=a||j;continue t}}if(h=!1,g){f>g?i.push(U(g)+"-"+U(f)):f===g&&i.push(U(f)),g="",r++;continue}if(s.startsWith("-]",r+1)){i.push(U(f+"-")),r+=2;continue}if(s.startsWith("-",r+1)){g=f,r+=2;continue}i.push(U(f)),r++}if(l<r)return["",!1,0,!1];if(!i.length&&!n.length)return["$.",!1,s.length-e,!0];if(n.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!c){const f=i[0].length===2?i[0].slice(-1):i[0];return[Yt(f),!1,l-e,!1]}const u="["+(c?"^":"")+ft(i)+"]",p="["+(c?"":"^")+ft(n)+"]";return[i.length&&n.length?"("+u+"|"+p+")":i.length?u:p,a,l-e,!0]},"parseClass");var ee=Object.defineProperty,se=y((s,t)=>ee(s,"name",{value:t,configurable:!0}),"a$2");const F=se((s,{windowsPathsNoEscape:t=!1}={})=>t?s.replace(/\[([^\/\\])\]/g,"$1"):s.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var ie=Object.defineProperty,et=y((s,t)=>ie(s,"name",{value:t,configurable:!0}),"E$1");const re=new Set(["!","?","+","*","@"]),gt=et(s=>re.has(s),"isExtglobType"),ne="(?!(?:^|/)\\.\\.?(?:$|/))",I="(?!\\.)",oe=new Set(["[","."]),ae=new Set(["..","."]),he=new Set("().*{}+?[]^$\\!"),ce=et(s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),st="[^/]",dt=st+"*?",mt=st+"+?";class M{static{v(this,"j")}static{x(this,"O")}static{y(this,"AST")}static{et(this,"AST")}type;#s;#i;#n=!1;#t=[];#e;#o;#h;#a=!1;#r;#c;#p=!1;constructor(t,e,i={}){this.type=t,t&&(this.#i=!0),this.#e=e,this.#s=this.#e?this.#e.#s:this,this.#r=this.#s===this?i:this.#s.#r,this.#h=this.#s===this?[]:this.#s.#h,t==="!"&&!this.#s.#a&&this.#h.push(this),this.#o=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(const t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#c=this.#t.map(t=>String(t)).join("")}#f(){if(this!==this.#s)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let t;for(;t=this.#h.pop();){if(t.type!=="!")continue;let e=t,i=e.#e;for(;i;){for(let n=e.#o+1;!i.type&&n<i.#t.length;n++)for(const r of t.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(i.#t[n])}e=i,i=e.#e}}return this}push(...t){for(const e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof M&&e.#e===this))throw new Error("invalid part: "+e);this.#t.push(e)}}toJSON(){const t=this.type===null?this.#t.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#t.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#s||this.#s.#a&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#s===this)return!0;if(!this.#e?.isStart())return!1;if(this.#o===0)return!0;const t=this.#e;for(let e=0;e<this.#o;e++){const i=t.#t[e];if(!(i instanceof M&&i.type==="!"))return!1}return!0}isEnd(){if(this.#s===this||this.#e?.type==="!")return!0;if(!this.#e?.isEnd())return!1;if(!this.type)return this.#e?.isEnd();const t=this.#e?this.#e.#t.length:0;return this.#o===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){const e=new M(this.type,t);for(const i of this.#t)e.copyIn(i);return e}static#l(t,e,i,n){let r=!1,o=!1,a=-1,h=!1;if(e.type===null){let p=i,f="";for(;p<t.length;){const m=t.charAt(p++);if(r||m==="\\"){r=!r,f+=m;continue}if(o){p===a+1?(m==="^"||m==="!")&&(h=!0):m==="]"&&!(p===a+2&&h)&&(o=!1),f+=m;continue}else if(m==="["){o=!0,a=p,h=!1,f+=m;continue}if(!n.noext&&gt(m)&&t.charAt(p)==="("){e.push(f),f="";const A=new M(m,e);p=M.#l(t,A,p,n),e.push(A);continue}f+=m}return e.push(f),p}let c=i+1,l=new M(null,e);const g=[];let u="";for(;c<t.length;){const p=t.charAt(c++);if(r||p==="\\"){r=!r,u+=p;continue}if(o){c===a+1?(p==="^"||p==="!")&&(h=!0):p==="]"&&!(c===a+2&&h)&&(o=!1),u+=p;continue}else if(p==="["){o=!0,a=c,h=!1,u+=p;continue}if(gt(p)&&t.charAt(c)==="("){l.push(u),u="";const f=new M(p,l);l.push(f),c=M.#l(t,f,c,n);continue}if(p==="|"){l.push(u),u="",g.push(l),l=new M(null,e);continue}if(p===")")return u===""&&e.#t.length===0&&(e.#p=!0),l.push(u),u="",e.push(...g,l),c;u+=p}return e.type=null,e.#i=void 0,e.#t=[t.substring(i-1)],c}static fromGlob(t,e={}){const i=new M(null,void 0,e);return M.#l(t,i,0,e),i}toMMPattern(){if(this!==this.#s)return this.#s.toMMPattern();const t=this.toString(),[e,i,n,r]=this.toRegExpSource();if(!(n||this.#i||this.#r.nocase&&!this.#r.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;const o=(this.#r.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,o),{_src:e,_glob:t})}get options(){return this.#r}toRegExpSource(t){const e=t??!!this.#r.dot;if(this.#s===this&&this.#f(),!this.type){const h=this.isStart()&&this.isEnd(),c=this.#t.map(u=>{const[p,f,m,A]=typeof u=="string"?M.#g(u,this.#i,h):u.toRegExpSource(t);return this.#i=this.#i||m,this.#n=this.#n||A,p}).join("");let l="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&ae.has(this.#t[0]))){const u=oe,p=e&&u.has(c.charAt(0))||c.startsWith("\\.")&&u.has(c.charAt(2))||c.startsWith("\\.\\.")&&u.has(c.charAt(4)),f=!e&&!t&&u.has(c.charAt(0));l=p?ne:f?I:""}let g="";return this.isEnd()&&this.#s.#a&&this.#e?.type==="!"&&(g="(?:$|\\/)"),[l+c+g,F(c),this.#i=!!this.#i,this.#n]}const i=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:";let r=this.#u(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){const h=this.toString();return this.#t=[h],this.type=null,this.#i=void 0,[h,F(this.toString()),!1,!1]}let o=!i||t||e||!I?"":this.#u(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#p)a=(this.isStart()&&!e?I:"")+mt;else{const h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?I:"")+dt+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=n+r+h}return[a,F(r),this.#i=!!this.#i,this.#n]}#u(t){return this.#t.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");const[i,n,r,o]=e.toRegExpSource(t);return this.#n=this.#n||o,i}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#g(t,e,i=!1){let n=!1,r="",o=!1;for(let a=0;a<t.length;a++){const h=t.charAt(a);if(n){n=!1,r+=(he.has(h)?"\\":"")+h;continue}if(h==="\\"){a===t.length-1?r+="\\\\":n=!0;continue}if(h==="["){const[c,l,g,u]=te(t,a);if(g){r+=c,o=o||l,a+=g-1,e=e||u;continue}}if(h==="*"){i&&t==="*"?r+=mt:r+=dt,e=!0;continue}if(h==="?"){r+=st,e=!0;continue}r+=ce(h)}return[r,F(t),!!e,o]}}var le=Object.defineProperty,pe=y((s,t)=>le(s,"name",{value:t,configurable:!0}),"a$1");const ue=pe((s,{windowsPathsNoEscape:t=!1}={})=>t?s.replace(/[?*()[\]]/g,"[$&]"):s.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var fe=Object.defineProperty,b=y((s,t)=>fe(s,"name",{value:t,configurable:!0}),"h$1");const E=b((s,t,e={})=>(J(t),!e.nocomment&&t.charAt(0)==="#"?!1:new H(t,e).match(s)),"minimatch"),ge=/^\*+([^+@!?\*\[\(]*)$/,de=b(s=>t=>!t.startsWith(".")&&t.endsWith(s),"starDotExtTest"),me=b(s=>t=>t.endsWith(s),"starDotExtTestDot"),be=b(s=>(s=s.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(s)),"starDotExtTestNocase"),ye=b(s=>(s=s.toLowerCase(),t=>t.toLowerCase().endsWith(s)),"starDotExtTestNocaseDot"),ve=/^\*+\.\*+$/,we=b(s=>!s.startsWith(".")&&s.includes("."),"starDotStarTest"),xe=b(s=>s!=="."&&s!==".."&&s.includes("."),"starDotStarTestDot"),Oe=/^\.\*+$/,$e=b(s=>s!=="."&&s!==".."&&s.startsWith("."),"dotStarTest"),Ee=/^\*+$/,Se=b(s=>s.length!==0&&!s.startsWith("."),"starTest"),Pe=b(s=>s.length!==0&&s!=="."&&s!=="..","starTestDot"),Me=/^\?+([^+@!?\*\[\(]*)?$/,Ae=b(([s,t=""])=>{const e=xt([s]);return t?(t=t.toLowerCase(),i=>e(i)&&i.toLowerCase().endsWith(t)):e},"qmarksTestNocase"),Ne=b(([s,t=""])=>{const e=Ot([s]);return t?(t=t.toLowerCase(),i=>e(i)&&i.toLowerCase().endsWith(t)):e},"qmarksTestNocaseDot"),je=b(([s,t=""])=>{const e=Ot([s]);return t?i=>e(i)&&i.endsWith(t):e},"qmarksTestDot"),Te=b(([s,t=""])=>{const e=xt([s]);return t?i=>e(i)&&i.endsWith(t):e},"qmarksTest"),xt=b(([s])=>{const t=s.length;return e=>e.length===t&&!e.startsWith(".")},"qmarksTestNoExt"),Ot=b(([s])=>{const t=s.length;return e=>e.length===t&&e!=="."&&e!==".."},"qmarksTestNoExtDot"),$t=process?process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",bt={win32:{sep:"\\"},posix:{sep:"/"}},Ce=$t==="win32"?bt.win32.sep:bt.posix.sep;E.sep=Ce;const C=Symbol("globstar **");E.GLOBSTAR=C;const ke="[^/]",We=ke+"*?",Le="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ze="(?:(?!(?:\\/|^)\\.).)*?",De=b((s,t={})=>e=>E(e,s,t),"filter");E.filter=De;const T=b((s,t={})=>Object.assign({},s,t),"ext"),Re=b(s=>{if(!s||typeof s!="object"||!Object.keys(s).length)return E;const t=E;return Object.assign(b((e,i,n={})=>t(e,i,T(s,n)),"m"),{Minimatch:class extends t.Minimatch{static{v(this,"Minimatch")}static{x(this,"Minimatch")}static{y(this,"Minimatch")}static{b(this,"Minimatch")}constructor(e,i={}){super(e,T(s,i))}static defaults(e){return t.defaults(T(s,e)).Minimatch}},AST:class extends t.AST{static{v(this,"AST")}static{x(this,"AST")}static{y(this,"AST")}static{b(this,"AST")}constructor(e,i,n={}){super(e,i,T(s,n))}static fromGlob(e,i={}){return t.AST.fromGlob(e,T(s,i))}},unescape:b((e,i={})=>t.unescape(e,T(s,i)),"unescape"),escape:b((e,i={})=>t.escape(e,T(s,i)),"escape"),filter:b((e,i={})=>t.filter(e,T(s,i)),"filter"),defaults:b(e=>t.defaults(T(s,e)),"defaults"),makeRe:b((e,i={})=>t.makeRe(e,T(s,i)),"makeRe"),braceExpand:b((e,i={})=>t.braceExpand(e,T(s,i)),"braceExpand"),match:b((e,i,n={})=>t.match(e,i,T(s,n)),"match"),sep:t.sep,GLOBSTAR:C})},"defaults");E.defaults=Re;const Et=b((s,t={})=>(J(s),t.nobrace||!/\{(?:(?!\{).)*\}/.test(s)?[s]:Ht(s)),"braceExpand");E.braceExpand=Et;const Ge=b((s,t={})=>new H(s,t).makeRe(),"makeRe");E.makeRe=Ge;const Be=b((s,t,e={})=>{const i=new H(t,e);return s=s.filter(n=>i.match(n)),i.options.nonull&&!s.length&&s.push(t),s},"match");E.match=Be;const yt=/[?*]|[+@!]\(.*?\)|\[|\]/,Ue=b(s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape");class H{static{v(this,"U")}static{x(this,"H")}static{y(this,"Minimatch")}static{b(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){J(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||$t,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);const i=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let n=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){const h=r[0]===""&&r[1]===""&&(r[2]==="?"||!yt.test(r[2]))&&!yt.test(r[3]),c=/^[a-z]:/i.test(r[0]);if(h)return[...r.slice(0,4),...r.slice(4).map(l=>this.parse(l))];if(c)return[r[0],...r.slice(1).map(l=>this.parse(l))]}return r.map(h=>this.parse(h))});if(this.debug(this.pattern,n),this.set=n.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){const o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i=0;i<t.length;i++)for(let n=0;n<t[i].length;n++)t[i][n]==="**"&&(t[i][n]="*");const{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let i=-1;for(;(i=e.indexOf("**",i+1))!==-1;){let n=i;for(;e[n+1]==="**";)n++;n!==i&&e.splice(i,n-i)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((i,n)=>{const r=i[i.length-1];return n==="**"&&r==="**"?i:n===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(i.pop(),i):(i.push(n),i)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;n<t.length-1;n++){const r=t[n];n===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(n,1),n--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){const n=t[i-1];n&&n!=="."&&n!==".."&&n!=="**"&&(e=!0,t.splice(i-1,2),i-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let i of t){let n=-1;for(;(n=i.indexOf("**",n+1))!==-1;){let o=n;for(;i[o+1]==="**";)o++;o>n&&i.splice(n+1,o-n);let a=i[n+1];const h=i[n+2],c=i[n+3];if(a!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;e=!0,i.splice(n,1);const l=i.slice(0);l[n]="**",t.push(l),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<i.length-1;o++){const a=i[o];o===1&&a===""&&i[0]===""||(a==="."||a==="")&&(e=!0,i.splice(o,1),o--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(e=!0,i.pop())}let r=0;for(;(r=i.indexOf("..",r+1))!==-1;){const o=i[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;const a=r===1&&i[r+1]==="**"?["."]:[];i.splice(r-1,2,...a),i.length===0&&i.push(""),r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let i=e+1;i<t.length;i++){const n=this.partsMatch(t[e],t[i],!this.preserveMultipleSlashes);if(n){t[e]=[],t[i]=n;break}}return t.filter(e=>e.length)}partsMatch(t,e,i=!1){let n=0,r=0,o=[],a="";for(;n<t.length&&r<e.length;)if(t[n]===e[r])o.push(a==="b"?e[r]:t[n]),n++,r++;else if(i&&t[n]==="**"&&e[r]===t[n+1])o.push(t[n]),n++;else if(i&&e[r]==="**"&&t[n]===e[r+1])o.push(e[r]),r++;else if(t[n]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(a==="b")return!1;a="a",o.push(t[n]),n++,r++}else if(e[r]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(a==="a")return!1;a="b",o.push(e[r]),n++,r++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=!1,i=0;for(let n=0;n<t.length&&t.charAt(n)==="!";n++)e=!e,i++;i&&(this.pattern=t.slice(i)),this.negate=e}matchOne(t,e,i=!1){const n=this.options;if(this.isWindows){const m=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),A=!m&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),j=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),d=!j&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),O=A?3:m?0:void 0,S=d?3:j?0:void 0;if(typeof O=="number"&&typeof S=="number"){const[w,G]=[t[O],e[S]];w.toLowerCase()===G.toLowerCase()&&(e[S]=w,S>O?e=e.slice(S):O>S&&(t=t.slice(O)))}}const{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var o=0,a=0,h=t.length,c=e.length;o<h&&a<c;o++,a++){this.debug("matchOne loop");var l=e[a],g=t[o];if(this.debug(e,l,g),l===!1)return!1;if(l===C){this.debug("GLOBSTAR",[e,l,g]);var u=o,p=a+1;if(p===c){for(this.debug("** at the end");o<h;o++)if(t[o]==="."||t[o]===".."||!n.dot&&t[o].charAt(0)===".")return!1;return!0}for(;u<h;){var f=t[u];if(this.debug(`
2
- globstar while`,t,u,e,p,f),this.matchOne(t.slice(u),e.slice(p),i))return this.debug("globstar found match!",u,h,f),!0;if(f==="."||f===".."||!n.dot&&f.charAt(0)==="."){this.debug("dot detected!",t,u,e,p);break}this.debug("globstar swallow a segment, and continue"),u++}return!!(i&&(this.debug(`
3
- >>> no match, partial?`,t,u,e,p),u===h))}let m;if(typeof l=="string"?(m=g===l,this.debug("string match",l,g,m)):(m=l.test(g),this.debug("pattern match",l,g,m)),!m)return!1}if(o===h&&a===c)return!0;if(o===h)return i;if(a===c)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Et(this.pattern,this.options)}parse(t){J(t);const e=this.options;if(t==="**")return C;if(t==="")return"";let i,n=null;(i=t.match(Ee))?n=e.dot?Pe:Se:(i=t.match(ge))?n=(e.nocase?e.dot?ye:be:e.dot?me:de)(i[1]):(i=t.match(Me))?n=(e.nocase?e.dot?Ne:Ae:e.dot?je:Te)(i):(i=t.match(ve))?n=e.dot?xe:we:(i=t.match(Oe))&&(n=$e);const r=M.fromGlob(t,this.options).toMMPattern();return n&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:n}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const e=this.options,i=e.noglobstar?We:e.dot?Le:ze,n=new Set(e.nocase?["i"]:[]);let r=t.map(h=>{const c=h.map(l=>{if(l instanceof RegExp)for(const g of l.flags.split(""))n.add(g);return typeof l=="string"?Ue(l):l===C?C:l._src});return c.forEach((l,g)=>{const u=c[g+1],p=c[g-1];l!==C||p===C||(p===void 0?u!==void 0&&u!==C?c[g+1]="(?:\\/|"+i+"\\/)?"+u:c[g]=i:u===void 0?c[g-1]=p+"(?:\\/|"+i+")?":u!==C&&(c[g-1]=p+"(?:\\/|\\/"+i+"\\/)"+u,c[g+1]=C))}),c.filter(l=>l!==C).join("/")}).join("|");const[o,a]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...n].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;const i=this.options;this.isWindows&&(t=t.split("\\").join("/"));const n=this.slashSplit(t);this.debug(this.pattern,"split",n);const r=this.set;this.debug(this.pattern,"set",r);let o=n[n.length-1];if(!o)for(let a=n.length-2;!o&&a>=0;a--)o=n[a];for(let a=0;a<r.length;a++){const h=r[a];let c=n;if(i.matchBase&&h.length===1&&(c=[o]),this.matchOne(c,h,e))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return E.defaults(t).Minimatch}}E.AST=M;E.Minimatch=H;E.escape=ue;E.unescape=F;var Fe=Object.defineProperty,Ze=y((s,t)=>Fe(s,"name",{value:t,configurable:!0}),"t");const _e=/^[A-Z]:\//i,R=Ze((s="")=>s&&s.replaceAll("\\","/").replace(_e,t=>t.toUpperCase()),"normalizeWindowsPath");var Ie=Object.defineProperty,N=y((s,t)=>Ie(s,"name",{value:t,configurable:!0}),"r");const Je=/^[/\\]{2}/,qe=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,St=/^[A-Z]:$/i,vt=/^\/([A-Z]:)?$/i,He=/.(\.[^./]+)$/,Ve=/^[/\\]|^[a-z]:[/\\]/i,Ke=N(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Pt=N((s,t)=>{let e="",i=0,n=-1,r=0,o=null;for(let a=0;a<=s.length;++a){if(a<s.length)o=s[a];else{if(o==="/")break;o="/"}if(o==="/"){if(!(n===a-1||r===1))if(r===2){if(e.length<2||i!==2||!e.endsWith(".")||e.at(-2)!=="."){if(e.length>2){const h=e.lastIndexOf("/");h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),n=a,r=0;continue}else if(e.length>0){e="",i=0,n=a,r=0;continue}}t&&(e+=e.length>0?"/..":"..",i=2)}else e.length>0?e+=`/${s.slice(n+1,a)}`:e=s.slice(n+1,a),i=a-n-1;n=a,r=0}else o==="."&&r!==-1?++r:r=-1}return e},"normalizeString"),Z=N(s=>qe.test(s),"isAbsolute"),Mt=N(function(s){if(s.length===0)return".";s=R(s);const t=Je.exec(s),e=Z(s),i=s.at(-1)==="/";return s=Pt(s,!e),s.length===0?e?"/":i?"./":".":(i&&(s+="/"),St.test(s)&&(s+="/"),t?e?`//${s}`:`//./${s}`:e&&!Z(s)?`/${s}`:s)},"normalize"),Qe=N((...s)=>{let t="";for(const e of s)if(e)if(t.length>0){const i=t[t.length-1]==="/",n=e[0]==="/";i&&n?t+=e.slice(1):t+=i||n?e:`/${e}`}else t+=e;return Mt(t)},"join"),Q=N(function(...s){s=s.map(i=>R(i));let t="",e=!1;for(let i=s.length-1;i>=-1&&!e;i--){const n=i>=0?s[i]:Ke();!n||n.length===0||(t=`${n}/${t}`,e=Z(n))}return t=Pt(t,!e),e&&!Z(t)?`/${t}`:t.length>0?t:"."},"resolve");N(function(s){return R(s)},"toNamespacedPath");const Xe=N(function(s){return He.exec(R(s))?.[1]??""},"extname");N(function(s,t){const e=Q(s).replace(vt,"$1").split("/"),i=Q(t).replace(vt,"$1").split("/");if(i[0][1]===":"&&e[0][1]===":"&&e[0]!==i[0])return i.join("/");const n=[...e];for(const r of n){if(i[0]!==r)break;e.shift(),i.shift()}return[...e.map(()=>".."),...i].join("/")},"relative");const At=N(s=>{const t=R(s).replace(/\/$/,"").split("/").slice(0,-1);return t.length===1&&St.test(t[0])&&(t[0]+="/"),t.join("/")||(Z(s)?"/":".")},"dirname");N(function(s){const t=[s.root,s.dir,s.base??s.name+s.ext].filter(Boolean);return R(s.root?Q(...t):t.join("/"))},"format");const Ye=N((s,t)=>{const e=R(s).split("/").pop();return t&&e.endsWith(t)?e.slice(0,-t.length):e},"basename");N(function(s){const t=Ve.exec(s)?.[0]?.replace(/\\/g,"/")??"",e=Ye(s),i=Xe(e);return{base:e,dir:At(s),ext:i,name:e.slice(0,e.length-i.length),root:t}},"parse");N((s,t)=>E(Mt(s),t,{nocaseMagicOnly:!0,nocomment:!0,nonegate:!0,optimizationLevel:2,windowsPathsNoEscape:!0}),"matchesGlob");var ts=Object.defineProperty,it=v((s,t)=>ts(s,"name",{value:t,configurable:!0}),"r");const es="last-update-check.json",Nt=it(s=>{const t=Bt(s);if(t===void 0)throw new Error("Could not find cache directory");return Qe(t,es)},"getConfigFile"),ss=it(s=>{const t=Nt(s);try{if(!wt(t))return;const{lastUpdateCheck:e}=JSON.parse(Dt(t,"utf8"));return e}catch{return}},"getLastUpdate"),is=it(s=>{const t=Nt(s),e=At(t);wt(e)||Rt(e,{recursive:!0}),Gt(t,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var rs=Object.defineProperty,ns=v((s,t)=>rs(s,"name",{value:t,configurable:!0}),"g");const os=ns(async(s,t,e)=>{const i=e.replace("__NAME__",s);return await new Promise((n,r)=>{Ut(i,o=>{let a="";o.on("data",h=>a+=h),o.on("end",()=>{try{const h=JSON.parse(a)[t];h||r(new Error("Error getting version")),n(h)}catch{r(new Error("Could not parse version response"))}})}).on("error",o=>r(o))})},"getDistributionVersion");var as=Object.defineProperty,hs=v((s,t)=>as(s,"name",{value:t,configurable:!0}),"i");const fs=hs(async({alwaysRun:s,debug:t,distTag:e="latest",pkg:i,registryUrl:n="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:r=1e3*60*60*24})=>{const o=ss(i.name);if(s||!o||o<Date.now()-r){const a=await os(i.name,e,n);if(is(i.name),_t(a,i.version))return a;t&&console.error(`Latest version (${a}) not newer than current version (${i.version})`)}else t&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${r}ms but only ${Date.now()-o}ms since last check.`);return null},"hasNewVersion");export{fs as default};
1
+ import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
2
+ import { findCacheDirSync } from '@visulima/find-cache-dir';
3
+ import { get } from 'node:https';
4
+
5
+ var __defProp$4 = Object.defineProperty;
6
+ var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
7
+ const semverGt = /* @__PURE__ */ __name$4((version1, version2) => {
8
+ const v1Components = version1.split(".").map(Number);
9
+ const v2Components = version2.split(".").map(Number);
10
+ for (const [index, v1Component] of v1Components.entries()) {
11
+ if (v1Component > v2Components[index]) {
12
+ return true;
13
+ }
14
+ if (v1Component < v2Components[index]) {
15
+ return false;
16
+ }
17
+ }
18
+ return false;
19
+ }, "semverGt");
20
+
21
+ var __defProp$3 = Object.defineProperty;
22
+ var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
23
+ var $t = Object.defineProperty;
24
+ var Z = /* @__PURE__ */ __name$3((r, i) => $t(r, "name", { value: i, configurable: true }), "Z");
25
+ var bt = Object.defineProperty;
26
+ var vt = Z((r, i) => bt(r, "name", { value: i, configurable: true }), "t");
27
+ const yt = /^[A-Z]:\//i;
28
+ const w = vt((r = "") => r && r.replaceAll("\\", "/").replace(yt, (i) => i.toUpperCase()), "normalizeWindowsPath");
29
+ var At = Object.defineProperty;
30
+ var s = Z((r, i) => At(r, "name", { value: i, configurable: true }), "u$1");
31
+ let ie = s(() => {
32
+ var r = (() => {
33
+ var i = Object.defineProperty, a = Object.getOwnPropertyDescriptor, p = Object.getOwnPropertyNames, h = Object.prototype.hasOwnProperty, x = s((e, t) => {
34
+ for (var n in t) i(e, n, { get: t[n], enumerable: true });
35
+ }, "q"), A = s((e, t, n, o) => {
36
+ if (t && typeof t == "object" || typeof t == "function") for (let l of p(t)) !h.call(e, l) && l !== n && i(e, l, { get: s(() => t[l], "get"), enumerable: !(o = a(t, l)) || o.enumerable });
37
+ return e;
38
+ }, "H"), g = s((e) => A(i({}, "__esModule", { value: true }), e), "J"), M = {};
39
+ x(M, { zeptomatch: s(() => xt, "zeptomatch") });
40
+ var G = s((e) => Array.isArray(e), "A"), O = s((e) => typeof e == "function", "d"), pe = s((e) => e.length === 0, "Q"), fe = s((e) => typeof e == "number", "W"), he = s((e) => typeof e == "object" && e !== null, "K"), de = s((e) => e instanceof RegExp, "X"), L = s((e) => typeof e == "string", "b"), j = s((e) => e === undefined, "h"), ge = s((e) => {
41
+ const t = /* @__PURE__ */ new Map();
42
+ return (n) => {
43
+ const o = t.get(n);
44
+ if (o) return o;
45
+ const l = e(n);
46
+ return t.set(n, l), l;
47
+ };
48
+ }, "Y"), xe = s((e, t, n = {}) => {
49
+ const o = { cache: {}, input: e, index: 0, indexMax: 0, options: n, output: [] };
50
+ if (y(t)(o) && o.index === e.length) return o.output;
51
+ throw new Error(`Failed to parse at index ${o.indexMax}`);
52
+ }, "rr"), u = s((e, t) => G(e) ? me(e, t) : L(e) ? be(e, t) : $e(e, t), "i"), me = s((e, t) => {
53
+ const n = {};
54
+ for (const o of e) {
55
+ if (o.length !== 1) throw new Error(`Invalid character: "${o}"`);
56
+ const l = o.charCodeAt(0);
57
+ n[l] = true;
58
+ }
59
+ return (o) => {
60
+ const l = o.index, c = o.input;
61
+ for (; o.index < c.length && c.charCodeAt(o.index) in n; ) o.index += 1;
62
+ const f = o.index;
63
+ if (f > l) {
64
+ if (!j(t) && !o.options.silent) {
65
+ const m = o.input.slice(l, f), $ = O(t) ? t(m, c, String(l)) : t;
66
+ j($) || o.output.push($);
67
+ }
68
+ o.indexMax = Math.max(o.indexMax, o.index);
69
+ }
70
+ return true;
71
+ };
72
+ }, "er"), $e = s((e, t) => {
73
+ const n = e.source, o = e.flags.replace(/y|$/, "y"), l = new RegExp(n, o);
74
+ return S((c) => {
75
+ l.lastIndex = c.index;
76
+ const f = l.exec(c.input);
77
+ if (f) {
78
+ if (!j(t) && !c.options.silent) {
79
+ const m = O(t) ? t(...f, c.input, String(c.index)) : t;
80
+ j(m) || c.output.push(m);
81
+ }
82
+ return c.index += f[0].length, c.indexMax = Math.max(c.indexMax, c.index), true;
83
+ } else return false;
84
+ });
85
+ }, "nr"), be = s((e, t) => (n) => {
86
+ if (n.input.startsWith(e, n.index)) {
87
+ if (!j(t) && !n.options.silent) {
88
+ const o = O(t) ? t(e, n.input, String(n.index)) : t;
89
+ j(o) || n.output.push(o);
90
+ }
91
+ return n.index += e.length, n.indexMax = Math.max(n.indexMax, n.index), true;
92
+ } else return false;
93
+ }, "tr"), T = s((e, t, n, o) => {
94
+ const l = y(e);
95
+ return S(E(U((c) => {
96
+ let f = 0;
97
+ for (; f < n; ) {
98
+ const m = c.index;
99
+ if (!l(c) || (f += 1, c.index === m)) break;
100
+ }
101
+ return f >= t;
102
+ }), o));
103
+ }, "C"), ve = s((e, t) => T(e, 0, 1, t), "ar"), _ = s((e, t) => T(e, 0, 1 / 0, t), "f"), P = s((e, t) => {
104
+ const n = e.map(y);
105
+ return S(E(U((o) => {
106
+ for (let l = 0, c = n.length; l < c; l++) if (!n[l](o)) return false;
107
+ return true;
108
+ }), t));
109
+ }, "x"), b = s((e, t) => {
110
+ const n = e.map(y);
111
+ return S(E((o) => {
112
+ for (let l = 0, c = n.length; l < c; l++) if (n[l](o)) return true;
113
+ return false;
114
+ }, t));
115
+ }, "l"), U = s((e, t = false) => {
116
+ const n = y(e);
117
+ return (o) => {
118
+ const l = o.index, c = o.output.length, f = n(o);
119
+ return (!f || t) && (o.index = l, o.output.length !== c && (o.output.length = c)), f;
120
+ };
121
+ }, "M"), E = s((e, t) => {
122
+ const n = y(e);
123
+ return t ? (o) => {
124
+ if (o.options.silent) return n(o);
125
+ const l = o.output.length;
126
+ if (n(o)) {
127
+ const c = o.output.splice(l, 1 / 0), f = t(c);
128
+ return j(f) || o.output.push(f), true;
129
+ } else return false;
130
+ } : n;
131
+ }, "_"), S = /* @__PURE__ */ (() => {
132
+ let e = 0;
133
+ return (t) => {
134
+ const n = y(t), o = e += 1;
135
+ return (l) => {
136
+ var c;
137
+ if (l.options.memoization === false) return n(l);
138
+ const f = l.index, m = (c = l.cache)[o] || (c[o] = /* @__PURE__ */ new Map()), $ = m.get(f);
139
+ if ($ === false) return false;
140
+ if (fe($)) return l.index = $, true;
141
+ if ($) return l.index = $.index, $.output?.length && l.output.push(...$.output), true;
142
+ {
143
+ const ne = l.output.length;
144
+ if (n(l)) {
145
+ const re = l.index, oe = l.output.length;
146
+ if (oe > ne) {
147
+ const mt = l.output.slice(ne, oe);
148
+ m.set(f, { index: re, output: mt });
149
+ } else m.set(f, re);
150
+ return true;
151
+ } else return m.set(f, false), false;
152
+ }
153
+ };
154
+ };
155
+ })(), B = s((e) => {
156
+ let t;
157
+ return (n) => (t || (t = y(e())), t(n));
158
+ }, "E"), y = ge((e) => {
159
+ if (O(e)) return pe(e) ? B(e) : e;
160
+ if (L(e) || de(e)) return u(e);
161
+ if (G(e)) return P(e);
162
+ if (he(e)) return b(Object.values(e));
163
+ throw new Error("Invalid rule");
164
+ }), D = "abcdefghijklmnopqrstuvwxyz", ye = s((e) => {
165
+ let t = "";
166
+ for (; e > 0; ) {
167
+ const n = (e - 1) % 26;
168
+ t = D[n] + t, e = Math.floor((e - 1) / 26);
169
+ }
170
+ return t;
171
+ }, "ir"), F = s((e) => {
172
+ let t = 0;
173
+ for (let n = 0, o = e.length; n < o; n++) t = t * 26 + D.indexOf(e[n]) + 1;
174
+ return t;
175
+ }, "z"), I = s((e, t) => {
176
+ if (t < e) return I(t, e);
177
+ const n = [];
178
+ for (; e <= t; ) n.push(e++);
179
+ return n;
180
+ }, "S"), Ae = s((e, t, n) => I(e, t).map((o) => String(o).padStart(n, "0")), "or"), H = s((e, t) => I(F(e), F(t)).map(ye), "O"), v = s((e) => e, "p"), J = s((e) => je((t) => xe(t, e, { memoization: false }).join("")), "R"), je = s((e) => {
181
+ const t = {};
182
+ return (n) => t[n] ?? (t[n] = e(n));
183
+ }, "ur"), we = u(/^\*\*\/\*$/, ".*"), ze = u(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (e, t, n) => `.*${t ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), Me = u(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (e, t, n, o) => `.*${t ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${o.replaceAll(",", "|").replaceAll(".", "\\.")})`), W = u(/\\./, v), Oe = u(/[$.*+?^(){}[\]\|]/, (e) => `\\${e}`), _e = u(/./, v), Pe = u(/^(?:!!)*!(.*)$/, (e, t) => `(?!^${te(t)}$).*?`), Se = u(/^(!!)+/, ""), Ze = b([Pe, Se]), Ce = u(/\/(\*\*\/)+/, "(?:/.+/|/)"), Ee = u(/^(\*\*\/)+/, "(?:^|.*/)"), Ie = u(/\/(\*\*)$/, "(?:/.*|$)"), We = u(/\*\*/, ".*"), K = b([Ce, Ee, Ie, We]), ke = u(/\*\/(?!\*\*\/)/, "[^/]*/"), Re = u(/\*/, "[^/]*"), Q = b([ke, Re]), X = u("?", "[^/]"), Ne = u("[", v), qe = u("]", v), Ge = u(/[!^]/, "^/"), Le = u(/[a-z]-[a-z]|[0-9]-[0-9]/i, v), Te = u(/[$.*+?^(){}[\|]/, (e) => `\\${e}`), Ue = u(/[^\]]/, v), Be = b([W, Te, Le, Ue]), Y = P([Ne, ve(Ge), _(Be), qe]), De = u("{", "(?:"), Fe = u("}", ")"), He = u(/(\d+)\.\.(\d+)/, (e, t, n) => Ae(+t, +n, Math.min(t.length, n.length)).join("|")), Je = u(/([a-z]+)\.\.([a-z]+)/, (e, t, n) => H(t, n).join("|")), Ke = u(/([A-Z]+)\.\.([A-Z]+)/, (e, t, n) => H(t.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Qe = b([He, Je, Ke]), V = P([De, Qe, Fe]), Xe = u("{", "(?:"), Ye = u("}", ")"), Ve = u(",", "|"), et = u(/[$.*+?^(){[\]\|]/, (e) => `\\${e}`), tt = u(/[^}]/, v), nt = B(() => ee), rt = b([K, Q, X, Y, V, nt, W, et, Ve, tt]), ee = P([Xe, _(rt), Ye]), ot = _(b([we, ze, Me, Ze, K, Q, X, Y, V, ee, W, Oe, _e])), it = ot, at = J(it), te = at, lt = u(/\\./, v), st = u(/./, v), ut = u(/\*\*\*+/, "*"), ct = u(/([^/{[(!])\*\*/, (e, t) => `${t}*`), pt = u(/(^|.)\*\*(?=[^*/)\]}])/, (e, t) => `${t}*`), ft = _(b([lt, ut, ct, pt, st])), ht = ft, dt = J(ht), gt = dt, k = s((e, t) => {
184
+ const n = Array.isArray(e) ? e : [e];
185
+ if (!n.length) return false;
186
+ const o = n.map(k.compile), l = n.every((f) => /(\/(?:\*\*)?|\[\/\])$/.test(f)), c = t.replace(/[\\\/]+/g, "/").replace(/\/$/, l ? "/" : "");
187
+ return o.some((f) => f.test(c));
188
+ }, "$");
189
+ k.compile = (e) => new RegExp(`^${te(gt(e))}$`, "s");
190
+ var xt = k;
191
+ return g(M);
192
+ })();
193
+ return r.default || r;
194
+ }, "_lazyMatch");
195
+ let R;
196
+ const jt = s((r, i) => (R || (R = ie(), ie = null), R(r, i)), "default");
197
+ var wt = Object.defineProperty;
198
+ var d = Z((r, i) => wt(r, "name", { value: i, configurable: true }), "r");
199
+ const zt = /^[/\\]{2}/;
200
+ const Mt = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
201
+ const le = /^[A-Z]:$/i;
202
+ const ae = /^\/([A-Z]:)?$/i;
203
+ const Ot = /.(\.[^./]+)$/;
204
+ const _t = /^[/\\]|^[a-z]:[/\\]/i;
205
+ const Pt = d(() => typeof process.cwd == "function" ? process.cwd().replaceAll("\\", "/") : "/", "cwd");
206
+ const N = d((r, i) => {
207
+ let a = "", p = 0, h = -1, x = 0, A = null;
208
+ for (let g = 0; g <= r.length; ++g) {
209
+ if (g < r.length) A = r[g];
210
+ else {
211
+ if (A === "/") break;
212
+ A = "/";
213
+ }
214
+ if (A === "/") {
215
+ if (!(h === g - 1 || x === 1)) if (x === 2) {
216
+ if (a.length < 2 || p !== 2 || !a.endsWith(".") || a.at(-2) !== ".") {
217
+ if (a.length > 2) {
218
+ const M = a.lastIndexOf("/");
219
+ M === -1 ? (a = "", p = 0) : (a = a.slice(0, M), p = a.length - 1 - a.lastIndexOf("/")), h = g, x = 0;
220
+ continue;
221
+ } else if (a.length > 0) {
222
+ a = "", p = 0, h = g, x = 0;
223
+ continue;
224
+ }
225
+ }
226
+ i && (a += a.length > 0 ? "/.." : "..", p = 2);
227
+ } else a.length > 0 ? a += `/${r.slice(h + 1, g)}` : a = r.slice(h + 1, g), p = g - h - 1;
228
+ h = g, x = 0;
229
+ } else A === "." && x !== -1 ? ++x : x = -1;
230
+ }
231
+ return a;
232
+ }, "normalizeString");
233
+ const z = d((r) => Mt.test(r), "isAbsolute");
234
+ const q = d(function(r) {
235
+ if (r.length === 0) return ".";
236
+ r = w(r);
237
+ const i = zt.exec(r), a = z(r), p = r.at(-1) === "/";
238
+ return r = N(r, !a), r.length === 0 ? a ? "/" : p ? "./" : "." : (p && (r += "/"), le.test(r) && (r += "/"), i ? a ? `//${r}` : `//./${r}` : a && !z(r) ? `/${r}` : r);
239
+ }, "normalize");
240
+ const Ct = d((...r) => {
241
+ let i = "";
242
+ for (const a of r) if (a) if (i.length > 0) {
243
+ const p = i[i.length - 1] === "/", h = a[0] === "/";
244
+ p && h ? i += a.slice(1) : i += p || h ? a : `/${a}`;
245
+ } else i += a;
246
+ return q(i);
247
+ }, "join");
248
+ const C = d(function(...r) {
249
+ r = r.map((p) => w(p));
250
+ let i = "", a = false;
251
+ for (let p = r.length - 1; p >= -1 && !a; p--) {
252
+ const h = p >= 0 ? r[p] : Pt();
253
+ !h || h.length === 0 || (i = `${h}/${i}`, a = z(h));
254
+ }
255
+ return i = N(i, !a), a && !z(i) ? `/${i}` : i.length > 0 ? i : ".";
256
+ }, "resolve");
257
+ d(function(r) {
258
+ return w(r);
259
+ }, "toNamespacedPath");
260
+ const se = d(function(r) {
261
+ return Ot.exec(w(r))?.[1] ?? "";
262
+ }, "extname");
263
+ d(function(r, i) {
264
+ const a = C(r).replace(ae, "$1").split("/"), p = C(i).replace(ae, "$1").split("/");
265
+ if (p[0][1] === ":" && a[0][1] === ":" && a[0] !== p[0]) return p.join("/");
266
+ const h = [...a];
267
+ for (const x of h) {
268
+ if (p[0] !== x) break;
269
+ a.shift(), p.shift();
270
+ }
271
+ return [...a.map(() => ".."), ...p].join("/");
272
+ }, "relative");
273
+ const ue = d((r) => {
274
+ const i = w(r).replace(/\/$/, "").split("/").slice(0, -1);
275
+ return i.length === 1 && le.test(i[0]) && (i[0] += "/"), i.join("/") || (z(r) ? "/" : ".");
276
+ }, "dirname");
277
+ d(function(r) {
278
+ const i = [r.root, r.dir, r.base ?? r.name + r.ext].filter(Boolean);
279
+ return w(r.root ? C(...i) : i.join("/"));
280
+ }, "format");
281
+ const ce = d((r, i) => {
282
+ const a = w(r).split("/").pop();
283
+ return i && a.endsWith(i) ? a.slice(0, -i.length) : a;
284
+ }, "basename");
285
+ d(function(r) {
286
+ const i = _t.exec(r)?.[0]?.replace(/\\/g, "/") ?? "", a = ce(r), p = se(a);
287
+ return { base: a, dir: ue(r), ext: p, name: a.slice(0, a.length - p.length), root: i };
288
+ }, "parse");
289
+ d((r, i) => jt(i, q(r)), "matchesGlob");
290
+
291
+ var __defProp$2 = Object.defineProperty;
292
+ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
293
+ const FILE_NAME = "last-update-check.json";
294
+ const getConfigFile = /* @__PURE__ */ __name$2((packageName) => {
295
+ const cacheDirectory = findCacheDirSync(packageName);
296
+ if (cacheDirectory === undefined) {
297
+ throw new Error("Could not find cache directory");
298
+ }
299
+ return Ct(cacheDirectory, FILE_NAME);
300
+ }, "getConfigFile");
301
+ const getLastUpdate = /* @__PURE__ */ __name$2((packageName) => {
302
+ const configFile = getConfigFile(packageName);
303
+ try {
304
+ if (!existsSync(configFile)) {
305
+ return undefined;
306
+ }
307
+ const { lastUpdateCheck } = JSON.parse(readFileSync(configFile, "utf8"));
308
+ return lastUpdateCheck;
309
+ } catch {
310
+ return undefined;
311
+ }
312
+ }, "getLastUpdate");
313
+ const saveLastUpdate = /* @__PURE__ */ __name$2((packageName) => {
314
+ const configFile = getConfigFile(packageName);
315
+ const configDirectory = ue(configFile);
316
+ if (!existsSync(configDirectory)) {
317
+ mkdirSync(configDirectory, { recursive: true });
318
+ }
319
+ writeFileSync(configFile, JSON.stringify({ lastUpdateCheck: Date.now() }));
320
+ }, "saveLastUpdate");
321
+
322
+ var __defProp$1 = Object.defineProperty;
323
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
324
+ const getDistributionVersion = /* @__PURE__ */ __name$1(async (packageName, distributionTag, registryUrl) => {
325
+ const url = registryUrl.replace("__NAME__", packageName);
326
+ return await new Promise((resolve, reject) => {
327
+ get(url, (message) => {
328
+ let body = "";
329
+ message.on("data", (chunk) => body += chunk);
330
+ message.on("end", () => {
331
+ try {
332
+ const json = JSON.parse(body);
333
+ const version = json[distributionTag];
334
+ if (!version) {
335
+ reject(new Error("Error getting version"));
336
+ }
337
+ resolve(version);
338
+ } catch {
339
+ reject(new Error("Could not parse version response"));
340
+ }
341
+ });
342
+ }).on("error", (error) => reject(error));
343
+ });
344
+ }, "getDistributionVersion");
345
+
346
+ var __defProp = Object.defineProperty;
347
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
348
+ const hasNewVersion = /* @__PURE__ */ __name(async ({
349
+ alwaysRun,
350
+ debug,
351
+ distTag: distributionTag = "latest",
352
+ pkg,
353
+ registryUrl = "https://registry.npmjs.org/-/package/__NAME__/dist-tags",
354
+ updateCheckInterval = 1e3 * 60 * 60 * 24
355
+ }) => {
356
+ const lastUpdateCheck = getLastUpdate(pkg.name);
357
+ if (alwaysRun || !lastUpdateCheck || lastUpdateCheck < Date.now() - updateCheckInterval) {
358
+ const latestVersion = await getDistributionVersion(pkg.name, distributionTag, registryUrl);
359
+ saveLastUpdate(pkg.name);
360
+ if (semverGt(latestVersion, pkg.version)) {
361
+ return latestVersion;
362
+ }
363
+ if (debug) {
364
+ console.error(`Latest version (${latestVersion}) not newer than current version (${pkg.version})`);
365
+ }
366
+ } else if (debug) {
367
+ console.error(
368
+ `Too recent to check for a new update. simpleUpdateNotifier() interval set to ${updateCheckInterval}ms but only ${Date.now() - lastUpdateCheck}ms since last check.`
369
+ );
370
+ }
371
+ return null;
372
+ }, "hasNewVersion");
373
+
374
+ export { hasNewVersion as default };