@capgo/cli 8.98.0 → 8.98.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
CHANGED
|
@@ -72,7 +72,7 @@ ${Z}
|
|
|
72
72
|
`}}}}).prompt();var l0=b(()=>{x2A();x2A();C2A();O2A();Ag=iA(R2A(),1);v2A=h40(),m40=H6("◆","*"),ErA=H6("■","x"),RrA=H6("▲","x"),g2A=H6("◇","o"),jrA=H6("┌","T"),u$=H6("│","|"),$F=H6("└","—"),c40=H6("┐","T"),d40=H6("┘","—"),f2A=H6("●",">"),rs=H6("○"," "),YkB=H6("◻","[•]"),XkB=H6("◼","[+]"),ZkB=H6("◻","[ ]"),l40=H6("▪","•"),p40=H6("─","-"),i40=H6("╮","+"),GkB=H6("├","+"),n40=H6("╯","+"),r40=H6("╰","+"),o40=H6("╭","+"),a40=H6("●","•"),s40=H6("◆","*"),t40=H6("▲","!"),e40=H6("■","x");$$0=[o40,i40,r40,n40],J$0=[jrA,c40,$F,d40];KkB=[`${v0("dim","↑/↓")} to navigate`,`${v0("dim","Space:")} select`,`${v0("dim","Enter:")} confirm`],x={message:(A=[],{symbol:Q=v0("gray",u$),secondarySymbol:B=v0("gray",u$),output:$=process.stdout,spacing:J=1,withGuide:Y}={})=>{let X=[],Z=Y??P5.withGuide,G=Z?B:"",K=Z?`${Q} `:"",W=Z?`${B} `:"";for(let F=0;F<J;F++)X.push(G);let H=Array.isArray(A)?A:A.split(`
|
|
73
73
|
`);if(H.length>0){let[F,...D]=H;F.length>0?X.push(`${K}${F}`):X.push(Z?Q:"");for(let q of D)q.length>0?X.push(`${W}${q}`):X.push(Z?B:"")}$.write(`${X.join(`
|
|
74
74
|
`)}
|
|
75
|
-
`)},info:(A,Q)=>{x.message(A,{...Q,symbol:v0("blue",a40)})},success:(A,Q)=>{x.message(A,{...Q,symbol:v0("green",s40)})},step:(A,Q)=>{x.message(A,{...Q,symbol:v0("green",g2A)})},warn:(A,Q)=>{x.message(A,{...Q,symbol:v0("yellow",t40)})},warning:(A,Q)=>{x.warn(A,Q)},error:(A,Q)=>{x.message(A,{...Q,symbol:v0("red",e40)})}},WkB={light:H6("─","-"),heavy:H6("━","="),block:H6("█","#")},Z$0=[`${v0("dim","↑/↓")} to navigate`,`${v0("dim","Enter:")} confirm`],HkB=`${v0("gray",u$)} `});var _rA=$A((UkB,G$0)=>{G$0.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var X_=$A((h2A)=>{var TrA=_rA(),eJ=process.env;Object.defineProperty(h2A,"_vendors",{value:TrA.map(function(A){return A.constant})});h2A.name=null;h2A.isPR=null;h2A.id=null;if(eJ.CI!=="false")TrA.forEach(function(A){let B=(Array.isArray(A.env)?A.env:[A.env]).every(function($){return PrA($)});if(h2A[A.constant]=B,!B)return;h2A.name=A.name,h2A.isPR=K$0(A),h2A.id=A.constant});h2A.isCI=!!(eJ.CI!=="false"&&(eJ.BUILD_ID||eJ.BUILD_NUMBER||eJ.CI||eJ.CI_APP_ID||eJ.CI_BUILD_ID||eJ.CI_BUILD_NUMBER||eJ.CI_NAME||eJ.CONTINUOUS_INTEGRATION||eJ.RUN_ID||h2A.name||!1));function PrA(A){if(typeof A==="string")return!!eJ[A];if("env"in A)return eJ[A.env]&&eJ[A.env].includes(A.includes);if("any"in A)return A.any.some(function(Q){return!!eJ[Q]});return Object.keys(A).every(function(Q){return eJ[Q]===A[Q]})}function K$0(A){switch(typeof A.pr){case"string":return!!eJ[A.pr];case"object":if("env"in A.pr)if("any"in A.pr)return A.pr.any.some(function(Q){return eJ[A.pr.env]===Q});else return A.pr.env in eJ&&eJ[A.pr.env]!==A.pr.ne;else if("any"in A.pr)return A.pr.any.some(function(Q){return!!eJ[Q]});else return PrA(A.pr);default:return null}}});var B8;var YX=b(()=>{B8={name:"@capgo/cli",type:"module",version:"8.98.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/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",typecheck:"tsc --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","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:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.mjs","test:key-create-mode":"bun test/test-key-create-mode.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:offline-packers":"bun test/test-offline-packers.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:capgo-app-id-prompt":"bun test/test-capgo-app-id-prompt.mjs","test:bundle-soft-delete":"bun test/test-bundle-soft-delete.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs && bun test/test-android-select-guard.mjs","test:android-keystore-action":"bun test/test-android-keystore-action.mjs","test:android-google-play-action":"bun test/test-android-google-play-action.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:api-perf":"bun test/test-api-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.test.ts","test:bundle-single-requests":"bun test test/test-bundle-single-requests.test.ts","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-host-fields":"bun test/test-mcp-host-fields.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list":"bun test/test-app-list.mjs","test:app-todo":"bun test/test-app-todo.mjs && bun test/test-builder-only-checklist.mjs && bun test/test-builder-only-setup.mjs && bun test/test-app-todo-lists.mjs && bun test/test-app-todo-tabs.mjs && bun test/test-app-todo-command.mjs && node test/test-app-todo-interactive.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-capgo-client":"bun test/test-create-capgo-client.mjs","test:no-supabase-sdk":"bun test/test-no-supabase-sdk.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-command-execution":"bun test/test-init-command-execution.mjs","test:init-upload-recovery":"bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-ota-checklist":"bun test/test-init-ota-checklist.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:builder-app-id-config":"bun test/test-builder-app-id-config.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:cordova-upload-mode":"bun test/test-cordova-upload-mode.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:builder-app-id-config && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs && bun test/test-auth-session-bad-key.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.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:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs && bun test/test-build-env.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-certificate-action":"bun test/test-ios-certificate-action.mjs","test:ios-profile-action":"bun test/test-ios-profile-action.mjs","test:ios-credential-action":"bun test/test-ios-credential-action.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun scripts/run-test-suite.ts","test:run":"bun scripts/run-test-suite.ts","test:serial":"bun run build && bun scripts/run-test-suite.ts --serial","test:suite":"bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:cordova-upload-mode && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:key-create-mode && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:offline-packers && bun run test:checksum && bun run test:build-needed && bun run test:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && bun run test:ci-prompts && bun run test:capgo-app-id-prompt && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:android-keystore-action && bun run test:android-google-play-action && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:api-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:bundle-single-requests && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-host-fields && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-capgo-client && bun run test:bundle-soft-delete && bun run test:no-supabase-sdk && bun run test:build-platform-selection && bun run test:builder-project-discovery && bun run test:builder-app-selection && bun run test:builder-login-gate && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-command-execution && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:init-ota-checklist && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:support && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-certificate-action && bun run test:ios-profile-action && bun run test:ios-credential-action && bun run test:ios-e2e && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:retryable-capgo-api-error && bun run test:organization-set-api-host && bun run test:plan-validation && bun run test:setup-notices && bun run test:settings-parity && bun run test:init-browser-login && bun run test:android-onboarding-units && bun run test:build-credentials-units && bun run test:onboarding-generators && bun run test:mcp-onboarding","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:builder-app-selection":"bun test/test-builder-app-selection.mjs","test:builder-login-gate":"bun test/test-builder-login-gate.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support":"bun test/test-support.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs","test:settings-parity":"bun test/test-settings-parity.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:retryable-capgo-api-error":"bun test/test-retryable-capgo-api-error.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:plan-validation":"bun test/test-plan-validation.mjs && bun test ./test/test-direct-offer-plan.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs","test:init-browser-login":"bun test test/init/","test:android-onboarding-units":"bun test/test-android-gradle.mjs && bun test/test-android-keystore.mjs && bun test/test-android-oauth.mjs && bun test/test-android-play.mjs && bun test/test-android-tui-sequencing.mjs","test:build-credentials-units":"bun test/test-credentials-migration.mjs && bun test/test-provisioning-map-validation.mjs && bun test/test-mobileprovision-parser.mjs","test:onboarding-generators":"bun test/test-diff-utils.mjs && bun test/test-workflow-generator.mjs","test:mcp-onboarding":"bun test/test-mcp-onboarding.mjs","test:setup-notices":"bun test ./test/test-setup-notices.mjs ./test/test-setup-progress-request.mjs ./test/test-setup-notice-background.mjs ./test/test-init-completion-notice.mjs && bun test ./test/test-builder-setup-notice.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.5.4"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@sinonjs/fake-timers":"15.4.0","@std/semver":"npm:@jsr/std__semver@1.0.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/cross-spawn":"^6.0.6","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native":"npm:typescript@7.1.0-beta","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0","cross-spawn":"^7.0.6",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});import{AsyncLocalStorage as I$0}from"node:async_hooks";function O$0(){return M$0.getStore()}function Qg(){grA=!0}function yrA(){return grA}function urA(A){hrA=A}function frA(A){try{hrA?.(A)}catch{}}function crA(A,Q){let B;try{B=new URL(A).pathname}catch{B=A.split("?")[0]}let $=[];for(let J of B.split("/").filter(Boolean)){if($.length>=4||!/^(?:[a-z_-]+|2fa)$/.test(J))break;$.push(J)}return`${Q} ${$.join("/")||B}`}function L$0(A){let Q=A?.headers;if(!Q)return;let B=Q.get;if(typeof B==="function")return B.call(Q,"capgkey")??void 0;if(Array.isArray(Q))return Q.find(([$])=>$.toLowerCase()==="capgkey")?.[1];return Q.capgkey}function drA(A){return async(B,$)=>{let J=($?.method??"GET").toUpperCase(),Y=typeof B==="string"?B:B instanceof URL?B.href:B.url,X=O$0(),Z=L$0($),G=Date.now();try{let K=await globalThis.fetch(B,$);return frA({url:Y,route:A,method:J,status:K.status,ok:K.ok,durationMs:Date.now()-G,source:X,apikey:Z}),K}catch(K){throw frA({url:Y,route:A,method:J,status:0,ok:!1,durationMs:Date.now()-G,source:X,apikey:Z,error:K}),K}}}var M$0,grA=!1,hrA,mrA=5000;var Bg=b(()=>{M$0=new I$0});var gA;var U1=b(()=>{gA=class gA extends Error{context;constructor(A,Q,B){super(A,B!==void 0?{cause:B}:void 0);this.name="CliUserError",this.context=Q}}});import{platform as N$0}from"node:os";import{version as V$0}from"node:process";function irA(A){prA=A}function E$0(A){for(let Q=0;Q<A.length;Q++)if(A.charCodeAt(Q)>255)return!1;return!0}function lrA(A){if(A.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function R$0(A){if(A.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if(A.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function p2A(A,Q){if(Q===void 0||Q===null){if(l2A.has(A.toLowerCase()))throw new gA(lrA(A));throw new gA(`HTTP header "${A}" is missing or invalid.`)}if(typeof Q!=="string"){if(l2A.has(A.toLowerCase()))throw new gA(lrA(A));throw new gA(`HTTP header "${A}" is missing or invalid.`)}if(!E$0(Q)){if(l2A.has(A.toLowerCase()))throw new gA(R$0(A));throw new gA(`HTTP header "${A}" contains invalid characters (only ASCII is allowed).`)}return Q}function A4(A){let Q={capgo_api:C$0,"x-cli-version":B8.version,"x-cli-command":prA,"x-cli-node":V$0,"x-cli-os":N$0()};if(A)for(let[B,$]of Object.entries(A))Q[B]=p2A(B,$);return Q}var C$0="2025-10-01",prA="",l2A;var PY=b(()=>{YX();U1();l2A=new Set(["authorization","capgkey","x-capgo-log-token"])});function nrA(A){let Q=A;if(typeof Q.status==="number")return Q.status;let B=Q.context&&typeof Q.context==="object"?Q.context.status:void 0;return typeof B==="number"?B:void 0}function j$0(A){if(!A||typeof A!=="object")return;let Q=nrA(A);if(Q!==void 0)return Q;let B=A.cause;if(B&&typeof B==="object")return nrA(B);return}function w$0(A){let Q=[],B=new Set,$=A;if(typeof A==="string")return A;while($){if(typeof $==="string"){Q.push($);break}if(typeof $!=="object")break;if(B.has($))break;if(B.add($),$ instanceof Error){Q.push($.message),$=$.cause;continue}let J=$;if(typeof J.message==="string")Q.push(J.message);$=J.cause}return Q.join(" ")}function _$0(A){return w$0(A)}function cV(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=j$0(A);if(Q!==void 0){if(Q===401)return"unauthorized";if(Q===403)return"forbidden";if(Q===404)return"not_found";if(Q===413)return"payload_too_large";if(Q===429)return"rate_limited";if(Q>=500)return"server_error"}let B=_$0(A).toLowerCase();if(/econnrefused|econnreset|enotfound|eai_again|fetch failed|failed to fetch|connect timeout|und_err/.test(B))return"network_error";if(/timed out|timeout|etimedout|aborted/.test(B))return"timeout";if(/invalid|must be|required|not allowed|malformed|validation/.test(B))return"validation_error";return"unknown"}function rrA(A){if(A===401)return"unauthorized";if(A===403)return"forbidden";if(A===404)return"not_found";if(A===408||A===504)return"timeout";if(A===413)return"payload_too_large";if(A===429)return"rate_limited";if(A===400||A===422)return"validation_error";if(A>=500)return"server_error";return"unknown"}function XX(A){let Q=A.length;while(Q>0&&A[Q-1]==="/")Q-=1;return A.slice(0,Q)}import{randomUUID as arA}from"node:crypto";import{existsSync as S$0,mkdirSync as k$0,readFileSync as b$0,writeFileSync as x$0}from"node:fs";import{homedir as r2A,platform as v$0,release as f$0}from"node:os";import{join as srA}from"node:path";import{arch as g$0,cwd as trA,env as dV,version as y$0}from"node:process";function L2(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function d$0(){if(L2(dV.CAPGO_DISABLE_TELEMETRY)||L2(dV.CAPGO_DISABLE_POSTHOG))return;return dV.CAPGO_CLI_POSTHOG_API_KEY?.trim()||dV.POSTHOG_API_KEY?.trim()||u$0}function l$0(A){let Q=XX(A);if(Q.endsWith("/i/v0/e"))return`${Q}/`;let B=Q.replace(/\/capture$/,"/");return new URL("i/v0/e/",B.endsWith("/")?B:`${B}/`).toString()}function p$0(A){if(A instanceof Error)return{cause:A.cause,message:A.message,name:A.name||"Error",stack:A.stack};if(typeof A==="string")return{message:A,name:"Error",stack:void 0};try{return{message:JSON.stringify(A)??String(A),name:"Error",stack:void 0}}catch{return{message:String(A),name:"Error",stack:void 0}}}function i$0(A){let Q=A,B=trA(),$=r2A();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function n$0(A){let Q=A,B=trA(),$=r2A();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q.replace(/<cwd>\/[^\s"',)]+/g,"<cwd>/<path>").replace(/~\/[^\s"',)]+/g,"~/<path>").replace(/[\w.%+-]+@[\w.-]+\.[A-Z]{2,}/gi,"<email>").replace(/(https?:\/\/)([^/\s:@]+):([^/\s@]+)@/gi,"$1<redacted>@").replace(/\b[a-z][\w-]*(?:\.[\w-]+){1,}\b/gi,"<app_id>").replace(/\b[a-z]:\\[^\s"',)]+/gi,"<path>").replace(/(^|[\s"'(])\/[^\s"',)]+/g,"$1<path>").replace(/(--(?:token|api[-_]?key|key|password|secret|private[-_]?key|jwt|session|auth)(?:=|\s+))("[^"]+"|'[^']+'|\S+)/gi,"$1<redacted>").replace(/\b((?:token|api[-_]?key|password|secret|authorization)\s*[:=]\s*)[^\s,;]+/gi,"$1<redacted>")}function r$0(A,Q){let B=A?.split(`
|
|
75
|
+
`)},info:(A,Q)=>{x.message(A,{...Q,symbol:v0("blue",a40)})},success:(A,Q)=>{x.message(A,{...Q,symbol:v0("green",s40)})},step:(A,Q)=>{x.message(A,{...Q,symbol:v0("green",g2A)})},warn:(A,Q)=>{x.message(A,{...Q,symbol:v0("yellow",t40)})},warning:(A,Q)=>{x.warn(A,Q)},error:(A,Q)=>{x.message(A,{...Q,symbol:v0("red",e40)})}},WkB={light:H6("─","-"),heavy:H6("━","="),block:H6("█","#")},Z$0=[`${v0("dim","↑/↓")} to navigate`,`${v0("dim","Enter:")} confirm`],HkB=`${v0("gray",u$)} `});var _rA=$A((UkB,G$0)=>{G$0.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var X_=$A((h2A)=>{var TrA=_rA(),eJ=process.env;Object.defineProperty(h2A,"_vendors",{value:TrA.map(function(A){return A.constant})});h2A.name=null;h2A.isPR=null;h2A.id=null;if(eJ.CI!=="false")TrA.forEach(function(A){let B=(Array.isArray(A.env)?A.env:[A.env]).every(function($){return PrA($)});if(h2A[A.constant]=B,!B)return;h2A.name=A.name,h2A.isPR=K$0(A),h2A.id=A.constant});h2A.isCI=!!(eJ.CI!=="false"&&(eJ.BUILD_ID||eJ.BUILD_NUMBER||eJ.CI||eJ.CI_APP_ID||eJ.CI_BUILD_ID||eJ.CI_BUILD_NUMBER||eJ.CI_NAME||eJ.CONTINUOUS_INTEGRATION||eJ.RUN_ID||h2A.name||!1));function PrA(A){if(typeof A==="string")return!!eJ[A];if("env"in A)return eJ[A.env]&&eJ[A.env].includes(A.includes);if("any"in A)return A.any.some(function(Q){return!!eJ[Q]});return Object.keys(A).every(function(Q){return eJ[Q]===A[Q]})}function K$0(A){switch(typeof A.pr){case"string":return!!eJ[A.pr];case"object":if("env"in A.pr)if("any"in A.pr)return A.pr.any.some(function(Q){return eJ[A.pr.env]===Q});else return A.pr.env in eJ&&eJ[A.pr.env]!==A.pr.ne;else if("any"in A.pr)return A.pr.any.some(function(Q){return!!eJ[Q]});else return PrA(A.pr);default:return null}}});var B8;var YX=b(()=>{B8={name:"@capgo/cli",type:"module",version:"8.98.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/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",typecheck:"tsc --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","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:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.mjs","test:key-create-mode":"bun test/test-key-create-mode.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:offline-packers":"bun test/test-offline-packers.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:capgo-app-id-prompt":"bun test/test-capgo-app-id-prompt.mjs","test:bundle-soft-delete":"bun test/test-bundle-soft-delete.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs && bun test/test-android-select-guard.mjs","test:android-keystore-action":"bun test/test-android-keystore-action.mjs","test:android-google-play-action":"bun test/test-android-google-play-action.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:api-perf":"bun test/test-api-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.test.ts","test:bundle-single-requests":"bun test test/test-bundle-single-requests.test.ts","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-host-fields":"bun test/test-mcp-host-fields.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list":"bun test/test-app-list.mjs","test:app-todo":"bun test/test-app-todo.mjs && bun test/test-builder-only-checklist.mjs && bun test/test-builder-only-setup.mjs && bun test/test-app-todo-lists.mjs && bun test/test-app-todo-tabs.mjs && bun test/test-app-todo-command.mjs && node test/test-app-todo-interactive.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-capgo-client":"bun test/test-create-capgo-client.mjs","test:no-supabase-sdk":"bun test/test-no-supabase-sdk.mjs","test:no-redirect-error":"bun test/test-no-redirect-error.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-command-execution":"bun test/test-init-command-execution.mjs","test:init-upload-recovery":"bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-ota-checklist":"bun test/test-init-ota-checklist.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:builder-app-id-config":"bun test/test-builder-app-id-config.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:cordova-upload-mode":"bun test/test-cordova-upload-mode.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:builder-app-id-config && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs && bun test/test-auth-session-bad-key.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.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:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs && bun test/test-build-env.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-certificate-action":"bun test/test-ios-certificate-action.mjs","test:ios-profile-action":"bun test/test-ios-profile-action.mjs","test:ios-credential-action":"bun test/test-ios-credential-action.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun scripts/run-test-suite.ts","test:run":"bun scripts/run-test-suite.ts","test:serial":"bun run build && bun scripts/run-test-suite.ts --serial","test:suite":"bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:cordova-upload-mode && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:key-create-mode && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:offline-packers && bun run test:checksum && bun run test:build-needed && bun run test:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && bun run test:ci-prompts && bun run test:capgo-app-id-prompt && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:android-keystore-action && bun run test:android-google-play-action && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:api-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:bundle-single-requests && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-host-fields && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-capgo-client && bun run test:bundle-soft-delete && bun run test:no-supabase-sdk && bun run test:no-redirect-error && bun run test:build-platform-selection && bun run test:builder-project-discovery && bun run test:builder-app-selection && bun run test:builder-login-gate && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-command-execution && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:init-ota-checklist && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:support && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-certificate-action && bun run test:ios-profile-action && bun run test:ios-credential-action && bun run test:ios-e2e && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:retryable-capgo-api-error && bun run test:organization-set-api-host && bun run test:plan-validation && bun run test:setup-notices && bun run test:settings-parity && bun run test:init-browser-login && bun run test:android-onboarding-units && bun run test:build-credentials-units && bun run test:onboarding-generators && bun run test:mcp-onboarding","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:builder-app-selection":"bun test/test-builder-app-selection.mjs","test:builder-login-gate":"bun test/test-builder-login-gate.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support":"bun test/test-support.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs","test:settings-parity":"bun test/test-settings-parity.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:retryable-capgo-api-error":"bun test/test-retryable-capgo-api-error.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:plan-validation":"bun test/test-plan-validation.mjs && bun test ./test/test-direct-offer-plan.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs","test:init-browser-login":"bun test test/init/","test:android-onboarding-units":"bun test/test-android-gradle.mjs && bun test/test-android-keystore.mjs && bun test/test-android-oauth.mjs && bun test/test-android-play.mjs && bun test/test-android-tui-sequencing.mjs","test:build-credentials-units":"bun test/test-credentials-migration.mjs && bun test/test-provisioning-map-validation.mjs && bun test/test-mobileprovision-parser.mjs","test:onboarding-generators":"bun test/test-diff-utils.mjs && bun test/test-workflow-generator.mjs","test:mcp-onboarding":"bun test/test-mcp-onboarding.mjs","test:setup-notices":"bun test ./test/test-setup-notices.mjs ./test/test-setup-progress-request.mjs ./test/test-setup-notice-background.mjs ./test/test-init-completion-notice.mjs && bun test ./test/test-builder-setup-notice.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.5.4"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@sinonjs/fake-timers":"15.4.0","@std/semver":"npm:@jsr/std__semver@1.0.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/cross-spawn":"^6.0.6","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native":"npm:typescript@7.1.0-beta","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0","cross-spawn":"^7.0.6",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});import{AsyncLocalStorage as I$0}from"node:async_hooks";function O$0(){return M$0.getStore()}function Qg(){grA=!0}function yrA(){return grA}function urA(A){hrA=A}function frA(A){try{hrA?.(A)}catch{}}function crA(A,Q){let B;try{B=new URL(A).pathname}catch{B=A.split("?")[0]}let $=[];for(let J of B.split("/").filter(Boolean)){if($.length>=4||!/^(?:[a-z_-]+|2fa)$/.test(J))break;$.push(J)}return`${Q} ${$.join("/")||B}`}function L$0(A){let Q=A?.headers;if(!Q)return;let B=Q.get;if(typeof B==="function")return B.call(Q,"capgkey")??void 0;if(Array.isArray(Q))return Q.find(([$])=>$.toLowerCase()==="capgkey")?.[1];return Q.capgkey}function drA(A){return async(B,$)=>{let J=($?.method??"GET").toUpperCase(),Y=typeof B==="string"?B:B instanceof URL?B.href:B.url,X=O$0(),Z=L$0($),G=Date.now();try{let K=await globalThis.fetch(B,$);return frA({url:Y,route:A,method:J,status:K.status,ok:K.ok,durationMs:Date.now()-G,source:X,apikey:Z}),K}catch(K){throw frA({url:Y,route:A,method:J,status:0,ok:!1,durationMs:Date.now()-G,source:X,apikey:Z,error:K}),K}}}var M$0,grA=!1,hrA,mrA=5000;var Bg=b(()=>{M$0=new I$0});var gA;var U1=b(()=>{gA=class gA extends Error{context;constructor(A,Q,B){super(A,B!==void 0?{cause:B}:void 0);this.name="CliUserError",this.context=Q}}});import{platform as N$0}from"node:os";import{version as V$0}from"node:process";function irA(A){prA=A}function E$0(A){for(let Q=0;Q<A.length;Q++)if(A.charCodeAt(Q)>255)return!1;return!0}function lrA(A){if(A.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function R$0(A){if(A.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if(A.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function p2A(A,Q){if(Q===void 0||Q===null){if(l2A.has(A.toLowerCase()))throw new gA(lrA(A));throw new gA(`HTTP header "${A}" is missing or invalid.`)}if(typeof Q!=="string"){if(l2A.has(A.toLowerCase()))throw new gA(lrA(A));throw new gA(`HTTP header "${A}" is missing or invalid.`)}if(!E$0(Q)){if(l2A.has(A.toLowerCase()))throw new gA(R$0(A));throw new gA(`HTTP header "${A}" contains invalid characters (only ASCII is allowed).`)}return Q}function A4(A){let Q={capgo_api:C$0,"x-cli-version":B8.version,"x-cli-command":prA,"x-cli-node":V$0,"x-cli-os":N$0()};if(A)for(let[B,$]of Object.entries(A))Q[B]=p2A(B,$);return Q}var C$0="2025-10-01",prA="",l2A;var PY=b(()=>{YX();U1();l2A=new Set(["authorization","capgkey","x-capgo-log-token"])});function nrA(A){let Q=A;if(typeof Q.status==="number")return Q.status;let B=Q.context&&typeof Q.context==="object"?Q.context.status:void 0;return typeof B==="number"?B:void 0}function j$0(A){if(!A||typeof A!=="object")return;let Q=nrA(A);if(Q!==void 0)return Q;let B=A.cause;if(B&&typeof B==="object")return nrA(B);return}function w$0(A){let Q=[],B=new Set,$=A;if(typeof A==="string")return A;while($){if(typeof $==="string"){Q.push($);break}if(typeof $!=="object")break;if(B.has($))break;if(B.add($),$ instanceof Error){Q.push($.message),$=$.cause;continue}let J=$;if(typeof J.message==="string")Q.push(J.message);$=J.cause}return Q.join(" ")}function _$0(A){return w$0(A)}function cV(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=j$0(A);if(Q!==void 0){if(Q===401)return"unauthorized";if(Q===403)return"forbidden";if(Q===404)return"not_found";if(Q===413)return"payload_too_large";if(Q===429)return"rate_limited";if(Q>=500)return"server_error"}let B=_$0(A).toLowerCase();if(/econnrefused|econnreset|enotfound|eai_again|fetch failed|failed to fetch|connect timeout|und_err/.test(B))return"network_error";if(/timed out|timeout|etimedout|aborted/.test(B))return"timeout";if(/invalid|must be|required|not allowed|malformed|validation/.test(B))return"validation_error";return"unknown"}function rrA(A){if(A===401)return"unauthorized";if(A===403)return"forbidden";if(A===404)return"not_found";if(A===408||A===504)return"timeout";if(A===413)return"payload_too_large";if(A===429)return"rate_limited";if(A===400||A===422)return"validation_error";if(A>=500)return"server_error";return"unknown"}function XX(A){let Q=A.length;while(Q>0&&A[Q-1]==="/")Q-=1;return A.slice(0,Q)}import{randomUUID as arA}from"node:crypto";import{existsSync as S$0,mkdirSync as k$0,readFileSync as b$0,writeFileSync as x$0}from"node:fs";import{homedir as r2A,platform as v$0,release as f$0}from"node:os";import{join as srA}from"node:path";import{arch as g$0,cwd as trA,env as dV,version as y$0}from"node:process";function L2(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function d$0(){if(L2(dV.CAPGO_DISABLE_TELEMETRY)||L2(dV.CAPGO_DISABLE_POSTHOG))return;return dV.CAPGO_CLI_POSTHOG_API_KEY?.trim()||dV.POSTHOG_API_KEY?.trim()||u$0}function l$0(A){let Q=XX(A);if(Q.endsWith("/i/v0/e"))return`${Q}/`;let B=Q.replace(/\/capture$/,"/");return new URL("i/v0/e/",B.endsWith("/")?B:`${B}/`).toString()}function p$0(A){if(A instanceof Error)return{cause:A.cause,message:A.message,name:A.name||"Error",stack:A.stack};if(typeof A==="string")return{message:A,name:"Error",stack:void 0};try{return{message:JSON.stringify(A)??String(A),name:"Error",stack:void 0}}catch{return{message:String(A),name:"Error",stack:void 0}}}function i$0(A){let Q=A,B=trA(),$=r2A();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function n$0(A){let Q=A,B=trA(),$=r2A();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q.replace(/<cwd>\/[^\s"',)]+/g,"<cwd>/<path>").replace(/~\/[^\s"',)]+/g,"~/<path>").replace(/[\w.%+-]+@[\w.-]+\.[A-Z]{2,}/gi,"<email>").replace(/(https?:\/\/)([^/\s:@]+):([^/\s@]+)@/gi,"$1<redacted>@").replace(/\b[a-z][\w-]*(?:\.[\w-]+){1,}\b/gi,"<app_id>").replace(/\b[a-z]:\\[^\s"',)]+/gi,"<path>").replace(/(^|[\s"'(])\/[^\s"',)]+/g,"$1<path>").replace(/(--(?:token|api[-_]?key|key|password|secret|private[-_]?key|jwt|session|auth)(?:=|\s+))("[^"]+"|'[^']+'|\S+)/gi,"$1<redacted>").replace(/\b((?:token|api[-_]?key|password|secret|authorization)\s*[:=]\s*)[^\s,;]+/gi,"$1<redacted>")}function r$0(A,Q){let B=A?.split(`
|
|
76
76
|
`).slice(1).map(($)=>{let J=$.trim(),Y=J.startsWith("at ")?J.slice(3):J,X=Q,Z=Y,G=Y.lastIndexOf(" (");if(G!==-1&&Y.endsWith(")"))X=Y.slice(0,G).trim()||Q,Z=Y.slice(G+2,-1);else{let H=Y.lastIndexOf(" "),F=H===-1?"":Y.slice(H+1);if(/:\d+:\d+$/.test(F))X=Y.slice(0,H).trim()||Q,Z=F}let K=Z.lastIndexOf(":"),W=K===-1?-1:Z.lastIndexOf(":",K-1);if(K===-1||W===-1)return{function:Q,platform:"custom",lang:"javascript"};return{function:X,filename:i$0(Z.slice(0,W)),lineno:Number.parseInt(Z.slice(W+1,K),10),colno:Number.parseInt(Z.slice(K+1),10),platform:"custom",lang:"javascript"}}).filter(Boolean);return B&&B.length>0?B:[{function:Q,platform:"custom",lang:"javascript"}]}function o$0(A){if(!A||typeof A!=="object"||!("code"in A))return;let{code:Q}=A;return typeof Q==="string"?Q:void 0}function s$0(A){if(!A||typeof A!=="object")return;let Q=A;if(typeof Q.status==="number")return Q.status;if(typeof Q.statusCode==="number")return Q.statusCode;let B=Q.context&&typeof Q.context==="object"?Q.context.status:void 0;return typeof B==="number"?B:void 0}function t$0(A){let Q=(A instanceof Error?A.message:typeof A==="string"?A:"").toLowerCase();if(a$0.some((B)=>Q.includes(B)))return!0;return s$0(A)===401}function $g(A){if(A instanceof gA){if(c$0.has(A.message))return!0;return!1}if(t$0(A))return!1;return!o$0(A)?.startsWith("commander.")}function $t(A){let Q=[],B=A;while(B?.parent){let $=B.name();if($)Q.push($);B=B.parent}return Q.reverse().join(" ")||"unknown"}function e$0(A=srA(r2A(),".capgo-credentials")){if(n2A)return n2A;let Q=srA(A,"install-id"),B;try{let $=S$0(Q)?b$0(Q,"utf8").trim():"";if($)B=$;else B=arA(),k$0(A,{recursive:!0}),x$0(Q,B,{encoding:"utf8",mode:384})}catch{B=arA()}return n2A=B,B}async function Jg(A){let Q=d$0();if(!Q)return!1;let B=dV.CAPGO_CLI_POSTHOG_API_HOST?.trim()||dV.POSTHOG_API_HOST?.trim()||h$0,$;try{$=l$0(B)}catch{return!1}let J=p$0(A.error),Y=n$0(J.message),X=e$0(),Z=r$0(J.stack,A.functionName),G=[A.functionName,A.kind,J.name||"Error",String(A.status??1)].join(":"),K={token:Q,event:"$exception",properties:{distinct_id:X,$exception_list:[{type:J.name||"Error",value:Y,mechanism:{handled:!0,synthetic:!1},stacktrace:{type:"raw",frames:Z}}],$exception_fingerprint:G,architecture:g$0,cli_version:B8.version,error_kind:A.kind,function_name:A.functionName,is_ci:Boolean(dV.CI),node_version:y$0,os_platform:v$0(),os_release:f$0(),runtime:"cli",status:A.status},timestamp:new Date().toISOString()};try{let W=new AbortController,H=setTimeout(()=>W.abort(),m$0);try{return(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K),signal:W.signal})).ok}finally{clearTimeout(H)}}catch{return!1}}var h$0="https://eu.i.posthog.com/i/v0/e/",u$0="phc_NXDyDajQaTQVwb25DEhIVZfxVUn4R0Y348Z7vWYHZUi",m$0=1500,o2A="iOS sync validation failed. Delete your iOS folder, then rerun the add and sync commands above and retry.",c$0,a$0,n2A;var Z_=b(()=>{YX();U1();c$0=new Set([o2A]);a$0=["invalid_apikey","invalid apikey","no_key_provided","no key provided","invalid api key or insufficient permissions","does not exist, run first"]});import{existsSync as UG}from"fs";var JF=(A=".",Q="unknown")=>{let B=`${A}/bun.lockb`,$=`${A}/bun.lock`,J=`${A}/pnpm-lock.yaml`,Y=`${A}/shrinkwrap.yaml`,X=`${A}/yarn.lock`,Z=`${A}/package-lock.json`,G=`${A}/npm-shrinkwrap.json`;if(UG(B)||UG($))return"bun";if(UG(J)||UG(Y))return"pnpm";if(UG(X))return"yarn";if(UG(Z)||UG(G))return"npm";return Q},FM=(A=JF(),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"}},Jt=(A=".",Q="npx")=>{let B=`${A}/bun.lockb`,$=`${A}/bun.lock`,J=`${A}/pnpm-lock.yaml`,Y=`${A}/shrinkwrap.yaml`,X=`${A}/yarn.lock`,Z=`${A}/package-lock.json`,G=`${A}/npm-shrinkwrap.json`;if(UG(B)||UG($))return"bunx";if(UG(J)||UG(Y))return"pnpm exec";if(UG(X))return"yarn dlx";if(UG(Z)||UG(G))return"npx";return Q};var Yg=()=>{};function Yt(A,Q){if(isNaN(A)||isNaN(Q))throw Error("Cannot compare against non-numbers");return A===Q?0:A<Q?-1:1}function QoA(A=[],Q=[]){if(A.length&&!Q.length)return-1;if(!A.length&&Q.length)return 1;return 0}function Xt(A=[],Q=[]){let B=Math.max(A.length,Q.length);for(let $=0;$<B;$++){let J=A[$],Y=Q[$];if(J===void 0&&Y===void 0)return 0;if(Y===void 0)return 1;if(J===void 0)return-1;if(typeof J==="string"&&typeof Y==="number")return 1;if(typeof J==="number"&&typeof Y==="string")return-1;if(J<Y)return-1;if(J>Y)return 1}return 0}function s2A(A){return typeof A==="number"&&!Number.isNaN(A)&&(!Number.isFinite(A)||0<=A&&A<=Number.MAX_SAFE_INTEGER)}function qG(A){return A.split(".").filter(Boolean).map((Q)=>{if($80.test(Q)){let B=Number(Q);if(s2A(B))return B}return Q})}function YF(A){return A.split(".").filter(Boolean)}function Gt(A,Q){let B=Number(A);if(!s2A(B))throw TypeError(Q);return B}function tU(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 G_="0|[1-9]\\d*",A80="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Q80,erA,BoA,AoA="[0-9A-Za-z-]+",$oA,JoA,YoA,XoA="(?:<|>)?=?",B80="x|X|\\*",a2A,Zt,ZoA,GoA,t2A=256,$80;var LK=b(()=>{Q80=`(?<major>${G_})\\.(?<minor>${G_})\\.(?<patch>${G_})`,erA=`(?:${G_}|${A80})`,BoA=`(?:-(?<prerelease>${erA}(?:\\.${erA})*))`,$oA=`(?:\\+(?<buildmetadata>${AoA}(?:\\.${AoA})*))`,JoA=`v?${Q80}${BoA}?${$oA}?`,YoA=new RegExp(`^${JoA}$`),a2A=`${G_}|${B80}`,Zt=`[v=\\s]*(?<major>${a2A})(?:\\.(?<minor>${a2A})(?:\\.(?<patch>${a2A})${BoA}?${$oA}?)?)?`,ZoA=new RegExp(`^(?<operator>~>?|\\^|${XoA})\\s*${Zt}$`),GoA=new RegExp(`^(?<operator>${XoA})\\s*(${JoA})$|^$`);$80=new RegExp(`^${G_}$`)});function DG(A,Q){if(A===Q)return 0;return Yt(A.major,Q.major)||Yt(A.minor,Q.minor)||Yt(A.patch,Q.patch)||QoA(A.prerelease,Q.prerelease)||Xt(A.prerelease,Q.prerelease)}var SW=b(()=>{LK()});function KoA(A,Q){let B=A.prerelease?.length||Q.prerelease?.length;if(A.major!==Q.major)return B?"premajor":"major";if(A.minor!==Q.minor)return B?"preminor":"minor";if(A.patch!==Q.patch)return B?"prepatch":"patch";if(Xt(A.prerelease,Q.prerelease)!==0)return"prerelease"}var WoA=b(()=>{LK()});function e2A(A){return A.toFixed(0)}function QZ(A){let Q=e2A(A.major),B=e2A(A.minor),$=e2A(A.patch),J=A.prerelease?.join(".")??"",Y=A.build?.join(".")??"";return[[`${Q}.${B}.${$}`,J].filter((G)=>G).join("-"),Y].filter((G)=>G).join("+")}function J80(A,Q){if(tU(Q))return!0;let B=DG(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 Kt(A,Q){for(let B of Q)if(!J80(A,B))return!1;if(!A.prerelease?.length)return!0;for(let B of Q){if(tU(B))continue;if(!B.prerelease?.length)continue;let{major:$,minor:J,patch:Y}=B;if(A.major===$&&A.minor===J&&A.patch===Y)return!0}return!1}var Wt=b(()=>{LK();SW()});function Xg(A,Q){return Q.some((B)=>Kt(A,B))}var Zg=b(()=>{Wt()});function Y80(A=[]){let Q=[...A],B=Q.length;while(B>=0){let $=Q[B];if(typeof $==="number"){Q[B]=$+1;break}B-=1}if(B===-1)Q.push(0);return Q}function Gg(A=[],Q){let B=Y80(A);if(!Q)return B;let $=qG(Q);if($.every((J)=>typeof J==="string")){if($.every((J,Y)=>J===B[Y])&&typeof B[$.length]==="number")return B;$=[...$,0]}return $}function zM(A,Q,B={}){let $=B.build!==void 0?YF(B.build):A.build??[];switch(Q){case"premajor":return{major:A.major+1,minor:0,patch:0,prerelease:Gg(A.prerelease,B.prerelease),build:$};case"preminor":return{major:A.major,minor:A.minor+1,patch:0,prerelease:Gg(A.prerelease,B.prerelease),build:$};case"prepatch":return{major:A.major,minor:A.minor,patch:A.patch+1,prerelease:Gg(A.prerelease,B.prerelease),build:$};case"prerelease":{let Y=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:Y,prerelease:Gg(A.prerelease,B.prerelease),build:$}}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:$};case"minor":{let Y=(A.prerelease??[]).length===0||A.patch!==0?A.minor+1:A.minor;return{major:A.major,minor:Y,patch:0,prerelease:[],build:$}}case"patch":{let Y=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:Y,prerelease:[],build:$}}case"pre":return{major:A.major,minor:A.minor,patch:A.patch,prerelease:Gg(A.prerelease,B.prerelease),build:$};default:throw TypeError(`Cannot increment version: invalid argument ${Q}`)}}var HoA=b(()=>{LK()});var Ht,K_;var Kg=b(()=>{Ht={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},K_={operator:void 0,...Ht}});var AHA=b(()=>{Kg();LK()});var QHA=b(()=>{SW()});var FoA=b(()=>{Zg();QHA()});function IG(A,Q){return DG(A,Q)<0}var BHA=b(()=>{SW()});var zoA=b(()=>{Zg();BHA()});function X80(A){let B=A.match(GoA)?.groups;if(!B)return null;let{operator:$}=B;return{operator:$||void 0,...Ht}}function m6(A){return!A||A.toLowerCase()==="x"||A==="*"}function Z80(A){if(m6(A.major))return;if(m6(A.minor))return{operator:">=",major:+A.major,minor:0,patch:0,prerelease:[],build:[]};if(m6(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?qG(A.prerelease):[],build:[]}}function G80(A){if(m6(A.major))return;if(m6(A.minor))return{operator:"<",major:+A.major+1,minor:0,patch:0,prerelease:[],build:[]};if(m6(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:qG(A.prerelease),build:[]};return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:[],build:[]}}function K80(A){let Q=A.match(new RegExp(`^${Zt}`)),B=Q?.groups;if(!B)return null;let $=Q[0].length,J=A.slice($).match(/^\s+-\s+/);if(!J)return null;let Y=J[0].length,Z=A.slice($+Y).match(new RegExp(`^${Zt}\\s*$`))?.groups,G=Z80(B),K=G80(Z);return[G,K].filter(Boolean)}function W80(A){let Q=m6(A.major),B=m6(A.minor),$=m6(A.patch),J=+A.major,Y=+A.minor,X=+A.patch;if(Q)return[K_];if(B)return[{operator:">=",major:J,minor:0,patch:0},{operator:"<",major:J+1,minor:0,patch:0}];if($){if(J===0)return[{operator:">=",major:J,minor:Y,patch:0},{operator:"<",major:J,minor:Y+1,patch:0}];return[{operator:">=",major:J,minor:Y,patch:0},{operator:"<",major:J+1,minor:0,patch:0}]}let Z=qG(A.prerelease??"");if(J===0){if(Y===0)return[{operator:">=",major:J,minor:Y,patch:X,prerelease:Z},{operator:"<",major:J,minor:Y,patch:X+1}];return[{operator:">=",major:J,minor:Y,patch:X,prerelease:Z},{operator:"<",major:J,minor:Y+1,patch:0}]}return[{operator:">=",major:J,minor:Y,patch:X,prerelease:Z},{operator:"<",major:J+1,minor:0,patch:0}]}function H80(A){let Q=m6(A.major),B=m6(A.minor),$=m6(A.patch),J=+A.major,Y=+A.minor,X=+A.patch;if(Q)return[K_];if(B)return[{operator:">=",major:J,minor:0,patch:0},{operator:"<",major:J+1,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y,patch:0},{operator:"<",major:J,minor:Y+1,patch:0}];let Z=qG(A.prerelease??"");return[{operator:">=",major:J,minor:Y,patch:X,prerelease:Z},{operator:"<",major:J,minor:Y+1,patch:0}]}function F80(A){let Q=m6(A.major),B=m6(A.minor),$=m6(A.patch),J=+A.major,Y=+A.minor,X=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B){if($)return[{operator:"<",major:J,minor:0,patch:0}];return[{operator:"<",major:J,minor:0,patch:0}]}if($)return[{operator:"<",major:J,minor:Y,patch:0}];let Z=qG(A.prerelease??""),G=YF(A.build??"");return[{operator:"<",major:J,minor:Y,patch:X,prerelease:Z,build:G}]}function z80(A){let Q=m6(A.minor),B=m6(A.patch),$=+A.major,J=+A.minor,Y=+A.patch;if(Q)return[{operator:"<",major:$+1,minor:0,patch:0}];if(B)return[{operator:"<",major:$,minor:J+1,patch:0}];let X=qG(A.prerelease??""),Z=YF(A.build??"");return[{operator:"<=",major:$,minor:J,patch:Y,prerelease:X,build:Z}]}function U80(A){let Q=m6(A.major),B=m6(A.minor),$=m6(A.patch),J=+A.major,Y=+A.minor,X=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B)return[{operator:">=",major:J+1,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y+1,patch:0}];let Z=qG(A.prerelease??""),G=YF(A.build??"");return[{operator:">",major:J,minor:Y,patch:X,prerelease:Z,build:G}]}function q80(A){let Q=m6(A.major),B=m6(A.minor),$=m6(A.patch),J=+A.major,Y=+A.minor,X=+A.patch;if(Q)return[K_];if(B)return[{operator:">=",major:J,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y,patch:0}];let Z=qG(A.prerelease??""),G=YF(A.build??"");return[{operator:">=",major:J,minor:Y,patch:X,prerelease:Z,build:G}]}function D80(A){let Q=m6(A.major),B=m6(A.minor),$=m6(A.patch),J=+A.major,Y=+A.minor,X=+A.patch;if(Q)return[K_];if(B)return[{operator:">=",major:J,minor:0,patch:0},{operator:"<",major:J+1,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y,patch:0},{operator:"<",major:J,minor:Y+1,patch:0}];let Z=qG(A.prerelease??""),G=YF(A.build??"");return[{operator:A.operator==="="?"=":void 0,major:J,minor:Y,patch:X,prerelease:Z,build:G}]}function I80(A){let Q=A.match(ZoA)?.groups;if(!Q)return X80(A);switch(Q.operator){case"^":return W80(Q);case"~":case"~>":return H80(Q);case"<":return F80(Q);case"<=":return z80(Q);case">":return U80(Q);case">=":return q80(Q);default:return D80(Q)}}function M80(A){return A.split(/\s+/).flatMap(I80)}function Ft(A){let Q=A.replaceAll(/(?<=[<>=~^])(\s+)/g,"").split(/\s*\|\|\s*/).map((B)=>K80(B)||M80(B));if(Q.some((B)=>B.includes(null)))throw TypeError(`Cannot parse version range: range "${A}" is invalid`);return Q}var $HA=b(()=>{LK();Kg()});function G1(A){if(typeof A!=="string")throw TypeError(`Cannot parse version as version must be a string: received ${typeof A}`);if(A.length>t2A)throw TypeError(`Cannot parse version as version length is too long: length is ${A.length}, max length is ${t2A}`);A=A.trim();let Q=A.match(YoA)?.groups;if(!Q)throw TypeError(`Cannot parse version: ${A}`);let B=Gt(Q.major,`Cannot parse version ${A}: invalid major version`),$=Gt(Q.minor,`Cannot parse version ${A}: invalid minor version`),J=Gt(Q.patch,`Cannot parse version ${A}: invalid patch version`),Y=Q.prerelease?qG(Q.prerelease):[],X=Q.buildmetadata?YF(Q.buildmetadata):[];return{major:B,minor:$,patch:J,prerelease:Y,build:X}}var zt=b(()=>{LK();LK()});function UoA(A,Q){let B=A.operator,$=Q.operator;if(B===void 0){if(tU(A))return!0;return Xg(A,[[Q]])}if($===void 0){if(tU(Q))return!0;return Xg(Q,[[A]])}let J=DG(A,Q);return(B===">="||B===">")&&($===">="||$===">")||(B==="<="||B==="<")&&($==="<="||$==="<")||J===0&&((B===">="||B==="<=")&&($===">="||$==="<="))||J===-1&&(B===">="||B===">")&&($==="<="||$==="<")||J===1&&(B==="<="||B==="<")&&($===">="||$===">")}function O80(A){return A.every((Q)=>{return Q.some((B)=>L80(B))})}function L80(A){for(let Q=0;Q<A.length-1;Q++){let B=A[Q];for(let $ of A.slice(Q+1))if(!UoA(B,$))return!1}return!0}function qoA(A,Q){return O80([A,Q])&&A.some((B)=>{return Q.some(($)=>{return B.every((J)=>{return $.every((Y)=>UoA(J,Y))})})})}var DoA=b(()=>{LK();SW();Zg()});var IoA=b(()=>{$HA()});var MoA=b(()=>{Kg();Kg();AHA()});function UM(A){try{return G1(A),!0}catch{return!1}}var OoA=b(()=>{zt()});var LoA=b(()=>{zt()});var NoA=b(()=>{LK()});var VoA=b(()=>{SW()});var CoA=b(()=>{SW()});var EoA=b(()=>{Wt();LK();SW()});function Ut(A,Q){return DG(A,Q)>=0}var RoA=b(()=>{SW()});var joA=b(()=>{Wt();LK();SW()});var woA=b(()=>{SW()});var NK=b(()=>{SW();WoA();Zg();HoA();AHA();FoA();zoA();$HA();zt();DoA();IoA();MoA();OoA();LoA();NoA();VoA();CoA();QHA();EoA();RoA();BHA();joA();woA()});var JHA=$A((AvB,_oA)=>{_oA.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 qt=$A((PoA)=>{var ToA={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 N80(A){return function(...Q){if(Q.length)A=A.replace(/\{(\d)\}/g,(B,$)=>Q[$]||"");return Error("ADM-ZIP: "+A)}}for(let A of Object.keys(ToA))PoA[A]=N80(ToA[A])});var voA=$A((BvB,xoA)=>{var V80=qQ("fs"),S5=qQ("path"),SoA=JHA(),C80=qt(),E80=typeof process==="object"&&process.platform==="win32",koA=(A)=>typeof A==="object"&&A!==null,boA=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 KJ(A){if(this.sep=S5.sep,this.fs=V80,koA(A)){if(koA(A.fs)&&typeof A.fs.statSync==="function")this.fs=A.fs}}xoA.exports=KJ;KJ.prototype.makeDir=function(A){let Q=this;function B($){let J=$.split(Q.sep)[0];$.split(Q.sep).forEach(function(Y){if(!Y||Y.substr(-1,1)===":")return;J+=Q.sep+Y;var X;try{X=Q.fs.statSync(J)}catch(Z){if(Z.message&&Z.message.startsWith("ENOENT"))Q.fs.mkdirSync(J);else throw Z}if(X&&X.isFile())throw C80.FILE_IN_THE_WAY(`"${J}"`)})}B(A)};KJ.prototype.writeFileTo=function(A,Q,B,$){let J=this;if(J.fs.existsSync(A)){if(!B)return!1;var Y=J.fs.statSync(A);if(Y.isDirectory())return!1}var X=S5.dirname(A);if(!J.fs.existsSync(X))J.makeDir(X);var Z;try{Z=J.fs.openSync(A,"w",438)}catch(G){J.fs.chmodSync(A,438),Z=J.fs.openSync(A,"w",438)}if(Z)try{J.fs.writeSync(Z,Q,0,Q.length,0)}finally{J.fs.closeSync(Z)}return J.fs.chmodSync(A,$||438),!0};KJ.prototype.writeFileToAsync=function(A,Q,B,$,J){if(typeof $==="function")J=$,$=void 0;let Y=this;Y.fs.exists(A,function(X){if(X&&!B)return J(!1);Y.fs.stat(A,function(Z,G){if(X&&G&&G.isDirectory())return J(!1);var K=S5.dirname(A);Y.fs.exists(K,function(W){if(!W)try{Y.makeDir(K)}catch(F){return J(!1)}let H=function(F){Y.fs.write(F,Q,0,Q.length,0,function(D){Y.fs.close(F,function(){if(D)return J(!1);Y.fs.chmod(A,$||438,function(){J(!0)})})})};Y.fs.open(A,"w",438,function(F,D){if(F)Y.fs.chmod(A,438,function(){Y.fs.open(A,"w",438,function(q,I){if(q||!I)return J(!1);H(I)})});else if(D)H(D);else J(!1)})})})})};KJ.prototype.findFiles=function(A){let Q=this;function B($,J,Y,X){if(typeof J==="boolean")Y=J,J=void 0;let Z=[];return Q.fs.readdirSync($).forEach(function(G){let K=S5.join($,G),W=Q.fs.statSync(K);if(!J||J.test(K))Z.push(S5.normalize(K)+(W.isDirectory()?Q.sep:""));if(W.isDirectory()&&Y){let H=Q.fs.realpathSync(K);if(!X.has(H))X.add(H),Z=Z.concat(B(K,J,Y,X))}}),Z}return B(A,void 0,!0,new Set([Q.fs.realpathSync(A)]))};KJ.prototype.findFilesAsync=function(A,Q){let B=this,$=[],J=!1,Y=function(Z){if(J)return;J=!0,Q(Z,Z?void 0:$)},X=function(Z,G,K){B.fs.readdir(Z,function(W,H){if(W)return K(W);let F=H.length;if(!F)return K();H.forEach(function(D){let q=S5.join(Z,D);B.fs.stat(q,function(I,M){if(I)return K(I);if(!M){if(!--F)K();return}if($.push(S5.normalize(q)+(M.isDirectory()?B.sep:"")),!M.isDirectory()){if(!--F)K();return}B.fs.realpath(q,function(V,C){if(V)return K(V);if(G.has(C)){if(!--F)K();return}G.add(C),X(q,G,function(L){if(L)return K(L);if(!--F)K()})})})})})};B.fs.realpath(A,function(Z,G){if(Z)return Y(Z);X(A,new Set([G]),Y)})};KJ.prototype.getAttributes=function(){};KJ.prototype.setAttributes=function(){};KJ.crc32update=function(A,Q){return boA[(A^Q)&255]^A>>>8};KJ.crc32=function(A){if(typeof A==="string")A=Buffer.from(A,"utf8");let Q=A.length,B=-1;for(let $=0;$<Q;)B=KJ.crc32update(B,A[$++]);return~B>>>0};KJ.methodToString=function(A){switch(A){case SoA.STORED:return"STORED ("+A+")";case SoA.DEFLATED:return"DEFLATED ("+A+")";default:return"UNSUPPORTED ("+A+")"}};KJ.canonical=function(A){if(!A)return"";let Q=S5.posix.normalize("/"+A.split("\\").join("/"));return S5.join(".",Q)};KJ.zipnamefix=function(A){if(!A)return"";let Q=S5.posix.normalize("/"+A.split("\\").join("/"));return S5.posix.join(".",Q)};KJ.findLast=function(A,Q){if(!Array.isArray(A))throw TypeError("arr is not array");let B=A.length>>>0;for(let $=B-1;$>=0;$--)if(Q(A[$],$,A))return A[$];return};KJ.sanitize=function(A,Q){A=S5.resolve(S5.normalize(A));var B=Q.split("/");for(var $=0,J=B.length;$<J;$++){var Y=S5.normalize(S5.join(A,B.slice($,J).join(S5.sep)));if(Y===A||Y.startsWith(A+S5.sep))return Y}return S5.normalize(S5.join(A,S5.basename(Q)))};KJ.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)};KJ.readBigUInt64LE=function(A,Q){let B=A.readUInt32LE(Q);return A.readUInt32LE(Q+4)*4294967296+B};KJ.writeBigUInt64LE=function(A,Q,B){let $=Q>>>0,J=Math.floor(Q/4294967296)>>>0;A.writeUInt32LE($,B),A.writeUInt32LE(J,B+4)};KJ.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)};KJ.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};KJ.isWin=E80;KJ.crcTable=boA});var goA=$A(($vB,foA)=>{var R80=qQ("path");foA.exports=function(A,{fs:Q}){var B=A||"",$=Y(),J=null;function Y(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}if(B&&Q.existsSync(B))J=Q.statSync(B),$.directory=J.isDirectory(),$.mtime=J.mtime,$.atime=J.atime,$.executable=(73&J.mode)!==0,$.readonly=(128&J.mode)===0,$.hidden=R80.basename(B)[0]===".";else console.warn("Invalid path: "+B);return{get directory(){return $.directory},get readOnly(){return $.readonly},get hidden(){return $.hidden},get mtime(){return $.mtime},get atime(){return $.atime},get executable(){return $.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:B,isDirectory:$.directory,isReadOnly:$.readonly,isHidden:$.hidden,isExecutable:$.executable,mTime:$.mtime,aTime:$.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var hoA=$A((JvB,yoA)=>{yoA.exports={efs:!0,encode:(A)=>Buffer.from(A,"utf8"),decode:(A)=>A.toString("utf8")}});var H_=$A((YvB,W_)=>{W_.exports=voA();W_.exports.Constants=JHA();W_.exports.Errors=qt();W_.exports.FileAttr=goA();W_.exports.decoder=hoA()});var moA=$A((XvB,uoA)=>{var qM=H_(),qB=qM.Constants;uoA.exports=function(){var A=20,Q=10,B=0,$=0,J=0,Y=0,X=0,Z=0,G=0,K=0,W=0,H=0,F=0,D=0,q=0;A|=qM.isWin?2560:768,B|=qB.FLG_EFS;let I={extraLen:0},M=(L)=>Math.max(0,L)>>>0,V=(L)=>Math.max(0,L)&65535,C=(L)=>Math.max(0,L)&255;return J=qM.fromDate2DOS(new Date),{get made(){return A},set made(L){A=L},get version(){return Q},set version(L){Q=L},get flags(){return B},set flags(L){B=L},get flags_efs(){return(B&qB.FLG_EFS)>0},set flags_efs(L){if(L)B|=qB.FLG_EFS;else B&=~qB.FLG_EFS},get flags_desc(){return(B&qB.FLG_DESC)>0},set flags_desc(L){if(L)B|=qB.FLG_DESC;else B&=~qB.FLG_DESC},get method(){return $},set method(L){switch(L){case qB.STORED:this.version=10;break;case qB.DEFLATED:default:this.version=20}$=L},get time(){return qM.fromDOS2Date(this.timeval)},set time(L){L=new Date(L),this.timeval=qM.fromDate2DOS(L)},get timeval(){return J},set timeval(L){J=M(L)},get timeHighByte(){return C(J>>>8)},get crc(){return Y},set crc(L){Y=M(L)},get compressedSize(){return X},set compressedSize(L){X=M(L)},get size(){return Z},set size(L){Z=M(L)},get fileNameLength(){return G},set fileNameLength(L){G=L},get extraLength(){return K},set extraLength(L){K=L},get extraLocalLength(){return I.extraLen},set extraLocalLength(L){I.extraLen=L},get commentLength(){return W},set commentLength(L){W=L},get diskNumStart(){return H},set diskNumStart(L){H=M(L)},get inAttr(){return F},set inAttr(L){F=M(L)},get attr(){return D},set attr(L){D=M(L)},get fileAttr(){return(D||0)>>16&4095},get offset(){return q},set offset(L){q=M(L)},get encrypted(){return(B&qB.FLG_ENC)===qB.FLG_ENC},get centralHeaderSize(){return qB.CENHDR+G+K+W},get realDataOffset(){return q+qB.LOCHDR+I.fnameLen+I.extraLen},get localHeader(){return I},loadLocalHeaderFromBinary:function(L){var N=L.slice(q,q+qB.LOCHDR);if(N.readUInt32LE(0)!==qB.LOCSIG)throw qM.Errors.INVALID_LOC();I.version=N.readUInt16LE(qB.LOCVER),I.flags=N.readUInt16LE(qB.LOCFLG),I.flags_desc=(I.flags&qB.FLG_DESC)>0,I.method=N.readUInt16LE(qB.LOCHOW),I.time=N.readUInt32LE(qB.LOCTIM),I.crc=N.readUInt32LE(qB.LOCCRC),I.compressedSize=N.readUInt32LE(qB.LOCSIZ),I.size=N.readUInt32LE(qB.LOCLEN),I.fnameLen=N.readUInt16LE(qB.LOCNAM),I.extraLen=N.readUInt16LE(qB.LOCEXT);let R=q+qB.LOCHDR+I.fnameLen,E=R+I.extraLen;return L.slice(R,E)},loadFromBinary:function(L){if(L.length!==qB.CENHDR||L.readUInt32LE(0)!==qB.CENSIG)throw qM.Errors.INVALID_CEN();A=L.readUInt16LE(qB.CENVEM),Q=L.readUInt16LE(qB.CENVER),B=L.readUInt16LE(qB.CENFLG),$=L.readUInt16LE(qB.CENHOW),J=L.readUInt32LE(qB.CENTIM),Y=L.readUInt32LE(qB.CENCRC),X=L.readUInt32LE(qB.CENSIZ),Z=L.readUInt32LE(qB.CENLEN),G=L.readUInt16LE(qB.CENNAM),K=L.readUInt16LE(qB.CENEXT),W=L.readUInt16LE(qB.CENCOM),H=L.readUInt16LE(qB.CENDSK),F=L.readUInt16LE(qB.CENATT),D=L.readUInt32LE(qB.CENATX),q=L.readUInt32LE(qB.CENOFF)},localHeaderToBinary:function(){var L=Buffer.alloc(qB.LOCHDR);return L.writeUInt32LE(qB.LOCSIG,0),L.writeUInt16LE(Q,qB.LOCVER),L.writeUInt16LE(B&~qB.FLG_DESC,qB.LOCFLG),L.writeUInt16LE($,qB.LOCHOW),L.writeUInt32LE(J,qB.LOCTIM),L.writeUInt32LE(Y,qB.LOCCRC),L.writeUInt32LE(X,qB.LOCSIZ),L.writeUInt32LE(Z,qB.LOCLEN),L.writeUInt16LE(G,qB.LOCNAM),L.writeUInt16LE(I.extraLen,qB.LOCEXT),L},centralHeaderToBinary:function(){var L=Buffer.alloc(qB.CENHDR+G+K+W);return L.writeUInt32LE(qB.CENSIG,0),L.writeUInt16LE(A,qB.CENVEM),L.writeUInt16LE(Q,qB.CENVER),L.writeUInt16LE(B&~qB.FLG_DESC,qB.CENFLG),L.writeUInt16LE($,qB.CENHOW),L.writeUInt32LE(J,qB.CENTIM),L.writeUInt32LE(Y,qB.CENCRC),L.writeUInt32LE(X,qB.CENSIZ),L.writeUInt32LE(Z,qB.CENLEN),L.writeUInt16LE(G,qB.CENNAM),L.writeUInt16LE(K,qB.CENEXT),L.writeUInt16LE(W,qB.CENCOM),L.writeUInt16LE(H,qB.CENDSK),L.writeUInt16LE(F,qB.CENATT),L.writeUInt32LE(D,qB.CENATX),L.writeUInt32LE(q,qB.CENOFF),L},toJSON:function(){let L=function(N){return N+" bytes"};return{made:A,version:Q,flags:B,method:qM.methodToString($),time:this.time,crc:"0x"+Y.toString(16).toUpperCase(),compressedSize:L(X),size:L(Z),fileNameLength:L(G),extraLength:L(K),commentLength:L(W),diskNumStart:H,inAttr:F,attr:D,offset:q,centralHeaderSize:L(qB.CENHDR+G+K+W)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var doA=$A((ZvB,coA)=>{var kW=H_(),Q1=kW.Constants;coA.exports=function(){var A=0,Q=0,B=0,$=0,J=0;let Y=()=>A>Q1.EF_ZIP64_OR_16||Q>Q1.EF_ZIP64_OR_16||B>Q1.EF_ZIP64_OR_32||$>Q1.EF_ZIP64_OR_32;return{get diskEntries(){return A},set diskEntries(X){A=Q=X},get totalEntries(){return Q},set totalEntries(X){Q=A=X},get size(){return B},set size(X){B=X},get offset(){return $},set offset(X){$=X},get commentLength(){return J},set commentLength(X){J=X},get mainHeaderSize(){return(Y()?Q1.ZIP64HDR+Q1.END64HDR:0)+Q1.ENDHDR+J},loadFromBinary:function(X){if((X.length!==Q1.ENDHDR||X.readUInt32LE(0)!==Q1.ENDSIG)&&(X.length<Q1.ZIP64HDR||X.readUInt32LE(0)!==Q1.ZIP64SIG))throw kW.Errors.INVALID_END();if(X.readUInt32LE(0)===Q1.ENDSIG)A=X.readUInt16LE(Q1.ENDSUB),Q=X.readUInt16LE(Q1.ENDTOT),B=X.readUInt32LE(Q1.ENDSIZ),$=X.readUInt32LE(Q1.ENDOFF),J=X.readUInt16LE(Q1.ENDCOM);else A=kW.readBigUInt64LE(X,Q1.ZIP64SUB),Q=kW.readBigUInt64LE(X,Q1.ZIP64TOT),B=kW.readBigUInt64LE(X,Q1.ZIP64SIZB),$=kW.readBigUInt64LE(X,Q1.ZIP64OFF),J=0},toBinary:function(){if(!Y()){var X=Buffer.alloc(Q1.ENDHDR+J);return X.writeUInt32LE(Q1.ENDSIG,0),X.writeUInt32LE(0,4),X.writeUInt16LE(A,Q1.ENDSUB),X.writeUInt16LE(Q,Q1.ENDTOT),X.writeUInt32LE(B,Q1.ENDSIZ),X.writeUInt32LE($,Q1.ENDOFF),X.writeUInt16LE(J,Q1.ENDCOM),X.fill(" ",Q1.ENDHDR),X}var X=Buffer.alloc(this.mainHeaderSize);let Z=0;X.writeUInt32LE(Q1.ZIP64SIG,Z),kW.writeBigUInt64LE(X,Q1.ZIP64HDR-Q1.ZIP64LEAD,Z+Q1.ZIP64SIZE),X.writeUInt16LE(45,Z+Q1.ZIP64VEM),X.writeUInt16LE(45,Z+Q1.ZIP64VER),X.writeUInt32LE(0,Z+Q1.ZIP64DSK),X.writeUInt32LE(0,Z+Q1.ZIP64DSKDIR),kW.writeBigUInt64LE(X,A,Z+Q1.ZIP64SUB),kW.writeBigUInt64LE(X,Q,Z+Q1.ZIP64TOT),kW.writeBigUInt64LE(X,B,Z+Q1.ZIP64SIZB),kW.writeBigUInt64LE(X,$,Z+Q1.ZIP64OFF);let G=$+B;return Z+=Q1.ZIP64HDR,X.writeUInt32LE(Q1.END64SIG,Z),X.writeUInt32LE(0,Z+Q1.END64START),kW.writeBigUInt64LE(X,G,Z+Q1.END64OFF),X.writeUInt32LE(1,Z+Q1.END64NUMDISKS),Z+=Q1.END64HDR,X.writeUInt32LE(Q1.ENDSIG,Z),X.writeUInt32LE(0,Z+4),X.writeUInt16LE(Math.min(A,Q1.EF_ZIP64_OR_16),Z+Q1.ENDSUB),X.writeUInt16LE(Math.min(Q,Q1.EF_ZIP64_OR_16),Z+Q1.ENDTOT),X.writeUInt32LE(Math.min(B,Q1.EF_ZIP64_OR_32),Z+Q1.ENDSIZ),X.writeUInt32LE(Math.min($,Q1.EF_ZIP64_OR_32),Z+Q1.ENDOFF),X.writeUInt16LE(J,Z+Q1.ENDCOM),X.fill(" ",Z+Q1.ENDHDR),X},toJSON:function(){let X=function(Z,G){let K=Z.toString(16).toUpperCase();while(K.length<G)K="0"+K;return"0x"+K};return{diskEntries:A,totalEntries:Q,size:B+" bytes",offset:X($,4),commentLength:J}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var YHA=$A((j80)=>{j80.EntryHeader=moA();j80.MainHeader=doA()});var poA=$A((KvB,loA)=>{loA.exports=function(A){var Q=qQ("zlib"),B={chunkSize:(parseInt(A.length/1024)+1)*1024};return{deflate:function(){return Q.deflateRawSync(A,B)},deflateAsync:function($){var J=Q.createDeflateRaw(B),Y=[],X=0;J.on("data",function(Z){Y.push(Z),X+=Z.length}),J.on("end",function(){var Z=Buffer.alloc(X),G=0;Z.fill(0);for(var K=0;K<Y.length;K++){var W=Y[K];W.copy(Z,G),G+=W.length}$&&$(Z)}),J.end(A)}}}});var noA=$A((WvB,ioA)=>{var T80=+(process?.versions?.node??"").split(".")[0]||0;ioA.exports=function(A,Q){var B=qQ("zlib");let $=T80>=15&&Q>0?{maxOutputLength:Q}:{};return{inflate:function(){return B.inflateRawSync(A,$)},inflateAsync:function(J){var Y=B.createInflateRaw($),X=[],Z=0;Y.on("data",function(G){X.push(G),Z+=G.length}),Y.on("end",function(){var G=Buffer.alloc(Z),K=0;G.fill(0);for(var W=0;W<X.length;W++){var H=X[W];H.copy(G,K),K+=H.length}J&&J(G)}),Y.end(A)}}}});var toA=$A((HvB,soA)=>{var{randomFillSync:roA}=qQ("crypto"),P80=qt(),S80=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}),aoA=(A,Q)=>Math.imul(A,Q)>>>0,ooA=(A,Q)=>{return S80[(A^Q)&255]^A>>>8},Wg=()=>{if(typeof roA==="function")return roA(Buffer.alloc(12));else return Wg.node()};Wg.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 Dt={genSalt:Wg};function It(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])}It.prototype.updateKeys=function(A){let Q=this.keys;return Q[0]=ooA(Q[0],A),Q[1]+=Q[0]&255,Q[1]=aoA(Q[1],134775813)+1,Q[2]=ooA(Q[2],Q[1]>>>24),A};It.prototype.next=function(){let A=(this.keys[2]|2)>>>0;return aoA(A,A^1)>>8&255};function k80(A){let Q=new It(A);return function(B){let $=Buffer.alloc(B.length),J=0;for(let Y of B)$[J++]=Q.updateKeys(Y^Q.next());return $}}function b80(A){let Q=new It(A);return function(B,$,J=0){if(!$)$=Buffer.alloc(B.length);for(let Y of B){let X=Q.next();$[J++]=Y^X,Q.updateKeys(Y)}return $}}function x80(A,Q,B){if(!A||!Buffer.isBuffer(A)||A.length<12)return Buffer.alloc(0);let $=k80(B),J=$(A.slice(0,12)),Y=(Q.flags&8)===8?Q.timeHighByte:Q.crc>>>24;if(J[11]!==Y)throw P80.WRONG_PASSWORD();return $(A.slice(12))}function v80(A){if(Buffer.isBuffer(A)&&A.length>=12)Dt.genSalt=function(){return A.slice(0,12)};else if(A==="node")Dt.genSalt=Wg.node;else Dt.genSalt=Wg}function f80(A,Q,B,$=!1){if(A==null)A=Buffer.alloc(0);if(!Buffer.isBuffer(A))A=Buffer.from(A.toString());let J=b80(B),Y=Dt.genSalt();if(Y[11]=Q.crc>>>24&255,$)Y[10]=Q.crc>>>16&255;let X=Buffer.alloc(A.length+12);return J(Y,X),J(A,X,12)}soA.exports={decrypt:x80,encrypt:f80,_salter:v80}});var eoA=$A((g80)=>{g80.Deflater=poA();g80.Inflater=noA();g80.ZipCrypto=toA()});var ZHA=$A((zvB,AaA)=>{var c6=H_(),m80=YHA(),VK=c6.Constants,XHA=eoA();AaA.exports=function(A,Q){var B=new m80.EntryHeader,$=Buffer.alloc(0),J=Buffer.alloc(0),Y=!1,X=null,Z=Buffer.alloc(0),G=Buffer.alloc(0),K=!0;let W=A,H=typeof W.decoder==="object"?W.decoder:c6.decoder;K=H.hasOwnProperty("efs")?H.efs:!1;function F(){if(!Q||!(Q instanceof Uint8Array))return Buffer.alloc(0);return G=B.loadLocalHeaderFromBinary(Q),Q.slice(B.realDataOffset,B.realDataOffset+B.compressedSize)}function D(L){let N=B.flags_desc||B.localHeader.flags_desc?B.crc:B.localHeader.crc;return c6.crc32(L)===N}function q(L,N,R){if(typeof N>"u"&&typeof L==="string")R=L,L=void 0;if(Y){if(L&&N)N(Buffer.alloc(0),c6.Errors.DIRECTORY_CONTENT_ERROR());return Buffer.alloc(0)}var E=F();if(E.length===0){if(L&&N)N(E);return E}if(B.encrypted){if(typeof R!=="string"&&!Buffer.isBuffer(R))throw c6.Errors.INVALID_PASS_PARAM();E=XHA.ZipCrypto.decrypt(E,B,R)}var w;switch(B.method){case c6.Constants.STORED:if(w=Buffer.alloc(E.length),E.copy(w),!D(w)){if(L&&N)N(w,c6.Errors.BAD_CRC());throw c6.Errors.BAD_CRC()}else{if(L&&N)N(w);return w}case c6.Constants.DEFLATED:var k=new XHA.Inflater(E,B.size);if(!L){if(w=k.inflate(),!D(w))throw c6.Errors.BAD_CRC(`"${H.decode($)}"`);return w}else k.inflateAsync(function(y){if(N)if(!D(y))N(y,c6.Errors.BAD_CRC());else N(y)});break;default:if(L&&N)N(Buffer.alloc(0),c6.Errors.UNKNOWN_METHOD());throw c6.Errors.UNKNOWN_METHOD()}}function I(L,N){if((!X||!X.length)&&Buffer.isBuffer(Q)){if(L&&N)N(F());return F()}if(X.length&&!Y){var R;switch(B.method){case c6.Constants.STORED:if(B.compressedSize=B.size,R=Buffer.alloc(X.length),X.copy(R),L&&N)N(R);return R;default:case c6.Constants.DEFLATED:var E=new XHA.Deflater(X);if(!L){var w=E.deflate();return B.compressedSize=w.length,w}else E.deflateAsync(function(k){R=Buffer.alloc(k.length),B.compressedSize=k.length,k.copy(R),N&&N(R)});E=null;break}}else if(L&&N)N(Buffer.alloc(0));else return Buffer.alloc(0)}function M(L,N){return c6.readBigUInt64LE(L,N)}function V(L){try{var N=0,R,E,w;while(N+4<L.length)if(R=L.readUInt16LE(N),N+=2,E=L.readUInt16LE(N),N+=2,w=L.slice(N,N+E),N+=E,VK.ID_ZIP64===R)C(w)}catch(k){throw c6.Errors.EXTRA_FIELD_PARSE_ERROR()}}function C(L){var N,R,E,w;if(L.length>=VK.EF_ZIP64_SCOMP){if(N=M(L,VK.EF_ZIP64_SUNCOMP),B.size===VK.EF_ZIP64_OR_32)B.size=N}if(L.length>=VK.EF_ZIP64_RHO){if(R=M(L,VK.EF_ZIP64_SCOMP),B.compressedSize===VK.EF_ZIP64_OR_32)B.compressedSize=R}if(L.length>=VK.EF_ZIP64_DSN){if(E=M(L,VK.EF_ZIP64_RHO),B.offset===VK.EF_ZIP64_OR_32)B.offset=E}if(L.length>=VK.EF_ZIP64_DSN+4){if(w=L.readUInt32LE(VK.EF_ZIP64_DSN),B.diskNumStart===VK.EF_ZIP64_OR_16)B.diskNumStart=w}}return{get entryName(){return H.decode($)},get rawEntryName(){return $},set entryName(L){$=c6.toBuffer(L,H.encode);var N=$[$.length-1];Y=N===47||N===92,B.fileNameLength=$.length},get efs(){if(typeof K==="function")return K(this.entryName);else return K},get extra(){return Z},set extra(L){Z=L,B.extraLength=L.length,V(L)},get comment(){return H.decode(J)},set comment(L){if(J=c6.toBuffer(L,H.encode),B.commentLength=J.length,J.length>65535)throw c6.Errors.COMMENT_TOO_LONG()},get name(){let L=H.decode($);return Y?L.replace(/[/\\]$/,"").split("/").pop():L.split("/").pop()},get isDirectory(){return Y},getCompressedData:function(){return I(!1,null)},getCompressedDataAsync:function(L){I(!0,L)},setData:function(L){if(X=c6.toBuffer(L,c6.decoder.encode),!Y&&X.length)B.size=X.length,B.method=c6.Constants.DEFLATED,B.crc=c6.crc32(L),B.changed=!0;else B.method=c6.Constants.STORED},getData:function(L){if(B.changed)return X;else return q(!1,null,L)},getDataAsync:function(L,N){if(B.changed)L(X);else q(!0,L,N)},set attr(L){B.attr=L},get attr(){return B.attr},set header(L){B.loadFromBinary(L)},get header(){return B},packCentralHeader:function(){B.flags_efs=this.efs,B.extraLength=Z.length;var L=B.centralHeaderToBinary(),N=c6.Constants.CENHDR;return $.copy(L,N),N+=$.length,Z.copy(L,N),N+=B.extraLength,J.copy(L,N),L},packLocalHeader:function(){let L=0;B.flags_efs=this.efs,B.extraLocalLength=G.length;let N=B.localHeaderToBinary(),R=Buffer.alloc(N.length+$.length+B.extraLocalLength);return N.copy(R,L),L+=N.length,$.copy(R,L),L+=$.length,G.copy(R,L),L+=G.length,R},toJSON:function(){let L=function(N){return"<"+(N&&N.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:B.toJSON(),compressedData:L(Q),data:L(X)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var $aA=$A((UvB,BaA)=>{var QaA=ZHA(),c80=YHA(),BZ=H_();BaA.exports=function(A,Q){var B=[],$=Object.create(null),J=Buffer.alloc(0),Y=new c80.MainHeader,X=!1,Z=null;let G=new Set,K=Q,{noSort:W,decoder:H}=K;if(A)q(K.readEntries);else X=!0;function F(){let M=new Set;for(let V of Object.keys($)){let C=V.split("/");if(C.pop(),!C.length)continue;for(let L=0;L<C.length;L++){let N=C.slice(0,L+1).join("/")+"/";M.add(N)}}for(let V of M)if(!(V in $)){let C=new QaA(K);C.entryName=V,C.attr=16,C.temporary=!0,B.push(C),$[C.entryName]=C,G.add(C)}}function D(){if(X=!0,$=Object.create(null),Y.diskEntries>(A.length-Y.offset)/BZ.Constants.CENHDR)throw BZ.Errors.DISK_ENTRY_TOO_LARGE();B=Array(Y.diskEntries);var M=Y.offset;for(var V=0;V<B.length;V++){var C=M,L=new QaA(K,A);if(L.header=A.slice(C,C+=BZ.Constants.CENHDR),L.entryName=A.slice(C,C+=L.header.fileNameLength),L.header.extraLength)L.extra=A.slice(C,C+=L.header.extraLength);if(L.header.commentLength)L.comment=A.slice(C,C+L.header.commentLength);M+=L.header.centralHeaderSize,B[V]=L,$[L.entryName]=L}G.clear(),F()}function q(M){var V=A.length-BZ.Constants.ENDHDR,C=Math.max(0,V-65535),L=C,N=A.length,R=-1,E=0;if(typeof K.trailingSpace==="boolean"?K.trailingSpace:!1)C=0;for(V;V>=L;V--){if(A[V]!==80)continue;if(A.readUInt32LE(V)===BZ.Constants.ENDSIG){R=V,E=V,N=V+BZ.Constants.ENDHDR,L=V-BZ.Constants.END64HDR;continue}if(A.readUInt32LE(V)===BZ.Constants.END64SIG){L=C;continue}if(A.readUInt32LE(V)===BZ.Constants.ZIP64SIG){R=V,N=V+BZ.readBigUInt64LE(A,V+BZ.Constants.ZIP64SIZE)+BZ.Constants.ZIP64LEAD;break}}if(R==-1)throw BZ.Errors.INVALID_FORMAT();if(Y.loadFromBinary(A.slice(R,N)),Y.commentLength)J=A.slice(E+BZ.Constants.ENDHDR);if(M)D()}function I(){if(B.length>1&&!W)B=B.map((M)=>({entry:M,key:M.entryName.toLowerCase()})).sort((M,V)=>M.key.localeCompare(V.key)).map((M)=>M.entry)}return{get entries(){if(!X)D();return B.filter((M)=>!G.has(M))},get comment(){return H.decode(J)},set comment(M){J=BZ.toBuffer(M,H.encode),Y.commentLength=J.length},getEntryCount:function(){if(!X)return Y.diskEntries;return B.length},forEach:function(M){this.entries.forEach(M)},getEntry:function(M){if(!X)D();return $[M]||null},setEntry:function(M){if(!X)D();B.push(M),$[M.entryName]=M,Y.totalEntries=B.length},deleteFile:function(M,V=!0){if(!X)D();let C=$[M];this.getEntryChildren(C,V).map((N)=>N.entryName).forEach(this.deleteEntry)},deleteEntry:function(M){if(!X)D();let V=$[M],C=B.indexOf(V);if(C>=0)B.splice(C,1),delete $[M],Y.totalEntries=B.length},getEntryChildren:function(M,V=!0){if(!X)D();if(typeof M==="object")if(M.isDirectory&&V){let C=[],L=M.entryName;for(let N of B)if(N.entryName.startsWith(L))C.push(N);return C}else return[M];return[]},getChildCount:function(M){if(M&&M.isDirectory){let V=this.getEntryChildren(M);return V.includes(M)?V.length-1:V.length}return 0},compressToBuffer:function(){if(!X)D();I();let M=[],V=[],C=0,L=0;Y.size=0,Y.offset=0;let N=0;for(let w of this.entries){let k=w.getCompressedData();w.header.offset=L;let y=w.packLocalHeader(),P=y.length+k.length;L+=P,M.push(y),M.push(k);let v=w.packCentralHeader();V.push(v),Y.size+=v.length,C+=P+v.length,N++}C+=Y.mainHeaderSize,Y.offset=L,Y.totalEntries=N,L=0;let R=Buffer.alloc(C);for(let w of M)w.copy(R,L),L+=w.length;for(let w of V)w.copy(R,L),L+=w.length;let E=Y.toBinary();if(J)J.copy(E,E.length-J.length);return E.copy(R,L),A=R,X=!1,R},toAsyncBuffer:function(M,V,C,L){try{if(!X)D();I();let N=[],R=[],E=0,w=0,k=0;Y.size=0,Y.offset=0;let y=function(P){if(P.length>0){let v=P.shift(),c=v.entryName+v.extra.toString();if(C)C(c);v.getCompressedDataAsync(function(a){if(L)L(c);v.header.offset=w;let e=v.packLocalHeader(),r=e.length+a.length;w+=r,N.push(e),N.push(a);let i=v.packCentralHeader();R.push(i),Y.size+=i.length,E+=r+i.length,k++,y(P)})}else{E+=Y.mainHeaderSize,Y.offset=w,Y.totalEntries=k,w=0;let v=Buffer.alloc(E);N.forEach(function(a){a.copy(v,w),w+=a.length}),R.forEach(function(a){a.copy(v,w),w+=a.length});let c=Y.toBinary();if(J)J.copy(c,c.length-J.length);c.copy(v,w),A=v,X=!1,M(v)}};y(Array.from(this.entries))}catch(N){V(N)}}}}});var Mt=$A((qvB,YaA)=>{var RJ=H_(),EJ=qQ("path"),d80=ZHA(),l80=$aA(),lV=(...A)=>RJ.findLast(A,(Q)=>typeof Q==="boolean"),JaA=(...A)=>RJ.findLast(A,(Q)=>typeof Q==="string"),p80=(...A)=>RJ.findLast(A,(Q)=>typeof Q==="function"),i80={noSort:!1,readEntries:!1,method:RJ.Constants.NONE,fs:null};YaA.exports=function(A,Q){let B=null,$=Object.assign(Object.create(null),i80);if(A&&typeof A==="object"){if(!(A instanceof Uint8Array)){if(Object.assign($,A),A=$.input?$.input:void 0,$.input)delete $.input}if(Buffer.isBuffer(A))B=A,$.method=RJ.Constants.BUFFER,A=void 0}Object.assign($,Q);let J=new RJ($),Y=(q)=>{q.filter((I)=>I.attr).sort((I,M)=>M.path.length-I.path.length).forEach((I)=>J.fs.chmodSync(I.path,I.attr))};if(typeof $.decoder!=="object"||typeof $.decoder.encode!=="function"||typeof $.decoder.decode!=="function")$.decoder=RJ.decoder;if(A&&typeof A==="string")if(J.fs.existsSync(A))$.method=RJ.Constants.FILE,$.filename=A,B=J.fs.readFileSync(A);else throw RJ.Errors.INVALID_FILENAME();let X=new l80(B,$),{canonical:Z,sanitize:G,zipnamefix:K}=RJ;function W(q){if(q&&X){var I;if(typeof q==="string")I=X.getEntry(EJ.posix.normalize(q));if(typeof q==="object"&&typeof q.entryName<"u"&&typeof q.header<"u")I=X.getEntry(q.entryName);if(I)return I}return null}function H(q){let{join:I,normalize:M,sep:V}=EJ.posix;return I(EJ.isAbsolute(q)?"/":".",M(V+q.split("\\").join(V)+V))}function F(q){if(q instanceof RegExp)return function(I){return function(M){return I.test(M)}}(q);else if(typeof q!=="function")return()=>!0;return q}let D=(q,I)=>{let M=I.slice(-1);return M=M===J.sep?J.sep:"",EJ.relative(q,I)+M};return{readFile:function(q,I){var M=W(q);return M&&M.getData(I)||null},childCount:function(q){let I=W(q);if(I)return X.getChildCount(I)},readFileAsync:function(q,I){var M=W(q);if(M)M.getDataAsync(I);else I(null,"getEntry failed for:"+q)},readAsText:function(q,I){var M=W(q);if(M){var V=M.getData();if(V&&V.length)return V.toString(I||"utf8")}return""},readAsTextAsync:function(q,I,M){var V=W(q);if(V)V.getDataAsync(function(C,L){if(L){I(C,L);return}if(C&&C.length)I(C.toString(M||"utf8"));else I("")});else I("")},deleteFile:function(q,I=!0){var M=W(q);if(M)X.deleteFile(M.entryName,I)},deleteEntry:function(q){var I=W(q);if(I)X.deleteEntry(I.entryName)},addZipComment:function(q){X.comment=q},getZipComment:function(){return X.comment||""},addZipEntryComment:function(q,I){var M=W(q);if(M)M.comment=I},getZipEntryComment:function(q){var I=W(q);if(I)return I.comment||"";return""},updateFile:function(q,I){var M=W(q);if(M)M.setData(I)},addLocalFile:function(q,I,M,V){if(J.fs.existsSync(q)){I=I?H(I):"";let C=EJ.win32.basename(EJ.win32.normalize(q));I+=M?M:C;let L=J.fs.statSync(q),N=L.isFile()?J.fs.readFileSync(q):Buffer.alloc(0);if(L.isDirectory())I+=J.sep;this.addFile(I,N,V,L)}else throw RJ.Errors.FILE_NOT_FOUND(q)},addLocalFileAsync:function(q,I){q=typeof q==="object"?q:{localPath:q};let M=EJ.resolve(q.localPath),{comment:V}=q,{zipPath:C,zipName:L}=q,N=this;J.fs.stat(M,function(R,E){if(R)return I(R,!1);C=C?H(C):"";let w=EJ.win32.basename(EJ.win32.normalize(M));if(C+=L?L:w,E.isFile())J.fs.readFile(M,function(k,y){if(k)return I(k,!1);return N.addFile(C,y,V,E),setImmediate(I,void 0,!0)});else if(E.isDirectory())return C+=J.sep,N.addFile(C,Buffer.alloc(0),V,E),setImmediate(I,void 0,!0)})},addLocalFolder:function(q,I,M){if(M=F(M),I=I?H(I):"",q=EJ.normalize(q),J.fs.existsSync(q)){let V=J.findFiles(q),C=this;if(V.length)for(let L of V){let N=EJ.join(I,D(q,L));if(M(N))C.addLocalFile(L,EJ.dirname(N))}}else throw RJ.Errors.FILE_NOT_FOUND(q)},addLocalFolderAsync:function(q,I,M,V){V=F(V),M=M?H(M):"",q=EJ.normalize(q);var C=this;J.fs.open(q,"r",function(L){if(L&&L.code==="ENOENT")I(void 0,RJ.Errors.FILE_NOT_FOUND(q));else if(L)I(void 0,L);else{var N=J.findFiles(q),R=-1,E=function(){if(R+=1,R<N.length){var w=N[R],k=D(q,w).split("\\").join("/");if(k=k.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),V(k))J.fs.stat(w,function(y,P){if(y)I(void 0,y);if(P.isFile())J.fs.readFile(w,function(v,c){if(v)I(void 0,v);else C.addFile(M+k,c,"",P),E()});else C.addFile(M+k+"/",Buffer.alloc(0),"",P),E()});else process.nextTick(()=>{E()})}else I(!0,void 0)};E()}})},addLocalFolderAsync2:function(q,I){let M=this;q=typeof q==="object"?q:{localPath:q};let V=EJ.resolve(H(q.localPath)),{zipPath:C,filter:L,namefix:N}=q;if(L instanceof RegExp)L=function(w){return function(k){return w.test(k)}}(L);else if(typeof L!=="function")L=function(){return!0};if(C=C?H(C):"",N==="latin1")N=(w)=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"");if(typeof N!=="function")N=(w)=>w;let R=(w)=>EJ.join(C,N(D(V,w))),E=(w)=>EJ.win32.basename(EJ.win32.normalize(N(w)));J.fs.open(V,"r",function(w){if(w&&w.code==="ENOENT")I(void 0,RJ.Errors.FILE_NOT_FOUND(V));else if(w)I(void 0,w);else J.findFilesAsync(V,function(k,y){if(k)return I(k);if(y=y.filter((P)=>L(R(P))),!y.length)I(void 0,!1);setImmediate(y.reverse().reduce(function(P,v){return function(c,a){if(c||a===!1)return setImmediate(P,c,!1);M.addLocalFileAsync({localPath:v,zipPath:EJ.dirname(R(v)),zipName:E(v)},P)}},I))})})},addLocalFolderPromise:function(q,I){return new Promise((M,V)=>{this.addLocalFolderAsync2(Object.assign({localPath:q},I),(C,L)=>{if(C)V(C);if(L)M(this)})})},addFile:function(q,I,M,V){q=K(q);let C=W(q),L=C!=null;if(!L)C=new d80($),C.entryName=q;C.comment=M||"";let N=typeof V==="object"&&V instanceof J.fs.Stats;if(N)C.header.time=V.mtime;var R=C.isDirectory?16:0;let E=C.isDirectory?16384:32768;if(N)E|=4095&V.mode;else if(typeof V==="number")E|=4095&V;else E|=C.isDirectory?493:420;if(R=(R|E<<16)>>>0,C.attr=R,C.setData(I),!L)X.setEntry(C);return C},getEntries:function(q){return X.password=q,X?X.entries:[]},getEntry:function(q){return W(q)},getEntryCount:function(){return X.getEntryCount()},forEach:function(q){return X.forEach(q)},extractEntryTo:function(q,I,M,V,C,L){V=lV(!1,V),C=lV(!1,C),M=lV(!0,M),L=JaA(C,L);var N=W(q);if(!N)throw RJ.Errors.NO_ENTRY();var R=Z(N.entryName),E=G(I,L&&!N.isDirectory?Z(L):M?R:EJ.basename(R));if(N.isDirectory){var w=X.getEntryChildren(N);return w.forEach(function(P){if(P.isDirectory)return;var v=P.getData();if(!v)throw RJ.Errors.CANT_EXTRACT_FILE();var c=Z(M?P.entryName:P.entryName.substring(N.entryName.length)),a=G(I,c);let e=C?P.header.fileAttr:void 0;J.writeFileTo(a,v,V,e)}),!0}var k=N.getData(X.password);if(!k)throw RJ.Errors.CANT_EXTRACT_FILE();if(J.fs.existsSync(E)&&!V)throw RJ.Errors.CANT_OVERRIDE();let y=C?q.header.fileAttr:void 0;return J.writeFileTo(E,k,V,y),!0},test:function(q){if(!X)return!1;for(var I of X.entries)try{if(I.isDirectory)continue;var M=I.getData(q);if(!M)return!1}catch(V){return!1}return!0},extractAllTo:function(q,I,M,V){if(M=lV(!1,M),V=JaA(M,V),I=lV(!1,I),!X)throw RJ.Errors.NO_ZIP();let C=[];X.entries.forEach(function(L){var N=G(q,Z(L.entryName));if(L.isDirectory){if(J.makeDir(N),M)C.push({path:N,attr:L.header.fileAttr});return}var R=L.getData(V);if(!R)throw RJ.Errors.CANT_EXTRACT_FILE();let E=M?L.header.fileAttr:void 0;J.writeFileTo(N,R,I,E);try{J.fs.utimesSync(N,L.header.time,L.header.time)}catch(w){}}),Y(C)},extractAllToAsync:function(q,I,M,V){if(V=p80(I,M,V),M=lV(!1,M),I=lV(!1,I),!V)return new Promise((k,y)=>{this.extractAllToAsync(q,I,M,function(P){if(P)y(P);else k(this)})});if(!X){V(RJ.Errors.NO_ZIP());return}q=EJ.resolve(q);let C=(k)=>G(q,EJ.normalize(Z(k.entryName))),L=(k,y)=>Error(k+': "'+y+'"'),N=[],R=[];X.entries.forEach((k)=>{if(k.isDirectory)N.push(k);else R.push(k)});let E=[];for(let k of N){let y=C(k),P=M?k.header.fileAttr:void 0;try{J.makeDir(y)}catch(v){V(L("Unable to create folder",y));continue}if(P)E.push({path:y,attr:P});try{J.fs.utimesSync(y,k.header.time,k.header.time)}catch(v){}}let w=(k)=>{if(!k)try{Y(E)}catch(y){return V(L("Unable to set folder permissions",y.path||""))}V(k)};R.reverse().reduce(function(k,y){return function(P){if(P)k(P);else{let v=EJ.normalize(Z(y.entryName)),c=G(q,v);y.getDataAsync(function(a,e){if(e)k(e);else if(!a)k(RJ.Errors.CANT_EXTRACT_FILE());else{let r=M?y.header.fileAttr:void 0;J.writeFileToAsync(c,a,I,r,function(i){if(!i)return k(L("Unable to write file",c));J.fs.utimes(c,y.header.time,y.header.time,function(){k()})})}})}}},w)()},writeZip:function(q,I){if(arguments.length===1){if(typeof q==="function")I=q,q=""}if(!q&&$.filename)q=$.filename;if(!q)return;var M=X.compressToBuffer();if(M){var V=J.writeFileTo(q,M,!0);if(typeof I==="function")I(!V?Error("failed"):null,"")}},writeZipPromise:function(q,I){let{overwrite:M,perm:V}=Object.assign({overwrite:!0},I);return new Promise((C,L)=>{if(!q&&$.filename)q=$.filename;if(!q)L("ADM-ZIP: ZIP File Name Missing");this.toBufferPromise().then((N)=>{let R=(E)=>E?C(E):L("ADM-ZIP: Wasn't able to write zip file");J.writeFileToAsync(q,N,M,V,R)},L)})},toBufferPromise:function(){return new Promise((q,I)=>{X.toAsyncBuffer(q,I)})},toBuffer:function(q,I,M,V){if(typeof q==="function")return X.toAsyncBuffer(q,I,M,V),null;return X.compressToBuffer()}}}});var KaA=$A((DvB,GaA)=>{var ZaA={};GaA.exports=ZaA;var XaA={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(XaA).forEach(function(A){var Q=XaA[A],B=ZaA[A]=[];B.open="\x1B["+Q[0]+"m",B.close="\x1B["+Q[1]+"m"})});var HaA=$A((IvB,WaA)=>{WaA.exports=function(A,Q){Q=Q||process.argv;var B=Q.indexOf("--"),$=/^-{1,2}/.test(A)?"":"--",J=Q.indexOf($+A);return J!==-1&&(B===-1?!0:J<B)}});var zaA=$A((MvB,FaA)=>{var n80=qQ("os"),N2=HaA(),$Z=process.env,F_=void 0;if(N2("no-color")||N2("no-colors")||N2("color=false"))F_=!1;else if(N2("color")||N2("colors")||N2("color=true")||N2("color=always"))F_=!0;if("FORCE_COLOR"in $Z)F_=$Z.FORCE_COLOR.length===0||parseInt($Z.FORCE_COLOR,10)!==0;function r80(A){if(A===0)return!1;return{level:A,hasBasic:!0,has256:A>=2,has16m:A>=3}}function o80(A){if(F_===!1)return 0;if(N2("color=16m")||N2("color=full")||N2("color=truecolor"))return 3;if(N2("color=256"))return 2;if(A&&!A.isTTY&&F_!==!0)return 0;var Q=F_?1:0;if(process.platform==="win32"){var B=n80.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 $Z){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(J){return J in $Z})||$Z.CI_NAME==="codeship")return 1;return Q}if("TEAMCITY_VERSION"in $Z)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($Z.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in $Z){var $=parseInt(($Z.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($Z.TERM_PROGRAM){case"iTerm.app":return $>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test($Z.TERM))return 2;if(/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test($Z.TERM))return 1;if("COLORTERM"in $Z)return 1;if($Z.TERM==="dumb")return Q;return Q}function GHA(A){var Q=o80(A);return r80(Q)}FaA.exports={supportsColor:GHA,stdout:GHA(process.stdout),stderr:GHA(process.stderr)}});var qaA=$A((OvB,UaA)=>{UaA.exports=function(Q,B){var $="";Q=Q||"Run the trap, drop the bass",Q=Q.split("");var J={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(Y){Y=Y.toLowerCase();var X=J[Y]||[" "],Z=Math.floor(Math.random()*X.length);if(typeof J[Y]<"u")$+=J[Y][Z];else $+=Y}),$}});var IaA=$A((LvB,DaA)=>{DaA.exports=function(Q,B){Q=Q||" he is here ";var $={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]},J=[].concat($.up,$.down,$.mid);function Y(G){var K=Math.floor(Math.random()*G);return K}function X(G){var K=!1;return J.filter(function(W){K=W===G}),K}function Z(G,K){var W="",H,F;K=K||{},K.up=typeof K.up<"u"?K.up:!0,K.mid=typeof K.mid<"u"?K.mid:!0,K.down=typeof K.down<"u"?K.down:!0,K.size=typeof K.size<"u"?K.size:"maxi",G=G.split("");for(F in G){if(X(F))continue;switch(W=W+G[F],H={up:0,down:0,mid:0},K.size){case"mini":H.up=Y(8),H.mid=Y(2),H.down=Y(8);break;case"maxi":H.up=Y(16)+3,H.mid=Y(4)+1,H.down=Y(64)+3;break;default:H.up=Y(8)+1,H.mid=Y(6)/2,H.down=Y(8)+1;break}var D=["up","mid","down"];for(var q in D){var I=D[q];for(var M=0;M<=H[I];M++)if(K[I])W=W+$[I][Y($[I].length)]}}return W}return Z(Q,B)}});var OaA=$A((NvB,MaA)=>{MaA.exports=function(A){return function(Q,B,$){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 NaA=$A((VvB,LaA)=>{LaA.exports=function(A){return function(Q,B,$){return B%2===0?Q:A.inverse(Q)}}});var CaA=$A((CvB,VaA)=>{VaA.exports=function(A){var Q=["red","yellow","green","blue","magenta"];return function(B,$,J){if(B===" ")return B;else return A[Q[$++%Q.length]](B)}}});var RaA=$A((EvB,EaA)=>{EaA.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,$,J){return B===" "?B:A[Q[Math.round(Math.random()*(Q.length-2))]](B)}}});var PaA=$A((jvB,TaA)=>{var V$={};TaA.exports=V$;V$.themes={};var a80=qQ("util"),pV=V$.styles=KaA(),jaA=Object.defineProperties,s80=new RegExp(/[\r\n]+/g);V$.supportsColor=zaA().supportsColor;if(typeof V$.enabled>"u")V$.enabled=V$.supportsColor()!==!1;V$.enable=function(){V$.enabled=!0};V$.disable=function(){V$.enabled=!1};V$.stripColors=V$.strip=function(A){return(""+A).replace(/\x1B\[\d+m/g,"")};var RvB=V$.stylize=function(Q,B){if(!V$.enabled)return Q+"";var $=pV[B];if(!$&&B in V$)return V$[B](Q);return $.open+Q+$.close},t80=/[|\\{}()[\]^$+*?.]/g,e80=function(A){if(typeof A!=="string")throw TypeError("Expected a string");return A.replace(t80,"\\$&")};function waA(A){var Q=function B(){return Q60.apply(B,arguments)};return Q._styles=A,Q.__proto__=A60,Q}var _aA=function(){var A={};return pV.grey=pV.gray,Object.keys(pV).forEach(function(Q){pV[Q].closeRe=new RegExp(e80(pV[Q].close),"g"),A[Q]={get:function(){return waA(this._styles.concat(Q))}}}),A}(),A60=jaA(function(){},_aA);function Q60(){var A=Array.prototype.slice.call(arguments),Q=A.map(function(X){if(X!=null&&X.constructor===String)return X;else return a80.inspect(X)}).join(" ");if(!V$.enabled||!Q)return Q;var B=Q.indexOf(`
|
|
77
77
|
`)!=-1,$=this._styles,J=$.length;while(J--){var Y=pV[$[J]];if(Q=Y.open+Q.replace(Y.closeRe,Y.open)+Y.close,B)Q=Q.replace(s80,function(X){return Y.close+X+Y.open})}return Q}V$.setTheme=function(A){if(typeof A==="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var Q in A)(function(B){V$[B]=function($){if(typeof A[B]==="object"){var J=$;for(var Y in A[B])J=V$[A[B][Y]](J);return J}return V$[A[B]]($)}})(Q)};function B60(){var A={};return Object.keys(_aA).forEach(function(Q){A[Q]={get:function(){return waA([Q])}}}),A}var $60=function(Q,B){var $=B.split("");return $=$.map(Q),$.join("")};V$.trap=qaA();V$.zalgo=IaA();V$.maps={};V$.maps.america=OaA()(V$);V$.maps.zebra=NaA()(V$);V$.maps.rainbow=CaA()(V$);V$.maps.random=RaA()(V$);for(KHA in V$.maps)(function(A){V$[A]=function(Q){return $60(V$.maps[A],Q)}})(KHA);var KHA;jaA(V$,B60())});var kaA=$A((wvB,SaA)=>{var J60=PaA();SaA.exports=J60});var baA=$A((Y60)=>{Y60.indent=function(Q){return Array(Q+1).join(" ")};Y60.getMaxIndexLength=function(A){var Q=0;return Object.getOwnPropertyNames(A).forEach(function(B){if(A[B]===void 0)return;Q=Math.max(Q,B.length)}),Q}});var xaA=$A((TvB,G60)=>{G60.exports={author:"Rafael de Oleza <rafeca@gmail.com> (https://github.com/rafeca)",name:"prettyjson",description:"Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",version:"1.2.5",homepage:"http://rafeca.com/prettyjson",keywords:["json","cli","formatting","colors"],repository:{type:"git",url:"https://github.com/rafeca/prettyjson.git"},bugs:{url:"https://github.com/rafeca/prettyjson/issues"},main:"./lib/prettyjson",files:["bin/prettyjson","lib/*.js"],license:"MIT",scripts:{test:"npm run jshint && mocha --reporter spec",testwin:"node ./node_modules/mocha/bin/mocha --reporter spec",jshint:"jshint lib/*.js test/*.js",coverage:"istanbul cover _mocha --report lcovonly -- -R spec",coveralls:"npm run coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",changelog:"git log $(git describe --tags --abbrev=0)..HEAD --pretty='* %s' --first-parent"},bin:{prettyjson:"./bin/prettyjson"},dependencies:{colors:"1.4.0",minimist:"^1.2.0"},devDependencies:{coveralls:"^2.11.15",istanbul:"^0.4.5",jshint:"^2.9.4",mocha:"^3.1.2","mocha-lcov-reporter":"^1.2.0",should:"^11.1.1"}}});var faA=$A((F60)=>{var XF=kaA(),DM=baA(),K60=/[^\w\s\n\r\v\t\.,]/i;F60.version=xaA().version;var WHA=function(A,Q){return A!==void 0||Q.renderUndefined},Ot=function(A,Q,B){if(typeof A==="boolean"||typeof A==="number"||typeof A==="function"||A===null||A===void 0||A instanceof Date)return!0;if(typeof A==="string"&&A.indexOf(`
|
|
78
78
|
`)===-1)return!0;if(B.inlineArrays&&!Q){if(Array.isArray(A)&&Ot(A[0],!0,B))return!0}return!1},W60=function(A,Q){if(Q.noColor)return A;if(typeof A==="string")return Q.stringColor?XF[Q.stringColor](A):A;var B=A+"";if(A===!0)return XF.green(B);if(A===!1)return XF.red(B);if(A===null||A===void 0)return XF.grey(B);if(typeof A==="number")if(A>=0)return XF[Q.positiveNumberColor](B);else return XF[Q.negativeNumberColor](B);if(typeof A==="function")return"function() {}";if(Array.isArray(A))return A.join(", ");return B},HHA=function(A,Q){if(A.multilineStringColor===null||A.noColor)return Q;else return XF[A.multilineStringColor](Q)},H60=function(A,Q,B){var $=A.split(`
|
|
@@ -257,8 +257,8 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
257
257
|
`)}function eJQ(A){return[`Bundle upload timed out after ${Math.round(A/1000)}s.`,"The standard upload has to finish the whole transfer within this window and does not retry, so a large bundle or a slow connection can trip it.","What you can do:","1. Retry with the resumable upload, which uploads in chunks and retries automatically: npx @capgo/cli@latest bundle upload --tus","2. Or raise the limit for the standard upload: npx @capgo/cli@latest bundle upload --timeout <milliseconds>"].join(`
|
|
258
258
|
`)}function bA(A){if(!A)return"Unknown error";if(iT(A).isSecurityPolicyError)return SLA(A);let B=A;if(typeof A==="string")return A;if(A instanceof Error){let $=B.message||B.cause?.message||B.stack||A.name,J=B.cause?.name,Y=$.toLowerCase();if(Y.includes("fetch failed")||Y.includes("failed to fetch")||Y.includes("connect timeout")||Y.includes("network")||J?.startsWith("UND_ERR"))return`Network error: ${$}${B.code?` (code ${B.code})`:""}. Check your network connection and API endpoint availability.`;let X=B.status||B.statusCode;return[$,B.code?`Code: ${B.code}`:void 0,X?`Status: ${X}`:void 0].filter(Boolean).join(" | ")||A.name}if(B.message){let $=[B.message,B.code?`Code: ${B.code}`:void 0,B.status||B.statusCode?`Status: ${B.status||B.statusCode}`:void 0].filter(Boolean).join(" | "),J=B.message.toLowerCase();if(J.includes("fetch failed")||J.includes("failed to fetch")||B.error==="Failed to fetch")return`Network error: ${$}. Check your network connection and API endpoint availability.`;if(B.details||B.hint||B.error)return`${$}${$?" | ":""}${B.error?typeof B.error==="string"?B.error:B.error.message??"":""}${B.details?`Details: ${B.details}`:""}${B.hint?`Hint: ${B.hint}`:""}`.trim();return $}if(typeof B.error==="string"&&B.error.length>0)return B.error;if(B.error&&typeof B.error==="object"&&typeof B.error.message==="string"&&B.error.message.length>0)return B.error.message;return`
|
|
259
259
|
${sJQ.default.render(A)}`}function GNA(A){if(typeof A!=="string"&&typeof A!=="number")return;return WX(String(A)).slice(0,A5Q)}function dO0(A){if(typeof A==="string")return WX(A).slice(0,A5Q);if(!A||typeof A!=="object")return String(A);let Q=A,B=GNA(Q.name),$=GNA(Q.message),J=B&&$?`${B}: ${$}`:$||B||Object.prototype.toString.call(A),Y=[["code",Q.code],["errno",Q.errno],["syscall",Q.syscall],["address",Q.address],["port",Q.port]].map(([X,Z])=>{let G=GNA(Z);return G?`${X}=${G}`:void 0}).filter(Boolean);return`${J}${Y.length>0?` (${Y.join(", ")})`:""}`}function Vh(A){let Q=[],B=new Set,$=0,J=(Y,X,Z)=>{if($>=cO0)return;if(Y&&typeof Y==="object"){if(B.has(Y))return;B.add(Y)}$++;let G=" ".repeat(Z);if(Q.push(`${G}${X}${dO0(Y)}`),!Y||typeof Y!=="object")return;let K=Y,W=[K.causingError,K.cause].filter((H,F,D)=>H!==void 0&&H!==null&&D.indexOf(H)===F);for(let H of W)J(H,"Caused by: ",Z+1);if(Array.isArray(K.errors))K.errors.forEach((H,F)=>{J(H,`Contained error ${F+1}: `,Z+1)})};return J(A,"",0),WX(Q.join(`
|
|
260
|
-
`))}function z6({silent:A=!1,stdinIsTTY:Q=!!oJQ.isTTY,stdoutIsTTY:B=!!aJQ.isTTY,ci:$=DNA.isCI}={}){return!A&&Q&&B&&!$}function lO0(A={}){let Q=A.ci??DNA.isCI,B=A.stdinIsTTY??!!oJQ.isTTY,$=A.stdoutIsTTY??!!aJQ.isTTY,J=A.platform??iJQ(),Y="display"in A?A.display:AO.DISPLAY;if(Q||!B||!$)return!1;if(J==="linux"&&!Y)return!1;return!0}async function Q5Q(A){if(!lO0())return;try{await(await Promise.resolve().then(() => (PK(),Ih))).default(A)}catch(Q){if(Q?.code==="ENOENT")return}}function MNA(A){return wzA(A)||_zA(A)}function V1(A){if(wzA(A))return k4Q(A);else if(_zA(A))return b4Q(A);return A}function B5Q(A=V1(vY()),Q=void 0){let B=Q?.split(",")[0],$=B??u4(A,m4);if(!Z4($)){let Y=B?`Package.json at ${$} does not exist`:`No package.json found at ${$}. Run this command from your project root (the folder that contains package.json), or pass --package-json <path> to point at it (for example in a monorepo).`;throw BB.error(Y),Error(Y)}let J=Q5($);return JSON.parse(J)}function mW(A=V1(vY()),Q=void 0){return B5Q(A,Q).scripts}function jG(A=V1(vY()),Q=void 0){return B5Q(A,Q).version??""}function pO0(A){let Q=A.replace("^","").replace("~","");if(UM(Q))try{let B=G1(Q);return QZ(B)}catch{return Q}return Q}async function UZ(A,Q=vY(),B){let $=B?B.split(",").map((X)=>X.trim()).filter(Boolean):[],J=[],Y=(X)=>{let Z=z9(X);if(!J.includes(Z))J.push(Z)};for(let X of $){let Z=z9(Q,X);if(Z4(Z))Y(Uq(Z))}Y(z9(Q)),Y(vY());for(let X of J)try{let Z=`${A}/package.json`,{createRequire:G}=await import("node:module"),W=G(u4(X,"package.json")).resolve(Z),H=JSON.parse(Q5(W,"utf-8"));if(H.version)return H.version}catch{}for(let X of J){let Z=X,G=aC.parse(Z).root;while(Z!==G){let K=u4(Z,"node_modules",A,m4);if(Z4(K))try{let H=JSON.parse(Q5(K,"utf-8"));if(H.version)return H.version}catch{}let W=Uq(Z);if(W===Z)break;Z=W}}if(A==="@capgo/capacitor-updater"){let X=null,Z=u4(Q,"ios","App","Podfile");if(Z4(Z))try{let K=Q5(Z,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);if(K?.[1])X=z9(u4(Q,"ios","App",K[1]))}catch{}if(!X){let G=u4(Q,"android","capacitor.settings.gradle");if(Z4(G))try{let W=Q5(G,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);if(W?.[1])X=z9(u4(Q,"android",W[1])).replace(/\/android$/,"")}catch{}}if(X){let G=u4(X,m4);if(Z4(G))try{let K=JSON.parse(Q5(G,"utf-8"));if(K.version)return K.version}catch{}}}try{let X=B?B.split(",").map((K)=>K.trim()).filter(Boolean).join(","):B,G=(await cW(Q,X)).get(A);if(G)return G}catch{}return null}async function cW(A=V1(vY()),Q=void 0){let B=Q?.split(",").map((Y)=>Y.trim()).filter(Boolean);if(B??=[u4(A,m4)],B){for(let Y of B)if(!Z4(Y)){let X=`Package.json at ${Y} does not exist`;throw BB.error(X),Error(X)}}let $=new Map,{createRequire:J}=await import("node:module");for(let Y of B){let X=Q5(Y),Z=JSON.parse(X),G=Uq(Y),K=(W,H)=>{try{let I=J(u4(G,"package.json")).resolve(`${W}/package.json`),M=JSON.parse(Q5(I,"utf-8"));if(M.version)return M.version}catch{}let F=G,D=aC.parse(F).root;while(F!==D){let q=u4(F,"node_modules",W,m4);if(Z4(q))try{let M=JSON.parse(Q5(q,"utf-8"));if(M.version)return M.version}catch{}let I=Uq(F);if(I===F)break;F=I}return pO0(H)};for(let W in Z.dependencies)$.set(W,K(W,Z.dependencies[W]));for(let W in Z.devDependencies)$.set(W,K(W,Z.devDependencies[W]))}return $}async function iO0(A=V1(vY()),Q=void 0){let B=Q?.split(",").map((J)=>J.trim()).filter(Boolean);if(B??=[u4(A,m4)],B){for(let J of B)if(!Z4(J)){let Y=`Package.json at ${J} does not exist`;throw BB.error(Y),Error(Y)}}let $=new Map;for(let J of B){let Y=Q5(J),X=JSON.parse(Y);for(let Z in X.dependencies??{})if(typeof X.dependencies[Z]==="string")$.set(Z,X.dependencies[Z]);for(let Z in X.devDependencies??{})if(typeof X.devDependencies[Z]==="string")$.set(Z,X.devDependencies[Z])}return $}function nO0(A){if(!A)return!1;if(A.config&&Object.keys(A.config).length>0)return!0;return!!A.path&&Z4(A.path)}async function $5Q(A,Q=!1){let B=N0A;try{let $=await A();if(!nO0($)){if(!Q)BB.error(B);throw new gA(B)}return $}catch($){if($ instanceof gA)throw $;let J=bA($);if(!Q)BB.error(`${B}: ${J}`);throw new gA(B,{cause:J})}}function y0(A=!1){return $5Q(fzA,A)}function m9(A=!1){return $5Q(gzA,A)}async function Ch(A,Q){let B=await m9();if(B?.config)B.config.plugins??={},B.config.plugins.extConfig??={},B.config.plugins[A]??={},B.config.plugins[A]={...B.config.plugins[A],...Q},await Gy(A,B);return B}async function QO(A){return Ch("CapacitorUpdater",A)}function uJQ(A,Q){if(typeof Q!=="string"||!Q.trim())return;try{return oC(Q)}catch(B){throw new gA(`Invalid ${A} in capacitor config: ${B instanceof Error?B.message:String(B)}`)}}async function b5(A=!1){let Q;try{Q=await y0(A)}catch{return mJQ({host:hJQ,hostWeb:HX,hostFilesApi:HNA,hostApi:_2})}let B=uJQ("localApi",Q?.config?.plugins?.CapacitorUpdater?.localApi),$=uJQ("localApiFiles",Q?.config?.plugins?.CapacitorUpdater?.localApiFiles),J={host:Q?.config?.plugins?.CapacitorUpdater?.localHost||hJQ,hostWeb:Q?.config?.plugins?.CapacitorUpdater?.localWebHost||HX,hostFilesApi:$??B??HNA,hostApi:B??_2};if(!B&&Q?.config?.plugins?.CapacitorUpdater?.localSupa&&!ONA().apiHost&&!FNA("CAPGO_API_HOST"))throw new gA("`localSupa` in capacitor.config is no longer supported. Set `localApi` to your Capgo API URL instead.");return mJQ(J)}function X5Q(A){return{apiHost:A.apiHost?oC(A.apiHost):void 0,filesHost:A.filesHost?oC(A.filesHost):void 0}}function ONA(){return Y5Q.getStore()??J5Q}function Z5Q(A){J5Q=X5Q(A)}function V0A(A,Q){return Y5Q.run(X5Q(A),Q)}function FNA(A){let Q=AO[A]?.trim();return Q?oC(Q):void 0}function mJQ(A){let Q=ONA(),B=Q.apiHost??FNA("CAPGO_API_HOST"),$=Q.filesHost??(Q.apiHost?void 0:FNA("CAPGO_FILES_HOST"));if(B)A.hostApi=B,A.hostFilesApi=B;if($)A.hostFilesApi=$;return A}function cJQ(A){return typeof A==="object"&&A!==null}function rO0(A){if(!cJQ(A))return!1;let Q=A.capacitor;if(cJQ(Q)&&(Q.ios!==void 0||Q.android!==void 0))return!0;return!1}function oO0(A){if(Z4(u4(A,"plugin.xml")))return!0;let Q=u4(A,m4);if(!Z4(Q))return!1;try{return rO0(JSON.parse(Q5(Q,"utf-8")))}catch{return!1}}function K5Q(A,Q){if(Q)return Q;return A===_2||A===HNA?k$():void 0}async function OF(A=!1,Q,B){let $=(K)=>{let W={...K};return qAQ(W,void 0,A),W},J=await b5(A),Y=J.hostApi,X=dJQ.get(Y);if(X)return $(X);let Z=KNA.get(Y);if(!Q&&Z)return Z.then($);let G=(async()=>{try{let K=K5Q(Y,B),W=await fetch(`${Y}/private/config`,{...Q?{signal:Q}:{},redirect:"
|
|
261
|
-
`)[0].trim()}async function C0A(A){let Q=await y9(A);if(Q?.error==="channel_zip_required"||Q?.error==="channel_delta_required")return Q.message||Q.error;let B=A instanceof Error?A.message:String(A??"");if(B.includes("CHANNEL_ZIP_REQUIRED"))return lJQ(B,"CHANNEL_ZIP_REQUIRED");if(B.includes("CHANNEL_DELTA_REQUIRED"))return lJQ(B,"CHANNEL_DELTA_REQUIRED");return null}function oC(A){let Q=new URL(A);if(!["http:","https:"].includes(Q.protocol))throw new gA("Capgo API host must use HTTPS");let B=Q.hostname==="localhost"||Q.hostname==="127.0.0.1"||Q.hostname==="[::1]";if(Q.protocol==="http:"&&!B)throw new gA("Capgo API host must use HTTPS (HTTP is only allowed for localhost)");if(Q.username||Q.password)throw new gA("Capgo API host must not include credentials");if(Q.search||Q.hash)throw new gA("Capgo API host must not include query parameters or fragments");return`${Q.origin}${XX(Q.pathname)}`}async function Eh(A,Q=!0,B){let $=await b5(Q),J=A?oC(A):$.hostApi,Y=B?oC(B):A&&J!==$.hostApi?J:$.hostFilesApi;return{apiHost:J,filesHost:Y}}async function S$(A){let Q=await y9(A);if(Q){let B=AP(Q);if(B)return B}return bA(A)}async function C0(A,Q){let B=(Q.method??"POST").toUpperCase(),$=await Eh(Q.apiHost),J=Q.useFilesHost?$.filesHost:$.apiHost,Y=`${XX(J)}/${A.replace(/^\//,"")}`,X=Q.instrument!==!1&&yrA()?drA(A.replace(/^\//,"")):fetch;try{let Z=await X(Y,{method:B,redirect:"error",headers:A4({"Content-Type":"application/json",Authorization:Q.apikey,capgkey:Q.apikey,...Q.apiVersion?{capgo_api:Q.apiVersion}:{}}),body:B==="GET"||B==="HEAD"?void 0:typeof Q.body==="string"?Q.body:JSON.stringify(Q.body??{}),signal:Q.signal});if(!Z.ok)return{data:null,error:new u_(Z)};return{data:(Z.headers.get("content-type")??"").includes("application/json")?await Z.json().catch(()=>null):await Z.text().catch(()=>null),error:null}}catch(Z){return{data:null,error:Z instanceof Error?Z:Error(String(Z))}}}async function tC(A,Q=!0){return(await Eh(A?.apiHost,Q)).apiHost}async function bB(A,Q,B=!1,$,J){let Y=p2A("capgkey",A),X=async()=>{await OF(B,$,Y);let K=await Eh(void 0,B);if(Q&&!B)BB.info(`Using custom Capgo API ${K.apiHost}`);return{apikey:Y,...K}};if(!Q&&!J)return X();let Z=ONA(),G=Q?oC(Q):Z.apiHost;return V0A({apiHost:G,filesHost:J??(G===Z.apiHost?Z.filesHost:void 0)},X)}async function E0A(A,Q,B={}){let{data:$,error:J}=await C0(`private/cli/members/2fa-status?org_id=${encodeURIComponent(Q)}`,{apikey:A,method:"GET",body:void 0,apiHost:B.apiHost});if(J)throw J;return $??[]}async function R0A(A,Q,B={}){let{data:$,error:J}=await C0(`private/cli/members/password-policy?org_id=${encodeURIComponent(Q)}`,{apikey:A,method:"GET",body:void 0,apiHost:B.apiHost});if(J)throw J;return $??[]}function I0A(A){try{if(!Z4(A))return;return Q5(A,"utf8").trim()||void 0}catch{return}}function k$(){let A=AO.CAPGO_TOKEN?.trim();if(A)return A;let Q=I0A(`${pJQ()}/.capgo`);if(Q)return Q;return I0A(".capgo")}function D0(A=!1,Q=(B)=>BB.info(B)){let B=AO.CAPGO_TOKEN?.trim();if(B){if(!A)Q("Use CAPGO_TOKEN environment variable");return B}let J=`${pJQ()}/.capgo`,Y=I0A(J);if(Y){if(!A)Q(`Use global API key ${J}`)}else if(J=".capgo",Y=I0A(J),Y&&!A)Q(`Use local API key ${J}`);if(!Y){let Z=`No Capgo API key found. Run \`${i4Q()}\` first, then retry this command.`;throw BB.error(Z),new gA(Z)}return Y}async function*LNA(A){let Q=await sT(A,{withFileTypes:!0});for(let B of Q){let $=z9(A,B.name);if(B.isDirectory()&&!B.name.startsWith(".")&&!B.name.startsWith("node_modules")&&!B.name.startsWith("dist"))yield*LNA($);else yield $}}function eC(A){let B=(A.endsWith(".br")?A.slice(0,-3):A).split(".").pop()?.toLowerCase()||"";return{html:"text/html",htm:"text/html",js:"application/javascript",mjs:"application/javascript",cjs:"application/javascript",css:"text/css",json:"application/json",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",avif:"image/avif",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",mp4:"video/mp4",webm:"video/webm",xml:"application/xml",txt:"text/plain",md:"text/markdown",pdf:"application/pdf",wasm:"application/wasm",map:"application/json"}[B]||"application/octet-stream"}function tM(A,Q){return`${A}-${Q?"ts":"js"}`}function eM(A,Q){if(!Q)BB.info(`Found ${A} project`)}function aO0(A){if(Z4(z9(A,"angular.json")))return"angular";if(Z4(z9(A,"nuxt.config.js"))||Z4(z9(A,"nuxt.config.ts")))return"nuxtjs";if(Z4(z9(A,"next.config.js"))||Z4(z9(A,"next.config.mjs"))||Z4(z9(A,"next.config.ts")))return"nextjs";if(Z4(z9(A,"svelte.config.js"))||Z4(z9(A,"svelte.config.ts")))return"sveltekit";if(Z4(z9(A,"vue.config.js"))||Z4(z9(A,"vue.config.ts")))return"vue"}function H5Q(A){if(A.get("@angular/core"))return"angular";if(A.get("nuxt"))return"nuxtjs";if(A.get("next"))return"nextjs";if(A.get("@sveltejs/kit"))return"sveltekit";if(A.get("svelte"))return"svelte";if(A.get("vue"))return"vue";if(A.get("react"))return"react"}async function sO0(A,Q){let B=Z4(z9(A,"tsconfig.json")),$=aO0(A);if($)return eM($,Q),tM($,B);let J=z9(A,m4);if(!Z4(J))return;let Y=await cW(void 0,J),X=H5Q(Y);if(!X)return;return eM(X,Q),tM(X,B)}function WNA(A,Q){if(!Q)return;let B=z9(Q);if(!A.includes(B))A.push(B)}function tO0(A){let Q=A,B=aC.parse(Q).root;while(!0){if(Z4(z9(Q,m4)))return Q;if(Q===B)return;let $=Uq(Q);if($===Q)return;Q=$}}function eO0(A){let Q=[],B=A?.split(",").map(($)=>$.trim()).filter(Boolean)[0];if(B)WNA(Q,Uq(z9(B)));return WNA(Q,tO0(vY())),WNA(Q,V1(vY())),Q}async function qZ(A){let Q=vY(),B=!1,$=A?.quiet??!1;for(let Y of eO0(A?.packageJsonPath)){let X=await sO0(Y,$);if(X)return X}let J=z9(Q,"tsconfig.json");if(Z4(J))B=!0;for await(let Y of LNA(Q)){if(Y.includes("angular.json"))return eM("angular",$),tM("angular",B);if(Y.includes("nuxt.config.js")||Y.includes("nuxt.config.ts"))return eM("nuxtjs",$),tM("nuxtjs",B);if(Y.includes("next.config.js")||Y.includes("next.config.mjs")||Y.includes("next.config.ts"))return eM("nextjs",$),tM("nextjs",B);if(Y.includes("svelte.config.js")||Y.includes("svelte.config.ts"))return eM("sveltekit",$),tM("sveltekit",B);if(Y.includes("vue.config.js")||Y.includes("vue.config.ts"))return eM("vue",$),tM("vue",B);if(Y.includes(m4)){let X=Uq(Y),Z=await cW(X),G=H5Q(Z);if(G)return eM(G,$),tM(G,B)}}return"unknown"}function F5Q(A,Q,B=vY()){if(A==="angular-js"||A==="angular-ts")return Q?"src/main.ts":"src/main.js";if(A==="nextjs-js"||A==="nextjs-ts")return Q?"src/app/layout.tsx":"src/app/layout.js";if(A==="svelte-js"||A==="svelte-ts")return Q?"src/main.ts":"src/main.js";if(A==="vue-js"||A==="vue-ts")return Q?"src/main.ts":"src/main.js";if(A==="react-js"||A==="react-ts"){let $=Q?"src/main.tsx":"src/main.js",J=Q?"src/index.tsx":"src/index.js";if(Z4(z9(B,$)))return $;return J}return null}async function SK(A){let Q=A.replace(/-(?:ts|js)$/,"");if(Q==="angular")return BB.info("Angular project detected"),"build";if(Q==="nuxtjs")return BB.info("Nuxtjs project detected"),"generate";if(Q==="nextjs"){if(BB.info("Nextjs project detected"),BB.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),BB.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await h1({message:"Do you want to continue?"}))throw BB.error("Build command selection aborted by user"),Error("Build command selection aborted by user");return"build"}if(Q==="sveltekit"){if(BB.info("Sveltekit project detected"),BB.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),BB.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await h1({message:"Do you want to continue?"}))throw BB.error("Build command selection aborted by user"),Error("Build command selection aborted by user");return"build"}return"build"}async function QP(A=!1,Q=vY()){let B=/(main|index)\.(ts|tsx|js|jsx)$/,$="",J=z9(Q),Y=J.split("/").length;for await(let X of LNA(J))if(X.split("/").length-Y<=2&&B.test(X)){if($=X,!A)BB.info(`Found main file here ${X}`);break}return $}async function z5Q(A,Q,B,$){let J={app_id:Q,name:B,version:0};try{let Y=await C0("files/upload_link",{apikey:A,body:J,useFilesHost:!0,apiHost:$?.apiHost});if(Y.error){if(Y.error instanceof u_){let X=await Y.error.context.json().catch(()=>({}));BB.error(`Upload URL error: ${X.status||JSON.stringify(X)}`)}else BB.error(`Cannot get upload url: ${Y.error.message}`);return""}return Y.data?.url??""}catch(Y){BB.error(`Cannot get upload url ${bA(Y)}`)}return""}async function*U5Q(A){let Q=sT(A,{withFileTypes:!0});for(let B of Q){let $=u4(A,B.name);if(B.isDirectory())yield*U5Q($);else yield $}}function dW(A,Q="5.10.0",B="6.25.0",$="7.25.0"){if(A.major===5&&IG(A,G1(Q)))return!0;if(A.major===6&&IG(A,G1(B)))return!0;if(A.major===7&&IG(A,G1($)))return!0;return!1}async function _0A(A){let Q=[],B=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let $ of U5Q(A)){if(B.some((Z)=>$.includes(Z))){BB.info(`Ignoring file ${$}, please ensure you have only required files in your dist folder`);continue}let J=Q5($);if(J.length===0){BB.info(`Ignoring empty file ${$}, please ensure you have only required files in your dist folder`);continue}let Y=await bM(J,"sha256"),X=nJQ(A,$);if(X.startsWith("/"))X=X.substring(1);Q.push({file:X,hash:Y})}return Q}async function T0A(A){if(iJQ()==="win32")return QL0(A);else return AL0(A)}function AL0(A){let Q=new qNA.default;return Q.addLocalFolder(A),Q.toBuffer()}async function QL0(A){BB.info("Zipping file windows mode");let Q=new qNA.default,B=($,J)=>{let Y=sT($);for(let X of Y){let Z=u4($,X),G=yO0(Z);if(G.isFile()){let K=Q5(Z);Q.addFile(u4(J,X).split(rJQ).join("/"),K)}else if(G.isDirectory())B(Z,u4(J,X))}};return B(A,""),Q.toBuffer()}function jh(A){let Q=c4();return`App ${A} does not exist, run first \`${Q.runner} @capgo/cli app add ${A}\` to create it`}function NNA(A){let B=A?.originalResponse?.getBody?.(),$=A instanceof Error?A.message:String(A??"");return`${B??""} ${$}`.includes("app_not_found")}async function q5Q(A,Q,B,$,J,Y,X,Z){return new Promise((G,K)=>{gB(A,{channel:"app",event:"App TUS upload",org_id:B,tracking_version:2,tags:{"app-id":$}}),new M0A.Upload(Q,{endpoint:`${X.hostFilesApi}/files/upload/attachments/`,chunkSize:Z,retryDelays:[...eT],metadataForPartialUploads:{filename:`orgs/${B}/apps/${$}/${J}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${B}/apps/${$}/${J}.zip`,filetype:"application/zip"},headers:A4({Authorization:A}),onError(H){if(BB.error(`Error uploading bundle: ${H.message}`),NNA(H)){K(Error(jh($)));return}if(H instanceof M0A.DetailedError){let F=H.originalResponse?.getBody(),D=H.originalResponse?.getStatus(),q=H.originalRequest?.getURL(),I=(()=>{try{let M=JSON.parse(F||'{"error": "unknown error"}');return M.status||M.error||M.message||"unknown error"}catch{return F||H.message}})();K(Error(`TUS upload failed (status ${D??"unknown"}, url ${q??"unknown"}): ${I}`))}else K(Error(`TUS upload failed: ${H.message||H.toString()}`))},onProgress(H,F){let D=(H/F*100).toFixed(2);Y.message(`Uploaded ${D}%`)},async onSuccess(){await gB(A,{channel:"app",event:"App TUS done",org_id:B,tracking_version:2,tags:{"app-id":$}}).catch(),G(!0)}}).start()})}async function BP(A,Q,B,$){let Y=await C0("private/delete_failed_version",{apikey:A,method:"DELETE",body:{app_id:Q,name:B},apiHost:$?.apiHost});if(Y.error){if(Y.error instanceof u_){let X=await Y.error.context.json().catch(()=>({}));throw Error(X.status||X.message||JSON.stringify(X))}throw Error(Y.error.message)}}async function D5Q(A,Q,B,$,J){let Y={app_id:Q,name:B,manifest:$},X=await CM(()=>C0("private/set_manifest",{apikey:A,body:Y,apiHost:J?.apiHost}));if(X.error){if(X.error instanceof u_){let Z=await X.error.context.json().catch(()=>({}));throw Error(Z.error||Z.status||Z.message||JSON.stringify(Z))}throw Error(X.error.message)}}async function gB(A,Q,B,$,J,Y){let X=Date.now();if((L2(AO.CAPGO_DISABLE_TELEMETRY)||L2(AO.CAPGO_DISABLE_POSTHOG))&&!Q.notifyConsole)return;try{let G={};try{G=LFA()}catch(q){if(B)BB.error(`Failed to enrich event tags, sending caller tags only: ${bA(q)}`)}let K={...Q,nonPersonTags:{...G,...Q.nonPersonTags??{}}};if(B)BB.info(`Get remove config: for ${Q.event}`);let W=J??(await OF(!0,$)).hostApi;if(B)BB.info(`Sending analytics event: ${JSON.stringify(K)}`);let H=new AbortController,F=setTimeout(()=>H.abort(),1e4),D=$?typeof AbortSignal.any==="function"?AbortSignal.any([H.signal,$]):$:H.signal;try{e4("telemetry request started");let q=await fetch(`${XX(W)}/private/events`,{method:"POST",body:JSON.stringify(K),headers:A4({"Content-Type":"application/json",capgkey:A}),signal:D,redirect:Y});if(e4("telemetry response received",{duration_ms:Date.now()-X,status:q.status}),clearTimeout(F),!q.ok)throw Error(`HTTP error! status: ${q.status}`);let I=await q.json();if(I.error&&B)BB.error(`Failed to send analytics event: ${I.error}`)}finally{clearTimeout(F)}}catch(G){if(e4("telemetry request failed",{duration_ms:Date.now()-X,error:Xq(G)}),B)BB.error("Failed to send Stats event details:"),BB.error(bA(G))}}function VNA(A){if(BB.error(`
|
|
260
|
+
`))}function z6({silent:A=!1,stdinIsTTY:Q=!!oJQ.isTTY,stdoutIsTTY:B=!!aJQ.isTTY,ci:$=DNA.isCI}={}){return!A&&Q&&B&&!$}function lO0(A={}){let Q=A.ci??DNA.isCI,B=A.stdinIsTTY??!!oJQ.isTTY,$=A.stdoutIsTTY??!!aJQ.isTTY,J=A.platform??iJQ(),Y="display"in A?A.display:AO.DISPLAY;if(Q||!B||!$)return!1;if(J==="linux"&&!Y)return!1;return!0}async function Q5Q(A){if(!lO0())return;try{await(await Promise.resolve().then(() => (PK(),Ih))).default(A)}catch(Q){if(Q?.code==="ENOENT")return}}function MNA(A){return wzA(A)||_zA(A)}function V1(A){if(wzA(A))return k4Q(A);else if(_zA(A))return b4Q(A);return A}function B5Q(A=V1(vY()),Q=void 0){let B=Q?.split(",")[0],$=B??u4(A,m4);if(!Z4($)){let Y=B?`Package.json at ${$} does not exist`:`No package.json found at ${$}. Run this command from your project root (the folder that contains package.json), or pass --package-json <path> to point at it (for example in a monorepo).`;throw BB.error(Y),Error(Y)}let J=Q5($);return JSON.parse(J)}function mW(A=V1(vY()),Q=void 0){return B5Q(A,Q).scripts}function jG(A=V1(vY()),Q=void 0){return B5Q(A,Q).version??""}function pO0(A){let Q=A.replace("^","").replace("~","");if(UM(Q))try{let B=G1(Q);return QZ(B)}catch{return Q}return Q}async function UZ(A,Q=vY(),B){let $=B?B.split(",").map((X)=>X.trim()).filter(Boolean):[],J=[],Y=(X)=>{let Z=z9(X);if(!J.includes(Z))J.push(Z)};for(let X of $){let Z=z9(Q,X);if(Z4(Z))Y(Uq(Z))}Y(z9(Q)),Y(vY());for(let X of J)try{let Z=`${A}/package.json`,{createRequire:G}=await import("node:module"),W=G(u4(X,"package.json")).resolve(Z),H=JSON.parse(Q5(W,"utf-8"));if(H.version)return H.version}catch{}for(let X of J){let Z=X,G=aC.parse(Z).root;while(Z!==G){let K=u4(Z,"node_modules",A,m4);if(Z4(K))try{let H=JSON.parse(Q5(K,"utf-8"));if(H.version)return H.version}catch{}let W=Uq(Z);if(W===Z)break;Z=W}}if(A==="@capgo/capacitor-updater"){let X=null,Z=u4(Q,"ios","App","Podfile");if(Z4(Z))try{let K=Q5(Z,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);if(K?.[1])X=z9(u4(Q,"ios","App",K[1]))}catch{}if(!X){let G=u4(Q,"android","capacitor.settings.gradle");if(Z4(G))try{let W=Q5(G,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);if(W?.[1])X=z9(u4(Q,"android",W[1])).replace(/\/android$/,"")}catch{}}if(X){let G=u4(X,m4);if(Z4(G))try{let K=JSON.parse(Q5(G,"utf-8"));if(K.version)return K.version}catch{}}}try{let X=B?B.split(",").map((K)=>K.trim()).filter(Boolean).join(","):B,G=(await cW(Q,X)).get(A);if(G)return G}catch{}return null}async function cW(A=V1(vY()),Q=void 0){let B=Q?.split(",").map((Y)=>Y.trim()).filter(Boolean);if(B??=[u4(A,m4)],B){for(let Y of B)if(!Z4(Y)){let X=`Package.json at ${Y} does not exist`;throw BB.error(X),Error(X)}}let $=new Map,{createRequire:J}=await import("node:module");for(let Y of B){let X=Q5(Y),Z=JSON.parse(X),G=Uq(Y),K=(W,H)=>{try{let I=J(u4(G,"package.json")).resolve(`${W}/package.json`),M=JSON.parse(Q5(I,"utf-8"));if(M.version)return M.version}catch{}let F=G,D=aC.parse(F).root;while(F!==D){let q=u4(F,"node_modules",W,m4);if(Z4(q))try{let M=JSON.parse(Q5(q,"utf-8"));if(M.version)return M.version}catch{}let I=Uq(F);if(I===F)break;F=I}return pO0(H)};for(let W in Z.dependencies)$.set(W,K(W,Z.dependencies[W]));for(let W in Z.devDependencies)$.set(W,K(W,Z.devDependencies[W]))}return $}async function iO0(A=V1(vY()),Q=void 0){let B=Q?.split(",").map((J)=>J.trim()).filter(Boolean);if(B??=[u4(A,m4)],B){for(let J of B)if(!Z4(J)){let Y=`Package.json at ${J} does not exist`;throw BB.error(Y),Error(Y)}}let $=new Map;for(let J of B){let Y=Q5(J),X=JSON.parse(Y);for(let Z in X.dependencies??{})if(typeof X.dependencies[Z]==="string")$.set(Z,X.dependencies[Z]);for(let Z in X.devDependencies??{})if(typeof X.devDependencies[Z]==="string")$.set(Z,X.devDependencies[Z])}return $}function nO0(A){if(!A)return!1;if(A.config&&Object.keys(A.config).length>0)return!0;return!!A.path&&Z4(A.path)}async function $5Q(A,Q=!1){let B=N0A;try{let $=await A();if(!nO0($)){if(!Q)BB.error(B);throw new gA(B)}return $}catch($){if($ instanceof gA)throw $;let J=bA($);if(!Q)BB.error(`${B}: ${J}`);throw new gA(B,{cause:J})}}function y0(A=!1){return $5Q(fzA,A)}function m9(A=!1){return $5Q(gzA,A)}async function Ch(A,Q){let B=await m9();if(B?.config)B.config.plugins??={},B.config.plugins.extConfig??={},B.config.plugins[A]??={},B.config.plugins[A]={...B.config.plugins[A],...Q},await Gy(A,B);return B}async function QO(A){return Ch("CapacitorUpdater",A)}function uJQ(A,Q){if(typeof Q!=="string"||!Q.trim())return;try{return oC(Q)}catch(B){throw new gA(`Invalid ${A} in capacitor config: ${B instanceof Error?B.message:String(B)}`)}}async function b5(A=!1){let Q;try{Q=await y0(A)}catch{return mJQ({host:hJQ,hostWeb:HX,hostFilesApi:HNA,hostApi:_2})}let B=uJQ("localApi",Q?.config?.plugins?.CapacitorUpdater?.localApi),$=uJQ("localApiFiles",Q?.config?.plugins?.CapacitorUpdater?.localApiFiles),J={host:Q?.config?.plugins?.CapacitorUpdater?.localHost||hJQ,hostWeb:Q?.config?.plugins?.CapacitorUpdater?.localWebHost||HX,hostFilesApi:$??B??HNA,hostApi:B??_2};if(!B&&Q?.config?.plugins?.CapacitorUpdater?.localSupa&&!ONA().apiHost&&!FNA("CAPGO_API_HOST"))throw new gA("`localSupa` in capacitor.config is no longer supported. Set `localApi` to your Capgo API URL instead.");return mJQ(J)}function X5Q(A){return{apiHost:A.apiHost?oC(A.apiHost):void 0,filesHost:A.filesHost?oC(A.filesHost):void 0}}function ONA(){return Y5Q.getStore()??J5Q}function Z5Q(A){J5Q=X5Q(A)}function V0A(A,Q){return Y5Q.run(X5Q(A),Q)}function FNA(A){let Q=AO[A]?.trim();return Q?oC(Q):void 0}function mJQ(A){let Q=ONA(),B=Q.apiHost??FNA("CAPGO_API_HOST"),$=Q.filesHost??(Q.apiHost?void 0:FNA("CAPGO_FILES_HOST"));if(B)A.hostApi=B,A.hostFilesApi=B;if($)A.hostFilesApi=$;return A}function cJQ(A){return typeof A==="object"&&A!==null}function rO0(A){if(!cJQ(A))return!1;let Q=A.capacitor;if(cJQ(Q)&&(Q.ios!==void 0||Q.android!==void 0))return!0;return!1}function oO0(A){if(Z4(u4(A,"plugin.xml")))return!0;let Q=u4(A,m4);if(!Z4(Q))return!1;try{return rO0(JSON.parse(Q5(Q,"utf-8")))}catch{return!1}}function K5Q(A,Q){if(Q)return Q;return A===_2||A===HNA?k$():void 0}async function OF(A=!1,Q,B){let $=(K)=>{let W={...K};return qAQ(W,void 0,A),W},J=await b5(A),Y=J.hostApi,X=dJQ.get(Y);if(X)return $(X);let Z=KNA.get(Y);if(!Q&&Z)return Z.then($);let G=(async()=>{try{let K=K5Q(Y,B),W=await fetch(`${Y}/private/config`,{...Q?{signal:Q}:{},redirect:"manual",headers:A4(K?{capgkey:K}:void 0)});if(!W.ok)throw Error(`HTTP error! status: ${W.status}`);let F={...await W.json(),...J};return dJQ.set(Y,F),{...F}}catch{if(!A)BB.info(`Local config ${bA(J)}`);return{...J}}finally{if(!Q)KNA.delete(Y)}})();if(!Q)KNA.set(Y,G);return G.then($)}async function W5Q(A){let Q=await b5();try{let B=K5Q(Q.hostFilesApi,A),$=await fetch(`${Q.hostFilesApi}/files/config`,{redirect:"manual",headers:A4(B?{capgkey:B}:void 0)});if(!$.ok)throw Error(`HTTP error! status: ${$.status}`);return await $.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:uO0,maxChunkSize:mO0,alertUploadSize:hO0}}}function AP(A){if(!A||typeof A!=="object")return"";let Q=A;return[Q.error,Q.message,Q.status].filter(Boolean).join(" | ")}function lJQ(A,Q){let B=A.indexOf(Q);if(B<0)return A;return A.slice(B+Q.length).replace(/^:\s*/,"").split(`
|
|
261
|
+
`)[0].trim()}async function C0A(A){let Q=await y9(A);if(Q?.error==="channel_zip_required"||Q?.error==="channel_delta_required")return Q.message||Q.error;let B=A instanceof Error?A.message:String(A??"");if(B.includes("CHANNEL_ZIP_REQUIRED"))return lJQ(B,"CHANNEL_ZIP_REQUIRED");if(B.includes("CHANNEL_DELTA_REQUIRED"))return lJQ(B,"CHANNEL_DELTA_REQUIRED");return null}function oC(A){let Q=new URL(A);if(!["http:","https:"].includes(Q.protocol))throw new gA("Capgo API host must use HTTPS");let B=Q.hostname==="localhost"||Q.hostname==="127.0.0.1"||Q.hostname==="[::1]";if(Q.protocol==="http:"&&!B)throw new gA("Capgo API host must use HTTPS (HTTP is only allowed for localhost)");if(Q.username||Q.password)throw new gA("Capgo API host must not include credentials");if(Q.search||Q.hash)throw new gA("Capgo API host must not include query parameters or fragments");return`${Q.origin}${XX(Q.pathname)}`}async function Eh(A,Q=!0,B){let $=await b5(Q),J=A?oC(A):$.hostApi,Y=B?oC(B):A&&J!==$.hostApi?J:$.hostFilesApi;return{apiHost:J,filesHost:Y}}async function S$(A){let Q=await y9(A);if(Q){let B=AP(Q);if(B)return B}return bA(A)}async function C0(A,Q){let B=(Q.method??"POST").toUpperCase(),$=await Eh(Q.apiHost),J=Q.useFilesHost?$.filesHost:$.apiHost,Y=`${XX(J)}/${A.replace(/^\//,"")}`,X=Q.instrument!==!1&&yrA()?drA(A.replace(/^\//,"")):fetch;try{let Z=await X(Y,{method:B,redirect:"manual",headers:A4({"Content-Type":"application/json",Authorization:Q.apikey,capgkey:Q.apikey,...Q.apiVersion?{capgo_api:Q.apiVersion}:{}}),body:B==="GET"||B==="HEAD"?void 0:typeof Q.body==="string"?Q.body:JSON.stringify(Q.body??{}),signal:Q.signal});if(!Z.ok)return{data:null,error:new u_(Z)};return{data:(Z.headers.get("content-type")??"").includes("application/json")?await Z.json().catch(()=>null):await Z.text().catch(()=>null),error:null}}catch(Z){return{data:null,error:Z instanceof Error?Z:Error(String(Z))}}}async function tC(A,Q=!0){return(await Eh(A?.apiHost,Q)).apiHost}async function bB(A,Q,B=!1,$,J){let Y=p2A("capgkey",A),X=async()=>{await OF(B,$,Y);let K=await Eh(void 0,B);if(Q&&!B)BB.info(`Using custom Capgo API ${K.apiHost}`);return{apikey:Y,...K}};if(!Q&&!J)return X();let Z=ONA(),G=Q?oC(Q):Z.apiHost;return V0A({apiHost:G,filesHost:J??(G===Z.apiHost?Z.filesHost:void 0)},X)}async function E0A(A,Q,B={}){let{data:$,error:J}=await C0(`private/cli/members/2fa-status?org_id=${encodeURIComponent(Q)}`,{apikey:A,method:"GET",body:void 0,apiHost:B.apiHost});if(J)throw J;return $??[]}async function R0A(A,Q,B={}){let{data:$,error:J}=await C0(`private/cli/members/password-policy?org_id=${encodeURIComponent(Q)}`,{apikey:A,method:"GET",body:void 0,apiHost:B.apiHost});if(J)throw J;return $??[]}function I0A(A){try{if(!Z4(A))return;return Q5(A,"utf8").trim()||void 0}catch{return}}function k$(){let A=AO.CAPGO_TOKEN?.trim();if(A)return A;let Q=I0A(`${pJQ()}/.capgo`);if(Q)return Q;return I0A(".capgo")}function D0(A=!1,Q=(B)=>BB.info(B)){let B=AO.CAPGO_TOKEN?.trim();if(B){if(!A)Q("Use CAPGO_TOKEN environment variable");return B}let J=`${pJQ()}/.capgo`,Y=I0A(J);if(Y){if(!A)Q(`Use global API key ${J}`)}else if(J=".capgo",Y=I0A(J),Y&&!A)Q(`Use local API key ${J}`);if(!Y){let Z=`No Capgo API key found. Run \`${i4Q()}\` first, then retry this command.`;throw BB.error(Z),new gA(Z)}return Y}async function*LNA(A){let Q=await sT(A,{withFileTypes:!0});for(let B of Q){let $=z9(A,B.name);if(B.isDirectory()&&!B.name.startsWith(".")&&!B.name.startsWith("node_modules")&&!B.name.startsWith("dist"))yield*LNA($);else yield $}}function eC(A){let B=(A.endsWith(".br")?A.slice(0,-3):A).split(".").pop()?.toLowerCase()||"";return{html:"text/html",htm:"text/html",js:"application/javascript",mjs:"application/javascript",cjs:"application/javascript",css:"text/css",json:"application/json",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",avif:"image/avif",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",mp4:"video/mp4",webm:"video/webm",xml:"application/xml",txt:"text/plain",md:"text/markdown",pdf:"application/pdf",wasm:"application/wasm",map:"application/json"}[B]||"application/octet-stream"}function tM(A,Q){return`${A}-${Q?"ts":"js"}`}function eM(A,Q){if(!Q)BB.info(`Found ${A} project`)}function aO0(A){if(Z4(z9(A,"angular.json")))return"angular";if(Z4(z9(A,"nuxt.config.js"))||Z4(z9(A,"nuxt.config.ts")))return"nuxtjs";if(Z4(z9(A,"next.config.js"))||Z4(z9(A,"next.config.mjs"))||Z4(z9(A,"next.config.ts")))return"nextjs";if(Z4(z9(A,"svelte.config.js"))||Z4(z9(A,"svelte.config.ts")))return"sveltekit";if(Z4(z9(A,"vue.config.js"))||Z4(z9(A,"vue.config.ts")))return"vue"}function H5Q(A){if(A.get("@angular/core"))return"angular";if(A.get("nuxt"))return"nuxtjs";if(A.get("next"))return"nextjs";if(A.get("@sveltejs/kit"))return"sveltekit";if(A.get("svelte"))return"svelte";if(A.get("vue"))return"vue";if(A.get("react"))return"react"}async function sO0(A,Q){let B=Z4(z9(A,"tsconfig.json")),$=aO0(A);if($)return eM($,Q),tM($,B);let J=z9(A,m4);if(!Z4(J))return;let Y=await cW(void 0,J),X=H5Q(Y);if(!X)return;return eM(X,Q),tM(X,B)}function WNA(A,Q){if(!Q)return;let B=z9(Q);if(!A.includes(B))A.push(B)}function tO0(A){let Q=A,B=aC.parse(Q).root;while(!0){if(Z4(z9(Q,m4)))return Q;if(Q===B)return;let $=Uq(Q);if($===Q)return;Q=$}}function eO0(A){let Q=[],B=A?.split(",").map(($)=>$.trim()).filter(Boolean)[0];if(B)WNA(Q,Uq(z9(B)));return WNA(Q,tO0(vY())),WNA(Q,V1(vY())),Q}async function qZ(A){let Q=vY(),B=!1,$=A?.quiet??!1;for(let Y of eO0(A?.packageJsonPath)){let X=await sO0(Y,$);if(X)return X}let J=z9(Q,"tsconfig.json");if(Z4(J))B=!0;for await(let Y of LNA(Q)){if(Y.includes("angular.json"))return eM("angular",$),tM("angular",B);if(Y.includes("nuxt.config.js")||Y.includes("nuxt.config.ts"))return eM("nuxtjs",$),tM("nuxtjs",B);if(Y.includes("next.config.js")||Y.includes("next.config.mjs")||Y.includes("next.config.ts"))return eM("nextjs",$),tM("nextjs",B);if(Y.includes("svelte.config.js")||Y.includes("svelte.config.ts"))return eM("sveltekit",$),tM("sveltekit",B);if(Y.includes("vue.config.js")||Y.includes("vue.config.ts"))return eM("vue",$),tM("vue",B);if(Y.includes(m4)){let X=Uq(Y),Z=await cW(X),G=H5Q(Z);if(G)return eM(G,$),tM(G,B)}}return"unknown"}function F5Q(A,Q,B=vY()){if(A==="angular-js"||A==="angular-ts")return Q?"src/main.ts":"src/main.js";if(A==="nextjs-js"||A==="nextjs-ts")return Q?"src/app/layout.tsx":"src/app/layout.js";if(A==="svelte-js"||A==="svelte-ts")return Q?"src/main.ts":"src/main.js";if(A==="vue-js"||A==="vue-ts")return Q?"src/main.ts":"src/main.js";if(A==="react-js"||A==="react-ts"){let $=Q?"src/main.tsx":"src/main.js",J=Q?"src/index.tsx":"src/index.js";if(Z4(z9(B,$)))return $;return J}return null}async function SK(A){let Q=A.replace(/-(?:ts|js)$/,"");if(Q==="angular")return BB.info("Angular project detected"),"build";if(Q==="nuxtjs")return BB.info("Nuxtjs project detected"),"generate";if(Q==="nextjs"){if(BB.info("Nextjs project detected"),BB.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),BB.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await h1({message:"Do you want to continue?"}))throw BB.error("Build command selection aborted by user"),Error("Build command selection aborted by user");return"build"}if(Q==="sveltekit"){if(BB.info("Sveltekit project detected"),BB.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),BB.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await h1({message:"Do you want to continue?"}))throw BB.error("Build command selection aborted by user"),Error("Build command selection aborted by user");return"build"}return"build"}async function QP(A=!1,Q=vY()){let B=/(main|index)\.(ts|tsx|js|jsx)$/,$="",J=z9(Q),Y=J.split("/").length;for await(let X of LNA(J))if(X.split("/").length-Y<=2&&B.test(X)){if($=X,!A)BB.info(`Found main file here ${X}`);break}return $}async function z5Q(A,Q,B,$){let J={app_id:Q,name:B,version:0};try{let Y=await C0("files/upload_link",{apikey:A,body:J,useFilesHost:!0,apiHost:$?.apiHost});if(Y.error){if(Y.error instanceof u_){let X=await Y.error.context.json().catch(()=>({}));BB.error(`Upload URL error: ${X.status||JSON.stringify(X)}`)}else BB.error(`Cannot get upload url: ${Y.error.message}`);return""}return Y.data?.url??""}catch(Y){BB.error(`Cannot get upload url ${bA(Y)}`)}return""}async function*U5Q(A){let Q=sT(A,{withFileTypes:!0});for(let B of Q){let $=u4(A,B.name);if(B.isDirectory())yield*U5Q($);else yield $}}function dW(A,Q="5.10.0",B="6.25.0",$="7.25.0"){if(A.major===5&&IG(A,G1(Q)))return!0;if(A.major===6&&IG(A,G1(B)))return!0;if(A.major===7&&IG(A,G1($)))return!0;return!1}async function _0A(A){let Q=[],B=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let $ of U5Q(A)){if(B.some((Z)=>$.includes(Z))){BB.info(`Ignoring file ${$}, please ensure you have only required files in your dist folder`);continue}let J=Q5($);if(J.length===0){BB.info(`Ignoring empty file ${$}, please ensure you have only required files in your dist folder`);continue}let Y=await bM(J,"sha256"),X=nJQ(A,$);if(X.startsWith("/"))X=X.substring(1);Q.push({file:X,hash:Y})}return Q}async function T0A(A){if(iJQ()==="win32")return QL0(A);else return AL0(A)}function AL0(A){let Q=new qNA.default;return Q.addLocalFolder(A),Q.toBuffer()}async function QL0(A){BB.info("Zipping file windows mode");let Q=new qNA.default,B=($,J)=>{let Y=sT($);for(let X of Y){let Z=u4($,X),G=yO0(Z);if(G.isFile()){let K=Q5(Z);Q.addFile(u4(J,X).split(rJQ).join("/"),K)}else if(G.isDirectory())B(Z,u4(J,X))}};return B(A,""),Q.toBuffer()}function jh(A){let Q=c4();return`App ${A} does not exist, run first \`${Q.runner} @capgo/cli app add ${A}\` to create it`}function NNA(A){let B=A?.originalResponse?.getBody?.(),$=A instanceof Error?A.message:String(A??"");return`${B??""} ${$}`.includes("app_not_found")}async function q5Q(A,Q,B,$,J,Y,X,Z){return new Promise((G,K)=>{gB(A,{channel:"app",event:"App TUS upload",org_id:B,tracking_version:2,tags:{"app-id":$}}),new M0A.Upload(Q,{endpoint:`${X.hostFilesApi}/files/upload/attachments/`,chunkSize:Z,retryDelays:[...eT],metadataForPartialUploads:{filename:`orgs/${B}/apps/${$}/${J}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${B}/apps/${$}/${J}.zip`,filetype:"application/zip"},headers:A4({Authorization:A}),onError(H){if(BB.error(`Error uploading bundle: ${H.message}`),NNA(H)){K(Error(jh($)));return}if(H instanceof M0A.DetailedError){let F=H.originalResponse?.getBody(),D=H.originalResponse?.getStatus(),q=H.originalRequest?.getURL(),I=(()=>{try{let M=JSON.parse(F||'{"error": "unknown error"}');return M.status||M.error||M.message||"unknown error"}catch{return F||H.message}})();K(Error(`TUS upload failed (status ${D??"unknown"}, url ${q??"unknown"}): ${I}`))}else K(Error(`TUS upload failed: ${H.message||H.toString()}`))},onProgress(H,F){let D=(H/F*100).toFixed(2);Y.message(`Uploaded ${D}%`)},async onSuccess(){await gB(A,{channel:"app",event:"App TUS done",org_id:B,tracking_version:2,tags:{"app-id":$}}).catch(),G(!0)}}).start()})}async function BP(A,Q,B,$){let Y=await C0("private/delete_failed_version",{apikey:A,method:"DELETE",body:{app_id:Q,name:B},apiHost:$?.apiHost});if(Y.error){if(Y.error instanceof u_){let X=await Y.error.context.json().catch(()=>({}));throw Error(X.status||X.message||JSON.stringify(X))}throw Error(Y.error.message)}}async function D5Q(A,Q,B,$,J){let Y={app_id:Q,name:B,manifest:$},X=await CM(()=>C0("private/set_manifest",{apikey:A,body:Y,apiHost:J?.apiHost}));if(X.error){if(X.error instanceof u_){let Z=await X.error.context.json().catch(()=>({}));throw Error(Z.error||Z.status||Z.message||JSON.stringify(Z))}throw Error(X.error.message)}}async function gB(A,Q,B,$,J,Y){let X=Date.now();if((L2(AO.CAPGO_DISABLE_TELEMETRY)||L2(AO.CAPGO_DISABLE_POSTHOG))&&!Q.notifyConsole)return;try{let G={};try{G=LFA()}catch(q){if(B)BB.error(`Failed to enrich event tags, sending caller tags only: ${bA(q)}`)}let K={...Q,nonPersonTags:{...G,...Q.nonPersonTags??{}}};if(B)BB.info(`Get remove config: for ${Q.event}`);let W=J??(await OF(!0,$)).hostApi;if(B)BB.info(`Sending analytics event: ${JSON.stringify(K)}`);let H=new AbortController,F=setTimeout(()=>H.abort(),1e4),D=$?typeof AbortSignal.any==="function"?AbortSignal.any([H.signal,$]):$:H.signal;try{e4("telemetry request started");let q=await fetch(`${XX(W)}/private/events`,{method:"POST",body:JSON.stringify(K),headers:A4({"Content-Type":"application/json",capgkey:A}),signal:D,redirect:Y});if(e4("telemetry response received",{duration_ms:Date.now()-X,status:q.status}),clearTimeout(F),!q.ok)throw Error(`HTTP error! status: ${q.status}`);let I=await q.json();if(I.error&&B)BB.error(`Failed to send analytics event: ${I.error}`)}finally{clearTimeout(F)}}catch(G){if(e4("telemetry request failed",{duration_ms:Date.now()-X,error:Xq(G)}),B)BB.error("Failed to send Stats event details:"),BB.error(bA(G))}}function VNA(A){if(BB.error(`
|
|
262
262
|
\uD83D\uDD10 Access Denied: Two-Factor Authentication Required`),BB.error("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"),A)BB.error(`
|
|
263
263
|
The organization "${A}" requires all members to have 2FA enabled.`);else BB.error(`
|
|
264
264
|
This organization requires all members to have 2FA enabled.`);throw BB.error(`
|
|
@@ -579,7 +579,7 @@ Global: ${wq()}`),x.info(`Local: ${jq()}`),x.info(`
|
|
|
579
579
|
`).map((Y,X)=>{if(X===0)return RE(["bold",A.kind==="plan"?"green":"cyan"],Y);if(Y===$)return RE(["bold","cyan"],Y);if(Y.startsWith("Your trial"))return RE("yellow",Y);return Y.startsWith("You can also")||Y.startsWith("Then ")?RE("dim",Y):Y}).join(`
|
|
580
580
|
`);if(!h0A(B))y2A(J,"",RHQ)}if(e4("render shown",{kind:A.kind}),A.kind==="plan")m0A(A.billing.orgId)}function EHQ(A,Q){let B=RYQ();if(e4("render checked",{available_notices:B.length}),!u0A(Q,A.optsWithGlobals()))return;let $=new Set,J=zX();for(let Y of B){if($.has(Y.appId)||Y.kind==="plan"&&!J&&u5Q(Y.billing.orgId)){e4("render suppressed",{reason:"already_shown"});continue}yEA(Y,J),$.add(Y.appId)}}async function jHQ(A,Q,B=Date.now()){let $=s0A();if(e4("shutdown entered",{pending_workers:$.size,stdin_tty:!!TG.stdin.isTTY,stdout_tty:!!TG.stdout.isTTY,ci:n1A.isCI}),!nP0(Q,A.optsWithGlobals())||$.size===0){e4("shutdown wait skipped",{pending_workers:$.size,stdout_tty:!!TG.stdout.isTTY}),EHQ(A,Q);return}let J=Math.max(0,Th-(Date.now()-B)),Y,X=()=>TG.exit(130);TG.prependOnceListener("SIGINT",X);try{if(e4("shutdown wait started",{budget_ms:J}),!n1A.isCI&&!zX())y2A(`${RE(["bold","cyan"],"Checking your setup...")}
|
|
581
581
|
|
|
582
|
-
${RE("dim","Press Ctrl+C to skip.")}`,"",RHQ);let Z=[...$.values()],G=A.optsWithGlobals();w0({channel:"cli-usage",event:"background_checks_wait_started",apikey:typeof G.apikey==="string"?G.apikey:void 0,appId:typeof G.appId==="string"?G.appId:void 0,timestamp:new Date,nonPersonTags:{command_path:Q,pending_checks:Z.reduce((K,W)=>K+W.attemptIds.length,0),grace_period_ms:Th,scan_attempt_ids:Z.flatMap((K)=>K.attemptIds)}}),await Promise.race([Promise.allSettled([...Z.map((K)=>K.completion),wG(J)]),new Promise((K)=>{Y=setTimeout(()=>{e4("shutdown deadline reached",{pending_workers:$.size}),K()},J)})])}finally{if(Y)clearTimeout(Y);TG.removeListener("SIGINT",X),e4("shutdown wait finished",{duration_ms:Date.now()-B,pending_workers:$.size});for(let Z of $.keys())Z.terminate().catch(()=>{});await wG(0)}EHQ(A,Q)}var n1A,RHQ,iP0;var hEA=b(()=>{l0();v4();qq();hh();PNA();FF();YP();e0A();SNA();n1A=iA(X_(),1);RHQ={withGuide:!1,rounded:!1,width:"auto",contentPadding:1,formatBorder:(A)=>RE("cyan",A)},iP0=new Set(["doctor","login","get-qr","app add","app delete","app list","app debug","app setting","app set","bundle upload","bundle compatibility","bundle delete","bundle list","bundle cleanup","bundle encrypt","bundle decrypt","bundle zip","channel add","channel delete","channel list","channel currentBundle","channel promote","channel set","key save","key create","key delete_old","organization list","organization add","organization members","organization set","organization delete","organisation list","organisation add","organisation set","organisation delete","build request"])});async function _HQ(A,Q){let B=Date.now();e4("progress request started",{budget_ms:wHQ,include_billing:!0});let $=new AbortController,J,Y;try{if(Q?.aborted)return;return await Promise.race([(async()=>{let X=await fetch(`${XX(A.apiHost)}/private/onboarding_progress`,{method:"POST",redirect:"
|
|
582
|
+
${RE("dim","Press Ctrl+C to skip.")}`,"",RHQ);let Z=[...$.values()],G=A.optsWithGlobals();w0({channel:"cli-usage",event:"background_checks_wait_started",apikey:typeof G.apikey==="string"?G.apikey:void 0,appId:typeof G.appId==="string"?G.appId:void 0,timestamp:new Date,nonPersonTags:{command_path:Q,pending_checks:Z.reduce((K,W)=>K+W.attemptIds.length,0),grace_period_ms:Th,scan_attempt_ids:Z.flatMap((K)=>K.attemptIds)}}),await Promise.race([Promise.allSettled([...Z.map((K)=>K.completion),wG(J)]),new Promise((K)=>{Y=setTimeout(()=>{e4("shutdown deadline reached",{pending_workers:$.size}),K()},J)})])}finally{if(Y)clearTimeout(Y);TG.removeListener("SIGINT",X),e4("shutdown wait finished",{duration_ms:Date.now()-B,pending_workers:$.size});for(let Z of $.keys())Z.terminate().catch(()=>{});await wG(0)}EHQ(A,Q)}var n1A,RHQ,iP0;var hEA=b(()=>{l0();v4();qq();hh();PNA();FF();YP();e0A();SNA();n1A=iA(X_(),1);RHQ={withGuide:!1,rounded:!1,width:"auto",contentPadding:1,formatBorder:(A)=>RE("cyan",A)},iP0=new Set(["doctor","login","get-qr","app add","app delete","app list","app debug","app setting","app set","bundle upload","bundle compatibility","bundle delete","bundle list","bundle cleanup","bundle encrypt","bundle decrypt","bundle zip","channel add","channel delete","channel list","channel currentBundle","channel promote","channel set","key save","key create","key delete_old","organization list","organization add","organization members","organization set","organization delete","organisation list","organisation add","organisation set","organisation delete","build request"])});async function _HQ(A,Q){let B=Date.now();e4("progress request started",{budget_ms:wHQ,include_billing:!0});let $=new AbortController,J,Y;try{if(Q?.aborted)return;return await Promise.race([(async()=>{let X=await fetch(`${XX(A.apiHost)}/private/onboarding_progress`,{method:"POST",redirect:"manual",signal:$.signal,headers:A4({"Content-Type":"application/json",Authorization:A.apikey,capgkey:A.apikey}),body:JSON.stringify({appId:A.project.appId,N:0,initial:!0,includeBilling:!0})});if(e4("progress response received",{duration_ms:Date.now()-B,status:X.status}),!X.ok)return;let Z=await X.json(),G=!!Z&&Object.hasOwn(Z,"onboarding");return e4("progress decoded",{valid:G,check_errors:Z?.checkErrors?.length??0}),G?Z:void 0})(),new Promise((X)=>{if(Y=()=>{e4("progress request cancelled",{duration_ms:Date.now()-B}),$.abort(),X(void 0)},Q?.addEventListener("abort",Y,{once:!0}),Q?.aborted)Y();J=setTimeout(()=>{e4("progress request timed out",{duration_ms:Date.now()-B}),X(void 0)},wHQ)})])}catch(X){e4("progress request failed",{duration_ms:Date.now()-B,error:Xq(X)});return}finally{if(Y)Q?.removeEventListener("abort",Y);clearTimeout(J),$.abort()}}var wHQ=15000;var THQ=b(()=>{PY();Y0();FF()});async function r1A(A,Q,B,$){if(!zX()||!BE($))return;let J=new AbortController,Y=setTimeout(()=>J.abort(),Th);try{let X=await _HQ({...Q,project:{appId:A}},J.signal),Z=X&&(TYQ(A,X,B)??SYQ(A,X,B));if(Z)yEA(Z,!0)}catch(X){e4("init completion notice failed",{error:Xq(X)})}finally{clearTimeout(Y)}}var uEA=b(()=>{hEA();FF();THQ();YP();e0A();qq()});function PHQ(A){let Q=BO(A);if(Q)return{appId:Q,source:"builder"};if(typeof A.appId!=="string"||!A.appId.trim())throw new PG("config","Set appId in your Capacitor config before starting Builder onboarding.");return{appId:A.appId.trim(),source:"capacitor"}}function rP0(A,Q){let B=A.toLowerCase().split("."),$=Q.toLowerCase().split("."),J=0;while(J<B.length&&J<$.length&&B[J]===$[J])J++;return J}function oP0(A,Q){let B=Array.from({length:Q.length+1},($,J)=>J);for(let $=1;$<=A.length;$++){let J=[$];for(let Y=1;Y<=Q.length;Y++)J[Y]=Math.min(J[Y-1]+1,B[Y]+1,B[Y-1]+Number(A[$-1]!==Q[Y-1]));B=J}return B[Q.length]}function SHQ(A,Q){let B=Q.toLowerCase();return A.map((J)=>{let Y=J.app_id.toLowerCase();return{app:J,prefix:rP0(Y,B),similarity:1-oP0(Y,B)/Math.max(Y.length,B.length,1)}}).sort((J,Y)=>Y.prefix-J.prefix||Y.similarity-J.similarity||J.app.app_id.localeCompare(Y.app.app_id)).map((J)=>J.app)}async function aP0(A,Q={},B=C0){let $=[];for(let J=0;;J++){let{data:Y,error:X}=await B(`app?page=${J}`,{apikey:A,method:"GET",body:void 0,apiHost:Q.apiHost});if(X)throw new PG("list",`Could not load apps: ${await S$(X)}`,{cause:X});if(!Array.isArray(Y))throw new PG("list","Capgo returned an invalid app list. Please retry.");if($.push(...Y),Y.length<50)return $}}async function sP0(A,Q,B={},$={}){let J=$.request??C0,{data:Y,error:X}=await J(`app/${encodeURIComponent(Q)}`,{apikey:A,method:"GET",body:void 0,apiHost:B.apiHost});if(X){let K=$8(X);if(K===401||K===403)throw new PG("read",`This API key needs app.read permission for ${Q}.`,{cause:X});if(K===404)throw new PG("missing",`${Q} is no longer available. Check the app list again.`,{cause:X});throw new PG("api",`Could not check app access: ${await S$(X)}`,{cause:X})}if(!Y||Y.app_id!==Q)throw new PG("missing",`${Q} is no longer available. Check the app list again.`);let{data:Z,error:G}=await J("private/cli/permissions",{apikey:A,method:"POST",body:{permissions:["app.build_native"],app_id:Q},apiHost:B.apiHost});if(G)throw new PG("permission","Could not check app.build_native permission. Please retry.",{cause:G});if(Z?.permissions?.["app.build_native"]!==!0)throw new PG("build",`This API key needs app.build_native permission for ${Q}.`)}async function tP0(A){try{let Q=await m9(!0);if(p6(void 0,Q.config)===A)return!1;return Q.config.plugins??={},Q.config.plugins.CapgoBuilder??={},Q.config.plugins.CapgoBuilder.capgoBuilderAppId=A,await Gy("CapgoBuilder",Q),!0}catch(Q){throw new PG("config","Could not save the selected Builder app ID to your Capacitor config.",{cause:Q})}}async function eP0(){try{return await _6(kHQ),!0}catch{return!1}}function bHQ(A={}){let Q=!A.apiHost;return{list:(B)=>aP0(B,A),verify:(B,$)=>sP0(B,$,A),persist:tP0,openDashboard:Q?eP0:async()=>!1,dashboardUrl:Q?kHQ:""}}var PG,kHQ;var mEA=b(()=>{PK();lW();OG();Y0();PG=class PG extends Error{code;constructor(A,Q,B){super(Q,B);this.code=A;this.name="AppSelectionError"}};kHQ=O7("/app/new")});import{appendFileSync as AS0,mkdirSync as QS0}from"node:fs";import{homedir as BS0}from"node:os";import{join as xHQ}from"node:path";function $S0(){return new Date().toISOString().replace(/[:.]/g,"-")}function JS0(A,Q){return(A??Q).replace(/[^\w.-]/g,"_").slice(0,60)||Q}function jO(A,Q=xHQ(BS0(),".capgo-credentials","support")){try{return QS0(Q,{recursive:!0}),$S=xHQ(Q,`internal-${JS0(A,"unknown-app")}-${$S0()}.log`),$S}catch{return $S=null,null}}function y2(){return $S}function sW(A){if(!A||typeof A.get!=="function")return"";let Q=[];for(let B of YS0){let $=A.get(B);if($)Q.push(`${B}=${$}`)}return Q.join(", ")}function hB(A){if(!$S)return;try{AS0($S,`[${new Date().toISOString()}] ${WX(A)}
|
|
583
583
|
`,"utf8")}catch{}}var $S=null,YS0;var V7=b(()=>{rM();YS0=["date","content-type","content-length","age","retry-after","www-authenticate","x-request-id","request-id","x-goog-request-id","x-amzn-requestid","apigw-requestid","cf-ray","x-rate-limit","x-ratelimit-limit","x-ratelimit-remaining","x-ratelimit-reset","server"]});import{randomUUID as XS0}from"node:crypto";function vHQ(){return`bj_${XS0()}`}var fHQ=()=>{};import{existsSync as yHQ,readFileSync as hHQ}from"node:fs";import{rm as ZS0}from"node:fs/promises";import{homedir as GS0}from"node:os";import KS0 from"node:process";function gHQ(A){try{return hHQ(A,"utf8").trim()||void 0}catch{return}}function WS0(){let A=KS0.env.CAPGO_TOKEN?.trim();if(A)return{key:A,source:"env"};let Q=gHQ(cEA());if(Q)return{key:Q,source:"global"};let B=gHQ(dEA);if(B)return{key:B,source:"local"};return{}}async function HS0(A){let Q="";try{Q=hHQ(".gitignore","utf8")}catch{Q=""}if(!Q.split(/\r?\n/).some(($)=>$.trim()===A))await uWQ(".gitignore",`${A}
|
|
584
584
|
`,384)}async function wO(A,Q={}){if(!A)throw Error("Missing API key");let B=Q.local??!1;if(B&&!yHQ(".git"))throw Error("To save a project-local key you must be inside a git repository");let $=await bB(A,Q.apiHost,!0),J=await T6($,A,!0);if(B)await MZ(dEA,`${A}
|
|
585
585
|
`,{mode:384}),await HS0(".capgo");else await MZ(cEA(),`${A}
|
|
@@ -1445,7 +1445,7 @@ ${TUB}
|
|
|
1445
1445
|
|
|
1446
1446
|
Docs: ${ugA}`);let X=await h1({message:"Have you added notifyAppReady() and rebuilt your app?"});if(WB(X)||!X)continue;if(r3(Q,"notifyAppReady"))return w0({channel:"bundle",event:"CLI Recovered Missing NotifyAppReady",tags:{recovery:"manual"}}),"recovered";x.warn("notifyAppReady() is still missing in the build folder. Rebuild, or choose another option.");continue}if(Y==="skip"){x.warn("Skipping notifyAppReady check. Without this call, Capgo may roll back downloaded updates."),x.warn(`Learn more: ${ugA}`);let X=await h1({message:"Continue without notifyAppReady()?",initialValue:!1});if(WB(X)||!X)continue;return w0({channel:"bundle",event:"CLI Skipped NotifyAppReady Check",tags:{}}),"skipped"}if(Y==="patch-build"){let X=gUB(Q);if(!X){x.warn("Could not patch the build folder automatically. The app bundle must already include CapacitorUpdater, or patch the source and rebuild.");continue}if(!r3(Q,"notifyAppReady")){x.warn(`Patched ${X}, but notifyAppReady() is still missing. Try another option.`);continue}return x.success(`Added notifyAppReady() to ${X}`),w0({channel:"bundle",event:"CLI Recovered Missing NotifyAppReady",tags:{recovery:"patch-build"}}),"recovered"}if(Y==="patch-source")try{let X=await yUB(V1(cgA()));if(!X){x.warn("Could not find your app entry file automatically.");continue}x.success(`Added notifyAppReady() to ${X}`),x.info("Rebuild your web assets, then retry zip/upload.");let Z=await h1({message:"Have you rebuilt your app into the build folder?"});if(WB(Z)||!Z)continue;if(r3(Q,"notifyAppReady"))return w0({channel:"bundle",event:"CLI Recovered Missing NotifyAppReady",tags:{recovery:"patch-source"}}),"recovered";x.warn("notifyAppReady() is still missing in the build folder after rebuild.")}catch(X){x.error(bA(X))}}}l0();import FhQ from"node:process";var hUB={info:(A)=>x.info(A),spinner:O8},uUB=[{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)"}],mUB=60000,cUB=1000,zhQ=20;function dUB(){if(typeof Intl>"u")return null;return Intl.DateTimeFormat().resolvedOptions().timeZone||null}function lUB(){let A=dUB();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 pUB(){let A=[...uUB],Q=lUB();if(!Q)return A;let B=A.findIndex((J)=>J.code===Q);if(B<0)return A;let[$]=A.splice(B,1);return A.push($),A}function iUB(A,Q,B){let $=Math.min(Math.max(A,0),B);return Math.floor($/B*Q)}function nUB(A){let Q=Math.min(Math.max(A,0),100),B=Math.round(Q/100*zhQ);return`${"█".repeat(B)}${"░".repeat(zhQ-B)}`}function rUB(A){return`${Math.max(0,A)}s`}function AXA({interactive:A=FhQ.stdout.isTTY&&FhQ.stderr.isTTY,totalMs:Q=mUB,updateIntervalMs:B=cUB,title:$="Replicating your bundle in all regions...",completeMessage:J="Your update is now available worldwide.",reporter:Y}={}){if(!A||Q<=0)return Promise.resolve();let X=pUB();if(!X.length)return Promise.resolve();let Z=Y??hUB;Z.info($),Z.info(`Regions: ${X.map((F)=>F.label).join(" • ")}`);let G=Z.spinner(),K=Date.now(),W=X.length,H=null;return new Promise((F)=>{let D=()=>{let q=Date.now()-K,I=Math.max(0,Q-q),M=iUB(q,W,Q),V=Math.min(100,Math.round(q/Q*100)),C=nUB(V),L=M<W?X[M]?.label||"Finalizing":"Complete",N=`${M}/${W} regions updated • ${rUB(Math.ceil(I/1000))} left • ${C} • Next: ${L}`;G.message(N)};G.start($),D(),H=setInterval(D,B),setTimeout(()=>{if(H)clearInterval(H);G.stop(J),F()},Q)})}U1();oM();function UhQ(A){let Q=A?.autoUpdate;if(Q==="always")return!0;if(typeof Q==="string"||Q===!1)return!1;let B=A?.directUpdate;return B===!0||B==="always"}Y0();l0();NK();var oUB=new Set(["major","minor","patch","metadata"]);function lj(A){if(A===void 0||A===null||A===!1)return;if(A===!0)return"minor";let Q=String(A).trim().toLowerCase();if(Q==="fix")return"patch";if(Q==="ai")return"ai";if(oUB.has(Q))return Q;return}function aUB(A){if(A==="metadata"||A==="prerelease")return"prerelease";return A}function sUB(A,Q){let B=A.match(/^(\d+)\.(\d+)\.(\d+)(.*)?$/);if(!B){if(Q==="major")return"1.0.0";if(Q==="minor")return"0.1.0";if(Q==="prerelease")return"1.0.1-0";return"1.0.1"}let $=Number.parseInt(B[1],10),J=Number.parseInt(B[2],10),Y=Number.parseInt(B[3],10),X=B[4]??"";if(Q==="major")return`${$+1}.0.0`;if(Q==="minor")return`${$}.${J+1}.0`;if(Q==="patch")return`${$}.${J}.${Y+1}`;let Z=X.match(/^-([A-Za-z0-9.-]*?)(\d+)?$/);if(Z){let G=Z[1]??"",K=Z[2]!==void 0?Number.parseInt(Z[2],10)+1:0;if(G.endsWith(".")||G==="")return`${$}.${J}.${Y}-${G}${K}`;return`${$}.${J}.${Y}-${G}${G?".":""}${K}`}return`${$}.${J}.${Y+1}-0`}function QXA(A,Q="minor"){let B=aUB(Q);try{let $=G1(A);return QZ(zM($,B))}catch{return sUB(A,B)}}function qhQ(A){return QXA(A,"patch")}async function DhQ(A,Q){let B=qhQ(A),$=Q?` for ${Q}`:"",J=await P8({message:`How do you want to handle the version${$}?`,options:[{value:"auto",label:`Auto: Bump patch version (${A} → ${B})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(WB(J))return null;if(J==="auto")return x.info(`\uD83D\uDD22 Auto-bumped version from ${A} to ${B}`),B;let Y=await AZ({message:`Current version is ${A}. Enter new version:`,validate:(X)=>{if(!X)return"Version is required";if(!/^\d+\.\d+\.\d+/.test(X))return"Please enter a valid version (x.y.z)"}});if(WB(Y))return null;return Y}function IhQ(A){let Q=qhQ(A);try{let B=G1(A);return[Q,QZ(zM(B,"minor")),`${A}-beta.1`,`${A}.1`]}catch{return[Q,`${A}.1`,`${A}-beta.1`,`${A}-rc.1`]}}l0();w2();Y0();var lgA=100;function tUB(A,Q){let B=new Map(Q.map((Z)=>[Z.file,Z.hash])),$=new Map(A.map((Z)=>[Z.file,Z.hash])),J=[],Y=[],X=[];for(let[Z,G]of $){let K=B.get(Z);if(K===void 0)J.push(Z);else if(K!==G)X.push(Z)}for(let[Z]of B)if(!$.has(Z))Y.push(Z);return{added:J,removed:Y,changed:X,counts:{added:J.length,removed:Y.length,changed:X.length}}}function eUB(A){return{added:A.added.slice(0,lgA),removed:A.removed.slice(0,lgA),changed:A.changed.slice(0,lgA),counts:A.counts}}async function AqB(A,Q){let B;try{B=await SJQ(A,Q)}catch($){throw Error(`Cannot fetch remote manifest: ${bA($)}`)}return B.filter(($)=>$.file_name&&$.file_hash).map(($)=>({file:$.file_name,hash:$.file_hash}))}async function QqB(A,Q,B){let $=B[0];if($){let Y=(await EG(A,Q,$).catch(()=>[]))[0]?.version_info;if(Y&&!Y.deleted&&Y.id&&Y.name)return{name:Y.name,id:Y.id}}try{return await Z0A(A,Q)}catch(J){return x.warn(`Cannot fetch latest remote version for AI auto-bump: ${bA(J)}`),null}}async function BqB(A){let{data:Q,error:B}=await C0("bundle/ai_bump_level",{apikey:A.apikey,body:{appId:A.appId,baseVersion:A.baseVersion,manifestDiff:eUB(A.manifestDiff),nativeCompatibility:A.nativeCompatibility},apiHost:A.apiHost});if(B)throw B;let $=typeof Q?.level==="string"?Q.level.trim().toLowerCase():"",J=typeof Q?.reason==="string"?Q.reason.trim():"";if(!["major","minor","patch","metadata"].includes($)||!J)throw Error("AI bump endpoint returned an invalid response");return{level:$,reason:J}}async function MhQ(A){let Q=await QqB(A.client,A.appid,A.channels);if(!Q)return{level:"patch",reason:"No previous Capgo version; defaulting to patch bump without AI."};try{let B=await _0A(A.path),$=await AqB(A.client,Q.id),J=tUB(B,$);return await BqB({apikey:A.apikey,appId:A.appid,baseVersion:Q.name,manifestDiff:J,apiHost:A.options?.apiHost})}catch(B){return{level:"minor",reason:`AI unavailable (${B instanceof Error?B.message:String(B)}); falling back to minor.`}}}l0();PK();v4();function $qB(A){if(!A.incompatible)return"skip";if(!A.interactive)return"ci-ad";return A.hasCredentials?"prompt-build":"prompt-onboarding"}function OhQ(A){if(!A.incompatible||!A.failOnIncompatible)return!1;if(!A.interactive)return!0;return A.builderAction==="continue"}var JqB="https://capgo.app/docs/cli/cloud-build/",pgA="https://capgo.app/native-build/",LhQ="This update includes native changes. An app store update may be required for these changes to take effect. Capgo Builder can help you build and publish the required native update.";function YqB(A){let Q=A?"run a native build (npx @capgo/cli build request --platform <ios|android>)":"set up Capgo Builder (npx @capgo/cli build onboarding)";x.warn(`${LhQ} To ${Q} — learn more: ${pgA} · docs: ${JqB}`)}async function NhQ(A){try{return await XqB(A)}catch{return"continue"}}async function XqB(A){let{hasCredentials:Q}=A,B=$qB({incompatible:A.incompatible,interactive:A.interactive,hasCredentials:Q});if(B==="skip")return"continue";let $=Q?"build":"onboarding";if(w0({channel:"bundle",event:"Builder CTA Shown",apikey:A.apikey,appId:A.appId,orgId:A.orgId,tags:{surface:B==="ci-ad"?"ci":"interactive",mode:$,incompatible_count:A.incompatibleCount}}),B==="ci-ad")return YqB(Q),"continue";x.info(LhQ);let J=A.select??((Z)=>P8(Z)),Y=A.openUrl??_6,X=$==="build"?"Start a native build with Capgo Builder now?":"Would you like to configure Capgo Builder now?";while(!0){let Z=await J({message:X,initialValue:"yes",options:[{value:"yes",label:"✅ Yes"},{value:"no",label:"❌ No"},{value:"learn",label:"\uD83D\uDCD6 Learn what Capgo Builder is"}]});if(WB(Z))return"abort";if(Z==="learn"){w0({channel:"bundle",event:"Builder CTA Learn Selected",apikey:A.apikey,appId:A.appId,orgId:A.orgId,tags:{mode:$}});try{await Y(pgA)}catch{x.warn(`Could not open your browser automatically. Visit: ${pgA}`)}continue}if(Z==="yes")return w0({channel:"bundle",event:"Builder CTA Accepted",apikey:A.apikey,appId:A.appId,orgId:A.orgId,tags:{mode:$}}),$==="build"?"launch-build":"launch-onboarding";return w0({channel:"bundle",event:"Builder CTA Declined",apikey:A.apikey,appId:A.appId,orgId:A.orgId,tags:{mode:$}}),"continue"}}U1();ug();Y0();FC();var $XA=1;function JXA(A,Q){return A?Q?"rsa_v3_hex":"rsa_v2_base64":"sha256_hex"}function EhQ(A,Q){return!A&&Q}var ZqB=/^[!#$%&'*+\-.^\w`|~]+$/,VhQ=new Set(["upload_if_doesnt_exist","reuse","upload"]),GqB=2048;function RhQ(A){for(let Q=0;Q<A.length;Q++){let B=A.charCodeAt(Q);if(B<=31||B===127)return!0}return!1}function jhQ(A){for(let Q=0;Q<A.length;Q++){let B=A.charCodeAt(Q);if(B<=31||B===127||B>255)return!0}return!1}function BXA(A){return typeof A==="object"&&A!==null&&!Array.isArray(A)}function G$(A){throw new gA(`Invalid manifest upload authorization response: ${A}`)}function ChQ(A,Q,B=!1){if(typeof A!=="string")G$(`${Q} must be a URL`);let $;try{$=new URL(A)}catch{G$(`${Q} must be a valid absolute URL`)}let J=$.protocol==="http:"&&($.hostname==="localhost"||$.hostname==="127.0.0.1"||$.hostname==="[::1]");if($.protocol!=="https:"&&!J)G$(`${Q} must use HTTPS`);if($.username||$.password||$.hash)G$(`${Q} contains unsupported URL components`);if(B&&!A.endsWith("/"))G$(`${Q} must end with /`);return A}function KqB(A){if(!A||A.length>GqB||A.startsWith("/")||A.includes("\\")||RhQ(A))return!1;let Q=A.split("/");return Q.length>=5&&Q[0]==="orgs"&&!!Q[1]&&Q[2]==="apps"&&!!Q[3]&&Q.slice(4).every((B)=>!!B&&B!=="."&&B!=="..")}function WqB(A,Q){if(!BXA(A))G$(`upload_targets[${Q}] must be an object`);if(typeof A.id!=="string"||!A.id||RhQ(A.id))G$(`upload_targets[${Q}].id must be a nonempty string`);if(A.protocol!=="tus")G$(`upload target ${A.id} uses an unsupported protocol`);if(!BXA(A.authorization)||A.authorization.type!=="header")G$(`upload target ${A.id} uses unsupported authorization`);let B=A.authorization.header_name,$=A.authorization.token_prefix,J=A.authorization.expires_at;if(typeof B!=="string"||!ZqB.test(B))G$(`upload target ${A.id} has an invalid authorization header name`);if(typeof $!=="string"||jhQ($))G$(`upload target ${A.id} has an invalid authorization token prefix`);if(typeof J!=="number"||!Number.isSafeInteger(J)||J<=0)G$(`upload target ${A.id} has an invalid expiration`);return{id:A.id,protocol:"tus",upload_url:ChQ(A.upload_url,`upload target ${A.id} upload_url`),existence_check_url_prefix:ChQ(A.existence_check_url_prefix,`upload target ${A.id} existence_check_url_prefix`,!0),authorization:{type:"header",header_name:B,token_prefix:$,expires_at:J}}}function HqB(A,Q){if(!BXA(Q))G$("body must be an object");if(Q.protocol_version!==A.protocol_version)G$("protocol_version does not match the request");if(Q.version_id!==A.version_id)G$("version_id does not match the request");if(!VhQ.has(Q.default_action))G$("default_action is invalid");if(Q.default_s3_path_prefix!==void 0&&typeof Q.default_s3_path_prefix!=="string")G$("default_s3_path_prefix must be a string");if(Q.default_upload_target!==void 0&&typeof Q.default_upload_target!=="string")G$("default_upload_target must be a string");if(!Array.isArray(Q.upload_targets))G$("upload_targets must be an array");if(!Array.isArray(Q.entries))G$("entries must be an array");let B=new Map;for(let[G,K]of Q.upload_targets.entries()){let W=WqB(K,G);if(B.has(W.id))G$(`upload target ${W.id} is duplicated`);B.set(W.id,W)}if(typeof Q.default_upload_target==="string"&&!B.has(Q.default_upload_target))G$("default_upload_target references an unknown upload target");let $=new Map(A.entries.map((G)=>[G.id,G]));if($.size!==A.entries.length)G$("request contains duplicate entry ids");let J=new Set,Y=new Set,X=new Map;for(let[G,K]of Q.entries.entries()){if(!BXA(K))G$(`entries[${G}] must be an object`);let W=K.id;if(typeof W!=="number"||!Number.isSafeInteger(W)||!$.has(W))G$(`entries[${G}].id is unknown`);if(J.has(W))G$(`entry id ${W} is duplicated`);J.add(W);let H=K.action??Q.default_action;if(!VhQ.has(H))G$(`entry id ${W} has an invalid action`);if(K.s3_path!==void 0&&typeof K.s3_path!=="string")G$(`entry id ${W} has an invalid s3_path`);if(K.s3_path_suffix!==void 0&&typeof K.s3_path_suffix!=="string")G$(`entry id ${W} has an invalid s3_path_suffix`);let F=typeof K.s3_path==="string",D=typeof K.s3_path_suffix==="string";if(F===D)G$(`entry id ${W} must contain exactly one path representation`);if(D&&typeof Q.default_s3_path_prefix!=="string")G$(`entry id ${W} requires default_s3_path_prefix`);let q=F?K.s3_path:`${Q.default_s3_path_prefix}${K.s3_path_suffix}`;if(!KqB(q))G$(`entry id ${W} has an invalid s3 path`);if(Y.has(q))G$(`entry id ${W} duplicates another s3 path`);Y.add(q);let I,M;if(K.upload_target!==void 0&&(typeof K.upload_target!=="string"||!B.has(K.upload_target)))G$(`entry id ${W} references an unknown upload target`);if(H!=="reuse"){let C=K.upload_target??Q.default_upload_target;if(typeof C!=="string"||!(I=B.get(C)))G$(`entry id ${W} references an unknown upload target`);if(typeof K.upload_token!=="string")G$(`entry id ${W} is missing upload_token`);let L=`${I.authorization.token_prefix}${K.upload_token}`;if(!L||jhQ(L))G$(`entry id ${W} has an invalid upload token`);M={headerName:I.authorization.header_name,value:L}}let V;if(H==="reuse"){if(typeof K.file_size_receipt!=="string"||!K.file_size_receipt)G$(`entry id ${W} is missing file_size_receipt`);V=K.file_size_receipt}X.set(W,{request:$.get(W),action:H,s3Path:q,uploadTarget:I,uploadAuthorization:M,fileSizeReceipt:V})}if(J.size!==A.entries.length)G$("response does not contain exactly one entry for every request entry");return{response:{...Q,upload_targets:[...B.values()],entries:Q.entries},entries:A.entries.map((G)=>X.get(G.id))}}async function whQ(A,Q,B={},$=C0,J=(Y)=>new Promise((X)=>setTimeout(X,Y))){let Y,X=setTimeout(()=>{Y=d6().spinner(),Y.start("Requesting delta upload authorization")},500);try{let{data:Z,error:G}=await CM(async()=>$("private/request_manifest_upload",{apikey:A,body:Q,apiHost:B.apiHost}),J);if(G)throw new gA(`Cannot request manifest upload: ${await S$(G)}`);let K=HqB(Q,Z);return Y?.stop("Delta upload authorized"),K}catch(Z){throw Y?.error("Cannot authorize delta upload"),Z}finally{clearTimeout(X)}}NK();PY();var uuQ=iA(xuQ(),1),muQ=iA(He(),1);import{createHash as mDB}from"node:crypto";import{createReadStream as WyA,statSync as cDB}from"node:fs";import{platform as dDB}from"node:os";import{join as lDB,posix as pDB,win32 as yuQ}from"node:path";import{cwd as iDB}from"node:process";import{buffer as HyA}from"node:stream/consumers";import{createBrotliCompress as nDB}from"node:zlib";U1();hg();Y0();FC();U1();function vuQ(A){return Array.from(A).filter((Q)=>{let B=Q.codePointAt(0)??0;return B===9||B===10||B>=32&&!(B>=127&&B<=159)}).join("")}class WI extends gA{backendMessage;requestId;scope;constructor(A,Q,B){let $=vuQ(Q),J=B===void 0?void 0:vuQ(B),Y=J?`
|
|
1447
1447
|
|
|
1448
|
-
Request ID: ${J}`:"";super(`Abandoning manifest upload. The following error occurred: ${$}${Y}`);this.name="ManifestUploadAbandonError",this.backendMessage=$,this.requestId=J,this.scope=A}}function GyA(A){if(A===void 0)return;let Q;try{Q=JSON.parse(A)}catch{return}if(!Q||typeof Q!=="object"||Array.isArray(Q))return;let B=Q,$=B.moreInfo&&typeof B.moreInfo==="object"&&!Array.isArray(B.moreInfo)?B.moreInfo:void 0,J=typeof $?.requestId==="string"?$.requestId:typeof B.requestId==="string"?B.requestId:void 0;if(typeof B.abandon_explicit_error==="string")return new WI("all",B.abandon_explicit_error,J);if(typeof B.abandon_manifest_only_explicit_error==="string")return new WI("manifest",B.abandon_manifest_only_explicit_error,J);return}function fuQ(A){return GyA(A?.originalResponse?.getBody?.())}function guQ(A,Q){return A.scope==="manifest"&&Q?"manifest":"all"}class KyA{abandonError;abandonPromise;activeUploads=new Map;register(A,Q){if(this.abandonError)return Q(this.abandonError),!1;return this.activeUploads.set(A,Q),!0}unregister(A){this.activeUploads.delete(A)}throwIfAbandoned(){if(this.abandonError)throw this.abandonError}async abandon(A){if(!this.abandonError)this.abandonError=A;if(!this.abandonPromise){let Q=[...this.activeUploads.entries()];this.activeUploads.clear(),this.abandonPromise=(async()=>{await Promise.allSettled(Q.map(async([B])=>{await B.abort()}));for(let[,B]of Q)B(this.abandonError)})()}await this.abandonPromise}}var HI={info:(A)=>d6().info(A),warn:(A)=>d6().warn(A),error:(A)=>d6().error(A)},rDB=new Set([429,502,503,504]),oDB=30000;function aDB(A){return rDB.has(A)}function huQ(A){return Math.min(A,oDB)}function sDB(A,Q,B){let $=Q[B];if($===void 0)return;if(A.status!==429)return $;let J=A.headers.get("Retry-After")?.trim();if(!J)return $;if(/^\d+$/.test(J)){let X=Number(J),Z=X*1000;if(Number.isSafeInteger(X)&&Number.isFinite(Z))return huQ(Z)}let Y=Date.parse(J);if(Number.isFinite(Y)){let X=Y-Date.now();if(X>=0)return huQ(X)}return $}function tDB(A){return new gA(`Cannot check whether manifest file exists (HTTP ${A})`,{status:A})}async function eDB(A,Q){let B=new URL(`${A}${encodeURIComponent(Q)}`),$=eT.slice(0,3);for(let J=0;;J++){B.searchParams.set("nocache",`${Date.now()}`);try{let Y=await fetch(B.toString(),{method:"GET",redirect:"error",headers:A4({"cache-control":"no-cache"})});if(Y.status===404)return{exists:!1};if(!Y.ok){let X=aDB(Y.status)?sDB(Y,$,J):void 0;if(X!==void 0){if(await Y.body?.cancel(),X>0)await new Promise((Z)=>setTimeout(Z,X));continue}throw tDB(Y.status)}return{exists:!0,receipt:Y.headers.get("X-Capgo-Manifest-Size-Receipt")??void 0}}catch(Y){let X=$[J];if(!$q(Y)||X===void 0)throw Y;if(X>0)await new Promise((Z)=>setTimeout(Z,X))}}}var AIB=8192;async function QIB(A){let Q=V1(iDB()),B=await UZ("@capgo/capacitor-updater",Q,A.packageJson),$;try{$=B?G1(B):void 0}catch{$=void 0}if(!B||!$)return{version:null,supportsBrotliV2:!1};let J=!dW($,void 0,void 0,Rh);return{version:`${$.major}.${$.minor}.${$.patch}`,supportsBrotliV2:J}}function BIB(A,Q){if(!Q)return!1;let B=Q.split(",").map(($)=>$.trim()).filter(($)=>!!$);if(B.length===0)return!1;return uuQ.isMatch(A,B)}async function $IB(A,Q,B){let J=cDB(A).size,Y=await HyA(WyA(A));if(J===0)return{buffer:Y,useBrotli:!1};if(BIB(Q,B.noBrotliPatterns))return{buffer:Y,useBrotli:!1};if(J<AIB)return{buffer:Y,useBrotli:!1};try{let X=await HyA(WyA(A).pipe(nDB({})));if(X.length>=J-10)return{buffer:Y,useBrotli:!1};return{buffer:X,useBrotli:!0}}catch(X){return HI.warn(`Brotli compression failed for ${A}: ${X}, using original file`),{buffer:Y,useBrotli:!1}}}async function FyA(A,Q,B,$=!1){let J=d6().spinner();J.start(Q!=="v2"?"Generating the update manifest":`Generating the update manifest with ${$?"V3":"V2"} encryption`);let Y=await _0A(A);if(Q==="v2")for(let X of Y)X.hash=$?hx(X.hash,B):yx(X.hash,B);return J.stop("Manifest generated successfully"),Y}async function cuQ(A,Q,B,$,J,Y,X=!1){let Z=await FyA(A,J,Y,X);return await gB(Q,{channel:"partial-update",event:"Generate manifest",org_id:B,tracking_version:2,tags:{"app-id":$}}),Z}function duQ(A){if(dDB()!=="win32")return A;return yuQ.normalize(A).split(yuQ.sep).join(pDB.sep)}class ex extends gA{constructor(A){super(A);this.name="PartialUploadValidationError"}}async function JIB(A,Q){let{version:B,supportsBrotliV2:$}=await QIB(Q);if(!$)throw new ex(`Your project is using an older version of @capgo/capacitor-updater (${B||"unknown"}). To use Delta updates, please upgrade to version ${j0A} (v5), ${w0A} (v6) or ${Rh} (v7) or higher.`);if(Q.disableBrotli)HI.info("Brotli compression disabled by user request");else if(Q.noBrotliPatterns)HI.info(`Files matching patterns (${Q.noBrotliPatterns}) will be excluded from brotli compression`);let J=A.filter((Y)=>Y.file.includes(" "));if(J.length>0)throw new ex(`Files with spaces in their names (${J.map((Y)=>Y.file).join(", ")}). Please rename the files.`);if(A.length>Nh)throw new ex(L0A(A.length))}async function luQ(A,Q,B,$){let J=lDB(Q,A.file),Y=duQ(A.file),X=$.disableBrotli?{buffer:await HyA(WyA(J)),useBrotli:!1}:await $IB(J,Y,$),Z=B?gx(X.buffer,B.sessionKey,B.ivSessionKey):X.buffer,G=X.useBrotli?`${Y}.br`:Y;return{buffer:Z,fileName:G,compression:X.useBrotli?"brotli":"none",uploadedBytesSha256:mDB("sha256").update(Z).digest("hex"),uploadedBytesSize:Z.byteLength}}async function WXA(A,Q,B,$,J){if(await JIB(A,$),A.length===0)throw new gA("Cannot request a manifest upload for an empty manifest");let Y=[];for(let[X,Z]of A.entries()){let G=await luQ(Z,Q,B,$),K={id:X,file_name:G.fileName,compression:G.compression,file_hash:Z.hash,uploaded_bytes_sha256:G.uploadedBytesSha256,uploaded_bytes_size:G.uploadedBytesSize};if(Y.push(K),J)await J(K,G.buffer)}return Y}function YIB(A,Q){if(A.request.file_name!==Q.fileName||A.request.compression!==Q.compression||A.request.uploaded_bytes_sha256!==Q.uploadedBytesSha256||A.request.uploaded_bytes_size!==Q.uploadedBytesSize)throw new gA(`Manifest file changed while preparing the upload: ${A.request.file_name}`)}function XIB(A){return A4({[A.uploadAuthorization.headerName]:A.uploadAuthorization.value})}async function puQ(A,Q,B,$,J,Y,X,Z){let G=d6().spinner();G.start("Preparing delta update with TUS protocol");let K=performance.now(),W=!!X.userRequestedDelta;if(Z.entries.length!==Q.length)throw new gA("Manifest upload authorization does not match the local manifest");let H=0,F=Q.length,D=Z.entries.filter((I)=>I.request.compression==="brotli").length,q=new KyA;try{G.message(`Uploading ${F} files using TUS protocol`);let I=async(N,R)=>{q.throwIfAbandoned();let E=duQ(N.file),w=await luQ(N,B,Y,X),k=w.buffer;q.throwIfAbandoned();let y=Z.entries[R];if(y.request.file_hash!==N.hash)throw new gA(`Manifest upload authorization does not match the local manifest entry ${R}`);YIB(y,w);let P=w.fileName,v=y.s3Path;if(y.action==="reuse")return H++,{file_name:P,s3_path:v,file_hash:N.hash,file_size_receipt:y.fileSizeReceipt};let c={exists:!1};if(y.action==="upload_if_doesnt_exist")try{c=await eDB(y.uploadTarget.existence_check_url_prefix,v)}catch(a){let e=a instanceof Error?a.message:String(a);throw Error(`Cannot check whether delta file exists: ${E}: ${e}`,{cause:a})}if(q.throwIfAbandoned(),c.exists)return H++,Promise.resolve({file_name:P,s3_path:v,file_hash:N.hash,file_size_receipt:c.receipt});return new Promise((a,e)=>{G.message(`Prepare upload delta file: ${E}`);let r=eC(P),i=XIB(y),l=new muQ.Upload(k,{endpoint:y.uploadTarget.upload_url,chunkSize:X.tusChunkSize,retryDelays:[...eT],removeFingerprintOnSuccess:!0,metadata:{filename:v,filetype:r},headers:i,onAfterResponse(f,p){let g=GyA(p.getBody());if(g)return q.abandon(g)},onError:(f)=>{let p=fuQ(f);if(p){q.abandon(p);return}q.unregister(l);let g=X.verbose?Vh(f):f.toString();if(NNA(f)){HI.error(`Failed to upload ${E}: ${g}`),e(Error(jh($)));return}let m;try{let d=g.match(/response text: (\{.*?\})/);if(d&&d[1])m=JSON.parse(d[1]).moreInfo?.requestId}catch{}let QA=m?` [requestId: ${m}]`:"";HI.error(`Failed to upload ${E}: ${g}${QA}`),e(f)},onProgress(){let f=(H/F*100).toFixed(2);G.message(`Uploading delta update: ${f}%`)},onSuccess({lastResponse:f}){q.unregister(l),H++,a({file_name:P,s3_path:v,file_hash:N.hash,file_size_receipt:f.getHeader("X-Capgo-Manifest-Size-Receipt")??void 0})}});if(q.register(l,e))l.start()})},M=X.deltaUploadConcurrency??50,V=[];for(let N=0;N<Q.length;N+=M){q.throwIfAbandoned();let R=Q.slice(N,N+M),E=Math.floor(N/M)+1,w=Math.ceil(Q.length/M);if(w>1)G.message(`Processing batch ${E}/${w} (${R.length} files)`);let k=await Promise.all(R.map((y,P)=>I(y,N+P)));V.push(...k)}if(V.some((N)=>!N.file_size_receipt))throw new gA("Manifest upload did not return a size receipt for every file");let L=((performance.now()-K)/1000).toFixed(2);if(G.stop(`Delta update uploaded successfully \uD83D\uDCAA in (${L} seconds)`),D>0)HI.info(`${D} of ${F} files were compressed with brotli and use .br extension`);return await gB(A,{channel:"app",event:`App Partial TUS done${D>0?" with .br extension":""}`,org_id:J,tracking_version:2,tags:{"app-id":$}}),await gB(A,{channel:"performance",event:"Partial upload performance",org_id:J,tracking_version:2,tags:{"app-id":$,time:L}}),V}catch(I){let V=((performance.now()-K)/1000).toFixed(2);if(G.error(`Failed to upload delta update (after ${V} seconds)`),I instanceof WI)throw I;let C=X.verbose?Vh(I):String(I);if(W)throw HI.error(`Error uploading delta update: ${C}`),HI.error("Delta upload was explicitly requested but failed. Upload aborted."),I;else return HI.info(`Error uploading delta update: ${C}, This is not a critical error, the bundle has been uploaded without the delta files`),null}}FC();function zyA(A){if(!A)return[];let Q=A.split(",").map((B)=>B.trim()).filter(Boolean);return Array.from(new Set(Q))}function Av(A){return A.join(", ")}function iuQ(A,Q,B){let $=[],J=[];for(let Y of A){if(B.get(Y)===Q){$.push(Y);continue}J.push(Y)}return{channelsAlreadyCurrent:$,channelsToAssign:J}}NK();import{existsSync as UyA,readFileSync as ZIB}from"node:fs";import{cwd as qyA}from"node:process";Zy();U1();Y0();FC();var $U={info:(A)=>d6().info(A),warn:(A)=>d6().warn(A),error:(A)=>d6().error(A)};function DyA(A){throw $U.error(A),new gA(A)}var GIB="5.30.0",KIB="6.30.0",WIB="7.30.0",nuQ=["@capgo/cordova-updater","cordova-plugin-capgo"];function HIB(A){return nuQ.includes(A)}async function FIB(A,Q){if(!PH(A.mode)){let B=await UZ("@capgo/capacitor-updater",Q,A.packageJson);return B?{packageName:"@capgo/capacitor-updater",version:B}:null}for(let B of nuQ){let $=await UZ(B,Q,A.packageJson);if($)return{packageName:B,version:$}}return null}async function HXA(A,Q,B,$={}){let J,Y,X="",Z=null,G="none",K="",W="",H,F=Q.keyV2,D=Q.key===!1,q=d6().spinner();q.start(`Zipping bundle from ${A}`),Z=await T0A(A),q.message("Calculating checksum");let I=V1(qyA()),M=await FIB(Q,I),V=M?.version,C=M?.packageName,L=!1,N;try{N=V?G1(V):void 0}catch{N=void 0}if(!M)if(PH(Q.mode))$U.warn("Cannot find a Capgo updater plugin in node_modules. Using SHA256 checksum for this Cordova upload."),L=!0;else DyA("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager");else if(C&&HIB(C))L=!0;else if(N)L=!dW(N,j0A,w0A,Rh);else if(V==="link:@capgo/capacitor-updater"||V==="file:.."||V==="file:../")$U.warn(`Using local ${C??"@capgo/capacitor-updater"}. Assuming latest version for checksum calculation.`),L=!0;let R=Q.forceCrc32Checksum===!0,E=!R&&((F||Q.keyDataV2||UyA(B5))&&!D||L),w=E?"sha256":"crc32";if(X=await bM(Z,w),q.stop(`Checksum ${E?"SHA256":"CRC32"}${R?" (forced)":""}: ${X}`),D)$U.info("Encryption ignored");else if((F||UyA(B5)||Q.keyDataV2)&&!Q.oldEncryption){let k=typeof F==="string"?F:B5,y=Q.keyDataV2||"";if(!y&&!UyA(k))DyA(`Cannot find private key ${k}`);if(await $.onEncryptV2?.(),!y)y=ZIB(k).toString();let P=N&&!dW(N,"5.30.0","6.30.0","7.30.0");$U.info(`Encrypting your bundle with ${P?"V3":"V2"}`);let{sessionKey:v,ivSessionKey:c}=b7A(y),a=gx(Z,v,c);if(X=P?hx(X,y):yx(X,y),J=c,H=P?"v3":"v2",Y=v,G="v2",K=y,B){if(W=egQ(B),Q.verbose)$U.info(`[Verbose] Encryption key_id: ${W}`)}if(Q.displayIvSession)$U.info(`Your Iv Session key is ${J},
|
|
1448
|
+
Request ID: ${J}`:"";super(`Abandoning manifest upload. The following error occurred: ${$}${Y}`);this.name="ManifestUploadAbandonError",this.backendMessage=$,this.requestId=J,this.scope=A}}function GyA(A){if(A===void 0)return;let Q;try{Q=JSON.parse(A)}catch{return}if(!Q||typeof Q!=="object"||Array.isArray(Q))return;let B=Q,$=B.moreInfo&&typeof B.moreInfo==="object"&&!Array.isArray(B.moreInfo)?B.moreInfo:void 0,J=typeof $?.requestId==="string"?$.requestId:typeof B.requestId==="string"?B.requestId:void 0;if(typeof B.abandon_explicit_error==="string")return new WI("all",B.abandon_explicit_error,J);if(typeof B.abandon_manifest_only_explicit_error==="string")return new WI("manifest",B.abandon_manifest_only_explicit_error,J);return}function fuQ(A){return GyA(A?.originalResponse?.getBody?.())}function guQ(A,Q){return A.scope==="manifest"&&Q?"manifest":"all"}class KyA{abandonError;abandonPromise;activeUploads=new Map;register(A,Q){if(this.abandonError)return Q(this.abandonError),!1;return this.activeUploads.set(A,Q),!0}unregister(A){this.activeUploads.delete(A)}throwIfAbandoned(){if(this.abandonError)throw this.abandonError}async abandon(A){if(!this.abandonError)this.abandonError=A;if(!this.abandonPromise){let Q=[...this.activeUploads.entries()];this.activeUploads.clear(),this.abandonPromise=(async()=>{await Promise.allSettled(Q.map(async([B])=>{await B.abort()}));for(let[,B]of Q)B(this.abandonError)})()}await this.abandonPromise}}var HI={info:(A)=>d6().info(A),warn:(A)=>d6().warn(A),error:(A)=>d6().error(A)},rDB=new Set([429,502,503,504]),oDB=30000;function aDB(A){return rDB.has(A)}function huQ(A){return Math.min(A,oDB)}function sDB(A,Q,B){let $=Q[B];if($===void 0)return;if(A.status!==429)return $;let J=A.headers.get("Retry-After")?.trim();if(!J)return $;if(/^\d+$/.test(J)){let X=Number(J),Z=X*1000;if(Number.isSafeInteger(X)&&Number.isFinite(Z))return huQ(Z)}let Y=Date.parse(J);if(Number.isFinite(Y)){let X=Y-Date.now();if(X>=0)return huQ(X)}return $}function tDB(A){return new gA(`Cannot check whether manifest file exists (HTTP ${A})`,{status:A})}async function eDB(A,Q){let B=new URL(`${A}${encodeURIComponent(Q)}`),$=eT.slice(0,3);for(let J=0;;J++){B.searchParams.set("nocache",`${Date.now()}`);try{let Y=await fetch(B.toString(),{method:"GET",redirect:"manual",headers:A4({"cache-control":"no-cache"})});if(Y.status===404)return{exists:!1};if(!Y.ok){let X=aDB(Y.status)?sDB(Y,$,J):void 0;if(X!==void 0){if(await Y.body?.cancel(),X>0)await new Promise((Z)=>setTimeout(Z,X));continue}throw tDB(Y.status)}return{exists:!0,receipt:Y.headers.get("X-Capgo-Manifest-Size-Receipt")??void 0}}catch(Y){let X=$[J];if(!$q(Y)||X===void 0)throw Y;if(X>0)await new Promise((Z)=>setTimeout(Z,X))}}}var AIB=8192;async function QIB(A){let Q=V1(iDB()),B=await UZ("@capgo/capacitor-updater",Q,A.packageJson),$;try{$=B?G1(B):void 0}catch{$=void 0}if(!B||!$)return{version:null,supportsBrotliV2:!1};let J=!dW($,void 0,void 0,Rh);return{version:`${$.major}.${$.minor}.${$.patch}`,supportsBrotliV2:J}}function BIB(A,Q){if(!Q)return!1;let B=Q.split(",").map(($)=>$.trim()).filter(($)=>!!$);if(B.length===0)return!1;return uuQ.isMatch(A,B)}async function $IB(A,Q,B){let J=cDB(A).size,Y=await HyA(WyA(A));if(J===0)return{buffer:Y,useBrotli:!1};if(BIB(Q,B.noBrotliPatterns))return{buffer:Y,useBrotli:!1};if(J<AIB)return{buffer:Y,useBrotli:!1};try{let X=await HyA(WyA(A).pipe(nDB({})));if(X.length>=J-10)return{buffer:Y,useBrotli:!1};return{buffer:X,useBrotli:!0}}catch(X){return HI.warn(`Brotli compression failed for ${A}: ${X}, using original file`),{buffer:Y,useBrotli:!1}}}async function FyA(A,Q,B,$=!1){let J=d6().spinner();J.start(Q!=="v2"?"Generating the update manifest":`Generating the update manifest with ${$?"V3":"V2"} encryption`);let Y=await _0A(A);if(Q==="v2")for(let X of Y)X.hash=$?hx(X.hash,B):yx(X.hash,B);return J.stop("Manifest generated successfully"),Y}async function cuQ(A,Q,B,$,J,Y,X=!1){let Z=await FyA(A,J,Y,X);return await gB(Q,{channel:"partial-update",event:"Generate manifest",org_id:B,tracking_version:2,tags:{"app-id":$}}),Z}function duQ(A){if(dDB()!=="win32")return A;return yuQ.normalize(A).split(yuQ.sep).join(pDB.sep)}class ex extends gA{constructor(A){super(A);this.name="PartialUploadValidationError"}}async function JIB(A,Q){let{version:B,supportsBrotliV2:$}=await QIB(Q);if(!$)throw new ex(`Your project is using an older version of @capgo/capacitor-updater (${B||"unknown"}). To use Delta updates, please upgrade to version ${j0A} (v5), ${w0A} (v6) or ${Rh} (v7) or higher.`);if(Q.disableBrotli)HI.info("Brotli compression disabled by user request");else if(Q.noBrotliPatterns)HI.info(`Files matching patterns (${Q.noBrotliPatterns}) will be excluded from brotli compression`);let J=A.filter((Y)=>Y.file.includes(" "));if(J.length>0)throw new ex(`Files with spaces in their names (${J.map((Y)=>Y.file).join(", ")}). Please rename the files.`);if(A.length>Nh)throw new ex(L0A(A.length))}async function luQ(A,Q,B,$){let J=lDB(Q,A.file),Y=duQ(A.file),X=$.disableBrotli?{buffer:await HyA(WyA(J)),useBrotli:!1}:await $IB(J,Y,$),Z=B?gx(X.buffer,B.sessionKey,B.ivSessionKey):X.buffer,G=X.useBrotli?`${Y}.br`:Y;return{buffer:Z,fileName:G,compression:X.useBrotli?"brotli":"none",uploadedBytesSha256:mDB("sha256").update(Z).digest("hex"),uploadedBytesSize:Z.byteLength}}async function WXA(A,Q,B,$,J){if(await JIB(A,$),A.length===0)throw new gA("Cannot request a manifest upload for an empty manifest");let Y=[];for(let[X,Z]of A.entries()){let G=await luQ(Z,Q,B,$),K={id:X,file_name:G.fileName,compression:G.compression,file_hash:Z.hash,uploaded_bytes_sha256:G.uploadedBytesSha256,uploaded_bytes_size:G.uploadedBytesSize};if(Y.push(K),J)await J(K,G.buffer)}return Y}function YIB(A,Q){if(A.request.file_name!==Q.fileName||A.request.compression!==Q.compression||A.request.uploaded_bytes_sha256!==Q.uploadedBytesSha256||A.request.uploaded_bytes_size!==Q.uploadedBytesSize)throw new gA(`Manifest file changed while preparing the upload: ${A.request.file_name}`)}function XIB(A){return A4({[A.uploadAuthorization.headerName]:A.uploadAuthorization.value})}async function puQ(A,Q,B,$,J,Y,X,Z){let G=d6().spinner();G.start("Preparing delta update with TUS protocol");let K=performance.now(),W=!!X.userRequestedDelta;if(Z.entries.length!==Q.length)throw new gA("Manifest upload authorization does not match the local manifest");let H=0,F=Q.length,D=Z.entries.filter((I)=>I.request.compression==="brotli").length,q=new KyA;try{G.message(`Uploading ${F} files using TUS protocol`);let I=async(N,R)=>{q.throwIfAbandoned();let E=duQ(N.file),w=await luQ(N,B,Y,X),k=w.buffer;q.throwIfAbandoned();let y=Z.entries[R];if(y.request.file_hash!==N.hash)throw new gA(`Manifest upload authorization does not match the local manifest entry ${R}`);YIB(y,w);let P=w.fileName,v=y.s3Path;if(y.action==="reuse")return H++,{file_name:P,s3_path:v,file_hash:N.hash,file_size_receipt:y.fileSizeReceipt};let c={exists:!1};if(y.action==="upload_if_doesnt_exist")try{c=await eDB(y.uploadTarget.existence_check_url_prefix,v)}catch(a){let e=a instanceof Error?a.message:String(a);throw Error(`Cannot check whether delta file exists: ${E}: ${e}`,{cause:a})}if(q.throwIfAbandoned(),c.exists)return H++,Promise.resolve({file_name:P,s3_path:v,file_hash:N.hash,file_size_receipt:c.receipt});return new Promise((a,e)=>{G.message(`Prepare upload delta file: ${E}`);let r=eC(P),i=XIB(y),l=new muQ.Upload(k,{endpoint:y.uploadTarget.upload_url,chunkSize:X.tusChunkSize,retryDelays:[...eT],removeFingerprintOnSuccess:!0,metadata:{filename:v,filetype:r},headers:i,onAfterResponse(f,p){let g=GyA(p.getBody());if(g)return q.abandon(g)},onError:(f)=>{let p=fuQ(f);if(p){q.abandon(p);return}q.unregister(l);let g=X.verbose?Vh(f):f.toString();if(NNA(f)){HI.error(`Failed to upload ${E}: ${g}`),e(Error(jh($)));return}let m;try{let d=g.match(/response text: (\{.*?\})/);if(d&&d[1])m=JSON.parse(d[1]).moreInfo?.requestId}catch{}let QA=m?` [requestId: ${m}]`:"";HI.error(`Failed to upload ${E}: ${g}${QA}`),e(f)},onProgress(){let f=(H/F*100).toFixed(2);G.message(`Uploading delta update: ${f}%`)},onSuccess({lastResponse:f}){q.unregister(l),H++,a({file_name:P,s3_path:v,file_hash:N.hash,file_size_receipt:f.getHeader("X-Capgo-Manifest-Size-Receipt")??void 0})}});if(q.register(l,e))l.start()})},M=X.deltaUploadConcurrency??50,V=[];for(let N=0;N<Q.length;N+=M){q.throwIfAbandoned();let R=Q.slice(N,N+M),E=Math.floor(N/M)+1,w=Math.ceil(Q.length/M);if(w>1)G.message(`Processing batch ${E}/${w} (${R.length} files)`);let k=await Promise.all(R.map((y,P)=>I(y,N+P)));V.push(...k)}if(V.some((N)=>!N.file_size_receipt))throw new gA("Manifest upload did not return a size receipt for every file");let L=((performance.now()-K)/1000).toFixed(2);if(G.stop(`Delta update uploaded successfully \uD83D\uDCAA in (${L} seconds)`),D>0)HI.info(`${D} of ${F} files were compressed with brotli and use .br extension`);return await gB(A,{channel:"app",event:`App Partial TUS done${D>0?" with .br extension":""}`,org_id:J,tracking_version:2,tags:{"app-id":$}}),await gB(A,{channel:"performance",event:"Partial upload performance",org_id:J,tracking_version:2,tags:{"app-id":$,time:L}}),V}catch(I){let V=((performance.now()-K)/1000).toFixed(2);if(G.error(`Failed to upload delta update (after ${V} seconds)`),I instanceof WI)throw I;let C=X.verbose?Vh(I):String(I);if(W)throw HI.error(`Error uploading delta update: ${C}`),HI.error("Delta upload was explicitly requested but failed. Upload aborted."),I;else return HI.info(`Error uploading delta update: ${C}, This is not a critical error, the bundle has been uploaded without the delta files`),null}}FC();function zyA(A){if(!A)return[];let Q=A.split(",").map((B)=>B.trim()).filter(Boolean);return Array.from(new Set(Q))}function Av(A){return A.join(", ")}function iuQ(A,Q,B){let $=[],J=[];for(let Y of A){if(B.get(Y)===Q){$.push(Y);continue}J.push(Y)}return{channelsAlreadyCurrent:$,channelsToAssign:J}}NK();import{existsSync as UyA,readFileSync as ZIB}from"node:fs";import{cwd as qyA}from"node:process";Zy();U1();Y0();FC();var $U={info:(A)=>d6().info(A),warn:(A)=>d6().warn(A),error:(A)=>d6().error(A)};function DyA(A){throw $U.error(A),new gA(A)}var GIB="5.30.0",KIB="6.30.0",WIB="7.30.0",nuQ=["@capgo/cordova-updater","cordova-plugin-capgo"];function HIB(A){return nuQ.includes(A)}async function FIB(A,Q){if(!PH(A.mode)){let B=await UZ("@capgo/capacitor-updater",Q,A.packageJson);return B?{packageName:"@capgo/capacitor-updater",version:B}:null}for(let B of nuQ){let $=await UZ(B,Q,A.packageJson);if($)return{packageName:B,version:$}}return null}async function HXA(A,Q,B,$={}){let J,Y,X="",Z=null,G="none",K="",W="",H,F=Q.keyV2,D=Q.key===!1,q=d6().spinner();q.start(`Zipping bundle from ${A}`),Z=await T0A(A),q.message("Calculating checksum");let I=V1(qyA()),M=await FIB(Q,I),V=M?.version,C=M?.packageName,L=!1,N;try{N=V?G1(V):void 0}catch{N=void 0}if(!M)if(PH(Q.mode))$U.warn("Cannot find a Capgo updater plugin in node_modules. Using SHA256 checksum for this Cordova upload."),L=!0;else DyA("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager");else if(C&&HIB(C))L=!0;else if(N)L=!dW(N,j0A,w0A,Rh);else if(V==="link:@capgo/capacitor-updater"||V==="file:.."||V==="file:../")$U.warn(`Using local ${C??"@capgo/capacitor-updater"}. Assuming latest version for checksum calculation.`),L=!0;let R=Q.forceCrc32Checksum===!0,E=!R&&((F||Q.keyDataV2||UyA(B5))&&!D||L),w=E?"sha256":"crc32";if(X=await bM(Z,w),q.stop(`Checksum ${E?"SHA256":"CRC32"}${R?" (forced)":""}: ${X}`),D)$U.info("Encryption ignored");else if((F||UyA(B5)||Q.keyDataV2)&&!Q.oldEncryption){let k=typeof F==="string"?F:B5,y=Q.keyDataV2||"";if(!y&&!UyA(k))DyA(`Cannot find private key ${k}`);if(await $.onEncryptV2?.(),!y)y=ZIB(k).toString();let P=N&&!dW(N,"5.30.0","6.30.0","7.30.0");$U.info(`Encrypting your bundle with ${P?"V3":"V2"}`);let{sessionKey:v,ivSessionKey:c}=b7A(y),a=gx(Z,v,c);if(X=P?hx(X,y):yx(X,y),J=c,H=P?"v3":"v2",Y=v,G="v2",K=y,B){if(W=egQ(B),Q.verbose)$U.info(`[Verbose] Encryption key_id: ${W}`)}if(Q.displayIvSession)$U.info(`Your Iv Session key is ${J},
|
|
1449
1449
|
keep it safe, you will need it to decrypt your bundle.
|
|
1450
1450
|
It will be also visible in your dashboard
|
|
1451
1451
|
`);Z=a}return{zipped:Z,ivSessionKey:J,sessionKey:Y,checksum:X,checksumAlgorithm:w,checksumEncryption:H,encryptionMethod:G,finalKeyData:K,keyId:W,updaterVersion:V,updaterPackageName:C}}function FXA(A,Q){let B=A?new Map(A.filter((J)=>!!J.native&&J.native!==void 0).map((J)=>[J.name,J])):new Map;return B.size>0||!Q?Array.from(B,([J,Y])=>({name:J,version:Y.version,requested_version:Y.requested_version,...Y.ios_checksum&&{ios_checksum:Y.ios_checksum},...Y.android_checksum&&{android_checksum:Y.android_checksum}})):void 0}async function zXA(A,Q){if(A.encryptDelta=A.encryptDelta||A.encryptPartial,A.encryptDelta&&Q!=="v2")DyA("You cannot encrypt the delta update if you are not using the v2 encryption method");let B=!1;if(A.delta&&Q==="v2"&&!A.encryptDelta){let $=V1(qyA()),J=await UZ("@capgo/capacitor-updater",$,A.packageJson),Y;try{Y=J?G1(J):void 0}catch{Y=void 0}if(J&&Y&&Ut(Y,G1("6.14.4"))){if($U.info(`Auto-enabling delta update encryption for updater version ${Y} (>= 6.14.4)`),A.verbose)$U.info("[Verbose] Delta encryption auto-enabled for updater >= 6.14.4");A.encryptDelta=!0}}if(A.delta&&(A.encryptDelta||Q==="v2")){let $=V1(qyA()),J=await UZ("@capgo/capacitor-updater",$,A.packageJson),Y;try{Y=J?G1(J):void 0}catch{Y=void 0}if(J&&Y){if(B=!dW(Y,GIB,KIB,WIB),A.verbose&&B)$U.info(`[Verbose] Using hex checksum format for updater version ${Y}`)}}return{supportsHexChecksum:B}}U1();Y0();function zIB(A){let Q=A.appId?.trim()||"<appId>",B=A.path?.trim()||"www",$=A.channel?.trim()||"<channel>";return`npx @capgo/cli@latest bundle upload ${Q} --mode cordova --path ${B} --channel ${$}`}function UIB(A){return[N0A,"If this is a Cordova project (config.xml / plugin.xml and a www folder), retry with:",zIB(A)].join(`
|