codemod 0.18.12 → 0.18.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.cjs +5 -5
  2. package/package.json +4 -4
package/dist/index.cjs CHANGED
@@ -674,7 +674,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);return new xI(t,e).found}f
674
674
  See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof xI))return new xI(t,e);if(c3i(this,t,e),this.noprocess)return this;var n=this.minimatch.set.length;this.matches=new Array(n);for(var i=0;i<n;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}xI.prototype._finish=function(){if(enr.ok(this instanceof xI),this.realpath){var t=this;this.matches.forEach(function(e,n){var i=t.matches[n]=Object.create(null);for(var s in e)try{s=t._makeAbs(s);var o=l3i.realpathSync(s,t.realpathCache);i[o]=!0}catch(f){if(f.syscall==="stat")i[t._makeAbs(s)]=!0;else throw f}})}QDe.finish(this)};xI.prototype._process=function(t,e,n){enr.ok(this instanceof xI);for(var i=0;typeof t[i]=="string";)i++;var s;switch(i){case t.length:this._processSimple(t.join("/"),e);return;case 0:s=null;break;default:s=t.slice(0,i).join("/");break}var o=t.slice(i),f;s===null?f=".":((LEt(s)||LEt(t.map(function(x){return typeof x=="string"?x:"[*]"}).join("/")))&&(!s||!LEt(s))&&(s="/"+s),f=s);var h=this._makeAbs(f);if(!u3i(this,f)){var _=o[0]===Ztr.GLOBSTAR;_?this._processGlobStar(s,f,h,o,e,n):this._processReaddir(s,f,h,o,e,n)}};xI.prototype._processReaddir=function(t,e,n,i,s,o){var f=this._readdir(n,o);if(f){for(var h=i[0],_=!!this.minimatch.negate,x=h._glob,v=this.dot||x.charAt(0)===".",T=[],A=0;A<f.length;A++){var w=f[A];if(w.charAt(0)!=="."||v){var N;_&&!t?N=!w.match(h):N=w.match(h),N&&T.push(w)}}var P=T.length;if(P!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[s]||(this.matches[s]=Object.create(null));for(var A=0;A<P;A++){var w=T[A];t&&(t.slice(-1)!=="/"?w=t+"/"+w:w=t+w),w.charAt(0)==="/"&&!this.nomount&&(w=jln.join(this.root,w)),this._emitMatch(s,w)}return}i.shift();for(var A=0;A<P;A++){var w=T[A],F;t?F=[t,w]:F=[w],this._process(F.concat(i),s,o)}}}};xI.prototype._emitMatch=function(t,e){if(!f3i(this,e)){var n=this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=n),!this.matches[t][e]){if(this.nodir){var i=this.cache[n];if(i==="DIR"||Array.isArray(i))return}this.matches[t][e]=!0,this.stat&&this._stat(e)}}};xI.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var e,n,i;try{n=this.fs.lstatSync(t)}catch(o){if(o.code==="ENOENT")return null}var s=n&&n.isSymbolicLink();return this.symlinks[t]=s,!s&&n&&!n.isDirectory()?this.cache[t]="FILE":e=this._readdir(t,!1),e};xI.prototype._readdir=function(t,e){var n;if(e&&!zln(this.symlinks,t))return this._readdirInGlobStar(t);if(zln(this.cache,t)){var i=this.cache[t];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(t,this.fs.readdirSync(t))}catch(s){return this._readdirError(t,s),null}};xI.prototype._readdirEntries=function(t,e){if(!this.mark&&!this.stat)for(var n=0;n<e.length;n++){var i=e[n];t==="/"?i=t+i:i=t+"/"+i,this.cache[i]=!0}return this.cache[t]=e,e};xI.prototype._readdirError=function(t,e){switch(e.code){case"ENOTSUP":case"ENOTDIR":var n=this._makeAbs(t);if(this.cache[n]="FILE",n===this.cwdAbs){var i=new Error(e.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=e.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:if(this.cache[this._makeAbs(t)]=!1,this.strict)throw e;this.silent||console.error("glob error",e);break}};xI.prototype._processGlobStar=function(t,e,n,i,s,o){var f=this._readdir(n,o);if(f){var h=i.slice(1),_=t?[t]:[],x=_.concat(h);this._process(x,s,!1);var v=f.length,T=this.symlinks[n];if(!(T&&o))for(var A=0;A<v;A++){var w=f[A];if(!(w.charAt(0)==="."&&!this.dot)){var N=_.concat(f[A],h);this._process(N,s,!0);var P=_.concat(f[A],i);this._process(P,s,!0)}}}};xI.prototype._processSimple=function(t,e){var n=this._stat(t);if(this.matches[e]||(this.matches[e]=Object.create(null)),!!n){if(t&&LEt(t)&&!this.nomount){var i=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=jln.join(this.root,t):(t=jln.resolve(this.root,t),i&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(e,t)}};xI.prototype._stat=function(t){var e=this._makeAbs(t),n=t.slice(-1)==="/";if(t.length>this.maxLength)return!1;if(!this.stat&&zln(this.cache,e)){var f=this.cache[e];if(Array.isArray(f)&&(f="DIR"),!n||f==="DIR")return f;if(n&&f==="FILE")return!1}var i,s=this.statCache[e];if(!s){var o;try{o=this.fs.lstatSync(e)}catch(h){if(h&&(h.code==="ENOENT"||h.code==="ENOTDIR"))return this.statCache[e]=!1,!1}if(o&&o.isSymbolicLink())try{s=this.fs.statSync(e)}catch{s=o}else s=o}this.statCache[e]=s;var f=!0;return s&&(f=s.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||f,n&&f==="FILE"?!1:f};xI.prototype._mark=function(t){return QDe.mark(this,t)};xI.prototype._makeAbs=function(t){return QDe.makeAbs(this,t)}});var Uln=le((WBa,snr)=>{snr.exports=inr;function inr(t,e){if(t&&e)return inr(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(i){n[i]=t[i]}),n;function n(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];var o=t.apply(this,i),f=i[i.length-1];return typeof o=="function"&&o!==f&&Object.keys(f).forEach(function(h){o[h]=f[h]}),o}}});var qln=le((jBa,Vln)=>{var anr=Uln();Vln.exports=anr(MEt);Vln.exports.strict=anr(onr);MEt.proto=MEt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return MEt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onr(this)},configurable:!0})});function MEt(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function onr(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}});var cnr=le((zBa,lnr)=>{var d3i=Uln(),Vet=Object.create(null),p3i=qln();lnr.exports=d3i(h3i);function h3i(t,e){return Vet[t]?(Vet[t].push(e),null):(Vet[t]=[e],m3i(t))}function m3i(t){return p3i(function e(){var n=Vet[t],i=n.length,s=_3i(arguments);try{for(var o=0;o<i;o++)n[o].apply(null,s)}finally{n.length>i?(n.splice(0,i),process.nextTick(function(){e.apply(null,s)})):delete Vet[t]}})}function _3i(t){for(var e=t.length,n=[],i=0;i<e;i++)n[i]=t[i];return n}});var Gln=le((VBa,fnr)=>{fnr.exports=ZDe;var g3i=kln(),unr=kEt(),GBa=unr.Minimatch,x3i=j2(),y3i=require("events").EventEmitter,Hln=require("path"),Kln=require("assert"),qet=OEt(),$ln=rnr(),eAe=Wln(),v3i=eAe.setopts,Jln=eAe.ownProp,Xln=cnr(),UBa=require("util"),b3i=eAe.childrenIgnored,E3i=eAe.isIgnored,S3i=qln();function ZDe(t,e,n){if(typeof e=="function"&&(n=e,e={}),e||(e={}),e.sync){if(n)throw new TypeError("callback provided to sync glob");return $ln(t,e)}return new lv(t,e,n)}ZDe.sync=$ln;var T3i=ZDe.GlobSync=$ln.GlobSync;ZDe.glob=ZDe;function D3i(t,e){if(e===null||typeof e!="object")return t;for(var n=Object.keys(e),i=n.length;i--;)t[n[i]]=e[n[i]];return t}ZDe.hasMagic=function(t,e){var n=D3i({},e);n.noprocess=!0;var i=new lv(t,n),s=i.minimatch.set;if(!t)return!1;if(s.length>1)return!0;for(var o=0;o<s[0].length;o++)if(typeof s[0][o]!="string")return!0;return!1};ZDe.Glob=lv;x3i(lv,y3i);function lv(t,e,n){if(typeof e=="function"&&(n=e,e=null),e&&e.sync){if(n)throw new TypeError("callback provided to sync glob");return new T3i(t,e)}if(!(this instanceof lv))return new lv(t,e,n);v3i(this,t,e),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof n=="function"&&(n=S3i(n),this.on("error",n),this.on("end",function(_){n(null,_)}));var s=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return h();for(var o=!0,f=0;f<i;f++)this._process(this.minimatch.set[f],f,!1,h);o=!1;function h(){--s._processing,s._processing<=0&&(o?process.nextTick(function(){s._finish()}):s._finish())}}lv.prototype._finish=function(){if(Kln(this instanceof lv),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();eAe.finish(this),this.emit("end",this.found)}};lv.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var t=this.matches.length;if(t===0)return this._finish();for(var e=this,n=0;n<this.matches.length;n++)this._realpathSet(n,i);function i(){--t===0&&e._finish()}};lv.prototype._realpathSet=function(t,e){var n=this.matches[t];if(!n)return e();var i=Object.keys(n),s=this,o=i.length;if(o===0)return e();var f=this.matches[t]=Object.create(null);i.forEach(function(h,_){h=s._makeAbs(h),g3i.realpath(h,s.realpathCache,function(x,v){x?x.syscall==="stat"?f[h]=!0:s.emit("error",x):f[v]=!0,--o===0&&(s.matches[t]=f,e())})})};lv.prototype._mark=function(t){return eAe.mark(this,t)};lv.prototype._makeAbs=function(t){return eAe.makeAbs(this,t)};lv.prototype.abort=function(){this.aborted=!0,this.emit("abort")};lv.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};lv.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var t=this._emitQueue.slice(0);this._emitQueue.length=0;for(var e=0;e<t.length;e++){var n=t[e];this._emitMatch(n[0],n[1])}}if(this._processQueue.length){var i=this._processQueue.slice(0);this._processQueue.length=0;for(var e=0;e<i.length;e++){var s=i[e];this._processing--,this._process(s[0],s[1],s[2],s[3])}}}};lv.prototype._process=function(t,e,n,i){if(Kln(this instanceof lv),Kln(typeof i=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([t,e,n,i]);return}for(var s=0;typeof t[s]=="string";)s++;var o;switch(s){case t.length:this._processSimple(t.join("/"),e,i);return;case 0:o=null;break;default:o=t.slice(0,s).join("/");break}var f=t.slice(s),h;o===null?h=".":((qet(o)||qet(t.map(function(v){return typeof v=="string"?v:"[*]"}).join("/")))&&(!o||!qet(o))&&(o="/"+o),h=o);var _=this._makeAbs(h);if(b3i(this,h))return i();var x=f[0]===unr.GLOBSTAR;x?this._processGlobStar(o,h,_,f,e,n,i):this._processReaddir(o,h,_,f,e,n,i)}};lv.prototype._processReaddir=function(t,e,n,i,s,o,f){var h=this;this._readdir(n,o,function(_,x){return h._processReaddir2(t,e,n,i,s,o,x,f)})};lv.prototype._processReaddir2=function(t,e,n,i,s,o,f,h){if(!f)return h();for(var _=i[0],x=!!this.minimatch.negate,v=_._glob,T=this.dot||v.charAt(0)===".",A=[],w=0;w<f.length;w++){var N=f[w];if(N.charAt(0)!=="."||T){var P;x&&!t?P=!N.match(_):P=N.match(_),P&&A.push(N)}}var F=A.length;if(F===0)return h();if(i.length===1&&!this.mark&&!this.stat){this.matches[s]||(this.matches[s]=Object.create(null));for(var w=0;w<F;w++){var N=A[w];t&&(t!=="/"?N=t+"/"+N:N=t+N),N.charAt(0)==="/"&&!this.nomount&&(N=Hln.join(this.root,N)),this._emitMatch(s,N)}return h()}i.shift();for(var w=0;w<F;w++){var N=A[w],j;t&&(t!=="/"?N=t+"/"+N:N=t+N),this._process([N].concat(i),s,o,h)}h()};lv.prototype._emitMatch=function(t,e){if(!this.aborted&&!E3i(this,e)){if(this.paused){this._emitQueue.push([t,e]);return}var n=qet(e)?e:this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=n),!this.matches[t][e]){if(this.nodir){var i=this.cache[n];if(i==="DIR"||Array.isArray(i))return}this.matches[t][e]=!0;var s=this.statCache[n];s&&this.emit("stat",e,s),this.emit("match",e)}}};lv.prototype._readdirInGlobStar=function(t,e){if(this.aborted)return;if(this.follow)return this._readdir(t,!1,e);var n="lstat\0"+t,i=this,s=Xln(n,o);s&&i.fs.lstat(t,s);function o(f,h){if(f&&f.code==="ENOENT")return e();var _=h&&h.isSymbolicLink();i.symlinks[t]=_,!_&&h&&!h.isDirectory()?(i.cache[t]="FILE",e()):i._readdir(t,!1,e)}};lv.prototype._readdir=function(t,e,n){if(!this.aborted&&(n=Xln("readdir\0"+t+"\0"+e,n),!!n)){if(e&&!Jln(this.symlinks,t))return this._readdirInGlobStar(t,n);if(Jln(this.cache,t)){var i=this.cache[t];if(!i||i==="FILE")return n();if(Array.isArray(i))return n(null,i)}var s=this;s.fs.readdir(t,A3i(this,t,n))}};function A3i(t,e,n){return function(i,s){i?t._readdirError(e,i,n):t._readdirEntries(e,s,n)}}lv.prototype._readdirEntries=function(t,e,n){if(!this.aborted){if(!this.mark&&!this.stat)for(var i=0;i<e.length;i++){var s=e[i];t==="/"?s=t+s:s=t+"/"+s,this.cache[s]=!0}return this.cache[t]=e,n(null,e)}};lv.prototype._readdirError=function(t,e,n){if(!this.aborted){switch(e.code){case"ENOTSUP":case"ENOTDIR":var i=this._makeAbs(t);if(this.cache[i]="FILE",i===this.cwdAbs){var s=new Error(e.code+" invalid cwd "+this.cwd);s.path=this.cwd,s.code=e.code,this.emit("error",s),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:this.cache[this._makeAbs(t)]=!1,this.strict&&(this.emit("error",e),this.abort()),this.silent||console.error("glob error",e);break}return n()}};lv.prototype._processGlobStar=function(t,e,n,i,s,o,f){var h=this;this._readdir(n,o,function(_,x){h._processGlobStar2(t,e,n,i,s,o,x,f)})};lv.prototype._processGlobStar2=function(t,e,n,i,s,o,f,h){if(!f)return h();var _=i.slice(1),x=t?[t]:[],v=x.concat(_);this._process(v,s,!1,h);var T=this.symlinks[n],A=f.length;if(T&&o)return h();for(var w=0;w<A;w++){var N=f[w];if(!(N.charAt(0)==="."&&!this.dot)){var P=x.concat(f[w],_);this._process(P,s,!0,h);var F=x.concat(f[w],i);this._process(F,s,!0,h)}}h()};lv.prototype._processSimple=function(t,e,n){var i=this;this._stat(t,function(s,o){i._processSimple2(t,e,s,o,n)})};lv.prototype._processSimple2=function(t,e,n,i,s){if(this.matches[e]||(this.matches[e]=Object.create(null)),!i)return s();if(t&&qet(t)&&!this.nomount){var o=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=Hln.join(this.root,t):(t=Hln.resolve(this.root,t),o&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(e,t),s()};lv.prototype._stat=function(t,e){var n=this._makeAbs(t),i=t.slice(-1)==="/";if(t.length>this.maxLength)return e();if(!this.stat&&Jln(this.cache,n)){var s=this.cache[n];if(Array.isArray(s)&&(s="DIR"),!i||s==="DIR")return e(null,s);if(i&&s==="FILE")return e()}var o,f=this.statCache[n];if(f!==void 0){if(f===!1)return e(null,f);var h=f.isDirectory()?"DIR":"FILE";return i&&h==="FILE"?e():e(null,h,f)}var _=this,x=Xln("stat\0"+n,v);x&&_.fs.lstat(n,x);function v(T,A){if(A&&A.isSymbolicLink())return _.fs.stat(n,function(w,N){w?_._stat2(t,n,null,A,e):_._stat2(t,n,w,N,e)});_._stat2(t,n,T,A,e)}};lv.prototype._stat2=function(t,e,n,i,s){if(n&&(n.code==="ENOENT"||n.code==="ENOTDIR"))return this.statCache[e]=!1,s();var o=t.slice(-1)==="/";if(this.statCache[e]=i,e.slice(-1)==="/"&&i&&!i.isDirectory())return s(null,!1,i);var f=!0;return i&&(f=i.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||f,o&&f==="FILE"?s():s(null,f,i)}});var ecn=le((qBa,ynr)=>{ynr.exports=Zln;Zln.sync=xnr;var My=require("assert"),mnr=require("path"),dnr=require("fs"),R8e=void 0;try{R8e=Gln()}catch{}var _nr=parseInt("666",8),C3i={nosort:!0,silent:!0},Yln=0,Het=process.platform==="win32";function gnr(t){var e=["unlink","chmod","stat","lstat","rmdir","readdir"];if(e.forEach(function(n){t[n]=t[n]||dnr[n],n=n+"Sync",t[n]=t[n]||dnr[n]}),t.maxBusyTries=t.maxBusyTries||3,t.emfileWait=t.emfileWait||1e3,t.glob===!1&&(t.disableGlob=!0),t.disableGlob!==!0&&R8e===void 0)throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");t.disableGlob=t.disableGlob||!1,t.glob=t.glob||C3i}function Zln(t,e,n){typeof e=="function"&&(n=e,e={}),My(t,"rimraf: missing path"),My.equal(typeof t,"string","rimraf: path should be a string"),My.equal(typeof n,"function","rimraf: callback function required"),My(e,"rimraf: invalid options argument provided"),My.equal(typeof e,"object","rimraf: options should be object"),gnr(e);var i=0,s=null,o=0;if(e.disableGlob||!R8e.hasMagic(t))return h(null,[t]);e.lstat(t,function(_,x){if(!_)return h(null,[t]);R8e(t,e.glob,h)});function f(_){s=s||_,--o===0&&n(s)}function h(_,x){if(_)return n(_);if(o=x.length,o===0)return n();x.forEach(function(v){Qln(v,e,function T(A){if(A){if((A.code==="EBUSY"||A.code==="ENOTEMPTY"||A.code==="EPERM")&&i<e.maxBusyTries){i++;var w=i*100;return setTimeout(function(){Qln(v,e,T)},w)}if(A.code==="EMFILE"&&Yln<e.emfileWait)return setTimeout(function(){Qln(v,e,T)},Yln++);A.code==="ENOENT"&&(A=null)}Yln=0,f(A)})})}}function Qln(t,e,n){My(t),My(e),My(typeof n=="function"),e.lstat(t,function(i,s){if(i&&i.code==="ENOENT")return n(null);if(i&&i.code==="EPERM"&&Het&&pnr(t,e,i,n),s&&s.isDirectory())return FEt(t,e,i,n);e.unlink(t,function(o){if(o){if(o.code==="ENOENT")return n(null);if(o.code==="EPERM")return Het?pnr(t,e,o,n):FEt(t,e,o,n);if(o.code==="EISDIR")return FEt(t,e,o,n)}return n(o)})})}function pnr(t,e,n,i){My(t),My(e),My(typeof i=="function"),n&&My(n instanceof Error),e.chmod(t,_nr,function(s){s?i(s.code==="ENOENT"?null:n):e.stat(t,function(o,f){o?i(o.code==="ENOENT"?null:n):f.isDirectory()?FEt(t,e,n,i):e.unlink(t,i)})})}function hnr(t,e,n){My(t),My(e),n&&My(n instanceof Error);try{e.chmodSync(t,_nr)}catch(s){if(s.code==="ENOENT")return;throw n}try{var i=e.statSync(t)}catch(s){if(s.code==="ENOENT")return;throw n}i.isDirectory()?BEt(t,e,n):e.unlinkSync(t)}function FEt(t,e,n,i){My(t),My(e),n&&My(n instanceof Error),My(typeof i=="function"),e.rmdir(t,function(s){s&&(s.code==="ENOTEMPTY"||s.code==="EEXIST"||s.code==="EPERM")?w3i(t,e,i):s&&s.code==="ENOTDIR"?i(n):i(s)})}function w3i(t,e,n){My(t),My(e),My(typeof n=="function"),e.readdir(t,function(i,s){if(i)return n(i);var o=s.length;if(o===0)return e.rmdir(t,n);var f;s.forEach(function(h){Zln(mnr.join(t,h),e,function(_){if(!f){if(_)return n(f=_);--o===0&&e.rmdir(t,n)}})})})}function xnr(t,e){e=e||{},gnr(e),My(t,"rimraf: missing path"),My.equal(typeof t,"string","rimraf: path should be a string"),My(e,"rimraf: missing options"),My.equal(typeof e,"object","rimraf: options should be object");var n;if(e.disableGlob||!R8e.hasMagic(t))n=[t];else try{e.lstatSync(t),n=[t]}catch{n=R8e.sync(t,e.glob)}if(n.length)for(var i=0;i<n.length;i++){var t=n[i];try{var s=e.lstatSync(t)}catch(f){if(f.code==="ENOENT")return;f.code==="EPERM"&&Het&&hnr(t,e,f)}try{s&&s.isDirectory()?BEt(t,e,null):e.unlinkSync(t)}catch(f){if(f.code==="ENOENT")return;if(f.code==="EPERM")return Het?hnr(t,e,f):BEt(t,e,f);if(f.code!=="EISDIR")throw f;BEt(t,e,f)}}}function BEt(t,e,n){My(t),My(e),n&&My(n instanceof Error);try{e.rmdirSync(t)}catch(i){if(i.code==="ENOENT")return;if(i.code==="ENOTDIR")throw n;(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")&&I3i(t,e)}}function I3i(t,e){My(t),My(e),e.readdirSync(t).forEach(function(f){xnr(mnr.join(t,f),e)});var n=Het?100:1,i=0;do{var s=!0;try{var o=e.rmdirSync(t,e);return s=!1,o}finally{if(++i<n&&s)continue}}while(!0)}});var tcn=le((HBa,Enr)=>{var Ket=require("path"),vnr=require("fs"),bnr=parseInt("0777",8);Enr.exports=O8e.mkdirp=O8e.mkdirP=O8e;function O8e(t,e,n,i){typeof e=="function"?(n=e,e={}):(!e||typeof e!="object")&&(e={mode:e});var s=e.mode,o=e.fs||vnr;s===void 0&&(s=bnr),i||(i=null);var f=n||function(){};t=Ket.resolve(t),o.mkdir(t,s,function(h){if(!h)return i=i||t,f(null,i);switch(h.code){case"ENOENT":if(Ket.dirname(t)===t)return f(h);O8e(Ket.dirname(t),e,function(_,x){_?f(_,x):O8e(t,e,f,x)});break;default:o.stat(t,function(_,x){_||!x.isDirectory()?f(h,i):f(null,i)});break}})}O8e.sync=function t(e,n,i){(!n||typeof n!="object")&&(n={mode:n});var s=n.mode,o=n.fs||vnr;s===void 0&&(s=bnr),i||(i=null),e=Ket.resolve(e);try{o.mkdirSync(e,s),i=i||e}catch(h){switch(h.code){case"ENOENT":i=t(Ket.dirname(e),n,i),t(e,n,i);break;default:var f;try{f=o.statSync(e)}catch{throw h}if(!f.isDirectory())throw h;break}}return i}});var WEt=le((KBa,Snr)=>{Snr.exports=ncn;function ncn(t){if(t._collected)return;if(t._paused)return t.on("resume",ncn.bind(null,t));t._collected=!0,t.pause(),t.on("data",n),t.on("end",n);var e=[];function n(f){typeof f=="string"&&(f=new Buffer(f)),!(Buffer.isBuffer(f)&&!f.length)&&e.push(f)}t.on("entry",s);var i=[];function s(f){ncn(f),i.push(f)}t.on("proxy",o);function o(f){f.pause()}t.pipe=function(f){return function(h){var _=0;(function v(){var T=i[_++];if(!T)return x();T.on("end",v),h?h.add(T):t.emit("entry",T)})();function x(){t.removeListener("entry",s),t.removeListener("data",n),t.removeListener("end",n),t.pipe=f,h&&t.pipe(h),e.forEach(function(v){v?t.emit("data",v):t.emit("end")}),t.resume()}return h}}(t.pipe)}});var rcn=le((JBa,Dnr)=>{Dnr.exports=p_e;var jEt=L8e(),P3i=j2(),N3i=tcn(),Tnr=require("path"),k3i=WEt();P3i(p_e,jEt);function p_e(t){var e=this;e instanceof p_e||e.error("DirWriter must be called as constructor.",null,!0),(t.type!=="Directory"||!t.Directory)&&e.error("Non-directory type "+t.type+" "+JSON.stringify(t),null,!0),jEt.call(this,t)}p_e.prototype._create=function(){var t=this;N3i(t._path,jEt.dirmode,function(e){if(e)return t.error(e);t.ready=!0,t.emit("ready"),t._process()})};p_e.prototype.write=function(){return!0};p_e.prototype.end=function(){this._ended=!0,this._process()};p_e.prototype.add=function(t){var e=this;return k3i(t),!e.ready||e._currentEntry?(e._buffer.push(t),!1):e._ended?e.error("add after end"):(e._buffer.push(t),e._process(),this._buffer.length===0)};p_e.prototype._process=function(){var t=this;if(t._processing)return;var e=t._buffer.shift();if(!e){t.emit("drain"),t._ended&&t._finish();return}t._processing=!0,t.emit("entry",e);var n=e,i;do{if(i=n._path||n.path,i===t.root._path||i===t._path||i&&i.indexOf(t._path)===0)return t._processing=!1,e._collected&&e.pipe(),t._process();n=n.parent}while(n);var s={parent:t,root:t.root||t,type:e.type,depth:t.depth+1};i=e._path||e.path||e.props.path,e.parent&&(i=i.substr(e.parent._path.length+1)),s.path=Tnr.join(t.path,Tnr.join("/",i)),s.filter=t.filter,Object.keys(e.props).forEach(function(_){s.hasOwnProperty(_)||(s[_]=e.props[_])});var o=t._currentChild=new jEt(s);o.on("ready",function(){e.pipe(o),e.resume()}),o.on("error",function(_){o._swallowErrors?(t.warn(_),o.emit("end"),o.emit("close")):t.emit("error",_)}),o.on("close",h);var f=!1;function h(){f||(f=!0,t._currentChild=null,t._processing=!1,t._process())}}});var icn=le(($Ba,Pnr)=>{Pnr.exports=Jet;var Cnr=qee(),wnr=L8e(),R3i=j2(),O3i=require("path"),L3i=ecn();R3i(Jet,wnr);function Jet(t){var e=this;if(!(e instanceof Jet))throw new Error("LinkWriter must be called as constructor.");if(!(t.type==="Link"&&t.Link||t.type==="SymbolicLink"&&t.SymbolicLink))throw new Error("Non-link type "+t.type);t.linkpath===""&&(t.linkpath="."),t.linkpath||e.error("Need linkpath property to create "+t.type),wnr.call(this,t)}Jet.prototype._create=function(){var t=this,e=t.type==="Link"||process.platform==="win32",n=e?"link":"symlink",i=e?O3i.resolve(t.dirname,t.linkpath):t.linkpath;if(e)return Anr(t,i,n);Cnr.readlink(t._path,function(s,o){if(o&&o===i)return Inr(t);Anr(t,i,n)})};function Anr(t,e,n){L3i(t._path,function(i){if(i)return t.error(i);M3i(t,e,n)})}function M3i(t,e,n){Cnr[n](e,t._path,function(i){if(i)if((i.code==="ENOENT"||i.code==="EACCES"||i.code==="EPERM")&&process.platform==="win32")t.ready=!0,t.emit("ready"),t.emit("end"),t.emit("close"),t.end=t._finish=function(){};else return t.error(i);Inr(t)})}function Inr(t){t.ready=!0,t.emit("ready"),t._ended&&!t._finished&&t._finish()}Jet.prototype.end=function(){this._ended=!0,this.ready&&(this._finished=!0,this._finish())}});var scn=le((XBa,knr)=>{knr.exports=tAe;var F3i=qee(),zEt=L8e(),B3i=j2(),Nnr={};B3i(tAe,zEt);function tAe(t){var e=this;if(!(e instanceof tAe))throw new Error("FileWriter must be called as constructor.");if(t.type!=="File"||!t.File)throw new Error("Non-file type "+t.type);e._buffer=[],e._bytesWritten=0,zEt.call(this,t)}tAe.prototype._create=function(){var t=this;if(!t._stream){var e={};t.props.flags&&(e.flags=t.props.flags),e.mode=zEt.filemode,t._old&&t._old.blksize&&(e.bufferSize=t._old.blksize),t._stream=F3i.createWriteStream(t._path,e),t._stream.on("open",function(){t.ready=!0,t._buffer.forEach(function(n){n===Nnr?t._stream.end():t._stream.write(n)}),t.emit("ready"),t.emit("drain")}),t._stream.on("error",function(n){t.emit("error",n)}),t._stream.on("drain",function(){t.emit("drain")}),t._stream.on("close",function(){t._finish()})}};tAe.prototype.write=function(t){var e=this;if(e._bytesWritten+=t.length,!e.ready){if(!Buffer.isBuffer(t)&&typeof t!="string")throw new Error("invalid write data");return e._buffer.push(t),!1}var n=e._stream.write(t);return n===!1&&e._stream._queue?e._stream._queue.length<=2:n};tAe.prototype.end=function(t){var e=this;return t&&e.write(t),e.ready?e._stream.end():(e._buffer.push(Nnr),!1)};tAe.prototype._finish=function(){var t=this;typeof t.size=="number"&&t._bytesWritten!==t.size&&t.error(`Did not get expected byte count.
675
675
  expect: `+t.size+`
676
676
  actual: `+t._bytesWritten),zEt.prototype._finish.call(t)}});var ocn=le((YBa,Rnr)=>{Rnr.exports=h_e;var acn=L8e(),W3i=Bet(),j3i=j2(),z3i=WEt(),G3i=require("fs");j3i(h_e,acn);function h_e(t){var e=this;if(!(e instanceof h_e))throw new Error("ProxyWriter must be called as constructor.");e.props=t,e._needDrain=!1,acn.call(e,t)}h_e.prototype._stat=function(){var t=this,e=t.props,n=e.follow?"stat":"lstat";G3i[n](e.path,function(i,s){var o;i||!s?o="File":o=W3i(s),e[o]=!0,e.type=t.type=o,t._old=s,t._addProxy(acn(e,s))})};h_e.prototype._addProxy=function(t){var e=this;if(e._proxy)return e.error("proxy already set");e._proxy=t,["ready","error","close","pipe","drain","warn"].forEach(function(i){t.on(i,e.emit.bind(e,i))}),e.emit("proxy",t);var n=e._buffer;n.forEach(function(i){t[i[0]].apply(t,i[1])}),e._buffer.length=0,e._needsDrain&&e.emit("drain")};h_e.prototype.add=function(t){return z3i(t),this._proxy?this._proxy.add(t):(this._buffer.push(["add",[t]]),this._needDrain=!0,!1)};h_e.prototype.write=function(t){return this._proxy?this._proxy.write(t):(this._buffer.push(["write",[t]]),this._needDrain=!0,!1)};h_e.prototype.end=function(t){return this._proxy?this._proxy.end(t):(this._buffer.push(["end",[t]]),!1)}});var L8e=le((QBa,Gnr)=>{Gnr.exports=uU;var cU=qee(),U3i=j2(),V3i=ecn(),q3i=tcn(),$et=require("path"),Lnr=process.platform==="win32"?0:process.umask(),Mnr=Bet(),Fnr=SEt();U3i(uU,Fnr);uU.dirmode=parseInt("0777",8)&~Lnr;uU.filemode=parseInt("0666",8)&~Lnr;var H3i=rcn(),K3i=icn(),J3i=scn(),$3i=ocn();function uU(t,e){var n=this;typeof t=="string"&&(t={path:t});var i=Mnr(t),s=uU;switch(i){case"Directory":s=H3i;break;case"File":s=J3i;break;case"Link":case"SymbolicLink":s=K3i;break;case null:default:s=$3i;break}if(!(n instanceof s))return new s(t);Fnr.call(n),t.path||n.error("Must provide a path",null,!0),n.type=t.type,n.props=t,n.depth=t.depth||0,n.clobber=t.clobber===!1?t.clobber:!0,n.parent=t.parent||null,n.root=t.root||t.parent&&t.parent.root||n,n._path=n.path=$et.resolve(t.path),process.platform==="win32"&&(n.path=n._path=n.path.replace(/\?/g,"_"),n._path.length>=260&&(n._swallowErrors=!0,n._path="\\\\?\\"+n.path.replace(/\//g,"\\"))),n.basename=$et.basename(t.path),n.dirname=$et.dirname(t.path),n.linkpath=t.linkpath||null,t.parent=t.root=null,n.size=t.size,typeof t.mode=="string"&&(t.mode=parseInt(t.mode,8)),n.readable=!1,n.writable=!0,n._buffer=[],n.ready=!1,n.filter=typeof t.filter=="function"?t.filter:null,n._stat(e)}uU.prototype._create=function(){var t=this;cU[t.props.follow?"stat":"lstat"](t._path,function(e){if(e)return t.warn("Cannot create "+t._path+`
677
- Unsupported type: `+t.type,"ENOTSUP");t._finish()})};uU.prototype._stat=function(t){var e=this,n=e.props,i=n.follow?"stat":"lstat",s=e._proxy||e;t?o(null,t):cU[i](e._path,o);function o(f,h){if(e.filter&&!e.filter.call(s,s,h)){e._aborted=!0,e.emit("end"),e.emit("close");return}if(f||!h)return lcn(e);e._old=h;var _=Mnr(h);if(_!==e.type||e.type==="File"&&h.nlink>1)return V3i(e._path,function(x){if(x)return e.error(x);e._old=null,lcn(e)});lcn(e)}};function lcn(t){q3i($et.dirname(t._path),uU.dirmode,function(e,n){return e?t.error(e):(t._madeDir=n,t._create())})}function Bnr(t,e,n,i,s){var o=e.mode,f=e.follow||t.type!=="SymbolicLink"?"chmod":"lchmod";if(!cU[f]||typeof o!="number")return s();var h=n.mode&parseInt("0777",8);if(o=o&parseInt("0777",8),o===h)return s();cU[f](i,o,s)}function Wnr(t,e,n,i,s){if(process.platform==="win32"||!process.getuid||process.getuid()!==0||typeof e.uid!="number"&&typeof e.gid!="number"||n.uid===e.uid&&n.gid===e.gid)return s();var o=t.props.follow||t.type!=="SymbolicLink"?"chown":"lchown";if(!cU[o])return s();typeof e.uid!="number"&&(e.uid=n.uid),typeof e.gid!="number"&&(e.gid=n.gid),cU[o](i,e.uid,e.gid,s)}function jnr(t,e,n,i,s){if(!cU.utimes||process.platform==="win32")return s();var o=e.follow||t.type!=="SymbolicLink"?"utimes":"lutimes";if(o==="lutimes"&&!cU[o]&&(o="utimes"),!cU[o])return s();var f=n.atime,h=n.mtime,_=e.atime,x=e.mtime;if(_===void 0&&(_=f),x===void 0&&(x=h),Onr(_)||(_=new Date(_)),Onr(x)||(_=new Date(x)),_.getTime()===f.getTime()&&x.getTime()===h.getTime())return s();cU[o](i,_,x,s)}uU.prototype._finish=function(){var t=this;if(t._finishing)return;t._finishing=!0;var e=0,n=null,i=!1;if(t._old)t._old.atime=new Date(0),t._old.mtime=new Date(0),o(t._old);else{var s=t.props.follow?"stat":"lstat";cU[s](t._path,function(h,_){if(h)if(h.code==="ENOENT"&&(t.type==="Link"||t.type==="SymbolicLink")&&process.platform==="win32"){t.ready=!0,t.emit("ready"),t.emit("end"),t.emit("close"),t.end=t._finish=function(){};return}else return t.error(h);o(t._old=_)})}return;function o(h){e+=3,Bnr(t,t.props,h,t._path,f("chmod")),Wnr(t,t.props,h,t._path,f("chown")),jnr(t,t.props,h,t._path,f("utimes"))}function f(h){return function(_){if(n)return;if(_)return _.fstream_finish_call=h,t.error(n=_);if(--e>0||i)return;if(i=!0,t._madeDir)znr(t,t._path,x);else return x();function x(v){if(v)return v.fstream_finish_call="setupMadeDir",t.error(v);t.emit("end"),t.emit("close")}}}};function znr(t,e,n){var i=t._madeDir,s=$et.dirname(e);X3i(t,s,function(o){if(o)return n(o);if(s===i)return n();znr(t,s,n)})}function X3i(t,e,n){var i={};Object.keys(t.props).forEach(function(h){i[h]=t.props[h],h==="mode"&&t.type!=="Directory"&&(i[h]=i[h]|parseInt("0111",8))});var s=3,o=null;cU.stat(e,function(h,_){if(h)return n(o=h);Bnr(t,i,_,e,f),Wnr(t,i,_,e,f),jnr(t,i,_,e,f)});function f(h){if(!o){if(h)return n(o=h);if(--s===0)return n()}}}uU.prototype.pipe=function(){this.error("Can't pipe from writable stream")};uU.prototype.add=function(){this.error("Can't add to non-Directory type")};uU.prototype.write=function(){return!0};function Y3i(t){return Object.prototype.toString.call(t)}function Onr(t){return typeof t=="object"&&Y3i(t)==="[object Date]"}});var ccn=le(Ax=>{Ax.Abstract=SEt();Ax.Reader=JDe();Ax.Writer=L8e();Ax.File={Reader:Sln(),Writer:scn()};Ax.Dir={Reader:Eln(),Writer:rcn()};Ax.Link={Reader:vln(),Writer:icn()};Ax.Proxy={Reader:Dln(),Writer:ocn()};Ax.Reader.Dir=Ax.DirReader=Ax.Dir.Reader;Ax.Reader.File=Ax.FileReader=Ax.File.Reader;Ax.Reader.Link=Ax.LinkReader=Ax.Link.Reader;Ax.Reader.Proxy=Ax.ProxyReader=Ax.Proxy.Reader;Ax.Writer.Dir=Ax.DirWriter=Ax.Dir.Writer;Ax.Writer.File=Ax.FileWriter=Ax.File.Writer;Ax.Writer.Link=Ax.LinkWriter=Ax.Link.Writer;Ax.Writer.Proxy=Ax.ProxyWriter=Ax.Proxy.Writer;Ax.collect=WEt()});var Vnr=le((e9a,Unr)=>{Unr.exports=rFi;var Q3i=fEt(),Z3i=ccn().Writer,ucn=require("path"),eFi=require("stream"),tFi=dln(),nFi=i_e();function rFi(t){t.path=ucn.resolve(ucn.normalize(t.path));var e=new Q3i(t),n=new eFi.Writable({objectMode:!0});n._write=function(s,o,f){if(s.type=="Directory")return f();var h=ucn.join(t.path,s.path.replace(/\\/g,"/"));if(h.indexOf(t.path)!=0)return f();let _=t.getWriter?t.getWriter({path:h}):Z3i({path:h});s.pipe(_).on("error",f).on("close",f)};var i=tFi(e,n);return e.once("crx-header",function(s){i.crxHeader=s}),e.pipe(n).on("finish",function(){i.emit("close")}),i.promise=function(){return new nFi(function(s,o){i.on("close",s),i.on("error",o)})},i}});var qnr=le((t9a,GEt)=>{var yI=function(t){"use strict";var e=1e7,n=7,i=9007199254740992,s=A(i),o="0123456789abcdefghijklmnopqrstuvwxyz",f=typeof BigInt=="function";function h(it,Yt,Qt,On){return typeof it>"u"?h[0]:typeof Yt<"u"?+Yt==10&&!Qt?jr(it):Fr(it,Yt,Qt,On):jr(it)}function _(it,Yt){this.value=it,this.sign=Yt,this.isSmall=!1}_.prototype=Object.create(h.prototype);function x(it){this.value=it,this.sign=it<0,this.isSmall=!0}x.prototype=Object.create(h.prototype);function v(it){this.value=it}v.prototype=Object.create(h.prototype);function T(it){return-i<it&&it<i}function A(it){return it<1e7?[it]:it<1e14?[it%1e7,Math.floor(it/1e7)]:[it%1e7,Math.floor(it/1e7)%1e7,Math.floor(it/1e14)]}function w(it){N(it);var Yt=it.length;if(Yt<4&&tn(it,s)<0)switch(Yt){case 0:return 0;case 1:return it[0];case 2:return it[0]+it[1]*e;default:return it[0]+(it[1]+it[2]*e)*e}return it}function N(it){for(var Yt=it.length;it[--Yt]===0;);it.length=Yt+1}function P(it){for(var Yt=new Array(it),Qt=-1;++Qt<it;)Yt[Qt]=0;return Yt}function F(it){return it>0?Math.floor(it):Math.ceil(it)}function j(it,Yt){var Qt=it.length,On=Yt.length,lt=new Array(Qt),er=0,gi=e,dr,xi;for(xi=0;xi<On;xi++)dr=it[xi]+Yt[xi]+er,er=dr>=gi?1:0,lt[xi]=dr-er*gi;for(;xi<Qt;)dr=it[xi]+er,er=dr===gi?1:0,lt[xi++]=dr-er*gi;return er>0&&lt.push(er),lt}function X(it,Yt){return it.length>=Yt.length?j(it,Yt):j(Yt,it)}function oe(it,Yt){var Qt=it.length,On=new Array(Qt),lt=e,er,gi;for(gi=0;gi<Qt;gi++)er=it[gi]-lt+Yt,Yt=Math.floor(er/lt),On[gi]=er-Yt*lt,Yt+=1;for(;Yt>0;)On[gi++]=Yt%lt,Yt=Math.floor(Yt/lt);return On}_.prototype.add=function(it){var Yt=jr(it);if(this.sign!==Yt.sign)return this.subtract(Yt.negate());var Qt=this.value,On=Yt.value;return Yt.isSmall?new _(oe(Qt,Math.abs(On)),this.sign):new _(X(Qt,On),this.sign)},_.prototype.plus=_.prototype.add,x.prototype.add=function(it){var Yt=jr(it),Qt=this.value;if(Qt<0!==Yt.sign)return this.subtract(Yt.negate());var On=Yt.value;if(Yt.isSmall){if(T(Qt+On))return new x(Qt+On);On=A(Math.abs(On))}return new _(oe(On,Math.abs(Qt)),Qt<0)},x.prototype.plus=x.prototype.add,v.prototype.add=function(it){return new v(this.value+jr(it).value)},v.prototype.plus=v.prototype.add;function ee(it,Yt){var Qt=it.length,On=Yt.length,lt=new Array(Qt),er=0,gi=e,dr,xi;for(dr=0;dr<On;dr++)xi=it[dr]-er-Yt[dr],xi<0?(xi+=gi,er=1):er=0,lt[dr]=xi;for(dr=On;dr<Qt;dr++){if(xi=it[dr]-er,xi<0)xi+=gi;else{lt[dr++]=xi;break}lt[dr]=xi}for(;dr<Qt;dr++)lt[dr]=it[dr];return N(lt),lt}function ge(it,Yt,Qt){var On;return tn(it,Yt)>=0?On=ee(it,Yt):(On=ee(Yt,it),Qt=!Qt),On=w(On),typeof On=="number"?(Qt&&(On=-On),new x(On)):new _(On,Qt)}function Le(it,Yt,Qt){var On=it.length,lt=new Array(On),er=-Yt,gi=e,dr,xi;for(dr=0;dr<On;dr++)xi=it[dr]+er,er=Math.floor(xi/gi),xi%=gi,lt[dr]=xi<0?xi+gi:xi;return lt=w(lt),typeof lt=="number"?(Qt&&(lt=-lt),new x(lt)):new _(lt,Qt)}_.prototype.subtract=function(it){var Yt=jr(it);if(this.sign!==Yt.sign)return this.add(Yt.negate());var Qt=this.value,On=Yt.value;return Yt.isSmall?Le(Qt,Math.abs(On),this.sign):ge(Qt,On,this.sign)},_.prototype.minus=_.prototype.subtract,x.prototype.subtract=function(it){var Yt=jr(it),Qt=this.value;if(Qt<0!==Yt.sign)return this.add(Yt.negate());var On=Yt.value;return Yt.isSmall?new x(Qt-On):Le(On,Math.abs(Qt),Qt>=0)},x.prototype.minus=x.prototype.subtract,v.prototype.subtract=function(it){return new v(this.value-jr(it).value)},v.prototype.minus=v.prototype.subtract,_.prototype.negate=function(){return new _(this.value,!this.sign)},x.prototype.negate=function(){var it=this.sign,Yt=new x(-this.value);return Yt.sign=!it,Yt},v.prototype.negate=function(){return new v(-this.value)},_.prototype.abs=function(){return new _(this.value,!1)},x.prototype.abs=function(){return new x(Math.abs(this.value))},v.prototype.abs=function(){return new v(this.value>=0?this.value:-this.value)};function xe(it,Yt){var Qt=it.length,On=Yt.length,lt=Qt+On,er=P(lt),gi=e,dr,xi,Ys,Ml,hl;for(Ys=0;Ys<Qt;++Ys){Ml=it[Ys];for(var Wc=0;Wc<On;++Wc)hl=Yt[Wc],dr=Ml*hl+er[Ys+Wc],xi=Math.floor(dr/gi),er[Ys+Wc]=dr-xi*gi,er[Ys+Wc+1]+=xi}return N(er),er}function Se(it,Yt){var Qt=it.length,On=new Array(Qt),lt=e,er=0,gi,dr;for(dr=0;dr<Qt;dr++)gi=it[dr]*Yt+er,er=Math.floor(gi/lt),On[dr]=gi-er*lt;for(;er>0;)On[dr++]=er%lt,er=Math.floor(er/lt);return On}function Ve(it,Yt){for(var Qt=[];Yt-- >0;)Qt.push(0);return Qt.concat(it)}function Xe(it,Yt){var Qt=Math.max(it.length,Yt.length);if(Qt<=30)return xe(it,Yt);Qt=Math.ceil(Qt/2);var On=it.slice(Qt),lt=it.slice(0,Qt),er=Yt.slice(Qt),gi=Yt.slice(0,Qt),dr=Xe(lt,gi),xi=Xe(On,er),Ys=Xe(X(lt,On),X(gi,er)),Ml=X(X(dr,Ve(ee(ee(Ys,dr),xi),Qt)),Ve(xi,2*Qt));return N(Ml),Ml}function Ne(it,Yt){return-.012*it-.012*Yt+15e-6*it*Yt>0}_.prototype.multiply=function(it){var Yt=jr(it),Qt=this.value,On=Yt.value,lt=this.sign!==Yt.sign,er;if(Yt.isSmall){if(On===0)return h[0];if(On===1)return this;if(On===-1)return this.negate();if(er=Math.abs(On),er<e)return new _(Se(Qt,er),lt);On=A(er)}return Ne(Qt.length,On.length)?new _(Xe(Qt,On),lt):new _(xe(Qt,On),lt)},_.prototype.times=_.prototype.multiply;function tt(it,Yt,Qt){return it<e?new _(Se(Yt,it),Qt):new _(xe(Yt,A(it)),Qt)}x.prototype._multiplyBySmall=function(it){return T(it.value*this.value)?new x(it.value*this.value):tt(Math.abs(it.value),A(Math.abs(this.value)),this.sign!==it.sign)},_.prototype._multiplyBySmall=function(it){return it.value===0?h[0]:it.value===1?this:it.value===-1?this.negate():tt(Math.abs(it.value),this.value,this.sign!==it.sign)},x.prototype.multiply=function(it){return jr(it)._multiplyBySmall(this)},x.prototype.times=x.prototype.multiply,v.prototype.multiply=function(it){return new v(this.value*jr(it).value)},v.prototype.times=v.prototype.multiply;function zt(it){var Yt=it.length,Qt=P(Yt+Yt),On=e,lt,er,gi,dr,xi;for(gi=0;gi<Yt;gi++){dr=it[gi],er=0-dr*dr;for(var Ys=gi;Ys<Yt;Ys++)xi=it[Ys],lt=2*(dr*xi)+Qt[gi+Ys]+er,er=Math.floor(lt/On),Qt[gi+Ys]=lt-er*On;Qt[gi+Yt]=er}return N(Qt),Qt}_.prototype.square=function(){return new _(zt(this.value),!1)},x.prototype.square=function(){var it=this.value*this.value;return T(it)?new x(it):new _(zt(A(Math.abs(this.value))),!1)},v.prototype.square=function(it){return new v(this.value*this.value)};function yt(it,Yt){var Qt=it.length,On=Yt.length,lt=e,er=P(Yt.length),gi=Yt[On-1],dr=Math.ceil(lt/(2*gi)),xi=Se(it,dr),Ys=Se(Yt,dr),Ml,hl,Wc,Ed,rp,Cf,cs;for(xi.length<=Qt&&xi.push(0),Ys.push(0),gi=Ys[On-1],hl=Qt-On;hl>=0;hl--){for(Ml=lt-1,xi[hl+On]!==gi&&(Ml=Math.floor((xi[hl+On]*lt+xi[hl+On-1])/gi)),Wc=0,Ed=0,Cf=Ys.length,rp=0;rp<Cf;rp++)Wc+=Ml*Ys[rp],cs=Math.floor(Wc/lt),Ed+=xi[hl+rp]-(Wc-cs*lt),Wc=cs,Ed<0?(xi[hl+rp]=Ed+lt,Ed=-1):(xi[hl+rp]=Ed,Ed=0);for(;Ed!==0;){for(Ml-=1,Wc=0,rp=0;rp<Cf;rp++)Wc+=xi[hl+rp]-lt+Ys[rp],Wc<0?(xi[hl+rp]=Wc+lt,Wc=0):(xi[hl+rp]=Wc,Wc=1);Ed+=Wc}er[hl]=Ml}return xi=dt(xi,dr)[0],[w(er),w(xi)]}function nn(it,Yt){for(var Qt=it.length,On=Yt.length,lt=[],er=[],gi=e,dr,xi,Ys,Ml,hl;Qt;){if(er.unshift(it[--Qt]),N(er),tn(er,Yt)<0){lt.push(0);continue}xi=er.length,Ys=er[xi-1]*gi+er[xi-2],Ml=Yt[On-1]*gi+Yt[On-2],xi>On&&(Ys=(Ys+1)*gi),dr=Math.ceil(Ys/Ml);do{if(hl=Se(Yt,dr),tn(hl,er)<=0)break;dr--}while(dr);lt.push(dr),er=ee(er,hl)}return lt.reverse(),[w(lt),w(er)]}function dt(it,Yt){var Qt=it.length,On=P(Qt),lt=e,er,gi,dr,xi;for(dr=0,er=Qt-1;er>=0;--er)xi=dr*lt+it[er],gi=F(xi/Yt),dr=xi-gi*Yt,On[er]=gi|0;return[On,dr|0]}function Ht(it,Yt){var Qt,On=jr(Yt);if(f)return[new v(it.value/On.value),new v(it.value%On.value)];var lt=it.value,er=On.value,gi;if(er===0)throw new Error("Cannot divide by zero");if(it.isSmall)return On.isSmall?[new x(F(lt/er)),new x(lt%er)]:[h[0],it];if(On.isSmall){if(er===1)return[it,h[0]];if(er==-1)return[it.negate(),h[0]];var dr=Math.abs(er);if(dr<e){Qt=dt(lt,dr),gi=w(Qt[0]);var xi=Qt[1];return it.sign&&(xi=-xi),typeof gi=="number"?(it.sign!==On.sign&&(gi=-gi),[new x(gi),new x(xi)]):[new _(gi,it.sign!==On.sign),new x(xi)]}er=A(dr)}var Ys=tn(lt,er);if(Ys===-1)return[h[0],it];if(Ys===0)return[h[it.sign===On.sign?1:-1],h[0]];lt.length+er.length<=200?Qt=yt(lt,er):Qt=nn(lt,er),gi=Qt[0];var Ml=it.sign!==On.sign,hl=Qt[1],Wc=it.sign;return typeof gi=="number"?(Ml&&(gi=-gi),gi=new x(gi)):gi=new _(gi,Ml),typeof hl=="number"?(Wc&&(hl=-hl),hl=new x(hl)):hl=new _(hl,Wc),[gi,hl]}_.prototype.divmod=function(it){var Yt=Ht(this,it);return{quotient:Yt[0],remainder:Yt[1]}},v.prototype.divmod=x.prototype.divmod=_.prototype.divmod,_.prototype.divide=function(it){return Ht(this,it)[0]},v.prototype.over=v.prototype.divide=function(it){return new v(this.value/jr(it).value)},x.prototype.over=x.prototype.divide=_.prototype.over=_.prototype.divide,_.prototype.mod=function(it){return Ht(this,it)[1]},v.prototype.mod=v.prototype.remainder=function(it){return new v(this.value%jr(it).value)},x.prototype.remainder=x.prototype.mod=_.prototype.remainder=_.prototype.mod,_.prototype.pow=function(it){var Yt=jr(it),Qt=this.value,On=Yt.value,lt,er,gi;if(On===0)return h[1];if(Qt===0)return h[0];if(Qt===1)return h[1];if(Qt===-1)return Yt.isEven()?h[1]:h[-1];if(Yt.sign)return h[0];if(!Yt.isSmall)throw new Error("The exponent "+Yt.toString()+" is too large.");if(this.isSmall&&T(lt=Math.pow(Qt,On)))return new x(F(lt));for(er=this,gi=h[1];On&!0&&(gi=gi.times(er),--On),On!==0;)On/=2,er=er.square();return gi},x.prototype.pow=_.prototype.pow,v.prototype.pow=function(it){var Yt=jr(it),Qt=this.value,On=Yt.value,lt=BigInt(0),er=BigInt(1),gi=BigInt(2);if(On===lt)return h[1];if(Qt===lt)return h[0];if(Qt===er)return h[1];if(Qt===BigInt(-1))return Yt.isEven()?h[1]:h[-1];if(Yt.isNegative())return new v(lt);for(var dr=this,xi=h[1];(On&er)===er&&(xi=xi.times(dr),--On),On!==lt;)On/=gi,dr=dr.square();return xi},_.prototype.modPow=function(it,Yt){if(it=jr(it),Yt=jr(Yt),Yt.isZero())throw new Error("Cannot take modPow with modulus 0");var Qt=h[1],On=this.mod(Yt);for(it.isNegative()&&(it=it.multiply(h[-1]),On=On.modInv(Yt));it.isPositive();){if(On.isZero())return h[0];it.isOdd()&&(Qt=Qt.multiply(On).mod(Yt)),it=it.divide(2),On=On.square().mod(Yt)}return Qt},v.prototype.modPow=x.prototype.modPow=_.prototype.modPow;function tn(it,Yt){if(it.length!==Yt.length)return it.length>Yt.length?1:-1;for(var Qt=it.length-1;Qt>=0;Qt--)if(it[Qt]!==Yt[Qt])return it[Qt]>Yt[Qt]?1:-1;return 0}_.prototype.compareAbs=function(it){var Yt=jr(it),Qt=this.value,On=Yt.value;return Yt.isSmall?1:tn(Qt,On)},x.prototype.compareAbs=function(it){var Yt=jr(it),Qt=Math.abs(this.value),On=Yt.value;return Yt.isSmall?(On=Math.abs(On),Qt===On?0:Qt>On?1:-1):-1},v.prototype.compareAbs=function(it){var Yt=this.value,Qt=jr(it).value;return Yt=Yt>=0?Yt:-Yt,Qt=Qt>=0?Qt:-Qt,Yt===Qt?0:Yt>Qt?1:-1},_.prototype.compare=function(it){if(it===1/0)return-1;if(it===-1/0)return 1;var Yt=jr(it),Qt=this.value,On=Yt.value;return this.sign!==Yt.sign?Yt.sign?1:-1:Yt.isSmall?this.sign?-1:1:tn(Qt,On)*(this.sign?-1:1)},_.prototype.compareTo=_.prototype.compare,x.prototype.compare=function(it){if(it===1/0)return-1;if(it===-1/0)return 1;var Yt=jr(it),Qt=this.value,On=Yt.value;return Yt.isSmall?Qt==On?0:Qt>On?1:-1:Qt<0!==Yt.sign?Qt<0?-1:1:Qt<0?1:-1},x.prototype.compareTo=x.prototype.compare,v.prototype.compare=function(it){if(it===1/0)return-1;if(it===-1/0)return 1;var Yt=this.value,Qt=jr(it).value;return Yt===Qt?0:Yt>Qt?1:-1},v.prototype.compareTo=v.prototype.compare,_.prototype.equals=function(it){return this.compare(it)===0},v.prototype.eq=v.prototype.equals=x.prototype.eq=x.prototype.equals=_.prototype.eq=_.prototype.equals,_.prototype.notEquals=function(it){return this.compare(it)!==0},v.prototype.neq=v.prototype.notEquals=x.prototype.neq=x.prototype.notEquals=_.prototype.neq=_.prototype.notEquals,_.prototype.greater=function(it){return this.compare(it)>0},v.prototype.gt=v.prototype.greater=x.prototype.gt=x.prototype.greater=_.prototype.gt=_.prototype.greater,_.prototype.lesser=function(it){return this.compare(it)<0},v.prototype.lt=v.prototype.lesser=x.prototype.lt=x.prototype.lesser=_.prototype.lt=_.prototype.lesser,_.prototype.greaterOrEquals=function(it){return this.compare(it)>=0},v.prototype.geq=v.prototype.greaterOrEquals=x.prototype.geq=x.prototype.greaterOrEquals=_.prototype.geq=_.prototype.greaterOrEquals,_.prototype.lesserOrEquals=function(it){return this.compare(it)<=0},v.prototype.leq=v.prototype.lesserOrEquals=x.prototype.leq=x.prototype.lesserOrEquals=_.prototype.leq=_.prototype.lesserOrEquals,_.prototype.isEven=function(){return(this.value[0]&1)===0},x.prototype.isEven=function(){return(this.value&1)===0},v.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},_.prototype.isOdd=function(){return(this.value[0]&1)===1},x.prototype.isOdd=function(){return(this.value&1)===1},v.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},_.prototype.isPositive=function(){return!this.sign},x.prototype.isPositive=function(){return this.value>0},v.prototype.isPositive=x.prototype.isPositive,_.prototype.isNegative=function(){return this.sign},x.prototype.isNegative=function(){return this.value<0},v.prototype.isNegative=x.prototype.isNegative,_.prototype.isUnit=function(){return!1},x.prototype.isUnit=function(){return Math.abs(this.value)===1},v.prototype.isUnit=function(){return this.abs().value===BigInt(1)},_.prototype.isZero=function(){return!1},x.prototype.isZero=function(){return this.value===0},v.prototype.isZero=function(){return this.value===BigInt(0)},_.prototype.isDivisibleBy=function(it){var Yt=jr(it);return Yt.isZero()?!1:Yt.isUnit()?!0:Yt.compareAbs(2)===0?this.isEven():this.mod(Yt).isZero()},v.prototype.isDivisibleBy=x.prototype.isDivisibleBy=_.prototype.isDivisibleBy;function Or(it){var Yt=it.abs();if(Yt.isUnit())return!1;if(Yt.equals(2)||Yt.equals(3)||Yt.equals(5))return!0;if(Yt.isEven()||Yt.isDivisibleBy(3)||Yt.isDivisibleBy(5))return!1;if(Yt.lesser(49))return!0}function Kt(it,Yt){for(var Qt=it.prev(),On=Qt,lt=0,er,gi,dr,xi;On.isEven();)On=On.divide(2),lt++;e:for(dr=0;dr<Yt.length;dr++)if(!it.lesser(Yt[dr])&&(xi=yI(Yt[dr]).modPow(On,it),!(xi.isUnit()||xi.equals(Qt)))){for(er=lt-1;er!=0;er--){if(xi=xi.square().mod(it),xi.isUnit())return!1;if(xi.equals(Qt))continue e}return!1}return!0}_.prototype.isPrime=function(it){var Yt=Or(this);if(Yt!==t)return Yt;var Qt=this.abs(),On=Qt.bitLength();if(On<=64)return Kt(Qt,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var lt=Math.log(2)*On.toJSNumber(),er=Math.ceil(it===!0?2*Math.pow(lt,2):lt),gi=[],dr=0;dr<er;dr++)gi.push(yI(dr+2));return Kt(Qt,gi)},v.prototype.isPrime=x.prototype.isPrime=_.prototype.isPrime,_.prototype.isProbablePrime=function(it,Yt){var Qt=Or(this);if(Qt!==t)return Qt;for(var On=this.abs(),lt=it===t?5:it,er=[],gi=0;gi<lt;gi++)er.push(yI.randBetween(2,On.minus(2),Yt));return Kt(On,er)},v.prototype.isProbablePrime=x.prototype.isProbablePrime=_.prototype.isProbablePrime,_.prototype.modInv=function(it){for(var Yt=yI.zero,Qt=yI.one,On=jr(it),lt=this.abs(),er,gi,dr;!lt.isZero();)er=On.divide(lt),gi=Yt,dr=On,Yt=Qt,On=lt,Qt=gi.subtract(er.multiply(Qt)),lt=dr.subtract(er.multiply(lt));if(!On.isUnit())throw new Error(this.toString()+" and "+it.toString()+" are not co-prime");return Yt.compare(0)===-1&&(Yt=Yt.add(it)),this.isNegative()?Yt.negate():Yt},v.prototype.modInv=x.prototype.modInv=_.prototype.modInv,_.prototype.next=function(){var it=this.value;return this.sign?Le(it,1,this.sign):new _(oe(it,1),this.sign)},x.prototype.next=function(){var it=this.value;return it+1<i?new x(it+1):new _(s,!1)},v.prototype.next=function(){return new v(this.value+BigInt(1))},_.prototype.prev=function(){var it=this.value;return this.sign?new _(oe(it,1),!0):Le(it,1,this.sign)},x.prototype.prev=function(){var it=this.value;return it-1>-i?new x(it-1):new _(s,!0)},v.prototype.prev=function(){return new v(this.value-BigInt(1))};for(var Gn=[1];2*Gn[Gn.length-1]<=e;)Gn.push(2*Gn[Gn.length-1]);var En=Gn.length,At=Gn[En-1];function Un(it){return Math.abs(it)<=e}_.prototype.shiftLeft=function(it){var Yt=jr(it).toJSNumber();if(!Un(Yt))throw new Error(String(Yt)+" is too large for shifting.");if(Yt<0)return this.shiftRight(-Yt);var Qt=this;if(Qt.isZero())return Qt;for(;Yt>=En;)Qt=Qt.multiply(At),Yt-=En-1;return Qt.multiply(Gn[Yt])},v.prototype.shiftLeft=x.prototype.shiftLeft=_.prototype.shiftLeft,_.prototype.shiftRight=function(it){var Yt,Qt=jr(it).toJSNumber();if(!Un(Qt))throw new Error(String(Qt)+" is too large for shifting.");if(Qt<0)return this.shiftLeft(-Qt);for(var On=this;Qt>=En;){if(On.isZero()||On.isNegative()&&On.isUnit())return On;Yt=Ht(On,At),On=Yt[1].isNegative()?Yt[0].prev():Yt[0],Qt-=En-1}return Yt=Ht(On,Gn[Qt]),Yt[1].isNegative()?Yt[0].prev():Yt[0]},v.prototype.shiftRight=x.prototype.shiftRight=_.prototype.shiftRight;function Hr(it,Yt,Qt){Yt=jr(Yt);for(var On=it.isNegative(),lt=Yt.isNegative(),er=On?it.not():it,gi=lt?Yt.not():Yt,dr=0,xi=0,Ys=null,Ml=null,hl=[];!er.isZero()||!gi.isZero();)Ys=Ht(er,At),dr=Ys[1].toJSNumber(),On&&(dr=At-1-dr),Ml=Ht(gi,At),xi=Ml[1].toJSNumber(),lt&&(xi=At-1-xi),er=Ys[0],gi=Ml[0],hl.push(Qt(dr,xi));for(var Wc=Qt(On?1:0,lt?1:0)!==0?yI(-1):yI(0),Ed=hl.length-1;Ed>=0;Ed-=1)Wc=Wc.multiply(At).add(yI(hl[Ed]));return Wc}_.prototype.not=function(){return this.negate().prev()},v.prototype.not=x.prototype.not=_.prototype.not,_.prototype.and=function(it){return Hr(this,it,function(Yt,Qt){return Yt&Qt})},v.prototype.and=x.prototype.and=_.prototype.and,_.prototype.or=function(it){return Hr(this,it,function(Yt,Qt){return Yt|Qt})},v.prototype.or=x.prototype.or=_.prototype.or,_.prototype.xor=function(it){return Hr(this,it,function(Yt,Qt){return Yt^Qt})},v.prototype.xor=x.prototype.xor=_.prototype.xor;var Kr=1<<30,Ur=(e&-e)*(e&-e)|Kr;function Gi(it){var Yt=it.value,Qt=typeof Yt=="number"?Yt|Kr:typeof Yt=="bigint"?Yt|BigInt(Kr):Yt[0]+Yt[1]*e|Ur;return Qt&-Qt}function $i(it,Yt){if(Yt.compareTo(it)<=0){var Qt=$i(it,Yt.square(Yt)),On=Qt.p,lt=Qt.e,er=On.multiply(Yt);return er.compareTo(it)<=0?{p:er,e:lt*2+1}:{p:On,e:lt*2}}return{p:yI(1),e:0}}_.prototype.bitLength=function(){var it=this;return it.compareTo(yI(0))<0&&(it=it.negate().subtract(yI(1))),it.compareTo(yI(0))===0?yI(0):yI($i(it,yI(2)).e).add(yI(1))},v.prototype.bitLength=x.prototype.bitLength=_.prototype.bitLength;function Ta(it,Yt){return it=jr(it),Yt=jr(Yt),it.greater(Yt)?it:Yt}function Rt(it,Yt){return it=jr(it),Yt=jr(Yt),it.lesser(Yt)?it:Yt}function Fa(it,Yt){if(it=jr(it).abs(),Yt=jr(Yt).abs(),it.equals(Yt))return it;if(it.isZero())return Yt;if(Yt.isZero())return it;for(var Qt=h[1],On,lt;it.isEven()&&Yt.isEven();)On=Rt(Gi(it),Gi(Yt)),it=it.divide(On),Yt=Yt.divide(On),Qt=Qt.multiply(On);for(;it.isEven();)it=it.divide(Gi(it));do{for(;Yt.isEven();)Yt=Yt.divide(Gi(Yt));it.greater(Yt)&&(lt=Yt,Yt=it,it=lt),Yt=Yt.subtract(it)}while(!Yt.isZero());return Qt.isUnit()?it:it.multiply(Qt)}function ls(it,Yt){return it=jr(it).abs(),Yt=jr(Yt).abs(),it.divide(Fa(it,Yt)).multiply(Yt)}function Kl(it,Yt,Qt){it=jr(it),Yt=jr(Yt);var On=Qt||Math.random,lt=Rt(it,Yt),er=Ta(it,Yt),gi=er.subtract(lt).add(1);if(gi.isSmall)return lt.add(Math.floor(On()*gi));for(var dr=ws(gi,e).value,xi=[],Ys=!0,Ml=0;Ml<dr.length;Ml++){var hl=Ys?dr[Ml]+(Ml+1<dr.length?dr[Ml+1]/e:0):e,Wc=F(On()*hl);xi.push(Wc),Wc<dr[Ml]&&(Ys=!1)}return lt.add(h.fromArray(xi,e,!1))}var Fr=function(it,Yt,Qt,On){Qt=Qt||o,it=String(it),On||(it=it.toLowerCase(),Qt=Qt.toLowerCase());var lt=it.length,er,gi=Math.abs(Yt),dr={};for(er=0;er<Qt.length;er++)dr[Qt[er]]=er;for(er=0;er<lt;er++){var xi=it[er];if(xi!=="-"&&xi in dr&&dr[xi]>=gi){if(xi==="1"&&gi===1)continue;throw new Error(xi+" is not a valid digit in base "+Yt+".")}}Yt=jr(Yt);var Ys=[],Ml=it[0]==="-";for(er=Ml?1:0;er<it.length;er++){var xi=it[er];if(xi in dr)Ys.push(jr(dr[xi]));else if(xi==="<"){var hl=er;do er++;while(it[er]!==">"&&er<it.length);Ys.push(jr(it.slice(hl+1,er)))}else throw new Error(xi+" is not a valid character")}return Hi(Ys,Yt,Ml)};function Hi(it,Yt,Qt){var On=h[0],lt=h[1],er;for(er=it.length-1;er>=0;er--)On=On.add(it[er].times(lt)),lt=lt.times(Yt);return Qt?On.negate():On}function yo(it,Yt){return Yt=Yt||o,it<Yt.length?Yt[it]:"<"+it+">"}function ws(it,Yt){if(Yt=yI(Yt),Yt.isZero()){if(it.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(Yt.equals(-1)){if(it.isZero())return{value:[0],isNegative:!1};if(it.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-it.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var Qt=Array.apply(null,Array(it.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return Qt.unshift([1]),{value:[].concat.apply([],Qt),isNegative:!1}}var On=!1;if(it.isNegative()&&Yt.isPositive()&&(On=!0,it=it.abs()),Yt.isUnit())return it.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(it.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:On};for(var lt=[],er=it,gi;er.isNegative()||er.compareAbs(Yt)>=0;){gi=er.divmod(Yt),er=gi.quotient;var dr=gi.remainder;dr.isNegative()&&(dr=Yt.minus(dr).abs(),er=er.next()),lt.push(dr.toJSNumber())}return lt.push(er.toJSNumber()),{value:lt.reverse(),isNegative:On}}function Mr(it,Yt,Qt){var On=ws(it,Yt);return(On.isNegative?"-":"")+On.value.map(function(lt){return yo(lt,Qt)}).join("")}_.prototype.toArray=function(it){return ws(this,it)},x.prototype.toArray=function(it){return ws(this,it)},v.prototype.toArray=function(it){return ws(this,it)},_.prototype.toString=function(it,Yt){if(it===t&&(it=10),it!==10||Yt)return Mr(this,it,Yt);for(var Qt=this.value,On=Qt.length,lt=String(Qt[--On]),er="0000000",gi;--On>=0;)gi=String(Qt[On]),lt+=er.slice(gi.length)+gi;var dr=this.sign?"-":"";return dr+lt},x.prototype.toString=function(it,Yt){return it===t&&(it=10),it!=10||Yt?Mr(this,it,Yt):String(this.value)},v.prototype.toString=x.prototype.toString,v.prototype.toJSON=_.prototype.toJSON=x.prototype.toJSON=function(){return this.toString()},_.prototype.valueOf=function(){return parseInt(this.toString(),10)},_.prototype.toJSNumber=_.prototype.valueOf,x.prototype.valueOf=function(){return this.value},x.prototype.toJSNumber=x.prototype.valueOf,v.prototype.valueOf=v.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function Yi(it){if(T(+it)){var Yt=+it;if(Yt===F(Yt))return f?new v(BigInt(Yt)):new x(Yt);throw new Error("Invalid integer: "+it)}var Qt=it[0]==="-";Qt&&(it=it.slice(1));var On=it.split(/e/i);if(On.length>2)throw new Error("Invalid integer: "+On.join("e"));if(On.length===2){var lt=On[1];if(lt[0]==="+"&&(lt=lt.slice(1)),lt=+lt,lt!==F(lt)||!T(lt))throw new Error("Invalid integer: "+lt+" is not a valid exponent.");var er=On[0],gi=er.indexOf(".");if(gi>=0&&(lt-=er.length-gi-1,er=er.slice(0,gi)+er.slice(gi+1)),lt<0)throw new Error("Cannot include negative exponent part for integers");er+=new Array(lt+1).join("0"),it=er}var dr=/^([0-9][0-9]*)$/.test(it);if(!dr)throw new Error("Invalid integer: "+it);if(f)return new v(BigInt(Qt?"-"+it:it));for(var xi=[],Ys=it.length,Ml=n,hl=Ys-Ml;Ys>0;)xi.push(+it.slice(hl,Ys)),hl-=Ml,hl<0&&(hl=0),Ys-=Ml;return N(xi),new _(xi,Qt)}function Lr(it){if(f)return new v(BigInt(it));if(T(it)){if(it!==F(it))throw new Error(it+" is not an integer.");return new x(it)}return Yi(it.toString())}function jr(it){return typeof it=="number"?Lr(it):typeof it=="string"?Yi(it):typeof it=="bigint"?new v(it):it}for(var lr=0;lr<1e3;lr++)h[lr]=jr(lr),lr>0&&(h[-lr]=jr(-lr));return h.one=h[1],h.zero=h[0],h.minusOne=h[-1],h.max=Ta,h.min=Rt,h.gcd=Fa,h.lcm=ls,h.isInstance=function(it){return it instanceof _||it instanceof x||it instanceof v},h.randBetween=Kl,h.fromArray=function(it,Yt,Qt){return Hi(it.map(jr),jr(Yt||10),Qt)},h}();typeof GEt<"u"&&GEt.hasOwnProperty("exports")&&(GEt.exports=yI);typeof define=="function"&&define.amd&&define(function(){return yI})});var Jnr=le((n9a,Knr)=>{var m_e=qnr(),iFi=require("stream"),UEt;function sFi(){var t=3988292384,e,n,i;for(UEt=[],n=0;n<256;n++){for(e=n,i=0;i<8;i++)e=e&1?t^e>>>1:e=e>>>1;UEt[n]=e>>>0}}function Hnr(t,e){return UEt||sFi(),t.charCodeAt&&(t=t.charCodeAt(0)),m_e(e).shiftRight(8).and(16777215).xor(UEt[m_e(e).xor(t).and(255)]).value}function M8e(){if(!(this instanceof M8e))return new M8e;this.key0=305419896,this.key1=591751049,this.key2=878082192}M8e.prototype.update=function(t){this.key0=Hnr(t,this.key0),this.key1=m_e(this.key0).and(255).and(4294967295).add(this.key1),this.key1=m_e(this.key1).multiply(134775813).add(1).and(4294967295).value,this.key2=Hnr(m_e(this.key1).shiftRight(24).and(255),this.key2)};M8e.prototype.decryptByte=function(t){var e=m_e(this.key2).or(2);return t=t^m_e(e).multiply(m_e(e^1)).shiftRight(8).and(255),this.update(t),t};M8e.prototype.stream=function(){var t=iFi.Transform(),e=this;return t._transform=function(n,i,s){for(var o=0;o<n.length;o++)n[o]=e.decryptByte(n[o]);this.push(n),s()},t};Knr.exports=M8e});var Ynr=le((r9a,Xnr)=>{var aFi=i_e(),oFi=Jnr(),lFi=oEt(),$nr=require("stream"),cFi=require("zlib"),uFi=cEt(),fFi=uEt(),dFi=Cet();Xnr.exports=function(e,n,i,s,o){var f=lFi(),h=$nr.PassThrough(),_=e.stream(n,o);return _.pipe(f).on("error",function(x){h.emit("error",x)}),h.vars=f.pull(30).then(function(x){var v=dFi.parse(x,[["signature",4],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2]]);return v.lastModifiedDateTime=fFi(v.lastModifiedDate,v.lastModifiedTime),f.pull(v.fileNameLength).then(function(T){return v.fileName=T.toString("utf8"),f.pull(v.extraFieldLength)}).then(function(T){var A;return v.extra=uFi(T,v),s&&s.compressedSize&&(v=s),v.flags&1&&(A=f.pull(12).then(function(w){if(!i)throw new Error("MISSING_PASSWORD");var N=oFi();String(i).split("").forEach(function(j){N.update(j)});for(var P=0;P<w.length;P++)w[P]=N.decryptByte(w[P]);v.decrypt=N,v.compressedSize-=12;var F=v.flags&8?v.lastModifiedTime>>8&255:v.crc32>>24&255;if(w[11]!==F)throw new Error("BAD_PASSWORD");return v})),aFi.resolve(A).then(function(){return h.emit("vars",v),v})})}),h.vars.then(function(x){var v=!(x.flags&8)||x.compressedSize>0,T,A=x.compressionMethod?cFi.createInflateRaw():$nr.PassThrough();v?(h.size=x.uncompressedSize,T=x.compressedSize):(T=Buffer.alloc(4),T.writeUInt32LE(134695760,0));var w=f.stream(T);x.decrypt&&(w=w.pipe(x.decrypt.stream())),w.pipe(A).on("error",function(N){h.emit("error",N)}).pipe(h).on("finish",function(){_.destroy?_.destroy():_.abort?_.abort():_.close?_.close():_.push?_.push():console.log("warning - unable to close stream")})}).catch(function(x){h.emit("error",x)}),h}});var err=le((i9a,Znr)=>{var Yet=oEt(),pFi=Ynr(),Xet=i_e(),hFi=lEt(),mFi=cEt(),fcn=require("path"),_Fi=ccn().Writer,gFi=uEt(),Qet=Cet(),Qnr=Buffer.alloc(4);Qnr.writeUInt32LE(101010256,0);function xFi(t){var e=t.stream(0).pipe(Yet());return e.pull(4).then(function(n){var i=n.readUInt32LE(0);if(i===875721283){var s;return e.pull(12).then(function(o){s=Qet.parse(o,[["version",4],["pubKeyLength",4],["signatureLength",4]])}).then(function(){return e.pull(s.pubKeyLength+s.signatureLength)}).then(function(o){return s.publicKey=o.slice(0,s.pubKeyLength),s.signature=o.slice(s.pubKeyLength),s.size=16+s.pubKeyLength+s.signatureLength,s})}})}function yFi(t,e){var n=Qet.parse(e,[["signature",4],["diskNumber",4],["offsetToStartOfCentralDirectory",8],["numberOfDisks",4]]);if(n.signature!=117853008)throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x"+n.signature.toString(16));var i=Yet();return t.stream(n.offsetToStartOfCentralDirectory).pipe(i),i.pull(56)}function vFi(t){var e=Qet.parse(t,[["signature",4],["sizeOfCentralDirectory",8],["version",2],["versionsNeededToExtract",2],["diskNumber",4],["diskStart",4],["numberOfRecordsOnDisk",8],["numberOfRecords",8],["sizeOfCentralDirectory",8],["offsetToStartOfCentralDirectory",8]]);if(e.signature!=101075792)throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0"+e.signature.toString(16));return e}Znr.exports=function(e,n){var i=Yet(),s=Yet(),o=n&&n.tailSize||80,f,h,_,x;return n&&n.crx&&(h=xFi(e)),e.size().then(function(v){return f=v,e.stream(Math.max(0,v-o)).on("error",function(T){i.emit("error",T)}).pipe(i),i.pull(Qnr)}).then(function(){return Xet.props({directory:i.pull(22),crxHeader:h})}).then(function(v){var T=v.directory;if(_=v.crxHeader&&v.crxHeader.size||0,x=Qet.parse(T,[["signature",4],["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]),x.numberOfRecords==65535||x.numberOfRecords==65535||x.offsetToStartOfCentralDirectory==4294967295){let w=f-(o-i.match+20),N=Yet();return e.stream(w).pipe(N),N.pull(20).then(function(P){return yFi(e,P)}).then(function(P){x=vFi(P)})}else x.offsetToStartOfCentralDirectory+=_}).then(function(){if(x.commentLength)return i.pull(x.commentLength).then(function(v){x.comment=v.toString("utf8")})}).then(function(){return e.stream(x.offsetToStartOfCentralDirectory).pipe(s),x.extract=function(v){if(!v||!v.path)throw new Error("PATH_MISSING");return v.path=fcn.resolve(fcn.normalize(v.path)),x.files.then(function(T){return Xet.map(T,function(A){if(A.type!="Directory"){var w=fcn.join(v.path,A.path);if(w.indexOf(v.path)==0){var N=v.getWriter?v.getWriter({path:w}):_Fi({path:w});return new Xet(function(P,F){A.stream(v.password).on("error",F).pipe(N).on("close",P).on("error",F)})}}},{concurrency:v.concurrency>1?v.concurrency:1})})},x.files=Xet.mapSeries(Array(x.numberOfRecords),function(){return s.pull(46).then(function(v){var T=T=Qet.parse(v,[["signature",4],["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return T.offsetToLocalFileHeader+=_,T.lastModifiedDateTime=gFi(T.lastModifiedDate,T.lastModifiedTime),s.pull(T.fileNameLength).then(function(A){return T.pathBuffer=A,T.path=A.toString("utf8"),T.isUnicode=(T.flags&2048)!=0,s.pull(T.extraFieldLength)}).then(function(A){return T.extra=mFi(A,T),s.pull(T.fileCommentLength)}).then(function(A){T.comment=A,T.type=T.uncompressedSize===0&&/[\/\\]$/.test(T.path)?"Directory":"File";var w=n&&n.padding||1e3;return T.stream=function(N){var P=30+w+(T.extraFieldLength||0)+(T.fileNameLength||0)+T.compressedSize;return pFi(e,T.offsetToLocalFileHeader,N,T,P)},T.buffer=function(N){return hFi(T.stream(N))},T})})}),Xet.props(x)})}});var rrr=le((s9a,nrr)=>{var trr=qee(),VEt=i_e(),Zet=err(),bFi=require("stream");nrr.exports={buffer:function(t,e){var n={stream:function(i,s){var o=bFi.PassThrough(),f=s?i+s:void 0;return o.end(t.slice(i,f)),o},size:function(){return VEt.resolve(t.length)}};return Zet(n,e)},file:function(t,e){var n={stream:function(i,s){var o=s?i+s:void 0;return trr.createReadStream(t,{start:i,end:o})},size:function(){return new VEt(function(i,s){trr.stat(t,function(o,f){o?s(o):i(f.size)})})}};return Zet(n,e)},url:function(t,e,n){if(typeof e=="string"&&(e={url:e}),!e.url)throw"URL missing";e.headers=e.headers||{};var i={stream:function(s,o){var f=Object.create(e),h=o?s+o:"";return f.headers=Object.create(e.headers),f.headers.range="bytes="+s+"-"+h,t(f)},size:function(){return new VEt(function(s,o){var f=t(e);f.on("response",function(h){f.abort(),h.headers["content-length"]?s(h.headers["content-length"]):o(new Error("Missing content length header"))}).on("error",o)})}};return Zet(i,n)},s3:function(t,e,n){var i={size:function(){return new VEt(function(s,o){t.headObject(e,function(f,h){f?o(f):s(h.ContentLength)})})},stream:function(s,o){var f={};for(var h in e)f[h]=e[h];var _=o?s+o:"";return f.Range="bytes="+s+"-"+_,t.getObject(f).createReadStream()}};return Zet(i,n)},custom:function(t,e){return Zet(t,e)}}});var irr=le(ett=>{"use strict";ett.Parse=fEt();ett.ParseOne=Zer();ett.Extract=Vnr();ett.Open=rrr()});var EFi,dcn,pcn,srr,Kee,arr,orr,lrr,crr,urr=Ct(()=>{"use strict";EFi=Ho(XHn(),1);gJn();dcn=Ho(xYn(),1),pcn=Ho(yQn(),1),srr=Ho(irr(),1),Kee=require("node:fs/promises"),arr=async(t,e)=>{await(0,Kee.access)(t,Kee.constants.F_OK).catch(()=>{throw new Error(`[Archiver]: source ${t} does not exist`)}),await(0,Kee.access)(e,Kee.constants.F_OK).catch(()=>(0,Kee.mkdir)(e,{recursive:!0}))},orr=async(t,e)=>(await arr(t,e),dcn.x({file:t,cwd:e})),lrr=async(t,e)=>(await arr(t,e),await srr.default.Open.file(t).then(n=>n.extract({path:e,concurrency:5})),e),crr=async t=>{let e=pcn.pack();for(let{name:s,data:o}of Object.values(t))e.entry({name:s},o);e.finalize();let n=[];return e.on("data",s=>n.push(s)),await new Promise((s,o)=>{e.on("end",s),e.on("error",o)}),Buffer.from(_Jn.gzip(Buffer.concat(n)))}});async function Jee(t){let{source:e,throwOnNotFound:n=!1}=t,i=await(0,frr.readFile)((0,drr.join)(e,".codemodrc.json"),{encoding:"utf-8"}).catch(()=>null);if(i===null){let o=`Could not locate the .codemodrc.json file at ${e}`;if(n)throw new Error(o);return{config:null,error:o}}let s;try{s=vme(JSON.parse(i))}catch{let f=`Failed to parse the .codemodrc.json file at ${e}`;if(n)throw new Error(f);return{config:null,error:f}}return{config:s,error:null}}async function hle(t){let{source:e,throwOnNotFound:n}=t,{config:i,error:s}=await Jee({source:e,throwOnNotFound:!1});if(i===null){if(n)throw new Error(s);return{path:null,error:s}}let o;switch(i.engine){case"ast-grep":o="**/rule.yaml";break;default:o="src/index.{ts,js}";break}let f=i.entry?`Make sure the entry point path under ${F2("entry")} key is correct in .codemodrc.json`:`Could not find an entry point under ${F2(o)}. Either create it or provide a path at ${F2("entry")} key in .codemodrc.json`,_=(await n3(i.entry??o,{absolute:!0,cwd:e,nodir:!0})).at(0)??null;if(_===null){if(n)throw new Error(f);return{path:null,error:f}}return{path:_,error:null}}var frr,drr,prr=Ct(()=>{"use strict";frr=require("node:fs/promises"),drr=require("node:path");Ame();vQe();e1t()});var hrr=Ct(()=>{"use strict"});var mrr=Ct(()=>{"use strict"});var _rr=Ct(()=>{"use strict"});var grr,xrr,pN,yrr,hcn=Ct(()=>{"use strict";grr=require("node:child_process"),xrr=require("node:util"),pN=(0,xrr.promisify)(grr.exec),yrr=async t=>{let e=t(),{done:n}=await e.next();return n}});async function qEt(t,e=!1){let n=null,i=null;try{let{stdout:o}=await pN("git rev-parse --show-toplevel",{cwd:t}),f=o.trim();if(f.length&&(i=f,e))return{rootPath:i}}catch{}if(i===null){let o=t;for(;;){try{await(0,cJ.access)((0,nAe.join)(o,".git"),cJ.constants.R_OK|cJ.constants.W_OK);let h=(0,nAe.join)(o,"package.json");await(0,cJ.access)(h,cJ.constants.R_OK|cJ.constants.W_OK),i=o}catch{}if(i){if(e)return{rootPath:i};break}let f=(0,nAe.dirname)(o);if(f===o)break;o=f}}let s=t;for(;;){for(let f of Object.keys(vrr))try{await(0,cJ.access)((0,nAe.join)(s,f),cJ.constants.R_OK|cJ.constants.W_OK),n=vrr[f],i===null&&(i=s);break}catch{}if(i){if(e)return{rootPath:i};break}let o=(0,nAe.dirname)(s);if(o===s)break;s=o}return{rootPath:i,detectedPackageManager:n}}var cJ,nAe,vrr,brr=Ct(()=>{"use strict";cJ=require("node:fs/promises"),nAe=require("node:path");hcn();vrr={"package-lock.json":"npm","yarn.lock":"yarn","pnpm-lock.yaml":"pnpm","bun.lockb":"bun"}});var SFi,ttt,Err,mcn=Ct(()=>{"use strict";lR();SFi=M_({engine:Lf("jscodeshift"),parser:ky([Lf("babel"),Lf("babylon"),Lf("flow"),Lf("ts"),Lf("tsx")])}),ttt=ky([SFi]),Err=t=>{let e=oR(ttt,t);return e.success?e.output:null}});var Srr,_cn,gcn,Trr,xcn,Drr,ntt,rAe,Arr,Crr=Ct(()=>{"use strict";lR();n1t();vQe();mcn();Srr=M_({$schema:Zd(ep()),path:ep(),source:ky([Lf("local"),Lf("remote")]),type:ky([Lf("standalone"),Lf("package")]),safeArgumentRecord:Zd(t1t,{}),engineOptions:Zd(eQe(ttt),null)}),_cn=M_({...Srr.entries,...M_({config:ctn}).entries}),gcn=M_({...Srr.entries,...M_({config:utn,codemods:Zd(mI(_cn),[])}).entries}),Trr=ky([_cn,gcn]),xcn=t=>oR(_cn,t),Drr=t=>oR(gcn,t),ntt=t=>men(gcn,t),rAe=t=>ZO(Trr,t),Arr=t=>oR(Trr,t)});var wrr=Ct(()=>{"use strict"});var T9a,D9a,Irr=Ct(()=>{"use strict";lR();T9a=M_({codemodSource:ep(),codemodEngine:ky([Lf("jscodeshift"),Lf("ts-morph"),Lf("workflow")]),codemodArguments:Zd(ep()),repoUrl:Zd(ep()),branch:Zd(ep()),persistent:Zd(L2())}),D9a=M_({jobId:ep()})});var uL=Ct(()=>{"use strict";vBn();Rjn();vHn();urr();prr();hrr();mrr();e1t();_rr();hcn();brr();Gen();n1t();vQe();Crr();mcn();wrr();Irr()});var TFi,Prr,Nrr=Ct(()=>{"use strict";lR();uL();TFi=ky([M_({kind:Lf("initialization"),path:ep(),codemodSource:ep(),engine:ky([Lf("jscodeshift"),Lf("ts-morph"),Lf("ast-grep"),Lf("workflow")]),format:L2(),safeArgumentRecord:t1t,engineOptions:eQe(ttt)}),M_({kind:Lf("exit")}),M_({kind:Lf("runCodemod"),path:ep(),data:ep()})]),Prr=t=>ZO(TFi,t)});var krr=Ct(()=>{"use strict"});var DFi,Rrr,Orr=Ct(()=>{"use strict";lR();yen();DFi=ky([M_({kind:Lf("commands"),commands:xen(),path:Zd(ep())}),M_({kind:Lf("error"),message:ep(),path:Zd(ep())}),M_({kind:Lf("console"),consoleKind:yBn,message:ep()})]),Rrr=t=>ZO(DFi,t)});var RC=Ct(()=>{"use strict";aR();n5n();cBn();mBn();yen();Nrr();krr();Orr()});var mle,rtt=Ct(()=>{mle="0.18.12"});var Lrr,Mrr,ycn,uJ,vcn,oWa,itt=Ct(()=>{"use strict";Lrr=Ho(require("node:os"),1),Mrr=require("node:path");RC();ycn=process.stdout.write,uJ=(0,Mrr.join)(Lrr.homedir(),".codemod"),vcn=Ii.green("\u2714"),oWa=Ii.red("\u2716")});var bcn,F8e,Ecn,HEt,KEt,Scn=Ct(()=>{"use strict";bcn=Ho(require("node:fs"),1),F8e=Ho(require("node:os"),1),Ecn=require("node:path");RC();uL();rtt();itt();HEt=(0,Ecn.join)(uJ,"logs"),KEt=async t=>{let{prefix:e,content:n,fatal:i}=t,s=(0,Ecn.join)(HEt,`${i?"FATAL-":""}${new Date().toISOString()}-error.log`),o=`- CLI version: ${mle}
677
+ Unsupported type: `+t.type,"ENOTSUP");t._finish()})};uU.prototype._stat=function(t){var e=this,n=e.props,i=n.follow?"stat":"lstat",s=e._proxy||e;t?o(null,t):cU[i](e._path,o);function o(f,h){if(e.filter&&!e.filter.call(s,s,h)){e._aborted=!0,e.emit("end"),e.emit("close");return}if(f||!h)return lcn(e);e._old=h;var _=Mnr(h);if(_!==e.type||e.type==="File"&&h.nlink>1)return V3i(e._path,function(x){if(x)return e.error(x);e._old=null,lcn(e)});lcn(e)}};function lcn(t){q3i($et.dirname(t._path),uU.dirmode,function(e,n){return e?t.error(e):(t._madeDir=n,t._create())})}function Bnr(t,e,n,i,s){var o=e.mode,f=e.follow||t.type!=="SymbolicLink"?"chmod":"lchmod";if(!cU[f]||typeof o!="number")return s();var h=n.mode&parseInt("0777",8);if(o=o&parseInt("0777",8),o===h)return s();cU[f](i,o,s)}function Wnr(t,e,n,i,s){if(process.platform==="win32"||!process.getuid||process.getuid()!==0||typeof e.uid!="number"&&typeof e.gid!="number"||n.uid===e.uid&&n.gid===e.gid)return s();var o=t.props.follow||t.type!=="SymbolicLink"?"chown":"lchown";if(!cU[o])return s();typeof e.uid!="number"&&(e.uid=n.uid),typeof e.gid!="number"&&(e.gid=n.gid),cU[o](i,e.uid,e.gid,s)}function jnr(t,e,n,i,s){if(!cU.utimes||process.platform==="win32")return s();var o=e.follow||t.type!=="SymbolicLink"?"utimes":"lutimes";if(o==="lutimes"&&!cU[o]&&(o="utimes"),!cU[o])return s();var f=n.atime,h=n.mtime,_=e.atime,x=e.mtime;if(_===void 0&&(_=f),x===void 0&&(x=h),Onr(_)||(_=new Date(_)),Onr(x)||(_=new Date(x)),_.getTime()===f.getTime()&&x.getTime()===h.getTime())return s();cU[o](i,_,x,s)}uU.prototype._finish=function(){var t=this;if(t._finishing)return;t._finishing=!0;var e=0,n=null,i=!1;if(t._old)t._old.atime=new Date(0),t._old.mtime=new Date(0),o(t._old);else{var s=t.props.follow?"stat":"lstat";cU[s](t._path,function(h,_){if(h)if(h.code==="ENOENT"&&(t.type==="Link"||t.type==="SymbolicLink")&&process.platform==="win32"){t.ready=!0,t.emit("ready"),t.emit("end"),t.emit("close"),t.end=t._finish=function(){};return}else return t.error(h);o(t._old=_)})}return;function o(h){e+=3,Bnr(t,t.props,h,t._path,f("chmod")),Wnr(t,t.props,h,t._path,f("chown")),jnr(t,t.props,h,t._path,f("utimes"))}function f(h){return function(_){if(n)return;if(_)return _.fstream_finish_call=h,t.error(n=_);if(--e>0||i)return;if(i=!0,t._madeDir)znr(t,t._path,x);else return x();function x(v){if(v)return v.fstream_finish_call="setupMadeDir",t.error(v);t.emit("end"),t.emit("close")}}}};function znr(t,e,n){var i=t._madeDir,s=$et.dirname(e);X3i(t,s,function(o){if(o)return n(o);if(s===i)return n();znr(t,s,n)})}function X3i(t,e,n){var i={};Object.keys(t.props).forEach(function(h){i[h]=t.props[h],h==="mode"&&t.type!=="Directory"&&(i[h]=i[h]|parseInt("0111",8))});var s=3,o=null;cU.stat(e,function(h,_){if(h)return n(o=h);Bnr(t,i,_,e,f),Wnr(t,i,_,e,f),jnr(t,i,_,e,f)});function f(h){if(!o){if(h)return n(o=h);if(--s===0)return n()}}}uU.prototype.pipe=function(){this.error("Can't pipe from writable stream")};uU.prototype.add=function(){this.error("Can't add to non-Directory type")};uU.prototype.write=function(){return!0};function Y3i(t){return Object.prototype.toString.call(t)}function Onr(t){return typeof t=="object"&&Y3i(t)==="[object Date]"}});var ccn=le(Ax=>{Ax.Abstract=SEt();Ax.Reader=JDe();Ax.Writer=L8e();Ax.File={Reader:Sln(),Writer:scn()};Ax.Dir={Reader:Eln(),Writer:rcn()};Ax.Link={Reader:vln(),Writer:icn()};Ax.Proxy={Reader:Dln(),Writer:ocn()};Ax.Reader.Dir=Ax.DirReader=Ax.Dir.Reader;Ax.Reader.File=Ax.FileReader=Ax.File.Reader;Ax.Reader.Link=Ax.LinkReader=Ax.Link.Reader;Ax.Reader.Proxy=Ax.ProxyReader=Ax.Proxy.Reader;Ax.Writer.Dir=Ax.DirWriter=Ax.Dir.Writer;Ax.Writer.File=Ax.FileWriter=Ax.File.Writer;Ax.Writer.Link=Ax.LinkWriter=Ax.Link.Writer;Ax.Writer.Proxy=Ax.ProxyWriter=Ax.Proxy.Writer;Ax.collect=WEt()});var Vnr=le((e9a,Unr)=>{Unr.exports=rFi;var Q3i=fEt(),Z3i=ccn().Writer,ucn=require("path"),eFi=require("stream"),tFi=dln(),nFi=i_e();function rFi(t){t.path=ucn.resolve(ucn.normalize(t.path));var e=new Q3i(t),n=new eFi.Writable({objectMode:!0});n._write=function(s,o,f){if(s.type=="Directory")return f();var h=ucn.join(t.path,s.path.replace(/\\/g,"/"));if(h.indexOf(t.path)!=0)return f();let _=t.getWriter?t.getWriter({path:h}):Z3i({path:h});s.pipe(_).on("error",f).on("close",f)};var i=tFi(e,n);return e.once("crx-header",function(s){i.crxHeader=s}),e.pipe(n).on("finish",function(){i.emit("close")}),i.promise=function(){return new nFi(function(s,o){i.on("close",s),i.on("error",o)})},i}});var qnr=le((t9a,GEt)=>{var yI=function(t){"use strict";var e=1e7,n=7,i=9007199254740992,s=A(i),o="0123456789abcdefghijklmnopqrstuvwxyz",f=typeof BigInt=="function";function h(it,Yt,Qt,On){return typeof it>"u"?h[0]:typeof Yt<"u"?+Yt==10&&!Qt?jr(it):Fr(it,Yt,Qt,On):jr(it)}function _(it,Yt){this.value=it,this.sign=Yt,this.isSmall=!1}_.prototype=Object.create(h.prototype);function x(it){this.value=it,this.sign=it<0,this.isSmall=!0}x.prototype=Object.create(h.prototype);function v(it){this.value=it}v.prototype=Object.create(h.prototype);function T(it){return-i<it&&it<i}function A(it){return it<1e7?[it]:it<1e14?[it%1e7,Math.floor(it/1e7)]:[it%1e7,Math.floor(it/1e7)%1e7,Math.floor(it/1e14)]}function w(it){N(it);var Yt=it.length;if(Yt<4&&tn(it,s)<0)switch(Yt){case 0:return 0;case 1:return it[0];case 2:return it[0]+it[1]*e;default:return it[0]+(it[1]+it[2]*e)*e}return it}function N(it){for(var Yt=it.length;it[--Yt]===0;);it.length=Yt+1}function P(it){for(var Yt=new Array(it),Qt=-1;++Qt<it;)Yt[Qt]=0;return Yt}function F(it){return it>0?Math.floor(it):Math.ceil(it)}function j(it,Yt){var Qt=it.length,On=Yt.length,lt=new Array(Qt),er=0,gi=e,dr,xi;for(xi=0;xi<On;xi++)dr=it[xi]+Yt[xi]+er,er=dr>=gi?1:0,lt[xi]=dr-er*gi;for(;xi<Qt;)dr=it[xi]+er,er=dr===gi?1:0,lt[xi++]=dr-er*gi;return er>0&&lt.push(er),lt}function X(it,Yt){return it.length>=Yt.length?j(it,Yt):j(Yt,it)}function oe(it,Yt){var Qt=it.length,On=new Array(Qt),lt=e,er,gi;for(gi=0;gi<Qt;gi++)er=it[gi]-lt+Yt,Yt=Math.floor(er/lt),On[gi]=er-Yt*lt,Yt+=1;for(;Yt>0;)On[gi++]=Yt%lt,Yt=Math.floor(Yt/lt);return On}_.prototype.add=function(it){var Yt=jr(it);if(this.sign!==Yt.sign)return this.subtract(Yt.negate());var Qt=this.value,On=Yt.value;return Yt.isSmall?new _(oe(Qt,Math.abs(On)),this.sign):new _(X(Qt,On),this.sign)},_.prototype.plus=_.prototype.add,x.prototype.add=function(it){var Yt=jr(it),Qt=this.value;if(Qt<0!==Yt.sign)return this.subtract(Yt.negate());var On=Yt.value;if(Yt.isSmall){if(T(Qt+On))return new x(Qt+On);On=A(Math.abs(On))}return new _(oe(On,Math.abs(Qt)),Qt<0)},x.prototype.plus=x.prototype.add,v.prototype.add=function(it){return new v(this.value+jr(it).value)},v.prototype.plus=v.prototype.add;function ee(it,Yt){var Qt=it.length,On=Yt.length,lt=new Array(Qt),er=0,gi=e,dr,xi;for(dr=0;dr<On;dr++)xi=it[dr]-er-Yt[dr],xi<0?(xi+=gi,er=1):er=0,lt[dr]=xi;for(dr=On;dr<Qt;dr++){if(xi=it[dr]-er,xi<0)xi+=gi;else{lt[dr++]=xi;break}lt[dr]=xi}for(;dr<Qt;dr++)lt[dr]=it[dr];return N(lt),lt}function ge(it,Yt,Qt){var On;return tn(it,Yt)>=0?On=ee(it,Yt):(On=ee(Yt,it),Qt=!Qt),On=w(On),typeof On=="number"?(Qt&&(On=-On),new x(On)):new _(On,Qt)}function Le(it,Yt,Qt){var On=it.length,lt=new Array(On),er=-Yt,gi=e,dr,xi;for(dr=0;dr<On;dr++)xi=it[dr]+er,er=Math.floor(xi/gi),xi%=gi,lt[dr]=xi<0?xi+gi:xi;return lt=w(lt),typeof lt=="number"?(Qt&&(lt=-lt),new x(lt)):new _(lt,Qt)}_.prototype.subtract=function(it){var Yt=jr(it);if(this.sign!==Yt.sign)return this.add(Yt.negate());var Qt=this.value,On=Yt.value;return Yt.isSmall?Le(Qt,Math.abs(On),this.sign):ge(Qt,On,this.sign)},_.prototype.minus=_.prototype.subtract,x.prototype.subtract=function(it){var Yt=jr(it),Qt=this.value;if(Qt<0!==Yt.sign)return this.add(Yt.negate());var On=Yt.value;return Yt.isSmall?new x(Qt-On):Le(On,Math.abs(Qt),Qt>=0)},x.prototype.minus=x.prototype.subtract,v.prototype.subtract=function(it){return new v(this.value-jr(it).value)},v.prototype.minus=v.prototype.subtract,_.prototype.negate=function(){return new _(this.value,!this.sign)},x.prototype.negate=function(){var it=this.sign,Yt=new x(-this.value);return Yt.sign=!it,Yt},v.prototype.negate=function(){return new v(-this.value)},_.prototype.abs=function(){return new _(this.value,!1)},x.prototype.abs=function(){return new x(Math.abs(this.value))},v.prototype.abs=function(){return new v(this.value>=0?this.value:-this.value)};function xe(it,Yt){var Qt=it.length,On=Yt.length,lt=Qt+On,er=P(lt),gi=e,dr,xi,Ys,Ml,hl;for(Ys=0;Ys<Qt;++Ys){Ml=it[Ys];for(var Wc=0;Wc<On;++Wc)hl=Yt[Wc],dr=Ml*hl+er[Ys+Wc],xi=Math.floor(dr/gi),er[Ys+Wc]=dr-xi*gi,er[Ys+Wc+1]+=xi}return N(er),er}function Se(it,Yt){var Qt=it.length,On=new Array(Qt),lt=e,er=0,gi,dr;for(dr=0;dr<Qt;dr++)gi=it[dr]*Yt+er,er=Math.floor(gi/lt),On[dr]=gi-er*lt;for(;er>0;)On[dr++]=er%lt,er=Math.floor(er/lt);return On}function Ve(it,Yt){for(var Qt=[];Yt-- >0;)Qt.push(0);return Qt.concat(it)}function Xe(it,Yt){var Qt=Math.max(it.length,Yt.length);if(Qt<=30)return xe(it,Yt);Qt=Math.ceil(Qt/2);var On=it.slice(Qt),lt=it.slice(0,Qt),er=Yt.slice(Qt),gi=Yt.slice(0,Qt),dr=Xe(lt,gi),xi=Xe(On,er),Ys=Xe(X(lt,On),X(gi,er)),Ml=X(X(dr,Ve(ee(ee(Ys,dr),xi),Qt)),Ve(xi,2*Qt));return N(Ml),Ml}function Ne(it,Yt){return-.012*it-.012*Yt+15e-6*it*Yt>0}_.prototype.multiply=function(it){var Yt=jr(it),Qt=this.value,On=Yt.value,lt=this.sign!==Yt.sign,er;if(Yt.isSmall){if(On===0)return h[0];if(On===1)return this;if(On===-1)return this.negate();if(er=Math.abs(On),er<e)return new _(Se(Qt,er),lt);On=A(er)}return Ne(Qt.length,On.length)?new _(Xe(Qt,On),lt):new _(xe(Qt,On),lt)},_.prototype.times=_.prototype.multiply;function tt(it,Yt,Qt){return it<e?new _(Se(Yt,it),Qt):new _(xe(Yt,A(it)),Qt)}x.prototype._multiplyBySmall=function(it){return T(it.value*this.value)?new x(it.value*this.value):tt(Math.abs(it.value),A(Math.abs(this.value)),this.sign!==it.sign)},_.prototype._multiplyBySmall=function(it){return it.value===0?h[0]:it.value===1?this:it.value===-1?this.negate():tt(Math.abs(it.value),this.value,this.sign!==it.sign)},x.prototype.multiply=function(it){return jr(it)._multiplyBySmall(this)},x.prototype.times=x.prototype.multiply,v.prototype.multiply=function(it){return new v(this.value*jr(it).value)},v.prototype.times=v.prototype.multiply;function zt(it){var Yt=it.length,Qt=P(Yt+Yt),On=e,lt,er,gi,dr,xi;for(gi=0;gi<Yt;gi++){dr=it[gi],er=0-dr*dr;for(var Ys=gi;Ys<Yt;Ys++)xi=it[Ys],lt=2*(dr*xi)+Qt[gi+Ys]+er,er=Math.floor(lt/On),Qt[gi+Ys]=lt-er*On;Qt[gi+Yt]=er}return N(Qt),Qt}_.prototype.square=function(){return new _(zt(this.value),!1)},x.prototype.square=function(){var it=this.value*this.value;return T(it)?new x(it):new _(zt(A(Math.abs(this.value))),!1)},v.prototype.square=function(it){return new v(this.value*this.value)};function yt(it,Yt){var Qt=it.length,On=Yt.length,lt=e,er=P(Yt.length),gi=Yt[On-1],dr=Math.ceil(lt/(2*gi)),xi=Se(it,dr),Ys=Se(Yt,dr),Ml,hl,Wc,Ed,rp,Cf,cs;for(xi.length<=Qt&&xi.push(0),Ys.push(0),gi=Ys[On-1],hl=Qt-On;hl>=0;hl--){for(Ml=lt-1,xi[hl+On]!==gi&&(Ml=Math.floor((xi[hl+On]*lt+xi[hl+On-1])/gi)),Wc=0,Ed=0,Cf=Ys.length,rp=0;rp<Cf;rp++)Wc+=Ml*Ys[rp],cs=Math.floor(Wc/lt),Ed+=xi[hl+rp]-(Wc-cs*lt),Wc=cs,Ed<0?(xi[hl+rp]=Ed+lt,Ed=-1):(xi[hl+rp]=Ed,Ed=0);for(;Ed!==0;){for(Ml-=1,Wc=0,rp=0;rp<Cf;rp++)Wc+=xi[hl+rp]-lt+Ys[rp],Wc<0?(xi[hl+rp]=Wc+lt,Wc=0):(xi[hl+rp]=Wc,Wc=1);Ed+=Wc}er[hl]=Ml}return xi=dt(xi,dr)[0],[w(er),w(xi)]}function nn(it,Yt){for(var Qt=it.length,On=Yt.length,lt=[],er=[],gi=e,dr,xi,Ys,Ml,hl;Qt;){if(er.unshift(it[--Qt]),N(er),tn(er,Yt)<0){lt.push(0);continue}xi=er.length,Ys=er[xi-1]*gi+er[xi-2],Ml=Yt[On-1]*gi+Yt[On-2],xi>On&&(Ys=(Ys+1)*gi),dr=Math.ceil(Ys/Ml);do{if(hl=Se(Yt,dr),tn(hl,er)<=0)break;dr--}while(dr);lt.push(dr),er=ee(er,hl)}return lt.reverse(),[w(lt),w(er)]}function dt(it,Yt){var Qt=it.length,On=P(Qt),lt=e,er,gi,dr,xi;for(dr=0,er=Qt-1;er>=0;--er)xi=dr*lt+it[er],gi=F(xi/Yt),dr=xi-gi*Yt,On[er]=gi|0;return[On,dr|0]}function Ht(it,Yt){var Qt,On=jr(Yt);if(f)return[new v(it.value/On.value),new v(it.value%On.value)];var lt=it.value,er=On.value,gi;if(er===0)throw new Error("Cannot divide by zero");if(it.isSmall)return On.isSmall?[new x(F(lt/er)),new x(lt%er)]:[h[0],it];if(On.isSmall){if(er===1)return[it,h[0]];if(er==-1)return[it.negate(),h[0]];var dr=Math.abs(er);if(dr<e){Qt=dt(lt,dr),gi=w(Qt[0]);var xi=Qt[1];return it.sign&&(xi=-xi),typeof gi=="number"?(it.sign!==On.sign&&(gi=-gi),[new x(gi),new x(xi)]):[new _(gi,it.sign!==On.sign),new x(xi)]}er=A(dr)}var Ys=tn(lt,er);if(Ys===-1)return[h[0],it];if(Ys===0)return[h[it.sign===On.sign?1:-1],h[0]];lt.length+er.length<=200?Qt=yt(lt,er):Qt=nn(lt,er),gi=Qt[0];var Ml=it.sign!==On.sign,hl=Qt[1],Wc=it.sign;return typeof gi=="number"?(Ml&&(gi=-gi),gi=new x(gi)):gi=new _(gi,Ml),typeof hl=="number"?(Wc&&(hl=-hl),hl=new x(hl)):hl=new _(hl,Wc),[gi,hl]}_.prototype.divmod=function(it){var Yt=Ht(this,it);return{quotient:Yt[0],remainder:Yt[1]}},v.prototype.divmod=x.prototype.divmod=_.prototype.divmod,_.prototype.divide=function(it){return Ht(this,it)[0]},v.prototype.over=v.prototype.divide=function(it){return new v(this.value/jr(it).value)},x.prototype.over=x.prototype.divide=_.prototype.over=_.prototype.divide,_.prototype.mod=function(it){return Ht(this,it)[1]},v.prototype.mod=v.prototype.remainder=function(it){return new v(this.value%jr(it).value)},x.prototype.remainder=x.prototype.mod=_.prototype.remainder=_.prototype.mod,_.prototype.pow=function(it){var Yt=jr(it),Qt=this.value,On=Yt.value,lt,er,gi;if(On===0)return h[1];if(Qt===0)return h[0];if(Qt===1)return h[1];if(Qt===-1)return Yt.isEven()?h[1]:h[-1];if(Yt.sign)return h[0];if(!Yt.isSmall)throw new Error("The exponent "+Yt.toString()+" is too large.");if(this.isSmall&&T(lt=Math.pow(Qt,On)))return new x(F(lt));for(er=this,gi=h[1];On&!0&&(gi=gi.times(er),--On),On!==0;)On/=2,er=er.square();return gi},x.prototype.pow=_.prototype.pow,v.prototype.pow=function(it){var Yt=jr(it),Qt=this.value,On=Yt.value,lt=BigInt(0),er=BigInt(1),gi=BigInt(2);if(On===lt)return h[1];if(Qt===lt)return h[0];if(Qt===er)return h[1];if(Qt===BigInt(-1))return Yt.isEven()?h[1]:h[-1];if(Yt.isNegative())return new v(lt);for(var dr=this,xi=h[1];(On&er)===er&&(xi=xi.times(dr),--On),On!==lt;)On/=gi,dr=dr.square();return xi},_.prototype.modPow=function(it,Yt){if(it=jr(it),Yt=jr(Yt),Yt.isZero())throw new Error("Cannot take modPow with modulus 0");var Qt=h[1],On=this.mod(Yt);for(it.isNegative()&&(it=it.multiply(h[-1]),On=On.modInv(Yt));it.isPositive();){if(On.isZero())return h[0];it.isOdd()&&(Qt=Qt.multiply(On).mod(Yt)),it=it.divide(2),On=On.square().mod(Yt)}return Qt},v.prototype.modPow=x.prototype.modPow=_.prototype.modPow;function tn(it,Yt){if(it.length!==Yt.length)return it.length>Yt.length?1:-1;for(var Qt=it.length-1;Qt>=0;Qt--)if(it[Qt]!==Yt[Qt])return it[Qt]>Yt[Qt]?1:-1;return 0}_.prototype.compareAbs=function(it){var Yt=jr(it),Qt=this.value,On=Yt.value;return Yt.isSmall?1:tn(Qt,On)},x.prototype.compareAbs=function(it){var Yt=jr(it),Qt=Math.abs(this.value),On=Yt.value;return Yt.isSmall?(On=Math.abs(On),Qt===On?0:Qt>On?1:-1):-1},v.prototype.compareAbs=function(it){var Yt=this.value,Qt=jr(it).value;return Yt=Yt>=0?Yt:-Yt,Qt=Qt>=0?Qt:-Qt,Yt===Qt?0:Yt>Qt?1:-1},_.prototype.compare=function(it){if(it===1/0)return-1;if(it===-1/0)return 1;var Yt=jr(it),Qt=this.value,On=Yt.value;return this.sign!==Yt.sign?Yt.sign?1:-1:Yt.isSmall?this.sign?-1:1:tn(Qt,On)*(this.sign?-1:1)},_.prototype.compareTo=_.prototype.compare,x.prototype.compare=function(it){if(it===1/0)return-1;if(it===-1/0)return 1;var Yt=jr(it),Qt=this.value,On=Yt.value;return Yt.isSmall?Qt==On?0:Qt>On?1:-1:Qt<0!==Yt.sign?Qt<0?-1:1:Qt<0?1:-1},x.prototype.compareTo=x.prototype.compare,v.prototype.compare=function(it){if(it===1/0)return-1;if(it===-1/0)return 1;var Yt=this.value,Qt=jr(it).value;return Yt===Qt?0:Yt>Qt?1:-1},v.prototype.compareTo=v.prototype.compare,_.prototype.equals=function(it){return this.compare(it)===0},v.prototype.eq=v.prototype.equals=x.prototype.eq=x.prototype.equals=_.prototype.eq=_.prototype.equals,_.prototype.notEquals=function(it){return this.compare(it)!==0},v.prototype.neq=v.prototype.notEquals=x.prototype.neq=x.prototype.notEquals=_.prototype.neq=_.prototype.notEquals,_.prototype.greater=function(it){return this.compare(it)>0},v.prototype.gt=v.prototype.greater=x.prototype.gt=x.prototype.greater=_.prototype.gt=_.prototype.greater,_.prototype.lesser=function(it){return this.compare(it)<0},v.prototype.lt=v.prototype.lesser=x.prototype.lt=x.prototype.lesser=_.prototype.lt=_.prototype.lesser,_.prototype.greaterOrEquals=function(it){return this.compare(it)>=0},v.prototype.geq=v.prototype.greaterOrEquals=x.prototype.geq=x.prototype.greaterOrEquals=_.prototype.geq=_.prototype.greaterOrEquals,_.prototype.lesserOrEquals=function(it){return this.compare(it)<=0},v.prototype.leq=v.prototype.lesserOrEquals=x.prototype.leq=x.prototype.lesserOrEquals=_.prototype.leq=_.prototype.lesserOrEquals,_.prototype.isEven=function(){return(this.value[0]&1)===0},x.prototype.isEven=function(){return(this.value&1)===0},v.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},_.prototype.isOdd=function(){return(this.value[0]&1)===1},x.prototype.isOdd=function(){return(this.value&1)===1},v.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},_.prototype.isPositive=function(){return!this.sign},x.prototype.isPositive=function(){return this.value>0},v.prototype.isPositive=x.prototype.isPositive,_.prototype.isNegative=function(){return this.sign},x.prototype.isNegative=function(){return this.value<0},v.prototype.isNegative=x.prototype.isNegative,_.prototype.isUnit=function(){return!1},x.prototype.isUnit=function(){return Math.abs(this.value)===1},v.prototype.isUnit=function(){return this.abs().value===BigInt(1)},_.prototype.isZero=function(){return!1},x.prototype.isZero=function(){return this.value===0},v.prototype.isZero=function(){return this.value===BigInt(0)},_.prototype.isDivisibleBy=function(it){var Yt=jr(it);return Yt.isZero()?!1:Yt.isUnit()?!0:Yt.compareAbs(2)===0?this.isEven():this.mod(Yt).isZero()},v.prototype.isDivisibleBy=x.prototype.isDivisibleBy=_.prototype.isDivisibleBy;function Or(it){var Yt=it.abs();if(Yt.isUnit())return!1;if(Yt.equals(2)||Yt.equals(3)||Yt.equals(5))return!0;if(Yt.isEven()||Yt.isDivisibleBy(3)||Yt.isDivisibleBy(5))return!1;if(Yt.lesser(49))return!0}function Kt(it,Yt){for(var Qt=it.prev(),On=Qt,lt=0,er,gi,dr,xi;On.isEven();)On=On.divide(2),lt++;e:for(dr=0;dr<Yt.length;dr++)if(!it.lesser(Yt[dr])&&(xi=yI(Yt[dr]).modPow(On,it),!(xi.isUnit()||xi.equals(Qt)))){for(er=lt-1;er!=0;er--){if(xi=xi.square().mod(it),xi.isUnit())return!1;if(xi.equals(Qt))continue e}return!1}return!0}_.prototype.isPrime=function(it){var Yt=Or(this);if(Yt!==t)return Yt;var Qt=this.abs(),On=Qt.bitLength();if(On<=64)return Kt(Qt,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var lt=Math.log(2)*On.toJSNumber(),er=Math.ceil(it===!0?2*Math.pow(lt,2):lt),gi=[],dr=0;dr<er;dr++)gi.push(yI(dr+2));return Kt(Qt,gi)},v.prototype.isPrime=x.prototype.isPrime=_.prototype.isPrime,_.prototype.isProbablePrime=function(it,Yt){var Qt=Or(this);if(Qt!==t)return Qt;for(var On=this.abs(),lt=it===t?5:it,er=[],gi=0;gi<lt;gi++)er.push(yI.randBetween(2,On.minus(2),Yt));return Kt(On,er)},v.prototype.isProbablePrime=x.prototype.isProbablePrime=_.prototype.isProbablePrime,_.prototype.modInv=function(it){for(var Yt=yI.zero,Qt=yI.one,On=jr(it),lt=this.abs(),er,gi,dr;!lt.isZero();)er=On.divide(lt),gi=Yt,dr=On,Yt=Qt,On=lt,Qt=gi.subtract(er.multiply(Qt)),lt=dr.subtract(er.multiply(lt));if(!On.isUnit())throw new Error(this.toString()+" and "+it.toString()+" are not co-prime");return Yt.compare(0)===-1&&(Yt=Yt.add(it)),this.isNegative()?Yt.negate():Yt},v.prototype.modInv=x.prototype.modInv=_.prototype.modInv,_.prototype.next=function(){var it=this.value;return this.sign?Le(it,1,this.sign):new _(oe(it,1),this.sign)},x.prototype.next=function(){var it=this.value;return it+1<i?new x(it+1):new _(s,!1)},v.prototype.next=function(){return new v(this.value+BigInt(1))},_.prototype.prev=function(){var it=this.value;return this.sign?new _(oe(it,1),!0):Le(it,1,this.sign)},x.prototype.prev=function(){var it=this.value;return it-1>-i?new x(it-1):new _(s,!0)},v.prototype.prev=function(){return new v(this.value-BigInt(1))};for(var Gn=[1];2*Gn[Gn.length-1]<=e;)Gn.push(2*Gn[Gn.length-1]);var En=Gn.length,At=Gn[En-1];function Un(it){return Math.abs(it)<=e}_.prototype.shiftLeft=function(it){var Yt=jr(it).toJSNumber();if(!Un(Yt))throw new Error(String(Yt)+" is too large for shifting.");if(Yt<0)return this.shiftRight(-Yt);var Qt=this;if(Qt.isZero())return Qt;for(;Yt>=En;)Qt=Qt.multiply(At),Yt-=En-1;return Qt.multiply(Gn[Yt])},v.prototype.shiftLeft=x.prototype.shiftLeft=_.prototype.shiftLeft,_.prototype.shiftRight=function(it){var Yt,Qt=jr(it).toJSNumber();if(!Un(Qt))throw new Error(String(Qt)+" is too large for shifting.");if(Qt<0)return this.shiftLeft(-Qt);for(var On=this;Qt>=En;){if(On.isZero()||On.isNegative()&&On.isUnit())return On;Yt=Ht(On,At),On=Yt[1].isNegative()?Yt[0].prev():Yt[0],Qt-=En-1}return Yt=Ht(On,Gn[Qt]),Yt[1].isNegative()?Yt[0].prev():Yt[0]},v.prototype.shiftRight=x.prototype.shiftRight=_.prototype.shiftRight;function Hr(it,Yt,Qt){Yt=jr(Yt);for(var On=it.isNegative(),lt=Yt.isNegative(),er=On?it.not():it,gi=lt?Yt.not():Yt,dr=0,xi=0,Ys=null,Ml=null,hl=[];!er.isZero()||!gi.isZero();)Ys=Ht(er,At),dr=Ys[1].toJSNumber(),On&&(dr=At-1-dr),Ml=Ht(gi,At),xi=Ml[1].toJSNumber(),lt&&(xi=At-1-xi),er=Ys[0],gi=Ml[0],hl.push(Qt(dr,xi));for(var Wc=Qt(On?1:0,lt?1:0)!==0?yI(-1):yI(0),Ed=hl.length-1;Ed>=0;Ed-=1)Wc=Wc.multiply(At).add(yI(hl[Ed]));return Wc}_.prototype.not=function(){return this.negate().prev()},v.prototype.not=x.prototype.not=_.prototype.not,_.prototype.and=function(it){return Hr(this,it,function(Yt,Qt){return Yt&Qt})},v.prototype.and=x.prototype.and=_.prototype.and,_.prototype.or=function(it){return Hr(this,it,function(Yt,Qt){return Yt|Qt})},v.prototype.or=x.prototype.or=_.prototype.or,_.prototype.xor=function(it){return Hr(this,it,function(Yt,Qt){return Yt^Qt})},v.prototype.xor=x.prototype.xor=_.prototype.xor;var Kr=1<<30,Ur=(e&-e)*(e&-e)|Kr;function Gi(it){var Yt=it.value,Qt=typeof Yt=="number"?Yt|Kr:typeof Yt=="bigint"?Yt|BigInt(Kr):Yt[0]+Yt[1]*e|Ur;return Qt&-Qt}function $i(it,Yt){if(Yt.compareTo(it)<=0){var Qt=$i(it,Yt.square(Yt)),On=Qt.p,lt=Qt.e,er=On.multiply(Yt);return er.compareTo(it)<=0?{p:er,e:lt*2+1}:{p:On,e:lt*2}}return{p:yI(1),e:0}}_.prototype.bitLength=function(){var it=this;return it.compareTo(yI(0))<0&&(it=it.negate().subtract(yI(1))),it.compareTo(yI(0))===0?yI(0):yI($i(it,yI(2)).e).add(yI(1))},v.prototype.bitLength=x.prototype.bitLength=_.prototype.bitLength;function Ta(it,Yt){return it=jr(it),Yt=jr(Yt),it.greater(Yt)?it:Yt}function Rt(it,Yt){return it=jr(it),Yt=jr(Yt),it.lesser(Yt)?it:Yt}function Fa(it,Yt){if(it=jr(it).abs(),Yt=jr(Yt).abs(),it.equals(Yt))return it;if(it.isZero())return Yt;if(Yt.isZero())return it;for(var Qt=h[1],On,lt;it.isEven()&&Yt.isEven();)On=Rt(Gi(it),Gi(Yt)),it=it.divide(On),Yt=Yt.divide(On),Qt=Qt.multiply(On);for(;it.isEven();)it=it.divide(Gi(it));do{for(;Yt.isEven();)Yt=Yt.divide(Gi(Yt));it.greater(Yt)&&(lt=Yt,Yt=it,it=lt),Yt=Yt.subtract(it)}while(!Yt.isZero());return Qt.isUnit()?it:it.multiply(Qt)}function ls(it,Yt){return it=jr(it).abs(),Yt=jr(Yt).abs(),it.divide(Fa(it,Yt)).multiply(Yt)}function Kl(it,Yt,Qt){it=jr(it),Yt=jr(Yt);var On=Qt||Math.random,lt=Rt(it,Yt),er=Ta(it,Yt),gi=er.subtract(lt).add(1);if(gi.isSmall)return lt.add(Math.floor(On()*gi));for(var dr=ws(gi,e).value,xi=[],Ys=!0,Ml=0;Ml<dr.length;Ml++){var hl=Ys?dr[Ml]+(Ml+1<dr.length?dr[Ml+1]/e:0):e,Wc=F(On()*hl);xi.push(Wc),Wc<dr[Ml]&&(Ys=!1)}return lt.add(h.fromArray(xi,e,!1))}var Fr=function(it,Yt,Qt,On){Qt=Qt||o,it=String(it),On||(it=it.toLowerCase(),Qt=Qt.toLowerCase());var lt=it.length,er,gi=Math.abs(Yt),dr={};for(er=0;er<Qt.length;er++)dr[Qt[er]]=er;for(er=0;er<lt;er++){var xi=it[er];if(xi!=="-"&&xi in dr&&dr[xi]>=gi){if(xi==="1"&&gi===1)continue;throw new Error(xi+" is not a valid digit in base "+Yt+".")}}Yt=jr(Yt);var Ys=[],Ml=it[0]==="-";for(er=Ml?1:0;er<it.length;er++){var xi=it[er];if(xi in dr)Ys.push(jr(dr[xi]));else if(xi==="<"){var hl=er;do er++;while(it[er]!==">"&&er<it.length);Ys.push(jr(it.slice(hl+1,er)))}else throw new Error(xi+" is not a valid character")}return Hi(Ys,Yt,Ml)};function Hi(it,Yt,Qt){var On=h[0],lt=h[1],er;for(er=it.length-1;er>=0;er--)On=On.add(it[er].times(lt)),lt=lt.times(Yt);return Qt?On.negate():On}function yo(it,Yt){return Yt=Yt||o,it<Yt.length?Yt[it]:"<"+it+">"}function ws(it,Yt){if(Yt=yI(Yt),Yt.isZero()){if(it.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(Yt.equals(-1)){if(it.isZero())return{value:[0],isNegative:!1};if(it.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-it.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var Qt=Array.apply(null,Array(it.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return Qt.unshift([1]),{value:[].concat.apply([],Qt),isNegative:!1}}var On=!1;if(it.isNegative()&&Yt.isPositive()&&(On=!0,it=it.abs()),Yt.isUnit())return it.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(it.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:On};for(var lt=[],er=it,gi;er.isNegative()||er.compareAbs(Yt)>=0;){gi=er.divmod(Yt),er=gi.quotient;var dr=gi.remainder;dr.isNegative()&&(dr=Yt.minus(dr).abs(),er=er.next()),lt.push(dr.toJSNumber())}return lt.push(er.toJSNumber()),{value:lt.reverse(),isNegative:On}}function Mr(it,Yt,Qt){var On=ws(it,Yt);return(On.isNegative?"-":"")+On.value.map(function(lt){return yo(lt,Qt)}).join("")}_.prototype.toArray=function(it){return ws(this,it)},x.prototype.toArray=function(it){return ws(this,it)},v.prototype.toArray=function(it){return ws(this,it)},_.prototype.toString=function(it,Yt){if(it===t&&(it=10),it!==10||Yt)return Mr(this,it,Yt);for(var Qt=this.value,On=Qt.length,lt=String(Qt[--On]),er="0000000",gi;--On>=0;)gi=String(Qt[On]),lt+=er.slice(gi.length)+gi;var dr=this.sign?"-":"";return dr+lt},x.prototype.toString=function(it,Yt){return it===t&&(it=10),it!=10||Yt?Mr(this,it,Yt):String(this.value)},v.prototype.toString=x.prototype.toString,v.prototype.toJSON=_.prototype.toJSON=x.prototype.toJSON=function(){return this.toString()},_.prototype.valueOf=function(){return parseInt(this.toString(),10)},_.prototype.toJSNumber=_.prototype.valueOf,x.prototype.valueOf=function(){return this.value},x.prototype.toJSNumber=x.prototype.valueOf,v.prototype.valueOf=v.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function Yi(it){if(T(+it)){var Yt=+it;if(Yt===F(Yt))return f?new v(BigInt(Yt)):new x(Yt);throw new Error("Invalid integer: "+it)}var Qt=it[0]==="-";Qt&&(it=it.slice(1));var On=it.split(/e/i);if(On.length>2)throw new Error("Invalid integer: "+On.join("e"));if(On.length===2){var lt=On[1];if(lt[0]==="+"&&(lt=lt.slice(1)),lt=+lt,lt!==F(lt)||!T(lt))throw new Error("Invalid integer: "+lt+" is not a valid exponent.");var er=On[0],gi=er.indexOf(".");if(gi>=0&&(lt-=er.length-gi-1,er=er.slice(0,gi)+er.slice(gi+1)),lt<0)throw new Error("Cannot include negative exponent part for integers");er+=new Array(lt+1).join("0"),it=er}var dr=/^([0-9][0-9]*)$/.test(it);if(!dr)throw new Error("Invalid integer: "+it);if(f)return new v(BigInt(Qt?"-"+it:it));for(var xi=[],Ys=it.length,Ml=n,hl=Ys-Ml;Ys>0;)xi.push(+it.slice(hl,Ys)),hl-=Ml,hl<0&&(hl=0),Ys-=Ml;return N(xi),new _(xi,Qt)}function Lr(it){if(f)return new v(BigInt(it));if(T(it)){if(it!==F(it))throw new Error(it+" is not an integer.");return new x(it)}return Yi(it.toString())}function jr(it){return typeof it=="number"?Lr(it):typeof it=="string"?Yi(it):typeof it=="bigint"?new v(it):it}for(var lr=0;lr<1e3;lr++)h[lr]=jr(lr),lr>0&&(h[-lr]=jr(-lr));return h.one=h[1],h.zero=h[0],h.minusOne=h[-1],h.max=Ta,h.min=Rt,h.gcd=Fa,h.lcm=ls,h.isInstance=function(it){return it instanceof _||it instanceof x||it instanceof v},h.randBetween=Kl,h.fromArray=function(it,Yt,Qt){return Hi(it.map(jr),jr(Yt||10),Qt)},h}();typeof GEt<"u"&&GEt.hasOwnProperty("exports")&&(GEt.exports=yI);typeof define=="function"&&define.amd&&define(function(){return yI})});var Jnr=le((n9a,Knr)=>{var m_e=qnr(),iFi=require("stream"),UEt;function sFi(){var t=3988292384,e,n,i;for(UEt=[],n=0;n<256;n++){for(e=n,i=0;i<8;i++)e=e&1?t^e>>>1:e=e>>>1;UEt[n]=e>>>0}}function Hnr(t,e){return UEt||sFi(),t.charCodeAt&&(t=t.charCodeAt(0)),m_e(e).shiftRight(8).and(16777215).xor(UEt[m_e(e).xor(t).and(255)]).value}function M8e(){if(!(this instanceof M8e))return new M8e;this.key0=305419896,this.key1=591751049,this.key2=878082192}M8e.prototype.update=function(t){this.key0=Hnr(t,this.key0),this.key1=m_e(this.key0).and(255).and(4294967295).add(this.key1),this.key1=m_e(this.key1).multiply(134775813).add(1).and(4294967295).value,this.key2=Hnr(m_e(this.key1).shiftRight(24).and(255),this.key2)};M8e.prototype.decryptByte=function(t){var e=m_e(this.key2).or(2);return t=t^m_e(e).multiply(m_e(e^1)).shiftRight(8).and(255),this.update(t),t};M8e.prototype.stream=function(){var t=iFi.Transform(),e=this;return t._transform=function(n,i,s){for(var o=0;o<n.length;o++)n[o]=e.decryptByte(n[o]);this.push(n),s()},t};Knr.exports=M8e});var Ynr=le((r9a,Xnr)=>{var aFi=i_e(),oFi=Jnr(),lFi=oEt(),$nr=require("stream"),cFi=require("zlib"),uFi=cEt(),fFi=uEt(),dFi=Cet();Xnr.exports=function(e,n,i,s,o){var f=lFi(),h=$nr.PassThrough(),_=e.stream(n,o);return _.pipe(f).on("error",function(x){h.emit("error",x)}),h.vars=f.pull(30).then(function(x){var v=dFi.parse(x,[["signature",4],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2]]);return v.lastModifiedDateTime=fFi(v.lastModifiedDate,v.lastModifiedTime),f.pull(v.fileNameLength).then(function(T){return v.fileName=T.toString("utf8"),f.pull(v.extraFieldLength)}).then(function(T){var A;return v.extra=uFi(T,v),s&&s.compressedSize&&(v=s),v.flags&1&&(A=f.pull(12).then(function(w){if(!i)throw new Error("MISSING_PASSWORD");var N=oFi();String(i).split("").forEach(function(j){N.update(j)});for(var P=0;P<w.length;P++)w[P]=N.decryptByte(w[P]);v.decrypt=N,v.compressedSize-=12;var F=v.flags&8?v.lastModifiedTime>>8&255:v.crc32>>24&255;if(w[11]!==F)throw new Error("BAD_PASSWORD");return v})),aFi.resolve(A).then(function(){return h.emit("vars",v),v})})}),h.vars.then(function(x){var v=!(x.flags&8)||x.compressedSize>0,T,A=x.compressionMethod?cFi.createInflateRaw():$nr.PassThrough();v?(h.size=x.uncompressedSize,T=x.compressedSize):(T=Buffer.alloc(4),T.writeUInt32LE(134695760,0));var w=f.stream(T);x.decrypt&&(w=w.pipe(x.decrypt.stream())),w.pipe(A).on("error",function(N){h.emit("error",N)}).pipe(h).on("finish",function(){_.destroy?_.destroy():_.abort?_.abort():_.close?_.close():_.push?_.push():console.log("warning - unable to close stream")})}).catch(function(x){h.emit("error",x)}),h}});var err=le((i9a,Znr)=>{var Yet=oEt(),pFi=Ynr(),Xet=i_e(),hFi=lEt(),mFi=cEt(),fcn=require("path"),_Fi=ccn().Writer,gFi=uEt(),Qet=Cet(),Qnr=Buffer.alloc(4);Qnr.writeUInt32LE(101010256,0);function xFi(t){var e=t.stream(0).pipe(Yet());return e.pull(4).then(function(n){var i=n.readUInt32LE(0);if(i===875721283){var s;return e.pull(12).then(function(o){s=Qet.parse(o,[["version",4],["pubKeyLength",4],["signatureLength",4]])}).then(function(){return e.pull(s.pubKeyLength+s.signatureLength)}).then(function(o){return s.publicKey=o.slice(0,s.pubKeyLength),s.signature=o.slice(s.pubKeyLength),s.size=16+s.pubKeyLength+s.signatureLength,s})}})}function yFi(t,e){var n=Qet.parse(e,[["signature",4],["diskNumber",4],["offsetToStartOfCentralDirectory",8],["numberOfDisks",4]]);if(n.signature!=117853008)throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x"+n.signature.toString(16));var i=Yet();return t.stream(n.offsetToStartOfCentralDirectory).pipe(i),i.pull(56)}function vFi(t){var e=Qet.parse(t,[["signature",4],["sizeOfCentralDirectory",8],["version",2],["versionsNeededToExtract",2],["diskNumber",4],["diskStart",4],["numberOfRecordsOnDisk",8],["numberOfRecords",8],["sizeOfCentralDirectory",8],["offsetToStartOfCentralDirectory",8]]);if(e.signature!=101075792)throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0"+e.signature.toString(16));return e}Znr.exports=function(e,n){var i=Yet(),s=Yet(),o=n&&n.tailSize||80,f,h,_,x;return n&&n.crx&&(h=xFi(e)),e.size().then(function(v){return f=v,e.stream(Math.max(0,v-o)).on("error",function(T){i.emit("error",T)}).pipe(i),i.pull(Qnr)}).then(function(){return Xet.props({directory:i.pull(22),crxHeader:h})}).then(function(v){var T=v.directory;if(_=v.crxHeader&&v.crxHeader.size||0,x=Qet.parse(T,[["signature",4],["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]),x.numberOfRecords==65535||x.numberOfRecords==65535||x.offsetToStartOfCentralDirectory==4294967295){let w=f-(o-i.match+20),N=Yet();return e.stream(w).pipe(N),N.pull(20).then(function(P){return yFi(e,P)}).then(function(P){x=vFi(P)})}else x.offsetToStartOfCentralDirectory+=_}).then(function(){if(x.commentLength)return i.pull(x.commentLength).then(function(v){x.comment=v.toString("utf8")})}).then(function(){return e.stream(x.offsetToStartOfCentralDirectory).pipe(s),x.extract=function(v){if(!v||!v.path)throw new Error("PATH_MISSING");return v.path=fcn.resolve(fcn.normalize(v.path)),x.files.then(function(T){return Xet.map(T,function(A){if(A.type!="Directory"){var w=fcn.join(v.path,A.path);if(w.indexOf(v.path)==0){var N=v.getWriter?v.getWriter({path:w}):_Fi({path:w});return new Xet(function(P,F){A.stream(v.password).on("error",F).pipe(N).on("close",P).on("error",F)})}}},{concurrency:v.concurrency>1?v.concurrency:1})})},x.files=Xet.mapSeries(Array(x.numberOfRecords),function(){return s.pull(46).then(function(v){var T=T=Qet.parse(v,[["signature",4],["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return T.offsetToLocalFileHeader+=_,T.lastModifiedDateTime=gFi(T.lastModifiedDate,T.lastModifiedTime),s.pull(T.fileNameLength).then(function(A){return T.pathBuffer=A,T.path=A.toString("utf8"),T.isUnicode=(T.flags&2048)!=0,s.pull(T.extraFieldLength)}).then(function(A){return T.extra=mFi(A,T),s.pull(T.fileCommentLength)}).then(function(A){T.comment=A,T.type=T.uncompressedSize===0&&/[\/\\]$/.test(T.path)?"Directory":"File";var w=n&&n.padding||1e3;return T.stream=function(N){var P=30+w+(T.extraFieldLength||0)+(T.fileNameLength||0)+T.compressedSize;return pFi(e,T.offsetToLocalFileHeader,N,T,P)},T.buffer=function(N){return hFi(T.stream(N))},T})})}),Xet.props(x)})}});var rrr=le((s9a,nrr)=>{var trr=qee(),VEt=i_e(),Zet=err(),bFi=require("stream");nrr.exports={buffer:function(t,e){var n={stream:function(i,s){var o=bFi.PassThrough(),f=s?i+s:void 0;return o.end(t.slice(i,f)),o},size:function(){return VEt.resolve(t.length)}};return Zet(n,e)},file:function(t,e){var n={stream:function(i,s){var o=s?i+s:void 0;return trr.createReadStream(t,{start:i,end:o})},size:function(){return new VEt(function(i,s){trr.stat(t,function(o,f){o?s(o):i(f.size)})})}};return Zet(n,e)},url:function(t,e,n){if(typeof e=="string"&&(e={url:e}),!e.url)throw"URL missing";e.headers=e.headers||{};var i={stream:function(s,o){var f=Object.create(e),h=o?s+o:"";return f.headers=Object.create(e.headers),f.headers.range="bytes="+s+"-"+h,t(f)},size:function(){return new VEt(function(s,o){var f=t(e);f.on("response",function(h){f.abort(),h.headers["content-length"]?s(h.headers["content-length"]):o(new Error("Missing content length header"))}).on("error",o)})}};return Zet(i,n)},s3:function(t,e,n){var i={size:function(){return new VEt(function(s,o){t.headObject(e,function(f,h){f?o(f):s(h.ContentLength)})})},stream:function(s,o){var f={};for(var h in e)f[h]=e[h];var _=o?s+o:"";return f.Range="bytes="+s+"-"+_,t.getObject(f).createReadStream()}};return Zet(i,n)},custom:function(t,e){return Zet(t,e)}}});var irr=le(ett=>{"use strict";ett.Parse=fEt();ett.ParseOne=Zer();ett.Extract=Vnr();ett.Open=rrr()});var EFi,dcn,pcn,srr,Kee,arr,orr,lrr,crr,urr=Ct(()=>{"use strict";EFi=Ho(XHn(),1);gJn();dcn=Ho(xYn(),1),pcn=Ho(yQn(),1),srr=Ho(irr(),1),Kee=require("node:fs/promises"),arr=async(t,e)=>{await(0,Kee.access)(t,Kee.constants.F_OK).catch(()=>{throw new Error(`[Archiver]: source ${t} does not exist`)}),await(0,Kee.access)(e,Kee.constants.F_OK).catch(()=>(0,Kee.mkdir)(e,{recursive:!0}))},orr=async(t,e)=>(await arr(t,e),dcn.x({file:t,cwd:e})),lrr=async(t,e)=>(await arr(t,e),await srr.default.Open.file(t).then(n=>n.extract({path:e,concurrency:5})),e),crr=async t=>{let e=pcn.pack();for(let{name:s,data:o}of Object.values(t))e.entry({name:s},o);e.finalize();let n=[];return e.on("data",s=>n.push(s)),await new Promise((s,o)=>{e.on("end",s),e.on("error",o)}),Buffer.from(_Jn.gzip(Buffer.concat(n)))}});async function Jee(t){let{source:e,throwOnNotFound:n=!1}=t,i=await(0,frr.readFile)((0,drr.join)(e,".codemodrc.json"),{encoding:"utf-8"}).catch(()=>null);if(i===null){let o=`Could not locate the .codemodrc.json file at ${e}`;if(n)throw new Error(o);return{config:null,error:o}}let s;try{s=vme(JSON.parse(i))}catch{let f=`Failed to parse the .codemodrc.json file at ${e}`;if(n)throw new Error(f);return{config:null,error:f}}return{config:s,error:null}}async function hle(t){let{source:e,throwOnNotFound:n}=t,{config:i,error:s}=await Jee({source:e,throwOnNotFound:!1});if(i===null){if(n)throw new Error(s);return{path:null,error:s}}let o;switch(i.engine){case"ast-grep":o="**/rule.yaml";break;default:o="src/index.{ts,js}";break}let f=i.entry?`Make sure the entry point path under ${F2("entry")} key is correct in .codemodrc.json`:`Could not find an entry point under ${F2(o)}. Either create it or provide a path at ${F2("entry")} key in .codemodrc.json`,_=(await n3(i.entry??o,{absolute:!0,cwd:e,nodir:!0})).at(0)??null;if(_===null){if(n)throw new Error(f);return{path:null,error:f}}return{path:_,error:null}}var frr,drr,prr=Ct(()=>{"use strict";frr=require("node:fs/promises"),drr=require("node:path");Ame();vQe();e1t()});var hrr=Ct(()=>{"use strict"});var mrr=Ct(()=>{"use strict"});var _rr=Ct(()=>{"use strict"});var grr,xrr,pN,yrr,hcn=Ct(()=>{"use strict";grr=require("node:child_process"),xrr=require("node:util"),pN=(0,xrr.promisify)(grr.exec),yrr=async t=>{let e=t(),{done:n}=await e.next();return n}});async function qEt(t,e=!1){let n=null,i=null;try{let{stdout:o}=await pN("git rev-parse --show-toplevel",{cwd:t}),f=o.trim();if(f.length&&(i=f,e))return{rootPath:i}}catch{}if(i===null){let o=t;for(;;){try{await(0,cJ.access)((0,nAe.join)(o,".git"),cJ.constants.R_OK|cJ.constants.W_OK);let h=(0,nAe.join)(o,"package.json");await(0,cJ.access)(h,cJ.constants.R_OK|cJ.constants.W_OK),i=o}catch{}if(i){if(e)return{rootPath:i};break}let f=(0,nAe.dirname)(o);if(f===o)break;o=f}}let s=t;for(;;){for(let f of Object.keys(vrr))try{await(0,cJ.access)((0,nAe.join)(s,f),cJ.constants.R_OK|cJ.constants.W_OK),n=vrr[f],i===null&&(i=s);break}catch{}if(i){if(e)return{rootPath:i};break}let o=(0,nAe.dirname)(s);if(o===s)break;s=o}return{rootPath:i,detectedPackageManager:n}}var cJ,nAe,vrr,brr=Ct(()=>{"use strict";cJ=require("node:fs/promises"),nAe=require("node:path");hcn();vrr={"package-lock.json":"npm","yarn.lock":"yarn","pnpm-lock.yaml":"pnpm","bun.lockb":"bun"}});var SFi,ttt,Err,mcn=Ct(()=>{"use strict";lR();SFi=M_({engine:Lf("jscodeshift"),parser:ky([Lf("babel"),Lf("babylon"),Lf("flow"),Lf("ts"),Lf("tsx")])}),ttt=ky([SFi]),Err=t=>{let e=oR(ttt,t);return e.success?e.output:null}});var Srr,_cn,gcn,Trr,xcn,Drr,ntt,rAe,Arr,Crr=Ct(()=>{"use strict";lR();n1t();vQe();mcn();Srr=M_({$schema:Zd(ep()),path:ep(),source:ky([Lf("local"),Lf("remote")]),type:ky([Lf("standalone"),Lf("package")]),safeArgumentRecord:Zd(t1t,{}),engineOptions:Zd(eQe(ttt),null)}),_cn=M_({...Srr.entries,...M_({config:ctn}).entries}),gcn=M_({...Srr.entries,...M_({config:utn,codemods:Zd(mI(_cn),[])}).entries}),Trr=ky([_cn,gcn]),xcn=t=>oR(_cn,t),Drr=t=>oR(gcn,t),ntt=t=>men(gcn,t),rAe=t=>ZO(Trr,t),Arr=t=>oR(Trr,t)});var wrr=Ct(()=>{"use strict"});var T9a,D9a,Irr=Ct(()=>{"use strict";lR();T9a=M_({codemodSource:ep(),codemodEngine:ky([Lf("jscodeshift"),Lf("ts-morph"),Lf("workflow")]),codemodArguments:Zd(ep()),repoUrl:Zd(ep()),branch:Zd(ep()),persistent:Zd(L2())}),D9a=M_({jobId:ep()})});var uL=Ct(()=>{"use strict";vBn();Rjn();vHn();urr();prr();hrr();mrr();e1t();_rr();hcn();brr();Gen();n1t();vQe();Crr();mcn();wrr();Irr()});var TFi,Prr,Nrr=Ct(()=>{"use strict";lR();uL();TFi=ky([M_({kind:Lf("initialization"),path:ep(),codemodSource:ep(),engine:ky([Lf("jscodeshift"),Lf("ts-morph"),Lf("ast-grep"),Lf("workflow")]),format:L2(),safeArgumentRecord:t1t,engineOptions:eQe(ttt)}),M_({kind:Lf("exit")}),M_({kind:Lf("runCodemod"),path:ep(),data:ep()})]),Prr=t=>ZO(TFi,t)});var krr=Ct(()=>{"use strict"});var DFi,Rrr,Orr=Ct(()=>{"use strict";lR();yen();DFi=ky([M_({kind:Lf("commands"),commands:xen(),path:Zd(ep())}),M_({kind:Lf("error"),message:ep(),path:Zd(ep())}),M_({kind:Lf("console"),consoleKind:yBn,message:ep()})]),Rrr=t=>ZO(DFi,t)});var RC=Ct(()=>{"use strict";aR();n5n();cBn();mBn();yen();Nrr();krr();Orr()});var mle,rtt=Ct(()=>{mle="0.18.13"});var Lrr,Mrr,ycn,uJ,vcn,oWa,itt=Ct(()=>{"use strict";Lrr=Ho(require("node:os"),1),Mrr=require("node:path");RC();ycn=process.stdout.write,uJ=(0,Mrr.join)(Lrr.homedir(),".codemod"),vcn=Ii.green("\u2714"),oWa=Ii.red("\u2716")});var bcn,F8e,Ecn,HEt,KEt,Scn=Ct(()=>{"use strict";bcn=Ho(require("node:fs"),1),F8e=Ho(require("node:os"),1),Ecn=require("node:path");RC();uL();rtt();itt();HEt=(0,Ecn.join)(uJ,"logs"),KEt=async t=>{let{prefix:e,content:n,fatal:i}=t,s=(0,Ecn.join)(HEt,`${i?"FATAL-":""}${new Date().toISOString()}-error.log`),o=`- CLI version: ${mle}
678
678
  - Node version: ${process.versions.node}
679
679
  - OS: ${F8e.type()} ${F8e.release()} ${F8e.arch()}
680
680
 
@@ -32280,11 +32280,11 @@ To view available commands, execute`,`${Ii.yellow.bold(F2("codemod --help"))}.`,
32280
32280
  To see a list of existing codemods, run`,`${Ii.yellow.bold(F2("codemod search"))}`,"or",`${Ii.yellow.bold(F2("codemod list"))}`,"with a query representing the codemod you are looking for.")),process.exit(1)),new Error(`Error while fetching codemod ${f}: ${j}`)});if((n.readme||n.config||n.version)&&h.type==="standalone")return e.printConsoleMessage("error",Ii.red("Standalone codemods do not support this feature."));if(n.version)return e.printConsoleMessage("log",Ii.cyan(`v${h.config.version}`));if(n.readme)try{let j=await(0,dri.readFile)((0,pri.join)(h.path,"README.md"),{encoding:"utf8"});return e.printConsoleMessage("log",_me(j,Ii.cyan,80))}catch{return e.printConsoleMessage("error",Ii.red("Could not find the manual file for the codemod."))}if(n.config)try{let{config:j}=await Jee({source:h.path,throwOnNotFound:!1});return e.printConsoleMessage("log",hri.default.render(j,{inlineArrays:!0}))}catch{return e.printConsoleMessage("error",Ii.red("Could not find the configuration file for the codemod."))}h=await aOn({codemod:h,argv:n,printer:e});let _=new O5t(e),x=new L5t(e),v=new GLt({flowSettings:o,authService:_,runnerService:x});!o.dry&&n.interactive&&await ERa(o.target);let T={},A=(0,uri.randomBytes)(20).toString("base64url"),w=[],N=Object.entries(h.safeArgumentRecord);N.length>0&&e.printConsoleMessage("info",Ii.cyan(`Running with arguments:
32281
32281
  `,...N.map(([j,X])=>Ii.bold(`
32282
32282
  - ${j}: ${X} (${typeof X})`))));let P=await v.run({codemod:h,onSuccess:async({codemod:j,output:X,commands:oe})=>{let ee=[...new Set(oe.map(Le=>"oldPath"in Le?Le.oldPath:Le.newPath))];n.mode==="json"&&typeof X=="object"?(process.stdout.write=ycn,process.stdout.write(JSON.stringify(X,null,2)),process.stdout.write=()=>!1):n.mode==="plain"&&(process.stdout.write=ycn,process.stdout.write(String(X)),process.stdout.write=()=>!1);let ge;if(j.type==="standalone"?ge="from-source-file":j.type==="package"&&j.source==="local"?ge="from-source-compatible-package":ge=j.config.name,j.type==="package"){let{config:Le}=await Jee({source:j.path,throwOnNotFound:!1});Le?.deps&&(T[ge]={affectedFiles:ee,deps:Le.deps})}w.push(...oe.map(Le=>({...Le,codemodName:ge}))),i.sendDangerousEvent({kind:"codemodExecuted",codemodName:ge,executionId:A,fileCount:ee.length,cliVersion:mle}),j.type==="standalone"&&await fri.promises.rm(j.path,{recursive:!0})},onFailure:j=>{j instanceof Error&&(e.printOperationMessage({kind:"error",message:`Error while running the codemod:
32283
- ${j.message}`}),i.sendEvent({kind:"failedToExecuteCommand",commandName:"codemod.executeCodemod",cliVersion:mle}))}}),F=()=>s();if(n.logs&&P?.length){let j=await KEt({prefix:Ii.red("Codemod execution encountered errors."),content:P.map(X=>`Error at ${X.filePath}${X.codemodName?` (${X.codemodName})`:""}:
32283
+ ${j.message}`}),i.sendEvent({kind:"failedToExecuteCommand",commandName:"codemod.executeCodemod",cliVersion:mle}))}}),F=async()=>{await i.dispose(),s()};if(n.logs&&P?.length){let j=await KEt({prefix:Ii.red("Codemod execution encountered errors."),content:P.map(X=>`Error at ${X.filePath}${X.codemodName?` (${X.codemodName})`:""}:
32284
32284
  ${X.message}`).join(`
32285
32285
 
32286
- `)});F=()=>(e.terminateExecutionProgress(),e.printConsoleMessage("info",j),s())}if(w.length===0)return e.terminateExecutionProgress(),h.config.engine!=="workflow"&&e.printConsoleMessage("info",Ii.yellow(`
32287
- No changes were made during the codemod run.`)),F();if(o.dry&&w.length>0){let j=Jni(w.map(Kni));return j.key(["escape","q","C-c"],()=>(j?.destroy(),F())),j.render()}if(o.install)for(let[j,{deps:X,affectedFiles:oe}]of Object.entries(T))await ari({codemodName:j,printer:e,affectedFiles:oe,target:o.target,deps:X});return F()}});var gri,xri=Ct(()=>{"use strict";y_e();RC();uL();ete();K9();gri=async t=>{let{printer:e,name:n,force:i}=t,{token:s}=await c3({message:"Authentication is required to unpublish codemods. Proceed?",printer:e}),{name:o,version:f}=U3e(n);if($K(o)&&!$K(f)&&!i)throw new Error(`Please provide the version of the codemod you want to unpublish. If you want to unpublish all versions, use the "${Ii.bold("--force (-f)")}" flag.`);let h=e.withLoaderMessage(Ii.cyan("Unpublishing ",Ii.bold(F2(n))));try{await Yor(s,n),h.succeed()}catch(_){h.fail();let x=_ instanceof x_e?_.response?.data.error:String(_),v=`${Ii.bold(`Could not unpublish the "${n}" codemod`)}:
32286
+ `)});F=async()=>{e.terminateExecutionProgress(),e.printConsoleMessage("info",j),await i.dispose(),s()}}if(w.length===0)return e.terminateExecutionProgress(),h.config.engine!=="workflow"&&e.printConsoleMessage("info",Ii.yellow(`
32287
+ No changes were made during the codemod run.`)),F();if(o.dry&&w.length>0){let j=Jni(w.map(Kni));return j.key(["escape","q","C-c"],async()=>{j?.destroy(),await F()}),j.render()}if(o.install)for(let[j,{deps:X,affectedFiles:oe}]of Object.entries(T))await ari({codemodName:j,printer:e,affectedFiles:oe,target:o.target,deps:X});return F()}});var gri,xri=Ct(()=>{"use strict";y_e();RC();uL();ete();K9();gri=async t=>{let{printer:e,name:n,force:i}=t,{token:s}=await c3({message:"Authentication is required to unpublish codemods. Proceed?",printer:e}),{name:o,version:f}=U3e(n);if($K(o)&&!$K(f)&&!i)throw new Error(`Please provide the version of the codemod you want to unpublish. If you want to unpublish all versions, use the "${Ii.bold("--force (-f)")}" flag.`);let h=e.withLoaderMessage(Ii.cyan("Unpublishing ",Ii.bold(F2(n))));try{await Yor(s,n),h.succeed()}catch(_){h.fail();let x=_ instanceof x_e?_.response?.data.error:String(_),v=`${Ii.bold(`Could not unpublish the "${n}" codemod`)}:
32288
32288
  ${x}`;e.printOperationMessage({kind:"error",message:v});return}e.printConsoleMessage("info",Ii.cyan("Codemod",Ii.bold(F2(n)),"was successfully unpublished."))}});var yri,vri=Ct(()=>{"use strict";RC();K9();yri=async t=>{let{printer:e}=t,n=await l3();if(n===null){e.printConsoleMessage("info",Ii.bold.red("To use this command, please log in first."));return}let{user:{username:i},organizations:s}=n;e.printConsoleMessage("info",Ii.cyan("You are logged in as",`${Ii.bold(i)}.`)),s.length>0&&e.printConsoleMessage("info",Ii.cyan(`You have access to the following organizations:
32289
32289
  `,Ii.bold(`- ${O2r(n).join(`
32290
32290
  - `)}`)))}});var bri,Eri,Sri=Ct(()=>{"use strict";mIe();uL();bri=t=>t.option("telemetry",{type:"boolean",default:dEr,hidden:!0}).option("no-telemetry",{type:"boolean",description:"Disable telemetry"}).option("clientIdentifier",{type:"string",description:"Telemetry client ID",hidden:!0}).option("version",{alias:"v",description:"Show version number"}).option("esm",{type:"boolean",description:"Use to specify that you intend to use ESM-specific features in your codemods.",default:!1}).option("json",{alias:"j",type:"boolean",description:"Respond with JSON",default:Xhn}).option("cache",{type:"boolean",default:Jhn,hidden:!0}).option("no-cache",{type:"boolean",description:"Disable cache for HTTP(S) requests"}),Eri=t=>t.option("include",{alias:"i",type:"string",array:!0,description:"Glob pattern(s) for files to include"}).option("exclude",{alias:"e",type:"string",array:!0,description:"Glob pattern(s) for files to exclude",defaultDescription:"node_modules, .next, dist, build, *.d.ts, version control folders, gitignore entries"}).option("target",{alias:"t",type:"string",description:"Input directory path"}).option("source",{alias:"s",type:"string",description:"Source path of the local codemod to run"}).option("engine",{type:"string",choices:yQe,description:"Engine to be used with standalone codemod. Can be used to skip the prompt."}).option("logs",{type:"boolean",default:uEr,description:"Print codemod execution errors into a logfile"}).option("format",{type:"boolean",default:Khn}).option("threads",{alias:"n",type:"number",description:"Number of worker threads",default:Yhn}).option("dry",{alias:"d",type:"boolean",description:"Perform a dry run",default:Qhn}).option("mode",{alias:"m",type:"string",choices:["json","plain","silent"],description:`Output mode to run the codemod in:
@@ -32301,7 +32301,7 @@ ${x}`;e.printOperationMessage({kind:"error",message:v});return}e.printConsoleMes
32301
32301
  * @license Apache-2.0
32302
32302
  * @copyright 2021-2023 LiosK
32303
32303
  * @packageDocumentation
32304
- */var X5t="0123456789abcdef",Y5t=class t{constructor(e){this.bytes=e}static ofInner(e){if(e.length!==16)throw new TypeError("not 128-bit length");return new t(e)}static fromFieldsV7(e,n,i,s){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||n<0||i<0||s<0||e>0xffffffffffff||n>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");let o=new Uint8Array(16);return o[0]=e/2**40,o[1]=e/2**32,o[2]=e/2**24,o[3]=e/2**16,o[4]=e/2**8,o[5]=e,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=s>>>24,o[13]=s>>>16,o[14]=s>>>8,o[15]=s,new t(o)}static parse(e){let n;switch(e.length){case 32:n=/^[0-9a-f]{32}$/i.exec(e)?.[0];break;case 36:n=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("");break;case 38:n=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(e)?.slice(1,6).join("");break;case 45:n=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("");break}if(n){let i=new Uint8Array(16);for(let s=0;s<16;s+=4){let o=parseInt(n.substring(2*s,2*s+8),16);i[s+0]=o>>>24,i[s+1]=o>>>16,i[s+2]=o>>>8,i[s+3]=o}return new t(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let e="";for(let n=0;n<this.bytes.length;n++)e+=X5t.charAt(this.bytes[n]>>>4),e+=X5t.charAt(this.bytes[n]&15),(n===3||n===5||n===7||n===9)&&(e+="-");return e}toHex(){let e="";for(let n=0;n<this.bytes.length;n++)e+=X5t.charAt(this.bytes[n]>>>4),e+=X5t.charAt(this.bytes[n]&15);return e}toJSON(){return this.toString()}getVariant(){let e=this.bytes[8]>>>4;if(e<0)throw new Error("unreachable");if(e<=7)return this.bytes.every(n=>n===0)?"NIL":"VAR_0";if(e<=11)return"VAR_10";if(e<=13)return"VAR_110";if(e<=15)return this.bytes.every(n=>n===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new t(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let n=0;n<16;n++){let i=this.bytes[n]-e.bytes[n];if(i!==0)return Math.sign(i)}return 0}},FOn=class{constructor(e){this.timestamp=0,this.counter=0,this.random=e??WOa()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(e,n){let i=this.generateOrAbortCore(e,n);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(e,n)),i}generateOrAbortCore(e,n){if(!Number.isInteger(e)||e<1||e>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(n<0||n>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(e>this.timestamp)this.timestamp=e,this.resetCounter();else if(e+n>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return Y5t.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){let e=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return e[6]=64|e[6]>>>4,e[8]=128|e[8]>>>2,Y5t.ofInner(e)}},WOa=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),Tii,Dii=()=>jOa().toString(),jOa=()=>(Tii||(Tii=new FOn)).generate(),Q5t=class extends Error{constructor(e){super("HTTP error while fetching PostHog: "+e.status),this.response=e,this.name="PostHogFetchHttpError"}},rlt=class extends Error{constructor(e){super("Network error while fetching PostHog",e instanceof Error?{cause:e}:{}),this.error=e,this.name="PostHogFetchNetworkError"}};function Aii(t){return typeof t=="object"&&(t instanceof Q5t||t instanceof rlt)}var BOn=class{constructor(e,n){this.flushPromise=null,this.disableGeoip=!0,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new MOn,this._isInitialized=!1,OOa(e,"You must pass your PostHog project's api key."),this.apiKey=e,this.host=LOa(n?.host||"https://app.posthog.com"),this.flushAt=n?.flushAt?Math.max(n?.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,n?.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,n?.maxQueueSize??1e3),this.flushInterval=n?.flushInterval??1e4,this.captureMode=n?.captureMode||"form",this.defaultOptIn=n?.defaultOptIn??!0,this._retryOptions={retryCount:n?.fetchRetryCount??3,retryDelay:n?.fetchRetryDelay??3e3,retryCheck:Aii},this.requestTimeout=n?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=n?.featureFlagsRequestTimeoutMs??3e3,this.disableGeoip=n?.disableGeoip??!0,this.disabled=n?.disabled??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}wrap(e){if(this.disabled){this.isDebug&&console.warn("[PostHog] The client is disabled");return}if(this._isInitialized)return e();this._initPromise.then(()=>e())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(u$.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(u$.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(u$.OptedOut,!0)})}on(e,n){return this._events.on(e,n)}debug(e=!0){if(this.removeDebugCallback?.(),e){let n=this.on("*",(i,s)=>console.log("PostHog Debug",i,s));this.removeDebugCallback=()=>{n(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(e){return{distinct_id:e.distinct_id,event:e.event,properties:{...e.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(e){let n=Dii();return this.pendingPromises[n]=e,e.catch(()=>{}).finally(()=>{delete this.pendingPromises[n]}),e}identifyStateless(e,n,i){this.wrap(()=>{let s={...this.buildPayload({distinct_id:e,event:"$identify",properties:n})};this.enqueue("identify",s,i)})}captureStateless(e,n,i,s){this.wrap(()=>{let o=this.buildPayload({distinct_id:e,event:n,properties:i});this.enqueue("capture",o,s)})}aliasStateless(e,n,i,s){this.wrap(()=>{let o=this.buildPayload({event:"$create_alias",distinct_id:n,properties:{...i||{},distinct_id:n,alias:e}});this.enqueue("alias",o,s)})}groupIdentifyStateless(e,n,i,s,o,f){this.wrap(()=>{let h=this.buildPayload({distinct_id:o||`$${e}_${n}`,event:"$groupidentify",properties:{$group_type:e,$group_key:n,$group_set:i||{},...f||{}}});this.enqueue("capture",h,s)})}async getDecide(e,n={},i={},s={},o={}){await this._initPromise;let f=`${this.host}/decide/?v=3`,h={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:e,groups:n,person_properties:i,group_properties:s,...o})};return this.fetchWithRetry(f,h,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(_=>_.json()).catch(_=>{this._events.emit("error",_)})}async getFeatureFlagStateless(e,n,i={},s={},o={},f){await this._initPromise;let h=await this.getFeatureFlagsStateless(n,i,s,o,f);if(!h)return;let _=h[e];return _===void 0&&(_=!1),_}async getFeatureFlagPayloadStateless(e,n,i={},s={},o={},f){await this._initPromise;let h=await this.getFeatureFlagPayloadsStateless(n,i,s,o,f);if(!h)return;let _=h[e];return _===void 0?null:_}async getFeatureFlagPayloadsStateless(e,n={},i={},s={},o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(e,n,i,s,o)).payloads}_parsePayload(e){try{return JSON.parse(e)}catch{return e}}async getFeatureFlagsStateless(e,n={},i={},s={},o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(e,n,i,s,o)).flags}async getFeatureFlagsAndPayloadsStateless(e,n={},i={},s={},o){await this._initPromise;let f={};(o??this.disableGeoip)&&(f.geoip_disable=!0);let h=await this.getDecide(e,n,i,s,f),_=h?.featureFlags,x=h?.featureFlagPayloads,v=x;return x&&(v=Object.fromEntries(Object.entries(x).map(([T,A])=>[T,this._parsePayload(A)]))),{flags:_,payloads:v}}enqueue(e,n,i){this.wrap(()=>{if(this.optedOut){this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let s={...n,type:e,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:Eii(),uuid:i?.uuid?i.uuid:Dii()};(i?.disableGeoip??this.disableGeoip)&&(s.properties||(s.properties={}),s.properties.$geoip_disable=!0),s.distinctId&&(s.distinct_id=s.distinctId,delete s.distinctId);let f=this.getPersistedProperty(u$.Queue)||[];f.length>=this.maxQueueSize&&(f.shift(),console.info("Queue is full, the oldest event is dropped.")),f.push({message:s}),this.setPersistedProperty(u$.Queue,f),this._events.emit(e,s),f.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Pii(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}getCustomHeaders(){let e=this.getCustomUserAgent(),n={};return e&&e!==""&&(n["User-Agent"]=e),n}async _flush(){this.clearFlushTimer(),await this._initPromise;let e=this.getPersistedProperty(u$.Queue)||[];if(!e.length)return[];let n=e.slice(0,this.maxBatchSize),i=n.map(x=>x.message),s=()=>{let x=this.getPersistedProperty(u$.Queue)||[];this.setPersistedProperty(u$.Queue,x.slice(n.length))},o={api_key:this.apiKey,batch:i,sent_at:Eii()},f=JSON.stringify(o),h=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${FOa()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,_=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(nlt.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f};try{await this.fetchWithRetry(h,_)}catch(x){throw x instanceof rlt||s(),this._events.emit("error",x),x}return s(),this._events.emit("flush",i),i}async fetchWithRetry(e,n,i,s){var o;return(o=AbortSignal).timeout??(o.timeout=function(h){let _=new AbortController;return setTimeout(()=>_.abort(),h),_.signal}),await MOa(async()=>{let f=null;try{f=await this.fetch(e,{signal:AbortSignal.timeout(s??this.requestTimeout),...n})}catch(_){throw new rlt(_)}if(!(n.mode==="no-cors")&&(f.status<200||f.status>=400))throw new Q5t(f);return f},{...this._retryOptions,...i})}async shutdown(e=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let n=Date.now()+e;for(;(this.getPersistedProperty(u$.Queue)||[]).length!==0;){await this.flush();let s=Date.now();if(n<s)break}}catch(n){if(!Aii(n))throw n;console.error("Error while shutting down PostHog",n)}}},WOn=class{constructor(){this._memoryStorage={}}getProperty(e){return this._memoryStorage[e]}setProperty(e,n){this._memoryStorage[e]=n!==null?n:void 0}},jOn=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!jOn){let t=bii();jOn=async(e,n)=>{let i=await t.request({url:e,headers:n.headers,method:n.method.toLowerCase(),data:n.body,signal:n.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var Nii=jOn,zOa=1152921504606847e3,Z5t=class t extends Error{constructor(e){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=e,Object.setPrototypeOf(this,t.prototype)}},II=class t extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,t.prototype)}},zOn=class{constructor({pollingInterval:e,personalApiKey:n,projectApiKey:i,timeout:s,host:o,customHeaders:f,...h}){this.debugMode=!1,this.pollingInterval=e,this.personalApiKey=n,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=s,this.projectApiKey=i,this.host=o,this.poller=void 0,this.fetch=h.fetch||Nii,this.onError=h.onError,this.customHeaders=f,this.loadFeatureFlags()}debug(e=!0){this.debugMode=e}async getFeatureFlag(e,n,i={},s={},o={}){await this.loadFeatureFlags();let f,h;if(!this.loadedSuccessfullyOnce)return f;for(let _ of this.featureFlags)if(e===_.key){h=_;break}if(h!==void 0)try{f=this.computeFlagLocally(h,n,i,s,o),this.debugMode&&console.debug(`Successfully computed flag locally: ${e} -> ${f}`)}catch(_){_ instanceof II?this.debugMode&&console.debug(`InconclusiveMatchError when computing flag locally: ${e}: ${_}`):_ instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${e}: ${_}`))}return f}async computeFeatureFlagPayloadLocally(e,n){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof n=="boolean"?i=this.featureFlagsByKey?.[e]?.filters?.payloads?.[n.toString()]:typeof n=="string"&&(i=this.featureFlagsByKey?.[e]?.filters?.payloads?.[n]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(e,n={},i={},s={}){await this.loadFeatureFlags();let o={},f={},h=this.featureFlags.length==0;return this.featureFlags.map(async _=>{try{let x=this.computeFlagLocally(_,e,n,i,s);o[_.key]=x;let v=await this.computeFeatureFlagPayloadLocally(_.key,x);v&&(f[_.key]=v)}catch(x){x instanceof II||x instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${_.key}: ${x}`)),h=!0}}),{response:o,payloads:f,fallbackToDecide:h}}computeFlagLocally(e,n,i={},s={},o={}){if(e.ensure_experience_continuity)throw new II("Flag has experience continuity enabled");if(!e.active)return!1;let h=(e.filters||{}).aggregation_group_type_index;if(h!=null){let _=this.groupTypeMapping[String(h)];if(!_)throw this.debugMode&&console.warn(`[FEATURE FLAGS] Unknown group type index ${h} for feature flag ${e.key}`),new II("Flag has unknown group type index");if(!(_ in i))return this.debugMode&&console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${e.key} without group names passed in`),!1;let x=o[_];return this.matchFeatureFlagProperties(e,i[_],x)}else return this.matchFeatureFlagProperties(e,n,s)}matchFeatureFlagProperties(e,n,i){let s=e.filters||{},o=s.groups||[],f=!1,h,_=[...o].sort((x,v)=>{let T=!!x.variant,A=!!v.variant;return T&&A?0:T?-1:A?1:0});for(let x of _)try{if(this.isConditionMatch(e,n,x,i)){let v=x.variant,T=s.multivariate?.variants||[];v&&T.some(A=>A.key===v)?h=v:h=this.getMatchingVariant(e,n)||!0;break}}catch(v){if(v instanceof II)f=!0;else throw v}if(h!==void 0)return h;if(f)throw new II("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(e,n,i,s){let o=i.rollout_percentage;if((i.properties||[]).length>0){for(let f of i.properties){let h=f.type,_=!1;if(h==="cohort"?_=Rii(f,s,this.cohorts,this.debugMode):_=kii(f,s),!_)return!1}if(o==null)return!0}return!(o!=null&&Cii(e.key,n)>o/100)}getMatchingVariant(e,n){let i=Cii(e.key,n,"variant"),s=this.variantLookupTable(e).find(o=>i>=o.valueMin&&i<o.valueMax);if(s)return s.key}variantLookupTable(e){let n=[],i=0,s=0;return((e.filters||{}).multivariate?.variants||[]).forEach(h=>{s=i+h.rollout_percentage/100,n.push({valueMin:i,valueMax:s,key:h.key}),i=s}),n}async loadFeatureFlags(e=!1){(!this.loadedSuccessfullyOnce||e)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let e=await this._requestFeatureFlagDefinitions();if(e&&e.status===401)throw new Z5t("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(e&&e.status!==200)return;let n=await e.json();"flags"in n||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`)),this.featureFlags=n.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,s)=>(i[s.key]=s,i),{}),this.groupTypeMapping=n.group_type_mapping||{},this.cohorts=n.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(e){e instanceof Z5t&&this.onError?.(e)}}async _requestFeatureFlagDefinitions(){let e=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,n={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let s=new AbortController;i=Pii(()=>{s.abort()},this.timeout),n.signal=s.signal}try{return await this.fetch(e,n)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function Cii(t,e,n=""){let i=kOa.createHash();return i.update(`${t}.${e}${n}`),parseInt(i.digest("hex").slice(0,15),16)/zOa}function kii(t,e){let n=t.key,i=t.value,s=t.operator||"exact";if(n in e){if(s==="is_not_set")throw new II("Operator is_not_set is not supported")}else throw new II(`Property ${n} not found in propertyValues`);let o=e[n];function f(_,x){return Array.isArray(_)?_.map(v=>String(v).toLowerCase()).includes(String(x).toLowerCase()):String(_).toLowerCase()===String(x).toLowerCase()}function h(_,x,v){if(v==="gt")return _>x;if(v==="gte")return _>=x;if(v==="lt")return _<x;if(v==="lte")return _<=x;throw new Error(`Invalid operator: ${v}`)}switch(s){case"exact":return f(i,o);case"is_not":return!f(i,o);case"is_set":return n in e;case"icontains":return String(o).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(i).toLowerCase());case"regex":return wii(String(i))&&String(o).match(String(i))!==null;case"not_regex":return wii(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let _=typeof i=="number"?i:null;if(typeof i=="string")try{_=parseFloat(i)}catch{}return _!=null&&o!=null?typeof o=="string"?h(o,String(i),s):h(o,_,s):h(String(o),String(i),s)}case"is_date_after":case"is_date_before":{let _=GOa(String(i));if(_==null&&(_=Iii(i)),_==null)throw new II(`Invalid date: ${i}`);let x=Iii(o);return["is_date_before"].includes(s)?x<_:x>_}default:throw new II(`Unknown operator: ${s}`)}}function Rii(t,e,n,i=!1){let s=String(t.value);if(!(s in n))throw new II("can't match cohort without a given cohort property value");let o=n[s];return Oii(o,e,n,i)}function Oii(t,e,n,i=!1){if(!t)return!0;let s=t.type,o=t.values;if(!o||o.length===0)return!0;let f=!1;if("values"in o[0]){for(let h of o)try{let _=Oii(h,e,n,i);if(s==="AND"){if(!_)return!1}else if(_)return!0}catch(_){if(_ instanceof II)i&&console.debug(`Failed to compute property ${h} locally: ${_}`),f=!0;else throw _}if(f)throw new II("Can't match cohort without a given cohort property value");return s==="AND"}else{for(let h of o)try{let _;h.type==="cohort"?_=Rii(h,e,n,i):_=kii(h,e);let x=h.negation||!1;if(s==="AND"){if(!_&&!x||_&&x)return!1}else if(_&&!x||!_&&x)return!0}catch(_){if(_ instanceof II)i&&console.debug(`Failed to compute property ${h} locally: ${_}`),f=!0;else throw _}if(f)throw new II("can't match cohort without a given cohort property value");return s==="AND"}}function wii(t){try{return new RegExp(t),!0}catch{return!1}}function Iii(t){if(t instanceof Date)return t;if(typeof t=="string"||typeof t=="number"){let e=new Date(t);if(!isNaN(e.valueOf()))return e;throw new II(`${t} is in an invalid date format`)}else throw new II(`The date provided ${t} must be a string, number, or date object`)}function GOa(t){let e=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,n=t.match(e),i=new Date(new Date().toISOString());if(n){if(!n.groups)return null;let s=parseInt(n.groups.number);if(s>=1e4)return null;let o=n.groups.interval;if(o=="h")i.setUTCHours(i.getUTCHours()-s);else if(o=="d")i.setUTCDate(i.getUTCDate()-s);else if(o=="w")i.setUTCDate(i.getUTCDate()-s*7);else if(o=="m")i.setUTCMonth(i.getUTCMonth()-s);else if(o=="y")i.setUTCFullYear(i.getUTCFullYear()-s);else return null;return i}else return null}var UOa=30*1e3,VOa=50*1e3,GOn=class extends BOn{constructor(e,n={}){n.captureMode=n?.captureMode||"json",super(e,n),this._memoryStorage=new WOn,this.options=n,n.personalApiKey&&(this.featureFlagsPoller=new zOn({pollingInterval:typeof n.featureFlagsPollingInterval=="number"?n.featureFlagsPollingInterval:UOa,personalApiKey:n.personalApiKey,projectApiKey:e,timeout:n.requestTimeout??1e4,host:this.host,fetch:n.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=n.maxCacheSize||VOa}getPersistedProperty(e){return this._memoryStorage.getProperty(e)}setPersistedProperty(e,n){return this._memoryStorage.setProperty(e,n)}fetch(e,n){return this.options.fetch?this.options.fetch(e,n):Nii(e,n)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return ROa}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(e=!0){super.debug(e),this.featureFlagsPoller?.debug(e)}capture({distinctId:e,event:n,properties:i,groups:s,sendFeatureFlags:o,timestamp:f,disableGeoip:h,uuid:_}){let x=A=>{super.captureStateless(e,n,A,{timestamp:f,disableGeoip:h,uuid:_})},v=(A,w,N)=>super.getFeatureFlagsStateless(A,w,void 0,void 0,N),T=Promise.resolve().then(async()=>{if(o)return await v(e,s,h);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let A={};for(let[w,N]of Object.entries(s||{}))A[w]=String(N);return await this.getAllFlags(e,{groups:A,disableGeoip:h,onlyEvaluateLocally:!0})}return{}}).then(A=>{let w={};if(A)for(let[P,F]of Object.entries(A))w[`$feature/${P}`]=F;let N=Object.keys(A||{}).filter(P=>A?.[P]!==!1);return N.length>0&&(w.$active_feature_flags=N),w}).catch(()=>({})).then(A=>{x({...A,...i,$groups:s})});this.addPendingPromise(T)}identify({distinctId:e,properties:n,disableGeoip:i}){let s=n?.$set||n;super.identifyStateless(e,{$set:s},{disableGeoip:i})}alias(e){super.aliasStateless(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}async getFeatureFlag(e,n,i){let{groups:s,disableGeoip:o}=i||{},{onlyEvaluateLocally:f,sendFeatureFlagEvents:h,personProperties:_,groupProperties:x}=i||{},v=this.addLocalPersonAndGroupProperties(n,s,_,x);_=v.allPersonProperties,x=v.allGroupProperties,f==null&&(f=!1),h==null&&(h=!0);let T=await this.featureFlagsPoller?.getFeatureFlag(e,n,s,_,x),A=T!==void 0;!A&&!f&&(T=await super.getFeatureFlagStateless(e,n,s,_,x,o));let w=`${e}_${T}`;return h&&(!(n in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[n].includes(w))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[n])?this.distinctIdHasSentFlagCalls[n].push(w):this.distinctIdHasSentFlagCalls[n]=[w],this.capture({distinctId:n,event:"$feature_flag_called",properties:{$feature_flag:e,$feature_flag_response:T,locally_evaluated:A,[`$feature/${e}`]:T},groups:s,disableGeoip:o})),T}async getFeatureFlagPayload(e,n,i,s){let{groups:o,disableGeoip:f}=s||{},{onlyEvaluateLocally:h,sendFeatureFlagEvents:_,personProperties:x,groupProperties:v}=s||{},T=this.addLocalPersonAndGroupProperties(n,o,x,v);x=T.allPersonProperties,v=T.allGroupProperties;let A;return i||(i=await this.getFeatureFlag(e,n,{...s,onlyEvaluateLocally:!0})),i&&(A=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(e,i)),h==null&&(h=!1),_==null&&(_=!0),h==null&&(h=!1),!(A!==void 0)&&!h&&(A=await super.getFeatureFlagPayloadStateless(e,n,o,x,v,f)),A}async isFeatureEnabled(e,n,i){let s=await this.getFeatureFlag(e,n,i);if(s!==void 0)return!!s||!1}async getAllFlags(e,n){return(await this.getAllFlagsAndPayloads(e,n)).featureFlags}async getAllFlagsAndPayloads(e,n){let{groups:i,disableGeoip:s}=n||{},{onlyEvaluateLocally:o,personProperties:f,groupProperties:h}=n||{},_=this.addLocalPersonAndGroupProperties(e,i,f,h);f=_.allPersonProperties,h=_.allGroupProperties,o==null&&(o=!1);let x=await this.featureFlagsPoller?.getAllFlagsAndPayloads(e,i,f,h),v={},T={},A=!0;if(x&&(v=x.response,T=x.payloads,A=x.fallbackToDecide),A&&!o){let w=await super.getFeatureFlagsAndPayloadsStateless(e,i,f,h,s);v={...v,...w.flags||{}},T={...T,...w.payloads||{}}}return{featureFlags:v,featureFlagPayloads:T}}groupIdentify({groupType:e,groupKey:n,properties:i,distinctId:s,disableGeoip:o}){super.groupIdentifyStateless(e,n,i,{disableGeoip:o},s)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(e){return this.featureFlagsPoller?.stopPoller(),super.shutdown(e)}addLocalPersonAndGroupProperties(e,n,i,s){let o={distinct_id:e,...i||{}},f={};if(n)for(let h of Object.keys(n))f[h]={$group_key:n[h],...s?.[h]||{}};return{allPersonProperties:o,allGroupProperties:f}}},eBt=class t{constructor(e,n,i,s){this.posthog=e,this.posthogHost=n,this.organization=i,this.prefix=s,this.name="posthog-node",this.posthogHost=e.options.host??"https://app.posthog.com"}setupOnce(e,n){e(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let s=n(),o=i.tags[t.POSTHOG_ID_TAG];if(o===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${o}`,this.posthogHost).toString();let f={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},h=s.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&h!==void 0&&i.event_id!==void 0&&(f.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${h}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:o,properties:f}),i})}};eBt.POSTHOG_ID_TAG="posthog_distinct_id";tBt.PostHog=GOn;tBt.PostHogSentryIntegration=eBt});var Mii,Fii=Ct(()=>{"use strict";Mii=t=>{let e=/(?:\/[^\/\s]+\s*)+[\/]?/g;return t.replace(e,"REDACTED-FILE-PATH")}});var Bii,ilt,Wii=Ct(()=>{"use strict";Bii=Ho(Lii(),1);Fii();ilt=class{__options;__telemetryClient;constructor(e){this.__options=e,this.__telemetryClient=new Bii.PostHog("phc_nGWKWP3t1fcNFqGi6UdstXjMf0fxx7SBeohHPSS6d2Y",{host:"https://app.posthog.com"})}dispose(){return this.__telemetryClient.shutdown()}async sendEvent(e,n,i=!1){let{kind:s,...o}=e,f=n?.distinctId??this.__options.distinctId,h=n?.cloudRole??this.__options.cloudRole,_=i?o:Object.entries(o).reduce((x,[v,T])=>(x[v]=Mii(String(T)),x),{});this.__telemetryClient?.capture({distinctId:f,event:`codemod.${h}.${s}`,properties:{cloudRole:h,..._}})}async sendDangerousEvent(e,n){return this.sendEvent(e,n,!0)}}});var slt,jii=Ct(()=>{"use strict";slt=class{sendEvent(){}sendDangerousEvent(){}async dispose(){return Promise.resolve()}}});var zii=Ct(()=>{"use strict";Wii();jii()});var Gii={};pme(Gii,{main:()=>qOa});var uV,qOa,Uii=Ct(()=>{"use strict";y_e();zor();Gor();rtt();W2r();z2r();rEr();Ghn();sEr();rni();_ri();xri();vri();Sri();Cri();RC();zii();uV=async t=>{let e=typeof t.clientIdentifier=="string"?t.clientIdentifier:"CLI";zb.interceptors.request.use(o=>(o.headers["X-Client-Identifier"]=e,o));let n=new B3e(t.json),i=t.telemetry?new ilt({cloudRole:e,distinctId:await Ari()}):new slt,s=async(o,f)=>{try{await o()}catch(h){if(await i.dispose(),!(h instanceof Error))return process.exit(0);n.printOperationMessage({kind:"error",message:h.message})}if(await i.dispose(),!f)return process.exit(0)};return{printer:n,telemetryService:i,exit:process.exit.bind(null,0),executeCliCommand:s}},qOa=async()=>{let t=Hun(process.argv),e=bri(jor(t).help().version(!1));if(e.wrap(e.terminalWidth()),(t.includes("--version")||t.includes("-v"))&&t.length===1)return console.log(mle);let n=Coe(`
32304
+ */var X5t="0123456789abcdef",Y5t=class t{constructor(e){this.bytes=e}static ofInner(e){if(e.length!==16)throw new TypeError("not 128-bit length");return new t(e)}static fromFieldsV7(e,n,i,s){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||n<0||i<0||s<0||e>0xffffffffffff||n>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");let o=new Uint8Array(16);return o[0]=e/2**40,o[1]=e/2**32,o[2]=e/2**24,o[3]=e/2**16,o[4]=e/2**8,o[5]=e,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=s>>>24,o[13]=s>>>16,o[14]=s>>>8,o[15]=s,new t(o)}static parse(e){let n;switch(e.length){case 32:n=/^[0-9a-f]{32}$/i.exec(e)?.[0];break;case 36:n=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("");break;case 38:n=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(e)?.slice(1,6).join("");break;case 45:n=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("");break}if(n){let i=new Uint8Array(16);for(let s=0;s<16;s+=4){let o=parseInt(n.substring(2*s,2*s+8),16);i[s+0]=o>>>24,i[s+1]=o>>>16,i[s+2]=o>>>8,i[s+3]=o}return new t(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let e="";for(let n=0;n<this.bytes.length;n++)e+=X5t.charAt(this.bytes[n]>>>4),e+=X5t.charAt(this.bytes[n]&15),(n===3||n===5||n===7||n===9)&&(e+="-");return e}toHex(){let e="";for(let n=0;n<this.bytes.length;n++)e+=X5t.charAt(this.bytes[n]>>>4),e+=X5t.charAt(this.bytes[n]&15);return e}toJSON(){return this.toString()}getVariant(){let e=this.bytes[8]>>>4;if(e<0)throw new Error("unreachable");if(e<=7)return this.bytes.every(n=>n===0)?"NIL":"VAR_0";if(e<=11)return"VAR_10";if(e<=13)return"VAR_110";if(e<=15)return this.bytes.every(n=>n===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new t(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let n=0;n<16;n++){let i=this.bytes[n]-e.bytes[n];if(i!==0)return Math.sign(i)}return 0}},FOn=class{constructor(e){this.timestamp=0,this.counter=0,this.random=e??WOa()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(e,n){let i=this.generateOrAbortCore(e,n);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(e,n)),i}generateOrAbortCore(e,n){if(!Number.isInteger(e)||e<1||e>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(n<0||n>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(e>this.timestamp)this.timestamp=e,this.resetCounter();else if(e+n>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return Y5t.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){let e=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return e[6]=64|e[6]>>>4,e[8]=128|e[8]>>>2,Y5t.ofInner(e)}},WOa=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),Tii,Dii=()=>jOa().toString(),jOa=()=>(Tii||(Tii=new FOn)).generate(),Q5t=class extends Error{constructor(e){super("HTTP error while fetching PostHog: "+e.status),this.response=e,this.name="PostHogFetchHttpError"}},rlt=class extends Error{constructor(e){super("Network error while fetching PostHog",e instanceof Error?{cause:e}:{}),this.error=e,this.name="PostHogFetchNetworkError"}};function Aii(t){return typeof t=="object"&&(t instanceof Q5t||t instanceof rlt)}var BOn=class{constructor(e,n){this.flushPromise=null,this.disableGeoip=!0,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new MOn,this._isInitialized=!1,OOa(e,"You must pass your PostHog project's api key."),this.apiKey=e,this.host=LOa(n?.host||"https://app.posthog.com"),this.flushAt=n?.flushAt?Math.max(n?.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,n?.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,n?.maxQueueSize??1e3),this.flushInterval=n?.flushInterval??1e4,this.captureMode=n?.captureMode||"form",this.defaultOptIn=n?.defaultOptIn??!0,this._retryOptions={retryCount:n?.fetchRetryCount??3,retryDelay:n?.fetchRetryDelay??3e3,retryCheck:Aii},this.requestTimeout=n?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=n?.featureFlagsRequestTimeoutMs??3e3,this.disableGeoip=n?.disableGeoip??!0,this.disabled=n?.disabled??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}wrap(e){if(this.disabled){this.isDebug&&console.warn("[PostHog] The client is disabled");return}if(this._isInitialized)return e();this._initPromise.then(()=>e())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(u$.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(u$.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(u$.OptedOut,!0)})}on(e,n){return this._events.on(e,n)}debug(e=!0){if(this.removeDebugCallback?.(),e){let n=this.on("*",(i,s)=>console.log("PostHog Debug",i,s));this.removeDebugCallback=()=>{n(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(e){return{distinct_id:e.distinct_id,event:e.event,properties:{...e.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(e){let n=Dii();return this.pendingPromises[n]=e,e.catch(()=>{}).finally(()=>{delete this.pendingPromises[n]}),e}identifyStateless(e,n,i){this.wrap(()=>{let s={...this.buildPayload({distinct_id:e,event:"$identify",properties:n})};this.enqueue("identify",s,i)})}captureStateless(e,n,i,s){this.wrap(()=>{let o=this.buildPayload({distinct_id:e,event:n,properties:i});this.enqueue("capture",o,s)})}aliasStateless(e,n,i,s){this.wrap(()=>{let o=this.buildPayload({event:"$create_alias",distinct_id:n,properties:{...i||{},distinct_id:n,alias:e}});this.enqueue("alias",o,s)})}groupIdentifyStateless(e,n,i,s,o,f){this.wrap(()=>{let h=this.buildPayload({distinct_id:o||`$${e}_${n}`,event:"$groupidentify",properties:{$group_type:e,$group_key:n,$group_set:i||{},...f||{}}});this.enqueue("capture",h,s)})}async getDecide(e,n={},i={},s={},o={}){await this._initPromise;let f=`${this.host}/decide/?v=3`,h={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:e,groups:n,person_properties:i,group_properties:s,...o})};return this.fetchWithRetry(f,h,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(_=>_.json()).catch(_=>{this._events.emit("error",_)})}async getFeatureFlagStateless(e,n,i={},s={},o={},f){await this._initPromise;let h=await this.getFeatureFlagsStateless(n,i,s,o,f);if(!h)return;let _=h[e];return _===void 0&&(_=!1),_}async getFeatureFlagPayloadStateless(e,n,i={},s={},o={},f){await this._initPromise;let h=await this.getFeatureFlagPayloadsStateless(n,i,s,o,f);if(!h)return;let _=h[e];return _===void 0?null:_}async getFeatureFlagPayloadsStateless(e,n={},i={},s={},o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(e,n,i,s,o)).payloads}_parsePayload(e){try{return JSON.parse(e)}catch{return e}}async getFeatureFlagsStateless(e,n={},i={},s={},o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(e,n,i,s,o)).flags}async getFeatureFlagsAndPayloadsStateless(e,n={},i={},s={},o){await this._initPromise;let f={};(o??this.disableGeoip)&&(f.geoip_disable=!0);let h=await this.getDecide(e,n,i,s,f),_=h?.featureFlags,x=h?.featureFlagPayloads,v=x;return x&&(v=Object.fromEntries(Object.entries(x).map(([T,A])=>[T,this._parsePayload(A)]))),{flags:_,payloads:v}}enqueue(e,n,i){this.wrap(()=>{if(this.optedOut){this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let s={...n,type:e,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:Eii(),uuid:i?.uuid?i.uuid:Dii()};(i?.disableGeoip??this.disableGeoip)&&(s.properties||(s.properties={}),s.properties.$geoip_disable=!0),s.distinctId&&(s.distinct_id=s.distinctId,delete s.distinctId);let f=this.getPersistedProperty(u$.Queue)||[];f.length>=this.maxQueueSize&&(f.shift(),console.info("Queue is full, the oldest event is dropped.")),f.push({message:s}),this.setPersistedProperty(u$.Queue,f),this._events.emit(e,s),f.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Pii(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}getCustomHeaders(){let e=this.getCustomUserAgent(),n={};return e&&e!==""&&(n["User-Agent"]=e),n}async _flush(){this.clearFlushTimer(),await this._initPromise;let e=this.getPersistedProperty(u$.Queue)||[];if(!e.length)return[];let n=e.slice(0,this.maxBatchSize),i=n.map(x=>x.message),s=()=>{let x=this.getPersistedProperty(u$.Queue)||[];this.setPersistedProperty(u$.Queue,x.slice(n.length))},o={api_key:this.apiKey,batch:i,sent_at:Eii()},f=JSON.stringify(o),h=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${FOa()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,_=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(nlt.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f};try{await this.fetchWithRetry(h,_)}catch(x){throw x instanceof rlt||s(),this._events.emit("error",x),x}return s(),this._events.emit("flush",i),i}async fetchWithRetry(e,n,i,s){var o;return(o=AbortSignal).timeout??(o.timeout=function(h){let _=new AbortController;return setTimeout(()=>_.abort(),h),_.signal}),await MOa(async()=>{let f=null;try{f=await this.fetch(e,{signal:AbortSignal.timeout(s??this.requestTimeout),...n})}catch(_){throw new rlt(_)}if(!(n.mode==="no-cors")&&(f.status<200||f.status>=400))throw new Q5t(f);return f},{...this._retryOptions,...i})}async shutdown(e=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let n=Date.now()+e;for(;(this.getPersistedProperty(u$.Queue)||[]).length!==0;){await this.flush();let s=Date.now();if(n<s)break}}catch(n){if(!Aii(n))throw n;console.error("Error while shutting down PostHog",n)}}},WOn=class{constructor(){this._memoryStorage={}}getProperty(e){return this._memoryStorage[e]}setProperty(e,n){this._memoryStorage[e]=n!==null?n:void 0}},jOn=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!jOn){let t=bii();jOn=async(e,n)=>{let i=await t.request({url:e,headers:n.headers,method:n.method.toLowerCase(),data:n.body,signal:n.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var Nii=jOn,zOa=1152921504606847e3,Z5t=class t extends Error{constructor(e){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=e,Object.setPrototypeOf(this,t.prototype)}},II=class t extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,t.prototype)}},zOn=class{constructor({pollingInterval:e,personalApiKey:n,projectApiKey:i,timeout:s,host:o,customHeaders:f,...h}){this.debugMode=!1,this.pollingInterval=e,this.personalApiKey=n,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=s,this.projectApiKey=i,this.host=o,this.poller=void 0,this.fetch=h.fetch||Nii,this.onError=h.onError,this.customHeaders=f,this.loadFeatureFlags()}debug(e=!0){this.debugMode=e}async getFeatureFlag(e,n,i={},s={},o={}){await this.loadFeatureFlags();let f,h;if(!this.loadedSuccessfullyOnce)return f;for(let _ of this.featureFlags)if(e===_.key){h=_;break}if(h!==void 0)try{f=this.computeFlagLocally(h,n,i,s,o),this.debugMode&&console.debug(`Successfully computed flag locally: ${e} -> ${f}`)}catch(_){_ instanceof II?this.debugMode&&console.debug(`InconclusiveMatchError when computing flag locally: ${e}: ${_}`):_ instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${e}: ${_}`))}return f}async computeFeatureFlagPayloadLocally(e,n){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof n=="boolean"?i=this.featureFlagsByKey?.[e]?.filters?.payloads?.[n.toString()]:typeof n=="string"&&(i=this.featureFlagsByKey?.[e]?.filters?.payloads?.[n]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(e,n={},i={},s={}){await this.loadFeatureFlags();let o={},f={},h=this.featureFlags.length==0;return this.featureFlags.map(async _=>{try{let x=this.computeFlagLocally(_,e,n,i,s);o[_.key]=x;let v=await this.computeFeatureFlagPayloadLocally(_.key,x);v&&(f[_.key]=v)}catch(x){x instanceof II||x instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${_.key}: ${x}`)),h=!0}}),{response:o,payloads:f,fallbackToDecide:h}}computeFlagLocally(e,n,i={},s={},o={}){if(e.ensure_experience_continuity)throw new II("Flag has experience continuity enabled");if(!e.active)return!1;let h=(e.filters||{}).aggregation_group_type_index;if(h!=null){let _=this.groupTypeMapping[String(h)];if(!_)throw this.debugMode&&console.warn(`[FEATURE FLAGS] Unknown group type index ${h} for feature flag ${e.key}`),new II("Flag has unknown group type index");if(!(_ in i))return this.debugMode&&console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${e.key} without group names passed in`),!1;let x=o[_];return this.matchFeatureFlagProperties(e,i[_],x)}else return this.matchFeatureFlagProperties(e,n,s)}matchFeatureFlagProperties(e,n,i){let s=e.filters||{},o=s.groups||[],f=!1,h,_=[...o].sort((x,v)=>{let T=!!x.variant,A=!!v.variant;return T&&A?0:T?-1:A?1:0});for(let x of _)try{if(this.isConditionMatch(e,n,x,i)){let v=x.variant,T=s.multivariate?.variants||[];v&&T.some(A=>A.key===v)?h=v:h=this.getMatchingVariant(e,n)||!0;break}}catch(v){if(v instanceof II)f=!0;else throw v}if(h!==void 0)return h;if(f)throw new II("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(e,n,i,s){let o=i.rollout_percentage;if((i.properties||[]).length>0){for(let f of i.properties){let h=f.type,_=!1;if(h==="cohort"?_=Rii(f,s,this.cohorts,this.debugMode):_=kii(f,s),!_)return!1}if(o==null)return!0}return!(o!=null&&Cii(e.key,n)>o/100)}getMatchingVariant(e,n){let i=Cii(e.key,n,"variant"),s=this.variantLookupTable(e).find(o=>i>=o.valueMin&&i<o.valueMax);if(s)return s.key}variantLookupTable(e){let n=[],i=0,s=0;return((e.filters||{}).multivariate?.variants||[]).forEach(h=>{s=i+h.rollout_percentage/100,n.push({valueMin:i,valueMax:s,key:h.key}),i=s}),n}async loadFeatureFlags(e=!1){(!this.loadedSuccessfullyOnce||e)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let e=await this._requestFeatureFlagDefinitions();if(e&&e.status===401)throw new Z5t("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(e&&e.status!==200)return;let n=await e.json();"flags"in n||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`)),this.featureFlags=n.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,s)=>(i[s.key]=s,i),{}),this.groupTypeMapping=n.group_type_mapping||{},this.cohorts=n.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(e){e instanceof Z5t&&this.onError?.(e)}}async _requestFeatureFlagDefinitions(){let e=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,n={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let s=new AbortController;i=Pii(()=>{s.abort()},this.timeout),n.signal=s.signal}try{return await this.fetch(e,n)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function Cii(t,e,n=""){let i=kOa.createHash();return i.update(`${t}.${e}${n}`),parseInt(i.digest("hex").slice(0,15),16)/zOa}function kii(t,e){let n=t.key,i=t.value,s=t.operator||"exact";if(n in e){if(s==="is_not_set")throw new II("Operator is_not_set is not supported")}else throw new II(`Property ${n} not found in propertyValues`);let o=e[n];function f(_,x){return Array.isArray(_)?_.map(v=>String(v).toLowerCase()).includes(String(x).toLowerCase()):String(_).toLowerCase()===String(x).toLowerCase()}function h(_,x,v){if(v==="gt")return _>x;if(v==="gte")return _>=x;if(v==="lt")return _<x;if(v==="lte")return _<=x;throw new Error(`Invalid operator: ${v}`)}switch(s){case"exact":return f(i,o);case"is_not":return!f(i,o);case"is_set":return n in e;case"icontains":return String(o).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(i).toLowerCase());case"regex":return wii(String(i))&&String(o).match(String(i))!==null;case"not_regex":return wii(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let _=typeof i=="number"?i:null;if(typeof i=="string")try{_=parseFloat(i)}catch{}return _!=null&&o!=null?typeof o=="string"?h(o,String(i),s):h(o,_,s):h(String(o),String(i),s)}case"is_date_after":case"is_date_before":{let _=GOa(String(i));if(_==null&&(_=Iii(i)),_==null)throw new II(`Invalid date: ${i}`);let x=Iii(o);return["is_date_before"].includes(s)?x<_:x>_}default:throw new II(`Unknown operator: ${s}`)}}function Rii(t,e,n,i=!1){let s=String(t.value);if(!(s in n))throw new II("can't match cohort without a given cohort property value");let o=n[s];return Oii(o,e,n,i)}function Oii(t,e,n,i=!1){if(!t)return!0;let s=t.type,o=t.values;if(!o||o.length===0)return!0;let f=!1;if("values"in o[0]){for(let h of o)try{let _=Oii(h,e,n,i);if(s==="AND"){if(!_)return!1}else if(_)return!0}catch(_){if(_ instanceof II)i&&console.debug(`Failed to compute property ${h} locally: ${_}`),f=!0;else throw _}if(f)throw new II("Can't match cohort without a given cohort property value");return s==="AND"}else{for(let h of o)try{let _;h.type==="cohort"?_=Rii(h,e,n,i):_=kii(h,e);let x=h.negation||!1;if(s==="AND"){if(!_&&!x||_&&x)return!1}else if(_&&!x||!_&&x)return!0}catch(_){if(_ instanceof II)i&&console.debug(`Failed to compute property ${h} locally: ${_}`),f=!0;else throw _}if(f)throw new II("can't match cohort without a given cohort property value");return s==="AND"}}function wii(t){try{return new RegExp(t),!0}catch{return!1}}function Iii(t){if(t instanceof Date)return t;if(typeof t=="string"||typeof t=="number"){let e=new Date(t);if(!isNaN(e.valueOf()))return e;throw new II(`${t} is in an invalid date format`)}else throw new II(`The date provided ${t} must be a string, number, or date object`)}function GOa(t){let e=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,n=t.match(e),i=new Date(new Date().toISOString());if(n){if(!n.groups)return null;let s=parseInt(n.groups.number);if(s>=1e4)return null;let o=n.groups.interval;if(o=="h")i.setUTCHours(i.getUTCHours()-s);else if(o=="d")i.setUTCDate(i.getUTCDate()-s);else if(o=="w")i.setUTCDate(i.getUTCDate()-s*7);else if(o=="m")i.setUTCMonth(i.getUTCMonth()-s);else if(o=="y")i.setUTCFullYear(i.getUTCFullYear()-s);else return null;return i}else return null}var UOa=30*1e3,VOa=50*1e3,GOn=class extends BOn{constructor(e,n={}){n.captureMode=n?.captureMode||"json",super(e,n),this._memoryStorage=new WOn,this.options=n,n.personalApiKey&&(this.featureFlagsPoller=new zOn({pollingInterval:typeof n.featureFlagsPollingInterval=="number"?n.featureFlagsPollingInterval:UOa,personalApiKey:n.personalApiKey,projectApiKey:e,timeout:n.requestTimeout??1e4,host:this.host,fetch:n.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=n.maxCacheSize||VOa}getPersistedProperty(e){return this._memoryStorage.getProperty(e)}setPersistedProperty(e,n){return this._memoryStorage.setProperty(e,n)}fetch(e,n){return this.options.fetch?this.options.fetch(e,n):Nii(e,n)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return ROa}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(e=!0){super.debug(e),this.featureFlagsPoller?.debug(e)}capture({distinctId:e,event:n,properties:i,groups:s,sendFeatureFlags:o,timestamp:f,disableGeoip:h,uuid:_}){let x=A=>{super.captureStateless(e,n,A,{timestamp:f,disableGeoip:h,uuid:_})},v=(A,w,N)=>super.getFeatureFlagsStateless(A,w,void 0,void 0,N),T=Promise.resolve().then(async()=>{if(o)return await v(e,s,h);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let A={};for(let[w,N]of Object.entries(s||{}))A[w]=String(N);return await this.getAllFlags(e,{groups:A,disableGeoip:h,onlyEvaluateLocally:!0})}return{}}).then(A=>{let w={};if(A)for(let[P,F]of Object.entries(A))w[`$feature/${P}`]=F;let N=Object.keys(A||{}).filter(P=>A?.[P]!==!1);return N.length>0&&(w.$active_feature_flags=N),w}).catch(()=>({})).then(A=>{x({...A,...i,$groups:s})});this.addPendingPromise(T)}identify({distinctId:e,properties:n,disableGeoip:i}){let s=n?.$set||n;super.identifyStateless(e,{$set:s},{disableGeoip:i})}alias(e){super.aliasStateless(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}async getFeatureFlag(e,n,i){let{groups:s,disableGeoip:o}=i||{},{onlyEvaluateLocally:f,sendFeatureFlagEvents:h,personProperties:_,groupProperties:x}=i||{},v=this.addLocalPersonAndGroupProperties(n,s,_,x);_=v.allPersonProperties,x=v.allGroupProperties,f==null&&(f=!1),h==null&&(h=!0);let T=await this.featureFlagsPoller?.getFeatureFlag(e,n,s,_,x),A=T!==void 0;!A&&!f&&(T=await super.getFeatureFlagStateless(e,n,s,_,x,o));let w=`${e}_${T}`;return h&&(!(n in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[n].includes(w))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[n])?this.distinctIdHasSentFlagCalls[n].push(w):this.distinctIdHasSentFlagCalls[n]=[w],this.capture({distinctId:n,event:"$feature_flag_called",properties:{$feature_flag:e,$feature_flag_response:T,locally_evaluated:A,[`$feature/${e}`]:T},groups:s,disableGeoip:o})),T}async getFeatureFlagPayload(e,n,i,s){let{groups:o,disableGeoip:f}=s||{},{onlyEvaluateLocally:h,sendFeatureFlagEvents:_,personProperties:x,groupProperties:v}=s||{},T=this.addLocalPersonAndGroupProperties(n,o,x,v);x=T.allPersonProperties,v=T.allGroupProperties;let A;return i||(i=await this.getFeatureFlag(e,n,{...s,onlyEvaluateLocally:!0})),i&&(A=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(e,i)),h==null&&(h=!1),_==null&&(_=!0),h==null&&(h=!1),!(A!==void 0)&&!h&&(A=await super.getFeatureFlagPayloadStateless(e,n,o,x,v,f)),A}async isFeatureEnabled(e,n,i){let s=await this.getFeatureFlag(e,n,i);if(s!==void 0)return!!s||!1}async getAllFlags(e,n){return(await this.getAllFlagsAndPayloads(e,n)).featureFlags}async getAllFlagsAndPayloads(e,n){let{groups:i,disableGeoip:s}=n||{},{onlyEvaluateLocally:o,personProperties:f,groupProperties:h}=n||{},_=this.addLocalPersonAndGroupProperties(e,i,f,h);f=_.allPersonProperties,h=_.allGroupProperties,o==null&&(o=!1);let x=await this.featureFlagsPoller?.getAllFlagsAndPayloads(e,i,f,h),v={},T={},A=!0;if(x&&(v=x.response,T=x.payloads,A=x.fallbackToDecide),A&&!o){let w=await super.getFeatureFlagsAndPayloadsStateless(e,i,f,h,s);v={...v,...w.flags||{}},T={...T,...w.payloads||{}}}return{featureFlags:v,featureFlagPayloads:T}}groupIdentify({groupType:e,groupKey:n,properties:i,distinctId:s,disableGeoip:o}){super.groupIdentifyStateless(e,n,i,{disableGeoip:o},s)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(e){return this.featureFlagsPoller?.stopPoller(),super.shutdown(e)}addLocalPersonAndGroupProperties(e,n,i,s){let o={distinct_id:e,...i||{}},f={};if(n)for(let h of Object.keys(n))f[h]={$group_key:n[h],...s?.[h]||{}};return{allPersonProperties:o,allGroupProperties:f}}},eBt=class t{constructor(e,n,i,s){this.posthog=e,this.posthogHost=n,this.organization=i,this.prefix=s,this.name="posthog-node",this.posthogHost=e.options.host??"https://app.posthog.com"}setupOnce(e,n){e(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let s=n(),o=i.tags[t.POSTHOG_ID_TAG];if(o===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${o}`,this.posthogHost).toString();let f={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},h=s.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&h!==void 0&&i.event_id!==void 0&&(f.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${h}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:o,properties:f}),i})}};eBt.POSTHOG_ID_TAG="posthog_distinct_id";tBt.PostHog=GOn;tBt.PostHogSentryIntegration=eBt});var Mii,Fii=Ct(()=>{"use strict";Mii=t=>{let e=/(?:\/[^\/\s]+\s*)+[\/]?/g;return t.replace(e,"REDACTED-FILE-PATH")}});var Bii,ilt,Wii=Ct(()=>{"use strict";Bii=Ho(Lii(),1);Fii();ilt=class{__options;__telemetryClient;constructor(e){this.__options=e,this.__telemetryClient=new Bii.PostHog("phc_nGWKWP3t1fcNFqGi6UdstXjMf0fxx7SBeohHPSS6d2Y",{host:"https://app.posthog.com",flushAt:1,flushInterval:0})}dispose(){return this.__telemetryClient.shutdown()}async sendEvent(e,n,i=!1){let{kind:s,...o}=e,f=n?.distinctId??this.__options.distinctId,h=n?.cloudRole??this.__options.cloudRole,_=i?o:Object.entries(o).reduce((x,[v,T])=>(x[v]=Mii(String(T)),x),{});this.__telemetryClient?.capture({distinctId:f,event:`codemod.${h}.${s}`,properties:{cloudRole:h,..._}})}async sendDangerousEvent(e,n){return this.sendEvent(e,n,!0)}}});var slt,jii=Ct(()=>{"use strict";slt=class{sendEvent(){}sendDangerousEvent(){}async dispose(){return Promise.resolve()}}});var zii=Ct(()=>{"use strict";Wii();jii()});var Gii={};pme(Gii,{main:()=>qOa});var uV,qOa,Uii=Ct(()=>{"use strict";y_e();zor();Gor();rtt();W2r();z2r();rEr();Ghn();sEr();rni();_ri();xri();vri();Sri();Cri();RC();zii();uV=async t=>{let e=typeof t.clientIdentifier=="string"?t.clientIdentifier:"CLI";zb.interceptors.request.use(o=>(o.headers["X-Client-Identifier"]=e,o));let n=new B3e(t.json),i=t.telemetry?new ilt({cloudRole:e,distinctId:await Ari()}):new slt,s=async(o,f)=>{try{await o()}catch(h){if(await i.dispose(),!(h instanceof Error))return process.exit(0);n.printOperationMessage({kind:"error",message:h.message})}if(await i.dispose(),!f)return process.exit(0)};return{printer:n,telemetryService:i,exit:process.exit.bind(null,0),executeCliCommand:s}},qOa=async()=>{let t=Hun(process.argv),e=bri(jor(t).help().version(!1));if(e.wrap(e.terminalWidth()),(t.includes("--version")||t.includes("-v"))&&t.length===1)return console.log(mle);let n=Coe(`
32305
32305
  ${Ii.bold.red("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}
32306
32306
  ${Ii.bold.red("\u{1F6A8} Codemod CLI Deprecation Notice")}
32307
32307
  ${Ii.bold.red("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "imports": {
5
5
  "#*": "./src/*"
6
6
  },
7
- "version": "0.18.12",
7
+ "version": "0.18.13",
8
8
  "description": "A codemod engine for Node.js libraries (jscodeshift, ts-morph, etc.)",
9
9
  "type": "module",
10
10
  "exports": null,
@@ -62,10 +62,10 @@
62
62
  "yargs": "^17.6.2",
63
63
  "@codemod-com/api-types": "1.0.1",
64
64
  "@codemod-com/printer": "1.0.1",
65
- "@codemod-com/runner": "1.3.11",
66
65
  "@codemod-com/filemod": "2.1.0",
67
- "@codemod-com/utilities": "1.2.1",
68
- "@codemod-com/telemetry": "1.1.0"
66
+ "@codemod-com/runner": "1.3.11",
67
+ "@codemod-com/telemetry": "1.1.1",
68
+ "@codemod-com/utilities": "1.2.1"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=18.5.0"