@expo/repack-app 0.2.7 → 0.2.8

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.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ ${i}`),Object.assign(O,W),c(O)}else a(W)},z=k=>{u?r.removeListener("exit",w):r.r
26
26
  `).replace(/[\r\u0085\u2028]/g,`
27
27
  `)}function Kg(t){this.options=t||{locator:{}}}Kg.prototype.parseFromString=function(t,o){var e=this.options,s=new Dy,i=e.domBuilder||new cs,r=e.errorHandler,n=e.locator,a=e.xmlns||{},c=/\/x?html?$/.test(o),u=c?yg.HTML_ENTITIES:yg.XML_ENTITIES;n&&i.setDocumentLocator(n),s.errorHandler=$y(r,i,n),s.domBuilder=e.domBuilder||i,c&&(a[""]=hg.HTML),a.xml=a.xml||hg.XML;var d=e.normalizeLineEndings||kg;return t&&typeof t=="string"?s.parse(d(t),a,u):s.errorHandler.error("invalid doc source"),i.doc};function $y(t,o,e){if(!t){if(o instanceof cs)return o;t=o}var s={},i=t instanceof Function;e=e||{};function r(n){var a=t[n];!a&&i&&(a=t.length==2?function(c){t(n,c)}:t),s[n]=a&&function(c){a("[xmldom "+n+"] "+c+An(e))}||function(){}}return r("warning"),r("error"),r("fatalError"),s}function cs(){this.cdata=!1}function we(t,o){o.lineNumber=t.lineNumber,o.columnNumber=t.columnNumber}cs.prototype={startDocument:function(){this.doc=new Jy().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,o,e,s){var i=this.doc,r=i.createElementNS(t,e||o),n=s.length;ji(this,r),this.currentElement=r,this.locator&&we(this.locator,r);for(var a=0;a<n;a++){var t=s.getURI(a),c=s.getValue(a),e=s.getQName(a),u=i.createAttributeNS(t,e);this.locator&&we(s.getLocator(a),u),u.value=u.nodeValue=c,r.setAttributeNode(u)}},endElement:function(t,o,e){var s=this.currentElement,i=s.tagName;this.currentElement=s.parentNode},startPrefixMapping:function(t,o){},endPrefixMapping:function(t){},processingInstruction:function(t,o){var e=this.doc.createProcessingInstruction(t,o);this.locator&&we(this.locator,e),ji(this,e)},ignorableWhitespace:function(t,o,e){},characters:function(t,o,e){if(t=fg.apply(this,arguments),t){if(this.cdata)var s=this.doc.createCDATASection(t);else var s=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(s):/^\s*$/.test(t)&&this.doc.appendChild(s),this.locator&&we(this.locator,s)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,o,e){t=fg.apply(this,arguments);var s=this.doc.createComment(t);this.locator&&we(this.locator,s),ji(this,s)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,o,e){var s=this.doc.implementation;if(s&&s.createDocumentType){var i=s.createDocumentType(t,o,e);this.locator&&we(this.locator,i),ji(this,i),this.doc.doctype=i}},warning:function(t){console.warn("[xmldom warning] "+t,An(this.locator))},error:function(t){console.error("[xmldom error] "+t,An(this.locator))},fatalError:function(t){throw new By(t,this.locator)}};function An(t){if(t)return`
28
28
  @`+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function fg(t,o,e){return typeof t=="string"?t.substr(o,e):t.length>=o+e||o?new java.lang.String(t,o,e)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){cs.prototype[t]=function(){return null}});function ji(t,o){t.currentElement?t.currentElement.appendChild(o):t.doc.appendChild(o)}Ri.__DOMHandler=cs;Ri.normalizeLineEndings=kg;Ri.DOMParser=Kg});var vg=S(Ji=>{var bg=Ln();Ji.DOMImplementation=bg.DOMImplementation;Ji.XMLSerializer=bg.XMLSerializer;Ji.DOMParser=Gg().DOMParser});var Wg=S(ls=>{"use strict";var Hy=ls&&ls.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ls,"__esModule",{value:!0});ls.parse=eh;var oh=vg(),ye=Hy(require("assert")),Bi=3,pg=4,th=8;function Qn(t){return t.nodeType===Bi||t.nodeType===th||t.nodeType===pg}function lt(t){return!t.childNodes||t.childNodes.length===0}function eh(t){let o=new oh.DOMParser({errorHandler(){}}).parseFromString(t);(0,ye.default)(o.documentElement.nodeName==="plist","malformed document. First element should be <plist>");let e=he(o.documentElement);return e.length===1&&(e=e[0]),e}function he(t){let o,e,s,i,r,n;if(!t)return null;if(t.nodeName==="plist"){if(i=[],lt(t))return i;for(o=0;o<t.childNodes.length;o++)Qn(t.childNodes[o])||i.push(he(t.childNodes[o]));return i}else if(t.nodeName==="dict"){if(e={},s=null,n=0,lt(t))return e;for(o=0;o<t.childNodes.length;o++)Qn(t.childNodes[o])||(n%2===0?((0,ye.default)(t.childNodes[o].nodeName==="key","Missing key while parsing <dict/>."),s=he(t.childNodes[o])):((0,ye.default)(t.childNodes[o].nodeName!=="key",'Unexpected key "'+he(t.childNodes[o])+'" while parsing <dict/>.'),e[s]=he(t.childNodes[o])),n+=1);if(n%2===1)throw new Error('Missing value for "'+s+'" while parsing <dict/>');return e}else if(t.nodeName==="array"){if(i=[],lt(t))return i;for(o=0;o<t.childNodes.length;o++)Qn(t.childNodes[o])||(r=he(t.childNodes[o]),r!=null&&i.push(r));return i}else if(t.nodeName!=="#text"){if(t.nodeName==="key")return lt(t)?"":t.childNodes[0].nodeValue;if(t.nodeName==="string"){if(r="",lt(t))return r;for(o=0;o<t.childNodes.length;o++){let a=t.childNodes[o].nodeType;(a===Bi||a===pg)&&(r+=t.childNodes[o].nodeValue)}return r}else{if(t.nodeName==="integer")return(0,ye.default)(!lt(t),'Cannot parse "" as integer.'),parseInt(t.childNodes[0].nodeValue,10);if(t.nodeName==="real"){for((0,ye.default)(!lt(t),'Cannot parse "" as real.'),r="",o=0;o<t.childNodes.length;o++)t.childNodes[o].nodeType===Bi&&(r+=t.childNodes[o].nodeValue);return parseFloat(r)}else if(t.nodeName==="data"){if(r="",lt(t))return Buffer.from(r,"base64");for(o=0;o<t.childNodes.length;o++)t.childNodes[o].nodeType===Bi&&(r+=t.childNodes[o].nodeValue.replace(/\s+/g,""));return Buffer.from(r,"base64")}else{if(t.nodeName==="date")return(0,ye.default)(!lt(t),'Cannot parse "" as Date.'),new Date(t.childNodes[0].nodeValue);if(t.nodeName==="true")return!0;if(t.nodeName==="false")return!1}}}}});var qg=S(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});var sh=Sm(),ih=Wg();jn.default={parse:ih.parse,build:sh.build}});var nh={};Lg(nh,{ConsoleLogger:()=>Ge,repackAppAndroidAsync:()=>Hu,repackAppIosAsync:()=>Eg});module.exports=Tg(nh);var on=P(require("node:assert")),pt=P(require("node:fs/promises")),st=P(require("node:path")),$u=P(er());var Lo=P(require("fs/promises")),Ke=P(require("node:assert")),Mo=P(require("node:path")),qs=P(mr());var Kc="./apktool.jar";var Gc=Mo.default.resolve(__dirname,Kc);async function bc(t,o){let{spawnAsync:e,workingDirectory:s}=o,i="decoded-apk";return await e("java",["-jar",Gc,"decode",t,"-s","-o",i],{cwd:s}),Mo.default.join(s,i)}async function vc(t,o){let{spawnAsync:e,workingDirectory:s}=o,r=Mo.default.resolve(s,"apktool-packed.apk");return await e("java",["-jar",Gc,"build","-o",r,t]),r}async function pc({decodedApkRoot:t,assetRoot:o,bundleOutputPath:e}){await Lo.default.copyFile(e,Mo.default.join(t,"assets","index.android.bundle"));let s=await qc(o,Mo.default.join(t,"res"));await Rg(t,s)}async function Wc(t,o){let e=Mo.default.join(t,"apktool.yml"),s=await Lo.default.readFile(e,"utf8");s=s.replace(/^(\s+renameManifestPackage:\s+)(.+)$/gm,`$1${o}`),await Lo.default.writeFile(e,s)}async function Rg(t,o){let e=Mo.default.join(t,"res/values/public.xml"),s=await Lo.default.readFile(e,"utf8"),i=new qs.Parser,r=new Set,n=await i.parseStringPromise(s),a=0,c=0,u=0;for(let k of n.resources.public){let p=parseInt(k.$.id,16);k.$.type==="drawable"?(a=Math.max(a,p),r.add(k.$.name)):k.$.type==="raw"&&(c=Math.max(c,p),r.add(k.$.name)),u=Math.max(u,p)}(0,Ke.default)(a!==0,"Drawable resources must be defined."),c===0&&(c=(u&4294901760)+65536);let d=(a&4294901760)+65536,x=(c&4294901760)+65536,g=new Set([...o.keys()].filter(k=>!r.has(k)));for(let k of g){let p=o.get(k);p!=null&&(p.type==="drawable"?(a+=1,(0,Ke.default)(a<d,"Drawable resource ID boundary exceeded."),n.resources.public.push({$:{type:"drawable",name:p.name,id:`0x${a.toString(16)}`}})):p.type==="raw"&&(c+=1,(0,Ke.default)(c<x,"Raw resource ID boundary exceeded."),n.resources.public.push({$:{type:"raw",name:p.name,id:`0x${c.toString(16)}`}})))}let z=new qs.Builder().buildObject(n);await Lo.default.writeFile(e,z)}function Jg(t){if(t.startsWith("drawable"))return"drawable";if(t==="raw")return"raw";throw new Error(`Unsupported asset type for ${t}`)}async function qc(t,o,e=0,s=2,i=void 0,r=new Map){await Lo.default.mkdir(o,{recursive:!0});let n=await Lo.default.readdir(t,{withFileTypes:!0});return await Promise.all(n.map(async a=>{let c=Mo.default.join(t,a.name),u=Mo.default.join(o,a.name);if(a.isDirectory()){let d=i??Jg(a.name);e<s-1?await qc(c,u,e+1,s,d,r):await Lo.default.mkdir(u,{recursive:!0})}else{await Lo.default.copyFile(c,u);let{name:d}=Mo.default.parse(a.name);(0,Ke.default)(i,"Asset type must be defined."),r.set(d,{name:d,type:i})}})),r}var Or=P(require("node:assert")),Cc=P(require("node:fs/promises")),tt=P(require("node:path")),gr=null;async function Nc(t){if(gr==null){let o=t?.androidBuildToolsDir??await Bg(t);(0,Or.default)(o!=null,"Unable to find the Android build-tools directory."),gr={aapt2Path:tt.default.join(o,"aapt2"),apksignerPath:tt.default.join(o,"apksigner"),dexdumpPath:tt.default.join(o,"dexdump"),zipalignPath:tt.default.join(o,"zipalign")}}return gr}async function Sc(t,o,e){let{spawnAsync:s,workingDirectory:i}=o,{apksignerPath:r,zipalignPath:n}=await Nc(o),a=tt.default.join(i,"resigned.apk"),c=tt.default.resolve(i,"resigned-unaligned.apk");await s("zip",["-r","-0",c,"lib","resources.arsc"],{cwd:t}),await s("zip",["-r",c,".","-x","lib/*","-x","resources.arsc"],{cwd:t}),await s(n,["-v","-p","4",c,a]);let u=["sign","--ks",e.keyStorePath,"--ks-pass",e.keyStorePassword];return e.keyAlias&&u.push("--ks-key-alias",e.keyAlias),e.keyPassword&&u.push("--key-pass",e.keyPassword),u.push(a),await s(r,u),a}async function Bg(t){let{logger:o}=t,e=process.env.ANDROID_SDK_ROOT;(0,Or.default)(e!=null,"ANDROID_SDK_ROOT environment variable is not set");let s=tt.default.join(e,"build-tools");try{let r=(await Cc.default.readdir(s,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort((n,a)=>{let c=n.split(".").map(Number),u=a.split(".").map(Number);for(let d=0;d<Math.min(c.length,u.length);d++)if(c[d]!==u[d])return u[d]-c[d];return u.length-c.length});return r.length>0?tt.default.join(s,r[0]):(o.error("No build-tools directories found."),null)}catch(i){return o.error(`Failed to read the build-tools directory: ${i}`),null}}async function Fc(t,o,e){let{logger:s,spawnAsync:i}=e,{dexdumpPath:r}=await Nc(e),n=`"^ Class descriptor : 'L${o.replace(/\./g,"/")}\\/"`;try{let{stdout:a}=await i(r,["classes*.dex","|","grep",n],{cwd:t,shell:!0,stdio:"pipe"}),c=a.split(`
29
- `).map(u=>u.match(/Class descriptor\s+?:\s+?'L(.+);'/)?.[1].replace(/\//g,".")).filter(Boolean);return new Set(c)}catch(a){return s.info(`Failed to search for classes in the APK - grepAppIdPattern[${o}]: ${a}`),null}}var Zt=P(require("node:assert")),pe=P(require("node:fs/promises")),ql=P(require("node:path")),Fs=P(mr());var vl=P(Kl()),pl=P(require("node:assert")),bt=P(require("node:fs/promises")),Yt=P(require("node:path"));async function Wl(t){return(await bt.default.stat(t).catch(()=>null))?.isFile()??!1}async function Ss(t){return(await bt.default.stat(t).catch(()=>null))?.isDirectory()??!1}function be(t){return(0,pl.default)(t!=null,"Expected value to be non-null"),t}async function ve(t){let o=t.platform==="android"?".apk":".ipa";return{...t,projectRoot:Yt.default.resolve(t.projectRoot),workingDirectory:t.workingDirectory??await bt.default.mkdtemp(Yt.default.join(bl(),"repack-app-")),outputPath:t.outputPath??Yt.default.join(t.projectRoot,`repacked${o}`),logger:WO(t.logger),spawnAsync:t.spawnAsync??qO(!!t.verbose)}}function WO(t){return t!=null?Ns.isBunyanLikeLogger(t)?new Ns(t):t:new Ge}var Ge=class{debug(...o){console.debug(...o)}info(...o){console.log(...o)}warn(...o){console.warn(...o)}error(...o){console.error(...o)}time(o){console.time(o)}timeEnd(o){console.timeEnd(o)}},Ns=class{constructor(o){this.logger=o}timerMap={};static isBunyanLikeLogger(o){return o.info&&o.time===void 0}debug(...o){this.logger.debug(o.join(""))}info(...o){this.logger.info(o.join(""))}warn(...o){this.logger.warn(o.join(""))}error(...o){this.logger.error(o.join(""))}time(o){this.timerMap[o]=Date.now()}timeEnd(o){if(this.timerMap[o]==null){this.logger.warn(`Timer '${o}' does not exist`);return}let e=Date.now()-this.timerMap[o];this.logger.info(`${o}: ${e} ms`),delete this.timerMap[o]}};function qO(t){return function(e,s,i){return(0,vl.default)(e,s,{stdio:t?"inherit":"pipe",...i})}}async function It(t,o){await bt.default.mkdir(o,{recursive:!0});let e=await bt.default.readdir(t,{withFileTypes:!0});for(let s of e){let i=Yt.default.join(t,s.name),r=Yt.default.join(o,s.name);s.isDirectory()?await It(i,r):s.isFile()&&await bt.default.copyFile(i,r)}}async function Cl({config:t,decodedApkRoot:o}){let e=ql.default.join(o,"res","values","strings.xml"),s=await pe.default.readFile(e,"utf8");s=s.replace(/(<string name="app_name">)(.+)(<\/string>)/,`$1${t.name}$3`),await pe.default.writeFile(e,s)}async function Nl({config:t,androidManiestXml:o,dexClasses:e,originalAppId:s,originalAppIdFallback:i,updatesRuntimeVersion:r}){let n=be(t.android?.package);o.manifest.$.package=n,Wr(o,d=>d.startsWith(s)&&!e.has(d)?d.replace(s,n):d);let a=pr("manifest",o.manifest,(d,x)=>d==="intent-filter"&&pr(d,x,(g,w)=>g==="action"&&w[0].$?.["android:name"]==="android.intent.action.VIEW").length>0),c=Array.isArray(t.scheme)?t.scheme[0]:t.scheme;for(let d of a)Wr(d,x=>{let g=x.replace(s,n).replace(/^exp\+.+$/g,`exp+${be(t.slug)}`);return c&&(g=g.replace(/^myapp$/g,c)),i!=null&&(g=g.replace(i,n)),g});let u=o.manifest.application[0];(0,Zt.default)(u.$?.["android:name"]?.endsWith(".MainApplication"),"Expected application node to be named as MainApplication"),CO(u,t,r)}async function Sl(t){let o=await pe.default.readFile(t,"utf8");return await new Fs.Parser().parseStringPromise(o)}async function Fl(t,o){let s=new Fs.Builder().buildObject(t);await pe.default.writeFile(o,s)}function Ml(t){let o=t.manifest.$.package;return(0,Zt.default)(o!=null,"Expected package attribute to be present in AndroidManifest.xml"),o}function El(t,o){let e=t.manifest.application?.[0]?.$?.["android:name"];if(e){let s=e.replace(/\.[^.]+$/,"");if(s!==e&&s!==o)return s}return null}function CO(t,o,e){let s=t["meta-data"]??[],i=o.updates?.enabled??!0,r=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.ENABLED");r!=null?((0,Zt.default)(r.$!=null),r.$["android:value"]=i?"true":"false"):s.push({$:{"android:name":"expo.modules.updates.ENABLED","android:value":i?"true":"false"}});let n=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.EXPO_RUNTIME_VERSION");e!=null&&(n!=null?((0,Zt.default)(n.$!=null),n.$["android:value"]=e):s.push({$:{"android:name":"expo.modules.updates.EXPO_RUNTIME_VERSION","android:value":e}}));let a=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.EXPO_UPDATE_URL"),c=o.updates?.url;c&&(a!=null?((0,Zt.default)(a.$!=null),a.$["android:value"]=c):s.push({$:{"android:name":"expo.modules.updates.EXPO_UPDATE_URL","android:value":c}}))}function pr(t,o,e){return o==null?[]:e(t,o)?[o]:Object.keys(o).filter(s=>s!=="$"&&s!=="_").flatMap(s=>{let i=o[s];return pr(s,i,e)})}function Wr(t,o){if(t==null)return;let e=t.$??{};for(let[s,i]of Object.entries(e))e[s]=o(i);for(let[s,i]of Object.entries(t))s==="$"||s==="_"||Wr(i,o)}var Vl="./debug.keystore";var Qu=P(Au());function Rs(t,o){let e=process.env;for(let[s,i]of Object.entries(o??{})){if(e[s]!==void 0)continue;let r;i==null?r="":typeof i=="string"?r=i:r=JSON.stringify(i),e[s]=r}Bd("development"),(0,Qu.loadProjectEnv)(t)}function Bd(t){process.env.NODE_ENV=process.env.NODE_ENV||t,process.env.BABEL_ENV=process.env.BABEL_ENV||process.env.NODE_ENV,globalThis.__DEV__=process.env.NODE_ENV!=="production"}var Bs=P(require("node:assert")),Js=P(require("node:fs/promises")),Eo=P(require("node:path")),Bt=P(Bu());async function Ds(t,o){let{workingDirectory:e}=t,s=Eo.default.join(e,"app.config");return await Js.default.writeFile(s,JSON.stringify(o)),s}async function $s(t){let{platform:o,projectRoot:e,spawnAsync:s,workingDirectory:i}=t,{stdout:r}=await s("node",["-e","require('expo/scripts/resolveAppEntry')",e,o,"absolute"],{cwd:e,stdio:"pipe"}),n=Bt.default.silent(t.projectRoot,"expo-updates/utils/build/createUpdatesResources.js");return(0,Bs.default)(n,"Failed to resolve `createUpdatesResources.js` within expo-updates package"),await s("node",[n,o,e,i,"all",r.trim()],{cwd:e}),Eo.default.join(i,"app.manifest")}function Hs(t){let o=Du(t);(0,Bs.default)(o,"Failed to resolve '@expo/config' package in the project");let{getPackageJson:e}=require(o),s=e(t);return!!(s.dependencies&&"expo-updates"in s.dependencies)}async function oi(t,o){let{projectRoot:e,spawnAsync:s}=t,i=Bt.default.silent(e,"expo-updates/bin/cli")??(0,Bt.default)(e,"expo-updates/bin/cli.js"),{stdout:r}=await s(i,["runtimeversion:resolve","--platform","android","--workflow","managed"],{cwd:e,stdio:"pipe"});return JSON.parse(r).runtimeVersion??null}function Du(t){let o=Bt.default.silent(t,"expo/package.json");return o?Bt.default.silent(Eo.default.dirname(o),"@expo/config")??null:null}function ti(t,o){let e=Du(t);(0,Bs.default)(e,"Failed to resolve '@expo/config' package in the project");let{getConfig:s}=require(e);return s(t,o)}async function ei(t,o){let{projectRoot:e,platform:s,spawnAsync:i,workingDirectory:r}=o,n=Eo.default.resolve(r,"bundles");await Js.default.mkdir(n,{recursive:!0});let a=Eo.default.join(n,"assets");await Js.default.mkdir(a,{recursive:!0});let{stdout:c}=await i("node",["-e","require('expo/scripts/resolveAppEntry')",e,s,"absolute"],{cwd:e,stdio:"pipe"}),u=$d(t,s),d=s==="android"?"index.android.bundle":"main.bundle",x=Eo.default.join(n,d),g=["expo","export:embed","--platform",s,"--entry-file",c.trim(),"--bundle-output",Eo.default.join(n,d),"--assets-dest",Eo.default.join(n,"assets"),"--dev","false","--reset-cache"];return u?(g.push("--minify","false"),g.push("--bytecode","true"),g.push("--unstable-transform-profile","hermes")):g.push("--minify","true"),o.exportEmbedOptions?.sourcemapOutput&&g.push("--sourcemap-output",o.exportEmbedOptions.sourcemapOutput),await i("npx",g,{cwd:e}),{bundleOutputPath:x,assetRoot:a}}async function si({appWorkingDirectory:t,options:o}){if(o.exportEmbedOptions!=null)return!0;let e;return o.platform==="android"?e=Eo.default.join(t,"assets","index.android.bundle"):e=Eo.default.join(t,"main.jsbundle"),await Wl(e)}function $d(t,o){switch(o){case"android":return(t.android?.jsEngine??t.jsEngine)!=="jsc";case"ios":return(t.ios?.jsEngine??t.jsEngine)!=="jsc";default:return!1}}var Hd=st.default.resolve(__dirname,Vl);async function Hu(t){let o=await ve(t),{logger:e,spawnAsync:s,workingDirectory:i}=o;await pt.default.mkdir(i,{recursive:!0}),Rs(o.projectRoot,o.env);let{exp:r}=ti(o.projectRoot,{isPublicConfig:!0,skipSDKVersionRequirement:!0}),n=await bc(st.default.resolve(o.sourceAppPath),o);(0,on.default)(r.android?.package,"Expected app ID (`android.package`) to be defined in app.json");let a=Hs(o.projectRoot),c=a?await oi(o,r):null;if(e.info($u.default.dim(`Resolved runtime version: ${c}`)),await si({appWorkingDirectory:n,options:o})){e.time("Generating bundle");let{assetRoot:l,bundleOutputPath:m}=await ei(r,o);if(e.timeEnd("Generating bundle"),e.time("Adding bundled resources"),await pc({decodedApkRoot:n,assetRoot:l,bundleOutputPath:m}),e.timeEnd("Adding bundled resources"),a){e.time("Generating 'app.manifest' for expo-updates");let _=await $s(o),G=st.default.join(n,"assets");await pt.default.copyFile(_,st.default.join(G,st.default.basename(_))),e.timeEnd("Generating 'app.manifest' for expo-updates")}}e.time("Updating AndroidManifest.xml");let d=st.default.join(n,"AndroidManifest.xml"),x=await Sl(d),g=Ml(x),w=new Set([g]),z=El(x,g);z!=null&&w.add(z);let k=await Promise.any(Array.from(w).map(l=>Fc(n,l,o)));(0,on.default)(k!=null,"Failed to search for dex classes with appId in the APK"),await Nl({config:r,androidManiestXml:x,dexClasses:k,originalAppId:g,originalAppIdFallback:z,options:o,updatesRuntimeVersion:c}),await Wc(n,r.android?.package),await Fl(x,d),e.timeEnd("Updating AndroidManifest.xml"),e.time("Updating resources"),await Cl({config:r,decodedApkRoot:n}),e.timeEnd("Updating resources"),e.time("Generating app config");let p=await Ds(o,r);await pt.default.copyFile(p,st.default.join(n,"assets","app.config")),e.timeEnd("Generating app config"),e.time("Creating updated apk");let W=await vc(n,o),q=st.default.join(i,"unzip");await pt.default.mkdir(q,{recursive:!0}),await s("unzip",["-o",W,"-d",q]);let O=await Sc(q,o,{keyStorePath:o.androidSigningOptions?.keyStorePath??Hd,keyStorePassword:o.androidSigningOptions?.keyStorePassword??"pass:android",keyAlias:o.androidSigningOptions?.keyAlias,keyPassword:o.androidSigningOptions?.keyPassword});if(e.timeEnd("Creating updated apk"),await pt.default.rename(O,o.outputPath),!o.skipWorkingDirCleanup)try{await pt.default.rm(i,{recursive:!0})}catch{}return o.outputPath}var Hi=P(require("node:assert")),Kt=P(require("node:fs/promises")),Bo=P(require("node:path")),Mg=P(er());var f_=P(x_(),1);var Fe=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var aw={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Me=t=>t.replace(/[[\]\\-]/g,"\\$&"),cw=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),m_=t=>t.join(""),g_=(t,o)=>{let e=o;if(t.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=e+1,n=!1,a=!1,c=!1,u=!1,d=e,x="";o:for(;r<t.length;){let k=t.charAt(r);if((k==="!"||k==="^")&&r===e+1){u=!0,r++;continue}if(k==="]"&&n&&!c){d=r+1;break}if(n=!0,k==="\\"&&!c){c=!0,r++;continue}if(k==="["&&!c){for(let[p,[W,q,O]]of Object.entries(aw))if(t.startsWith(p,r)){if(x)return["$.",!1,t.length-e,!0];r+=p.length,O?i.push(W):s.push(W),a=a||q;continue o}}if(c=!1,x){k>x?s.push(Me(x)+"-"+Me(k)):k===x&&s.push(Me(k)),x="",r++;continue}if(t.startsWith("-]",r+1)){s.push(Me(k+"-")),r+=2;continue}if(t.startsWith("-",r+1)){x=k,r+=2;continue}s.push(Me(k)),r++}if(d<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,t.length-e,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!u){let k=s[0].length===2?s[0].slice(-1):s[0];return[cw(k),!1,d-e,!1]}let g="["+(u?"^":"")+m_(s)+"]",w="["+(u?"":"^")+m_(i)+"]";return[s.length&&i.length?"("+g+"|"+w+")":s.length?g:w,a,d-e,!0]};var Vo=(t,{windowsPathsNoEscape:o=!1}={})=>o?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var lw=new Set(["!","?","+","*","@"]),O_=t=>lw.has(t),uw="(?!(?:^|/)\\.\\.?(?:$|/))",ii="(?!\\.)",_w=new Set(["[","."]),xw=new Set(["..","."]),mw=new Set("().*{}+?[]^$\\!"),gw=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sn="[^/]",d_=sn+"*?",w_=sn+"+?",Dt=class t{type;#o;#t;#r=!1;#s=[];#n;#f;#l;#_=!1;#a;#c;#i=!1;constructor(o,e,s={}){this.type=o,o&&(this.#t=!0),this.#n=e,this.#o=this.#n?this.#n.#o:this,this.#a=this.#o===this?s:this.#o.#a,this.#l=this.#o===this?[]:this.#o.#l,o==="!"&&!this.#o.#_&&this.#l.push(this),this.#f=this.#n?this.#n.#s.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let o of this.#s)if(typeof o!="string"&&(o.type||o.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#s.map(o=>String(o)).join("|")+")":this.#c=this.#s.map(o=>String(o)).join("")}#d(){if(this!==this.#o)throw new Error("should only call on root");if(this.#_)return this;this.toString(),this.#_=!0;let o;for(;o=this.#l.pop();){if(o.type!=="!")continue;let e=o,s=e.#n;for(;s;){for(let i=e.#f+1;!s.type&&i<s.#s.length;i++)for(let r of o.#s){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#s[i])}e=s,s=e.#n}}return this}push(...o){for(let e of o)if(e!==""){if(typeof e!="string"&&!(e instanceof t&&e.#n===this))throw new Error("invalid part: "+e);this.#s.push(e)}}toJSON(){let o=this.type===null?this.#s.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#s.map(e=>e.toJSON())];return this.isStart()&&!this.type&&o.unshift([]),this.isEnd()&&(this===this.#o||this.#o.#_&&this.#n?.type==="!")&&o.push({}),o}isStart(){if(this.#o===this)return!0;if(!this.#n?.isStart())return!1;if(this.#f===0)return!0;let o=this.#n;for(let e=0;e<this.#f;e++){let s=o.#s[e];if(!(s instanceof t&&s.type==="!"))return!1}return!0}isEnd(){if(this.#o===this||this.#n?.type==="!")return!0;if(!this.#n?.isEnd())return!1;if(!this.type)return this.#n?.isEnd();let o=this.#n?this.#n.#s.length:0;return this.#f===o-1}copyIn(o){typeof o=="string"?this.push(o):this.push(o.clone(this))}clone(o){let e=new t(this.type,o);for(let s of this.#s)e.copyIn(s);return e}static#w(o,e,s,i){let r=!1,n=!1,a=-1,c=!1;if(e.type===null){let w=s,z="";for(;w<o.length;){let k=o.charAt(w++);if(r||k==="\\"){r=!r,z+=k;continue}if(n){w===a+1?(k==="^"||k==="!")&&(c=!0):k==="]"&&!(w===a+2&&c)&&(n=!1),z+=k;continue}else if(k==="["){n=!0,a=w,c=!1,z+=k;continue}if(!i.noext&&O_(k)&&o.charAt(w)==="("){e.push(z),z="";let p=new t(k,e);w=t.#w(o,p,w,i),e.push(p);continue}z+=k}return e.push(z),w}let u=s+1,d=new t(null,e),x=[],g="";for(;u<o.length;){let w=o.charAt(u++);if(r||w==="\\"){r=!r,g+=w;continue}if(n){u===a+1?(w==="^"||w==="!")&&(c=!0):w==="]"&&!(u===a+2&&c)&&(n=!1),g+=w;continue}else if(w==="["){n=!0,a=u,c=!1,g+=w;continue}if(O_(w)&&o.charAt(u)==="("){d.push(g),g="";let z=new t(w,d);d.push(z),u=t.#w(o,z,u,i);continue}if(w==="|"){d.push(g),g="",x.push(d),d=new t(null,e);continue}if(w===")")return g===""&&e.#s.length===0&&(e.#i=!0),d.push(g),g="",e.push(...x,d),u;g+=w}return e.type=null,e.#t=void 0,e.#s=[o.substring(s-1)],u}static fromGlob(o,e={}){let s=new t(null,void 0,e);return t.#w(o,s,0,e),s}toMMPattern(){if(this!==this.#o)return this.#o.toMMPattern();let o=this.toString(),[e,s,i,r]=this.toRegExpSource();if(!(i||this.#t||this.#a.nocase&&!this.#a.nocaseMagicOnly&&o.toUpperCase()!==o.toLowerCase()))return s;let a=(this.#a.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,a),{_src:e,_glob:o})}get options(){return this.#a}toRegExpSource(o){let e=o??!!this.#a.dot;if(this.#o===this&&this.#d(),!this.type){let c=this.isStart()&&this.isEnd(),u=this.#s.map(w=>{let[z,k,p,W]=typeof w=="string"?t.#x(w,this.#t,c):w.toRegExpSource(o);return this.#t=this.#t||p,this.#r=this.#r||W,z}).join(""),d="";if(this.isStart()&&typeof this.#s[0]=="string"&&!(this.#s.length===1&&xw.has(this.#s[0]))){let z=_w,k=e&&z.has(u.charAt(0))||u.startsWith("\\.")&&z.has(u.charAt(2))||u.startsWith("\\.\\.")&&z.has(u.charAt(4)),p=!e&&!o&&z.has(u.charAt(0));d=k?uw:p?ii:""}let x="";return this.isEnd()&&this.#o.#_&&this.#n?.type==="!"&&(x="(?:$|\\/)"),[d+u+x,Vo(u),this.#t=!!this.#t,this.#r]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#m(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let c=this.toString();return this.#s=[c],this.type=null,this.#t=void 0,[c,Vo(this.toString()),!1,!1]}let n=!s||o||e||!ii?"":this.#m(!0);n===r&&(n=""),n&&(r=`(?:${r})(?:${n})*?`);let a="";if(this.type==="!"&&this.#i)a=(this.isStart()&&!e?ii:"")+w_;else{let c=this.type==="!"?"))"+(this.isStart()&&!e&&!o?ii:"")+d_+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=i+r+c}return[a,Vo(r),this.#t=!!this.#t,this.#r]}#m(o){return this.#s.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,i,r,n]=e.toRegExpSource(o);return this.#r=this.#r||n,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#x(o,e,s=!1){let i=!1,r="",n=!1;for(let a=0;a<o.length;a++){let c=o.charAt(a);if(i){i=!1,r+=(mw.has(c)?"\\":"")+c;continue}if(c==="\\"){a===o.length-1?r+="\\\\":i=!0;continue}if(c==="["){let[u,d,x,g]=g_(o,a);if(x){r+=u,n=n||d,a+=x-1,e=e||g;continue}}if(c==="*"){s&&o==="*"?r+=w_:r+=d_,e=!0;continue}if(c==="?"){r+=sn,e=!0;continue}r+=gw(c)}return[r,Vo(o),!!e,n]}};var $t=(t,{windowsPathsNoEscape:o=!1}={})=>o?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var xo=(t,o,e={})=>(Fe(o),!e.nocomment&&o.charAt(0)==="#"?!1:new ko(o,e).match(t)),Ow=/^\*+([^+@!?\*\[\(]*)$/,dw=t=>o=>!o.startsWith(".")&&o.endsWith(t),ww=t=>o=>o.endsWith(t),yw=t=>(t=t.toLowerCase(),o=>!o.startsWith(".")&&o.toLowerCase().endsWith(t)),hw=t=>(t=t.toLowerCase(),o=>o.toLowerCase().endsWith(t)),fw=/^\*+\.\*+$/,zw=t=>!t.startsWith(".")&&t.includes("."),kw=t=>t!=="."&&t!==".."&&t.includes("."),Kw=/^\.\*+$/,Gw=t=>t!=="."&&t!==".."&&t.startsWith("."),bw=/^\*+$/,vw=t=>t.length!==0&&!t.startsWith("."),pw=t=>t.length!==0&&t!=="."&&t!=="..",Ww=/^\?+([^+@!?\*\[\(]*)?$/,qw=([t,o=""])=>{let e=z_([t]);return o?(o=o.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(o)):e},Cw=([t,o=""])=>{let e=k_([t]);return o?(o=o.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(o)):e},Nw=([t,o=""])=>{let e=k_([t]);return o?s=>e(s)&&s.endsWith(o):e},Sw=([t,o=""])=>{let e=z_([t]);return o?s=>e(s)&&s.endsWith(o):e},z_=([t])=>{let o=t.length;return e=>e.length===o&&!e.startsWith(".")},k_=([t])=>{let o=t.length;return e=>e.length===o&&e!=="."&&e!==".."},K_=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",y_={win32:{sep:"\\"},posix:{sep:"/"}},Fw=K_==="win32"?y_.win32.sep:y_.posix.sep;xo.sep=Fw;var ro=Symbol("globstar **");xo.GLOBSTAR=ro;var Mw="[^/]",Ew=Mw+"*?",Vw="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Xw="(?:(?!(?:\\/|^)\\.).)*?",Yw=(t,o={})=>e=>xo(e,t,o);xo.filter=Yw;var Co=(t,o={})=>Object.assign({},t,o),Iw=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return xo;let o=xo;return Object.assign((s,i,r={})=>o(s,i,Co(t,r)),{Minimatch:class extends o.Minimatch{constructor(i,r={}){super(i,Co(t,r))}static defaults(i){return o.defaults(Co(t,i)).Minimatch}},AST:class extends o.AST{constructor(i,r,n={}){super(i,r,Co(t,n))}static fromGlob(i,r={}){return o.AST.fromGlob(i,Co(t,r))}},unescape:(s,i={})=>o.unescape(s,Co(t,i)),escape:(s,i={})=>o.escape(s,Co(t,i)),filter:(s,i={})=>o.filter(s,Co(t,i)),defaults:s=>o.defaults(Co(t,s)),makeRe:(s,i={})=>o.makeRe(s,Co(t,i)),braceExpand:(s,i={})=>o.braceExpand(s,Co(t,i)),match:(s,i,r={})=>o.match(s,i,Co(t,r)),sep:o.sep,GLOBSTAR:ro})};xo.defaults=Iw;var G_=(t,o={})=>(Fe(t),o.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,f_.default)(t));xo.braceExpand=G_;var Zw=(t,o={})=>new ko(t,o).makeRe();xo.makeRe=Zw;var Pw=(t,o,e={})=>{let s=new ko(o,e);return t=t.filter(i=>s.match(i)),s.options.nonull&&!t.length&&t.push(o),t};xo.match=Pw;var h_=/[?*]|[+@!]\(.*?\)|\[|\]/,Lw=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ko=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(o,e={}){Fe(o),e=e||{},this.options=e,this.pattern=o,this.platform=e.platform||K_,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let o of this.set)for(let e of o)if(typeof e!="string")return!0;return!1}debug(...o){}make(){let o=this.pattern,e=this.options;if(!e.nocomment&&o.charAt(0)==="#"){this.comment=!0;return}if(!o){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,n,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=r[0]===""&&r[1]===""&&(r[2]==="?"||!h_.test(r[2]))&&!h_.test(r[3]),u=/^[a-z]:/i.test(r[0]);if(c)return[...r.slice(0,4),...r.slice(4).map(d=>this.parse(d))];if(u)return[r[0],...r.slice(1).map(d=>this.parse(d))]}return r.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let n=this.set[r];n[0]===""&&n[1]===""&&this.globParts[r][2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])&&(n[2]="?")}this.debug(this.pattern,this.set)}preprocess(o){if(this.options.noglobstar)for(let s=0;s<o.length;s++)for(let i=0;i<o[s].length;i++)o[s][i]==="**"&&(o[s][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(o=this.firstPhasePreProcess(o),o=this.secondPhasePreProcess(o)):e>=1?o=this.levelOneOptimize(o):o=this.adjascentGlobstarOptimize(o),o}adjascentGlobstarOptimize(o){return o.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(o){return o.map(e=>(e=e.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(o){Array.isArray(o)||(o=this.slashSplit(o));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<o.length-1;i++){let r=o[i];i===1&&r===""&&o[0]===""||(r==="."||r==="")&&(e=!0,o.splice(i,1),i--)}o[0]==="."&&o.length===2&&(o[1]==="."||o[1]==="")&&(e=!0,o.pop())}let s=0;for(;(s=o.indexOf("..",s+1))!==-1;){let i=o[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(e=!0,o.splice(s-1,2),s-=2)}}while(e);return o.length===0?[""]:o}firstPhasePreProcess(o){let e=!1;do{e=!1;for(let s of o){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let n=i;for(;s[n+1]==="**";)n++;n>i&&s.splice(i+1,n-i);let a=s[i+1],c=s[i+2],u=s[i+3];if(a!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;e=!0,s.splice(i,1);let d=s.slice(0);d[i]="**",o.push(d),i--}if(!this.preserveMultipleSlashes){for(let n=1;n<s.length-1;n++){let a=s[n];n===1&&a===""&&s[0]===""||(a==="."||a==="")&&(e=!0,s.splice(n,1),n--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let n=s[r-1];if(n&&n!=="."&&n!==".."&&n!=="**"){e=!0;let c=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...c),s.length===0&&s.push(""),r-=2}}}}while(e);return o}secondPhasePreProcess(o){for(let e=0;e<o.length-1;e++)for(let s=e+1;s<o.length;s++){let i=this.partsMatch(o[e],o[s],!this.preserveMultipleSlashes);if(i){o[e]=[],o[s]=i;break}}return o.filter(e=>e.length)}partsMatch(o,e,s=!1){let i=0,r=0,n=[],a="";for(;i<o.length&&r<e.length;)if(o[i]===e[r])n.push(a==="b"?e[r]:o[i]),i++,r++;else if(s&&o[i]==="**"&&e[r]===o[i+1])n.push(o[i]),i++;else if(s&&e[r]==="**"&&o[i]===e[r+1])n.push(e[r]),r++;else if(o[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(a==="b")return!1;a="a",n.push(o[i]),i++,r++}else if(e[r]==="*"&&o[i]&&(this.options.dot||!o[i].startsWith("."))&&o[i]!=="**"){if(a==="a")return!1;a="b",n.push(e[r]),i++,r++}else return!1;return o.length===e.length&&n}parseNegate(){if(this.nonegate)return;let o=this.pattern,e=!1,s=0;for(let i=0;i<o.length&&o.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=o.slice(s)),this.negate=e}matchOne(o,e,s=!1){let i=this.options;if(this.isWindows){let k=typeof o[0]=="string"&&/^[a-z]:$/i.test(o[0]),p=!k&&o[0]===""&&o[1]===""&&o[2]==="?"&&/^[a-z]:$/i.test(o[3]),W=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),q=!W&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),O=p?3:k?0:void 0,l=q?3:W?0:void 0;if(typeof O=="number"&&typeof l=="number"){let[m,_]=[o[O],e[l]];m.toLowerCase()===_.toLowerCase()&&(e[l]=m,l>O?e=e.slice(l):O>l&&(o=o.slice(O)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(o=this.levelTwoFileOptimize(o)),this.debug("matchOne",this,{file:o,pattern:e}),this.debug("matchOne",o.length,e.length);for(var n=0,a=0,c=o.length,u=e.length;n<c&&a<u;n++,a++){this.debug("matchOne loop");var d=e[a],x=o[n];if(this.debug(e,d,x),d===!1)return!1;if(d===ro){this.debug("GLOBSTAR",[e,d,x]);var g=n,w=a+1;if(w===u){for(this.debug("** at the end");n<c;n++)if(o[n]==="."||o[n]===".."||!i.dot&&o[n].charAt(0)===".")return!1;return!0}for(;g<c;){var z=o[g];if(this.debug(`
29
+ `).map(u=>u.match(/Class descriptor\s+?:\s+?'L(.+);'/)?.[1].replace(/\//g,".")).filter(Boolean);return new Set(c)}catch(a){let c=`Failed to search for classes in the APK - grepAppIdPattern[${o}]: ${a}`;throw s.info(c),new Error(c)}}var Zt=P(require("node:assert")),pe=P(require("node:fs/promises")),ql=P(require("node:path")),Fs=P(mr());var vl=P(Kl()),pl=P(require("node:assert")),bt=P(require("node:fs/promises")),Yt=P(require("node:path"));async function Wl(t){return(await bt.default.stat(t).catch(()=>null))?.isFile()??!1}async function Ss(t){return(await bt.default.stat(t).catch(()=>null))?.isDirectory()??!1}function be(t){return(0,pl.default)(t!=null,"Expected value to be non-null"),t}async function ve(t){let o=t.platform==="android"?".apk":".ipa";return{...t,projectRoot:Yt.default.resolve(t.projectRoot),workingDirectory:t.workingDirectory??await bt.default.mkdtemp(Yt.default.join(bl(),"repack-app-")),outputPath:t.outputPath??Yt.default.join(t.projectRoot,`repacked${o}`),logger:WO(t.logger),spawnAsync:t.spawnAsync??qO(!!t.verbose)}}function WO(t){return t!=null?Ns.isBunyanLikeLogger(t)?new Ns(t):t:new Ge}var Ge=class{debug(...o){console.debug(...o)}info(...o){console.log(...o)}warn(...o){console.warn(...o)}error(...o){console.error(...o)}time(o){console.time(o)}timeEnd(o){console.timeEnd(o)}},Ns=class{constructor(o){this.logger=o}timerMap={};static isBunyanLikeLogger(o){return o.info&&o.time===void 0}debug(...o){this.logger.debug(o.join(""))}info(...o){this.logger.info(o.join(""))}warn(...o){this.logger.warn(o.join(""))}error(...o){this.logger.error(o.join(""))}time(o){this.timerMap[o]=Date.now()}timeEnd(o){if(this.timerMap[o]==null){this.logger.warn(`Timer '${o}' does not exist`);return}let e=Date.now()-this.timerMap[o];this.logger.info(`${o}: ${e} ms`),delete this.timerMap[o]}};function qO(t){return function(e,s,i){return(0,vl.default)(e,s,{stdio:t?"inherit":"pipe",...i})}}async function It(t,o){await bt.default.mkdir(o,{recursive:!0});let e=await bt.default.readdir(t,{withFileTypes:!0});for(let s of e){let i=Yt.default.join(t,s.name),r=Yt.default.join(o,s.name);s.isDirectory()?await It(i,r):s.isFile()&&await bt.default.copyFile(i,r)}}async function Cl({config:t,decodedApkRoot:o}){let e=ql.default.join(o,"res","values","strings.xml"),s=await pe.default.readFile(e,"utf8");s=s.replace(/(<string name="app_name">)(.+)(<\/string>)/,`$1${t.name}$3`),await pe.default.writeFile(e,s)}async function Nl({config:t,androidManiestXml:o,dexClasses:e,originalAppId:s,originalAppIdFallback:i,updatesRuntimeVersion:r}){let n=be(t.android?.package);o.manifest.$.package=n,Wr(o,d=>d.startsWith(s)&&!e.has(d)?d.replace(s,n):d);let a=pr("manifest",o.manifest,(d,x)=>d==="intent-filter"&&pr(d,x,(g,w)=>g==="action"&&w[0].$?.["android:name"]==="android.intent.action.VIEW").length>0),c=Array.isArray(t.scheme)?t.scheme[0]:t.scheme;for(let d of a)Wr(d,x=>{let g=x.replace(s,n).replace(/^exp\+.+$/g,`exp+${be(t.slug)}`);return c&&(g=g.replace(/^myapp$/g,c)),i!=null&&(g=g.replace(i,n)),g});let u=o.manifest.application[0];(0,Zt.default)(u.$?.["android:name"]?.endsWith(".MainApplication"),"Expected application node to be named as MainApplication"),CO(u,t,r)}async function Sl(t){let o=await pe.default.readFile(t,"utf8");return await new Fs.Parser().parseStringPromise(o)}async function Fl(t,o){let s=new Fs.Builder().buildObject(t);await pe.default.writeFile(o,s)}function Ml(t){let o=t.manifest.$.package;return(0,Zt.default)(o!=null,"Expected package attribute to be present in AndroidManifest.xml"),o}function El(t,o){let e=t.manifest.application?.[0]?.$?.["android:name"];if(e){let s=e.replace(/\.[^.]+$/,"");if(s!==e&&s!==o)return s}return null}function CO(t,o,e){let s=t["meta-data"]??[],i=o.updates?.enabled??!0,r=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.ENABLED");r!=null?((0,Zt.default)(r.$!=null),r.$["android:value"]=i?"true":"false"):s.push({$:{"android:name":"expo.modules.updates.ENABLED","android:value":i?"true":"false"}});let n=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.EXPO_RUNTIME_VERSION");e!=null&&(n!=null?((0,Zt.default)(n.$!=null),n.$["android:value"]=e):s.push({$:{"android:name":"expo.modules.updates.EXPO_RUNTIME_VERSION","android:value":e}}));let a=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.EXPO_UPDATE_URL"),c=o.updates?.url;c&&(a!=null?((0,Zt.default)(a.$!=null),a.$["android:value"]=c):s.push({$:{"android:name":"expo.modules.updates.EXPO_UPDATE_URL","android:value":c}}))}function pr(t,o,e){return o==null?[]:e(t,o)?[o]:Object.keys(o).filter(s=>s!=="$"&&s!=="_").flatMap(s=>{let i=o[s];return pr(s,i,e)})}function Wr(t,o){if(t==null)return;let e=t.$??{};for(let[s,i]of Object.entries(e))e[s]=o(i);for(let[s,i]of Object.entries(t))s==="$"||s==="_"||Wr(i,o)}var Vl="./debug.keystore";var Qu=P(Au());function Rs(t,o){let e=process.env;for(let[s,i]of Object.entries(o??{})){if(e[s]!==void 0)continue;let r;i==null?r="":typeof i=="string"?r=i:r=JSON.stringify(i),e[s]=r}Bd("development"),(0,Qu.loadProjectEnv)(t)}function Bd(t){process.env.NODE_ENV=process.env.NODE_ENV||t,process.env.BABEL_ENV=process.env.BABEL_ENV||process.env.NODE_ENV,globalThis.__DEV__=process.env.NODE_ENV!=="production"}var Bs=P(require("node:assert")),Js=P(require("node:fs/promises")),Eo=P(require("node:path")),Bt=P(Bu());async function Ds(t,o){let{workingDirectory:e}=t,s=Eo.default.join(e,"app.config");return await Js.default.writeFile(s,JSON.stringify(o)),s}async function $s(t){let{platform:o,projectRoot:e,spawnAsync:s,workingDirectory:i}=t,{stdout:r}=await s("node",["-e","require('expo/scripts/resolveAppEntry')",e,o,"absolute"],{cwd:e,stdio:"pipe"}),n=Bt.default.silent(t.projectRoot,"expo-updates/utils/build/createUpdatesResources.js");return(0,Bs.default)(n,"Failed to resolve `createUpdatesResources.js` within expo-updates package"),await s("node",[n,o,e,i,"all",r.trim()],{cwd:e}),Eo.default.join(i,"app.manifest")}function Hs(t){let o=Du(t);(0,Bs.default)(o,"Failed to resolve '@expo/config' package in the project");let{getPackageJson:e}=require(o),s=e(t);return!!(s.dependencies&&"expo-updates"in s.dependencies)}async function oi(t,o){let{projectRoot:e,spawnAsync:s}=t,i=Bt.default.silent(e,"expo-updates/bin/cli")??(0,Bt.default)(e,"expo-updates/bin/cli.js"),{stdout:r}=await s(i,["runtimeversion:resolve","--platform","android","--workflow","managed"],{cwd:e,stdio:"pipe"});return JSON.parse(r).runtimeVersion??null}function Du(t){let o=Bt.default.silent(t,"expo/package.json");return o?Bt.default.silent(Eo.default.dirname(o),"@expo/config")??null:null}function ti(t,o){let e=Du(t);(0,Bs.default)(e,"Failed to resolve '@expo/config' package in the project");let{getConfig:s}=require(e);return s(t,o)}async function ei(t,o){let{projectRoot:e,platform:s,spawnAsync:i,workingDirectory:r}=o,n=Eo.default.resolve(r,"bundles");await Js.default.mkdir(n,{recursive:!0});let a=Eo.default.join(n,"assets");await Js.default.mkdir(a,{recursive:!0});let{stdout:c}=await i("node",["-e","require('expo/scripts/resolveAppEntry')",e,s,"absolute"],{cwd:e,stdio:"pipe"}),u=$d(t,s),d=s==="android"?"index.android.bundle":"main.bundle",x=Eo.default.join(n,d),g=["expo","export:embed","--platform",s,"--entry-file",c.trim(),"--bundle-output",Eo.default.join(n,d),"--assets-dest",Eo.default.join(n,"assets"),"--dev","false","--reset-cache"];return u?(g.push("--minify","false"),g.push("--bytecode","true"),g.push("--unstable-transform-profile","hermes")):g.push("--minify","true"),o.exportEmbedOptions?.sourcemapOutput&&g.push("--sourcemap-output",o.exportEmbedOptions.sourcemapOutput),await i("npx",g,{cwd:e}),{bundleOutputPath:x,assetRoot:a}}async function si({appWorkingDirectory:t,options:o}){if(o.exportEmbedOptions!=null)return!0;let e;return o.platform==="android"?e=Eo.default.join(t,"assets","index.android.bundle"):e=Eo.default.join(t,"main.jsbundle"),await Wl(e)}function $d(t,o){switch(o){case"android":return(t.android?.jsEngine??t.jsEngine)!=="jsc";case"ios":return(t.ios?.jsEngine??t.jsEngine)!=="jsc";default:return!1}}var Hd=st.default.resolve(__dirname,Vl);async function Hu(t){let o=await ve(t),{logger:e,spawnAsync:s,workingDirectory:i}=o;await pt.default.mkdir(i,{recursive:!0}),Rs(o.projectRoot,o.env);let{exp:r}=ti(o.projectRoot,{isPublicConfig:!0,skipSDKVersionRequirement:!0}),n=await bc(st.default.resolve(o.sourceAppPath),o);(0,on.default)(r.android?.package,"Expected app ID (`android.package`) to be defined in app.json");let a=Hs(o.projectRoot),c=a?await oi(o,r):null;if(e.info($u.default.dim(`Resolved runtime version: ${c}`)),await si({appWorkingDirectory:n,options:o})){e.time("Generating bundle");let{assetRoot:l,bundleOutputPath:m}=await ei(r,o);if(e.timeEnd("Generating bundle"),e.time("Adding bundled resources"),await pc({decodedApkRoot:n,assetRoot:l,bundleOutputPath:m}),e.timeEnd("Adding bundled resources"),a){e.time("Generating 'app.manifest' for expo-updates");let _=await $s(o),G=st.default.join(n,"assets");await pt.default.copyFile(_,st.default.join(G,st.default.basename(_))),e.timeEnd("Generating 'app.manifest' for expo-updates")}}e.time("Updating AndroidManifest.xml");let d=st.default.join(n,"AndroidManifest.xml"),x=await Sl(d),g=Ml(x),w=new Set([g]),z=El(x,g);z!=null&&w.add(z);let k=await Promise.any(Array.from(w).map(l=>Fc(n,l,o)));(0,on.default)(k!=null,"Failed to search for dex classes with appId in the APK"),await Nl({config:r,androidManiestXml:x,dexClasses:k,originalAppId:g,originalAppIdFallback:z,options:o,updatesRuntimeVersion:c}),await Wc(n,r.android?.package),await Fl(x,d),e.timeEnd("Updating AndroidManifest.xml"),e.time("Updating resources"),await Cl({config:r,decodedApkRoot:n}),e.timeEnd("Updating resources"),e.time("Generating app config");let p=await Ds(o,r);await pt.default.copyFile(p,st.default.join(n,"assets","app.config")),e.timeEnd("Generating app config"),e.time("Creating updated apk");let W=await vc(n,o),q=st.default.join(i,"unzip");await pt.default.mkdir(q,{recursive:!0}),await s("unzip",["-o",W,"-d",q]);let O=await Sc(q,o,{keyStorePath:o.androidSigningOptions?.keyStorePath??Hd,keyStorePassword:o.androidSigningOptions?.keyStorePassword??"pass:android",keyAlias:o.androidSigningOptions?.keyAlias,keyPassword:o.androidSigningOptions?.keyPassword});if(e.timeEnd("Creating updated apk"),await pt.default.rename(O,o.outputPath),!o.skipWorkingDirCleanup)try{await pt.default.rm(i,{recursive:!0})}catch{}return o.outputPath}var Hi=P(require("node:assert")),Kt=P(require("node:fs/promises")),Bo=P(require("node:path")),Mg=P(er());var f_=P(x_(),1);var Fe=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var aw={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Me=t=>t.replace(/[[\]\\-]/g,"\\$&"),cw=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),m_=t=>t.join(""),g_=(t,o)=>{let e=o;if(t.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=e+1,n=!1,a=!1,c=!1,u=!1,d=e,x="";o:for(;r<t.length;){let k=t.charAt(r);if((k==="!"||k==="^")&&r===e+1){u=!0,r++;continue}if(k==="]"&&n&&!c){d=r+1;break}if(n=!0,k==="\\"&&!c){c=!0,r++;continue}if(k==="["&&!c){for(let[p,[W,q,O]]of Object.entries(aw))if(t.startsWith(p,r)){if(x)return["$.",!1,t.length-e,!0];r+=p.length,O?i.push(W):s.push(W),a=a||q;continue o}}if(c=!1,x){k>x?s.push(Me(x)+"-"+Me(k)):k===x&&s.push(Me(k)),x="",r++;continue}if(t.startsWith("-]",r+1)){s.push(Me(k+"-")),r+=2;continue}if(t.startsWith("-",r+1)){x=k,r+=2;continue}s.push(Me(k)),r++}if(d<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,t.length-e,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!u){let k=s[0].length===2?s[0].slice(-1):s[0];return[cw(k),!1,d-e,!1]}let g="["+(u?"^":"")+m_(s)+"]",w="["+(u?"":"^")+m_(i)+"]";return[s.length&&i.length?"("+g+"|"+w+")":s.length?g:w,a,d-e,!0]};var Vo=(t,{windowsPathsNoEscape:o=!1}={})=>o?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var lw=new Set(["!","?","+","*","@"]),O_=t=>lw.has(t),uw="(?!(?:^|/)\\.\\.?(?:$|/))",ii="(?!\\.)",_w=new Set(["[","."]),xw=new Set(["..","."]),mw=new Set("().*{}+?[]^$\\!"),gw=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sn="[^/]",d_=sn+"*?",w_=sn+"+?",Dt=class t{type;#o;#t;#r=!1;#s=[];#n;#f;#l;#_=!1;#a;#c;#i=!1;constructor(o,e,s={}){this.type=o,o&&(this.#t=!0),this.#n=e,this.#o=this.#n?this.#n.#o:this,this.#a=this.#o===this?s:this.#o.#a,this.#l=this.#o===this?[]:this.#o.#l,o==="!"&&!this.#o.#_&&this.#l.push(this),this.#f=this.#n?this.#n.#s.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let o of this.#s)if(typeof o!="string"&&(o.type||o.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#s.map(o=>String(o)).join("|")+")":this.#c=this.#s.map(o=>String(o)).join("")}#d(){if(this!==this.#o)throw new Error("should only call on root");if(this.#_)return this;this.toString(),this.#_=!0;let o;for(;o=this.#l.pop();){if(o.type!=="!")continue;let e=o,s=e.#n;for(;s;){for(let i=e.#f+1;!s.type&&i<s.#s.length;i++)for(let r of o.#s){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#s[i])}e=s,s=e.#n}}return this}push(...o){for(let e of o)if(e!==""){if(typeof e!="string"&&!(e instanceof t&&e.#n===this))throw new Error("invalid part: "+e);this.#s.push(e)}}toJSON(){let o=this.type===null?this.#s.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#s.map(e=>e.toJSON())];return this.isStart()&&!this.type&&o.unshift([]),this.isEnd()&&(this===this.#o||this.#o.#_&&this.#n?.type==="!")&&o.push({}),o}isStart(){if(this.#o===this)return!0;if(!this.#n?.isStart())return!1;if(this.#f===0)return!0;let o=this.#n;for(let e=0;e<this.#f;e++){let s=o.#s[e];if(!(s instanceof t&&s.type==="!"))return!1}return!0}isEnd(){if(this.#o===this||this.#n?.type==="!")return!0;if(!this.#n?.isEnd())return!1;if(!this.type)return this.#n?.isEnd();let o=this.#n?this.#n.#s.length:0;return this.#f===o-1}copyIn(o){typeof o=="string"?this.push(o):this.push(o.clone(this))}clone(o){let e=new t(this.type,o);for(let s of this.#s)e.copyIn(s);return e}static#w(o,e,s,i){let r=!1,n=!1,a=-1,c=!1;if(e.type===null){let w=s,z="";for(;w<o.length;){let k=o.charAt(w++);if(r||k==="\\"){r=!r,z+=k;continue}if(n){w===a+1?(k==="^"||k==="!")&&(c=!0):k==="]"&&!(w===a+2&&c)&&(n=!1),z+=k;continue}else if(k==="["){n=!0,a=w,c=!1,z+=k;continue}if(!i.noext&&O_(k)&&o.charAt(w)==="("){e.push(z),z="";let p=new t(k,e);w=t.#w(o,p,w,i),e.push(p);continue}z+=k}return e.push(z),w}let u=s+1,d=new t(null,e),x=[],g="";for(;u<o.length;){let w=o.charAt(u++);if(r||w==="\\"){r=!r,g+=w;continue}if(n){u===a+1?(w==="^"||w==="!")&&(c=!0):w==="]"&&!(u===a+2&&c)&&(n=!1),g+=w;continue}else if(w==="["){n=!0,a=u,c=!1,g+=w;continue}if(O_(w)&&o.charAt(u)==="("){d.push(g),g="";let z=new t(w,d);d.push(z),u=t.#w(o,z,u,i);continue}if(w==="|"){d.push(g),g="",x.push(d),d=new t(null,e);continue}if(w===")")return g===""&&e.#s.length===0&&(e.#i=!0),d.push(g),g="",e.push(...x,d),u;g+=w}return e.type=null,e.#t=void 0,e.#s=[o.substring(s-1)],u}static fromGlob(o,e={}){let s=new t(null,void 0,e);return t.#w(o,s,0,e),s}toMMPattern(){if(this!==this.#o)return this.#o.toMMPattern();let o=this.toString(),[e,s,i,r]=this.toRegExpSource();if(!(i||this.#t||this.#a.nocase&&!this.#a.nocaseMagicOnly&&o.toUpperCase()!==o.toLowerCase()))return s;let a=(this.#a.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,a),{_src:e,_glob:o})}get options(){return this.#a}toRegExpSource(o){let e=o??!!this.#a.dot;if(this.#o===this&&this.#d(),!this.type){let c=this.isStart()&&this.isEnd(),u=this.#s.map(w=>{let[z,k,p,W]=typeof w=="string"?t.#x(w,this.#t,c):w.toRegExpSource(o);return this.#t=this.#t||p,this.#r=this.#r||W,z}).join(""),d="";if(this.isStart()&&typeof this.#s[0]=="string"&&!(this.#s.length===1&&xw.has(this.#s[0]))){let z=_w,k=e&&z.has(u.charAt(0))||u.startsWith("\\.")&&z.has(u.charAt(2))||u.startsWith("\\.\\.")&&z.has(u.charAt(4)),p=!e&&!o&&z.has(u.charAt(0));d=k?uw:p?ii:""}let x="";return this.isEnd()&&this.#o.#_&&this.#n?.type==="!"&&(x="(?:$|\\/)"),[d+u+x,Vo(u),this.#t=!!this.#t,this.#r]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#m(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let c=this.toString();return this.#s=[c],this.type=null,this.#t=void 0,[c,Vo(this.toString()),!1,!1]}let n=!s||o||e||!ii?"":this.#m(!0);n===r&&(n=""),n&&(r=`(?:${r})(?:${n})*?`);let a="";if(this.type==="!"&&this.#i)a=(this.isStart()&&!e?ii:"")+w_;else{let c=this.type==="!"?"))"+(this.isStart()&&!e&&!o?ii:"")+d_+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=i+r+c}return[a,Vo(r),this.#t=!!this.#t,this.#r]}#m(o){return this.#s.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,i,r,n]=e.toRegExpSource(o);return this.#r=this.#r||n,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#x(o,e,s=!1){let i=!1,r="",n=!1;for(let a=0;a<o.length;a++){let c=o.charAt(a);if(i){i=!1,r+=(mw.has(c)?"\\":"")+c;continue}if(c==="\\"){a===o.length-1?r+="\\\\":i=!0;continue}if(c==="["){let[u,d,x,g]=g_(o,a);if(x){r+=u,n=n||d,a+=x-1,e=e||g;continue}}if(c==="*"){s&&o==="*"?r+=w_:r+=d_,e=!0;continue}if(c==="?"){r+=sn,e=!0;continue}r+=gw(c)}return[r,Vo(o),!!e,n]}};var $t=(t,{windowsPathsNoEscape:o=!1}={})=>o?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var xo=(t,o,e={})=>(Fe(o),!e.nocomment&&o.charAt(0)==="#"?!1:new ko(o,e).match(t)),Ow=/^\*+([^+@!?\*\[\(]*)$/,dw=t=>o=>!o.startsWith(".")&&o.endsWith(t),ww=t=>o=>o.endsWith(t),yw=t=>(t=t.toLowerCase(),o=>!o.startsWith(".")&&o.toLowerCase().endsWith(t)),hw=t=>(t=t.toLowerCase(),o=>o.toLowerCase().endsWith(t)),fw=/^\*+\.\*+$/,zw=t=>!t.startsWith(".")&&t.includes("."),kw=t=>t!=="."&&t!==".."&&t.includes("."),Kw=/^\.\*+$/,Gw=t=>t!=="."&&t!==".."&&t.startsWith("."),bw=/^\*+$/,vw=t=>t.length!==0&&!t.startsWith("."),pw=t=>t.length!==0&&t!=="."&&t!=="..",Ww=/^\?+([^+@!?\*\[\(]*)?$/,qw=([t,o=""])=>{let e=z_([t]);return o?(o=o.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(o)):e},Cw=([t,o=""])=>{let e=k_([t]);return o?(o=o.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(o)):e},Nw=([t,o=""])=>{let e=k_([t]);return o?s=>e(s)&&s.endsWith(o):e},Sw=([t,o=""])=>{let e=z_([t]);return o?s=>e(s)&&s.endsWith(o):e},z_=([t])=>{let o=t.length;return e=>e.length===o&&!e.startsWith(".")},k_=([t])=>{let o=t.length;return e=>e.length===o&&e!=="."&&e!==".."},K_=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",y_={win32:{sep:"\\"},posix:{sep:"/"}},Fw=K_==="win32"?y_.win32.sep:y_.posix.sep;xo.sep=Fw;var ro=Symbol("globstar **");xo.GLOBSTAR=ro;var Mw="[^/]",Ew=Mw+"*?",Vw="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Xw="(?:(?!(?:\\/|^)\\.).)*?",Yw=(t,o={})=>e=>xo(e,t,o);xo.filter=Yw;var Co=(t,o={})=>Object.assign({},t,o),Iw=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return xo;let o=xo;return Object.assign((s,i,r={})=>o(s,i,Co(t,r)),{Minimatch:class extends o.Minimatch{constructor(i,r={}){super(i,Co(t,r))}static defaults(i){return o.defaults(Co(t,i)).Minimatch}},AST:class extends o.AST{constructor(i,r,n={}){super(i,r,Co(t,n))}static fromGlob(i,r={}){return o.AST.fromGlob(i,Co(t,r))}},unescape:(s,i={})=>o.unescape(s,Co(t,i)),escape:(s,i={})=>o.escape(s,Co(t,i)),filter:(s,i={})=>o.filter(s,Co(t,i)),defaults:s=>o.defaults(Co(t,s)),makeRe:(s,i={})=>o.makeRe(s,Co(t,i)),braceExpand:(s,i={})=>o.braceExpand(s,Co(t,i)),match:(s,i,r={})=>o.match(s,i,Co(t,r)),sep:o.sep,GLOBSTAR:ro})};xo.defaults=Iw;var G_=(t,o={})=>(Fe(t),o.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,f_.default)(t));xo.braceExpand=G_;var Zw=(t,o={})=>new ko(t,o).makeRe();xo.makeRe=Zw;var Pw=(t,o,e={})=>{let s=new ko(o,e);return t=t.filter(i=>s.match(i)),s.options.nonull&&!t.length&&t.push(o),t};xo.match=Pw;var h_=/[?*]|[+@!]\(.*?\)|\[|\]/,Lw=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ko=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(o,e={}){Fe(o),e=e||{},this.options=e,this.pattern=o,this.platform=e.platform||K_,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let o of this.set)for(let e of o)if(typeof e!="string")return!0;return!1}debug(...o){}make(){let o=this.pattern,e=this.options;if(!e.nocomment&&o.charAt(0)==="#"){this.comment=!0;return}if(!o){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,n,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=r[0]===""&&r[1]===""&&(r[2]==="?"||!h_.test(r[2]))&&!h_.test(r[3]),u=/^[a-z]:/i.test(r[0]);if(c)return[...r.slice(0,4),...r.slice(4).map(d=>this.parse(d))];if(u)return[r[0],...r.slice(1).map(d=>this.parse(d))]}return r.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let n=this.set[r];n[0]===""&&n[1]===""&&this.globParts[r][2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])&&(n[2]="?")}this.debug(this.pattern,this.set)}preprocess(o){if(this.options.noglobstar)for(let s=0;s<o.length;s++)for(let i=0;i<o[s].length;i++)o[s][i]==="**"&&(o[s][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(o=this.firstPhasePreProcess(o),o=this.secondPhasePreProcess(o)):e>=1?o=this.levelOneOptimize(o):o=this.adjascentGlobstarOptimize(o),o}adjascentGlobstarOptimize(o){return o.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(o){return o.map(e=>(e=e.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(o){Array.isArray(o)||(o=this.slashSplit(o));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<o.length-1;i++){let r=o[i];i===1&&r===""&&o[0]===""||(r==="."||r==="")&&(e=!0,o.splice(i,1),i--)}o[0]==="."&&o.length===2&&(o[1]==="."||o[1]==="")&&(e=!0,o.pop())}let s=0;for(;(s=o.indexOf("..",s+1))!==-1;){let i=o[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(e=!0,o.splice(s-1,2),s-=2)}}while(e);return o.length===0?[""]:o}firstPhasePreProcess(o){let e=!1;do{e=!1;for(let s of o){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let n=i;for(;s[n+1]==="**";)n++;n>i&&s.splice(i+1,n-i);let a=s[i+1],c=s[i+2],u=s[i+3];if(a!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;e=!0,s.splice(i,1);let d=s.slice(0);d[i]="**",o.push(d),i--}if(!this.preserveMultipleSlashes){for(let n=1;n<s.length-1;n++){let a=s[n];n===1&&a===""&&s[0]===""||(a==="."||a==="")&&(e=!0,s.splice(n,1),n--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let n=s[r-1];if(n&&n!=="."&&n!==".."&&n!=="**"){e=!0;let c=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...c),s.length===0&&s.push(""),r-=2}}}}while(e);return o}secondPhasePreProcess(o){for(let e=0;e<o.length-1;e++)for(let s=e+1;s<o.length;s++){let i=this.partsMatch(o[e],o[s],!this.preserveMultipleSlashes);if(i){o[e]=[],o[s]=i;break}}return o.filter(e=>e.length)}partsMatch(o,e,s=!1){let i=0,r=0,n=[],a="";for(;i<o.length&&r<e.length;)if(o[i]===e[r])n.push(a==="b"?e[r]:o[i]),i++,r++;else if(s&&o[i]==="**"&&e[r]===o[i+1])n.push(o[i]),i++;else if(s&&e[r]==="**"&&o[i]===e[r+1])n.push(e[r]),r++;else if(o[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(a==="b")return!1;a="a",n.push(o[i]),i++,r++}else if(e[r]==="*"&&o[i]&&(this.options.dot||!o[i].startsWith("."))&&o[i]!=="**"){if(a==="a")return!1;a="b",n.push(e[r]),i++,r++}else return!1;return o.length===e.length&&n}parseNegate(){if(this.nonegate)return;let o=this.pattern,e=!1,s=0;for(let i=0;i<o.length&&o.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=o.slice(s)),this.negate=e}matchOne(o,e,s=!1){let i=this.options;if(this.isWindows){let k=typeof o[0]=="string"&&/^[a-z]:$/i.test(o[0]),p=!k&&o[0]===""&&o[1]===""&&o[2]==="?"&&/^[a-z]:$/i.test(o[3]),W=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),q=!W&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),O=p?3:k?0:void 0,l=q?3:W?0:void 0;if(typeof O=="number"&&typeof l=="number"){let[m,_]=[o[O],e[l]];m.toLowerCase()===_.toLowerCase()&&(e[l]=m,l>O?e=e.slice(l):O>l&&(o=o.slice(O)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(o=this.levelTwoFileOptimize(o)),this.debug("matchOne",this,{file:o,pattern:e}),this.debug("matchOne",o.length,e.length);for(var n=0,a=0,c=o.length,u=e.length;n<c&&a<u;n++,a++){this.debug("matchOne loop");var d=e[a],x=o[n];if(this.debug(e,d,x),d===!1)return!1;if(d===ro){this.debug("GLOBSTAR",[e,d,x]);var g=n,w=a+1;if(w===u){for(this.debug("** at the end");n<c;n++)if(o[n]==="."||o[n]===".."||!i.dot&&o[n].charAt(0)===".")return!1;return!0}for(;g<c;){var z=o[g];if(this.debug(`
30
30
  globstar while`,o,g,e,w,z),this.matchOne(o.slice(g),e.slice(w),s))return this.debug("globstar found match!",g,c,z),!0;if(z==="."||z===".."||!i.dot&&z.charAt(0)==="."){this.debug("dot detected!",o,g,e,w);break}this.debug("globstar swallow a segment, and continue"),g++}return!!(s&&(this.debug(`
31
31
  >>> no match, partial?`,o,g,e,w),g===c))}let k;if(typeof d=="string"?(k=x===d,this.debug("string match",d,x,k)):(k=d.test(x),this.debug("pattern match",d,x,k)),!k)return!1}if(n===c&&a===u)return!0;if(n===c)return s;if(a===u)return n===c-1&&o[n]==="";throw new Error("wtf?")}braceExpand(){return G_(this.pattern,this.options)}parse(o){Fe(o);let e=this.options;if(o==="**")return ro;if(o==="")return"";let s,i=null;(s=o.match(bw))?i=e.dot?pw:vw:(s=o.match(Ow))?i=(e.nocase?e.dot?hw:yw:e.dot?ww:dw)(s[1]):(s=o.match(Ww))?i=(e.nocase?e.dot?Cw:qw:e.dot?Nw:Sw)(s):(s=o.match(fw))?i=e.dot?kw:zw:(s=o.match(Kw))&&(i=Gw);let r=Dt.fromGlob(o,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let o=this.set;if(!o.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?Ew:e.dot?Vw:Xw,i=new Set(e.nocase?["i"]:[]),r=o.map(c=>{let u=c.map(d=>{if(d instanceof RegExp)for(let x of d.flags.split(""))i.add(x);return typeof d=="string"?Lw(d):d===ro?ro:d._src});return u.forEach((d,x)=>{let g=u[x+1],w=u[x-1];d!==ro||w===ro||(w===void 0?g!==void 0&&g!==ro?u[x+1]="(?:\\/|"+s+"\\/)?"+g:u[x]=s:g===void 0?u[x-1]=w+"(?:\\/|"+s+")?":g!==ro&&(u[x-1]=w+"(?:\\/|\\/"+s+"\\/)"+g,u[x+1]=ro))}),u.filter(d=>d!==ro).join("/")}).join("|"),[n,a]=o.length>1?["(?:",")"]:["",""];r="^"+n+r+a+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(o){return this.preserveMultipleSlashes?o.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(o)?["",...o.split(/\/+/)]:o.split(/\/+/)}match(o,e=this.partial){if(this.debug("match",o,this.pattern),this.comment)return!1;if(this.empty)return o==="";if(o==="/"&&e)return!0;let s=this.options;this.isWindows&&(o=o.split("\\").join("/"));let i=this.slashSplit(o);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let n=i[i.length-1];if(!n)for(let a=i.length-2;!n&&a>=0;a--)n=i[a];for(let a=0;a<r.length;a++){let c=r[a],u=i;if(s.matchBase&&c.length===1&&(u=[n]),this.matchOne(u,c,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(o){return xo.defaults(o).Minimatch}};xo.AST=Dt;xo.Minimatch=ko;xo.escape=$t;xo.unescape=Vo;var R_=require("node:url");var Ht=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,v_=new Set,rn=typeof process=="object"&&process?process:{},p_=(t,o,e,s)=>{typeof rn.emitWarning=="function"?rn.emitWarning(t,o,e,s):console.error(`[${e}] ${o}: ${t}`)},ri=globalThis.AbortController,b_=globalThis.AbortSignal;if(typeof ri>"u"){b_=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},ri=class{constructor(){o()}signal=new b_;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let t=rn.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",o=()=>{t&&(t=!1,p_("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",o))}}var Tw=t=>!v_.has(t),Yf=Symbol("type"),Ot=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),W_=t=>Ot(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?oe:null:null,oe=class extends Array{constructor(o){super(o),this.fill(0)}},nn=class t{heap;length;static#o=!1;static create(o){let e=W_(o);if(!e)return[];t.#o=!0;let s=new t(o,e);return t.#o=!1,s}constructor(o,e){if(!t.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(o),this.length=0}push(o){this.heap[this.length++]=o}pop(){return this.heap[--this.length]}},Ee=class t{#o;#t;#r;#s;#n;#f;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#_;#a;#c;#i;#d;#w;#m;#x;#K;#O;#G;#b;#h;#z;#k;#g;static unsafeExposeInternals(o){return{starts:o.#b,ttls:o.#h,sizes:o.#G,keyMap:o.#a,keyList:o.#c,valList:o.#i,next:o.#d,prev:o.#w,get head(){return o.#m},get tail(){return o.#x},free:o.#K,isBackgroundFetch:e=>o.#u(e),backgroundFetch:(e,s,i,r)=>o.#Y(e,s,i,r),moveToTail:e=>o.#Z(e),indexes:e=>o.#p(e),rindexes:e=>o.#W(e),isStale:e=>o.#y(e)}}get max(){return this.#o}get maxSize(){return this.#t}get calculatedSize(){return this.#_}get size(){return this.#l}get fetchMethod(){return this.#n}get memoMethod(){return this.#f}get dispose(){return this.#r}get disposeAfter(){return this.#s}constructor(o){let{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:c,dispose:u,disposeAfter:d,noDisposeOnSet:x,noUpdateTTL:g,maxSize:w=0,maxEntrySize:z=0,sizeCalculation:k,fetchMethod:p,memoMethod:W,noDeleteOnFetchRejection:q,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:l,allowStaleOnFetchAbort:m,ignoreFetchAbort:_}=o;if(e!==0&&!Ot(e))throw new TypeError("max option must be a nonnegative integer");let G=e?W_(e):Array;if(!G)throw new Error("invalid max value: "+e);if(this.#o=e,this.#t=w,this.maxEntrySize=z||this.#t,this.sizeCalculation=k,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(W!==void 0&&typeof W!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#f=W,p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#n=p,this.#k=!!p,this.#a=new Map,this.#c=new Array(e).fill(void 0),this.#i=new Array(e).fill(void 0),this.#d=new G(e),this.#w=new G(e),this.#m=0,this.#x=0,this.#K=nn.create(e),this.#l=0,this.#_=0,typeof u=="function"&&(this.#r=u),typeof d=="function"?(this.#s=d,this.#O=[]):(this.#s=void 0,this.#O=void 0),this.#z=!!this.#r,this.#g=!!this.#s,this.noDisposeOnSet=!!x,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!q,this.allowStaleOnFetchRejection=!!l,this.allowStaleOnFetchAbort=!!m,this.ignoreFetchAbort=!!_,this.maxEntrySize!==0){if(this.#t!==0&&!Ot(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!Ot(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Ot(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!Ot(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#q()}if(this.#o===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#t){let y="LRU_CACHE_UNBOUNDED";Tw(y)&&(v_.add(y),p_("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",y,t))}}getRemainingTTL(o){return this.#a.has(o)?1/0:0}#q(){let o=new oe(this.#o),e=new oe(this.#o);this.#h=o,this.#b=e,this.#S=(r,n,a=Ht.now())=>{if(e[r]=n!==0?a:0,o[r]=n,n!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#y(r)&&this.#N(this.#c[r],"expire")},n+1);c.unref&&c.unref()}},this.#v=r=>{e[r]=o[r]!==0?Ht.now():0},this.#e=(r,n)=>{if(o[n]){let a=o[n],c=e[n];if(!a||!c)return;r.ttl=a,r.start=c,r.now=s||i();let u=r.now-c;r.remainingTTL=a-u}};let s=0,i=()=>{let r=Ht.now();if(this.ttlResolution>0){s=r;let n=setTimeout(()=>s=0,this.ttlResolution);n.unref&&n.unref()}return r};this.getRemainingTTL=r=>{let n=this.#a.get(r);if(n===void 0)return 0;let a=o[n],c=e[n];if(!a||!c)return 1/0;let u=(s||i())-c;return a-u},this.#y=r=>{let n=e[r],a=o[r];return!!a&&!!n&&(s||i())-n>a}}#v=()=>{};#e=()=>{};#S=()=>{};#y=()=>!1;#C(){let o=new oe(this.#o);this.#_=0,this.#G=o,this.#F=e=>{this.#_-=o[e],o[e]=0},this.#E=(e,s,i,r)=>{if(this.#u(s))return 0;if(!Ot(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,e),!Ot(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#M=(e,s,i)=>{if(o[e]=s,this.#t){let r=this.#t-o[e];for(;this.#_>r;)this.#X(!0)}this.#_+=o[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#_)}}#F=o=>{};#M=(o,e,s)=>{};#E=(o,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#p({allowStale:o=this.allowStale}={}){if(this.#l)for(let e=this.#x;!(!this.#V(e)||((o||!this.#y(e))&&(yield e),e===this.#m));)e=this.#w[e]}*#W({allowStale:o=this.allowStale}={}){if(this.#l)for(let e=this.#m;!(!this.#V(e)||((o||!this.#y(e))&&(yield e),e===this.#x));)e=this.#d[e]}#V(o){return o!==void 0&&this.#a.get(this.#c[o])===o}*entries(){for(let o of this.#p())this.#i[o]!==void 0&&this.#c[o]!==void 0&&!this.#u(this.#i[o])&&(yield[this.#c[o],this.#i[o]])}*rentries(){for(let o of this.#W())this.#i[o]!==void 0&&this.#c[o]!==void 0&&!this.#u(this.#i[o])&&(yield[this.#c[o],this.#i[o]])}*keys(){for(let o of this.#p()){let e=this.#c[o];e!==void 0&&!this.#u(this.#i[o])&&(yield e)}}*rkeys(){for(let o of this.#W()){let e=this.#c[o];e!==void 0&&!this.#u(this.#i[o])&&(yield e)}}*values(){for(let o of this.#p())this.#i[o]!==void 0&&!this.#u(this.#i[o])&&(yield this.#i[o])}*rvalues(){for(let o of this.#W())this.#i[o]!==void 0&&!this.#u(this.#i[o])&&(yield this.#i[o])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(o,e={}){for(let s of this.#p()){let i=this.#i[s],r=this.#u(i)?i.__staleWhileFetching:i;if(r!==void 0&&o(r,this.#c[s],this))return this.get(this.#c[s],e)}}forEach(o,e=this){for(let s of this.#p()){let i=this.#i[s],r=this.#u(i)?i.__staleWhileFetching:i;r!==void 0&&o.call(e,r,this.#c[s],this)}}rforEach(o,e=this){for(let s of this.#W()){let i=this.#i[s],r=this.#u(i)?i.__staleWhileFetching:i;r!==void 0&&o.call(e,r,this.#c[s],this)}}purgeStale(){let o=!1;for(let e of this.#W({allowStale:!0}))this.#y(e)&&(this.#N(this.#c[e],"expire"),o=!0);return o}info(o){let e=this.#a.get(o);if(e===void 0)return;let s=this.#i[e],i=this.#u(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#h&&this.#b){let n=this.#h[e],a=this.#b[e];if(n&&a){let c=n-(Ht.now()-a);r.ttl=c,r.start=Date.now()}}return this.#G&&(r.size=this.#G[e]),r}dump(){let o=[];for(let e of this.#p({allowStale:!0})){let s=this.#c[e],i=this.#i[e],r=this.#u(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let n={value:r};if(this.#h&&this.#b){n.ttl=this.#h[e];let a=Ht.now()-this.#b[e];n.start=Math.floor(Date.now()-a)}this.#G&&(n.size=this.#G[e]),o.unshift([s,n])}return o}load(o){this.clear();for(let[e,s]of o){if(s.start){let i=Date.now()-s.start;s.start=Ht.now()-i}this.set(e,s.value,s)}}set(o,e,s={}){if(e===void 0)return this.delete(o),this;let{ttl:i=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=s,{noUpdateTTL:u=this.noUpdateTTL}=s,d=this.#E(o,e,s.size||0,a);if(this.maxEntrySize&&d>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#N(o,"set"),this;let x=this.#l===0?void 0:this.#a.get(o);if(x===void 0)x=this.#l===0?this.#x:this.#K.length!==0?this.#K.pop():this.#l===this.#o?this.#X(!1):this.#l,this.#c[x]=o,this.#i[x]=e,this.#a.set(o,x),this.#d[this.#x]=x,this.#w[x]=this.#x,this.#x=x,this.#l++,this.#M(x,d,c),c&&(c.set="add"),u=!1;else{this.#Z(x);let g=this.#i[x];if(e!==g){if(this.#k&&this.#u(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:w}=g;w!==void 0&&!n&&(this.#z&&this.#r?.(w,o,"set"),this.#g&&this.#O?.push([w,o,"set"]))}else n||(this.#z&&this.#r?.(g,o,"set"),this.#g&&this.#O?.push([g,o,"set"]));if(this.#F(x),this.#M(x,d,c),this.#i[x]=e,c){c.set="replace";let w=g&&this.#u(g)?g.__staleWhileFetching:g;w!==void 0&&(c.oldValue=w)}}else c&&(c.set="update")}if(i!==0&&!this.#h&&this.#q(),this.#h&&(u||this.#S(x,i,r),c&&this.#e(c,x)),!n&&this.#g&&this.#O){let g=this.#O,w;for(;w=g?.shift();)this.#s?.(...w)}return this}pop(){try{for(;this.#l;){let o=this.#i[this.#m];if(this.#X(!0),this.#u(o)){if(o.__staleWhileFetching)return o.__staleWhileFetching}else if(o!==void 0)return o}}finally{if(this.#g&&this.#O){let o=this.#O,e;for(;e=o?.shift();)this.#s?.(...e)}}}#X(o){let e=this.#m,s=this.#c[e],i=this.#i[e];return this.#k&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#z||this.#g)&&(this.#z&&this.#r?.(i,s,"evict"),this.#g&&this.#O?.push([i,s,"evict"])),this.#F(e),o&&(this.#c[e]=void 0,this.#i[e]=void 0,this.#K.push(e)),this.#l===1?(this.#m=this.#x=0,this.#K.length=0):this.#m=this.#d[e],this.#a.delete(s),this.#l--,e}has(o,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#a.get(o);if(r!==void 0){let n=this.#i[r];if(this.#u(n)&&n.__staleWhileFetching===void 0)return!1;if(this.#y(r))i&&(i.has="stale",this.#e(i,r));else return s&&this.#v(r),i&&(i.has="hit",this.#e(i,r)),!0}else i&&(i.has="miss");return!1}peek(o,e={}){let{allowStale:s=this.allowStale}=e,i=this.#a.get(o);if(i===void 0||!s&&this.#y(i))return;let r=this.#i[i];return this.#u(r)?r.__staleWhileFetching:r}#Y(o,e,s,i){let r=e===void 0?void 0:this.#i[e];if(this.#u(r))return r;let n=new ri,{signal:a}=s;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let c={signal:n.signal,options:s,context:i},u=(k,p=!1)=>{let{aborted:W}=n.signal,q=s.ignoreFetchAbort&&k!==void 0;if(s.status&&(W&&!p?(s.status.fetchAborted=!0,s.status.fetchError=n.signal.reason,q&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),W&&!q&&!p)return x(n.signal.reason);let O=w;return this.#i[e]===w&&(k===void 0?O.__staleWhileFetching?this.#i[e]=O.__staleWhileFetching:this.#N(o,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(o,k,c.options))),k},d=k=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=k),x(k)),x=k=>{let{aborted:p}=n.signal,W=p&&s.allowStaleOnFetchAbort,q=W||s.allowStaleOnFetchRejection,O=q||s.noDeleteOnFetchRejection,l=w;if(this.#i[e]===w&&(!O||l.__staleWhileFetching===void 0?this.#N(o,"fetch"):W||(this.#i[e]=l.__staleWhileFetching)),q)return s.status&&l.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw k},g=(k,p)=>{let W=this.#n?.(o,r,c);W&&W instanceof Promise&&W.then(q=>k(q===void 0?void 0:q),p),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(k(void 0),s.allowStaleOnFetchAbort&&(k=q=>u(q,!0)))})};s.status&&(s.status.fetchDispatched=!0);let w=new Promise(g).then(u,d),z=Object.assign(w,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(o,z,{...c.options,status:void 0}),e=this.#a.get(o)):this.#i[e]=z,z}#u(o){if(!this.#k)return!1;let e=o;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof ri}async fetch(o,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:w=this.ignoreFetchAbort,allowStaleOnFetchAbort:z=this.allowStaleOnFetchAbort,context:k,forceRefresh:p=!1,status:W,signal:q}=e;if(!this.#k)return W&&(W.fetch="get"),this.get(o,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:W});let O={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:a,size:c,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:z,ignoreFetchAbort:w,status:W,signal:q},l=this.#a.get(o);if(l===void 0){W&&(W.fetch="miss");let m=this.#Y(o,l,O,k);return m.__returned=m}else{let m=this.#i[l];if(this.#u(m)){let f=s&&m.__staleWhileFetching!==void 0;return W&&(W.fetch="inflight",f&&(W.returnedStale=!0)),f?m.__staleWhileFetching:m.__returned=m}let _=this.#y(l);if(!p&&!_)return W&&(W.fetch="hit"),this.#Z(l),i&&this.#v(l),W&&this.#e(W,l),m;let G=this.#Y(o,l,O,k),h=G.__staleWhileFetching!==void 0&&s;return W&&(W.fetch=_?"stale":"refresh",h&&_&&(W.returnedStale=!0)),h?G.__staleWhileFetching:G.__returned=G}}async forceFetch(o,e={}){let s=await this.fetch(o,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(o,e={}){let s=this.#f;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...n}=e,a=this.get(o,n);if(!r&&a!==void 0)return a;let c=s(o,a,{options:n,context:i});return this.set(o,c,n),c}get(o,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=e,a=this.#a.get(o);if(a!==void 0){let c=this.#i[a],u=this.#u(c);return n&&this.#e(n,a),this.#y(a)?(n&&(n.get="stale"),u?(n&&s&&c.__staleWhileFetching!==void 0&&(n.returnedStale=!0),s?c.__staleWhileFetching:void 0):(r||this.#N(o,"expire"),n&&s&&(n.returnedStale=!0),s?c:void 0)):(n&&(n.get="hit"),u?c.__staleWhileFetching:(this.#Z(a),i&&this.#v(a),c))}else n&&(n.get="miss")}#I(o,e){this.#w[e]=o,this.#d[o]=e}#Z(o){o!==this.#x&&(o===this.#m?this.#m=this.#d[o]:this.#I(this.#w[o],this.#d[o]),this.#I(this.#x,o),this.#x=o)}delete(o){return this.#N(o,"delete")}#N(o,e){let s=!1;if(this.#l!==0){let i=this.#a.get(o);if(i!==void 0)if(s=!0,this.#l===1)this.#P(e);else{this.#F(i);let r=this.#i[i];if(this.#u(r)?r.__abortController.abort(new Error("deleted")):(this.#z||this.#g)&&(this.#z&&this.#r?.(r,o,e),this.#g&&this.#O?.push([r,o,e])),this.#a.delete(o),this.#c[i]=void 0,this.#i[i]=void 0,i===this.#x)this.#x=this.#w[i];else if(i===this.#m)this.#m=this.#d[i];else{let n=this.#w[i];this.#d[n]=this.#d[i];let a=this.#d[i];this.#w[a]=this.#w[i]}this.#l--,this.#K.push(i)}}if(this.#g&&this.#O?.length){let i=this.#O,r;for(;r=i?.shift();)this.#s?.(...r)}return s}clear(){return this.#P("delete")}#P(o){for(let e of this.#W({allowStale:!0})){let s=this.#i[e];if(this.#u(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#c[e];this.#z&&this.#r?.(s,i,o),this.#g&&this.#O?.push([s,i,o])}}if(this.#a.clear(),this.#i.fill(void 0),this.#c.fill(void 0),this.#h&&this.#b&&(this.#h.fill(0),this.#b.fill(0)),this.#G&&this.#G.fill(0),this.#m=0,this.#x=0,this.#K.length=0,this.#_=0,this.#l=0,this.#g&&this.#O){let e=this.#O,s;for(;s=e?.shift();)this.#s?.(...s)}}};var se=require("node:path"),Y_=require("node:url"),Ao=require("fs"),Hw=P(require("node:fs"),1),yt=require("node:fs/promises");var xi=require("node:events"),mn=P(require("node:stream"),1),F_=require("node:string_decoder"),q_=typeof process=="object"&&process?process:{stdout:null,stderr:null},Uw=t=>!!t&&typeof t=="object"&&(t instanceof wt||t instanceof mn.default||Aw(t)||Qw(t)),Aw=t=>!!t&&typeof t=="object"&&t instanceof xi.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==mn.default.Writable.prototype.pipe,Qw=t=>!!t&&typeof t=="object"&&t instanceof xi.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",it=Symbol("EOF"),rt=Symbol("maybeEmitEnd"),dt=Symbol("emittedEnd"),ni=Symbol("emittingEnd"),Ve=Symbol("emittedError"),ai=Symbol("closed"),C_=Symbol("read"),ci=Symbol("flush"),N_=Symbol("flushChunk"),Xo=Symbol("encoding"),te=Symbol("decoder"),oo=Symbol("flowing"),Xe=Symbol("paused"),ee=Symbol("resume"),to=Symbol("buffer"),mo=Symbol("pipes"),eo=Symbol("bufferLength"),an=Symbol("bufferPush"),li=Symbol("bufferShift"),co=Symbol("objectMode"),A=Symbol("destroyed"),cn=Symbol("error"),ln=Symbol("emitData"),S_=Symbol("emitEnd"),un=Symbol("emitEnd2"),To=Symbol("async"),_n=Symbol("abort"),ui=Symbol("aborted"),Ye=Symbol("signal"),Wt=Symbol("dataListeners"),Ko=Symbol("discarded"),Ie=t=>Promise.resolve().then(t),jw=t=>t(),Rw=t=>t==="end"||t==="finish"||t==="prefinish",Jw=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Bw=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),_i=class{src;dest;opts;ondrain;constructor(o,e,s){this.src=o,this.dest=e,this.opts=s,this.ondrain=()=>o[ee](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(o){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},xn=class extends _i{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(o,e,s){super(o,e,s),this.proxyErrors=i=>e.emit("error",i),o.on("error",this.proxyErrors)}},Dw=t=>!!t.objectMode,$w=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",wt=class extends xi.EventEmitter{[oo]=!1;[Xe]=!1;[mo]=[];[to]=[];[co];[Xo];[To];[te];[it]=!1;[dt]=!1;[ni]=!1;[ai]=!1;[Ve]=null;[eo]=0;[A]=!1;[Ye];[ui]=!1;[Wt]=0;[Ko]=!1;writable=!0;readable=!0;constructor(...o){let e=o[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Dw(e)?(this[co]=!0,this[Xo]=null):$w(e)?(this[Xo]=e.encoding,this[co]=!1):(this[co]=!1,this[Xo]=null),this[To]=!!e.async,this[te]=this[Xo]?new F_.StringDecoder(this[Xo]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[to]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[mo]});let{signal:s}=e;s&&(this[Ye]=s,s.aborted?this[_n]():s.addEventListener("abort",()=>this[_n]()))}get bufferLength(){return this[eo]}get encoding(){return this[Xo]}set encoding(o){throw new Error("Encoding must be set at instantiation time")}setEncoding(o){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[co]}set objectMode(o){throw new Error("objectMode must be set at instantiation time")}get async(){return this[To]}set async(o){this[To]=this[To]||!!o}[_n](){this[ui]=!0,this.emit("abort",this[Ye]?.reason),this.destroy(this[Ye]?.reason)}get aborted(){return this[ui]}set aborted(o){}write(o,e,s){if(this[ui])return!1;if(this[it])throw new Error("write after end");if(this[A])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let i=this[To]?Ie:jw;if(!this[co]&&!Buffer.isBuffer(o)){if(Bw(o))o=Buffer.from(o.buffer,o.byteOffset,o.byteLength);else if(Jw(o))o=Buffer.from(o);else if(typeof o!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[co]?(this[oo]&&this[eo]!==0&&this[ci](!0),this[oo]?this.emit("data",o):this[an](o),this[eo]!==0&&this.emit("readable"),s&&i(s),this[oo]):o.length?(typeof o=="string"&&!(e===this[Xo]&&!this[te]?.lastNeed)&&(o=Buffer.from(o,e)),Buffer.isBuffer(o)&&this[Xo]&&(o=this[te].write(o)),this[oo]&&this[eo]!==0&&this[ci](!0),this[oo]?this.emit("data",o):this[an](o),this[eo]!==0&&this.emit("readable"),s&&i(s),this[oo]):(this[eo]!==0&&this.emit("readable"),s&&i(s),this[oo])}read(o){if(this[A])return null;if(this[Ko]=!1,this[eo]===0||o===0||o&&o>this[eo])return this[rt](),null;this[co]&&(o=null),this[to].length>1&&!this[co]&&(this[to]=[this[Xo]?this[to].join(""):Buffer.concat(this[to],this[eo])]);let e=this[C_](o||null,this[to][0]);return this[rt](),e}[C_](o,e){if(this[co])this[li]();else{let s=e;o===s.length||o===null?this[li]():typeof s=="string"?(this[to][0]=s.slice(o),e=s.slice(0,o),this[eo]-=o):(this[to][0]=s.subarray(o),e=s.subarray(0,o),this[eo]-=o)}return this.emit("data",e),!this[to].length&&!this[it]&&this.emit("drain"),e}end(o,e,s){return typeof o=="function"&&(s=o,o=void 0),typeof e=="function"&&(s=e,e="utf8"),o!==void 0&&this.write(o,e),s&&this.once("end",s),this[it]=!0,this.writable=!1,(this[oo]||!this[Xe])&&this[rt](),this}[ee](){this[A]||(!this[Wt]&&!this[mo].length&&(this[Ko]=!0),this[Xe]=!1,this[oo]=!0,this.emit("resume"),this[to].length?this[ci]():this[it]?this[rt]():this.emit("drain"))}resume(){return this[ee]()}pause(){this[oo]=!1,this[Xe]=!0,this[Ko]=!1}get destroyed(){return this[A]}get flowing(){return this[oo]}get paused(){return this[Xe]}[an](o){this[co]?this[eo]+=1:this[eo]+=o.length,this[to].push(o)}[li](){return this[co]?this[eo]-=1:this[eo]-=this[to][0].length,this[to].shift()}[ci](o=!1){do;while(this[N_](this[li]())&&this[to].length);!o&&!this[to].length&&!this[it]&&this.emit("drain")}[N_](o){return this.emit("data",o),this[oo]}pipe(o,e){if(this[A])return o;this[Ko]=!1;let s=this[dt];return e=e||{},o===q_.stdout||o===q_.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&o.end():(this[mo].push(e.proxyErrors?new xn(this,o,e):new _i(this,o,e)),this[To]?Ie(()=>this[ee]()):this[ee]()),o}unpipe(o){let e=this[mo].find(s=>s.dest===o);e&&(this[mo].length===1?(this[oo]&&this[Wt]===0&&(this[oo]=!1),this[mo]=[]):this[mo].splice(this[mo].indexOf(e),1),e.unpipe())}addListener(o,e){return this.on(o,e)}on(o,e){let s=super.on(o,e);if(o==="data")this[Ko]=!1,this[Wt]++,!this[mo].length&&!this[oo]&&this[ee]();else if(o==="readable"&&this[eo]!==0)super.emit("readable");else if(Rw(o)&&this[dt])super.emit(o),this.removeAllListeners(o);else if(o==="error"&&this[Ve]){let i=e;this[To]?Ie(()=>i.call(this,this[Ve])):i.call(this,this[Ve])}return s}removeListener(o,e){return this.off(o,e)}off(o,e){let s=super.off(o,e);return o==="data"&&(this[Wt]=this.listeners("data").length,this[Wt]===0&&!this[Ko]&&!this[mo].length&&(this[oo]=!1)),s}removeAllListeners(o){let e=super.removeAllListeners(o);return(o==="data"||o===void 0)&&(this[Wt]=0,!this[Ko]&&!this[mo].length&&(this[oo]=!1)),e}get emittedEnd(){return this[dt]}[rt](){!this[ni]&&!this[dt]&&!this[A]&&this[to].length===0&&this[it]&&(this[ni]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ai]&&this.emit("close"),this[ni]=!1)}emit(o,...e){let s=e[0];if(o!=="error"&&o!=="close"&&o!==A&&this[A])return!1;if(o==="data")return!this[co]&&!s?!1:this[To]?(Ie(()=>this[ln](s)),!0):this[ln](s);if(o==="end")return this[S_]();if(o==="close"){if(this[ai]=!0,!this[dt]&&!this[A])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(o==="error"){this[Ve]=s,super.emit(cn,s);let r=!this[Ye]||this.listeners("error").length?super.emit("error",s):!1;return this[rt](),r}else if(o==="resume"){let r=super.emit("resume");return this[rt](),r}else if(o==="finish"||o==="prefinish"){let r=super.emit(o);return this.removeAllListeners(o),r}let i=super.emit(o,...e);return this[rt](),i}[ln](o){for(let s of this[mo])s.dest.write(o)===!1&&this.pause();let e=this[Ko]?!1:super.emit("data",o);return this[rt](),e}[S_](){return this[dt]?!1:(this[dt]=!0,this.readable=!1,this[To]?(Ie(()=>this[un]()),!0):this[un]())}[un](){if(this[te]){let e=this[te].end();if(e){for(let s of this[mo])s.dest.write(e);this[Ko]||super.emit("data",e)}}for(let e of this[mo])e.end();let o=super.emit("end");return this.removeAllListeners("end"),o}async collect(){let o=Object.assign([],{dataLength:0});this[co]||(o.dataLength=0);let e=this.promise();return this.on("data",s=>{o.push(s),this[co]||(o.dataLength+=s.length)}),await e,o}async concat(){if(this[co])throw new Error("cannot concat in objectMode");let o=await this.collect();return this[Xo]?o.join(""):Buffer.concat(o,o.dataLength)}async promise(){return new Promise((o,e)=>{this.on(A,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>o())})}[Symbol.asyncIterator](){this[Ko]=!1;let o=!1,e=async()=>(this.pause(),o=!0,{value:void 0,done:!0});return{next:()=>{if(o)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[it])return e();let r,n,a=x=>{this.off("data",c),this.off("end",u),this.off(A,d),e(),n(x)},c=x=>{this.off("error",a),this.off("end",u),this.off(A,d),this.pause(),r({value:x,done:!!this[it]})},u=()=>{this.off("error",a),this.off("data",c),this.off(A,d),e(),r({done:!0,value:void 0})},d=()=>a(new Error("stream destroyed"));return new Promise((x,g)=>{n=g,r=x,this.once(A,d),this.once("error",a),this.once("end",u),this.once("data",c)})},throw:e,return:e,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Ko]=!1;let o=!1,e=()=>(this.pause(),this.off(cn,e),this.off(A,e),this.off("end",e),o=!0,{done:!0,value:void 0}),s=()=>{if(o)return e();let i=this.read();return i===null?e():{done:!1,value:i}};return this.once("end",e),this.once(cn,e),this.once(A,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this}}}destroy(o){if(this[A])return o?this.emit("error",o):this.emit(A),this;this[A]=!0,this[Ko]=!0,this[to].length=0,this[eo]=0;let e=this;return typeof e.close=="function"&&!this[ai]&&e.close(),o?this.emit("error",o):this.emit(A),this}static get isStream(){return Uw}};var oy=Ao.realpathSync.native,Pe={lstatSync:Ao.lstatSync,readdir:Ao.readdir,readdirSync:Ao.readdirSync,readlinkSync:Ao.readlinkSync,realpathSync:oy,promises:{lstat:yt.lstat,readdir:yt.readdir,readlink:yt.readlink,realpath:yt.realpath}},I_=t=>!t||t===Pe||t===Hw?Pe:{...Pe,...t,promises:{...Pe.promises,...t.promises||{}}},Z_=/^\\\\\?\\([a-z]:)\\?$/i,ty=t=>t.replace(/\//g,"\\").replace(Z_,"$1\\"),ey=/[\\\/]/,So=0,P_=1,L_=2,Uo=4,T_=6,U_=8,qt=10,A_=12,No=15,Ze=~No,gn=16,M_=32,Le=64,Yo=128,mi=256,Oi=512,E_=Le|Yo|Oi,sy=1023,On=t=>t.isFile()?U_:t.isDirectory()?Uo:t.isSymbolicLink()?qt:t.isCharacterDevice()?L_:t.isBlockDevice()?T_:t.isSocket()?A_:t.isFIFO()?P_:So,V_=new Map,Te=t=>{let o=V_.get(t);if(o)return o;let e=t.normalize("NFKD");return V_.set(t,e),e},X_=new Map,gi=t=>{let o=X_.get(t);if(o)return o;let e=Te(t.toLowerCase());return X_.set(t,e),e},di=class extends Ee{constructor(){super({max:256})}},dn=class extends Ee{constructor(o=16*1024){super({maxSize:o,sizeCalculation:e=>e.length+1})}},Q_=Symbol("PathScurry setAsCwd"),lo=class{name;root;roots;parent;nocase;isCWD=!1;#o;#t;get dev(){return this.#t}#r;get mode(){return this.#r}#s;get nlink(){return this.#s}#n;get uid(){return this.#n}#f;get gid(){return this.#f}#l;get rdev(){return this.#l}#_;get blksize(){return this.#_}#a;get ino(){return this.#a}#c;get size(){return this.#c}#i;get blocks(){return this.#i}#d;get atimeMs(){return this.#d}#w;get mtimeMs(){return this.#w}#m;get ctimeMs(){return this.#m}#x;get birthtimeMs(){return this.#x}#K;get atime(){return this.#K}#O;get mtime(){return this.#O}#G;get ctime(){return this.#G}#b;get birthtime(){return this.#b}#h;#z;#k;#g;#q;#v;#e;#S;#y;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(o,e=So,s,i,r,n,a){this.name=o,this.#h=r?gi(o):Te(o),this.#e=e&sy,this.nocase=r,this.roots=i,this.root=s||this,this.#S=n,this.#k=a.fullpath,this.#q=a.relative,this.#v=a.relativePosix,this.parent=a.parent,this.parent?this.#o=this.parent.#o:this.#o=I_(a.fs)}depth(){return this.#z!==void 0?this.#z:this.parent?this.#z=this.parent.depth()+1:this.#z=0}childrenCache(){return this.#S}resolve(o){if(!o)return this;let e=this.getRootString(o),i=o.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#F(i):this.#F(i)}#F(o){let e=this;for(let s of o)e=e.child(s);return e}children(){let o=this.#S.get(this);if(o)return o;let e=Object.assign([],{provisional:0});return this.#S.set(this,e),this.#e&=~gn,e}child(o,e){if(o===""||o===".")return this;if(o==="..")return this.parent||this;let s=this.children(),i=this.nocase?gi(o):Te(o);for(let c of s)if(c.#h===i)return c;let r=this.parent?this.sep:"",n=this.#k?this.#k+r+o:void 0,a=this.newChild(o,So,{...e,parent:this,fullpath:n});return this.canReaddir()||(a.#e|=Yo),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#q!==void 0)return this.#q;let o=this.name,e=this.parent;if(!e)return this.#q=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+o}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let o=this.name,e=this.parent;if(!e)return this.#v=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+o}fullpath(){if(this.#k!==void 0)return this.#k;let o=this.name,e=this.parent;if(!e)return this.#k=this.name;let i=e.fullpath()+(e.parent?this.sep:"")+o;return this.#k=i}fullpathPosix(){if(this.#g!==void 0)return this.#g;if(this.sep==="/")return this.#g=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#g=`//?/${i}`:this.#g=i}let o=this.parent,e=o.fullpathPosix(),s=e+(!e||!o.parent?"":"/")+this.name;return this.#g=s}isUnknown(){return(this.#e&No)===So}isType(o){return this[`is${o}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#e&No)===U_}isDirectory(){return(this.#e&No)===Uo}isCharacterDevice(){return(this.#e&No)===L_}isBlockDevice(){return(this.#e&No)===T_}isFIFO(){return(this.#e&No)===P_}isSocket(){return(this.#e&No)===A_}isSymbolicLink(){return(this.#e&qt)===qt}lstatCached(){return this.#e&M_?this:void 0}readlinkCached(){return this.#y}realpathCached(){return this.#C}readdirCached(){let o=this.children();return o.slice(0,o.provisional)}canReadlink(){if(this.#y)return!0;if(!this.parent)return!1;let o=this.#e&No;return!(o!==So&&o!==qt||this.#e&mi||this.#e&Yo)}calledReaddir(){return!!(this.#e&gn)}isENOENT(){return!!(this.#e&Yo)}isNamed(o){return this.nocase?this.#h===gi(o):this.#h===Te(o)}async readlink(){let o=this.#y;if(o)return o;if(this.canReadlink()&&this.parent)try{let e=await this.#o.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#y=s}catch(e){this.#u(e.code);return}}readlinkSync(){let o=this.#y;if(o)return o;if(this.canReadlink()&&this.parent)try{let e=this.#o.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#y=s}catch(e){this.#u(e.code);return}}#M(o){this.#e|=gn;for(let e=o.provisional;e<o.length;e++){let s=o[e];s&&s.#E()}}#E(){this.#e&Yo||(this.#e=(this.#e|Yo)&Ze,this.#p())}#p(){let o=this.children();o.provisional=0;for(let e of o)e.#E()}#W(){this.#e|=Oi,this.#V()}#V(){if(this.#e&Le)return;let o=this.#e;(o&No)===Uo&&(o&=Ze),this.#e=o|Le,this.#p()}#X(o=""){o==="ENOTDIR"||o==="EPERM"?this.#V():o==="ENOENT"?this.#E():this.children().provisional=0}#Y(o=""){o==="ENOTDIR"?this.parent.#V():o==="ENOENT"&&this.#E()}#u(o=""){let e=this.#e;e|=mi,o==="ENOENT"&&(e|=Yo),(o==="EINVAL"||o==="UNKNOWN")&&(e&=Ze),this.#e=e,o==="ENOTDIR"&&this.parent&&this.parent.#V()}#I(o,e){return this.#N(o,e)||this.#Z(o,e)}#Z(o,e){let s=On(o),i=this.newChild(o.name,s,{parent:this}),r=i.#e&No;return r!==Uo&&r!==qt&&r!==So&&(i.#e|=Le),e.unshift(i),e.provisional++,i}#N(o,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?gi(o.name):Te(o.name))===i.#h)return this.#P(o,i,s,e)}}#P(o,e,s,i){let r=e.name;return e.#e=e.#e&Ze|On(o),r!==o.name&&(e.name=o.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e}async lstat(){if((this.#e&Yo)===0)try{return this.#A(await this.#o.promises.lstat(this.fullpath())),this}catch(o){this.#Y(o.code)}}lstatSync(){if((this.#e&Yo)===0)try{return this.#A(this.#o.lstatSync(this.fullpath())),this}catch(o){this.#Y(o.code)}}#A(o){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:n,blocks:a,ctime:c,ctimeMs:u,dev:d,gid:x,ino:g,mode:w,mtime:z,mtimeMs:k,nlink:p,rdev:W,size:q,uid:O}=o;this.#K=e,this.#d=s,this.#b=i,this.#x=r,this.#_=n,this.#i=a,this.#G=c,this.#m=u,this.#t=d,this.#f=x,this.#a=g,this.#r=w,this.#O=z,this.#w=k,this.#s=p,this.#l=W,this.#c=q,this.#n=O;let l=On(o);this.#e=this.#e&Ze|l|M_,l!==So&&l!==Uo&&l!==qt&&(this.#e|=Le)}#T=[];#U=!1;#Q(o){this.#U=!1;let e=this.#T.slice();this.#T.length=0,e.forEach(s=>s(null,o))}readdirCB(o,e=!1){if(!this.canReaddir()){e?o(null,[]):queueMicrotask(()=>o(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);e?o(null,r):queueMicrotask(()=>o(null,r));return}if(this.#T.push(o),this.#U)return;this.#U=!0;let i=this.fullpath();this.#o.readdir(i,{withFileTypes:!0},(r,n)=>{if(r)this.#X(r.code),s.provisional=0;else{for(let a of n)this.#I(a,s);this.#M(s)}this.#Q(s.slice(0,s.provisional))})}#L;async readdir(){if(!this.canReaddir())return[];let o=this.children();if(this.calledReaddir())return o.slice(0,o.provisional);let e=this.fullpath();if(this.#L)await this.#L;else{let s=()=>{};this.#L=new Promise(i=>s=i);try{for(let i of await this.#o.promises.readdir(e,{withFileTypes:!0}))this.#I(i,o);this.#M(o)}catch(i){this.#X(i.code),o.provisional=0}this.#L=void 0,s()}return o.slice(0,o.provisional)}readdirSync(){if(!this.canReaddir())return[];let o=this.children();if(this.calledReaddir())return o.slice(0,o.provisional);let e=this.fullpath();try{for(let s of this.#o.readdirSync(e,{withFileTypes:!0}))this.#I(s,o);this.#M(o)}catch(s){this.#X(s.code),o.provisional=0}return o.slice(0,o.provisional)}canReaddir(){if(this.#e&E_)return!1;let o=No&this.#e;return o===So||o===Uo||o===qt}shouldWalk(o,e){return(this.#e&Uo)===Uo&&!(this.#e&E_)&&!o.has(this)&&(!e||e(this))}async realpath(){if(this.#C)return this.#C;if(!((Oi|mi|Yo)&this.#e))try{let o=await this.#o.promises.realpath(this.fullpath());return this.#C=this.resolve(o)}catch{this.#W()}}realpathSync(){if(this.#C)return this.#C;if(!((Oi|mi|Yo)&this.#e))try{let o=this.#o.realpathSync(this.fullpath());return this.#C=this.resolve(o)}catch{this.#W()}}[Q_](o){if(o===this)return;o.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),i.#q=s.join(this.sep),i.#v=s.join("/"),i=i.parent,s.push("..");for(i=o;i&&i.parent&&!e.has(i);)i.#q=void 0,i.#v=void 0,i=i.parent}},wi=class t extends lo{sep="\\";splitSep=ey;constructor(o,e=So,s,i,r,n,a){super(o,e,s,i,r,n,a)}newChild(o,e=So,s={}){return new t(o,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(o){return se.win32.parse(o).root}getRoot(o){if(o=ty(o.toUpperCase()),o===this.root.name)return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(o,e))return this.roots[o]=s;return this.roots[o]=new ie(o,this).root}sameRoot(o,e=this.root.name){return o=o.toUpperCase().replace(/\//g,"\\").replace(Z_,"$1\\"),o===e}},yi=class t extends lo{splitSep="/";sep="/";constructor(o,e=So,s,i,r,n,a){super(o,e,s,i,r,n,a)}getRootString(o){return o.startsWith("/")?"/":""}getRoot(o){return this.root}newChild(o,e=So,s={}){return new t(o,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}},hi=class{root;rootPath;roots;cwd;#o;#t;#r;nocase;#s;constructor(o=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16*1024,fs:n=Pe}={}){this.#s=I_(n),(o instanceof URL||o.startsWith("file://"))&&(o=(0,Y_.fileURLToPath)(o));let a=e.resolve(o);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#o=new di,this.#t=new di,this.#r=new dn(r);let c=a.substring(this.rootPath.length).split(s);if(c.length===1&&!c[0]&&c.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#s),this.roots[this.rootPath]=this.root;let u=this.root,d=c.length-1,x=e.sep,g=this.rootPath,w=!1;for(let z of c){let k=d--;u=u.child(z,{relative:new Array(k).fill("..").join(x),relativePosix:new Array(k).fill("..").join("/"),fullpath:g+=(w?"":x)+z}),w=!0}this.cwd=u}depth(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.depth()}childrenCache(){return this.#r}resolve(...o){let e="";for(let r=o.length-1;r>=0;r--){let n=o[r];if(!(!n||n===".")&&(e=e?`${n}/${e}`:n,this.isAbsolute(n)))break}let s=this.#o.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return this.#o.set(e,i),i}resolvePosix(...o){let e="";for(let r=o.length-1;r>=0;r--){let n=o[r];if(!(!n||n===".")&&(e=e?`${n}/${e}`:n,this.isAbsolute(n)))break}let s=this.#t.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return this.#t.set(e,i),i}relative(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.relative()}relativePosix(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.relativePosix()}basename(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.name}dirname(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),(o.parent||o).fullpath()}async readdir(o=this.cwd,e={withFileTypes:!0}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o,o=this.cwd);let{withFileTypes:s}=e;if(o.canReaddir()){let i=await o.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(o=this.cwd,e={withFileTypes:!0}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o,o=this.cwd);let{withFileTypes:s=!0}=e;return o.canReaddir()?s?o.readdirSync():o.readdirSync().map(i=>i.name):[]}async lstat(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.lstat()}lstatSync(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.lstatSync()}async readlink(o=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o.withFileTypes,o=this.cwd);let s=await o.readlink();return e?s:s?.fullpath()}readlinkSync(o=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o.withFileTypes,o=this.cwd);let s=o.readlinkSync();return e?s:s?.fullpath()}async realpath(o=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o.withFileTypes,o=this.cwd);let s=await o.realpath();return e?s:s?.fullpath()}realpathSync(o=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o.withFileTypes,o=this.cwd);let s=o.realpathSync();return e?s:s?.fullpath()}async walk(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,a=[];(!r||r(o))&&a.push(s?o:o.fullpath());let c=new Set,u=(x,g)=>{c.add(x),x.readdirCB((w,z)=>{if(w)return g(w);let k=z.length;if(!k)return g();let p=()=>{--k===0&&g()};for(let W of z)(!r||r(W))&&a.push(s?W:W.fullpath()),i&&W.isSymbolicLink()?W.realpath().then(q=>q?.isUnknown()?q.lstat():q).then(q=>q?.shouldWalk(c,n)?u(q,p):p()):W.shouldWalk(c,n)?u(W,p):p()},!0)},d=o;return new Promise((x,g)=>{u(d,w=>{if(w)return g(w);x(a)})})}walkSync(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,a=[];(!r||r(o))&&a.push(s?o:o.fullpath());let c=new Set([o]);for(let u of c){let d=u.readdirSync();for(let x of d){(!r||r(x))&&a.push(s?x:x.fullpath());let g=x;if(x.isSymbolicLink()){if(!(i&&(g=x.realpathSync())))continue;g.isUnknown()&&g.lstatSync()}g.shouldWalk(c,n)&&c.add(g)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(o=this.cwd,e={}){return typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o,o=this.cwd),this.stream(o,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e;(!r||r(o))&&(yield s?o:o.fullpath());let a=new Set([o]);for(let c of a){let u=c.readdirSync();for(let d of u){(!r||r(d))&&(yield s?d:d.fullpath());let x=d;if(d.isSymbolicLink()){if(!(i&&(x=d.realpathSync())))continue;x.isUnknown()&&x.lstatSync()}x.shouldWalk(a,n)&&a.add(x)}}}stream(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,a=new wt({objectMode:!0});(!r||r(o))&&a.write(s?o:o.fullpath());let c=new Set,u=[o],d=0,x=()=>{let g=!1;for(;!g;){let w=u.shift();if(!w){d===0&&a.end();return}d++,c.add(w);let z=(p,W,q=!1)=>{if(p)return a.emit("error",p);if(i&&!q){let O=[];for(let l of W)l.isSymbolicLink()&&O.push(l.realpath().then(m=>m?.isUnknown()?m.lstat():m));if(O.length){Promise.all(O).then(()=>z(null,W,!0));return}}for(let O of W)O&&(!r||r(O))&&(a.write(s?O:O.fullpath())||(g=!0));d--;for(let O of W){let l=O.realpathCached()||O;l.shouldWalk(c,n)&&u.push(l)}g&&!a.flowing?a.once("drain",x):k||x()},k=!0;w.readdirCB(z,!0),k=!1}};return x(),a}streamSync(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof lo||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,a=new wt({objectMode:!0}),c=new Set;(!r||r(o))&&a.write(s?o:o.fullpath());let u=[o],d=0,x=()=>{let g=!1;for(;!g;){let w=u.shift();if(!w){d===0&&a.end();return}d++,c.add(w);let z=w.readdirSync();for(let k of z)(!r||r(k))&&(a.write(s?k:k.fullpath())||(g=!0));d--;for(let k of z){let p=k;if(k.isSymbolicLink()){if(!(i&&(p=k.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(c,n)&&u.push(p)}}g&&!a.flowing&&a.once("drain",x)};return x(),a}chdir(o=this.cwd){let e=this.cwd;this.cwd=typeof o=="string"?this.cwd.resolve(o):o,this.cwd[Q_](e)}},ie=class extends hi{sep="\\";constructor(o=process.cwd(),e={}){let{nocase:s=!0}=e;super(o,se.win32,"\\",{...e,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(o){return se.win32.parse(o).root.toUpperCase()}newRoot(o){return new wi(this.rootPath,Uo,void 0,this.roots,this.nocase,this.childrenCache(),{fs:o})}isAbsolute(o){return o.startsWith("/")||o.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(o)}},re=class extends hi{sep="/";constructor(o=process.cwd(),e={}){let{nocase:s=!1}=e;super(o,se.posix,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(o){return"/"}newRoot(o){return new yi(this.rootPath,Uo,void 0,this.roots,this.nocase,this.childrenCache(),{fs:o})}isAbsolute(o){return o.startsWith("/")}},Ue=class extends re{constructor(o=process.cwd(),e={}){let{nocase:s=!0}=e;super(o,{...e,nocase:s})}},Tf=process.platform==="win32"?wi:yi,j_=process.platform==="win32"?ie:process.platform==="darwin"?Ue:re;var iy=t=>t.length>=1,ry=t=>t.length>=1,ne=class t{#o;#t;#r;length;#s;#n;#f;#l;#_;#a;#c=!0;constructor(o,e,s,i){if(!iy(o))throw new TypeError("empty pattern list");if(!ry(e))throw new TypeError("empty glob list");if(e.length!==o.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=o.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#o=o,this.#t=e,this.#r=s,this.#s=i,this.#r===0){if(this.isUNC()){let[r,n,a,c,...u]=this.#o,[d,x,g,w,...z]=this.#t;u[0]===""&&(u.shift(),z.shift());let k=[r,n,a,c,""].join("/"),p=[d,x,g,w,""].join("/");this.#o=[k,...u],this.#t=[p,...z],this.length=this.#o.length}else if(this.isDrive()||this.isAbsolute()){let[r,...n]=this.#o,[a,...c]=this.#t;n[0]===""&&(n.shift(),c.shift());let u=r+"/",d=a+"/";this.#o=[u,...n],this.#t=[d,...c],this.length=this.#o.length}}}pattern(){return this.#o[this.#r]}isString(){return typeof this.#o[this.#r]=="string"}isGlobstar(){return this.#o[this.#r]===ro}isRegExp(){return this.#o[this.#r]instanceof RegExp}globString(){return this.#f=this.#f||(this.#r===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join("/"):this.#t.join("/"):this.#t.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#n!==void 0?this.#n:this.hasMore()?(this.#n=new t(this.#o,this.#t,this.#r+1,this.#s),this.#n.#a=this.#a,this.#n.#_=this.#_,this.#n.#l=this.#l,this.#n):this.#n=null}isUNC(){let o=this.#o;return this.#_!==void 0?this.#_:this.#_=this.#s==="win32"&&this.#r===0&&o[0]===""&&o[1]===""&&typeof o[2]=="string"&&!!o[2]&&typeof o[3]=="string"&&!!o[3]}isDrive(){let o=this.#o;return this.#l!==void 0?this.#l:this.#l=this.#s==="win32"&&this.#r===0&&this.length>1&&typeof o[0]=="string"&&/^[a-z]:$/i.test(o[0])}isAbsolute(){let o=this.#o;return this.#a!==void 0?this.#a:this.#a=o[0]===""&&o.length>1||this.isDrive()||this.isUNC()}root(){let o=this.#o[0];return typeof o=="string"&&this.isAbsolute()&&this.#r===0?o:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#c)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#c?!1:(this.#c=!1,!0)}};var ny=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ae=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(o,{nobrace:e,nocase:s,noext:i,noglobstar:r,platform:n=ny}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=n,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:n,nocomment:!0,nonegate:!0};for(let a of o)this.add(a)}add(o){let e=new ko(o,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],r=e.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let n=new ne(i,r,0,this.platform),a=new ko(n.globString(),this.mmopts),c=r[r.length-1]==="**",u=n.isAbsolute();u?this.absolute.push(a):this.relative.push(a),c&&(u?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(o){let e=o.fullpath(),s=`${e}/`,i=o.relative()||".",r=`${i}/`;for(let n of this.relative)if(n.match(i)||n.match(r))return!0;for(let n of this.absolute)if(n.match(e)||n.match(s))return!0;return!1}childrenIgnored(o){let e=o.fullpath()+"/",s=(o.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}};var wn=class t{store;constructor(o=new Map){this.store=o}copy(){return new t(new Map(this.store))}hasWalked(o,e){return this.store.get(o.fullpath())?.has(e.globString())}storeWalked(o,e){let s=o.fullpath(),i=this.store.get(s);i?i.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},yn=class{store=new Map;add(o,e,s){let i=(e?2:0)|(s?1:0),r=this.store.get(o);this.store.set(o,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([o,e])=>[o,!!(e&2),!!(e&1)])}},hn=class{store=new Map;add(o,e){if(!o.canReaddir())return;let s=this.store.get(o);s?s.find(i=>i.globString()===e.globString())||s.push(e):this.store.set(o,[e])}get(o){let e=this.store.get(o);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(o=>[o,this.store.get(o)])}keys(){return[...this.store.keys()].filter(o=>o.canReaddir())}},Ae=class t{hasWalkedCache;matches=new yn;subwalks=new hn;patterns;follow;dot;opts;constructor(o,e){this.opts=o,this.follow=!!o.follow,this.dot=!!o.dot,this.hasWalkedCache=e?e.copy():new wn}processPatterns(o,e){this.patterns=e;let s=e.map(i=>[o,i]);for(let[i,r]of s){this.hasWalkedCache.storeWalked(i,r);let n=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(n){i=i.resolve(n==="/"&&this.opts.root!==void 0?this.opts.root:n);let x=r.rest();if(x)r=x;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let c,u,d=!1;for(;typeof(c=r.pattern())=="string"&&(u=r.rest());)i=i.resolve(c),r=u,d=!0;if(c=r.pattern(),u=r.rest(),d){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof c=="string"){let x=c===".."||c===""||c===".";this.matches.add(i.resolve(c),a,x);continue}else if(c===ro){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let x=u?.pattern(),g=u?.rest();if(!u||(x===""||x===".")&&!g)this.matches.add(i,a,x===""||x===".");else if(x===".."){let w=i.parent||i;g?this.hasWalkedCache.hasWalked(w,g)||this.subwalks.add(w,g):this.matches.add(w,a,!0)}}else c instanceof RegExp&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(o,e){let s=this.subwalks.get(o),i=this.child();for(let r of e)for(let n of s){let a=n.isAbsolute(),c=n.pattern(),u=n.rest();c===ro?i.testGlobstar(r,n,u,a):c instanceof RegExp?i.testRegExp(r,c,u,a):i.testString(r,c,u,a)}return i}testGlobstar(o,e,s,i){if((this.dot||!o.name.startsWith("."))&&(e.hasMore()||this.matches.add(o,i,!1),o.canReaddir()&&(this.follow||!o.isSymbolicLink()?this.subwalks.add(o,e):o.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(o,s):e.markFollowGlobstar()&&this.subwalks.add(o,e)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(o,r,s.rest(),i);else if(r===".."){let n=o.parent||o;this.subwalks.add(n,s)}else r instanceof RegExp&&this.testRegExp(o,r,s.rest(),i)}}testRegExp(o,e,s,i){e.test(o.name)&&(s?this.subwalks.add(o,s):this.matches.add(o,i,!1))}testString(o,e,s,i){o.isNamed(e)&&(s?this.subwalks.add(o,s):this.matches.add(o,i,!1))}};var ay=(t,o)=>typeof t=="string"?new ae([t],o):Array.isArray(t)?new ae(t,o):t,fi=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#o=[];#t;#r;signal;maxDepth;includeChildMatches;constructor(o,e,s){if(this.patterns=o,this.path=e,this.opts=s,this.#r=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#t=ay(s.ignore??[],s),!this.includeChildMatches&&typeof this.#t.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#o.length=0}))}#s(o){return this.seen.has(o)||!!this.#t?.ignored?.(o)}#n(o){return!!this.#t?.childrenIgnored?.(o)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let o;for(;!this.paused&&(o=this.#o.shift());)o()}onResume(o){this.signal?.aborted||(this.paused?this.#o.push(o):o())}async matchCheck(o,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=o.realpathCached()||await o.realpath(),!s)return;o=s}let r=o.isUnknown()||this.opts.stat?await o.lstat():o;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let n=await r.realpath();n&&(n.isUnknown()||this.opts.stat)&&await n.lstat()}return this.matchCheckTest(r,e)}matchCheckTest(o,e){return o&&(this.maxDepth===1/0||o.depth()<=this.maxDepth)&&(!e||o.canReaddir())&&(!this.opts.nodir||!o.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!o.isSymbolicLink()||!o.realpathCached()?.isDirectory())&&!this.#s(o)?o:void 0}matchCheckSync(o,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=o.realpathCached()||o.realpathSync(),!s)return;o=s}let r=o.isUnknown()||this.opts.stat?o.lstatSync():o;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let n=r.realpathSync();n&&(n?.isUnknown()||this.opts.stat)&&n.lstatSync()}return this.matchCheckTest(r,e)}matchFinish(o,e){if(this.#s(o))return;if(!this.includeChildMatches&&this.#t?.add){let r=`${o.relativePosix()}/**`;this.#t.add(r)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(o);let i=this.opts.mark&&o.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(o);else if(s){let r=this.opts.posix?o.fullpathPosix():o.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?o.relativePosix():o.relative(),n=this.opts.dotRelative&&!r.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(r?n+r+i:"."+i)}}async match(o,e,s){let i=await this.matchCheck(o,s);i&&this.matchFinish(i,e)}matchSync(o,e,s){let i=this.matchCheckSync(o,s);i&&this.matchFinish(i,e)}walkCB(o,e,s){this.signal?.aborted&&s(),this.walkCB2(o,e,new Ae(this.opts),s)}walkCB2(o,e,s,i){if(this.#n(o))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(o,e,s,i));return}s.processPatterns(o,e);let r=1,n=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())this.#s(a)||(r++,this.match(a,c,u).then(()=>n()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,s,n):a.readdirCB((u,d)=>this.walkCB3(a,d,s,n),!0)}n()}walkCB3(o,e,s,i){s=s.filterEntries(o,e);let r=1,n=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())this.#s(a)||(r++,this.match(a,c,u).then(()=>n()));for(let[a,c]of s.subwalks.entries())r++,this.walkCB2(a,c,s.child(),n);n()}walkCBSync(o,e,s){this.signal?.aborted&&s(),this.walkCB2Sync(o,e,new Ae(this.opts),s)}walkCB2Sync(o,e,s,i){if(this.#n(o))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(o,e,s,i));return}s.processPatterns(o,e);let r=1,n=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())this.#s(a)||this.matchSync(a,c,u);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirSync();this.walkCB3Sync(a,c,s,n)}n()}walkCB3Sync(o,e,s,i){s=s.filterEntries(o,e);let r=1,n=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())this.#s(a)||this.matchSync(a,c,u);for(let[a,c]of s.subwalks.entries())r++,this.walkCB2Sync(a,c,s.child(),n);n()}},Qe=class extends fi{matches=new Set;constructor(o,e,s){super(o,e,s)}matchEmit(o){this.matches.add(o)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((o,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):o(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},je=class extends fi{results;constructor(o,e,s){super(o,e,s),this.results=new wt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(o){this.results.write(o),this.results.flowing||this.pause()}stream(){let o=this.path;return o.isUnknown()?o.lstat().then(()=>{this.walkCB(o,this.patterns,()=>this.results.end())}):this.walkCB(o,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var cy=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Io=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(o,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,R_.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof o=="string"&&(o=[o]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(o=o.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");o=o.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=o,this.platform=e.platform||cy,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=e.platform==="win32"?ie:e.platform==="darwin"?Ue:e.platform?re:j_;this.scurry=new c(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(c=>new ko(c,i)),[n,a]=r.reduce((c,u)=>(c[0].push(...u.set),c[1].push(...u.globParts),c),[[],[]]);this.patterns=n.map((c,u)=>{let d=a[u];if(!d)throw new Error("invalid pattern object");return new ne(c,d,0,this.platform)})}async walk(){return[...await new Qe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Qe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new je(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new je(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var fn=(t,o={})=>{Array.isArray(t)||(t=[t]);for(let e of t)if(new ko(e,o).hasMagic())return!0;return!1};function ki(t,o={}){return new Io(t,o).streamSync()}function B_(t,o={}){return new Io(t,o).stream()}function D_(t,o={}){return new Io(t,o).walkSync()}async function J_(t,o={}){return new Io(t,o).walk()}function Ki(t,o={}){return new Io(t,o).iterateSync()}function $_(t,o={}){return new Io(t,o).iterate()}var ly=ki,uy=Object.assign(B_,{sync:ki}),_y=Ki,xy=Object.assign($_,{sync:Ki}),my=Object.assign(D_,{stream:ki,iterate:Ki}),zi=Object.assign(J_,{glob:J_,globSync:D_,sync:my,globStream:B_,stream:uy,globStreamSync:ki,streamSync:ly,globIterate:$_,iterate:xy,globIterateSync:Ki,iterateSync:_y,Glob:Io,hasMagic:fn,escape:$t,unescape:Vo});zi.glob=zi;var ex=P(require("node:assert")),ce=P(require("node:fs/promises")),go=P(require("node:path"));var tx=P(H_());function Gi(t){return ox(t)||ox((0,tx.default)(t))||"app"}function ox(t){return t.replace(/[\W_]+/g,"").normalize("NFD").replace(/[\u0300-\u036f]/g,"")}async function sx(t){let{spawnAsync:o,sourceAppPath:e}=t,s=go.default.join(t.workingDirectory,"extracted");if(await ce.default.mkdir(s,{recursive:!0}),e.endsWith(".zip")||e.endsWith(".ipa"))await o("unzip",[e,"-d",s]);else if(e.endsWith(".tar.gz"))await o("tar",["-xzf",e,"-C",s]);else if(e.endsWith(".app")){let n=go.default.basename(e);await It(e,go.default.join(s,n))}else throw new Error("Unsupported file type. Please provide a .zip, .tar.gz, or .app file.");let r=(await zi("{Payload/*.app,*.app}",{cwd:s,absolute:!0}))[0];return(0,ex.default)(r,`Failed to find the .app directory in the extracted artifact: ${s}`),r}async function ix({config:t,appWorkingDirectory:o,executableName:e}){let{dir:s,name:i}=go.default.parse(o),r=Gi(t.name),n=go.default.join(s,`${r}.app`);return await ce.default.rename(go.default.join(s,`${i}.app`),n),await ce.default.rename(go.default.join(n,e),go.default.join(n,r)),n}async function rx(t,o){let e=go.default.resolve(t.workingDirectory,go.default.basename(o));return await It(o,e),e}async function nx(t,o){let{spawnAsync:e,workingDirectory:s}=t;await ce.default.mkdir(go.default.join(s,"Payload"),{recursive:!0}),await ce.default.rename(o,go.default.join(s,"Payload",go.default.basename(o)));let i=go.default.resolve(s,"repacked.ipa");return await e("zip",["-r",i,"Payload"],{cwd:s}),i}function ax(t,o,e){let s=e.keychainPath?`keychain_path: "${e.keychainPath}",`:"",i;if(typeof e.provisioningProfile=="string")i=`provisioning_profile: "${e.provisioningProfile}",`;else if(typeof e.provisioningProfile=="object"&&!Array.isArray(e.provisioningProfile)){let n="";for(let[a,c]of Object.entries(e.provisioningProfile))n+=` "${a}" => "${c}",
32
32
  `;i=`provisioning_profile: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/repack-app",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Repacking tool for Expo apps",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",