@capgo/cli 7.88.0 → 7.88.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/package.json +2 -2
- package/dist/src/sdk.js +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -95,7 +95,7 @@ Expecting one of '${B.join("', '")}'`);if(this._lifeCycleHooks[A])this._lifeCycl
|
|
|
95
95
|
`),this.outputHelp({error:!0});let B=Q||{},D=B.exitCode||1,E=B.code||"commander.error";this._exit(D,E,A)}_parseOptionsEnv(){this.options.forEach((A)=>{if(A.envVar&&A.envVar in hD.env){let Q=A.attributeName();if(this.getOptionValue(Q)===void 0||["default","config","env"].includes(this.getOptionValueSource(Q)))if(A.required||A.optional)this.emit(`optionEnv:${A.name()}`,hD.env[A.envVar]);else this.emit(`optionEnv:${A.name()}`)}})}_parseOptionsImplied(){let A=new wSA(this.options),Q=(B)=>{return this.getOptionValue(B)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(B))};this.options.filter((B)=>B.implied!==void 0&&Q(B.attributeName())&&A.valueFromOption(this.getOptionValue(B.attributeName()),B)).forEach((B)=>{Object.keys(B.implied).filter((D)=>!Q(D)).forEach((D)=>{this.setOptionValueWithSource(D,B.implied[D],"implied")})})}missingArgument(A){let Q=`error: missing required argument '${A}'`;this.error(Q,{code:"commander.missingArgument"})}optionMissingArgument(A){let Q=`error: option '${A.flags}' argument missing`;this.error(Q,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(A){let Q=`error: required option '${A.flags}' not specified`;this.error(Q,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(A,Q){let B=(I)=>{let C=I.attributeName(),F=this.getOptionValue(C),$=this.options.find((Y)=>Y.negate&&C===Y.attributeName()),H=this.options.find((Y)=>!Y.negate&&C===Y.attributeName());if($&&($.presetArg===void 0&&F===!1||$.presetArg!==void 0&&F===$.presetArg))return $;return H||I},D=(I)=>{let C=B(I),F=C.attributeName();if(this.getOptionValueSource(F)==="env")return`environment variable '${C.envVar}'`;return`option '${C.flags}'`},E=`error: ${D(A)} cannot be used with ${D(Q)}`;this.error(E,{code:"commander.conflictingOption"})}unknownOption(A){if(this._allowUnknownOption)return;let Q="";if(A.startsWith("--")&&this._showSuggestionAfterError){let D=[],E=this;do{let I=E.createHelp().visibleOptions(E).filter((C)=>C.long).map((C)=>C.long);D=D.concat(I),E=E.parent}while(E&&!E._enablePositionalOptions);Q=Mo(A,D)}let B=`error: unknown option '${A}'${Q}`;this.error(B,{code:"commander.unknownOption"})}_excessArguments(A){if(this._allowExcessArguments)return;let Q=this.registeredArguments.length,B=Q===1?"":"s",E=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Q} argument${B} but got ${A.length}.`;this.error(E,{code:"commander.excessArguments"})}unknownCommand(){let A=this.args[0],Q="";if(this._showSuggestionAfterError){let D=[];this.createHelp().visibleCommands(this).forEach((E)=>{if(D.push(E.name()),E.alias())D.push(E.alias())}),Q=Mo(A,D)}let B=`error: unknown command '${A}'${Q}`;this.error(B,{code:"commander.unknownCommand"})}version(A,Q,B){if(A===void 0)return this._version;this._version=A,Q=Q||"-V, --version",B=B||"output the version number";let D=this.createOption(Q,B);return this._versionOptionName=D.attributeName(),this._registerOption(D),this.on("option:"+D.name(),()=>{this._outputConfiguration.writeOut(`${A}
|
|
96
96
|
`),this._exit(0,"commander.version",A)}),this}description(A,Q){if(A===void 0&&Q===void 0)return this._description;if(this._description=A,Q)this._argsDescription=Q;return this}summary(A){if(A===void 0)return this._summary;return this._summary=A,this}alias(A){if(A===void 0)return this._aliases[0];let Q=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Q=this.commands[this.commands.length-1];if(A===Q._name)throw Error("Command alias can't be the same as its name");let B=this.parent?._findCommand(A);if(B){let D=[B.name()].concat(B.aliases()).join("|");throw Error(`cannot add alias '${A}' to command '${this.name()}' as already have command '${D}'`)}return Q._aliases.push(A),this}aliases(A){if(A===void 0)return this._aliases;return A.forEach((Q)=>this.alias(Q)),this}usage(A){if(A===void 0){if(this._usage)return this._usage;let Q=this.registeredArguments.map((B)=>{return USA(B)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Q:[]).join(" ")}return this._usage=A,this}name(A){if(A===void 0)return this._name;return this._name=A,this}helpGroup(A){if(A===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=A,this}commandsGroup(A){if(A===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=A,this}optionsGroup(A){if(A===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=A,this}_initOptionGroup(A){if(this._defaultOptionGroup&&!A.helpGroupHeading)A.helpGroup(this._defaultOptionGroup)}_initCommandGroup(A){if(this._defaultCommandGroup&&!A.helpGroup())A.helpGroup(this._defaultCommandGroup)}nameFromFilename(A){return this._name=wF.basename(A,wF.extname(A)),this}executableDir(A){if(A===void 0)return this._executableDir;return this._executableDir=A,this}helpInformation(A){let Q=this.createHelp(),B=this._getOutputContext(A);Q.prepareContext({error:B.error,helpWidth:B.helpWidth,outputHasColors:B.hasColors});let D=Q.formatHelp(this,Q);if(B.hasColors)return D;return this._outputConfiguration.stripColor(D)}_getOutputContext(A){A=A||{};let Q=!!A.error,B,D,E;if(Q)B=(C)=>this._outputConfiguration.writeErr(C),D=this._outputConfiguration.getErrHasColors(),E=this._outputConfiguration.getErrHelpWidth();else B=(C)=>this._outputConfiguration.writeOut(C),D=this._outputConfiguration.getOutHasColors(),E=this._outputConfiguration.getOutHelpWidth();return{error:Q,write:(C)=>{if(!D)C=this._outputConfiguration.stripColor(C);return B(C)},hasColors:D,helpWidth:E}}outputHelp(A){let Q;if(typeof A==="function")Q=A,A=void 0;let B=this._getOutputContext(A),D={error:B.error,write:B.write,command:this};this._getCommandAndAncestors().reverse().forEach((I)=>I.emit("beforeAllHelp",D)),this.emit("beforeHelp",D);let E=this.helpInformation({error:B.error});if(Q){if(E=Q(E),typeof E!=="string"&&!Buffer.isBuffer(E))throw Error("outputHelp callback must return a string or a Buffer")}if(B.write(E),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",D),this._getCommandAndAncestors().forEach((I)=>I.emit("afterAllHelp",D))}helpOption(A,Q){if(typeof A==="boolean"){if(A){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(A??"-h, --help",Q??"display help for command"),A||Q)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(A){return this._helpOption=A,this._initOptionGroup(A),this}help(A){this.outputHelp(A);let Q=Number(hD.exitCode??0);if(Q===0&&A&&typeof A!=="function"&&A.error)Q=1;this._exit(Q,"commander.help","(outputHelp)")}addHelpText(A,Q){let B=["beforeAll","before","after","afterAll"];if(!B.includes(A))throw Error(`Unexpected value for position to addHelpText.
|
|
97
97
|
Expecting one of '${B.join("', '")}'`);let D=`${A}Help`;return this.on(D,(E)=>{let I;if(typeof Q==="function")I=Q({error:E.error,command:E.command});else I=Q;if(I)E.write(`${I}
|
|
98
|
-
`)}),this}_outputHelpIfRequested(A){let Q=this._getHelpOption();if(Q&&A.find((D)=>Q.is(D)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function qo(A){return A.map((Q)=>{if(!Q.startsWith("--inspect"))return Q;let B,D="127.0.0.1",E="9229",I;if((I=Q.match(/^(--inspect(-brk)?)$/))!==null)B=I[1];else if((I=Q.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(B=I[1],/^\d+$/.test(I[3]))E=I[3];else D=I[3];else if((I=Q.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)B=I[1],D=I[3],E=I[4];if(B&&E!=="0")return`${B}=${D}:${parseInt(E)+1}`;return Q})}function x_(){if(hD.env.NO_COLOR||hD.env.FORCE_COLOR==="0"||hD.env.FORCE_COLOR==="false")return!1;if(hD.env.FORCE_COLOR||hD.env.CLICOLOR_FORCE!==void 0)return!0;return}MSA.Command=v_;MSA.useColor=x_});var Vo=c((RSA)=>{var{Argument:Zo}=Zq(),{Command:k_}=No(),{CommanderError:ZSA,InvalidArgumentError:zo}=_Y(),{Help:zSA}=T_(),{Option:Ro}=j_();RSA.program=new k_;RSA.createCommand=(A)=>new k_(A);RSA.createOption=(A,Q)=>new Ro(A,Q);RSA.createArgument=(A,Q)=>new Zo(A,Q);RSA.Command=k_;RSA.Option=Ro;RSA.Argument=Zo;RSA.Help=zSA;RSA.CommanderError=ZSA;RSA.InvalidArgumentError=zo;RSA.InvalidOptionArgumentError=zo});var dI;var K$=LA(()=>{dI={name:"@capgo/cli",type:"module",version:"7.88.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split"},devDependencies:{"@antfu/eslint-config":"^7.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.0.0","@modelcontextprotocol/sdk":"^1.25.3","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.79.0","@tanstack/intent":"^0.0.23","@types/adm-zip":"^0.5.7","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.0.0","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/react":"^18.3.28","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",eslint:"^9.38.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.0",micromatch:"^4.0.8",open:"^11.0.0",partysocket:"^1.1.11",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",ws:"^8.18.3",zod:"^4.3.6"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^5.2.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.3.3",react:"^18.3.1"}}});var Lq=c((Oo)=>{Object.defineProperty(Oo,"__esModule",{value:!0});Oo.isNXMonorepo=Oo.isMonorepo=Oo.findPackageRelativePathInMonorepo=Oo.findPackagePath=Oo.findNXMonorepoRoot=Oo.findMonorepoRoot=void 0;var xY=kA("node:fs"),v6=kA("node:path");function Vq(A){let Q=(0,v6.join)(A,"package.json"),B=(0,v6.join)(A,"pnpm-workspace.yaml");if((0,xY.existsSync)(B)||(0,xY.existsSync)(Q)&&JSON.parse((0,xY.readFileSync)(Q,"utf-8")).workspaces)return A;let D=(0,v6.dirname)(A);if(D===A)throw Error("Monorepo root not found");return Vq(D)}Oo.findMonorepoRoot=Vq;function g_(A){let Q=(0,v6.join)(A,"nx.json");if((0,xY.existsSync)(Q))return A;let B=(0,v6.dirname)(A);if(B===A)throw Error("Monorepo root not found");return g_(B)}Oo.findNXMonorepoRoot=g_;function b_(A,Q,B){let D=(0,v6.join)(Q,"node_modules",A);if((0,xY.existsSync)(D))return D;if(Q===B)return null;let E=(0,v6.dirname)(Q);return b_(A,E,B)}Oo.findPackagePath=b_;function bSA(A,Q){let B=Vq(Q),D=b_(A,Q,B);if(D)return(0,v6.relative)(Q,D);return null}Oo.findPackageRelativePathInMonorepo=bSA;function ySA(A){try{return Vq(A),!0}catch(Q){return!1}}Oo.isMonorepo=ySA;function fSA(A){try{return g_(A),!0}catch(Q){return!1}}Oo.isNXMonorepo=fSA});import{existsSync as h1}from"fs";var vY=(A=".",Q="unknown")=>{let B=`${A}/bun.lockb`,D=`${A}/bun.lock`,E=`${A}/pnpm-lock.yaml`,I=`${A}/shrinkwrap.yaml`,C=`${A}/yarn.lock`,F=`${A}/package-lock.json`,$=`${A}/npm-shrinkwrap.json`;if(h1(B)||h1(D))return"bun";if(h1(E)||h1(I))return"pnpm";if(h1(C))return"yarn";if(h1(F)||h1($))return"npm";return Q},Oq=(A=vY(),Q=!1)=>{switch(A){case"bun":return Q?"bun install":"install";case"pnpm":return Q?"pnpm install":"install";case"yarn":return Q?"yarn install":"install";case"npm":return Q?"npm install":"install";case"unknown":return Q?"unknown unknown":"unknown";default:return Q?"npm install":"install"}},To=(A=".",Q="npx")=>{let B=`${A}/bun.lockb`,D=`${A}/bun.lock`,E=`${A}/pnpm-lock.yaml`,I=`${A}/shrinkwrap.yaml`,C=`${A}/yarn.lock`,F=`${A}/package-lock.json`,$=`${A}/npm-shrinkwrap.json`;if(h1(B)||h1(D))return"bunx";if(h1(E)||h1(I))return"pnpm exec";if(h1(C))return"yarn dlx";if(h1(F)||h1($))return"npx";return Q};var jo=()=>{};function Sq(A,Q){if(isNaN(A)||isNaN(Q))throw Error("Cannot compare against non-numbers");return A===Q?0:A<Q?-1:1}function xo(A=[],Q=[]){if(A.length&&!Q.length)return-1;if(!A.length&&Q.length)return 1;return 0}function f_(A=[],Q=[]){let B=Math.max(A.length,Q.length);for(let D=0;D<B;D++){let E=A[D],I=Q[D];if(E===void 0&&I===void 0)return 0;if(I===void 0)return 1;if(E===void 0)return-1;if(typeof E==="string"&&typeof I==="number")return 1;if(typeof E==="number"&&typeof I==="string")return-1;if(E<I)return-1;if(E>I)return 1}return 0}function u_(A){return typeof A==="number"&&!Number.isNaN(A)&&(!Number.isFinite(A)||0<=A&&A<=Number.MAX_SAFE_INTEGER)}function m1(A){return A.split(".").filter(Boolean).map((Q)=>{if(iSA.test(Q)){let B=Number(Q);if(u_(B))return B}return Q})}function M4(A){return A.split(".").filter(Boolean)}function jq(A,Q){let B=Number(A);if(!u_(B))throw TypeError(Q);return B}function MF(A){return Number.isNaN(A.major)&&Number.isNaN(A.minor)&&Number.isNaN(A.patch)&&(A.prerelease===void 0||A.prerelease.length===0)&&(A.build===void 0||A.build.length===0)}var mJ="0|[1-9]\\d*",dSA="\\d*[a-zA-Z-][a-zA-Z0-9-]*",pSA,Po,vo,_o="[0-9A-Za-z-]+",ko,go,bo,yo="(?:<|>)?=?",nSA="x|X|\\*",y_,Tq,fo,uo,h_=256,iSA;var J8=LA(()=>{pSA=`(?<major>${mJ})\\.(?<minor>${mJ})\\.(?<patch>${mJ})`,Po=`(?:${mJ}|${dSA})`,vo=`(?:-(?<prerelease>${Po}(?:\\.${Po})*))`,ko=`(?:\\+(?<buildmetadata>${_o}(?:\\.${_o})*))`,go=`v?${pSA}${vo}?${ko}?`,bo=new RegExp(`^${go}$`),y_=`${mJ}|${nSA}`,Tq=`[v=\\s]*(?<major>${y_})(?:\\.(?<minor>${y_})(?:\\.(?<patch>${y_})${vo}?${ko}?)?)?`,fo=new RegExp(`^(?<operator>~>?|\\^|${yo})\\s*${Tq}$`),uo=new RegExp(`^(?<operator>${yo})\\s*(${go})$|^$`);iSA=new RegExp(`^${mJ}$`)});function X1(A,Q){if(A===Q)return 0;return Sq(A.major,Q.major)||Sq(A.minor,Q.minor)||Sq(A.patch,Q.patch)||xo(A.prerelease,Q.prerelease)||f_(A.prerelease,Q.prerelease)}var v8=LA(()=>{J8()});var ho=LA(()=>{J8()});function m_(A){return A.toFixed(0)}function c1(A){let Q=m_(A.major),B=m_(A.minor),D=m_(A.patch),E=A.prerelease?.join(".")??"",I=A.build?.join(".")??"";return[[`${Q}.${B}.${D}`,E].filter(($)=>$).join("-"),I].filter(($)=>$).join("+")}function rSA(A,Q){if(MF(Q))return!0;let B=X1(A,Q);switch(Q.operator){case"=":case void 0:return B===0;case"!=":return B!==0;case">":return B>0;case"<":return B<0;case">=":return B>=0;case"<=":return B<=0}}function Pq(A,Q){for(let B of Q)if(!rSA(A,B))return!1;if(!A.prerelease?.length)return!0;for(let B of Q){if(MF(B))continue;if(!B.prerelease?.length)continue;let{major:D,minor:E,patch:I}=B;if(A.major===D&&A.minor===E&&A.patch===I)return!0}return!1}var _q=LA(()=>{J8();v8()});function kY(A,Q){return Q.some((B)=>Pq(A,B))}var gY=LA(()=>{_q()});function aSA(A=[]){let Q=[...A],B=Q.length;while(B>=0){let D=Q[B];if(typeof D==="number"){Q[B]=D+1;break}B-=1}if(B===-1)Q.push(0);return Q}function bY(A=[],Q){let B=aSA(A);if(!Q)return B;let D=m1(Q);if(D.every((E)=>typeof E==="string")){if(D.every((E,I)=>E===B[I])&&typeof B[D.length]==="number")return B;D=[...D,0]}return D}function k6(A,Q,B={}){let D=B.build!==void 0?M4(B.build):A.build??[];switch(Q){case"premajor":return{major:A.major+1,minor:0,patch:0,prerelease:bY(A.prerelease,B.prerelease),build:D};case"preminor":return{major:A.major,minor:A.minor+1,patch:0,prerelease:bY(A.prerelease,B.prerelease),build:D};case"prepatch":return{major:A.major,minor:A.minor,patch:A.patch+1,prerelease:bY(A.prerelease,B.prerelease),build:D};case"prerelease":{let I=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:I,prerelease:bY(A.prerelease,B.prerelease),build:D}}case"major":return{major:(A.prerelease??[]).length===0||A.minor!==0||A.patch!==0?A.major+1:A.major,minor:0,patch:0,prerelease:[],build:D};case"minor":{let I=(A.prerelease??[]).length===0||A.patch!==0?A.minor+1:A.minor;return{major:A.major,minor:I,patch:0,prerelease:[],build:D}}case"patch":{let I=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:I,prerelease:[],build:D}}case"pre":return{major:A.major,minor:A.minor,patch:A.patch,prerelease:bY(A.prerelease,B.prerelease),build:D};default:throw TypeError(`Cannot increment version: invalid argument ${Q}`)}}var mo=LA(()=>{J8()});var xq,cJ;var yY=LA(()=>{xq={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},cJ={operator:void 0,...xq}});var c_=LA(()=>{yY();J8()});function l_(A,Q){return X1(A,Q)>0}var d_=LA(()=>{v8()});var co=LA(()=>{gY();d_()});function H8(A,Q){return X1(A,Q)<0}var p_=LA(()=>{v8()});var lo=LA(()=>{gY();p_()});function oSA(A){let B=A.match(uo)?.groups;if(!B)return null;let{operator:D}=B;return{operator:D||void 0,...xq}}function N0(A){return!A||A.toLowerCase()==="x"||A==="*"}function sSA(A){if(N0(A.major))return;if(N0(A.minor))return{operator:">=",major:+A.major,minor:0,patch:0,prerelease:[],build:[]};if(N0(A.patch))return{operator:">=",major:+A.major,minor:+A.minor,patch:0,prerelease:[],build:[]};return{operator:">=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:A.prerelease?m1(A.prerelease):[],build:[]}}function tSA(A){if(N0(A.major))return;if(N0(A.minor))return{operator:"<",major:+A.major+1,minor:0,patch:0,prerelease:[],build:[]};if(N0(A.patch))return{operator:"<",major:+A.major,minor:+A.minor+1,patch:0,prerelease:[],build:[]};if(A.prerelease)return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:m1(A.prerelease),build:[]};return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:[],build:[]}}function eSA(A){let Q=A.match(new RegExp(`^${Tq}`)),B=Q?.groups;if(!B)return null;let D=Q[0].length,E=A.slice(D).match(/^\s+-\s+/);if(!E)return null;let I=E[0].length,F=A.slice(D+I).match(new RegExp(`^${Tq}\\s*$`))?.groups,$=sSA(B),H=tSA(F);return[$,H].filter(Boolean)}function ATA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[cJ];if(B)return[{operator:">=",major:E,minor:0,patch:0},{operator:"<",major:E+1,minor:0,patch:0}];if(D){if(E===0)return[{operator:">=",major:E,minor:I,patch:0},{operator:"<",major:E,minor:I+1,patch:0}];return[{operator:">=",major:E,minor:I,patch:0},{operator:"<",major:E+1,minor:0,patch:0}]}let F=m1(A.prerelease??"");if(E===0){if(I===0)return[{operator:">=",major:E,minor:I,patch:C,prerelease:F},{operator:"<",major:E,minor:I,patch:C+1}];return[{operator:">=",major:E,minor:I,patch:C,prerelease:F},{operator:"<",major:E,minor:I+1,patch:0}]}return[{operator:">=",major:E,minor:I,patch:C,prerelease:F},{operator:"<",major:E+1,minor:0,patch:0}]}function QTA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[cJ];if(B)return[{operator:">=",major:E,minor:0,patch:0},{operator:"<",major:E+1,minor:0,patch:0}];if(D)return[{operator:">=",major:E,minor:I,patch:0},{operator:"<",major:E,minor:I+1,patch:0}];let F=m1(A.prerelease??"");return[{operator:">=",major:E,minor:I,patch:C,prerelease:F},{operator:"<",major:E,minor:I+1,patch:0}]}function BTA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B){if(D)return[{operator:"<",major:E,minor:0,patch:0}];return[{operator:"<",major:E,minor:0,patch:0}]}if(D)return[{operator:"<",major:E,minor:I,patch:0}];let F=m1(A.prerelease??""),$=M4(A.build??"");return[{operator:"<",major:E,minor:I,patch:C,prerelease:F,build:$}]}function DTA(A){let Q=N0(A.minor),B=N0(A.patch),D=+A.major,E=+A.minor,I=+A.patch;if(Q)return[{operator:"<",major:D+1,minor:0,patch:0}];if(B)return[{operator:"<",major:D,minor:E+1,patch:0}];let C=m1(A.prerelease??""),F=M4(A.build??"");return[{operator:"<=",major:D,minor:E,patch:I,prerelease:C,build:F}]}function ETA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B)return[{operator:">=",major:E+1,minor:0,patch:0}];if(D)return[{operator:">=",major:E,minor:I+1,patch:0}];let F=m1(A.prerelease??""),$=M4(A.build??"");return[{operator:">",major:E,minor:I,patch:C,prerelease:F,build:$}]}function ITA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[cJ];if(B)return[{operator:">=",major:E,minor:0,patch:0}];if(D)return[{operator:">=",major:E,minor:I,patch:0}];let F=m1(A.prerelease??""),$=M4(A.build??"");return[{operator:">=",major:E,minor:I,patch:C,prerelease:F,build:$}]}function CTA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[cJ];if(B)return[{operator:">=",major:E,minor:0,patch:0},{operator:"<",major:E+1,minor:0,patch:0}];if(D)return[{operator:">=",major:E,minor:I,patch:0},{operator:"<",major:E,minor:I+1,patch:0}];let F=m1(A.prerelease??""),$=M4(A.build??"");return[{operator:A.operator==="="?"=":void 0,major:E,minor:I,patch:C,prerelease:F,build:$}]}function FTA(A){let Q=A.match(fo)?.groups;if(!Q)return oSA(A);switch(Q.operator){case"^":return ATA(Q);case"~":case"~>":return QTA(Q);case"<":return BTA(Q);case"<=":return DTA(Q);case">":return ETA(Q);case">=":return ITA(Q);default:return CTA(Q)}}function GTA(A){return A.split(/\s+/).flatMap(FTA)}function vq(A){let Q=A.replaceAll(/(?<=[<>=~^])(\s+)/g,"").split(/\s*\|\|\s*/).map((B)=>eSA(B)||GTA(B));if(Q.some((B)=>B.includes(null)))throw TypeError(`Cannot parse version range: range "${A}" is invalid`);return Q}var n_=LA(()=>{J8();yY()});function oB(A){if(typeof A!=="string")throw TypeError(`Cannot parse version as version must be a string: received ${typeof A}`);if(A.length>h_)throw TypeError(`Cannot parse version as version length is too long: length is ${A.length}, max length is ${h_}`);A=A.trim();let Q=A.match(bo)?.groups;if(!Q)throw TypeError(`Cannot parse version: ${A}`);let B=jq(Q.major,`Cannot parse version ${A}: invalid major version`),D=jq(Q.minor,`Cannot parse version ${A}: invalid minor version`),E=jq(Q.patch,`Cannot parse version ${A}: invalid patch version`),I=Q.prerelease?m1(Q.prerelease):[],C=Q.buildmetadata?M4(Q.buildmetadata):[];return{major:B,minor:D,patch:E,prerelease:I,build:C}}var kq=LA(()=>{J8();J8()});function po(A,Q){let B=A.operator,D=Q.operator;if(B===void 0){if(MF(A))return!0;return kY(A,[[Q]])}if(D===void 0){if(MF(Q))return!0;return kY(Q,[[A]])}let E=X1(A,Q);return(B===">="||B===">")&&(D===">="||D===">")||(B==="<="||B==="<")&&(D==="<="||D==="<")||E===0&&((B===">="||B==="<=")&&(D===">="||D==="<="))||E===-1&&(B===">="||B===">")&&(D==="<="||D==="<")||E===1&&(B==="<="||B==="<")&&(D===">="||D===">")}function $TA(A){return A.every((Q)=>{return Q.some((B)=>JTA(B))})}function JTA(A){for(let Q=0;Q<A.length-1;Q++){let B=A[Q];for(let D of A.slice(Q+1))if(!po(B,D))return!1}return!0}function no(A,Q){return $TA([A,Q])&&A.some((B)=>{return Q.some((D)=>{return B.every((E)=>{return D.every((I)=>po(E,I))})})})}var io=LA(()=>{J8();v8();gY()});var ro=LA(()=>{n_()});var ao=LA(()=>{yY();yY();c_()});function oo(A){try{return oB(A),!0}catch{return!1}}var so=LA(()=>{kq()});var to=LA(()=>{kq()});var eo=LA(()=>{J8()});var As=LA(()=>{v8()});var Qs=LA(()=>{v8()});var Bs=LA(()=>{_q();J8();v8()});function Ds(A,Q){return X1(A,Q)>=0}var Es=LA(()=>{v8()});var Is=LA(()=>{_q();J8();v8()});var Cs=LA(()=>{v8()});var q4=LA(()=>{v8();ho();gY();mo();c_();co();lo();n_();kq();io();ro();ao();so();to();eo();As();Qs();d_();Bs();Es();p_();Is();Cs()});var l1=c((KwQ,yq)=>{var Fs,Gs,$s,Js,Hs,Ys,Xs,Us,Ws,Ks,ws,Ms,qs,gq,i_,Ns,Zs,zs,lJ,Rs,Vs,Ls,Os,Ss,Ts,js,Ps,_s,bq,xs,vs,ks;(function(A){var Q=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd)define("tslib",["exports"],function(D){A(B(Q,B(D)))});else if(typeof yq==="object"&&typeof KwQ==="object")A(B(Q,B(KwQ)));else A(B(Q));function B(D,E){if(D!==Q)if(typeof Object.create==="function")Object.defineProperty(D,"__esModule",{value:!0});else D.__esModule=!0;return function(I,C){return D[I]=E?E(I,C):C}}})(function(A){var Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,C){I.__proto__=C}||function(I,C){for(var F in C)if(Object.prototype.hasOwnProperty.call(C,F))I[F]=C[F]};Fs=function(I,C){if(typeof C!=="function"&&C!==null)throw TypeError("Class extends value "+String(C)+" is not a constructor or null");Q(I,C);function F(){this.constructor=I}I.prototype=C===null?Object.create(C):(F.prototype=C.prototype,new F)},Gs=Object.assign||function(I){for(var C,F=1,$=arguments.length;F<$;F++){C=arguments[F];for(var H in C)if(Object.prototype.hasOwnProperty.call(C,H))I[H]=C[H]}return I},$s=function(I,C){var F={};for(var $ in I)if(Object.prototype.hasOwnProperty.call(I,$)&&C.indexOf($)<0)F[$]=I[$];if(I!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var H=0,$=Object.getOwnPropertySymbols(I);H<$.length;H++)if(C.indexOf($[H])<0&&Object.prototype.propertyIsEnumerable.call(I,$[H]))F[$[H]]=I[$[H]]}return F},Js=function(I,C,F,$){var H=arguments.length,Y=H<3?C:$===null?$=Object.getOwnPropertyDescriptor(C,F):$,X;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")Y=Reflect.decorate(I,C,F,$);else for(var W=I.length-1;W>=0;W--)if(X=I[W])Y=(H<3?X(Y):H>3?X(C,F,Y):X(C,F))||Y;return H>3&&Y&&Object.defineProperty(C,F,Y),Y},Hs=function(I,C){return function(F,$){C(F,$,I)}},Ys=function(I,C,F,$,H,Y){function X(d){if(d!==void 0&&typeof d!=="function")throw TypeError("Function expected");return d}var W=$.kind,M=W==="getter"?"get":W==="setter"?"set":"value",q=!C&&I?$.static?I:I.prototype:null,Z=C||(q?Object.getOwnPropertyDescriptor(q,$.name):{}),z,R=!1;for(var O=F.length-1;O>=0;O--){var V={};for(var T in $)V[T]=T==="access"?{}:$[T];for(var T in $.access)V.access[T]=$.access[T];V.addInitializer=function(d){if(R)throw TypeError("Cannot add initializers after decoration has completed");Y.push(X(d||null))};var j=(0,F[O])(W==="accessor"?{get:Z.get,set:Z.set}:Z[M],V);if(W==="accessor"){if(j===void 0)continue;if(j===null||typeof j!=="object")throw TypeError("Object expected");if(z=X(j.get))Z.get=z;if(z=X(j.set))Z.set=z;if(z=X(j.init))H.unshift(z)}else if(z=X(j))if(W==="field")H.unshift(z);else Z[M]=z}if(q)Object.defineProperty(q,$.name,Z);R=!0},Xs=function(I,C,F){var $=arguments.length>2;for(var H=0;H<C.length;H++)F=$?C[H].call(I,F):C[H].call(I);return $?F:void 0},Us=function(I){return typeof I==="symbol"?I:"".concat(I)},Ws=function(I,C,F){if(typeof C==="symbol")C=C.description?"[".concat(C.description,"]"):"";return Object.defineProperty(I,"name",{configurable:!0,value:F?"".concat(F," ",C):C})},Ks=function(I,C){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(I,C)},ws=function(I,C,F,$){function H(Y){return Y instanceof F?Y:new F(function(X){X(Y)})}return new(F||(F=Promise))(function(Y,X){function W(Z){try{q($.next(Z))}catch(z){X(z)}}function M(Z){try{q($.throw(Z))}catch(z){X(z)}}function q(Z){Z.done?Y(Z.value):H(Z.value).then(W,M)}q(($=$.apply(I,C||[])).next())})},Ms=function(I,C){var F={label:0,sent:function(){if(Y[0]&1)throw Y[1];return Y[1]},trys:[],ops:[]},$,H,Y,X=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return X.next=W(0),X.throw=W(1),X.return=W(2),typeof Symbol==="function"&&(X[Symbol.iterator]=function(){return this}),X;function W(q){return function(Z){return M([q,Z])}}function M(q){if($)throw TypeError("Generator is already executing.");while(X&&(X=0,q[0]&&(F=0)),F)try{if($=1,H&&(Y=q[0]&2?H.return:q[0]?H.throw||((Y=H.return)&&Y.call(H),0):H.next)&&!(Y=Y.call(H,q[1])).done)return Y;if(H=0,Y)q=[q[0]&2,Y.value];switch(q[0]){case 0:case 1:Y=q;break;case 4:return F.label++,{value:q[1],done:!1};case 5:F.label++,H=q[1],q=[0];continue;case 7:q=F.ops.pop(),F.trys.pop();continue;default:if((Y=F.trys,!(Y=Y.length>0&&Y[Y.length-1]))&&(q[0]===6||q[0]===2)){F=0;continue}if(q[0]===3&&(!Y||q[1]>Y[0]&&q[1]<Y[3])){F.label=q[1];break}if(q[0]===6&&F.label<Y[1]){F.label=Y[1],Y=q;break}if(Y&&F.label<Y[2]){F.label=Y[2],F.ops.push(q);break}if(Y[2])F.ops.pop();F.trys.pop();continue}q=C.call(I,F)}catch(Z){q=[6,Z],H=0}finally{$=Y=0}if(q[0]&5)throw q[1];return{value:q[0]?q[1]:void 0,done:!0}}},qs=function(I,C){for(var F in I)if(F!=="default"&&!Object.prototype.hasOwnProperty.call(C,F))bq(C,I,F)},bq=Object.create?function(I,C,F,$){if($===void 0)$=F;var H=Object.getOwnPropertyDescriptor(C,F);if(!H||("get"in H?!C.__esModule:H.writable||H.configurable))H={enumerable:!0,get:function(){return C[F]}};Object.defineProperty(I,$,H)}:function(I,C,F,$){if($===void 0)$=F;I[$]=C[F]},gq=function(I){var C=typeof Symbol==="function"&&Symbol.iterator,F=C&&I[C],$=0;if(F)return F.call(I);if(I&&typeof I.length==="number")return{next:function(){if(I&&$>=I.length)I=void 0;return{value:I&&I[$++],done:!I}}};throw TypeError(C?"Object is not iterable.":"Symbol.iterator is not defined.")},i_=function(I,C){var F=typeof Symbol==="function"&&I[Symbol.iterator];if(!F)return I;var $=F.call(I),H,Y=[],X;try{while((C===void 0||C-- >0)&&!(H=$.next()).done)Y.push(H.value)}catch(W){X={error:W}}finally{try{if(H&&!H.done&&(F=$.return))F.call($)}finally{if(X)throw X.error}}return Y},Ns=function(){for(var I=[],C=0;C<arguments.length;C++)I=I.concat(i_(arguments[C]));return I},Zs=function(){for(var I=0,C=0,F=arguments.length;C<F;C++)I+=arguments[C].length;for(var $=Array(I),H=0,C=0;C<F;C++)for(var Y=arguments[C],X=0,W=Y.length;X<W;X++,H++)$[H]=Y[X];return $},zs=function(I,C,F){if(F||arguments.length===2){for(var $=0,H=C.length,Y;$<H;$++)if(Y||!($ in C)){if(!Y)Y=Array.prototype.slice.call(C,0,$);Y[$]=C[$]}}return I.concat(Y||Array.prototype.slice.call(C))},lJ=function(I){return this instanceof lJ?(this.v=I,this):new lJ(I)},Rs=function(I,C,F){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var $=F.apply(I,C||[]),H,Y=[];return H=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),W("next"),W("throw"),W("return",X),H[Symbol.asyncIterator]=function(){return this},H;function X(O){return function(V){return Promise.resolve(V).then(O,z)}}function W(O,V){if($[O]){if(H[O]=function(T){return new Promise(function(j,d){Y.push([O,T,j,d])>1||M(O,T)})},V)H[O]=V(H[O])}}function M(O,V){try{q($[O](V))}catch(T){R(Y[0][3],T)}}function q(O){O.value instanceof lJ?Promise.resolve(O.value.v).then(Z,z):R(Y[0][2],O)}function Z(O){M("next",O)}function z(O){M("throw",O)}function R(O,V){if(O(V),Y.shift(),Y.length)M(Y[0][0],Y[0][1])}},Vs=function(I){var C,F;return C={},$("next"),$("throw",function(H){throw H}),$("return"),C[Symbol.iterator]=function(){return this},C;function $(H,Y){C[H]=I[H]?function(X){return(F=!F)?{value:lJ(I[H](X)),done:!1}:Y?Y(X):X}:Y}},Ls=function(I){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var C=I[Symbol.asyncIterator],F;return C?C.call(I):(I=typeof gq==="function"?gq(I):I[Symbol.iterator](),F={},$("next"),$("throw"),$("return"),F[Symbol.asyncIterator]=function(){return this},F);function $(Y){F[Y]=I[Y]&&function(X){return new Promise(function(W,M){X=I[Y](X),H(W,M,X.done,X.value)})}}function H(Y,X,W,M){Promise.resolve(M).then(function(q){Y({value:q,done:W})},X)}},Os=function(I,C){if(Object.defineProperty)Object.defineProperty(I,"raw",{value:C});else I.raw=C;return I};var B=Object.create?function(I,C){Object.defineProperty(I,"default",{enumerable:!0,value:C})}:function(I,C){I.default=C},D=function(I){return D=Object.getOwnPropertyNames||function(C){var F=[];for(var $ in C)if(Object.prototype.hasOwnProperty.call(C,$))F[F.length]=$;return F},D(I)};Ss=function(I){if(I&&I.__esModule)return I;var C={};if(I!=null){for(var F=D(I),$=0;$<F.length;$++)if(F[$]!=="default")bq(C,I,F[$])}return B(C,I),C},Ts=function(I){return I&&I.__esModule?I:{default:I}},js=function(I,C,F,$){if(F==="a"&&!$)throw TypeError("Private accessor was defined without a getter");if(typeof C==="function"?I!==C||!$:!C.has(I))throw TypeError("Cannot read private member from an object whose class did not declare it");return F==="m"?$:F==="a"?$.call(I):$?$.value:C.get(I)},Ps=function(I,C,F,$,H){if($==="m")throw TypeError("Private method is not writable");if($==="a"&&!H)throw TypeError("Private accessor was defined without a setter");if(typeof C==="function"?I!==C||!H:!C.has(I))throw TypeError("Cannot write private member to an object whose class did not declare it");return $==="a"?H.call(I,F):H?H.value=F:C.set(I,F),F},_s=function(I,C){if(C===null||typeof C!=="object"&&typeof C!=="function")throw TypeError("Cannot use 'in' operator on non-object");return typeof I==="function"?C===I:I.has(C)},xs=function(I,C,F){if(C!==null&&C!==void 0){if(typeof C!=="object"&&typeof C!=="function")throw TypeError("Object expected.");var $,H;if(F){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");$=C[Symbol.asyncDispose]}if($===void 0){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");if($=C[Symbol.dispose],F)H=$}if(typeof $!=="function")throw TypeError("Object not disposable.");if(H)$=function(){try{H.call(this)}catch(Y){return Promise.reject(Y)}};I.stack.push({value:C,dispose:$,async:F})}else if(F)I.stack.push({async:!0});return C};var E=typeof SuppressedError==="function"?SuppressedError:function(I,C,F){var $=Error(F);return $.name="SuppressedError",$.error=I,$.suppressed=C,$};vs=function(I){function C(Y){I.error=I.hasError?new E(Y,I.error,"An error was suppressed during disposal."):Y,I.hasError=!0}var F,$=0;function H(){while(F=I.stack.pop())try{if(!F.async&&$===1)return $=0,I.stack.push(F),Promise.resolve().then(H);if(F.dispose){var Y=F.dispose.call(F.value);if(F.async)return $|=2,Promise.resolve(Y).then(H,function(X){return C(X),H()})}else $|=1}catch(X){C(X)}if($===1)return I.hasError?Promise.reject(I.error):Promise.resolve();if(I.hasError)throw I.error}return H()},ks=function(I,C){if(typeof I==="string"&&/^\.\.?\//.test(I))return I.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(F,$,H,Y,X){return $?C?".jsx":".js":H&&(!Y||!X)?F:H+Y+"."+X.toLowerCase()+"js"});return I},A("__extends",Fs),A("__assign",Gs),A("__rest",$s),A("__decorate",Js),A("__param",Hs),A("__esDecorate",Ys),A("__runInitializers",Xs),A("__propKey",Us),A("__setFunctionName",Ws),A("__metadata",Ks),A("__awaiter",ws),A("__generator",Ms),A("__exportStar",qs),A("__createBinding",bq),A("__values",gq),A("__read",i_),A("__spread",Ns),A("__spreadArrays",Zs),A("__spreadArray",zs),A("__await",lJ),A("__asyncGenerator",Rs),A("__asyncDelegator",Vs),A("__asyncValues",Ls),A("__makeTemplateObject",Os),A("__importStar",Ss),A("__importDefault",Ts),A("__classPrivateFieldGet",js),A("__classPrivateFieldSet",Ps),A("__classPrivateFieldIn",_s),A("__addDisposableResource",xs),A("__disposeResources",vs),A("__rewriteRelativeImportExtension",ks)})});var ys=c((gs)=>{Object.defineProperty(gs,"__esModule",{value:!0});gs.resolveFetch=void 0;var HTA=(A)=>{if(A)return(...Q)=>A(...Q);return(...Q)=>fetch(...Q)};gs.resolveFetch=HTA});var r_=c((cs)=>{Object.defineProperty(cs,"__esModule",{value:!0});cs.FunctionRegion=cs.FunctionsHttpError=cs.FunctionsRelayError=cs.FunctionsFetchError=cs.FunctionsError=void 0;class fY extends Error{constructor(A,Q="FunctionsError",B){super(A);this.name=Q,this.context=B}}cs.FunctionsError=fY;class us extends fY{constructor(A){super("Failed to send a request to the Edge Function","FunctionsFetchError",A)}}cs.FunctionsFetchError=us;class hs extends fY{constructor(A){super("Relay Error invoking the Edge Function","FunctionsRelayError",A)}}cs.FunctionsRelayError=hs;class ms extends fY{constructor(A){super("Edge Function returned a non-2xx status code","FunctionsHttpError",A)}}cs.FunctionsHttpError=ms;var fs;(function(A){A.Any="any",A.ApNortheast1="ap-northeast-1",A.ApNortheast2="ap-northeast-2",A.ApSouth1="ap-south-1",A.ApSoutheast1="ap-southeast-1",A.ApSoutheast2="ap-southeast-2",A.CaCentral1="ca-central-1",A.EuCentral1="eu-central-1",A.EuWest1="eu-west-1",A.EuWest2="eu-west-2",A.EuWest3="eu-west-3",A.SaEast1="sa-east-1",A.UsEast1="us-east-1",A.UsWest1="us-west-1",A.UsWest2="us-west-2"})(fs||(cs.FunctionRegion=fs={}))});var is=c((ps)=>{Object.defineProperty(ps,"__esModule",{value:!0});ps.FunctionsClient=void 0;var KTA=l1(),wTA=ys(),dJ=r_();class ds{constructor(A,{headers:Q={},customFetch:B,region:D=dJ.FunctionRegion.Any}={}){this.url=A,this.headers=Q,this.region=D,this.fetch=(0,wTA.resolveFetch)(B)}setAuth(A){this.headers.Authorization=`Bearer ${A}`}invoke(A){return KTA.__awaiter(this,arguments,void 0,function*(Q,B={}){var D;let E,I;try{let{headers:C,method:F,body:$,signal:H,timeout:Y}=B,X={},{region:W}=B;if(!W)W=this.region;let M=new URL(`${this.url}/${Q}`);if(W&&W!=="any")X["x-region"]=W,M.searchParams.set("forceFunctionRegion",W);let q;if($&&(C&&!Object.prototype.hasOwnProperty.call(C,"Content-Type")||!C))if(typeof Blob<"u"&&$ instanceof Blob||$ instanceof ArrayBuffer)X["Content-Type"]="application/octet-stream",q=$;else if(typeof $==="string")X["Content-Type"]="text/plain",q=$;else if(typeof FormData<"u"&&$ instanceof FormData)q=$;else X["Content-Type"]="application/json",q=JSON.stringify($);else if($&&typeof $!=="string"&&!(typeof Blob<"u"&&$ instanceof Blob)&&!($ instanceof ArrayBuffer)&&!(typeof FormData<"u"&&$ instanceof FormData))q=JSON.stringify($);else q=$;let Z=H;if(Y)if(I=new AbortController,E=setTimeout(()=>I.abort(),Y),H)Z=I.signal,H.addEventListener("abort",()=>I.abort());else Z=I.signal;let z=yield this.fetch(M.toString(),{method:F||"POST",headers:Object.assign(Object.assign(Object.assign({},X),this.headers),C),body:q,signal:Z}).catch((T)=>{throw new dJ.FunctionsFetchError(T)}),R=z.headers.get("x-relay-error");if(R&&R==="true")throw new dJ.FunctionsRelayError(z);if(!z.ok)throw new dJ.FunctionsHttpError(z);let O=((D=z.headers.get("Content-Type"))!==null&&D!==void 0?D:"text/plain").split(";")[0].trim(),V;if(O==="application/json")V=yield z.json();else if(O==="application/octet-stream"||O==="application/pdf")V=yield z.blob();else if(O==="text/event-stream")V=z;else if(O==="multipart/form-data")V=yield z.formData();else V=yield z.text();return{data:V,error:null,response:z}}catch(C){return{data:null,error:C,response:C instanceof dJ.FunctionsHttpError||C instanceof dJ.FunctionsRelayError?C.context:void 0}}finally{if(E)clearTimeout(E)}})}}ps.FunctionsClient=ds});var rs=c((g6)=>{Object.defineProperty(g6,"__esModule",{value:!0});g6.FunctionRegion=g6.FunctionsRelayError=g6.FunctionsHttpError=g6.FunctionsFetchError=g6.FunctionsError=g6.FunctionsClient=void 0;var MTA=is();Object.defineProperty(g6,"FunctionsClient",{enumerable:!0,get:function(){return MTA.FunctionsClient}});var uY=r_();Object.defineProperty(g6,"FunctionsError",{enumerable:!0,get:function(){return uY.FunctionsError}});Object.defineProperty(g6,"FunctionsFetchError",{enumerable:!0,get:function(){return uY.FunctionsFetchError}});Object.defineProperty(g6,"FunctionsHttpError",{enumerable:!0,get:function(){return uY.FunctionsHttpError}});Object.defineProperty(g6,"FunctionsRelayError",{enumerable:!0,get:function(){return uY.FunctionsRelayError}});Object.defineProperty(g6,"FunctionRegion",{enumerable:!0,get:function(){return uY.FunctionRegion}})});function hY(A){return hY=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},hY(A)}function RTA(A,Q){if(hY(A)!="object"||!A)return A;var B=A[Symbol.toPrimitive];if(B!==void 0){var D=B.call(A,Q||"default");if(hY(D)!="object")return D;throw TypeError("@@toPrimitive must return a primitive value.")}return(Q==="string"?String:Number)(A)}function VTA(A){var Q=RTA(A,"string");return hY(Q)=="symbol"?Q:Q+""}function LTA(A,Q,B){return(Q=VTA(Q))in A?Object.defineProperty(A,Q,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[Q]=B,A}function os(A,Q){var B=Object.keys(A);if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(A);Q&&(D=D.filter(function(E){return Object.getOwnPropertyDescriptor(A,E).enumerable})),B.push.apply(B,D)}return B}function fq(A){for(var Q=1;Q<arguments.length;Q++){var B=arguments[Q]!=null?arguments[Q]:{};Q%2?os(Object(B),!0).forEach(function(D){LTA(A,D,B[D])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(B)):os(Object(B)).forEach(function(D){Object.defineProperty(A,D,Object.getOwnPropertyDescriptor(B,D))})}return A}var ss,NTA=class{constructor(A){var Q,B,D;if(this.shouldThrowOnError=!1,this.method=A.method,this.url=A.url,this.headers=new Headers(A.headers),this.schema=A.schema,this.body=A.body,this.shouldThrowOnError=(Q=A.shouldThrowOnError)!==null&&Q!==void 0?Q:!1,this.signal=A.signal,this.isMaybeSingle=(B=A.isMaybeSingle)!==null&&B!==void 0?B:!1,this.urlLengthLimit=(D=A.urlLengthLimit)!==null&&D!==void 0?D:8000,A.fetch)this.fetch=A.fetch;else this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(A,Q){return this.headers=new Headers(this.headers),this.headers.set(A,Q),this}then(A,Q){var B=this;if(this.schema===void 0);else if(["GET","HEAD"].includes(this.method))this.headers.set("Accept-Profile",this.schema);else this.headers.set("Content-Profile",this.schema);if(this.method!=="GET"&&this.method!=="HEAD")this.headers.set("Content-Type","application/json");let D=this.fetch,E=D(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async(I)=>{let C=null,F=null,$=null,H=I.status,Y=I.statusText;if(I.ok){var X,W;if(B.method!=="HEAD"){var M;let R=await I.text();if(R==="");else if(B.headers.get("Accept")==="text/csv")F=R;else if(B.headers.get("Accept")&&((M=B.headers.get("Accept"))===null||M===void 0?void 0:M.includes("application/vnd.pgrst.plan+text")))F=R;else F=JSON.parse(R)}let Z=(X=B.headers.get("Prefer"))===null||X===void 0?void 0:X.match(/count=(exact|planned|estimated)/),z=(W=I.headers.get("content-range"))===null||W===void 0?void 0:W.split("/");if(Z&&z&&z.length>1)$=parseInt(z[1]);if(B.isMaybeSingle&&B.method==="GET"&&Array.isArray(F))if(F.length>1)C={code:"PGRST116",details:`Results contain ${F.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},F=null,$=null,H=406,Y="Not Acceptable";else if(F.length===1)F=F[0];else F=null}else{var q;let Z=await I.text();try{if(C=JSON.parse(Z),Array.isArray(C)&&I.status===404)F=[],C=null,H=200,Y="OK"}catch(z){if(I.status===404&&Z==="")H=204,Y="No Content";else C={message:Z}}if(C&&B.isMaybeSingle&&(C===null||C===void 0||(q=C.details)===null||q===void 0?void 0:q.includes("0 rows")))C=null,H=200,Y="OK";if(C&&B.shouldThrowOnError)throw new ss(C)}return{error:C,data:F,count:$,status:H,statusText:Y}});if(!this.shouldThrowOnError)E=E.catch((I)=>{var C;let F="",$="",H="",Y=I===null||I===void 0?void 0:I.cause;if(Y){var X,W,M,q;let R=(X=Y===null||Y===void 0?void 0:Y.message)!==null&&X!==void 0?X:"",O=(W=Y===null||Y===void 0?void 0:Y.code)!==null&&W!==void 0?W:"";if(F=`${(M=I===null||I===void 0?void 0:I.name)!==null&&M!==void 0?M:"FetchError"}: ${I===null||I===void 0?void 0:I.message}`,F+=`
|
|
98
|
+
`)}),this}_outputHelpIfRequested(A){let Q=this._getHelpOption();if(Q&&A.find((D)=>Q.is(D)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function qo(A){return A.map((Q)=>{if(!Q.startsWith("--inspect"))return Q;let B,D="127.0.0.1",E="9229",I;if((I=Q.match(/^(--inspect(-brk)?)$/))!==null)B=I[1];else if((I=Q.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(B=I[1],/^\d+$/.test(I[3]))E=I[3];else D=I[3];else if((I=Q.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)B=I[1],D=I[3],E=I[4];if(B&&E!=="0")return`${B}=${D}:${parseInt(E)+1}`;return Q})}function x_(){if(hD.env.NO_COLOR||hD.env.FORCE_COLOR==="0"||hD.env.FORCE_COLOR==="false")return!1;if(hD.env.FORCE_COLOR||hD.env.CLICOLOR_FORCE!==void 0)return!0;return}MSA.Command=v_;MSA.useColor=x_});var Vo=c((RSA)=>{var{Argument:Zo}=Zq(),{Command:k_}=No(),{CommanderError:ZSA,InvalidArgumentError:zo}=_Y(),{Help:zSA}=T_(),{Option:Ro}=j_();RSA.program=new k_;RSA.createCommand=(A)=>new k_(A);RSA.createOption=(A,Q)=>new Ro(A,Q);RSA.createArgument=(A,Q)=>new Zo(A,Q);RSA.Command=k_;RSA.Option=Ro;RSA.Argument=Zo;RSA.Help=zSA;RSA.CommanderError=ZSA;RSA.InvalidArgumentError=zo;RSA.InvalidOptionArgumentError=zo});var dI;var K$=LA(()=>{dI={name:"@capgo/cli",type:"module",version:"7.88.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split"},devDependencies:{"@antfu/eslint-config":"^7.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.5","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.0.0","@modelcontextprotocol/sdk":"^1.25.3","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.79.0","@tanstack/intent":"^0.0.23","@types/adm-zip":"^0.5.7","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.0.0","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/react":"^18.3.28","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",eslint:"^9.38.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.0",micromatch:"^4.0.8",open:"^11.0.0",partysocket:"^1.1.11",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",ws:"^8.18.3",zod:"^4.3.6"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^5.2.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.3.3",react:"^18.3.1"}}});var Lq=c((Oo)=>{Object.defineProperty(Oo,"__esModule",{value:!0});Oo.isNXMonorepo=Oo.isMonorepo=Oo.findPackageRelativePathInMonorepo=Oo.findPackagePath=Oo.findNXMonorepoRoot=Oo.findMonorepoRoot=void 0;var xY=kA("node:fs"),v6=kA("node:path");function Vq(A){let Q=(0,v6.join)(A,"package.json"),B=(0,v6.join)(A,"pnpm-workspace.yaml");if((0,xY.existsSync)(B)||(0,xY.existsSync)(Q)&&JSON.parse((0,xY.readFileSync)(Q,"utf-8")).workspaces)return A;let D=(0,v6.dirname)(A);if(D===A)throw Error("Monorepo root not found");return Vq(D)}Oo.findMonorepoRoot=Vq;function g_(A){let Q=(0,v6.join)(A,"nx.json");if((0,xY.existsSync)(Q))return A;let B=(0,v6.dirname)(A);if(B===A)throw Error("Monorepo root not found");return g_(B)}Oo.findNXMonorepoRoot=g_;function b_(A,Q,B){let D=(0,v6.join)(Q,"node_modules",A);if((0,xY.existsSync)(D))return D;if(Q===B)return null;let E=(0,v6.dirname)(Q);return b_(A,E,B)}Oo.findPackagePath=b_;function bSA(A,Q){let B=Vq(Q),D=b_(A,Q,B);if(D)return(0,v6.relative)(Q,D);return null}Oo.findPackageRelativePathInMonorepo=bSA;function ySA(A){try{return Vq(A),!0}catch(Q){return!1}}Oo.isMonorepo=ySA;function fSA(A){try{return g_(A),!0}catch(Q){return!1}}Oo.isNXMonorepo=fSA});import{existsSync as h1}from"fs";var vY=(A=".",Q="unknown")=>{let B=`${A}/bun.lockb`,D=`${A}/bun.lock`,E=`${A}/pnpm-lock.yaml`,I=`${A}/shrinkwrap.yaml`,C=`${A}/yarn.lock`,F=`${A}/package-lock.json`,$=`${A}/npm-shrinkwrap.json`;if(h1(B)||h1(D))return"bun";if(h1(E)||h1(I))return"pnpm";if(h1(C))return"yarn";if(h1(F)||h1($))return"npm";return Q},Oq=(A=vY(),Q=!1)=>{switch(A){case"bun":return Q?"bun install":"install";case"pnpm":return Q?"pnpm install":"install";case"yarn":return Q?"yarn install":"install";case"npm":return Q?"npm install":"install";case"unknown":return Q?"unknown unknown":"unknown";default:return Q?"npm install":"install"}},To=(A=".",Q="npx")=>{let B=`${A}/bun.lockb`,D=`${A}/bun.lock`,E=`${A}/pnpm-lock.yaml`,I=`${A}/shrinkwrap.yaml`,C=`${A}/yarn.lock`,F=`${A}/package-lock.json`,$=`${A}/npm-shrinkwrap.json`;if(h1(B)||h1(D))return"bunx";if(h1(E)||h1(I))return"pnpm exec";if(h1(C))return"yarn dlx";if(h1(F)||h1($))return"npx";return Q};var jo=()=>{};function Sq(A,Q){if(isNaN(A)||isNaN(Q))throw Error("Cannot compare against non-numbers");return A===Q?0:A<Q?-1:1}function xo(A=[],Q=[]){if(A.length&&!Q.length)return-1;if(!A.length&&Q.length)return 1;return 0}function f_(A=[],Q=[]){let B=Math.max(A.length,Q.length);for(let D=0;D<B;D++){let E=A[D],I=Q[D];if(E===void 0&&I===void 0)return 0;if(I===void 0)return 1;if(E===void 0)return-1;if(typeof E==="string"&&typeof I==="number")return 1;if(typeof E==="number"&&typeof I==="string")return-1;if(E<I)return-1;if(E>I)return 1}return 0}function u_(A){return typeof A==="number"&&!Number.isNaN(A)&&(!Number.isFinite(A)||0<=A&&A<=Number.MAX_SAFE_INTEGER)}function m1(A){return A.split(".").filter(Boolean).map((Q)=>{if(iSA.test(Q)){let B=Number(Q);if(u_(B))return B}return Q})}function M4(A){return A.split(".").filter(Boolean)}function jq(A,Q){let B=Number(A);if(!u_(B))throw TypeError(Q);return B}function MF(A){return Number.isNaN(A.major)&&Number.isNaN(A.minor)&&Number.isNaN(A.patch)&&(A.prerelease===void 0||A.prerelease.length===0)&&(A.build===void 0||A.build.length===0)}var mJ="0|[1-9]\\d*",dSA="\\d*[a-zA-Z-][a-zA-Z0-9-]*",pSA,Po,vo,_o="[0-9A-Za-z-]+",ko,go,bo,yo="(?:<|>)?=?",nSA="x|X|\\*",y_,Tq,fo,uo,h_=256,iSA;var J8=LA(()=>{pSA=`(?<major>${mJ})\\.(?<minor>${mJ})\\.(?<patch>${mJ})`,Po=`(?:${mJ}|${dSA})`,vo=`(?:-(?<prerelease>${Po}(?:\\.${Po})*))`,ko=`(?:\\+(?<buildmetadata>${_o}(?:\\.${_o})*))`,go=`v?${pSA}${vo}?${ko}?`,bo=new RegExp(`^${go}$`),y_=`${mJ}|${nSA}`,Tq=`[v=\\s]*(?<major>${y_})(?:\\.(?<minor>${y_})(?:\\.(?<patch>${y_})${vo}?${ko}?)?)?`,fo=new RegExp(`^(?<operator>~>?|\\^|${yo})\\s*${Tq}$`),uo=new RegExp(`^(?<operator>${yo})\\s*(${go})$|^$`);iSA=new RegExp(`^${mJ}$`)});function X1(A,Q){if(A===Q)return 0;return Sq(A.major,Q.major)||Sq(A.minor,Q.minor)||Sq(A.patch,Q.patch)||xo(A.prerelease,Q.prerelease)||f_(A.prerelease,Q.prerelease)}var v8=LA(()=>{J8()});var ho=LA(()=>{J8()});function m_(A){return A.toFixed(0)}function c1(A){let Q=m_(A.major),B=m_(A.minor),D=m_(A.patch),E=A.prerelease?.join(".")??"",I=A.build?.join(".")??"";return[[`${Q}.${B}.${D}`,E].filter(($)=>$).join("-"),I].filter(($)=>$).join("+")}function rSA(A,Q){if(MF(Q))return!0;let B=X1(A,Q);switch(Q.operator){case"=":case void 0:return B===0;case"!=":return B!==0;case">":return B>0;case"<":return B<0;case">=":return B>=0;case"<=":return B<=0}}function Pq(A,Q){for(let B of Q)if(!rSA(A,B))return!1;if(!A.prerelease?.length)return!0;for(let B of Q){if(MF(B))continue;if(!B.prerelease?.length)continue;let{major:D,minor:E,patch:I}=B;if(A.major===D&&A.minor===E&&A.patch===I)return!0}return!1}var _q=LA(()=>{J8();v8()});function kY(A,Q){return Q.some((B)=>Pq(A,B))}var gY=LA(()=>{_q()});function aSA(A=[]){let Q=[...A],B=Q.length;while(B>=0){let D=Q[B];if(typeof D==="number"){Q[B]=D+1;break}B-=1}if(B===-1)Q.push(0);return Q}function bY(A=[],Q){let B=aSA(A);if(!Q)return B;let D=m1(Q);if(D.every((E)=>typeof E==="string")){if(D.every((E,I)=>E===B[I])&&typeof B[D.length]==="number")return B;D=[...D,0]}return D}function k6(A,Q,B={}){let D=B.build!==void 0?M4(B.build):A.build??[];switch(Q){case"premajor":return{major:A.major+1,minor:0,patch:0,prerelease:bY(A.prerelease,B.prerelease),build:D};case"preminor":return{major:A.major,minor:A.minor+1,patch:0,prerelease:bY(A.prerelease,B.prerelease),build:D};case"prepatch":return{major:A.major,minor:A.minor,patch:A.patch+1,prerelease:bY(A.prerelease,B.prerelease),build:D};case"prerelease":{let I=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:I,prerelease:bY(A.prerelease,B.prerelease),build:D}}case"major":return{major:(A.prerelease??[]).length===0||A.minor!==0||A.patch!==0?A.major+1:A.major,minor:0,patch:0,prerelease:[],build:D};case"minor":{let I=(A.prerelease??[]).length===0||A.patch!==0?A.minor+1:A.minor;return{major:A.major,minor:I,patch:0,prerelease:[],build:D}}case"patch":{let I=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:I,prerelease:[],build:D}}case"pre":return{major:A.major,minor:A.minor,patch:A.patch,prerelease:bY(A.prerelease,B.prerelease),build:D};default:throw TypeError(`Cannot increment version: invalid argument ${Q}`)}}var mo=LA(()=>{J8()});var xq,cJ;var yY=LA(()=>{xq={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},cJ={operator:void 0,...xq}});var c_=LA(()=>{yY();J8()});function l_(A,Q){return X1(A,Q)>0}var d_=LA(()=>{v8()});var co=LA(()=>{gY();d_()});function H8(A,Q){return X1(A,Q)<0}var p_=LA(()=>{v8()});var lo=LA(()=>{gY();p_()});function oSA(A){let B=A.match(uo)?.groups;if(!B)return null;let{operator:D}=B;return{operator:D||void 0,...xq}}function N0(A){return!A||A.toLowerCase()==="x"||A==="*"}function sSA(A){if(N0(A.major))return;if(N0(A.minor))return{operator:">=",major:+A.major,minor:0,patch:0,prerelease:[],build:[]};if(N0(A.patch))return{operator:">=",major:+A.major,minor:+A.minor,patch:0,prerelease:[],build:[]};return{operator:">=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:A.prerelease?m1(A.prerelease):[],build:[]}}function tSA(A){if(N0(A.major))return;if(N0(A.minor))return{operator:"<",major:+A.major+1,minor:0,patch:0,prerelease:[],build:[]};if(N0(A.patch))return{operator:"<",major:+A.major,minor:+A.minor+1,patch:0,prerelease:[],build:[]};if(A.prerelease)return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:m1(A.prerelease),build:[]};return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:[],build:[]}}function eSA(A){let Q=A.match(new RegExp(`^${Tq}`)),B=Q?.groups;if(!B)return null;let D=Q[0].length,E=A.slice(D).match(/^\s+-\s+/);if(!E)return null;let I=E[0].length,F=A.slice(D+I).match(new RegExp(`^${Tq}\\s*$`))?.groups,$=sSA(B),H=tSA(F);return[$,H].filter(Boolean)}function ATA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[cJ];if(B)return[{operator:">=",major:E,minor:0,patch:0},{operator:"<",major:E+1,minor:0,patch:0}];if(D){if(E===0)return[{operator:">=",major:E,minor:I,patch:0},{operator:"<",major:E,minor:I+1,patch:0}];return[{operator:">=",major:E,minor:I,patch:0},{operator:"<",major:E+1,minor:0,patch:0}]}let F=m1(A.prerelease??"");if(E===0){if(I===0)return[{operator:">=",major:E,minor:I,patch:C,prerelease:F},{operator:"<",major:E,minor:I,patch:C+1}];return[{operator:">=",major:E,minor:I,patch:C,prerelease:F},{operator:"<",major:E,minor:I+1,patch:0}]}return[{operator:">=",major:E,minor:I,patch:C,prerelease:F},{operator:"<",major:E+1,minor:0,patch:0}]}function QTA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[cJ];if(B)return[{operator:">=",major:E,minor:0,patch:0},{operator:"<",major:E+1,minor:0,patch:0}];if(D)return[{operator:">=",major:E,minor:I,patch:0},{operator:"<",major:E,minor:I+1,patch:0}];let F=m1(A.prerelease??"");return[{operator:">=",major:E,minor:I,patch:C,prerelease:F},{operator:"<",major:E,minor:I+1,patch:0}]}function BTA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B){if(D)return[{operator:"<",major:E,minor:0,patch:0}];return[{operator:"<",major:E,minor:0,patch:0}]}if(D)return[{operator:"<",major:E,minor:I,patch:0}];let F=m1(A.prerelease??""),$=M4(A.build??"");return[{operator:"<",major:E,minor:I,patch:C,prerelease:F,build:$}]}function DTA(A){let Q=N0(A.minor),B=N0(A.patch),D=+A.major,E=+A.minor,I=+A.patch;if(Q)return[{operator:"<",major:D+1,minor:0,patch:0}];if(B)return[{operator:"<",major:D,minor:E+1,patch:0}];let C=m1(A.prerelease??""),F=M4(A.build??"");return[{operator:"<=",major:D,minor:E,patch:I,prerelease:C,build:F}]}function ETA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B)return[{operator:">=",major:E+1,minor:0,patch:0}];if(D)return[{operator:">=",major:E,minor:I+1,patch:0}];let F=m1(A.prerelease??""),$=M4(A.build??"");return[{operator:">",major:E,minor:I,patch:C,prerelease:F,build:$}]}function ITA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[cJ];if(B)return[{operator:">=",major:E,minor:0,patch:0}];if(D)return[{operator:">=",major:E,minor:I,patch:0}];let F=m1(A.prerelease??""),$=M4(A.build??"");return[{operator:">=",major:E,minor:I,patch:C,prerelease:F,build:$}]}function CTA(A){let Q=N0(A.major),B=N0(A.minor),D=N0(A.patch),E=+A.major,I=+A.minor,C=+A.patch;if(Q)return[cJ];if(B)return[{operator:">=",major:E,minor:0,patch:0},{operator:"<",major:E+1,minor:0,patch:0}];if(D)return[{operator:">=",major:E,minor:I,patch:0},{operator:"<",major:E,minor:I+1,patch:0}];let F=m1(A.prerelease??""),$=M4(A.build??"");return[{operator:A.operator==="="?"=":void 0,major:E,minor:I,patch:C,prerelease:F,build:$}]}function FTA(A){let Q=A.match(fo)?.groups;if(!Q)return oSA(A);switch(Q.operator){case"^":return ATA(Q);case"~":case"~>":return QTA(Q);case"<":return BTA(Q);case"<=":return DTA(Q);case">":return ETA(Q);case">=":return ITA(Q);default:return CTA(Q)}}function GTA(A){return A.split(/\s+/).flatMap(FTA)}function vq(A){let Q=A.replaceAll(/(?<=[<>=~^])(\s+)/g,"").split(/\s*\|\|\s*/).map((B)=>eSA(B)||GTA(B));if(Q.some((B)=>B.includes(null)))throw TypeError(`Cannot parse version range: range "${A}" is invalid`);return Q}var n_=LA(()=>{J8();yY()});function oB(A){if(typeof A!=="string")throw TypeError(`Cannot parse version as version must be a string: received ${typeof A}`);if(A.length>h_)throw TypeError(`Cannot parse version as version length is too long: length is ${A.length}, max length is ${h_}`);A=A.trim();let Q=A.match(bo)?.groups;if(!Q)throw TypeError(`Cannot parse version: ${A}`);let B=jq(Q.major,`Cannot parse version ${A}: invalid major version`),D=jq(Q.minor,`Cannot parse version ${A}: invalid minor version`),E=jq(Q.patch,`Cannot parse version ${A}: invalid patch version`),I=Q.prerelease?m1(Q.prerelease):[],C=Q.buildmetadata?M4(Q.buildmetadata):[];return{major:B,minor:D,patch:E,prerelease:I,build:C}}var kq=LA(()=>{J8();J8()});function po(A,Q){let B=A.operator,D=Q.operator;if(B===void 0){if(MF(A))return!0;return kY(A,[[Q]])}if(D===void 0){if(MF(Q))return!0;return kY(Q,[[A]])}let E=X1(A,Q);return(B===">="||B===">")&&(D===">="||D===">")||(B==="<="||B==="<")&&(D==="<="||D==="<")||E===0&&((B===">="||B==="<=")&&(D===">="||D==="<="))||E===-1&&(B===">="||B===">")&&(D==="<="||D==="<")||E===1&&(B==="<="||B==="<")&&(D===">="||D===">")}function $TA(A){return A.every((Q)=>{return Q.some((B)=>JTA(B))})}function JTA(A){for(let Q=0;Q<A.length-1;Q++){let B=A[Q];for(let D of A.slice(Q+1))if(!po(B,D))return!1}return!0}function no(A,Q){return $TA([A,Q])&&A.some((B)=>{return Q.some((D)=>{return B.every((E)=>{return D.every((I)=>po(E,I))})})})}var io=LA(()=>{J8();v8();gY()});var ro=LA(()=>{n_()});var ao=LA(()=>{yY();yY();c_()});function oo(A){try{return oB(A),!0}catch{return!1}}var so=LA(()=>{kq()});var to=LA(()=>{kq()});var eo=LA(()=>{J8()});var As=LA(()=>{v8()});var Qs=LA(()=>{v8()});var Bs=LA(()=>{_q();J8();v8()});function Ds(A,Q){return X1(A,Q)>=0}var Es=LA(()=>{v8()});var Is=LA(()=>{_q();J8();v8()});var Cs=LA(()=>{v8()});var q4=LA(()=>{v8();ho();gY();mo();c_();co();lo();n_();kq();io();ro();ao();so();to();eo();As();Qs();d_();Bs();Es();p_();Is();Cs()});var l1=c((KwQ,yq)=>{var Fs,Gs,$s,Js,Hs,Ys,Xs,Us,Ws,Ks,ws,Ms,qs,gq,i_,Ns,Zs,zs,lJ,Rs,Vs,Ls,Os,Ss,Ts,js,Ps,_s,bq,xs,vs,ks;(function(A){var Q=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd)define("tslib",["exports"],function(D){A(B(Q,B(D)))});else if(typeof yq==="object"&&typeof KwQ==="object")A(B(Q,B(KwQ)));else A(B(Q));function B(D,E){if(D!==Q)if(typeof Object.create==="function")Object.defineProperty(D,"__esModule",{value:!0});else D.__esModule=!0;return function(I,C){return D[I]=E?E(I,C):C}}})(function(A){var Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,C){I.__proto__=C}||function(I,C){for(var F in C)if(Object.prototype.hasOwnProperty.call(C,F))I[F]=C[F]};Fs=function(I,C){if(typeof C!=="function"&&C!==null)throw TypeError("Class extends value "+String(C)+" is not a constructor or null");Q(I,C);function F(){this.constructor=I}I.prototype=C===null?Object.create(C):(F.prototype=C.prototype,new F)},Gs=Object.assign||function(I){for(var C,F=1,$=arguments.length;F<$;F++){C=arguments[F];for(var H in C)if(Object.prototype.hasOwnProperty.call(C,H))I[H]=C[H]}return I},$s=function(I,C){var F={};for(var $ in I)if(Object.prototype.hasOwnProperty.call(I,$)&&C.indexOf($)<0)F[$]=I[$];if(I!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var H=0,$=Object.getOwnPropertySymbols(I);H<$.length;H++)if(C.indexOf($[H])<0&&Object.prototype.propertyIsEnumerable.call(I,$[H]))F[$[H]]=I[$[H]]}return F},Js=function(I,C,F,$){var H=arguments.length,Y=H<3?C:$===null?$=Object.getOwnPropertyDescriptor(C,F):$,X;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")Y=Reflect.decorate(I,C,F,$);else for(var W=I.length-1;W>=0;W--)if(X=I[W])Y=(H<3?X(Y):H>3?X(C,F,Y):X(C,F))||Y;return H>3&&Y&&Object.defineProperty(C,F,Y),Y},Hs=function(I,C){return function(F,$){C(F,$,I)}},Ys=function(I,C,F,$,H,Y){function X(d){if(d!==void 0&&typeof d!=="function")throw TypeError("Function expected");return d}var W=$.kind,M=W==="getter"?"get":W==="setter"?"set":"value",q=!C&&I?$.static?I:I.prototype:null,Z=C||(q?Object.getOwnPropertyDescriptor(q,$.name):{}),z,R=!1;for(var O=F.length-1;O>=0;O--){var V={};for(var T in $)V[T]=T==="access"?{}:$[T];for(var T in $.access)V.access[T]=$.access[T];V.addInitializer=function(d){if(R)throw TypeError("Cannot add initializers after decoration has completed");Y.push(X(d||null))};var j=(0,F[O])(W==="accessor"?{get:Z.get,set:Z.set}:Z[M],V);if(W==="accessor"){if(j===void 0)continue;if(j===null||typeof j!=="object")throw TypeError("Object expected");if(z=X(j.get))Z.get=z;if(z=X(j.set))Z.set=z;if(z=X(j.init))H.unshift(z)}else if(z=X(j))if(W==="field")H.unshift(z);else Z[M]=z}if(q)Object.defineProperty(q,$.name,Z);R=!0},Xs=function(I,C,F){var $=arguments.length>2;for(var H=0;H<C.length;H++)F=$?C[H].call(I,F):C[H].call(I);return $?F:void 0},Us=function(I){return typeof I==="symbol"?I:"".concat(I)},Ws=function(I,C,F){if(typeof C==="symbol")C=C.description?"[".concat(C.description,"]"):"";return Object.defineProperty(I,"name",{configurable:!0,value:F?"".concat(F," ",C):C})},Ks=function(I,C){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(I,C)},ws=function(I,C,F,$){function H(Y){return Y instanceof F?Y:new F(function(X){X(Y)})}return new(F||(F=Promise))(function(Y,X){function W(Z){try{q($.next(Z))}catch(z){X(z)}}function M(Z){try{q($.throw(Z))}catch(z){X(z)}}function q(Z){Z.done?Y(Z.value):H(Z.value).then(W,M)}q(($=$.apply(I,C||[])).next())})},Ms=function(I,C){var F={label:0,sent:function(){if(Y[0]&1)throw Y[1];return Y[1]},trys:[],ops:[]},$,H,Y,X=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return X.next=W(0),X.throw=W(1),X.return=W(2),typeof Symbol==="function"&&(X[Symbol.iterator]=function(){return this}),X;function W(q){return function(Z){return M([q,Z])}}function M(q){if($)throw TypeError("Generator is already executing.");while(X&&(X=0,q[0]&&(F=0)),F)try{if($=1,H&&(Y=q[0]&2?H.return:q[0]?H.throw||((Y=H.return)&&Y.call(H),0):H.next)&&!(Y=Y.call(H,q[1])).done)return Y;if(H=0,Y)q=[q[0]&2,Y.value];switch(q[0]){case 0:case 1:Y=q;break;case 4:return F.label++,{value:q[1],done:!1};case 5:F.label++,H=q[1],q=[0];continue;case 7:q=F.ops.pop(),F.trys.pop();continue;default:if((Y=F.trys,!(Y=Y.length>0&&Y[Y.length-1]))&&(q[0]===6||q[0]===2)){F=0;continue}if(q[0]===3&&(!Y||q[1]>Y[0]&&q[1]<Y[3])){F.label=q[1];break}if(q[0]===6&&F.label<Y[1]){F.label=Y[1],Y=q;break}if(Y&&F.label<Y[2]){F.label=Y[2],F.ops.push(q);break}if(Y[2])F.ops.pop();F.trys.pop();continue}q=C.call(I,F)}catch(Z){q=[6,Z],H=0}finally{$=Y=0}if(q[0]&5)throw q[1];return{value:q[0]?q[1]:void 0,done:!0}}},qs=function(I,C){for(var F in I)if(F!=="default"&&!Object.prototype.hasOwnProperty.call(C,F))bq(C,I,F)},bq=Object.create?function(I,C,F,$){if($===void 0)$=F;var H=Object.getOwnPropertyDescriptor(C,F);if(!H||("get"in H?!C.__esModule:H.writable||H.configurable))H={enumerable:!0,get:function(){return C[F]}};Object.defineProperty(I,$,H)}:function(I,C,F,$){if($===void 0)$=F;I[$]=C[F]},gq=function(I){var C=typeof Symbol==="function"&&Symbol.iterator,F=C&&I[C],$=0;if(F)return F.call(I);if(I&&typeof I.length==="number")return{next:function(){if(I&&$>=I.length)I=void 0;return{value:I&&I[$++],done:!I}}};throw TypeError(C?"Object is not iterable.":"Symbol.iterator is not defined.")},i_=function(I,C){var F=typeof Symbol==="function"&&I[Symbol.iterator];if(!F)return I;var $=F.call(I),H,Y=[],X;try{while((C===void 0||C-- >0)&&!(H=$.next()).done)Y.push(H.value)}catch(W){X={error:W}}finally{try{if(H&&!H.done&&(F=$.return))F.call($)}finally{if(X)throw X.error}}return Y},Ns=function(){for(var I=[],C=0;C<arguments.length;C++)I=I.concat(i_(arguments[C]));return I},Zs=function(){for(var I=0,C=0,F=arguments.length;C<F;C++)I+=arguments[C].length;for(var $=Array(I),H=0,C=0;C<F;C++)for(var Y=arguments[C],X=0,W=Y.length;X<W;X++,H++)$[H]=Y[X];return $},zs=function(I,C,F){if(F||arguments.length===2){for(var $=0,H=C.length,Y;$<H;$++)if(Y||!($ in C)){if(!Y)Y=Array.prototype.slice.call(C,0,$);Y[$]=C[$]}}return I.concat(Y||Array.prototype.slice.call(C))},lJ=function(I){return this instanceof lJ?(this.v=I,this):new lJ(I)},Rs=function(I,C,F){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var $=F.apply(I,C||[]),H,Y=[];return H=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),W("next"),W("throw"),W("return",X),H[Symbol.asyncIterator]=function(){return this},H;function X(O){return function(V){return Promise.resolve(V).then(O,z)}}function W(O,V){if($[O]){if(H[O]=function(T){return new Promise(function(j,d){Y.push([O,T,j,d])>1||M(O,T)})},V)H[O]=V(H[O])}}function M(O,V){try{q($[O](V))}catch(T){R(Y[0][3],T)}}function q(O){O.value instanceof lJ?Promise.resolve(O.value.v).then(Z,z):R(Y[0][2],O)}function Z(O){M("next",O)}function z(O){M("throw",O)}function R(O,V){if(O(V),Y.shift(),Y.length)M(Y[0][0],Y[0][1])}},Vs=function(I){var C,F;return C={},$("next"),$("throw",function(H){throw H}),$("return"),C[Symbol.iterator]=function(){return this},C;function $(H,Y){C[H]=I[H]?function(X){return(F=!F)?{value:lJ(I[H](X)),done:!1}:Y?Y(X):X}:Y}},Ls=function(I){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var C=I[Symbol.asyncIterator],F;return C?C.call(I):(I=typeof gq==="function"?gq(I):I[Symbol.iterator](),F={},$("next"),$("throw"),$("return"),F[Symbol.asyncIterator]=function(){return this},F);function $(Y){F[Y]=I[Y]&&function(X){return new Promise(function(W,M){X=I[Y](X),H(W,M,X.done,X.value)})}}function H(Y,X,W,M){Promise.resolve(M).then(function(q){Y({value:q,done:W})},X)}},Os=function(I,C){if(Object.defineProperty)Object.defineProperty(I,"raw",{value:C});else I.raw=C;return I};var B=Object.create?function(I,C){Object.defineProperty(I,"default",{enumerable:!0,value:C})}:function(I,C){I.default=C},D=function(I){return D=Object.getOwnPropertyNames||function(C){var F=[];for(var $ in C)if(Object.prototype.hasOwnProperty.call(C,$))F[F.length]=$;return F},D(I)};Ss=function(I){if(I&&I.__esModule)return I;var C={};if(I!=null){for(var F=D(I),$=0;$<F.length;$++)if(F[$]!=="default")bq(C,I,F[$])}return B(C,I),C},Ts=function(I){return I&&I.__esModule?I:{default:I}},js=function(I,C,F,$){if(F==="a"&&!$)throw TypeError("Private accessor was defined without a getter");if(typeof C==="function"?I!==C||!$:!C.has(I))throw TypeError("Cannot read private member from an object whose class did not declare it");return F==="m"?$:F==="a"?$.call(I):$?$.value:C.get(I)},Ps=function(I,C,F,$,H){if($==="m")throw TypeError("Private method is not writable");if($==="a"&&!H)throw TypeError("Private accessor was defined without a setter");if(typeof C==="function"?I!==C||!H:!C.has(I))throw TypeError("Cannot write private member to an object whose class did not declare it");return $==="a"?H.call(I,F):H?H.value=F:C.set(I,F),F},_s=function(I,C){if(C===null||typeof C!=="object"&&typeof C!=="function")throw TypeError("Cannot use 'in' operator on non-object");return typeof I==="function"?C===I:I.has(C)},xs=function(I,C,F){if(C!==null&&C!==void 0){if(typeof C!=="object"&&typeof C!=="function")throw TypeError("Object expected.");var $,H;if(F){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");$=C[Symbol.asyncDispose]}if($===void 0){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");if($=C[Symbol.dispose],F)H=$}if(typeof $!=="function")throw TypeError("Object not disposable.");if(H)$=function(){try{H.call(this)}catch(Y){return Promise.reject(Y)}};I.stack.push({value:C,dispose:$,async:F})}else if(F)I.stack.push({async:!0});return C};var E=typeof SuppressedError==="function"?SuppressedError:function(I,C,F){var $=Error(F);return $.name="SuppressedError",$.error=I,$.suppressed=C,$};vs=function(I){function C(Y){I.error=I.hasError?new E(Y,I.error,"An error was suppressed during disposal."):Y,I.hasError=!0}var F,$=0;function H(){while(F=I.stack.pop())try{if(!F.async&&$===1)return $=0,I.stack.push(F),Promise.resolve().then(H);if(F.dispose){var Y=F.dispose.call(F.value);if(F.async)return $|=2,Promise.resolve(Y).then(H,function(X){return C(X),H()})}else $|=1}catch(X){C(X)}if($===1)return I.hasError?Promise.reject(I.error):Promise.resolve();if(I.hasError)throw I.error}return H()},ks=function(I,C){if(typeof I==="string"&&/^\.\.?\//.test(I))return I.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(F,$,H,Y,X){return $?C?".jsx":".js":H&&(!Y||!X)?F:H+Y+"."+X.toLowerCase()+"js"});return I},A("__extends",Fs),A("__assign",Gs),A("__rest",$s),A("__decorate",Js),A("__param",Hs),A("__esDecorate",Ys),A("__runInitializers",Xs),A("__propKey",Us),A("__setFunctionName",Ws),A("__metadata",Ks),A("__awaiter",ws),A("__generator",Ms),A("__exportStar",qs),A("__createBinding",bq),A("__values",gq),A("__read",i_),A("__spread",Ns),A("__spreadArrays",Zs),A("__spreadArray",zs),A("__await",lJ),A("__asyncGenerator",Rs),A("__asyncDelegator",Vs),A("__asyncValues",Ls),A("__makeTemplateObject",Os),A("__importStar",Ss),A("__importDefault",Ts),A("__classPrivateFieldGet",js),A("__classPrivateFieldSet",Ps),A("__classPrivateFieldIn",_s),A("__addDisposableResource",xs),A("__disposeResources",vs),A("__rewriteRelativeImportExtension",ks)})});var ys=c((gs)=>{Object.defineProperty(gs,"__esModule",{value:!0});gs.resolveFetch=void 0;var HTA=(A)=>{if(A)return(...Q)=>A(...Q);return(...Q)=>fetch(...Q)};gs.resolveFetch=HTA});var r_=c((cs)=>{Object.defineProperty(cs,"__esModule",{value:!0});cs.FunctionRegion=cs.FunctionsHttpError=cs.FunctionsRelayError=cs.FunctionsFetchError=cs.FunctionsError=void 0;class fY extends Error{constructor(A,Q="FunctionsError",B){super(A);this.name=Q,this.context=B}}cs.FunctionsError=fY;class us extends fY{constructor(A){super("Failed to send a request to the Edge Function","FunctionsFetchError",A)}}cs.FunctionsFetchError=us;class hs extends fY{constructor(A){super("Relay Error invoking the Edge Function","FunctionsRelayError",A)}}cs.FunctionsRelayError=hs;class ms extends fY{constructor(A){super("Edge Function returned a non-2xx status code","FunctionsHttpError",A)}}cs.FunctionsHttpError=ms;var fs;(function(A){A.Any="any",A.ApNortheast1="ap-northeast-1",A.ApNortheast2="ap-northeast-2",A.ApSouth1="ap-south-1",A.ApSoutheast1="ap-southeast-1",A.ApSoutheast2="ap-southeast-2",A.CaCentral1="ca-central-1",A.EuCentral1="eu-central-1",A.EuWest1="eu-west-1",A.EuWest2="eu-west-2",A.EuWest3="eu-west-3",A.SaEast1="sa-east-1",A.UsEast1="us-east-1",A.UsWest1="us-west-1",A.UsWest2="us-west-2"})(fs||(cs.FunctionRegion=fs={}))});var is=c((ps)=>{Object.defineProperty(ps,"__esModule",{value:!0});ps.FunctionsClient=void 0;var KTA=l1(),wTA=ys(),dJ=r_();class ds{constructor(A,{headers:Q={},customFetch:B,region:D=dJ.FunctionRegion.Any}={}){this.url=A,this.headers=Q,this.region=D,this.fetch=(0,wTA.resolveFetch)(B)}setAuth(A){this.headers.Authorization=`Bearer ${A}`}invoke(A){return KTA.__awaiter(this,arguments,void 0,function*(Q,B={}){var D;let E,I;try{let{headers:C,method:F,body:$,signal:H,timeout:Y}=B,X={},{region:W}=B;if(!W)W=this.region;let M=new URL(`${this.url}/${Q}`);if(W&&W!=="any")X["x-region"]=W,M.searchParams.set("forceFunctionRegion",W);let q;if($&&(C&&!Object.prototype.hasOwnProperty.call(C,"Content-Type")||!C))if(typeof Blob<"u"&&$ instanceof Blob||$ instanceof ArrayBuffer)X["Content-Type"]="application/octet-stream",q=$;else if(typeof $==="string")X["Content-Type"]="text/plain",q=$;else if(typeof FormData<"u"&&$ instanceof FormData)q=$;else X["Content-Type"]="application/json",q=JSON.stringify($);else if($&&typeof $!=="string"&&!(typeof Blob<"u"&&$ instanceof Blob)&&!($ instanceof ArrayBuffer)&&!(typeof FormData<"u"&&$ instanceof FormData))q=JSON.stringify($);else q=$;let Z=H;if(Y)if(I=new AbortController,E=setTimeout(()=>I.abort(),Y),H)Z=I.signal,H.addEventListener("abort",()=>I.abort());else Z=I.signal;let z=yield this.fetch(M.toString(),{method:F||"POST",headers:Object.assign(Object.assign(Object.assign({},X),this.headers),C),body:q,signal:Z}).catch((T)=>{throw new dJ.FunctionsFetchError(T)}),R=z.headers.get("x-relay-error");if(R&&R==="true")throw new dJ.FunctionsRelayError(z);if(!z.ok)throw new dJ.FunctionsHttpError(z);let O=((D=z.headers.get("Content-Type"))!==null&&D!==void 0?D:"text/plain").split(";")[0].trim(),V;if(O==="application/json")V=yield z.json();else if(O==="application/octet-stream"||O==="application/pdf")V=yield z.blob();else if(O==="text/event-stream")V=z;else if(O==="multipart/form-data")V=yield z.formData();else V=yield z.text();return{data:V,error:null,response:z}}catch(C){return{data:null,error:C,response:C instanceof dJ.FunctionsHttpError||C instanceof dJ.FunctionsRelayError?C.context:void 0}}finally{if(E)clearTimeout(E)}})}}ps.FunctionsClient=ds});var rs=c((g6)=>{Object.defineProperty(g6,"__esModule",{value:!0});g6.FunctionRegion=g6.FunctionsRelayError=g6.FunctionsHttpError=g6.FunctionsFetchError=g6.FunctionsError=g6.FunctionsClient=void 0;var MTA=is();Object.defineProperty(g6,"FunctionsClient",{enumerable:!0,get:function(){return MTA.FunctionsClient}});var uY=r_();Object.defineProperty(g6,"FunctionsError",{enumerable:!0,get:function(){return uY.FunctionsError}});Object.defineProperty(g6,"FunctionsFetchError",{enumerable:!0,get:function(){return uY.FunctionsFetchError}});Object.defineProperty(g6,"FunctionsHttpError",{enumerable:!0,get:function(){return uY.FunctionsHttpError}});Object.defineProperty(g6,"FunctionsRelayError",{enumerable:!0,get:function(){return uY.FunctionsRelayError}});Object.defineProperty(g6,"FunctionRegion",{enumerable:!0,get:function(){return uY.FunctionRegion}})});function hY(A){return hY=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},hY(A)}function RTA(A,Q){if(hY(A)!="object"||!A)return A;var B=A[Symbol.toPrimitive];if(B!==void 0){var D=B.call(A,Q||"default");if(hY(D)!="object")return D;throw TypeError("@@toPrimitive must return a primitive value.")}return(Q==="string"?String:Number)(A)}function VTA(A){var Q=RTA(A,"string");return hY(Q)=="symbol"?Q:Q+""}function LTA(A,Q,B){return(Q=VTA(Q))in A?Object.defineProperty(A,Q,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[Q]=B,A}function os(A,Q){var B=Object.keys(A);if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(A);Q&&(D=D.filter(function(E){return Object.getOwnPropertyDescriptor(A,E).enumerable})),B.push.apply(B,D)}return B}function fq(A){for(var Q=1;Q<arguments.length;Q++){var B=arguments[Q]!=null?arguments[Q]:{};Q%2?os(Object(B),!0).forEach(function(D){LTA(A,D,B[D])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(B)):os(Object(B)).forEach(function(D){Object.defineProperty(A,D,Object.getOwnPropertyDescriptor(B,D))})}return A}var ss,NTA=class{constructor(A){var Q,B,D;if(this.shouldThrowOnError=!1,this.method=A.method,this.url=A.url,this.headers=new Headers(A.headers),this.schema=A.schema,this.body=A.body,this.shouldThrowOnError=(Q=A.shouldThrowOnError)!==null&&Q!==void 0?Q:!1,this.signal=A.signal,this.isMaybeSingle=(B=A.isMaybeSingle)!==null&&B!==void 0?B:!1,this.urlLengthLimit=(D=A.urlLengthLimit)!==null&&D!==void 0?D:8000,A.fetch)this.fetch=A.fetch;else this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(A,Q){return this.headers=new Headers(this.headers),this.headers.set(A,Q),this}then(A,Q){var B=this;if(this.schema===void 0);else if(["GET","HEAD"].includes(this.method))this.headers.set("Accept-Profile",this.schema);else this.headers.set("Content-Profile",this.schema);if(this.method!=="GET"&&this.method!=="HEAD")this.headers.set("Content-Type","application/json");let D=this.fetch,E=D(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async(I)=>{let C=null,F=null,$=null,H=I.status,Y=I.statusText;if(I.ok){var X,W;if(B.method!=="HEAD"){var M;let R=await I.text();if(R==="");else if(B.headers.get("Accept")==="text/csv")F=R;else if(B.headers.get("Accept")&&((M=B.headers.get("Accept"))===null||M===void 0?void 0:M.includes("application/vnd.pgrst.plan+text")))F=R;else F=JSON.parse(R)}let Z=(X=B.headers.get("Prefer"))===null||X===void 0?void 0:X.match(/count=(exact|planned|estimated)/),z=(W=I.headers.get("content-range"))===null||W===void 0?void 0:W.split("/");if(Z&&z&&z.length>1)$=parseInt(z[1]);if(B.isMaybeSingle&&B.method==="GET"&&Array.isArray(F))if(F.length>1)C={code:"PGRST116",details:`Results contain ${F.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},F=null,$=null,H=406,Y="Not Acceptable";else if(F.length===1)F=F[0];else F=null}else{var q;let Z=await I.text();try{if(C=JSON.parse(Z),Array.isArray(C)&&I.status===404)F=[],C=null,H=200,Y="OK"}catch(z){if(I.status===404&&Z==="")H=204,Y="No Content";else C={message:Z}}if(C&&B.isMaybeSingle&&(C===null||C===void 0||(q=C.details)===null||q===void 0?void 0:q.includes("0 rows")))C=null,H=200,Y="OK";if(C&&B.shouldThrowOnError)throw new ss(C)}return{error:C,data:F,count:$,status:H,statusText:Y}});if(!this.shouldThrowOnError)E=E.catch((I)=>{var C;let F="",$="",H="",Y=I===null||I===void 0?void 0:I.cause;if(Y){var X,W,M,q;let R=(X=Y===null||Y===void 0?void 0:Y.message)!==null&&X!==void 0?X:"",O=(W=Y===null||Y===void 0?void 0:Y.code)!==null&&W!==void 0?W:"";if(F=`${(M=I===null||I===void 0?void 0:I.name)!==null&&M!==void 0?M:"FetchError"}: ${I===null||I===void 0?void 0:I.message}`,F+=`
|
|
99
99
|
|
|
100
100
|
Caused by: ${(q=Y===null||Y===void 0?void 0:Y.name)!==null&&q!==void 0?q:"Error"}: ${R}`,O)F+=` (${O})`;if(Y===null||Y===void 0?void 0:Y.stack)F+=`
|
|
101
101
|
${Y.stack}`}else{var Z;F=(Z=I===null||I===void 0?void 0:I.stack)!==null&&Z!==void 0?Z:""}let z=this.url.toString().length;if((I===null||I===void 0?void 0:I.name)==="AbortError"||(I===null||I===void 0?void 0:I.code)==="ABORT_ERR"){if(H="",$="Request was aborted (timeout or manual cancellation)",z>this.urlLengthLimit)$+=`. Note: Your request URL is ${z} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`}else if((Y===null||Y===void 0?void 0:Y.name)==="HeadersOverflowError"||(Y===null||Y===void 0?void 0:Y.code)==="UND_ERR_HEADERS_OVERFLOW"){if(H="",$="HTTP headers exceeded server limits (typically 16KB)",z>this.urlLengthLimit)$+=`. Your request URL is ${z} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`}return{error:{message:`${(C=I===null||I===void 0?void 0:I.name)!==null&&C!==void 0?C:"FetchError"}: ${I===null||I===void 0?void 0:I.message}`,details:F,hint:$,code:H},data:null,count:null,status:0,statusText:""}});return E.then(A,Q)}returns(){return this}overrideTypes(){return this}},ZTA,as,pJ,zTA=class{constructor(A,{headers:Q={},schema:B,fetch:D,urlLengthLimit:E=8000}){this.url=A,this.headers=new Headers(Q),this.schema=B,this.fetch=D,this.urlLengthLimit=E}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(A,Q){let{head:B=!1,count:D}=Q!==null&&Q!==void 0?Q:{},E=B?"HEAD":"GET",I=!1,C=(A!==null&&A!==void 0?A:"*").split("").map((H)=>{if(/\s/.test(H)&&!I)return"";if(H==='"')I=!I;return H}).join(""),{url:F,headers:$}=this.cloneRequestState();if(F.searchParams.set("select",C),D)$.append("Prefer",`count=${D}`);return new pJ({method:E,url:F,headers:$,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(A,{count:Q,defaultToNull:B=!0}={}){var D;let E="POST",{url:I,headers:C}=this.cloneRequestState();if(Q)C.append("Prefer",`count=${Q}`);if(!B)C.append("Prefer","missing=default");if(Array.isArray(A)){let F=A.reduce(($,H)=>$.concat(Object.keys(H)),[]);if(F.length>0){let $=[...new Set(F)].map((H)=>`"${H}"`);I.searchParams.set("columns",$.join(","))}}return new pJ({method:"POST",url:I,headers:C,schema:this.schema,body:A,fetch:(D=this.fetch)!==null&&D!==void 0?D:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(A,{onConflict:Q,ignoreDuplicates:B=!1,count:D,defaultToNull:E=!0}={}){var I;let C="POST",{url:F,headers:$}=this.cloneRequestState();if($.append("Prefer",`resolution=${B?"ignore":"merge"}-duplicates`),Q!==void 0)F.searchParams.set("on_conflict",Q);if(D)$.append("Prefer",`count=${D}`);if(!E)$.append("Prefer","missing=default");if(Array.isArray(A)){let H=A.reduce((Y,X)=>Y.concat(Object.keys(X)),[]);if(H.length>0){let Y=[...new Set(H)].map((X)=>`"${X}"`);F.searchParams.set("columns",Y.join(","))}}return new pJ({method:"POST",url:F,headers:$,schema:this.schema,body:A,fetch:(I=this.fetch)!==null&&I!==void 0?I:fetch,urlLengthLimit:this.urlLengthLimit})}update(A,{count:Q}={}){var B;let D="PATCH",{url:E,headers:I}=this.cloneRequestState();if(Q)I.append("Prefer",`count=${Q}`);return new pJ({method:"PATCH",url:E,headers:I,schema:this.schema,body:A,fetch:(B=this.fetch)!==null&&B!==void 0?B:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:A}={}){var Q;let B="DELETE",{url:D,headers:E}=this.cloneRequestState();if(A)E.append("Prefer",`count=${A}`);return new pJ({method:"DELETE",url:D,headers:E,schema:this.schema,fetch:(Q=this.fetch)!==null&&Q!==void 0?Q:fetch,urlLengthLimit:this.urlLengthLimit})}},ts=class A{constructor(Q,{headers:B={},schema:D,fetch:E,timeout:I,urlLengthLimit:C=8000}={}){this.url=Q,this.headers=new Headers(B),this.schemaName=D,this.urlLengthLimit=C;let F=E!==null&&E!==void 0?E:globalThis.fetch;if(I!==void 0&&I>0)this.fetch=($,H)=>{let Y=new AbortController,X=setTimeout(()=>Y.abort(),I),W=H===null||H===void 0?void 0:H.signal;if(W){if(W.aborted)return clearTimeout(X),F($,H);let M=()=>{clearTimeout(X),Y.abort()};return W.addEventListener("abort",M,{once:!0}),F($,fq(fq({},H),{},{signal:Y.signal})).finally(()=>{clearTimeout(X),W.removeEventListener("abort",M)})}return F($,fq(fq({},H),{},{signal:Y.signal})).finally(()=>clearTimeout(X))};else this.fetch=F}from(Q){if(!Q||typeof Q!=="string"||Q.trim()==="")throw Error("Invalid relation name: relation must be a non-empty string.");return new zTA(new URL(`${this.url}/${Q}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(Q){return new A(this.url,{headers:this.headers,schema:Q,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(Q,B={},{head:D=!1,get:E=!1,count:I}={}){var C;let F,$=new URL(`${this.url}/rpc/${Q}`),H,Y=(M)=>M!==null&&typeof M==="object"&&(!Array.isArray(M)||M.some(Y)),X=D&&Object.values(B).some(Y);if(X)F="POST",H=B;else if(D||E)F=D?"HEAD":"GET",Object.entries(B).filter(([M,q])=>q!==void 0).map(([M,q])=>[M,Array.isArray(q)?`{${q.join(",")}}`:`${q}`]).forEach(([M,q])=>{$.searchParams.append(M,q)});else F="POST",H=B;let W=new Headers(this.headers);if(X)W.set("Prefer",I?`count=${I},return=minimal`:"return=minimal");else if(I)W.set("Prefer",`count=${I}`);return new pJ({method:F,url:$,headers:W,schema:this.schemaName,body:H,fetch:(C=this.fetch)!==null&&C!==void 0?C:fetch,urlLengthLimit:this.urlLengthLimit})}};var es=LA(()=>{ss=class extends Error{constructor(A){super(A.message);this.name="PostgrestError",this.details=A.details,this.hint=A.hint,this.code=A.code}},ZTA=class extends NTA{select(A){let Q=!1,B=(A!==null&&A!==void 0?A:"*").split("").map((D)=>{if(/\s/.test(D)&&!Q)return"";if(D==='"')Q=!Q;return D}).join("");return this.url.searchParams.set("select",B),this.headers.append("Prefer","return=representation"),this}order(A,{ascending:Q=!0,nullsFirst:B,foreignTable:D,referencedTable:E=D}={}){let I=E?`${E}.order`:"order",C=this.url.searchParams.get(I);return this.url.searchParams.set(I,`${C?`${C},`:""}${A}.${Q?"asc":"desc"}${B===void 0?"":B?".nullsfirst":".nullslast"}`),this}limit(A,{foreignTable:Q,referencedTable:B=Q}={}){let D=typeof B>"u"?"limit":`${B}.limit`;return this.url.searchParams.set(D,`${A}`),this}range(A,Q,{foreignTable:B,referencedTable:D=B}={}){let E=typeof D>"u"?"offset":`${D}.offset`,I=typeof D>"u"?"limit":`${D}.limit`;return this.url.searchParams.set(E,`${A}`),this.url.searchParams.set(I,`${Q-A+1}`),this}abortSignal(A){return this.signal=A,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){if(this.method==="GET")this.headers.set("Accept","application/json");else this.headers.set("Accept","application/vnd.pgrst.object+json");return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:A=!1,verbose:Q=!1,settings:B=!1,buffers:D=!1,wal:E=!1,format:I="text"}={}){var C;let F=[A?"analyze":null,Q?"verbose":null,B?"settings":null,D?"buffers":null,E?"wal":null].filter(Boolean).join("|"),$=(C=this.headers.get("Accept"))!==null&&C!==void 0?C:"application/json";if(this.headers.set("Accept",`application/vnd.pgrst.plan+${I}; for="${$}"; options=${F};`),I==="json")return this;else return this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(A){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${A}`),this}},as=new RegExp("[,()]"),pJ=class extends ZTA{eq(A,Q){return this.url.searchParams.append(A,`eq.${Q}`),this}neq(A,Q){return this.url.searchParams.append(A,`neq.${Q}`),this}gt(A,Q){return this.url.searchParams.append(A,`gt.${Q}`),this}gte(A,Q){return this.url.searchParams.append(A,`gte.${Q}`),this}lt(A,Q){return this.url.searchParams.append(A,`lt.${Q}`),this}lte(A,Q){return this.url.searchParams.append(A,`lte.${Q}`),this}like(A,Q){return this.url.searchParams.append(A,`like.${Q}`),this}likeAllOf(A,Q){return this.url.searchParams.append(A,`like(all).{${Q.join(",")}}`),this}likeAnyOf(A,Q){return this.url.searchParams.append(A,`like(any).{${Q.join(",")}}`),this}ilike(A,Q){return this.url.searchParams.append(A,`ilike.${Q}`),this}ilikeAllOf(A,Q){return this.url.searchParams.append(A,`ilike(all).{${Q.join(",")}}`),this}ilikeAnyOf(A,Q){return this.url.searchParams.append(A,`ilike(any).{${Q.join(",")}}`),this}regexMatch(A,Q){return this.url.searchParams.append(A,`match.${Q}`),this}regexIMatch(A,Q){return this.url.searchParams.append(A,`imatch.${Q}`),this}is(A,Q){return this.url.searchParams.append(A,`is.${Q}`),this}isDistinct(A,Q){return this.url.searchParams.append(A,`isdistinct.${Q}`),this}in(A,Q){let B=Array.from(new Set(Q)).map((D)=>{if(typeof D==="string"&&as.test(D))return`"${D}"`;else return`${D}`}).join(",");return this.url.searchParams.append(A,`in.(${B})`),this}notIn(A,Q){let B=Array.from(new Set(Q)).map((D)=>{if(typeof D==="string"&&as.test(D))return`"${D}"`;else return`${D}`}).join(",");return this.url.searchParams.append(A,`not.in.(${B})`),this}contains(A,Q){if(typeof Q==="string")this.url.searchParams.append(A,`cs.${Q}`);else if(Array.isArray(Q))this.url.searchParams.append(A,`cs.{${Q.join(",")}}`);else this.url.searchParams.append(A,`cs.${JSON.stringify(Q)}`);return this}containedBy(A,Q){if(typeof Q==="string")this.url.searchParams.append(A,`cd.${Q}`);else if(Array.isArray(Q))this.url.searchParams.append(A,`cd.{${Q.join(",")}}`);else this.url.searchParams.append(A,`cd.${JSON.stringify(Q)}`);return this}rangeGt(A,Q){return this.url.searchParams.append(A,`sr.${Q}`),this}rangeGte(A,Q){return this.url.searchParams.append(A,`nxl.${Q}`),this}rangeLt(A,Q){return this.url.searchParams.append(A,`sl.${Q}`),this}rangeLte(A,Q){return this.url.searchParams.append(A,`nxr.${Q}`),this}rangeAdjacent(A,Q){return this.url.searchParams.append(A,`adj.${Q}`),this}overlaps(A,Q){if(typeof Q==="string")this.url.searchParams.append(A,`ov.${Q}`);else this.url.searchParams.append(A,`ov.{${Q.join(",")}}`);return this}textSearch(A,Q,{config:B,type:D}={}){let E="";if(D==="plain")E="pl";else if(D==="phrase")E="ph";else if(D==="websearch")E="w";let I=B===void 0?"":`(${B})`;return this.url.searchParams.append(A,`${E}fts${I}.${Q}`),this}match(A){return Object.entries(A).forEach(([Q,B])=>{this.url.searchParams.append(Q,`eq.${B}`)}),this}not(A,Q,B){return this.url.searchParams.append(A,`not.${Q}.${B}`),this}or(A,{foreignTable:Q,referencedTable:B=Q}={}){let D=B?`${B}.or`:"or";return this.url.searchParams.append(D,`(${A})`),this}filter(A,Q,B){return this.url.searchParams.append(A,`${Q}.${B}`),this}}});class a_{constructor(){}connect(){}disconnect(){}}function OTA(A,Q,B){let D=new URL(Q,A);if(B){for(let[E,I]of Object.entries(B))if(I!==void 0)D.searchParams.set(E,I)}return D.toString()}async function STA(A){if(!A||A.type==="none")return{};if(A.type==="bearer")return{Authorization:`Bearer ${A.token}`};if(A.type==="header")return{[A.name]:A.value};if(A.type==="custom")return await A.getHeaders();return{}}function TTA(A){let Q=A.fetchImpl??globalThis.fetch;return{async request({method:B,path:D,query:E,body:I,headers:C}){let F=OTA(A.baseUrl,D,E),$=await STA(A.auth),H=await Q(F,{method:B,headers:{...I?{"Content-Type":"application/json"}:{},...$,...C},body:I?JSON.stringify(I):void 0}),Y=await H.text(),X=(H.headers.get("content-type")||"").includes("application/json"),W=X&&Y?JSON.parse(Y):Y;if(!H.ok){let M=X?W:void 0,q=M?.error;throw new mY(q?.message??`Request failed with status ${H.status}`,{status:H.status,icebergType:q?.type,icebergCode:q?.code,details:M})}return{status:H.status,headers:H.headers,data:W}}}}function uq(A){return A.join("\x1F")}function nJ(A){return A.join("\x1F")}var mY,jTA=class{constructor(A,Q=""){this.client=A,this.prefix=Q}async listNamespaces(A){let Q=A?{parent:uq(A.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:Q})).data.namespaces.map((D)=>({namespace:D}))}async createNamespace(A,Q){let B={namespace:A.namespace,properties:Q?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:B})).data}async dropNamespace(A){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${uq(A.namespace)}`})}async loadNamespaceMetadata(A){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${uq(A.namespace)}`})).data.properties}}async namespaceExists(A){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${uq(A.namespace)}`}),!0}catch(Q){if(Q instanceof mY&&Q.status===404)return!1;throw Q}}async createNamespaceIfNotExists(A,Q){try{return await this.createNamespace(A,Q)}catch(B){if(B instanceof mY&&B.status===409)return;throw B}}},PTA=class{constructor(A,Q="",B){this.client=A,this.prefix=Q,this.accessDelegation=B}async listTables(A){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${nJ(A.namespace)}/tables`})).data.identifiers}async createTable(A,Q){let B={};if(this.accessDelegation)B["X-Iceberg-Access-Delegation"]=this.accessDelegation;return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${nJ(A.namespace)}/tables`,body:Q,headers:B})).data.metadata}async updateTable(A,Q){let B=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${nJ(A.namespace)}/tables/${A.name}`,body:Q});return{"metadata-location":B.data["metadata-location"],metadata:B.data.metadata}}async dropTable(A,Q){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${nJ(A.namespace)}/tables/${A.name}`,query:{purgeRequested:String(Q?.purge??!1)}})}async loadTable(A){let Q={};if(this.accessDelegation)Q["X-Iceberg-Access-Delegation"]=this.accessDelegation;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${nJ(A.namespace)}/tables/${A.name}`,headers:Q})).data.metadata}async tableExists(A){let Q={};if(this.accessDelegation)Q["X-Iceberg-Access-Delegation"]=this.accessDelegation;try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${nJ(A.namespace)}/tables/${A.name}`,headers:Q}),!0}catch(B){if(B instanceof mY&&B.status===404)return!1;throw B}}async createTableIfNotExists(A,Q){try{return await this.createTable(A,Q)}catch(B){if(B instanceof mY&&B.status===409)return await this.loadTable({namespace:A.namespace,name:Q.name});throw B}}},At=class{constructor(A){let Q="v1";if(A.catalogName)Q+=`/${A.catalogName}`;let B=A.baseUrl.endsWith("/")?A.baseUrl:`${A.baseUrl}/`;this.client=TTA({baseUrl:B,auth:A.auth,fetchImpl:A.fetch}),this.accessDelegation=A.accessDelegation?.join(","),this.namespaceOps=new jTA(this.client,Q),this.tableOps=new PTA(this.client,Q,this.accessDelegation)}async listNamespaces(A){return this.namespaceOps.listNamespaces(A)}async createNamespace(A,Q){return this.namespaceOps.createNamespace(A,Q)}async dropNamespace(A){await this.namespaceOps.dropNamespace(A)}async loadNamespaceMetadata(A){return this.namespaceOps.loadNamespaceMetadata(A)}async listTables(A){return this.tableOps.listTables(A)}async createTable(A,Q){return this.tableOps.createTable(A,Q)}async updateTable(A,Q){return this.tableOps.updateTable(A,Q)}async dropTable(A,Q){await this.tableOps.dropTable(A,Q)}async loadTable(A){return this.tableOps.loadTable(A)}async namespaceExists(A){return this.namespaceOps.namespaceExists(A)}async tableExists(A){return this.tableOps.tableExists(A)}async createNamespaceIfNotExists(A,Q){return this.namespaceOps.createNamespaceIfNotExists(A,Q)}async createTableIfNotExists(A,Q){return this.tableOps.createTableIfNotExists(A,Q)}};var Qt=LA(()=>{mY=class extends Error{constructor(A,Q){super(A);this.name="IcebergError",this.status=Q.status,this.icebergType=Q.icebergType,this.icebergCode=Q.icebergCode,this.details=Q.details,this.isCommitStateUnknown=Q.icebergType==="CommitStateUnknownException"||[500,502,504].includes(Q.status)&&Q.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}}});function cq(A){return typeof A==="object"&&A!==null&&"__isStorageError"in A}function lY(A){return lY=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},lY(A)}function kTA(A,Q){if(lY(A)!="object"||!A)return A;var B=A[Symbol.toPrimitive];if(B!==void 0){var D=B.call(A,Q||"default");if(lY(D)!="object")return D;throw TypeError("@@toPrimitive must return a primitive value.")}return(Q==="string"?String:Number)(A)}function gTA(A){var Q=kTA(A,"string");return lY(Q)=="symbol"?Q:Q+""}function bTA(A,Q,B){return(Q=gTA(Q))in A?Object.defineProperty(A,Q,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[Q]=B,A}function Bt(A,Q){var B=Object.keys(A);if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(A);Q&&(D=D.filter(function(E){return Object.getOwnPropertyDescriptor(A,E).enumerable})),B.push.apply(B,D)}return B}function MB(A){for(var Q=1;Q<arguments.length;Q++){var B=arguments[Q]!=null?arguments[Q]:{};Q%2?Bt(Object(B),!0).forEach(function(D){bTA(A,D,B[D])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(B)):Bt(Object(B)).forEach(function(D){Object.defineProperty(A,D,Object.getOwnPropertyDescriptor(B,D))})}return A}async function cY(A,Q,B,D,E,I,C){return new Promise((F,$)=>{A(B,fTA(Q,D,E,I)).then((H)=>{if(!H.ok)throw H;if(D===null||D===void 0?void 0:D.noResolveJson)return H;if(C==="vectors"){let Y=H.headers.get("content-type");if(H.headers.get("content-length")==="0"||H.status===204)return{};if(!Y||!Y.includes("application/json"))return{}}return H.json()}).then((H)=>F(H)).catch((H)=>yTA(H,$,D,C))})}function Ct(A="storage"){return{get:async(Q,B,D,E)=>{return cY(Q,"GET",B,D,E,void 0,A)},post:async(Q,B,D,E,I)=>{return cY(Q,"POST",B,E,I,D,A)},put:async(Q,B,D,E,I)=>{return cY(Q,"PUT",B,E,I,D,A)},head:async(Q,B,D,E)=>{return cY(Q,"HEAD",B,MB(MB({},D),{},{noResolveJson:!0}),E,void 0,A)},remove:async(Q,B,D,E,I)=>{return cY(Q,"DELETE",B,E,I,D,A)}}}var mq,hq,It,_TA=(A)=>{if(A)return(...Q)=>A(...Q);return(...Q)=>fetch(...Q)},xTA=(A)=>{if(typeof A!=="object"||A===null)return!1;let Q=Object.getPrototypeOf(A);return(Q===null||Q===Object.prototype||Object.getPrototypeOf(Q)===null)&&!(Symbol.toStringTag in A)&&!(Symbol.iterator in A)},o_=(A)=>{if(Array.isArray(A))return A.map((B)=>o_(B));else if(typeof A==="function"||A!==Object(A))return A;let Q={};return Object.entries(A).forEach(([B,D])=>{let E=B.replace(/([-_][a-z])/gi,(I)=>I.toUpperCase().replace(/[-_]/g,""));Q[E]=o_(D)}),Q},vTA=(A)=>{if(!A||typeof A!=="string")return!1;if(A.length===0||A.length>100)return!1;if(A.trim()!==A)return!1;if(A.includes("/")||A.includes("\\"))return!1;return/^[\w!.\*'() &$@=;:+,?-]+$/.test(A)},Dt=(A)=>{var Q;return A.msg||A.message||A.error_description||(typeof A.error==="string"?A.error:(Q=A.error)===null||Q===void 0?void 0:Q.message)||JSON.stringify(A)},yTA=async(A,Q,B,D)=>{if(A&&typeof A==="object"&&"status"in A&&"ok"in A&&typeof A.status==="number"&&!(B===null||B===void 0?void 0:B.noResolveJson)){let E=A,I=E.status||500;if(typeof E.json==="function")E.json().then((C)=>{let F=(C===null||C===void 0?void 0:C.statusCode)||(C===null||C===void 0?void 0:C.code)||I+"";Q(new hq(Dt(C),I,F,D))}).catch(()=>{if(D==="vectors"){let C=I+"";Q(new hq(E.statusText||`HTTP ${I} error`,I,C,D))}else{let C=I+"";Q(new hq(E.statusText||`HTTP ${I} error`,I,C,D))}});else{let C=I+"";Q(new hq(E.statusText||`HTTP ${I} error`,I,C,D))}}else Q(new It(Dt(A),A,D))},fTA=(A,Q,B,D)=>{let E={method:A,headers:(Q===null||Q===void 0?void 0:Q.headers)||{}};if(A==="GET"||A==="HEAD"||!D)return MB(MB({},E),B);if(xTA(D))E.headers=MB({"Content-Type":"application/json"},Q===null||Q===void 0?void 0:Q.headers),E.body=JSON.stringify(D);else E.body=D;if(Q===null||Q===void 0?void 0:Q.duplex)E.duplex=Q.duplex;return MB(MB({},E),B)},uTA,dY,ZC,s_,hTA,t_,Y8,iJ=class{constructor(A,Q={},B,D="storage"){this.shouldThrowOnError=!1,this.url=A,this.headers=Q,this.fetch=_TA(B),this.namespace=D}throwOnError(){return this.shouldThrowOnError=!0,this}async handleOperation(A){var Q=this;try{return{data:await A(),error:null}}catch(B){if(Q.shouldThrowOnError)throw B;if(cq(B))return{data:null,error:B};throw B}}},mTA=class{constructor(A,Q){this.downloadFn=A,this.shouldThrowOnError=Q}then(A,Q){return this.execute().then(A,Q)}async execute(){var A=this;try{return{data:(await A.downloadFn()).body,error:null}}catch(Q){if(A.shouldThrowOnError)throw Q;if(cq(Q))return{data:null,error:Q};throw Q}}},Ft,cTA=class{constructor(A,Q){this.downloadFn=A,this.shouldThrowOnError=Q,this[Ft]="BlobDownloadBuilder",this.promise=null}asStream(){return new mTA(this.downloadFn,this.shouldThrowOnError)}then(A,Q){return this.getPromise().then(A,Q)}catch(A){return this.getPromise().catch(A)}finally(A){return this.getPromise().finally(A)}getPromise(){if(!this.promise)this.promise=this.execute();return this.promise}async execute(){var A=this;try{return{data:await(await A.downloadFn()).blob(),error:null}}catch(Q){if(A.shouldThrowOnError)throw Q;if(cq(Q))return{data:null,error:Q};throw Q}}},lTA,Et,dTA,pTA="2.95.3",pY,nTA,iTA,rTA,aTA,oTA,sTA,tTA,eTA,Gt;var $t=LA(()=>{Qt();mq=class extends Error{constructor(A,Q="storage",B,D){super(A);this.__isStorageError=!0,this.namespace=Q,this.name=Q==="vectors"?"StorageVectorsError":"StorageError",this.status=B,this.statusCode=D}};hq=class extends mq{constructor(A,Q,B,D="storage"){super(A,D,Q,B);this.name=D==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=Q,this.statusCode=B}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},It=class extends mq{constructor(A,Q,B="storage"){super(A,B);this.name=B==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=Q}};uTA=Ct("storage"),{get:dY,post:ZC,put:s_,head:hTA,remove:t_}=uTA,Y8=Ct("vectors");Ft=Symbol.toStringTag;lTA={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Et={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},dTA=class extends iJ{constructor(A,Q={},B,D){super(A,Q,D,"storage");this.bucketId=B}async uploadOrUpdate(A,Q,B,D){var E=this;return E.handleOperation(async()=>{let I,C=MB(MB({},Et),D),F=MB(MB({},E.headers),A==="POST"&&{"x-upsert":String(C.upsert)}),$=C.metadata;if(typeof Blob<"u"&&B instanceof Blob){if(I=new FormData,I.append("cacheControl",C.cacheControl),$)I.append("metadata",E.encodeMetadata($));I.append("",B)}else if(typeof FormData<"u"&&B instanceof FormData){if(I=B,!I.has("cacheControl"))I.append("cacheControl",C.cacheControl);if($&&!I.has("metadata"))I.append("metadata",E.encodeMetadata($))}else{if(I=B,F["cache-control"]=`max-age=${C.cacheControl}`,F["content-type"]=C.contentType,$)F["x-metadata"]=E.toBase64(E.encodeMetadata($));if((typeof ReadableStream<"u"&&I instanceof ReadableStream||I&&typeof I==="object"&&("pipe"in I)&&typeof I.pipe==="function")&&!C.duplex)C.duplex="half"}if(D===null||D===void 0?void 0:D.headers)F=MB(MB({},F),D.headers);let H=E._removeEmptyFolders(Q),Y=E._getFinalPath(H),X=await(A=="PUT"?s_:ZC)(E.fetch,`${E.url}/object/${Y}`,I,MB({headers:F},(C===null||C===void 0?void 0:C.duplex)?{duplex:C.duplex}:{}));return{path:H,id:X.Id,fullPath:X.Key}})}async upload(A,Q,B){return this.uploadOrUpdate("POST",A,Q,B)}async uploadToSignedUrl(A,Q,B,D){var E=this;let I=E._removeEmptyFolders(A),C=E._getFinalPath(I),F=new URL(E.url+`/object/upload/sign/${C}`);return F.searchParams.set("token",Q),E.handleOperation(async()=>{let $,H=MB({upsert:Et.upsert},D),Y=MB(MB({},E.headers),{"x-upsert":String(H.upsert)});if(typeof Blob<"u"&&B instanceof Blob)$=new FormData,$.append("cacheControl",H.cacheControl),$.append("",B);else if(typeof FormData<"u"&&B instanceof FormData)$=B,$.append("cacheControl",H.cacheControl);else $=B,Y["cache-control"]=`max-age=${H.cacheControl}`,Y["content-type"]=H.contentType;return{path:I,fullPath:(await s_(E.fetch,F.toString(),$,{headers:Y})).Key}})}async createSignedUploadUrl(A,Q){var B=this;return B.handleOperation(async()=>{let D=B._getFinalPath(A),E=MB({},B.headers);if(Q===null||Q===void 0?void 0:Q.upsert)E["x-upsert"]="true";let I=await ZC(B.fetch,`${B.url}/object/upload/sign/${D}`,{},{headers:E}),C=new URL(B.url+I.url),F=C.searchParams.get("token");if(!F)throw new mq("No token returned by API");return{signedUrl:C.toString(),path:A,token:F}})}async update(A,Q,B){return this.uploadOrUpdate("PUT",A,Q,B)}async move(A,Q,B){var D=this;return D.handleOperation(async()=>{return await ZC(D.fetch,`${D.url}/object/move`,{bucketId:D.bucketId,sourceKey:A,destinationKey:Q,destinationBucket:B===null||B===void 0?void 0:B.destinationBucket},{headers:D.headers})})}async copy(A,Q,B){var D=this;return D.handleOperation(async()=>{return{path:(await ZC(D.fetch,`${D.url}/object/copy`,{bucketId:D.bucketId,sourceKey:A,destinationKey:Q,destinationBucket:B===null||B===void 0?void 0:B.destinationBucket},{headers:D.headers})).Key}})}async createSignedUrl(A,Q,B){var D=this;return D.handleOperation(async()=>{let E=D._getFinalPath(A),I=await ZC(D.fetch,`${D.url}/object/sign/${E}`,MB({expiresIn:Q},(B===null||B===void 0?void 0:B.transform)?{transform:B.transform}:{}),{headers:D.headers}),C=(B===null||B===void 0?void 0:B.download)?`&download=${B.download===!0?"":B.download}`:"";return{signedUrl:encodeURI(`${D.url}${I.signedURL}${C}`)}})}async createSignedUrls(A,Q,B){var D=this;return D.handleOperation(async()=>{let E=await ZC(D.fetch,`${D.url}/object/sign/${D.bucketId}`,{expiresIn:Q,paths:A},{headers:D.headers}),I=(B===null||B===void 0?void 0:B.download)?`&download=${B.download===!0?"":B.download}`:"";return E.map((C)=>MB(MB({},C),{},{signedUrl:C.signedURL?encodeURI(`${D.url}${C.signedURL}${I}`):null}))})}download(A,Q,B){let D=typeof(Q===null||Q===void 0?void 0:Q.transform)<"u"?"render/image/authenticated":"object",E=this.transformOptsToQueryString((Q===null||Q===void 0?void 0:Q.transform)||{}),I=E?`?${E}`:"",C=this._getFinalPath(A);return new cTA(()=>dY(this.fetch,`${this.url}/${D}/${C}${I}`,{headers:this.headers,noResolveJson:!0},B),this.shouldThrowOnError)}async info(A){var Q=this;let B=Q._getFinalPath(A);return Q.handleOperation(async()=>{return o_(await dY(Q.fetch,`${Q.url}/object/info/${B}`,{headers:Q.headers}))})}async exists(A){var Q=this;let B=Q._getFinalPath(A);try{return await hTA(Q.fetch,`${Q.url}/object/${B}`,{headers:Q.headers}),{data:!0,error:null}}catch(D){if(Q.shouldThrowOnError)throw D;if(cq(D)&&D instanceof It){let E=D.originalError;if([400,404].includes(E===null||E===void 0?void 0:E.status))return{data:!1,error:D}}throw D}}getPublicUrl(A,Q){let B=this._getFinalPath(A),D=[],E=(Q===null||Q===void 0?void 0:Q.download)?`download=${Q.download===!0?"":Q.download}`:"";if(E!=="")D.push(E);let I=typeof(Q===null||Q===void 0?void 0:Q.transform)<"u"?"render/image":"object",C=this.transformOptsToQueryString((Q===null||Q===void 0?void 0:Q.transform)||{});if(C!=="")D.push(C);let F=D.join("&");if(F!=="")F=`?${F}`;return{data:{publicUrl:encodeURI(`${this.url}/${I}/public/${B}${F}`)}}}async remove(A){var Q=this;return Q.handleOperation(async()=>{return await t_(Q.fetch,`${Q.url}/object/${Q.bucketId}`,{prefixes:A},{headers:Q.headers})})}async list(A,Q,B){var D=this;return D.handleOperation(async()=>{let E=MB(MB(MB({},lTA),Q),{},{prefix:A||""});return await ZC(D.fetch,`${D.url}/object/list/${D.bucketId}`,E,{headers:D.headers},B)})}async listV2(A,Q){var B=this;return B.handleOperation(async()=>{let D=MB({},A);return await ZC(B.fetch,`${B.url}/object/list-v2/${B.bucketId}`,D,{headers:B.headers},Q)})}encodeMetadata(A){return JSON.stringify(A)}toBase64(A){if(typeof Buffer<"u")return Buffer.from(A).toString("base64");return btoa(A)}_getFinalPath(A){return`${this.bucketId}/${A.replace(/^\/+/,"")}`}_removeEmptyFolders(A){return A.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(A){let Q=[];if(A.width)Q.push(`width=${A.width}`);if(A.height)Q.push(`height=${A.height}`);if(A.resize)Q.push(`resize=${A.resize}`);if(A.format)Q.push(`format=${A.format}`);if(A.quality)Q.push(`quality=${A.quality}`);return Q.join("&")}},pY={"X-Client-Info":`storage-js/${pTA}`},nTA=class extends iJ{constructor(A,Q={},B,D){let E=new URL(A);if(D===null||D===void 0?void 0:D.useNewHostname){if(/supabase\.(co|in|red)$/.test(E.hostname)&&!E.hostname.includes("storage.supabase."))E.hostname=E.hostname.replace("supabase.","storage.supabase.")}let I=E.href.replace(/\/$/,""),C=MB(MB({},pY),Q);super(I,C,B,"storage")}async listBuckets(A){var Q=this;return Q.handleOperation(async()=>{let B=Q.listBucketOptionsToQueryString(A);return await dY(Q.fetch,`${Q.url}/bucket${B}`,{headers:Q.headers})})}async getBucket(A){var Q=this;return Q.handleOperation(async()=>{return await dY(Q.fetch,`${Q.url}/bucket/${A}`,{headers:Q.headers})})}async createBucket(A,Q={public:!1}){var B=this;return B.handleOperation(async()=>{return await ZC(B.fetch,`${B.url}/bucket`,{id:A,name:A,type:Q.type,public:Q.public,file_size_limit:Q.fileSizeLimit,allowed_mime_types:Q.allowedMimeTypes},{headers:B.headers})})}async updateBucket(A,Q){var B=this;return B.handleOperation(async()=>{return await s_(B.fetch,`${B.url}/bucket/${A}`,{id:A,name:A,public:Q.public,file_size_limit:Q.fileSizeLimit,allowed_mime_types:Q.allowedMimeTypes},{headers:B.headers})})}async emptyBucket(A){var Q=this;return Q.handleOperation(async()=>{return await ZC(Q.fetch,`${Q.url}/bucket/${A}/empty`,{},{headers:Q.headers})})}async deleteBucket(A){var Q=this;return Q.handleOperation(async()=>{return await t_(Q.fetch,`${Q.url}/bucket/${A}`,{},{headers:Q.headers})})}listBucketOptionsToQueryString(A){let Q={};if(A){if("limit"in A)Q.limit=String(A.limit);if("offset"in A)Q.offset=String(A.offset);if(A.search)Q.search=A.search;if(A.sortColumn)Q.sortColumn=A.sortColumn;if(A.sortOrder)Q.sortOrder=A.sortOrder}return Object.keys(Q).length>0?"?"+new URLSearchParams(Q).toString():""}},iTA=class extends iJ{constructor(A,Q={},B){let D=A.replace(/\/$/,""),E=MB(MB({},pY),Q);super(D,E,B,"storage")}async createBucket(A){var Q=this;return Q.handleOperation(async()=>{return await ZC(Q.fetch,`${Q.url}/bucket`,{name:A},{headers:Q.headers})})}async listBuckets(A){var Q=this;return Q.handleOperation(async()=>{let B=new URLSearchParams;if((A===null||A===void 0?void 0:A.limit)!==void 0)B.set("limit",A.limit.toString());if((A===null||A===void 0?void 0:A.offset)!==void 0)B.set("offset",A.offset.toString());if(A===null||A===void 0?void 0:A.sortColumn)B.set("sortColumn",A.sortColumn);if(A===null||A===void 0?void 0:A.sortOrder)B.set("sortOrder",A.sortOrder);if(A===null||A===void 0?void 0:A.search)B.set("search",A.search);let D=B.toString(),E=D?`${Q.url}/bucket?${D}`:`${Q.url}/bucket`;return await dY(Q.fetch,E,{headers:Q.headers})})}async deleteBucket(A){var Q=this;return Q.handleOperation(async()=>{return await t_(Q.fetch,`${Q.url}/bucket/${A}`,{},{headers:Q.headers})})}from(A){var Q=this;if(!vTA(A))throw new mq("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");let B=new At({baseUrl:this.url,catalogName:A,auth:{type:"custom",getHeaders:async()=>Q.headers},fetch:this.fetch}),D=this.shouldThrowOnError;return new Proxy(B,{get(E,I){let C=E[I];if(typeof C!=="function")return C;return async(...F)=>{try{return{data:await C.apply(E,F),error:null}}catch($){if(D)throw $;return{data:null,error:$}}}}})}},rTA=class extends iJ{constructor(A,Q={},B){let D=A.replace(/\/$/,""),E=MB(MB({},pY),{},{"Content-Type":"application/json"},Q);super(D,E,B,"vectors")}async createIndex(A){var Q=this;return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/CreateIndex`,A,{headers:Q.headers})||{}})}async getIndex(A,Q){var B=this;return B.handleOperation(async()=>{return await Y8.post(B.fetch,`${B.url}/GetIndex`,{vectorBucketName:A,indexName:Q},{headers:B.headers})})}async listIndexes(A){var Q=this;return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/ListIndexes`,A,{headers:Q.headers})})}async deleteIndex(A,Q){var B=this;return B.handleOperation(async()=>{return await Y8.post(B.fetch,`${B.url}/DeleteIndex`,{vectorBucketName:A,indexName:Q},{headers:B.headers})||{}})}},aTA=class extends iJ{constructor(A,Q={},B){let D=A.replace(/\/$/,""),E=MB(MB({},pY),{},{"Content-Type":"application/json"},Q);super(D,E,B,"vectors")}async putVectors(A){var Q=this;if(A.vectors.length<1||A.vectors.length>500)throw Error("Vector batch size must be between 1 and 500 items");return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/PutVectors`,A,{headers:Q.headers})||{}})}async getVectors(A){var Q=this;return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/GetVectors`,A,{headers:Q.headers})})}async listVectors(A){var Q=this;if(A.segmentCount!==void 0){if(A.segmentCount<1||A.segmentCount>16)throw Error("segmentCount must be between 1 and 16");if(A.segmentIndex!==void 0){if(A.segmentIndex<0||A.segmentIndex>=A.segmentCount)throw Error(`segmentIndex must be between 0 and ${A.segmentCount-1}`)}}return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/ListVectors`,A,{headers:Q.headers})})}async queryVectors(A){var Q=this;return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/QueryVectors`,A,{headers:Q.headers})})}async deleteVectors(A){var Q=this;if(A.keys.length<1||A.keys.length>500)throw Error("Keys batch size must be between 1 and 500 items");return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/DeleteVectors`,A,{headers:Q.headers})||{}})}},oTA=class extends iJ{constructor(A,Q={},B){let D=A.replace(/\/$/,""),E=MB(MB({},pY),{},{"Content-Type":"application/json"},Q);super(D,E,B,"vectors")}async createBucket(A){var Q=this;return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/CreateVectorBucket`,{vectorBucketName:A},{headers:Q.headers})||{}})}async getBucket(A){var Q=this;return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/GetVectorBucket`,{vectorBucketName:A},{headers:Q.headers})})}async listBuckets(A={}){var Q=this;return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/ListVectorBuckets`,A,{headers:Q.headers})})}async deleteBucket(A){var Q=this;return Q.handleOperation(async()=>{return await Y8.post(Q.fetch,`${Q.url}/DeleteVectorBucket`,{vectorBucketName:A},{headers:Q.headers})||{}})}},sTA=class extends oTA{constructor(A,Q={}){super(A,Q.headers||{},Q.fetch)}from(A){return new tTA(this.url,this.headers,A,this.fetch)}async createBucket(A){var Q=()=>super.createBucket,B=this;return Q().call(B,A)}async getBucket(A){var Q=()=>super.getBucket,B=this;return Q().call(B,A)}async listBuckets(A={}){var Q=()=>super.listBuckets,B=this;return Q().call(B,A)}async deleteBucket(A){var Q=()=>super.deleteBucket,B=this;return Q().call(B,A)}},tTA=class extends rTA{constructor(A,Q,B,D){super(A,Q,D);this.vectorBucketName=B}async createIndex(A){var Q=()=>super.createIndex,B=this;return Q().call(B,MB(MB({},A),{},{vectorBucketName:B.vectorBucketName}))}async listIndexes(A={}){var Q=()=>super.listIndexes,B=this;return Q().call(B,MB(MB({},A),{},{vectorBucketName:B.vectorBucketName}))}async getIndex(A){var Q=()=>super.getIndex,B=this;return Q().call(B,B.vectorBucketName,A)}async deleteIndex(A){var Q=()=>super.deleteIndex,B=this;return Q().call(B,B.vectorBucketName,A)}index(A){return new eTA(this.url,this.headers,this.vectorBucketName,A,this.fetch)}},eTA=class extends aTA{constructor(A,Q,B,D,E){super(A,Q,E);this.vectorBucketName=B,this.indexName=D}async putVectors(A){var Q=()=>super.putVectors,B=this;return Q().call(B,MB(MB({},A),{},{vectorBucketName:B.vectorBucketName,indexName:B.indexName}))}async getVectors(A){var Q=()=>super.getVectors,B=this;return Q().call(B,MB(MB({},A),{},{vectorBucketName:B.vectorBucketName,indexName:B.indexName}))}async listVectors(A={}){var Q=()=>super.listVectors,B=this;return Q().call(B,MB(MB({},A),{},{vectorBucketName:B.vectorBucketName,indexName:B.indexName}))}async queryVectors(A){var Q=()=>super.queryVectors,B=this;return Q().call(B,MB(MB({},A),{},{vectorBucketName:B.vectorBucketName,indexName:B.indexName}))}async deleteVectors(A){var Q=()=>super.deleteVectors,B=this;return Q().call(B,MB(MB({},A),{},{vectorBucketName:B.vectorBucketName,indexName:B.indexName}))}},Gt=class extends nTA{constructor(A,Q={},B,D){super(A,Q,B,D)}from(A){return new dTA(this.url,this.headers,A,this.fetch)}get vectors(){return new sTA(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new iTA(this.url+"/iceberg",this.headers,this.fetch)}}});class Jt{constructor(A){return this.options=A,new Proxy(this,QjA)}}var AjA=()=>Promise.resolve({data:{session:null,user:null},error:null}),QjA,e_;var Ax=LA(()=>{QjA={get:(A,Q)=>{if(Q==="constructor")return A.constructor;if(Q==="then"||Q==="catch"||Q==="finally")return;if(typeof Q==="symbol")return;if(Q==="getSession")return()=>Promise.resolve({data:{session:null,user:null},error:null});if(Q==="onAuthStateChange")return()=>({data:{subscription:{unsubscribe:()=>{}}},error:null});return AjA}};e_=class e_ extends Jt{}});function iY(A){return iY=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},iY(A)}function GjA(A,Q){if(iY(A)!="object"||!A)return A;var B=A[Symbol.toPrimitive];if(B!==void 0){var D=B.call(A,Q||"default");if(iY(D)!="object")return D;throw TypeError("@@toPrimitive must return a primitive value.")}return(Q==="string"?String:Number)(A)}function $jA(A){var Q=GjA(A,"string");return iY(Q)=="symbol"?Q:Q+""}function JjA(A,Q,B){return(Q=$jA(Q))in A?Object.defineProperty(A,Q,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[Q]=B,A}function Ht(A,Q){var B=Object.keys(A);if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(A);Q&&(D=D.filter(function(E){return Object.getOwnPropertyDescriptor(A,E).enumerable})),B.push.apply(B,D)}return B}function IE(A){for(var Q=1;Q<arguments.length;Q++){var B=arguments[Q]!=null?arguments[Q]:{};Q%2?Ht(Object(B),!0).forEach(function(D){JjA(A,D,B[D])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(B)):Ht(Object(B)).forEach(function(D){Object.defineProperty(A,D,Object.getOwnPropertyDescriptor(B,D))})}return A}function UjA(A){return A.endsWith("/")?A:A+"/"}function WjA(A,Q){var B,D;let{db:E,auth:I,realtime:C,global:F}=A,{db:$,auth:H,realtime:Y,global:X}=Q,W={db:IE(IE({},$),E),auth:IE(IE({},H),I),realtime:IE(IE({},Y),C),storage:{},global:IE(IE(IE({},X),F),{},{headers:IE(IE({},(B=X===null||X===void 0?void 0:X.headers)!==null&&B!==void 0?B:{}),(D=F===null||F===void 0?void 0:F.headers)!==null&&D!==void 0?D:{})}),accessToken:async()=>""};if(A.accessToken)W.accessToken=A.accessToken;else delete W.accessToken;return W}function KjA(A){let Q=A===null||A===void 0?void 0:A.trim();if(!Q)throw Error("supabaseUrl is required.");if(!Q.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(UjA(Q))}catch(B){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}function qjA(){if(typeof window<"u")return!1;let A=globalThis.process;if(!A)return!1;let Q=A.version;if(Q===void 0||Q===null)return!1;let B=Q.match(/^v(\d+)\./);if(!B)return!1;return parseInt(B[1],10)<=18}var zC,BjA="2.95.3",nY="",DjA,EjA,IjA,CjA,FjA,HjA=(A)=>{if(A)return(...Q)=>A(...Q);return(...Q)=>fetch(...Q)},YjA=()=>{return Headers},XjA=(A,Q,B)=>{let D=HjA(B),E=YjA();return async(I,C)=>{var F;let $=(F=await Q())!==null&&F!==void 0?F:A,H=new E(C===null||C===void 0?void 0:C.headers);if(!H.has("apikey"))H.set("apikey",A);if(!H.has("Authorization"))H.set("Authorization",`Bearer ${$}`);return D(I,IE(IE({},C),{},{headers:H}))}},wjA,MjA=class{constructor(A,Q,B){var D,E;this.supabaseUrl=A,this.supabaseKey=Q;let I=KjA(A);if(!Q)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",I),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",I),this.storageUrl=new URL("storage/v1",I),this.functionsUrl=new URL("functions/v1",I);let C=`sb-${I.hostname.split(".")[0]}-auth-token`,F={db:IjA,realtime:FjA,auth:IE(IE({},CjA),{},{storageKey:C}),global:EjA},$=WjA(B!==null&&B!==void 0?B:{},F);if(this.storageKey=(D=$.auth.storageKey)!==null&&D!==void 0?D:"",this.headers=(E=$.global.headers)!==null&&E!==void 0?E:{},!$.accessToken){var H;this.auth=this._initSupabaseAuthClient((H=$.auth)!==null&&H!==void 0?H:{},this.headers,$.global.fetch)}else this.accessToken=$.accessToken,this.auth=new Proxy({},{get:(Y,X)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(X)} is not possible`)}});if(this.fetch=XjA(Q,this._getAccessToken.bind(this),$.global.fetch),this.realtime=this._initRealtimeClient(IE({headers:this.headers,accessToken:this._getAccessToken.bind(this)},$.realtime)),this.accessToken)Promise.resolve(this.accessToken()).then((Y)=>this.realtime.setAuth(Y)).catch((Y)=>console.warn("Failed to set initial Realtime auth token:",Y));if(this.rest=new ts(new URL("rest/v1",I).href,{headers:this.headers,schema:$.db.schema,fetch:this.fetch,timeout:$.db.timeout,urlLengthLimit:$.db.urlLengthLimit}),this.storage=new Gt(this.storageUrl.href,this.headers,this.fetch,B===null||B===void 0?void 0:B.storage),!$.accessToken)this._listenForAuthEvents()}get functions(){return new zC.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(A){return this.rest.from(A)}schema(A){return this.rest.schema(A)}rpc(A,Q={},B={head:!1,get:!1,count:void 0}){return this.rest.rpc(A,Q,B)}channel(A,Q={config:{}}){return this.realtime.channel(A,Q)}getChannels(){return this.realtime.getChannels()}removeChannel(A){return this.realtime.removeChannel(A)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var A=this,Q,B;if(A.accessToken)return await A.accessToken();let{data:D}=await A.auth.getSession();return(Q=(B=D.session)===null||B===void 0?void 0:B.access_token)!==null&&Q!==void 0?Q:A.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:A,persistSession:Q,detectSessionInUrl:B,storage:D,userStorage:E,storageKey:I,flowType:C,lock:F,debug:$,throwOnError:H},Y,X){let W={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new wjA({url:this.authUrl.href,headers:IE(IE({},W),Y),storageKey:I,autoRefreshToken:A,persistSession:Q,detectSessionInUrl:B,storage:D,userStorage:E,flowType:C,lock:F,debug:$,throwOnError:H,fetch:X,hasCustomAuthorizationHeader:Object.keys(this.headers).some((M)=>M.toLowerCase()==="authorization")})}_initRealtimeClient(A){return new a_(this.realtimeUrl.href,IE(IE({},A),{},{params:IE(IE({},{apikey:this.supabaseKey}),A===null||A===void 0?void 0:A.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((A,Q)=>{this._handleTokenChanged(A,"CLIENT",Q===null||Q===void 0?void 0:Q.access_token)})}_handleTokenChanged(A,Q,B){if((A==="TOKEN_REFRESHED"||A==="SIGNED_IN")&&this.changedAccessToken!==B)this.changedAccessToken=B,this.realtime.setAuth(B);else if(A==="SIGNED_OUT"){if(this.realtime.setAuth(),Q=="STORAGE")this.auth.signOut();this.changedAccessToken=void 0}}},Yt=(A,Q,B)=>{return new MjA(A,Q,B)};var Xt=LA(()=>{es();$t();Ax();zC=oA(rs(),1);Ax();if(typeof Deno<"u")nY="deno";else if(typeof document<"u")nY="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")nY="react-native";else nY="node";DjA={"X-Client-Info":`supabase-js-${nY}/${BjA}`},EjA={headers:DjA},IjA={schema:"public"},CjA={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},FjA={};wjA=class extends e_{constructor(A){super(A)}};if(qjA())console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var Qx=c((YMQ,Ut)=>{Ut.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var lq=c((Kt)=>{var Wt={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function NjA(A){return function(...Q){if(Q.length)A=A.replace(/\{(\d)\}/g,(B,D)=>Q[D]||"");return Error("ADM-ZIP: "+A)}}for(let A of Object.keys(Wt))Kt[A]=NjA(Wt[A])});var Zt=c((UMQ,Nt)=>{var ZjA=kA("fs"),dE=kA("path"),wt=Qx(),zjA=lq(),RjA=typeof process==="object"&&process.platform==="win32",Mt=(A)=>typeof A==="object"&&A!==null,qt=new Uint32Array(256).map((A,Q)=>{for(let B=0;B<8;B++)if((Q&1)!==0)Q=3988292384^Q>>>1;else Q>>>=1;return Q>>>0});function CE(A){if(this.sep=dE.sep,this.fs=ZjA,Mt(A)){if(Mt(A.fs)&&typeof A.fs.statSync==="function")this.fs=A.fs}}Nt.exports=CE;CE.prototype.makeDir=function(A){let Q=this;function B(D){let E=D.split(Q.sep)[0];D.split(Q.sep).forEach(function(I){if(!I||I.substr(-1,1)===":")return;E+=Q.sep+I;var C;try{C=Q.fs.statSync(E)}catch(F){Q.fs.mkdirSync(E)}if(C&&C.isFile())throw zjA.FILE_IN_THE_WAY(`"${E}"`)})}B(A)};CE.prototype.writeFileTo=function(A,Q,B,D){let E=this;if(E.fs.existsSync(A)){if(!B)return!1;var I=E.fs.statSync(A);if(I.isDirectory())return!1}var C=dE.dirname(A);if(!E.fs.existsSync(C))E.makeDir(C);var F;try{F=E.fs.openSync(A,"w",438)}catch($){E.fs.chmodSync(A,438),F=E.fs.openSync(A,"w",438)}if(F)try{E.fs.writeSync(F,Q,0,Q.length,0)}finally{E.fs.closeSync(F)}return E.fs.chmodSync(A,D||438),!0};CE.prototype.writeFileToAsync=function(A,Q,B,D,E){if(typeof D==="function")E=D,D=void 0;let I=this;I.fs.exists(A,function(C){if(C&&!B)return E(!1);I.fs.stat(A,function(F,$){if(C&&$.isDirectory())return E(!1);var H=dE.dirname(A);I.fs.exists(H,function(Y){if(!Y)I.makeDir(H);I.fs.open(A,"w",438,function(X,W){if(X)I.fs.chmod(A,438,function(){I.fs.open(A,"w",438,function(M,q){I.fs.write(q,Q,0,Q.length,0,function(){I.fs.close(q,function(){I.fs.chmod(A,D||438,function(){E(!0)})})})})});else if(W)I.fs.write(W,Q,0,Q.length,0,function(){I.fs.close(W,function(){I.fs.chmod(A,D||438,function(){E(!0)})})});else I.fs.chmod(A,D||438,function(){E(!0)})})})})})};CE.prototype.findFiles=function(A){let Q=this;function B(D,E,I){if(typeof E==="boolean")I=E,E=void 0;let C=[];return Q.fs.readdirSync(D).forEach(function(F){let $=dE.join(D,F),H=Q.fs.statSync($);if(!E||E.test($))C.push(dE.normalize($)+(H.isDirectory()?Q.sep:""));if(H.isDirectory()&&I)C=C.concat(B($,E,I))}),C}return B(A,void 0,!0)};CE.prototype.findFilesAsync=function(A,Q){let B=this,D=[];B.fs.readdir(A,function(E,I){if(E)return Q(E);let C=I.length;if(!C)return Q(null,D);I.forEach(function(F){F=dE.join(A,F),B.fs.stat(F,function($,H){if($)return Q($);if(H){if(D.push(dE.normalize(F)+(H.isDirectory()?B.sep:"")),H.isDirectory())B.findFilesAsync(F,function(Y,X){if(Y)return Q(Y);if(D=D.concat(X),!--C)Q(null,D)});else if(!--C)Q(null,D)}})})})};CE.prototype.getAttributes=function(){};CE.prototype.setAttributes=function(){};CE.crc32update=function(A,Q){return qt[(A^Q)&255]^A>>>8};CE.crc32=function(A){if(typeof A==="string")A=Buffer.from(A,"utf8");let Q=A.length,B=-1;for(let D=0;D<Q;)B=CE.crc32update(B,A[D++]);return~B>>>0};CE.methodToString=function(A){switch(A){case wt.STORED:return"STORED ("+A+")";case wt.DEFLATED:return"DEFLATED ("+A+")";default:return"UNSUPPORTED ("+A+")"}};CE.canonical=function(A){if(!A)return"";let Q=dE.posix.normalize("/"+A.split("\\").join("/"));return dE.join(".",Q)};CE.zipnamefix=function(A){if(!A)return"";let Q=dE.posix.normalize("/"+A.split("\\").join("/"));return dE.posix.join(".",Q)};CE.findLast=function(A,Q){if(!Array.isArray(A))throw TypeError("arr is not array");let B=A.length>>>0;for(let D=B-1;D>=0;D--)if(Q(A[D],D,A))return A[D];return};CE.sanitize=function(A,Q){A=dE.resolve(dE.normalize(A));var B=Q.split("/");for(var D=0,E=B.length;D<E;D++){var I=dE.normalize(dE.join(A,B.slice(D,E).join(dE.sep)));if(I.indexOf(A)===0)return I}return dE.normalize(dE.join(A,dE.basename(Q)))};CE.toBuffer=function(Q,B){if(Buffer.isBuffer(Q))return Q;else if(Q instanceof Uint8Array)return Buffer.from(Q);else return typeof Q==="string"?B(Q):Buffer.alloc(0)};CE.readBigUInt64LE=function(A,Q){var B=Buffer.from(A.slice(Q,Q+8));return B.swap64(),parseInt(`0x${B.toString("hex")}`)};CE.fromDOS2Date=function(A){return new Date((A>>25&127)+1980,Math.max((A>>21&15)-1,0),Math.max(A>>16&31,1),A>>11&31,A>>5&63,(A&31)<<1)};CE.fromDate2DOS=function(A){let Q=0,B=0;if(A.getFullYear()>1979)Q=(A.getFullYear()-1980&127)<<9|A.getMonth()+1<<5|A.getDate(),B=A.getHours()<<11|A.getMinutes()<<5|A.getSeconds()>>1;return Q<<16|B};CE.isWin=RjA;CE.crcTable=qt});var Rt=c((WMQ,zt)=>{var VjA=kA("path");zt.exports=function(A,{fs:Q}){var B=A||"",D=I(),E=null;function I(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}if(B&&Q.existsSync(B))E=Q.statSync(B),D.directory=E.isDirectory(),D.mtime=E.mtime,D.atime=E.atime,D.executable=(73&E.mode)!==0,D.readonly=(128&E.mode)===0,D.hidden=VjA.basename(B)[0]===".";else console.warn("Invalid path: "+B);return{get directory(){return D.directory},get readOnly(){return D.readonly},get hidden(){return D.hidden},get mtime(){return D.mtime},get atime(){return D.atime},get executable(){return D.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:B,isDirectory:D.directory,isReadOnly:D.readonly,isHidden:D.hidden,isExecutable:D.executable,mTime:D.mtime,aTime:D.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var Lt=c((KMQ,Vt)=>{Vt.exports={efs:!0,encode:(A)=>Buffer.from(A,"utf8"),decode:(A)=>A.toString("utf8")}});var aJ=c((wMQ,rJ)=>{rJ.exports=Zt();rJ.exports.Constants=Qx();rJ.exports.Errors=lq();rJ.exports.FileAttr=Rt();rJ.exports.decoder=Lt()});var St=c((MMQ,Ot)=>{var b6=aJ(),vQ=b6.Constants;Ot.exports=function(){var A=20,Q=10,B=0,D=0,E=0,I=0,C=0,F=0,$=0,H=0,Y=0,X=0,W=0,M=0,q=0;A|=b6.isWin?2560:768,B|=vQ.FLG_EFS;let Z={extraLen:0},z=(V)=>Math.max(0,V)>>>0,R=(V)=>Math.max(0,V)&65535,O=(V)=>Math.max(0,V)&255;return E=b6.fromDate2DOS(new Date),{get made(){return A},set made(V){A=V},get version(){return Q},set version(V){Q=V},get flags(){return B},set flags(V){B=V},get flags_efs(){return(B&vQ.FLG_EFS)>0},set flags_efs(V){if(V)B|=vQ.FLG_EFS;else B&=~vQ.FLG_EFS},get flags_desc(){return(B&vQ.FLG_DESC)>0},set flags_desc(V){if(V)B|=vQ.FLG_DESC;else B&=~vQ.FLG_DESC},get method(){return D},set method(V){switch(V){case vQ.STORED:this.version=10;case vQ.DEFLATED:default:this.version=20}D=V},get time(){return b6.fromDOS2Date(this.timeval)},set time(V){this.timeval=b6.fromDate2DOS(V)},get timeval(){return E},set timeval(V){E=z(V)},get timeHighByte(){return O(E>>>8)},get crc(){return I},set crc(V){I=z(V)},get compressedSize(){return C},set compressedSize(V){C=z(V)},get size(){return F},set size(V){F=z(V)},get fileNameLength(){return $},set fileNameLength(V){$=V},get extraLength(){return H},set extraLength(V){H=V},get extraLocalLength(){return Z.extraLen},set extraLocalLength(V){Z.extraLen=V},get commentLength(){return Y},set commentLength(V){Y=V},get diskNumStart(){return X},set diskNumStart(V){X=z(V)},get inAttr(){return W},set inAttr(V){W=z(V)},get attr(){return M},set attr(V){M=z(V)},get fileAttr(){return(M||0)>>16&4095},get offset(){return q},set offset(V){q=z(V)},get encrypted(){return(B&vQ.FLG_ENC)===vQ.FLG_ENC},get centralHeaderSize(){return vQ.CENHDR+$+H+Y},get realDataOffset(){return q+vQ.LOCHDR+Z.fnameLen+Z.extraLen},get localHeader(){return Z},loadLocalHeaderFromBinary:function(V){var T=V.slice(q,q+vQ.LOCHDR);if(T.readUInt32LE(0)!==vQ.LOCSIG)throw b6.Errors.INVALID_LOC();Z.version=T.readUInt16LE(vQ.LOCVER),Z.flags=T.readUInt16LE(vQ.LOCFLG),Z.method=T.readUInt16LE(vQ.LOCHOW),Z.time=T.readUInt32LE(vQ.LOCTIM),Z.crc=T.readUInt32LE(vQ.LOCCRC),Z.compressedSize=T.readUInt32LE(vQ.LOCSIZ),Z.size=T.readUInt32LE(vQ.LOCLEN),Z.fnameLen=T.readUInt16LE(vQ.LOCNAM),Z.extraLen=T.readUInt16LE(vQ.LOCEXT);let j=q+vQ.LOCHDR+Z.fnameLen,d=j+Z.extraLen;return V.slice(j,d)},loadFromBinary:function(V){if(V.length!==vQ.CENHDR||V.readUInt32LE(0)!==vQ.CENSIG)throw b6.Errors.INVALID_CEN();A=V.readUInt16LE(vQ.CENVEM),Q=V.readUInt16LE(vQ.CENVER),B=V.readUInt16LE(vQ.CENFLG),D=V.readUInt16LE(vQ.CENHOW),E=V.readUInt32LE(vQ.CENTIM),I=V.readUInt32LE(vQ.CENCRC),C=V.readUInt32LE(vQ.CENSIZ),F=V.readUInt32LE(vQ.CENLEN),$=V.readUInt16LE(vQ.CENNAM),H=V.readUInt16LE(vQ.CENEXT),Y=V.readUInt16LE(vQ.CENCOM),X=V.readUInt16LE(vQ.CENDSK),W=V.readUInt16LE(vQ.CENATT),M=V.readUInt32LE(vQ.CENATX),q=V.readUInt32LE(vQ.CENOFF)},localHeaderToBinary:function(){var V=Buffer.alloc(vQ.LOCHDR);return V.writeUInt32LE(vQ.LOCSIG,0),V.writeUInt16LE(Q,vQ.LOCVER),V.writeUInt16LE(B,vQ.LOCFLG),V.writeUInt16LE(D,vQ.LOCHOW),V.writeUInt32LE(E,vQ.LOCTIM),V.writeUInt32LE(I,vQ.LOCCRC),V.writeUInt32LE(C,vQ.LOCSIZ),V.writeUInt32LE(F,vQ.LOCLEN),V.writeUInt16LE($,vQ.LOCNAM),V.writeUInt16LE(Z.extraLen,vQ.LOCEXT),V},centralHeaderToBinary:function(){var V=Buffer.alloc(vQ.CENHDR+$+H+Y);return V.writeUInt32LE(vQ.CENSIG,0),V.writeUInt16LE(A,vQ.CENVEM),V.writeUInt16LE(Q,vQ.CENVER),V.writeUInt16LE(B,vQ.CENFLG),V.writeUInt16LE(D,vQ.CENHOW),V.writeUInt32LE(E,vQ.CENTIM),V.writeUInt32LE(I,vQ.CENCRC),V.writeUInt32LE(C,vQ.CENSIZ),V.writeUInt32LE(F,vQ.CENLEN),V.writeUInt16LE($,vQ.CENNAM),V.writeUInt16LE(H,vQ.CENEXT),V.writeUInt16LE(Y,vQ.CENCOM),V.writeUInt16LE(X,vQ.CENDSK),V.writeUInt16LE(W,vQ.CENATT),V.writeUInt32LE(M,vQ.CENATX),V.writeUInt32LE(q,vQ.CENOFF),V},toJSON:function(){let V=function(T){return T+" bytes"};return{made:A,version:Q,flags:B,method:b6.methodToString(D),time:this.time,crc:"0x"+I.toString(16).toUpperCase(),compressedSize:V(C),size:V(F),fileNameLength:V($),extraLength:V(H),commentLength:V(Y),diskNumStart:X,inAttr:W,attr:M,offset:q,centralHeaderSize:V(vQ.CENHDR+$+H+Y)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var jt=c((qMQ,Tt)=>{var oJ=aJ(),e0=oJ.Constants;Tt.exports=function(){var A=0,Q=0,B=0,D=0,E=0;return{get diskEntries(){return A},set diskEntries(I){A=Q=I},get totalEntries(){return Q},set totalEntries(I){Q=A=I},get size(){return B},set size(I){B=I},get offset(){return D},set offset(I){D=I},get commentLength(){return E},set commentLength(I){E=I},get mainHeaderSize(){return e0.ENDHDR+E},loadFromBinary:function(I){if((I.length!==e0.ENDHDR||I.readUInt32LE(0)!==e0.ENDSIG)&&(I.length<e0.ZIP64HDR||I.readUInt32LE(0)!==e0.ZIP64SIG))throw oJ.Errors.INVALID_END();if(I.readUInt32LE(0)===e0.ENDSIG)A=I.readUInt16LE(e0.ENDSUB),Q=I.readUInt16LE(e0.ENDTOT),B=I.readUInt32LE(e0.ENDSIZ),D=I.readUInt32LE(e0.ENDOFF),E=I.readUInt16LE(e0.ENDCOM);else A=oJ.readBigUInt64LE(I,e0.ZIP64SUB),Q=oJ.readBigUInt64LE(I,e0.ZIP64TOT),B=oJ.readBigUInt64LE(I,e0.ZIP64SIZE),D=oJ.readBigUInt64LE(I,e0.ZIP64OFF),E=0},toBinary:function(){var I=Buffer.alloc(e0.ENDHDR+E);return I.writeUInt32LE(e0.ENDSIG,0),I.writeUInt32LE(0,4),I.writeUInt16LE(A,e0.ENDSUB),I.writeUInt16LE(Q,e0.ENDTOT),I.writeUInt32LE(B,e0.ENDSIZ),I.writeUInt32LE(D,e0.ENDOFF),I.writeUInt16LE(E,e0.ENDCOM),I.fill(" ",e0.ENDHDR),I},toJSON:function(){let I=function(C,F){let $=C.toString(16).toUpperCase();while($.length<F)$="0"+$;return"0x"+$};return{diskEntries:A,totalEntries:Q,size:B+" bytes",offset:I(D,4),commentLength:E}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var Bx=c((LjA)=>{LjA.EntryHeader=St();LjA.MainHeader=jt()});var _t=c((ZMQ,Pt)=>{Pt.exports=function(A){var Q=kA("zlib"),B={chunkSize:(parseInt(A.length/1024)+1)*1024};return{deflate:function(){return Q.deflateRawSync(A,B)},deflateAsync:function(D){var E=Q.createDeflateRaw(B),I=[],C=0;E.on("data",function(F){I.push(F),C+=F.length}),E.on("end",function(){var F=Buffer.alloc(C),$=0;F.fill(0);for(var H=0;H<I.length;H++){var Y=I[H];Y.copy(F,$),$+=Y.length}D&&D(F)}),E.end(A)}}}});var vt=c((zMQ,xt)=>{var TjA=+(process.versions?process.versions.node:"").split(".")[0]||0;xt.exports=function(A,Q){var B=kA("zlib");let D=TjA>=15&&Q>0?{maxOutputLength:Q}:{};return{inflate:function(){return B.inflateRawSync(A,D)},inflateAsync:function(E){var I=B.createInflateRaw(D),C=[],F=0;I.on("data",function($){C.push($),F+=$.length}),I.on("end",function(){var $=Buffer.alloc(F),H=0;$.fill(0);for(var Y=0;Y<C.length;Y++){var X=C[Y];X.copy($,H),H+=X.length}E&&E($)}),I.end(A)}}}});var ft=c((RMQ,yt)=>{var{randomFillSync:kt}=kA("crypto"),jjA=lq(),PjA=new Uint32Array(256).map((A,Q)=>{for(let B=0;B<8;B++)if((Q&1)!==0)Q=Q>>>1^3988292384;else Q>>>=1;return Q>>>0}),bt=(A,Q)=>Math.imul(A,Q)>>>0,gt=(A,Q)=>{return PjA[(A^Q)&255]^A>>>8},rY=()=>{if(typeof kt==="function")return kt(Buffer.alloc(12));else return rY.node()};rY.node=()=>{let A=Buffer.alloc(12),Q=A.length;for(let B=0;B<Q;B++)A[B]=Math.random()*256&255;return A};var dq={genSalt:rY};function pq(A){let Q=Buffer.isBuffer(A)?A:Buffer.from(A);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let B=0;B<Q.length;B++)this.updateKeys(Q[B])}pq.prototype.updateKeys=function(A){let Q=this.keys;return Q[0]=gt(Q[0],A),Q[1]+=Q[0]&255,Q[1]=bt(Q[1],134775813)+1,Q[2]=gt(Q[2],Q[1]>>>24),A};pq.prototype.next=function(){let A=(this.keys[2]|2)>>>0;return bt(A,A^1)>>8&255};function _jA(A){let Q=new pq(A);return function(B){let D=Buffer.alloc(B.length),E=0;for(let I of B)D[E++]=Q.updateKeys(I^Q.next());return D}}function xjA(A){let Q=new pq(A);return function(B,D,E=0){if(!D)D=Buffer.alloc(B.length);for(let I of B){let C=Q.next();D[E++]=I^C,Q.updateKeys(I)}return D}}function vjA(A,Q,B){if(!A||!Buffer.isBuffer(A)||A.length<12)return Buffer.alloc(0);let D=_jA(B),E=D(A.slice(0,12)),I=(Q.flags&8)===8?Q.timeHighByte:Q.crc>>>24;if(E[11]!==I)throw jjA.WRONG_PASSWORD();return D(A.slice(12))}function kjA(A){if(Buffer.isBuffer(A)&&A.length>=12)dq.genSalt=function(){return A.slice(0,12)};else if(A==="node")dq.genSalt=rY.node;else dq.genSalt=rY}function gjA(A,Q,B,D=!1){if(A==null)A=Buffer.alloc(0);if(!Buffer.isBuffer(A))A=Buffer.from(A.toString());let E=xjA(B),I=dq.genSalt();if(I[11]=Q.crc>>>24&255,D)I[10]=Q.crc>>>16&255;let C=Buffer.alloc(A.length+12);return E(I,C),E(A,C,12)}yt.exports={decrypt:vjA,encrypt:gjA,_salter:kjA}});var ut=c((bjA)=>{bjA.Deflater=_t();bjA.Inflater=vt();bjA.ZipCrypto=ft()});var Ex=c((LMQ,ht)=>{var sD=aJ(),hjA=Bx(),FE=sD.Constants,Dx=ut();ht.exports=function(A,Q){var B=new hjA.EntryHeader,D=Buffer.alloc(0),E=Buffer.alloc(0),I=!1,C=null,F=Buffer.alloc(0),$=Buffer.alloc(0),H=!0;let Y=A,X=typeof Y.decoder==="object"?Y.decoder:sD.decoder;H=X.hasOwnProperty("efs")?X.efs:!1;function W(){if(!Q||!(Q instanceof Uint8Array))return Buffer.alloc(0);return $=B.loadLocalHeaderFromBinary(Q),Q.slice(B.realDataOffset,B.realDataOffset+B.compressedSize)}function M(V){if(!B.flags_desc){if(sD.crc32(V)!==B.localHeader.crc)return!1}else{let T={},j=B.realDataOffset+B.compressedSize;if(Q.readUInt32LE(j)==FE.LOCSIG||Q.readUInt32LE(j)==FE.CENSIG)throw sD.Errors.DESCRIPTOR_NOT_EXIST();if(Q.readUInt32LE(j)==FE.EXTSIG)T.crc=Q.readUInt32LE(j+FE.EXTCRC),T.compressedSize=Q.readUInt32LE(j+FE.EXTSIZ),T.size=Q.readUInt32LE(j+FE.EXTLEN);else if(Q.readUInt16LE(j+12)===19280)T.crc=Q.readUInt32LE(j+FE.EXTCRC-4),T.compressedSize=Q.readUInt32LE(j+FE.EXTSIZ-4),T.size=Q.readUInt32LE(j+FE.EXTLEN-4);else throw sD.Errors.DESCRIPTOR_UNKNOWN();if(T.compressedSize!==B.compressedSize||T.size!==B.size||T.crc!==B.crc)throw sD.Errors.DESCRIPTOR_FAULTY();if(sD.crc32(V)!==T.crc)return!1}return!0}function q(V,T,j){if(typeof T>"u"&&typeof V==="string")j=V,V=void 0;if(I){if(V&&T)T(Buffer.alloc(0),sD.Errors.DIRECTORY_CONTENT_ERROR());return Buffer.alloc(0)}var d=W();if(d.length===0){if(V&&T)T(d);return d}if(B.encrypted){if(typeof j!=="string"&&!Buffer.isBuffer(j))throw sD.Errors.INVALID_PASS_PARAM();d=Dx.ZipCrypto.decrypt(d,B,j)}var u=Buffer.alloc(B.size);switch(B.method){case sD.Constants.STORED:if(d.copy(u),!M(u)){if(V&&T)T(u,sD.Errors.BAD_CRC());throw sD.Errors.BAD_CRC()}else{if(V&&T)T(u);return u}case sD.Constants.DEFLATED:var r=new Dx.Inflater(d,B.size);if(!V){if(r.inflate(u).copy(u,0),!M(u))throw sD.Errors.BAD_CRC(`"${X.decode(D)}"`);return u}else r.inflateAsync(function(p){if(p.copy(p,0),T)if(!M(p))T(p,sD.Errors.BAD_CRC());else T(p)});break;default:if(V&&T)T(Buffer.alloc(0),sD.Errors.UNKNOWN_METHOD());throw sD.Errors.UNKNOWN_METHOD()}}function Z(V,T){if((!C||!C.length)&&Buffer.isBuffer(Q)){if(V&&T)T(W());return W()}if(C.length&&!I){var j;switch(B.method){case sD.Constants.STORED:if(B.compressedSize=B.size,j=Buffer.alloc(C.length),C.copy(j),V&&T)T(j);return j;default:case sD.Constants.DEFLATED:var d=new Dx.Deflater(C);if(!V){var u=d.deflate();return B.compressedSize=u.length,u}else d.deflateAsync(function(r){j=Buffer.alloc(r.length),B.compressedSize=r.length,r.copy(j),T&&T(j)});d=null;break}}else if(V&&T)T(Buffer.alloc(0));else return Buffer.alloc(0)}function z(V,T){return(V.readUInt32LE(T+4)<<4)+V.readUInt32LE(T)}function R(V){try{var T=0,j,d,u;while(T+4<V.length)if(j=V.readUInt16LE(T),T+=2,d=V.readUInt16LE(T),T+=2,u=V.slice(T,T+d),T+=d,FE.ID_ZIP64===j)O(u)}catch(r){throw sD.Errors.EXTRA_FIELD_PARSE_ERROR()}}function O(V){var T,j,d,u;if(V.length>=FE.EF_ZIP64_SCOMP){if(T=z(V,FE.EF_ZIP64_SUNCOMP),B.size===FE.EF_ZIP64_OR_32)B.size=T}if(V.length>=FE.EF_ZIP64_RHO){if(j=z(V,FE.EF_ZIP64_SCOMP),B.compressedSize===FE.EF_ZIP64_OR_32)B.compressedSize=j}if(V.length>=FE.EF_ZIP64_DSN){if(d=z(V,FE.EF_ZIP64_RHO),B.offset===FE.EF_ZIP64_OR_32)B.offset=d}if(V.length>=FE.EF_ZIP64_DSN+4){if(u=V.readUInt32LE(FE.EF_ZIP64_DSN),B.diskNumStart===FE.EF_ZIP64_OR_16)B.diskNumStart=u}}return{get entryName(){return X.decode(D)},get rawEntryName(){return D},set entryName(V){D=sD.toBuffer(V,X.encode);var T=D[D.length-1];I=T===47||T===92,B.fileNameLength=D.length},get efs(){if(typeof H==="function")return H(this.entryName);else return H},get extra(){return F},set extra(V){F=V,B.extraLength=V.length,R(V)},get comment(){return X.decode(E)},set comment(V){if(E=sD.toBuffer(V,X.encode),B.commentLength=E.length,E.length>65535)throw sD.Errors.COMMENT_TOO_LONG()},get name(){var V=X.decode(D);return I?V.substr(V.length-1).split("/").pop():V.split("/").pop()},get isDirectory(){return I},getCompressedData:function(){return Z(!1,null)},getCompressedDataAsync:function(V){Z(!0,V)},setData:function(V){if(C=sD.toBuffer(V,sD.decoder.encode),!I&&C.length)B.size=C.length,B.method=sD.Constants.DEFLATED,B.crc=sD.crc32(V),B.changed=!0;else B.method=sD.Constants.STORED},getData:function(V){if(B.changed)return C;else return q(!1,null,V)},getDataAsync:function(V,T){if(B.changed)V(C);else q(!0,V,T)},set attr(V){B.attr=V},get attr(){return B.attr},set header(V){B.loadFromBinary(V)},get header(){return B},packCentralHeader:function(){B.flags_efs=this.efs,B.extraLength=F.length;var V=B.centralHeaderToBinary(),T=sD.Constants.CENHDR;return D.copy(V,T),T+=D.length,F.copy(V,T),T+=B.extraLength,E.copy(V,T),V},packLocalHeader:function(){let V=0;B.flags_efs=this.efs,B.extraLocalLength=$.length;let T=B.localHeaderToBinary(),j=Buffer.alloc(T.length+D.length+B.extraLocalLength);return T.copy(j,V),V+=T.length,D.copy(j,V),V+=D.length,$.copy(j,V),V+=$.length,j},toJSON:function(){let V=function(T){return"<"+(T&&T.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:B.toJSON(),compressedData:V(Q),data:V(C)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var lt=c((OMQ,ct)=>{var mt=Ex(),mjA=Bx(),ZI=aJ();ct.exports=function(A,Q){var B=[],D={},E=Buffer.alloc(0),I=new mjA.MainHeader,C=!1,F=null;let $=new Set,H=Q,{noSort:Y,decoder:X}=H;if(A)q(H.readEntries);else C=!0;function W(){let z=new Set;for(let R of Object.keys(D)){let O=R.split("/");if(O.pop(),!O.length)continue;for(let V=0;V<O.length;V++){let T=O.slice(0,V+1).join("/")+"/";z.add(T)}}for(let R of z)if(!(R in D)){let O=new mt(H);O.entryName=R,O.attr=16,O.temporary=!0,B.push(O),D[O.entryName]=O,$.add(O)}}function M(){if(C=!0,D={},I.diskEntries>(A.length-I.offset)/ZI.Constants.CENHDR)throw ZI.Errors.DISK_ENTRY_TOO_LARGE();B=Array(I.diskEntries);var z=I.offset;for(var R=0;R<B.length;R++){var O=z,V=new mt(H,A);if(V.header=A.slice(O,O+=ZI.Constants.CENHDR),V.entryName=A.slice(O,O+=V.header.fileNameLength),V.header.extraLength)V.extra=A.slice(O,O+=V.header.extraLength);if(V.header.commentLength)V.comment=A.slice(O,O+V.header.commentLength);z+=V.header.centralHeaderSize,B[R]=V,D[V.entryName]=V}$.clear(),W()}function q(z){var R=A.length-ZI.Constants.ENDHDR,O=Math.max(0,R-65535),V=O,T=A.length,j=-1,d=0;if(typeof H.trailingSpace==="boolean"?H.trailingSpace:!1)O=0;for(R;R>=V;R--){if(A[R]!==80)continue;if(A.readUInt32LE(R)===ZI.Constants.ENDSIG){j=R,d=R,T=R+ZI.Constants.ENDHDR,V=R-ZI.Constants.END64HDR;continue}if(A.readUInt32LE(R)===ZI.Constants.END64SIG){V=O;continue}if(A.readUInt32LE(R)===ZI.Constants.ZIP64SIG){j=R,T=R+ZI.readBigUInt64LE(A,R+ZI.Constants.ZIP64SIZE)+ZI.Constants.ZIP64LEAD;break}}if(j==-1)throw ZI.Errors.INVALID_FORMAT();if(I.loadFromBinary(A.slice(j,T)),I.commentLength)E=A.slice(d+ZI.Constants.ENDHDR);if(z)M()}function Z(){if(B.length>1&&!Y)B.sort((z,R)=>z.entryName.toLowerCase().localeCompare(R.entryName.toLowerCase()))}return{get entries(){if(!C)M();return B.filter((z)=>!$.has(z))},get comment(){return X.decode(E)},set comment(z){E=ZI.toBuffer(z,X.encode),I.commentLength=E.length},getEntryCount:function(){if(!C)return I.diskEntries;return B.length},forEach:function(z){this.entries.forEach(z)},getEntry:function(z){if(!C)M();return D[z]||null},setEntry:function(z){if(!C)M();B.push(z),D[z.entryName]=z,I.totalEntries=B.length},deleteFile:function(z,R=!0){if(!C)M();let O=D[z];this.getEntryChildren(O,R).map((T)=>T.entryName).forEach(this.deleteEntry)},deleteEntry:function(z){if(!C)M();let R=D[z],O=B.indexOf(R);if(O>=0)B.splice(O,1),delete D[z],I.totalEntries=B.length},getEntryChildren:function(z,R=!0){if(!C)M();if(typeof z==="object")if(z.isDirectory&&R){let O=[],V=z.entryName;for(let T of B)if(T.entryName.startsWith(V))O.push(T);return O}else return[z];return[]},getChildCount:function(z){if(z&&z.isDirectory){let R=this.getEntryChildren(z);return R.includes(z)?R.length-1:R.length}return 0},compressToBuffer:function(){if(!C)M();Z();let z=[],R=[],O=0,V=0;I.size=0,I.offset=0;let T=0;for(let u of this.entries){let r=u.getCompressedData();u.header.offset=V;let p=u.packLocalHeader(),t=p.length+r.length;V+=t,z.push(p),z.push(r);let i=u.packCentralHeader();R.push(i),I.size+=i.length,O+=t+i.length,T++}O+=I.mainHeaderSize,I.offset=V,I.totalEntries=T,V=0;let j=Buffer.alloc(O);for(let u of z)u.copy(j,V),V+=u.length;for(let u of R)u.copy(j,V),V+=u.length;let d=I.toBinary();if(E)E.copy(d,ZI.Constants.ENDHDR);return d.copy(j,V),A=j,C=!1,j},toAsyncBuffer:function(z,R,O,V){try{if(!C)M();Z();let T=[],j=[],d=0,u=0,r=0;I.size=0,I.offset=0;let p=function(t){if(t.length>0){let i=t.shift(),XA=i.entryName+i.extra.toString();if(O)O(XA);i.getCompressedDataAsync(function($A){if(V)V(XA);i.header.offset=u;let WA=i.packLocalHeader(),n=WA.length+$A.length;u+=n,T.push(WA),T.push($A);let P=i.packCentralHeader();j.push(P),I.size+=P.length,d+=n+P.length,r++,p(t)})}else{d+=I.mainHeaderSize,I.offset=u,I.totalEntries=r,u=0;let i=Buffer.alloc(d);T.forEach(function($A){$A.copy(i,u),u+=$A.length}),j.forEach(function($A){$A.copy(i,u),u+=$A.length});let XA=I.toBinary();if(E)E.copy(XA,ZI.Constants.ENDHDR);XA.copy(i,u),A=i,C=!1,z(i)}};p(Array.from(this.entries))}catch(T){R(T)}}}}});var Ix=c((SMQ,pt)=>{var AE=aJ(),GE=kA("path"),cjA=Ex(),ljA=lt(),w$=(...A)=>AE.findLast(A,(Q)=>typeof Q==="boolean"),dt=(...A)=>AE.findLast(A,(Q)=>typeof Q==="string"),djA=(...A)=>AE.findLast(A,(Q)=>typeof Q==="function"),pjA={noSort:!1,readEntries:!1,method:AE.Constants.NONE,fs:null};pt.exports=function(A,Q){let B=null,D=Object.assign(Object.create(null),pjA);if(A&&typeof A==="object"){if(!(A instanceof Uint8Array)){if(Object.assign(D,A),A=D.input?D.input:void 0,D.input)delete D.input}if(Buffer.isBuffer(A))B=A,D.method=AE.Constants.BUFFER,A=void 0}Object.assign(D,Q);let E=new AE(D);if(typeof D.decoder!=="object"||typeof D.decoder.encode!=="function"||typeof D.decoder.decode!=="function")D.decoder=AE.decoder;if(A&&typeof A==="string")if(E.fs.existsSync(A))D.method=AE.Constants.FILE,D.filename=A,B=E.fs.readFileSync(A);else throw AE.Errors.INVALID_FILENAME();let I=new ljA(B,D),{canonical:C,sanitize:F,zipnamefix:$}=AE;function H(M){if(M&&I){var q;if(typeof M==="string")q=I.getEntry(GE.posix.normalize(M));if(typeof M==="object"&&typeof M.entryName<"u"&&typeof M.header<"u")q=I.getEntry(M.entryName);if(q)return q}return null}function Y(M){let{join:q,normalize:Z,sep:z}=GE.posix;return q(".",Z(z+M.split("\\").join(z)+z))}function X(M){if(M instanceof RegExp)return function(q){return function(Z){return q.test(Z)}}(M);else if(typeof M!=="function")return()=>!0;return M}let W=(M,q)=>{let Z=q.slice(-1);return Z=Z===E.sep?E.sep:"",GE.relative(M,q)+Z};return{readFile:function(M,q){var Z=H(M);return Z&&Z.getData(q)||null},childCount:function(M){let q=H(M);if(q)return I.getChildCount(q)},readFileAsync:function(M,q){var Z=H(M);if(Z)Z.getDataAsync(q);else q(null,"getEntry failed for:"+M)},readAsText:function(M,q){var Z=H(M);if(Z){var z=Z.getData();if(z&&z.length)return z.toString(q||"utf8")}return""},readAsTextAsync:function(M,q,Z){var z=H(M);if(z)z.getDataAsync(function(R,O){if(O){q(R,O);return}if(R&&R.length)q(R.toString(Z||"utf8"));else q("")});else q("")},deleteFile:function(M,q=!0){var Z=H(M);if(Z)I.deleteFile(Z.entryName,q)},deleteEntry:function(M){var q=H(M);if(q)I.deleteEntry(q.entryName)},addZipComment:function(M){I.comment=M},getZipComment:function(){return I.comment||""},addZipEntryComment:function(M,q){var Z=H(M);if(Z)Z.comment=q},getZipEntryComment:function(M){var q=H(M);if(q)return q.comment||"";return""},updateFile:function(M,q){var Z=H(M);if(Z)Z.setData(q)},addLocalFile:function(M,q,Z,z){if(E.fs.existsSync(M)){q=q?Y(q):"";let R=GE.win32.basename(GE.win32.normalize(M));q+=Z?Z:R;let O=E.fs.statSync(M),V=O.isFile()?E.fs.readFileSync(M):Buffer.alloc(0);if(O.isDirectory())q+=E.sep;this.addFile(q,V,z,O)}else throw AE.Errors.FILE_NOT_FOUND(M)},addLocalFileAsync:function(M,q){M=typeof M==="object"?M:{localPath:M};let Z=GE.resolve(M.localPath),{comment:z}=M,{zipPath:R,zipName:O}=M,V=this;E.fs.stat(Z,function(T,j){if(T)return q(T,!1);R=R?Y(R):"";let d=GE.win32.basename(GE.win32.normalize(Z));if(R+=O?O:d,j.isFile())E.fs.readFile(Z,function(u,r){if(u)return q(u,!1);return V.addFile(R,r,z,j),setImmediate(q,void 0,!0)});else if(j.isDirectory())return R+=E.sep,V.addFile(R,Buffer.alloc(0),z,j),setImmediate(q,void 0,!0)})},addLocalFolder:function(M,q,Z){if(Z=X(Z),q=q?Y(q):"",M=GE.normalize(M),E.fs.existsSync(M)){let z=E.findFiles(M),R=this;if(z.length)for(let O of z){let V=GE.join(q,W(M,O));if(Z(V))R.addLocalFile(O,GE.dirname(V))}}else throw AE.Errors.FILE_NOT_FOUND(M)},addLocalFolderAsync:function(M,q,Z,z){z=X(z),Z=Z?Y(Z):"",M=GE.normalize(M);var R=this;E.fs.open(M,"r",function(O){if(O&&O.code==="ENOENT")q(void 0,AE.Errors.FILE_NOT_FOUND(M));else if(O)q(void 0,O);else{var V=E.findFiles(M),T=-1,j=function(){if(T+=1,T<V.length){var d=V[T],u=W(M,d).split("\\").join("/");if(u=u.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),z(u))E.fs.stat(d,function(r,p){if(r)q(void 0,r);if(p.isFile())E.fs.readFile(d,function(t,i){if(t)q(void 0,t);else R.addFile(Z+u,i,"",p),j()});else R.addFile(Z+u+"/",Buffer.alloc(0),"",p),j()});else process.nextTick(()=>{j()})}else q(!0,void 0)};j()}})},addLocalFolderAsync2:function(M,q){let Z=this;M=typeof M==="object"?M:{localPath:M},localPath=GE.resolve(Y(M.localPath));let{zipPath:z,filter:R,namefix:O}=M;if(R instanceof RegExp)R=function(j){return function(d){return j.test(d)}}(R);else if(typeof R!=="function")R=function(){return!0};if(z=z?Y(z):"",O=="latin1")O=(j)=>j.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"");if(typeof O!=="function")O=(j)=>j;let V=(j)=>GE.join(z,O(W(localPath,j))),T=(j)=>GE.win32.basename(GE.win32.normalize(O(j)));E.fs.open(localPath,"r",function(j){if(j&&j.code==="ENOENT")q(void 0,AE.Errors.FILE_NOT_FOUND(localPath));else if(j)q(void 0,j);else E.findFilesAsync(localPath,function(d,u){if(d)return q(d);if(u=u.filter((r)=>R(V(r))),!u.length)q(void 0,!1);setImmediate(u.reverse().reduce(function(r,p){return function(t,i){if(t||i===!1)return setImmediate(r,t,!1);Z.addLocalFileAsync({localPath:p,zipPath:GE.dirname(V(p)),zipName:T(p)},r)}},q))})})},addLocalFolderPromise:function(M,q){return new Promise((Z,z)=>{this.addLocalFolderAsync2(Object.assign({localPath:M},q),(R,O)=>{if(R)z(R);if(O)Z(this)})})},addFile:function(M,q,Z,z){M=$(M);let R=H(M),O=R!=null;if(!O)R=new cjA(D),R.entryName=M;R.comment=Z||"";let V=typeof z==="object"&&z instanceof E.fs.Stats;if(V)R.header.time=z.mtime;var T=R.isDirectory?16:0;let j=R.isDirectory?16384:32768;if(V)j|=4095&z.mode;else if(typeof z==="number")j|=4095&z;else j|=R.isDirectory?493:420;if(T=(T|j<<16)>>>0,R.attr=T,R.setData(q),!O)I.setEntry(R);return R},getEntries:function(M){return I.password=M,I?I.entries:[]},getEntry:function(M){return H(M)},getEntryCount:function(){return I.getEntryCount()},forEach:function(M){return I.forEach(M)},extractEntryTo:function(M,q,Z,z,R,O){z=w$(!1,z),R=w$(!1,R),Z=w$(!0,Z),O=dt(R,O);var V=H(M);if(!V)throw AE.Errors.NO_ENTRY();var T=C(V.entryName),j=F(q,O&&!V.isDirectory?O:Z?T:GE.basename(T));if(V.isDirectory){var d=I.getEntryChildren(V);return d.forEach(function(p){if(p.isDirectory)return;var t=p.getData();if(!t)throw AE.Errors.CANT_EXTRACT_FILE();var i=C(p.entryName),XA=F(q,Z?i:GE.basename(i));let $A=R?p.header.fileAttr:void 0;E.writeFileTo(XA,t,z,$A)}),!0}var u=V.getData(I.password);if(!u)throw AE.Errors.CANT_EXTRACT_FILE();if(E.fs.existsSync(j)&&!z)throw AE.Errors.CANT_OVERRIDE();let r=R?M.header.fileAttr:void 0;return E.writeFileTo(j,u,z,r),!0},test:function(M){if(!I)return!1;for(var q in I.entries)try{if(q.isDirectory)continue;var Z=I.entries[q].getData(M);if(!Z)return!1}catch(z){return!1}return!0},extractAllTo:function(M,q,Z,z){if(Z=w$(!1,Z),z=dt(Z,z),q=w$(!1,q),!I)throw AE.Errors.NO_ZIP();I.entries.forEach(function(R){var O=F(M,C(R.entryName));if(R.isDirectory){E.makeDir(O);return}var V=R.getData(z);if(!V)throw AE.Errors.CANT_EXTRACT_FILE();let T=Z?R.header.fileAttr:void 0;E.writeFileTo(O,V,q,T);try{E.fs.utimesSync(O,R.header.time,R.header.time)}catch(j){throw AE.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(M,q,Z,z){if(z=djA(q,Z,z),Z=w$(!1,Z),q=w$(!1,q),!z)return new Promise((j,d)=>{this.extractAllToAsync(M,q,Z,function(u){if(u)d(u);else j(this)})});if(!I){z(AE.Errors.NO_ZIP());return}M=GE.resolve(M);let R=(j)=>F(M,GE.normalize(C(j.entryName))),O=(j,d)=>Error(j+': "'+d+'"'),V=[],T=[];I.entries.forEach((j)=>{if(j.isDirectory)V.push(j);else T.push(j)});for(let j of V){let d=R(j),u=Z?j.header.fileAttr:void 0;try{if(E.makeDir(d),u)E.fs.chmodSync(d,u);E.fs.utimesSync(d,j.header.time,j.header.time)}catch(r){z(O("Unable to create folder",d))}}T.reverse().reduce(function(j,d){return function(u){if(u)j(u);else{let r=GE.normalize(C(d.entryName)),p=F(M,r);d.getDataAsync(function(t,i){if(i)j(i);else if(!t)j(AE.Errors.CANT_EXTRACT_FILE());else{let XA=Z?d.header.fileAttr:void 0;E.writeFileToAsync(p,t,q,XA,function($A){if(!$A)j(O("Unable to write file",p));E.fs.utimes(p,d.header.time,d.header.time,function(WA){if(WA)j(O("Unable to set times",p));else j()})})}})}}},z)()},writeZip:function(M,q){if(arguments.length===1){if(typeof M==="function")q=M,M=""}if(!M&&D.filename)M=D.filename;if(!M)return;var Z=I.compressToBuffer();if(Z){var z=E.writeFileTo(M,Z,!0);if(typeof q==="function")q(!z?Error("failed"):null,"")}},writeZipPromise:function(M,q){let{overwrite:Z,perm:z}=Object.assign({overwrite:!0},q);return new Promise((R,O)=>{if(!M&&D.filename)M=D.filename;if(!M)O("ADM-ZIP: ZIP File Name Missing");this.toBufferPromise().then((V)=>{let T=(j)=>j?R(j):O("ADM-ZIP: Wasn't able to write zip file");E.writeFileToAsync(M,V,Z,z,T)},O)})},toBufferPromise:function(){return new Promise((M,q)=>{I.toAsyncBuffer(M,q)})},toBuffer:function(M,q,Z,z){if(typeof M==="function")return I.toAsyncBuffer(M,q,Z,z),null;return I.compressToBuffer()}}}});var at=c((TMQ,rt)=>{var it={};rt.exports=it;var nt={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(nt).forEach(function(A){var Q=nt[A],B=it[A]=[];B.open="\x1B["+Q[0]+"m",B.close="\x1B["+Q[1]+"m"})});var st=c((jMQ,ot)=>{ot.exports=function(A,Q){Q=Q||process.argv;var B=Q.indexOf("--"),D=/^-{1,2}/.test(A)?"":"--",E=Q.indexOf(D+A);return E!==-1&&(B===-1?!0:E<B)}});var et=c((PMQ,tt)=>{var njA=kA("os"),RC=st(),U1=process.env,sJ=void 0;if(RC("no-color")||RC("no-colors")||RC("color=false"))sJ=!1;else if(RC("color")||RC("colors")||RC("color=true")||RC("color=always"))sJ=!0;if("FORCE_COLOR"in U1)sJ=U1.FORCE_COLOR.length===0||parseInt(U1.FORCE_COLOR,10)!==0;function ijA(A){if(A===0)return!1;return{level:A,hasBasic:!0,has256:A>=2,has16m:A>=3}}function rjA(A){if(sJ===!1)return 0;if(RC("color=16m")||RC("color=full")||RC("color=truecolor"))return 3;if(RC("color=256"))return 2;if(A&&!A.isTTY&&sJ!==!0)return 0;var Q=sJ?1:0;if(process.platform==="win32"){var B=njA.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(B[0])>=10&&Number(B[2])>=10586)return Number(B[2])>=14931?3:2;return 1}if("CI"in U1){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(E){return E in U1})||U1.CI_NAME==="codeship")return 1;return Q}if("TEAMCITY_VERSION"in U1)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U1.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in U1){var D=parseInt((U1.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U1.TERM_PROGRAM){case"iTerm.app":return D>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(U1.TERM))return 2;if(/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(U1.TERM))return 1;if("COLORTERM"in U1)return 1;if(U1.TERM==="dumb")return Q;return Q}function Cx(A){var Q=rjA(A);return ijA(Q)}tt.exports={supportsColor:Cx,stdout:Cx(process.stdout),stderr:Cx(process.stderr)}});var Qe=c((_MQ,Ae)=>{Ae.exports=function(Q,B){var D="";Q=Q||"Run the trap, drop the bass",Q=Q.split("");var E={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};return Q.forEach(function(I){I=I.toLowerCase();var C=E[I]||[" "],F=Math.floor(Math.random()*C.length);if(typeof E[I]<"u")D+=E[I][F];else D+=I}),D}});var De=c((xMQ,Be)=>{Be.exports=function(Q,B){Q=Q||" he is here ";var D={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]},E=[].concat(D.up,D.down,D.mid);function I($){var H=Math.floor(Math.random()*$);return H}function C($){var H=!1;return E.filter(function(Y){H=Y===$}),H}function F($,H){var Y="",X,W;H=H||{},H.up=typeof H.up<"u"?H.up:!0,H.mid=typeof H.mid<"u"?H.mid:!0,H.down=typeof H.down<"u"?H.down:!0,H.size=typeof H.size<"u"?H.size:"maxi",$=$.split("");for(W in $){if(C(W))continue;switch(Y=Y+$[W],X={up:0,down:0,mid:0},H.size){case"mini":X.up=I(8),X.mid=I(2),X.down=I(8);break;case"maxi":X.up=I(16)+3,X.mid=I(4)+1,X.down=I(64)+3;break;default:X.up=I(8)+1,X.mid=I(6)/2,X.down=I(8)+1;break}var M=["up","mid","down"];for(var q in M){var Z=M[q];for(var z=0;z<=X[Z];z++)if(H[Z])Y=Y+D[Z][I(D[Z].length)]}}return Y}return F(Q,B)}});var Ie=c((vMQ,Ee)=>{Ee.exports=function(A){return function(Q,B,D){if(Q===" ")return Q;switch(B%3){case 0:return A.red(Q);case 1:return A.white(Q);case 2:return A.blue(Q)}}}});var Fe=c((kMQ,Ce)=>{Ce.exports=function(A){return function(Q,B,D){return B%2===0?Q:A.inverse(Q)}}});var $e=c((gMQ,Ge)=>{Ge.exports=function(A){var Q=["red","yellow","green","blue","magenta"];return function(B,D,E){if(B===" ")return B;else return A[Q[D++%Q.length]](B)}}});var He=c((bMQ,Je)=>{Je.exports=function(A){var Q=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(B,D,E){return B===" "?B:A[Q[Math.round(Math.random()*(Q.length-2))]](B)}}});var Ke=c((fMQ,We)=>{var CD={};We.exports=CD;CD.themes={};var ajA=kA("util"),M$=CD.styles=at(),Ye=Object.defineProperties,ojA=new RegExp(/[\r\n]+/g);CD.supportsColor=et().supportsColor;if(typeof CD.enabled>"u")CD.enabled=CD.supportsColor()!==!1;CD.enable=function(){CD.enabled=!0};CD.disable=function(){CD.enabled=!1};CD.stripColors=CD.strip=function(A){return(""+A).replace(/\x1B\[\d+m/g,"")};var yMQ=CD.stylize=function(Q,B){if(!CD.enabled)return Q+"";var D=M$[B];if(!D&&B in CD)return CD[B](Q);return D.open+Q+D.close},sjA=/[|\\{}()[\]^$+*?.]/g,tjA=function(A){if(typeof A!=="string")throw TypeError("Expected a string");return A.replace(sjA,"\\$&")};function Xe(A){var Q=function B(){return APA.apply(B,arguments)};return Q._styles=A,Q.__proto__=ejA,Q}var Ue=function(){var A={};return M$.grey=M$.gray,Object.keys(M$).forEach(function(Q){M$[Q].closeRe=new RegExp(tjA(M$[Q].close),"g"),A[Q]={get:function(){return Xe(this._styles.concat(Q))}}}),A}(),ejA=Ye(function(){},Ue);function APA(){var A=Array.prototype.slice.call(arguments),Q=A.map(function(C){if(C!=null&&C.constructor===String)return C;else return ajA.inspect(C)}).join(" ");if(!CD.enabled||!Q)return Q;var B=Q.indexOf(`
|
|
@@ -589,7 +589,7 @@ const partysocket = new PartySocket({
|
|
|
589
589
|
${M} package(s) are incompatible with channel "${C}"`),w.warn("An app store update may be required for these changes to take effect.")}else w.success(`
|
|
590
590
|
All packages are compatible with channel "${C}"`)}return{finalCompatibility:$.finalCompatibility,hasIncompatible:H,resolvedAppId:I,channel:C}}async function XYA(A,Q){try{await sW(A,Q,!1)}catch(B){throw w.error(`Error checking compatibility ${_A(B)}`),B}}TB();q4();import{existsSync as gc,readFileSync as ZYA,writeFileSync as O8Q}from"node:fs";import{cwd as S8Q}from"node:process";import{Buffer as lF}from"node:buffer";import{constants as z8Q,createCipheriv as R8Q,createDecipheriv as V8Q,generateKeyPairSync as L8Q,privateEncrypt as vc,publicDecrypt as kc,randomBytes as UYA}from"node:crypto";var WYA="aes-128-cbc",dF="base64",cL="hex",f5=z8Q.RSA_PKCS1_PADDING;function lL(A){let Q=UYA(16),B=UYA(16),D=Q.toString(dF),E=vc({key:A,padding:f5},B).toString(dF);return{sessionKey:B,ivSessionKey:`${D}:${E}`}}function u5(A,Q,B){let[D]=B.split(":"),E=lF.from(D,dF),I=R8Q(WYA,Q,E);return I.setAutoPadding(!0),lF.concat([I.update(A),I.final()])}function KYA(A,Q,B){let[D,E]=Q.split(":"),I=kc({key:B,padding:f5},lF.from(E,dF)),C=lF.from(D,dF),F=V8Q(WYA,I,C);return F.setAutoPadding(!0),lF.concat([F.update(A),F.final()])}function h5(A,Q){return vc({key:Q,padding:f5},lF.from(A,dF)).toString(dF)}function m5(A,Q){return vc({key:Q,padding:f5},lF.from(A,cL)).toString(cL)}function wYA(A,Q){return kc({key:Q,padding:f5},lF.from(A,dF)).toString(dF)}function MYA(A,Q){return kc({key:Q,padding:f5},lF.from(A,cL)).toString(cL)}function qYA(){let{publicKey:A,privateKey:Q}=L8Q("rsa",{modulusLength:2048});return{publicKey:A.export({type:"pkcs1",format:"pem"}),privateKey:Q.export({type:"pkcs1",format:"pem"})}}function NYA(A){if(!A)return"";return A.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,20)}AI();ZX();OB();var T8Q="5.30.0",j8Q="6.30.0",P8Q="7.30.0";function _8Q(A,Q){let B=A.key||jF,D=Q.config.plugins?.CapacitorUpdater?.publicKey;if(gc(B))D=ZYA(B,"utf8");else if(!D&&A.keyData)D=A.keyData;return{publicKey:D,fallbackKeyPath:B}}async function bc(A,Q,B,D=!1){if(!D)lQ("Decrypt zip file");try{if(await XD(),!gc(A)){let X=`Zip not found at the path ${A}`;if(!D)w.error(X);throw Error(X)}let E=await sQ();if(!B.key&&!gc(jF)&&!E.config.plugins?.CapacitorUpdater?.publicKey){let X=`Public Key not found at the path ${jF} or in ${E.path}`;if(!D)w.error(X);throw Error(X)}let{publicKey:I,fallbackKeyPath:C}=_8Q(B,E);if(!I){let X=`Cannot find public key ${C} or as keyData option or in ${E.path}`;if(!D)w.error(X);throw Error(X)}let F=ZYA(A),$=KYA(F,Q,B.keyData??I),H=`${A}_decrypted.zip`;if(O8Q(H,$),!D)w.info(`Decrypted zip file at ${H}`);let Y;if(B.checksum){let X=await d6($,"sha256"),W=NE(S8Q()),M=await oI("@capgo/capacitor-updater",W,B.packageJson),q=!1,Z;try{Z=M?oB(M):void 0}catch{Z=void 0}if(Z)q=!f8(Z,T8Q,j8Q,P8Q);if(!D)w.info(`Decrypting checksum with ${q?"V3":"V2"} (based on updater version ${M||"unknown"})`);let z=q?MYA(B.checksum,B.keyData??I):wYA(B.checksum,B.keyData??I);if(Y=X===z,!Y){let R=`Checksum does not match ${X} !== ${z}`;if(!D)w.error(R);throw Error(R)}if(!D)w.info("Checksum matches")}if(!D)XQ("✅ done");return{outputPath:H,checksumMatches:Y}}catch(E){if(!D)w.error(`Error decrypting zip file ${_A(E)}`);throw E instanceof Error?E:Error(String(E))}}async function zYA(A,Q,B){await bc(A,Q,B,!1)}TB();OB();async function yc(A,Q,B,D=!1){if(!D)lQ("Delete bundle");B.apikey=B.apikey||zQ();let E=await sQ();if(Q=mB(Q,E?.config),!B.apikey){if(!D)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Q){if(!D)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!A){if(!D)w.error("Missing argument, you need to provide a bundleId, or be in a capacitor project");throw Error("Missing bundleId")}let I=await GB(B.apikey,B.supaHost,B.supaAnon);if(await ZE(I,Q,D),await SB(I,B.apikey,["write","all"]),await g0(I,B.apikey,Q,3,D,!0),!D)w.info(`Deleting bundle ${Q}@${A} from Capgo`),w.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever");await hL(I,Q,A);let C=await PE(I,Q);if(await LB(B.apikey,{channel:"app",event:"Bundle Deleted",icon:"\uD83D\uDDD1️",user_id:C,tags:{"app-id":Q,bundle:A},notify:!1,notifyConsole:!0}).catch(()=>{}),!D)w.success(`Bundle ${Q}@${A} deleted in Capgo`),XQ("Done");return!0}async function RYA(A,Q,B){return yc(A,Q,B)}TB();q4();import{existsSync as fc,readFileSync as VYA,writeFileSync as x8Q}from"node:fs";import{cwd as v8Q}from"node:process";AI();OB();var k8Q="5.30.0",g8Q="6.30.0",b8Q="7.30.0";function tW(A){console.error(_A(A))}async function uc(A,Q,B,D=!1){let{json:E}=B,I=!E&&!D;if(I)lQ("Encryption"),await XD();try{let C=await sQ(),F=!!C.config.plugins?.CapacitorUpdater?.privateKey,$=!!C.config.plugins?.CapacitorUpdater?.publicKey;if(F&&I)w.warning("There is still a privateKey in the config");if(!fc(A)){let j=`Zip not found at the path ${A}`;if(!D)if(E)tW({error:"zip_not_found"});else w.error(`Error: ${j}`);throw Error(j)}if(!$){if(!D)if(E)tW({error:"missing_public_key"});else w.warning("Warning: Missing Public Key in config");throw Error("Missing public key in config")}let H=B.key||a1,Y=B.keyData||"";if(!fc(H)&&!Y){if(!D)if(E)tW({error:"missing_key"});else w.warning(`Cannot find a private key at ${H} or as a keyData option`),w.error("Error: Missing key");throw Error("Missing private key")}else if(fc(H))Y=VYA(H,"utf8");if(Y&&!Y.startsWith("-----BEGIN RSA PRIVATE KEY-----")){if(!D)if(E)tW({error:"invalid_private_key"});else w.error("The private key provided is not a valid RSA Private key");throw Error("Invalid private key format")}let X=VYA(A),{sessionKey:W,ivSessionKey:M}=lL(Y),q=u5(X,W,M),Z=NE(v8Q()),z=await oI("@capgo/capacitor-updater",Z,B.packageJson),R=!1,O;try{O=z?oB(z):void 0}catch{O=void 0}if(O)R=!f8(O,k8Q,g8Q,b8Q);let V=R?m5(Q,Y):h5(Q,Y);if(I)w.info(`Encrypting checksum with ${R?"V3":"V2"} (based on updater version ${z||"unknown"})`);let T=`${A}_encrypted.zip`;if(x8Q(T,q),!D)if(E)console.log(JSON.stringify({checksum:V,filename:T,ivSessionKey:M},null,2));else w.success(`Encoded Checksum: ${V}`),w.success(`ivSessionKey: ${M}`),w.success(`Encrypted zip saved at ${T}`),XQ("Done ✅");return{checksum:V,filename:T,ivSessionKey:M}}catch(C){if(!D)if(B.json)tW(C);else w.error(`Error encrypting zip file ${_A(C)}`);throw C instanceof Error?C:Error(String(C))}}async function LYA(A,Q,B){await uc(A,Q,B,!1)}TB();AI();OB();async function OYA(A,Q,B=!1){if(!B)lQ("List bundles");await XD(),Q.apikey=Q.apikey||zQ();let D=await sQ();if(A=mB(A,D?.config),!Q.apikey){if(!B)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!A){if(!B)w.error("Missing argument, you need to provide a appid, or be in a capacitor project");throw Error("Missing appId")}let E=await GB(Q.apikey,Q.supaHost,Q.supaAnon);if(await ZE(E,A,B),await SB(E,Q.apikey,["write","all","read","upload"]),await g0(E,Q.apikey,A,1,B,!0),!B)w.info(`Querying available versions of: ${A} in Capgo`);let I=await y5(E,A);if(!B)w.info(`Active versions in Capgo: ${I?.length??0}`),mL(I),XQ("Done ✅");return I}TB();OB();import{stdout as y8Q}from"node:process";async function f8Q(A,Q){let B=await sW(A,Q,!0);return{releaseType:B.hasIncompatible?"native":"OTA",resolvedAppId:B.resolvedAppId,channel:B.channel}}async function SYA(A,Q){try{let{releaseType:B,resolvedAppId:D,channel:E}=await f8Q(A,Q),I=B==="OTA"?["Recommendation: OTA",`Run: npx @capgo/cli@latest bundle upload ${D} --channel ${E}`]:["Recommendation: native",`Save credentials: npx @capgo/cli@latest build credentials save --appId ${D} --platform <ios|android>`,`Request build: npx @capgo/cli@latest build request ${D} --platform <ios|android> --path .`];y8Q.write(`${I.join(`
|
|
591
591
|
`)}
|
|
592
|
-
`)}catch(B){throw w.error(`Error checking release type ${_A(B)}`),B}}import{randomUUID as FFQ}from"node:crypto";import{existsSync as GK,readFileSync as GFQ}from"node:fs";import{cwd as wl,stdin as Ml,stdout as ql}from"node:process";class hc extends TransformStream{outChunkSize;constructor(A){let Q=new Uint8Array(A),B=0;super({transform(D,E){let I=0;while(I<D.length){let C=A-B,F=Math.min(C,D.length-I);if(Q.set(D.subarray(I,I+F),B),I+=F,B+=F,B===A)E.enqueue(Q),Q=new Uint8Array(A),B=0}},flush(D){if(B>0)D.enqueue(Q.subarray(0,B))}}),this.outChunkSize=A}}function jG(A){return A=A.trim(),A=A.replace(/<!--[\s\S]*?-->/g,""),Q();function Q(){return{declaration:B(),root:D()}}function B(){if(!$(/^<\?xml\s*/))return;let W={attributes:{}};while(!(H()||Y("?>"))){let M=I();if(!M)return W;W.attributes[M.name]=M.value}return $(/\?>\s*/),W}function D(){let X=$(/^<([\w-:.]+)\s*/);if(!X)return;let W={name:X[1],attributes:{},children:[]};while(!(H()||Y(">")||Y("?>")||Y("/>"))){let q=I();if(!q)return W;W.attributes[q.name]=q.value}if($(/^\s*\/>\s*/))return W;$(/\??>\s*/),W.content=E();let M;while(M=D())W.children.push(M);return $(/^<\/[\w-:.]+>\s*/),W}function E(){let X=$(/^([^<]*)/);if(X)return F(X[1]);return""}function I(){let X=$(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!X)return;return{name:X[1],value:F(C(X[2]))}}function C(X){return X.replace(/^['"]|['"]$/g,"")}function F(X){return X.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function $(X){let W=A.match(X);if(!W)return;return A=A.slice(W[0].length),W}function H(){return A.length===0}function Y(X){return A.startsWith(X)}}class pF extends Error{}class O1 extends pF{}class dL extends pF{}class mc extends pF{bucketName;constructor(A){super(`Invalid bucket name: ${A}`),this.bucketName=A}}class nF extends pF{objectName;constructor(A){super(`Invalid object name: ${A}`),this.objectName=A}}class f9 extends pF{constructor(){super("accessKey is required")}}class eW extends pF{constructor(){super("secretKey is required")}}class pL extends pF{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}}class PG extends pF{statusCode;code;key;bucketName;resource;region;constructor(A,Q,B,D={}){super(B),this.statusCode=A,this.code=Q,this.key=D.key,this.bucketName=D.bucketName,this.resource=D.resource,this.region=D.region}}async function TYA(A){try{let B=jG(await A.text()).root;if(B?.name!=="Error")throw Error("Invalid root, expected <Error>");let D=B.children.find((H)=>H.name==="Code")?.content??"UnknownErrorCode",E=B.children.find((H)=>H.name==="Message")?.content??"The error message could not be determined.",I=B.children.find((H)=>H.name==="Key")?.content,C=B.children.find((H)=>H.name==="BucketName")?.content,F=B.children.find((H)=>H.name==="Resource")?.content,$=B.children.find((H)=>H.name==="Region")?.content;return new PG(A.status,D,E,{key:I,bucketName:C,resource:F,region:$})}catch{return new PG(A.status,"UnrecognizedError",`Error: Unexpected response code ${A.status} ${A.statusText}. Unable to parse response as XML.`)}}function jYA(A){if(typeof A!=="number"||isNaN(A))return!1;return A>=1&&A<=65535}function PYA(A){if(typeof A!=="string")return!1;if(A.length
|
|
592
|
+
`)}catch(B){throw w.error(`Error checking release type ${_A(B)}`),B}}import{randomUUID as FFQ}from"node:crypto";import{existsSync as GK,readFileSync as GFQ}from"node:fs";import{cwd as wl,stdin as Ml,stdout as ql}from"node:process";class hc extends TransformStream{outChunkSize;constructor(A){let Q=new Uint8Array(A),B=0;super({transform(D,E){let I=0;while(I<D.length){let C=A-B,F=Math.min(C,D.length-I);if(Q.set(D.subarray(I,I+F),B),I+=F,B+=F,B===A)E.enqueue(Q),Q=new Uint8Array(A),B=0}},flush(D){if(B>0)D.enqueue(Q.subarray(0,B))}}),this.outChunkSize=A}}function jG(A){return A=A.trim(),A=A.replace(/<!--[\s\S]*?-->/g,""),Q();function Q(){return{declaration:B(),root:D()}}function B(){if(!$(/^<\?xml\s*/))return;let W={attributes:{}};while(!(H()||Y("?>"))){let M=I();if(!M)return W;W.attributes[M.name]=M.value}return $(/\?>\s*/),W}function D(){let X=$(/^<([\w-:.]+)\s*/);if(!X)return;let W={name:X[1],attributes:{},children:[]};while(!(H()||Y(">")||Y("?>")||Y("/>"))){let q=I();if(!q)return W;W.attributes[q.name]=q.value}if($(/^\s*\/>\s*/))return W;$(/\??>\s*/),W.content=E();let M;while(M=D())W.children.push(M);return $(/^<\/[\w-:.]+>\s*/),W}function E(){let X=$(/^([^<]*)/);if(X)return F(X[1]);return""}function I(){let X=$(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!X)return;return{name:X[1],value:F(C(X[2]))}}function C(X){return X.replace(/^['"]|['"]$/g,"")}function F(X){return X.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function $(X){let W=A.match(X);if(!W)return;return A=A.slice(W[0].length),W}function H(){return A.length===0}function Y(X){return A.startsWith(X)}}class pF extends Error{}class O1 extends pF{}class dL extends pF{}class mc extends pF{bucketName;constructor(A){super(`Invalid bucket name: ${A}`),this.bucketName=A}}class nF extends pF{objectName;constructor(A){super(`Invalid object name: ${A}`),this.objectName=A}}class f9 extends pF{constructor(){super("accessKey is required")}}class eW extends pF{constructor(){super("secretKey is required")}}class pL extends pF{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}}class PG extends pF{statusCode;code;key;bucketName;resource;region;constructor(A,Q,B,D={}){super(B),this.statusCode=A,this.code=Q,this.key=D.key,this.bucketName=D.bucketName,this.resource=D.resource,this.region=D.region}}async function TYA(A){try{let B=jG(await A.text()).root;if(B?.name!=="Error")throw Error("Invalid root, expected <Error>");let D=B.children.find((H)=>H.name==="Code")?.content??"UnknownErrorCode",E=B.children.find((H)=>H.name==="Message")?.content??"The error message could not be determined.",I=B.children.find((H)=>H.name==="Key")?.content,C=B.children.find((H)=>H.name==="BucketName")?.content,F=B.children.find((H)=>H.name==="Resource")?.content,$=B.children.find((H)=>H.name==="Region")?.content;return new PG(A.status,D,E,{key:I,bucketName:C,resource:F,region:$})}catch{return new PG(A.status,"UnrecognizedError",`Error: Unexpected response code ${A.status} ${A.statusText}. Unable to parse response as XML.`)}}function jYA(A){if(typeof A!=="number"||isNaN(A))return!1;return A>=1&&A<=65535}function PYA(A){if(typeof A!=="string")return!1;if(A.length>255)return!1;if(A.includes(".."))return!1;return Boolean(A.match(/^[a-zA-Z0-9][a-zA-Z0-9.-]+[a-zA-Z0-9]$/))}function _G(A){if(!u8Q(A))return!1;if(A.length===0)return!1;return!0}function u8Q(A){if(typeof A!=="string")return!1;if(A.length>1024)return!1;return!0}function AK(A){return Array.from(A).map((Q)=>Q.toString(16).padStart(2,"0")).join("")}function u9(A=""){let Q={'"':"",""":"",""":"",""":"",""":""};return A.replace(/^("|"|")|("|"|")$/g,(B)=>Q[B])}function lc(A){return A.get("x-amz-version-id")??null}function h9(A){let Q=A.toISOString();return Q.slice(0,4)+Q.slice(5,7)+Q.slice(8,13)+Q.slice(14,16)+Q.slice(17,19)+"Z"}function dc(A){return h9(A).slice(0,8)}function pc(A,Q){return`${dc(Q)}/${A}/s3/aws4_request`}async function nL(A){if(!(A instanceof Uint8Array))A=new TextEncoder().encode(A);return AK(new Uint8Array(await crypto.subtle.digest("SHA-256",A)))}var h8Q=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"];class nc extends WritableStream{getResult;constructor({client:A,bucketName:Q,objectName:B,partSize:D,metadata:E}){let I,C=1,F,$=[],H,Y=[];super({start(){},async write(X,W){let q=C++;try{if(q==1&&X.length<D){let R=await A.makeRequest({method:"PUT",headers:new Headers({...E,"Content-Length":String(X.length)}),bucketName:Q,objectName:B,payload:X});I={etag:u9(R.headers.get("etag")??void 0),versionId:lc(R.headers)};return}if(q===1)F=(await m8Q({client:A,bucketName:Q,objectName:B,metadata:E})).uploadId;let Z={"Content-Length":String(X.length)};for(let R of h8Q){let O=E[R];if(O)Z[R]=O}let z=A.makeRequest({method:"PUT",query:{partNumber:q.toString(),uploadId:F},headers:new Headers(Z),bucketName:Q,objectName:B,payload:X}).then((R)=>{let O=R.headers.get("etag")??"";if(O)O=O.replace(/^"/,"").replace(/"$/,"");return $.push({part:q,etag:O}),R});Y.push(z.catch((R)=>{if(!H)H=R}))}catch(Z){throw Z}},async close(){if(I);else if(F){if(await Promise.all(Y),H)throw H;$.sort((X,W)=>X.part>W.part?1:-1),I=await c8Q({client:A,bucketName:Q,objectName:B,uploadId:F,etags:$})}else throw Error("Stream was closed without uploading any data.")}});this.getResult=()=>{if(I===void 0)throw Error("Result is not ready. await the stream first.");return I}}}async function m8Q(A){let B=new Headers(A.metadata),D="uploads",I=await(await A.client.makeRequest({method:"POST",bucketName:A.bucketName,objectName:A.objectName,query:"uploads",headers:B,returnBody:!0})).text(),C=jG(I).root;if(!C||C.name!=="InitiateMultipartUploadResult")throw Error(`Unexpected response: ${I}`);let F=C.children.find(($)=>$.name==="UploadId")?.content;if(!F)throw Error(`Unable to get UploadId from response: ${I}`);return{uploadId:F}}async function c8Q({client:A,bucketName:Q,objectName:B,uploadId:D,etags:E}){let I=`
|
|
593
593
|
<CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
594
594
|
${E.map((X)=>` <Part><PartNumber>${X.part}</PartNumber><ETag>${X.etag}</ETag></Part>`).join(`
|
|
595
595
|
`)}
|
|
@@ -598,7 +598,7 @@ All packages are compatible with channel "${C}"`)}return{finalCompatibility:$.fi
|
|
|
598
598
|
`)+`
|
|
599
599
|
`,D.join(";").toLowerCase(),E].join(`
|
|
600
600
|
`)}async function gYA(A,Q,B){let D=await nL(A),E=pc(B,Q);return[QK,h9(Q),E,D].join(`
|
|
601
|
-
`)}async function rc(A,Q,B){let D=dc(A),E=await c9("AWS4"+B,D),I=await c9(E,Q),C=await c9(I,"s3");return await c9(C,"aws4_request")}function ac(A,Q,B){return`${A}/${pc(Q,B)}`}async function c9(A,Q){let B=new TextEncoder,D=await crypto.subtle.importKey("raw",A instanceof Uint8Array?A:B.encode(A),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),E=await crypto.subtle.sign("HMAC",D,Q instanceof Uint8Array?Q:B.encode(Q));return new Uint8Array(E)}async function bYA(A){if(!A.accessKey)throw new f9;if(!A.secretKey)throw new eW;if(A.expirySeconds<1||A.expirySeconds>604800)throw new pL;let Q=new Date(A.date);Q.setSeconds(Q.getSeconds()+A.expirySeconds);let B=ac(A.accessKey,A.region,A.date),D=h9(A.date),E={"X-Amz-Algorithm":QK,"X-Amz-Credential":B,"X-Amz-Date":D,key:A.objectKey,...A.fields},I=[{bucket:A.bucket},{key:A.objectKey},{"X-Amz-Algorithm":QK},{"X-Amz-Credential":B},{"X-Amz-Date":D}];if(A.conditions)I.push(...A.conditions);for(let[M,q]of Object.entries(A.fields||{})){if(["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(M))continue;I.push({[M]:q})}let C={expiration:Q.toISOString(),conditions:I},F=new TextEncoder().encode(JSON.stringify(C)),$=btoa(String.fromCharCode(...F));E.policy=$;let H=$,Y=await rc(A.date,A.region,A.secretKey),X=AK(await c9(Y,H)).toLowerCase();return E["X-Amz-Signature"]=X,{url:`${A.protocol}//${A.host}/${A.bucket}`,fields:E}}var d8Q=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],p8Q=5242880,n8Q=5368709120,oc=5497558138880;class iL{host;port;protocol;accessKey;#A;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:A,useSSL:Q,port:B,pathPrefix:D,...E}){if(/^https?:\/\//i.test(A)){if(Q!==void 0||B!==void 0||D!==void 0)throw new O1("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let C=new URL(A);if(A=C.hostname,Q=C.protocol==="https:",B=C.port?parseInt(C.port,10):Q?443:80,C.pathname&&C.pathname!=="/")D=C.pathname.endsWith("/")?C.pathname.slice(0,-1):C.pathname}catch{throw new dL(`Invalid endPoint URL: ${A}`)}}if(typeof A!=="string"||A.length===0)throw new dL(`Invalid endPoint: ${A}`);if(Q===void 0)Q=!0;if(B!==void 0&&!jYA(B))throw new O1(`Invalid port: ${B}`);if(E.accessKey&&!E.secretKey)throw new O1("If specifying access key, secret key must also be provided.");if(E.accessKey&&E.accessKey.startsWith("ASIA")&&!E.sessionToken)throw new O1("If specifying temporary access key, session token must also be provided.");let I=Q?443:80;if(this.port=B??I,this.host=A.toLowerCase()+(this.port!==I?`:${this.port}`:""),this.protocol=Q?"https:":"http:",this.accessKey=E.accessKey,this.#A=E.secretKey??"",this.sessionToken=E.sessionToken,this.pathStyle=E.pathStyle??!0,this.pathPrefix=D??"",this.defaultBucket=E.bucket,this.region=E.region,this.pathPrefix){if(!this.pathStyle)throw new O1("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new O1("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new O1("pathPrefix should not end with /")}}getBucketName(A){let Q=A?.bucketName??this.defaultBucket;if(Q===void 0||!PYA(Q))throw new mc(Q??"");return Q}buildRequestOptions(A){let Q=this.getBucketName(A),B=this.pathStyle?this.host:`${Q}.${this.host}`,D=A.headers??new Headers;D.set("host",B);let E=typeof A.query==="object"?new URLSearchParams(A.query).toString().replace("+","%20"):A.query,I=this.pathStyle?`${this.pathPrefix}/${Q}/${A.objectName}`:`/${A.objectName}`,C=E?`?${E}`:"",F=I+C,$=I.split("/").map((H)=>encodeURIComponent(H)).join("/")+C;return{headers:D,host:B,path:F,encodedPath:$}}async makeRequest({method:A,payload:Q,...B}){let D=new Date,{headers:E,host:I,path:C,encodedPath:F}=this.buildRequestOptions(B),$=B.statusCode??200;if(A==="POST"||A==="PUT"||A==="DELETE"){if(Q===void 0)Q=new Uint8Array;else if(typeof Q==="string")Q=new TextEncoder().encode(Q);E.set("Content-Length",String(Q.length))}else if(Q)throw Error(`Unexpected payload on ${A} request.`);let H=await nL(Q??new Uint8Array);if(E.set("x-amz-date",h9(D)),E.set("x-amz-content-sha256",H),this.accessKey){if(this.sessionToken)E.set("x-amz-security-token",this.sessionToken);E.set("authorization",await _YA({headers:E,method:A,path:C,accessKey:this.accessKey,secretKey:this.#A,region:this.region,date:D}))}let Y=`${this.protocol}//${I}${F}`,X=await fetch(Y,{method:A,headers:E,body:Q});if(X.status!==$){if(X.status>=400)throw await TYA(X);else if(X.status===301)throw new PG(X.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"');throw new PG(X.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${$}, got ${X.status} ${X.statusText}).`)}if(!B.returnBody)await X.body?.getReader().read();return X}async deleteObject(A,Q={}){let B=this.getBucketName(Q);if(!_G(A))throw new nF(A);let D=Q.versionId?{versionId:Q.versionId}:{},E=new Headers;if(Q.governanceBypass)E.set("X-Amz-Bypass-Governance-Retention","true");await this.makeRequest({method:"DELETE",bucketName:B,objectName:A,headers:E,query:D,statusCode:204})}async exists(A,Q){try{return await this.statObject(A,Q),!0}catch(B){if(B instanceof PG&&B.statusCode===404)return!1;throw B}}getObject(A,Q){return this.getPartialObject(A,{...Q,offset:0,length:0})}async getPartialObject(A,{offset:Q,length:B,...D}){let E=this.getBucketName(D);if(!_G(A))throw new nF(A);let I=new Headers(Object.entries(D.metadata??{})),C=200;if(Q||B){let $="";if(Q)$=`bytes=${+Q}-`;else $="bytes=0-",Q=0;if(B)$+=`${+B+Q-1}`;I.set("Range",$),C=206}let F={...D.responseParams,...D.versionId?{versionId:D.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:E,objectName:A,headers:I,query:F,statusCode:C,returnBody:!0})}getPresignedUrl(A,Q,B={}){if(!this.accessKey)throw new f9;if(!_G(Q))throw new nF(Q);let{headers:D,path:E}=this.buildRequestOptions({objectName:Q,bucketName:B.bucketName,query:B.parameters}),I=B.requestDate??new Date,C=B.expirySeconds??604800;return xYA({protocol:this.protocol,headers:D,method:A,path:E,accessKey:this.accessKey,secretKey:this.#A,sessionToken:this.sessionToken,region:this.region,date:I,expirySeconds:C})}presignedGetObject(A,Q={}){let{versionId:B,responseParams:D,...E}=Q,I={...D,...B?{versionId:B}:{}};return this.getPresignedUrl("GET",A,{parameters:I,...E})}async*listObjects(A={}){for await(let Q of this.listObjectsGrouped({...A,delimiter:""}))if(Q.type==="Object")yield Q;else throw Error(`Unexpected result from listObjectsGrouped(): ${Q}`)}async*listObjectsGrouped(A){let Q=this.getBucketName(A),B="",D=A.pageSize??1000;if(D<1||D>1000)throw new O1("pageSize must be between 1 and 1,000.");let E=0;while(!0){let I=A.maxResults?Math.min(D,A.maxResults-E):D;if(I===0)return;let F=await(await this.makeRequest({method:"GET",bucketName:Q,objectName:"",query:{"list-type":"2",prefix:A.prefix??"",delimiter:A.delimiter,"max-keys":String(I),...B?{"continuation-token":B}:{}},returnBody:!0})).text(),$=jG(F).root;if(!$||$.name!=="ListBucketResult")throw Error(`Unexpected response: ${F}`);let H=$.children.filter((W)=>W.name==="CommonPrefixes").flatMap((W)=>W.children),Y=[];for(let W of H)Y.push({type:"CommonPrefix",prefix:W.content??""}),E++;for(let W of $.children.filter((M)=>M.name==="Contents"))Y.push({type:"Object",key:W.children.find((M)=>M.name==="Key")?.content??"",etag:u9(W.children.find((M)=>M.name==="ETag")?.content??""),size:parseInt(W.children.find((M)=>M.name==="Size")?.content??"",10),lastModified:new Date(W.children.find((M)=>M.name==="LastModified")?.content??"invalid")}),E++;Y.sort((W,M)=>{let q=W.type==="Object"?W.key:W.prefix,Z=M.type==="Object"?M.key:M.prefix;return q>Z?1:q<Z?-1:0});for(let W of Y)yield W;if($.children.find((W)=>W.name==="IsTruncated")?.content==="true"){let W=$.children.find((M)=>M.name==="NextContinuationToken")?.content;if(!W)throw Error("Unexpectedly missing continuation token, but server said there are more results.");B=W}else return}}async putObject(A,Q,B){let D=this.getBucketName(B);if(!_G(A))throw new nF(A);let E,I;if(typeof Q==="string"){let H=new TextEncoder().encode(Q);if(typeof ReadableStream.from<"u")I=ReadableStream.from([H]);else I=new ReadableStream({start(Y){Y.enqueue(H),Y.close()}});E=H.length}else if(Q instanceof Uint8Array){if(typeof ReadableStream.from<"u")I=ReadableStream.from([Q]);else I=new ReadableStream({start(H){H.enqueue(Q),H.close()}});E=Q.byteLength}else if(Q instanceof ReadableStream)I=Q;else throw new O1("Invalid stream/data type provided.");if(B?.size!==void 0){if(E!==void 0&&B?.size!==E)throw new O1(`size was specified (${B.size}) but doesn't match auto-detected size (${E}).`);if(typeof B.size!=="number"||B.size<0||isNaN(B.size))throw new O1(`invalid size specified: ${B.size}`);else E=B.size}let C=B?.partSize??this.calculatePartSize(E);if(C<p8Q)throw new O1("Part size should be greater than 5MB");else if(C>n8Q)throw new O1("Part size should be less than 6MB");let F=new hc(C),$=new nc({client:this,bucketName:D,objectName:A,partSize:C,metadata:B?.metadata??{}});return await I.pipeThrough(F).pipeTo($),$.getResult()}calculatePartSize(A){if(A===void 0)A=oc;if(A>oc)throw TypeError(`size should not be more than ${oc}`);let Q=67108864;while(!0){if(Q*1e4>A)return Q;Q+=16777216}}async statObject(A,Q){let B=this.getBucketName(Q);if(!_G(A))throw new nF(A);let D={};if(Q?.versionId)D.versionId=Q.versionId;let E=await this.makeRequest({method:"HEAD",bucketName:B,objectName:A,query:D,headers:new Headers(Q?.headers)}),I={};for(let C of d8Q)if(E.headers.has(C))I[C]=E.headers.get(C);return E.headers.forEach((C,F)=>{if(F.startsWith("x-amz-meta-"))I[F]=E.headers.get(F)}),{type:"Object",key:A,size:parseInt(E.headers.get("content-length")??"",10),metadata:I,lastModified:new Date(E.headers.get("Last-Modified")??"error: missing last modified"),versionId:E.headers.get("x-amz-version-id")||null,etag:u9(E.headers.get("ETag")??"")}}async copyObject(A,Q,B){let D=this.getBucketName(B),E=A.sourceBucketName??D;if(!_G(Q))throw new nF(Q);let I=`${E}/${A.sourceKey}`;if(A.sourceVersionId)I+=`?versionId=${A.sourceVersionId}`;let C=new Headers(B?.metadata);if(B?.metadata!==void 0)C.set("x-amz-metadata-directive","REPLACE");C.set("x-amz-copy-source",I);let F=await this.makeRequest({method:"PUT",bucketName:D,objectName:Q,headers:C,returnBody:!0}),$=await F.text(),H=jG($).root;if(!H||H.name!=="CopyObjectResult")throw Error(`Unexpected response: ${$}`);let Y=H.children.find((W)=>W.name==="ETag")?.content??"",X=H.children.find((W)=>W.name==="LastModified")?.content;if(X===void 0)throw Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:F.headers.get("x-amz-copy-source-version-id")||null,etag:u9(Y),lastModified:new Date(X),versionId:F.headers.get("x-amz-version-id")||null}}async bucketExists(A){try{return await this.listObjects({bucketName:A}).next(),!0}catch(Q){if(Q instanceof PG&&Q.statusCode===404)return!1;throw Q}}async makeBucket(A){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:A}),objectName:"",statusCode:200})}async removeBucket(A){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:A}),objectName:"",statusCode:204})}presignedPostObject(A,Q={}){if(!_G(A))throw new nF(A);let B=this.getBucketName(Q);if(!B)throw Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let D=Q.requestDate||new Date,E=Q.expirySeconds??3600;return bYA({protocol:this.protocol,host:this.host,bucket:B,objectKey:A,accessKey:this.accessKey||"",secretKey:this.#A||"",region:this.region,date:D,expirySeconds:E,conditions:Q.conditions,fields:Q.fields})}}TB();V4();q4();K$();AI();ZX();import{spawn as i8Q,spawnSync as r8Q}from"node:child_process";var iF="Cap-go",oL="capacitor-updater",uYA=`${iF}/${oL}`,yYA="capacitor-",sc=[`${iF}/CLI`,`${iF}/capgo`,`${iF}/capgo-skills`],rL=[uYA,...sc],a8Q=20,o8Q=180,s8Q=4,hYA=new Set;class sL extends Error{results;constructor(A=[]){super("Star-all interrupted by user.");this.name="StarAllRepositoriesAbortedError",this.results=A}}function BK(A){return A.toLowerCase()}function ec(A){hYA.add(BK(A))}function c5(A){let Q=tL(A);return hYA.has(BK(Q))}function fYA(A,Q){if(typeof A!=="number")return Q;if(!Number.isFinite(A))return Q;if(A<0)return Q;return Math.floor(A)}function t8Q(A,Q){let B=fYA(A,a8Q),D=fYA(Q,o8Q);if(B<=D)return{min:B,max:D};return{min:D,max:B}}function e8Q(A,Q){if(A===Q)return A;return Math.floor(Math.random()*(Q-A+1))+A}function ACQ(A,Q){if(typeof A!=="number")return Q;if(!Number.isFinite(A))return Q;if(A<1)return Q;return Math.min(Math.floor(A),16)}function aL(A=[]){return new sL(A)}function l9(A,Q=[]){if(A?.aborted)throw aL(Q)}async function QCQ(A,Q){if(A<=0)return;if(!Q)return new Promise((B)=>setTimeout(B,A));if(Q.aborted)throw aL();return new Promise((B,D)=>{let E,I=()=>{clearTimeout(E),Q.removeEventListener("abort",I),D(aL())};E=setTimeout(()=>{Q.removeEventListener("abort",I),B()},A),Q.addEventListener("abort",I,{once:!0})})}function tc(A){let Q=new Set,B=[];for(let D of A){let E=tL(D),I=BK(E);if(!Q.has(I))Q.add(I),B.push(E)}return B}async function BCQ(A,Q){l9(Q),A?.(`Discovering repositories in the ${iF} organization.`);let B=d9(["api","--paginate",`orgs/${iF}/repos`,"--jq",`map(select(.name | startswith("${yYA}")) | .nameWithOwner)[]`]);if(B.status===0&&B.stdout.trim().length>0){let E=B.stdout.split(`
|
|
601
|
+
`)}async function rc(A,Q,B){let D=dc(A),E=await c9("AWS4"+B,D),I=await c9(E,Q),C=await c9(I,"s3");return await c9(C,"aws4_request")}function ac(A,Q,B){return`${A}/${pc(Q,B)}`}async function c9(A,Q){let B=new TextEncoder,D=await crypto.subtle.importKey("raw",A instanceof Uint8Array?A:B.encode(A),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),E=await crypto.subtle.sign("HMAC",D,Q instanceof Uint8Array?Q:B.encode(Q));return new Uint8Array(E)}async function bYA(A){if(!A.accessKey)throw new f9;if(!A.secretKey)throw new eW;if(A.expirySeconds<1||A.expirySeconds>604800)throw new pL;let Q=new Date(A.date);Q.setSeconds(Q.getSeconds()+A.expirySeconds);let B=ac(A.accessKey,A.region,A.date),D=h9(A.date),E={"X-Amz-Algorithm":QK,"X-Amz-Credential":B,"X-Amz-Date":D,key:A.objectKey,...A.fields},I=[{bucket:A.bucket},{key:A.objectKey},{"X-Amz-Algorithm":QK},{"X-Amz-Credential":B},{"X-Amz-Date":D}];if(A.conditions)I.push(...A.conditions);for(let[M,q]of Object.entries(A.fields||{})){if(["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(M))continue;I.push({[M]:q})}let C={expiration:Q.toISOString(),conditions:I},F=new TextEncoder().encode(JSON.stringify(C)),$=btoa(String.fromCharCode(...F));E.policy=$;let H=$,Y=await rc(A.date,A.region,A.secretKey),X=AK(await c9(Y,H)).toLowerCase();return E["X-Amz-Signature"]=X,{url:`${A.protocol}//${A.host}/${A.bucket}`,fields:E}}var d8Q=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],p8Q=5242880,n8Q=5368709120,oc=5497558138880;class iL{host;port;protocol;accessKey;#A;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:A,useSSL:Q,port:B,pathPrefix:D,...E}){if(/^https?:\/\//i.test(A)){if(Q!==void 0||B!==void 0||D!==void 0)throw new O1("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let C=new URL(A);if(A=C.hostname,Q=C.protocol==="https:",B=C.port?parseInt(C.port,10):Q?443:80,C.pathname&&C.pathname!=="/")D=C.pathname.endsWith("/")?C.pathname.slice(0,-1):C.pathname}catch{throw new dL(`Invalid endPoint URL: ${A}`)}}if(typeof A!=="string"||A.length===0)throw new dL(`Invalid endPoint: ${A}`);if(Q===void 0)Q=!0;if(B!==void 0&&!jYA(B))throw new O1(`Invalid port: ${B}`);if(E.accessKey&&!E.secretKey)throw new O1("If specifying access key, secret key must also be provided.");if(E.accessKey&&E.accessKey.startsWith("ASIA")&&!E.sessionToken)throw new O1("If specifying temporary access key, session token must also be provided.");let I=Q?443:80;if(this.port=B??I,this.host=A.toLowerCase()+(this.port!==I?`:${this.port}`:""),this.protocol=Q?"https:":"http:",this.accessKey=E.accessKey,this.#A=E.secretKey??"",this.sessionToken=E.sessionToken,this.pathStyle=E.pathStyle??!0,this.pathPrefix=D??"",this.defaultBucket=E.bucket,this.region=E.region,this.pathPrefix){if(!this.pathStyle)throw new O1("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new O1("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new O1("pathPrefix should not end with /")}}getBucketName(A){let Q=A?.bucketName??this.defaultBucket;if(Q===void 0||!PYA(Q))throw new mc(Q??"");return Q}buildRequestOptions(A){let Q=this.getBucketName(A),B=this.pathStyle?this.host:`${Q}.${this.host}`,D=A.headers??new Headers;D.set("host",B);let E=typeof A.query==="object"?new URLSearchParams(A.query).toString().replace("+","%20"):A.query,I=this.pathStyle?`${this.pathPrefix}/${Q}/${A.objectName}`:`/${A.objectName}`,C=E?`?${E}`:"",F=I+C,$=I.split("/").map((H)=>encodeURIComponent(H)).join("/")+C;return{headers:D,host:B,path:F,encodedPath:$}}async makeRequest({method:A,payload:Q,...B}){let D=new Date,{headers:E,host:I,path:C,encodedPath:F}=this.buildRequestOptions(B),$=B.statusCode??200;if(A==="POST"||A==="PUT"||A==="DELETE"){if(Q===void 0)Q=new Uint8Array;else if(typeof Q==="string")Q=new TextEncoder().encode(Q);E.set("Content-Length",String(Q.length))}else if(Q)throw Error(`Unexpected payload on ${A} request.`);let H=await nL(Q??new Uint8Array);if(E.set("x-amz-date",h9(D)),E.set("x-amz-content-sha256",H),this.accessKey){if(this.sessionToken)E.set("x-amz-security-token",this.sessionToken);E.set("authorization",await _YA({headers:E,method:A,path:C,accessKey:this.accessKey,secretKey:this.#A,region:this.region,date:D}))}let Y=`${this.protocol}//${I}${F}`,X=await fetch(Y,{method:A,headers:E,body:Q});if(X.status!==$){if(X.status>=400)throw await TYA(X);else if(X.status===301)throw new PG(X.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"');throw new PG(X.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${$}, got ${X.status} ${X.statusText}).`)}if(!B.returnBody)await X.body?.getReader().read();return X}async deleteObject(A,Q={}){let B=this.getBucketName(Q);if(!_G(A))throw new nF(A);let D=Q.versionId?{versionId:Q.versionId}:{},E=new Headers;if(Q.governanceBypass)E.set("X-Amz-Bypass-Governance-Retention","true");await this.makeRequest({method:"DELETE",bucketName:B,objectName:A,headers:E,query:D,statusCode:204})}async exists(A,Q){try{return await this.statObject(A,Q),!0}catch(B){if(B instanceof PG&&B.statusCode===404)return!1;throw B}}getObject(A,Q){return this.getPartialObject(A,{...Q,offset:0,length:0})}async getPartialObject(A,{offset:Q,length:B,...D}){let E=this.getBucketName(D);if(!_G(A))throw new nF(A);let I=new Headers(Object.entries(D.metadata??{})),C=200;if(Q||B){let $="";if(Q)$=`bytes=${+Q}-`;else $="bytes=0-",Q=0;if(B)$+=`${+B+Q-1}`;I.set("Range",$),C=206}let F={...D.responseParams,...D.versionId?{versionId:D.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:E,objectName:A,headers:I,query:F,statusCode:C,returnBody:!0})}getPresignedUrl(A,Q,B={}){if(!this.accessKey)throw new f9;if(!_G(Q))throw new nF(Q);let{headers:D,path:E}=this.buildRequestOptions({objectName:Q,bucketName:B.bucketName,query:B.parameters}),I=B.requestDate??new Date,C=B.expirySeconds??604800;return xYA({protocol:this.protocol,headers:D,method:A,path:E,accessKey:this.accessKey,secretKey:this.#A,sessionToken:this.sessionToken,region:this.region,date:I,expirySeconds:C})}presignedGetObject(A,Q={}){let{versionId:B,responseParams:D,...E}=Q,I={...D,...B?{versionId:B}:{}};return this.getPresignedUrl("GET",A,{parameters:I,...E})}async*listObjects(A={}){for await(let Q of this.listObjectsGrouped({...A,delimiter:""}))if(Q.type==="Object")yield Q;else throw Error(`Unexpected result from listObjectsGrouped(): ${Q}`)}async*listObjectsGrouped(A){let Q=this.getBucketName(A),B="",D=A.pageSize??1000;if(D<1||D>1000)throw new O1("pageSize must be between 1 and 1,000.");let E=0;while(!0){let I=A.maxResults?Math.min(D,A.maxResults-E):D;if(I===0)return;let F=await(await this.makeRequest({method:"GET",bucketName:Q,objectName:"",query:{"list-type":"2",prefix:A.prefix??"",delimiter:A.delimiter,"max-keys":String(I),...B?{"continuation-token":B}:{}},returnBody:!0})).text(),$=jG(F).root;if(!$||$.name!=="ListBucketResult")throw Error(`Unexpected response: ${F}`);let H=$.children.filter((W)=>W.name==="CommonPrefixes").flatMap((W)=>W.children),Y=[];for(let W of H)Y.push({type:"CommonPrefix",prefix:W.content??""}),E++;for(let W of $.children.filter((M)=>M.name==="Contents"))Y.push({type:"Object",key:W.children.find((M)=>M.name==="Key")?.content??"",etag:u9(W.children.find((M)=>M.name==="ETag")?.content??""),size:parseInt(W.children.find((M)=>M.name==="Size")?.content??"",10),lastModified:new Date(W.children.find((M)=>M.name==="LastModified")?.content??"invalid")}),E++;Y.sort((W,M)=>{let q=W.type==="Object"?W.key:W.prefix,Z=M.type==="Object"?M.key:M.prefix;return q>Z?1:q<Z?-1:0});for(let W of Y)yield W;if($.children.find((W)=>W.name==="IsTruncated")?.content==="true"){let W=$.children.find((M)=>M.name==="NextContinuationToken")?.content;if(!W)throw Error("Unexpectedly missing continuation token, but server said there are more results.");B=W}else return}}async putObject(A,Q,B){let D=this.getBucketName(B);if(!_G(A))throw new nF(A);let E,I;if(typeof Q==="string"){let H=new TextEncoder().encode(Q);if(typeof ReadableStream.from<"u")I=ReadableStream.from([H]);else I=new ReadableStream({start(Y){Y.enqueue(H),Y.close()}});E=H.length}else if(Q instanceof Uint8Array){if(typeof ReadableStream.from<"u")I=ReadableStream.from([Q]);else I=new ReadableStream({start(H){H.enqueue(Q),H.close()}});E=Q.byteLength}else if(Q instanceof ReadableStream)I=Q;else throw new O1("Invalid stream/data type provided.");if(B?.size!==void 0){if(E!==void 0&&B?.size!==E)throw new O1(`size was specified (${B.size}) but doesn't match auto-detected size (${E}).`);if(typeof B.size!=="number"||B.size<0||isNaN(B.size))throw new O1(`invalid size specified: ${B.size}`);else E=B.size}let C=B?.partSize??this.calculatePartSize(E);if(C<p8Q)throw new O1("Part size should be greater than 5MB");else if(C>n8Q)throw new O1("Part size should be less than 6MB");let F=new hc(C),$=new nc({client:this,bucketName:D,objectName:A,partSize:C,metadata:B?.metadata??{}});return await I.pipeThrough(F).pipeTo($),$.getResult()}calculatePartSize(A){if(A===void 0)A=oc;if(A>oc)throw TypeError(`size should not be more than ${oc}`);let Q=67108864;while(!0){if(Q*1e4>A)return Q;Q+=16777216}}async statObject(A,Q){let B=this.getBucketName(Q);if(!_G(A))throw new nF(A);let D={};if(Q?.versionId)D.versionId=Q.versionId;let E=await this.makeRequest({method:"HEAD",bucketName:B,objectName:A,query:D,headers:new Headers(Q?.headers)}),I={};for(let C of d8Q)if(E.headers.has(C))I[C]=E.headers.get(C);return E.headers.forEach((C,F)=>{if(F.startsWith("x-amz-meta-"))I[F]=E.headers.get(F)}),{type:"Object",key:A,size:parseInt(E.headers.get("content-length")??"",10),metadata:I,lastModified:new Date(E.headers.get("Last-Modified")??"error: missing last modified"),versionId:E.headers.get("x-amz-version-id")||null,etag:u9(E.headers.get("ETag")??"")}}async copyObject(A,Q,B){let D=this.getBucketName(B),E=A.sourceBucketName??D;if(!_G(Q))throw new nF(Q);let I=`${E}/${A.sourceKey.split("/").map((W)=>encodeURIComponent(W)).join("/")}`;if(A.sourceVersionId)I+=`?versionId=${A.sourceVersionId}`;let C=new Headers(B?.metadata);if(B?.metadata!==void 0)C.set("x-amz-metadata-directive","REPLACE");C.set("x-amz-copy-source",I);let F=await this.makeRequest({method:"PUT",bucketName:D,objectName:Q,headers:C,returnBody:!0}),$=await F.text(),H=jG($).root;if(!H||H.name!=="CopyObjectResult")throw Error(`Unexpected response: ${$}`);let Y=H.children.find((W)=>W.name==="ETag")?.content??"",X=H.children.find((W)=>W.name==="LastModified")?.content;if(X===void 0)throw Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:F.headers.get("x-amz-copy-source-version-id")||null,etag:u9(Y),lastModified:new Date(X),versionId:F.headers.get("x-amz-version-id")||null}}async bucketExists(A){try{return await this.listObjects({bucketName:A}).next(),!0}catch(Q){if(Q instanceof PG&&Q.statusCode===404)return!1;throw Q}}async makeBucket(A){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:A}),objectName:"",statusCode:200})}async removeBucket(A){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:A}),objectName:"",statusCode:204})}presignedPostObject(A,Q={}){if(!_G(A))throw new nF(A);let B=this.getBucketName(Q);if(!B)throw Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let D=Q.requestDate||new Date,E=Q.expirySeconds??3600;return bYA({protocol:this.protocol,host:this.host,bucket:B,objectKey:A,accessKey:this.accessKey||"",secretKey:this.#A||"",region:this.region,date:D,expirySeconds:E,conditions:Q.conditions,fields:Q.fields})}}TB();V4();q4();K$();AI();ZX();import{spawn as i8Q,spawnSync as r8Q}from"node:child_process";var iF="Cap-go",oL="capacitor-updater",uYA=`${iF}/${oL}`,yYA="capacitor-",sc=[`${iF}/CLI`,`${iF}/capgo`,`${iF}/capgo-skills`],rL=[uYA,...sc],a8Q=20,o8Q=180,s8Q=4,hYA=new Set;class sL extends Error{results;constructor(A=[]){super("Star-all interrupted by user.");this.name="StarAllRepositoriesAbortedError",this.results=A}}function BK(A){return A.toLowerCase()}function ec(A){hYA.add(BK(A))}function c5(A){let Q=tL(A);return hYA.has(BK(Q))}function fYA(A,Q){if(typeof A!=="number")return Q;if(!Number.isFinite(A))return Q;if(A<0)return Q;return Math.floor(A)}function t8Q(A,Q){let B=fYA(A,a8Q),D=fYA(Q,o8Q);if(B<=D)return{min:B,max:D};return{min:D,max:B}}function e8Q(A,Q){if(A===Q)return A;return Math.floor(Math.random()*(Q-A+1))+A}function ACQ(A,Q){if(typeof A!=="number")return Q;if(!Number.isFinite(A))return Q;if(A<1)return Q;return Math.min(Math.floor(A),16)}function aL(A=[]){return new sL(A)}function l9(A,Q=[]){if(A?.aborted)throw aL(Q)}async function QCQ(A,Q){if(A<=0)return;if(!Q)return new Promise((B)=>setTimeout(B,A));if(Q.aborted)throw aL();return new Promise((B,D)=>{let E,I=()=>{clearTimeout(E),Q.removeEventListener("abort",I),D(aL())};E=setTimeout(()=>{Q.removeEventListener("abort",I),B()},A),Q.addEventListener("abort",I,{once:!0})})}function tc(A){let Q=new Set,B=[];for(let D of A){let E=tL(D),I=BK(E);if(!Q.has(I))Q.add(I),B.push(E)}return B}async function BCQ(A,Q){l9(Q),A?.(`Discovering repositories in the ${iF} organization.`);let B=d9(["api","--paginate",`orgs/${iF}/repos`,"--jq",`map(select(.name | startswith("${yYA}")) | .nameWithOwner)[]`]);if(B.status===0&&B.stdout.trim().length>0){let E=B.stdout.split(`
|
|
602
602
|
`).map((I)=>I.trim()).filter((I)=>I.length>0);if(E.length>0){let I=tc([...E,...sc]);return A?.(`Found ${I.length} matching repositories from the GitHub API.`),I}A?.("No matching repositories were returned from the paginated GitHub API. Trying a fallback request.")}else A?.("Paginated GitHub API request failed. Trying a fallback request.");let D=d9(["api",`orgs/${iF}/repos?per_page=100`]);if(D.status!==0)return A?.("Fallback request failed. Using the default repository list instead."),[...rL];try{let E=JSON.parse(D.stdout);if(!Array.isArray(E))return A?.("Fallback response format was invalid. Using the default repository list instead."),[...rL];let I=E.filter((C)=>typeof C==="object"&&C!==null).map((C)=>C.name).filter((C)=>!!C&&C.startsWith(yYA)).map((C)=>`${iF}/${C}`);if(I.length>0){let C=tc([...I,...sc]);return A?.(`Found ${C.length} matching repositories from the fallback request.`),C}}catch{return A?.("Fallback response could not be parsed. Using the default repository list instead."),[...rL]}return A?.("No matching repositories were found. Using the default repository list instead."),[...rL]}function DCQ(A,Q){return new Promise((B)=>{let D="",E="",I=!1,C,F=()=>{},$=(H)=>{if(I)return;I=!0,Q?.removeEventListener("abort",F),B(H)};if(F=()=>{C?.kill("SIGINT"),$({status:130,stderr:"GitHub command interrupted by user.",stdout:D})},C=i8Q("gh",A,{stdio:["ignore","pipe","pipe"]}),C.stdout?.setEncoding("utf8"),C.stdout?.on("data",(H)=>{D+=H}),C.stderr?.setEncoding("utf8"),C.stderr?.on("data",(H)=>{E+=H}),C.on("error",()=>{$({status:1,stderr:"`gh` command is not available in PATH.",stdout:""})}),C.on("close",(H)=>{$({status:H??1,stderr:E,stdout:D})}),Q){if(Q.aborted){F();return}Q.addEventListener("abort",F,{once:!0})}})}function d9(A){try{let Q=r8Q("gh",A,{encoding:"utf8",stdio:["ignore","pipe","pipe"]});return{status:Q.status??1,stderr:Q.stderr?.toString()??"",stdout:Q.stdout?.toString()??""}}catch{return{status:1,stderr:"`gh` command is not available in PATH.",stdout:""}}}function mYA(){if(!dYA())throw Error("GitHub CLI (`gh`) is not installed. Install it from https://cli.github.com/");if(!pYA())throw Error("GitHub CLI is not logged in. Run `gh auth login` first.")}async function ECQ(A,Q,B){if(A.length===0)return new Set;let D=new Set;return Q?.(`Checking ${A.length} target repositories against your GitHub stars.`),await cYA(A,Math.min(A.length,8),B,()=>[],async(E)=>{let I=await DCQ(["api","-X","GET",`/user/starred/${E}`],B);if(I.status===0){D.add(BK(E));return}if(I.status===1)return;if(I.status===130&&B?.aborted)throw aL();throw Error(`Unable to check star status for ${E}. ${I.stderr||I.stdout}`.trim())}),Q?.(`Found ${D.size} repositories already starred.`),D}async function cYA(A,Q,B,D,E){let I=0;async function C(){while(!0){l9(B,D());let $=I;if(I+=1,$>=A.length)return;await E(A[$],$)}}let F=Math.min(Q,A.length);await Promise.all(Array.from({length:F},()=>C()))}function ICQ(A,Q,B){let D=Promise.resolve();return async()=>{l9(B);let E,I=D;D=new Promise((C)=>{E=C}),await I,await QCQ(e8Q(A,Q),B),E?.()}}function lYA(A){let Q=d9(["api","-X","PUT",`/user/starred/${A}`]);if(Q.status!==0){let B=Q.stderr||Q.stdout||`GitHub returned status ${Q.status}`;throw Error(`Failed to star ${A}: ${B.trim()}`)}return ec(A),{repository:A,alreadyStarred:!1}}function tL(A){let B=(A?.trim()||uYA).replace(/\.git$/i,"");if(/^https?:\/\//.test(B))try{let D=new URL(B);if(D.hostname.endsWith("github.com")){let[E,I]=D.pathname.split("/").filter((C)=>C.length>0);if(E&&I)return`${E}/${I}`}}catch{}if(B.startsWith("git@github.com:")){let[,D]=B.split("git@github.com:");if(D){let[E,I]=D.split("/");if(E&&I)return`${E}/${I}`}}if(B.includes("/")){let[D,E]=B.split("/");if(D&&E)return`${D}/${E}`}return`${iF}/${B}`}function CCQ(A){return d9(["repo","view",A,"--json","nameWithOwner"]).status===0}function FCQ(A){let Q=d9(["api","-X","GET",`/user/starred/${A}`]);if(Q.status===0)return!0;if(Q.status===1)return!1;throw Error(`Unable to check star status for ${A}.`)}function dYA(){return d9(["--version"]).status===0}function pYA(){return d9(["auth","status"]).status===0}function l5(A){let Q=tL(A);if(!dYA())return{repository:Q,ghInstalled:!1,ghLoggedIn:!1,repositoryExists:!1,starred:!1};if(!pYA())return{repository:Q,ghInstalled:!0,ghLoggedIn:!1,repositoryExists:!1,starred:!1};if(!CCQ(Q))return{repository:Q,ghInstalled:!0,ghLoggedIn:!0,repositoryExists:!1,starred:!1};return{repository:Q,ghInstalled:!0,ghLoggedIn:!0,repositoryExists:!0,starred:FCQ(Q)}}async function d5(A={}){mYA(),l9(A.signal);let Q=A.repositories?.length?A.repositories:await BCQ(A.onDiscovery,A.signal);A.onDiscovery?.(`Prepared ${Q.length} repositories to process.`);let B=t8Q(A.minDelayMs,A.maxDelayMs),D=tc(Q),E=ACQ(A.maxConcurrency,s8Q);l9(A.signal);let I=await ECQ(D,A.onDiscovery,A.signal),C=Array.from({length:D.length}),F=()=>C.filter((Y)=>!!Y),$=[];for(let Y=0;Y<D.length;Y++){l9(A.signal,F());let X=D[Y],W=BK(X);if(c5(X)){let M={repository:X,alreadyStarred:!0,skipped:!0,status:"already_starred"};A.onProgress?.(M),C[Y]=M;continue}if(I.has(W)){ec(X);let M={repository:X,alreadyStarred:!0,skipped:!0,status:"already_starred"};A.onProgress?.(M),C[Y]=M;continue}$.push({index:Y,repository:X})}let H=ICQ(B.min,B.max,A.signal);return await cYA($,E,A.signal,F,async({index:Y,repository:X})=>{await H(),l9(A.signal,F());try{let M={repository:lYA(X).repository,alreadyStarred:!1,skipped:!1,status:"starred"};A.onProgress?.(M),C[Y]=M}catch(W){let M={repository:X,alreadyStarred:!1,skipped:!1,status:"failed",error:W instanceof Error?W.message:String(W)};A.onProgress?.(M),C[Y]=M}}),F()}function rF(A){let Q=tL(A);mYA();let B=l5(Q);if(!B.repositoryExists)throw Error(`Cannot star ${Q}: repository is not reachable or does not exist.`);if(B.starred)return ec(Q),{repository:Q,alreadyStarred:!0};return lYA(Q)}TB();import nYA from"node:process";var GCQ=[{code:"aws:eu-central-1",label:"EU (Frankfurt)"},{code:"gcp:me-central1",label:"Middle East (Riyadh)"},{code:"gcp:asia-east2",label:"Hong Kong"},{code:"aws:ap-northeast-1",label:"Japan (Tokyo)"},{code:"aws:ap-south-1",label:"India (Mumbai)"},{code:"aws:us-east-1",label:"North America (Virginia)"},{code:"gcp:africa-south1",label:"Africa (South Africa)"},{code:"aws:ap-southeast-2",label:"Oceania (Sydney)"},{code:"aws:sa-east-1",label:"South America (São Paulo)"}],$CQ=60000,JCQ=1000,iYA=20;function HCQ(){if(typeof Intl>"u")return null;return Intl.DateTimeFormat().resolvedOptions().timeZone||null}function YCQ(){let A=HCQ();if(!A)return null;if(/^America\//.test(A))return"aws:us-east-1";if(/^Europe\//.test(A)||/^Atlantic\//.test(A))return"aws:eu-central-1";if(/^Africa\//.test(A))return"gcp:africa-south1";if(/^Asia\//.test(A)){let Q=(A.split("/")[1]??"").toLowerCase();if(["tokyo","osaka","seoul","pyongyang"].includes(Q))return"aws:ap-northeast-1";if(["kolkata","mumbai","calcutta","chennai","bangalore","hyderabad","delhi","dhaka","colombo","karachi"].includes(Q))return"aws:ap-south-1";if(["hong_kong","singapore","manila","jakarta","kuala_lumpur","beijing","shanghai","hongkong","taipei"].includes(Q))return"gcp:asia-east2";if(["sydney","melbourne","canberra","perth","brisbane","darwin","adelaide"].includes(Q))return"aws:ap-southeast-2";return"gcp:asia-east2"}if(/^Pacific\//.test(A)||/^Australia\//.test(A))return"aws:ap-southeast-2";return null}function XCQ(){let A=[...GCQ],Q=YCQ();if(!Q)return A;let B=A.findIndex((E)=>E.code===Q);if(B<0)return A;let[D]=A.splice(B,1);return A.push(D),A}function UCQ(A,Q,B){let D=Math.min(Math.max(A,0),B);return Math.floor(D/B*Q)}function WCQ(A){let Q=Math.min(Math.max(A,0),100),B=Math.round(Q/100*iYA);return`${"█".repeat(B)}${"░".repeat(iYA-B)}`}function KCQ(A){return`${Math.max(0,A)}s`}function eL({interactive:A=nYA.stdout.isTTY&&nYA.stderr.isTTY,totalMs:Q=$CQ,updateIntervalMs:B=JCQ,title:D="Replicating your bundle in all regions...",completeMessage:E="Your update is now available worldwide."}={}){if(!A||Q<=0)return Promise.resolve();let I=XCQ();if(!I.length)return Promise.resolve();w.info(D),w.info(`Regions: ${I.map((Y)=>Y.label).join(" • ")}`);let C=bB(),F=Date.now(),$=I.length,H=null;return new Promise((Y)=>{let X=()=>{let W=Date.now()-F,M=Math.max(0,Q-W),q=UCQ(W,$,Q),Z=Math.min(100,Math.round(W/Q*100)),z=WCQ(Z),R=q<$?I[q]?.label||"Finalizing":"Complete",O=`${q}/${$} regions updated • ${KCQ(Math.ceil(M/1000))} left • ${z} • Next: ${R}`;C.message(O)};C.start(D),X(),H=setInterval(X,B),setTimeout(()=>{if(H)clearInterval(H);C.stop(E),Y()},Q)})}OB();TB();q4();function rYA(A){try{let Q=oB(A);return c1(k6(Q,"patch"))}catch{let Q=A.match(/^(\d+)\.(\d+)\.(\d+)/);if(Q){let[,B,D,E]=Q;return`${B}.${D}.${Number.parseInt(E)+1}`}return"1.0.1"}}async function aYA(A,Q){let B=rYA(A),D=Q?` for ${Q}`:"",E=await wE({message:`How do you want to handle the version${D}?`,options:[{value:"auto",label:`Auto: Bump patch version (${A} → ${B})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(FB(E))return null;if(E==="auto")return w.info(`\uD83D\uDD22 Auto-bumped version from ${A} to ${B}`),B;let I=await u1({message:`Current version is ${A}. Enter new version:`,validate:(C)=>{if(!C)return"Version is required";if(!C.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});if(FB(I))return null;return I}function oYA(A){let Q=rYA(A);try{let B=oB(A);return[Q,c1(k6(B,"minor")),`${A}-beta.1`,`${A}.1`]}catch{return[Q,`${A}.1`,`${A}-beta.1`,`${A}-rc.1`]}}import{readdirSync as sYA,readFileSync as wCQ,statSync as MCQ}from"node:fs";import{extname as qCQ,join as NCQ}from"node:path";function ZCQ(A,Q){return wCQ(A,"utf8").includes(Q)}function DK(A,Q){let B=sYA(A);for(let D of B){let E=NCQ(A,D),I=MCQ(E);if(I.isDirectory()){if(DK(E,Q))return!0}else if(I.isFile()&&qCQ(E)===".js"){if(ZCQ(E,Q))return!0}}return!1}function AO(A){if(sYA(A).indexOf("index.html")>-1)return!0;return!1}TB();q4();var EUA=oA(BUA(),1),IUA=oA(fN(),1);import{Buffer as n4Q}from"node:buffer";import{createHash as i4Q}from"node:crypto";import{createReadStream as Wl,statSync as r4Q}from"node:fs";import{platform as a4Q}from"node:os";import{join as o4Q,posix as s4Q,win32 as DUA}from"node:path";import{cwd as t4Q}from"node:process";import{buffer as Kl}from"node:stream/consumers";import{createBrotliCompress as e4Q}from"node:zlib";OB();async function AFQ(A,Q){try{let B=new URL(`${A.hostFilesApi}/files/read/attachments/${encodeURIComponent(Q)}`);return B.searchParams.set("nocache",`${Date.now()}`),(await fetch(B.toString(),{method:"GET",headers:{range:"bytes=0-0","cache-control":"no-cache"}})).ok}catch{return!1}}var QFQ=8192;async function BFQ(A){let Q=NE(t4Q()),B=await oI("@capgo/capacitor-updater",Q,A.packageJson),D;try{D=B?oB(B):void 0}catch{D=void 0}if(!B||!D)return{version:null,supportsBrotliV2:!1};let E=!f8(D,void 0,void 0,nU);return{version:`${D.major}.${D.minor}.${D.patch}`,supportsBrotliV2:E}}function DFQ(A,Q){if(!Q)return!1;let B=Q.split(",").map((D)=>D.trim()).filter((D)=>!!D);if(B.length===0)return!1;return EUA.isMatch(A,B)}async function EFQ(A,Q,B){let E=r4Q(A).size,I=await Kl(Wl(A));if(E===0)return{buffer:I,useBrotli:!1};if(DFQ(Q,B.noBrotliPatterns))return{buffer:I,useBrotli:!1};if(E<QFQ)return{buffer:I,useBrotli:!1};try{let C=await Kl(Wl(A).pipe(e4Q({})));if(C.length>=E-10)return{buffer:I,useBrotli:!1};return{buffer:C,useBrotli:!0}}catch(C){return w.warn(`Brotli compression failed for ${A}: ${C}, using original file`),{buffer:I,useBrotli:!1}}}async function CUA(A,Q,B,D,E,I,C=!1){let F=bB();F.start(E!=="v2"?"Generating the update manifest":`Generating the update manifest with ${C?"V3":"V2"} encryption`);let $=await LFA(A);if(E==="v2")for(let H of $)H.hash=C?m5(H.hash,I):h5(H.hash,I);return F.stop("Manifest generated successfully"),await LB(Q,{channel:"partial-update",event:"Generate manifest",icon:"\uD83D\uDCC2",user_id:B,tags:{"app-id":D},notify:!1}),$}function IFQ(A){if(a4Q()!=="win32")return A;return DUA.normalize(A).split(DUA.sep).join(s4Q.sep)}function CFQ(A){let Q=A.split("/").map((B)=>encodeURIComponent(B)).join("/");if(A.includes(" "))w.warn(`File "${A}" contains spaces in its name.`);return Q}async function FUA(A,Q,B,D,E,I,C){let F=bB();F.start("Preparing partial update with TUS protocol");let $=performance.now(),H=await d1(),Y=!!(C.partial||C.delta||C.partialOnly||C.deltaOnly),{version:X,supportsBrotliV2:W}=await BFQ(C);if(!W)throw Error(`Your project is using an older version of @capgo/capacitor-updater (${X||"unknown"}). To use Delta updates, please upgrade to version ${WR} (v5), ${KR} (v6) or ${nU} (v7) or higher.`);else if(C.disableBrotli)w.info("Brotli compression disabled by user request");else if(C.noBrotliPatterns)w.info(`Files matching patterns (${C.noBrotliPatterns}) will be excluded from brotli compression`);let M=Q.filter((R)=>R.file.includes(" "));if(M.length>0)throw Error(`Files with spaces in their names (${M.map((R)=>R.file).join(", ")}). Please rename the files.`);let q=0,Z=Q.length,z=0;try{F.message(`Uploading ${Z} files using TUS protocol`);let R=async(d)=>{let u=o4Q(B,d.file),r=IFQ(d.file),p,t=!1;if(C.disableBrotli)p=await Kl(Wl(u)),t=!1;else{let P=await EFQ(u,r,C);p=P.buffer,t=P.useBrotli}let i=p;if(I)i=u5(p,I.sessionKey,I.ivSessionKey);let XA=r;if(t)XA=`${r}.br`,z++;let $A=CFQ(XA),WA=i4Q("sha256").update(d.hash).digest("hex"),n;if(I){let P=n4Q.from(I.ivSessionKey).toString("hex");n=`orgs/${E}/apps/${D}/delta/${P}/${WA}_${$A}`}else n=`orgs/${E}/apps/${D}/delta/${WA}_${$A}`;if(!I&&await AFQ(H,n))return q++,Promise.resolve({file_name:$A,s3_path:n,file_hash:d.hash});return new Promise((P,_)=>{F.message(`Prepare upload partial file: ${r}`);let k=$G(XA);new IUA.Upload(i,{endpoint:`${H.hostFilesApi}/files/upload/attachments/`,chunkSize:C.tusChunkSize,retryDelays:[0,1000,3000,5000,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:n,filetype:k},headers:{Authorization:A},onError:(AA)=>{let IA=AA.toString(),MA;try{let HA=IA.match(/response text: (\{.*?\})/);if(HA&&HA[1])MA=JSON.parse(HA[1]).moreInfo?.requestId}catch{}let QA=MA?` [requestId: ${MA}]`:"";w.error(`Failed to upload ${r}: ${IA}${QA}`),_(AA)},onProgress(){let AA=(q/Z*100).toFixed(2);F.message(`Uploading partial update: ${AA}%`)},onSuccess(){q++,P({file_name:$A,s3_path:n,file_hash:d.hash})}}).start()})},O=500,V=[];for(let d=0;d<Q.length;d+=O){let u=Q.slice(d,d+O),r=Math.floor(d/O)+1,p=Math.ceil(Q.length/O);if(p>1)F.message(`Processing batch ${r}/${p} (${u.length} files)`);let t=await Promise.all(u.map((i)=>R(i)));V.push(...t)}let j=((performance.now()-$)/1000).toFixed(2);if(F.stop(`Partial update uploaded successfully \uD83D\uDCAA in (${j} seconds)`),z>0)w.info(`${z} of ${Z} files were compressed with brotli and use .br extension`);return await LB(A,{channel:"app",event:`App Partial TUS done${z>0?" with .br extension":""}`,icon:"⏫",user_id:E,tags:{"app-id":D},notify:!1}),await LB(A,{channel:"performance",event:"Partial upload performance",icon:"\uD83D\uDE84",user_id:E,tags:{"app-id":D,time:j},notify:!1}),V}catch(R){let V=((performance.now()-$)/1000).toFixed(2);if(F.error(`Failed to upload Partial bundle (after ${V} seconds)`),Y)throw w.error(`Error uploading partial update: ${R}`),w.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),R;else return w.info(`Error uploading partial update: ${R}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function WD(A){throw w.error(A),Error(A)}function $FQ(A){let Q=new Z0;Q.headers=["Package","Local","Remote","Status","Details"],Q.theme=Z0.roundTheme,Q.rows=[];for(let B of A){let{name:D,localVersion:E,remoteVersion:I}=B,C=G9(B),F=C.compatible?"✅":"❌";Q.rows.push([D,E||"-",I||"-",F,C.message])}w.info(Q.toString())}async function JFQ(A,Q){let B=TC("",Q.packageJson),D=Q.bundle||A?.plugins?.CapacitorUpdater?.version||B||`0.0.1-beta.${FFQ().split("-")[0]}`;if(!x3.test(D))WD(`Your bundle name ${D}, is not valid it should follow semver convention : https://semver.org/`);return D}function HFQ(A){let Q=A.apikey||zQ();if(!Q)WD("Missing API key, you need to provide an API key to upload your bundle");return Q}function YFQ(A,Q,B){let D=mB(A,B),E=Q.path||B?.webDir;if(!D)WD("Missing argument, you need to provide a appid or be in a capacitor project");if(!E)WD("Missing argument, you need to provide a path (--path), or be in a capacitor project");if(!GK(E))WD(`Path ${E} does not exist, build your app first, or provide a valid path`);return{appid:D,path:E}}function XFQ(A,Q){let B=A.codeCheck;if(typeof B>"u"||B){if(!DK(Q,"notifyAppReady"))WD(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
603
603
|
If you are sure your app has this code, you can use the --no-code-check option`);if(!AO(Q))WD(`index.html is missing in the root folder of ${Q}`)}}async function UFQ(A,Q,B,D,E,I){let{ignoreMetadataCheck:C,autoMinUpdateVersion:F,minUpdateVersion:$}=B,{data:H,error:Y}=await A.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",D).eq("app_id",E).single(),X=!!H&&H.disable_auto_update==="version_number",W,M;if(!Y&&H&&H.version&&H.version.native_packages&&!C){let z=bB();z.start(`Checking bundle compatibility with channel ${D}`);let{finalCompatibility:R,localDependencies:O}=await qR(A,E,D,B.packageJson,B.nodeModules);if(M=R,W=O,M.filter((T)=>!JG(T)).length>0){if(z.error(`Bundle NOT compatible with ${D} channel`),w.warn(""),$FQ(M),w.warn(""),w.warn("An app store update may be required for these changes to take effect."),F)$=I,w.info(`Auto set min-update-version to ${$}`)}else if(F)try{let{min_update_version:T}=H.version;if(!T||!x3.test(T))WD("Invalid remote min update version, skipping auto setting compatibility");$=T,z.stop(`Auto set min-update-version to ${$}`)}catch{WD(`Cannot auto set compatibility, invalid data ${H}`)}else z.stop(`Bundle compatible with ${D} channel`)}else if(!C){if(w.warn(`Channel ${D} is new or it's your first upload with compatibility check, it will be ignored this time`),W=await Hu(B.packageJson,B.nodeModules),F)$=I,w.info(`Auto set min-update-version to ${$}`)}if(X&&!$&&!C)WD("You need to provide a min-update-version to upload a bundle to this channel");if($){if(!x3.test($))WD(`Your minimal version update ${$}, is not valid it should follow semver convention : https://semver.org/`)}let q=W?new Map(W.filter((z)=>!!z.native&&z.native!==void 0).map((z)=>[z.name,z])):new Map;return{nativePackages:q.size>0||!B.ignoreMetadataCheck?Array.from(q,([z,R])=>({name:z,version:R.version,...R.ios_checksum&&{ios_checksum:R.ios_checksum},...R.android_checksum&&{android_checksum:R.android_checksum}})):void 0,minUpdateVersion:$}}async function WFQ(A,Q,B,D=!1,E=!1){let{data:I,error:C}=await A.rpc("exist_app_versions",{appid:Q,name_version:B}).single();if(I||C){if(D)return w.warn(`Version ${B} already exists - exiting gracefully due to --silent-fail option`),XQ("Bundle version already exists - exiting gracefully \uD83C\uDF89"),!0;if(E){w.error(`❌ Version ${B} already exists`);let F=oYA(B);w.info("\uD83D\uDCA1 Here are some suggestions:"),F.forEach((Y,X)=>{w.info(` ${X+1}. ${Y}`)});let $=await wE({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${F[0]}`},{value:"suggest2",label:`Use ${F[1]}`},{value:"suggest3",label:`Use ${F[2]}`},{value:"suggest4",label:`Use ${F[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});if(FB($)||$==="cancel")WD("Upload cancelled by user");let H;if($==="custom"){let Y=await aYA(B,"upload");if(!Y)WD("Upload cancelled by user");H=Y}else{let Y=Number.parseInt($.replace("suggest",""))-1;H=F[Y]}return w.info(`\uD83D\uDD04 Retrying with new version: ${H}`),H}WD(`Version ${B} already exists ${_A(C)}`)}return!1}async function KFQ(A,Q,B,D,E,I,C,F){let $,H,Y="",X=null,W="none",M="",q="",Z=Q.keyV2,z=Q.key===!1,R=bB();R.start(`Zipping bundle from ${A}`),X=await wR(A),R.message("Calculating checksum");let O=NE(wl()),V=await oI("@capgo/capacitor-updater",O,Q.packageJson),T=!1,j;try{j=V?oB(V):void 0}catch{j=void 0}if(!V)WD("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager");else if(j)T=!f8(j,WR,KR,nU);else if(V==="link:@capgo/capacitor-updater"||V==="file:.."||V==="file:../")w.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),T=!0;let d=Q.forceCrc32Checksum===!0,u=!d&&((Z||Q.keyDataV2||GK(a1))&&!z||T);if(Y=await d6(X,u?"sha256":"crc32"),R.stop(`Checksum ${u?"SHA256":"CRC32"}${d?" (forced)":""}: ${Y}`),z)w.info("Encryption ignored");else if((Z||GK(a1)||Q.keyDataV2)&&!Q.oldEncryption){let t=typeof Z==="string"?Z:a1,i=Q.keyDataV2||"";if(!i&&!GK(t))WD(`Cannot find private key ${t}`);if(await LB(B,{channel:"app",event:"App encryption v2",icon:"\uD83D\uDD11",user_id:D,tags:{"app-id":E},notify:!1},Q.verbose),!i)i=GFQ(t).toString();let XA=j&&!f8(j,"5.30.0","6.30.0","7.30.0");w.info(`Encrypting your bundle with ${XA?"V3":"V2"}`);let{sessionKey:$A,ivSessionKey:WA}=lL(i),n=u5(X,$A,WA);if(Y=XA?m5(Y,i):h5(Y,i),$=WA,H=$A,W="v2",M=i,F){if(q=NYA(F),Q.verbose)w.info(`[Verbose] Encryption key_id: ${q}`)}if(Q.displayIvSession)w.info(`Your Iv Session key is ${$},
|
|
604
604
|
keep it safe, you will need it to decrypt your bundle.
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.88.
|
|
4
|
+
"version": "7.88.1",
|
|
5
5
|
"description": "A CLI to upload to capgo servers",
|
|
6
6
|
"author": "Martin martin@capgo.app",
|
|
7
7
|
"license": "Apache 2.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@antfu/eslint-config": "^7.0.0",
|
|
84
|
-
"@bradenmacdonald/s3-lite-client": "npm:@jsr/bradenmacdonald__s3-lite-client@0.9.
|
|
84
|
+
"@bradenmacdonald/s3-lite-client": "npm:@jsr/bradenmacdonald__s3-lite-client@0.9.5",
|
|
85
85
|
"@capacitor/cli": "^8.0.0",
|
|
86
86
|
"@capgo/find-package-manager": "^0.0.18",
|
|
87
87
|
"@clack/prompts": "^1.0.0",
|
package/dist/src/sdk.js
CHANGED
|
@@ -127,7 +127,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
127
127
|
`)}),$.__defineSetter__("stack",function(X){return[X].concat($.stack).join(`
|
|
128
128
|
|
|
129
129
|
`)}),$}});var jx=T((DhD,Rx)=>{var d6=p("constants"),gQD=process.cwd,WY=null,mQD=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!WY)WY=gQD.call(process);return WY};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(KY=process.chdir,process.chdir=function(D){WY=null,KY.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,KY)}var KY;Rx.exports=cQD;function cQD(D){if(d6.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))$(D);if(!D.lutimes)X(D);if(D.chown=Q(D.chown),D.fchown=Q(D.fchown),D.lchown=Q(D.lchown),D.chmod=Y(D.chmod),D.fchmod=Y(D.fchmod),D.lchmod=Y(D.lchmod),D.chownSync=F(D.chownSync),D.fchownSync=F(D.fchownSync),D.lchownSync=F(D.lchownSync),D.chmodSync=J(D.chmodSync),D.fchmodSync=J(D.fchmodSync),D.lchmodSync=J(D.lchmodSync),D.stat=Z(D.stat),D.fstat=Z(D.fstat),D.lstat=Z(D.lstat),D.statSync=w(D.statSync),D.fstatSync=w(D.fstatSync),D.lstatSync=w(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(U,O,q){if(q)process.nextTick(q)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(U,O,q,z){if(z)process.nextTick(z)},D.lchownSync=function(){};if(mQD==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(U){function O(q,z,B){var W=Date.now(),L=0;U(q,z,function M(I){if(I&&(I.code==="EACCES"||I.code==="EPERM"||I.code==="EBUSY")&&Date.now()-W<60000){if(setTimeout(function(){D.stat(z,function(K,V){if(K&&K.code==="ENOENT")U(q,z,M);else B(I)})},L),L<100)L+=10;return}if(B)B(I)})}if(Object.setPrototypeOf)Object.setPrototypeOf(O,U);return O}(D.rename);D.read=typeof D.read!=="function"?D.read:function(U){function O(q,z,B,W,L,M){var I;if(M&&typeof M==="function"){var K=0;I=function(V,N,R){if(V&&V.code==="EAGAIN"&&K<10)return K++,U.call(D,q,z,B,W,L,I);M.apply(this,arguments)}}return U.call(D,q,z,B,W,L,I)}if(Object.setPrototypeOf)Object.setPrototypeOf(O,U);return O}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(U){return function(O,q,z,B,W){var L=0;while(!0)try{return U.call(D,O,q,z,B,W)}catch(M){if(M.code==="EAGAIN"&&L<10){L++;continue}throw M}}}(D.readSync);function $(U){U.lchmod=function(O,q,z){U.open(O,d6.O_WRONLY|d6.O_SYMLINK,q,function(B,W){if(B){if(z)z(B);return}U.fchmod(W,q,function(L){U.close(W,function(M){if(z)z(L||M)})})})},U.lchmodSync=function(O,q){var z=U.openSync(O,d6.O_WRONLY|d6.O_SYMLINK,q),B=!0,W;try{W=U.fchmodSync(z,q),B=!1}finally{if(B)try{U.closeSync(z)}catch(L){}else U.closeSync(z)}return W}}function X(U){if(d6.hasOwnProperty("O_SYMLINK")&&U.futimes)U.lutimes=function(O,q,z,B){U.open(O,d6.O_SYMLINK,function(W,L){if(W){if(B)B(W);return}U.futimes(L,q,z,function(M){U.close(L,function(I){if(B)B(M||I)})})})},U.lutimesSync=function(O,q,z){var B=U.openSync(O,d6.O_SYMLINK),W,L=!0;try{W=U.futimesSync(B,q,z),L=!1}finally{if(L)try{U.closeSync(B)}catch(M){}else U.closeSync(B)}return W};else if(U.futimes)U.lutimes=function(O,q,z,B){if(B)process.nextTick(B)},U.lutimesSync=function(){}}function Y(U){if(!U)return U;return function(O,q,z){return U.call(D,O,q,function(B){if(G(B))B=null;if(z)z.apply(this,arguments)})}}function J(U){if(!U)return U;return function(O,q){try{return U.call(D,O,q)}catch(z){if(!G(z))throw z}}}function Q(U){if(!U)return U;return function(O,q,z,B){return U.call(D,O,q,z,function(W){if(G(W))W=null;if(B)B.apply(this,arguments)})}}function F(U){if(!U)return U;return function(O,q,z){try{return U.call(D,O,q,z)}catch(B){if(!G(B))throw B}}}function Z(U){if(!U)return U;return function(O,q,z){if(typeof q==="function")z=q,q=null;function B(W,L){if(L){if(L.uid<0)L.uid+=4294967296;if(L.gid<0)L.gid+=4294967296}if(z)z.apply(this,arguments)}return q?U.call(D,O,q,B):U.call(D,O,B)}}function w(U){if(!U)return U;return function(O,q){var z=q?U.call(D,O,q):U.call(D,O);if(z){if(z.uid<0)z.uid+=4294967296;if(z.gid<0)z.gid+=4294967296}return z}}function G(U){if(!U)return!0;if(U.code==="ENOSYS")return!0;var O=!process.getuid||process.getuid()!==0;if(O){if(U.code==="EINVAL"||U.code==="EPERM")return!0}return!1}}});var Cx=T(($hD,Tx)=>{var Ex=p("stream").Stream;Tx.exports=dQD;function dQD(D){return{ReadStream:$,WriteStream:X};function $(Y,J){if(!(this instanceof $))return new $(Y,J);Ex.call(this);var Q=this;this.path=Y,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,J=J||{};var F=Object.keys(J);for(var Z=0,w=F.length;Z<w;Z++){var G=F[Z];this[G]=J[G]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){Q._read()});return}D.open(this.path,this.flags,this.mode,function(U,O){if(U){Q.emit("error",U),Q.readable=!1;return}Q.fd=O,Q.emit("open",O),Q._read()})}function X(Y,J){if(!(this instanceof X))return new X(Y,J);Ex.call(this),this.path=Y,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,J=J||{};var Q=Object.keys(J);for(var F=0,Z=Q.length;F<Z;F++){var w=Q[F];this[w]=J[w]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var xx=T((XhD,Px)=>{Px.exports=nQD;var lQD=Object.getPrototypeOf||function(D){return D.__proto__};function nQD(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var $={__proto__:lQD(D)};else var $=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(X){Object.defineProperty($,X,Object.getOwnPropertyDescriptor(D,X))}),$}});var S0=T((JhD,CO)=>{var M0=p("fs"),iQD=jx(),pQD=Cx(),rQD=xx(),HY=p("util"),o0,NY;if(typeof Symbol==="function"&&typeof Symbol.for==="function")o0=Symbol.for("graceful-fs.queue"),NY=Symbol.for("graceful-fs.previous");else o0="___graceful-fs.queue",NY="___graceful-fs.previous";function oQD(){}function ux(D,$){Object.defineProperty(D,o0,{get:function(){return $}})}var $8=oQD;if(HY.debuglog)$8=HY.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))$8=function(){var D=HY.format.apply(HY,arguments);D="GFS4: "+D.split(/\n/).join(`
|
|
130
|
-
GFS4: `),console.error(D)};if(!M0[o0]){if(jO=global[o0]||[],ux(M0,jO),M0.close=function(D){function $(X,Y){return D.call(M0,X,function(J){if(!J)Sx();if(typeof Y==="function")Y.apply(this,arguments)})}return Object.defineProperty($,NY,{value:D}),$}(M0.close),M0.closeSync=function(D){function $(X){D.apply(M0,arguments),Sx()}return Object.defineProperty($,NY,{value:D}),$}(M0.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){$8(M0[o0]),p("assert").equal(M0[o0].length,0)})}var jO;if(!global[o0])ux(global,M0[o0]);CO.exports=EO(rQD(M0));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!M0.__patched)CO.exports=EO(M0),M0.__patched=!0;function EO(D){iQD(D),D.gracefulify=EO,D.createReadStream=N,D.createWriteStream=R;var $=D.readFile;D.readFile=X;function X(_,u,x){if(typeof u==="function")x=u,u=null;return h(_,u,x);function h(b,l,f,j){return $(b,l,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))k9([h,[b,l,f],S,j||Date.now(),Date.now()]);else if(typeof f==="function")f.apply(this,arguments)})}}var Y=D.writeFile;D.writeFile=J;function J(_,u,x,h){if(typeof x==="function")h=x,x=null;return b(_,u,x,h);function b(l,f,j,S,v){return Y(l,f,j,function(y){if(y&&(y.code==="EMFILE"||y.code==="ENFILE"))k9([b,[l,f,j,S],y,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var Q=D.appendFile;if(Q)D.appendFile=F;function F(_,u,x,h){if(typeof x==="function")h=x,x=null;return b(_,u,x,h);function b(l,f,j,S,v){return Q(l,f,j,function(y){if(y&&(y.code==="EMFILE"||y.code==="ENFILE"))k9([b,[l,f,j,S],y,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var Z=D.copyFile;if(Z)D.copyFile=w;function w(_,u,x,h){if(typeof x==="function")h=x,x=0;return b(_,u,x,h);function b(l,f,j,S,v){return Z(l,f,j,function(y){if(y&&(y.code==="EMFILE"||y.code==="ENFILE"))k9([b,[l,f,j,S],y,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=O;var U=/^v[0-5]\./;function O(_,u,x){if(typeof u==="function")x=u,u=null;var h=U.test(process.version)?function(f,j,S,v){return G(f,b(f,j,S,v))}:function(f,j,S,v){return G(f,j,b(f,j,S,v))};return h(_,u,x);function b(l,f,j,S){return function(v,y){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))k9([h,[l,f,j],v,S||Date.now(),Date.now()]);else{if(y&&y.sort)y.sort();if(typeof j==="function")j.call(this,v,y)}}}}if(process.version.substr(0,4)==="v0.8"){var q=pQD(D);M=q.ReadStream,K=q.WriteStream}var z=D.ReadStream;if(z)M.prototype=Object.create(z.prototype),M.prototype.open=I;var B=D.WriteStream;if(B)K.prototype=Object.create(B.prototype),K.prototype.open=V;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(_){M=_},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return K},set:function(_){K=_},enumerable:!0,configurable:!0});var W=M;Object.defineProperty(D,"FileReadStream",{get:function(){return W},set:function(_){W=_},enumerable:!0,configurable:!0});var L=K;Object.defineProperty(D,"FileWriteStream",{get:function(){return L},set:function(_){L=_},enumerable:!0,configurable:!0});function M(_,u){if(this instanceof M)return z.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function I(){var _=this;A(_.path,_.flags,_.mode,function(u,x){if(u){if(_.autoClose)_.destroy();_.emit("error",u)}else _.fd=x,_.emit("open",x),_.read()})}function K(_,u){if(this instanceof K)return B.apply(this,arguments),this;else return K.apply(Object.create(K.prototype),arguments)}function V(){var _=this;A(_.path,_.flags,_.mode,function(u,x){if(u)_.destroy(),_.emit("error",u);else _.fd=x,_.emit("open",x)})}function N(_,u){return new D.ReadStream(_,u)}function R(_,u){return new D.WriteStream(_,u)}var C=D.open;D.open=A;function A(_,u,x,h){if(typeof x==="function")h=x,x=null;return b(_,u,x,h);function b(l,f,j,S,v){return C(l,f,j,function(y,g){if(y&&(y.code==="EMFILE"||y.code==="ENFILE"))k9([b,[l,f,j,S],y,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function k9(D){$8("ENQUEUE",D[0].name,D[1]),M0[o0].push(D),TO()}var VY;function Sx(){var D=Date.now();for(var $=0;$<M0[o0].length;++$)if(M0[o0][$].length>2)M0[o0][$][3]=D,M0[o0][$][4]=D;TO()}function TO(){if(clearTimeout(VY),VY=void 0,M0[o0].length===0)return;var D=M0[o0].shift(),$=D[0],X=D[1],Y=D[2],J=D[3],Q=D[4];if(J===void 0)$8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-J>=60000){$8("TIMEOUT",$.name,X);var F=X.pop();if(typeof F==="function")F.call(null,Y)}else{var Z=Date.now()-Q,w=Math.max(Q-J,1),G=Math.min(w*1.2,100);if(Z>=G)$8("RETRY",$.name,X),$.apply(null,X.concat([J]));else M0[o0].push(D)}if(VY===void 0)VY=setTimeout(TO,0)}});var _x=T((YhD,vx)=>{function e1(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}vx.exports=e1;e1.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};e1.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};e1.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var X=this._timeouts.shift();if(X===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),X=this._timeouts.shift();else return!1;var Y=this,J=setTimeout(function(){if(Y._attempts++,Y._operationTimeoutCb){if(Y._timeout=setTimeout(function(){Y._operationTimeoutCb(Y._attempts)},Y._operationTimeout),Y._options.unref)Y._timeout.unref()}Y._fn(Y._attempts)},X);if(this._options.unref)J.unref();return!0};e1.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var X=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){X._operationTimeoutCb()},X._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};e1.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};e1.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};e1.prototype.start=e1.prototype.try;e1.prototype.errors=function(){return this._errors};e1.prototype.attempts=function(){return this._attempts};e1.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,X=0;for(var Y=0;Y<this._errors.length;Y++){var J=this._errors[Y],Q=J.message,F=(D[Q]||0)+1;if(D[Q]=F,F>=X)$=J,X=F}return $}});var fx=T((tQD)=>{var aQD=_x();tQD.operation=function(D){var $=tQD.timeouts(D);return new aQD($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};tQD.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var X in D)$[X]=D[X];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Y=[];for(var J=0;J<$.retries;J++)Y.push(this.createTimeout(J,$));if(D&&D.forever&&!Y.length)Y.push(this.createTimeout(J,$));return Y.sort(function(Q,F){return Q-F}),Y};tQD.createTimeout=function(D,$){var X=$.randomize?Math.random()+1:1,Y=Math.round(X*$.minTimeout*Math.pow($.factor,D));return Y=Math.min(Y,$.maxTimeout),Y};tQD.wrap=function(D,$,X){if($ instanceof Array)X=$,$=null;if(!X){X=[];for(var Y in D)if(typeof D[Y]==="function")X.push(Y)}for(var J=0;J<X.length;J++){var Q=X[J],F=D[Q];D[Q]=function(w){var G=tQD.operation($),U=Array.prototype.slice.call(arguments,1),O=U.pop();U.push(function(q){if(G.retry(q))return;if(q)arguments[0]=G.mainError();O.apply(this,arguments)}),G.attempt(function(){w.apply(D,U)})}.bind(D,F),D[Q].options=$}}});var yx=T((FhD,LY)=>{LY.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")LY.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")LY.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var AY=T((ZhD,y9)=>{var K0=global.process,X8=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!X8(K0))y9.exports=function(){return function(){}};else{if(PO=p("assert"),J8=yx(),xO=/^win/i.test(K0.platform),f9=p("events"),typeof f9!=="function")f9=f9.EventEmitter;if(K0.__signal_exit_emitter__)g0=K0.__signal_exit_emitter__;else g0=K0.__signal_exit_emitter__=new f9,g0.count=0,g0.emitted={};if(!g0.infinite)g0.setMaxListeners(1/0),g0.infinite=!0;y9.exports=function(D,$){if(!X8(global.process))return function(){};if(PO.equal(typeof D,"function","a callback must be provided for exit handler"),Y8===!1)MY();var X="exit";if($&&$.alwaysLast)X="afterexit";var Y=function(){if(g0.removeListener(X,D),g0.listeners("exit").length===0&&g0.listeners("afterexit").length===0)B3()};return g0.on(X,D),Y},B3=function(){if(!Y8||!X8(global.process))return;Y8=!1,J8.forEach(function($){try{K0.removeListener($,W3[$])}catch(X){}}),K0.emit=K3,K0.reallyExit=IY,g0.count-=1},y9.exports.unload=B3,l6=function($,X,Y){if(g0.emitted[$])return;g0.emitted[$]=!0,g0.emit($,X,Y)},W3={},J8.forEach(function(D){W3[D]=function(){if(!X8(global.process))return;var X=K0.listeners(D);if(X.length===g0.count){if(B3(),l6("exit",null,D),l6("afterexit",null,D),xO&&D==="SIGHUP")D="SIGINT";K0.kill(K0.pid,D)}}}),y9.exports.signals=function(){return J8},Y8=!1,MY=function(){if(Y8||!X8(global.process))return;Y8=!0,g0.count+=1,J8=J8.filter(function($){try{return K0.on($,W3[$]),!0}catch(X){return!1}}),K0.emit=uO,K0.reallyExit=SO},y9.exports.load=MY,IY=K0.reallyExit,SO=function($){if(!X8(global.process))return;K0.exitCode=$||0,l6("exit",K0.exitCode,null),l6("afterexit",K0.exitCode,null),IY.call(K0,K0.exitCode)},K3=K0.emit,uO=function($,X){if($==="exit"&&X8(global.process)){if(X!==void 0)K0.exitCode=X;var Y=K3.apply(this,arguments);return l6("exit",K0.exitCode,null),l6("afterexit",K0.exitCode,null),Y}else return K3.apply(this,arguments)}}var PO,J8,xO,f9,g0,B3,l6,W3,Y8,MY,IY,SO,K3,uO});var hx=T((JFD,vO)=>{var bx=Symbol();function $FD(D,$,X){let Y=$[bx];if(Y)return $.stat(D,(Q,F)=>{if(Q)return X(Q);X(null,F.mtime,Y)});let J=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,J,J,(Q)=>{if(Q)return X(Q);$.stat(D,(F,Z)=>{if(F)return X(F);let w=Z.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,bx,{value:w}),X(null,Z.mtime,w)})})}function XFD(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}JFD.probe=$FD;JFD.getMtime=XFD});var lx=T((qFD,V3)=>{var FFD=p("path"),fO=S0(),ZFD=fx(),wFD=AY(),gx=hx(),Z6={};function H3(D,$){return $.lockfilePath||`${D}.lock`}function yO(D,$,X){if(!$.realpath)return X(null,FFD.resolve(D));$.fs.realpath(D,X)}function kO(D,$,X){let Y=H3(D,$);$.fs.mkdir(Y,(J)=>{if(!J)return gx.probe(Y,$.fs,(Q,F,Z)=>{if(Q)return $.fs.rmdir(Y,()=>{}),X(Q);X(null,F,Z)});if(J.code!=="EEXIST")return X(J);if($.stale<=0)return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(Y,(Q,F)=>{if(Q){if(Q.code==="ENOENT")return kO(D,{...$,stale:0},X);return X(Q)}if(!mx(F,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));cx(D,$,(Z)=>{if(Z)return X(Z);kO(D,{...$,stale:0},X)})})})}function mx(D,$){return D.mtime.getTime()<Date.now()-$.stale}function cx(D,$,X){$.fs.rmdir(H3(D,$),(Y)=>{if(Y&&Y.code!=="ENOENT")return X(Y);X()})}function RY(D,$){let X=Z6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(Y,J)=>{let Q=X.lastUpdate+$.stale<Date.now();if(Y){if(Y.code==="ENOENT"||Q)return _O(D,X,Object.assign(Y,{code:"ECOMPROMISED"}));return X.updateDelay=1000,RY(D,$)}if(X.mtime.getTime()!==J.mtime.getTime())return _O(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let Z=gx.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,Z,Z,(w)=>{let G=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(w){if(w.code==="ENOENT"||G)return _O(D,X,Object.assign(w,{code:"ECOMPROMISED"}));return X.updateDelay=1000,RY(D,$)}X.mtime=Z,X.lastUpdate=Date.now(),X.updateDelay=null,RY(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function _O(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(Z6[D]===$)delete Z6[D];$.options.onCompromised(X)}function GFD(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:fO,onCompromised:(Y)=>{throw Y},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),yO(D,$,(Y,J)=>{if(Y)return X(Y);let Q=ZFD.operation($.retries);Q.attempt(()=>{kO(J,$,(F,Z,w)=>{if(Q.retry(F))return;if(F)return X(Q.mainError());let G=Z6[J]={lockfilePath:H3(J,$),mtime:Z,mtimePrecision:w,options:$,lastUpdate:Date.now()};RY(J,$),X(null,(U)=>{if(G.released)return U&&U(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));dx(J,{...$,realpath:!1},U)})})})})}function dx(D,$,X){$={fs:fO,realpath:!0,...$},yO(D,$,(Y,J)=>{if(Y)return X(Y);let Q=Z6[J];if(!Q)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Q.updateTimeout&&clearTimeout(Q.updateTimeout),Q.released=!0,delete Z6[J],cx(J,$,X)})}function UFD(D,$,X){$={stale:1e4,realpath:!0,fs:fO,...$},$.stale=Math.max($.stale||0,2000),yO(D,$,(Y,J)=>{if(Y)return X(Y);$.fs.stat(H3(J,$),(Q,F)=>{if(Q)return Q.code==="ENOENT"?X(null,!1):X(Q);return X(null,!mx(F,$))})})}function OFD(){return Z6}wFD(()=>{for(let D in Z6){let $=Z6[D].options;try{$.fs.rmdirSync(H3(D,$))}catch(X){}}});qFD.lock=GFD;qFD.unlock=dx;qFD.check=UFD;qFD.getLocks=OFD});var ix=T((whD,nx)=>{var HFD=S0();function VFD(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((Y)=>{X[Y]=(...J)=>{let Q=J.pop(),F;try{F=D[`${Y}Sync`](...J)}catch(Z){return Q(Z)}Q(null,F)}}),X}function NFD(D){return(...$)=>new Promise((X,Y)=>{$.push((J,Q)=>{if(J)Y(J);else X(Q)}),D(...$)})}function LFD(D){return(...$)=>{let X,Y;if($.push((J,Q)=>{X=J,Y=Q}),D(...$),X)throw X;return Y}}function MFD(D){if(D={...D},D.fs=VFD(D.fs||HFD),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}nx.exports={toPromise:NFD,toSync:LFD,toSyncOptions:MFD}});var rx=T((GhD,n6)=>{var b9=lx(),{toPromise:jY,toSync:EY,toSyncOptions:bO}=ix();async function px(D,$){let X=await jY(b9.lock)(D,$);return jY(X)}function IFD(D,$){let X=EY(b9.lock)(D,bO($));return EY(X)}function AFD(D,$){return jY(b9.unlock)(D,$)}function RFD(D,$){return EY(b9.unlock)(D,bO($))}function jFD(D,$){return jY(b9.check)(D,$)}function EFD(D,$){return EY(b9.check)(D,bO($))}n6.exports=px;n6.exports.lock=px;n6.exports.unlock=AFD;n6.exports.lockSync=IFD;n6.exports.unlockSync=RFD;n6.exports.check=jFD;n6.exports.checkSync=EFD});var $S=T((ex)=>{Object.defineProperty(ex,"__esModule",{value:!0});ex.canStoreURLs=ex.FileUrlStorage=void 0;var ox=p("fs"),TFD=PFD(Ax()),ax=CFD(rx());function sx(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(sx=function(Y){return Y?X:$})(D)}function CFD(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=sx($);if(X&&X.has(D))return X.get(D);var Y={__proto__:null},J=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Q in D)if(Q!=="default"&&{}.hasOwnProperty.call(D,Q)){var F=J?Object.getOwnPropertyDescriptor(D,Q):null;F&&(F.get||F.set)?Object.defineProperty(Y,Q,F):Y[Q]=D[Q]}return Y.default=D,X&&X.set(D,Y),Y}function PFD(D){return D&&D.__esModule?D:{default:D}}function N3(D){return N3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},N3(D)}function xFD(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function tx(D,$){for(var X=0;X<$.length;X++){var Y=$[X];if(Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y)Y.writable=!0;Object.defineProperty(D,uFD(Y.key),Y)}}function SFD(D,$,X){if($)tx(D.prototype,$);if(X)tx(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function uFD(D){var $=vFD(D,"string");return N3($)=="symbol"?$:$+""}function vFD(D,$){if(N3(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var Y=X.call(D,$||"default");if(N3(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var UhD=ex.canStoreURLs=!0,OhD=ex.FileUrlStorage=function(){function D($){xFD(this,D),this.path=$}return SFD(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(Y,J){X._getItems("tus::",function(Q,F){if(Q)J(Q);else Y(F)})})}},{key:"findUploadsByFingerprint",value:function(X){var Y=this;return new Promise(function(J,Q){Y._getItems("tus::".concat(X),function(F,Z){if(F)Q(F);else J(Z)})})}},{key:"removeUpload",value:function(X){var Y=this;return new Promise(function(J,Q){Y._removeItem(X,function(F){if(F)Q(F);else J()})})}},{key:"addUpload",value:function(X,Y){var J=this,Q=Math.round(Math.random()*1000000000000),F="tus::".concat(X,"::").concat(Q);return new Promise(function(Z,w){J._setItem(F,Y,function(G){if(G)w(G);else Z(F)})})}},{key:"_setItem",value:function(X,Y,J){var Q=this;ax.lock(this.path,this._lockfileOptions()).then(function(F){J=Q._releaseAndCb(F,J),Q._getData(function(Z,w){if(Z){J(Z);return}w[X]=Y,Q._writeData(w,function(G){return J(G)})})}).catch(J)}},{key:"_getItems",value:function(X,Y){this._getData(function(J,Q){if(J){Y(J);return}var F=Object.keys(Q).filter(function(Z){return Z.startsWith(X)}).map(function(Z){var w=Q[Z];return w.urlStorageKey=Z,w});Y(null,F)})}},{key:"_removeItem",value:function(X,Y){var J=this;ax.lock(this.path,this._lockfileOptions()).then(function(Q){Y=J._releaseAndCb(Q,Y),J._getData(function(F,Z){if(F){Y(F);return}delete Z[X],J._writeData(Z,function(w){return Y(w)})})}).catch(Y)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(X,Y){return function(J){if(J){X().then(function(){return Y(J)}).catch(function(Q){return Y((0,TFD.default)([J,Q]))});return}X().then(Y).catch(Y)}}},{key:"_writeData",value:function(X,Y){var J={encoding:"utf8",mode:432,flag:"w"};(0,ox.writeFile)(this.path,JSON.stringify(X),J,function(Q){return Y(Q)})}},{key:"_getData",value:function(X){(0,ox.readFile)(this.path,"utf8",function(Y,J){if(Y){if(Y.code==="ENOENT")X(null,{});else X(Y);return}try{J=!J.trim().length?{}:JSON.parse(J)}catch(Q){X(Q);return}X(null,J)})}}])}()});var CY=T((i6)=>{Object.defineProperty(i6,"__esModule",{value:!0});Object.defineProperty(i6,"DefaultHttpStack",{enumerable:!0,get:function(){return QS.default}});Object.defineProperty(i6,"DetailedError",{enumerable:!0,get:function(){return kFD.default}});Object.defineProperty(i6,"FileUrlStorage",{enumerable:!0,get:function(){return FS.FileUrlStorage}});Object.defineProperty(i6,"StreamSource",{enumerable:!0,get:function(){return gFD.default}});i6.Upload=void 0;Object.defineProperty(i6,"canStoreURLs",{enumerable:!0,get:function(){return FS.canStoreURLs}});i6.defaultOptions=void 0;Object.defineProperty(i6,"enableDebugLog",{enumerable:!0,get:function(){return fFD.enableDebugLog}});i6.isSupported=void 0;var kFD=Q8(bU()),fFD=hU(),yFD=Q8(rT()),hO=Q8(TC()),bFD=Q8(pC()),hFD=Q8(sC()),QS=Q8(BP()),gFD=Q8(aU()),FS=$S();function Q8(D){return D&&D.__esModule?D:{default:D}}function g9(D){return g9=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},g9(D)}function mFD(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function XS(D,$){for(var X=0;X<$.length;X++){var Y=$[X];if(Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y)Y.writable=!0;Object.defineProperty(D,wS(Y.key),Y)}}function cFD(D,$,X){if($)XS(D.prototype,$);if(X)XS(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function dFD(D,$,X){return $=TY($),lFD(D,ZS()?Reflect.construct($,X||[],TY(D).constructor):$.apply(D,X))}function lFD(D,$){if($&&(g9($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return nFD(D)}function nFD(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function ZS(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(ZS=function(){return!!D})()}function TY(D){return TY=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},TY(D)}function iFD(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)gO(D,$)}function gO(D,$){return gO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Y,J){return Y.__proto__=J,Y},gO(D,$)}function JS(D,$){var X=Object.keys(D);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(D);$&&(Y=Y.filter(function(J){return Object.getOwnPropertyDescriptor(D,J).enumerable})),X.push.apply(X,Y)}return X}function h9(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?JS(Object(X),!0).forEach(function(Y){pFD(D,Y,X[Y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):JS(Object(X)).forEach(function(Y){Object.defineProperty(D,Y,Object.getOwnPropertyDescriptor(X,Y))})}return D}function pFD(D,$,X){if($=wS($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function wS(D){var $=rFD(D,"string");return g9($)=="symbol"?$:$+""}function rFD(D,$){if(g9(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var Y=X.call(D,$||"default");if(g9(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var YS=i6.defaultOptions=h9(h9({},hO.default.defaultOptions),{},{httpStack:new QS.default,fileReader:new bFD.default,urlStorage:new yFD.default,fingerprint:hFD.default}),zhD=i6.Upload=function(D){function $(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return mFD(this,$),Y=h9(h9({},YS),Y),dFD(this,$,[X,Y])}return iFD($,D),cFD($,null,[{key:"terminate",value:function(Y){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return J=h9(h9({},YS),J),hO.default.terminate(Y,J)}}])}(hO.default),BhD=i6.isSupported=!0});var H$;var L3=o(()=>{H$={name:"@capgo/cli",type:"module",version:"7.88.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split"},devDependencies:{"@antfu/eslint-config":"^7.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.0.0","@modelcontextprotocol/sdk":"^1.25.3","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.79.0","@tanstack/intent":"^0.0.23","@types/adm-zip":"^0.5.7","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.0.0","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/react":"^18.3.28","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",eslint:"^9.38.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.0",micromatch:"^4.0.8",open:"^11.0.0",partysocket:"^1.1.11",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",ws:"^8.18.3",zod:"^4.3.6"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^5.2.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.3.3",react:"^18.3.1"}}});async function PY(D){try{let X=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,Y=await fetch(X,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!Y.ok)return null;return(await Y.json())["dist-tags"]?.latest||null}catch{return null}}async function F0(){let D=await PY("@capgo/cli")??"",$=D?.split(".")[0];if(D!==H$.version)H.warning(`\uD83D\uDEA8 You are using @capgo/cli@${H$.version} it's not the latest version.
|
|
130
|
+
GFS4: `),console.error(D)};if(!M0[o0]){if(jO=global[o0]||[],ux(M0,jO),M0.close=function(D){function $(X,Y){return D.call(M0,X,function(J){if(!J)Sx();if(typeof Y==="function")Y.apply(this,arguments)})}return Object.defineProperty($,NY,{value:D}),$}(M0.close),M0.closeSync=function(D){function $(X){D.apply(M0,arguments),Sx()}return Object.defineProperty($,NY,{value:D}),$}(M0.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){$8(M0[o0]),p("assert").equal(M0[o0].length,0)})}var jO;if(!global[o0])ux(global,M0[o0]);CO.exports=EO(rQD(M0));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!M0.__patched)CO.exports=EO(M0),M0.__patched=!0;function EO(D){iQD(D),D.gracefulify=EO,D.createReadStream=N,D.createWriteStream=R;var $=D.readFile;D.readFile=X;function X(_,u,x){if(typeof u==="function")x=u,u=null;return h(_,u,x);function h(b,l,f,j){return $(b,l,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))k9([h,[b,l,f],S,j||Date.now(),Date.now()]);else if(typeof f==="function")f.apply(this,arguments)})}}var Y=D.writeFile;D.writeFile=J;function J(_,u,x,h){if(typeof x==="function")h=x,x=null;return b(_,u,x,h);function b(l,f,j,S,v){return Y(l,f,j,function(y){if(y&&(y.code==="EMFILE"||y.code==="ENFILE"))k9([b,[l,f,j,S],y,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var Q=D.appendFile;if(Q)D.appendFile=F;function F(_,u,x,h){if(typeof x==="function")h=x,x=null;return b(_,u,x,h);function b(l,f,j,S,v){return Q(l,f,j,function(y){if(y&&(y.code==="EMFILE"||y.code==="ENFILE"))k9([b,[l,f,j,S],y,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var Z=D.copyFile;if(Z)D.copyFile=w;function w(_,u,x,h){if(typeof x==="function")h=x,x=0;return b(_,u,x,h);function b(l,f,j,S,v){return Z(l,f,j,function(y){if(y&&(y.code==="EMFILE"||y.code==="ENFILE"))k9([b,[l,f,j,S],y,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=O;var U=/^v[0-5]\./;function O(_,u,x){if(typeof u==="function")x=u,u=null;var h=U.test(process.version)?function(f,j,S,v){return G(f,b(f,j,S,v))}:function(f,j,S,v){return G(f,j,b(f,j,S,v))};return h(_,u,x);function b(l,f,j,S){return function(v,y){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))k9([h,[l,f,j],v,S||Date.now(),Date.now()]);else{if(y&&y.sort)y.sort();if(typeof j==="function")j.call(this,v,y)}}}}if(process.version.substr(0,4)==="v0.8"){var q=pQD(D);M=q.ReadStream,K=q.WriteStream}var z=D.ReadStream;if(z)M.prototype=Object.create(z.prototype),M.prototype.open=I;var B=D.WriteStream;if(B)K.prototype=Object.create(B.prototype),K.prototype.open=V;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(_){M=_},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return K},set:function(_){K=_},enumerable:!0,configurable:!0});var W=M;Object.defineProperty(D,"FileReadStream",{get:function(){return W},set:function(_){W=_},enumerable:!0,configurable:!0});var L=K;Object.defineProperty(D,"FileWriteStream",{get:function(){return L},set:function(_){L=_},enumerable:!0,configurable:!0});function M(_,u){if(this instanceof M)return z.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function I(){var _=this;A(_.path,_.flags,_.mode,function(u,x){if(u){if(_.autoClose)_.destroy();_.emit("error",u)}else _.fd=x,_.emit("open",x),_.read()})}function K(_,u){if(this instanceof K)return B.apply(this,arguments),this;else return K.apply(Object.create(K.prototype),arguments)}function V(){var _=this;A(_.path,_.flags,_.mode,function(u,x){if(u)_.destroy(),_.emit("error",u);else _.fd=x,_.emit("open",x)})}function N(_,u){return new D.ReadStream(_,u)}function R(_,u){return new D.WriteStream(_,u)}var C=D.open;D.open=A;function A(_,u,x,h){if(typeof x==="function")h=x,x=null;return b(_,u,x,h);function b(l,f,j,S,v){return C(l,f,j,function(y,g){if(y&&(y.code==="EMFILE"||y.code==="ENFILE"))k9([b,[l,f,j,S],y,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function k9(D){$8("ENQUEUE",D[0].name,D[1]),M0[o0].push(D),TO()}var VY;function Sx(){var D=Date.now();for(var $=0;$<M0[o0].length;++$)if(M0[o0][$].length>2)M0[o0][$][3]=D,M0[o0][$][4]=D;TO()}function TO(){if(clearTimeout(VY),VY=void 0,M0[o0].length===0)return;var D=M0[o0].shift(),$=D[0],X=D[1],Y=D[2],J=D[3],Q=D[4];if(J===void 0)$8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-J>=60000){$8("TIMEOUT",$.name,X);var F=X.pop();if(typeof F==="function")F.call(null,Y)}else{var Z=Date.now()-Q,w=Math.max(Q-J,1),G=Math.min(w*1.2,100);if(Z>=G)$8("RETRY",$.name,X),$.apply(null,X.concat([J]));else M0[o0].push(D)}if(VY===void 0)VY=setTimeout(TO,0)}});var _x=T((YhD,vx)=>{function e1(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}vx.exports=e1;e1.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};e1.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};e1.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var X=this._timeouts.shift();if(X===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),X=this._timeouts.shift();else return!1;var Y=this,J=setTimeout(function(){if(Y._attempts++,Y._operationTimeoutCb){if(Y._timeout=setTimeout(function(){Y._operationTimeoutCb(Y._attempts)},Y._operationTimeout),Y._options.unref)Y._timeout.unref()}Y._fn(Y._attempts)},X);if(this._options.unref)J.unref();return!0};e1.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var X=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){X._operationTimeoutCb()},X._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};e1.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};e1.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};e1.prototype.start=e1.prototype.try;e1.prototype.errors=function(){return this._errors};e1.prototype.attempts=function(){return this._attempts};e1.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,X=0;for(var Y=0;Y<this._errors.length;Y++){var J=this._errors[Y],Q=J.message,F=(D[Q]||0)+1;if(D[Q]=F,F>=X)$=J,X=F}return $}});var fx=T((tQD)=>{var aQD=_x();tQD.operation=function(D){var $=tQD.timeouts(D);return new aQD($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};tQD.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var X in D)$[X]=D[X];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Y=[];for(var J=0;J<$.retries;J++)Y.push(this.createTimeout(J,$));if(D&&D.forever&&!Y.length)Y.push(this.createTimeout(J,$));return Y.sort(function(Q,F){return Q-F}),Y};tQD.createTimeout=function(D,$){var X=$.randomize?Math.random()+1:1,Y=Math.round(X*$.minTimeout*Math.pow($.factor,D));return Y=Math.min(Y,$.maxTimeout),Y};tQD.wrap=function(D,$,X){if($ instanceof Array)X=$,$=null;if(!X){X=[];for(var Y in D)if(typeof D[Y]==="function")X.push(Y)}for(var J=0;J<X.length;J++){var Q=X[J],F=D[Q];D[Q]=function(w){var G=tQD.operation($),U=Array.prototype.slice.call(arguments,1),O=U.pop();U.push(function(q){if(G.retry(q))return;if(q)arguments[0]=G.mainError();O.apply(this,arguments)}),G.attempt(function(){w.apply(D,U)})}.bind(D,F),D[Q].options=$}}});var yx=T((FhD,LY)=>{LY.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")LY.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")LY.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var AY=T((ZhD,y9)=>{var K0=global.process,X8=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!X8(K0))y9.exports=function(){return function(){}};else{if(PO=p("assert"),J8=yx(),xO=/^win/i.test(K0.platform),f9=p("events"),typeof f9!=="function")f9=f9.EventEmitter;if(K0.__signal_exit_emitter__)g0=K0.__signal_exit_emitter__;else g0=K0.__signal_exit_emitter__=new f9,g0.count=0,g0.emitted={};if(!g0.infinite)g0.setMaxListeners(1/0),g0.infinite=!0;y9.exports=function(D,$){if(!X8(global.process))return function(){};if(PO.equal(typeof D,"function","a callback must be provided for exit handler"),Y8===!1)MY();var X="exit";if($&&$.alwaysLast)X="afterexit";var Y=function(){if(g0.removeListener(X,D),g0.listeners("exit").length===0&&g0.listeners("afterexit").length===0)B3()};return g0.on(X,D),Y},B3=function(){if(!Y8||!X8(global.process))return;Y8=!1,J8.forEach(function($){try{K0.removeListener($,W3[$])}catch(X){}}),K0.emit=K3,K0.reallyExit=IY,g0.count-=1},y9.exports.unload=B3,l6=function($,X,Y){if(g0.emitted[$])return;g0.emitted[$]=!0,g0.emit($,X,Y)},W3={},J8.forEach(function(D){W3[D]=function(){if(!X8(global.process))return;var X=K0.listeners(D);if(X.length===g0.count){if(B3(),l6("exit",null,D),l6("afterexit",null,D),xO&&D==="SIGHUP")D="SIGINT";K0.kill(K0.pid,D)}}}),y9.exports.signals=function(){return J8},Y8=!1,MY=function(){if(Y8||!X8(global.process))return;Y8=!0,g0.count+=1,J8=J8.filter(function($){try{return K0.on($,W3[$]),!0}catch(X){return!1}}),K0.emit=uO,K0.reallyExit=SO},y9.exports.load=MY,IY=K0.reallyExit,SO=function($){if(!X8(global.process))return;K0.exitCode=$||0,l6("exit",K0.exitCode,null),l6("afterexit",K0.exitCode,null),IY.call(K0,K0.exitCode)},K3=K0.emit,uO=function($,X){if($==="exit"&&X8(global.process)){if(X!==void 0)K0.exitCode=X;var Y=K3.apply(this,arguments);return l6("exit",K0.exitCode,null),l6("afterexit",K0.exitCode,null),Y}else return K3.apply(this,arguments)}}var PO,J8,xO,f9,g0,B3,l6,W3,Y8,MY,IY,SO,K3,uO});var hx=T((JFD,vO)=>{var bx=Symbol();function $FD(D,$,X){let Y=$[bx];if(Y)return $.stat(D,(Q,F)=>{if(Q)return X(Q);X(null,F.mtime,Y)});let J=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,J,J,(Q)=>{if(Q)return X(Q);$.stat(D,(F,Z)=>{if(F)return X(F);let w=Z.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,bx,{value:w}),X(null,Z.mtime,w)})})}function XFD(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}JFD.probe=$FD;JFD.getMtime=XFD});var lx=T((qFD,V3)=>{var FFD=p("path"),fO=S0(),ZFD=fx(),wFD=AY(),gx=hx(),Z6={};function H3(D,$){return $.lockfilePath||`${D}.lock`}function yO(D,$,X){if(!$.realpath)return X(null,FFD.resolve(D));$.fs.realpath(D,X)}function kO(D,$,X){let Y=H3(D,$);$.fs.mkdir(Y,(J)=>{if(!J)return gx.probe(Y,$.fs,(Q,F,Z)=>{if(Q)return $.fs.rmdir(Y,()=>{}),X(Q);X(null,F,Z)});if(J.code!=="EEXIST")return X(J);if($.stale<=0)return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(Y,(Q,F)=>{if(Q){if(Q.code==="ENOENT")return kO(D,{...$,stale:0},X);return X(Q)}if(!mx(F,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));cx(D,$,(Z)=>{if(Z)return X(Z);kO(D,{...$,stale:0},X)})})})}function mx(D,$){return D.mtime.getTime()<Date.now()-$.stale}function cx(D,$,X){$.fs.rmdir(H3(D,$),(Y)=>{if(Y&&Y.code!=="ENOENT")return X(Y);X()})}function RY(D,$){let X=Z6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(Y,J)=>{let Q=X.lastUpdate+$.stale<Date.now();if(Y){if(Y.code==="ENOENT"||Q)return _O(D,X,Object.assign(Y,{code:"ECOMPROMISED"}));return X.updateDelay=1000,RY(D,$)}if(X.mtime.getTime()!==J.mtime.getTime())return _O(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let Z=gx.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,Z,Z,(w)=>{let G=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(w){if(w.code==="ENOENT"||G)return _O(D,X,Object.assign(w,{code:"ECOMPROMISED"}));return X.updateDelay=1000,RY(D,$)}X.mtime=Z,X.lastUpdate=Date.now(),X.updateDelay=null,RY(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function _O(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(Z6[D]===$)delete Z6[D];$.options.onCompromised(X)}function GFD(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:fO,onCompromised:(Y)=>{throw Y},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),yO(D,$,(Y,J)=>{if(Y)return X(Y);let Q=ZFD.operation($.retries);Q.attempt(()=>{kO(J,$,(F,Z,w)=>{if(Q.retry(F))return;if(F)return X(Q.mainError());let G=Z6[J]={lockfilePath:H3(J,$),mtime:Z,mtimePrecision:w,options:$,lastUpdate:Date.now()};RY(J,$),X(null,(U)=>{if(G.released)return U&&U(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));dx(J,{...$,realpath:!1},U)})})})})}function dx(D,$,X){$={fs:fO,realpath:!0,...$},yO(D,$,(Y,J)=>{if(Y)return X(Y);let Q=Z6[J];if(!Q)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Q.updateTimeout&&clearTimeout(Q.updateTimeout),Q.released=!0,delete Z6[J],cx(J,$,X)})}function UFD(D,$,X){$={stale:1e4,realpath:!0,fs:fO,...$},$.stale=Math.max($.stale||0,2000),yO(D,$,(Y,J)=>{if(Y)return X(Y);$.fs.stat(H3(J,$),(Q,F)=>{if(Q)return Q.code==="ENOENT"?X(null,!1):X(Q);return X(null,!mx(F,$))})})}function OFD(){return Z6}wFD(()=>{for(let D in Z6){let $=Z6[D].options;try{$.fs.rmdirSync(H3(D,$))}catch(X){}}});qFD.lock=GFD;qFD.unlock=dx;qFD.check=UFD;qFD.getLocks=OFD});var ix=T((whD,nx)=>{var HFD=S0();function VFD(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((Y)=>{X[Y]=(...J)=>{let Q=J.pop(),F;try{F=D[`${Y}Sync`](...J)}catch(Z){return Q(Z)}Q(null,F)}}),X}function NFD(D){return(...$)=>new Promise((X,Y)=>{$.push((J,Q)=>{if(J)Y(J);else X(Q)}),D(...$)})}function LFD(D){return(...$)=>{let X,Y;if($.push((J,Q)=>{X=J,Y=Q}),D(...$),X)throw X;return Y}}function MFD(D){if(D={...D},D.fs=VFD(D.fs||HFD),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}nx.exports={toPromise:NFD,toSync:LFD,toSyncOptions:MFD}});var rx=T((GhD,n6)=>{var b9=lx(),{toPromise:jY,toSync:EY,toSyncOptions:bO}=ix();async function px(D,$){let X=await jY(b9.lock)(D,$);return jY(X)}function IFD(D,$){let X=EY(b9.lock)(D,bO($));return EY(X)}function AFD(D,$){return jY(b9.unlock)(D,$)}function RFD(D,$){return EY(b9.unlock)(D,bO($))}function jFD(D,$){return jY(b9.check)(D,$)}function EFD(D,$){return EY(b9.check)(D,bO($))}n6.exports=px;n6.exports.lock=px;n6.exports.unlock=AFD;n6.exports.lockSync=IFD;n6.exports.unlockSync=RFD;n6.exports.check=jFD;n6.exports.checkSync=EFD});var $S=T((ex)=>{Object.defineProperty(ex,"__esModule",{value:!0});ex.canStoreURLs=ex.FileUrlStorage=void 0;var ox=p("fs"),TFD=PFD(Ax()),ax=CFD(rx());function sx(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(sx=function(Y){return Y?X:$})(D)}function CFD(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=sx($);if(X&&X.has(D))return X.get(D);var Y={__proto__:null},J=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Q in D)if(Q!=="default"&&{}.hasOwnProperty.call(D,Q)){var F=J?Object.getOwnPropertyDescriptor(D,Q):null;F&&(F.get||F.set)?Object.defineProperty(Y,Q,F):Y[Q]=D[Q]}return Y.default=D,X&&X.set(D,Y),Y}function PFD(D){return D&&D.__esModule?D:{default:D}}function N3(D){return N3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},N3(D)}function xFD(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function tx(D,$){for(var X=0;X<$.length;X++){var Y=$[X];if(Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y)Y.writable=!0;Object.defineProperty(D,uFD(Y.key),Y)}}function SFD(D,$,X){if($)tx(D.prototype,$);if(X)tx(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function uFD(D){var $=vFD(D,"string");return N3($)=="symbol"?$:$+""}function vFD(D,$){if(N3(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var Y=X.call(D,$||"default");if(N3(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var UhD=ex.canStoreURLs=!0,OhD=ex.FileUrlStorage=function(){function D($){xFD(this,D),this.path=$}return SFD(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(Y,J){X._getItems("tus::",function(Q,F){if(Q)J(Q);else Y(F)})})}},{key:"findUploadsByFingerprint",value:function(X){var Y=this;return new Promise(function(J,Q){Y._getItems("tus::".concat(X),function(F,Z){if(F)Q(F);else J(Z)})})}},{key:"removeUpload",value:function(X){var Y=this;return new Promise(function(J,Q){Y._removeItem(X,function(F){if(F)Q(F);else J()})})}},{key:"addUpload",value:function(X,Y){var J=this,Q=Math.round(Math.random()*1000000000000),F="tus::".concat(X,"::").concat(Q);return new Promise(function(Z,w){J._setItem(F,Y,function(G){if(G)w(G);else Z(F)})})}},{key:"_setItem",value:function(X,Y,J){var Q=this;ax.lock(this.path,this._lockfileOptions()).then(function(F){J=Q._releaseAndCb(F,J),Q._getData(function(Z,w){if(Z){J(Z);return}w[X]=Y,Q._writeData(w,function(G){return J(G)})})}).catch(J)}},{key:"_getItems",value:function(X,Y){this._getData(function(J,Q){if(J){Y(J);return}var F=Object.keys(Q).filter(function(Z){return Z.startsWith(X)}).map(function(Z){var w=Q[Z];return w.urlStorageKey=Z,w});Y(null,F)})}},{key:"_removeItem",value:function(X,Y){var J=this;ax.lock(this.path,this._lockfileOptions()).then(function(Q){Y=J._releaseAndCb(Q,Y),J._getData(function(F,Z){if(F){Y(F);return}delete Z[X],J._writeData(Z,function(w){return Y(w)})})}).catch(Y)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(X,Y){return function(J){if(J){X().then(function(){return Y(J)}).catch(function(Q){return Y((0,TFD.default)([J,Q]))});return}X().then(Y).catch(Y)}}},{key:"_writeData",value:function(X,Y){var J={encoding:"utf8",mode:432,flag:"w"};(0,ox.writeFile)(this.path,JSON.stringify(X),J,function(Q){return Y(Q)})}},{key:"_getData",value:function(X){(0,ox.readFile)(this.path,"utf8",function(Y,J){if(Y){if(Y.code==="ENOENT")X(null,{});else X(Y);return}try{J=!J.trim().length?{}:JSON.parse(J)}catch(Q){X(Q);return}X(null,J)})}}])}()});var CY=T((i6)=>{Object.defineProperty(i6,"__esModule",{value:!0});Object.defineProperty(i6,"DefaultHttpStack",{enumerable:!0,get:function(){return QS.default}});Object.defineProperty(i6,"DetailedError",{enumerable:!0,get:function(){return kFD.default}});Object.defineProperty(i6,"FileUrlStorage",{enumerable:!0,get:function(){return FS.FileUrlStorage}});Object.defineProperty(i6,"StreamSource",{enumerable:!0,get:function(){return gFD.default}});i6.Upload=void 0;Object.defineProperty(i6,"canStoreURLs",{enumerable:!0,get:function(){return FS.canStoreURLs}});i6.defaultOptions=void 0;Object.defineProperty(i6,"enableDebugLog",{enumerable:!0,get:function(){return fFD.enableDebugLog}});i6.isSupported=void 0;var kFD=Q8(bU()),fFD=hU(),yFD=Q8(rT()),hO=Q8(TC()),bFD=Q8(pC()),hFD=Q8(sC()),QS=Q8(BP()),gFD=Q8(aU()),FS=$S();function Q8(D){return D&&D.__esModule?D:{default:D}}function g9(D){return g9=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},g9(D)}function mFD(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function XS(D,$){for(var X=0;X<$.length;X++){var Y=$[X];if(Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y)Y.writable=!0;Object.defineProperty(D,wS(Y.key),Y)}}function cFD(D,$,X){if($)XS(D.prototype,$);if(X)XS(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function dFD(D,$,X){return $=TY($),lFD(D,ZS()?Reflect.construct($,X||[],TY(D).constructor):$.apply(D,X))}function lFD(D,$){if($&&(g9($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return nFD(D)}function nFD(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function ZS(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(ZS=function(){return!!D})()}function TY(D){return TY=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},TY(D)}function iFD(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)gO(D,$)}function gO(D,$){return gO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Y,J){return Y.__proto__=J,Y},gO(D,$)}function JS(D,$){var X=Object.keys(D);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(D);$&&(Y=Y.filter(function(J){return Object.getOwnPropertyDescriptor(D,J).enumerable})),X.push.apply(X,Y)}return X}function h9(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?JS(Object(X),!0).forEach(function(Y){pFD(D,Y,X[Y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):JS(Object(X)).forEach(function(Y){Object.defineProperty(D,Y,Object.getOwnPropertyDescriptor(X,Y))})}return D}function pFD(D,$,X){if($=wS($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function wS(D){var $=rFD(D,"string");return g9($)=="symbol"?$:$+""}function rFD(D,$){if(g9(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var Y=X.call(D,$||"default");if(g9(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var YS=i6.defaultOptions=h9(h9({},hO.default.defaultOptions),{},{httpStack:new QS.default,fileReader:new bFD.default,urlStorage:new yFD.default,fingerprint:hFD.default}),zhD=i6.Upload=function(D){function $(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return mFD(this,$),Y=h9(h9({},YS),Y),dFD(this,$,[X,Y])}return iFD($,D),cFD($,null,[{key:"terminate",value:function(Y){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return J=h9(h9({},YS),J),hO.default.terminate(Y,J)}}])}(hO.default),BhD=i6.isSupported=!0});var H$;var L3=o(()=>{H$={name:"@capgo/cli",type:"module",version:"7.88.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split"},devDependencies:{"@antfu/eslint-config":"^7.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.5","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.0.0","@modelcontextprotocol/sdk":"^1.25.3","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.79.0","@tanstack/intent":"^0.0.23","@types/adm-zip":"^0.5.7","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.0.0","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/react":"^18.3.28","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",eslint:"^9.38.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.0",micromatch:"^4.0.8",open:"^11.0.0",partysocket:"^1.1.11",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",ws:"^8.18.3",zod:"^4.3.6"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^5.2.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.3.3",react:"^18.3.1"}}});async function PY(D){try{let X=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,Y=await fetch(X,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!Y.ok)return null;return(await Y.json())["dist-tags"]?.latest||null}catch{return null}}async function F0(){let D=await PY("@capgo/cli")??"",$=D?.split(".")[0];if(D!==H$.version)H.warning(`\uD83D\uDEA8 You are using @capgo/cli@${H$.version} it's not the latest version.
|
|
131
131
|
Please use @capgo/cli@${D}" or @capgo/cli@${$} to keep up to date with the latest features and bug fixes.`)}var O1=o(()=>{vD();L3()});async function qS(D,$,X,Y,J,Q="✅"){await AD(X,{channel:D,event:Y,icon:Q,user_id:$,...J?{tags:{"app-id":J}}:{},notify:!1})}var zS=o(()=>{vD();D6();O1();kD()});import{Buffer as BS}from"node:buffer";import{createHash as aFD}from"node:crypto";function sFD(D){let $=4294967295;for(let X=0;X<D.length;X++){let Y=D[X];$=tFD[($^Y)&255]^$>>>8}return $=$^4294967295,($>>>0).toString(16).padStart(8,"0")}async function p6(D,$="sha256"){let X=BS.isBuffer(D)?D:BS.from(D);if($==="crc32")return sFD(X);let Y=aFD($);return Y.update(X),Y.digest("hex")}var tFD;var M3=o(()=>{tFD=(()=>{let D=[];for(let $=0;$<256;$++){let X=$;for(let Y=0;Y<8;Y++)X=X&1?3988292384^X>>>1:X>>>1;D[$]=X}return D})()});var KS=T((xhD,WS)=>{var m9=1000,c9=m9*60,d9=c9*60,F8=d9*24,eFD=F8*7,DZD=F8*365.25;WS.exports=function(D,$){$=$||{};var X=typeof D;if(X==="string"&&D.length>0)return $ZD(D);else if(X==="number"&&isFinite(D))return $.long?JZD(D):XZD(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function $ZD(D){if(D=String(D),D.length>100)return;var $=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!$)return;var X=parseFloat($[1]),Y=($[2]||"ms").toLowerCase();switch(Y){case"years":case"year":case"yrs":case"yr":case"y":return X*DZD;case"weeks":case"week":case"w":return X*eFD;case"days":case"day":case"d":return X*F8;case"hours":case"hour":case"hrs":case"hr":case"h":return X*d9;case"minutes":case"minute":case"mins":case"min":case"m":return X*c9;case"seconds":case"second":case"secs":case"sec":case"s":return X*m9;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return X;default:return}}function XZD(D){var $=Math.abs(D);if($>=F8)return Math.round(D/F8)+"d";if($>=d9)return Math.round(D/d9)+"h";if($>=c9)return Math.round(D/c9)+"m";if($>=m9)return Math.round(D/m9)+"s";return D+"ms"}function JZD(D){var $=Math.abs(D);if($>=F8)return xY(D,$,F8,"day");if($>=d9)return xY(D,$,d9,"hour");if($>=c9)return xY(D,$,c9,"minute");if($>=m9)return xY(D,$,m9,"second");return D+" ms"}function xY(D,$,X,Y){var J=$>=X*1.5;return Math.round(D/X)+" "+Y+(J?"s":"")}});var mO=T((ShD,HS)=>{function YZD(D){X.debug=X,X.default=X,X.coerce=w,X.disable=F,X.enable=J,X.enabled=Z,X.humanize=KS(),X.destroy=G,Object.keys(D).forEach((U)=>{X[U]=D[U]}),X.names=[],X.skips=[],X.formatters={};function $(U){let O=0;for(let q=0;q<U.length;q++)O=(O<<5)-O+U.charCodeAt(q),O|=0;return X.colors[Math.abs(O)%X.colors.length]}X.selectColor=$;function X(U){let O,q=null,z,B;function W(...L){if(!W.enabled)return;let M=W,I=Number(new Date),K=I-(O||I);if(M.diff=K,M.prev=O,M.curr=I,O=I,L[0]=X.coerce(L[0]),typeof L[0]!=="string")L.unshift("%O");let V=0;L[0]=L[0].replace(/%([a-zA-Z%])/g,(R,C)=>{if(R==="%%")return"%";V++;let A=X.formatters[C];if(typeof A==="function"){let _=L[V];R=A.call(M,_),L.splice(V,1),V--}return R}),X.formatArgs.call(M,L),(M.log||X.log).apply(M,L)}if(W.namespace=U,W.useColors=X.useColors(),W.color=X.selectColor(U),W.extend=Y,W.destroy=X.destroy,Object.defineProperty(W,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(q!==null)return q;if(z!==X.namespaces)z=X.namespaces,B=X.enabled(U);return B},set:(L)=>{q=L}}),typeof X.init==="function")X.init(W);return W}function Y(U,O){let q=X(this.namespace+(typeof O>"u"?":":O)+U);return q.log=this.log,q}function J(U){X.save(U),X.namespaces=U,X.names=[],X.skips=[];let O=(typeof U==="string"?U:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let q of O)if(q[0]==="-")X.skips.push(q.slice(1));else X.names.push(q)}function Q(U,O){let q=0,z=0,B=-1,W=0;while(q<U.length)if(z<O.length&&(O[z]===U[q]||O[z]==="*"))if(O[z]==="*")B=z,W=q,z++;else q++,z++;else if(B!==-1)z=B+1,W++,q=W;else return!1;while(z<O.length&&O[z]==="*")z++;return z===O.length}function F(){let U=[...X.names,...X.skips.map((O)=>"-"+O)].join(",");return X.enable(""),U}function Z(U){for(let O of X.skips)if(Q(U,O))return!1;for(let O of X.names)if(Q(U,O))return!0;return!1}function w(U){if(U instanceof Error)return U.stack||U.message;return U}function G(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return X.enable(X.load()),X}HS.exports=YZD});var NS=T((VS,SY)=>{VS.formatArgs=FZD;VS.save=ZZD;VS.load=wZD;VS.useColors=QZD;VS.storage=GZD();VS.destroy=(()=>{let D=!1;return()=>{if(!D)D=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();VS.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function QZD(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let D;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(D=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(D[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function FZD(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+SY.exports.humanize(this.diff),!this.useColors)return;let $="color: "+this.color;D.splice(1,0,$,"color: inherit");let X=0,Y=0;D[0].replace(/%[a-zA-Z%]/g,(J)=>{if(J==="%%")return;if(X++,J==="%c")Y=X}),D.splice(Y,0,$)}VS.log=console.debug||console.log||(()=>{});function ZZD(D){try{if(D)VS.storage.setItem("debug",D);else VS.storage.removeItem("debug")}catch($){}}function wZD(){let D;try{D=VS.storage.getItem("debug")||VS.storage.getItem("DEBUG")}catch($){}if(!D&&typeof process<"u"&&"env"in process)D=process.env.DEBUG;return D}function GZD(){try{return localStorage}catch(D){}}SY.exports=mO()(VS);var{formatters:UZD}=SY.exports;UZD.j=function(D){try{return JSON.stringify(D)}catch($){return"[UnexpectedJSONParseError]: "+$.message}}});var MS=T((vhD,LS)=>{LS.exports=(D,$=process.argv)=>{let X=D.startsWith("-")?"":D.length===1?"-":"--",Y=$.indexOf(X+D),J=$.indexOf("--");return Y!==-1&&(J===-1||Y<J)}});var RS=T((_hD,AS)=>{var VZD=p("os"),IS=p("tty"),D$=MS(),{env:n0}=process,r6;if(D$("no-color")||D$("no-colors")||D$("color=false")||D$("color=never"))r6=0;else if(D$("color")||D$("colors")||D$("color=true")||D$("color=always"))r6=1;if("FORCE_COLOR"in n0)if(n0.FORCE_COLOR==="true")r6=1;else if(n0.FORCE_COLOR==="false")r6=0;else r6=n0.FORCE_COLOR.length===0?1:Math.min(parseInt(n0.FORCE_COLOR,10),3);function cO(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function dO(D,$){if(r6===0)return 0;if(D$("color=16m")||D$("color=full")||D$("color=truecolor"))return 3;if(D$("color=256"))return 2;if(D&&!$&&r6===void 0)return 0;let X=r6||0;if(n0.TERM==="dumb")return X;if(process.platform==="win32"){let Y=VZD.release().split(".");if(Number(Y[0])>=10&&Number(Y[2])>=10586)return Number(Y[2])>=14931?3:2;return 1}if("CI"in n0){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((Y)=>(Y in n0))||n0.CI_NAME==="codeship")return 1;return X}if("TEAMCITY_VERSION"in n0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n0.TEAMCITY_VERSION)?1:0;if(n0.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in n0){let Y=parseInt((n0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n0.TERM_PROGRAM){case"iTerm.app":return Y>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(n0.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n0.TERM))return 1;if("COLORTERM"in n0)return 1;return X}function NZD(D){let $=dO(D,D&&D.isTTY);return cO($)}AS.exports={supportsColor:NZD,stdout:cO(dO(!0,IS.isatty(1))),stderr:cO(dO(!0,IS.isatty(2)))}});var CS=T((ES,vY)=>{var LZD=p("tty"),uY=p("util");ES.init=TZD;ES.log=RZD;ES.formatArgs=IZD;ES.save=jZD;ES.load=EZD;ES.useColors=MZD;ES.destroy=uY.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ES.colors=[6,2,3,4,5,1];try{let D=RS();if(D&&(D.stderr||D).level>=2)ES.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(D){}ES.inspectOpts=Object.keys(process.env).filter((D)=>{return/^debug_/i.test(D)}).reduce((D,$)=>{let X=$.substring(6).toLowerCase().replace(/_([a-z])/g,(J,Q)=>{return Q.toUpperCase()}),Y=process.env[$];if(/^(yes|on|true|enabled)$/i.test(Y))Y=!0;else if(/^(no|off|false|disabled)$/i.test(Y))Y=!1;else if(Y==="null")Y=null;else Y=Number(Y);return D[X]=Y,D},{});function MZD(){return"colors"in ES.inspectOpts?Boolean(ES.inspectOpts.colors):LZD.isatty(process.stderr.fd)}function IZD(D){let{namespace:$,useColors:X}=this;if(X){let Y=this.color,J="\x1B[3"+(Y<8?Y:"8;5;"+Y),Q=` ${J};1m${$} \x1B[0m`;D[0]=Q+D[0].split(`
|
|
132
132
|
`).join(`
|
|
133
133
|
`+Q),D.push(J+"m+"+vY.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=AZD()+$+" "+D[0]}function AZD(){if(ES.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function RZD(...D){return process.stderr.write(uY.formatWithOptions(ES.inspectOpts,...D)+`
|
|
@@ -465,7 +465,7 @@ const partysocket = new PartySocket({
|
|
|
465
465
|
\uD83D\uDD12 Security: Credentials are never stored on Capgo servers`),F.info(" They are used only during build and deleted after"),F.info(` Build outputs can optionally be uploaded for time-limited download links
|
|
466
466
|
`),Q)F.info(`API host: ${G}`);let q={};if($.buildCertificateBase64)q.BUILD_CERTIFICATE_BASE64=$.buildCertificateBase64;if($.p12Password)q.P12_PASSWORD=$.p12Password;if($.appleKeyId)q.APPLE_KEY_ID=$.appleKeyId;if($.appleIssuerId)q.APPLE_ISSUER_ID=$.appleIssuerId;if($.appleKeyContent)q.APPLE_KEY_CONTENT=$.appleKeyContent;if($.appStoreConnectTeamId)q.APP_STORE_CONNECT_TEAM_ID=$.appStoreConnectTeamId;if($.iosScheme)q.CAPGO_IOS_SCHEME=$.iosScheme;if($.iosTarget)q.CAPGO_IOS_TARGET=$.iosTarget;if($.iosDistribution)q.CAPGO_IOS_DISTRIBUTION=$.iosDistribution;if($.iosProvisioningProfile&&$.iosProvisioningProfile.length>0){let u=De($.iosProvisioningProfile,Je($.path||MM()));q.CAPGO_IOS_PROVISIONING_MAP=JSON.stringify(u)}if($.iosProvisioningMap)q.CAPGO_IOS_PROVISIONING_MAP=$.iosProvisioningMap;if($.androidKeystoreFile)q.ANDROID_KEYSTORE_FILE=$.androidKeystoreFile;if($.keystoreKeyAlias)q.KEYSTORE_KEY_ALIAS=$.keystoreKeyAlias;let z=!!$.keystoreKeyPassword,B=!!$.keystoreStorePassword;if(z&&!B)q.KEYSTORE_KEY_PASSWORD=$.keystoreKeyPassword,q.KEYSTORE_STORE_PASSWORD=$.keystoreKeyPassword;else if(!z&&B)q.KEYSTORE_KEY_PASSWORD=$.keystoreStorePassword,q.KEYSTORE_STORE_PASSWORD=$.keystoreStorePassword;else if(z&&B)q.KEYSTORE_KEY_PASSWORD=$.keystoreKeyPassword,q.KEYSTORE_STORE_PASSWORD=$.keystoreStorePassword;if(typeof $.androidFlavor==="string"){let u=$.androidFlavor.trim();if(u)q.CAPGO_ANDROID_FLAVOR=u}if($.playConfigJson)q.PLAY_CONFIG_JSON=$.playConfigJson;if($.outputUpload!==void 0)q.BUILD_OUTPUT_UPLOAD_ENABLED=O7($.outputUpload)?"true":"false";if($.outputRetention)q.BUILD_OUTPUT_RETENTION_SECONDS=String(bw($.outputRetention));if($.skipBuildNumberBump!==void 0)q.SKIP_BUILD_NUMBER_BUMP=O7($.skipBuildNumberBump)?"true":"false";let W=await ls(D,$.platform,Object.keys(q).length>0?q:void 0);if($.playstoreUpload===!1&&W)delete W.PLAY_CONFIG_JSON,F.info("ℹ️ --no-playstore-upload specified, Play Store upload disabled for this build");let L=I2(w?.config,$.platform);if(W&&L)if($.platform==="ios")W.CAPGO_IOS_SOURCE_DIR=L,W.CAPGO_IOS_APP_DIR=L,W.CAPGO_IOS_PROJECT_DIR=L,W.IOS_PROJECT_DIR=L;else W.CAPGO_ANDROID_SOURCE_DIR=L,W.CAPGO_ANDROID_APP_DIR=L,W.CAPGO_ANDROID_PROJECT_DIR=L,W.ANDROID_PROJECT_DIR=L;if(!W)throw F.error("❌ No credentials found for this app and platform"),F.error(""),F.error("You must provide credentials via:"),F.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),F.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),F.error(" 3. Saved credentials file:"),F.error(` npx @capgo/cli build credentials save --appId ${D} --platform ${$.platform}`),F.error(""),F.error("Documentation:"),F.error(" https://capgo.app/docs/cli/cloud-build/credentials/"),Error("No credentials found. Please provide credentials before building.");let M=[];if($.platform==="ios"){let u=W.CAPGO_IOS_DISTRIBUTION,x=["app_store","ad_hoc"];if(u&&!x.includes(u))M.push(`Invalid CAPGO_IOS_DISTRIBUTION value: '${u}'. Must be one of: ${x.join(", ")}`);let h=u&&x.includes(u)?u:"app_store";if(!u)F.info("ℹ️ --ios-distribution not specified, defaulting to app_store");if(W.CAPGO_IOS_DISTRIBUTION=h,!W.BUILD_CERTIFICATE_BASE64)M.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)");if(!W.P12_PASSWORD)F.warn("⚠️ P12_PASSWORD not provided - assuming certificate has no password"),F.warn(" If your certificate requires a password, provide it with --p12-password");if(!!(W.BUILD_PROVISION_PROFILE_BASE64||W.APPLE_PROFILE_NAME)&&!W.CAPGO_IOS_PROVISIONING_MAP)throw F.error("❌ Legacy provisioning profile format detected. Run:"),F.error(" npx @capgo/cli build credentials migrate --platform ios"),F.error(""),F.error(" This will convert your existing provisioning profile to the new multi-target format."),Error("Legacy provisioning profile format detected. Run: npx @capgo/cli build credentials migrate --platform ios");if(!W.CAPGO_IOS_PROVISIONING_MAP)M.push('CAPGO_IOS_PROVISIONING_MAP (use --ios-provisioning-profile or save via "build credentials save")');if(h==="app_store"){let l=!!W.APPLE_KEY_ID,f=!!W.APPLE_ISSUER_ID,j=!!W.APPLE_KEY_CONTENT,S=l||f||j;if(!(l&&f&&j))if(S){let y=[];if(!l)y.push("APPLE_KEY_ID (or --apple-key-id)");if(!f)y.push("APPLE_ISSUER_ID (or --apple-issuer-id)");if(!j)y.push("APPLE_KEY_CONTENT (or --apple-key-content)");M.push(`Incomplete App Store Connect API key - missing: ${y.join(", ")}`)}else if(W.BUILD_OUTPUT_UPLOAD_ENABLED!=="true")M.push("APPLE_KEY_ID/APPLE_ISSUER_ID/APPLE_KEY_CONTENT or BUILD_OUTPUT_UPLOAD_ENABLED=true (or --output-upload) (build has no output destination - enable either TestFlight upload or Capgo download link)");else if(W.SKIP_BUILD_NUMBER_BUMP!=="true")M.push("APPLE_KEY_ID/APPLE_ISSUER_ID/APPLE_KEY_CONTENT or --skip-build-number-bump (App Store Connect API key not provided - build numbers cannot be auto-incremented without it)");else F.warn("⚠️ App Store Connect API key not provided - build will succeed but cannot auto-upload to TestFlight")}else if(h==="ad_hoc")F.info("\uD83D\uDCE6 Ad-hoc distribution mode: App Store Connect API key not required"),F.info(" Build number will use timestamp-based fallback");if(!W.APP_STORE_CONNECT_TEAM_ID)M.push("APP_STORE_CONNECT_TEAM_ID (or --app-store-connect-team-id)")}else if($.platform==="android"){if(!W.ANDROID_KEYSTORE_FILE)M.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)");if(!W.KEYSTORE_KEY_ALIAS)M.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)");if(!W.KEYSTORE_KEY_PASSWORD&&!W.KEYSTORE_STORE_PASSWORD)M.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)");if(!W.PLAY_CONFIG_JSON)if(W.BUILD_OUTPUT_UPLOAD_ENABLED!=="true")M.push("PLAY_CONFIG_JSON or BUILD_OUTPUT_UPLOAD_ENABLED=true (build has no output destination - enable either Play Store upload or Capgo download link)");else F.warn("⚠️ PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")}if(M.length>0){F.error(`❌ Missing required credentials for ${$.platform}:`),F.error("");for(let u of M)F.error(` • ${u}`);throw F.error(""),F.error("Provide credentials via:"),F.error(` 1. CLI arguments: npx @capgo/cli build request --platform ${$.platform} ${$.platform==="ios"?'--apple-key-id "..." --apple-issuer-id "..." --apple-key-content "..."':'--android-keystore-file "..." --keystore-key-alias "..."'}`),F.error(` 2. Environment variables: ${$.platform==="ios"?'export APPLE_KEY_ID="..." APPLE_ISSUER_ID="..." APPLE_KEY_CONTENT="..."':'export ANDROID_KEYSTORE_FILE="..." KEYSTORE_KEY_ALIAS="..."'}`),F.error(` 3. Saved credentials: npx @capgo/cli build credentials save --platform ${$.platform} ...`),F.error(""),F.error("Documentation:"),F.error(` https://capgo.app/docs/cli/cloud-build/${$.platform}/`),Error(`Missing required credentials for ${$.platform}: ${M.join(", ")}`)}if(!$.buildMode)F.info("ℹ️ --build-mode not specified, defaulting to release");if(!W.BUILD_OUTPUT_UPLOAD_ENABLED)F.info("ℹ️ --output-upload not specified, defaulting to false (no Capgo download link)");if(!W.BUILD_OUTPUT_RETENTION_SECONDS)F.info(`ℹ️ --output-retention not specified, defaulting to ${m8}s (1 hour)`);if(!W.SKIP_BUILD_NUMBER_BUMP)F.info("ℹ️ --skip-build-number-bump not specified, build number will be auto-incremented (default)");let{buildOptions:I,buildCredentials:K}=HxD(W,$.platform,$.buildMode||"release",H$.version),V={app_id:D,platform:$.platform,build_mode:$.buildMode||"release",build_options:I,build_credentials:K};if(F.info("✓ Using credentials (merged from CLI args, env vars, and saved file)"),Q){let u=Object.keys(K);F.info(`Credentials provided: ${u.join(", ")}`),F.info(`Build options: platform=${I.platform}, mode=${I.buildMode}, cliVersion=${I.cliVersion}`)}F.info("Requesting build from Capgo...");let N=3,R=await UxD(`${G}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:$.apikey},body:JSON.stringify(V)},N,F);if(!R.ok){let u=await R.text();throw Error(`Failed to request build: ${R.status} - ${u}`)}let C=await R.json();if(F.success(`Build job created: ${C.job_id}`),F.info(`Status: ${C.status}`),Q)F.info(`Upload URL: ${C.upload_url}`),F.info(`Upload expires: ${C.upload_expires_at}`);await AD($.apikey,{channel:"native-builder",event:"Build requested",icon:"\uD83C\uDFD7️",user_id:O,tags:{"app-id":D,platform:$.platform},notify:!1}).catch();let A=s$(ZxD(),`capgo-build-${Date.now()}`);await JxD(A,{recursive:!0});let _=s$(A,`${Xe(Z)}.zip`);try{F.info(`Zipping ${$.platform} project from ${Z}...`),await WxD(Z,_,$.platform,w?.config);let x=((await QxD(_)).size/1024/1024).toFixed(2);if(F.success(`Created zip: ${_} (${x} MB)`),F.info("Uploading to builder..."),Q)F.info(`Upload endpoint: ${C.upload_url}`),F.info(`File size: ${x} MB`),F.info(`Job ID: ${C.job_id}`);let h=$xD(_);F.uploadProgress(0),await new Promise((r,YD)=>{let P=new mw.Upload(h,{endpoint:C.upload_url,chunkSize:5242880,metadata:{filename:Xe(_),filetype:"application/zip"},headers:{authorization:$.apikey},onBeforeRequest(E){if(Q){F.info(`[TUS] ${E.getMethod()} ${E.getURL()}`);let n=E.getHeader("authorization");F.info(`[TUS] Authorization header present: ${!!n}`)}},onAfterResponse(E,n){if(Q){F.info(`[TUS] Response status: ${n.getStatus()}`);let k=n.getHeader("upload-offset"),zD=n.getHeader("tus-resumable");F.info(`[TUS] Upload-Offset: ${k}, Tus-Resumable: ${zD}`)}},onError(E){if(F.error(`Upload error: ${E.message}`),E instanceof mw.DetailedError){let n=E.originalResponse?.getBody(),k=E.originalResponse?.getStatus(),zD=E.originalRequest?.getURL();if(Q)F.error(`[TUS] Request URL: ${zD}`),F.error(`[TUS] Response status: ${k}`),F.error(`[TUS] Response body: ${n}`);let t="Unknown error";try{let BD=JSON.parse(n||'{"error": "unknown error"}');t=BD.status||BD.error||BD.message||"unknown error"}catch{t=n||E.message}YD(Error(`TUS upload failed: ${t}`))}else YD(Error(`TUS upload failed: ${E.message||E.toString()}`))},onProgress(E,n){let k=Number.parseFloat((E/n*100).toFixed(2));F.uploadProgress(k)},onSuccess(){if(F.uploadProgress(100),Q)F.success("TUS upload completed successfully");r()}});if(Q)F.info("[TUS] Starting upload...");P.start()}),F.info("Starting build job...");let b=await fetch(`${G}/build/start/${C.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:$.apikey},body:JSON.stringify({app_id:D})});if(!b.ok){let r=await b.text();throw Error(`Failed to start build: ${b.status} - ${r}`)}let l=await b.json();F.success("Build started!"),F.info("Streaming build logs...");let f=new AbortController,j=!1,S=async()=>{if(j)return;j=!0;let r=new AbortController,YD=setTimeout(()=>r.abort(),4000);try{await fetch(`${G}/build/cancel/${C.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:$.apikey},body:JSON.stringify({app_id:D}),signal:r.signal})}catch{}finally{clearTimeout(YD)}},v=async()=>{try{if(j)LM.exit(1);F.warn("Canceling build... (press Ctrl+C again to force quit)"),await S(),f.abort()}catch{}};LM.on("SIGINT",v);let y,g=!1,d=async()=>{try{let r=await fetch(`${G}/build/status?job_id=${encodeURIComponent(C.job_id)}&app_id=${encodeURIComponent(D)}&platform=${$.platform}`,{headers:{authorization:$.apikey}});if(!r.ok)return null;let YD=await r.json(),P=YD.status?.toLowerCase?.()??"";if(g)F.info(`Build status: ${P||YD.status}`);if(gw.has(P))return P;return null}catch{return null}},a=null;try{a=await qxD(X,Q,l.logs_url,l.logs_token,d,f.signal,()=>{g=!0},X&&!Y?void 0:F)}finally{LM.removeListener("SIGINT",v)}if(a){if(y=a,gw.has(a))await d().catch(()=>{})}else y=await zxD(G,C.job_id,D,$.platform,$.apikey,X,g,f.signal,F);if(y==="succeeded")F.success("Build completed successfully!");else if(y==="failed")F.error("Build failed");else F.warn(`Build finished with status: ${y}`);let m=((Date.now()-J)/1000).toFixed(2);return await AD($.apikey,{channel:"native-builder",event:y==="succeeded"?"Build succeeded":"Build failed",icon:y==="succeeded"?"✅":"❌",user_id:O,tags:{"app-id":D,platform:$.platform,status:y||"unknown",time:m},notify:!1}).catch(),{success:y==="succeeded",jobId:C.job_id,uploadUrl:C.upload_url,status:y||l.status||C.status}}finally{await YxD(A,{recursive:!0,force:!0})}}catch(Z){let w=Z instanceof Error?Z.message:String(Z);return F.error(w),{success:!1,error:w}}}vD();X6();O1();kD();async function VxD(D,$,X,Y){for await(let J of D){if(!Y)H.warn(`Removing ${J.name} created on ${$7(J.created_at)}`);await Mw($,X,J.name)}}function NxD(D,$,X){let Y=[];for(let J of D??[]){let Q=eD(J.name);if(lG(Q,$)&&S4(Q,X))Y.push(J)}return Y}async function Ue(D,$,X=!1){if(!X)VD("Cleanup versions in Capgo");await F0(),$.apikey=$.apikey||WD();let{bundle:Y,keep:J=4}=$,Q=$.force||!1,F=$.ignoreChannel||!1,Z=await ID();if(D=mD(D,Z?.config),!$.apikey){if(!X)H.error("Missing API key, you need to provide an API key to delete your app");throw Error("Missing API key")}if(!D){if(!X)H.error("Missing argument, you need to provide a appid, or be in a capacitor project");throw Error("Missing appId")}let w=await jD($.apikey,$.supaHost,$.supaAnon);if(await m0(w,D,X),await xD(w,$.apikey,["write","all"]),await u0(w,$.apikey,D,3,X,!0),!X)H.info("Querying all available versions in Capgo");let G=await Iw(w,D),U=await Lt(w,D);if(!X)H.info(`Total active versions in Capgo: ${G?.length??0}`);if(!G?.length){if(!X)H.error("No versions found, aborting cleanup");throw Error("No versions found")}if(Y){let z=eD(Y),B=P7(z,"major");if(!X)H.info(`Querying available versions in Capgo between ${q$(z)} and ${q$(B)}`);if(G=NxD(G,z,B),!X)H.info(`Active versions in Capgo between ${q$(z)} and ${q$(B)}: ${G?.length??0}`)}let O=[],q=0;for(let z of G){let B=U.find((W)=>W===z.id);if(q<J||B&&!F)z.keep=B?"✅ (Linked to channel)":"✅",q+=1;else z.keep="❌",O.push(z)}if(!O.length){if(!X)H.warn("Nothing to be removed, aborting removal...");return{removed:0,kept:q}}if(!X)Nt(G);if(!Q)if(!X){let z=await d0({message:"Do you want to continue removing the versions specified?"});if(bD(z)||!z)throw H.warn("Not confirmed, aborting removal..."),Error("Cleanup cancelled by user")}else throw Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");if(!X)H.success("You have confirmed removal, removing versions now");if(await VxD(O,w,D,X),!X)ND("Done ✅");return{removed:O.length,kept:q}}vD();D6();kD();async function Oe(D,$,X=!1){if(!X)VD("Check compatibility");let Y={...$,apikey:$.apikey||WD()},J=D?void 0:await ID(),Q=mD(D,J?.config),F=Y.channel;if(!F){if(!X)H.error("Missing argument, you need to provide a channel");throw Error("Missing channel")}if(!Y.apikey){if(!X)H.error("Missing API key, you need to provide an API key to access Capgo Cloud metadata");throw Error("Missing API key")}if(!Q){if(!X)H.error("Missing argument, you need to provide an appId, or be in a capacitor project");throw Error("Missing appId")}let Z=await jD(Y.apikey,Y.supaHost,Y.supaAnon);await m0(Z,Q,X),await xD(Z,Y.apikey,["write","all","read","upload"]),await u0(Z,Y.apikey,Q,1,X,!0);let w=await Lw(Z,Q,F,Y.packageJson,Y.nodeModules),G=w.finalCompatibility.some((U)=>!M4(U));if(!X){let U=new R0;U.headers=["Package","Local","Remote","Status","Details"],U.theme=R0.roundTheme,U.rows=[];let O=Y.text?"OK":"✅",q=Y.text?"FAIL":"❌";for(let z of w.finalCompatibility){let{name:B,localVersion:W,remoteVersion:L}=z,M=k8(z),I=M.compatible?O:q;U.rows.push([B,W||"-",L||"-",I,M.message])}if(H.success("Compatibility Check Results"),H.info(U.toString()),G){let z=w.finalCompatibility.filter((B)=>!M4(B)).length;H.warn(`
|
|
467
467
|
${z} package(s) are incompatible with channel "${F}"`),H.warn("An app store update may be required for these changes to take effect.")}else H.success(`
|
|
468
|
-
All packages are compatible with channel "${F}"`)}return{finalCompatibility:w.finalCompatibility,hasIncompatible:G,resolvedAppId:Q,channel:F}}vD();X6();import{existsSync as RM,readFileSync as Ne,writeFileSync as RxD}from"node:fs";import{cwd as jxD}from"node:process";import{Buffer as C6}from"node:buffer";import{constants as LxD,createCipheriv as MxD,createDecipheriv as IxD,generateKeyPairSync as AxD,privateEncrypt as IM,publicDecrypt as AM,randomBytes as qe}from"node:crypto";var ze="aes-128-cbc",P6="base64",cw="hex",q7=LxD.RSA_PKCS1_PADDING;function dw(D){let $=qe(16),X=qe(16),Y=$.toString(P6),J=IM({key:D,padding:q7},X).toString(P6);return{sessionKey:X,ivSessionKey:`${Y}:${J}`}}function z7(D,$,X){let[Y]=X.split(":"),J=C6.from(Y,P6),Q=MxD(ze,$,J);return Q.setAutoPadding(!0),C6.concat([Q.update(D),Q.final()])}function Be(D,$,X){let[Y,J]=$.split(":"),Q=AM({key:X,padding:q7},C6.from(J,P6)),F=C6.from(Y,P6),Z=IxD(ze,Q,F);return Z.setAutoPadding(!0),C6.concat([Z.update(D),Z.final()])}function B7(D,$){return IM({key:$,padding:q7},C6.from(D,P6)).toString(P6)}function W7(D,$){return IM({key:$,padding:q7},C6.from(D,cw)).toString(cw)}function We(D,$){return AM({key:$,padding:q7},C6.from(D,P6)).toString(P6)}function Ke(D,$){return AM({key:$,padding:q7},C6.from(D,cw)).toString(cw)}function He(){let{publicKey:D,privateKey:$}=AxD("rsa",{modulusLength:2048});return{publicKey:D.export({type:"pkcs1",format:"pem"}),privateKey:$.export({type:"pkcs1",format:"pem"})}}function Ve(D){if(!D)return"";return D.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,20)}O1();M3();kD();var ExD="5.30.0",TxD="6.30.0",CxD="7.30.0";function PxD(D,$){let X=D.key||R6,Y=$.config.plugins?.CapacitorUpdater?.publicKey;if(RM(X))Y=Ne(X,"utf8");else if(!Y&&D.keyData)Y=D.keyData;return{publicKey:Y,fallbackKeyPath:X}}async function Le(D,$,X,Y=!1){if(!Y)VD("Decrypt zip file");try{if(await F0(),!RM(D)){let O=`Zip not found at the path ${D}`;if(!Y)H.error(O);throw Error(O)}let J=await ID();if(!X.key&&!RM(R6)&&!J.config.plugins?.CapacitorUpdater?.publicKey){let O=`Public Key not found at the path ${R6} or in ${J.path}`;if(!Y)H.error(O);throw Error(O)}let{publicKey:Q,fallbackKeyPath:F}=PxD(X,J);if(!Q){let O=`Cannot find public key ${F} or as keyData option or in ${J.path}`;if(!Y)H.error(O);throw Error(O)}let Z=Ne(D),w=Be(Z,$,X.keyData??Q),G=`${D}_decrypted.zip`;if(RxD(G,w),!Y)H.info(`Decrypted zip file at ${G}`);let U;if(X.checksum){let O=await p6(w,"sha256"),q=e0(jxD()),z=await y1("@capgo/capacitor-updater",q,X.packageJson),B=!1,W;try{W=z?eD(z):void 0}catch{W=void 0}if(W)B=!w$(W,ExD,TxD,CxD);if(!Y)H.info(`Decrypting checksum with ${B?"V3":"V2"} (based on updater version ${z||"unknown"})`);let L=B?Ke(X.checksum,X.keyData??Q):We(X.checksum,X.keyData??Q);if(U=O===L,!U){let M=`Checksum does not match ${O} !== ${L}`;if(!Y)H.error(M);throw Error(M)}if(!Y)H.info("Checksum matches")}if(!Y)ND("✅ done");return{outputPath:G,checksumMatches:U}}catch(J){if(!Y)H.error(`Error decrypting zip file ${s(J)}`);throw J instanceof Error?J:Error(String(J))}}vD();kD();async function Me(D,$,X,Y=!1){if(!Y)VD("Delete bundle");X.apikey=X.apikey||WD();let J=await ID();if($=mD($,J?.config),!X.apikey){if(!Y)H.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!$){if(!Y)H.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!D){if(!Y)H.error("Missing argument, you need to provide a bundleId, or be in a capacitor project");throw Error("Missing bundleId")}let Q=await jD(X.apikey,X.supaHost,X.supaAnon);if(await m0(Q,$,Y),await xD(Q,X.apikey,["write","all"]),await u0(Q,X.apikey,$,3,Y,!0),!Y)H.info(`Deleting bundle ${$}@${D} from Capgo`),H.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever");await Mw(Q,$,D);let F=await l0(Q,$);if(await AD(X.apikey,{channel:"app",event:"Bundle Deleted",icon:"\uD83D\uDDD1️",user_id:F,tags:{"app-id":$,bundle:D},notify:!1,notifyConsole:!0}).catch(()=>{}),!Y)H.success(`Bundle ${$}@${D} deleted in Capgo`),ND("Done");return!0}vD();X6();import{existsSync as jM,readFileSync as Ie,writeFileSync as xxD}from"node:fs";import{cwd as SxD}from"node:process";O1();kD();var uxD="5.30.0",vxD="6.30.0",_xD="7.30.0";function R2(D){console.error(s(D))}async function Ae(D,$,X,Y=!1){let{json:J}=X,Q=!J&&!Y;if(Q)VD("Encryption"),await F0();try{let F=await ID(),Z=!!F.config.plugins?.CapacitorUpdater?.privateKey,w=!!F.config.plugins?.CapacitorUpdater?.publicKey;if(Z&&Q)H.warning("There is still a privateKey in the config");if(!jM(D)){let N=`Zip not found at the path ${D}`;if(!Y)if(J)R2({error:"zip_not_found"});else H.error(`Error: ${N}`);throw Error(N)}if(!w){if(!Y)if(J)R2({error:"missing_public_key"});else H.warning("Warning: Missing Public Key in config");throw Error("Missing public key in config")}let G=X.key||i1,U=X.keyData||"";if(!jM(G)&&!U){if(!Y)if(J)R2({error:"missing_key"});else H.warning(`Cannot find a private key at ${G} or as a keyData option`),H.error("Error: Missing key");throw Error("Missing private key")}else if(jM(G))U=Ie(G,"utf8");if(U&&!U.startsWith("-----BEGIN RSA PRIVATE KEY-----")){if(!Y)if(J)R2({error:"invalid_private_key"});else H.error("The private key provided is not a valid RSA Private key");throw Error("Invalid private key format")}let O=Ie(D),{sessionKey:q,ivSessionKey:z}=dw(U),B=z7(O,q,z),W=e0(SxD()),L=await y1("@capgo/capacitor-updater",W,X.packageJson),M=!1,I;try{I=L?eD(L):void 0}catch{I=void 0}if(I)M=!w$(I,uxD,vxD,_xD);let K=M?W7($,U):B7($,U);if(Q)H.info(`Encrypting checksum with ${M?"V3":"V2"} (based on updater version ${L||"unknown"})`);let V=`${D}_encrypted.zip`;if(xxD(V,B),!Y)if(J)console.log(JSON.stringify({checksum:K,filename:V,ivSessionKey:z},null,2));else H.success(`Encoded Checksum: ${K}`),H.success(`ivSessionKey: ${z}`),H.success(`Encrypted zip saved at ${V}`),ND("Done ✅");return{checksum:K,filename:V,ivSessionKey:z}}catch(F){if(!Y)if(X.json)R2(F);else H.error(`Error encrypting zip file ${s(F)}`);throw F instanceof Error?F:Error(String(F))}}import{randomUUID as YvD}from"node:crypto";import{existsSync as YG,readFileSync as QvD}from"node:fs";import{cwd as YI,stdin as FvD,stdout as ZvD}from"node:process";class EM extends TransformStream{outChunkSize;constructor(D){let $=new Uint8Array(D),X=0;super({transform(Y,J){let Q=0;while(Q<Y.length){let F=D-X,Z=Math.min(F,Y.length-Q);if($.set(Y.subarray(Q,Q+Z),X),Q+=Z,X+=Z,X===D)J.enqueue($),$=new Uint8Array(D),X=0}},flush(Y){if(X>0)Y.enqueue($.subarray(0,X))}}),this.outChunkSize=D}}function E4(D){return D=D.trim(),D=D.replace(/<!--[\s\S]*?-->/g,""),$();function $(){return{declaration:X(),root:Y()}}function X(){if(!w(/^<\?xml\s*/))return;let q={attributes:{}};while(!(G()||U("?>"))){let z=Q();if(!z)return q;q.attributes[z.name]=z.value}return w(/\?>\s*/),q}function Y(){let O=w(/^<([\w-:.]+)\s*/);if(!O)return;let q={name:O[1],attributes:{},children:[]};while(!(G()||U(">")||U("?>")||U("/>"))){let B=Q();if(!B)return q;q.attributes[B.name]=B.value}if(w(/^\s*\/>\s*/))return q;w(/\??>\s*/),q.content=J();let z;while(z=Y())q.children.push(z);return w(/^<\/[\w-:.]+>\s*/),q}function J(){let O=w(/^([^<]*)/);if(O)return Z(O[1]);return""}function Q(){let O=w(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!O)return;return{name:O[1],value:Z(F(O[2]))}}function F(O){return O.replace(/^['"]|['"]$/g,"")}function Z(O){return O.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function w(O){let q=D.match(O);if(!q)return;return D=D.slice(q[0].length),q}function G(){return D.length===0}function U(O){return D.startsWith(O)}}class x6 extends Error{}class R1 extends x6{}class lw extends x6{}class TM extends x6{bucketName;constructor(D){super(`Invalid bucket name: ${D}`),this.bucketName=D}}class S6 extends x6{objectName;constructor(D){super(`Invalid object name: ${D}`),this.objectName=D}}class c8 extends x6{constructor(){super("accessKey is required")}}class j2 extends x6{constructor(){super("secretKey is required")}}class nw extends x6{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}}class T4 extends x6{statusCode;code;key;bucketName;resource;region;constructor(D,$,X,Y={}){super(X),this.statusCode=D,this.code=$,this.key=Y.key,this.bucketName=Y.bucketName,this.resource=Y.resource,this.region=Y.region}}async function Re(D){try{let X=E4(await D.text()).root;if(X?.name!=="Error")throw Error("Invalid root, expected <Error>");let Y=X.children.find((G)=>G.name==="Code")?.content??"UnknownErrorCode",J=X.children.find((G)=>G.name==="Message")?.content??"The error message could not be determined.",Q=X.children.find((G)=>G.name==="Key")?.content,F=X.children.find((G)=>G.name==="BucketName")?.content,Z=X.children.find((G)=>G.name==="Resource")?.content,w=X.children.find((G)=>G.name==="Region")?.content;return new T4(D.status,Y,J,{key:Q,bucketName:F,resource:Z,region:w})}catch{return new T4(D.status,"UnrecognizedError",`Error: Unexpected response code ${D.status} ${D.statusText}. Unable to parse response as XML.`)}}function je(D){if(typeof D!=="number"||isNaN(D))return!1;return D>=1&&D<=65535}function Ee(D){if(typeof D!=="string")return!1;if(D.length<3||D.length>63)return!1;if(D.includes(".."))return!1;if(D.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/))return!1;if(D.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/))return!0;return!1}function C4(D){if(!kxD(D))return!1;if(D.length===0)return!1;return!0}function kxD(D){if(typeof D!=="string")return!1;if(D.length>1024)return!1;return!0}function E2(D){return Array.from(D).map(($)=>$.toString(16).padStart(2,"0")).join("")}function d8(D=""){let $={'"':"",""":"",""":"",""":"",""":""};return D.replace(/^("|"|")|("|"|")$/g,(X)=>$[X])}function PM(D){return D.get("x-amz-version-id")??null}function l8(D){let $=D.toISOString();return $.slice(0,4)+$.slice(5,7)+$.slice(8,13)+$.slice(14,16)+$.slice(17,19)+"Z"}function xM(D){return l8(D).slice(0,8)}function SM(D,$){return`${xM($)}/${D}/s3/aws4_request`}async function iw(D){if(!(D instanceof Uint8Array))D=new TextEncoder().encode(D);return E2(new Uint8Array(await crypto.subtle.digest("SHA-256",D)))}var fxD=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"];class uM extends WritableStream{getResult;constructor({client:D,bucketName:$,objectName:X,partSize:Y,metadata:J}){let Q,F=1,Z,w=[],G,U=[];super({start(){},async write(O,q){let B=F++;try{if(B==1&&O.length<Y){let M=await D.makeRequest({method:"PUT",headers:new Headers({...J,"Content-Length":String(O.length)}),bucketName:$,objectName:X,payload:O});Q={etag:d8(M.headers.get("etag")??void 0),versionId:PM(M.headers)};return}if(B===1)Z=(await yxD({client:D,bucketName:$,objectName:X,metadata:J})).uploadId;let W={"Content-Length":String(O.length)};for(let M of fxD){let I=J[M];if(I)W[M]=I}let L=D.makeRequest({method:"PUT",query:{partNumber:B.toString(),uploadId:Z},headers:new Headers(W),bucketName:$,objectName:X,payload:O}).then((M)=>{let I=M.headers.get("etag")??"";if(I)I=I.replace(/^"/,"").replace(/"$/,"");return w.push({part:B,etag:I}),M});U.push(L.catch((M)=>{if(!G)G=M}))}catch(W){throw W}},async close(){if(Q);else if(Z){if(await Promise.all(U),G)throw G;w.sort((O,q)=>O.part>q.part?1:-1),Q=await bxD({client:D,bucketName:$,objectName:X,uploadId:Z,etags:w})}else throw Error("Stream was closed without uploading any data.")}});this.getResult=()=>{if(Q===void 0)throw Error("Result is not ready. await the stream first.");return Q}}}async function yxD(D){let X=new Headers(D.metadata),Y="uploads",Q=await(await D.client.makeRequest({method:"POST",bucketName:D.bucketName,objectName:D.objectName,query:"uploads",headers:X,returnBody:!0})).text(),F=E4(Q).root;if(!F||F.name!=="InitiateMultipartUploadResult")throw Error(`Unexpected response: ${Q}`);let Z=F.children.find((w)=>w.name==="UploadId")?.content;if(!Z)throw Error(`Unable to get UploadId from response: ${Q}`);return{uploadId:Z}}async function bxD({client:D,bucketName:$,objectName:X,uploadId:Y,etags:J}){let Q=`
|
|
468
|
+
All packages are compatible with channel "${F}"`)}return{finalCompatibility:w.finalCompatibility,hasIncompatible:G,resolvedAppId:Q,channel:F}}vD();X6();import{existsSync as RM,readFileSync as Ne,writeFileSync as RxD}from"node:fs";import{cwd as jxD}from"node:process";import{Buffer as C6}from"node:buffer";import{constants as LxD,createCipheriv as MxD,createDecipheriv as IxD,generateKeyPairSync as AxD,privateEncrypt as IM,publicDecrypt as AM,randomBytes as qe}from"node:crypto";var ze="aes-128-cbc",P6="base64",cw="hex",q7=LxD.RSA_PKCS1_PADDING;function dw(D){let $=qe(16),X=qe(16),Y=$.toString(P6),J=IM({key:D,padding:q7},X).toString(P6);return{sessionKey:X,ivSessionKey:`${Y}:${J}`}}function z7(D,$,X){let[Y]=X.split(":"),J=C6.from(Y,P6),Q=MxD(ze,$,J);return Q.setAutoPadding(!0),C6.concat([Q.update(D),Q.final()])}function Be(D,$,X){let[Y,J]=$.split(":"),Q=AM({key:X,padding:q7},C6.from(J,P6)),F=C6.from(Y,P6),Z=IxD(ze,Q,F);return Z.setAutoPadding(!0),C6.concat([Z.update(D),Z.final()])}function B7(D,$){return IM({key:$,padding:q7},C6.from(D,P6)).toString(P6)}function W7(D,$){return IM({key:$,padding:q7},C6.from(D,cw)).toString(cw)}function We(D,$){return AM({key:$,padding:q7},C6.from(D,P6)).toString(P6)}function Ke(D,$){return AM({key:$,padding:q7},C6.from(D,cw)).toString(cw)}function He(){let{publicKey:D,privateKey:$}=AxD("rsa",{modulusLength:2048});return{publicKey:D.export({type:"pkcs1",format:"pem"}),privateKey:$.export({type:"pkcs1",format:"pem"})}}function Ve(D){if(!D)return"";return D.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,20)}O1();M3();kD();var ExD="5.30.0",TxD="6.30.0",CxD="7.30.0";function PxD(D,$){let X=D.key||R6,Y=$.config.plugins?.CapacitorUpdater?.publicKey;if(RM(X))Y=Ne(X,"utf8");else if(!Y&&D.keyData)Y=D.keyData;return{publicKey:Y,fallbackKeyPath:X}}async function Le(D,$,X,Y=!1){if(!Y)VD("Decrypt zip file");try{if(await F0(),!RM(D)){let O=`Zip not found at the path ${D}`;if(!Y)H.error(O);throw Error(O)}let J=await ID();if(!X.key&&!RM(R6)&&!J.config.plugins?.CapacitorUpdater?.publicKey){let O=`Public Key not found at the path ${R6} or in ${J.path}`;if(!Y)H.error(O);throw Error(O)}let{publicKey:Q,fallbackKeyPath:F}=PxD(X,J);if(!Q){let O=`Cannot find public key ${F} or as keyData option or in ${J.path}`;if(!Y)H.error(O);throw Error(O)}let Z=Ne(D),w=Be(Z,$,X.keyData??Q),G=`${D}_decrypted.zip`;if(RxD(G,w),!Y)H.info(`Decrypted zip file at ${G}`);let U;if(X.checksum){let O=await p6(w,"sha256"),q=e0(jxD()),z=await y1("@capgo/capacitor-updater",q,X.packageJson),B=!1,W;try{W=z?eD(z):void 0}catch{W=void 0}if(W)B=!w$(W,ExD,TxD,CxD);if(!Y)H.info(`Decrypting checksum with ${B?"V3":"V2"} (based on updater version ${z||"unknown"})`);let L=B?Ke(X.checksum,X.keyData??Q):We(X.checksum,X.keyData??Q);if(U=O===L,!U){let M=`Checksum does not match ${O} !== ${L}`;if(!Y)H.error(M);throw Error(M)}if(!Y)H.info("Checksum matches")}if(!Y)ND("✅ done");return{outputPath:G,checksumMatches:U}}catch(J){if(!Y)H.error(`Error decrypting zip file ${s(J)}`);throw J instanceof Error?J:Error(String(J))}}vD();kD();async function Me(D,$,X,Y=!1){if(!Y)VD("Delete bundle");X.apikey=X.apikey||WD();let J=await ID();if($=mD($,J?.config),!X.apikey){if(!Y)H.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!$){if(!Y)H.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!D){if(!Y)H.error("Missing argument, you need to provide a bundleId, or be in a capacitor project");throw Error("Missing bundleId")}let Q=await jD(X.apikey,X.supaHost,X.supaAnon);if(await m0(Q,$,Y),await xD(Q,X.apikey,["write","all"]),await u0(Q,X.apikey,$,3,Y,!0),!Y)H.info(`Deleting bundle ${$}@${D} from Capgo`),H.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever");await Mw(Q,$,D);let F=await l0(Q,$);if(await AD(X.apikey,{channel:"app",event:"Bundle Deleted",icon:"\uD83D\uDDD1️",user_id:F,tags:{"app-id":$,bundle:D},notify:!1,notifyConsole:!0}).catch(()=>{}),!Y)H.success(`Bundle ${$}@${D} deleted in Capgo`),ND("Done");return!0}vD();X6();import{existsSync as jM,readFileSync as Ie,writeFileSync as xxD}from"node:fs";import{cwd as SxD}from"node:process";O1();kD();var uxD="5.30.0",vxD="6.30.0",_xD="7.30.0";function R2(D){console.error(s(D))}async function Ae(D,$,X,Y=!1){let{json:J}=X,Q=!J&&!Y;if(Q)VD("Encryption"),await F0();try{let F=await ID(),Z=!!F.config.plugins?.CapacitorUpdater?.privateKey,w=!!F.config.plugins?.CapacitorUpdater?.publicKey;if(Z&&Q)H.warning("There is still a privateKey in the config");if(!jM(D)){let N=`Zip not found at the path ${D}`;if(!Y)if(J)R2({error:"zip_not_found"});else H.error(`Error: ${N}`);throw Error(N)}if(!w){if(!Y)if(J)R2({error:"missing_public_key"});else H.warning("Warning: Missing Public Key in config");throw Error("Missing public key in config")}let G=X.key||i1,U=X.keyData||"";if(!jM(G)&&!U){if(!Y)if(J)R2({error:"missing_key"});else H.warning(`Cannot find a private key at ${G} or as a keyData option`),H.error("Error: Missing key");throw Error("Missing private key")}else if(jM(G))U=Ie(G,"utf8");if(U&&!U.startsWith("-----BEGIN RSA PRIVATE KEY-----")){if(!Y)if(J)R2({error:"invalid_private_key"});else H.error("The private key provided is not a valid RSA Private key");throw Error("Invalid private key format")}let O=Ie(D),{sessionKey:q,ivSessionKey:z}=dw(U),B=z7(O,q,z),W=e0(SxD()),L=await y1("@capgo/capacitor-updater",W,X.packageJson),M=!1,I;try{I=L?eD(L):void 0}catch{I=void 0}if(I)M=!w$(I,uxD,vxD,_xD);let K=M?W7($,U):B7($,U);if(Q)H.info(`Encrypting checksum with ${M?"V3":"V2"} (based on updater version ${L||"unknown"})`);let V=`${D}_encrypted.zip`;if(xxD(V,B),!Y)if(J)console.log(JSON.stringify({checksum:K,filename:V,ivSessionKey:z},null,2));else H.success(`Encoded Checksum: ${K}`),H.success(`ivSessionKey: ${z}`),H.success(`Encrypted zip saved at ${V}`),ND("Done ✅");return{checksum:K,filename:V,ivSessionKey:z}}catch(F){if(!Y)if(X.json)R2(F);else H.error(`Error encrypting zip file ${s(F)}`);throw F instanceof Error?F:Error(String(F))}}import{randomUUID as YvD}from"node:crypto";import{existsSync as YG,readFileSync as QvD}from"node:fs";import{cwd as YI,stdin as FvD,stdout as ZvD}from"node:process";class EM extends TransformStream{outChunkSize;constructor(D){let $=new Uint8Array(D),X=0;super({transform(Y,J){let Q=0;while(Q<Y.length){let F=D-X,Z=Math.min(F,Y.length-Q);if($.set(Y.subarray(Q,Q+Z),X),Q+=Z,X+=Z,X===D)J.enqueue($),$=new Uint8Array(D),X=0}},flush(Y){if(X>0)Y.enqueue($.subarray(0,X))}}),this.outChunkSize=D}}function E4(D){return D=D.trim(),D=D.replace(/<!--[\s\S]*?-->/g,""),$();function $(){return{declaration:X(),root:Y()}}function X(){if(!w(/^<\?xml\s*/))return;let q={attributes:{}};while(!(G()||U("?>"))){let z=Q();if(!z)return q;q.attributes[z.name]=z.value}return w(/\?>\s*/),q}function Y(){let O=w(/^<([\w-:.]+)\s*/);if(!O)return;let q={name:O[1],attributes:{},children:[]};while(!(G()||U(">")||U("?>")||U("/>"))){let B=Q();if(!B)return q;q.attributes[B.name]=B.value}if(w(/^\s*\/>\s*/))return q;w(/\??>\s*/),q.content=J();let z;while(z=Y())q.children.push(z);return w(/^<\/[\w-:.]+>\s*/),q}function J(){let O=w(/^([^<]*)/);if(O)return Z(O[1]);return""}function Q(){let O=w(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!O)return;return{name:O[1],value:Z(F(O[2]))}}function F(O){return O.replace(/^['"]|['"]$/g,"")}function Z(O){return O.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function w(O){let q=D.match(O);if(!q)return;return D=D.slice(q[0].length),q}function G(){return D.length===0}function U(O){return D.startsWith(O)}}class x6 extends Error{}class R1 extends x6{}class lw extends x6{}class TM extends x6{bucketName;constructor(D){super(`Invalid bucket name: ${D}`),this.bucketName=D}}class S6 extends x6{objectName;constructor(D){super(`Invalid object name: ${D}`),this.objectName=D}}class c8 extends x6{constructor(){super("accessKey is required")}}class j2 extends x6{constructor(){super("secretKey is required")}}class nw extends x6{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}}class T4 extends x6{statusCode;code;key;bucketName;resource;region;constructor(D,$,X,Y={}){super(X),this.statusCode=D,this.code=$,this.key=Y.key,this.bucketName=Y.bucketName,this.resource=Y.resource,this.region=Y.region}}async function Re(D){try{let X=E4(await D.text()).root;if(X?.name!=="Error")throw Error("Invalid root, expected <Error>");let Y=X.children.find((G)=>G.name==="Code")?.content??"UnknownErrorCode",J=X.children.find((G)=>G.name==="Message")?.content??"The error message could not be determined.",Q=X.children.find((G)=>G.name==="Key")?.content,F=X.children.find((G)=>G.name==="BucketName")?.content,Z=X.children.find((G)=>G.name==="Resource")?.content,w=X.children.find((G)=>G.name==="Region")?.content;return new T4(D.status,Y,J,{key:Q,bucketName:F,resource:Z,region:w})}catch{return new T4(D.status,"UnrecognizedError",`Error: Unexpected response code ${D.status} ${D.statusText}. Unable to parse response as XML.`)}}function je(D){if(typeof D!=="number"||isNaN(D))return!1;return D>=1&&D<=65535}function Ee(D){if(typeof D!=="string")return!1;if(D.length>255)return!1;if(D.includes(".."))return!1;return Boolean(D.match(/^[a-zA-Z0-9][a-zA-Z0-9.-]+[a-zA-Z0-9]$/))}function C4(D){if(!kxD(D))return!1;if(D.length===0)return!1;return!0}function kxD(D){if(typeof D!=="string")return!1;if(D.length>1024)return!1;return!0}function E2(D){return Array.from(D).map(($)=>$.toString(16).padStart(2,"0")).join("")}function d8(D=""){let $={'"':"",""":"",""":"",""":"",""":""};return D.replace(/^("|"|")|("|"|")$/g,(X)=>$[X])}function PM(D){return D.get("x-amz-version-id")??null}function l8(D){let $=D.toISOString();return $.slice(0,4)+$.slice(5,7)+$.slice(8,13)+$.slice(14,16)+$.slice(17,19)+"Z"}function xM(D){return l8(D).slice(0,8)}function SM(D,$){return`${xM($)}/${D}/s3/aws4_request`}async function iw(D){if(!(D instanceof Uint8Array))D=new TextEncoder().encode(D);return E2(new Uint8Array(await crypto.subtle.digest("SHA-256",D)))}var fxD=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"];class uM extends WritableStream{getResult;constructor({client:D,bucketName:$,objectName:X,partSize:Y,metadata:J}){let Q,F=1,Z,w=[],G,U=[];super({start(){},async write(O,q){let B=F++;try{if(B==1&&O.length<Y){let M=await D.makeRequest({method:"PUT",headers:new Headers({...J,"Content-Length":String(O.length)}),bucketName:$,objectName:X,payload:O});Q={etag:d8(M.headers.get("etag")??void 0),versionId:PM(M.headers)};return}if(B===1)Z=(await yxD({client:D,bucketName:$,objectName:X,metadata:J})).uploadId;let W={"Content-Length":String(O.length)};for(let M of fxD){let I=J[M];if(I)W[M]=I}let L=D.makeRequest({method:"PUT",query:{partNumber:B.toString(),uploadId:Z},headers:new Headers(W),bucketName:$,objectName:X,payload:O}).then((M)=>{let I=M.headers.get("etag")??"";if(I)I=I.replace(/^"/,"").replace(/"$/,"");return w.push({part:B,etag:I}),M});U.push(L.catch((M)=>{if(!G)G=M}))}catch(W){throw W}},async close(){if(Q);else if(Z){if(await Promise.all(U),G)throw G;w.sort((O,q)=>O.part>q.part?1:-1),Q=await bxD({client:D,bucketName:$,objectName:X,uploadId:Z,etags:w})}else throw Error("Stream was closed without uploading any data.")}});this.getResult=()=>{if(Q===void 0)throw Error("Result is not ready. await the stream first.");return Q}}}async function yxD(D){let X=new Headers(D.metadata),Y="uploads",Q=await(await D.client.makeRequest({method:"POST",bucketName:D.bucketName,objectName:D.objectName,query:"uploads",headers:X,returnBody:!0})).text(),F=E4(Q).root;if(!F||F.name!=="InitiateMultipartUploadResult")throw Error(`Unexpected response: ${Q}`);let Z=F.children.find((w)=>w.name==="UploadId")?.content;if(!Z)throw Error(`Unable to get UploadId from response: ${Q}`);return{uploadId:Z}}async function bxD({client:D,bucketName:$,objectName:X,uploadId:Y,etags:J}){let Q=`
|
|
469
469
|
<CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
470
470
|
${J.map((O)=>` <Part><PartNumber>${O.part}</PartNumber><ETag>${O.etag}</ETag></Part>`).join(`
|
|
471
471
|
`)}
|
|
@@ -474,7 +474,7 @@ All packages are compatible with channel "${F}"`)}return{finalCompatibility:w.fi
|
|
|
474
474
|
`)+`
|
|
475
475
|
`,Y.join(";").toLowerCase(),J].join(`
|
|
476
476
|
`)}async function Se(D,$,X){let Y=await iw(D),J=SM(X,$);return[T2,l8($),J,Y].join(`
|
|
477
|
-
`)}async function _M(D,$,X){let Y=xM(D),J=await i8("AWS4"+X,Y),Q=await i8(J,$),F=await i8(Q,"s3");return await i8(F,"aws4_request")}function kM(D,$,X){return`${D}/${SM($,X)}`}async function i8(D,$){let X=new TextEncoder,Y=await crypto.subtle.importKey("raw",D instanceof Uint8Array?D:X.encode(D),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),J=await crypto.subtle.sign("HMAC",Y,$ instanceof Uint8Array?$:X.encode($));return new Uint8Array(J)}async function ue(D){if(!D.accessKey)throw new c8;if(!D.secretKey)throw new j2;if(D.expirySeconds<1||D.expirySeconds>604800)throw new nw;let $=new Date(D.date);$.setSeconds($.getSeconds()+D.expirySeconds);let X=kM(D.accessKey,D.region,D.date),Y=l8(D.date),J={"X-Amz-Algorithm":T2,"X-Amz-Credential":X,"X-Amz-Date":Y,key:D.objectKey,...D.fields},Q=[{bucket:D.bucket},{key:D.objectKey},{"X-Amz-Algorithm":T2},{"X-Amz-Credential":X},{"X-Amz-Date":Y}];if(D.conditions)Q.push(...D.conditions);for(let[z,B]of Object.entries(D.fields||{})){if(["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(z))continue;Q.push({[z]:B})}let F={expiration:$.toISOString(),conditions:Q},Z=new TextEncoder().encode(JSON.stringify(F)),w=btoa(String.fromCharCode(...Z));J.policy=w;let G=w,U=await _M(D.date,D.region,D.secretKey),O=E2(await i8(U,G)).toLowerCase();return J["X-Amz-Signature"]=O,{url:`${D.protocol}//${D.host}/${D.bucket}`,fields:J}}var gxD=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],mxD=5242880,cxD=5368709120,fM=5497558138880;class pw{host;port;protocol;accessKey;#D;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:D,useSSL:$,port:X,pathPrefix:Y,...J}){if(/^https?:\/\//i.test(D)){if($!==void 0||X!==void 0||Y!==void 0)throw new R1("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let F=new URL(D);if(D=F.hostname,$=F.protocol==="https:",X=F.port?parseInt(F.port,10):$?443:80,F.pathname&&F.pathname!=="/")Y=F.pathname.endsWith("/")?F.pathname.slice(0,-1):F.pathname}catch{throw new lw(`Invalid endPoint URL: ${D}`)}}if(typeof D!=="string"||D.length===0)throw new lw(`Invalid endPoint: ${D}`);if($===void 0)$=!0;if(X!==void 0&&!je(X))throw new R1(`Invalid port: ${X}`);if(J.accessKey&&!J.secretKey)throw new R1("If specifying access key, secret key must also be provided.");if(J.accessKey&&J.accessKey.startsWith("ASIA")&&!J.sessionToken)throw new R1("If specifying temporary access key, session token must also be provided.");let Q=$?443:80;if(this.port=X??Q,this.host=D.toLowerCase()+(this.port!==Q?`:${this.port}`:""),this.protocol=$?"https:":"http:",this.accessKey=J.accessKey,this.#D=J.secretKey??"",this.sessionToken=J.sessionToken,this.pathStyle=J.pathStyle??!0,this.pathPrefix=Y??"",this.defaultBucket=J.bucket,this.region=J.region,this.pathPrefix){if(!this.pathStyle)throw new R1("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new R1("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new R1("pathPrefix should not end with /")}}getBucketName(D){let $=D?.bucketName??this.defaultBucket;if($===void 0||!Ee($))throw new TM($??"");return $}buildRequestOptions(D){let $=this.getBucketName(D),X=this.pathStyle?this.host:`${$}.${this.host}`,Y=D.headers??new Headers;Y.set("host",X);let J=typeof D.query==="object"?new URLSearchParams(D.query).toString().replace("+","%20"):D.query,Q=this.pathStyle?`${this.pathPrefix}/${$}/${D.objectName}`:`/${D.objectName}`,F=J?`?${J}`:"",Z=Q+F,w=Q.split("/").map((G)=>encodeURIComponent(G)).join("/")+F;return{headers:Y,host:X,path:Z,encodedPath:w}}async makeRequest({method:D,payload:$,...X}){let Y=new Date,{headers:J,host:Q,path:F,encodedPath:Z}=this.buildRequestOptions(X),w=X.statusCode??200;if(D==="POST"||D==="PUT"||D==="DELETE"){if($===void 0)$=new Uint8Array;else if(typeof $==="string")$=new TextEncoder().encode($);J.set("Content-Length",String($.length))}else if($)throw Error(`Unexpected payload on ${D} request.`);let G=await iw($??new Uint8Array);if(J.set("x-amz-date",l8(Y)),J.set("x-amz-content-sha256",G),this.accessKey){if(this.sessionToken)J.set("x-amz-security-token",this.sessionToken);J.set("authorization",await Te({headers:J,method:D,path:F,accessKey:this.accessKey,secretKey:this.#D,region:this.region,date:Y}))}let U=`${this.protocol}//${Q}${Z}`,O=await fetch(U,{method:D,headers:J,body:$});if(O.status!==w){if(O.status>=400)throw await Re(O);else if(O.status===301)throw new T4(O.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"');throw new T4(O.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${w}, got ${O.status} ${O.statusText}).`)}if(!X.returnBody)await O.body?.getReader().read();return O}async deleteObject(D,$={}){let X=this.getBucketName($);if(!C4(D))throw new S6(D);let Y=$.versionId?{versionId:$.versionId}:{},J=new Headers;if($.governanceBypass)J.set("X-Amz-Bypass-Governance-Retention","true");await this.makeRequest({method:"DELETE",bucketName:X,objectName:D,headers:J,query:Y,statusCode:204})}async exists(D,$){try{return await this.statObject(D,$),!0}catch(X){if(X instanceof T4&&X.statusCode===404)return!1;throw X}}getObject(D,$){return this.getPartialObject(D,{...$,offset:0,length:0})}async getPartialObject(D,{offset:$,length:X,...Y}){let J=this.getBucketName(Y);if(!C4(D))throw new S6(D);let Q=new Headers(Object.entries(Y.metadata??{})),F=200;if($||X){let w="";if($)w=`bytes=${+$}-`;else w="bytes=0-",$=0;if(X)w+=`${+X+$-1}`;Q.set("Range",w),F=206}let Z={...Y.responseParams,...Y.versionId?{versionId:Y.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:J,objectName:D,headers:Q,query:Z,statusCode:F,returnBody:!0})}getPresignedUrl(D,$,X={}){if(!this.accessKey)throw new c8;if(!C4($))throw new S6($);let{headers:Y,path:J}=this.buildRequestOptions({objectName:$,bucketName:X.bucketName,query:X.parameters}),Q=X.requestDate??new Date,F=X.expirySeconds??604800;return Ce({protocol:this.protocol,headers:Y,method:D,path:J,accessKey:this.accessKey,secretKey:this.#D,sessionToken:this.sessionToken,region:this.region,date:Q,expirySeconds:F})}presignedGetObject(D,$={}){let{versionId:X,responseParams:Y,...J}=$,Q={...Y,...X?{versionId:X}:{}};return this.getPresignedUrl("GET",D,{parameters:Q,...J})}async*listObjects(D={}){for await(let $ of this.listObjectsGrouped({...D,delimiter:""}))if($.type==="Object")yield $;else throw Error(`Unexpected result from listObjectsGrouped(): ${$}`)}async*listObjectsGrouped(D){let $=this.getBucketName(D),X="",Y=D.pageSize??1000;if(Y<1||Y>1000)throw new R1("pageSize must be between 1 and 1,000.");let J=0;while(!0){let Q=D.maxResults?Math.min(Y,D.maxResults-J):Y;if(Q===0)return;let Z=await(await this.makeRequest({method:"GET",bucketName:$,objectName:"",query:{"list-type":"2",prefix:D.prefix??"",delimiter:D.delimiter,"max-keys":String(Q),...X?{"continuation-token":X}:{}},returnBody:!0})).text(),w=E4(Z).root;if(!w||w.name!=="ListBucketResult")throw Error(`Unexpected response: ${Z}`);let G=w.children.filter((q)=>q.name==="CommonPrefixes").flatMap((q)=>q.children),U=[];for(let q of G)U.push({type:"CommonPrefix",prefix:q.content??""}),J++;for(let q of w.children.filter((z)=>z.name==="Contents"))U.push({type:"Object",key:q.children.find((z)=>z.name==="Key")?.content??"",etag:d8(q.children.find((z)=>z.name==="ETag")?.content??""),size:parseInt(q.children.find((z)=>z.name==="Size")?.content??"",10),lastModified:new Date(q.children.find((z)=>z.name==="LastModified")?.content??"invalid")}),J++;U.sort((q,z)=>{let B=q.type==="Object"?q.key:q.prefix,W=z.type==="Object"?z.key:z.prefix;return B>W?1:B<W?-1:0});for(let q of U)yield q;if(w.children.find((q)=>q.name==="IsTruncated")?.content==="true"){let q=w.children.find((z)=>z.name==="NextContinuationToken")?.content;if(!q)throw Error("Unexpectedly missing continuation token, but server said there are more results.");X=q}else return}}async putObject(D,$,X){let Y=this.getBucketName(X);if(!C4(D))throw new S6(D);let J,Q;if(typeof $==="string"){let G=new TextEncoder().encode($);if(typeof ReadableStream.from<"u")Q=ReadableStream.from([G]);else Q=new ReadableStream({start(U){U.enqueue(G),U.close()}});J=G.length}else if($ instanceof Uint8Array){if(typeof ReadableStream.from<"u")Q=ReadableStream.from([$]);else Q=new ReadableStream({start(G){G.enqueue($),G.close()}});J=$.byteLength}else if($ instanceof ReadableStream)Q=$;else throw new R1("Invalid stream/data type provided.");if(X?.size!==void 0){if(J!==void 0&&X?.size!==J)throw new R1(`size was specified (${X.size}) but doesn't match auto-detected size (${J}).`);if(typeof X.size!=="number"||X.size<0||isNaN(X.size))throw new R1(`invalid size specified: ${X.size}`);else J=X.size}let F=X?.partSize??this.calculatePartSize(J);if(F<mxD)throw new R1("Part size should be greater than 5MB");else if(F>cxD)throw new R1("Part size should be less than 6MB");let Z=new EM(F),w=new uM({client:this,bucketName:Y,objectName:D,partSize:F,metadata:X?.metadata??{}});return await Q.pipeThrough(Z).pipeTo(w),w.getResult()}calculatePartSize(D){if(D===void 0)D=fM;if(D>fM)throw TypeError(`size should not be more than ${fM}`);let $=67108864;while(!0){if($*1e4>D)return $;$+=16777216}}async statObject(D,$){let X=this.getBucketName($);if(!C4(D))throw new S6(D);let Y={};if($?.versionId)Y.versionId=$.versionId;let J=await this.makeRequest({method:"HEAD",bucketName:X,objectName:D,query:Y,headers:new Headers($?.headers)}),Q={};for(let F of gxD)if(J.headers.has(F))Q[F]=J.headers.get(F);return J.headers.forEach((F,Z)=>{if(Z.startsWith("x-amz-meta-"))Q[Z]=J.headers.get(Z)}),{type:"Object",key:D,size:parseInt(J.headers.get("content-length")??"",10),metadata:Q,lastModified:new Date(J.headers.get("Last-Modified")??"error: missing last modified"),versionId:J.headers.get("x-amz-version-id")||null,etag:d8(J.headers.get("ETag")??"")}}async copyObject(D,$,X){let Y=this.getBucketName(X),J=D.sourceBucketName??Y;if(!C4($))throw new S6($);let Q=`${J}/${D.sourceKey}`;if(D.sourceVersionId)Q+=`?versionId=${D.sourceVersionId}`;let F=new Headers(X?.metadata);if(X?.metadata!==void 0)F.set("x-amz-metadata-directive","REPLACE");F.set("x-amz-copy-source",Q);let Z=await this.makeRequest({method:"PUT",bucketName:Y,objectName:$,headers:F,returnBody:!0}),w=await Z.text(),G=E4(w).root;if(!G||G.name!=="CopyObjectResult")throw Error(`Unexpected response: ${w}`);let U=G.children.find((q)=>q.name==="ETag")?.content??"",O=G.children.find((q)=>q.name==="LastModified")?.content;if(O===void 0)throw Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:Z.headers.get("x-amz-copy-source-version-id")||null,etag:d8(U),lastModified:new Date(O),versionId:Z.headers.get("x-amz-version-id")||null}}async bucketExists(D){try{return await this.listObjects({bucketName:D}).next(),!0}catch($){if($ instanceof T4&&$.statusCode===404)return!1;throw $}}async makeBucket(D){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:D}),objectName:"",statusCode:200})}async removeBucket(D){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:D}),objectName:"",statusCode:204})}presignedPostObject(D,$={}){if(!C4(D))throw new S6(D);let X=this.getBucketName($);if(!X)throw Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let Y=$.requestDate||new Date,J=$.expirySeconds??3600;return ue({protocol:this.protocol,host:this.host,bucket:X,objectKey:D,accessKey:this.accessKey||"",secretKey:this.#D||"",region:this.region,date:Y,expirySeconds:J,conditions:$.conditions,fields:$.fields})}}vD();D6();X6();L3();O1();M3();import{spawn as dxD,spawnSync as lxD}from"node:child_process";var u6="Cap-go",nxD="capacitor-updater",ke=`${u6}/${nxD}`,ve="capacitor-",yM=[`${u6}/CLI`,`${u6}/capgo`,`${u6}/capgo-skills`],rw=[ke,...yM],ixD=20,pxD=180,rxD=4,fe=new Set;class ye extends Error{results;constructor(D=[]){super("Star-all interrupted by user.");this.name="StarAllRepositoriesAbortedError",this.results=D}}function C2(D){return D.toLowerCase()}function hM(D){fe.add(C2(D))}function be(D){let $=aw(D);return fe.has(C2($))}function _e(D,$){if(typeof D!=="number")return $;if(!Number.isFinite(D))return $;if(D<0)return $;return Math.floor(D)}function oxD(D,$){let X=_e(D,ixD),Y=_e($,pxD);if(X<=Y)return{min:X,max:Y};return{min:Y,max:X}}function axD(D,$){if(D===$)return D;return Math.floor(Math.random()*($-D+1))+D}function txD(D,$){if(typeof D!=="number")return $;if(!Number.isFinite(D))return $;if(D<1)return $;return Math.min(Math.floor(D),16)}function ow(D=[]){return new ye(D)}function p8(D,$=[]){if(D?.aborted)throw ow($)}async function sxD(D,$){if(D<=0)return;if(!$)return new Promise((X)=>setTimeout(X,D));if($.aborted)throw ow();return new Promise((X,Y)=>{let J,Q=()=>{clearTimeout(J),$.removeEventListener("abort",Q),Y(ow())};J=setTimeout(()=>{$.removeEventListener("abort",Q),X()},D),$.addEventListener("abort",Q,{once:!0})})}function bM(D){let $=new Set,X=[];for(let Y of D){let J=aw(Y),Q=C2(J);if(!$.has(Q))$.add(Q),X.push(J)}return X}async function exD(D,$){p8($),D?.(`Discovering repositories in the ${u6} organization.`);let X=r8(["api","--paginate",`orgs/${u6}/repos`,"--jq",`map(select(.name | startswith("${ve}")) | .nameWithOwner)[]`]);if(X.status===0&&X.stdout.trim().length>0){let J=X.stdout.split(`
|
|
477
|
+
`)}async function _M(D,$,X){let Y=xM(D),J=await i8("AWS4"+X,Y),Q=await i8(J,$),F=await i8(Q,"s3");return await i8(F,"aws4_request")}function kM(D,$,X){return`${D}/${SM($,X)}`}async function i8(D,$){let X=new TextEncoder,Y=await crypto.subtle.importKey("raw",D instanceof Uint8Array?D:X.encode(D),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),J=await crypto.subtle.sign("HMAC",Y,$ instanceof Uint8Array?$:X.encode($));return new Uint8Array(J)}async function ue(D){if(!D.accessKey)throw new c8;if(!D.secretKey)throw new j2;if(D.expirySeconds<1||D.expirySeconds>604800)throw new nw;let $=new Date(D.date);$.setSeconds($.getSeconds()+D.expirySeconds);let X=kM(D.accessKey,D.region,D.date),Y=l8(D.date),J={"X-Amz-Algorithm":T2,"X-Amz-Credential":X,"X-Amz-Date":Y,key:D.objectKey,...D.fields},Q=[{bucket:D.bucket},{key:D.objectKey},{"X-Amz-Algorithm":T2},{"X-Amz-Credential":X},{"X-Amz-Date":Y}];if(D.conditions)Q.push(...D.conditions);for(let[z,B]of Object.entries(D.fields||{})){if(["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(z))continue;Q.push({[z]:B})}let F={expiration:$.toISOString(),conditions:Q},Z=new TextEncoder().encode(JSON.stringify(F)),w=btoa(String.fromCharCode(...Z));J.policy=w;let G=w,U=await _M(D.date,D.region,D.secretKey),O=E2(await i8(U,G)).toLowerCase();return J["X-Amz-Signature"]=O,{url:`${D.protocol}//${D.host}/${D.bucket}`,fields:J}}var gxD=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],mxD=5242880,cxD=5368709120,fM=5497558138880;class pw{host;port;protocol;accessKey;#D;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:D,useSSL:$,port:X,pathPrefix:Y,...J}){if(/^https?:\/\//i.test(D)){if($!==void 0||X!==void 0||Y!==void 0)throw new R1("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let F=new URL(D);if(D=F.hostname,$=F.protocol==="https:",X=F.port?parseInt(F.port,10):$?443:80,F.pathname&&F.pathname!=="/")Y=F.pathname.endsWith("/")?F.pathname.slice(0,-1):F.pathname}catch{throw new lw(`Invalid endPoint URL: ${D}`)}}if(typeof D!=="string"||D.length===0)throw new lw(`Invalid endPoint: ${D}`);if($===void 0)$=!0;if(X!==void 0&&!je(X))throw new R1(`Invalid port: ${X}`);if(J.accessKey&&!J.secretKey)throw new R1("If specifying access key, secret key must also be provided.");if(J.accessKey&&J.accessKey.startsWith("ASIA")&&!J.sessionToken)throw new R1("If specifying temporary access key, session token must also be provided.");let Q=$?443:80;if(this.port=X??Q,this.host=D.toLowerCase()+(this.port!==Q?`:${this.port}`:""),this.protocol=$?"https:":"http:",this.accessKey=J.accessKey,this.#D=J.secretKey??"",this.sessionToken=J.sessionToken,this.pathStyle=J.pathStyle??!0,this.pathPrefix=Y??"",this.defaultBucket=J.bucket,this.region=J.region,this.pathPrefix){if(!this.pathStyle)throw new R1("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new R1("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new R1("pathPrefix should not end with /")}}getBucketName(D){let $=D?.bucketName??this.defaultBucket;if($===void 0||!Ee($))throw new TM($??"");return $}buildRequestOptions(D){let $=this.getBucketName(D),X=this.pathStyle?this.host:`${$}.${this.host}`,Y=D.headers??new Headers;Y.set("host",X);let J=typeof D.query==="object"?new URLSearchParams(D.query).toString().replace("+","%20"):D.query,Q=this.pathStyle?`${this.pathPrefix}/${$}/${D.objectName}`:`/${D.objectName}`,F=J?`?${J}`:"",Z=Q+F,w=Q.split("/").map((G)=>encodeURIComponent(G)).join("/")+F;return{headers:Y,host:X,path:Z,encodedPath:w}}async makeRequest({method:D,payload:$,...X}){let Y=new Date,{headers:J,host:Q,path:F,encodedPath:Z}=this.buildRequestOptions(X),w=X.statusCode??200;if(D==="POST"||D==="PUT"||D==="DELETE"){if($===void 0)$=new Uint8Array;else if(typeof $==="string")$=new TextEncoder().encode($);J.set("Content-Length",String($.length))}else if($)throw Error(`Unexpected payload on ${D} request.`);let G=await iw($??new Uint8Array);if(J.set("x-amz-date",l8(Y)),J.set("x-amz-content-sha256",G),this.accessKey){if(this.sessionToken)J.set("x-amz-security-token",this.sessionToken);J.set("authorization",await Te({headers:J,method:D,path:F,accessKey:this.accessKey,secretKey:this.#D,region:this.region,date:Y}))}let U=`${this.protocol}//${Q}${Z}`,O=await fetch(U,{method:D,headers:J,body:$});if(O.status!==w){if(O.status>=400)throw await Re(O);else if(O.status===301)throw new T4(O.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"');throw new T4(O.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${w}, got ${O.status} ${O.statusText}).`)}if(!X.returnBody)await O.body?.getReader().read();return O}async deleteObject(D,$={}){let X=this.getBucketName($);if(!C4(D))throw new S6(D);let Y=$.versionId?{versionId:$.versionId}:{},J=new Headers;if($.governanceBypass)J.set("X-Amz-Bypass-Governance-Retention","true");await this.makeRequest({method:"DELETE",bucketName:X,objectName:D,headers:J,query:Y,statusCode:204})}async exists(D,$){try{return await this.statObject(D,$),!0}catch(X){if(X instanceof T4&&X.statusCode===404)return!1;throw X}}getObject(D,$){return this.getPartialObject(D,{...$,offset:0,length:0})}async getPartialObject(D,{offset:$,length:X,...Y}){let J=this.getBucketName(Y);if(!C4(D))throw new S6(D);let Q=new Headers(Object.entries(Y.metadata??{})),F=200;if($||X){let w="";if($)w=`bytes=${+$}-`;else w="bytes=0-",$=0;if(X)w+=`${+X+$-1}`;Q.set("Range",w),F=206}let Z={...Y.responseParams,...Y.versionId?{versionId:Y.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:J,objectName:D,headers:Q,query:Z,statusCode:F,returnBody:!0})}getPresignedUrl(D,$,X={}){if(!this.accessKey)throw new c8;if(!C4($))throw new S6($);let{headers:Y,path:J}=this.buildRequestOptions({objectName:$,bucketName:X.bucketName,query:X.parameters}),Q=X.requestDate??new Date,F=X.expirySeconds??604800;return Ce({protocol:this.protocol,headers:Y,method:D,path:J,accessKey:this.accessKey,secretKey:this.#D,sessionToken:this.sessionToken,region:this.region,date:Q,expirySeconds:F})}presignedGetObject(D,$={}){let{versionId:X,responseParams:Y,...J}=$,Q={...Y,...X?{versionId:X}:{}};return this.getPresignedUrl("GET",D,{parameters:Q,...J})}async*listObjects(D={}){for await(let $ of this.listObjectsGrouped({...D,delimiter:""}))if($.type==="Object")yield $;else throw Error(`Unexpected result from listObjectsGrouped(): ${$}`)}async*listObjectsGrouped(D){let $=this.getBucketName(D),X="",Y=D.pageSize??1000;if(Y<1||Y>1000)throw new R1("pageSize must be between 1 and 1,000.");let J=0;while(!0){let Q=D.maxResults?Math.min(Y,D.maxResults-J):Y;if(Q===0)return;let Z=await(await this.makeRequest({method:"GET",bucketName:$,objectName:"",query:{"list-type":"2",prefix:D.prefix??"",delimiter:D.delimiter,"max-keys":String(Q),...X?{"continuation-token":X}:{}},returnBody:!0})).text(),w=E4(Z).root;if(!w||w.name!=="ListBucketResult")throw Error(`Unexpected response: ${Z}`);let G=w.children.filter((q)=>q.name==="CommonPrefixes").flatMap((q)=>q.children),U=[];for(let q of G)U.push({type:"CommonPrefix",prefix:q.content??""}),J++;for(let q of w.children.filter((z)=>z.name==="Contents"))U.push({type:"Object",key:q.children.find((z)=>z.name==="Key")?.content??"",etag:d8(q.children.find((z)=>z.name==="ETag")?.content??""),size:parseInt(q.children.find((z)=>z.name==="Size")?.content??"",10),lastModified:new Date(q.children.find((z)=>z.name==="LastModified")?.content??"invalid")}),J++;U.sort((q,z)=>{let B=q.type==="Object"?q.key:q.prefix,W=z.type==="Object"?z.key:z.prefix;return B>W?1:B<W?-1:0});for(let q of U)yield q;if(w.children.find((q)=>q.name==="IsTruncated")?.content==="true"){let q=w.children.find((z)=>z.name==="NextContinuationToken")?.content;if(!q)throw Error("Unexpectedly missing continuation token, but server said there are more results.");X=q}else return}}async putObject(D,$,X){let Y=this.getBucketName(X);if(!C4(D))throw new S6(D);let J,Q;if(typeof $==="string"){let G=new TextEncoder().encode($);if(typeof ReadableStream.from<"u")Q=ReadableStream.from([G]);else Q=new ReadableStream({start(U){U.enqueue(G),U.close()}});J=G.length}else if($ instanceof Uint8Array){if(typeof ReadableStream.from<"u")Q=ReadableStream.from([$]);else Q=new ReadableStream({start(G){G.enqueue($),G.close()}});J=$.byteLength}else if($ instanceof ReadableStream)Q=$;else throw new R1("Invalid stream/data type provided.");if(X?.size!==void 0){if(J!==void 0&&X?.size!==J)throw new R1(`size was specified (${X.size}) but doesn't match auto-detected size (${J}).`);if(typeof X.size!=="number"||X.size<0||isNaN(X.size))throw new R1(`invalid size specified: ${X.size}`);else J=X.size}let F=X?.partSize??this.calculatePartSize(J);if(F<mxD)throw new R1("Part size should be greater than 5MB");else if(F>cxD)throw new R1("Part size should be less than 6MB");let Z=new EM(F),w=new uM({client:this,bucketName:Y,objectName:D,partSize:F,metadata:X?.metadata??{}});return await Q.pipeThrough(Z).pipeTo(w),w.getResult()}calculatePartSize(D){if(D===void 0)D=fM;if(D>fM)throw TypeError(`size should not be more than ${fM}`);let $=67108864;while(!0){if($*1e4>D)return $;$+=16777216}}async statObject(D,$){let X=this.getBucketName($);if(!C4(D))throw new S6(D);let Y={};if($?.versionId)Y.versionId=$.versionId;let J=await this.makeRequest({method:"HEAD",bucketName:X,objectName:D,query:Y,headers:new Headers($?.headers)}),Q={};for(let F of gxD)if(J.headers.has(F))Q[F]=J.headers.get(F);return J.headers.forEach((F,Z)=>{if(Z.startsWith("x-amz-meta-"))Q[Z]=J.headers.get(Z)}),{type:"Object",key:D,size:parseInt(J.headers.get("content-length")??"",10),metadata:Q,lastModified:new Date(J.headers.get("Last-Modified")??"error: missing last modified"),versionId:J.headers.get("x-amz-version-id")||null,etag:d8(J.headers.get("ETag")??"")}}async copyObject(D,$,X){let Y=this.getBucketName(X),J=D.sourceBucketName??Y;if(!C4($))throw new S6($);let Q=`${J}/${D.sourceKey.split("/").map((q)=>encodeURIComponent(q)).join("/")}`;if(D.sourceVersionId)Q+=`?versionId=${D.sourceVersionId}`;let F=new Headers(X?.metadata);if(X?.metadata!==void 0)F.set("x-amz-metadata-directive","REPLACE");F.set("x-amz-copy-source",Q);let Z=await this.makeRequest({method:"PUT",bucketName:Y,objectName:$,headers:F,returnBody:!0}),w=await Z.text(),G=E4(w).root;if(!G||G.name!=="CopyObjectResult")throw Error(`Unexpected response: ${w}`);let U=G.children.find((q)=>q.name==="ETag")?.content??"",O=G.children.find((q)=>q.name==="LastModified")?.content;if(O===void 0)throw Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:Z.headers.get("x-amz-copy-source-version-id")||null,etag:d8(U),lastModified:new Date(O),versionId:Z.headers.get("x-amz-version-id")||null}}async bucketExists(D){try{return await this.listObjects({bucketName:D}).next(),!0}catch($){if($ instanceof T4&&$.statusCode===404)return!1;throw $}}async makeBucket(D){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:D}),objectName:"",statusCode:200})}async removeBucket(D){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:D}),objectName:"",statusCode:204})}presignedPostObject(D,$={}){if(!C4(D))throw new S6(D);let X=this.getBucketName($);if(!X)throw Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let Y=$.requestDate||new Date,J=$.expirySeconds??3600;return ue({protocol:this.protocol,host:this.host,bucket:X,objectKey:D,accessKey:this.accessKey||"",secretKey:this.#D||"",region:this.region,date:Y,expirySeconds:J,conditions:$.conditions,fields:$.fields})}}vD();D6();X6();L3();O1();M3();import{spawn as dxD,spawnSync as lxD}from"node:child_process";var u6="Cap-go",nxD="capacitor-updater",ke=`${u6}/${nxD}`,ve="capacitor-",yM=[`${u6}/CLI`,`${u6}/capgo`,`${u6}/capgo-skills`],rw=[ke,...yM],ixD=20,pxD=180,rxD=4,fe=new Set;class ye extends Error{results;constructor(D=[]){super("Star-all interrupted by user.");this.name="StarAllRepositoriesAbortedError",this.results=D}}function C2(D){return D.toLowerCase()}function hM(D){fe.add(C2(D))}function be(D){let $=aw(D);return fe.has(C2($))}function _e(D,$){if(typeof D!=="number")return $;if(!Number.isFinite(D))return $;if(D<0)return $;return Math.floor(D)}function oxD(D,$){let X=_e(D,ixD),Y=_e($,pxD);if(X<=Y)return{min:X,max:Y};return{min:Y,max:X}}function axD(D,$){if(D===$)return D;return Math.floor(Math.random()*($-D+1))+D}function txD(D,$){if(typeof D!=="number")return $;if(!Number.isFinite(D))return $;if(D<1)return $;return Math.min(Math.floor(D),16)}function ow(D=[]){return new ye(D)}function p8(D,$=[]){if(D?.aborted)throw ow($)}async function sxD(D,$){if(D<=0)return;if(!$)return new Promise((X)=>setTimeout(X,D));if($.aborted)throw ow();return new Promise((X,Y)=>{let J,Q=()=>{clearTimeout(J),$.removeEventListener("abort",Q),Y(ow())};J=setTimeout(()=>{$.removeEventListener("abort",Q),X()},D),$.addEventListener("abort",Q,{once:!0})})}function bM(D){let $=new Set,X=[];for(let Y of D){let J=aw(Y),Q=C2(J);if(!$.has(Q))$.add(Q),X.push(J)}return X}async function exD(D,$){p8($),D?.(`Discovering repositories in the ${u6} organization.`);let X=r8(["api","--paginate",`orgs/${u6}/repos`,"--jq",`map(select(.name | startswith("${ve}")) | .nameWithOwner)[]`]);if(X.status===0&&X.stdout.trim().length>0){let J=X.stdout.split(`
|
|
478
478
|
`).map((Q)=>Q.trim()).filter((Q)=>Q.length>0);if(J.length>0){let Q=bM([...J,...yM]);return D?.(`Found ${Q.length} matching repositories from the GitHub API.`),Q}D?.("No matching repositories were returned from the paginated GitHub API. Trying a fallback request.")}else D?.("Paginated GitHub API request failed. Trying a fallback request.");let Y=r8(["api",`orgs/${u6}/repos?per_page=100`]);if(Y.status!==0)return D?.("Fallback request failed. Using the default repository list instead."),[...rw];try{let J=JSON.parse(Y.stdout);if(!Array.isArray(J))return D?.("Fallback response format was invalid. Using the default repository list instead."),[...rw];let Q=J.filter((F)=>typeof F==="object"&&F!==null).map((F)=>F.name).filter((F)=>!!F&&F.startsWith(ve)).map((F)=>`${u6}/${F}`);if(Q.length>0){let F=bM([...Q,...yM]);return D?.(`Found ${F.length} matching repositories from the fallback request.`),F}}catch{return D?.("Fallback response could not be parsed. Using the default repository list instead."),[...rw]}return D?.("No matching repositories were found. Using the default repository list instead."),[...rw]}function DSD(D,$){return new Promise((X)=>{let Y="",J="",Q=!1,F,Z=()=>{},w=(G)=>{if(Q)return;Q=!0,$?.removeEventListener("abort",Z),X(G)};if(Z=()=>{F?.kill("SIGINT"),w({status:130,stderr:"GitHub command interrupted by user.",stdout:Y})},F=dxD("gh",D,{stdio:["ignore","pipe","pipe"]}),F.stdout?.setEncoding("utf8"),F.stdout?.on("data",(G)=>{Y+=G}),F.stderr?.setEncoding("utf8"),F.stderr?.on("data",(G)=>{J+=G}),F.on("error",()=>{w({status:1,stderr:"`gh` command is not available in PATH.",stdout:""})}),F.on("close",(G)=>{w({status:G??1,stderr:J,stdout:Y})}),$){if($.aborted){Z();return}$.addEventListener("abort",Z,{once:!0})}})}function r8(D){try{let $=lxD("gh",D,{encoding:"utf8",stdio:["ignore","pipe","pipe"]});return{status:$.status??1,stderr:$.stderr?.toString()??"",stdout:$.stdout?.toString()??""}}catch{return{status:1,stderr:"`gh` command is not available in PATH.",stdout:""}}}function he(){if(!ce())throw Error("GitHub CLI (`gh`) is not installed. Install it from https://cli.github.com/");if(!de())throw Error("GitHub CLI is not logged in. Run `gh auth login` first.")}async function $SD(D,$,X){if(D.length===0)return new Set;let Y=new Set;return $?.(`Checking ${D.length} target repositories against your GitHub stars.`),await ge(D,Math.min(D.length,8),X,()=>[],async(J)=>{let Q=await DSD(["api","-X","GET",`/user/starred/${J}`],X);if(Q.status===0){Y.add(C2(J));return}if(Q.status===1)return;if(Q.status===130&&X?.aborted)throw ow();throw Error(`Unable to check star status for ${J}. ${Q.stderr||Q.stdout}`.trim())}),$?.(`Found ${Y.size} repositories already starred.`),Y}async function ge(D,$,X,Y,J){let Q=0;async function F(){while(!0){p8(X,Y());let w=Q;if(Q+=1,w>=D.length)return;await J(D[w],w)}}let Z=Math.min($,D.length);await Promise.all(Array.from({length:Z},()=>F()))}function XSD(D,$,X){let Y=Promise.resolve();return async()=>{p8(X);let J,Q=Y;Y=new Promise((F)=>{J=F}),await Q,await sxD(axD(D,$),X),J?.()}}function me(D){let $=r8(["api","-X","PUT",`/user/starred/${D}`]);if($.status!==0){let X=$.stderr||$.stdout||`GitHub returned status ${$.status}`;throw Error(`Failed to star ${D}: ${X.trim()}`)}return hM(D),{repository:D,alreadyStarred:!1}}function aw(D){let X=(D?.trim()||ke).replace(/\.git$/i,"");if(/^https?:\/\//.test(X))try{let Y=new URL(X);if(Y.hostname.endsWith("github.com")){let[J,Q]=Y.pathname.split("/").filter((F)=>F.length>0);if(J&&Q)return`${J}/${Q}`}}catch{}if(X.startsWith("git@github.com:")){let[,Y]=X.split("git@github.com:");if(Y){let[J,Q]=Y.split("/");if(J&&Q)return`${J}/${Q}`}}if(X.includes("/")){let[Y,J]=X.split("/");if(Y&&J)return`${Y}/${J}`}return`${u6}/${X}`}function JSD(D){return r8(["repo","view",D,"--json","nameWithOwner"]).status===0}function YSD(D){let $=r8(["api","-X","GET",`/user/starred/${D}`]);if($.status===0)return!0;if($.status===1)return!1;throw Error(`Unable to check star status for ${D}.`)}function ce(){return r8(["--version"]).status===0}function de(){return r8(["auth","status"]).status===0}function le(D){let $=aw(D);if(!ce())return{repository:$,ghInstalled:!1,ghLoggedIn:!1,repositoryExists:!1,starred:!1};if(!de())return{repository:$,ghInstalled:!0,ghLoggedIn:!1,repositoryExists:!1,starred:!1};if(!JSD($))return{repository:$,ghInstalled:!0,ghLoggedIn:!0,repositoryExists:!1,starred:!1};return{repository:$,ghInstalled:!0,ghLoggedIn:!0,repositoryExists:!0,starred:YSD($)}}async function ne(D={}){he(),p8(D.signal);let $=D.repositories?.length?D.repositories:await exD(D.onDiscovery,D.signal);D.onDiscovery?.(`Prepared ${$.length} repositories to process.`);let X=oxD(D.minDelayMs,D.maxDelayMs),Y=bM($),J=txD(D.maxConcurrency,rxD);p8(D.signal);let Q=await $SD(Y,D.onDiscovery,D.signal),F=Array.from({length:Y.length}),Z=()=>F.filter((U)=>!!U),w=[];for(let U=0;U<Y.length;U++){p8(D.signal,Z());let O=Y[U],q=C2(O);if(be(O)){let z={repository:O,alreadyStarred:!0,skipped:!0,status:"already_starred"};D.onProgress?.(z),F[U]=z;continue}if(Q.has(q)){hM(O);let z={repository:O,alreadyStarred:!0,skipped:!0,status:"already_starred"};D.onProgress?.(z),F[U]=z;continue}w.push({index:U,repository:O})}let G=XSD(X.min,X.max,D.signal);return await ge(w,J,D.signal,Z,async({index:U,repository:O})=>{await G(),p8(D.signal,Z());try{let z={repository:me(O).repository,alreadyStarred:!1,skipped:!1,status:"starred"};D.onProgress?.(z),F[U]=z}catch(q){let z={repository:O,alreadyStarred:!1,skipped:!1,status:"failed",error:q instanceof Error?q.message:String(q)};D.onProgress?.(z),F[U]=z}}),Z()}function gM(D){let $=aw(D);he();let X=le($);if(!X.repositoryExists)throw Error(`Cannot star ${$}: repository is not reachable or does not exist.`);if(X.starred)return hM($),{repository:$,alreadyStarred:!0};return me($)}vD();import ie from"node:process";var QSD=[{code:"aws:eu-central-1",label:"EU (Frankfurt)"},{code:"gcp:me-central1",label:"Middle East (Riyadh)"},{code:"gcp:asia-east2",label:"Hong Kong"},{code:"aws:ap-northeast-1",label:"Japan (Tokyo)"},{code:"aws:ap-south-1",label:"India (Mumbai)"},{code:"aws:us-east-1",label:"North America (Virginia)"},{code:"gcp:africa-south1",label:"Africa (South Africa)"},{code:"aws:ap-southeast-2",label:"Oceania (Sydney)"},{code:"aws:sa-east-1",label:"South America (São Paulo)"}],FSD=60000,ZSD=1000,pe=20;function wSD(){if(typeof Intl>"u")return null;return Intl.DateTimeFormat().resolvedOptions().timeZone||null}function GSD(){let D=wSD();if(!D)return null;if(/^America\//.test(D))return"aws:us-east-1";if(/^Europe\//.test(D)||/^Atlantic\//.test(D))return"aws:eu-central-1";if(/^Africa\//.test(D))return"gcp:africa-south1";if(/^Asia\//.test(D)){let $=(D.split("/")[1]??"").toLowerCase();if(["tokyo","osaka","seoul","pyongyang"].includes($))return"aws:ap-northeast-1";if(["kolkata","mumbai","calcutta","chennai","bangalore","hyderabad","delhi","dhaka","colombo","karachi"].includes($))return"aws:ap-south-1";if(["hong_kong","singapore","manila","jakarta","kuala_lumpur","beijing","shanghai","hongkong","taipei"].includes($))return"gcp:asia-east2";if(["sydney","melbourne","canberra","perth","brisbane","darwin","adelaide"].includes($))return"aws:ap-southeast-2";return"gcp:asia-east2"}if(/^Pacific\//.test(D)||/^Australia\//.test(D))return"aws:ap-southeast-2";return null}function USD(){let D=[...QSD],$=GSD();if(!$)return D;let X=D.findIndex((J)=>J.code===$);if(X<0)return D;let[Y]=D.splice(X,1);return D.push(Y),D}function OSD(D,$,X){let Y=Math.min(Math.max(D,0),X);return Math.floor(Y/X*$)}function qSD(D){let $=Math.min(Math.max(D,0),100),X=Math.round($/100*pe);return`${"█".repeat(X)}${"░".repeat(pe-X)}`}function zSD(D){return`${Math.max(0,D)}s`}function re({interactive:D=ie.stdout.isTTY&&ie.stderr.isTTY,totalMs:$=FSD,updateIntervalMs:X=ZSD,title:Y="Replicating your bundle in all regions...",completeMessage:J="Your update is now available worldwide."}={}){if(!D||$<=0)return Promise.resolve();let Q=USD();if(!Q.length)return Promise.resolve();H.info(Y),H.info(`Regions: ${Q.map((U)=>U.label).join(" • ")}`);let F=A0(),Z=Date.now(),w=Q.length,G=null;return new Promise((U)=>{let O=()=>{let q=Date.now()-Z,z=Math.max(0,$-q),B=OSD(q,w,$),W=Math.min(100,Math.round(q/$*100)),L=qSD(W),M=B<w?Q[B]?.label||"Finalizing":"Complete",I=`${B}/${w} regions updated • ${zSD(Math.ceil(z/1000))} left • ${L} • Next: ${M}`;F.message(I)};F.start(Y),O(),G=setInterval(O,X),setTimeout(()=>{if(G)clearInterval(G);F.stop(J),U()},$)})}kD();vD();X6();function oe(D){try{let $=eD(D);return q$(P7($,"patch"))}catch{let $=D.match(/^(\d+)\.(\d+)\.(\d+)/);if($){let[,X,Y,J]=$;return`${X}.${Y}.${Number.parseInt(J)+1}`}return"1.0.1"}}async function ae(D,$){let X=oe(D),Y=$?` for ${$}`:"",J=await t1({message:`How do you want to handle the version${Y}?`,options:[{value:"auto",label:`Auto: Bump patch version (${D} → ${X})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(bD(J))return null;if(J==="auto")return H.info(`\uD83D\uDD22 Auto-bumped version from ${D} to ${X}`),X;let Q=await k6({message:`Current version is ${D}. Enter new version:`,validate:(F)=>{if(!F)return"Version is required";if(!F.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});if(bD(Q))return null;return Q}function te(D){let $=oe(D);try{let X=eD(D);return[$,q$(P7(X,"minor")),`${D}-beta.1`,`${D}.1`]}catch{return[$,`${D}.1`,`${D}-beta.1`,`${D}-rc.1`]}}import{readdirSync as se,readFileSync as BSD,statSync as WSD}from"node:fs";import{extname as KSD,join as HSD}from"node:path";function VSD(D,$){return BSD(D,"utf8").includes($)}function P2(D,$){let X=se(D);for(let Y of X){let J=HSD(D,Y),Q=WSD(J);if(Q.isDirectory()){if(P2(J,$))return!0}else if(Q.isFile()&&KSD(J)===".js"){if(VSD(J,$))return!0}}return!1}function tw(D){if(se(D).indexOf("index.html")>-1)return!0;return!1}vD();X6();var Q0D=V0(J0D(),1),F0D=V0(CY(),1);import{Buffer as duD}from"node:buffer";import{createHash as luD}from"node:crypto";import{createReadStream as XI,statSync as nuD}from"node:fs";import{platform as iuD}from"node:os";import{join as puD,posix as ruD,win32 as Y0D}from"node:path";import{cwd as ouD}from"node:process";import{buffer as JI}from"node:stream/consumers";import{createBrotliCompress as auD}from"node:zlib";kD();async function tuD(D,$){try{let X=new URL(`${D.hostFilesApi}/files/read/attachments/${encodeURIComponent($)}`);return X.searchParams.set("nocache",`${Date.now()}`),(await fetch(X.toString(),{method:"GET",headers:{range:"bytes=0-0","cache-control":"no-cache"}})).ok}catch{return!1}}var suD=8192;async function euD(D){let $=e0(ouD()),X=await y1("@capgo/capacitor-updater",$,D.packageJson),Y;try{Y=X?eD(X):void 0}catch{Y=void 0}if(!X||!Y)return{version:null,supportsBrotliV2:!1};let J=!w$(Y,void 0,void 0,z2);return{version:`${Y.major}.${Y.minor}.${Y.patch}`,supportsBrotliV2:J}}function DvD(D,$){if(!$)return!1;let X=$.split(",").map((Y)=>Y.trim()).filter((Y)=>!!Y);if(X.length===0)return!1;return Q0D.isMatch(D,X)}async function $vD(D,$,X){let J=nuD(D).size,Q=await JI(XI(D));if(J===0)return{buffer:Q,useBrotli:!1};if(DvD($,X.noBrotliPatterns))return{buffer:Q,useBrotli:!1};if(J<suD)return{buffer:Q,useBrotli:!1};try{let F=await JI(XI(D).pipe(auD({})));if(F.length>=J-10)return{buffer:Q,useBrotli:!1};return{buffer:F,useBrotli:!0}}catch(F){return H.warn(`Brotli compression failed for ${D}: ${F}, using original file`),{buffer:Q,useBrotli:!1}}}async function Z0D(D,$,X,Y,J,Q,F=!1){let Z=A0();Z.start(J!=="v2"?"Generating the update manifest":`Generating the update manifest with ${F?"V3":"V2"} encryption`);let w=await Xt(D);if(J==="v2")for(let G of w)G.hash=F?W7(G.hash,Q):B7(G.hash,Q);return Z.stop("Manifest generated successfully"),await AD($,{channel:"partial-update",event:"Generate manifest",icon:"\uD83D\uDCC2",user_id:X,tags:{"app-id":Y},notify:!1}),w}function XvD(D){if(iuD()!=="win32")return D;return Y0D.normalize(D).split(Y0D.sep).join(ruD.sep)}function JvD(D){let $=D.split("/").map((X)=>encodeURIComponent(X)).join("/");if(D.includes(" "))H.warn(`File "${D}" contains spaces in its name.`);return $}async function w0D(D,$,X,Y,J,Q,F){let Z=A0();Z.start("Preparing partial update with TUS protocol");let w=performance.now(),G=await v$(),U=!!(F.partial||F.delta||F.partialOnly||F.deltaOnly),{version:O,supportsBrotliV2:q}=await euD(F);if(!q)throw Error(`Your project is using an older version of @capgo/capacitor-updater (${O||"unknown"}). To use Delta updates, please upgrade to version ${Ww} (v5), ${Kw} (v6) or ${z2} (v7) or higher.`);else if(F.disableBrotli)H.info("Brotli compression disabled by user request");else if(F.noBrotliPatterns)H.info(`Files matching patterns (${F.noBrotliPatterns}) will be excluded from brotli compression`);let z=$.filter((M)=>M.file.includes(" "));if(z.length>0)throw Error(`Files with spaces in their names (${z.map((M)=>M.file).join(", ")}). Please rename the files.`);let B=0,W=$.length,L=0;try{Z.message(`Uploading ${W} files using TUS protocol`);let M=async(R)=>{let C=puD(X,R.file),A=XvD(R.file),_,u=!1;if(F.disableBrotli)_=await JI(XI(C)),u=!1;else{let j=await $vD(C,A,F);_=j.buffer,u=j.useBrotli}let x=_;if(Q)x=z7(_,Q.sessionKey,Q.ivSessionKey);let h=A;if(u)h=`${A}.br`,L++;let b=JvD(h),l=luD("sha256").update(R.hash).digest("hex"),f;if(Q){let j=duD.from(Q.ivSessionKey).toString("hex");f=`orgs/${J}/apps/${Y}/delta/${j}/${l}_${b}`}else f=`orgs/${J}/apps/${Y}/delta/${l}_${b}`;if(!Q&&await tuD(G,f))return B++,Promise.resolve({file_name:b,s3_path:f,file_hash:R.hash});return new Promise((j,S)=>{Z.message(`Prepare upload partial file: ${A}`);let v=L4(h);new F0D.Upload(x,{endpoint:`${G.hostFilesApi}/files/upload/attachments/`,chunkSize:F.tusChunkSize,retryDelays:[0,1000,3000,5000,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:f,filetype:v},headers:{Authorization:D},onError:(g)=>{let d=g.toString(),a;try{let r=d.match(/response text: (\{.*?\})/);if(r&&r[1])a=JSON.parse(r[1]).moreInfo?.requestId}catch{}let m=a?` [requestId: ${a}]`:"";H.error(`Failed to upload ${A}: ${d}${m}`),S(g)},onProgress(){let g=(B/W*100).toFixed(2);Z.message(`Uploading partial update: ${g}%`)},onSuccess(){B++,j({file_name:b,s3_path:f,file_hash:R.hash})}}).start()})},I=500,K=[];for(let R=0;R<$.length;R+=I){let C=$.slice(R,R+I),A=Math.floor(R/I)+1,_=Math.ceil($.length/I);if(_>1)Z.message(`Processing batch ${A}/${_} (${C.length} files)`);let u=await Promise.all(C.map((x)=>M(x)));K.push(...u)}let N=((performance.now()-w)/1000).toFixed(2);if(Z.stop(`Partial update uploaded successfully \uD83D\uDCAA in (${N} seconds)`),L>0)H.info(`${L} of ${W} files were compressed with brotli and use .br extension`);return await AD(D,{channel:"app",event:`App Partial TUS done${L>0?" with .br extension":""}`,icon:"⏫",user_id:J,tags:{"app-id":Y},notify:!1}),await AD(D,{channel:"performance",event:"Partial upload performance",icon:"\uD83D\uDE84",user_id:J,tags:{"app-id":Y,time:N},notify:!1}),K}catch(M){let K=((performance.now()-w)/1000).toFixed(2);if(Z.error(`Failed to upload Partial bundle (after ${K} seconds)`),U)throw H.error(`Error uploading partial update: ${M}`),H.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),M;else return H.info(`Error uploading partial update: ${M}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function H0(D){throw H.error(D),Error(D)}function wvD(D){let $=new R0;$.headers=["Package","Local","Remote","Status","Details"],$.theme=R0.roundTheme,$.rows=[];for(let X of D){let{name:Y,localVersion:J,remoteVersion:Q}=X,F=k8(X),Z=F.compatible?"✅":"❌";$.rows.push([Y,J||"-",Q||"-",Z,F.message])}H.info($.toString())}async function GvD(D,$){let X=N4("",$.packageJson),Y=$.bundle||D?.plugins?.CapacitorUpdater?.version||X||`0.0.1-beta.${YvD().split("-")[0]}`;if(!e5.test(Y))H0(`Your bundle name ${Y}, is not valid it should follow semver convention : https://semver.org/`);return Y}function UvD(D){let $=D.apikey||WD();if(!$)H0("Missing API key, you need to provide an API key to upload your bundle");return $}function OvD(D,$,X){let Y=mD(D,X),J=$.path||X?.webDir;if(!Y)H0("Missing argument, you need to provide a appid or be in a capacitor project");if(!J)H0("Missing argument, you need to provide a path (--path), or be in a capacitor project");if(!YG(J))H0(`Path ${J} does not exist, build your app first, or provide a valid path`);return{appid:Y,path:J}}function qvD(D,$){let X=D.codeCheck;if(typeof X>"u"||X){if(!P2($,"notifyAppReady"))H0(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
479
479
|
If you are sure your app has this code, you can use the --no-code-check option`);if(!tw($))H0(`index.html is missing in the root folder of ${$}`)}}async function zvD(D,$,X,Y,J,Q){let{ignoreMetadataCheck:F,autoMinUpdateVersion:Z,minUpdateVersion:w}=X,{data:G,error:U}=await D.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",Y).eq("app_id",J).single(),O=!!G&&G.disable_auto_update==="version_number",q,z;if(!U&&G&&G.version&&G.version.native_packages&&!F){let L=A0();L.start(`Checking bundle compatibility with channel ${Y}`);let{finalCompatibility:M,localDependencies:I}=await Lw(D,J,Y,X.packageJson,X.nodeModules);if(z=M,q=I,z.filter((V)=>!M4(V)).length>0){if(L.error(`Bundle NOT compatible with ${Y} channel`),H.warn(""),wvD(z),H.warn(""),H.warn("An app store update may be required for these changes to take effect."),Z)w=Q,H.info(`Auto set min-update-version to ${w}`)}else if(Z)try{let{min_update_version:V}=G.version;if(!V||!e5.test(V))H0("Invalid remote min update version, skipping auto setting compatibility");w=V,L.stop(`Auto set min-update-version to ${w}`)}catch{H0(`Cannot auto set compatibility, invalid data ${G}`)}else L.stop(`Bundle compatible with ${Y} channel`)}else if(!F){if(H.warn(`Channel ${Y} is new or it's your first upload with compatibility check, it will be ignored this time`),q=await oL(X.packageJson,X.nodeModules),Z)w=Q,H.info(`Auto set min-update-version to ${w}`)}if(O&&!w&&!F)H0("You need to provide a min-update-version to upload a bundle to this channel");if(w){if(!e5.test(w))H0(`Your minimal version update ${w}, is not valid it should follow semver convention : https://semver.org/`)}let B=q?new Map(q.filter((L)=>!!L.native&&L.native!==void 0).map((L)=>[L.name,L])):new Map;return{nativePackages:B.size>0||!X.ignoreMetadataCheck?Array.from(B,([L,M])=>({name:L,version:M.version,...M.ios_checksum&&{ios_checksum:M.ios_checksum},...M.android_checksum&&{android_checksum:M.android_checksum}})):void 0,minUpdateVersion:w}}async function BvD(D,$,X,Y=!1,J=!1){let{data:Q,error:F}=await D.rpc("exist_app_versions",{appid:$,name_version:X}).single();if(Q||F){if(Y)return H.warn(`Version ${X} already exists - exiting gracefully due to --silent-fail option`),ND("Bundle version already exists - exiting gracefully \uD83C\uDF89"),!0;if(J){H.error(`❌ Version ${X} already exists`);let Z=te(X);H.info("\uD83D\uDCA1 Here are some suggestions:"),Z.forEach((U,O)=>{H.info(` ${O+1}. ${U}`)});let w=await t1({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${Z[0]}`},{value:"suggest2",label:`Use ${Z[1]}`},{value:"suggest3",label:`Use ${Z[2]}`},{value:"suggest4",label:`Use ${Z[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});if(bD(w)||w==="cancel")H0("Upload cancelled by user");let G;if(w==="custom"){let U=await ae(X,"upload");if(!U)H0("Upload cancelled by user");G=U}else{let U=Number.parseInt(w.replace("suggest",""))-1;G=Z[U]}return H.info(`\uD83D\uDD04 Retrying with new version: ${G}`),G}H0(`Version ${X} already exists ${s(F)}`)}return!1}async function WvD(D,$,X,Y,J,Q,F,Z){let w,G,U="",O=null,q="none",z="",B="",W=$.keyV2,L=$.key===!1,M=A0();M.start(`Zipping bundle from ${D}`),O=await Hw(D),M.message("Calculating checksum");let I=e0(YI()),K=await y1("@capgo/capacitor-updater",I,$.packageJson),V=!1,N;try{N=K?eD(K):void 0}catch{N=void 0}if(!K)H0("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager");else if(N)V=!w$(N,Ww,Kw,z2);else if(K==="link:@capgo/capacitor-updater"||K==="file:.."||K==="file:../")H.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),V=!0;let R=$.forceCrc32Checksum===!0,C=!R&&((W||$.keyDataV2||YG(i1))&&!L||V);if(U=await p6(O,C?"sha256":"crc32"),M.stop(`Checksum ${C?"SHA256":"CRC32"}${R?" (forced)":""}: ${U}`),L)H.info("Encryption ignored");else if((W||YG(i1)||$.keyDataV2)&&!$.oldEncryption){let u=typeof W==="string"?W:i1,x=$.keyDataV2||"";if(!x&&!YG(u))H0(`Cannot find private key ${u}`);if(await AD(X,{channel:"app",event:"App encryption v2",icon:"\uD83D\uDD11",user_id:Y,tags:{"app-id":J},notify:!1},$.verbose),!x)x=QvD(u).toString();let h=N&&!w$(N,"5.30.0","6.30.0","7.30.0");H.info(`Encrypting your bundle with ${h?"V3":"V2"}`);let{sessionKey:b,ivSessionKey:l}=dw(x),f=z7(O,b,l);if(U=h?W7(U,x):B7(U,x),w=l,G=b,q="v2",z=x,Z){if(B=Ve(Z),$.verbose)H.info(`[Verbose] Encryption key_id: ${B}`)}if($.displayIvSession)H.info(`Your Iv Session key is ${w},
|
|
480
480
|
keep it safe, you will need it to decrypt your bundle.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.88.
|
|
4
|
+
"version": "7.88.1",
|
|
5
5
|
"description": "A CLI to upload to capgo servers",
|
|
6
6
|
"author": "Martin martin@capgo.app",
|
|
7
7
|
"license": "Apache 2.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@antfu/eslint-config": "^7.0.0",
|
|
84
|
-
"@bradenmacdonald/s3-lite-client": "npm:@jsr/bradenmacdonald__s3-lite-client@0.9.
|
|
84
|
+
"@bradenmacdonald/s3-lite-client": "npm:@jsr/bradenmacdonald__s3-lite-client@0.9.5",
|
|
85
85
|
"@capacitor/cli": "^8.0.0",
|
|
86
86
|
"@capgo/find-package-manager": "^0.0.18",
|
|
87
87
|
"@clack/prompts": "^1.0.0",
|