@capgo/cli 8.87.1 → 8.87.3
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 +2 -2
- package/dist/notify-app-ready-worker.js +1 -1
- package/dist/onboarding-worker.js +1 -1
- package/dist/package.json +1 -1
- package/dist/src/sdk.js +2 -2
- package/dist/src/types/supabase.types.d.ts +0 -45
- package/dist/src/utils.d.ts +12 -86
- package/dist/updater-installed-worker.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -67,7 +67,7 @@ ${X}
|
|
|
67
67
|
`}}}}).prompt();var s0=b(()=>{CKA();CKA();HKA();XKA();cv=tA(zKA(),1);VKA=EoQ(),woQ=Q6("◆","*"),klA=Q6("■","x"),blA=Q6("▲","x"),EKA=Q6("◇","o"),PoQ=Q6("┌","T"),$$=Q6("│","|"),KU=Q6("└","—"),nLB=Q6("┐","T"),rLB=Q6("┘","—"),RKA=Q6("●",">"),Oo=Q6("○"," "),aLB=Q6("◻","[•]"),oLB=Q6("◼","[+]"),sLB=Q6("◻","[ ]"),_oQ=Q6("▪","•"),tLB=Q6("─","-"),eLB=Q6("╮","+"),ANB=Q6("├","+"),QNB=Q6("╯","+"),BNB=Q6("╰","+"),$NB=Q6("╭","+"),ToQ=Q6("●","•"),SoQ=Q6("◆","*"),koQ=Q6("▲","!"),boQ=Q6("■","x");JNB=[`${b0("dim","↑/↓")} to navigate`,`${b0("dim","Space:")} select`,`${b0("dim","Enter:")} confirm`],v={message:(A=[],{symbol:Q=b0("gray",$$),secondarySymbol:B=b0("gray",$$),output:$=process.stdout,spacing:J=1,withGuide:Y}={})=>{let Z=[],X=Y??x5.withGuide,G=X?B:"",W=X?`${Q} `:"",K=X?`${B} `:"";for(let z=0;z<J;z++)Z.push(G);let H=Array.isArray(A)?A:A.split(`
|
|
68
68
|
`);if(H.length>0){let[z,...q]=H;z.length>0?Z.push(`${W}${z}`):Z.push(X?Q:"");for(let D of q)D.length>0?Z.push(`${K}${D}`):Z.push(X?B:"")}$.write(`${Z.join(`
|
|
69
69
|
`)}
|
|
70
|
-
`)},info:(A,Q)=>{v.message(A,{...Q,symbol:b0("blue",ToQ)})},success:(A,Q)=>{v.message(A,{...Q,symbol:b0("green",SoQ)})},step:(A,Q)=>{v.message(A,{...Q,symbol:b0("green",EKA)})},warn:(A,Q)=>{v.message(A,{...Q,symbol:b0("yellow",koQ)})},warning:(A,Q)=>{v.warn(A,Q)},error:(A,Q)=>{v.message(A,{...Q,symbol:b0("red",boQ)})}},YNB={light:Q6("─","-"),heavy:Q6("━","="),block:Q6("█","#")},yoQ=[`${b0("dim","↑/↓")} to navigate`,`${b0("dim","Enter:")} confirm`],ZNB=`${b0("gray",$$)} `});var P$;var mX=b(()=>{P$={name:"@capgo/cli",type:"module",version:"8.87.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",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --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: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: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: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:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.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-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-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs && bun test/test-builder-only-checklist.mjs && bun test/test-builder-only-setup.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-supabase-client":"bun test/test-create-supabase-client.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-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.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","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","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:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.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-flow-contract":"bun test/test-ios-flow-contract.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: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: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:supabase-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:app-set-options && bun run test:settings-parity && 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-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-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && 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-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && 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:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && 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:frame-fit-ios-shared && 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-flow-contract && 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:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","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-analyze-stream":"bun test/test-ai-analyze-stream.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-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.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 && bun test/test-app-list-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:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.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"},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","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@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-preview":"7.0.0-dev.20260707.2","@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",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"}}});function ylA(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 poQ(A){if(!A||typeof A!=="object")return;let Q=ylA(A);if(Q!==void 0)return Q;let B=A.cause;if(B&&typeof B==="object")return ylA(B);return}function ioQ(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 noQ(A){return ioQ(A)}function gN(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=poQ(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=noQ(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 hlA(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"}import{AsyncLocalStorage as aoQ}from"node:async_hooks";function Po(A,Q){return clA.run(A,()=>Promise.resolve(Q()))}function ooQ(){return clA.getStore()}function dv(){dlA=!0}function llA(){return dlA}function ilA(A){plA=A}function mlA(A){try{plA?.(A)}catch{}}function rlA(A,Q){let B;try{B=new URL(A).pathname}catch{B=A.split("?")[0]}let $="/functions/v1/",J=B.indexOf($);if(J>=0){let W=B.slice(J+$.length),K=0,H=W.length;while(K<H&&W[K]==="/")K+=1;while(H>K&&W[H-1]==="/")H-=1;let z=W.slice(K,H);return z?`${Q} functions:${z}`:`${Q} functions`}let Y="/rest/v1/",Z=B.indexOf(Y),X=Z>=0?B.slice(Z+Y.length):B.replace(/^\//,"");if(X.startsWith("rpc/"))return`rpc:${X.slice(4).split("/")[0]}`;let G=X.split("/")[0]||B;return`${Q} ${G}`}function soQ(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 alA(){return async(Q,B)=>{let $=(B?.method??"GET").toUpperCase(),J=typeof Q==="string"?Q:Q instanceof URL?Q.href:Q.url,Y=ooQ(),Z=soQ(B),X=Date.now();try{let G=await globalThis.fetch(Q,B);return mlA({url:J,method:$,status:G.status,ok:G.ok,durationMs:Date.now()-X,source:Y,apikey:Z}),G}catch(G){throw mlA({url:J,method:$,status:0,ok:!1,durationMs:Date.now()-X,source:Y,apikey:Z,error:G}),G}}}var clA,dlA=!1,plA,nlA=5000;var lv=b(()=>{clA=new aoQ});var pA;var j1=b(()=>{pA=class pA 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 toQ}from"node:os";import{version as eoQ}from"node:process";function tlA(A){slA=A}function QsQ(A){for(let Q=0;Q<A.length;Q++)if(A.charCodeAt(Q)>255)return!1;return!0}function olA(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 BsQ(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 or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function TKA(A,Q){if(Q===void 0||Q===null){if(_KA.has(A.toLowerCase()))throw new pA(olA(A));throw new pA(`HTTP header "${A}" is missing or invalid.`)}if(typeof Q!=="string"){if(_KA.has(A.toLowerCase()))throw new pA(olA(A));throw new pA(`HTTP header "${A}" is missing or invalid.`)}if(!QsQ(Q)){if(_KA.has(A.toLowerCase()))throw new pA(BsQ(A));throw new pA(`HTTP header "${A}" contains invalid characters (only ASCII is allowed).`)}return Q}function b4(A){let Q={capgo_api:AsQ,"x-cli-version":P$.version,"x-cli-command":slA,"x-cli-node":eoQ,"x-cli-os":toQ()};if(A)for(let[B,$]of Object.entries(A))Q[B]=TKA(B,$);return Q}var AsQ="2025-10-01",slA="",_KA;var m7=b(()=>{mX();j1();_KA=new Set(["authorization","capgkey","x-capgo-log-token"])});function wZ(A){let Q=A.length;while(Q>0&&A[Q-1]==="/")Q-=1;return A.slice(0,Q)}import{randomUUID as elA}from"node:crypto";import{existsSync as $sQ,mkdirSync as JsQ,readFileSync as YsQ,writeFileSync as ZsQ}from"node:fs";import{homedir as kKA,platform as XsQ,release as GsQ}from"node:os";import{join as ApA}from"node:path";import{arch as WsQ,cwd as QpA,env as yN,version as KsQ}from"node:process";function u3(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function qsQ(){if(u3(yN.CAPGO_DISABLE_TELEMETRY)||u3(yN.CAPGO_DISABLE_POSTHOG))return;return yN.CAPGO_CLI_POSTHOG_API_KEY?.trim()||yN.POSTHOG_API_KEY?.trim()||FsQ}function DsQ(A){let Q=wZ(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 IsQ(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 MsQ(A){let Q=A,B=QpA(),$=kKA();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function OsQ(A){let Q=A,B=QpA(),$=kKA();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 LsQ(A,Q){let B=A?.split(`
|
|
70
|
+
`)},info:(A,Q)=>{v.message(A,{...Q,symbol:b0("blue",ToQ)})},success:(A,Q)=>{v.message(A,{...Q,symbol:b0("green",SoQ)})},step:(A,Q)=>{v.message(A,{...Q,symbol:b0("green",EKA)})},warn:(A,Q)=>{v.message(A,{...Q,symbol:b0("yellow",koQ)})},warning:(A,Q)=>{v.warn(A,Q)},error:(A,Q)=>{v.message(A,{...Q,symbol:b0("red",boQ)})}},YNB={light:Q6("─","-"),heavy:Q6("━","="),block:Q6("█","#")},yoQ=[`${b0("dim","↑/↓")} to navigate`,`${b0("dim","Enter:")} confirm`],ZNB=`${b0("gray",$$)} `});var P$;var mX=b(()=>{P$={name:"@capgo/cli",type:"module",version:"8.87.3",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",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --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: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: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: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:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.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-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-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs && bun test/test-builder-only-checklist.mjs && bun test/test-builder-only-setup.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-supabase-client":"bun test/test-create-supabase-client.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-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.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","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","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:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.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-flow-contract":"bun test/test-ios-flow-contract.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: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: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:supabase-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:app-set-options && bun run test:settings-parity && 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-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-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && 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-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && 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:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && 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:frame-fit-ios-shared && 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-flow-contract && 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:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","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-analyze-stream":"bun test/test-ai-analyze-stream.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-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.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 && bun test/test-app-list-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:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.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"},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","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@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-preview":"7.0.0-dev.20260707.2","@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",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"}}});function ylA(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 poQ(A){if(!A||typeof A!=="object")return;let Q=ylA(A);if(Q!==void 0)return Q;let B=A.cause;if(B&&typeof B==="object")return ylA(B);return}function ioQ(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 noQ(A){return ioQ(A)}function gN(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=poQ(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=noQ(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 hlA(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"}import{AsyncLocalStorage as aoQ}from"node:async_hooks";function Po(A,Q){return clA.run(A,()=>Promise.resolve(Q()))}function ooQ(){return clA.getStore()}function dv(){dlA=!0}function llA(){return dlA}function ilA(A){plA=A}function mlA(A){try{plA?.(A)}catch{}}function rlA(A,Q){let B;try{B=new URL(A).pathname}catch{B=A.split("?")[0]}let $="/functions/v1/",J=B.indexOf($);if(J>=0){let W=B.slice(J+$.length),K=0,H=W.length;while(K<H&&W[K]==="/")K+=1;while(H>K&&W[H-1]==="/")H-=1;let z=W.slice(K,H);return z?`${Q} functions:${z}`:`${Q} functions`}let Y="/rest/v1/",Z=B.indexOf(Y),X=Z>=0?B.slice(Z+Y.length):B.replace(/^\//,"");if(X.startsWith("rpc/"))return`rpc:${X.slice(4).split("/")[0]}`;let G=X.split("/")[0]||B;return`${Q} ${G}`}function soQ(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 alA(){return async(Q,B)=>{let $=(B?.method??"GET").toUpperCase(),J=typeof Q==="string"?Q:Q instanceof URL?Q.href:Q.url,Y=ooQ(),Z=soQ(B),X=Date.now();try{let G=await globalThis.fetch(Q,B);return mlA({url:J,method:$,status:G.status,ok:G.ok,durationMs:Date.now()-X,source:Y,apikey:Z}),G}catch(G){throw mlA({url:J,method:$,status:0,ok:!1,durationMs:Date.now()-X,source:Y,apikey:Z,error:G}),G}}}var clA,dlA=!1,plA,nlA=5000;var lv=b(()=>{clA=new aoQ});var pA;var j1=b(()=>{pA=class pA 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 toQ}from"node:os";import{version as eoQ}from"node:process";function tlA(A){slA=A}function QsQ(A){for(let Q=0;Q<A.length;Q++)if(A.charCodeAt(Q)>255)return!1;return!0}function olA(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 BsQ(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 or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function TKA(A,Q){if(Q===void 0||Q===null){if(_KA.has(A.toLowerCase()))throw new pA(olA(A));throw new pA(`HTTP header "${A}" is missing or invalid.`)}if(typeof Q!=="string"){if(_KA.has(A.toLowerCase()))throw new pA(olA(A));throw new pA(`HTTP header "${A}" is missing or invalid.`)}if(!QsQ(Q)){if(_KA.has(A.toLowerCase()))throw new pA(BsQ(A));throw new pA(`HTTP header "${A}" contains invalid characters (only ASCII is allowed).`)}return Q}function b4(A){let Q={capgo_api:AsQ,"x-cli-version":P$.version,"x-cli-command":slA,"x-cli-node":eoQ,"x-cli-os":toQ()};if(A)for(let[B,$]of Object.entries(A))Q[B]=TKA(B,$);return Q}var AsQ="2025-10-01",slA="",_KA;var m7=b(()=>{mX();j1();_KA=new Set(["authorization","capgkey","x-capgo-log-token"])});function wZ(A){let Q=A.length;while(Q>0&&A[Q-1]==="/")Q-=1;return A.slice(0,Q)}import{randomUUID as elA}from"node:crypto";import{existsSync as $sQ,mkdirSync as JsQ,readFileSync as YsQ,writeFileSync as ZsQ}from"node:fs";import{homedir as kKA,platform as XsQ,release as GsQ}from"node:os";import{join as ApA}from"node:path";import{arch as WsQ,cwd as QpA,env as yN,version as KsQ}from"node:process";function u3(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function qsQ(){if(u3(yN.CAPGO_DISABLE_TELEMETRY)||u3(yN.CAPGO_DISABLE_POSTHOG))return;return yN.CAPGO_CLI_POSTHOG_API_KEY?.trim()||yN.POSTHOG_API_KEY?.trim()||FsQ}function DsQ(A){let Q=wZ(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 IsQ(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 MsQ(A){let Q=A,B=QpA(),$=kKA();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function OsQ(A){let Q=A,B=QpA(),$=kKA();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 LsQ(A,Q){let B=A?.split(`
|
|
71
71
|
`).slice(1).map(($)=>{let J=$.trim(),Y=J.startsWith("at ")?J.slice(3):J,Z=Q,X=Y,G=Y.lastIndexOf(" (");if(G!==-1&&Y.endsWith(")"))Z=Y.slice(0,G).trim()||Q,X=Y.slice(G+2,-1);else{let H=Y.lastIndexOf(" "),z=H===-1?"":Y.slice(H+1);if(/:\d+:\d+$/.test(z))Z=Y.slice(0,H).trim()||Q,X=z}let W=X.lastIndexOf(":"),K=W===-1?-1:X.lastIndexOf(":",W-1);if(W===-1||K===-1)return{function:Q,platform:"custom",lang:"javascript"};return{function:Z,filename:MsQ(X.slice(0,K)),lineno:Number.parseInt(X.slice(K+1,W),10),colno:Number.parseInt(X.slice(W+1),10),platform:"custom",lang:"javascript"}}).filter(Boolean);return B&&B.length>0?B:[{function:Q,platform:"custom",lang:"javascript"}]}function NsQ(A){if(!A||typeof A!=="object"||!("code"in A))return;let{code:Q}=A;return typeof Q==="string"?Q:void 0}function VsQ(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 RsQ(A){let Q=(A instanceof Error?A.message:typeof A==="string"?A:"").toLowerCase();if(CsQ.some((B)=>Q.includes(B)))return!0;return VsQ(A)===401}function pv(A){if(A instanceof pA){if(UsQ.has(A.message))return!0;return!1}if(RsQ(A))return!1;return!NsQ(A)?.startsWith("commander.")}function _o(A){let Q=[],B=A;while(B?.parent){let $=B.name();if($)Q.push($);B=B.parent}return Q.reverse().join(" ")||"unknown"}function EsQ(A=ApA(kKA(),".capgo-credentials")){if(SKA)return SKA;let Q=ApA(A,"install-id"),B;try{let $=$sQ(Q)?YsQ(Q,"utf8").trim():"";if($)B=$;else B=elA(),JsQ(A,{recursive:!0}),ZsQ(Q,B,{encoding:"utf8",mode:384})}catch{B=elA()}return SKA=B,B}async function iv(A){let Q=qsQ();if(!Q)return!1;let B=yN.CAPGO_CLI_POSTHOG_API_HOST?.trim()||yN.POSTHOG_API_HOST?.trim()||HsQ,$;try{$=DsQ(B)}catch{return!1}let J=IsQ(A.error),Y=OsQ(J.message),Z=EsQ(),X=LsQ(J.stack,A.functionName),G=[A.functionName,A.kind,J.name||"Error",String(A.status??1)].join(":"),W={token:Q,event:"$exception",properties:{distinct_id:Z,$exception_list:[{type:J.name||"Error",value:Y,mechanism:{handled:!0,synthetic:!1},stacktrace:{type:"raw",frames:X}}],$exception_fingerprint:G,architecture:WsQ,cli_version:P$.version,error_kind:A.kind,function_name:A.functionName,is_ci:Boolean(yN.CI),node_version:KsQ,os_platform:XsQ(),os_release:GsQ(),runtime:"cli",status:A.status},timestamp:new Date().toISOString()};try{let K=new AbortController,H=setTimeout(()=>K.abort(),zsQ);try{return(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W),signal:K.signal})).ok}finally{clearTimeout(H)}}catch{return!1}}var HsQ="https://eu.i.posthog.com/i/v0/e/",FsQ="phc_NXDyDajQaTQVwb25DEhIVZfxVUn4R0Y348Z7vWYHZUi",zsQ=1500,bKA="iOS sync validation failed. Delete your iOS folder, then rerun the add and sync commands above and retry.",UsQ,CsQ,SKA;var Gw=b(()=>{mX();j1();UsQ=new Set([bKA]);CsQ=["invalid_apikey","invalid apikey","no_key_provided","no key provided","invalid api key or insufficient permissions","does not exist, run first"]});import{existsSync as cX}from"fs";var j2=(A=".",Q="unknown")=>{let B=`${A}/bun.lockb`,$=`${A}/bun.lock`,J=`${A}/pnpm-lock.yaml`,Y=`${A}/shrinkwrap.yaml`,Z=`${A}/yarn.lock`,X=`${A}/package-lock.json`,G=`${A}/npm-shrinkwrap.json`;if(cX(B)||cX($))return"bun";if(cX(J)||cX(Y))return"pnpm";if(cX(Z))return"yarn";if(cX(X)||cX(G))return"npm";return Q},NI=(A=j2(),Q=!1)=>{switch(A){case"bun":return Q?"bun install":"install";case"pnpm":return Q?"pnpm install":"install";case"yarn":return Q?"yarn install":"install";case"npm":return Q?"npm install":"install";case"unknown":return Q?"unknown unknown":"unknown";default:return Q?"npm install":"install"}},To=(A=".",Q="npx")=>{let B=`${A}/bun.lockb`,$=`${A}/bun.lock`,J=`${A}/pnpm-lock.yaml`,Y=`${A}/shrinkwrap.yaml`,Z=`${A}/yarn.lock`,X=`${A}/package-lock.json`,G=`${A}/npm-shrinkwrap.json`;if(cX(B)||cX($))return"bunx";if(cX(J)||cX(Y))return"pnpm exec";if(cX(Z))return"yarn dlx";if(cX(X)||cX(G))return"npx";return Q};var nv=()=>{};function So(A,Q){if(isNaN(A)||isNaN(Q))throw Error("Cannot compare against non-numbers");return A===Q?0:A<Q?-1:1}function JpA(A=[],Q=[]){if(A.length&&!Q.length)return-1;if(!A.length&&Q.length)return 1;return 0}function ko(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 vKA(A){return typeof A==="number"&&!Number.isNaN(A)&&(!Number.isFinite(A)||0<=A&&A<=Number.MAX_SAFE_INTEGER)}function dX(A){return A.split(".").filter(Boolean).map((Q)=>{if(_sQ.test(Q)){let B=Number(Q);if(vKA(B))return B}return Q})}function w2(A){return A.split(".").filter(Boolean)}function xo(A,Q){let B=Number(A);if(!vKA(B))throw TypeError(Q);return B}function zU(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 Ww="0|[1-9]\\d*",jsQ="\\d*[a-zA-Z-][a-zA-Z0-9-]*",wsQ,BpA,YpA,$pA="[0-9A-Za-z-]+",ZpA,XpA,GpA,WpA="(?:<|>)?=?",PsQ="x|X|\\*",xKA,bo,KpA,HpA,fKA=256,_sQ;var aG=b(()=>{wsQ=`(?<major>${Ww})\\.(?<minor>${Ww})\\.(?<patch>${Ww})`,BpA=`(?:${Ww}|${jsQ})`,YpA=`(?:-(?<prerelease>${BpA}(?:\\.${BpA})*))`,ZpA=`(?:\\+(?<buildmetadata>${$pA}(?:\\.${$pA})*))`,XpA=`v?${wsQ}${YpA}?${ZpA}?`,GpA=new RegExp(`^${XpA}$`),xKA=`${Ww}|${PsQ}`,bo=`[v=\\s]*(?<major>${xKA})(?:\\.(?<minor>${xKA})(?:\\.(?<patch>${xKA})${YpA}?${ZpA}?)?)?`,KpA=new RegExp(`^(?<operator>~>?|\\^|${WpA})\\s*${bo}$`),HpA=new RegExp(`^(?<operator>${WpA})\\s*(${XpA})$|^$`);_sQ=new RegExp(`^${Ww}$`)});function PZ(A,Q){if(A===Q)return 0;return So(A.major,Q.major)||So(A.minor,Q.minor)||So(A.patch,Q.patch)||JpA(A.prerelease,Q.prerelease)||ko(A.prerelease,Q.prerelease)}var QK=b(()=>{aG()});function FpA(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(ko(A.prerelease,Q.prerelease)!==0)return"prerelease"}var zpA=b(()=>{aG()});function gKA(A){return A.toFixed(0)}function aY(A){let Q=gKA(A.major),B=gKA(A.minor),$=gKA(A.patch),J=A.prerelease?.join(".")??"",Y=A.build?.join(".")??"";return[[`${Q}.${B}.${$}`,J].filter((G)=>G).join("-"),Y].filter((G)=>G).join("+")}function TsQ(A,Q){if(zU(Q))return!0;let B=PZ(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 vo(A,Q){for(let B of Q)if(!TsQ(A,B))return!1;if(!A.prerelease?.length)return!0;for(let B of Q){if(zU(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 fo=b(()=>{aG();QK()});function rv(A,Q){return Q.some((B)=>vo(A,B))}var av=b(()=>{fo()});function SsQ(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 ov(A=[],Q){let B=SsQ(A);if(!Q)return B;let $=dX(Q);if($.every((J)=>typeof J==="string")){if($.every((J,Y)=>J===B[Y])&&typeof B[$.length]==="number")return B;$=[...$,0]}return $}function CI(A,Q,B={}){let $=B.build!==void 0?w2(B.build):A.build??[];switch(Q){case"premajor":return{major:A.major+1,minor:0,patch:0,prerelease:ov(A.prerelease,B.prerelease),build:$};case"preminor":return{major:A.major,minor:A.minor+1,patch:0,prerelease:ov(A.prerelease,B.prerelease),build:$};case"prepatch":return{major:A.major,minor:A.minor,patch:A.patch+1,prerelease:ov(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:ov(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:ov(A.prerelease,B.prerelease),build:$};default:throw TypeError(`Cannot increment version: invalid argument ${Q}`)}}var UpA=b(()=>{aG()});var go,Kw;var sv=b(()=>{go={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Kw={operator:void 0,...go}});var yKA=b(()=>{sv();aG()});function hKA(A,Q){return PZ(A,Q)>0}var uKA=b(()=>{QK()});var qpA=b(()=>{av();uKA()});function c7(A,Q){return PZ(A,Q)<0}var mKA=b(()=>{QK()});var DpA=b(()=>{av();mKA()});function ksQ(A){let B=A.match(HpA)?.groups;if(!B)return null;let{operator:$}=B;return{operator:$||void 0,...go}}function _6(A){return!A||A.toLowerCase()==="x"||A==="*"}function bsQ(A){if(_6(A.major))return;if(_6(A.minor))return{operator:">=",major:+A.major,minor:0,patch:0,prerelease:[],build:[]};if(_6(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?dX(A.prerelease):[],build:[]}}function xsQ(A){if(_6(A.major))return;if(_6(A.minor))return{operator:"<",major:+A.major+1,minor:0,patch:0,prerelease:[],build:[]};if(_6(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:dX(A.prerelease),build:[]};return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:[],build:[]}}function vsQ(A){let Q=A.match(new RegExp(`^${bo}`)),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,X=A.slice($+Y).match(new RegExp(`^${bo}\\s*$`))?.groups,G=bsQ(B),W=xsQ(X);return[G,W].filter(Boolean)}function fsQ(A){let Q=_6(A.major),B=_6(A.minor),$=_6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[Kw];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 X=dX(A.prerelease??"");if(J===0){if(Y===0)return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J,minor:Y,patch:Z+1}];return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J,minor:Y+1,patch:0}]}return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J+1,minor:0,patch:0}]}function gsQ(A){let Q=_6(A.major),B=_6(A.minor),$=_6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[Kw];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 X=dX(A.prerelease??"");return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J,minor:Y+1,patch:0}]}function ysQ(A){let Q=_6(A.major),B=_6(A.minor),$=_6(A.patch),J=+A.major,Y=+A.minor,Z=+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 X=dX(A.prerelease??""),G=w2(A.build??"");return[{operator:"<",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function hsQ(A){let Q=_6(A.minor),B=_6(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 Z=dX(A.prerelease??""),X=w2(A.build??"");return[{operator:"<=",major:$,minor:J,patch:Y,prerelease:Z,build:X}]}function usQ(A){let Q=_6(A.major),B=_6(A.minor),$=_6(A.patch),J=+A.major,Y=+A.minor,Z=+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 X=dX(A.prerelease??""),G=w2(A.build??"");return[{operator:">",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function msQ(A){let Q=_6(A.major),B=_6(A.minor),$=_6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[Kw];if(B)return[{operator:">=",major:J,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y,patch:0}];let X=dX(A.prerelease??""),G=w2(A.build??"");return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function csQ(A){let Q=_6(A.major),B=_6(A.minor),$=_6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[Kw];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 X=dX(A.prerelease??""),G=w2(A.build??"");return[{operator:A.operator==="="?"=":void 0,major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function dsQ(A){let Q=A.match(KpA)?.groups;if(!Q)return ksQ(A);switch(Q.operator){case"^":return fsQ(Q);case"~":case"~>":return gsQ(Q);case"<":return ysQ(Q);case"<=":return hsQ(Q);case">":return usQ(Q);case">=":return msQ(Q);default:return csQ(Q)}}function lsQ(A){return A.split(/\s+/).flatMap(dsQ)}function yo(A){let Q=A.replaceAll(/(?<=[<>=~^])(\s+)/g,"").split(/\s*\|\|\s*/).map((B)=>vsQ(B)||lsQ(B));if(Q.some((B)=>B.includes(null)))throw TypeError(`Cannot parse version range: range "${A}" is invalid`);return Q}var cKA=b(()=>{aG();sv()});function K1(A){if(typeof A!=="string")throw TypeError(`Cannot parse version as version must be a string: received ${typeof A}`);if(A.length>fKA)throw TypeError(`Cannot parse version as version length is too long: length is ${A.length}, max length is ${fKA}`);A=A.trim();let Q=A.match(GpA)?.groups;if(!Q)throw TypeError(`Cannot parse version: ${A}`);let B=xo(Q.major,`Cannot parse version ${A}: invalid major version`),$=xo(Q.minor,`Cannot parse version ${A}: invalid minor version`),J=xo(Q.patch,`Cannot parse version ${A}: invalid patch version`),Y=Q.prerelease?dX(Q.prerelease):[],Z=Q.buildmetadata?w2(Q.buildmetadata):[];return{major:B,minor:$,patch:J,prerelease:Y,build:Z}}var ho=b(()=>{aG();aG()});function IpA(A,Q){let B=A.operator,$=Q.operator;if(B===void 0){if(zU(A))return!0;return rv(A,[[Q]])}if($===void 0){if(zU(Q))return!0;return rv(Q,[[A]])}let J=PZ(A,Q);return(B===">="||B===">")&&($===">="||$===">")||(B==="<="||B==="<")&&($==="<="||$==="<")||J===0&&((B===">="||B==="<=")&&($===">="||$==="<="))||J===-1&&(B===">="||B===">")&&($==="<="||$==="<")||J===1&&(B==="<="||B==="<")&&($===">="||$===">")}function psQ(A){return A.every((Q)=>{return Q.some((B)=>isQ(B))})}function isQ(A){for(let Q=0;Q<A.length-1;Q++){let B=A[Q];for(let $ of A.slice(Q+1))if(!IpA(B,$))return!1}return!0}function MpA(A,Q){return psQ([A,Q])&&A.some((B)=>{return Q.some(($)=>{return B.every((J)=>{return $.every((Y)=>IpA(J,Y))})})})}var OpA=b(()=>{aG();QK();av()});var LpA=b(()=>{cKA()});var NpA=b(()=>{sv();sv();yKA()});function VI(A){try{return K1(A),!0}catch{return!1}}var CpA=b(()=>{ho()});var VpA=b(()=>{ho()});var RpA=b(()=>{aG()});var EpA=b(()=>{QK()});var jpA=b(()=>{QK()});var wpA=b(()=>{fo();aG();QK()});function dKA(A,Q){return PZ(A,Q)>=0}var PpA=b(()=>{QK()});var _pA=b(()=>{fo();aG();QK()});var TpA=b(()=>{QK()});var BK=b(()=>{QK();zpA();av();UpA();yKA();qpA();DpA();cKA();ho();OpA();LpA();NpA();CpA();VpA();RpA();EpA();jpA();uKA();wpA();PpA();mKA();_pA();TpA()});var lX=YA((iVB,co)=>{var SpA,kpA,bpA,xpA,vpA,fpA,gpA,ypA,hpA,upA,mpA,cpA,dpA,uo,lKA,lpA,ppA,ipA,Hw,npA,rpA,apA,opA,spA,tpA,epA,AiA,QiA,mo,BiA,$iA,JiA;(function(A){var Q=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd)define("tslib",["exports"],function($){A(B(Q,B($)))});else if(typeof co==="object"&&typeof iVB==="object")A(B(Q,B(iVB)));else A(B(Q));function B($,J){if($!==Q)if(typeof Object.create==="function")Object.defineProperty($,"__esModule",{value:!0});else $.__esModule=!0;return function(Y,Z){return $[Y]=J?J(Y,Z):Z}}})(function(A){var Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Y,Z){Y.__proto__=Z}||function(Y,Z){for(var X in Z)if(Object.prototype.hasOwnProperty.call(Z,X))Y[X]=Z[X]};SpA=function(Y,Z){if(typeof Z!=="function"&&Z!==null)throw TypeError("Class extends value "+String(Z)+" is not a constructor or null");Q(Y,Z);function X(){this.constructor=Y}Y.prototype=Z===null?Object.create(Z):(X.prototype=Z.prototype,new X)},kpA=Object.assign||function(Y){for(var Z,X=1,G=arguments.length;X<G;X++){Z=arguments[X];for(var W in Z)if(Object.prototype.hasOwnProperty.call(Z,W))Y[W]=Z[W]}return Y},bpA=function(Y,Z){var X={};for(var G in Y)if(Object.prototype.hasOwnProperty.call(Y,G)&&Z.indexOf(G)<0)X[G]=Y[G];if(Y!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var W=0,G=Object.getOwnPropertySymbols(Y);W<G.length;W++)if(Z.indexOf(G[W])<0&&Object.prototype.propertyIsEnumerable.call(Y,G[W]))X[G[W]]=Y[G[W]]}return X},xpA=function(Y,Z,X,G){var W=arguments.length,K=W<3?Z:G===null?G=Object.getOwnPropertyDescriptor(Z,X):G,H;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")K=Reflect.decorate(Y,Z,X,G);else for(var z=Y.length-1;z>=0;z--)if(H=Y[z])K=(W<3?H(K):W>3?H(Z,X,K):H(Z,X))||K;return W>3&&K&&Object.defineProperty(Z,X,K),K},vpA=function(Y,Z){return function(X,G){Z(X,G,Y)}},fpA=function(Y,Z,X,G,W,K){function H(E){if(E!==void 0&&typeof E!=="function")throw TypeError("Function expected");return E}var z=G.kind,q=z==="getter"?"get":z==="setter"?"set":"value",D=!Z&&Y?G.static?Y:Y.prototype:null,I=Z||(D?Object.getOwnPropertyDescriptor(D,G.name):{}),M,C=!1;for(var V=X.length-1;V>=0;V--){var L={};for(var N in G)L[N]=N==="access"?{}:G[N];for(var N in G.access)L.access[N]=G.access[N];L.addInitializer=function(E){if(C)throw TypeError("Cannot add initializers after decoration has completed");K.push(H(E||null))};var R=(0,X[V])(z==="accessor"?{get:I.get,set:I.set}:I[q],L);if(z==="accessor"){if(R===void 0)continue;if(R===null||typeof R!=="object")throw TypeError("Object expected");if(M=H(R.get))I.get=M;if(M=H(R.set))I.set=M;if(M=H(R.init))W.unshift(M)}else if(M=H(R))if(z==="field")W.unshift(M);else I[q]=M}if(D)Object.defineProperty(D,G.name,I);C=!0},gpA=function(Y,Z,X){var G=arguments.length>2;for(var W=0;W<Z.length;W++)X=G?Z[W].call(Y,X):Z[W].call(Y);return G?X:void 0},ypA=function(Y){return typeof Y==="symbol"?Y:"".concat(Y)},hpA=function(Y,Z,X){if(typeof Z==="symbol")Z=Z.description?"[".concat(Z.description,"]"):"";return Object.defineProperty(Y,"name",{configurable:!0,value:X?"".concat(X," ",Z):Z})},upA=function(Y,Z){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Y,Z)},mpA=function(Y,Z,X,G){function W(K){return K instanceof X?K:new X(function(H){H(K)})}return new(X||(X=Promise))(function(K,H){function z(I){try{D(G.next(I))}catch(M){H(M)}}function q(I){try{D(G.throw(I))}catch(M){H(M)}}function D(I){I.done?K(I.value):W(I.value).then(z,q)}D((G=G.apply(Y,Z||[])).next())})},cpA=function(Y,Z){var X={label:0,sent:function(){if(K[0]&1)throw K[1];return K[1]},trys:[],ops:[]},G,W,K,H=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return H.next=z(0),H.throw=z(1),H.return=z(2),typeof Symbol==="function"&&(H[Symbol.iterator]=function(){return this}),H;function z(D){return function(I){return q([D,I])}}function q(D){if(G)throw TypeError("Generator is already executing.");while(H&&(H=0,D[0]&&(X=0)),X)try{if(G=1,W&&(K=D[0]&2?W.return:D[0]?W.throw||((K=W.return)&&K.call(W),0):W.next)&&!(K=K.call(W,D[1])).done)return K;if(W=0,K)D=[D[0]&2,K.value];switch(D[0]){case 0:case 1:K=D;break;case 4:return X.label++,{value:D[1],done:!1};case 5:X.label++,W=D[1],D=[0];continue;case 7:D=X.ops.pop(),X.trys.pop();continue;default:if((K=X.trys,!(K=K.length>0&&K[K.length-1]))&&(D[0]===6||D[0]===2)){X=0;continue}if(D[0]===3&&(!K||D[1]>K[0]&&D[1]<K[3])){X.label=D[1];break}if(D[0]===6&&X.label<K[1]){X.label=K[1],K=D;break}if(K&&X.label<K[2]){X.label=K[2],X.ops.push(D);break}if(K[2])X.ops.pop();X.trys.pop();continue}D=Z.call(Y,X)}catch(I){D=[6,I],W=0}finally{G=K=0}if(D[0]&5)throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}},dpA=function(Y,Z){for(var X in Y)if(X!=="default"&&!Object.prototype.hasOwnProperty.call(Z,X))mo(Z,Y,X)},mo=Object.create?function(Y,Z,X,G){if(G===void 0)G=X;var W=Object.getOwnPropertyDescriptor(Z,X);if(!W||("get"in W?!Z.__esModule:W.writable||W.configurable))W={enumerable:!0,get:function(){return Z[X]}};Object.defineProperty(Y,G,W)}:function(Y,Z,X,G){if(G===void 0)G=X;Y[G]=Z[X]},uo=function(Y){var Z=typeof Symbol==="function"&&Symbol.iterator,X=Z&&Y[Z],G=0;if(X)return X.call(Y);if(Y&&typeof Y.length==="number")return{next:function(){if(Y&&G>=Y.length)Y=void 0;return{value:Y&&Y[G++],done:!Y}}};throw TypeError(Z?"Object is not iterable.":"Symbol.iterator is not defined.")},lKA=function(Y,Z){var X=typeof Symbol==="function"&&Y[Symbol.iterator];if(!X)return Y;var G=X.call(Y),W,K=[],H;try{while((Z===void 0||Z-- >0)&&!(W=G.next()).done)K.push(W.value)}catch(z){H={error:z}}finally{try{if(W&&!W.done&&(X=G.return))X.call(G)}finally{if(H)throw H.error}}return K},lpA=function(){for(var Y=[],Z=0;Z<arguments.length;Z++)Y=Y.concat(lKA(arguments[Z]));return Y},ppA=function(){for(var Y=0,Z=0,X=arguments.length;Z<X;Z++)Y+=arguments[Z].length;for(var G=Array(Y),W=0,Z=0;Z<X;Z++)for(var K=arguments[Z],H=0,z=K.length;H<z;H++,W++)G[W]=K[H];return G},ipA=function(Y,Z,X){if(X||arguments.length===2){for(var G=0,W=Z.length,K;G<W;G++)if(K||!(G in Z)){if(!K)K=Array.prototype.slice.call(Z,0,G);K[G]=Z[G]}}return Y.concat(K||Array.prototype.slice.call(Z))},Hw=function(Y){return this instanceof Hw?(this.v=Y,this):new Hw(Y)},npA=function(Y,Z,X){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var G=X.apply(Y,Z||[]),W,K=[];return W=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),z("next"),z("throw"),z("return",H),W[Symbol.asyncIterator]=function(){return this},W;function H(V){return function(L){return Promise.resolve(L).then(V,M)}}function z(V,L){if(G[V]){if(W[V]=function(N){return new Promise(function(R,E){K.push([V,N,R,E])>1||q(V,N)})},L)W[V]=L(W[V])}}function q(V,L){try{D(G[V](L))}catch(N){C(K[0][3],N)}}function D(V){V.value instanceof Hw?Promise.resolve(V.value.v).then(I,M):C(K[0][2],V)}function I(V){q("next",V)}function M(V){q("throw",V)}function C(V,L){if(V(L),K.shift(),K.length)q(K[0][0],K[0][1])}},rpA=function(Y){var Z,X;return Z={},G("next"),G("throw",function(W){throw W}),G("return"),Z[Symbol.iterator]=function(){return this},Z;function G(W,K){Z[W]=Y[W]?function(H){return(X=!X)?{value:Hw(Y[W](H)),done:!1}:K?K(H):H}:K}},apA=function(Y){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var Z=Y[Symbol.asyncIterator],X;return Z?Z.call(Y):(Y=typeof uo==="function"?uo(Y):Y[Symbol.iterator](),X={},G("next"),G("throw"),G("return"),X[Symbol.asyncIterator]=function(){return this},X);function G(K){X[K]=Y[K]&&function(H){return new Promise(function(z,q){H=Y[K](H),W(z,q,H.done,H.value)})}}function W(K,H,z,q){Promise.resolve(q).then(function(D){K({value:D,done:z})},H)}},opA=function(Y,Z){if(Object.defineProperty)Object.defineProperty(Y,"raw",{value:Z});else Y.raw=Z;return Y};var B=Object.create?function(Y,Z){Object.defineProperty(Y,"default",{enumerable:!0,value:Z})}:function(Y,Z){Y.default=Z},$=function(Y){return $=Object.getOwnPropertyNames||function(Z){var X=[];for(var G in Z)if(Object.prototype.hasOwnProperty.call(Z,G))X[X.length]=G;return X},$(Y)};spA=function(Y){if(Y&&Y.__esModule)return Y;var Z={};if(Y!=null){for(var X=$(Y),G=0;G<X.length;G++)if(X[G]!=="default")mo(Z,Y,X[G])}return B(Z,Y),Z},tpA=function(Y){return Y&&Y.__esModule?Y:{default:Y}},epA=function(Y,Z,X,G){if(X==="a"&&!G)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?Y!==Z||!G:!Z.has(Y))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?G:X==="a"?G.call(Y):G?G.value:Z.get(Y)},AiA=function(Y,Z,X,G,W){if(G==="m")throw TypeError("Private method is not writable");if(G==="a"&&!W)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?Y!==Z||!W:!Z.has(Y))throw TypeError("Cannot write private member to an object whose class did not declare it");return G==="a"?W.call(Y,X):W?W.value=X:Z.set(Y,X),X},QiA=function(Y,Z){if(Z===null||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("Cannot use 'in' operator on non-object");return typeof Y==="function"?Z===Y:Y.has(Z)},BiA=function(Y,Z,X){if(Z!==null&&Z!==void 0){if(typeof Z!=="object"&&typeof Z!=="function")throw TypeError("Object expected.");var G,W;if(X){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");G=Z[Symbol.asyncDispose]}if(G===void 0){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");if(G=Z[Symbol.dispose],X)W=G}if(typeof G!=="function")throw TypeError("Object not disposable.");if(W)G=function(){try{W.call(this)}catch(K){return Promise.reject(K)}};Y.stack.push({value:Z,dispose:G,async:X})}else if(X)Y.stack.push({async:!0});return Z};var J=typeof SuppressedError==="function"?SuppressedError:function(Y,Z,X){var G=Error(X);return G.name="SuppressedError",G.error=Y,G.suppressed=Z,G};$iA=function(Y){function Z(K){Y.error=Y.hasError?new J(K,Y.error,"An error was suppressed during disposal."):K,Y.hasError=!0}var X,G=0;function W(){while(X=Y.stack.pop())try{if(!X.async&&G===1)return G=0,Y.stack.push(X),Promise.resolve().then(W);if(X.dispose){var K=X.dispose.call(X.value);if(X.async)return G|=2,Promise.resolve(K).then(W,function(H){return Z(H),W()})}else G|=1}catch(H){Z(H)}if(G===1)return Y.hasError?Promise.reject(Y.error):Promise.resolve();if(Y.hasError)throw Y.error}return W()},JiA=function(Y,Z){if(typeof Y==="string"&&/^\.\.?\//.test(Y))return Y.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(X,G,W,K,H){return G?Z?".jsx":".js":W&&(!K||!H)?X:W+K+"."+H.toLowerCase()+"js"});return Y},A("__extends",SpA),A("__assign",kpA),A("__rest",bpA),A("__decorate",xpA),A("__param",vpA),A("__esDecorate",fpA),A("__runInitializers",gpA),A("__propKey",ypA),A("__setFunctionName",hpA),A("__metadata",upA),A("__awaiter",mpA),A("__generator",cpA),A("__exportStar",dpA),A("__createBinding",mo),A("__values",uo),A("__read",lKA),A("__spread",lpA),A("__spreadArrays",ppA),A("__spreadArray",ipA),A("__await",Hw),A("__asyncGenerator",npA),A("__asyncDelegator",rpA),A("__asyncValues",apA),A("__makeTemplateObject",opA),A("__importStar",spA),A("__importDefault",tpA),A("__classPrivateFieldGet",epA),A("__classPrivateFieldSet",AiA),A("__classPrivateFieldIn",QiA),A("__addDisposableResource",BiA),A("__disposeResources",$iA),A("__rewriteRelativeImportExtension",JiA)})});var XiA=YA((YiA)=>{Object.defineProperty(YiA,"__esModule",{value:!0});YiA.resolveFetch=void 0;var nsQ=(A)=>{if(A)return(...Q)=>A(...Q);return(...Q)=>fetch(...Q)};YiA.resolveFetch=nsQ});var pKA=YA((FiA)=>{Object.defineProperty(FiA,"__esModule",{value:!0});FiA.FunctionRegion=FiA.FunctionsHttpError=FiA.FunctionsRelayError=FiA.FunctionsFetchError=FiA.FunctionsError=void 0;class tv extends Error{constructor(A,Q="FunctionsError",B){super(A);this.name=Q,this.context=B}toJSON(){return{name:this.name,message:this.message,context:this.context}}}FiA.FunctionsError=tv;class WiA extends tv{constructor(A){super("Failed to send a request to the Edge Function","FunctionsFetchError",A)}}FiA.FunctionsFetchError=WiA;class KiA extends tv{constructor(A){super("Relay Error invoking the Edge Function","FunctionsRelayError",A)}}FiA.FunctionsRelayError=KiA;class HiA extends tv{constructor(A){super("Edge Function returned a non-2xx status code","FunctionsHttpError",A)}}FiA.FunctionsHttpError=HiA;var GiA;(function(A){A.Any="any",A.ApNortheast1="ap-northeast-1",A.ApNortheast2="ap-northeast-2",A.ApSouth1="ap-south-1",A.ApSoutheast1="ap-southeast-1",A.ApSoutheast2="ap-southeast-2",A.CaCentral1="ca-central-1",A.EuCentral1="eu-central-1",A.EuWest1="eu-west-1",A.EuWest2="eu-west-2",A.EuWest3="eu-west-3",A.SaEast1="sa-east-1",A.UsEast1="us-east-1",A.UsWest1="us-west-1",A.UsWest2="us-west-2"})(GiA||(FiA.FunctionRegion=GiA={}))});var IiA=YA((qiA)=>{Object.defineProperty(qiA,"__esModule",{value:!0});qiA.FunctionsClient=void 0;var tsQ=lX(),esQ=XiA(),Fw=pKA();class UiA{constructor(A,{headers:Q={},customFetch:B,region:$=Fw.FunctionRegion.Any}={}){this.url=A,this.headers=Q,this.region=$,this.fetch=(0,esQ.resolveFetch)(B)}setAuth(A){this.headers.Authorization=`Bearer ${A}`}invoke(A){return tsQ.__awaiter(this,arguments,void 0,function*(Q,B={}){var $,J;let Y,Z,X;try{let{headers:G,method:W,body:K,signal:H,timeout:z}=B,q={},{region:D}=B;if(!D)D=this.region;let I=new URL(`${this.url}/${Q}`);if(D&&D!=="any")q["x-region"]=D,I.searchParams.set("forceFunctionRegion",D);let M,C=!!G&&Object.keys(G).some((w)=>w.toLowerCase()==="content-type");if(K&&!C)if(typeof Blob<"u"&&K instanceof Blob||K instanceof ArrayBuffer)q["Content-Type"]="application/octet-stream",M=K;else if(typeof K==="string")q["Content-Type"]="text/plain",M=K;else if(typeof FormData<"u"&&K instanceof FormData)M=K;else q["Content-Type"]="application/json",M=JSON.stringify(K);else if(K&&typeof K!=="string"&&!(typeof Blob<"u"&&K instanceof Blob)&&!(K instanceof ArrayBuffer)&&!(typeof FormData<"u"&&K instanceof FormData))M=JSON.stringify(K);else M=K;let V=H;if(z)if(Z=new AbortController,Y=setTimeout(()=>Z.abort(),z),H)V=Z.signal,X=()=>Z.abort(),H.addEventListener("abort",X);else V=Z.signal;let L=yield this.fetch(I.toString(),{method:W||"POST",headers:Object.assign(Object.assign(Object.assign({},q),this.headers),G),body:M,signal:V}).catch((w)=>{throw new Fw.FunctionsFetchError(w)}),N=L.headers.get("x-relay-error");if(N&&N==="true")throw new Fw.FunctionsRelayError(L);if(!L.ok)throw new Fw.FunctionsHttpError(L);let R=(($=L.headers.get("Content-Type"))!==null&&$!==void 0?$:"text/plain").split(";")[0].trim().toLowerCase(),E;if(R==="application/json")E=yield L.json();else if(R==="application/octet-stream"||R==="application/pdf")E=yield L.blob();else if(R==="text/event-stream")E=L;else if(R==="multipart/form-data")E=yield L.formData();else E=yield L.text();return{data:E,error:null,response:L}}catch(G){return{data:null,error:G,response:G instanceof Fw.FunctionsHttpError||G instanceof Fw.FunctionsRelayError?G.context:void 0}}finally{if(Y)clearTimeout(Y);if(X)(J=B.signal)===null||J===void 0||J.removeEventListener("abort",X)}})}}qiA.FunctionsClient=UiA});var MiA=YA((RI)=>{Object.defineProperty(RI,"__esModule",{value:!0});RI.FunctionRegion=RI.FunctionsRelayError=RI.FunctionsHttpError=RI.FunctionsFetchError=RI.FunctionsError=RI.FunctionsClient=void 0;var AtQ=IiA();Object.defineProperty(RI,"FunctionsClient",{enumerable:!0,get:function(){return AtQ.FunctionsClient}});var ev=pKA();Object.defineProperty(RI,"FunctionsError",{enumerable:!0,get:function(){return ev.FunctionsError}});Object.defineProperty(RI,"FunctionsFetchError",{enumerable:!0,get:function(){return ev.FunctionsFetchError}});Object.defineProperty(RI,"FunctionsHttpError",{enumerable:!0,get:function(){return ev.FunctionsHttpError}});Object.defineProperty(RI,"FunctionsRelayError",{enumerable:!0,get:function(){return ev.FunctionsRelayError}});Object.defineProperty(RI,"FunctionRegion",{enumerable:!0,get:function(){return ev.FunctionRegion}})});function LiA(A,Q){return new Promise((B)=>{if(Q===null||Q===void 0?void 0:Q.aborted){B();return}let $=setTimeout(()=>{Q===null||Q===void 0||Q.removeEventListener("abort",J),B()},A);function J(){clearTimeout($),B()}Q===null||Q===void 0||Q.addEventListener("abort",J)})}function $tQ(A,Q,B,$){if(!$||B>=3)return!1;if(!ViA.includes(A))return!1;if(!BtQ.includes(Q))return!1;return!0}function Af(A){return Af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},Af(A)}function XtQ(A,Q){if(Af(A)!="object"||!A)return A;var B=A[Symbol.toPrimitive];if(B!==void 0){var $=B.call(A,Q||"default");if(Af($)!="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(Q==="string"?String:Number)(A)}function GtQ(A){var Q=XtQ(A,"string");return Af(Q)=="symbol"?Q:Q+""}function WtQ(A,Q,B){return(Q=GtQ(Q))in A?Object.defineProperty(A,Q,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[Q]=B,A}function CiA(A,Q){var B=Object.keys(A);if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(A);Q&&($=$.filter(function(J){return Object.getOwnPropertyDescriptor(A,J).enumerable})),B.push.apply(B,$)}return B}function lo(A){for(var Q=1;Q<arguments.length;Q++){var B=arguments[Q]!=null?arguments[Q]:{};Q%2?CiA(Object(B),!0).forEach(function($){WtQ(A,$,B[$])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(B)):CiA(Object(B)).forEach(function($){Object.defineProperty(A,$,Object.getOwnPropertyDescriptor(B,$))})}return A}var OiA=(A)=>Math.min(1000*2**A,30000),BtQ,ViA,iKA,JtQ=class{constructor(A){var Q,B,$,J,Y;if(this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=A.method,this.url=A.url,this.headers=new Headers(A.headers),this.schema=A.schema,this.body=A.body,this.shouldThrowOnError=(Q=A.shouldThrowOnError)!==null&&Q!==void 0?Q:!1,this.signal=A.signal,this.isMaybeSingle=(B=A.isMaybeSingle)!==null&&B!==void 0?B:!1,this.shouldStripNulls=($=A.shouldStripNulls)!==null&&$!==void 0?$:!1,this.urlLengthLimit=(J=A.urlLengthLimit)!==null&&J!==void 0?J:8000,this.retryEnabled=(Y=A.retry)!==null&&Y!==void 0?Y:!0,A.fetch)this.fetch=A.fetch;else this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(A,Q){return this.headers=new Headers(this.headers),this.headers.set(A,Q),this}retry(A){return this.retryEnabled=A,this}then(A,Q){var B=this;if(this.schema===void 0);else if(["GET","HEAD"].includes(this.method))this.headers.set("Accept-Profile",this.schema);else this.headers.set("Content-Profile",this.schema);if(this.method!=="GET"&&this.method!=="HEAD")this.headers.set("Content-Type","application/json");if(this.shouldStripNulls){let Z=this.headers.get("Accept");if(Z==="application/vnd.pgrst.object+json")this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped");else if(!Z||Z==="application/json")this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}let $=this.fetch,Y=(async()=>{let Z=0;while(!0){let W={};if(B.headers.forEach((H,z)=>{W[z]=H}),Z>0)W["X-Retry-Count"]=String(Z);let K;try{K=await $(B.url.toString(),{method:B.method,headers:W,body:JSON.stringify(B.body,(H,z)=>typeof z==="bigint"?z.toString():z),signal:B.signal})}catch(H){if((H===null||H===void 0?void 0:H.name)==="AbortError"||(H===null||H===void 0?void 0:H.code)==="ABORT_ERR")throw H;if(!ViA.includes(B.method))throw H;if(B.retryEnabled&&Z<3){let z=OiA(Z);Z++,await LiA(z,B.signal);continue}throw H}if($tQ(B.method,K.status,Z,B.retryEnabled)){var X,G;let H=(X=(G=K.headers)===null||G===void 0?void 0:G.get("Retry-After"))!==null&&X!==void 0?X:null,z=H!==null?Math.max(0,parseInt(H,10)||0)*1000:OiA(Z);await K.text(),Z++,await LiA(z,B.signal);continue}return await B.processResponse(K)}})();if(!this.shouldThrowOnError)Y=Y.catch((Z)=>{var X;let G="",W="",K="",H=Z===null||Z===void 0?void 0:Z.cause;if(H){var z,q,D,I;let V=(z=H===null||H===void 0?void 0:H.message)!==null&&z!==void 0?z:"",L=(q=H===null||H===void 0?void 0:H.code)!==null&&q!==void 0?q:"";if(G=`${(D=Z===null||Z===void 0?void 0:Z.name)!==null&&D!==void 0?D:"FetchError"}: ${Z===null||Z===void 0?void 0:Z.message}`,G+=`
|
|
72
72
|
|
|
73
73
|
Caused by: ${(I=H===null||H===void 0?void 0:H.name)!==null&&I!==void 0?I:"Error"}: ${V}`,L)G+=` (${L})`;if(H===null||H===void 0?void 0:H.stack)G+=`
|
|
@@ -1024,7 +1024,7 @@ Reference: ${A}`:"Logs uploaded — Capgo support will be in touch by email."}as
|
|
|
1024
1024
|
`)){let J=$.trim();if(!J||J.startsWith("#")||J.startsWith("//"))continue;let Y=J.indexOf("=");if(Y>0)B[J.slice(0,Y).trim()]=J.slice(Y+1).trim()}return B}function iNQ(A){let Q=K6(aq(A,"android","capacitor.settings.gradle"));if(!Q)return 0;return(Q.match(/^\s*include\s+':/gm)??[]).length}function vH(A){return K6(aq(A,"android","app","build.gradle"))??K6(aq(A,"android","app","build.gradle.kts"))}function wp(A){let Q=vH(A);if(!Q)return null;return FL(Q).match(/applicationId\s*[=( ]\s*["']([\w.]+)["']/)?.[1]??null}function lNQ(A,Q){let B=A.match(new RegExp(`(?:^|[\\s;{}])${Q}\\s*\\{`));if(B?.index===void 0)return null;let $=A.indexOf("{",B.index+B[0].length-1);if($===-1)return null;let J=0;for(let Y=$;Y<A.length;Y++)if(A[Y]==="{")J++;else if(A[Y]==="}"){if(J--,J===0)return A.slice($+1,Y)}return null}function ep0(A,Q){let B=A.match(new RegExp(`(?:^|[\\s;{}])${Q}\\s*\\{`));if(B?.index===void 0)return A;let $=A.indexOf("{",B.index+B[0].length-1);if($===-1)return A;let J=0;for(let Y=$;Y<A.length;Y++)if(A[Y]==="{")J++;else if(A[Y]==="}"){if(J--,J===0)return A.slice(0,B.index)+" "+A.slice(Y+1)}return A.slice(0,B.index)}function Ai0(A,Q){let B=0,$=0;for(let J=0;J<A.length;J++){let Y=A[J];if(Y==="{"){if(B===0){let Z=A.slice($,J),X=Z.match(/(?:create|register)\s*\(\s*["'](\w+)["']\s*\)\s*$/),G=Z.match(/val\s+(\w+)\s+by\s+creating\s*$/),W=Z.match(/(?:^|[\s;}])(\w+)\s*$/);if((X?.[1]??G?.[1]??W?.[1])===Q){let H=0;for(let z=J;z<A.length;z++)if(A[z]==="{")H++;else if(A[z]==="}"){if(H--,H===0)return A.slice(J+1,z)}return null}}B++}else if(Y==="}"){if(B=Math.max(0,B-1),B===0)$=J+1}else if(B===0&&(Y===`
|
|
1025
1025
|
`||Y===";"))$=J+1}return null}function nNQ(A,Q){let B=wp(A),$=vH(A),J=$===null?null:FL($),Y=J!==null&&lNQ(J,"productFlavors")!==null;if(!Q){if(Y)return{packageName:B,ambiguous:!0};return{packageName:B,ambiguous:!1}}if(J===null)return{packageName:B,ambiguous:!0};let Z=lNQ(J,"productFlavors");if(Z===null)return{packageName:B,ambiguous:!0};let X=Ai0(Z,Q);if(X===null)return{packageName:B,ambiguous:!0};let G=X.match(/applicationId\s*[=( ]\s*["']([\w.]+)["']/);if(G)return{packageName:G[1],ambiguous:!1};let W=X.match(/applicationIdSuffix\s*[=( ]\s*["']([\w.]+)["']/);if(W){if(B===null)return{packageName:null,ambiguous:!0};let K=W[1].startsWith(".")?"":".";return{packageName:B+K+W[1],ambiguous:!1}}return{packageName:B,ambiguous:!1}}function FL(A){return A.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/[^\n]*/g,"")}function Bi0(A){let Q=K6(aq(A,"android","variables.gradle")),B={};if(!Q)return B;let $=FL(Q),J=$.search(/\bext\s*\{/),Y=J===-1?$:$i0($,J);for(let Z of Y.matchAll(/([A-Za-z_]\w*)\s*=\s*(\d+)\b/g))B[Z[1]]=Number(Z[2]);return B}function $i0(A,Q){let B=A.indexOf("{",Q);if(B===-1)return"";let $=0;for(let J=B;J<A.length;J++)if(A[J]==="{")$++;else if(A[J]==="}"){if($--,$===0)return A.slice(B+1,J)}return A.slice(B+1)}function X3(A,Q){let B=Qi0[Q],$=vH(A);if($){let Z=B.replace(/Version$/,""),X=new RegExp(`\\b(?:${B}|${Z})\\s*[=\\s]\\s*(\\d+)\\b`),W=ep0(FL($),"productFlavors").match(X);if(W)return Number(W[1])}let J=Bi0(A)[B];if(typeof J==="number")return J;let Y=K6(aq(A,"android","app","src","main","AndroidManifest.xml"));if(Y){let X=Y.replace(/<!--[\s\S]*?-->/g," ").match(new RegExp(`android:${B}\\s*=\\s*"(\\d+)"`));if(X)return Number(X[1])}return null}function $SA(A){let Q=K6(aq(A,"android","capacitor.settings.gradle"));if(!Q)return[];let B=aq(A,"android"),$=[],J=/project\(':[^']+'\)\.projectDir\s*=\s*new File\('([^']+)'\)/g;for(let Y=J.exec(Q);Y!==null;Y=J.exec(Q))$.push(aq(B,Y[1]));return $}var Qi0;var oq=b(()=>{Qi0={minSdk:"minSdkVersion",targetSdk:"targetSdkVersion",compileSdk:"compileSdkVersion"}});function b9A(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sq(A,Q){let B=new RegExp(`<key>${b9A(Q)}</key>\\s*<string>([\\s\\S]*?)</string>`);return A.match(B)?.[1]??null}function Pp(A,Q){let B=new RegExp(`<key>${b9A(Q)}</key>\\s*<(true|false)\\s*/>`),$=A.match(B);if(!$)return null;return $[1]==="true"}function tq(A,Q){return A.includes(`<key>${Q}</key>`)}function Hz(A,Q){let B=new RegExp(`<key>${b9A(Q)}</key>\\s*<array>([\\s\\S]*?)</array>`),$=A.match(B)?.[1];if($===void 0)return[];let J=[];for(let Y of $.matchAll(/<string>([\s\S]*?)<\/string>/g))J.push(Y[1].trim());return J}function JSA(A,Q){let B=new RegExp(`<key>${b9A(Q)}</key>\\s*<dict>`),$=A.match(B);if($?.index===void 0)return null;let J=$.index+$[0].length,Y=/<dict>|<\/dict>/g;Y.lastIndex=J;let Z=1;for(let X=Y.exec(A);X!==null;X=Y.exec(A))if(X[0]==="<dict>")Z++;else if(Z--,Z===0)return A.slice(J,X.index);return null}import{existsSync as Ji0,readFileSync as Yi0}from"node:fs";import{join as Zi0}from"node:path";var x9A,Xi0,Gi0,rNQ;var YSA=b(()=>{x9A=/^[a-z][a-z0-9+.-]*$/i,Xi0=["NSCameraUsageDescription","NSMicrophoneUsageDescription","NSPhotoLibraryUsageDescription","NSLocationWhenInUseUsageDescription","NSLocationAlwaysAndWhenInUseUsageDescription","NSContactsUsageDescription","NSFaceIDUsageDescription","NSBluetoothAlwaysUsageDescription"],Gi0=new Set(["","todo","tbd","description","usage description","lorem ipsum"]),rNQ={id:"ios/infoplist-sanity",platforms:["ios"],async run(A){let Q=Zi0(A.projectDir,"ios","App","App","Info.plist");if(!Ji0(Q))return[];let B=Yi0(Q,"utf8"),$=[];if(!B.includes("<key>CFBundleVersion</key>"))$.push({id:"ios/infoplist-sanity",severity:"warning",title:"Info.plist has no CFBundleVersion",fix:"Add CFBundleVersion (build number) — App Store uploads require it"});if(!B.includes("<key>CFBundleShortVersionString</key>"))$.push({id:"ios/infoplist-sanity",severity:"warning",title:"Info.plist has no CFBundleShortVersionString",fix:"Add the marketing version (e.g. 1.0.0)"});let J=B.match(/<key>CFBundleURLSchemes<\/key>\s*<array>([\s\S]*?)<\/array>/g)??[];for(let Y of J)for(let Z of Y.matchAll(/<string>([\s\S]*?)<\/string>/g)){let X=Z[1].trim();if(X&&!x9A.test(X))$.push({id:"ios/infoplist-sanity",severity:"error",title:`Invalid URL scheme "${X}" — App Store upload will reject it`,detail:'Schemes must match RFC 3986: letters, digits, "+", "-", "." only (no underscores)',fix:'Rename the scheme (e.g. replace "_" with "-") in Info.plist and your deep-link config'})}for(let Y of Xi0){if(!B.includes(`<key>${Y}</key>`))continue;let Z=sq(B,Y);if(Z===null||Gi0.has(Z.trim().toLowerCase())||Z.trim().length<8)$.push({id:"ios/infoplist-sanity",severity:"warning",title:`${Y} is empty or placeholder text`,fix:"App Review rejects vague purpose strings — describe the actual user-facing reason"})}return $}}});import{join as Wi0}from"node:path";function ZE(A){if(Sk.has(A))return Sk.get(A)??null;let Q=Wi0(A,"android","app","src","main","AndroidManifest.xml"),B=K6(Q),$=B===null?null:{raw:B,path:Q};return Hi0(A,$),$}function Hi0(A,Q){if(Sk.size>=Ki0)Sk.delete(Sk.keys().next().value);Sk.set(A,Q)}function _p(A){return A.replace(/<!--[\s\S]*?-->/g,(Q)=>" ".repeat(Q.length))}function CG(A){let Q=[];for(let B of A.matchAll(Fi0)){let $=B[0],J=B[1],Y={};for(let X of(B[2]??"").matchAll(zi0))Y[X[1]]=X[2]??X[3]??"";let Z=B.index;Q.push({tag:J,attrs:Y,start:Z,end:Z+$.length,rawOpenTag:$})}return Q}function aNQ(A){return{android:/xmlns:android\s*=\s*"http:\/\/schemas\.android\.com\/apk\/res\/android"/.test(A),tools:/xmlns:tools\s*=\s*"http:\/\/schemas\.android\.com\/tools"/.test(A)}}function oNQ(A,Q,B){if(A===Q)return 0;if(Math.abs(A.length-Q.length)>B)return B+1;let $=Array.from({length:Q.length+1},(Y,Z)=>Z),J=Array(Q.length+1);for(let Y=1;Y<=A.length;Y++){J[0]=Y;let Z=J[0];for(let X=1;X<=Q.length;X++){let G=A[Y-1]===Q[X-1]?0:1;if(J[X]=Math.min($[X]+1,J[X-1]+1,$[X-1]+G),J[X]<Z)Z=J[X]}if(Z>B)return B+1;for(let X=0;X<=Q.length;X++)$[X]=J[X]}return $[Q.length]}var Ki0=8,Sk,Fi0,zi0,ZSA;var XSA=b(()=>{oq();YSA();Sk=new Map;Fi0=/<([a-z][\w:-]*)((?:\s+[\w:.-]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*\/?>/gi,zi0=/([\w:.-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;ZSA=new Set(["manifest","application","activity","activity-alias","service","provider","receiver","instrumentation","intent","meta-data","action","category","data","uses-permission","uses-permission-sdk-23","permission","permission-tree","permission-group","uses-feature","uses-library","uses-native-library","uses-sdk","uses-configuration","supports-screens","compatible-screens","supports-gl-texture","grant-uri-permission","path-permission","queries","package","profileable","property"])});function fH(A){return ZE(A.projectDir)!==null}function EW(A){let Q=ZE(A.projectDir);return Q===null?null:_p(Q.raw)}function tNQ(A,Q){if(Q.rawOpenTag.trimEnd().endsWith("/>"))return"";let B=A.indexOf(`</${Q.tag}>`,Q.end);return A.slice(Q.end,B===-1?A.length:B)}function Ii0(A){return A!==void 0&&A!=="true"&&A!=="false"}function Mi0(A,Q){let B=wp(A.projectDir);if(B)return B;return Q.match(/<manifest\b[^>]*\spackage\s*=\s*"([\w.]+)"/)?.[1]??null}function Oi0(A,Q){if(A.startsWith("."))return Q+A;if(!A.includes("."))return`${Q}.${A}`;return A}function GSA(A){return{id:"android/manifest-deeplink-valid",severity:"warning",title:A,fix:"Give deep-link <data> a valid lowercase RFC-3986 scheme + host; only use autoVerify on http/https filters with a host."}}function FCQ(A){let Q=[],B=/<intent-filter\b[^>]*>/g;for(let $ of A.matchAll(B)){let Y=$.index+$[0].length,Z=A.indexOf("</intent-filter>",Y),X=A.slice(Y,Z===-1?A.length:Z);if(/android\.intent\.action\.VIEW/.test(X)&&/android\.intent\.category\.BROWSABLE/.test(X))Q.push({openTag:$[0],body:X})}return Q}function Li0(A){return FCQ(A).length>0}var Ui0,eNQ,ACQ,sNQ="http://schemas.android.com/apk/res/android",QCQ,qi0,BCQ,Di0,$CQ,JCQ,YCQ,ZCQ,XCQ,GCQ,WCQ,KCQ,HCQ;var zCQ=b(()=>{oq();XSA();Ui0=new Set(["activity","activity-alias","service","receiver","provider"]);eNQ={id:"android/manifest-well-formed",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let B=(X)=>[{id:"android/manifest-well-formed",severity:"error",title:X,fix:"Manifest must have exactly one <application> nested in <manifest>; remove the duplicate/extra block or close the unclosed tag."}];if((Q.match(/<manifest\b/g)??[]).length>1)return B("AndroidManifest.xml declares more than one <manifest> root element");if(!/<\/manifest>/.test(Q))return B("AndroidManifest.xml is missing its closing </manifest> tag");let $=CG(Q).filter((X)=>X.tag==="application"&&!X.rawOpenTag.trimEnd().endsWith("/>")).length,J=(Q.match(/<\/application>/g)??[]).length,Y=CG(Q).filter((X)=>X.tag==="application"&&X.rawOpenTag.trimEnd().endsWith("/>")).length,Z=$+Y;if(Z!==1)return B(`AndroidManifest.xml must have exactly one <application> element (found ${Z})`);if($!==J)return B("AndroidManifest.xml has an unclosed <application> element");return[]}},ACQ={id:"android/manifest-tag-typo",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let B=[],$=new Set;for(let J of CG(Q)){let Y=J.tag;if(ZSA.has(Y)||Y.includes(":")||$.has(Y))continue;let Z=null;for(let X of ZSA)if(oNQ(Y,X,1)===1){Z=X;break}if(Z===null)continue;$.add(Y),B.push({id:"android/manifest-tag-typo",severity:"error",title:`Unknown manifest tag <${Y}> — did you mean <${Z}>?`,fix:"Rename the misspelled tag to the suggested valid manifest element."})}return B}},QCQ={id:"android/manifest-namespace-uri",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let B=aNQ(Q),$=/\bandroid:[\w.-]+\s*=/.test(Q),J=/\btools:[\w.-]+\s*=/.test(Q),Y=Q.match(/xmlns:android\s*=\s*"([^"]*)"/),Z=[];if(Y&&Y[1]!==sNQ)Z.push({id:"android/manifest-namespace-uri",severity:"error",title:"xmlns:android declares the wrong namespace URI",detail:`expected "${sNQ}"`,fix:"Declare the exact xmlns:android (and xmlns:tools when tools: attrs used) URI on <manifest>."});else if($&&!B.android)Z.push({id:"android/manifest-namespace-uri",severity:"error",title:"android:-prefixed attributes are used but xmlns:android is not declared",fix:"Declare the exact xmlns:android (and xmlns:tools when tools: attrs used) URI on <manifest>."});if(J&&!B.tools)Z.push({id:"android/manifest-namespace-uri",severity:"error",title:"tools:-prefixed attributes are used but xmlns:tools is not declared",fix:'Declare xmlns:tools="http://schemas.android.com/tools" on <manifest>.'});return Z}},qi0=new Set(["name","exported","label","icon","theme","permission","authorities","debuggable","allowBackup","targetSdkVersion","minSdkVersion","value"]),BCQ={id:"android/manifest-missing-prefix",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let B=new Set;for(let $ of CG(Q)){if($.tag==="manifest"||$.tag==="queries")continue;for(let J of Object.keys($.attrs)){if(J.includes(":"))continue;if(qi0.has(J))B.add(J)}}if(B.size===0)return[];return[{id:"android/manifest-missing-prefix",severity:"error",title:"Manifest attribute is missing the android: namespace prefix",detail:`bare attribute(s): ${[...B].sort().join(", ")}`,fix:"Prefix with android: (e.g. android:name, android:exported)."}]}},Di0=new Set(["activity","activity-alias","service","receiver"]);$CQ={id:"android/manifest-exported-missing",platforms:["android"],appliesTo:(A)=>{if(ZE(A.projectDir)===null)return!1;let Q=X3(A.projectDir,"targetSdk");return Q===null||Q>=31},async run(A){let Q=EW(A);if(Q===null)return[];let B=CG(Q),$=[];for(let J of B){if(!Di0.has(J.tag))continue;let Y=tNQ(Q,J),Z=/<intent-filter\b/.test(Y),X=J.attrs["android:exported"]!==void 0,G=J.attrs["android:exported"];if(/android\.intent\.category\.LAUNCHER/.test(Y)&&/android\.intent\.action\.MAIN/.test(Y)&&G!=="true"&&!Ii0(G)){$.push({id:"android/manifest-exported-missing",severity:"error",title:'The MAIN/LAUNCHER activity must declare android:exported="true"',detail:`<${J.tag} android:name="${J.attrs["android:name"]??""}">`,fix:'Add android:exported="true" to launcher/deep-link components and ="false" to internal components that have intent-filters.'});continue}if(Z&&!X)$.push({id:"android/manifest-exported-missing",severity:"error",title:`<${J.tag}> has an intent-filter but no android:exported (required on Android 12+)`,detail:`<${J.tag} android:name="${J.attrs["android:name"]??""}">`,fix:'Add android:exported="true" to launcher/deep-link components and ="false" to internal components that have intent-filters.'})}return $}},JCQ={id:"android/manifest-multiple-uses-sdk",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let B=(Q.match(/<uses-sdk\b/g)??[]).length;if(B<=1)return[];return[{id:"android/manifest-multiple-uses-sdk",severity:"error",title:`AndroidManifest.xml declares ${B} <uses-sdk> elements`,fix:"Keep at most one <uses-sdk>; prefer setting SDKs in android/variables.gradle."}]}};YCQ={id:"android/manifest-duplicate-component",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let B=Mi0(A,Q),$=(Z)=>Z==="activity-alias"?"activity":Z,J=new Map;for(let Z of CG(Q)){if(!Ui0.has(Z.tag))continue;let X=Z.attrs["android:name"];if(!X)continue;if((X.startsWith(".")||!X.includes("."))&&B===null)continue;let W=B===null?X:Oi0(X,B),K=$(Z.tag),H=J.get(K)??new Map;H.set(W,(H.get(W)??0)+1),J.set(K,H)}let Y=[];for(let[,Z]of J)for(let[X,G]of Z)if(G>=2)Y.push({id:"android/manifest-duplicate-component",severity:"error",title:`Component android:name="${X}" is declared ${G} times`,fix:"Remove the duplicate declaration; each component android:name must be unique."});return Y}},ZCQ={id:"android/manifest-unique-permission",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let B=new Map;for(let J of CG(Q)){if(J.tag!=="permission"&&J.tag!=="permission-group")continue;let Y=J.attrs["android:name"];if(Y)B.set(Y,(B.get(Y)??0)+1)}let $=[];for(let[J,Y]of B)if(Y>1)$.push({id:"android/manifest-unique-permission",severity:"error",title:`Custom permission "${J}" is declared ${Y} times`,fix:"Declare each custom <permission> name exactly once."});return $}},XCQ={id:"android/manifest-hardcoded-debuggable",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let $=CG(Q).find((J)=>J.tag==="application")?.attrs["android:debuggable"];if($===void 0)return[];if($==="true")return[{id:"android/manifest-hardcoded-debuggable",severity:"error",title:'android:debuggable="true" in the manifest — Play rejects debuggable release uploads',fix:"Remove android:debuggable from the manifest; the release build type sets it automatically."}];return[{id:"android/manifest-hardcoded-debuggable",severity:"warning",title:'android:debuggable="false" in the manifest is redundant — Gradle owns this',fix:"Remove android:debuggable from the manifest; the release build type sets it automatically."}]}},GCQ={id:"android/manifest-mock-location",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];if(!CG(Q).some(($)=>$.tag==="uses-permission"&&$.attrs["android:name"]==="android.permission.ACCESS_MOCK_LOCATION"))return[];return[{id:"android/manifest-mock-location",severity:"error",title:"ACCESS_MOCK_LOCATION is a test-only permission and must not ship",fix:"Remove the test-only ACCESS_MOCK_LOCATION permission."}]}},WCQ={id:"android/manifest-exported-unprotected",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];let B=X3(A.projectDir,"targetSdk"),$=B!==null&&B<31,J=[];for(let Y of CG(Q)){if(Y.tag!=="service"&&Y.tag!=="receiver"&&Y.tag!=="provider")continue;let Z=Y.attrs["android:exported"],X=tNQ(Q,Y),G=/<intent-filter\b/.test(X);if(!(Z==="true"||Z===void 0&&$&&G))continue;if(Y.attrs["android:permission"]===void 0)J.push({id:"android/manifest-exported-unprotected",severity:"warning",title:`Exported <${Y.tag}> "${Y.attrs["android:name"]??""}" has no android:permission`,fix:'Add android:permission to the exported component, or set android:exported="false"; narrow over-broad grant-uri paths.'});if(Y.tag==="provider"&&Y.attrs["android:grantUriPermissions"]==="true"){if(CG(X).some((H)=>H.tag==="grant-uri-permission"&&(H.attrs["android:path"]==="/"||H.attrs["android:pathPattern"]===".*")))J.push({id:"android/manifest-exported-unprotected",severity:"warning",title:`Exported <provider> "${Y.attrs["android:name"]??""}" grants URI permission over an over-broad path`,fix:'Add android:permission to the exported component, or set android:exported="false"; narrow over-broad grant-uri paths.'})}}return J}},KCQ={id:"android/manifest-query-all-packages",platforms:["android"],appliesTo:fH,async run(A){let Q=EW(A);if(Q===null)return[];if(!CG(Q).some(($)=>$.tag==="uses-permission"&&$.attrs["android:name"]==="android.permission.QUERY_ALL_PACKAGES"))return[];return[{id:"android/manifest-query-all-packages",severity:"warning",title:"QUERY_ALL_PACKAGES requires Play package-visibility justification",fix:"Use a scoped <queries> element, or justify via Play's permission-declaration form.",docsUrl:"https://support.google.com/googleplay/android-developer/answer/10158779"}]}},HCQ={id:"android/manifest-deeplink-valid",platforms:["android"],appliesTo:(A)=>{let Q=ZE(A.projectDir);if(Q===null)return!1;return Li0(_p(Q.raw))},async run(A){let Q=EW(A);if(Q===null)return[];let B=[];for(let $ of FCQ(Q)){let J=/android:autoVerify\s*=\s*"true"/.test($.openTag),Y=[],Z=!1,X=!1;for(let G of CG($.body)){if(G.tag!=="data")continue;if(G.attrs["android:host"]!==void 0)Z=!0;let W=G.attrs["android:scheme"];if(W===void 0)continue;if(Y.push(W),W==="http"||W==="https")X=!0}for(let G of Y){let W=G==="http"||G==="https";if(J&&!W)B.push(GSA(`autoVerify deep link uses a non-http(s) scheme "${G}"`));else if(!W&&!x9A.test(G))B.push(GSA(`deep-link android:scheme "${G}" is not a valid RFC-3986 scheme`))}if(J&&X&&!Z)B.push(GSA("autoVerify http(s) deep link has no android:host"))}return B}}});function Tp(A,Q){if(A.length>10485760){let B=(A.length/1024/1024).toFixed(0);throw Error(`credential blob is ${B} MB of base64 — not a valid ${Q} (limit 10 MB)`)}}import{createHash as Ni0}from"node:crypto";function Vi0(A){if(A.length>=4&&A.readUInt32BE(0)===Ci0)return"jks";if(A.length>=1&&A[0]===48)return"pkcs12";return"unknown"}function Ri0(A,Q){let B=A.subarray(0,A.length-20),$=A.subarray(A.length-20),J=Buffer.from(Q,"utf16le").swap16(),Z=Ni0("sha1").update(Buffer.concat([J,Buffer.from("Mighty Aphrodite","utf8"),B])).digest().equals($),X=[],G=[],W=8,K=A.readUInt32BE(W);W+=4;for(let H=0;H<K&&W<B.length;H++){let z=A.readUInt32BE(W);W+=4;let q=A.readUInt16BE(W);if(W+=2,X.push(A.subarray(W,W+q).toString("utf8")),W+=q,W+=8,z===1){let D=A.readUInt32BE(W);W+=4+D;let I=A.readUInt32BE(W);W+=4;for(let M=0;M<I;M++){let C=A.readUInt16BE(W);W+=2+C;let V=A.readUInt32BE(W);W+=4,G.push(A.subarray(W,W+V)),W+=V}}else{let D=A.readUInt16BE(W);W+=2+D;let I=A.readUInt32BE(W);W+=4,G.push(A.subarray(W,W+I)),W+=I}}return{passwordOk:Z,aliases:X,certsDer:G}}function qCQ(A,Q){let B=`${Q}\x00${A}`,$=Sp.get(B);if($){if($.error!==void 0)throw $.error;return $.value}try{let J=ji0(A,Q);return UCQ(B,{value:J}),J}catch(J){throw UCQ(B,{error:J}),J}}function UCQ(A,Q){if(Sp.size>=Ei0)Sp.delete(Sp.keys().next().value);Sp.set(A,Q)}function ji0(A,Q){Tp(A,"keystore");let B=Buffer.from(A,"base64"),$=Vi0(B);if($==="jks"){let J=Ri0(B,Q);if(!J.passwordOk)throw Error("JKS integrity check failed — wrong store password");let Y=null;for(let Z of J.certsDer)try{let X=G3.default.pki.certificateFromAsn1(G3.default.asn1.fromDer(G3.default.util.createBuffer(Z.toString("binary"))));if(!Y||X.validity.notAfter<Y)Y=X.validity.notAfter}catch{}return{kind:$,aliases:J.aliases,notAfter:Y}}if($==="pkcs12"){let Y=G3.default.pkcs12.pkcs12FromAsn1(G3.default.asn1.fromDer(B.toString("binary")),Q).getBags({bagType:G3.default.pki.oids.certBag})[G3.default.pki.oids.certBag]??[],Z=Y.map((G)=>G.attributes?.friendlyName?.[0]??"").filter(Boolean),X=null;for(let G of Y)if(G.cert&&(!X||G.cert.validity.notAfter<X))X=G.cert.validity.notAfter;return{kind:$,aliases:Z,notAfter:X}}throw Error("Unrecognized keystore format (expected JKS or PKCS12)")}var G3,Ci0=4277010157,Ei0=4,Sp,DCQ=(A)=>Boolean(A.credentials?.ANDROID_KEYSTORE_FILE),ICQ=(A)=>A.credentials?.KEYSTORE_STORE_PASSWORD??A.credentials?.KEYSTORE_KEY_PASSWORD??"",MCQ,wi0,OCQ;var LCQ=b(()=>{G3=tA(dS(),1);Sp=new Map;MCQ={id:"android/keystore-opens",platforms:["android"],appliesTo:DCQ,async run(A){let Q;try{Q=qCQ(A.credentials.ANDROID_KEYSTORE_FILE,ICQ(A))}catch(J){let Y=J instanceof Error?J.message:String(J);return[{id:"android/keystore-opens",severity:"error",title:/password|mac|integrity/i.test(Y)?"The keystore cannot be opened with the saved store password":"The saved keystore is not a valid JKS/PKCS12 file",detail:Y,fix:"Verify the keystore file and --keystore-store-password, then re-run `build credentials save`"}]}let B=A.credentials?.KEYSTORE_KEY_ALIAS,$=Q.kind==="jks"||Q.aliases.length>0;if(B&&$&&!Q.aliases.includes(B))return[{id:"android/keystore-opens",severity:"error",title:`Key alias "${B}" not found in the keystore`,detail:`available aliases: ${Q.aliases.join(", ")||"(none)"}`,fix:"Use one of the existing aliases or the correct keystore file"}];return[]}},wi0=new Date("2033-10-01"),OCQ={id:"android/keystore-expiry",platforms:["android"],appliesTo:DCQ,async run(A){let Q;try{Q=qCQ(A.credentials.ANDROID_KEYSTORE_FILE,ICQ(A))}catch{return[]}if(Q.notAfter&&Q.notAfter<wi0)return[{id:"android/keystore-expiry",severity:"warning",title:`Signing certificate validity ends ${Q.notAfter.toISOString().slice(0,10)} — Play requires validity through Oct 2033 for new apps`,fix:"Generate a keystore with ≥25y validity (keytool -validity 10000) for new apps"}];return[]}}});import{join as Pi0}from"node:path";function kk(A){let Q=K6(Pi0(A,"package.json"));if(Q===null)return null;let B;try{let Y=JSON.parse(Q);B={...Y.devDependencies,...Y.dependencies}}catch{return null}let $=B["@capacitor/core"]??B["@capacitor/ios"]??B["@capacitor/android"];if(typeof $!=="string")return null;let J=$.match(/(\d+)/);return J?Number(J[1]):null}var WSA=b(()=>{oq()});function kp(A){return A.platform==="android"&&Boolean(A.credentials?.PLAY_CONFIG_JSON)}function jW(A){if(A.platform!=="ios")return!1;if((A.distributionMode??"app_store")!=="app_store")return!1;let B=A.credentials;return Boolean(B?.APPLE_KEY_ID&&B?.APPLE_ISSUER_ID&&B?.APPLE_KEY_CONTENT)}import{existsSync as bp}from"node:fs";import{join as gH}from"node:path";function _i0(A){let Q=K6(gH(A.projectDir,"package.json"));if(!Q)return!1;try{return Object.keys(JSON.parse(Q).dependencies??{}).some(($)=>$.startsWith("cordova-plugin-")||$.startsWith("@awesome-cordova-plugins/"))}catch{return!1}}function Si0(A){let Q=A?.match(/-Xmx(\d+)([mMgG])/);if(!Q)return null;let B=Number.parseInt(Q[1],10);return/g/i.test(Q[2])?B*1024:B}function f9A(A,Q){let B=A.match(new RegExp(`(?:^|[\\s;{}])${Q}\\s*\\{`));if(B?.index===void 0)return null;let $=A.indexOf("{",B.index+B[0].length-1),J=0;for(let Y=$;Y<A.length;Y++)if(A[Y]==="{")J++;else if(A[Y]==="}"){if(J--,J===0)return A.slice($+1,Y)}return null}function _CQ(A){let Q=[],B=0,$=0;for(let J=0;J<A.length;J++){let Y=A[J];if(Y==="{"){if(B===0){let Z=A.slice($,J),X=Z.match(/(?:create|register)\s*\(\s*["'](\w+)["']\s*\)\s*$/),G=Z.match(/val\s+(\w+)\s+by\s+creating\s*$/),W=Z.match(/(?:^|[\s;}])(\w+)\s*$/),K=X?.[1]??G?.[1]??W?.[1];if(K)Q.push(K)}B++}else if(Y==="}"){if(B=Math.max(0,B-1),B===0)$=J+1}else if(B===0&&(Y===`
|
|
1026
1026
|
`||Y===";"))$=J+1}return Q}function xp(A){let Q=vH(A);return Q===null?null:FL(Q)}function CCQ(A){let Q=xp(A);if(Q===null)return null;let B=f9A(Q,"productFlavors");if(B===null)return null;let $=_CQ(B).filter((J)=>J!=="dimension");if($.length===0)return null;return{gradle:Q,block:B,flavors:$}}function bi0(A){let Q=xp(A);if(Q===null)return!1;let B=Q.match(ki0);if(B?.index===void 0)return!1;let $=0;for(let J=0;J<B.index;J++)if(Q[J]==="{")$++;else if(Q[J]==="}")$=Math.max(0,$-1);return $===0}function vi0(A){return A.startsWith("/")||/^[A-Za-z]:\\/.test(A)}function yi0(A){return fi0[A]??gi0}function ui0(A){let Q=xp(A);if(Q===null)return{code:!1,name:!1};return{code:/versionCode\s*[=\s]\s*\S/.test(Q),name:/versionName\s*[=\s]\s*["']/.test(Q)||/versionName\s*[=\s]\s*\w/.test(Q)}}function mi0(A){let Q=K6(gH(A,"android","app","src","main","AndroidManifest.xml"));if(Q===null)return{code:!1,name:!1};return{code:/android:versionCode\s*=\s*"/.test(Q),name:/android:versionName\s*=\s*"/.test(Q)}}var jCQ,NCQ=30,Ti0=2048,wCQ,PCQ,TCQ,SCQ,kCQ,bCQ,xCQ,vCQ,ki0,fCQ,xi0,gCQ,VCQ,yCQ,RCQ=34,v9A=35,ECQ="https://developer.android.com/google/play/requirements/target-sdk",hCQ,fi0,gi0=24,uCQ,hi0,mCQ,cCQ;var dCQ=b(()=>{oq();XSA();WSA();jCQ={id:"android/cordova-vars-present",platforms:["android"],appliesTo:_i0,async run(A){let Q=gH(A.projectDir,"android","capacitor-cordova-android-plugins","cordova.variables.gradle");if(bp(Q))return[];return[{id:"android/cordova-vars-present",severity:"error",title:"cordova.variables.gradle is missing — the cloud build cannot compile your Cordova plugins",detail:"This generated file is gitignored; `cap copy` does not create it, only `cap sync` does",fix:"Run `npx cap sync android` before requesting the build"}]}};wCQ={id:"android/gradle-props-heuristics",platforms:["android"],async run(A){let Q=iNQ(A.projectDir),B=pNQ(A.projectDir),$=[],J=B["org.gradle.parallel"]==="true";if(Q>NCQ&&!J)$.push({id:"android/gradle-props-heuristics",severity:"warning",title:`${Q} Gradle modules build serially — org.gradle.parallel is not enabled`,fix:"Add `org.gradle.parallel=true` (and `org.gradle.caching=true`) to android/gradle.properties"});if(J&&B["org.gradle.workers.max"]==="1")$.push({id:"android/gradle-props-heuristics",severity:"warning",title:"org.gradle.workers.max=1 makes org.gradle.parallel=true a no-op",fix:"Remove the workers.max cap (or raise it) so parallel project execution can work"});let Y=Si0(B["org.gradle.jvmargs"]);if(Q>NCQ&&Y!==null&&Y<Ti0)$.push({id:"android/gradle-props-heuristics",severity:"warning",title:`Gradle heap -Xmx${Y}m is small for ${Q} modules — D8/R8 may stall or OOM`,fix:"Raise org.gradle.jvmargs, e.g. `-Xmx4096m -XX:MaxMetaspaceSize=1024m`"});return $}},PCQ={id:"android/play-sa-json",platforms:["android"],appliesTo:(A)=>Boolean(A.credentials?.PLAY_CONFIG_JSON),async run(A){let Q;try{Q=JSON.parse(Buffer.from(A.credentials.PLAY_CONFIG_JSON,"base64").toString("utf8"))}catch{Q=void 0}if(!Q||typeof Q!=="object"||Array.isArray(Q))return[{id:"android/play-sa-json",severity:"error",title:"PLAY_CONFIG_JSON does not decode to valid JSON",fix:"Base64-encode the raw service-account .json file"}];let B=Q;if(B.type!=="service_account")return[{id:"android/play-sa-json",severity:"error",title:"PLAY_CONFIG_JSON is not a service-account key",detail:`type: ${String(B.type)}`,fix:"Create a service-account key in Google Cloud Console (IAM → Service Accounts → Keys)"}];let $=["private_key","client_email"].filter((J)=>!B[J]);if($.length>0)return[{id:"android/play-sa-json",severity:"error",title:"Service-account JSON is incomplete",detail:`missing: ${$.join(", ")}`,fix:"Re-download the key file — it must contain private_key and client_email"}];return[]}};TCQ={id:"android/flavor-exists",platforms:["android"],appliesTo:(A)=>Boolean(A.androidFlavor),async run(A){let Q=vH(A.projectDir);if(!Q)return[];let B=f9A(Q,"productFlavors");if(B===null)return[{id:"android/flavor-exists",severity:"error",title:`--android-flavor "${A.androidFlavor}" passed but build.gradle declares no productFlavors`,fix:"Drop the flag or add the flavor to android/app/build.gradle"}];let $=_CQ(B).filter((J)=>J!=="dimension");if($.length===0)return[];if(!$.includes(A.androidFlavor))return[{id:"android/flavor-exists",severity:"error",title:`Product flavor "${A.androidFlavor}" not found in build.gradle`,detail:`declared flavors: ${$.join(", ")}`,fix:"Use one of the declared flavors or add the missing one"}];return[]}},SCQ={id:"android/agp8-package-attr",platforms:["android"],async run(A){let Q=ZE(A.projectDir),B=vH(A.projectDir);if(!Q||!B)return[];let $=_p(Q.raw),J=/<manifest[^>]*\spackage\s*=\s*"/.test($),Y=/namespace\s*[=( ]\s*["']/.test(FL(B));if(J&&Y)return[{id:"android/agp8-package-attr",severity:"error",title:"AndroidManifest.xml still has a package= attribute — AGP 8+ fails the build",detail:"build.gradle declares `namespace`, so the manifest attribute is forbidden",fix:'Delete the package="…" attribute from android/app/src/main/AndroidManifest.xml'}];return[]}};kCQ={id:"android/applicationid-present",platforms:["android"],appliesTo:(A)=>vH(A.projectDir)!==null,async run(A){let Q=xp(A.projectDir);if(Q===null)return[];if(/(?:^|[\s;{(])applicationId\s*[=(\s]\s*["'][\w.]+["']/.test(Q))return[];let B=f9A(Q,"productFlavors");if(B!==null&&/applicationId(?:Suffix)?/.test(B))return[];return[{id:"android/applicationid-present",severity:"error",title:"No applicationId is declared in android/app/build.gradle",detail:"Capacitor needs a defaultConfig (or per-flavor) applicationId to assemble the APK/AAB",fix:'Add `applicationId "your.app.id"` to defaultConfig (or per flavor); it must match the Capacitor appId'}]}},bCQ={id:"android/capacitor-build-gradle-applied",platforms:["android"],appliesTo:(A)=>vH(A.projectDir)!==null,async run(A){let Q=xp(A.projectDir);if(Q===null)return[];let B=/apply\s+from:\s*["']capacitor\.build\.gradle["']/.test(Q),$=bp(gH(A.projectDir,"android","app","capacitor.build.gradle"));if(B&&$)return[];if(B&&!$)return[{id:"android/capacitor-build-gradle-applied",severity:"error",title:"app/build.gradle applies capacitor.build.gradle but the file is missing",detail:"This generated file is created by `cap sync`, not `cap copy`",fix:"Run `npx cap sync android` to regenerate android/app/capacitor.build.gradle"}];return[{id:"android/capacitor-build-gradle-applied",severity:"error",title:"app/build.gradle never applies capacitor.build.gradle",detail:'Without `apply from: "capacitor.build.gradle"` the Capacitor plugin dependencies are not wired in',fix:"Run `npx cap sync android`; ensure app/build.gradle has `apply from: 'capacitor.build.gradle'`"}]}},xCQ={id:"android/gradle-wrapper-present",platforms:["android"],appliesTo:(A)=>bp(gH(A.projectDir,"android")),async run(A){let Q=K6(gH(A.projectDir,"android","gradle","wrapper","gradle-wrapper.properties"));if(Q===null)return[{id:"android/gradle-wrapper-present",severity:"error",title:"The Gradle wrapper is missing — android/gradle/wrapper/gradle-wrapper.properties not found",detail:"The cloud builder runs `./gradlew`, which needs the committed wrapper",fix:"Restore it: `npx cap sync android` or `gradle wrapper`; commit android/gradle/wrapper/ + android/gradlew"}];if(!/^distributionUrl=\S+/m.test(Q))return[{id:"android/gradle-wrapper-present",severity:"error",title:"gradle-wrapper.properties has no distributionUrl — Gradle cannot bootstrap",fix:"Add a distributionUrl line (e.g. via `gradle wrapper`) or re-run `npx cap sync android`"}];return[]}};vCQ={id:"android/flavor-dimensions",platforms:["android"],appliesTo:(A)=>CCQ(A.projectDir)!==null,async run(A){let Q=CCQ(A.projectDir);if(Q===null)return[];if(/flavorDimensions?\s*[=(\s]\s*["']/.test(Q.gradle))return[];let B=Q.flavors.filter(($)=>{let J=f9A(Q.block,$);return J===null||!/(?:^|[\s;{])dimension\s+["']/.test(J)});if(B.length===0)return[];return[{id:"android/flavor-dimensions",severity:"error",title:"Product flavors are missing a dimension and no top-level flavorDimensions is declared",detail:`flavors without a dimension: ${B.join(", ")}`,fix:'Add `flavorDimensions "default"` and give every flavor `dimension "default"`'}]}},ki0=/(?:apply\s+plugin:\s*["']com\.google\.gms\.google-services["']|id\s*[("']+com\.google\.gms\.google-services)/;fCQ={id:"android/google-services-file",platforms:["android"],appliesTo:(A)=>vH(A.projectDir)!==null&&bi0(A.projectDir),async run(A){if(bp(gH(A.projectDir,"android","app","google-services.json")))return[];return[{id:"android/google-services-file",severity:"error",title:"com.google.gms.google-services is applied unconditionally but google-services.json is missing",detail:"The unguarded plugin apply fails the build when the config file is absent",fix:"Supply android/app/google-services.json to the cloud build (it is gitignored), or guard/remove the gms apply"}]}},xi0=/^(sdk|ndk)\.dir\s*=\s*(.+)$/gm;gCQ={id:"android/local-properties-committed",platforms:["android"],appliesTo:(A)=>bp(gH(A.projectDir,"android","local.properties")),async run(A){let Q=K6(gH(A.projectDir,"android","local.properties"));if(Q===null)return[];let B=[];for(let $ of Q.matchAll(xi0)){let J=`${$[1]}.dir`;if(vi0($[2].trim()))B.push({id:"android/local-properties-committed",severity:"warning",title:"android/local.properties is committed with a machine-specific SDK path",detail:`local.properties pins an absolute ${J}`,fix:"Remove android/local.properties from VCS and gitignore it; the cloud builder sets its own SDK location"})}return B}},VCQ=[{dim:"compileSdk",label:"compileSdkVersion",floor:34},{dim:"targetSdk",label:"targetSdkVersion",floor:34},{dim:"minSdk",label:"minSdkVersion",floor:23}],yCQ={id:"android/sdk-floors",platforms:["android"],appliesTo:(A)=>VCQ.some(({dim:Q})=>X3(A.projectDir,Q)!==null),async run(A){let Q=[];for(let{dim:B,label:$,floor:J}of VCQ){let Y=X3(A.projectDir,B);if(Y===null||Y>=J)continue;Q.push({id:"android/sdk-floors",severity:"warning",title:`${B} ${Y} is below the recommended floor (${J})`,fix:`Raise ${$} to at least ${J} in android/variables.gradle`})}return Q}},hCQ={id:"android/target-sdk-play",platforms:["android"],appliesTo:(A)=>X3(A.projectDir,"targetSdk")!==null,async run(A){let Q=X3(A.projectDir,"targetSdk");if(Q===null||Q>=v9A)return[];if(Q<RCQ)return[{id:"android/target-sdk-play",severity:"error",title:`targetSdk ${Q} is below Play's minimum (${RCQ}) — you cannot publish or stay available`,fix:`Set targetSdkVersion = ${v9A} in android/variables.gradle`,docsUrl:ECQ}];let B=kp(A);return[{id:"android/target-sdk-play",severity:B?"error":"warning",title:`targetSdk ${Q} is behind Play's submission requirement (${v9A})`,detail:B?"Play rejects new apps and updates below this target":"Approaching enforcement — raise before your next submission",fix:`Set targetSdkVersion = ${v9A} in android/variables.gradle`,docsUrl:ECQ}]}},fi0={6:22,7:23,8:24};uCQ={id:"android/min-sdk-capacitor",platforms:["android"],appliesTo:(A)=>kk(A.projectDir)!==null&&X3(A.projectDir,"minSdk")!==null,async run(A){let Q=kk(A.projectDir),B=X3(A.projectDir,"minSdk");if(Q===null||B===null)return[];let $=yi0(Q);if(B>=$)return[];return[{id:"android/min-sdk-capacitor",severity:"error",title:`minSdk ${B} is below the Capacitor ${Q} floor`,detail:`Capacitor ${Q} requires minSdkVersion >= ${$}`,fix:`Raise minSdkVersion to at least ${$} in android/variables.gradle`}]}},hi0=[{pattern:/['"]com\.google\.mlkit:genai-prompt/,minSdk:26,label:"com.google.mlkit:genai-prompt"}],mCQ={id:"android/min-sdk-dependencies",platforms:["android"],appliesTo:(A)=>X3(A.projectDir,"minSdk")!==null&&$SA(A.projectDir).length>0,async run(A){let Q=X3(A.projectDir,"minSdk");if(Q===null)return[];let B=new Map;for(let Y of $SA(A.projectDir)){let Z=K6(gH(Y,"build.gradle"))??K6(gH(Y,"build.gradle.kts"));if(!Z)continue;let X=FL(Z);for(let{pattern:G,minSdk:W,label:K}of hi0){if(!G.test(X))continue;let H=B.get(W)??[];if(!H.includes(K))H.push(K);B.set(W,H)}}if(B.size===0)return[];let $=Math.max(...B.keys());if(Q>=$)return[];let J=B.get($)??[];return[{id:"android/min-sdk-dependencies",severity:"error",title:`minSdk ${Q} is below a plugin dependency requirement (${$})`,detail:`Synced Capacitor plugin(s) depend on ${J.join(", ")} which requires minSdkVersion >= ${$}`,fix:`Raise minSdkVersion to at least ${$} in android/variables.gradle`}]}};cCQ={id:"android/version-fields",platforms:["android"],appliesTo:(A)=>vH(A.projectDir)!==null,async run(A){let Q=ui0(A.projectDir),B=mi0(A.projectDir),$=Q.code||B.code,J=Q.name||B.name,Y=[];if(!$){let Z=kp(A);Y.push({id:"android/version-fields",severity:Z?"error":"warning",title:"No versionCode found in app/build.gradle or AndroidManifest.xml",detail:Z?"Google Play rejects an upload without an integer versionCode":"A versionCode is required to assemble a release artifact",fix:"Set versionCode (integer) in android/app/build.gradle defaultConfig (or via the CLI build-number bump)"})}if(!J)Y.push({id:"android/version-fields",severity:"warning",title:"No versionName found in app/build.gradle or AndroidManifest.xml",fix:"Set versionName in android/app/build.gradle defaultConfig"});return Y}}});var ci0,lCQ;var pCQ=b(()=>{ci0={ios:["BUILD_CERTIFICATE_BASE64","CAPGO_IOS_PROVISIONING_MAP","APP_STORE_CONNECT_TEAM_ID"],android:["ANDROID_KEYSTORE_FILE","KEYSTORE_KEY_ALIAS"]},lCQ={id:"shared/credentials-saved",platforms:["ios","android"],async run(A){let Q=A.credentials;if(!Q||Object.keys(Q).length===0)return[{id:"shared/credentials-saved",severity:"error",title:`No ${A.platform} build credentials found`,fix:`Save them first: npx @capgo/cli build credentials save --appId ${A.appId} --platform ${A.platform}`}];let B=ci0[A.platform].filter(($)=>!Q[$]);if(A.platform==="android"&&!Q.KEYSTORE_STORE_PASSWORD&&!Q.KEYSTORE_KEY_PASSWORD)B.push("KEYSTORE_STORE_PASSWORD (or KEYSTORE_KEY_PASSWORD)");if(B.length>0)return[{id:"shared/credentials-saved",severity:"error",title:`Incomplete ${A.platform} credentials`,detail:`missing: ${B.join(", ")}`,fix:"Re-run `build credentials save` with the missing values"}];return[]}}});function bk(A){return A&&Array.isArray(A.value)?A.value:[]}function g9A(A){if(!A||A.type!==s9.default.asn1.Type.OID||typeof A.value!=="string")return null;try{return s9.default.asn1.derToOid(A.value)}catch{return null}}function ni0(A){let Q=bk(A);if(g9A(Q[0])!==s9.default.pki.oids.pkcs8ShroudedKeyBag)return null;let B=bk(Q[1])[0],$=bk(B)[0],J=bk($),Y=g9A(J[0]);if(!Y)return null;let Z=bk(J[1]),X=bk(Z[1]);return{algorithmOid:Y,encryptionSchemeOid:g9A(X[0])}}function KSA(A,Q,B=0){if(B>32)return;let $=ni0(A);if($){Q.push($);return}if(Array.isArray(A.value))for(let J of A.value)KSA(J,Q,B+1);else if(A.type===s9.default.asn1.Type.OCTETSTRING&&A.value.length>0)try{KSA(s9.default.asn1.fromDer(A.value),Q,B+1)}catch{}}function ri0(A){if(!Array.isArray(A.value))return null;let Q=A.value[2];if(!Q||!Array.isArray(Q.value))return null;let B=Q.value[0];if(!B||!Array.isArray(B.value))return null;let $=B.value[0];if(!$||!Array.isArray($.value))return null;return g9A($.value[0])}function ai0(A){try{return s9.default.asn1.fromDer(s9.default.util.decode64(A))}catch{throw new HSA}}function oi0(A){Tp(A,"certificate");let Q=ai0(A),B=[];KSA(Q,B);let $=new Set,J=ri0(Q);if(J!==di0)$.add(J===s9.default.pki.oids.sha256?"SHA-256 MAC":"non-SHA-1 MAC");if(B.length===0)$.add("missing PBESv1 SHA-1/3DES private-key encryption");for(let Y of B){if(Y.algorithmOid===pi0)continue;if(Y.algorithmOid===li0)$.add(ii0.has(Y.encryptionSchemeOid??"")?"PBES2/AES private-key encryption":"PBES2 private-key encryption");else $.add("unsupported private-key encryption")}return[...$]}function iCQ(A){let Q=A.attributes?.localKeyId?.[0];return typeof Q==="string"?s9.default.util.bytesToHex(Q):null}function si0(A,Q){let B=[...A.getBags({bagType:s9.default.pki.oids.pkcs8ShroudedKeyBag})[s9.default.pki.oids.pkcs8ShroudedKeyBag]??[],...A.getBags({bagType:s9.default.pki.oids.keyBag})[s9.default.pki.oids.keyBag]??[]],$=new Set(B.map((Y)=>iCQ(Y)).filter((Y)=>Y!==null));if($.size>0){let Y=Q.find((Z)=>{let X=iCQ(Z);return X!==null&&$.has(X)});if(Y?.cert)return Y.cert}let J=Q.find((Y)=>{if(!Y.cert)return!1;return!Y.cert.getExtension("basicConstraints")?.cA});if(J?.cert)return J.cert;return Q[0]?.cert}function vk(A,Q){let B=`${Q}\x00${A}`,$=vp.get(B);if($){if($.error!==void 0)throw $.error;return $.value}try{let J=ei0(A,Q);return nCQ(B,{value:J}),J}catch(J){throw nCQ(B,{error:J}),J}}function nCQ(A,Q){if(vp.size>=ti0)vp.delete(vp.keys().next().value);vp.set(A,Q)}function ei0(A,Q){Tp(A,"certificate");let B=s9.default.util.decode64(A),$=s9.default.asn1.fromDer(B),J=s9.default.pkcs12.pkcs12FromAsn1($,Q),Y=J.getBags({bagType:s9.default.pki.oids.certBag})[s9.default.pki.oids.certBag]??[],Z=si0(J,Y);if(!Z)throw Error("no certificate inside the P12");let X=s9.default.asn1.toDer(s9.default.pki.certificateToAsn1(Z)).getBytes(),G=s9.default.md.sha1.create();return G.update(X),{cert:Z,sha1:G.digest().toHex().toLowerCase()}}var s9,di0="1.3.14.3.2.26",li0="1.2.840.113549.1.5.13",pi0="1.2.840.113549.1.12.1.3",ii0,HSA,ti0=4,vp,xk=(A,Q)=>Boolean(A.credentials?.[Q]),rCQ,aCQ,An0=2592000000,oCQ,Qn0,Bn0,sCQ;var y9A=b(()=>{s9=tA(dS(),1),ii0=new Set(["2.16.840.1.101.3.4.1.2","2.16.840.1.101.3.4.1.22","2.16.840.1.101.3.4.1.42"]);HSA=class HSA extends Error{constructor(){super("malformed PKCS12 ASN.1");this.name="MalformedP12Error"}};vp=new Map;rCQ={id:"ios/p12-opens",platforms:["ios"],appliesTo:(A)=>xk(A,"BUILD_CERTIFICATE_BASE64"),async run(A){try{return vk(A.credentials.BUILD_CERTIFICATE_BASE64,A.credentials.P12_PASSWORD??""),[]}catch(Q){let B=Q instanceof Error?Q.message:String(Q);return[{id:"ios/p12-opens",severity:"error",title:/mac|hmac|password|invalid/i.test(B)?"The P12 certificate cannot be opened with the saved password":"The saved certificate is not a valid P12 file",detail:B,fix:"Re-export the .p12 and re-run `build credentials save` with the correct --p12-password"}]}}},aCQ={id:"ios/p12-legacy-encryption",platforms:["ios"],appliesTo:(A)=>xk(A,"BUILD_CERTIFICATE_BASE64"),async run(A){let Q;try{Q=oi0(A.credentials.BUILD_CERTIFICATE_BASE64)}catch(B){if(B instanceof HSA)return[];throw B}if(Q.length===0)return[];return[{id:"ios/p12-legacy-encryption",severity:"error",title:"The P12 certificate uses encryption that the macOS build runner cannot import",detail:`Detected ${Q.join(" and ")}. Fastlane security import may report a wrong password even when the password is correct.`,fix:"Re-export the .p12 with PBESv1 SHA-1/3DES encryption and a SHA-1 MAC, then re-run `build credentials save`."}]}},oCQ={id:"ios/p12-expiry",platforms:["ios"],appliesTo:(A)=>xk(A,"BUILD_CERTIFICATE_BASE64"),async run(A){let Q;try{Q=vk(A.credentials.BUILD_CERTIFICATE_BASE64,A.credentials.P12_PASSWORD??"")}catch{return[]}let B=Q.cert.validity.notAfter,$=B.getTime()-Date.now();if($<=0)return[{id:"ios/p12-expiry",severity:"error",title:`Signing certificate expired on ${B.toISOString().slice(0,10)}`,fix:"Create a new distribution certificate in the Apple Developer portal and re-save credentials"}];if($<An0)return[{id:"ios/p12-expiry",severity:"warning",title:`Signing certificate expires in ${Math.ceil($/86400000)} day(s) (${B.toISOString().slice(0,10)})`,fix:"Renew it soon to avoid build interruptions"}];return[]}},Qn0=/^[A-Z0-9]{10}$/,Bn0=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,sCQ={id:"ios/asc-key-valid",platforms:["ios"],appliesTo:(A)=>xk(A,"APPLE_KEY_CONTENT")||xk(A,"APPLE_KEY_ID")||xk(A,"APPLE_ISSUER_ID"),async run(A){let Q=[],{APPLE_KEY_ID:B,APPLE_ISSUER_ID:$,APPLE_KEY_CONTENT:J}=A.credentials??{};if(B&&!Qn0.test(B))Q.push({id:"ios/asc-key-valid",severity:"error",title:"APPLE_KEY_ID is not a 10-char App Store Connect key ID",detail:`got a ${B.length}-char value (expected 10 uppercase letters/digits)`});if($&&!Bn0.test($))Q.push({id:"ios/asc-key-valid",severity:"error",title:"APPLE_ISSUER_ID is not a UUID",detail:`got a ${$.length}-char value (expected a UUID like 12345678-1234-1234-1234-123456789012)`,fix:"Copy the Issuer ID from App Store Connect → Users and Access → Integrations"});if(J){let Y="";try{Y=s9.default.util.decode64(J)}catch{}if(!Y.includes("-----BEGIN PRIVATE KEY-----"))Q.push({id:"ios/asc-key-valid",severity:"error",title:"APPLE_KEY_CONTENT does not decode to a .p8 private key PEM",fix:"Base64-encode the raw AuthKey_XXXX.p8 file content"})}return Q}}});function tCQ(A){return A!==null&&typeof A==="object"&&!Array.isArray(A)?A:void 0}function fp(A){throw new gp("invalid",A)}function FSA(A,Q,B){let $={profile:A,name:Q};return Object.defineProperty($,"bundleId",{value:B}),$}function yp(A){if(A===void 0||A===null)throw new gp("missing","No provisioning profile map is saved");if(typeof A!=="string"||A.trim()==="")fp("The saved provisioning profile map is empty or invalid");let Q;try{Q=JSON.parse(A)}catch{throw new gp("malformed","The saved provisioning profile map is not valid JSON")}let B=tCQ(Q);if(!B)fp("The saved provisioning profile map must be a JSON object");if(Object.keys(B).length===0)throw new gp("empty","The saved provisioning profile map has no profiles");let $=Object.create(null);for(let[J,Y]of Object.entries(B)){if(!J.trim())fp("The saved provisioning profile map contains an empty bundle ID");let Z=tCQ(Y),X=typeof Y==="string"?Y:Z&&Object.hasOwn(Z,"profile")&&typeof Z.profile==="string"?Z.profile:void 0;if(!X)fp(`The saved provisioning profile for ${J} is invalid`);try{let G=q_(X);$[J]=FSA(X,G.name,G.bundleId)}catch{fp(`The saved provisioning profile for ${J} is invalid`)}}return $}function h9A(A){let Q=A.trim();return Q.length>0&&!Q.includes("*")&&!Q.includes("$(")&&!Q.includes("${")}function zSA(A,Q){if(A==="*")return!0;if(!A.endsWith(".*"))return!1;let B=A.slice(0,-2);return B.length>0&&Q.startsWith(`${B}.`)&&Q.length>B.length+1}function $n0(A){let Q=new Map;for(let B of A){let $=Q.get(B.bundleId);if($)$.targetNames.push(B.name);else Q.set(B.bundleId,{bundleId:B.bundleId,targetNames:[B.name]})}return[...Q.values()]}function fk(A,Q){let B=A.filter((z)=>!h9A(z.bundleId)),$=$n0(A.filter((z)=>h9A(z.bundleId))),J=$.filter((z)=>Object.hasOwn(Q,z.bundleId)),Y=$.filter((z)=>!Object.hasOwn(Q,z.bundleId)),Z=new Map;for(let[z,q]of Object.entries(Q)){let D=Y.filter((M)=>zSA(q.bundleId,M.bundleId));if(D.length===0)continue;let I=Z.get(q.profile);if(I){I.sourceKeys.push(z);for(let M of D)I.targetBundleIds.add(M.bundleId)}else Z.set(q.profile,{entry:q,sourceKeys:[z],targetBundleIds:new Set(D.map((M)=>M.bundleId))})}let X=[...Z.values()],G=new Set(X.flatMap((z)=>[...z.targetBundleIds])),W=X.length>1?Y.filter((z)=>G.has(z.bundleId)):[],K=X.length===1?X[0]:void 0,H=K?{entry:K.entry,sourceKeys:K.sourceKeys,targets:Y.filter((z)=>K.targetBundleIds.has(z.bundleId))}:null;return{exact:J,missing:Y,unresolved:B,wildcardReuse:H,wildcardConflict:W,generation:Y.filter((z)=>!G.has(z.bundleId))}}var gp;var USA=b(()=>{zM();gp=class gp extends Error{code;constructor(A,Q){super(Q);this.code=A;this.name="ProvisioningMapError"}}});function eq(A){let Q=A.credentials?.CAPGO_IOS_PROVISIONING_MAP;if(!Q)return[];try{let B=JSON.parse(Q);if(!B||typeof B!=="object"||Array.isArray(B))return[];let $=[];for(let[J,Y]of Object.entries(B))if(typeof Y==="string")$.push({bundleId:J,base64:Y});else if(Y&&typeof Y==="object"&&typeof Y.profile==="string"){let Z=Y;$.push({bundleId:J,base64:Z.profile,name:Z.name})}return $}catch{return[]}}function u9A(A){try{return q_(A)}catch{return null}}function Yn0(A,Q){return A===Q||zSA(A,Q)}var Jn0=2592000000,m9A=(A)=>eq(A).length>0,eCQ,AVQ,QVQ,BVQ,$VQ,JVQ;var c9A=b(()=>{USA();zM();y9A();eCQ={id:"ios/profile-expiry",platforms:["ios"],appliesTo:m9A,async run(A){let Q=[];for(let{bundleId:B,base64:$}of eq(A)){let J=u9A($);if(!J?.expirationDate)continue;let Y=new Date(J.expirationDate).getTime()-Date.now();if(Y<=0)Q.push({id:"ios/profile-expiry",severity:"error",title:`Provisioning profile for "${B}" expired on ${J.expirationDate.slice(0,10)}`,fix:"Regenerate the profile in the Apple Developer portal and re-save credentials"});else if(Y<Jn0)Q.push({id:"ios/profile-expiry",severity:"warning",title:`Provisioning profile for "${B}" expires in ${Math.ceil(Y/86400000)} day(s)`})}return Q}};AVQ={id:"ios/profile-bundle-match",platforms:["ios"],appliesTo:m9A,async run(A){let Q=[];for(let{bundleId:B,base64:$}of eq(A)){let J=u9A($);if(J?.bundleId&&!Yn0(J.bundleId,B))Q.push({id:"ios/profile-bundle-match",severity:"error",title:`Provisioning profile mapped to "${B}" is for a different bundle id`,detail:`profile: ${J.bundleId} — assigned to: ${B}`,fix:"Use a profile generated for this bundle id (or a wildcard profile)"})}return Q}},QVQ={id:"ios/profile-type-vs-mode",platforms:["ios"],appliesTo:(A)=>m9A(A)&&Boolean(A.distributionMode),async run(A){let Q=[];for(let{bundleId:B,base64:$}of eq(A)){let J=u9A($);if(!J||J.profileType==="unknown")continue;if(J.profileType!==A.distributionMode)Q.push({id:"ios/profile-type-vs-mode",severity:"error",title:`Profile for "${B}" is ${J.profileType} but the build requests ${A.distributionMode}`,fix:A.distributionMode==="app_store"?"Generate an App Store distribution profile, or build with --ios-distribution ad_hoc":"Generate an Ad Hoc profile, or switch --ios-distribution"})}return Q}},BVQ={id:"ios/cert-profile-pairing",platforms:["ios"],appliesTo:(A)=>m9A(A)&&Boolean(A.credentials?.BUILD_CERTIFICATE_BASE64),async run(A){let Q;try{Q=vk(A.credentials.BUILD_CERTIFICATE_BASE64,A.credentials.P12_PASSWORD??"").sha1}catch{return[]}let B=[];for(let{bundleId:$,base64:J}of eq(A)){let Y=u9A(J);if(!Y||Y.certificateSha1s.length===0)continue;if(!Y.certificateSha1s.includes(Q))B.push({id:"ios/cert-profile-pairing",severity:"error",title:`Your signing certificate is not included in the provisioning profile for "${$}"`,detail:`cert sha1 ${Q} not in [${Y.certificateSha1s.join(", ")}]`,fix:"Regenerate the profile selecting this distribution certificate, then re-save credentials"})}return B}},$VQ={id:"ios/targets-covered",platforms:["ios"],appliesTo:(A)=>A.credentials?.CAPGO_IOS_PROVISIONING_MAP!==void 0,async run(A){let Q;try{Q=yp(A.credentials?.CAPGO_IOS_PROVISIONING_MAP)}catch(H){return[{id:"ios/targets-covered",severity:"error",title:"Saved iOS provisioning profile map cannot be used",detail:H instanceof Error?H.message:"The saved provisioning profile map is invalid",fix:"Save or update the iOS provisioning profile map before building"}]}let{findSignableTargets:B,readPbxproj:$}=await Promise.resolve().then(() => (r7(),vy)),J=$(A.projectDir);if(!J)return[];let Y=B(J),Z=fk(Y,Q),X=new Set([...Z.wildcardReuse?.targets??[],...Z.wildcardConflict].map((H)=>H.bundleId)),G=Z.missing.filter((H)=>!X.has(H.bundleId));if(G.length===0)return[];let W=G.reduce((H,z)=>H+z.targetNames.length,0),K=Y.filter((H)=>H.bundleId).length>1;return[{id:"ios/targets-covered",severity:"error",title:`${W} signable target(s) have no provisioning profile mapped`,detail:`uncovered: ${G.flatMap((H)=>H.targetNames.map((z)=>`${z} (${H.bundleId})`)).join(", ")}`,fix:K?"Run npx @capgo/cli@latest build credentials ios-provisioning to set up every target":'Add --ios-provisioning-profile "bundleId=/path/to/profile.mobileprovision" and re-save credentials'}]}},JVQ={id:"ios/wildcard-profile-targets",platforms:["ios"],appliesTo:(A)=>A.credentials?.CAPGO_IOS_PROVISIONING_MAP!==void 0,async run(A){let Q;try{Q=yp(A.credentials?.CAPGO_IOS_PROVISIONING_MAP)}catch{return[]}let{findSignableTargets:B,readPbxproj:$}=await Promise.resolve().then(() => (r7(),vy)),J=$(A.projectDir);if(!J)return[];let Y=fk(B(J),Q);if(Y.wildcardConflict.length>0)return[{id:"ios/wildcard-profile-targets",severity:"error",title:"Sorry, multiple matching wildcard provisioning profiles are not supported",detail:`targets: ${Y.wildcardConflict.map((Z)=>`${Z.targetNames.join("/")} (${Z.bundleId})`).join(", ")}`,fix:"Remove or replace the conflicting wildcard profiles in the saved map, then retry"}];if(!Y.wildcardReuse)return[];return[{id:"ios/wildcard-profile-targets",severity:"error",title:`${Y.wildcardReuse.targets.length} target bundle id(s) can reuse a saved wildcard provisioning profile`,detail:`targets: ${Y.wildcardReuse.targets.map((Z)=>`${Z.targetNames.join("/")} (${Z.bundleId})`).join(", ")}`,fix:"Run npx @capgo/cli@latest build credentials ios-provisioning to confirm and update the map"}]}}});function d9A(A){return A.config?.server}function qSA(A){let Q=d9A(A)?.url;return typeof Q==="string"&&Q!==""?Q:null}function Wn0(A){if(Xn0.test(A))return"points at localhost / 127.0.0.1";if(Zn0.test(A))return"points at a private LAN IP (live-reload)";if(Gn0.test(A))return"points at a dev tunnel host (ngrok / cloudflare / localtunnel)";if(/^http:\/\//i.test(A))return"uses cleartext http://";return null}function Kn0(A){if(A==="*")return!0;return/^\*\.[a-z0-9-]+$/i.test(A)}function YVQ(A){let Q=d9A(A)?.allowNavigation;if(!Array.isArray(Q))return[];return Q.filter((B)=>typeof B==="string"&&Kn0(B))}var Zn0,Xn0,Gn0,ZVQ,XVQ,GVQ;var WVQ=b(()=>{Zn0=/^https?:\/\/(?:10\.|172\.(?:1[6-9]|2\d|3[01])\.|192\.168\.)/i,Xn0=/^https?:\/\/(?:localhost|127\.0\.0\.1)(?:[:/]|$)/i,Gn0=/^https?:\/\/[^/]*\.(?:ngrok\.io|ngrok-free\.app|trycloudflare\.com|loca\.lt)(?:[:/]|$)/i;ZVQ={id:"ios/capacitor-server-url-shipped",platforms:["ios"],appliesTo:(A)=>qSA(A)!==null,async run(A){let Q=qSA(A);if(Q===null)return[];let B=jW(A),$=Wn0(Q),J=$?`server.url ${$} — this ships a live-reload/remote endpoint into the build`:"server.url ships a remote endpoint into the build instead of the bundled web assets";return[{id:"ios/capacitor-server-url-shipped",severity:B?"error":"warning",title:"capacitor.config server.url is set — the build will load a remote URL instead of bundled assets",detail:J,fix:"Remove the server.url live-reload block before a production build; build web assets and run `npx cap sync`"}]}},XVQ={id:"ios/capacitor-server-cleartext",platforms:["ios"],appliesTo:(A)=>d9A(A)?.cleartext===!0,async run(A){if(d9A(A)?.cleartext!==!0)return[];let Q=qSA(A),B=Q!==null&&/^http:\/\//i.test(Q);return[{id:"ios/capacitor-server-cleartext",severity:B?"error":"warning",title:"capacitor.config server.cleartext is enabled — arbitrary cleartext HTTP traffic is allowed",detail:B?"paired with a cleartext http:// server.url":void 0,fix:"Remove server.cleartext (or set it false) for production; use https or a scoped ATS exception"}]}};GVQ={id:"ios/capacitor-allow-navigation-wildcard",platforms:["ios"],appliesTo:(A)=>YVQ(A).length>0,async run(A){let Q=YVQ(A);if(Q.length===0)return[];return[{id:"ios/capacitor-allow-navigation-wildcard",severity:"warning",title:"capacitor.config server.allowNavigation contains a blanket wildcard",detail:`wildcard entr(y/ies): ${Q.join(", ")}`,fix:'Restrict allowNavigation to specific hosts; remove blanket "*" / "*.<tld>" entries'}]}}});function Fn0(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zn0(A){return A.match(/buildSettings\s*=\s*\{([\s\S]*?)\n\s*\};/)?.[1]??""}function Un0(A){let Q={};for(let B of A.split(`
|
|
1027
|
-
`)){let $=B.match(/^\s*([A-Z0-9_]+(?:\[[^\]]*\])?)\s*=\s*(.+?);\s*$/i);if(!$)continue;let J=$[1],Y=$[2].trim();if(Y.startsWith("("))continue;if(Y.length>=2&&Y.startsWith('"')&&Y.endsWith('"'))Y=Y.slice(1,-1);Q[J]=Y}return Q}function DSA(A){if(!A)return[];let Q=/(\w+)\s*\/\*[^*]*\*\/\s*=\s*\{[^{}]*isa\s*=\s*XCBuildConfiguration;(?:[^{}]*\{[^}]*\})*[^}]*\}/g,B=[];for(let $ of A.matchAll(Q)){let J=$[0],Y=$[1],Z=J.match(/\bname\s*=\s*("[^"]*"|[^;\s]+)\s*;/),X=Z?Z[1].replace(/^"|"$/g,""):"";B.push({id:Y,name:X,settings:Un0(zn0(J))})}return B}function qn0(A){let Q=A.match(/isa\s*=\s*PBXProject;[\s\S]*?buildConfigurationList\s*=\s*(\w+)/)?.[1];if(!Q)return new Set;return KVQ(A,Q)}function KVQ(A,Q){let B=new RegExp(`${Fn0(Q)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*XCConfigurationList;[^}]*\\}`),$=A.match(B)?.[0];if(!$)return new Set;let J=$.match(/buildConfigurations\s*=\s*\(([^)]*)\)/);if(!J)return new Set;return new Set(Array.from(J[1].matchAll(/(\w+)/g),(Y)=>Y[1]))}function ISA(A){let Q=qn0(A);return DSA(A).map((B)=>({name:B.name,settings:B.settings,isProjectLevel:Q.has(B.id)}))}function hp(A,Q){let B=null;for(let $ of DSA(A)){let J=$.settings[Q];if(J===void 0)continue;if($.name==="Release")return J;if(B===null)B=J}return B}function up(A,Q){let B=A.match(/^\$\(([A-Z0-9_]+)\)$/i),$=A.match(/^\$\{([A-Z0-9_]+)\}$/i),J=B?.[1]??$?.[1];if(!J)return A;return hp(Q,J)??A}function AD(A){if(!A)return[];let Q=UK(A);if(Q.length===0)return[];let B=new Map,$=/\w+\s*\/\*[^*]*\*\/\s*=\s*\{[^}]*isa\s*=\s*PBXNativeTarget;[^}]*\}/g;for(let Z of A.matchAll($)){let X=Z[0],G=X.match(/\bname\s*=\s*("[^"]*"|[^;\s]+)\s*;/),W=X.match(/buildConfigurationList\s*=\s*(\w+)/);if(!G||!W)continue;B.set(G[1].replace(/^"|"$/g,""),W[1])}let J=DSA(A),Y=new Map(J.map((Z)=>[Z.id,Z]));return Q.map((Z)=>{let X=B.get(Z.name),G=X?KVQ(A,X):new Set,W=Array.from(G).map((K)=>Y.get(K)).filter((K)=>K!==void 0).map((K)=>({name:K.name,settings:K.settings}));return{target:Z,configs:W}})}function mp(A){let Q=[],B=($)=>{if($===void 0)return;let J=Number.parseFloat($);if(!Number.isNaN(J))Q.push(J)};for(let $ of ISA(A))if($.isProjectLevel)B($.settings.IPHONEOS_DEPLOYMENT_TARGET);for(let{target:$,configs:J}of AD(A)){if($.productType!==Hn0)continue;for(let Y of J)B(Y.settings.IPHONEOS_DEPLOYMENT_TARGET)}return Q.length>0?Math.min(...Q):null}var Hn0="com.apple.product-type.application";var gk=b(()=>{r7()});import{existsSync as Dn0,readFileSync as FVQ}from"node:fs";import{dirname as HVQ,isAbsolute as In0,join as Mn0,resolve as On0}from"node:path";function Nn0(A,Q){return A.find((B)=>B.name==="Release")?.settings[Q]??A.find((B)=>B.name==="Debug")?.settings[Q]??A.find((B)=>B.settings[Q]!==void 0)?.settings[Q]}function Cn0(A,Q){let B=ZW(A);if(!B)return;let $;try{$=FVQ(B,"utf8")}catch{return}let J=AD($).filter(({target:W})=>W.productType===Ln0),Y=J.find(({target:W,configs:K})=>W.bundleId===Q||K.some((H)=>H.settings.PRODUCT_BUNDLE_IDENTIFIER===Q))??J[0],Z=Y?Nn0(Y.configs,"CODE_SIGN_ENTITLEMENTS"):void 0;if(Z===void 0)return;let X=HVQ(HVQ(B)),G=Z.replace(/\$\((?:SRCROOT|SOURCE_ROOT|PROJECT_DIR)\)|\$\{(?:SRCROOT|SOURCE_ROOT|PROJECT_DIR)\}/g,X);if(/\$\([^)]+\)|\$\{[^}]+\}/.test(G))return null;return In0(G)?G:On0(X,G)}function Fz(A,Q){let B=Cn0(A,Q);if(B===null)return null;let $=B??Mn0(A,"ios","App","App","App.entitlements");if(!Dn0($))return null;try{return{raw:FVQ($,"utf8")}}catch{return null}}function MSA(A,Q){return sq(A,Q)}function yk(A,Q){return Hz(A,Q)}function zVQ(A,Q){return Pp(A,Q)}var Ln0="com.apple.product-type.application";var UVQ=b(()=>{r7();gk()});import{existsSync as Vn0,readFileSync as Rn0}from"node:fs";import{join as NVQ}from"node:path";function OSA(A){return eq(A).find((Q)=>Q.bundleId===(A.nativeAppId??A.appId))}function wn0(A){let Q=NVQ(A,"ios","App","App","Info.plist");if(!Vn0(Q))return!1;try{return Hz(Rn0(Q,"utf8"),"UIBackgroundModes").includes("remote-notification")}catch{return!1}}function CVQ(A){try{return q_(A).profileEntitlements}catch{return{}}}function _n0(A){return Pn0.has(A)||A.endsWith(".team-identifier")}function Tn0(A){return A==="*"||A==="$(AppIdentifierPrefix)*"||/^\$\(\w+\)\*$/.test(A)||/^[A-Z0-9]{10}\.\*$/.test(A)}function IVQ(A){if(qVQ.test(A))return A.replace(qVQ,"");if(DVQ.test(A))return A.replace(DVQ,"");return A}function Sn0(A){let Q=[],B=/<key>([\s\S]*?)<\/key>\s*<(array|string|true|false|dict|integer|real|data|date)(\/)?\s*>/g,$=B.exec(A);while($!==null){let J=$[1].trim(),Y=$[2],Z=$[3]==="/";if(Q.push({key:J,isArray:Y==="array"}),!Z&&(Y==="dict"||Y==="array")){let X=kn0(A,Y,$.index+$[0].length);if(X>B.lastIndex)B.lastIndex=X}$=B.exec(A)}return Q}function kn0(A,Q,B){let $=new RegExp(`<${Q}>|</${Q}>`,"g");$.lastIndex=B;let J=1;for(let Y=$.exec(A);Y!==null;Y=$.exec(A))if(Y[0]===`<${Q}>`)J++;else if(--J===0)return $.lastIndex;return A.length}function fn0(A,Q){let B=K6(NVQ(A,"package.json"));if(B===null)return!1;try{let $=JSON.parse(B);return typeof{...$.devDependencies,...$.dependencies}[Q]==="string"}catch{return!1}}var En0=(A)=>OSA(A)!==void 0,jn0=(A)=>Fz(A.projectDir,A.nativeAppId??A.appId)!==null,Pn0,qVQ,DVQ,VVQ,RVQ,bn0,MVQ="com.apple.developer.associated-domains",EVQ,OVQ="com.apple.security.application-groups",xn0,jVQ,LVQ="@capgo/capacitor-age-range",vn0="com.apple.developer.declared-age-range",wVQ;var PVQ=b(()=>{zM();oq();UVQ();c9A();Pn0=new Set(["aps-environment","get-task-allow","application-identifier"]);qVQ=/^\$\((?:AppIdentifierPrefix|TeamIdentifierPrefix)\)/,DVQ=/^[A-Z0-9]{10}\./;VVQ={id:"ios/entitlements-vs-profile-capability",platforms:["ios"],appliesTo:(A)=>En0(A)&&jn0(A),async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId),B=OSA(A);if(!Q||!B)return[];let $=Sn0(Q.raw).filter((Y)=>!_n0(Y.key));if($.length===0)return[];let J=[];for(let{bundleId:Y,base64:Z}of[B]){let X=CVQ(Z);for(let{key:G,isArray:W}of $)if(W){let K=yk(Q.raw,G),H=X[G],z=Array.isArray(H)?H:typeof H==="string"?[H]:[];if(z.some(Tn0))continue;let q=new Set(z.map(IVQ)),D=K.filter((I)=>!q.has(IVQ(I)));if(D.length>0)J.push({id:"ios/entitlements-vs-profile-capability",severity:"error",title:`Entitlement "${G}" is not fully covered by the provisioning profile for "${Y}"`,detail:`uncovered ${G} value(s): ${D.join(", ")}`,fix:"Enable the capability for this App ID in the Apple Developer portal, regenerate the profile, and re-save credentials (or remove the unused entitlement)"})}else if(!(G in X))J.push({id:"ios/entitlements-vs-profile-capability",severity:"error",title:`Entitlement "${G}" is declared by the app but not granted by the provisioning profile for "${Y}"`,detail:`missing capability: ${G}`,fix:"Enable the capability for this App ID in the Apple Developer portal, regenerate the profile, and re-save credentials (or remove the unused entitlement)"})}return J}},RVQ={id:"ios/entitlements-aps-environment-vs-mode",platforms:["ios"],appliesTo:(A)=>{let Q=Fz(A.projectDir,A.nativeAppId??A.appId);return Q!==null&&MSA(Q.raw,"aps-environment")!==null&&Boolean(A.distributionMode)},async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId);if(!Q)return[];let B=MSA(Q.raw,"aps-environment");if(B===null)return[];let $=OSA(A),J=$?CVQ($.base64)["aps-environment"]:void 0,Y=typeof J==="string"&&J!==B,Z=[];if(A.distributionMode==="app_store"&&B==="development"&&!Y){let X=wn0(A.projectDir);Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:X?"error":"warning",title:'aps-environment is "development" but the build distributes to the App Store / TestFlight',detail:X?"The app declares the remote-notification background mode, so it needs a production push environment for App Store / TestFlight":"App Store and TestFlight push needs a production environment; this is the default Capacitor leftover and is harmless unless the app uses push notifications",fix:"Set aps-environment=production in App.entitlements and use a production push profile (or remove aps-environment if the app does not use push)"})}else if(A.distributionMode==="ad_hoc"&&B==="production"&&!Y)Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"warning",title:'aps-environment is "production" for an ad_hoc build',detail:"ad_hoc builds usually use the development push environment (production is valid but uncommon)",fix:"Use aps-environment=development for ad_hoc unless you intend production APNs"});if($&&Y)Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"error",title:`aps-environment differs between App.entitlements and the provisioning profile for "${$.bundleId}"`,detail:`app: ${B} — profile: ${J}`,fix:"Align aps-environment in App.entitlements with the push profile (or regenerate the profile)"});return Z}},bn0=/^(?:applinks|webcredentials|activitycontinuation|appclips):[a-z0-9.-]+(?:\?mode=(?:developer|managed))?$/i,EVQ={id:"ios/entitlements-associated-domains-format",platforms:["ios"],appliesTo:(A)=>{let Q=Fz(A.projectDir,A.nativeAppId??A.appId);return Q!==null&&yk(Q.raw,MVQ).length>0},async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId);if(!Q)return[];let B=[];for(let $ of yk(Q.raw,MVQ)){if(/^(?:applinks|webcredentials|activitycontinuation|appclips):\*$/i.test($))continue;if(!bn0.test($))B.push($)}if(B.length===0)return[];return[{id:"ios/entitlements-associated-domains-format",severity:"warning",title:`${B.length} associated-domains entr(y/ies) have an invalid format`,detail:`invalid: ${B.join(", ")}`,fix:'Use the "service:domain" form (e.g. applinks:example.com) — no scheme, path, or trailing slash'}]}},xn0=/^group\.[a-z0-9.-]+$/,jVQ={id:"ios/entitlements-app-groups-format",platforms:["ios"],appliesTo:(A)=>{let Q=Fz(A.projectDir,A.nativeAppId??A.appId);return Q!==null&&yk(Q.raw,OVQ).length>0},async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId);if(!Q)return[];let B=yk(Q.raw,OVQ).filter(($)=>!xn0.test($));if(B.length===0)return[];return[{id:"ios/entitlements-app-groups-format",severity:"warning",title:`${B.length} app group identifier(s) have an invalid format`,detail:`invalid: ${B.join(", ")}`,fix:'Name app groups "group.<reverse-dns>" (lowercase, no whitespace) and register them in the portal'}]}};wVQ={id:"ios/entitlements-declared-age-range",platforms:["ios"],appliesTo:(A)=>fn0(A.projectDir,LVQ)&&jW(A),async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId);if(Q!==null&&zVQ(Q.raw,vn0)===!0)return[];return[{id:"ios/entitlements-declared-age-range",severity:"warning",title:`${LVQ} is installed without the Declared Age Range entitlement`,detail:"The plugin calls Apple's Declared Age Range API. Without com.apple.developer.declared-age-range signed into the binary, in-app age-range requests fail.",fix:"Add com.apple.developer.declared-age-range=<true/> to App.entitlements, enable Declared Age Range on the App ID, and set CODE_SIGN_ENTITLEMENTS."}]}}});import{existsSync as gn0,readFileSync as yn0}from"node:fs";import{join as hn0}from"node:path";function _VQ(A){let Q=hn0(A,...un0);return gn0(Q)?Q:null}function VG(A){let Q=_VQ(A);if(!Q)return null;try{return yn0(Q,"utf8")}catch{return null}}function cp(A){return XW(A)??""}function l9A(A){return A.startsWith("$(")||A.startsWith("${")}function mn0(A){let Q=A.config?.server;if(Q===null||typeof Q!=="object")return!1;let B=Q;return B.cleartext===!0||typeof B.url==="string"&&B.url.length>0}function rn0(A){let Q=Hz(A,"UIRequiredDeviceCapabilities");if(Q.length>0)return Q;let B=JSA(A,"UIRequiredDeviceCapabilities");if(B===null)return[];let $=[];for(let J of B.matchAll(/<key>([\s\S]*?)<\/key>\s*<(true|false)\s*\/>/g))if(J[2]==="true")$.push(J[1].trim());return $}function an0(A){let Q=A.credentials?.CAPGO_IOS_XCODE_VERSION?.trim().replace(/^xcode\s*/i,""),B=Q?Number.parseInt(Q,10):Number.NaN;return Number.isFinite(B)?B:null}var un0,W3=(A)=>_VQ(A.projectDir)!==null,cn0,dn0,ln0,TVQ,pn0,in0,SVQ,kVQ,bVQ,xVQ,vVQ,fVQ,gVQ,yVQ,hVQ,nn0,uVQ,mVQ,cVQ;var dVQ=b(()=>{r7();gk();un0=["ios","App","App","Info.plist"];cn0=/^\d+\.\d+(?:\.\d+)?$/,dn0=/^\d+(?:\.\d+){0,2}$/,ln0=/^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9-]+)+$/i,TVQ=["UIInterfaceOrientationPortrait","UIInterfaceOrientationPortraitUpsideDown","UIInterfaceOrientationLandscapeLeft","UIInterfaceOrientationLandscapeRight"],pn0=new Set(TVQ),in0=new Set(["audio","location","voip","fetch","remote-notification","processing","bluetooth-central","bluetooth-peripheral","external-accessory","newsstand-content"]),SVQ={id:"ios/plist-bundle-id-format",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=sq(Q,"CFBundleIdentifier");if(B===null)return[{id:"ios/plist-bundle-id-format",severity:"error",title:"Info.plist has no CFBundleIdentifier",fix:"Set a valid reverse-DNS PRODUCT_BUNDLE_IDENTIFIER (no spaces, underscores, or wildcards)."}];let $=up(B,cp(A.projectDir));if(l9A($))return[];if(!ln0.test($))return[{id:"ios/plist-bundle-id-format",severity:"error",title:`Invalid bundle identifier "${$}"`,detail:"Bundle ids must be reverse-DNS (≥2 dot-separated segments) with no spaces, underscores, or wildcards.",fix:"Set a valid reverse-DNS PRODUCT_BUNDLE_IDENTIFIER (no spaces, underscores, or wildcards)."}];return[]}},kVQ={id:"ios/plist-version-short-format",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=sq(Q,"CFBundleShortVersionString");if(B===null)return[];let $=up(B,cp(A.projectDir));if(l9A($))return[];if(!cn0.test($))return[{id:"ios/plist-version-short-format",severity:"error",title:`CFBundleShortVersionString "${$}" is not a valid version (ITMS-90060)`,detail:"The marketing version must be two or three dot-separated integers (e.g. 1.4 or 1.4.2) — no letters or pre-release suffixes.",fix:"Set CFBundleShortVersionString or its build setting to two or three dot-separated integers (e.g. 1.4.2)."}];return[]}},bVQ={id:"ios/plist-version-build-format",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=sq(Q,"CFBundleVersion");if(B===null)return[];let $=up(B,cp(A.projectDir));if(l9A($))return[];if(!dn0.test($))return[{id:"ios/plist-version-build-format",severity:"error",title:`CFBundleVersion "${$}" is not a valid build number`,detail:"The build number must be numeric, ≤3 dot-separated integers (e.g. 42 or 1.4.42).",fix:"Set CURRENT_PROJECT_VERSION numeric, ≤3 integers (e.g. 42 or 1.4.42)."}];return[]}},xVQ={id:"ios/plist-encryption-compliance",platforms:["ios"],appliesTo:(A)=>W3(A)&&jW(A),async run(A){let Q=VG(A.projectDir);if(Q===null)return[];if(tq(Q,"ITSAppUsesNonExemptEncryption"))return[];return[{id:"ios/plist-encryption-compliance",severity:"warning",title:"Info.plist is missing ITSAppUsesNonExemptEncryption",detail:'Without this key, App Store Connect shows a "Missing Compliance" prompt on every upload.',fix:"Add ITSAppUsesNonExemptEncryption=<false/> (correct for most Capacitor apps) to stop the per-upload Missing Compliance prompt."}]}},vVQ={id:"ios/plist-ats-arbitrary-loads",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=JSA(Q,"NSAppTransportSecurity");if(B===null)return[];if(Pp(B,"NSAllowsArbitraryLoads")!==!0)return[];let $=jW(A)&&mn0(A);return[{id:"ios/plist-ats-arbitrary-loads",severity:$?"error":"warning",title:"NSAllowsArbitraryLoads is enabled (App Transport Security disabled)",detail:$?"Uploading with arbitrary loads enabled and a dev server (cleartext / server.url) still configured ships an insecure release.":"NSAllowsArbitraryLoads disables App Transport Security for all hosts.",fix:"Remove NSAllowsArbitraryLoads (or set <false/>); use scoped NSExceptionDomains; remove server.url/cleartext before release."}]}},fVQ={id:"ios/plist-launch-storyboard",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];if(tq(Q,"UILaunchStoryboardName")||tq(Q,"UILaunchScreen"))return[];return[{id:"ios/plist-launch-storyboard",severity:"error",title:"Info.plist declares no launch screen (ITMS-90475/90096)",detail:"App Store upload requires a launch storyboard or a UILaunchScreen dictionary.",fix:"Add UILaunchStoryboardName=LaunchScreen (Capacitor default) or a UILaunchScreen dict."}]}},gVQ={id:"ios/plist-orientations-multitasking",platforms:["ios"],appliesTo(A){if(!W3(A))return!1;let Q=VG(A.projectDir);if(Q===null)return!1;if(Pp(Q,"UIRequiresFullScreen")===!0)return!1;let B=hp(cp(A.projectDir),"TARGETED_DEVICE_FAMILY");if(B===null)return!1;return B.split(",").map(($)=>$.trim()).includes("2")},async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=Hz(Q,"UISupportedInterfaceOrientations~ipad");if(!tq(Q,"UISupportedInterfaceOrientations~ipad"))B=Hz(Q,"UISupportedInterfaceOrientations");let $=new Set(B),J=TVQ.filter((Y)=>!$.has(Y));if(J.length===0)return[];return[{id:"ios/plist-orientations-multitasking",severity:"warning",title:`iPad multitasking requires all four orientations — missing ${J.join(", ")} (ITMS-90474)`,detail:"An iPad-capable app that supports multitasking must declare all four interface orientations for iPad.",fix:"Add all four orientations to UISupportedInterfaceOrientations~ipad, or add UIRequiresFullScreen=<true/>."}]}},yVQ={id:"ios/plist-orientations-present",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=Hz(Q,"UISupportedInterfaceOrientations");if(B.length===0)return[{id:"ios/plist-orientations-present",severity:"warning",title:"Info.plist declares no UISupportedInterfaceOrientations",detail:"Declare at least one supported interface orientation for iPhone.",fix:"Declare ≥1 valid UIInterfaceOrientation* value."}];let $=B.find((J)=>!pn0.has(J));if($!==void 0)return[{id:"ios/plist-orientations-present",severity:"warning",title:`Invalid interface orientation "${$}"`,detail:"Each entry must be one of UIInterfaceOrientationPortrait, PortraitUpsideDown, LandscapeLeft, LandscapeRight.",fix:"Declare ≥1 valid UIInterfaceOrientation* value."}];return[]}},hVQ={id:"ios/plist-display-name",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=cp(A.projectDir),$=(J)=>{let Y=sq(Q,J);if(Y===null)return null;let Z=up(Y,B);if(l9A(Z)||Z.trim()==="")return null;return Z};if($("CFBundleDisplayName")!==null||$("CFBundleName")!==null)return[];return[{id:"ios/plist-display-name",severity:"warning",title:"Info.plist has no resolvable app display name",detail:"Neither CFBundleDisplayName nor CFBundleName resolves to a non-empty value.",fix:"Set CFBundleDisplayName or ensure PRODUCT_NAME resolves."}]}},nn0=["NSLocationWhenInUseUsageDescription","NSLocationAlwaysAndWhenInUseUsageDescription","NSLocationAlwaysUsageDescription","NSLocationUsageDescription"],uVQ={id:"ios/plist-background-modes-sanity",platforms:["ios"],appliesTo(A){if(!W3(A))return!1;let Q=VG(A.projectDir);return Q!==null&&tq(Q,"UIBackgroundModes")},async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=Hz(Q,"UIBackgroundModes"),$=[],J=B.filter((Y)=>!in0.has(Y));if(J.length>0)$.push({id:"ios/plist-background-modes-sanity",severity:"warning",title:`Unknown UIBackgroundModes value(s): ${J.join(", ")}`,detail:"Background modes must be one of Apple's documented UIBackgroundModes tokens.",fix:"Remove unused background modes; add matching usage strings/capabilities."});if(B.includes("location")&&jW(A)){if(!nn0.some((Z)=>tq(Q,Z)))$.push({id:"ios/plist-background-modes-sanity",severity:"warning",title:'UIBackgroundModes declares "location" without a location usage description (Guideline 2.5.4)',detail:"App Review rejects background location without an NSLocation*UsageDescription string.",fix:"Add the matching NSLocation*UsageDescription, or remove the location background mode."})}return $}};mVQ={id:"ios/plist-required-device-arm64",platforms:["ios"],appliesTo:(A)=>W3(A)&&jW(A),async run(A){let Q=VG(A.projectDir);if(Q===null)return[];if(!tq(Q,"UIRequiredDeviceCapabilities"))return[];let B=rn0(Q);if(B.includes("arm64")||!B.includes("armv7"))return[];return[{id:"ios/plist-required-device-arm64",severity:"warning",title:"UIRequiredDeviceCapabilities lists armv7 without arm64",detail:"Requiring only armv7 marks the binary as 32-bit. App Store installs on iOS 26+ can fail with a generic download error.",fix:"Replace armv7 with arm64 in UIRequiredDeviceCapabilities (modern iPhones are 64-bit only)."}]}};cVQ={id:"ios/plist-scene-lifecycle-xcode27",platforms:["ios"],appliesTo:(A)=>W3(A)&&(an0(A)??0)>=27,async run(A){let Q=VG(A.projectDir);if(Q===null||tq(Q,"UIApplicationSceneManifest"))return[];return[{id:"ios/plist-scene-lifecycle-xcode27",severity:"error",title:"App does not adopt the UIScene lifecycle, required when building with Xcode 27",detail:"Apps built with the iOS 27 SDK crash at launch on iOS 27 without a UIApplicationSceneManifest in Info.plist and a scene delegate.",fix:"Add a SceneDelegate and a UIApplicationSceneManifest to ios/App/App/Info.plist (Capacitor supports scenes), or build with --xcode-version 26.",docsUrl:"https://developer.apple.com/documentation/uikit/specifying-the-scenes-your-app-supports"}]}}});import{readFileSync as on0}from"node:fs";import{join as sn0}from"node:path";function dp(A){try{return JSON.parse(on0(A,"utf8"))}catch{return null}}function lp(A,Q){let B=(Q?hp(Q,"ASSETCATALOG_COMPILER_APPICON_NAME"):null)??"AppIcon";return sn0(A,"ios","App","App","Assets.xcassets",`${B}.appiconset`)}function tn0(A){return(A??"").trim()}function lVQ(A){return(A?.images??[]).some((Q)=>tn0(Q.size)==="1024x1024"||Q.role==="marketing")}var pVQ=b(()=>{gk()});import{existsSync as zL}from"node:fs";import{join as wW}from"node:path";function iVQ(A){return wW(A,"ios","App","Podfile")}function NSA(A){return wW(A,"ios","App","CapApp-SPM","Package.swift")}function nVQ(A){return zL(iVQ(A.projectDir))}function rVQ(A){return A.hostPlatform==="darwin"&&nVQ(A)}function CSA(A){return zL(NSA(A.projectDir))}function p9A(A){return XW(A.projectDir)}function LSA(A){if(A.platform!=="ios")return!1;if((A.distributionMode??"app_store")!=="app_store")return!1;let B=A.credentials;return Boolean(B?.APPLE_KEY_ID&&B?.APPLE_ISSUER_ID&&B?.APPLE_KEY_CONTENT)}var aVQ,oVQ,sVQ,tVQ,eVQ,ARQ,QRQ,BRQ,en0,$RQ;var JRQ=b(()=>{pVQ();gk();r7();oq();aVQ={id:"ios/pods-not-installed",platforms:["ios"],appliesTo:rVQ,async run(A){let Q=wW(A.projectDir,"ios","App"),B=zL(wW(Q,"Pods")),$=zL(wW(Q,"App.xcworkspace"));if(B&&$)return[];let J=[];if(!B)J.push("ios/App/Pods");if(!$)J.push("ios/App/App.xcworkspace");return[{id:"ios/pods-not-installed",severity:"warning",title:"CocoaPods is not installed (missing Pods/ or App.xcworkspace)",detail:`A Podfile exists but ${J.join(" and ")} ${J.length>1?"are":"is"} missing. The cloud build runs pod install and recovers, but local Xcode builds will fail.`,fix:"Run `npx cap sync ios` (or `pod install`) and commit Pods/ + App.xcworkspace."}]}},oVQ={id:"ios/pods-lock-missing",platforms:["ios"],appliesTo:rVQ,async run(A){if(K6(wW(A.projectDir,"ios","App","Podfile.lock"))!==null)return[];return[{id:"ios/pods-lock-missing",severity:"warning",title:"Podfile.lock is missing - pod versions are not pinned",detail:"Without Podfile.lock the cloud build resolves pod versions fresh, which can drift from your local versions.",fix:"Run `pod install` and commit Podfile.lock."}]}},sVQ={id:"ios/pods-capacitor-missing",platforms:["ios"],appliesTo:nVQ,async run(A){let Q=K6(iVQ(A.projectDir));if(Q===null)return[];if(/pod\s+['"]Capacitor['"]/.test(Q)||/capacitor_pods/.test(Q)||/@capacitor\/ios/.test(Q))return[];return[{id:"ios/pods-capacitor-missing",severity:"warning",title:"Podfile does not appear to wire the Capacitor pod",detail:"No `pod 'Capacitor'`, `capacitor_pods` helper, or `@capacitor/ios` reference was found. If this is intentional (custom pod names) you can ignore this.",fix:"Run `npx cap sync ios` then `pod install`."}]}},tVQ={id:"ios/spm-package-resolved-missing",platforms:["ios"],appliesTo:CSA,async run(A){let Q=wW(A.projectDir,"ios","App","App.xcodeproj","project.xcworkspace","xcshareddata","swiftpm","Package.resolved"),B=wW(A.projectDir,"ios","App","CapApp-SPM","Package.resolved");if(zL(Q)||zL(B))return[];return[{id:"ios/spm-package-resolved-missing",severity:"warning",title:"Swift Package Manager Package.resolved is missing",detail:"No Package.resolved found under the xcodeproj or CapApp-SPM. The cloud build resolves packages during build_app, but committing Package.resolved pins versions for reproducible builds.",fix:"Run `xcodebuild -resolvePackageDependencies` (or open in Xcode) and commit Package.resolved."}]}},eVQ={id:"ios/spm-capacitor-dependency-missing",platforms:["ios"],appliesTo:CSA,async run(A){let Q=K6(NSA(A.projectDir));if(Q===null)return[];let B=/capacitor-swift-pm/.test(Q),$=/\.product\(\s*name:\s*['"]Capacitor['"]/.test(Q);if(B&&$)return[];return[{id:"ios/spm-capacitor-dependency-missing",severity:"warning",title:"Package.swift does not declare the Capacitor SPM dependency",detail:'Expected a capacitor-swift-pm package dependency and a `.product(name: "Capacitor", ...)` target dependency. If your project uses a non-standard layout you can ignore this.',fix:"Run `npx cap sync ios` to regenerate Package.swift."}]}},ARQ={id:"ios/appicon-empty-or-placeholder",platforms:["ios"],async run(A){let Q=lp(A.projectDir,p9A(A)??void 0);if(!zL(Q))return[{id:"ios/appicon-empty-or-placeholder",severity:"error",title:"AppIcon.appiconset is missing",detail:`Expected an app-icon asset set at ${Q.replace(A.projectDir,".")} but the directory does not exist.`,fix:"Run `npx @capacitor/assets generate` (or add the icon set in Xcode)."}];let B=dp(wW(Q,"Contents.json"));if(B===null)return[{id:"ios/appicon-empty-or-placeholder",severity:"error",title:"AppIcon Contents.json is missing or malformed",detail:"The app-icon Contents.json could not be parsed as JSON.",fix:"Regenerate the icon set (`npx @capacitor/assets generate`) or fix the malformed Contents.json."}];if((B.images??[]).some((J)=>J.filename?.trim()))return[];return[{id:"ios/appicon-empty-or-placeholder",severity:LSA(A)?"error":"warning",title:"AppIcon.appiconset declares no icon images",detail:LSA(A)?"The icon set has no images - App Store upload will reject it (ITMS-90704).":"The icon set has no images. The build tolerates this for ad_hoc/development, but App Store upload would reject it.",fix:"Run `npx @capacitor/assets generate` so the set has at least the 1024x1024 icon."}]}},QRQ={id:"ios/appicon-referenced-file-missing",platforms:["ios"],appliesTo(A){let Q=lp(A.projectDir,XW(A.projectDir)??void 0);return dp(wW(Q,"Contents.json"))!==null},async run(A){let Q=lp(A.projectDir,p9A(A)??void 0),B=dp(wW(Q,"Contents.json"));if(B===null)return[];let $=[];for(let J of B.images??[]){let Y=J.filename?.trim();if(!Y)continue;if(!zL(wW(Q,Y)))$.push(Y)}if($.length===0)return[];return[{id:"ios/appicon-referenced-file-missing",severity:"error",title:"AppIcon Contents.json references icon file(s) missing from disk",detail:`actool will fail the build: missing ${$.join(", ")}.`,fix:"Regenerate the icons (`npx @capacitor/assets generate`) or commit the referenced PNG(s)."}]}},BRQ={id:"ios/appicon-marketing-missing",platforms:["ios"],appliesTo:LSA,async run(A){let Q=lp(A.projectDir,p9A(A)??void 0),B=dp(wW(Q,"Contents.json"));if(B===null)return[];if(lVQ(B))return[];return[{id:"ios/appicon-marketing-missing",severity:"error",title:"App Store marketing icon (1024x1024) is missing",detail:"App Store upload requires a 1024x1024 marketing icon in the AppIcon set (ITMS-90704).",fix:"Add a 1024x1024 PNG (no alpha) marketing icon and reference it in Contents.json."}]}},en0=/\.iOS\(\.v(\d+)\)/,$RQ={id:"ios/spm-deployment-target-consistency",platforms:["ios"],appliesTo(A){if(!CSA(A))return!1;let Q=XW(A.projectDir);if(Q===null)return!1;return mp(Q)!==null},async run(A){let Q=p9A(A);if(Q===null)return[];let B=mp(Q);if(B===null)return[];let $=K6(NSA(A.projectDir));if($===null)return[];let J=$.match(en0);if(!J)return[];let Y=Number.parseFloat(J[1]);if(Number.isNaN(Y)||B>=Y)return[];return[{id:"ios/spm-deployment-target-consistency",severity:"warning",title:"IPHONEOS_DEPLOYMENT_TARGET is below the Package.swift iOS minimum",detail:`The Xcode app target builds for iOS ${B} but Package.swift requires iOS ${Y} (.iOS(.v${Y})).`,fix:`Raise IPHONEOS_DEPLOYMENT_TARGET to >= ${Y}, or run \`npx cap sync ios\`.`}]}}});function RG(A){return XW(A.projectDir)}function VSA(A){return UK(A).filter((Q)=>Q.productType===Ar0)}function $r0(A){return Qr0[A]??Br0}function YRQ(A){return mp(A)}function i9A(A,Q){let B=A.find((J)=>J.name==="Release")?.settings[Q];if(B!==void 0)return B;let $=A.find((J)=>J.name==="Debug")?.settings[Q];if($!==void 0)return $;for(let J of A)if(J.settings[Q]!==void 0)return J.settings[Q];return}function XRQ(A){let Q=[];for(let{target:B,configs:$}of AD(A)){if(i9A($,"CODE_SIGN_STYLE")===void 0)continue;let Y=i9A($,"DEVELOPMENT_TEAM");if(Y===void 0||Y.trim()==="")Q.push(B.name)}return Q}function Jr0(A){let Q=[];for(let{target:B,configs:$}of AD(A)){let J=$.map((Z)=>Z.settings.PRODUCT_BUNDLE_IDENTIFIER).filter((Z)=>Z!==void 0);if(J.length<2)continue;let Y=Array.from(new Set(J));if(Y.length>=2)Q.push({name:B.name,values:Y})}return Q}function GRQ(A){return ISA(A).filter((Q)=>Q.settings.ENABLE_BITCODE==="YES").map((Q)=>Q.isProjectLevel?`project ${Q.name}`:Q.name)}function Yr0(A){let Q=[];for(let{target:B,configs:$}of AD(A)){let J=i9A($,"SWIFT_VERSION");if(J===void 0)continue;let Y=J.match(/^\s*(\d+(?:\.\d+)?)/),Z=Y?Number.parseFloat(Y[1]):Number.NaN;if(Number.isNaN(Z)||Z<5)Q.push({name:B.name,value:J})}return Q}var Ar0="com.apple.product-type.application",Qr0,Br0=14,WRQ,ZRQ=(A)=>eq(A).length>0,KRQ,HRQ,FRQ,zRQ,URQ,qRQ;var DRQ=b(()=>{r7();WSA();gk();c9A();Qr0={5:13,6:13,7:14,8:14};WRQ={id:"ios/xcode-deployment-target-capacitor",platforms:["ios"],appliesTo:(A)=>{if(kk(A.projectDir)===null)return!1;let Q=RG(A);return Q!==null&&YRQ(Q)!==null},async run(A){let Q=RG(A);if(!Q)return[];let B=kk(A.projectDir),$=YRQ(Q);if(B===null||$===null)return[];let J=$r0(B);if($>=J)return[];return[{id:"ios/xcode-deployment-target-capacitor",severity:"error",title:`IPHONEOS_DEPLOYMENT_TARGET ${$} is below the Capacitor ${B} floor (${J})`,detail:`Capacitor ${B} requires iOS deployment target >= ${J}; the build will fail otherwise.`,fix:`Raise IPHONEOS_DEPLOYMENT_TARGET to >= ${J} (project + app target) and the Podfile platform line if present.`}]}};KRQ={id:"ios/xcode-signing-team",platforms:["ios"],appliesTo:(A)=>{if(ZRQ(A))return!1;let Q=RG(A);return Q!==null&&XRQ(Q).length>0},async run(A){if(ZRQ(A))return[];let Q=RG(A);if(!Q)return[];let B=XRQ(Q);if(B.length===0)return[];return[{id:"ios/xcode-signing-team",severity:jW(A)?"error":"warning",title:`${B.length} signable target(s) set a code-signing style but no DEVELOPMENT_TEAM`,detail:`targets without a team: ${B.join(", ")}`,fix:"Set DEVELOPMENT_TEAM in Xcode (Signing & Capabilities), or supply signing creds/profiles to the cloud build so it switches to managed-manual signing."}]}};HRQ={id:"ios/xcode-bundle-id-mismatch-across-configs",platforms:["ios"],appliesTo:(A)=>{let Q=RG(A);return Q!==null&&AD(Q).some((B)=>{return B.configs.map((J)=>J.settings.PRODUCT_BUNDLE_IDENTIFIER).filter((J)=>J!==void 0).length>=2})},async run(A){let Q=RG(A);if(!Q)return[];let B=Jr0(Q);if(B.length===0)return[];return[{id:"ios/xcode-bundle-id-mismatch-across-configs",severity:"warning",title:`PRODUCT_BUNDLE_IDENTIFIER differs across build configs in ${B.length} target(s)`,detail:B.map(($)=>`${$.name}: ${$.values.join(" vs ")}`).join("; "),fix:"Align PRODUCT_BUNDLE_IDENTIFIER across Debug/Release (or ignore if a Debug suffix is intentional)."}]}};FRQ={id:"ios/xcode-enable-bitcode-leftover",platforms:["ios"],appliesTo:(A)=>{let Q=RG(A);return Q!==null&&GRQ(Q).length>0},async run(A){let Q=RG(A);if(!Q)return[];let B=GRQ(Q);if(B.length===0)return[];return[{id:"ios/xcode-enable-bitcode-leftover",severity:"warning",title:"ENABLE_BITCODE = YES is set (deprecated since Xcode 14)",detail:`present in: ${B.join(", ")}`,fix:"Set ENABLE_BITCODE = NO or delete it — Xcode 14+ ignores bitcode and Apple no longer accepts it."}]}};zRQ={id:"ios/xcode-swift-version-sanity",platforms:["ios"],appliesTo:(A)=>{let Q=RG(A);return Q!==null&&AD(Q).some((B)=>i9A(B.configs,"SWIFT_VERSION")!==void 0)},async run(A){let Q=RG(A);if(!Q)return[];let B=Yr0(Q);if(B.length===0)return[];return[{id:"ios/xcode-swift-version-sanity",severity:"warning",title:`SWIFT_VERSION is below 5 (or unparseable) in ${B.length} target(s)`,detail:B.map(($)=>`${$.name}: ${$.value}`).join("; "),fix:"Set SWIFT_VERSION = 5.0 (or your intended Swift >= 5) for the affected target(s)."}]}},URQ={id:"ios/xcode-no-app-target",platforms:["ios"],appliesTo:(A)=>RG(A)!==null,async run(A){let Q=RG(A);if(!Q)return[];if(VSA(Q).length>0)return[];return[{id:"ios/xcode-no-app-target",severity:"error",title:"No application target found in the Xcode project",detail:"The pbxproj parsed but contains no com.apple.product-type.application target — the build has nothing to archive.",fix:"Run `npx cap sync ios`, or restore the application target in Xcode."}]}},qRQ={id:"ios/xcode-multiple-app-targets",platforms:["ios"],appliesTo:(A)=>{let Q=RG(A);return Q!==null&&VSA(Q).length>1},async run(A){let Q=RG(A);if(!Q)return[];let B=VSA(Q);if(B.length<=1)return[];return[{id:"ios/xcode-multiple-app-targets",severity:"warning",title:`${B.length} application targets found — the build may sign/archive the wrong one`,detail:`app targets: ${B.map(($)=>`${$.name} (${$.bundleId})`).join(", ")}`,fix:"Keep a single application target, remove the duplicate, or pass the intended scheme to the build."}]}}});import{createRequire as Zr0}from"node:module";import{existsSync as hk}from"node:fs";import{dirname as Xr0,join as zz}from"node:path";function Gr0(A){let Q=K6(zz(A,"package.json"));if(!Q)return[];let B;try{B=JSON.parse(Q)}catch{return[]}let $=new Set(["@capacitor/core","@capacitor/cli","@capacitor/ios","@capacitor/android","@capacitor/assets","@capacitor/synapse"]);return Object.keys(B.dependencies??{}).filter((J)=>J.startsWith("@capacitor/")&&!$.has(J))}function Wr0(A){return A.replace(/^@/,"").replace(/\//g,"-")}function Kr0(A,Q){try{let $=Zr0(zz(A,"package.json")).resolve(`${Q}/package.json`);return hk(zz(Xr0($),"android"))}catch{return!1}}var IRQ,MRQ,ORQ;var LRQ=b(()=>{oq();IRQ={id:"shared/cap-sync-stale",platforms:["ios","android"],async run(A){let Q=[],B=A.config?.webDir??"dist";if(!hk(zz(A.projectDir,B)))return Q.push({id:"shared/cap-sync-stale",severity:"error",title:`webDir "${B}" does not exist — web assets were never built`,fix:"Run your web build (e.g. `npm run build`) then `npx cap sync` before requesting a build"}),Q;let $=Gr0(A.projectDir),J=$.filter((Z)=>Kr0(A.projectDir,Z)),Y=v9(A.config,A.platform);if(A.platform==="android"&&J.length>0){let Z=K6(zz(A.projectDir,Y,"capacitor.settings.gradle"));if(Z===null)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${Y}/capacitor.settings.gradle is missing — \`npx cap sync android\` was never run`,fix:"Run `npx cap sync android`"});else{let X=J.filter((G)=>!Z.includes(`:${Wr0(G)}`));if(X.length>0)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${X.length} Capacitor plugin(s) not synced into the Android project`,detail:`missing from capacitor.settings.gradle: ${X.join(", ")}`,fix:"Run `npx cap sync android` (sync, not copy — copy does not regenerate plugin projects)"})}}if(A.platform==="ios"&&$.length>0){let Z=hk(zz(A.projectDir,Y,"App","Podfile")),X=hk(zz(A.projectDir,Y,"App","CapApp-SPM","Package.swift"));if(!Z&&!X)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${Y}/App sync artifacts are missing — \`npx cap sync ios\` was never run`,detail:`expected ${Y}/App/Podfile (CocoaPods) or ${Y}/App/CapApp-SPM/Package.swift (SPM)`,fix:"Run `npx cap sync ios`"})}return Q}},MRQ={id:"shared/node-linker-layout",platforms:["ios","android"],async run(A){let Q=zz(A.projectDir,"node_modules");if(hk(zz(Q,".bun")))return[{id:"shared/node-linker-layout",severity:"error",title:'bun isolated node_modules layout detected — Capacitor Gradle/Pod paths will not resolve ("No variants exist")',fix:"Reinstall with `bun install --linker=hoisted`"}];if(hk(zz(Q,".pnpm")))return[{id:"shared/node-linker-layout",severity:"warning",title:"pnpm symlinked node_modules layout detected — Capacitor native builds often need a hoisted layout",fix:"If the build fails resolving @capacitor/* paths, set `node-linker=hoisted` in .npmrc and reinstall"}];return[]}},ORQ={id:"shared/bundle-id-consistency",platforms:["ios","android"],async run(A){let Q=A.config?.appId??A.appId;if(A.platform==="android"){let Z=wp(A.projectDir);if(Z&&Z!==Q)return[{id:"shared/bundle-id-consistency",severity:"warning",title:"Gradle applicationId differs from the Capacitor appId",detail:`capacitor.config appId: ${Q} — android/app/build.gradle applicationId: ${Z}`,fix:"Align them (or pass the intended appId explicitly to `build request`)"}];return[]}let{findSignableTargets:B,readPbxproj:$}=await Promise.resolve().then(() => (r7(),vy)),J=$(A.projectDir);if(!J)return[];let Y=B(J);if(Y.length>0&&!Y.some((Z)=>Z.bundleId===Q))return[{id:"shared/bundle-id-consistency",severity:"warning",title:"No Xcode target uses the Capacitor appId as its bundle identifier",detail:`capacitor appId: ${Q} — targets: ${Y.map((Z)=>`${Z.name}=${Z.bundleId}`).join(", ")}`,fix:"Align PRODUCT_BUNDLE_IDENTIFIER with the appId, or build with the intended appId"}];return[]}}});var NRQ,CRQ;var VRQ=b(()=>{NRQ={id:"shared/apikey-permission",platforms:["ios","android"],remote:!0,async run(A){let{data:Q,error:B}=await A.supabase.rpc("cli_check_permission",{apikey:A.apikey??"",permission_key:"app.build_native",org_id:null,app_id:A.appId,channel_id:null});if(B)return[{id:"shared/apikey-permission",severity:"info",title:"Could not verify Capgo build permission (network/API error)",detail:B.message}];if(Q!==!0)return[{id:"shared/apikey-permission",severity:"error",title:`Capgo could not authorize app.build_native for ${A.appId}`,detail:"Capgo could not authorize the requested permission for this API key and app.",fix:"Use a Capgo apikey from the org that owns the app (role with native-build rights), or fix the appId"}];return[]}},CRQ={id:"shared/app-exists",platforms:["ios","android"],remote:!0,async run(A){let{data:Q,error:B}=await A.supabase.from("apps").select("app_id").eq("app_id",A.appId).maybeSingle();if(B)return[{id:"shared/app-exists",severity:"info",title:"Could not verify app existence (network/API error)",detail:B.message}];if(!Q)return[{id:"shared/app-exists",severity:"error",title:`Capgo: app ${A.appId} is not visible to this Capgo API key`,detail:"Either the app does not exist in Capgo or it belongs to an org this Capgo key cannot access.",fix:`Create it (npx @capgo/cli@latest app add ${A.appId}) or pass the right appId / Capgo apikey`}];return[]}}});function qr0(A){let Q;try{Q=JSON.parse(new TextDecoder().decode(A))}catch(J){throw Error(`Service account file is not valid JSON: ${J instanceof Error?J.message:String(J)}`)}if(!Q||typeof Q!=="object")throw Error("Service account file is not a JSON object.");let B=Q;if(B.type!=="service_account")throw Error(`Expected "type": "service_account" — found ${JSON.stringify(B.type)}. This file is not a service account key.`);let $=["client_email","private_key","project_id","token_uri"];for(let J of $){let Y=B[J];if(typeof Y!=="string"||Y.length===0)throw Error(`Service account JSON is missing required field "${J}".`)}if(!Ur0.has(B.token_uri))throw Error("Service account JSON has an unsupported token_uri. Expected a Google OAuth token endpoint.");return{type:"service_account",client_email:B.client_email,private_key:B.private_key,project_id:B.project_id,token_uri:B.token_uri,private_key_id:typeof B.private_key_id==="string"?B.private_key_id:void 0,client_id:typeof B.client_id==="string"?B.client_id:void 0}}function Dr0(A){let Q=Math.floor(Date.now()/1000);return ERQ.default.sign({iss:A.client_email,scope:Hr0,aud:A.token_uri,exp:Q+Fr0,iat:Q},A.private_key,{algorithm:"RS256",header:{alg:"RS256",typ:"JWT",kid:A.private_key_id??""}})}async function Ir0(A){let Q=new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:A.assertion}),B=await RSA({url:A.key.token_uri,init:{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:Q.toString()},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl}),$=await B.text();if(!B.ok){let Y=`${B.status} ${B.statusText}`;try{let Z=JSON.parse($);if(Z.error)Y=Z.error_description?`${Z.error}: ${Z.error_description}`:Z.error}catch{}if(B.status>=500||B.status<400)throw new pp(`Google's token endpoint returned ${Y}. Try again in a moment.`);throw Error(`Google rejected the service account credentials (${Y}). The private key may be revoked or invalid.`)}let J;try{J=JSON.parse($)}catch{throw new pp(`Google's token endpoint returned a non-JSON response (${B.status}).`)}if(typeof J.access_token!=="string"||J.access_token.length===0)throw new pp("Google's token response was missing an access_token field.");return J.access_token}async function RSA(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),A.timeoutMs),$,J=null;if(A.signal){let Y=new AbortController;if(J=()=>Y.abort(),A.signal.addEventListener("abort",J,{once:!0}),Q.signal.addEventListener("abort",J,{once:!0}),A.signal.aborted||Q.signal.aborted)Y.abort();$=Y.signal}else $=Q.signal;try{return await A.fetchImpl(A.url,{...A.init,signal:$})}finally{if(clearTimeout(B),J)A.signal?.removeEventListener("abort",J),Q.signal.removeEventListener("abort",J)}}async function Mr0(A){let Q=`${RRQ}/applications/${encodeURIComponent(A.packageName)}/edits`,B;try{B=await RSA({url:Q,init:{method:"POST",headers:{Authorization:`Bearer ${A.accessToken}`,"Content-Type":"application/json",Accept:"application/json"},body:"{}"},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl})}catch(Z){return{kind:"network",detail:Z instanceof Error?Z.message:String(Z)}}let $=await B.text();if(fB(`probeAppAccess: POST ${Q} → HTTP ${B.status} ${B.statusText}${B.ok?"":` :: ${$.slice(0,300)}`}`),B.status===401||B.status===403||B.status===404)return{kind:"no-access",detail:Or0($)??`${B.status} ${B.statusText}`};if(!B.ok)return{kind:"network",detail:`${B.status} ${B.statusText}: ${$.slice(0,200)}`};let J;try{J=JSON.parse($)}catch{return{kind:"network",detail:"Play API returned non-JSON on edits.insert"}}if(typeof J.id!=="string"||J.id.length===0)return{kind:"network",detail:"Play API returned no edit id"};let Y=`${RRQ}/applications/${encodeURIComponent(A.packageName)}/edits/${encodeURIComponent(J.id)}`;try{await RSA({url:Y,init:{method:"DELETE",headers:{Authorization:`Bearer ${A.accessToken}`}},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl})}catch{}return{kind:"ok"}}function Or0(A){try{let Q=JSON.parse(A);if(Q.error?.message)return Q.error.status?`${Q.error.status}: ${Q.error.message}`:Q.error.message}catch{}return null}async function Uz(A){let Q=A.timeoutMs??zr0,B=A.fetchImpl??globalThis.fetch.bind(globalThis),$;try{$=qr0(A.jsonBytes)}catch(Z){return{ok:!1,kind:"shape-error",message:Z instanceof Error?Z.message:String(Z)}}if(A.signal?.aborted)return{ok:!1,kind:"network-error",message:"Validation cancelled."};let J;try{let Z=Dr0($);J=await Ir0({key:$,assertion:Z,signal:A.signal,timeoutMs:Q,fetchImpl:B})}catch(Z){let X=Z instanceof Error?Z.message:String(Z),G=Z?.name==="AbortError",W=Z instanceof pp,K=/timeout|timed out|network|fetch failed|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i.test(X);if(G||W||K)return{ok:!1,kind:"network-error",message:X};return{ok:!1,kind:"token-error",message:X}}if(A.signal?.aborted)return{ok:!1,kind:"network-error",message:"Validation cancelled."};let Y=await Mr0({accessToken:J,packageName:A.packageName,signal:A.signal,timeoutMs:Q,fetchImpl:B});if(Y.kind==="ok")return{ok:!0,serviceAccountEmail:$.client_email,projectId:$.project_id};if(Y.kind==="no-access")return{ok:!1,kind:"no-app-access",serviceAccountEmail:$.client_email,message:`Service account "${$.client_email}" cannot access package "${A.packageName}" on Google Play (${Y.detail}). Create the app in Play Console (if it does not exist yet), invite this service account under Users and permissions, and grant release access for this app — or skip Play upload and get the AAB via Capgo with --no-playstore-upload --output-upload.`};return{ok:!1,kind:"network-error",message:Y.detail}}var ERQ,Hr0="https://www.googleapis.com/auth/androidpublisher",RRQ="https://androidpublisher.googleapis.com/androidpublisher/v3",Fr0=3600,zr0=30000,Ur0,pp;var ip=b(()=>{$7();ERQ=tA(m$A(),1),Ur0=new Set(["https://oauth2.googleapis.com/token","https://accounts.google.com/o/oauth2/token","https://www.googleapis.com/oauth2/v4/token"]);pp=class pp extends Error{constructor(A){super(A);this.name="TokenExchangeTransientError"}}});function ESA(A,Q){if(typeof A!=="string")return;let B=i7(A);for(let $ of Q)if($)B=B.replaceAll($,"[REDACTED IDENTIFIER]");return B=B.replace(/\p{Cc}+/gu," ").replace(/\s+/g," ").trim(),B?B.slice(0,Vr0):void 0}async function jRQ(A){let Q=A.fetchImpl??globalThis.fetch.bind(globalThis),B=A.timeoutMs??Nr0;if(A.signal?.aborted)return{ok:!1,kind:"network",message:"App Store Connect check cancelled."};let $;try{$=rO(A.keyId,A.issuerId,A.p8Pem)}catch{return{ok:!1,kind:"auth-error",message:"Invalid App Store Connect key material (.p8 / Key ID / Issuer ID). The CLI could not build a JWT, so Apple was never contacted."}}let J=new AbortController,Y=setTimeout(()=>J.abort(),B),Z=()=>J.abort();A.signal?.addEventListener("abort",Z,{once:!0});let G=`/apps${A.bundleId?`?filter[bundleId]=${encodeURIComponent(A.bundleId)}&limit=1`:"?limit=1"}`;try{let W=await Q(`${Lr0}${G}`,{signal:J.signal,headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"}}),K=await W.json().catch(()=>null);if(!W.ok){let H=(K?.errors??[])[0];fB(`apple-access GET ${G}: HTTP ${W.status} ${W.statusText} ${JSON.stringify(K?.errors??null)} | ${LK(W.headers)}`);let z=new cR(W.status,H?`Apple API error (${W.status}): ${H.title} - ${H.detail} (${H.code})`:`Apple API error: HTTP ${W.status} ${W.statusText}`,H?.code),q=q_A(z),D=[A.keyId,A.issuerId],I={status:W.status,code:ESA(H?.code,D),title:ESA(H?.title,D),detail:ESA(H?.detail,D)};if(q.is401or403)return{ok:!1,kind:"auth-error",message:q.message,...I};return{ok:!1,kind:"network",message:`App Store Connect returned HTTP ${W.status}.`,...I}}if(fB(`apple-access GET ${G}: HTTP ${W.status} | ${LK(W.headers)}`),A.bundleId){if(!I_A(K).some((q)=>q.bundleId===A.bundleId))return{ok:!1,kind:"no-app-access",message:`The App Store Connect API key cannot see an app with bundle id ${A.bundleId}. Create it in App Store Connect, or skip TestFlight and get an IPA with --ios-distribution ad_hoc --output-upload.`}}return{ok:!0}}catch(W){let K=W instanceof Error?W.message:String(W);if(W?.name==="AbortError"||J.signal.aborted||Cr0.test(K))return{ok:!1,kind:"network",message:"Could not reach App Store Connect (network error or timeout)."};return{ok:!1,kind:"network",message:"App Store Connect check failed unexpectedly."}}finally{clearTimeout(Y),A.signal?.removeEventListener("abort",Z)}}var Lr0="https://api.appstoreconnect.apple.com/v1",Nr0=7000,Cr0,Vr0=500;var wRQ=b(()=>{$7();$M();pR();Cr0=/timeout|timed out|network|fetch failed|aborted|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i});import{Buffer as Rr0}from"node:buffer";function kRQ(A){return[[A.code?`[${A.code}]`:"",A.title??""].filter(Boolean).join(" "),A.detail].filter(Boolean).join(" - ")||A.message}function Pr0(A){return Boolean(A.status===403&&(A.code&&Er0.has(A.code)||/\bPLA_NOT_ACCEPTED\b|required agreement|program license agreement/i.test(`${A.code??""} ${A.title??""} ${A.detail??""}`)))}function _r0(A){if(A.status===401)return!0;if(A.status!==403)return!1;return jr0.test(A.code??"")||wr0.test(`${A.title??""} ${A.detail??""}`)}function Tr0(A){let Q=kRQ(A);if(Pr0(A))return{id:"ios/asc-key-access",severity:"error",enforceAfter:PRQ,title:"Apple blocked App Store Connect API access (HTTP 403): unsigned or expired agreement",detail:Q,fix:"Ask the Account Holder to accept pending agreements in App Store Connect → Business, then retry."};if(_r0(A))return{id:"ios/asc-key-access",severity:"error",enforceAfter:PRQ,title:`Apple rejected the App Store Connect API key during preflight (HTTP ${A.status})`,detail:Q,fix:TRQ};if(A.status===403)return{id:"ios/asc-key-access",severity:"warning",title:"Apple denied the App Store Connect preflight request (HTTP 403)",detail:`${Q} This /v1/apps probe differs from the TestFlight upload path, so the build may still succeed.`,fix:"Review Apple's reason and confirm the App Store Connect key can access the target app. Use --fail-on-warnings only if this probe must be strict."};if(A.status!==void 0)return{id:"ios/asc-key-access",severity:"warning",title:`App Store Connect preflight returned HTTP ${A.status}`,detail:Q,fix:"Retry the preflight. The build will still attempt the upload because this response does not prove the credentials are invalid."};return{id:"ios/asc-key-access",severity:"error",title:"Invalid App Store Connect key material (.p8 / Key ID / Issuer ID)",detail:Q||"The CLI could not build an App Store Connect JWT from the credentials you provided, so Apple was never contacted.",fix:TRQ}}function bRQ(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),A);return{signal:Q.signal,clear:()=>clearTimeout(B)}}function Sr0(A){return{id:"android/play-sa-access",platforms:["android"],appliesTo:(Q)=>kp(Q),async run(Q){let B=Q.credentials?.PLAY_CONFIG_JSON;if(!B)return[];let $=nNQ(Q.projectDir,Q.androidFlavor),J=$.packageName??Q.config?.appId??Q.appId,Y=Rr0.from(B,"base64"),{signal:Z,clear:X}=bRQ(n9A),G;try{G=await A({jsonBytes:Y,packageName:J,signal:Z,timeoutMs:n9A})}finally{X()}if(G.ok)return[];switch(G.kind){case"no-app-access":return[{id:"android/play-sa-access",severity:$.ambiguous?"warning":"error",title:$.ambiguous?"Google Play access could not be verified: app missing or service account has no access":"Google Play upload blocked: app missing or service account has no access",detail:G.message,fix:_RQ}];case"token-error":return[{id:"android/play-sa-access",severity:"error",title:"Google rejected the Play service-account key",detail:"The service-account JSON failed to authenticate with Google. Re-download a fresh key from the Google Cloud console.",fix:_RQ}];case"network-error":return[{id:"android/play-sa-access",severity:"info",title:"Could not verify Play service-account access (network error or timeout)",detail:"The build will still attempt the upload; this check is best-effort and skipped offline."}];case"shape-error":return[{id:"android/play-sa-access",severity:"info",title:"Skipped Play access check (service-account JSON shape problem)",detail:"See the android/play-sa-json finding for the shape error."}];default:return[]}}}}function kr0(A){return{id:"ios/asc-key-access",platforms:["ios"],appliesTo:(Q)=>jW(Q),async run(Q){let{APPLE_KEY_ID:B,APPLE_ISSUER_ID:$,APPLE_KEY_CONTENT:J}=Q.credentials??{};if(!B||!$||!J)return[];let Y="";try{Y=SRQ.default.util.decode64(J)}catch{return[]}if(!Y.includes("-----BEGIN PRIVATE KEY-----"))return[];let Z=await br0(Q),{signal:X,clear:G}=bRQ(n9A),W;try{W=await A({keyId:B,issuerId:$,p8Pem:Y,bundleId:Z,signal:X,timeoutMs:n9A})}finally{G()}if(W.ok)return[];switch(W.kind){case"auth-error":return[Tr0(W)];case"no-app-access":return[{id:"ios/asc-key-access",severity:"warning",title:"App Store Connect API key cannot see this app",detail:W.message,fix:"Confirm the app exists in App Store Connect and the API key role can access it, or fix the bundle identifier. If you only need an IPA download (no TestFlight), re-run with --ios-distribution ad_hoc --output-upload."}];case"network":return[{id:"ios/asc-key-access",severity:"warning",title:W.status?`App Store Connect preflight returned HTTP ${W.status}`:"Could not verify App Store Connect access (network error or timeout)",detail:W.status?`${kRQ(W)} The build will still attempt the upload.`:"The build will still attempt the upload; retry when network access is available."}];default:return[]}}}}async function br0(A){try{let{findSignableTargets:Q,readPbxproj:B}=await Promise.resolve().then(() => (r7(),vy)),$=B(A.projectDir);if(!$)return A.config?.appId??A.appId;let J=Q($),Y=A.config?.appId??A.appId;return(J.find((X)=>X.bundleId===Y)??J[0])?.bundleId??Y}catch{return A.config?.appId??A.appId}}var SRQ,n9A=7000,PRQ="2026-08-17T00:00:00.000Z",_RQ="Invite the Google Play service-account email in Play Console → Users and permissions and grant release access for this app. If the Play app does not exist yet and you only need the AAB, re-run with --no-playstore-upload --output-upload.",TRQ="Fix the App Store Connect API key: check Key ID / Issuer ID / .p8, and confirm the key has Admin or Developer access (or ask the Account Holder to accept pending agreements).",Er0,jr0,wr0,xRQ,vRQ;var fRQ=b(()=>{ip();wRQ();oq();SRQ=tA(dS(),1),Er0=new Set(["FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED","FORBIDDEN_ERROR.PLA_NOT_ACCEPTED"]),jr0=/(?:^|[._-])(NOT_AUTHORIZED|UNAUTHORIZED|AUTHENTICATION(?:_ERROR)?|INVALID_(?:TOKEN|CREDENTIALS?))(?:$|[._-])/i,wr0=/authentication credentials? (?:are )?(?:missing or invalid)|invalid (?:bearer )?token|token (?:is )?(?:invalid|expired)/i;xRQ=Sr0(Uz),vRQ=kr0(jRQ)});var xr0="2026-08-14T00:00:00.000Z",vr0="2026-08-17T00:00:00.000Z",fr0,jSA,gRQ;var yRQ=b(()=>{zCQ();LCQ();dCQ();pCQ();y9A();YSA();c9A();WVQ();PVQ();dVQ();JRQ();DRQ();LRQ();VRQ();fRQ();fr0=[SVQ,kVQ,bVQ,xVQ,vVQ,fVQ,gVQ,yVQ,hVQ,uVQ,mVQ,cVQ,WRQ,KRQ,HRQ,FRQ,zRQ,URQ,qRQ,VVQ,RVQ,EVQ,jVQ,wVQ,ZVQ,XVQ,GVQ,aVQ,oVQ,sVQ,tVQ,eVQ,ARQ,QRQ,BRQ,$RQ].map((A)=>({...A,enforceAfter:xr0})),jSA=[NRQ,CRQ,lCQ,IRQ,MRQ,ORQ,rCQ,{...aCQ,enforceAfter:vr0},oCQ,eCQ,AVQ,QVQ,BVQ,$VQ,JVQ,rNQ,sCQ,MCQ,OCQ,jCQ,wCQ,PCQ,TCQ,SCQ,eNQ,ACQ,QCQ,BCQ,$CQ,JCQ,YCQ,ZCQ,XCQ,GCQ,WCQ,KCQ,HCQ,kCQ,bCQ,xCQ,vCQ,fCQ,gCQ,yCQ,hCQ,uCQ,mCQ,cCQ,xRQ,vRQ,...fr0],gRQ=jSA.map((A)=>A.id)});import{env as gr0,stdout as yr0}from"node:process";function mr0(){return Boolean(yr0.isTTY)&&!gr0.NO_COLOR}function wSA(A,Q={}){let B=Q.color??mr0(),$=Q.now??new Date,J=(z,q)=>B?`${z}${q}${WZ.reset}`:q,Y=[];for(let z of hr0)for(let q of A.findings.filter((D)=>D.severity===z)){let D=!jp(q,$),I=D?z==="error"?"✖ CRITICAL — INFORMATION ONLY":`${hRQ[z].trim()} — INFORMATION ONLY`:hRQ[z];if(Y.push(`${J(ur0[z],I)} ${q.title} ${J(WZ.dim,`[${q.id}]`)}`),q.detail)Y.push(J(WZ.dim,` ${q.detail}`));if(q.fix)Y.push(J(WZ.dim,` fix: ${q.fix}`));if(q.docsUrl)Y.push(J(WZ.dim,` docs: ${q.docsUrl}`));if(D&&q.enforceAfter&&!(Q.ignoreFatal&&z==="error")){let M=z==="error"?"this critical finding is information only now and will fail builds":"this finding is information only now and can affect build outcomes";Y.push(J(WZ.dim,` rollout: ${M} starting ${QSA(q.enforceAfter)}`))}}let{error:Z,warning:X,info:G}=A.counts;Y.push("");let W=`prescan: ${A.checksRun} checks in ${A.durationMs}ms — ${Z} error(s), ${X} warning(s), ${G} info`,K=Z>0?WZ.red:X>0?WZ.yellow:WZ.dim;Y.push(J(K,W));let H=_k(A,$).filter((z)=>!(Q.ignoreFatal&&z.severity==="error"));if(H.length>0)Y.push(J(WZ.dim,`rollout: ${H.length} finding(s) are information only until their enforcement deadline`));if(Q.verbose)Y.push(J(WZ.dim,`remote checks skipped: ${A.skippedRemote}`));return Y.join(`
|
|
1027
|
+
`)){let $=B.match(/^\s*([A-Z0-9_]+(?:\[[^\]]*\])?)\s*=\s*(.+?);\s*$/i);if(!$)continue;let J=$[1],Y=$[2].trim();if(Y.startsWith("("))continue;if(Y.length>=2&&Y.startsWith('"')&&Y.endsWith('"'))Y=Y.slice(1,-1);Q[J]=Y}return Q}function DSA(A){if(!A)return[];let Q=/(\w+)\s*\/\*[^*]*\*\/\s*=\s*\{[^{}]*isa\s*=\s*XCBuildConfiguration;(?:[^{}]*\{[^}]*\})*[^}]*\}/g,B=[];for(let $ of A.matchAll(Q)){let J=$[0],Y=$[1],Z=J.match(/\bname\s*=\s*("[^"]*"|[^;\s]+)\s*;/),X=Z?Z[1].replace(/^"|"$/g,""):"";B.push({id:Y,name:X,settings:Un0(zn0(J))})}return B}function qn0(A){let Q=A.match(/isa\s*=\s*PBXProject;[\s\S]*?buildConfigurationList\s*=\s*(\w+)/)?.[1];if(!Q)return new Set;return KVQ(A,Q)}function KVQ(A,Q){let B=new RegExp(`${Fn0(Q)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*XCConfigurationList;[^}]*\\}`),$=A.match(B)?.[0];if(!$)return new Set;let J=$.match(/buildConfigurations\s*=\s*\(([^)]*)\)/);if(!J)return new Set;return new Set(Array.from(J[1].matchAll(/(\w+)/g),(Y)=>Y[1]))}function ISA(A){let Q=qn0(A);return DSA(A).map((B)=>({name:B.name,settings:B.settings,isProjectLevel:Q.has(B.id)}))}function hp(A,Q){let B=null;for(let $ of DSA(A)){let J=$.settings[Q];if(J===void 0)continue;if($.name==="Release")return J;if(B===null)B=J}return B}function up(A,Q){let B=A.match(/^\$\(([A-Z0-9_]+)\)$/i),$=A.match(/^\$\{([A-Z0-9_]+)\}$/i),J=B?.[1]??$?.[1];if(!J)return A;return hp(Q,J)??A}function AD(A){if(!A)return[];let Q=UK(A);if(Q.length===0)return[];let B=new Map,$=/\w+\s*\/\*[^*]*\*\/\s*=\s*\{[^}]*isa\s*=\s*PBXNativeTarget;[^}]*\}/g;for(let Z of A.matchAll($)){let X=Z[0],G=X.match(/\bname\s*=\s*("[^"]*"|[^;\s]+)\s*;/),W=X.match(/buildConfigurationList\s*=\s*(\w+)/);if(!G||!W)continue;B.set(G[1].replace(/^"|"$/g,""),W[1])}let J=DSA(A),Y=new Map(J.map((Z)=>[Z.id,Z]));return Q.map((Z)=>{let X=B.get(Z.name),G=X?KVQ(A,X):new Set,W=Array.from(G).map((K)=>Y.get(K)).filter((K)=>K!==void 0).map((K)=>({name:K.name,settings:K.settings}));return{target:Z,configs:W}})}function mp(A){let Q=[],B=($)=>{if($===void 0)return;let J=Number.parseFloat($);if(!Number.isNaN(J))Q.push(J)};for(let $ of ISA(A))if($.isProjectLevel)B($.settings.IPHONEOS_DEPLOYMENT_TARGET);for(let{target:$,configs:J}of AD(A)){if($.productType!==Hn0)continue;for(let Y of J)B(Y.settings.IPHONEOS_DEPLOYMENT_TARGET)}return Q.length>0?Math.min(...Q):null}var Hn0="com.apple.product-type.application";var gk=b(()=>{r7()});import{existsSync as Dn0,readFileSync as FVQ}from"node:fs";import{dirname as HVQ,isAbsolute as In0,join as Mn0,resolve as On0}from"node:path";function Nn0(A,Q){return A.find((B)=>B.name==="Release")?.settings[Q]??A.find((B)=>B.name==="Debug")?.settings[Q]??A.find((B)=>B.settings[Q]!==void 0)?.settings[Q]}function Cn0(A,Q){let B=ZW(A);if(!B)return;let $;try{$=FVQ(B,"utf8")}catch{return}let J=AD($).filter(({target:W})=>W.productType===Ln0),Y=J.find(({target:W,configs:K})=>W.bundleId===Q||K.some((H)=>H.settings.PRODUCT_BUNDLE_IDENTIFIER===Q))??J[0],Z=Y?Nn0(Y.configs,"CODE_SIGN_ENTITLEMENTS"):void 0;if(Z===void 0)return;let X=HVQ(HVQ(B)),G=Z.replace(/\$\((?:SRCROOT|SOURCE_ROOT|PROJECT_DIR)\)|\$\{(?:SRCROOT|SOURCE_ROOT|PROJECT_DIR)\}/g,X);if(/\$\([^)]+\)|\$\{[^}]+\}/.test(G))return null;return In0(G)?G:On0(X,G)}function Fz(A,Q){let B=Cn0(A,Q);if(B===null)return null;let $=B??Mn0(A,"ios","App","App","App.entitlements");if(!Dn0($))return null;try{return{raw:FVQ($,"utf8")}}catch{return null}}function MSA(A,Q){return sq(A,Q)}function yk(A,Q){return Hz(A,Q)}function zVQ(A,Q){return Pp(A,Q)}var Ln0="com.apple.product-type.application";var UVQ=b(()=>{r7();gk()});import{existsSync as Vn0,readFileSync as Rn0}from"node:fs";import{join as NVQ}from"node:path";function OSA(A){return eq(A).find((Q)=>Q.bundleId===(A.nativeAppId??A.appId))}function wn0(A){let Q=NVQ(A,"ios","App","App","Info.plist");if(!Vn0(Q))return!1;try{return Hz(Rn0(Q,"utf8"),"UIBackgroundModes").includes("remote-notification")}catch{return!1}}function CVQ(A){try{return q_(A).profileEntitlements}catch{return{}}}function _n0(A){return Pn0.has(A)||A.endsWith(".team-identifier")}function Tn0(A){return A==="*"||A==="$(AppIdentifierPrefix)*"||/^\$\(\w+\)\*$/.test(A)||/^[A-Z0-9]{10}\.\*$/.test(A)}function IVQ(A){if(qVQ.test(A))return A.replace(qVQ,"");if(DVQ.test(A))return A.replace(DVQ,"");return A}function Sn0(A){let Q=[],B=/<key>([\s\S]*?)<\/key>\s*<(array|string|true|false|dict|integer|real|data|date)(\/)?\s*>/g,$=B.exec(A);while($!==null){let J=$[1].trim(),Y=$[2],Z=$[3]==="/";if(Q.push({key:J,isArray:Y==="array"}),!Z&&(Y==="dict"||Y==="array")){let X=kn0(A,Y,$.index+$[0].length);if(X>B.lastIndex)B.lastIndex=X}$=B.exec(A)}return Q}function kn0(A,Q,B){let $=new RegExp(`<${Q}>|</${Q}>`,"g");$.lastIndex=B;let J=1;for(let Y=$.exec(A);Y!==null;Y=$.exec(A))if(Y[0]===`<${Q}>`)J++;else if(--J===0)return $.lastIndex;return A.length}function fn0(A,Q){let B=K6(NVQ(A,"package.json"));if(B===null)return!1;try{let $=JSON.parse(B);return typeof{...$.devDependencies,...$.dependencies}[Q]==="string"}catch{return!1}}var En0=(A)=>OSA(A)!==void 0,jn0=(A)=>Fz(A.projectDir,A.nativeAppId??A.appId)!==null,Pn0,qVQ,DVQ,VVQ,RVQ,bn0,MVQ="com.apple.developer.associated-domains",EVQ,OVQ="com.apple.security.application-groups",xn0,jVQ,LVQ="@capgo/capacitor-age-range",vn0="com.apple.developer.declared-age-range",wVQ;var PVQ=b(()=>{zM();oq();UVQ();c9A();Pn0=new Set(["aps-environment","get-task-allow","application-identifier"]);qVQ=/^\$\((?:AppIdentifierPrefix|TeamIdentifierPrefix)\)/,DVQ=/^[A-Z0-9]{10}\./;VVQ={id:"ios/entitlements-vs-profile-capability",platforms:["ios"],appliesTo:(A)=>En0(A)&&jn0(A),async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId),B=OSA(A);if(!Q||!B)return[];let $=Sn0(Q.raw).filter((Y)=>!_n0(Y.key));if($.length===0)return[];let J=[];for(let{bundleId:Y,base64:Z}of[B]){let X=CVQ(Z);for(let{key:G,isArray:W}of $)if(W){let K=yk(Q.raw,G),H=X[G],z=Array.isArray(H)?H:typeof H==="string"?[H]:[];if(z.some(Tn0))continue;let q=new Set(z.map(IVQ)),D=K.filter((I)=>!q.has(IVQ(I)));if(D.length>0)J.push({id:"ios/entitlements-vs-profile-capability",severity:"error",title:`Entitlement "${G}" is not fully covered by the provisioning profile for "${Y}"`,detail:`uncovered ${G} value(s): ${D.join(", ")}`,fix:"Enable the capability for this App ID in the Apple Developer portal, regenerate the profile, and re-save credentials (or remove the unused entitlement)"})}else if(!(G in X))J.push({id:"ios/entitlements-vs-profile-capability",severity:"error",title:`Entitlement "${G}" is declared by the app but not granted by the provisioning profile for "${Y}"`,detail:`missing capability: ${G}`,fix:"Enable the capability for this App ID in the Apple Developer portal, regenerate the profile, and re-save credentials (or remove the unused entitlement)"})}return J}},RVQ={id:"ios/entitlements-aps-environment-vs-mode",platforms:["ios"],appliesTo:(A)=>{let Q=Fz(A.projectDir,A.nativeAppId??A.appId);return Q!==null&&MSA(Q.raw,"aps-environment")!==null&&Boolean(A.distributionMode)},async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId);if(!Q)return[];let B=MSA(Q.raw,"aps-environment");if(B===null)return[];let $=OSA(A),J=$?CVQ($.base64)["aps-environment"]:void 0,Y=A.distributionMode==="app_store"&&B==="development"&&J==="production",Z=typeof J==="string"&&J!==B&&!Y,X=[];if(A.distributionMode==="app_store"&&B==="development"&&!Z){let G=wn0(A.projectDir);X.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"warning",title:'aps-environment is "development" but the build distributes to the App Store / TestFlight',detail:G?"The app declares the remote-notification background mode; the App Store export uses the distribution profile's production push environment, so make sure the App ID has the Push Notifications capability":"This is the default Capacitor leftover; the App Store export uses the distribution profile's push environment, so it is harmless unless push is misconfigured",fix:"Optionally set aps-environment=production in App.entitlements (or remove aps-environment if the app does not use push)"})}else if(A.distributionMode==="ad_hoc"&&B==="production"&&!Z)X.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"warning",title:'aps-environment is "production" for an ad_hoc build',detail:"ad_hoc builds usually use the development push environment (production is valid but uncommon)",fix:"Use aps-environment=development for ad_hoc unless you intend production APNs"});if($&&Z)X.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"error",title:`aps-environment differs between App.entitlements and the provisioning profile for "${$.bundleId}"`,detail:`app: ${B} — profile: ${J}`,fix:"Align aps-environment in App.entitlements with the push profile (or regenerate the profile)"});return X}},bn0=/^(?:applinks|webcredentials|activitycontinuation|appclips):[a-z0-9.-]+(?:\?mode=(?:developer|managed))?$/i,EVQ={id:"ios/entitlements-associated-domains-format",platforms:["ios"],appliesTo:(A)=>{let Q=Fz(A.projectDir,A.nativeAppId??A.appId);return Q!==null&&yk(Q.raw,MVQ).length>0},async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId);if(!Q)return[];let B=[];for(let $ of yk(Q.raw,MVQ)){if(/^(?:applinks|webcredentials|activitycontinuation|appclips):\*$/i.test($))continue;if(!bn0.test($))B.push($)}if(B.length===0)return[];return[{id:"ios/entitlements-associated-domains-format",severity:"warning",title:`${B.length} associated-domains entr(y/ies) have an invalid format`,detail:`invalid: ${B.join(", ")}`,fix:'Use the "service:domain" form (e.g. applinks:example.com) — no scheme, path, or trailing slash'}]}},xn0=/^group\.[a-z0-9.-]+$/,jVQ={id:"ios/entitlements-app-groups-format",platforms:["ios"],appliesTo:(A)=>{let Q=Fz(A.projectDir,A.nativeAppId??A.appId);return Q!==null&&yk(Q.raw,OVQ).length>0},async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId);if(!Q)return[];let B=yk(Q.raw,OVQ).filter(($)=>!xn0.test($));if(B.length===0)return[];return[{id:"ios/entitlements-app-groups-format",severity:"warning",title:`${B.length} app group identifier(s) have an invalid format`,detail:`invalid: ${B.join(", ")}`,fix:'Name app groups "group.<reverse-dns>" (lowercase, no whitespace) and register them in the portal'}]}};wVQ={id:"ios/entitlements-declared-age-range",platforms:["ios"],appliesTo:(A)=>fn0(A.projectDir,LVQ)&&jW(A),async run(A){let Q=Fz(A.projectDir,A.nativeAppId??A.appId);if(Q!==null&&zVQ(Q.raw,vn0)===!0)return[];return[{id:"ios/entitlements-declared-age-range",severity:"warning",title:`${LVQ} is installed without the Declared Age Range entitlement`,detail:"The plugin calls Apple's Declared Age Range API. Without com.apple.developer.declared-age-range signed into the binary, in-app age-range requests fail.",fix:"Add com.apple.developer.declared-age-range=<true/> to App.entitlements, enable Declared Age Range on the App ID, and set CODE_SIGN_ENTITLEMENTS."}]}}});import{existsSync as gn0,readFileSync as yn0}from"node:fs";import{join as hn0}from"node:path";function _VQ(A){let Q=hn0(A,...un0);return gn0(Q)?Q:null}function VG(A){let Q=_VQ(A);if(!Q)return null;try{return yn0(Q,"utf8")}catch{return null}}function cp(A){return XW(A)??""}function l9A(A){return A.startsWith("$(")||A.startsWith("${")}function mn0(A){let Q=A.config?.server;if(Q===null||typeof Q!=="object")return!1;let B=Q;return B.cleartext===!0||typeof B.url==="string"&&B.url.length>0}function rn0(A){let Q=Hz(A,"UIRequiredDeviceCapabilities");if(Q.length>0)return Q;let B=JSA(A,"UIRequiredDeviceCapabilities");if(B===null)return[];let $=[];for(let J of B.matchAll(/<key>([\s\S]*?)<\/key>\s*<(true|false)\s*\/>/g))if(J[2]==="true")$.push(J[1].trim());return $}function an0(A){let Q=A.credentials?.CAPGO_IOS_XCODE_VERSION?.trim().replace(/^xcode\s*/i,""),B=Q?Number.parseInt(Q,10):Number.NaN;return Number.isFinite(B)?B:null}var un0,W3=(A)=>_VQ(A.projectDir)!==null,cn0,dn0,ln0,TVQ,pn0,in0,SVQ,kVQ,bVQ,xVQ,vVQ,fVQ,gVQ,yVQ,hVQ,nn0,uVQ,mVQ,cVQ;var dVQ=b(()=>{r7();gk();un0=["ios","App","App","Info.plist"];cn0=/^\d+\.\d+(?:\.\d+)?$/,dn0=/^\d+(?:\.\d+){0,2}$/,ln0=/^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9-]+)+$/i,TVQ=["UIInterfaceOrientationPortrait","UIInterfaceOrientationPortraitUpsideDown","UIInterfaceOrientationLandscapeLeft","UIInterfaceOrientationLandscapeRight"],pn0=new Set(TVQ),in0=new Set(["audio","location","voip","fetch","remote-notification","processing","bluetooth-central","bluetooth-peripheral","external-accessory","newsstand-content"]),SVQ={id:"ios/plist-bundle-id-format",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=sq(Q,"CFBundleIdentifier");if(B===null)return[{id:"ios/plist-bundle-id-format",severity:"error",title:"Info.plist has no CFBundleIdentifier",fix:"Set a valid reverse-DNS PRODUCT_BUNDLE_IDENTIFIER (no spaces, underscores, or wildcards)."}];let $=up(B,cp(A.projectDir));if(l9A($))return[];if(!ln0.test($))return[{id:"ios/plist-bundle-id-format",severity:"error",title:`Invalid bundle identifier "${$}"`,detail:"Bundle ids must be reverse-DNS (≥2 dot-separated segments) with no spaces, underscores, or wildcards.",fix:"Set a valid reverse-DNS PRODUCT_BUNDLE_IDENTIFIER (no spaces, underscores, or wildcards)."}];return[]}},kVQ={id:"ios/plist-version-short-format",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=sq(Q,"CFBundleShortVersionString");if(B===null)return[];let $=up(B,cp(A.projectDir));if(l9A($))return[];if(!cn0.test($))return[{id:"ios/plist-version-short-format",severity:"error",title:`CFBundleShortVersionString "${$}" is not a valid version (ITMS-90060)`,detail:"The marketing version must be two or three dot-separated integers (e.g. 1.4 or 1.4.2) — no letters or pre-release suffixes.",fix:"Set CFBundleShortVersionString or its build setting to two or three dot-separated integers (e.g. 1.4.2)."}];return[]}},bVQ={id:"ios/plist-version-build-format",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=sq(Q,"CFBundleVersion");if(B===null)return[];let $=up(B,cp(A.projectDir));if(l9A($))return[];if(!dn0.test($))return[{id:"ios/plist-version-build-format",severity:"error",title:`CFBundleVersion "${$}" is not a valid build number`,detail:"The build number must be numeric, ≤3 dot-separated integers (e.g. 42 or 1.4.42).",fix:"Set CURRENT_PROJECT_VERSION numeric, ≤3 integers (e.g. 42 or 1.4.42)."}];return[]}},xVQ={id:"ios/plist-encryption-compliance",platforms:["ios"],appliesTo:(A)=>W3(A)&&jW(A),async run(A){let Q=VG(A.projectDir);if(Q===null)return[];if(tq(Q,"ITSAppUsesNonExemptEncryption"))return[];return[{id:"ios/plist-encryption-compliance",severity:"warning",title:"Info.plist is missing ITSAppUsesNonExemptEncryption",detail:'Without this key, App Store Connect shows a "Missing Compliance" prompt on every upload.',fix:"Add ITSAppUsesNonExemptEncryption=<false/> (correct for most Capacitor apps) to stop the per-upload Missing Compliance prompt."}]}},vVQ={id:"ios/plist-ats-arbitrary-loads",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=JSA(Q,"NSAppTransportSecurity");if(B===null)return[];if(Pp(B,"NSAllowsArbitraryLoads")!==!0)return[];let $=jW(A)&&mn0(A);return[{id:"ios/plist-ats-arbitrary-loads",severity:$?"error":"warning",title:"NSAllowsArbitraryLoads is enabled (App Transport Security disabled)",detail:$?"Uploading with arbitrary loads enabled and a dev server (cleartext / server.url) still configured ships an insecure release.":"NSAllowsArbitraryLoads disables App Transport Security for all hosts.",fix:"Remove NSAllowsArbitraryLoads (or set <false/>); use scoped NSExceptionDomains; remove server.url/cleartext before release."}]}},fVQ={id:"ios/plist-launch-storyboard",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];if(tq(Q,"UILaunchStoryboardName")||tq(Q,"UILaunchScreen"))return[];return[{id:"ios/plist-launch-storyboard",severity:"error",title:"Info.plist declares no launch screen (ITMS-90475/90096)",detail:"App Store upload requires a launch storyboard or a UILaunchScreen dictionary.",fix:"Add UILaunchStoryboardName=LaunchScreen (Capacitor default) or a UILaunchScreen dict."}]}},gVQ={id:"ios/plist-orientations-multitasking",platforms:["ios"],appliesTo(A){if(!W3(A))return!1;let Q=VG(A.projectDir);if(Q===null)return!1;if(Pp(Q,"UIRequiresFullScreen")===!0)return!1;let B=hp(cp(A.projectDir),"TARGETED_DEVICE_FAMILY");if(B===null)return!1;return B.split(",").map(($)=>$.trim()).includes("2")},async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=Hz(Q,"UISupportedInterfaceOrientations~ipad");if(!tq(Q,"UISupportedInterfaceOrientations~ipad"))B=Hz(Q,"UISupportedInterfaceOrientations");let $=new Set(B),J=TVQ.filter((Y)=>!$.has(Y));if(J.length===0)return[];return[{id:"ios/plist-orientations-multitasking",severity:"warning",title:`iPad multitasking requires all four orientations — missing ${J.join(", ")} (ITMS-90474)`,detail:"An iPad-capable app that supports multitasking must declare all four interface orientations for iPad.",fix:"Add all four orientations to UISupportedInterfaceOrientations~ipad, or add UIRequiresFullScreen=<true/>."}]}},yVQ={id:"ios/plist-orientations-present",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=Hz(Q,"UISupportedInterfaceOrientations");if(B.length===0)return[{id:"ios/plist-orientations-present",severity:"warning",title:"Info.plist declares no UISupportedInterfaceOrientations",detail:"Declare at least one supported interface orientation for iPhone.",fix:"Declare ≥1 valid UIInterfaceOrientation* value."}];let $=B.find((J)=>!pn0.has(J));if($!==void 0)return[{id:"ios/plist-orientations-present",severity:"warning",title:`Invalid interface orientation "${$}"`,detail:"Each entry must be one of UIInterfaceOrientationPortrait, PortraitUpsideDown, LandscapeLeft, LandscapeRight.",fix:"Declare ≥1 valid UIInterfaceOrientation* value."}];return[]}},hVQ={id:"ios/plist-display-name",platforms:["ios"],appliesTo:W3,async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=cp(A.projectDir),$=(J)=>{let Y=sq(Q,J);if(Y===null)return null;let Z=up(Y,B);if(l9A(Z)||Z.trim()==="")return null;return Z};if($("CFBundleDisplayName")!==null||$("CFBundleName")!==null)return[];return[{id:"ios/plist-display-name",severity:"warning",title:"Info.plist has no resolvable app display name",detail:"Neither CFBundleDisplayName nor CFBundleName resolves to a non-empty value.",fix:"Set CFBundleDisplayName or ensure PRODUCT_NAME resolves."}]}},nn0=["NSLocationWhenInUseUsageDescription","NSLocationAlwaysAndWhenInUseUsageDescription","NSLocationAlwaysUsageDescription","NSLocationUsageDescription"],uVQ={id:"ios/plist-background-modes-sanity",platforms:["ios"],appliesTo(A){if(!W3(A))return!1;let Q=VG(A.projectDir);return Q!==null&&tq(Q,"UIBackgroundModes")},async run(A){let Q=VG(A.projectDir);if(Q===null)return[];let B=Hz(Q,"UIBackgroundModes"),$=[],J=B.filter((Y)=>!in0.has(Y));if(J.length>0)$.push({id:"ios/plist-background-modes-sanity",severity:"warning",title:`Unknown UIBackgroundModes value(s): ${J.join(", ")}`,detail:"Background modes must be one of Apple's documented UIBackgroundModes tokens.",fix:"Remove unused background modes; add matching usage strings/capabilities."});if(B.includes("location")&&jW(A)){if(!nn0.some((Z)=>tq(Q,Z)))$.push({id:"ios/plist-background-modes-sanity",severity:"warning",title:'UIBackgroundModes declares "location" without a location usage description (Guideline 2.5.4)',detail:"App Review rejects background location without an NSLocation*UsageDescription string.",fix:"Add the matching NSLocation*UsageDescription, or remove the location background mode."})}return $}};mVQ={id:"ios/plist-required-device-arm64",platforms:["ios"],appliesTo:(A)=>W3(A)&&jW(A),async run(A){let Q=VG(A.projectDir);if(Q===null)return[];if(!tq(Q,"UIRequiredDeviceCapabilities"))return[];let B=rn0(Q);if(B.includes("arm64")||!B.includes("armv7"))return[];return[{id:"ios/plist-required-device-arm64",severity:"warning",title:"UIRequiredDeviceCapabilities lists armv7 without arm64",detail:"Requiring only armv7 marks the binary as 32-bit. App Store installs on iOS 26+ can fail with a generic download error.",fix:"Replace armv7 with arm64 in UIRequiredDeviceCapabilities (modern iPhones are 64-bit only)."}]}};cVQ={id:"ios/plist-scene-lifecycle-xcode27",platforms:["ios"],appliesTo:(A)=>W3(A)&&(an0(A)??0)>=27,async run(A){let Q=VG(A.projectDir);if(Q===null||tq(Q,"UIApplicationSceneManifest"))return[];return[{id:"ios/plist-scene-lifecycle-xcode27",severity:"error",title:"App does not adopt the UIScene lifecycle, required when building with Xcode 27",detail:"Apps built with the iOS 27 SDK crash at launch on iOS 27 without a UIApplicationSceneManifest in Info.plist and a scene delegate.",fix:"Add a SceneDelegate and a UIApplicationSceneManifest to ios/App/App/Info.plist (Capacitor supports scenes), or build with --xcode-version 26.",docsUrl:"https://developer.apple.com/documentation/uikit/specifying-the-scenes-your-app-supports"}]}}});import{readFileSync as on0}from"node:fs";import{join as sn0}from"node:path";function dp(A){try{return JSON.parse(on0(A,"utf8"))}catch{return null}}function lp(A,Q){let B=(Q?hp(Q,"ASSETCATALOG_COMPILER_APPICON_NAME"):null)??"AppIcon";return sn0(A,"ios","App","App","Assets.xcassets",`${B}.appiconset`)}function tn0(A){return(A??"").trim()}function lVQ(A){return(A?.images??[]).some((Q)=>tn0(Q.size)==="1024x1024"||Q.role==="marketing")}var pVQ=b(()=>{gk()});import{existsSync as zL}from"node:fs";import{join as wW}from"node:path";function iVQ(A){return wW(A,"ios","App","Podfile")}function NSA(A){return wW(A,"ios","App","CapApp-SPM","Package.swift")}function nVQ(A){return zL(iVQ(A.projectDir))}function rVQ(A){return A.hostPlatform==="darwin"&&nVQ(A)}function CSA(A){return zL(NSA(A.projectDir))}function p9A(A){return XW(A.projectDir)}function LSA(A){if(A.platform!=="ios")return!1;if((A.distributionMode??"app_store")!=="app_store")return!1;let B=A.credentials;return Boolean(B?.APPLE_KEY_ID&&B?.APPLE_ISSUER_ID&&B?.APPLE_KEY_CONTENT)}var aVQ,oVQ,sVQ,tVQ,eVQ,ARQ,QRQ,BRQ,en0,$RQ;var JRQ=b(()=>{pVQ();gk();r7();oq();aVQ={id:"ios/pods-not-installed",platforms:["ios"],appliesTo:rVQ,async run(A){let Q=wW(A.projectDir,"ios","App"),B=zL(wW(Q,"Pods")),$=zL(wW(Q,"App.xcworkspace"));if(B&&$)return[];let J=[];if(!B)J.push("ios/App/Pods");if(!$)J.push("ios/App/App.xcworkspace");return[{id:"ios/pods-not-installed",severity:"warning",title:"CocoaPods is not installed (missing Pods/ or App.xcworkspace)",detail:`A Podfile exists but ${J.join(" and ")} ${J.length>1?"are":"is"} missing. The cloud build runs pod install and recovers, but local Xcode builds will fail.`,fix:"Run `npx cap sync ios` (or `pod install`) and commit Pods/ + App.xcworkspace."}]}},oVQ={id:"ios/pods-lock-missing",platforms:["ios"],appliesTo:rVQ,async run(A){if(K6(wW(A.projectDir,"ios","App","Podfile.lock"))!==null)return[];return[{id:"ios/pods-lock-missing",severity:"warning",title:"Podfile.lock is missing - pod versions are not pinned",detail:"Without Podfile.lock the cloud build resolves pod versions fresh, which can drift from your local versions.",fix:"Run `pod install` and commit Podfile.lock."}]}},sVQ={id:"ios/pods-capacitor-missing",platforms:["ios"],appliesTo:nVQ,async run(A){let Q=K6(iVQ(A.projectDir));if(Q===null)return[];if(/pod\s+['"]Capacitor['"]/.test(Q)||/capacitor_pods/.test(Q)||/@capacitor\/ios/.test(Q))return[];return[{id:"ios/pods-capacitor-missing",severity:"warning",title:"Podfile does not appear to wire the Capacitor pod",detail:"No `pod 'Capacitor'`, `capacitor_pods` helper, or `@capacitor/ios` reference was found. If this is intentional (custom pod names) you can ignore this.",fix:"Run `npx cap sync ios` then `pod install`."}]}},tVQ={id:"ios/spm-package-resolved-missing",platforms:["ios"],appliesTo:CSA,async run(A){let Q=wW(A.projectDir,"ios","App","App.xcodeproj","project.xcworkspace","xcshareddata","swiftpm","Package.resolved"),B=wW(A.projectDir,"ios","App","CapApp-SPM","Package.resolved");if(zL(Q)||zL(B))return[];return[{id:"ios/spm-package-resolved-missing",severity:"warning",title:"Swift Package Manager Package.resolved is missing",detail:"No Package.resolved found under the xcodeproj or CapApp-SPM. The cloud build resolves packages during build_app, but committing Package.resolved pins versions for reproducible builds.",fix:"Run `xcodebuild -resolvePackageDependencies` (or open in Xcode) and commit Package.resolved."}]}},eVQ={id:"ios/spm-capacitor-dependency-missing",platforms:["ios"],appliesTo:CSA,async run(A){let Q=K6(NSA(A.projectDir));if(Q===null)return[];let B=/capacitor-swift-pm/.test(Q),$=/\.product\(\s*name:\s*['"]Capacitor['"]/.test(Q);if(B&&$)return[];return[{id:"ios/spm-capacitor-dependency-missing",severity:"warning",title:"Package.swift does not declare the Capacitor SPM dependency",detail:'Expected a capacitor-swift-pm package dependency and a `.product(name: "Capacitor", ...)` target dependency. If your project uses a non-standard layout you can ignore this.',fix:"Run `npx cap sync ios` to regenerate Package.swift."}]}},ARQ={id:"ios/appicon-empty-or-placeholder",platforms:["ios"],async run(A){let Q=lp(A.projectDir,p9A(A)??void 0);if(!zL(Q))return[{id:"ios/appicon-empty-or-placeholder",severity:"error",title:"AppIcon.appiconset is missing",detail:`Expected an app-icon asset set at ${Q.replace(A.projectDir,".")} but the directory does not exist.`,fix:"Run `npx @capacitor/assets generate` (or add the icon set in Xcode)."}];let B=dp(wW(Q,"Contents.json"));if(B===null)return[{id:"ios/appicon-empty-or-placeholder",severity:"error",title:"AppIcon Contents.json is missing or malformed",detail:"The app-icon Contents.json could not be parsed as JSON.",fix:"Regenerate the icon set (`npx @capacitor/assets generate`) or fix the malformed Contents.json."}];if((B.images??[]).some((J)=>J.filename?.trim()))return[];return[{id:"ios/appicon-empty-or-placeholder",severity:LSA(A)?"error":"warning",title:"AppIcon.appiconset declares no icon images",detail:LSA(A)?"The icon set has no images - App Store upload will reject it (ITMS-90704).":"The icon set has no images. The build tolerates this for ad_hoc/development, but App Store upload would reject it.",fix:"Run `npx @capacitor/assets generate` so the set has at least the 1024x1024 icon."}]}},QRQ={id:"ios/appicon-referenced-file-missing",platforms:["ios"],appliesTo(A){let Q=lp(A.projectDir,XW(A.projectDir)??void 0);return dp(wW(Q,"Contents.json"))!==null},async run(A){let Q=lp(A.projectDir,p9A(A)??void 0),B=dp(wW(Q,"Contents.json"));if(B===null)return[];let $=[];for(let J of B.images??[]){let Y=J.filename?.trim();if(!Y)continue;if(!zL(wW(Q,Y)))$.push(Y)}if($.length===0)return[];return[{id:"ios/appicon-referenced-file-missing",severity:"error",title:"AppIcon Contents.json references icon file(s) missing from disk",detail:`actool will fail the build: missing ${$.join(", ")}.`,fix:"Regenerate the icons (`npx @capacitor/assets generate`) or commit the referenced PNG(s)."}]}},BRQ={id:"ios/appicon-marketing-missing",platforms:["ios"],appliesTo:LSA,async run(A){let Q=lp(A.projectDir,p9A(A)??void 0),B=dp(wW(Q,"Contents.json"));if(B===null)return[];if(lVQ(B))return[];return[{id:"ios/appicon-marketing-missing",severity:"error",title:"App Store marketing icon (1024x1024) is missing",detail:"App Store upload requires a 1024x1024 marketing icon in the AppIcon set (ITMS-90704).",fix:"Add a 1024x1024 PNG (no alpha) marketing icon and reference it in Contents.json."}]}},en0=/\.iOS\(\.v(\d+)\)/,$RQ={id:"ios/spm-deployment-target-consistency",platforms:["ios"],appliesTo(A){if(!CSA(A))return!1;let Q=XW(A.projectDir);if(Q===null)return!1;return mp(Q)!==null},async run(A){let Q=p9A(A);if(Q===null)return[];let B=mp(Q);if(B===null)return[];let $=K6(NSA(A.projectDir));if($===null)return[];let J=$.match(en0);if(!J)return[];let Y=Number.parseFloat(J[1]);if(Number.isNaN(Y)||B>=Y)return[];return[{id:"ios/spm-deployment-target-consistency",severity:"warning",title:"IPHONEOS_DEPLOYMENT_TARGET is below the Package.swift iOS minimum",detail:`The Xcode app target builds for iOS ${B} but Package.swift requires iOS ${Y} (.iOS(.v${Y})).`,fix:`Raise IPHONEOS_DEPLOYMENT_TARGET to >= ${Y}, or run \`npx cap sync ios\`.`}]}}});function RG(A){return XW(A.projectDir)}function VSA(A){return UK(A).filter((Q)=>Q.productType===Ar0)}function $r0(A){return Qr0[A]??Br0}function YRQ(A){return mp(A)}function i9A(A,Q){let B=A.find((J)=>J.name==="Release")?.settings[Q];if(B!==void 0)return B;let $=A.find((J)=>J.name==="Debug")?.settings[Q];if($!==void 0)return $;for(let J of A)if(J.settings[Q]!==void 0)return J.settings[Q];return}function XRQ(A){let Q=[];for(let{target:B,configs:$}of AD(A)){if(i9A($,"CODE_SIGN_STYLE")===void 0)continue;let Y=i9A($,"DEVELOPMENT_TEAM");if(Y===void 0||Y.trim()==="")Q.push(B.name)}return Q}function Jr0(A){let Q=[];for(let{target:B,configs:$}of AD(A)){let J=$.map((Z)=>Z.settings.PRODUCT_BUNDLE_IDENTIFIER).filter((Z)=>Z!==void 0);if(J.length<2)continue;let Y=Array.from(new Set(J));if(Y.length>=2)Q.push({name:B.name,values:Y})}return Q}function GRQ(A){return ISA(A).filter((Q)=>Q.settings.ENABLE_BITCODE==="YES").map((Q)=>Q.isProjectLevel?`project ${Q.name}`:Q.name)}function Yr0(A){let Q=[];for(let{target:B,configs:$}of AD(A)){let J=i9A($,"SWIFT_VERSION");if(J===void 0)continue;let Y=J.match(/^\s*(\d+(?:\.\d+)?)/),Z=Y?Number.parseFloat(Y[1]):Number.NaN;if(Number.isNaN(Z)||Z<5)Q.push({name:B.name,value:J})}return Q}var Ar0="com.apple.product-type.application",Qr0,Br0=14,WRQ,ZRQ=(A)=>eq(A).length>0,KRQ,HRQ,FRQ,zRQ,URQ,qRQ;var DRQ=b(()=>{r7();WSA();gk();c9A();Qr0={5:13,6:13,7:14,8:14};WRQ={id:"ios/xcode-deployment-target-capacitor",platforms:["ios"],appliesTo:(A)=>{if(kk(A.projectDir)===null)return!1;let Q=RG(A);return Q!==null&&YRQ(Q)!==null},async run(A){let Q=RG(A);if(!Q)return[];let B=kk(A.projectDir),$=YRQ(Q);if(B===null||$===null)return[];let J=$r0(B);if($>=J)return[];return[{id:"ios/xcode-deployment-target-capacitor",severity:"error",title:`IPHONEOS_DEPLOYMENT_TARGET ${$} is below the Capacitor ${B} floor (${J})`,detail:`Capacitor ${B} requires iOS deployment target >= ${J}; the build will fail otherwise.`,fix:`Raise IPHONEOS_DEPLOYMENT_TARGET to >= ${J} (project + app target) and the Podfile platform line if present.`}]}};KRQ={id:"ios/xcode-signing-team",platforms:["ios"],appliesTo:(A)=>{if(ZRQ(A))return!1;let Q=RG(A);return Q!==null&&XRQ(Q).length>0},async run(A){if(ZRQ(A))return[];let Q=RG(A);if(!Q)return[];let B=XRQ(Q);if(B.length===0)return[];return[{id:"ios/xcode-signing-team",severity:jW(A)?"error":"warning",title:`${B.length} signable target(s) set a code-signing style but no DEVELOPMENT_TEAM`,detail:`targets without a team: ${B.join(", ")}`,fix:"Set DEVELOPMENT_TEAM in Xcode (Signing & Capabilities), or supply signing creds/profiles to the cloud build so it switches to managed-manual signing."}]}};HRQ={id:"ios/xcode-bundle-id-mismatch-across-configs",platforms:["ios"],appliesTo:(A)=>{let Q=RG(A);return Q!==null&&AD(Q).some((B)=>{return B.configs.map((J)=>J.settings.PRODUCT_BUNDLE_IDENTIFIER).filter((J)=>J!==void 0).length>=2})},async run(A){let Q=RG(A);if(!Q)return[];let B=Jr0(Q);if(B.length===0)return[];return[{id:"ios/xcode-bundle-id-mismatch-across-configs",severity:"warning",title:`PRODUCT_BUNDLE_IDENTIFIER differs across build configs in ${B.length} target(s)`,detail:B.map(($)=>`${$.name}: ${$.values.join(" vs ")}`).join("; "),fix:"Align PRODUCT_BUNDLE_IDENTIFIER across Debug/Release (or ignore if a Debug suffix is intentional)."}]}};FRQ={id:"ios/xcode-enable-bitcode-leftover",platforms:["ios"],appliesTo:(A)=>{let Q=RG(A);return Q!==null&&GRQ(Q).length>0},async run(A){let Q=RG(A);if(!Q)return[];let B=GRQ(Q);if(B.length===0)return[];return[{id:"ios/xcode-enable-bitcode-leftover",severity:"warning",title:"ENABLE_BITCODE = YES is set (deprecated since Xcode 14)",detail:`present in: ${B.join(", ")}`,fix:"Set ENABLE_BITCODE = NO or delete it — Xcode 14+ ignores bitcode and Apple no longer accepts it."}]}};zRQ={id:"ios/xcode-swift-version-sanity",platforms:["ios"],appliesTo:(A)=>{let Q=RG(A);return Q!==null&&AD(Q).some((B)=>i9A(B.configs,"SWIFT_VERSION")!==void 0)},async run(A){let Q=RG(A);if(!Q)return[];let B=Yr0(Q);if(B.length===0)return[];return[{id:"ios/xcode-swift-version-sanity",severity:"warning",title:`SWIFT_VERSION is below 5 (or unparseable) in ${B.length} target(s)`,detail:B.map(($)=>`${$.name}: ${$.value}`).join("; "),fix:"Set SWIFT_VERSION = 5.0 (or your intended Swift >= 5) for the affected target(s)."}]}},URQ={id:"ios/xcode-no-app-target",platforms:["ios"],appliesTo:(A)=>RG(A)!==null,async run(A){let Q=RG(A);if(!Q)return[];if(VSA(Q).length>0)return[];return[{id:"ios/xcode-no-app-target",severity:"error",title:"No application target found in the Xcode project",detail:"The pbxproj parsed but contains no com.apple.product-type.application target — the build has nothing to archive.",fix:"Run `npx cap sync ios`, or restore the application target in Xcode."}]}},qRQ={id:"ios/xcode-multiple-app-targets",platforms:["ios"],appliesTo:(A)=>{let Q=RG(A);return Q!==null&&VSA(Q).length>1},async run(A){let Q=RG(A);if(!Q)return[];let B=VSA(Q);if(B.length<=1)return[];return[{id:"ios/xcode-multiple-app-targets",severity:"warning",title:`${B.length} application targets found — the build may sign/archive the wrong one`,detail:`app targets: ${B.map(($)=>`${$.name} (${$.bundleId})`).join(", ")}`,fix:"Keep a single application target, remove the duplicate, or pass the intended scheme to the build."}]}}});import{createRequire as Zr0}from"node:module";import{existsSync as hk}from"node:fs";import{dirname as Xr0,join as zz}from"node:path";function Gr0(A){let Q=K6(zz(A,"package.json"));if(!Q)return[];let B;try{B=JSON.parse(Q)}catch{return[]}let $=new Set(["@capacitor/core","@capacitor/cli","@capacitor/ios","@capacitor/android","@capacitor/assets","@capacitor/synapse"]);return Object.keys(B.dependencies??{}).filter((J)=>J.startsWith("@capacitor/")&&!$.has(J))}function Wr0(A){return A.replace(/^@/,"").replace(/\//g,"-")}function Kr0(A,Q){try{let $=Zr0(zz(A,"package.json")).resolve(`${Q}/package.json`);return hk(zz(Xr0($),"android"))}catch{return!1}}var IRQ,MRQ,ORQ;var LRQ=b(()=>{oq();IRQ={id:"shared/cap-sync-stale",platforms:["ios","android"],async run(A){let Q=[],B=A.config?.webDir??"dist";if(!hk(zz(A.projectDir,B)))return Q.push({id:"shared/cap-sync-stale",severity:"error",title:`webDir "${B}" does not exist — web assets were never built`,fix:"Run your web build (e.g. `npm run build`) then `npx cap sync` before requesting a build"}),Q;let $=Gr0(A.projectDir),J=$.filter((Z)=>Kr0(A.projectDir,Z)),Y=v9(A.config,A.platform);if(A.platform==="android"&&J.length>0){let Z=K6(zz(A.projectDir,Y,"capacitor.settings.gradle"));if(Z===null)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${Y}/capacitor.settings.gradle is missing — \`npx cap sync android\` was never run`,fix:"Run `npx cap sync android`"});else{let X=J.filter((G)=>!Z.includes(`:${Wr0(G)}`));if(X.length>0)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${X.length} Capacitor plugin(s) not synced into the Android project`,detail:`missing from capacitor.settings.gradle: ${X.join(", ")}`,fix:"Run `npx cap sync android` (sync, not copy — copy does not regenerate plugin projects)"})}}if(A.platform==="ios"&&$.length>0){let Z=hk(zz(A.projectDir,Y,"App","Podfile")),X=hk(zz(A.projectDir,Y,"App","CapApp-SPM","Package.swift"));if(!Z&&!X)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${Y}/App sync artifacts are missing — \`npx cap sync ios\` was never run`,detail:`expected ${Y}/App/Podfile (CocoaPods) or ${Y}/App/CapApp-SPM/Package.swift (SPM)`,fix:"Run `npx cap sync ios`"})}return Q}},MRQ={id:"shared/node-linker-layout",platforms:["ios","android"],async run(A){let Q=zz(A.projectDir,"node_modules");if(hk(zz(Q,".bun")))return[{id:"shared/node-linker-layout",severity:"error",title:'bun isolated node_modules layout detected — Capacitor Gradle/Pod paths will not resolve ("No variants exist")',fix:"Reinstall with `bun install --linker=hoisted`"}];if(hk(zz(Q,".pnpm")))return[{id:"shared/node-linker-layout",severity:"warning",title:"pnpm symlinked node_modules layout detected — Capacitor native builds often need a hoisted layout",fix:"If the build fails resolving @capacitor/* paths, set `node-linker=hoisted` in .npmrc and reinstall"}];return[]}},ORQ={id:"shared/bundle-id-consistency",platforms:["ios","android"],async run(A){let Q=A.config?.appId??A.appId;if(A.platform==="android"){let Z=wp(A.projectDir);if(Z&&Z!==Q)return[{id:"shared/bundle-id-consistency",severity:"warning",title:"Gradle applicationId differs from the Capacitor appId",detail:`capacitor.config appId: ${Q} — android/app/build.gradle applicationId: ${Z}`,fix:"Align them (or pass the intended appId explicitly to `build request`)"}];return[]}let{findSignableTargets:B,readPbxproj:$}=await Promise.resolve().then(() => (r7(),vy)),J=$(A.projectDir);if(!J)return[];let Y=B(J);if(Y.length>0&&!Y.some((Z)=>Z.bundleId===Q))return[{id:"shared/bundle-id-consistency",severity:"warning",title:"No Xcode target uses the Capacitor appId as its bundle identifier",detail:`capacitor appId: ${Q} — targets: ${Y.map((Z)=>`${Z.name}=${Z.bundleId}`).join(", ")}`,fix:"Align PRODUCT_BUNDLE_IDENTIFIER with the appId, or build with the intended appId"}];return[]}}});var NRQ,CRQ;var VRQ=b(()=>{NRQ={id:"shared/apikey-permission",platforms:["ios","android"],remote:!0,async run(A){let{data:Q,error:B}=await A.supabase.rpc("cli_check_permission",{apikey:A.apikey??"",permission_key:"app.build_native",org_id:null,app_id:A.appId,channel_id:null});if(B)return[{id:"shared/apikey-permission",severity:"info",title:"Could not verify Capgo build permission (network/API error)",detail:B.message}];if(Q!==!0)return[{id:"shared/apikey-permission",severity:"error",title:`Capgo could not authorize app.build_native for ${A.appId}`,detail:"Capgo could not authorize the requested permission for this API key and app.",fix:"Use a Capgo apikey from the org that owns the app (role with native-build rights), or fix the appId"}];return[]}},CRQ={id:"shared/app-exists",platforms:["ios","android"],remote:!0,async run(A){let{data:Q,error:B}=await A.supabase.from("apps").select("app_id").eq("app_id",A.appId).maybeSingle();if(B)return[{id:"shared/app-exists",severity:"info",title:"Could not verify app existence (network/API error)",detail:B.message}];if(!Q)return[{id:"shared/app-exists",severity:"error",title:`Capgo: app ${A.appId} is not visible to this Capgo API key`,detail:"Either the app does not exist in Capgo or it belongs to an org this Capgo key cannot access.",fix:`Create it (npx @capgo/cli@latest app add ${A.appId}) or pass the right appId / Capgo apikey`}];return[]}}});function qr0(A){let Q;try{Q=JSON.parse(new TextDecoder().decode(A))}catch(J){throw Error(`Service account file is not valid JSON: ${J instanceof Error?J.message:String(J)}`)}if(!Q||typeof Q!=="object")throw Error("Service account file is not a JSON object.");let B=Q;if(B.type!=="service_account")throw Error(`Expected "type": "service_account" — found ${JSON.stringify(B.type)}. This file is not a service account key.`);let $=["client_email","private_key","project_id","token_uri"];for(let J of $){let Y=B[J];if(typeof Y!=="string"||Y.length===0)throw Error(`Service account JSON is missing required field "${J}".`)}if(!Ur0.has(B.token_uri))throw Error("Service account JSON has an unsupported token_uri. Expected a Google OAuth token endpoint.");return{type:"service_account",client_email:B.client_email,private_key:B.private_key,project_id:B.project_id,token_uri:B.token_uri,private_key_id:typeof B.private_key_id==="string"?B.private_key_id:void 0,client_id:typeof B.client_id==="string"?B.client_id:void 0}}function Dr0(A){let Q=Math.floor(Date.now()/1000);return ERQ.default.sign({iss:A.client_email,scope:Hr0,aud:A.token_uri,exp:Q+Fr0,iat:Q},A.private_key,{algorithm:"RS256",header:{alg:"RS256",typ:"JWT",kid:A.private_key_id??""}})}async function Ir0(A){let Q=new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:A.assertion}),B=await RSA({url:A.key.token_uri,init:{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:Q.toString()},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl}),$=await B.text();if(!B.ok){let Y=`${B.status} ${B.statusText}`;try{let Z=JSON.parse($);if(Z.error)Y=Z.error_description?`${Z.error}: ${Z.error_description}`:Z.error}catch{}if(B.status>=500||B.status<400)throw new pp(`Google's token endpoint returned ${Y}. Try again in a moment.`);throw Error(`Google rejected the service account credentials (${Y}). The private key may be revoked or invalid.`)}let J;try{J=JSON.parse($)}catch{throw new pp(`Google's token endpoint returned a non-JSON response (${B.status}).`)}if(typeof J.access_token!=="string"||J.access_token.length===0)throw new pp("Google's token response was missing an access_token field.");return J.access_token}async function RSA(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),A.timeoutMs),$,J=null;if(A.signal){let Y=new AbortController;if(J=()=>Y.abort(),A.signal.addEventListener("abort",J,{once:!0}),Q.signal.addEventListener("abort",J,{once:!0}),A.signal.aborted||Q.signal.aborted)Y.abort();$=Y.signal}else $=Q.signal;try{return await A.fetchImpl(A.url,{...A.init,signal:$})}finally{if(clearTimeout(B),J)A.signal?.removeEventListener("abort",J),Q.signal.removeEventListener("abort",J)}}async function Mr0(A){let Q=`${RRQ}/applications/${encodeURIComponent(A.packageName)}/edits`,B;try{B=await RSA({url:Q,init:{method:"POST",headers:{Authorization:`Bearer ${A.accessToken}`,"Content-Type":"application/json",Accept:"application/json"},body:"{}"},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl})}catch(Z){return{kind:"network",detail:Z instanceof Error?Z.message:String(Z)}}let $=await B.text();if(fB(`probeAppAccess: POST ${Q} → HTTP ${B.status} ${B.statusText}${B.ok?"":` :: ${$.slice(0,300)}`}`),B.status===401||B.status===403||B.status===404)return{kind:"no-access",detail:Or0($)??`${B.status} ${B.statusText}`};if(!B.ok)return{kind:"network",detail:`${B.status} ${B.statusText}: ${$.slice(0,200)}`};let J;try{J=JSON.parse($)}catch{return{kind:"network",detail:"Play API returned non-JSON on edits.insert"}}if(typeof J.id!=="string"||J.id.length===0)return{kind:"network",detail:"Play API returned no edit id"};let Y=`${RRQ}/applications/${encodeURIComponent(A.packageName)}/edits/${encodeURIComponent(J.id)}`;try{await RSA({url:Y,init:{method:"DELETE",headers:{Authorization:`Bearer ${A.accessToken}`}},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl})}catch{}return{kind:"ok"}}function Or0(A){try{let Q=JSON.parse(A);if(Q.error?.message)return Q.error.status?`${Q.error.status}: ${Q.error.message}`:Q.error.message}catch{}return null}async function Uz(A){let Q=A.timeoutMs??zr0,B=A.fetchImpl??globalThis.fetch.bind(globalThis),$;try{$=qr0(A.jsonBytes)}catch(Z){return{ok:!1,kind:"shape-error",message:Z instanceof Error?Z.message:String(Z)}}if(A.signal?.aborted)return{ok:!1,kind:"network-error",message:"Validation cancelled."};let J;try{let Z=Dr0($);J=await Ir0({key:$,assertion:Z,signal:A.signal,timeoutMs:Q,fetchImpl:B})}catch(Z){let X=Z instanceof Error?Z.message:String(Z),G=Z?.name==="AbortError",W=Z instanceof pp,K=/timeout|timed out|network|fetch failed|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i.test(X);if(G||W||K)return{ok:!1,kind:"network-error",message:X};return{ok:!1,kind:"token-error",message:X}}if(A.signal?.aborted)return{ok:!1,kind:"network-error",message:"Validation cancelled."};let Y=await Mr0({accessToken:J,packageName:A.packageName,signal:A.signal,timeoutMs:Q,fetchImpl:B});if(Y.kind==="ok")return{ok:!0,serviceAccountEmail:$.client_email,projectId:$.project_id};if(Y.kind==="no-access")return{ok:!1,kind:"no-app-access",serviceAccountEmail:$.client_email,message:`Service account "${$.client_email}" cannot access package "${A.packageName}" on Google Play (${Y.detail}). Create the app in Play Console (if it does not exist yet), invite this service account under Users and permissions, and grant release access for this app — or skip Play upload and get the AAB via Capgo with --no-playstore-upload --output-upload.`};return{ok:!1,kind:"network-error",message:Y.detail}}var ERQ,Hr0="https://www.googleapis.com/auth/androidpublisher",RRQ="https://androidpublisher.googleapis.com/androidpublisher/v3",Fr0=3600,zr0=30000,Ur0,pp;var ip=b(()=>{$7();ERQ=tA(m$A(),1),Ur0=new Set(["https://oauth2.googleapis.com/token","https://accounts.google.com/o/oauth2/token","https://www.googleapis.com/oauth2/v4/token"]);pp=class pp extends Error{constructor(A){super(A);this.name="TokenExchangeTransientError"}}});function ESA(A,Q){if(typeof A!=="string")return;let B=i7(A);for(let $ of Q)if($)B=B.replaceAll($,"[REDACTED IDENTIFIER]");return B=B.replace(/\p{Cc}+/gu," ").replace(/\s+/g," ").trim(),B?B.slice(0,Vr0):void 0}async function jRQ(A){let Q=A.fetchImpl??globalThis.fetch.bind(globalThis),B=A.timeoutMs??Nr0;if(A.signal?.aborted)return{ok:!1,kind:"network",message:"App Store Connect check cancelled."};let $;try{$=rO(A.keyId,A.issuerId,A.p8Pem)}catch{return{ok:!1,kind:"auth-error",message:"Invalid App Store Connect key material (.p8 / Key ID / Issuer ID). The CLI could not build a JWT, so Apple was never contacted."}}let J=new AbortController,Y=setTimeout(()=>J.abort(),B),Z=()=>J.abort();A.signal?.addEventListener("abort",Z,{once:!0});let G=`/apps${A.bundleId?`?filter[bundleId]=${encodeURIComponent(A.bundleId)}&limit=1`:"?limit=1"}`;try{let W=await Q(`${Lr0}${G}`,{signal:J.signal,headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"}}),K=await W.json().catch(()=>null);if(!W.ok){let H=(K?.errors??[])[0];fB(`apple-access GET ${G}: HTTP ${W.status} ${W.statusText} ${JSON.stringify(K?.errors??null)} | ${LK(W.headers)}`);let z=new cR(W.status,H?`Apple API error (${W.status}): ${H.title} - ${H.detail} (${H.code})`:`Apple API error: HTTP ${W.status} ${W.statusText}`,H?.code),q=q_A(z),D=[A.keyId,A.issuerId],I={status:W.status,code:ESA(H?.code,D),title:ESA(H?.title,D),detail:ESA(H?.detail,D)};if(q.is401or403)return{ok:!1,kind:"auth-error",message:q.message,...I};return{ok:!1,kind:"network",message:`App Store Connect returned HTTP ${W.status}.`,...I}}if(fB(`apple-access GET ${G}: HTTP ${W.status} | ${LK(W.headers)}`),A.bundleId){if(!I_A(K).some((q)=>q.bundleId===A.bundleId))return{ok:!1,kind:"no-app-access",message:`The App Store Connect API key cannot see an app with bundle id ${A.bundleId}. Create it in App Store Connect, or skip TestFlight and get an IPA with --ios-distribution ad_hoc --output-upload.`}}return{ok:!0}}catch(W){let K=W instanceof Error?W.message:String(W);if(W?.name==="AbortError"||J.signal.aborted||Cr0.test(K))return{ok:!1,kind:"network",message:"Could not reach App Store Connect (network error or timeout)."};return{ok:!1,kind:"network",message:"App Store Connect check failed unexpectedly."}}finally{clearTimeout(Y),A.signal?.removeEventListener("abort",Z)}}var Lr0="https://api.appstoreconnect.apple.com/v1",Nr0=7000,Cr0,Vr0=500;var wRQ=b(()=>{$7();$M();pR();Cr0=/timeout|timed out|network|fetch failed|aborted|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i});import{Buffer as Rr0}from"node:buffer";function kRQ(A){return[[A.code?`[${A.code}]`:"",A.title??""].filter(Boolean).join(" "),A.detail].filter(Boolean).join(" - ")||A.message}function Pr0(A){return Boolean(A.status===403&&(A.code&&Er0.has(A.code)||/\bPLA_NOT_ACCEPTED\b|required agreement|program license agreement/i.test(`${A.code??""} ${A.title??""} ${A.detail??""}`)))}function _r0(A){if(A.status===401)return!0;if(A.status!==403)return!1;return jr0.test(A.code??"")||wr0.test(`${A.title??""} ${A.detail??""}`)}function Tr0(A){let Q=kRQ(A);if(Pr0(A))return{id:"ios/asc-key-access",severity:"error",enforceAfter:PRQ,title:"Apple blocked App Store Connect API access (HTTP 403): unsigned or expired agreement",detail:Q,fix:"Ask the Account Holder to accept pending agreements in App Store Connect → Business, then retry."};if(_r0(A))return{id:"ios/asc-key-access",severity:"error",enforceAfter:PRQ,title:`Apple rejected the App Store Connect API key during preflight (HTTP ${A.status})`,detail:Q,fix:TRQ};if(A.status===403)return{id:"ios/asc-key-access",severity:"warning",title:"Apple denied the App Store Connect preflight request (HTTP 403)",detail:`${Q} This /v1/apps probe differs from the TestFlight upload path, so the build may still succeed.`,fix:"Review Apple's reason and confirm the App Store Connect key can access the target app. Use --fail-on-warnings only if this probe must be strict."};if(A.status!==void 0)return{id:"ios/asc-key-access",severity:"warning",title:`App Store Connect preflight returned HTTP ${A.status}`,detail:Q,fix:"Retry the preflight. The build will still attempt the upload because this response does not prove the credentials are invalid."};return{id:"ios/asc-key-access",severity:"error",title:"Invalid App Store Connect key material (.p8 / Key ID / Issuer ID)",detail:Q||"The CLI could not build an App Store Connect JWT from the credentials you provided, so Apple was never contacted.",fix:TRQ}}function bRQ(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),A);return{signal:Q.signal,clear:()=>clearTimeout(B)}}function Sr0(A){return{id:"android/play-sa-access",platforms:["android"],appliesTo:(Q)=>kp(Q),async run(Q){let B=Q.credentials?.PLAY_CONFIG_JSON;if(!B)return[];let $=nNQ(Q.projectDir,Q.androidFlavor),J=$.packageName??Q.config?.appId??Q.appId,Y=Rr0.from(B,"base64"),{signal:Z,clear:X}=bRQ(n9A),G;try{G=await A({jsonBytes:Y,packageName:J,signal:Z,timeoutMs:n9A})}finally{X()}if(G.ok)return[];switch(G.kind){case"no-app-access":return[{id:"android/play-sa-access",severity:$.ambiguous?"warning":"error",title:$.ambiguous?"Google Play access could not be verified: app missing or service account has no access":"Google Play upload blocked: app missing or service account has no access",detail:G.message,fix:_RQ}];case"token-error":return[{id:"android/play-sa-access",severity:"error",title:"Google rejected the Play service-account key",detail:"The service-account JSON failed to authenticate with Google. Re-download a fresh key from the Google Cloud console.",fix:_RQ}];case"network-error":return[{id:"android/play-sa-access",severity:"info",title:"Could not verify Play service-account access (network error or timeout)",detail:"The build will still attempt the upload; this check is best-effort and skipped offline."}];case"shape-error":return[{id:"android/play-sa-access",severity:"info",title:"Skipped Play access check (service-account JSON shape problem)",detail:"See the android/play-sa-json finding for the shape error."}];default:return[]}}}}function kr0(A){return{id:"ios/asc-key-access",platforms:["ios"],appliesTo:(Q)=>jW(Q),async run(Q){let{APPLE_KEY_ID:B,APPLE_ISSUER_ID:$,APPLE_KEY_CONTENT:J}=Q.credentials??{};if(!B||!$||!J)return[];let Y="";try{Y=SRQ.default.util.decode64(J)}catch{return[]}if(!Y.includes("-----BEGIN PRIVATE KEY-----"))return[];let Z=await br0(Q),{signal:X,clear:G}=bRQ(n9A),W;try{W=await A({keyId:B,issuerId:$,p8Pem:Y,bundleId:Z,signal:X,timeoutMs:n9A})}finally{G()}if(W.ok)return[];switch(W.kind){case"auth-error":return[Tr0(W)];case"no-app-access":return[{id:"ios/asc-key-access",severity:"warning",title:"App Store Connect API key cannot see this app",detail:W.message,fix:"Confirm the app exists in App Store Connect and the API key role can access it, or fix the bundle identifier. If you only need an IPA download (no TestFlight), re-run with --ios-distribution ad_hoc --output-upload."}];case"network":return[{id:"ios/asc-key-access",severity:"warning",title:W.status?`App Store Connect preflight returned HTTP ${W.status}`:"Could not verify App Store Connect access (network error or timeout)",detail:W.status?`${kRQ(W)} The build will still attempt the upload.`:"The build will still attempt the upload; retry when network access is available."}];default:return[]}}}}async function br0(A){try{let{findSignableTargets:Q,readPbxproj:B}=await Promise.resolve().then(() => (r7(),vy)),$=B(A.projectDir);if(!$)return A.config?.appId??A.appId;let J=Q($),Y=A.config?.appId??A.appId;return(J.find((X)=>X.bundleId===Y)??J[0])?.bundleId??Y}catch{return A.config?.appId??A.appId}}var SRQ,n9A=7000,PRQ="2026-08-17T00:00:00.000Z",_RQ="Invite the Google Play service-account email in Play Console → Users and permissions and grant release access for this app. If the Play app does not exist yet and you only need the AAB, re-run with --no-playstore-upload --output-upload.",TRQ="Fix the App Store Connect API key: check Key ID / Issuer ID / .p8, and confirm the key has Admin or Developer access (or ask the Account Holder to accept pending agreements).",Er0,jr0,wr0,xRQ,vRQ;var fRQ=b(()=>{ip();wRQ();oq();SRQ=tA(dS(),1),Er0=new Set(["FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED","FORBIDDEN_ERROR.PLA_NOT_ACCEPTED"]),jr0=/(?:^|[._-])(NOT_AUTHORIZED|UNAUTHORIZED|AUTHENTICATION(?:_ERROR)?|INVALID_(?:TOKEN|CREDENTIALS?))(?:$|[._-])/i,wr0=/authentication credentials? (?:are )?(?:missing or invalid)|invalid (?:bearer )?token|token (?:is )?(?:invalid|expired)/i;xRQ=Sr0(Uz),vRQ=kr0(jRQ)});var xr0="2026-08-14T00:00:00.000Z",vr0="2026-08-17T00:00:00.000Z",fr0,jSA,gRQ;var yRQ=b(()=>{zCQ();LCQ();dCQ();pCQ();y9A();YSA();c9A();WVQ();PVQ();dVQ();JRQ();DRQ();LRQ();VRQ();fRQ();fr0=[SVQ,kVQ,bVQ,xVQ,vVQ,fVQ,gVQ,yVQ,hVQ,uVQ,mVQ,cVQ,WRQ,KRQ,HRQ,FRQ,zRQ,URQ,qRQ,VVQ,RVQ,EVQ,jVQ,wVQ,ZVQ,XVQ,GVQ,aVQ,oVQ,sVQ,tVQ,eVQ,ARQ,QRQ,BRQ,$RQ].map((A)=>({...A,enforceAfter:xr0})),jSA=[NRQ,CRQ,lCQ,IRQ,MRQ,ORQ,rCQ,{...aCQ,enforceAfter:vr0},oCQ,eCQ,AVQ,QVQ,BVQ,$VQ,JVQ,rNQ,sCQ,MCQ,OCQ,jCQ,wCQ,PCQ,TCQ,SCQ,eNQ,ACQ,QCQ,BCQ,$CQ,JCQ,YCQ,ZCQ,XCQ,GCQ,WCQ,KCQ,HCQ,kCQ,bCQ,xCQ,vCQ,fCQ,gCQ,yCQ,hCQ,uCQ,mCQ,cCQ,xRQ,vRQ,...fr0],gRQ=jSA.map((A)=>A.id)});import{env as gr0,stdout as yr0}from"node:process";function mr0(){return Boolean(yr0.isTTY)&&!gr0.NO_COLOR}function wSA(A,Q={}){let B=Q.color??mr0(),$=Q.now??new Date,J=(z,q)=>B?`${z}${q}${WZ.reset}`:q,Y=[];for(let z of hr0)for(let q of A.findings.filter((D)=>D.severity===z)){let D=!jp(q,$),I=D?z==="error"?"✖ CRITICAL — INFORMATION ONLY":`${hRQ[z].trim()} — INFORMATION ONLY`:hRQ[z];if(Y.push(`${J(ur0[z],I)} ${q.title} ${J(WZ.dim,`[${q.id}]`)}`),q.detail)Y.push(J(WZ.dim,` ${q.detail}`));if(q.fix)Y.push(J(WZ.dim,` fix: ${q.fix}`));if(q.docsUrl)Y.push(J(WZ.dim,` docs: ${q.docsUrl}`));if(D&&q.enforceAfter&&!(Q.ignoreFatal&&z==="error")){let M=z==="error"?"this critical finding is information only now and will fail builds":"this finding is information only now and can affect build outcomes";Y.push(J(WZ.dim,` rollout: ${M} starting ${QSA(q.enforceAfter)}`))}}let{error:Z,warning:X,info:G}=A.counts;Y.push("");let W=`prescan: ${A.checksRun} checks in ${A.durationMs}ms — ${Z} error(s), ${X} warning(s), ${G} info`,K=Z>0?WZ.red:X>0?WZ.yellow:WZ.dim;Y.push(J(K,W));let H=_k(A,$).filter((z)=>!(Q.ignoreFatal&&z.severity==="error"));if(H.length>0)Y.push(J(WZ.dim,`rollout: ${H.length} finding(s) are information only until their enforcement deadline`));if(Q.verbose)Y.push(J(WZ.dim,`remote checks skipped: ${A.skippedRemote}`));return Y.join(`
|
|
1028
1028
|
`)}function uRQ(A){let Q=A.findings.map((B)=>{let $={id:B.id,severity:B.severity,title:B.title};if(B.detail)$.detail=B.detail;if(B.fix)$.fix=B.fix;if(B.docsUrl)$.docsUrl=B.docsUrl;if(B.enforceAfter)$.enforceAfter=B.enforceAfter;return $});return JSON.stringify({version:1,counts:A.counts,checksRun:A.checksRun,durationMs:A.durationMs,skippedRemote:A.skippedRemote,findings:Q},null,2)}var hr0,hRQ,WZ,ur0;var mRQ=b(()=>{hr0=["error","warning","info"],hRQ={error:"✖ ERROR",warning:"⚠ WARN ",info:"ℹ INFO "},WZ={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",dim:"\x1B[2m",bold:"\x1B[1m"},ur0={error:WZ.bold+WZ.red,warning:WZ.bold+WZ.yellow,info:WZ.dim}});var _SA={};e6(_SA,{validateFlags:()=>cRQ,runPrescanGate:()=>lr0,prescanCommand:()=>PSA,exitCodeFor:()=>dRQ,executePrescan:()=>lRQ});import{cwd as cr0,exit as dr0}from"node:process";function cRQ(A){if(A.failOnWarnings&&A.ignoreFatal)throw Error("--ignore-fatal and --fail-on-warnings are contradictory — pick one")}function dRQ(A,Q,B=[]){if(Q.ignoreFatal)return 0;let $=Tk({counts:A,findings:B},Q.now);if($.error>0)return 1;if($.warning>0&&Q.failOnWarnings)return 2;return 0}async function lRQ(A,Q){let B=Q.platform;if(B!=="ios"&&B!=="android")throw Error("--platform must be ios or android");let $=Q.apikey??N8(),J;if($)try{J=await VB($,Q.supaHost,Q.supaAnon,!0)}catch{}let Y=await _NQ({appId:A,platform:B,projectDir:Q.path??cr0(),distributionMode:Q.iosDist,androidFlavor:Q.androidFlavor,apikey:$,supabase:J,credentials:Q.credentials}),Z=xNQ({skip:Q.skip,warn:Q.warn});return vNQ(Z,gRQ),{report:await uNQ(Y,jSA,{overrides:Z}),appId:Y.appId,apikey:$}}async function PSA(A,Q){if(cRQ(Q),!Q.json)g0("Capgo build prescan");let{report:B,appId:$,apikey:J}=await lRQ(A,Q);if(Q.json)console.log(uRQ(B));else{v.message(wSA(B,{verbose:Q.verbose,now:Q.now,ignoreFatal:Q.ignoreFatal}));let Y=BSA(B,Q);u0(Y==="block"?"Prescan found blocking problems — fix them before building.":"Prescan finished.")}if(J){let Y=Tk(B,Q.now),Z=_k(B,Q.now).length;await xB(J,{channel:"build",event:"Prescan run",tags:{source:"standalone",result:Y.error>0?Q.ignoreFatal?"bypassed":"blocked":Y.warning>0?Q.failOnWarnings?"blocked":"warned":Z>0?"information-only":"clean","app-id":$,platform:Q.platform??"unknown",errors:String(B.counts.error),warnings:String(B.counts.warning),"finding-ids":B.findings.filter((X)=>X.severity!=="info").map((X)=>X.id).join(",").slice(0,200),"information-only-findings":String(Z)}},Q.verbose).catch(()=>{})}dr0(dRQ(B.counts,Q,B.findings))}async function lr0(A,Q){if(!A.enabled)return{decision:"proceed",report:null,crashed:!1,informationOnlyFindings:0};let B=()=>{},$=A.print??(A.silent?B:(G)=>v.message(G)),J=A.warn??(A.silent?B:(G)=>v.warn(G)),Y;try{Y=await Q()}catch(G){return J(`prescan crashed and was skipped: ${G instanceof Error?G.message:String(G)}`),{decision:"proceed",report:null,crashed:!0,informationOnlyFindings:0}}if(Y.findings.length>0)$(wSA(Y,{now:A.now,ignoreFatal:A.ignoreFatal}));let Z=BSA(Y,{ignoreFatal:A.ignoreFatal,failOnWarnings:A.failOnWarnings,now:A.now}),X;if(Z==="ask")X=A.interactive===!1?"proceed":await cNQ("ask",{silent:A.silent});else X=Z;return{decision:X,report:Y,crashed:!1,informationOnlyFindings:_k(Y,A.now).length}}var r9A=b(()=>{s0();I0();TNQ();mNQ();dNQ();yRQ();mRQ()});import{Buffer as pRQ}from"node:buffer";import{existsSync as K3,readdirSync as SSA,readFileSync as pr0,statSync as ir0}from"node:fs";import{mkdir as nr0,readFile as a9A,rm as rr0,stat as ar0,writeFile as or0}from"node:fs/promises";import{tmpdir as sr0}from"node:os";import{basename as iRQ,join as R7,resolve as TSA}from"node:path";import t9,{cwd as nRQ,exit as tr0}from"node:process";async function er0(){return I$({message:"No platform selected. Which platform do you want to build?",options:[{value:"ios",label:"iOS"},{value:"android",label:"Android"}]})}async function Aa0(A,{silent:Q=!1,interactive:B=k6({silent:Q}),promptPlatform:$=er0}={}){if(A==="ios"||A==="android")return A;if(A)throw Error(`Invalid platform "${A}". Must be "ios" or "android"`);if(!B)throw Error("Missing required argument: --platform <ios|android>. In an interactive terminal, you can omit --platform and choose one when prompted.");let J=await $();if(HB(J))throw v.warn("Build request canceled."),new pA("Build request canceled.");if(J!=="ios"&&J!=="android")throw Error("Build request canceled.");return J}function Qa0(A){return{info:(Q)=>{if(!A)v.info(Q)},error:(Q)=>{if(!A)v.error(Q)},warn:(Q)=>{if(!A)v.warn(Q)},success:(Q)=>{if(!A)v.success(Q)},buildLog:(Q)=>{if(!A)console.log(Q)},uploadProgress:(()=>{let Q=A?null:J$(),B=!1;return($)=>{if(A||!Q)return;if(!B)Q.start("Uploading bundle"),B=!0;if($>=100)Q.stop("Upload complete!");else Q.message(`Uploading ${$.toFixed(0)}%`)}})(),customMsg:async(Q,B)=>{if(!A)await sR(Q,B,($)=>console.log($),($)=>v.warn($))}}}function Ba0(A){try{let Q=JSON.parse(A);if(!Q||typeof Q!=="object")return null;return Q}catch{return null}}async function rRQ(A,Q,B,$){if(A!==429)return;let J=Ba0(Q),Y=J?.error;if(Y!=="native_build_concurrency_limit_exceeded"&&Y!=="need_plan_upgrade")return;let Z=await wU(),X=J?.moreInfo?.upgrade_url||`${Z.hostWeb}/settings/organization/plans`,G=J?.message||(Y==="native_build_concurrency_limit_exceeded"?`Native build concurrency limit reached for your plan. Upgrade here: ${X}`:`Cannot ${B} native build, upgrade plan to continue: ${X}`);if($.error(G),!G.includes(X))$.error(`Upgrade here: ${X}`);try{await(await Promise.resolve().then(() => (JW(),Ly))).default(X)}catch{}throw Error(G)}async function $a0(A,Q,B=3,$){let J=[1000,3000,5000];for(let Y=1;Y<=B;Y++)try{let Z=await fetch(A,Q);if(Z.ok||Z.status>=400&&Z.status<500)return Z;let X=await Z.text().catch(()=>"unknown error");if($?.warn(`Build request attempt ${Y}/${B} failed: ${Z.status} - ${X}`),Y<B){let G=J[Y-1]||5000;$?.info(`Retrying in ${G/1000}s...`),await new Promise((W)=>setTimeout(W,G))}else throw Error(`Failed to request build after ${B} attempts: ${Z.status} - ${X}`)}catch(Z){let X=Z instanceof Error?Z.message:String(Z);if(X.startsWith("Failed to request build after"))throw Z;if($?.warn(`Build request attempt ${Y}/${B} failed: ${X}`),Y<B){let G=J[Y-1]||5000;$?.info(`Retrying in ${G/1000}s...`),await new Promise((W)=>setTimeout(W,G))}else throw Error(`Failed to request build after ${B} attempts: ${X}`)}throw Error("Unexpected error in fetchWithRetry")}function aRQ(A){let Q={};if(A?.cache===!1)Q.cache_enabled=!1;let B=A?.cacheKey?.trim();if(B)Q.cache_key=B,Q.cache_fingerprint_extra=B;return Q}function Ya0(A){return A.cache!==!1&&!A.cacheKey?.trim()&&A.aiAnalysisMode!=="caller-handled"}function Xa0(A){if(typeof A.data==="string")return A.data;if(A.data instanceof ArrayBuffer)return new TextDecoder().decode(A.data);if(ArrayBuffer.isView(A.data)){let Q=A.data;return new TextDecoder().decode(new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength))}if(A.data&&typeof A.data.toString==="function")return A.data.toString();return""}function tRQ(A,Q,B){if(Q)Q.warn(A);else if(!B)v.warn(A)}async function Ga0(A,Q,B,$){try{if(B)await B.customMsg(A,Q);else if(!$)await sR(A,Q,(J)=>console.log(J),(J)=>v.warn(J))}catch(J){tRQ(`Custom message handler encountered an error, continuing... ${String(J)}`,B,$)}}async function Wa0(A,Q=!1,B,$,J,Y,Z,X){if(A&&!X)return null;let G=null,W=!1,K=(z)=>{if(!z.trim())return;if(G)return;if(!W)if(W=!0,X)X.buildLog("");else console.log("");if(X)X.buildLog(z);else console.log(z)},H=async()=>{if(!B||!$)return null;let z=wZ(B),q=`${z}/start`,I=`${z}/stream?token=${encodeURIComponent($)}`.replace(/^https:/,"wss:").replace(/^http:/,"ws:");if(X)X.info("Connecting to log streaming...");else if(!A)console.log("Connecting to log streaming...");let M=await fetch(q,{method:"POST",headers:b4({"x-capgo-log-token":$})});if(!M.ok){let C=await M.text().catch(()=>"unknown error");if(X)X.warn(`Could not start log session (${M.status}): ${C}`);else if(!A)console.warn(`Could not start log session (${M.status}): ${C}`);return null}return await new Promise((C)=>{let V=!1,L=10,N=0,R=!1,E=new $p(I,void 0,{maxRetries:L,WebSocket:OM}),w=null,k=0,y=Date.now(),S=!1,f=2000,c=4,o=o9A,e=null,r=null,i=(g)=>{if(V)return;if(V=!0,r)clearTimeout(r),r=null;if(w)clearInterval(w),w=null;if(Y&&e)Y.removeEventListener("abort",e),e=null;try{E.close()}catch(h){fB(`ws.close failed during cleanup (ignored): ${h instanceof Error?h.message:String(h)}`)}C(g)};r=setTimeout(()=>{if(!V){if(X)X.warn("Log streaming timed out after 3 hours");else if(!A)console.warn("Log streaming timed out after 3 hours");i(null)}},10800000);let l=()=>{if(w)return;w=setInterval(async()=>{try{if(E.readyState===$p.OPEN)E.send(JSON.stringify({type:"heartbeat",lastId:k}));let g=Date.now();if(J&&!S&&g-y>=f*c){S=!0;try{let h=await J();if(h&&o.has(h))G=h,i(G)}finally{S=!1}}}catch(g){if(X)X.warn(`Heartbeat encountered an error, continuing... ${String(g)}`);else if(!A)v.warn(`Heartbeat encountered an error, continuing... ${String(g)}`)}},f)},x=async(g)=>{if(g.type==="custom_msg"&&typeof g.kind==="string"&&g.data){y=Date.now(),await Ga0(g.kind,g.data,X,A);return}if(g.type==="status"&&typeof g.status==="string"){let h=g.status.toLowerCase();if(y=Date.now(),o.has(h))G=h;return}if(g.type==="log"&&typeof g.message==="string"){y=Date.now(),K(g.message);return}if(typeof g.message==="string")y=Date.now(),K(g.message)},p=(g)=>{if(E.readyState!==$p.OPEN)return;try{E.send(JSON.stringify({type:"confirmed_received",lastId:g}))}catch(h){tRQ(`Failed to send log confirmation, continuing... ${String(h)}`,X,A)}};if(l(),Y){if(e=()=>{if(!V)i("cancelled")},Y.aborted){i("cancelled");return}Y.addEventListener("abort",e)}E.addEventListener("message",async(g)=>{let h=Xa0(g),QA=null;try{QA=JSON.parse(h)}catch{QA=null}if(QA?.type==="heartbeat_response")return;if(QA?.type==="batch_messages"&&Array.isArray(QA.messages)){let d=k;for(let s of QA.messages)if(await x(s),typeof s.id==="number")d=Math.max(d,s.id);if(d>k)k=d,p(d)}else{if(QA)await x(QA);else if(h)y=Date.now(),K(h);if(QA&&typeof QA.id==="number"&&QA.id>k)k=QA.id,p(QA.id)}if(G)i(G)}),E.addEventListener("error",()=>{if(N+=1,X)X.warn(`Log stream encountered an error, retrying (${N}/${L})...`);else if(!A)console.warn(`Log stream encountered an error, retrying (${N}/${L})...`);if(!R&&N>=L){if(R=!0,X)X.warn("Log stream retry limit reached. Falling back to status checks.");else if(!A)v.warn("Log stream retry limit reached. Falling back to status checks.");if(Z)Z();i(null)}}),E.addEventListener("close",()=>{if(V)return;if(G){i(G);return}if(X)X.warn("Log stream closed, waiting for reconnect...");else if(!A)v.warn("Log stream closed, waiting for reconnect...")})})};try{let z=await H();if(z||G)return z||G}catch(z){if(X)X.warn(`Direct log streaming failed${z instanceof Error?`: ${z.message}`:""}`);else if(!A)v.warn(`Direct log streaming failed${z instanceof Error?`: ${z.message}`:""}`)}return G}async function Ka0(A,Q,B,$,J,Y,Z=!1,X,G){let K=0;while(K<120){if(X?.aborted)return"cancelled";try{let H=await fetch(`${A}/build/status?job_id=${encodeURIComponent(Q)}&app_id=${encodeURIComponent(B)}&platform=${$}`,{headers:b4({authorization:J}),signal:X});if(!H.ok){G?.warn(`Status check failed: ${H.status}`),await new Promise((D)=>setTimeout(D,5000)),K++;continue}let z=await H.json(),q=z.status?.toLowerCase?.()??"";if(Z)G?.info(`Build status: ${q||z.status}`);if(o9A.has(q))return q;await new Promise((D)=>setTimeout(D,5000)),K++}catch(H){if(X?.aborted)return"cancelled";G?.warn(`Status check error: ${H}`),await new Promise((z)=>setTimeout(z,5000)),K++}}return G?.warn("Build status polling timed out"),"timeout"}async function Ha0(A,Q,B){let $=new Set,J=new Set,Y=!1,Z=!1;if(Q==="ios"){let X=R7(A,B,"App","CapApp-SPM","Package.swift");if(K3(X)){Y=!0;let K=(await a9A(X,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.[\\/])*node_modules[\\/]([^"']+)["']\s*\)/g);for(let H of K){let z=H[1].replace(/\\/g,"/"),q=z.lastIndexOf("node_modules/");if(q!==-1)z=z.substring(q+13);$.add(z)}}let G=R7(A,B);if(K3(G)){let W=[R7(G,"App","Podfile"),R7(G,"Podfile")];for(let H of SSA(G,{withFileTypes:!0}))if(H.isDirectory())W.push(R7(G,H.name,"Podfile"));let K=[...new Set(W)].filter((H)=>K3(H));if(K.length>0)Z=!0;for(let H of K){let q=(await a9A(H,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"](?:\.\.[\\/])+node_modules[\\/]([^'"]+)['"]/g);for(let D of q){let I=D[1],M=I.lastIndexOf("node_modules/");if(M!==-1)I=I.substring(M+13);$.add(I)}}}}else if(Q==="android"){let X=R7(A,B,"capacitor.settings.gradle");if(K3(X)){let K=(await a9A(X,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.[\\/]node_modules[\\/]([^'"]+)['"]\s*\)/g);for(let H of K){let z=H[1].replace(/\\/g,"/"),q=z.lastIndexOf("node_modules/");if(q!==-1)z=z.substring(q+13);let D=z.replace(/\/(android|capacitor)$/,"");$.add(D)}}let G=R7(A,B,"capacitor-cordova-android-plugins","build.gradle");if(K3(G)){let K=(await a9A(G,"utf-8")).matchAll(/apply\s+from\s*:\s*["'](?:\.\.\/)+node_modules\/([^"']+)["']/g);for(let H of K){let z=H[1],q=z.lastIndexOf("node_modules/");if(q!==-1)z=z.substring(q+13);let D=z.split("/"),I=D[0].startsWith("@")&&D.length>=2?`${D[0]}/${D[1]}`:D[0];J.add(I)}}}return{packages:$,cordovaPackages:J,usesSPM:Y,usesCocoaPods:Z}}function Fa0(A,Q){let B=R7(A,Q,"App");if(K3(R7(B,"Podfile")))return"cocoapods";if(K3(R7(B,"CapApp-SPM","Package.swift")))return"spm";return}function oRQ(A,Q,B,$){let J=A.replace(/\\/g,"/");if(J.startsWith(`${$}/`))return!0;if(J==="package.json"||J==="package-lock.json"||J.startsWith("capacitor.config."))return!0;if(J.startsWith("resources/"))return!0;if(Q==="ios"&&J.startsWith("node_modules/@capacitor/ios/"))return!0;if(Q==="android"&&J.startsWith("node_modules/@capacitor/android/"))return!0;if(Q==="android")for(let Y of B.cordovaPackages){let Z=`node_modules/${Y}/`;if(J===`node_modules/${Y}/package.json`)return!0;if(J.startsWith(Z)){let X=J.slice(Z.length);if(X==="node_modules"||X.startsWith("node_modules/"))continue;return!0}}for(let Y of B.packages){let Z=`node_modules/${Y}/`;if(J===`${Z}package.json`)return!0;if(Q==="android"){if(J.startsWith(`${Z}android/`))return!0}else if(Q==="ios"){if(J.startsWith(`${Z}ios/`))return!0;if(B.usesSPM){if(J===`${Z}Package.swift`)return!0}if(B.usesCocoaPods||!B.usesSPM){if(J.startsWith(Z)&&J.endsWith(".podspec"))return!0}}}return!1}function np(A,Q,B,$,J,Y){let Z=SSA(Q);for(let X of Z){let G=R7(Q,X),W=B?`${B}/${X}`:X,K=ir0(G);if(K.isDirectory()){if(X===".git"||X==="dist"||X==="build"||X===".angular"||X===".vite"||X===".gradle"||X===".idea"||X===".swiftpm")continue;if(X==="node_modules"){np(A,G,W,$,J,Y);continue}if(X==="resources"){np(A,G,W,$,J,Y);continue}let H=W.replace(/\\/g,"/"),z=[...J.packages,...J.cordovaPackages];if(oRQ(W,$,J,Y)||Y===H||Y.startsWith(`${H}/`)||z.some((D)=>{return`node_modules/${D}/`.startsWith(`${H}/`)||H.startsWith(`node_modules/${D}`)}))np(A,G,W,$,J,Y)}else if(K.isFile()){if(X===".DS_Store"||X.endsWith(".log"))continue;if(oRQ(W,$,J,Y))za0(A,G,W)}}}function za0(A,Q,B){let $=B.replace(/\\/g,"/");if(A.getEntry($))return;let J=$.lastIndexOf("/"),Y=J===-1?void 0:$.slice(0,J);A.addLocalFile(Q,Y)}function Ua0(A){if(!A)return[];let Q=A.split(",").map((B)=>B.trim()).filter(Boolean).map((B)=>TSA(B));return[...new Set(Q)]}function qa0(A,Q){let B=new Set([...Q.packages,...Q.cordovaPackages]);return B.add(A==="ios"?"@capacitor/ios":"@capacitor/android"),B}function Da0(A,Q){let B=R7(A,...Q.split("/"));if(K3(B))return B;let $=R7(A,".pnpm");if(!K3($))return;let J=Q.replace("/","+"),Y=SSA($,{withFileTypes:!0}).filter((Z)=>Z.isDirectory()).map((Z)=>Z.name).filter((Z)=>Z.startsWith(`${J}@`)).sort();if(Y.length>1)throw Error(`Multiple pnpm store entries found for ${Q} in ${$}; provide the app-specific node_modules path so the native build archive can use the exact resolved package.`);for(let Z of Y){let X=R7($,Z,"node_modules",...Q.split("/"));if(K3(X))return X}return}function Ia0(A,Q,B,$,J){if(Q.length===0)return;let Y=Q.filter((Z)=>!K3(Z));if(Y.length>0)throw Error(`Missing node_modules folder at ${Y.join(", ")}`);for(let Z of Q)for(let X of qa0(B,$)){let G=Da0(Z,X);if(!G)continue;np(A,G,`node_modules/${X}`,B,$,J)}}async function Ma0(A,Q,B,$,J={}){let Y=v9($,B),Z=await Ha0(A,B,Y),X=new sRQ.default;np(X,A,"",B,Z,Y),Ia0(X,Ua0(J.nodeModules),B,Z,Y);let G=/node_modules\/\.pnpm\/[^/\n\r]+(?:\/[^/\n\r]+)*\/node_modules\//g,W=/node_modules\/\.bun\/[^/\n\r]+(?:\/[^/\n\r]+)*\/node_modules\//g,K=new Set(["",".gradle",".swift",".json",".lock",".xml",".properties",".pbxproj",".xcconfig",".plist",".podspec",".rb",".yaml",".yml"]);for(let z of X.getEntries()){if(z.isDirectory)continue;let q=z.entryName.includes(".")?`.${z.entryName.split(".").pop()}`:"",D=z.entryName.split("/").pop()||"";if(!K.has(q)&&D!=="Podfile")continue;let I=z.getData().toString("utf-8"),M=DIQ(I);if(M=M.replace(G,"node_modules/").replace(W,"node_modules/"),B==="ios"){let C="../".repeat(z.entryName.split("/").length-1);M=M.replace(/(?:\.\.\/){4,}(ios\/|node_modules\/)/g,(V,L)=>`${C}${L}`)}if(M!==I)X.updateFile(z.entryName,pRQ.from(M,"utf-8"))}let H=R7(A,"capacitor.config.json");if($&&!K3(H)){let z=`${JSON.stringify($,null,2)}
|
|
1029
1029
|
`;X.addFile("capacitor.config.json",pRQ.from(z,"utf-8"))}await or0(Q,X.toBuffer())}function Oa0(A){let Q=A.trim().replace(/^xcode\s*/i,"");return/^\d{1,3}(?:\.\d{1,3}){0,2}$/.test(Q)?Q:void 0}function Na0(A){if(!A||A.length===0)return;let Q={};for(let B of A){let $=B.indexOf("=");if($<=0)throw Error('--store-release-notes-locale must use locale=notes format, for example: --store-release-notes-locale en-US="Bug fixes"');let J=B.slice(0,$).trim(),Y=B.slice($+1).trim();if(!J||!Y)throw Error("--store-release-notes-locale requires both a locale and non-empty release notes");Q[J]=Y}return Object.keys(Q).length>0?Q:void 0}function t9A(A){let Q=A?.trim();if(!Q)return;let B;try{B=JSON.parse(Q)}catch(J){throw Error(`CAPGO_STORE_RELEASE_NOTES_LOCALIZED must be valid JSON: ${J instanceof Error?J.message:String(J)}`)}if(!B||typeof B!=="object"||Array.isArray(B))throw Error('CAPGO_STORE_RELEASE_NOTES_LOCALIZED must be a JSON object like {"en-US":"Bug fixes"}');let $={};for(let[J,Y]of Object.entries(B)){let Z=J.trim();if(typeof Y!=="string"||!Y.trim())throw Error(`CAPGO_STORE_RELEASE_NOTES_LOCALIZED.${Z||J} must be a non-empty string`);if(!Z)throw Error("CAPGO_STORE_RELEASE_NOTES_LOCALIZED cannot contain an empty locale key");$[Z]=Y.trim()}return Object.keys($).length>0?$:void 0}function Ca0(A,Q,B,$){let J=t9A(A.CAPGO_STORE_RELEASE_NOTES_LOCALIZED),Y=A.CAPGO_IOS_AUTOMATIC_RELEASE===void 0?void 0:A.CAPGO_IOS_AUTOMATIC_RELEASE==="true",Z={platform:Q,buildMode:B,cliVersion:$,iosScheme:A.CAPGO_IOS_SCHEME,iosTarget:A.CAPGO_IOS_TARGET,iosDistribution:A.CAPGO_IOS_DISTRIBUTION,iosXcodeVersion:Q==="ios"?A.CAPGO_IOS_XCODE_VERSION:void 0,iosSourceDir:A.CAPGO_IOS_SOURCE_DIR,iosAppDir:A.CAPGO_IOS_APP_DIR,iosProjectDir:A.CAPGO_IOS_PROJECT_DIR,androidSourceDir:A.CAPGO_ANDROID_SOURCE_DIR,androidAppDir:A.CAPGO_ANDROID_APP_DIR,androidProjectDir:A.CAPGO_ANDROID_PROJECT_DIR,androidFlavor:A.CAPGO_ANDROID_FLAVOR,outputUploadEnabled:A.BUILD_OUTPUT_UPLOAD_ENABLED==="true",outputRetentionSeconds:A.BUILD_OUTPUT_RETENTION_SECONDS?Number.parseInt(A.BUILD_OUTPUT_RETENTION_SECONDS,10)||SU:SU,skipBuildNumberBump:A.SKIP_BUILD_NUMBER_BUMP==="true",skipMarketingVersionBump:A.SKIP_MARKETING_VERSION_BUMP==="true",submitToStoreReview:A.CAPGO_STORE_SUBMIT_REVIEW==="true",storeReleaseName:A.CAPGO_STORE_RELEASE_NAME,storeReleaseNotes:A.CAPGO_STORE_RELEASE_NOTES,storeReleaseNotesLocalized:J,iosTestflightGroups:A.CAPGO_IOS_TESTFLIGHT_GROUPS,iosAutomaticRelease:Y},X={};for(let[G,W]of Object.entries(A))if(!La0.has(G)&&W!==void 0)X[G]=W;return{buildOptions:Z,buildCredentials:X}}async function QD(A,Q,B=!1,$){if(!$H())TM(A);fB(`build request: started for ${A} (platform ${Q.platform??"auto"})`);let J=Date.now(),Y=Q.verbose??!1,Z=$||Qa0(B),X=null,G=Q.outputRecord?{...Z,customMsg:async(W,K)=>{if(W==="qr_download_link"&&typeof K.url==="string")X=K.url;await Z.customMsg(W,K)}}:Z;try{if(Q.prescan===!0){let{validateFlags:s}=await Promise.resolve().then(() => (r9A(),_SA));s({ignoreFatal:Q.prescanIgnoreFatal,failOnWarnings:Q.failOnWarnings})}Q.apikey=Q.apikey||V0(B);let W=TSA(Q.path||nRQ()),K=await $9A(W,()=>h0());if(A=qJ(A,K?.config,"native")||"",!A)throw Error("Missing argument, you need to provide a appId, or be in a capacitor project");let H=await Aa0(Q.platform,{silent:B});if(H==="ios"&&Q.syncIosVersion){let s=sTA({path:W});G.info(s.changed?`Synced iOS app version to ${s.marketingVersion}`:`iOS app version is already ${s.marketingVersion}`)}if(H==="android"&&Q.syncAndroidVersion){let s=tOQ({path:W});G.info(s.changed?`Synced Android app version to ${s.packageVersion}`:`Android app version is already ${s.packageVersion}`)}let z=Q.supaHost||"https://api.capgo.app",q=await VB(Q.apikey,Q.supaHost,Q.supaAnon),D="";try{D=await V9(Q.apikey,A,{supaHost:Q.supaHost,supaAnon:Q.supaAnon})}catch{}if(G.info(`Requesting native build for ${A}`),G.info(`Platform: ${H}`),G.info(`Project: ${W}`),G.info(`
|
|
1030
1030
|
\uD83D\uDD12 Security: Credentials are never stored on Capgo servers`),G.info(" They are used only during build and deleted after"),G.info(` Build outputs can optionally be uploaded for time-limited download links
|