@capgo/cli 8.65.0 → 8.66.0
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 +359 -359
- package/dist/notify-app-ready-worker.js +3 -3
- package/dist/onboarding-worker.js +3 -3
- package/dist/package.json +1 -1
- package/dist/src/analytics/org-resolver.d.ts +3 -1
- package/dist/src/build/onboarding/telemetry.d.ts +1 -1
- package/dist/src/sdk.js +4 -4
- package/dist/updater-installed-worker.js +3 -3
- package/package.json +1 -1
package/dist/src/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as sT0}from"node:module";var module={exports:{}};var pT0=Object.create;var{getPrototypeOf:iT0,defineProperty:bG,getOwnPropertyNames:gg}=Object;var nw=Object.prototype.hasOwnProperty;function pw($){return this[$]}var z0=($,D,X)=>{var Q=gg(D);for(let J of Q)if(!nw.call($,J)&&J!=="default")bG($,J,{get:pw.bind(D,J),enumerable:!0});if(X){for(let J of Q)if(!nw.call(X,J)&&J!=="default")bG(X,J,{get:pw.bind(D,J),enumerable:!0});return X}},rT0,oT0,x$=($,D,X)=>{var Q=$!=null&&typeof $==="object";if(Q){var J=D?rT0??=new WeakMap:oT0??=new WeakMap,Y=J.get($);if(Y)return Y}X=$!=null?pT0(iT0($)):{};let Z=D||!$||!$.__esModule?bG(X,"default",{value:$,enumerable:!0}):X;for(let F of gg($))if(!nw.call(Z,F))bG(Z,F,{get:pw.bind($,F),enumerable:!0});if(Q)J.set($,Z);return Z};var E=($,D)=>()=>(D||$((D={exports:{}}).exports,D),D.exports);var tT0=($)=>$;function aT0($,D){this[$]=tT0.bind(null,D)}var H6=($,D)=>{for(var X in D)bG($,X,{get:D[X],enumerable:!0,configurable:!0,set:aT0.bind(D,X)})};var o=($,D)=>()=>($&&(D=$($=0)),D);var Q0=sT0(import.meta.url);var s1;var z8=o(()=>{s1={name:"@capgo/cli",type:"module",version:"8.65.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",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: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","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:manifest-path-encoding":"bun test/test-manifest-path-encoding.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-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 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: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: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:manifest-path-encoding && 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-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: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","@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"}}});var G0;var v$=o(()=>{G0=class G0 extends Error{context;constructor($,D){super($);this.name="CliUserError",this.context=D}}});import{platform as $C0}from"node:os";import{version as DC0}from"node:process";function JC0($){for(let D=0;D<$.length;D++)if($.charCodeAt(D)>255)return!1;return!0}function mg($){if($.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 YC0($){if($.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($.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 rw($,D){if(D===void 0||D===null){if(iw.has($.toLowerCase()))throw new G0(mg($));throw new G0(`HTTP header "${$}" is missing or invalid.`)}if(typeof D!=="string"){if(iw.has($.toLowerCase()))throw new G0(mg($));throw new G0(`HTTP header "${$}" is missing or invalid.`)}if(!JC0(D)){if(iw.has($.toLowerCase()))throw new G0(YC0($));throw new G0(`HTTP header "${$}" contains invalid characters (only ASCII is allowed).`)}return D}function p$($){let D={capgo_api:XC0,"x-cli-version":s1.version,"x-cli-command":QC0,"x-cli-node":DC0,"x-cli-os":$C0()};if($)for(let[X,Q]of Object.entries($))D[X]=rw(X,Q);return D}var XC0="2025-10-01",QC0="",iw;var G4=o(()=>{z8();v$();iw=new Set(["authorization","capgkey","x-capgo-log-token"])});var dg,cg=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},lg=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var ng=o(()=>{dg=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(D)=>{let X=0;$.lastIndex=0;while($.test(D))X+=1;return D.length-X}})()});var ZC0,FC0,pg,GC0,ig,WC0,qC0,UC0,rg=($,D={},X={})=>{let Q=D.limit??1/0,J=D.ellipsis??"",Y=D?.ellipsisWidth??(J?rg(J,UC0,X).width:0),Z=0,F=X.controlWidth??0,G=X.tabWidth??8,W=X.emojiWidth??2,q=2,U=X.regularWidth??1,H=X.wideWidth??2,K=[[WC0,U],[ZC0,0],[FC0,F],[GC0,G],[ig,W],[pg,H]],O=0,V=0,z=$.length,N=0,w=!1,L=z,M=Math.max(0,Q-Y),B=0,R=0,P=0,v=0;$:while(!0){if(R>B||V>=z&&V>O){let j=$.slice(B,R)||$.slice(O,V);N=0;for(let k of j.replaceAll(qC0,"")){let x=k.codePointAt(0)||0;if(cg(x))v=2;else if(lg(x))v=H;else v=U;if(P+v>M)L=Math.min(L,Math.max(B,O)+N);if(P+v>Q){w=!0;break $}N+=k.length,P+=v}B=R=0}if(V>=z)break $;for(let j=0,k=K.length;j<k;j++){let[x,g]=K[j];if(x.lastIndex=V,x.test($)){if(N=x===pg?dg($.slice(V,x.lastIndex)):x===ig?1:x.lastIndex-V,v=N*g,P+v>M)L=Math.min(L,V+Math.floor((M-P)/g));if(P+v>Q){w=!0;break $}P+=v,B=O,R=V,V=O=x.lastIndex;continue $}}V+=1}return{width:w?M:P,index:w?L:z,truncated:w,ellipsed:w&&Q>=Y}},og;var tg=o(()=>{ng();ZC0=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,FC0=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,pg=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,GC0=/\t{1,1000}/y,ig=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,WC0=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,qC0=/\p{M}+/gu,UC0={limit:1/0,ellipsis:""},og=rg});var HC0,KC0=($,D={})=>{return og($,HC0,D).width},l8;var ow=o(()=>{tg();HC0={limit:1/0,ellipsis:"",ellipsisWidth:0},l8=KC0});function m7($,D,X){return String($).normalize().split(MC0).map((Q)=>LC0(Q,D,X)).join(`
|
|
1
|
+
import{createRequire as sT0}from"node:module";var module={exports:{}};var pT0=Object.create;var{getPrototypeOf:iT0,defineProperty:bG,getOwnPropertyNames:gg}=Object;var nw=Object.prototype.hasOwnProperty;function pw($){return this[$]}var z0=($,D,X)=>{var Q=gg(D);for(let J of Q)if(!nw.call($,J)&&J!=="default")bG($,J,{get:pw.bind(D,J),enumerable:!0});if(X){for(let J of Q)if(!nw.call(X,J)&&J!=="default")bG(X,J,{get:pw.bind(D,J),enumerable:!0});return X}},rT0,oT0,x$=($,D,X)=>{var Q=$!=null&&typeof $==="object";if(Q){var J=D?rT0??=new WeakMap:oT0??=new WeakMap,Y=J.get($);if(Y)return Y}X=$!=null?pT0(iT0($)):{};let Z=D||!$||!$.__esModule?bG(X,"default",{value:$,enumerable:!0}):X;for(let F of gg($))if(!nw.call(Z,F))bG(Z,F,{get:pw.bind($,F),enumerable:!0});if(Q)J.set($,Z);return Z};var E=($,D)=>()=>(D||$((D={exports:{}}).exports,D),D.exports);var tT0=($)=>$;function aT0($,D){this[$]=tT0.bind(null,D)}var H6=($,D)=>{for(var X in D)bG($,X,{get:D[X],enumerable:!0,configurable:!0,set:aT0.bind(D,X)})};var o=($,D)=>()=>($&&(D=$($=0)),D);var Q0=sT0(import.meta.url);var s1;var z8=o(()=>{s1={name:"@capgo/cli",type:"module",version:"8.66.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",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: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","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:manifest-path-encoding":"bun test/test-manifest-path-encoding.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-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 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: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: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:manifest-path-encoding && 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-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: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","@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"}}});var G0;var v$=o(()=>{G0=class G0 extends Error{context;constructor($,D){super($);this.name="CliUserError",this.context=D}}});import{platform as $C0}from"node:os";import{version as DC0}from"node:process";function JC0($){for(let D=0;D<$.length;D++)if($.charCodeAt(D)>255)return!1;return!0}function mg($){if($.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 YC0($){if($.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($.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 rw($,D){if(D===void 0||D===null){if(iw.has($.toLowerCase()))throw new G0(mg($));throw new G0(`HTTP header "${$}" is missing or invalid.`)}if(typeof D!=="string"){if(iw.has($.toLowerCase()))throw new G0(mg($));throw new G0(`HTTP header "${$}" is missing or invalid.`)}if(!JC0(D)){if(iw.has($.toLowerCase()))throw new G0(YC0($));throw new G0(`HTTP header "${$}" contains invalid characters (only ASCII is allowed).`)}return D}function p$($){let D={capgo_api:XC0,"x-cli-version":s1.version,"x-cli-command":QC0,"x-cli-node":DC0,"x-cli-os":$C0()};if($)for(let[X,Q]of Object.entries($))D[X]=rw(X,Q);return D}var XC0="2025-10-01",QC0="",iw;var G4=o(()=>{z8();v$();iw=new Set(["authorization","capgkey","x-capgo-log-token"])});var dg,cg=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},lg=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var ng=o(()=>{dg=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(D)=>{let X=0;$.lastIndex=0;while($.test(D))X+=1;return D.length-X}})()});var ZC0,FC0,pg,GC0,ig,WC0,qC0,UC0,rg=($,D={},X={})=>{let Q=D.limit??1/0,J=D.ellipsis??"",Y=D?.ellipsisWidth??(J?rg(J,UC0,X).width:0),Z=0,F=X.controlWidth??0,G=X.tabWidth??8,W=X.emojiWidth??2,q=2,U=X.regularWidth??1,H=X.wideWidth??2,K=[[WC0,U],[ZC0,0],[FC0,F],[GC0,G],[ig,W],[pg,H]],O=0,V=0,z=$.length,N=0,w=!1,L=z,M=Math.max(0,Q-Y),B=0,R=0,P=0,v=0;$:while(!0){if(R>B||V>=z&&V>O){let j=$.slice(B,R)||$.slice(O,V);N=0;for(let k of j.replaceAll(qC0,"")){let x=k.codePointAt(0)||0;if(cg(x))v=2;else if(lg(x))v=H;else v=U;if(P+v>M)L=Math.min(L,Math.max(B,O)+N);if(P+v>Q){w=!0;break $}N+=k.length,P+=v}B=R=0}if(V>=z)break $;for(let j=0,k=K.length;j<k;j++){let[x,g]=K[j];if(x.lastIndex=V,x.test($)){if(N=x===pg?dg($.slice(V,x.lastIndex)):x===ig?1:x.lastIndex-V,v=N*g,P+v>M)L=Math.min(L,V+Math.floor((M-P)/g));if(P+v>Q){w=!0;break $}P+=v,B=O,R=V,V=O=x.lastIndex;continue $}}V+=1}return{width:w?M:P,index:w?L:z,truncated:w,ellipsed:w&&Q>=Y}},og;var tg=o(()=>{ng();ZC0=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,FC0=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,pg=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,GC0=/\t{1,1000}/y,ig=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,WC0=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,qC0=/\p{M}+/gu,UC0={limit:1/0,ellipsis:""},og=rg});var HC0,KC0=($,D={})=>{return og($,HC0,D).width},l8;var ow=o(()=>{tg();HC0={limit:1/0,ellipsis:"",ellipsisWidth:0},l8=KC0});function m7($,D,X){return String($).normalize().split(MC0).map((Q)=>LC0(Q,D,X)).join(`
|
|
2
2
|
`)}var ZK="\x1B",Dm="",OC0=39,aw="\x07",Xm="[",VC0="]",Qm="m",sw,ag,sg=($)=>{if($>=30&&$<=37)return 39;if($>=90&&$<=97)return 39;if($>=40&&$<=47)return 49;if($>=100&&$<=107)return 49;if($===1||$===2)return 22;if($===3)return 23;if($===4)return 24;if($===7)return 27;if($===8)return 28;if($===9)return 29;if($===0)return 0;return},eg=($)=>`${ZK}${Xm}${$}${Qm}`,$m=($)=>`${ZK}${sw}${$}${aw}`,tw=($,D,X)=>{let Q=D[Symbol.iterator](),J=!1,Y=!1,Z=$.at(-1),F=Z===void 0?0:l8(Z),G=Q.next(),W=Q.next(),q=0;while(!G.done){let U=G.value,H=l8(U);if(F+H<=X)$[$.length-1]+=U;else $.push(U),F=0;if(U===ZK||U===Dm)J=!0,Y=D.startsWith(sw,q+1);if(J){if(Y){if(U===aw)J=!1,Y=!1}else if(U===Qm)J=!1}else if(F+=H,F===X&&!W.done)$.push(""),F=0;G=W,W=Q.next(),q+=U.length}if(Z=$.at(-1),!F&&Z!==void 0&&Z.length&&$.length>1)$[$.length-2]+=$.pop()},zC0=($)=>{let D=$.split(" "),X=D.length;while(X){if(l8(D[X-1]))break;X--}if(X===D.length)return $;return D.slice(0,X).join(" ")+D.slice(X).join("")},LC0=($,D,X={})=>{if(X.trim!==!1&&$.trim()==="")return"";let Q="",J,Y,Z=$.split(" "),F=[""],G=0;for(let U=0;U<Z.length;U++){let H=Z[U];if(X.trim!==!1){let O=F.at(-1)??"",V=O.trimStart();if(O.length!==V.length)F[F.length-1]=V,G=l8(V)}if(U!==0){if(G>=D&&(X.wordWrap===!1||X.trim===!1))F.push(""),G=0;if(G||X.trim===!1)F[F.length-1]+=" ",G++}let K=l8(H);if(X.hard&&K>D){let O=D-G,V=1+Math.floor((K-O-1)/D);if(Math.floor((K-1)/D)<V)F.push("");tw(F,H,D),G=l8(F.at(-1)??"");continue}if(G+K>D&&G&&K){if(X.wordWrap===!1&&G<D){tw(F,H,D),G=l8(F.at(-1)??"");continue}F.push(""),G=0}if(G+K>D&&X.wordWrap===!1){tw(F,H,D),G=l8(F.at(-1)??"");continue}F[F.length-1]+=H,G+=K}if(X.trim!==!1)F=F.map((U)=>zC0(U));let W=F.join(`
|
|
3
3
|
`),q=!1;for(let U=0;U<W.length;U++){let H=W[U];if(Q+=H,!q){if(q=H>="\uD800"&&H<="\uDBFF",q)continue}else q=!1;if(H===ZK||H===Dm){ag.lastIndex=U+1;let O=ag.exec(W)?.groups;if(O?.code!==void 0){let V=Number.parseFloat(O.code);J=V===OC0?void 0:V}else if(O?.uri!==void 0)Y=O.uri.length===0?void 0:O.uri}if(W[U+1]===`
|
|
4
4
|
`){if(Y)Q+=$m("");let K=J?sg(J):void 0;if(J&&K)Q+=eg(K)}else if(H===`
|
|
@@ -390,8 +390,8 @@ Please generate a new API key with a shorter expiration:
|
|
|
390
390
|
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var w30=o(()=>{B30()});import{promisify as iY$}from"node:util";import{execFile as rY$}from"node:child_process";async function Ck($=oY$){let{stdout:D}=await $("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),X=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(D);if(!X)throw new R30(`Cannot find Windows browser in stdout: ${JSON.stringify(D)}`);let{id:Q}=X.groups,J=Q.lastIndexOf("."),Y=Q.lastIndexOf("-"),Z=J===-1?void 0:Q.slice(0,J),F=Y===-1?void 0:Q.slice(0,Y);return XN[Q]??XN[Z]??XN[F]??{name:Q,id:Q}}var oY$,XN,QN,R30;var Pk=o(()=>{oY$=iY$(rY$),XN={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},QN=new Map(Object.entries(XN));R30=class R30 extends Error{}});import{promisify as tY$}from"node:util";import Sk from"node:process";import{execFile as aY$}from"node:child_process";async function _k(){if(Sk.platform==="darwin"){let $=await Ik();return{name:await Tk($),id:$}}if(Sk.platform==="linux"){let{stdout:$}=await sY$("xdg-mime",["query","default","x-scheme-handler/http"]),D=$.trim();return{name:eY$(D.replace(/.desktop$/,"").replace("-"," ")),id:D}}if(Sk.platform==="win32")return Ck();throw Error("Only macOS, Linux, and Windows are supported")}var sY$,eY$=($)=>$.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(D)=>D.toUpperCase());var E30=o(()=>{M30();w30();Pk();Pk();sY$=tY$(aY$)});import vk from"node:process";var $Z$,j30;var A30=o(()=>{$Z$=Boolean(vk.env.SSH_CONNECTION||vk.env.SSH_CLIENT||vk.env.SSH_TTY),j30=$Z$});var eq={};H6(eq,{openApp:()=>ZZ$,default:()=>yk,apps:()=>fQ});import xk from"node:process";import S30 from"node:path";import{fileURLToPath as DZ$}from"node:url";import XZ$ from"node:child_process";import QZ$,{constants as JZ$}from"node:fs/promises";function P30($){if(typeof $==="string"||Array.isArray($))return $;let{[T30]:D}=$;if(!D)throw Error(`${T30} is not supported`);return D}function sq({[cZ]:$},{wsl:D}={}){if(D&&N7)return P30(D);if(!$)throw Error(`${cZ} is not supported`);return P30($)}var JN,kk,I30,cZ,T30,C30=async($,D)=>{if($.length===0)return;let X=[];for(let Q of $)try{return await D(Q)}catch(J){X.push(J)}throw AggregateError(X,"Failed to open in all supported apps")},aq=async($)=>{$={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...$};let D=$[JN]===!0;if(delete $[JN],Array.isArray($.app))return C30($.app,(W)=>aq({...$,app:W,[JN]:!0}));let{name:X,arguments:Q=[]}=$.app??{};if(Q=[...Q],Array.isArray(X))return C30(X,(W)=>aq({...$,app:{name:W,arguments:Q},[JN]:!0}));if(X==="browser"||X==="browserPrivate"){let W={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},q={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},U;if(N7){let H=await V30();U=QN.get(H)??{}}else U=await _k();if(U.id in W){let H=W[U.id.toLowerCase()];if(X==="browserPrivate"){if(H==="safari")throw Error("Safari doesn't support opening in private mode via command line");Q.push(q[H])}return aq({...$,app:{name:fQ[H],arguments:Q}})}throw Error(`${U.name} is not supported as a default browser`)}let J,Y=[],Z={},F=!1;if(N7&&!kQ()&&!j30&&!X)F=await O30();if(cZ==="darwin"){if(J="open",$.wait)Y.push("--wait-apps");if($.background)Y.push("--background");if($.newInstance)Y.push("--new");if(X)Y.push("-a",X)}else if(cZ==="win32"||F){if(J=await DN(),Y.push(...M4.argumentsPrefix),!N7)Z.windowsVerbatimArguments=!0;if(N7&&$.target)$.target=await z30($.target);let W=["$ProgressPreference = 'SilentlyContinue';","Start"];if($.wait)W.push("-Wait");if(X){if(W.push(M4.escapeArgument(X)),$.target)Q.push($.target)}else if($.target)W.push(M4.escapeArgument($.target));if(Q.length>0)Q=Q.map((q)=>M4.escapeArgument(q)),W.push("-ArgumentList",Q.join(","));if($.target=M4.encodeCommand(W.join(" ")),!$.wait)Z.stdio="ignore"}else{if(X)J=X;else{let W=!kk||kk==="/",q=!1;try{await QZ$.access(I30,JZ$.X_OK),q=!0}catch{}J=xk.versions.electron??(cZ==="android"||W||!q)?"xdg-open":I30}if(Q.length>0)Y.push(...Q);if(!$.wait)Z.stdio="ignore",Z.detached=!0}if(cZ==="darwin"&&Q.length>0)Y.push("--args",...Q);if($.target)Y.push($.target);let G=XZ$.spawn(J,Y,Z);if($.wait)return new Promise((W,q)=>{G.once("error",q),G.once("close",(U)=>{if(!$.allowNonzeroExitCode&&U!==0){q(Error(`Exited with code ${U}`));return}W(G)})});if(D)return new Promise((W,q)=>{G.once("error",q),G.once("spawn",()=>{G.once("close",(U)=>{if(G.off("error",q),U!==0){q(Error(`Exited with code ${U}`));return}G.unref(),W(G)})})});return G.unref(),new Promise((W,q)=>{G.once("error",q),G.once("spawn",()=>{G.off("error",q),W(G)})})},YZ$=($,D)=>{if(typeof $!=="string")throw TypeError("Expected a `target`");return aq({...D,target:$})},ZZ$=($,D)=>{if(typeof $!=="string"&&!Array.isArray($))throw TypeError("Expected a valid `name`");let{arguments:X=[]}=D??{};if(X!==void 0&&X!==null&&!Array.isArray(X))throw TypeError("Expected `appArguments` as Array type");return aq({...D,app:{name:$,arguments:X}})},fQ,yk;var lZ=o(()=>{L30();jk();E30();Bk();A30();JN=Symbol("fallbackAttempt"),kk=import.meta.url?S30.dirname(DZ$(import.meta.url)):"",I30=S30.join(kk,"xdg-open"),{platform:cZ,arch:T30}=xk;fQ={browser:"browser",browserPrivate:"browserPrivate"};yQ(fQ,"chrome",()=>sq({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));yQ(fQ,"brave",()=>sq({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));yQ(fQ,"firefox",()=>sq({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));yQ(fQ,"edge",()=>sq({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));yQ(fQ,"safari",()=>sq({darwin:"Safari"}));yk=YZ$});import{spawn as FZ$}from"node:child_process";import{existsSync as K1,readdirSync as rZ,readFileSync as qD,statSync as GZ$}from"node:fs";import{homedir as b30,platform as h30}from"node:os";import oZ,{dirname as pZ,join as P$,relative as g30,resolve as f5,sep as m30}from"node:path";import{cwd as N4,env as uQ,stdin as d30,stdout as c30}from"node:process";function YN($,D){let X=ut();if(X)X[$](D);else C[$](D)}function DU($=""){if(!$)return u5;return`${u5}${$.startsWith("/")?$:`/${$}`}`}function HN($){let D=QU.toLocaleString("en-US");return[`Delta updates cannot upload this bundle: it has ${$.toLocaleString("en-US")} files, and Capgo allows at most ${D} files per delta (manifest) upload.`,"Delta mode tracks and uploads each file individually so devices can download only what changed. Very large file counts are not supported on that path.","What you can do:","1. Upload a full zip instead: npx @capgo/cli@latest bundle upload --no-delta","2. Or reduce files in your web build output (remove unused assets, avoid copying large trees into dist).","See https://capgo.app/docs/faq/#are-there-delta-update-file-path-limitations"].join(`
|
|
391
391
|
`)}function p30($){return[`Bundle upload timed out after ${Math.round($/1000)}s.`,"The standard upload has to finish the whole transfer within this window and does not retry, so a large bundle or a slow connection can trip it.","What you can do:","1. Retry with the resumable upload, which uploads in chunks and retries automatically: npx @capgo/cli@latest bundle upload --tus","2. Or raise the limit for the standard upload: npx @capgo/cli@latest bundle upload --timeout <milliseconds>"].join(`
|
|
392
392
|
`)}function F0($){if(!$)return"Unknown error";if(dZ($).isSecurityPolicyError)return zk($);let X=$;if(typeof $==="string")return $;if($ instanceof Error){let Q=X.message||X.cause?.message||X.stack||$.name,J=X.cause?.name,Y=Q.toLowerCase();if(Y.includes("fetch failed")||Y.includes("failed to fetch")||Y.includes("connect timeout")||Y.includes("network")||J?.startsWith("UND_ERR"))return`Network error: ${Q}${X.code?` (code ${X.code})`:""}. Check your network connection and API endpoint availability.`;let Z=X.status||X.statusCode;return[Q,X.code?`Code: ${X.code}`:void 0,Z?`Status: ${Z}`:void 0].filter(Boolean).join(" | ")||$.name}if(X.message){let Q=[X.message,X.code?`Code: ${X.code}`:void 0,X.status||X.statusCode?`Status: ${X.status||X.statusCode}`:void 0].filter(Boolean).join(" | "),J=X.message.toLowerCase();if(J.includes("fetch failed")||J.includes("failed to fetch")||X.error==="Failed to fetch")return`Network error: ${Q}. Check your network connection and API endpoint availability.`;if(X.details||X.hint||X.error)return`${Q}${Q?" | ":""}${X.error?typeof X.error==="string"?X.error:X.error.message??"":""}${X.details?`Details: ${X.details}`:""}${X.hint?`Hint: ${X.hint}`:""}`.trim();return Q}if(typeof X.error==="string"&&X.error.length>0)return X.error;if(X.error&&typeof X.error==="object"&&typeof X.error.message==="string"&&X.error.message.length>0)return X.error.message;return`
|
|
393
|
-
${l30.default.render($)}`}async function KN($,D,X=!1){let{data:Q,error:J}=await LK(()=>$.rpc("reject_access_due_to_2fa_for_org",{org_id:D}));if(J){if(!X&&!r9(J))T0.error(`Cannot check 2FA compliance: ${J.message}`);if(r9(J)){await MK({silent:X,telemetryFunctionName:"check2FAAccessForOrg"});return}NK(J)}if(Q){if(!X)T0.error(`\uD83D\uDD10 Access Denied: 2FA Required. Enable 2FA at ${DU("/settings/account")}`);throw Error("2FA required for this organization")}}function w4({silent:$=!1,stdinIsTTY:D=!!d30.isTTY,stdoutIsTTY:X=!!c30.isTTY,ci:Q=gk.isCI}={}){return!$&&D&&X&&!Q}function HZ$($={}){let D=$.ci??gk.isCI,X=$.stdinIsTTY??!!d30.isTTY,Q=$.stdoutIsTTY??!!c30.isTTY,J=$.platform??h30(),Y="display"in $?$.display:uQ.DISPLAY;if(D||!X||!Q)return!1;if(J==="linux"&&!Y)return!1;return!0}async function KZ$($){if(!HZ$())return;try{await(await Promise.resolve().then(() => (lZ(),eq))).default($)}catch(D){if(D?.code==="ENOENT")return}}function Y1($){if(vJ0($))return SJ0($);else if(xJ0($))return _J0($);return $}function OZ$($=Y1(N4()),D=void 0){let X=D?.split(",")[0],Q=X??P$($,B4);if(!K1(Q)){let Y=X?`Package.json at ${Q} does not exist`:`No package.json found at ${Q}. Run this command from your project root (the folder that contains package.json), or pass --package-json <path> to point at it (for example in a monorepo).`;throw T0.error(Y),Error(Y)}let J=qD(Q);return JSON.parse(J)}function b5($=Y1(N4()),D=void 0){return OZ$($,D).version??""}function VZ$($){let D=$.replace("^","").replace("~","");if(pG(D))try{let X=t$(D);return M8(X)}catch{return D}return D}async function S6($,D=N4(),X){let Q=X?X.split(",").map((Z)=>Z.trim()).filter(Boolean):[],J=[],Y=(Z)=>{let F=f5(Z);if(!J.includes(F))J.push(F)};for(let Z of Q){let F=f5(D,Z);if(K1(F))Y(pZ(F))}Y(f5(D)),Y(N4());for(let Z of J)try{let F=`${$}/package.json`,{createRequire:G}=await import("node:module"),q=G(P$(Z,"package.json")).resolve(F),U=JSON.parse(qD(q,"utf-8"));if(U.version)return U.version}catch{}for(let Z of J){let F=Z,G=oZ.parse(F).root;while(F!==G){let W=P$(F,"node_modules",$,B4);if(K1(W))try{let U=JSON.parse(qD(W,"utf-8"));if(U.version)return U.version}catch{}let q=pZ(F);if(q===F)break;F=q}}if($==="@capgo/capacitor-updater"){let Z=null,F=P$(D,"ios","App","Podfile");if(K1(F))try{let W=qD(F,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);if(W?.[1])Z=f5(P$(D,"ios","App",W[1]))}catch{}if(!Z){let G=P$(D,"android","capacitor.settings.gradle");if(K1(G))try{let q=qD(G,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);if(q?.[1])Z=f5(P$(D,"android",q[1])).replace(/\/android$/,"")}catch{}}if(Z){let G=P$(Z,B4);if(K1(G))try{let W=JSON.parse(qD(G,"utf-8"));if(W.version)return W.version}catch{}}}try{let Z=X?X.split(",").map((W)=>W.trim()).filter(Boolean).join(","):X,G=(await ON(D,Z)).get($);if(G)return G}catch{}return null}async function ON($=Y1(N4()),D=void 0){let X=D?.split(",").map((Y)=>Y.trim()).filter(Boolean);if(X??=[P$($,B4)],X){for(let Y of X)if(!K1(Y)){let Z=`Package.json at ${Y} does not exist`;throw T0.error(Z),Error(Z)}}let Q=new Map,{createRequire:J}=await import("node:module");for(let Y of X){let Z=qD(Y),F=JSON.parse(Z),G=pZ(Y),W=(q,U)=>{try{let V=J(P$(G,"package.json")).resolve(`${q}/package.json`),z=JSON.parse(qD(V,"utf-8"));if(z.version)return z.version}catch{}let H=G,K=oZ.parse(H).root;while(H!==K){let O=P$(H,"node_modules",q,B4);if(K1(O))try{let z=JSON.parse(qD(O,"utf-8"));if(z.version)return z.version}catch{}let V=pZ(H);if(V===H)break;H=V}return VZ$(U)};for(let q in F.dependencies)Q.set(q,W(q,F.dependencies[q]));for(let q in F.devDependencies)Q.set(q,W(q,F.devDependencies[q]))}return Q}async function zZ$($=Y1(N4()),D=void 0){let X=D?.split(",").map((J)=>J.trim()).filter(Boolean);if(X??=[P$($,B4)],X){for(let J of X)if(!K1(J)){let Y=`Package.json at ${J} does not exist`;throw T0.error(Y),Error(Y)}}let Q=new Map;for(let J of X){let Y=qD(J),Z=JSON.parse(Y);for(let F in Z.dependencies??{})if(typeof Z.dependencies[F]==="string")Q.set(F,Z.dependencies[F]);for(let F in Z.devDependencies??{})if(typeof Z.devDependencies[F]==="string")Q.set(F,Z.devDependencies[F])}return Q}function LZ$($){if(!$)return!1;if($.config&&Object.keys($.config).length>0)return!0;return!!$.path&&K1($.path)}async function i30($,D=!1){let X=VN;try{let Q=await $();if(!LZ$(Q)){if(!D)T0.error(X);throw new G0(X)}return Q}catch(Q){if(Q instanceof G0)throw Q;let J=F0(Q);if(!D)T0.error(`${X}: ${J}`);throw new G0(X,{cause:J})}}function L$($=!1){return i30(jT,$)}function rD($=!1){return i30(AT,$)}async function MZ$($,D){let X=await rD();if(X?.config)X.config.plugins??={},X.config.plugins.extConfig??={},X.config.plugins[$]??={},X.config.plugins[$]={...X.config.plugins[$],...D},await IT($,X);return X}async function r30($){return MZ$("CapacitorUpdater",$)}async function Q6($=!1){try{let D=await L$($),X={host:D?.config?.plugins?.CapacitorUpdater?.localHost||_30,hostWeb:D?.config?.plugins?.CapacitorUpdater?.localWebHost||u5,hostFilesApi:D?.config?.plugins?.CapacitorUpdater?.localApiFiles||v30,hostApi:D?.config?.plugins?.CapacitorUpdater?.localApi||GN};if(D?.config?.plugins?.CapacitorUpdater?.localSupa&&D?.config?.plugins?.CapacitorUpdater?.localSupaAnon){if(!$)T0.info("Using custom supabase instance from capacitor.config.json");X.supaKey=D?.config?.plugins?.CapacitorUpdater?.localSupaAnon,X.supaHost=D?.config?.plugins?.CapacitorUpdater?.localSupa}return X}catch{return{host:_30,hostWeb:u5,hostFilesApi:v30,hostApi:GN}}}function k30($){return typeof $==="object"&&$!==null}function NZ$($){if(!k30($))return!1;let D=$.capacitor;if(k30(D)&&(D.ios!==void 0||D.android!==void 0))return!0;return!1}function BZ$($){if(K1(P$($,"plugin.xml")))return!0;let D=P$($,B4);if(!K1(D))return!1;try{return NZ$(JSON.parse(qD(D,"utf-8")))}catch{return!1}}async function mQ($=!1,D){let X=(J)=>{let Y={...J};return _t(Y,void 0,$),Y};if(!D&&fk)return X(fk);if(!D&&ZN)return ZN.then(X);let Q=(async()=>{let J=await Q6($);try{let Y=g5(),Z=await fetch(`${J.hostApi}/private/config`,{...D?{signal:D}:{},headers:p$(Y?{capgkey:Y}:void 0)});if(!Z.ok)throw Error(`HTTP error! status: ${Z.status}`);let G={...await Z.json(),...J};if(!D)fk=G;return{...G}}catch{if(!$)T0.info(`Local config ${F0(J)}`);return{...J}}finally{if(!D)ZN=null}})();if(!D)ZN=Q;return Q.then(X)}async function t30(){let $=await Q6();try{let D=g5(),X=await fetch(`${$.hostFilesApi}/files/config`,{headers:p$(D?{capgkey:D}:void 0)});if(!X.ok)throw Error(`HTTP error! status: ${X.status}`);return await X.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:qZ$,maxChunkSize:UZ$,alertUploadSize:WZ$}}}function iZ($){let D=new URL($);if(!["http:","https:"].includes(D.protocol))throw Error("Invalid Supabase host protocol");if(D.username||D.password)throw Error("Supabase host must not include credentials");if(D.search||D.hash)throw Error("Supabase host must not include query parameters or fragments");let
|
|
394
|
-
`)[0].trim()}async function JU($){let D=await dQ($);if(D?.error==="channel_zip_required"||D?.error==="channel_delta_required")return D.message||D.error;let X=$ instanceof Error?$.message:String($??"");if(X.includes("CHANNEL_ZIP_REQUIRED"))return y30(X,"CHANNEL_ZIP_REQUIRED");if(X.includes("CHANNEL_DELTA_REQUIRED"))return y30(X,"CHANNEL_DELTA_REQUIRED");return null}function bQ($){if(!$)return!1;try{let D=new URL(iZ($)).hostname.toLowerCase();return D==="sb.capgo.app"||D==="xvwzpoazmxkqosrdewyv.supabase.co"||D==="ibwjdnhknbkcqfbabwei.supabase.co"||D==="aucsybvnhavogdmzwtcw.supabase.co"}catch{return!1}}function a30($){if($.supaHost&&$.supaKey&&$.hostApi===GN&&!bQ($.supaHost))return`${iZ($.supaHost)}/functions/v1`;return $.hostApi}function _8($){let D=$?.context;return typeof D?.status==="number"?D.status:void 0}async function dQ($){let D=$?.context;if(!D||typeof D.clone!=="function")return null;try{let X=await D.clone().text();try{return JSON.parse(X)}catch{return X?{message:X}:null}}catch{return null}}async function h5($){let D=await dQ($);if(D){let X=zN(D);if(X)return X}return F0($)}async function K$($,D){let X=(D.method??"POST").toUpperCase(),Q,J=D.supaAnon;if(D.supaHost&&D.supaAnon&&!bQ(D.supaHost))Q=`${iZ(D.supaHost)}/functions/v1`;else{let F=await mQ(!0);if(J=D.supaAnon??F.supaKey,F.supaHost&&F.supaKey&&F.hostApi===GN&&!bQ(F.supaHost)&&!(D.supaHost&&bQ(D.supaHost)))Q=`${iZ(F.supaHost)}/functions/v1`;else if(D.useFilesHost)Q=F.hostFilesApi;else Q=F.hostApi}let Y=Q.includes("/functions/v1"),Z=`${n8(Q)}/${$.replace(/^\//,"")}`;try{let F=await fetch(Z,{method:X,headers:p$({"Content-Type":"application/json",Authorization:Y&&J?`Bearer ${J}`:D.apikey,capgkey:D.apikey}),body:X==="GET"||X==="HEAD"?void 0:typeof D.body==="string"?D.body:JSON.stringify(D.body??{}),signal:D.signal});if(!F.ok)return{data:null,error:new gD.FunctionsHttpError(F)};return{data:(F.headers.get("content-type")??"").includes("application/json")?await F.json().catch(()=>null):await F.text().catch(()=>null),error:null}}catch(F){return{data:null,error:F instanceof Error?F:Error(String(F))}}}async function YU($,D=!0){if($?.supaHost&&$?.supaAnon){if(bQ($.supaHost))return(await Q6(D)).hostApi;return`${iZ($.supaHost)}/functions/v1`}let X=await Q6(D);if(X.supaHost&&X.supaKey)return a30(X);return(await mQ(D)).hostApi}async function U$($,D,X,Q=!1,J=!0,Y){let Z=await mQ(Q,Y);if(D&&X){if(!Q)T0.info("Using custom supabase instance from provided options");Z.supaHost=D,Z.supaKey=X}if(!Z.supaHost||!Z.supaKey){if(!Q)T0.error(x30);throw new G0(x30,{missingSupaHost:!Z.supaHost,missingSupaKey:!Z.supaKey})}let F=iZ(Z.supaHost);return VE(F,Z.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:rw("capgkey",$)},...At()&&J?{fetch:St()}:{}}})}async function wZ$($,D){let{data:X}=await $.rpc("is_paying_org",{orgid:D}).single();return X||!1}async function RZ$($,D){let{data:X}=await $.rpc("is_trial_org",{orgid:D}).single();return X||0}async function EZ$($,D,X){let{data:Q}=await $.rpc("has_usage_credits_org",X?{orgid:D,appid:X}:{orgid:D}).single();return Q||!1}function jZ$($){let{trialDays:D,isPaying:X,hasCredits:Q,warning:J=!0}=$;return!!J&&D>0&&!X&&!Q}async function AZ$($,D){let{data:X,error:Q}=await $.rpc("is_allowed_action_org",{orgid:D}).single();if(Q)throw Error(`Cannot validate plan: ${F0(Q)}`);return X===!0}async function uk($,D,X,Q){let{data:J,error:Y}=Q?await $.rpc("is_allowed_action_org_action",{orgid:D,actions:X,appid:Q}):await $.rpc("is_allowed_action_org_action",{orgid:D,actions:X});if(Y){if(Q&&Y.code==="PGRST202")return AZ$($,D);throw Error(`Cannot validate plan: ${F0(Y)}`)}return J===!0}async function IZ$($,D,X,Q){if(Q){if(await uk($,D,X,Q))return"allowed";if(await uk($,D,X))return"permission_denied";return"billing_denied"}return await uk($,D,X)?"allowed":"billing_denied"}async function TZ$($,D){throw T0.error(`You need to upgrade your plan to continue to use capgo.
|
|
393
|
+
${l30.default.render($)}`}async function KN($,D,X=!1){let{data:Q,error:J}=await LK(()=>$.rpc("reject_access_due_to_2fa_for_org",{org_id:D}));if(J){if(!X&&!r9(J))T0.error(`Cannot check 2FA compliance: ${J.message}`);if(r9(J)){await MK({silent:X,telemetryFunctionName:"check2FAAccessForOrg"});return}NK(J)}if(Q){if(!X)T0.error(`\uD83D\uDD10 Access Denied: 2FA Required. Enable 2FA at ${DU("/settings/account")}`);throw Error("2FA required for this organization")}}function w4({silent:$=!1,stdinIsTTY:D=!!d30.isTTY,stdoutIsTTY:X=!!c30.isTTY,ci:Q=gk.isCI}={}){return!$&&D&&X&&!Q}function HZ$($={}){let D=$.ci??gk.isCI,X=$.stdinIsTTY??!!d30.isTTY,Q=$.stdoutIsTTY??!!c30.isTTY,J=$.platform??h30(),Y="display"in $?$.display:uQ.DISPLAY;if(D||!X||!Q)return!1;if(J==="linux"&&!Y)return!1;return!0}async function KZ$($){if(!HZ$())return;try{await(await Promise.resolve().then(() => (lZ(),eq))).default($)}catch(D){if(D?.code==="ENOENT")return}}function Y1($){if(vJ0($))return SJ0($);else if(xJ0($))return _J0($);return $}function OZ$($=Y1(N4()),D=void 0){let X=D?.split(",")[0],Q=X??P$($,B4);if(!K1(Q)){let Y=X?`Package.json at ${Q} does not exist`:`No package.json found at ${Q}. Run this command from your project root (the folder that contains package.json), or pass --package-json <path> to point at it (for example in a monorepo).`;throw T0.error(Y),Error(Y)}let J=qD(Q);return JSON.parse(J)}function b5($=Y1(N4()),D=void 0){return OZ$($,D).version??""}function VZ$($){let D=$.replace("^","").replace("~","");if(pG(D))try{let X=t$(D);return M8(X)}catch{return D}return D}async function S6($,D=N4(),X){let Q=X?X.split(",").map((Z)=>Z.trim()).filter(Boolean):[],J=[],Y=(Z)=>{let F=f5(Z);if(!J.includes(F))J.push(F)};for(let Z of Q){let F=f5(D,Z);if(K1(F))Y(pZ(F))}Y(f5(D)),Y(N4());for(let Z of J)try{let F=`${$}/package.json`,{createRequire:G}=await import("node:module"),q=G(P$(Z,"package.json")).resolve(F),U=JSON.parse(qD(q,"utf-8"));if(U.version)return U.version}catch{}for(let Z of J){let F=Z,G=oZ.parse(F).root;while(F!==G){let W=P$(F,"node_modules",$,B4);if(K1(W))try{let U=JSON.parse(qD(W,"utf-8"));if(U.version)return U.version}catch{}let q=pZ(F);if(q===F)break;F=q}}if($==="@capgo/capacitor-updater"){let Z=null,F=P$(D,"ios","App","Podfile");if(K1(F))try{let W=qD(F,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);if(W?.[1])Z=f5(P$(D,"ios","App",W[1]))}catch{}if(!Z){let G=P$(D,"android","capacitor.settings.gradle");if(K1(G))try{let q=qD(G,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);if(q?.[1])Z=f5(P$(D,"android",q[1])).replace(/\/android$/,"")}catch{}}if(Z){let G=P$(Z,B4);if(K1(G))try{let W=JSON.parse(qD(G,"utf-8"));if(W.version)return W.version}catch{}}}try{let Z=X?X.split(",").map((W)=>W.trim()).filter(Boolean).join(","):X,G=(await ON(D,Z)).get($);if(G)return G}catch{}return null}async function ON($=Y1(N4()),D=void 0){let X=D?.split(",").map((Y)=>Y.trim()).filter(Boolean);if(X??=[P$($,B4)],X){for(let Y of X)if(!K1(Y)){let Z=`Package.json at ${Y} does not exist`;throw T0.error(Z),Error(Z)}}let Q=new Map,{createRequire:J}=await import("node:module");for(let Y of X){let Z=qD(Y),F=JSON.parse(Z),G=pZ(Y),W=(q,U)=>{try{let V=J(P$(G,"package.json")).resolve(`${q}/package.json`),z=JSON.parse(qD(V,"utf-8"));if(z.version)return z.version}catch{}let H=G,K=oZ.parse(H).root;while(H!==K){let O=P$(H,"node_modules",q,B4);if(K1(O))try{let z=JSON.parse(qD(O,"utf-8"));if(z.version)return z.version}catch{}let V=pZ(H);if(V===H)break;H=V}return VZ$(U)};for(let q in F.dependencies)Q.set(q,W(q,F.dependencies[q]));for(let q in F.devDependencies)Q.set(q,W(q,F.devDependencies[q]))}return Q}async function zZ$($=Y1(N4()),D=void 0){let X=D?.split(",").map((J)=>J.trim()).filter(Boolean);if(X??=[P$($,B4)],X){for(let J of X)if(!K1(J)){let Y=`Package.json at ${J} does not exist`;throw T0.error(Y),Error(Y)}}let Q=new Map;for(let J of X){let Y=qD(J),Z=JSON.parse(Y);for(let F in Z.dependencies??{})if(typeof Z.dependencies[F]==="string")Q.set(F,Z.dependencies[F]);for(let F in Z.devDependencies??{})if(typeof Z.devDependencies[F]==="string")Q.set(F,Z.devDependencies[F])}return Q}function LZ$($){if(!$)return!1;if($.config&&Object.keys($.config).length>0)return!0;return!!$.path&&K1($.path)}async function i30($,D=!1){let X=VN;try{let Q=await $();if(!LZ$(Q)){if(!D)T0.error(X);throw new G0(X)}return Q}catch(Q){if(Q instanceof G0)throw Q;let J=F0(Q);if(!D)T0.error(`${X}: ${J}`);throw new G0(X,{cause:J})}}function L$($=!1){return i30(jT,$)}function rD($=!1){return i30(AT,$)}async function MZ$($,D){let X=await rD();if(X?.config)X.config.plugins??={},X.config.plugins.extConfig??={},X.config.plugins[$]??={},X.config.plugins[$]={...X.config.plugins[$],...D},await IT($,X);return X}async function r30($){return MZ$("CapacitorUpdater",$)}async function Q6($=!1){try{let D=await L$($),X={host:D?.config?.plugins?.CapacitorUpdater?.localHost||_30,hostWeb:D?.config?.plugins?.CapacitorUpdater?.localWebHost||u5,hostFilesApi:D?.config?.plugins?.CapacitorUpdater?.localApiFiles||v30,hostApi:D?.config?.plugins?.CapacitorUpdater?.localApi||GN};if(D?.config?.plugins?.CapacitorUpdater?.localSupa&&D?.config?.plugins?.CapacitorUpdater?.localSupaAnon){if(!$)T0.info("Using custom supabase instance from capacitor.config.json");X.supaKey=D?.config?.plugins?.CapacitorUpdater?.localSupaAnon,X.supaHost=D?.config?.plugins?.CapacitorUpdater?.localSupa}return X}catch{return{host:_30,hostWeb:u5,hostFilesApi:v30,hostApi:GN}}}function k30($){return typeof $==="object"&&$!==null}function NZ$($){if(!k30($))return!1;let D=$.capacitor;if(k30(D)&&(D.ios!==void 0||D.android!==void 0))return!0;return!1}function BZ$($){if(K1(P$($,"plugin.xml")))return!0;let D=P$($,B4);if(!K1(D))return!1;try{return NZ$(JSON.parse(qD(D,"utf-8")))}catch{return!1}}async function mQ($=!1,D){let X=(J)=>{let Y={...J};return _t(Y,void 0,$),Y};if(!D&&fk)return X(fk);if(!D&&ZN)return ZN.then(X);let Q=(async()=>{let J=await Q6($);try{let Y=g5(),Z=await fetch(`${J.hostApi}/private/config`,{...D?{signal:D}:{},headers:p$(Y?{capgkey:Y}:void 0)});if(!Z.ok)throw Error(`HTTP error! status: ${Z.status}`);let G={...await Z.json(),...J};if(!D)fk=G;return{...G}}catch{if(!$)T0.info(`Local config ${F0(J)}`);return{...J}}finally{if(!D)ZN=null}})();if(!D)ZN=Q;return Q.then(X)}async function t30(){let $=await Q6();try{let D=g5(),X=await fetch(`${$.hostFilesApi}/files/config`,{headers:p$(D?{capgkey:D}:void 0)});if(!X.ok)throw Error(`HTTP error! status: ${X.status}`);return await X.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:qZ$,maxChunkSize:UZ$,alertUploadSize:WZ$}}}function iZ($){let D=new URL($);if(!["http:","https:"].includes(D.protocol))throw Error("Invalid Supabase host protocol");let X=D.hostname==="localhost"||D.hostname==="127.0.0.1"||D.hostname==="[::1]";if(D.protocol==="http:"&&!X)throw Error("Supabase host must use HTTPS (HTTP is only allowed for localhost)");if(D.username||D.password)throw Error("Supabase host must not include credentials");if(D.search||D.hash)throw Error("Supabase host must not include query parameters or fragments");let Q=n8(D.pathname);return`${D.origin}${Q}`}function zN($){if(!$||typeof $!=="object")return"";let D=$;return[D.error,D.message,D.status].filter(Boolean).join(" | ")}function y30($,D){let X=$.indexOf(D);if(X<0)return $;return $.slice(X+D.length).replace(/^:\s*/,"").split(`
|
|
394
|
+
`)[0].trim()}async function JU($){let D=await dQ($);if(D?.error==="channel_zip_required"||D?.error==="channel_delta_required")return D.message||D.error;let X=$ instanceof Error?$.message:String($??"");if(X.includes("CHANNEL_ZIP_REQUIRED"))return y30(X,"CHANNEL_ZIP_REQUIRED");if(X.includes("CHANNEL_DELTA_REQUIRED"))return y30(X,"CHANNEL_DELTA_REQUIRED");return null}function bQ($){if(!$)return!1;try{let D=new URL(iZ($)).hostname.toLowerCase();return D==="sb.capgo.app"||D==="xvwzpoazmxkqosrdewyv.supabase.co"||D==="ibwjdnhknbkcqfbabwei.supabase.co"||D==="aucsybvnhavogdmzwtcw.supabase.co"}catch{return!1}}function a30($){if($.supaHost&&$.supaKey&&$.hostApi===GN&&!bQ($.supaHost))return`${iZ($.supaHost)}/functions/v1`;return $.hostApi}function _8($){let D=$?.context;return typeof D?.status==="number"?D.status:void 0}async function dQ($){let D=$?.context;if(!D||typeof D.clone!=="function")return null;try{let X=await D.clone().text();try{return JSON.parse(X)}catch{return X?{message:X}:null}}catch{return null}}async function h5($){let D=await dQ($);if(D){let X=zN(D);if(X)return X}return F0($)}async function K$($,D){let X=(D.method??"POST").toUpperCase(),Q,J=D.supaAnon;if(D.supaHost&&D.supaAnon&&!bQ(D.supaHost))Q=`${iZ(D.supaHost)}/functions/v1`;else{let F=await mQ(!0);if(J=D.supaAnon??F.supaKey,F.supaHost&&F.supaKey&&F.hostApi===GN&&!bQ(F.supaHost)&&!(D.supaHost&&bQ(D.supaHost)))Q=`${iZ(F.supaHost)}/functions/v1`;else if(D.useFilesHost)Q=F.hostFilesApi;else Q=F.hostApi}let Y=Q.includes("/functions/v1"),Z=`${n8(Q)}/${$.replace(/^\//,"")}`;try{let F=await fetch(Z,{method:X,redirect:"error",headers:p$({"Content-Type":"application/json",Authorization:Y&&J?`Bearer ${J}`:D.apikey,capgkey:D.apikey}),body:X==="GET"||X==="HEAD"?void 0:typeof D.body==="string"?D.body:JSON.stringify(D.body??{}),signal:D.signal});if(!F.ok)return{data:null,error:new gD.FunctionsHttpError(F)};return{data:(F.headers.get("content-type")??"").includes("application/json")?await F.json().catch(()=>null):await F.text().catch(()=>null),error:null}}catch(F){return{data:null,error:F instanceof Error?F:Error(String(F))}}}async function YU($,D=!0){if($?.supaHost&&$?.supaAnon){if(bQ($.supaHost))return(await Q6(D)).hostApi;return`${iZ($.supaHost)}/functions/v1`}let X=await Q6(D);if(X.supaHost&&X.supaKey)return a30(X);return(await mQ(D)).hostApi}async function U$($,D,X,Q=!1,J=!0,Y){let Z=await mQ(Q,Y);if(D&&X){if(!Q)T0.info("Using custom supabase instance from provided options");Z.supaHost=D,Z.supaKey=X}if(!Z.supaHost||!Z.supaKey){if(!Q)T0.error(x30);throw new G0(x30,{missingSupaHost:!Z.supaHost,missingSupaKey:!Z.supaKey})}let F=iZ(Z.supaHost);return VE(F,Z.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:rw("capgkey",$)},...At()&&J?{fetch:St()}:{}}})}async function wZ$($,D){let{data:X}=await $.rpc("is_paying_org",{orgid:D}).single();return X||!1}async function RZ$($,D){let{data:X}=await $.rpc("is_trial_org",{orgid:D}).single();return X||0}async function EZ$($,D,X){let{data:Q}=await $.rpc("has_usage_credits_org",X?{orgid:D,appid:X}:{orgid:D}).single();return Q||!1}function jZ$($){let{trialDays:D,isPaying:X,hasCredits:Q,warning:J=!0}=$;return!!J&&D>0&&!X&&!Q}async function AZ$($,D){let{data:X,error:Q}=await $.rpc("is_allowed_action_org",{orgid:D}).single();if(Q)throw Error(`Cannot validate plan: ${F0(Q)}`);return X===!0}async function uk($,D,X,Q){let{data:J,error:Y}=Q?await $.rpc("is_allowed_action_org_action",{orgid:D,actions:X,appid:Q}):await $.rpc("is_allowed_action_org_action",{orgid:D,actions:X});if(Y){if(Q&&Y.code==="PGRST202")return AZ$($,D);throw Error(`Cannot validate plan: ${F0(Y)}`)}return J===!0}async function IZ$($,D,X,Q){if(Q){if(await uk($,D,X,Q))return"allowed";if(await uk($,D,X))return"permission_denied";return"billing_denied"}return await uk($,D,X)?"allowed":"billing_denied"}async function TZ$($,D){throw T0.error(`You need to upgrade your plan to continue to use capgo.
|
|
395
395
|
Upgrade here: ${$}
|
|
396
396
|
`),await KZ$($),new G0(D)}async function CZ$(){throw T0.error("Cannot validate plan usage for this app. The API key may lack permission to read app billing details."),new G0("Plan validation permission denied")}async function s30($,D,X){let{data:Q,error:J}=await $.rpc("get_organization_cli_warnings",{orgid:D,cli_version:X});if(J){T0.error(`Cannot get cli warnings: ${F0(J)}`);return}if(Q.length>0){T0.warn(`Found ${Q.length} cli warnings for your organization.`);let Y=null;for(let Z of Q){if(typeof Z!=="object"||typeof Z.message!=="string"||typeof Z.fatal!=="boolean"){T0.error(`Invalid cli warning: ${Z}`);continue}let F=Z;if(F.fatal)T0.error(`${F.message.replaceAll("\\n",`
|
|
397
397
|
`)}`),Y=Error(F.message);else T0.warn(`${F.message.replaceAll("\\n",`
|
|
@@ -405,7 +405,7 @@ To regain access:`),T0.error(` 1. Go to ${DU("/settings/account")}`),T0.error("
|
|
|
405
405
|
For more information, visit: https://capgo.app/docs/webapp/2fa-enforcement/
|
|
406
406
|
`),Error("2FA required for this organization")}async function _Z$($,D,X,Q){return(await Promise.all(X.map(async(Y)=>{return await xD($,D,Q,{orgId:Y.gid})?Y:null}))).filter((Y)=>Y!==null)}async function vZ$($,D,X){let{error:Q,data:J}=await $.rpc("get_orgs_v7");if(Q)throw T0.error("Cannot get the list of organizations - exiting"),T0.error(F0(Q)),Error("Cannot get the list of organizations");if(J.length===0)throw T0.error("Could not get organization please create an organization first"),Error("No organizations available");let Y=await _Z$($,D,J,X);if(Y.length===0)throw T0.error(`Could not find organization with permission: ${X}`),Error("Could not find organization with required permission");return{allOrganizations:J,allowedOrganizations:Y}}async function RN($,D,X){let{allOrganizations:Q,allowedOrganizations:J}=await vZ$($,D,X),Y=J.length>1?await x1({message:"Please pick the organization that you want to insert to",options:J.map((G)=>{let W=G.enforcing_2fa&&!G["2fa_has_access"]?" ⚠️ (2FA required)":"";return{value:G.gid,label:`${G.name}${W}`}})}):J[0].gid;if(r0(Y))throw T0.warn("Canceled organization selection, exiting"),new G0("Organization selection cancelled");let Z=Y,F=Q.find((G)=>G.gid===Z);if(F.enforcing_2fa&&!F["2fa_has_access"])ck(F.name);return T0.info(`Using the organization "${F.name}" as the app owner`),F}async function L1($,D,X=!1){let{data:Q,error:J}=await $.rpc("request_actor_user_id"),Y=(Q||"").toString();if(J){if(!X)T0.error(J.message);throw J}if(!Y){if(!X)T0.error("Capgo authentication failed: invalid Capgo API key or insufficient Capgo permissions.");throw Error("Capgo authentication failed: invalid Capgo API key or insufficient Capgo permissions.")}return Y}async function xD($,D,X,Q={}){let{data:J,error:Y}=await $.rpc("cli_check_permission",{apikey:D,permission_key:X,org_id:Q.orgId??null,app_id:Q.appId??null,channel_id:Q.channelId??null});if(Y)throw T0.error(`Cannot check permission ${X}`),T0.error(F0(Y)),Error(`Cannot check permission ${X}`);return!!J}async function GU($,D,X,Q={},J={}){if(await xD($,D,X,Q))return;let Z=J.message||`Insufficient permissions for ${X}`;if(!J.silent)T0.error(Z);throw new G0(`Insufficient permissions for ${X}`,{permissionKey:X,...Q})}async function EN($,D,X,Q,J,Y){await L1($,D,Y),await GU($,D,X,{orgId:Q},{message:J,silent:Y})}async function PD($,D,X){let{data:Q,error:J}=await K$(`app/${encodeURIComponent(D)}`,{apikey:$,method:"GET",body:void 0,supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(!Q?.owner_org||J){let Y=F0(J);throw T0.error(`Cannot get organization id for app id ${D}: ${Y}`),new G0("Cannot get organization id for app",{appId:D,cause:Y})}return Q.owner_org}function lQ($){return new Date($||"").toLocaleString()}function hQ(){if(f30)return{pm:nZ,command:$U,installCommand:`${nZ} ${$U}`,runner:bk};let $=Y1(N4());return nZ=AX($,"npm"),$U=vJ(nZ),f30=!0,bk=BK($),{pm:nZ,command:$U,installCommand:`${nZ} ${$U}`,runner:bk}}function xZ$($,D){return{summary:`Best fix: recreate and sync ${D==="ios"?"iOS":"Android"} with this one-line command.`,command:`rm -rf ${D} && ${$} cap add ${D} && ${$} cap sync ${D}`}}function GW0($){return rZ($,{withFileTypes:!0}).flatMap((Q)=>{let J=P$($,Q.name);if(Q.isDirectory())return GW0(J);else return J.split(`node_modules${m30}`)[1]||J})}function WW0($){if(!K1($))return[];try{return rZ($,{withFileTypes:!0}).flatMap((Q)=>{let J=P$($,Q.name);if(Q.isDirectory())return WW0(J);else return J})}catch{return[]}}function kZ$($,D){let X=[];if(D==="ios"){try{let Y=rZ($);for(let Z of Y)if(Z.endsWith(".podspec"))X.push(P$($,Z))}catch{}let Q=P$($,"Package.swift"),J=P$($,"ios","Package.swift");if(K1(Q))X.push(Q);if(K1(J))X.push(J)}else if(D==="android"){let Q=P$($,"android"),J=P$(Q,"build.gradle"),Y=P$(Q,"build.gradle.kts");if(K1(J))X.push(J);if(K1(Y))X.push(Y)}return X}async function yZ$($){let D=P$($,"ios"),X=P$($,"android"),Q=async(Z,F)=>{let G=K1(Z)?WW0(Z).filter((K)=>o30.test(K)):[],W=kZ$($,F),q=[...G,...W].sort((K,O)=>K.localeCompare(O));if(q.length===0)return;let{createHash:U}=await import("node:crypto"),H=U("sha256");for(let K of q)try{let O=g30($,K);H.update(O);let V=qD(K);H.update(V)}catch{}return H.digest("hex")},[J,Y]=await Promise.all([Q(D,"ios"),Q(X,"android")]);return{ios_checksum:J,android_checksum:Y}}function fZ$($){let D=[],X=$,Q=oZ.parse(X).root;while(!0){if(D.push(P$(X,"node_modules")),X===Q)break;let J=pZ(X);if(J===X)break;X=J}return D}async function lk($,D){let X=D?D.split(",").map((U)=>U.trim()).filter(Boolean):[],Q;try{Q=await ON("",$)}catch(U){throw T0.error("Invalid package.json, JSON parsing failed"),T0.error(`json parse error: ${F0(U)}`),U instanceof Error?U:Error("Invalid package.json")}let J=$?$.split(",")[0].trim():void 0,Y=!J?Y1(N4()):oZ.resolve(J).replace(B4,"");if(!Q)throw T0.error("Missing dependencies section in package.json"),Error("Missing dependencies section in package.json");for(let[U,H]of Object.entries(Q))if(typeof H!=="string")throw T0.error(`Invalid dependency ${U}: ${H}, expected string, got ${typeof H}`),Error(`Invalid dependency ${U}: expected string version`);let Z=X.length===0?fZ$(N4()):X;if(!Z.some((U)=>K1(U))){let U=AX(Y,"npm"),H=vJ(U);throw T0.error(`Missing node_modules folder at ${Z.join(", ")}, please run ${U} ${H}`),Error("Missing node_modules folder")}let G=!1,W=await zZ$(Y1(N4()),$),q=await Promise.all(Array.from(Q.entries()).map(async([U,H])=>{let K=!1,O=!1,V=H,z=W.get(U)??H,N;for(let M of Z){let B=P$(M,U);if(K1(B)){K=!0,N=B;try{let R=P$(B,B4);if(K1(R)){let P=JSON.parse(qD(R,"utf-8"));if(P.version)V=P.version}}catch{}if(!BZ$(B))continue;try{if(GW0(B).some((P)=>o30.test(P))){O=!0;break}}catch(R){throw T0.error(`Error reading node_modules files for ${U} package in ${M}`),T0.error(F0(R)),R instanceof Error?R:Error(`Error reading node_modules files for ${U}`)}}}if(!K){G=!0;let M=AX(Y,"npm"),B=vJ(M);return T0.error(`Missing dependency ${U}, please run ${M} ${B}`),{name:U,version:V,requested_version:z}}let w,L;if(O&&N){let M=await yZ$(N);w=M.ios_checksum,L=M.android_checksum}return{name:U,version:V,requested_version:z,native:O,ios_checksum:w,android_checksum:L}}));if(G||q.some((U)=>U.native===void 0))throw T0.error("Missing dependencies or invalid dependencies"),T0.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),Error("Missing dependencies or invalid dependencies");return q}async function qW0($,D,X){let{data:Q,error:J}=await $.from("channels").select("version:app_versions!channels_version_fkey(checksum)").eq("name",X).eq("app_id",D).single(),Y=Q;if(J||Y===null||!Y.version||!Y.version.checksum)return null;return Y.version.checksum}function u30($){if(!$)throw T0.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),Error("Error parsing native packages");for(let X of $){let Q=Q30(D30,X);if(!Q.success){let J=Q.error.issues.map((Y)=>`${(Y.path??[]).join(".")}: ${Y.message}`).join(", ");throw T0.error(`Invalid remote native package data: ${J}`),Error(`Invalid remote native package data: ${J}`)}}return new Map($.map((X)=>[X.name,X]))}async function UW0($,D,X){let{data:Q,error:J}=await $.from("channels").select(`version:app_versions!channels_version_fkey(
|
|
407
407
|
native_packages
|
|
408
|
-
)`).eq("name",X).eq("app_id",D).maybeSingle();if(J){let Z=J.code==="PGRST116"||J.message?.includes("Cannot coerce")?`Multiple channels matched for app "${D}" and channel "${X}". Contact support if this persists.`:J.message;throw T0.error(`Error fetching native packages: ${Z}`),Error(`Error fetching native packages: ${Z}`)}if(!Q)return u30([]);return u30(Q.version?.native_packages??[])}function a$($,D){return $||D?.plugins?.CapacitorUpdater?.appId||D?.appId}function m5($){let D=[];if(!$.localVersion)return{compatible:!0,reasons:[],message:"Package only exists on remote (will be removed)"};if(!$.remoteVersion)return D.push("new_plugin"),{compatible:!1,reasons:D,message:"New native plugin added (requires app store update)"};let X=!1;try{let U=TK($.localVersion),H=TK($.remoteVersion);X=mm(U,H)}catch{X=!1}if(!X)D.push("version_mismatch");if($.localRequestedVersion&&$.remoteRequestedVersion&&$.localRequestedVersion.trim()!==$.remoteRequestedVersion.trim())D.push("requested_version_changed");let Q=(U)=>typeof U==="string"&&U.trim().length>0,J=Q($.localIosChecksum)&&Q($.remoteIosChecksum)&&$.localIosChecksum!==$.remoteIosChecksum,Y=Q($.localAndroidChecksum)&&Q($.remoteAndroidChecksum)&&$.localAndroidChecksum!==$.remoteAndroidChecksum;if(J&&Y)D.push("both_platforms_changed");else if(J)D.push("ios_code_changed");else if(Y)D.push("android_code_changed");let Z=Q($.localIosChecksum)!==Q($.remoteIosChecksum),F=Q($.localAndroidChecksum)!==Q($.remoteAndroidChecksum);if(Z||F)D.push("platform_checksum_metadata_changed");let G=[],W=(U)=>U!=="requested_version_changed";for(let U of D)switch(U){case"version_mismatch":G.push(`version changed: ${$.remoteVersion} → ${$.localVersion}`);break;case"requested_version_changed":G.push(`requested version changed: ${$.remoteRequestedVersion??"unknown"} → ${$.localRequestedVersion??"unknown"}`);break;case"ios_code_changed":G.push("iOS native code changed");break;case"android_code_changed":G.push("Android native code changed");break;case"both_platforms_changed":G.push("iOS and Android native code changed");break;case"platform_checksum_metadata_changed":G.push("iOS/Android checksum metadata appeared or disappeared (may be Capgo CLI change — verify native code)");break;case"new_plugin":G.push("new plugin (requires app store update)");break;case"removed_plugin":G.push("plugin removed");break}if(!D.some(W))return{compatible:!0,reasons:D,message:G.length>0?G.join(", "):"Compatible"};return{compatible:!1,reasons:D,message:G.join(", ")}}function p4($){return m5($).compatible}async function jN($,D,X,Q,J){let Y=await lk(Q,J),Z=await UW0($,D,X),F=Y.filter((W)=>!!W.native).map((W)=>{let q=Z.get(W.name);if(q)return{name:W.name,localVersion:W.version,localRequestedVersion:W.requested_version,remoteVersion:q.version,remoteRequestedVersion:q.requested_version,localIosChecksum:W.ios_checksum,remoteIosChecksum:q.ios_checksum,localAndroidChecksum:W.android_checksum,remoteAndroidChecksum:q.android_checksum};return{name:W.name,localVersion:W.version,localRequestedVersion:W.requested_version,remoteVersion:void 0,localIosChecksum:W.ios_checksum,localAndroidChecksum:W.android_checksum}}),G=[...Z].filter(([W])=>!Y.some((q)=>q.name===W)).map(([W,q])=>({name:W,localVersion:void 0,remoteVersion:q.version,remoteRequestedVersion:q.requested_version,remoteIosChecksum:q.ios_checksum,remoteAndroidChecksum:q.android_checksum}));return F.push(...G),{finalCompatibility:F,localDependencies:Y}}async function WU($,D,X,Q){let J=await UW0($,D,X),Y=Q.map((F)=>{let G=J.get(F.name);if(G)return{name:F.name,localVersion:F.version,localRequestedVersion:F.requested_version,remoteVersion:G.version,remoteRequestedVersion:G.requested_version,localIosChecksum:F.ios_checksum,remoteIosChecksum:G.ios_checksum,localAndroidChecksum:F.android_checksum,remoteAndroidChecksum:G.android_checksum};return{name:F.name,localVersion:F.version,localRequestedVersion:F.requested_version,remoteVersion:void 0,localIosChecksum:F.ios_checksum,localAndroidChecksum:F.android_checksum}}),Z=[...J].filter(([F])=>!Q.some((G)=>G.name===F)).map(([F,G])=>({name:F,localVersion:void 0,remoteVersion:G.version,remoteRequestedVersion:G.requested_version,remoteIosChecksum:G.ios_checksum,remoteAndroidChecksum:G.android_checksum}));return Y.push(...Z),{finalCompatibility:Y,localDependencies:Q}}function HW0($){if(!K1($))return null;try{return JSON.parse(qD($,"utf-8"))}catch{return null}}function FN($){if(!$)return!1;return/@capgo\/capacitor-updater|CapgoCapacitorUpdater|CapacitorUpdaterPlugin/.test($)}function uZ$($){let D=HW0($);if(!D)return!1;let X=D.packageClassList;return Array.isArray(X)&&X.includes("CapacitorUpdaterPlugin")}function bZ$($,D){if(!D)return P$($,B4);return oZ.isAbsolute(D)?D:f5($,D)}function hZ$($=N4(),D){let X=bZ$($,D),Q=oZ.basename(X)===B4?pZ(X):X,J=[P$(Q,"ios","App"),P$($,"ios","App")].find((R)=>K1(R));if(!J)return{shouldCheck:!1,valid:!0,details:[]};let Y=HW0(X),Z={...Y?.dependencies,...Y?.devDependencies,...Y?.optionalDependencies},F=Object.hasOwn(Z,"@capgo/capacitor-updater"),G=[Q,$].some((R)=>K1(P$(R,"node_modules","@capgo","capacitor-updater"))),W=P$(J,"Podfile"),q=P$(J,"CapApp-SPM","Package.swift"),U=K1(W)?qD(W,"utf-8"):void 0,H=K1(q)?qD(q,"utf-8"):void 0,K=FN(U)||FN(H),O=P$(J,"Podfile.lock"),V=P$(J,"App","capacitor.plugins.json"),z=P$(J,"App","capacitor.config.json"),N=K1(O)?qD(O,"utf-8"):void 0,w=K1(V)?qD(V,"utf-8"):void 0,L=FN(N)||FN(w)||uZ$(z);if(!(F||G||K||L))return{shouldCheck:!1,valid:!0,details:[]};let B=[];if(!K)B.push(`Missing @capgo/capacitor-updater in iOS dependency files (${W} or ${q})`);if(!L)B.push(`Missing @capgo/capacitor-updater in iOS native project outputs (${O}, ${V}, or ${z})`);return{shouldCheck:!0,valid:K&&L,details:B}}function gZ$($,D,X){if(!$.shouldCheck||$.valid)return;let Q=xZ$(D,"ios");X?.(),T0.error("Capgo iOS dependency sync verification failed.");for(let J of $.details)T0.error(J);throw T0.error("Stop here to avoid testing on a broken native iOS project."),T0.warn(Q.summary),T0.info(Q.command),new G0(zR)}async function KW0($,D,X,Q){let J=await h$({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(r0(J)){if($&&D&&X)await yt("onboarding-v2",D,X,"canceled");throw T0.warn("Canceled Capacitor sync"),new G0("Capacitor sync cancelled")}if(J){let Y=hQ(),Z=m1();Z.start("Running the command...");let F;try{await new Promise((G,W)=>{let q=FZ$(Y.runner,["cap","sync"],{stdio:"pipe"});q.on("close",(U)=>{if(U===0)G();else W(Error(`Command failed with exit code ${U}`))}),q.on("error",(U)=>{W(U)})})}catch(G){F=G,T0.error(`Failed to run Capacitor sync: ${G}`),T0.warn(`Please run "${Y.runner} cap sync" manually to ensure encrypted updates work properly`)}if(Q?.validateIosUpdater)gZ$(hZ$(N4(),Q.packageJsonPath),Y.runner,()=>Z.stop("iOS sync check failed ❌"));if(F){Z.stop("Error");return}Z.stop("Capacitor sync completed ✅")}else{let Y=hQ();T0.warn("⚠️ Important: If you upload encrypted bundles without syncing, updates will fail!"),T0.info(`Remember to run "${Y.runner} cap sync" before uploading encrypted bundles`)}}var hk,gk,l30,qN,T0,tZ=".capgo_key",G6=".capgo_key_v2",UN,e6,_30="https://capgo.app",v30="https://files.capgo.app",GN="https://api.capgo.app",u5="https://console.capgo.app",n30=120000,WZ$=20971520,qZ$=1073741824,UZ$=103809024,XU,QU=1e4,mk="BundleUploadTimeoutError",B4="package.json",x30="Cannot connect to server please try again later",gQ,VN="No capacitor config file found, run `cap init` first",o30,fk=null,ZN=null,LN="5.10.0",MN="6.25.0",ZU="7.0.30",f30=!1,nZ="npm",$U="install",bk="npx";var t0=o(()=>{NR();J$();i8();Pn();G4();eO();DV();vt();ft();QV();MT();mW();$Z();zK();nJ0();sM();J30();v$();VK();MR();$N();hk=x$(BE(),1),gk=x$(EE(),1),l30=x$(lp(),1),qN=x$(aO(),1);T0={error:($)=>YN("error",$),info:($)=>YN("info",$),success:($)=>YN("success",$),warn:($)=>YN("warn",$)},UN=`${tZ}.pub`,e6=`${G6}.pub`;XU=[0,1000,3000,5000,1e4];gQ=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i;o30=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/});function pk($){let D=$?.plugins?.CapgoBuilder;return D!==null&&typeof D==="object"&&Object.hasOwn(D,"capgoBuilderAppId")}function QF$($){let D=$?.plugins?.CapgoBuilder;if(pk($)){let X=D.capgoBuilderAppId;if(typeof X!=="string"||!X.trim())throw new G0("Invalid Capacitor config: plugins.CapgoBuilder.capgoBuilderAppId must be a non-empty string");return X.trim()}return}function nQ($,D,X="updater",Q="truthy"){if(Q==="defined"?$!==void 0:Boolean($))return $;let J=QF$(D);if(J)return J;return X==="native"?D?.appId:a$(void 0,D)}var qU=o(()=>{v$();t0()});function AW0($,D,X={},Q){let J=`${$}:${D}`,Y=TN.get(J);if(Y)return Y;let Z=(async()=>{try{if(Q?.aborted)return;if(X.fetchOwnerOrg)return await X.fetchOwnerOrg($,D,Q);if(X.createClient){let q=(await X.createClient($,void 0,void 0,!0,!1)).from("apps").select("owner_org").eq("app_id",D);if(Q)q=q.abortSignal(Q);let{data:U}=await q.maybeSingle();return U?.owner_org??void 0}let{data:F,error:G}=await K$(`app/${encodeURIComponent(D)}`,{apikey:$,method:"GET",body:void 0,signal:Q});if(G||!F?.owner_org)return;return F.owner_org}catch{return}})();return TN.set(J,Z),Z.then((F)=>{if(!F)TN.delete(J)}).catch(()=>{TN.delete(J)}),Z}var TN;var IW0=o(()=>{t0();TN=new Map});import{AsyncLocalStorage as JF$}from"node:async_hooks";import{env as TW0}from"node:process";function YF$(){return l7(TW0.CAPGO_DISABLE_TELEMETRY)||l7(TW0.CAPGO_DISABLE_POSTHOG)}function ZF$($){CW0.add($),$.finally(()=>CW0.delete($))}function FF$($){return $==="build"||$.startsWith("build ")||/^mcp:(?:capgo_builder_|start_capgo_builder_|start_capgo_build$|capgo_build_|cancel_capgo_build$)/u.test($)}function GF$($,D,X=!1){let Q=`${$}\x00${X?"builder":"default"}`,J=SW0.get(Q);if(J)return J;let Y=(async()=>{try{let Z=await L$(!0).catch(()=>{return}),F=(X?nQ(void 0,Z?.config):a$("",Z?.config))||void 0;if(!F)return{};let G=await AW0($,F,{},D);return{appId:F,orgId:G}}catch{return{}}})();return SW0.set(Q,Y),Y}function G$($){if(YF$())return Promise.resolve();let D=$.apikey??g5();if(!D)return Promise.resolve();let X=new AbortController;PW0.add(X);let Q=(async()=>{try{let{appId:J,orgId:Y}=$;if(J===void 0&&Y===void 0){let F=vW0.getStore()??(typeof $.tags?.command_path==="string"?$.tags.command_path:_W0),G=await GF$(D,X.signal,FF$(F));J=G.appId,Y=G.orgId}let Z={...J?{app_id:J}:{},...$.tags??{}};await e0(D,{channel:$.channel,event:$.event,tracking_version:2,...$.timestamp?{timestamp:$.timestamp}:{},...Y?{org_id:Y}:{},tags:Z,...$.nonPersonTags?{nonPersonTags:$.nonPersonTags}:{}},!1,X.signal).catch(()=>{})}catch{}finally{PW0.delete(X)}})();return ZF$(Q),Q}function qF$($){let D=$.durationMs>Ct;if($.ok&&!D)return;let X=vW0.getStore()??_W0,Q={operation:Pt($.url,$.method),method:$.method,status_code:$.status,duration_ms:$.durationMs,ok:$.ok,slow:D};if($.source)Q.source=$.source;if(X)Q.command_path=X;if(!$.ok)Q.error_category=$.error!==void 0?OK($.error):Nm($.status);G$({apikey:$.apikey,channel:WF$,event:"Supabase Call",tags:Q})}var CW0,PW0,SW0,_W0="",vW0,WF$="cli-perf";var YD=o(()=>{z8();zK();t0();qU();IW0();DV();eO();DV();CW0=new Set,PW0=new Set;SW0=new Map;vW0=new JF$;Tt(qF$)});var w7=E((BD1,Zq0)=>{var Jq0=["nodebuffer","arraybuffer","fragments"],Yq0=typeof Blob<"u";if(Yq0)Jq0.push("blob");Zq0.exports={BINARY_TYPES:Jq0,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Yq0,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var KU=E((wD1,kN)=>{var{EMPTY_BUFFER:QG$}=w7(),Xy=Buffer[Symbol.species];function JG$($,D){if($.length===0)return QG$;if($.length===1)return $[0];let X=Buffer.allocUnsafe(D),Q=0;for(let J=0;J<$.length;J++){let Y=$[J];X.set(Y,Q),Q+=Y.length}if(Q<D)return new Xy(X.buffer,X.byteOffset,Q);return X}function Fq0($,D,X,Q,J){for(let Y=0;Y<J;Y++)X[Q+Y]=$[Y]^D[Y&3]}function Gq0($,D){for(let X=0;X<$.length;X++)$[X]^=D[X&3]}function YG$($){if($.length===$.buffer.byteLength)return $.buffer;return $.buffer.slice($.byteOffset,$.byteOffset+$.length)}function Qy($){if(Qy.readOnly=!0,Buffer.isBuffer($))return $;let D;if($ instanceof ArrayBuffer)D=new Xy($);else if(ArrayBuffer.isView($))D=new Xy($.buffer,$.byteOffset,$.byteLength);else D=Buffer.from($),Qy.readOnly=!1;return D}kN.exports={concat:JG$,mask:Fq0,toArrayBuffer:YG$,toBuffer:Qy,unmask:Gq0};if(!process.env.WS_NO_BUFFER_UTIL)try{let $=(()=>{throw new Error("Cannot require module "+"bufferutil");})();kN.exports.mask=function(D,X,Q,J,Y){if(Y<48)Fq0(D,X,Q,J,Y);else $.mask(D,X,Q,J,Y)},kN.exports.unmask=function(D,X){if(D.length<32)Gq0(D,X);else $.unmask(D,X)}}catch($){}});var Hq0=E((RD1,Uq0)=>{var Wq0=Symbol("kDone"),Jy=Symbol("kRun");class qq0{constructor($){this[Wq0]=()=>{this.pending--,this[Jy]()},this.concurrency=$||1/0,this.jobs=[],this.pending=0}add($){this.jobs.push($),this[Jy]()}[Jy](){if(this.pending===this.concurrency)return;if(this.jobs.length){let $=this.jobs.shift();this.pending++,$(this[Wq0])}}}Uq0.exports=qq0});var QF=E((ED1,Lq0)=>{var OU=Q0("zlib"),Kq0=KU(),ZG$=Hq0(),{kStatusCode:Oq0}=w7(),FG$=Buffer[Symbol.species],GG$=Buffer.from([0,0,255,255]),fN=Symbol("permessage-deflate"),R7=Symbol("total-length"),DF=Symbol("callback"),d5=Symbol("buffers"),XF=Symbol("error"),yN;class Vq0{constructor($){if(this._options=$||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yN){let D=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yN=new ZG$(D)}}static get extensionName(){return"permessage-deflate"}offer(){let $={};if(this._options.serverNoContextTakeover)$.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)$.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)$.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)$.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)$.client_max_window_bits=!0;return $}accept($){return $=this.normalizeParams($),this.params=this._isServer?this.acceptAsServer($):this.acceptAsClient($),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let $=this._deflate[DF];if(this._deflate.close(),this._deflate=null,$)$(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer($){let D=this._options,X=$.find((Q)=>{if(D.serverNoContextTakeover===!1&&Q.server_no_context_takeover||Q.server_max_window_bits&&(D.serverMaxWindowBits===!1||typeof D.serverMaxWindowBits==="number"&&D.serverMaxWindowBits>Q.server_max_window_bits)||typeof D.clientMaxWindowBits==="number"&&!Q.client_max_window_bits)return!1;return!0});if(!X)throw Error("None of the extension offers can be accepted");if(D.serverNoContextTakeover)X.server_no_context_takeover=!0;if(D.clientNoContextTakeover)X.client_no_context_takeover=!0;if(typeof D.serverMaxWindowBits==="number")X.server_max_window_bits=D.serverMaxWindowBits;if(typeof D.clientMaxWindowBits==="number")X.client_max_window_bits=D.clientMaxWindowBits;else if(X.client_max_window_bits===!0||D.clientMaxWindowBits===!1)delete X.client_max_window_bits;return X}acceptAsClient($){let D=$[0];if(this._options.clientNoContextTakeover===!1&&D.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!D.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")D.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&D.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return D}normalizeParams($){return $.forEach((D)=>{Object.keys(D).forEach((X)=>{let Q=D[X];if(Q.length>1)throw Error(`Parameter "${X}" must have only a single value`);if(Q=Q[0],X==="client_max_window_bits"){if(Q!==!0){let J=+Q;if(!Number.isInteger(J)||J<8||J>15)throw TypeError(`Invalid value for parameter "${X}": ${Q}`);Q=J}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${X}": ${Q}`)}else if(X==="server_max_window_bits"){let J=+Q;if(!Number.isInteger(J)||J<8||J>15)throw TypeError(`Invalid value for parameter "${X}": ${Q}`);Q=J}else if(X==="client_no_context_takeover"||X==="server_no_context_takeover"){if(Q!==!0)throw TypeError(`Invalid value for parameter "${X}": ${Q}`)}else throw Error(`Unknown parameter "${X}"`);D[X]=Q})}),$}decompress($,D,X){yN.add((Q)=>{this._decompress($,D,(J,Y)=>{Q(),X(J,Y)})})}compress($,D,X){yN.add((Q)=>{this._compress($,D,(J,Y)=>{Q(),X(J,Y)})})}_decompress($,D,X){let Q=this._isServer?"client":"server";if(!this._inflate){let J=`${Q}_max_window_bits`,Y=typeof this.params[J]!=="number"?OU.Z_DEFAULT_WINDOWBITS:this.params[J];this._inflate=OU.createInflateRaw({...this._options.zlibInflateOptions,windowBits:Y}),this._inflate[fN]=this,this._inflate[R7]=0,this._inflate[d5]=[],this._inflate.on("error",qG$),this._inflate.on("data",zq0)}if(this._inflate[DF]=X,this._inflate.write($),D)this._inflate.write(GG$);this._inflate.flush(()=>{let J=this._inflate[XF];if(J){this._inflate.close(),this._inflate=null,X(J);return}let Y=Kq0.concat(this._inflate[d5],this._inflate[R7]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[R7]=0,this._inflate[d5]=[],D&&this.params[`${Q}_no_context_takeover`])this._inflate.reset();X(null,Y)})}_compress($,D,X){let Q=this._isServer?"server":"client";if(!this._deflate){let J=`${Q}_max_window_bits`,Y=typeof this.params[J]!=="number"?OU.Z_DEFAULT_WINDOWBITS:this.params[J];this._deflate=OU.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:Y}),this._deflate[R7]=0,this._deflate[d5]=[],this._deflate.on("data",WG$)}this._deflate[DF]=X,this._deflate.write($),this._deflate.flush(OU.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let J=Kq0.concat(this._deflate[d5],this._deflate[R7]);if(D)J=new FG$(J.buffer,J.byteOffset,J.length-4);if(this._deflate[DF]=null,this._deflate[R7]=0,this._deflate[d5]=[],D&&this.params[`${Q}_no_context_takeover`])this._deflate.reset();X(null,J)})}}Lq0.exports=Vq0;function WG$($){this[d5].push($),this[R7]+=$.length}function zq0($){if(this[R7]+=$.length,this[fN]._maxPayload<1||this[R7]<=this[fN]._maxPayload){this[d5].push($);return}this[XF]=RangeError("Max payload size exceeded"),this[XF].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[XF][Oq0]=1009,this.removeListener("data",zq0),this.reset()}function qG$($){if(this[fN]._inflate=null,this[XF]){this[DF](this[XF]);return}$[Oq0]=1007,this[DF]($)}});var JF=E((jD1,uN)=>{var{isUtf8:Mq0}=Q0("buffer"),{hasBlob:UG$}=w7(),HG$=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function KG$($){return $>=1000&&$<=1014&&$!==1004&&$!==1005&&$!==1006||$>=3000&&$<=4999}function Yy($){let D=$.length,X=0;while(X<D)if(($[X]&128)===0)X++;else if(($[X]&224)===192){if(X+1===D||($[X+1]&192)!==128||($[X]&254)===192)return!1;X+=2}else if(($[X]&240)===224){if(X+2>=D||($[X+1]&192)!==128||($[X+2]&192)!==128||$[X]===224&&($[X+1]&224)===128||$[X]===237&&($[X+1]&224)===160)return!1;X+=3}else if(($[X]&248)===240){if(X+3>=D||($[X+1]&192)!==128||($[X+2]&192)!==128||($[X+3]&192)!==128||$[X]===240&&($[X+1]&240)===128||$[X]===244&&$[X+1]>143||$[X]>244)return!1;X+=4}else return!1;return!0}function OG$($){return UG$&&typeof $==="object"&&typeof $.arrayBuffer==="function"&&typeof $.type==="string"&&typeof $.stream==="function"&&($[Symbol.toStringTag]==="Blob"||$[Symbol.toStringTag]==="File")}uN.exports={isBlob:OG$,isValidStatusCode:KG$,isValidUTF8:Yy,tokenChars:HG$};if(Mq0)uN.exports.isValidUTF8=function($){return $.length<24?Yy($):Mq0($)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let $=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();uN.exports.isValidUTF8=function(D){return D.length<32?Yy(D):$(D)}}catch($){}});var Fy=E((AD1,Eq0)=>{var{Writable:VG$}=Q0("stream"),Nq0=QF(),{BINARY_TYPES:zG$,EMPTY_BUFFER:Bq0,kStatusCode:LG$,kWebSocket:MG$}=w7(),{concat:Zy,toArrayBuffer:NG$,unmask:BG$}=KU(),{isValidStatusCode:wG$,isValidUTF8:wq0}=JF(),bN=Buffer[Symbol.species];class Rq0 extends VG${constructor($={}){super();this._allowSynchronousEvents=$.allowSynchronousEvents!==void 0?$.allowSynchronousEvents:!0,this._binaryType=$.binaryType||zG$[0],this._extensions=$.extensions||{},this._isServer=!!$.isServer,this._maxBufferedChunks=$.maxBufferedChunks|0,this._maxFragments=$.maxFragments|0,this._maxPayload=$.maxPayload|0,this._skipUTF8Validation=!!$.skipUTF8Validation,this[MG$]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write($,D,X){if(this._opcode===8&&this._state==0)return X();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){X(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=$.length,this._buffers.push($),this.startLoop(X)}consume($){if(this._bufferedBytes-=$,$===this._buffers[0].length)return this._buffers.shift();if($<this._buffers[0].length){let X=this._buffers[0];return this._buffers[0]=new bN(X.buffer,X.byteOffset+$,X.length-$),new bN(X.buffer,X.byteOffset,$)}let D=Buffer.allocUnsafe($);do{let X=this._buffers[0],Q=D.length-$;if($>=X.length)D.set(this._buffers.shift(),Q);else D.set(new Uint8Array(X.buffer,X.byteOffset,$),Q),this._buffers[0]=new bN(X.buffer,X.byteOffset+$,X.length-$);$-=X.length}while($>0);return D}startLoop($){this._loop=!0;do switch(this._state){case 0:this.getInfo($);break;case 1:this.getPayloadLength16($);break;case 2:this.getPayloadLength64($);break;case 3:this.getMask();break;case 4:this.getData($);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)$()}getInfo($){if(this._bufferedBytes<2){this._loop=!1;return}let D=this.consume(2);if((D[0]&48)!==0){let Q=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");$(Q);return}let X=(D[0]&64)===64;if(X&&!this._extensions[Nq0.extensionName]){let Q=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(Q);return}if(this._fin=(D[0]&128)===128,this._opcode=D[0]&15,this._payloadLength=D[1]&127,this._opcode===0){if(X){let Q=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(Q);return}if(!this._fragmented){let Q=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");$(Q);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let Q=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");$(Q);return}this._compressed=X}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let Q=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");$(Q);return}if(X){let Q=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(Q);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let Q=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");$(Q);return}}else{let Q=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");$(Q);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(D[1]&128)===128,this._isServer){if(!this._masked){let Q=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");$(Q);return}}else if(this._masked){let Q=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");$(Q);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength($)}getPayloadLength16($){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength($)}getPayloadLength64($){if(this._bufferedBytes<8){this._loop=!1;return}let D=this.consume(8),X=D.readUInt32BE(0);if(X>Math.pow(2,21)-1){let Q=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");$(Q);return}this._payloadLength=X*Math.pow(2,32)+D.readUInt32BE(4),this.haveLength($)}haveLength($){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let D=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");$(D);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData($){let D=Bq0;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(D=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)BG$(D,this._mask)}if(this._opcode>7){this.controlMessage(D,$);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let X=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");$(X);return}if(this._compressed){this._state=5,this.decompress(D,$);return}if(D.length)this._messageLength=this._totalPayloadLength,this._fragments.push(D);this.dataMessage($)}decompress($,D){this._extensions[Nq0.extensionName].decompress($,this._fin,(Q,J)=>{if(Q)return D(Q);if(J.length){if(this._messageLength+=J.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let Y=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");D(Y);return}this._fragments.push(J)}if(this.dataMessage(D),this._state===0)this.startLoop(D)})}dataMessage($){if(!this._fin){this._state=0;return}let D=this._messageLength,X=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let Q;if(this._binaryType==="nodebuffer")Q=Zy(X,D);else if(this._binaryType==="arraybuffer")Q=NG$(Zy(X,D));else if(this._binaryType==="blob")Q=new Blob(X);else Q=X;if(this._allowSynchronousEvents)this.emit("message",Q,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",Q,!0),this._state=0,this.startLoop($)})}else{let Q=Zy(X,D);if(!this._skipUTF8Validation&&!wq0(Q)){let J=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");$(J);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",Q,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",Q,!1),this._state=0,this.startLoop($)})}}controlMessage($,D){if(this._opcode===8){if($.length===0)this._loop=!1,this.emit("conclude",1005,Bq0),this.end();else{let X=$.readUInt16BE(0);if(!wG$(X)){let J=this.createError(RangeError,`invalid status code ${X}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");D(J);return}let Q=new bN($.buffer,$.byteOffset+2,$.length-2);if(!this._skipUTF8Validation&&!wq0(Q)){let J=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");D(J);return}this._loop=!1,this.emit("conclude",X,Q),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",$),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",$),this._state=0,this.startLoop(D)})}createError($,D,X,Q,J){this._loop=!1,this._errored=!0;let Y=new $(X?`Invalid WebSocket frame: ${D}`:D);return Error.captureStackTrace(Y,this.createError),Y.code=J,Y[LG$]=Q,Y}}Eq0.exports=Rq0});var Wy=E((TD1,Iq0)=>{var{Duplex:ID1}=Q0("stream"),{randomFillSync:RG$}=Q0("crypto"),{types:{isUint8Array:EG$}}=Q0("util"),jq0=QF(),{EMPTY_BUFFER:jG$,kWebSocket:AG$,NOOP:IG$}=w7(),{isBlob:YF,isValidStatusCode:TG$}=JF(),{mask:Aq0,toBuffer:iQ}=KU(),i4=Symbol("kByteLength"),CG$=Buffer.alloc(4),rQ,ZF=8192,v8=0,PG$=1,SG$=2;class c5{constructor($,D,X){if(this._extensions=D||{},X)this._generateMask=X,this._maskBuffer=Buffer.alloc(4);this._socket=$,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=v8,this.onerror=IG$,this[AG$]=void 0}static frame($,D){let X,Q=!1,J=2,Y=!1;if(D.mask){if(X=D.maskBuffer||CG$,D.generateMask)D.generateMask(X);else{if(ZF===8192){if(rQ===void 0)rQ=Buffer.alloc(8192);RG$(rQ,0,8192),ZF=0}X[0]=rQ[ZF++],X[1]=rQ[ZF++],X[2]=rQ[ZF++],X[3]=rQ[ZF++]}Y=(X[0]|X[1]|X[2]|X[3])===0,J=6}let Z;if(typeof $==="string")if((!D.mask||Y)&&D[i4]!==void 0)Z=D[i4];else $=Buffer.from($),Z=$.length;else Z=$.length,Q=D.mask&&D.readOnly&&!Y;let F=Z;if(Z>=65536)J+=8,F=127;else if(Z>125)J+=2,F=126;let G=Buffer.allocUnsafe(Q?Z+J:J);if(G[0]=D.fin?D.opcode|128:D.opcode,D.rsv1)G[0]|=64;if(G[1]=F,F===126)G.writeUInt16BE(Z,2);else if(F===127)G[2]=G[3]=0,G.writeUIntBE(Z,4,6);if(!D.mask)return[G,$];if(G[1]|=128,G[J-4]=X[0],G[J-3]=X[1],G[J-2]=X[2],G[J-1]=X[3],Y)return[G,$];if(Q)return Aq0($,X,G,J,Z),[G];return Aq0($,X,$,0,Z),[G,$]}close($,D,X,Q){let J;if($===void 0)J=jG$;else if(typeof $!=="number"||!TG$($))throw TypeError("First argument must be a valid error code number");else if(D===void 0||!D.length)J=Buffer.allocUnsafe(2),J.writeUInt16BE($,0);else{let Z=Buffer.byteLength(D);if(Z>123)throw RangeError("The message must not be greater than 123 bytes");if(J=Buffer.allocUnsafe(2+Z),J.writeUInt16BE($,0),typeof D==="string")J.write(D,2);else if(EG$(D))J.set(D,2);else throw TypeError("Second argument must be a string or a Uint8Array")}let Y={[i4]:J.length,fin:!0,generateMask:this._generateMask,mask:X,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==v8)this.enqueue([this.dispatch,J,!1,Y,Q]);else this.sendFrame(c5.frame(J,Y),Q)}ping($,D,X){let Q,J;if(typeof $==="string")Q=Buffer.byteLength($),J=!1;else if(YF($))Q=$.size,J=!1;else $=iQ($),Q=$.length,J=iQ.readOnly;if(Q>125)throw RangeError("The data size must not be greater than 125 bytes");let Y={[i4]:Q,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:9,readOnly:J,rsv1:!1};if(YF($))if(this._state!==v8)this.enqueue([this.getBlobData,$,!1,Y,X]);else this.getBlobData($,!1,Y,X);else if(this._state!==v8)this.enqueue([this.dispatch,$,!1,Y,X]);else this.sendFrame(c5.frame($,Y),X)}pong($,D,X){let Q,J;if(typeof $==="string")Q=Buffer.byteLength($),J=!1;else if(YF($))Q=$.size,J=!1;else $=iQ($),Q=$.length,J=iQ.readOnly;if(Q>125)throw RangeError("The data size must not be greater than 125 bytes");let Y={[i4]:Q,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:10,readOnly:J,rsv1:!1};if(YF($))if(this._state!==v8)this.enqueue([this.getBlobData,$,!1,Y,X]);else this.getBlobData($,!1,Y,X);else if(this._state!==v8)this.enqueue([this.dispatch,$,!1,Y,X]);else this.sendFrame(c5.frame($,Y),X)}send($,D,X){let Q=this._extensions[jq0.extensionName],J=D.binary?2:1,Y=D.compress,Z,F;if(typeof $==="string")Z=Buffer.byteLength($),F=!1;else if(YF($))Z=$.size,F=!1;else $=iQ($),Z=$.length,F=iQ.readOnly;if(this._firstFragment){if(this._firstFragment=!1,Y&&Q&&Q.params[Q._isServer?"server_no_context_takeover":"client_no_context_takeover"])Y=Z>=Q._threshold;this._compress=Y}else Y=!1,J=0;if(D.fin)this._firstFragment=!0;let G={[i4]:Z,fin:D.fin,generateMask:this._generateMask,mask:D.mask,maskBuffer:this._maskBuffer,opcode:J,readOnly:F,rsv1:Y};if(YF($))if(this._state!==v8)this.enqueue([this.getBlobData,$,this._compress,G,X]);else this.getBlobData($,this._compress,G,X);else if(this._state!==v8)this.enqueue([this.dispatch,$,this._compress,G,X]);else this.dispatch($,this._compress,G,X)}getBlobData($,D,X,Q){this._bufferedBytes+=X[i4],this._state=SG$,$.arrayBuffer().then((J)=>{if(this._socket.destroyed){let Z=Error("The socket was closed while the blob was being read");process.nextTick(Gy,this,Z,Q);return}this._bufferedBytes-=X[i4];let Y=iQ(J);if(!D)this._state=v8,this.sendFrame(c5.frame(Y,X),Q),this.dequeue();else this.dispatch(Y,D,X,Q)}).catch((J)=>{process.nextTick(_G$,this,J,Q)})}dispatch($,D,X,Q){if(!D){this.sendFrame(c5.frame($,X),Q);return}let J=this._extensions[jq0.extensionName];this._bufferedBytes+=X[i4],this._state=PG$,J.compress($,X.fin,(Y,Z)=>{if(this._socket.destroyed){let F=Error("The socket was closed while data was being compressed");Gy(this,F,Q);return}this._bufferedBytes-=X[i4],this._state=v8,X.readOnly=!1,this.sendFrame(c5.frame(Z,X),Q),this.dequeue()})}dequeue(){while(this._state===v8&&this._queue.length){let $=this._queue.shift();this._bufferedBytes-=$[3][i4],Reflect.apply($[0],this,$.slice(1))}}enqueue($){this._bufferedBytes+=$[3][i4],this._queue.push($)}sendFrame($,D){if($.length===2)this._socket.cork(),this._socket.write($[0]),this._socket.write($[1],D),this._socket.uncork();else this._socket.write($[0],D)}}Iq0.exports=c5;function Gy($,D,X){if(typeof X==="function")X(D);for(let Q=0;Q<$._queue.length;Q++){let J=$._queue[Q],Y=J[J.length-1];if(typeof Y==="function")Y(D)}}function _G$($,D,X){Gy($,D,X),$.onerror(D)}});var yq0=E((CD1,kq0)=>{var{kForOnEventAttribute:VU,kListener:qy}=w7(),Tq0=Symbol("kCode"),Cq0=Symbol("kData"),Pq0=Symbol("kError"),Sq0=Symbol("kMessage"),_q0=Symbol("kReason"),FF=Symbol("kTarget"),vq0=Symbol("kType"),xq0=Symbol("kWasClean");class l5{constructor($){this[FF]=null,this[vq0]=$}get target(){return this[FF]}get type(){return this[vq0]}}Object.defineProperty(l5.prototype,"target",{enumerable:!0});Object.defineProperty(l5.prototype,"type",{enumerable:!0});class GF extends l5{constructor($,D={}){super($);this[Tq0]=D.code===void 0?0:D.code,this[_q0]=D.reason===void 0?"":D.reason,this[xq0]=D.wasClean===void 0?!1:D.wasClean}get code(){return this[Tq0]}get reason(){return this[_q0]}get wasClean(){return this[xq0]}}Object.defineProperty(GF.prototype,"code",{enumerable:!0});Object.defineProperty(GF.prototype,"reason",{enumerable:!0});Object.defineProperty(GF.prototype,"wasClean",{enumerable:!0});class zU extends l5{constructor($,D={}){super($);this[Pq0]=D.error===void 0?null:D.error,this[Sq0]=D.message===void 0?"":D.message}get error(){return this[Pq0]}get message(){return this[Sq0]}}Object.defineProperty(zU.prototype,"error",{enumerable:!0});Object.defineProperty(zU.prototype,"message",{enumerable:!0});class gN extends l5{constructor($,D={}){super($);this[Cq0]=D.data===void 0?null:D.data}get data(){return this[Cq0]}}Object.defineProperty(gN.prototype,"data",{enumerable:!0});var vG$={addEventListener($,D,X={}){for(let J of this.listeners($))if(!X[VU]&&J[qy]===D&&!J[VU])return;let Q;if($==="message")Q=function(Y,Z){let F=new gN("message",{data:Z?Y:Y.toString()});F[FF]=this,hN(D,this,F)};else if($==="close")Q=function(Y,Z){let F=new GF("close",{code:Y,reason:Z.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});F[FF]=this,hN(D,this,F)};else if($==="error")Q=function(Y){let Z=new zU("error",{error:Y,message:Y.message});Z[FF]=this,hN(D,this,Z)};else if($==="open")Q=function(){let Y=new l5("open");Y[FF]=this,hN(D,this,Y)};else return;if(Q[VU]=!!X[VU],Q[qy]=D,X.once)this.once($,Q);else this.on($,Q)},removeEventListener($,D){for(let X of this.listeners($))if(X[qy]===D&&!X[VU]){this.removeListener($,X);break}}};kq0.exports={CloseEvent:GF,ErrorEvent:zU,Event:l5,EventTarget:vG$,MessageEvent:gN};function hN($,D,X){if(typeof $==="object"&&$.handleEvent)$.handleEvent.call($,X);else $.call(D,X)}});var mN=E((PD1,fq0)=>{var{tokenChars:LU}=JF();function B9($,D,X){if($[D]===void 0)$[D]=[X];else $[D].push(X)}function xG$($){let D=Object.create(null),X=Object.create(null),Q=!1,J=!1,Y=!1,Z,F,G=-1,W=-1,q=-1,U=0;for(;U<$.length;U++)if(W=$.charCodeAt(U),Z===void 0)if(q===-1&&LU[W]===1){if(G===-1)G=U}else if(U!==0&&(W===32||W===9)){if(q===-1&&G!==-1)q=U}else if(W===59||W===44){if(G===-1)throw SyntaxError(`Unexpected character at index ${U}`);if(q===-1)q=U;let K=$.slice(G,q);if(W===44)B9(D,K,X),X=Object.create(null);else Z=K;G=q=-1}else throw SyntaxError(`Unexpected character at index ${U}`);else if(F===void 0)if(q===-1&&LU[W]===1){if(G===-1)G=U}else if(W===32||W===9){if(q===-1&&G!==-1)q=U}else if(W===59||W===44){if(G===-1)throw SyntaxError(`Unexpected character at index ${U}`);if(q===-1)q=U;if(B9(X,$.slice(G,q),!0),W===44)B9(D,Z,X),X=Object.create(null),Z=void 0;G=q=-1}else if(W===61&&G!==-1&&q===-1)F=$.slice(G,U),G=q=-1;else throw SyntaxError(`Unexpected character at index ${U}`);else if(J){if(LU[W]!==1)throw SyntaxError(`Unexpected character at index ${U}`);if(G===-1)G=U;else if(!Q)Q=!0;J=!1}else if(Y)if(LU[W]===1){if(G===-1)G=U}else if(W===34&&G!==-1)Y=!1,q=U;else if(W===92)J=!0;else throw SyntaxError(`Unexpected character at index ${U}`);else if(W===34&&$.charCodeAt(U-1)===61)Y=!0;else if(q===-1&&LU[W]===1){if(G===-1)G=U}else if(G!==-1&&(W===32||W===9)){if(q===-1)q=U}else if(W===59||W===44){if(G===-1)throw SyntaxError(`Unexpected character at index ${U}`);if(q===-1)q=U;let K=$.slice(G,q);if(Q)K=K.replace(/\\/g,""),Q=!1;if(B9(X,F,K),W===44)B9(D,Z,X),X=Object.create(null),Z=void 0;F=void 0,G=q=-1}else throw SyntaxError(`Unexpected character at index ${U}`);if(G===-1||Y||W===32||W===9)throw SyntaxError("Unexpected end of input");if(q===-1)q=U;let H=$.slice(G,q);if(Z===void 0)B9(D,H,X);else{if(F===void 0)B9(X,H,!0);else if(Q)B9(X,F,H.replace(/\\/g,""));else B9(X,F,H);B9(D,Z,X)}return D}function kG$($){return Object.keys($).map((D)=>{let X=$[D];if(!Array.isArray(X))X=[X];return X.map((Q)=>{return[D].concat(Object.keys(Q).map((J)=>{let Y=Q[J];if(!Array.isArray(Y))Y=[Y];return Y.map((Z)=>Z===!0?J:`${J}=${Z}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}fq0.exports={format:kG$,parse:xG$}});var nN=E((vD1,rq0)=>{var yG$=Q0("events"),fG$=Q0("https"),uG$=Q0("http"),hq0=Q0("net"),bG$=Q0("tls"),{randomBytes:hG$,createHash:gG$}=Q0("crypto"),{Duplex:SD1,Readable:_D1}=Q0("stream"),{URL:Uy}=Q0("url"),n5=QF(),mG$=Fy(),dG$=Wy(),{isBlob:cG$}=JF(),{BINARY_TYPES:uq0,CLOSE_TIMEOUT:lG$,EMPTY_BUFFER:dN,GUID:nG$,kForOnEventAttribute:Hy,kListener:pG$,kStatusCode:iG$,kWebSocket:kD,NOOP:gq0}=w7(),{EventTarget:{addEventListener:rG$,removeEventListener:oG$}}=yq0(),{format:tG$,parse:aG$}=mN(),{toBuffer:sG$}=KU(),mq0=Symbol("kAborted"),Ky=[8,13],E7=["CONNECTING","OPEN","CLOSING","CLOSED"],eG$=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class M$ extends yG${constructor($,D,X){super();if(this._binaryType=uq0[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=dN,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=M$.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,$!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,D===void 0)D=[];else if(!Array.isArray(D))if(typeof D==="object"&&D!==null)X=D,D=[];else D=[D];dq0(this,$,D,X)}else this._autoPong=X.autoPong,this._closeTimeout=X.closeTimeout,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType($){if(!uq0.includes($))return;if(this._binaryType=$,this._receiver)this._receiver._binaryType=$}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket($,D,X){let Q=new mG$({allowSynchronousEvents:X.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:X.maxBufferedChunks,maxFragments:X.maxFragments,maxPayload:X.maxPayload,skipUTF8Validation:X.skipUTF8Validation}),J=new dG$($,this._extensions,X.generateMask);if(this._receiver=Q,this._sender=J,this._socket=$,Q[kD]=this,J[kD]=this,$[kD]=this,Q.on("conclude",X3$),Q.on("drain",Q3$),Q.on("error",J3$),Q.on("message",Y3$),Q.on("ping",Z3$),Q.on("pong",F3$),J.onerror=G3$,$.setTimeout)$.setTimeout(0);if($.setNoDelay)$.setNoDelay();if(D.length>0)$.unshift(D);$.on("close",nq0),$.on("data",lN),$.on("end",pq0),$.on("error",iq0),this._readyState=M$.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=M$.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[n5.extensionName])this._extensions[n5.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=M$.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close($,D){if(this.readyState===M$.CLOSED)return;if(this.readyState===M$.CONNECTING){R4(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===M$.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=M$.CLOSING,this._sender.close($,D,!this._isServer,(X)=>{if(X)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),lq0(this)}pause(){if(this.readyState===M$.CONNECTING||this.readyState===M$.CLOSED)return;this._paused=!0,this._socket.pause()}ping($,D,X){if(this.readyState===M$.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof $==="function")X=$,$=D=void 0;else if(typeof D==="function")X=D,D=void 0;if(typeof $==="number")$=$.toString();if(this.readyState!==M$.OPEN){Oy(this,$,X);return}if(D===void 0)D=!this._isServer;this._sender.ping($||dN,D,X)}pong($,D,X){if(this.readyState===M$.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof $==="function")X=$,$=D=void 0;else if(typeof D==="function")X=D,D=void 0;if(typeof $==="number")$=$.toString();if(this.readyState!==M$.OPEN){Oy(this,$,X);return}if(D===void 0)D=!this._isServer;this._sender.pong($||dN,D,X)}resume(){if(this.readyState===M$.CONNECTING||this.readyState===M$.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send($,D,X){if(this.readyState===M$.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof D==="function")X=D,D={};if(typeof $==="number")$=$.toString();if(this.readyState!==M$.OPEN){Oy(this,$,X);return}let Q={binary:typeof $!=="string",mask:!this._isServer,compress:!0,fin:!0,...D};if(!this._extensions[n5.extensionName])Q.compress=!1;this._sender.send($||dN,Q,X)}terminate(){if(this.readyState===M$.CLOSED)return;if(this.readyState===M$.CONNECTING){R4(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=M$.CLOSING,this._socket.destroy()}}Object.defineProperty(M$,"CONNECTING",{enumerable:!0,value:E7.indexOf("CONNECTING")});Object.defineProperty(M$.prototype,"CONNECTING",{enumerable:!0,value:E7.indexOf("CONNECTING")});Object.defineProperty(M$,"OPEN",{enumerable:!0,value:E7.indexOf("OPEN")});Object.defineProperty(M$.prototype,"OPEN",{enumerable:!0,value:E7.indexOf("OPEN")});Object.defineProperty(M$,"CLOSING",{enumerable:!0,value:E7.indexOf("CLOSING")});Object.defineProperty(M$.prototype,"CLOSING",{enumerable:!0,value:E7.indexOf("CLOSING")});Object.defineProperty(M$,"CLOSED",{enumerable:!0,value:E7.indexOf("CLOSED")});Object.defineProperty(M$.prototype,"CLOSED",{enumerable:!0,value:E7.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(($)=>{Object.defineProperty(M$.prototype,$,{enumerable:!0})});["open","error","close","message"].forEach(($)=>{Object.defineProperty(M$.prototype,`on${$}`,{enumerable:!0,get(){for(let D of this.listeners($))if(D[Hy])return D[pG$];return null},set(D){for(let X of this.listeners($))if(X[Hy]){this.removeListener($,X);break}if(typeof D!=="function")return;this.addEventListener($,D,{[Hy]:!0})}})});M$.prototype.addEventListener=rG$;M$.prototype.removeEventListener=oG$;rq0.exports=M$;function dq0($,D,X,Q){let J={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:lG$,protocolVersion:Ky[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...Q,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if($._autoPong=J.autoPong,$._closeTimeout=J.closeTimeout,!Ky.includes(J.protocolVersion))throw RangeError(`Unsupported protocol version: ${J.protocolVersion} (supported versions: ${Ky.join(", ")})`);let Y;if(D instanceof Uy)Y=D;else try{Y=new Uy(D)}catch{throw SyntaxError(`Invalid URL: ${D}`)}if(Y.protocol==="http:")Y.protocol="ws:";else if(Y.protocol==="https:")Y.protocol="wss:";$._url=Y.href;let Z=Y.protocol==="wss:",F=Y.protocol==="ws+unix:",G;if(Y.protocol!=="ws:"&&!Z&&!F)G=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(F&&!Y.pathname)G="The URL's pathname is empty";else if(Y.hash)G="The URL contains a fragment identifier";if(G){let V=SyntaxError(G);if($._redirects===0)throw V;else{cN($,V);return}}let W=Z?443:80,q=hG$(16).toString("base64"),U=Z?fG$.request:uG$.request,H=new Set,K;if(J.createConnection=J.createConnection||(Z?D3$:$3$),J.defaultPort=J.defaultPort||W,J.port=Y.port||W,J.host=Y.hostname.startsWith("[")?Y.hostname.slice(1,-1):Y.hostname,J.headers={...J.headers,"Sec-WebSocket-Version":J.protocolVersion,"Sec-WebSocket-Key":q,Connection:"Upgrade",Upgrade:"websocket"},J.path=Y.pathname+Y.search,J.timeout=J.handshakeTimeout,J.perMessageDeflate)K=new n5({...J.perMessageDeflate,isServer:!1,maxPayload:J.maxPayload}),J.headers["Sec-WebSocket-Extensions"]=tG$({[n5.extensionName]:K.offer()});if(X.length){for(let V of X){if(typeof V!=="string"||!eG$.test(V)||H.has(V))throw SyntaxError("An invalid or duplicated subprotocol was specified");H.add(V)}J.headers["Sec-WebSocket-Protocol"]=X.join(",")}if(J.origin)if(J.protocolVersion<13)J.headers["Sec-WebSocket-Origin"]=J.origin;else J.headers.Origin=J.origin;if(Y.username||Y.password)J.auth=`${Y.username}:${Y.password}`;if(F){let V=J.path.split(":");J.socketPath=V[0],J.path=V[1]}let O;if(J.followRedirects){if($._redirects===0){$._originalIpc=F,$._originalSecure=Z,$._originalHostOrSocketPath=F?J.socketPath:Y.host;let V=Q&&Q.headers;if(Q={...Q,headers:{}},V)for(let[z,N]of Object.entries(V))Q.headers[z.toLowerCase()]=N}else if($.listenerCount("redirect")===0){let V=F?$._originalIpc?J.socketPath===$._originalHostOrSocketPath:!1:$._originalIpc?!1:Y.host===$._originalHostOrSocketPath;if(!V||$._originalSecure&&!Z){if(delete J.headers.authorization,delete J.headers.cookie,!V)delete J.headers.host;J.auth=void 0}}if(J.auth&&!Q.headers.authorization)Q.headers.authorization="Basic "+Buffer.from(J.auth).toString("base64");if(O=$._req=U(J),$._redirects)$.emit("redirect",$.url,O)}else O=$._req=U(J);if(J.timeout)O.on("timeout",()=>{R4($,O,"Opening handshake has timed out")});if(O.on("error",(V)=>{if(O===null||O[mq0])return;O=$._req=null,cN($,V)}),O.on("response",(V)=>{let z=V.headers.location,N=V.statusCode;if(z&&J.followRedirects&&N>=300&&N<400){if(++$._redirects>J.maxRedirects){R4($,O,"Maximum redirects exceeded");return}O.abort();let w;try{w=new Uy(z,D)}catch(L){let M=SyntaxError(`Invalid URL: ${z}`);cN($,M);return}dq0($,w,X,Q)}else if(!$.emit("unexpected-response",O,V))R4($,O,`Unexpected server response: ${V.statusCode}`)}),O.on("upgrade",(V,z,N)=>{if($.emit("upgrade",V),$.readyState!==M$.CONNECTING)return;O=$._req=null;let w=V.headers.upgrade;if(w===void 0||w.toLowerCase()!=="websocket"){R4($,z,"Invalid Upgrade header");return}let L=gG$("sha1").update(q+nG$).digest("base64");if(V.headers["sec-websocket-accept"]!==L){R4($,z,"Invalid Sec-WebSocket-Accept header");return}let M=V.headers["sec-websocket-protocol"],B;if(M!==void 0){if(!H.size)B="Server sent a subprotocol but none was requested";else if(!H.has(M))B="Server sent an invalid subprotocol"}else if(H.size)B="Server sent no subprotocol";if(B){R4($,z,B);return}if(M)$._protocol=M;let R=V.headers["sec-websocket-extensions"];if(R!==void 0){if(!K){R4($,z,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let P;try{P=aG$(R)}catch(j){R4($,z,"Invalid Sec-WebSocket-Extensions header");return}let v=Object.keys(P);if(v.length!==1||v[0]!==n5.extensionName){R4($,z,"Server indicated an extension that was not requested");return}try{K.accept(P[n5.extensionName])}catch(j){R4($,z,"Invalid Sec-WebSocket-Extensions header");return}$._extensions[n5.extensionName]=K}$.setSocket(z,N,{allowSynchronousEvents:J.allowSynchronousEvents,generateMask:J.generateMask,maxBufferedChunks:J.maxBufferedChunks,maxFragments:J.maxFragments,maxPayload:J.maxPayload,skipUTF8Validation:J.skipUTF8Validation})}),J.finishRequest)J.finishRequest(O,$);else O.end()}function cN($,D){$._readyState=M$.CLOSING,$._errorEmitted=!0,$.emit("error",D),$.emitClose()}function $3$($){return $.path=$.socketPath,hq0.connect($)}function D3$($){if($.path=void 0,!$.servername&&$.servername!=="")$.servername=hq0.isIP($.host)?"":$.host;return bG$.connect($)}function R4($,D,X){$._readyState=M$.CLOSING;let Q=Error(X);if(Error.captureStackTrace(Q,R4),D.setHeader){if(D[mq0]=!0,D.abort(),D.socket&&!D.socket.destroyed)D.socket.destroy();process.nextTick(cN,$,Q)}else D.destroy(Q),D.once("error",$.emit.bind($,"error")),D.once("close",$.emitClose.bind($))}function Oy($,D,X){if(D){let Q=cG$(D)?D.size:sG$(D).length;if($._socket)$._sender._bufferedBytes+=Q;else $._bufferedAmount+=Q}if(X){let Q=Error(`WebSocket is not open: readyState ${$.readyState} (${E7[$.readyState]})`);process.nextTick(X,Q)}}function X3$($,D){let X=this[kD];if(X._closeFrameReceived=!0,X._closeMessage=D,X._closeCode=$,X._socket[kD]===void 0)return;if(X._socket.removeListener("data",lN),process.nextTick(cq0,X._socket),$===1005)X.close();else X.close($,D)}function Q3$(){let $=this[kD];if(!$.isPaused)$._socket.resume()}function J3$($){let D=this[kD];if(D._socket[kD]!==void 0)D._socket.removeListener("data",lN),process.nextTick(cq0,D._socket),D.close($[iG$]);if(!D._errorEmitted)D._errorEmitted=!0,D.emit("error",$)}function bq0(){this[kD].emitClose()}function Y3$($,D){this[kD].emit("message",$,D)}function Z3$($){let D=this[kD];if(D._autoPong)D.pong($,!this._isServer,gq0);D.emit("ping",$)}function F3$($){this[kD].emit("pong",$)}function cq0($){$.resume()}function G3$($){let D=this[kD];if(D.readyState===M$.CLOSED)return;if(D.readyState===M$.OPEN)D._readyState=M$.CLOSING,lq0(D);if(this._socket.end(),!D._errorEmitted)D._errorEmitted=!0,D.emit("error",$)}function lq0($){$._closeTimer=setTimeout($._socket.destroy.bind($._socket),$._closeTimeout)}function nq0(){let $=this[kD];if(this.removeListener("close",nq0),this.removeListener("data",lN),this.removeListener("end",pq0),$._readyState=M$.CLOSING,!this._readableState.endEmitted&&!$._closeFrameReceived&&!$._receiver._writableState.errorEmitted&&this._readableState.length!==0){let D=this.read(this._readableState.length);$._receiver.write(D)}if($._receiver.end(),this[kD]=void 0,clearTimeout($._closeTimer),$._receiver._writableState.finished||$._receiver._writableState.errorEmitted)$.emitClose();else $._receiver.on("error",bq0),$._receiver.on("finish",bq0)}function lN($){if(!this[kD]._receiver.write($))this.pause()}function pq0(){let $=this[kD];$._readyState=M$.CLOSING,$._receiver.end(),this.end()}function iq0(){let $=this[kD];if(this.removeListener("error",iq0),this.on("error",gq0),$)$._readyState=M$.CLOSING,this.destroy()}});var sq0=E((kD1,aq0)=>{var xD1=nN(),{Duplex:W3$}=Q0("stream");function oq0($){$.emit("close")}function q3$(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function tq0($){if(this.removeListener("error",tq0),this.destroy(),this.listenerCount("error")===0)this.emit("error",$)}function U3$($,D){let X=!0,Q=new W3$({...D,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return $.on("message",function(Y,Z){let F=!Z&&Q._readableState.objectMode?Y.toString():Y;if(!Q.push(F))$.pause()}),$.once("error",function(Y){if(Q.destroyed)return;X=!1,Q.destroy(Y)}),$.once("close",function(){if(Q.destroyed)return;Q.push(null)}),Q._destroy=function(J,Y){if($.readyState===$.CLOSED){Y(J),process.nextTick(oq0,Q);return}let Z=!1;if($.once("error",function(G){Z=!0,Y(G)}),$.once("close",function(){if(!Z)Y(J);process.nextTick(oq0,Q)}),X)$.terminate()},Q._final=function(J){if($.readyState===$.CONNECTING){$.once("open",function(){Q._final(J)});return}if($._socket===null)return;if($._socket._writableState.finished){if(J(),Q._readableState.endEmitted)Q.destroy()}else $._socket.once("finish",function(){J()}),$.close()},Q._read=function(){if($.isPaused)$.resume()},Q._write=function(J,Y,Z){if($.readyState===$.CONNECTING){$.once("open",function(){Q._write(J,Y,Z)});return}$.send(J,Z)},Q.on("end",q3$),Q.on("error",tq0),Q}aq0.exports=U3$});var Vy=E((yD1,eq0)=>{var{tokenChars:H3$}=JF();function K3$($){let D=new Set,X=-1,Q=-1,J=0;for(J;J<$.length;J++){let Z=$.charCodeAt(J);if(Q===-1&&H3$[Z]===1){if(X===-1)X=J}else if(J!==0&&(Z===32||Z===9)){if(Q===-1&&X!==-1)Q=J}else if(Z===44){if(X===-1)throw SyntaxError(`Unexpected character at index ${J}`);if(Q===-1)Q=J;let F=$.slice(X,Q);if(D.has(F))throw SyntaxError(`The "${F}" subprotocol is duplicated`);D.add(F),X=Q=-1}else throw SyntaxError(`Unexpected character at index ${J}`)}if(X===-1||Q!==-1)throw SyntaxError("Unexpected end of input");let Y=$.slice(X,J);if(D.has(Y))throw SyntaxError(`The "${Y}" subprotocol is duplicated`);return D.add(Y),D}eq0.exports={parse:K3$}});var JU0=E((uD1,QU0)=>{var O3$=Q0("events"),pN=Q0("http"),{Duplex:fD1}=Q0("stream"),{createHash:V3$}=Q0("crypto"),$U0=mN(),oQ=QF(),z3$=Vy(),L3$=nN(),{CLOSE_TIMEOUT:M3$,GUID:N3$,kWebSocket:B3$}=w7(),w3$=/^[+/0-9A-Za-z]{22}==$/;class XU0 extends O3${constructor($,D){super();if($={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:M3$,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:L3$,...$},$.port==null&&!$.server&&!$.noServer||$.port!=null&&($.server||$.noServer)||$.server&&$.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if($.port!=null)this._server=pN.createServer((X,Q)=>{let J=pN.STATUS_CODES[426];Q.writeHead(426,{"Content-Length":J.length,"Content-Type":"text/plain"}),Q.end(J)}),this._server.listen($.port,$.host,$.backlog,D);else if($.server)this._server=$.server;if(this._server){let X=this.emit.bind(this,"connection");this._removeListeners=R3$(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(Q,J,Y)=>{this.handleUpgrade(Q,J,Y,X)}})}if($.perMessageDeflate===!0)$.perMessageDeflate={};if($.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=$,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close($){if(this._state===2){if($)this.once("close",()=>{$(Error("The server is not running"))});process.nextTick(MU,this);return}if($)this.once("close",$);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(MU,this);else this._shouldEmitClose=!0;else process.nextTick(MU,this)}else{let D=this._server;this._removeListeners(),this._removeListeners=this._server=null,D.close(()=>{MU(this)})}}shouldHandle($){if(this.options.path){let D=$.url.indexOf("?");if((D!==-1?$.url.slice(0,D):$.url)!==this.options.path)return!1}return!0}handleUpgrade($,D,X,Q){D.on("error",DU0);let J=$.headers["sec-websocket-key"],Y=$.headers.upgrade,Z=+$.headers["sec-websocket-version"];if($.method!=="GET"){tQ(this,$,D,405,"Invalid HTTP method");return}if(Y===void 0||Y.toLowerCase()!=="websocket"){tQ(this,$,D,400,"Invalid Upgrade header");return}if(J===void 0||!w3$.test(J)){tQ(this,$,D,400,"Missing or invalid Sec-WebSocket-Key header");return}if(Z!==13&&Z!==8){tQ(this,$,D,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle($)){NU(D,400);return}let F=$.headers["sec-websocket-protocol"],G=new Set;if(F!==void 0)try{G=z3$.parse(F)}catch(U){tQ(this,$,D,400,"Invalid Sec-WebSocket-Protocol header");return}let W=$.headers["sec-websocket-extensions"],q={};if(this.options.perMessageDeflate&&W!==void 0){let U=new oQ({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let H=$U0.parse(W);if(H[oQ.extensionName])U.accept(H[oQ.extensionName]),q[oQ.extensionName]=U}catch(H){tQ(this,$,D,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let U={origin:$.headers[`${Z===8?"sec-websocket-origin":"origin"}`],secure:!!($.socket.authorized||$.socket.encrypted),req:$};if(this.options.verifyClient.length===2){this.options.verifyClient(U,(H,K,O,V)=>{if(!H)return NU(D,K||401,O,V);this.completeUpgrade(q,J,G,$,D,X,Q)});return}if(!this.options.verifyClient(U))return NU(D,401)}this.completeUpgrade(q,J,G,$,D,X,Q)}completeUpgrade($,D,X,Q,J,Y,Z){if(!J.readable||!J.writable)return J.destroy();if(J[B3$])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return NU(J,503);let G=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${V3$("sha1").update(D+N3$).digest("base64")}`],W=new this.options.WebSocket(null,void 0,this.options);if(X.size){let q=this.options.handleProtocols?this.options.handleProtocols(X,Q):X.values().next().value;if(q)G.push(`Sec-WebSocket-Protocol: ${q}`),W._protocol=q}if($[oQ.extensionName]){let q=$[oQ.extensionName].params,U=$U0.format({[oQ.extensionName]:[q]});G.push(`Sec-WebSocket-Extensions: ${U}`),W._extensions=$}if(this.emit("headers",G,Q),J.write(G.concat(`\r
|
|
408
|
+
)`).eq("name",X).eq("app_id",D).maybeSingle();if(J){let Z=J.code==="PGRST116"||J.message?.includes("Cannot coerce")?`Multiple channels matched for app "${D}" and channel "${X}". Contact support if this persists.`:J.message;throw T0.error(`Error fetching native packages: ${Z}`),Error(`Error fetching native packages: ${Z}`)}if(!Q)return u30([]);return u30(Q.version?.native_packages??[])}function a$($,D){return $||D?.plugins?.CapacitorUpdater?.appId||D?.appId}function m5($){let D=[];if(!$.localVersion)return{compatible:!0,reasons:[],message:"Package only exists on remote (will be removed)"};if(!$.remoteVersion)return D.push("new_plugin"),{compatible:!1,reasons:D,message:"New native plugin added (requires app store update)"};let X=!1;try{let U=TK($.localVersion),H=TK($.remoteVersion);X=mm(U,H)}catch{X=!1}if(!X)D.push("version_mismatch");if($.localRequestedVersion&&$.remoteRequestedVersion&&$.localRequestedVersion.trim()!==$.remoteRequestedVersion.trim())D.push("requested_version_changed");let Q=(U)=>typeof U==="string"&&U.trim().length>0,J=Q($.localIosChecksum)&&Q($.remoteIosChecksum)&&$.localIosChecksum!==$.remoteIosChecksum,Y=Q($.localAndroidChecksum)&&Q($.remoteAndroidChecksum)&&$.localAndroidChecksum!==$.remoteAndroidChecksum;if(J&&Y)D.push("both_platforms_changed");else if(J)D.push("ios_code_changed");else if(Y)D.push("android_code_changed");let Z=Q($.localIosChecksum)!==Q($.remoteIosChecksum),F=Q($.localAndroidChecksum)!==Q($.remoteAndroidChecksum);if(Z||F)D.push("platform_checksum_metadata_changed");let G=[],W=(U)=>U!=="requested_version_changed";for(let U of D)switch(U){case"version_mismatch":G.push(`version changed: ${$.remoteVersion} → ${$.localVersion}`);break;case"requested_version_changed":G.push(`requested version changed: ${$.remoteRequestedVersion??"unknown"} → ${$.localRequestedVersion??"unknown"}`);break;case"ios_code_changed":G.push("iOS native code changed");break;case"android_code_changed":G.push("Android native code changed");break;case"both_platforms_changed":G.push("iOS and Android native code changed");break;case"platform_checksum_metadata_changed":G.push("iOS/Android checksum metadata appeared or disappeared (may be Capgo CLI change — verify native code)");break;case"new_plugin":G.push("new plugin (requires app store update)");break;case"removed_plugin":G.push("plugin removed");break}if(!D.some(W))return{compatible:!0,reasons:D,message:G.length>0?G.join(", "):"Compatible"};return{compatible:!1,reasons:D,message:G.join(", ")}}function p4($){return m5($).compatible}async function jN($,D,X,Q,J){let Y=await lk(Q,J),Z=await UW0($,D,X),F=Y.filter((W)=>!!W.native).map((W)=>{let q=Z.get(W.name);if(q)return{name:W.name,localVersion:W.version,localRequestedVersion:W.requested_version,remoteVersion:q.version,remoteRequestedVersion:q.requested_version,localIosChecksum:W.ios_checksum,remoteIosChecksum:q.ios_checksum,localAndroidChecksum:W.android_checksum,remoteAndroidChecksum:q.android_checksum};return{name:W.name,localVersion:W.version,localRequestedVersion:W.requested_version,remoteVersion:void 0,localIosChecksum:W.ios_checksum,localAndroidChecksum:W.android_checksum}}),G=[...Z].filter(([W])=>!Y.some((q)=>q.name===W)).map(([W,q])=>({name:W,localVersion:void 0,remoteVersion:q.version,remoteRequestedVersion:q.requested_version,remoteIosChecksum:q.ios_checksum,remoteAndroidChecksum:q.android_checksum}));return F.push(...G),{finalCompatibility:F,localDependencies:Y}}async function WU($,D,X,Q){let J=await UW0($,D,X),Y=Q.map((F)=>{let G=J.get(F.name);if(G)return{name:F.name,localVersion:F.version,localRequestedVersion:F.requested_version,remoteVersion:G.version,remoteRequestedVersion:G.requested_version,localIosChecksum:F.ios_checksum,remoteIosChecksum:G.ios_checksum,localAndroidChecksum:F.android_checksum,remoteAndroidChecksum:G.android_checksum};return{name:F.name,localVersion:F.version,localRequestedVersion:F.requested_version,remoteVersion:void 0,localIosChecksum:F.ios_checksum,localAndroidChecksum:F.android_checksum}}),Z=[...J].filter(([F])=>!Q.some((G)=>G.name===F)).map(([F,G])=>({name:F,localVersion:void 0,remoteVersion:G.version,remoteRequestedVersion:G.requested_version,remoteIosChecksum:G.ios_checksum,remoteAndroidChecksum:G.android_checksum}));return Y.push(...Z),{finalCompatibility:Y,localDependencies:Q}}function HW0($){if(!K1($))return null;try{return JSON.parse(qD($,"utf-8"))}catch{return null}}function FN($){if(!$)return!1;return/@capgo\/capacitor-updater|CapgoCapacitorUpdater|CapacitorUpdaterPlugin/.test($)}function uZ$($){let D=HW0($);if(!D)return!1;let X=D.packageClassList;return Array.isArray(X)&&X.includes("CapacitorUpdaterPlugin")}function bZ$($,D){if(!D)return P$($,B4);return oZ.isAbsolute(D)?D:f5($,D)}function hZ$($=N4(),D){let X=bZ$($,D),Q=oZ.basename(X)===B4?pZ(X):X,J=[P$(Q,"ios","App"),P$($,"ios","App")].find((R)=>K1(R));if(!J)return{shouldCheck:!1,valid:!0,details:[]};let Y=HW0(X),Z={...Y?.dependencies,...Y?.devDependencies,...Y?.optionalDependencies},F=Object.hasOwn(Z,"@capgo/capacitor-updater"),G=[Q,$].some((R)=>K1(P$(R,"node_modules","@capgo","capacitor-updater"))),W=P$(J,"Podfile"),q=P$(J,"CapApp-SPM","Package.swift"),U=K1(W)?qD(W,"utf-8"):void 0,H=K1(q)?qD(q,"utf-8"):void 0,K=FN(U)||FN(H),O=P$(J,"Podfile.lock"),V=P$(J,"App","capacitor.plugins.json"),z=P$(J,"App","capacitor.config.json"),N=K1(O)?qD(O,"utf-8"):void 0,w=K1(V)?qD(V,"utf-8"):void 0,L=FN(N)||FN(w)||uZ$(z);if(!(F||G||K||L))return{shouldCheck:!1,valid:!0,details:[]};let B=[];if(!K)B.push(`Missing @capgo/capacitor-updater in iOS dependency files (${W} or ${q})`);if(!L)B.push(`Missing @capgo/capacitor-updater in iOS native project outputs (${O}, ${V}, or ${z})`);return{shouldCheck:!0,valid:K&&L,details:B}}function gZ$($,D,X){if(!$.shouldCheck||$.valid)return;let Q=xZ$(D,"ios");X?.(),T0.error("Capgo iOS dependency sync verification failed.");for(let J of $.details)T0.error(J);throw T0.error("Stop here to avoid testing on a broken native iOS project."),T0.warn(Q.summary),T0.info(Q.command),new G0(zR)}async function KW0($,D,X,Q){let J=await h$({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(r0(J)){if($&&D&&X)await yt("onboarding-v2",D,X,"canceled");throw T0.warn("Canceled Capacitor sync"),new G0("Capacitor sync cancelled")}if(J){let Y=hQ(),Z=m1();Z.start("Running the command...");let F;try{await new Promise((G,W)=>{let q=FZ$(Y.runner,["cap","sync"],{stdio:"pipe"});q.on("close",(U)=>{if(U===0)G();else W(Error(`Command failed with exit code ${U}`))}),q.on("error",(U)=>{W(U)})})}catch(G){F=G,T0.error(`Failed to run Capacitor sync: ${G}`),T0.warn(`Please run "${Y.runner} cap sync" manually to ensure encrypted updates work properly`)}if(Q?.validateIosUpdater)gZ$(hZ$(N4(),Q.packageJsonPath),Y.runner,()=>Z.stop("iOS sync check failed ❌"));if(F){Z.stop("Error");return}Z.stop("Capacitor sync completed ✅")}else{let Y=hQ();T0.warn("⚠️ Important: If you upload encrypted bundles without syncing, updates will fail!"),T0.info(`Remember to run "${Y.runner} cap sync" before uploading encrypted bundles`)}}var hk,gk,l30,qN,T0,tZ=".capgo_key",G6=".capgo_key_v2",UN,e6,_30="https://capgo.app",v30="https://files.capgo.app",GN="https://api.capgo.app",u5="https://console.capgo.app",n30=120000,WZ$=20971520,qZ$=1073741824,UZ$=103809024,XU,QU=1e4,mk="BundleUploadTimeoutError",B4="package.json",x30="Cannot connect to server please try again later",gQ,VN="No capacitor config file found, run `cap init` first",o30,fk=null,ZN=null,LN="5.10.0",MN="6.25.0",ZU="7.0.30",f30=!1,nZ="npm",$U="install",bk="npx";var t0=o(()=>{NR();J$();i8();Pn();G4();eO();DV();vt();ft();QV();MT();mW();$Z();zK();nJ0();sM();J30();v$();VK();MR();$N();hk=x$(BE(),1),gk=x$(EE(),1),l30=x$(lp(),1),qN=x$(aO(),1);T0={error:($)=>YN("error",$),info:($)=>YN("info",$),success:($)=>YN("success",$),warn:($)=>YN("warn",$)},UN=`${tZ}.pub`,e6=`${G6}.pub`;XU=[0,1000,3000,5000,1e4];gQ=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i;o30=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/});function pk($){let D=$?.plugins?.CapgoBuilder;return D!==null&&typeof D==="object"&&Object.hasOwn(D,"capgoBuilderAppId")}function QF$($){let D=$?.plugins?.CapgoBuilder;if(pk($)){let X=D.capgoBuilderAppId;if(typeof X!=="string"||!X.trim())throw new G0("Invalid Capacitor config: plugins.CapgoBuilder.capgoBuilderAppId must be a non-empty string");return X.trim()}return}function nQ($,D,X="updater",Q="truthy"){if(Q==="defined"?$!==void 0:Boolean($))return $;let J=QF$(D);if(J)return J;return X==="native"?D?.appId:a$(void 0,D)}var qU=o(()=>{v$();t0()});function AW0($,D,X={},Q){let J=`${X.supaHost??""}:${$}:${D}`,Y=TN.get(J);if(Y)return Y;let Z=(async()=>{try{if(Q?.aborted)return;if(X.fetchOwnerOrg)return await X.fetchOwnerOrg($,D,Q);if(X.createClient){let q=(await X.createClient($,X.supaHost,X.supaAnon,!0,!1)).from("apps").select("owner_org").eq("app_id",D);if(Q)q=q.abortSignal(Q);let{data:U}=await q.maybeSingle();return U?.owner_org??void 0}let{data:F,error:G}=await K$(`app/${encodeURIComponent(D)}`,{apikey:$,method:"GET",body:void 0,supaHost:X.supaHost,supaAnon:X.supaAnon,signal:Q});if(G||!F?.owner_org)return;return F.owner_org}catch{return}})();return TN.set(J,Z),Z.then((F)=>{if(!F)TN.delete(J)}).catch(()=>{TN.delete(J)}),Z}var TN;var IW0=o(()=>{t0();TN=new Map});import{AsyncLocalStorage as JF$}from"node:async_hooks";import{env as TW0}from"node:process";function YF$(){return l7(TW0.CAPGO_DISABLE_TELEMETRY)||l7(TW0.CAPGO_DISABLE_POSTHOG)}function ZF$($){CW0.add($),$.finally(()=>CW0.delete($))}function FF$($){return $==="build"||$.startsWith("build ")||/^mcp:(?:capgo_builder_|start_capgo_builder_|start_capgo_build$|capgo_build_|cancel_capgo_build$)/u.test($)}function GF$($,D,X=!1){let Q=`${$}\x00${X?"builder":"default"}`,J=SW0.get(Q);if(J)return J;let Y=(async()=>{try{let Z=await L$(!0).catch(()=>{return}),F=(X?nQ(void 0,Z?.config):a$("",Z?.config))||void 0;if(!F)return{};let G=await AW0($,F,{},D);return{appId:F,orgId:G}}catch{return{}}})();return SW0.set(Q,Y),Y}function G$($){if(YF$())return Promise.resolve();let D=$.apikey??g5();if(!D)return Promise.resolve();let X=new AbortController;PW0.add(X);let Q=(async()=>{try{let{appId:J,orgId:Y}=$;if(J===void 0&&Y===void 0){let F=vW0.getStore()??(typeof $.tags?.command_path==="string"?$.tags.command_path:_W0),G=await GF$(D,X.signal,FF$(F));J=G.appId,Y=G.orgId}let Z={...J?{app_id:J}:{},...$.tags??{}};await e0(D,{channel:$.channel,event:$.event,tracking_version:2,...$.timestamp?{timestamp:$.timestamp}:{},...Y?{org_id:Y}:{},tags:Z,...$.nonPersonTags?{nonPersonTags:$.nonPersonTags}:{}},!1,X.signal).catch(()=>{})}catch{}finally{PW0.delete(X)}})();return ZF$(Q),Q}function qF$($){let D=$.durationMs>Ct;if($.ok&&!D)return;let X=vW0.getStore()??_W0,Q={operation:Pt($.url,$.method),method:$.method,status_code:$.status,duration_ms:$.durationMs,ok:$.ok,slow:D};if($.source)Q.source=$.source;if(X)Q.command_path=X;if(!$.ok)Q.error_category=$.error!==void 0?OK($.error):Nm($.status);G$({apikey:$.apikey,channel:WF$,event:"Supabase Call",tags:Q})}var CW0,PW0,SW0,_W0="",vW0,WF$="cli-perf";var YD=o(()=>{z8();zK();t0();qU();IW0();DV();eO();DV();CW0=new Set,PW0=new Set;SW0=new Map;vW0=new JF$;Tt(qF$)});var w7=E((BD1,Zq0)=>{var Jq0=["nodebuffer","arraybuffer","fragments"],Yq0=typeof Blob<"u";if(Yq0)Jq0.push("blob");Zq0.exports={BINARY_TYPES:Jq0,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Yq0,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var KU=E((wD1,kN)=>{var{EMPTY_BUFFER:QG$}=w7(),Xy=Buffer[Symbol.species];function JG$($,D){if($.length===0)return QG$;if($.length===1)return $[0];let X=Buffer.allocUnsafe(D),Q=0;for(let J=0;J<$.length;J++){let Y=$[J];X.set(Y,Q),Q+=Y.length}if(Q<D)return new Xy(X.buffer,X.byteOffset,Q);return X}function Fq0($,D,X,Q,J){for(let Y=0;Y<J;Y++)X[Q+Y]=$[Y]^D[Y&3]}function Gq0($,D){for(let X=0;X<$.length;X++)$[X]^=D[X&3]}function YG$($){if($.length===$.buffer.byteLength)return $.buffer;return $.buffer.slice($.byteOffset,$.byteOffset+$.length)}function Qy($){if(Qy.readOnly=!0,Buffer.isBuffer($))return $;let D;if($ instanceof ArrayBuffer)D=new Xy($);else if(ArrayBuffer.isView($))D=new Xy($.buffer,$.byteOffset,$.byteLength);else D=Buffer.from($),Qy.readOnly=!1;return D}kN.exports={concat:JG$,mask:Fq0,toArrayBuffer:YG$,toBuffer:Qy,unmask:Gq0};if(!process.env.WS_NO_BUFFER_UTIL)try{let $=(()=>{throw new Error("Cannot require module "+"bufferutil");})();kN.exports.mask=function(D,X,Q,J,Y){if(Y<48)Fq0(D,X,Q,J,Y);else $.mask(D,X,Q,J,Y)},kN.exports.unmask=function(D,X){if(D.length<32)Gq0(D,X);else $.unmask(D,X)}}catch($){}});var Hq0=E((RD1,Uq0)=>{var Wq0=Symbol("kDone"),Jy=Symbol("kRun");class qq0{constructor($){this[Wq0]=()=>{this.pending--,this[Jy]()},this.concurrency=$||1/0,this.jobs=[],this.pending=0}add($){this.jobs.push($),this[Jy]()}[Jy](){if(this.pending===this.concurrency)return;if(this.jobs.length){let $=this.jobs.shift();this.pending++,$(this[Wq0])}}}Uq0.exports=qq0});var QF=E((ED1,Lq0)=>{var OU=Q0("zlib"),Kq0=KU(),ZG$=Hq0(),{kStatusCode:Oq0}=w7(),FG$=Buffer[Symbol.species],GG$=Buffer.from([0,0,255,255]),fN=Symbol("permessage-deflate"),R7=Symbol("total-length"),DF=Symbol("callback"),d5=Symbol("buffers"),XF=Symbol("error"),yN;class Vq0{constructor($){if(this._options=$||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yN){let D=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yN=new ZG$(D)}}static get extensionName(){return"permessage-deflate"}offer(){let $={};if(this._options.serverNoContextTakeover)$.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)$.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)$.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)$.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)$.client_max_window_bits=!0;return $}accept($){return $=this.normalizeParams($),this.params=this._isServer?this.acceptAsServer($):this.acceptAsClient($),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let $=this._deflate[DF];if(this._deflate.close(),this._deflate=null,$)$(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer($){let D=this._options,X=$.find((Q)=>{if(D.serverNoContextTakeover===!1&&Q.server_no_context_takeover||Q.server_max_window_bits&&(D.serverMaxWindowBits===!1||typeof D.serverMaxWindowBits==="number"&&D.serverMaxWindowBits>Q.server_max_window_bits)||typeof D.clientMaxWindowBits==="number"&&!Q.client_max_window_bits)return!1;return!0});if(!X)throw Error("None of the extension offers can be accepted");if(D.serverNoContextTakeover)X.server_no_context_takeover=!0;if(D.clientNoContextTakeover)X.client_no_context_takeover=!0;if(typeof D.serverMaxWindowBits==="number")X.server_max_window_bits=D.serverMaxWindowBits;if(typeof D.clientMaxWindowBits==="number")X.client_max_window_bits=D.clientMaxWindowBits;else if(X.client_max_window_bits===!0||D.clientMaxWindowBits===!1)delete X.client_max_window_bits;return X}acceptAsClient($){let D=$[0];if(this._options.clientNoContextTakeover===!1&&D.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!D.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")D.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&D.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return D}normalizeParams($){return $.forEach((D)=>{Object.keys(D).forEach((X)=>{let Q=D[X];if(Q.length>1)throw Error(`Parameter "${X}" must have only a single value`);if(Q=Q[0],X==="client_max_window_bits"){if(Q!==!0){let J=+Q;if(!Number.isInteger(J)||J<8||J>15)throw TypeError(`Invalid value for parameter "${X}": ${Q}`);Q=J}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${X}": ${Q}`)}else if(X==="server_max_window_bits"){let J=+Q;if(!Number.isInteger(J)||J<8||J>15)throw TypeError(`Invalid value for parameter "${X}": ${Q}`);Q=J}else if(X==="client_no_context_takeover"||X==="server_no_context_takeover"){if(Q!==!0)throw TypeError(`Invalid value for parameter "${X}": ${Q}`)}else throw Error(`Unknown parameter "${X}"`);D[X]=Q})}),$}decompress($,D,X){yN.add((Q)=>{this._decompress($,D,(J,Y)=>{Q(),X(J,Y)})})}compress($,D,X){yN.add((Q)=>{this._compress($,D,(J,Y)=>{Q(),X(J,Y)})})}_decompress($,D,X){let Q=this._isServer?"client":"server";if(!this._inflate){let J=`${Q}_max_window_bits`,Y=typeof this.params[J]!=="number"?OU.Z_DEFAULT_WINDOWBITS:this.params[J];this._inflate=OU.createInflateRaw({...this._options.zlibInflateOptions,windowBits:Y}),this._inflate[fN]=this,this._inflate[R7]=0,this._inflate[d5]=[],this._inflate.on("error",qG$),this._inflate.on("data",zq0)}if(this._inflate[DF]=X,this._inflate.write($),D)this._inflate.write(GG$);this._inflate.flush(()=>{let J=this._inflate[XF];if(J){this._inflate.close(),this._inflate=null,X(J);return}let Y=Kq0.concat(this._inflate[d5],this._inflate[R7]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[R7]=0,this._inflate[d5]=[],D&&this.params[`${Q}_no_context_takeover`])this._inflate.reset();X(null,Y)})}_compress($,D,X){let Q=this._isServer?"server":"client";if(!this._deflate){let J=`${Q}_max_window_bits`,Y=typeof this.params[J]!=="number"?OU.Z_DEFAULT_WINDOWBITS:this.params[J];this._deflate=OU.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:Y}),this._deflate[R7]=0,this._deflate[d5]=[],this._deflate.on("data",WG$)}this._deflate[DF]=X,this._deflate.write($),this._deflate.flush(OU.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let J=Kq0.concat(this._deflate[d5],this._deflate[R7]);if(D)J=new FG$(J.buffer,J.byteOffset,J.length-4);if(this._deflate[DF]=null,this._deflate[R7]=0,this._deflate[d5]=[],D&&this.params[`${Q}_no_context_takeover`])this._deflate.reset();X(null,J)})}}Lq0.exports=Vq0;function WG$($){this[d5].push($),this[R7]+=$.length}function zq0($){if(this[R7]+=$.length,this[fN]._maxPayload<1||this[R7]<=this[fN]._maxPayload){this[d5].push($);return}this[XF]=RangeError("Max payload size exceeded"),this[XF].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[XF][Oq0]=1009,this.removeListener("data",zq0),this.reset()}function qG$($){if(this[fN]._inflate=null,this[XF]){this[DF](this[XF]);return}$[Oq0]=1007,this[DF]($)}});var JF=E((jD1,uN)=>{var{isUtf8:Mq0}=Q0("buffer"),{hasBlob:UG$}=w7(),HG$=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function KG$($){return $>=1000&&$<=1014&&$!==1004&&$!==1005&&$!==1006||$>=3000&&$<=4999}function Yy($){let D=$.length,X=0;while(X<D)if(($[X]&128)===0)X++;else if(($[X]&224)===192){if(X+1===D||($[X+1]&192)!==128||($[X]&254)===192)return!1;X+=2}else if(($[X]&240)===224){if(X+2>=D||($[X+1]&192)!==128||($[X+2]&192)!==128||$[X]===224&&($[X+1]&224)===128||$[X]===237&&($[X+1]&224)===160)return!1;X+=3}else if(($[X]&248)===240){if(X+3>=D||($[X+1]&192)!==128||($[X+2]&192)!==128||($[X+3]&192)!==128||$[X]===240&&($[X+1]&240)===128||$[X]===244&&$[X+1]>143||$[X]>244)return!1;X+=4}else return!1;return!0}function OG$($){return UG$&&typeof $==="object"&&typeof $.arrayBuffer==="function"&&typeof $.type==="string"&&typeof $.stream==="function"&&($[Symbol.toStringTag]==="Blob"||$[Symbol.toStringTag]==="File")}uN.exports={isBlob:OG$,isValidStatusCode:KG$,isValidUTF8:Yy,tokenChars:HG$};if(Mq0)uN.exports.isValidUTF8=function($){return $.length<24?Yy($):Mq0($)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let $=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();uN.exports.isValidUTF8=function(D){return D.length<32?Yy(D):$(D)}}catch($){}});var Fy=E((AD1,Eq0)=>{var{Writable:VG$}=Q0("stream"),Nq0=QF(),{BINARY_TYPES:zG$,EMPTY_BUFFER:Bq0,kStatusCode:LG$,kWebSocket:MG$}=w7(),{concat:Zy,toArrayBuffer:NG$,unmask:BG$}=KU(),{isValidStatusCode:wG$,isValidUTF8:wq0}=JF(),bN=Buffer[Symbol.species];class Rq0 extends VG${constructor($={}){super();this._allowSynchronousEvents=$.allowSynchronousEvents!==void 0?$.allowSynchronousEvents:!0,this._binaryType=$.binaryType||zG$[0],this._extensions=$.extensions||{},this._isServer=!!$.isServer,this._maxBufferedChunks=$.maxBufferedChunks|0,this._maxFragments=$.maxFragments|0,this._maxPayload=$.maxPayload|0,this._skipUTF8Validation=!!$.skipUTF8Validation,this[MG$]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write($,D,X){if(this._opcode===8&&this._state==0)return X();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){X(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=$.length,this._buffers.push($),this.startLoop(X)}consume($){if(this._bufferedBytes-=$,$===this._buffers[0].length)return this._buffers.shift();if($<this._buffers[0].length){let X=this._buffers[0];return this._buffers[0]=new bN(X.buffer,X.byteOffset+$,X.length-$),new bN(X.buffer,X.byteOffset,$)}let D=Buffer.allocUnsafe($);do{let X=this._buffers[0],Q=D.length-$;if($>=X.length)D.set(this._buffers.shift(),Q);else D.set(new Uint8Array(X.buffer,X.byteOffset,$),Q),this._buffers[0]=new bN(X.buffer,X.byteOffset+$,X.length-$);$-=X.length}while($>0);return D}startLoop($){this._loop=!0;do switch(this._state){case 0:this.getInfo($);break;case 1:this.getPayloadLength16($);break;case 2:this.getPayloadLength64($);break;case 3:this.getMask();break;case 4:this.getData($);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)$()}getInfo($){if(this._bufferedBytes<2){this._loop=!1;return}let D=this.consume(2);if((D[0]&48)!==0){let Q=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");$(Q);return}let X=(D[0]&64)===64;if(X&&!this._extensions[Nq0.extensionName]){let Q=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(Q);return}if(this._fin=(D[0]&128)===128,this._opcode=D[0]&15,this._payloadLength=D[1]&127,this._opcode===0){if(X){let Q=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(Q);return}if(!this._fragmented){let Q=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");$(Q);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let Q=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");$(Q);return}this._compressed=X}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let Q=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");$(Q);return}if(X){let Q=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(Q);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let Q=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");$(Q);return}}else{let Q=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");$(Q);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(D[1]&128)===128,this._isServer){if(!this._masked){let Q=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");$(Q);return}}else if(this._masked){let Q=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");$(Q);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength($)}getPayloadLength16($){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength($)}getPayloadLength64($){if(this._bufferedBytes<8){this._loop=!1;return}let D=this.consume(8),X=D.readUInt32BE(0);if(X>Math.pow(2,21)-1){let Q=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");$(Q);return}this._payloadLength=X*Math.pow(2,32)+D.readUInt32BE(4),this.haveLength($)}haveLength($){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let D=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");$(D);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData($){let D=Bq0;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(D=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)BG$(D,this._mask)}if(this._opcode>7){this.controlMessage(D,$);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let X=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");$(X);return}if(this._compressed){this._state=5,this.decompress(D,$);return}if(D.length)this._messageLength=this._totalPayloadLength,this._fragments.push(D);this.dataMessage($)}decompress($,D){this._extensions[Nq0.extensionName].decompress($,this._fin,(Q,J)=>{if(Q)return D(Q);if(J.length){if(this._messageLength+=J.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let Y=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");D(Y);return}this._fragments.push(J)}if(this.dataMessage(D),this._state===0)this.startLoop(D)})}dataMessage($){if(!this._fin){this._state=0;return}let D=this._messageLength,X=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let Q;if(this._binaryType==="nodebuffer")Q=Zy(X,D);else if(this._binaryType==="arraybuffer")Q=NG$(Zy(X,D));else if(this._binaryType==="blob")Q=new Blob(X);else Q=X;if(this._allowSynchronousEvents)this.emit("message",Q,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",Q,!0),this._state=0,this.startLoop($)})}else{let Q=Zy(X,D);if(!this._skipUTF8Validation&&!wq0(Q)){let J=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");$(J);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",Q,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",Q,!1),this._state=0,this.startLoop($)})}}controlMessage($,D){if(this._opcode===8){if($.length===0)this._loop=!1,this.emit("conclude",1005,Bq0),this.end();else{let X=$.readUInt16BE(0);if(!wG$(X)){let J=this.createError(RangeError,`invalid status code ${X}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");D(J);return}let Q=new bN($.buffer,$.byteOffset+2,$.length-2);if(!this._skipUTF8Validation&&!wq0(Q)){let J=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");D(J);return}this._loop=!1,this.emit("conclude",X,Q),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",$),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",$),this._state=0,this.startLoop(D)})}createError($,D,X,Q,J){this._loop=!1,this._errored=!0;let Y=new $(X?`Invalid WebSocket frame: ${D}`:D);return Error.captureStackTrace(Y,this.createError),Y.code=J,Y[LG$]=Q,Y}}Eq0.exports=Rq0});var Wy=E((TD1,Iq0)=>{var{Duplex:ID1}=Q0("stream"),{randomFillSync:RG$}=Q0("crypto"),{types:{isUint8Array:EG$}}=Q0("util"),jq0=QF(),{EMPTY_BUFFER:jG$,kWebSocket:AG$,NOOP:IG$}=w7(),{isBlob:YF,isValidStatusCode:TG$}=JF(),{mask:Aq0,toBuffer:iQ}=KU(),i4=Symbol("kByteLength"),CG$=Buffer.alloc(4),rQ,ZF=8192,v8=0,PG$=1,SG$=2;class c5{constructor($,D,X){if(this._extensions=D||{},X)this._generateMask=X,this._maskBuffer=Buffer.alloc(4);this._socket=$,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=v8,this.onerror=IG$,this[AG$]=void 0}static frame($,D){let X,Q=!1,J=2,Y=!1;if(D.mask){if(X=D.maskBuffer||CG$,D.generateMask)D.generateMask(X);else{if(ZF===8192){if(rQ===void 0)rQ=Buffer.alloc(8192);RG$(rQ,0,8192),ZF=0}X[0]=rQ[ZF++],X[1]=rQ[ZF++],X[2]=rQ[ZF++],X[3]=rQ[ZF++]}Y=(X[0]|X[1]|X[2]|X[3])===0,J=6}let Z;if(typeof $==="string")if((!D.mask||Y)&&D[i4]!==void 0)Z=D[i4];else $=Buffer.from($),Z=$.length;else Z=$.length,Q=D.mask&&D.readOnly&&!Y;let F=Z;if(Z>=65536)J+=8,F=127;else if(Z>125)J+=2,F=126;let G=Buffer.allocUnsafe(Q?Z+J:J);if(G[0]=D.fin?D.opcode|128:D.opcode,D.rsv1)G[0]|=64;if(G[1]=F,F===126)G.writeUInt16BE(Z,2);else if(F===127)G[2]=G[3]=0,G.writeUIntBE(Z,4,6);if(!D.mask)return[G,$];if(G[1]|=128,G[J-4]=X[0],G[J-3]=X[1],G[J-2]=X[2],G[J-1]=X[3],Y)return[G,$];if(Q)return Aq0($,X,G,J,Z),[G];return Aq0($,X,$,0,Z),[G,$]}close($,D,X,Q){let J;if($===void 0)J=jG$;else if(typeof $!=="number"||!TG$($))throw TypeError("First argument must be a valid error code number");else if(D===void 0||!D.length)J=Buffer.allocUnsafe(2),J.writeUInt16BE($,0);else{let Z=Buffer.byteLength(D);if(Z>123)throw RangeError("The message must not be greater than 123 bytes");if(J=Buffer.allocUnsafe(2+Z),J.writeUInt16BE($,0),typeof D==="string")J.write(D,2);else if(EG$(D))J.set(D,2);else throw TypeError("Second argument must be a string or a Uint8Array")}let Y={[i4]:J.length,fin:!0,generateMask:this._generateMask,mask:X,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==v8)this.enqueue([this.dispatch,J,!1,Y,Q]);else this.sendFrame(c5.frame(J,Y),Q)}ping($,D,X){let Q,J;if(typeof $==="string")Q=Buffer.byteLength($),J=!1;else if(YF($))Q=$.size,J=!1;else $=iQ($),Q=$.length,J=iQ.readOnly;if(Q>125)throw RangeError("The data size must not be greater than 125 bytes");let Y={[i4]:Q,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:9,readOnly:J,rsv1:!1};if(YF($))if(this._state!==v8)this.enqueue([this.getBlobData,$,!1,Y,X]);else this.getBlobData($,!1,Y,X);else if(this._state!==v8)this.enqueue([this.dispatch,$,!1,Y,X]);else this.sendFrame(c5.frame($,Y),X)}pong($,D,X){let Q,J;if(typeof $==="string")Q=Buffer.byteLength($),J=!1;else if(YF($))Q=$.size,J=!1;else $=iQ($),Q=$.length,J=iQ.readOnly;if(Q>125)throw RangeError("The data size must not be greater than 125 bytes");let Y={[i4]:Q,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:10,readOnly:J,rsv1:!1};if(YF($))if(this._state!==v8)this.enqueue([this.getBlobData,$,!1,Y,X]);else this.getBlobData($,!1,Y,X);else if(this._state!==v8)this.enqueue([this.dispatch,$,!1,Y,X]);else this.sendFrame(c5.frame($,Y),X)}send($,D,X){let Q=this._extensions[jq0.extensionName],J=D.binary?2:1,Y=D.compress,Z,F;if(typeof $==="string")Z=Buffer.byteLength($),F=!1;else if(YF($))Z=$.size,F=!1;else $=iQ($),Z=$.length,F=iQ.readOnly;if(this._firstFragment){if(this._firstFragment=!1,Y&&Q&&Q.params[Q._isServer?"server_no_context_takeover":"client_no_context_takeover"])Y=Z>=Q._threshold;this._compress=Y}else Y=!1,J=0;if(D.fin)this._firstFragment=!0;let G={[i4]:Z,fin:D.fin,generateMask:this._generateMask,mask:D.mask,maskBuffer:this._maskBuffer,opcode:J,readOnly:F,rsv1:Y};if(YF($))if(this._state!==v8)this.enqueue([this.getBlobData,$,this._compress,G,X]);else this.getBlobData($,this._compress,G,X);else if(this._state!==v8)this.enqueue([this.dispatch,$,this._compress,G,X]);else this.dispatch($,this._compress,G,X)}getBlobData($,D,X,Q){this._bufferedBytes+=X[i4],this._state=SG$,$.arrayBuffer().then((J)=>{if(this._socket.destroyed){let Z=Error("The socket was closed while the blob was being read");process.nextTick(Gy,this,Z,Q);return}this._bufferedBytes-=X[i4];let Y=iQ(J);if(!D)this._state=v8,this.sendFrame(c5.frame(Y,X),Q),this.dequeue();else this.dispatch(Y,D,X,Q)}).catch((J)=>{process.nextTick(_G$,this,J,Q)})}dispatch($,D,X,Q){if(!D){this.sendFrame(c5.frame($,X),Q);return}let J=this._extensions[jq0.extensionName];this._bufferedBytes+=X[i4],this._state=PG$,J.compress($,X.fin,(Y,Z)=>{if(this._socket.destroyed){let F=Error("The socket was closed while data was being compressed");Gy(this,F,Q);return}this._bufferedBytes-=X[i4],this._state=v8,X.readOnly=!1,this.sendFrame(c5.frame(Z,X),Q),this.dequeue()})}dequeue(){while(this._state===v8&&this._queue.length){let $=this._queue.shift();this._bufferedBytes-=$[3][i4],Reflect.apply($[0],this,$.slice(1))}}enqueue($){this._bufferedBytes+=$[3][i4],this._queue.push($)}sendFrame($,D){if($.length===2)this._socket.cork(),this._socket.write($[0]),this._socket.write($[1],D),this._socket.uncork();else this._socket.write($[0],D)}}Iq0.exports=c5;function Gy($,D,X){if(typeof X==="function")X(D);for(let Q=0;Q<$._queue.length;Q++){let J=$._queue[Q],Y=J[J.length-1];if(typeof Y==="function")Y(D)}}function _G$($,D,X){Gy($,D,X),$.onerror(D)}});var yq0=E((CD1,kq0)=>{var{kForOnEventAttribute:VU,kListener:qy}=w7(),Tq0=Symbol("kCode"),Cq0=Symbol("kData"),Pq0=Symbol("kError"),Sq0=Symbol("kMessage"),_q0=Symbol("kReason"),FF=Symbol("kTarget"),vq0=Symbol("kType"),xq0=Symbol("kWasClean");class l5{constructor($){this[FF]=null,this[vq0]=$}get target(){return this[FF]}get type(){return this[vq0]}}Object.defineProperty(l5.prototype,"target",{enumerable:!0});Object.defineProperty(l5.prototype,"type",{enumerable:!0});class GF extends l5{constructor($,D={}){super($);this[Tq0]=D.code===void 0?0:D.code,this[_q0]=D.reason===void 0?"":D.reason,this[xq0]=D.wasClean===void 0?!1:D.wasClean}get code(){return this[Tq0]}get reason(){return this[_q0]}get wasClean(){return this[xq0]}}Object.defineProperty(GF.prototype,"code",{enumerable:!0});Object.defineProperty(GF.prototype,"reason",{enumerable:!0});Object.defineProperty(GF.prototype,"wasClean",{enumerable:!0});class zU extends l5{constructor($,D={}){super($);this[Pq0]=D.error===void 0?null:D.error,this[Sq0]=D.message===void 0?"":D.message}get error(){return this[Pq0]}get message(){return this[Sq0]}}Object.defineProperty(zU.prototype,"error",{enumerable:!0});Object.defineProperty(zU.prototype,"message",{enumerable:!0});class gN extends l5{constructor($,D={}){super($);this[Cq0]=D.data===void 0?null:D.data}get data(){return this[Cq0]}}Object.defineProperty(gN.prototype,"data",{enumerable:!0});var vG$={addEventListener($,D,X={}){for(let J of this.listeners($))if(!X[VU]&&J[qy]===D&&!J[VU])return;let Q;if($==="message")Q=function(Y,Z){let F=new gN("message",{data:Z?Y:Y.toString()});F[FF]=this,hN(D,this,F)};else if($==="close")Q=function(Y,Z){let F=new GF("close",{code:Y,reason:Z.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});F[FF]=this,hN(D,this,F)};else if($==="error")Q=function(Y){let Z=new zU("error",{error:Y,message:Y.message});Z[FF]=this,hN(D,this,Z)};else if($==="open")Q=function(){let Y=new l5("open");Y[FF]=this,hN(D,this,Y)};else return;if(Q[VU]=!!X[VU],Q[qy]=D,X.once)this.once($,Q);else this.on($,Q)},removeEventListener($,D){for(let X of this.listeners($))if(X[qy]===D&&!X[VU]){this.removeListener($,X);break}}};kq0.exports={CloseEvent:GF,ErrorEvent:zU,Event:l5,EventTarget:vG$,MessageEvent:gN};function hN($,D,X){if(typeof $==="object"&&$.handleEvent)$.handleEvent.call($,X);else $.call(D,X)}});var mN=E((PD1,fq0)=>{var{tokenChars:LU}=JF();function B9($,D,X){if($[D]===void 0)$[D]=[X];else $[D].push(X)}function xG$($){let D=Object.create(null),X=Object.create(null),Q=!1,J=!1,Y=!1,Z,F,G=-1,W=-1,q=-1,U=0;for(;U<$.length;U++)if(W=$.charCodeAt(U),Z===void 0)if(q===-1&&LU[W]===1){if(G===-1)G=U}else if(U!==0&&(W===32||W===9)){if(q===-1&&G!==-1)q=U}else if(W===59||W===44){if(G===-1)throw SyntaxError(`Unexpected character at index ${U}`);if(q===-1)q=U;let K=$.slice(G,q);if(W===44)B9(D,K,X),X=Object.create(null);else Z=K;G=q=-1}else throw SyntaxError(`Unexpected character at index ${U}`);else if(F===void 0)if(q===-1&&LU[W]===1){if(G===-1)G=U}else if(W===32||W===9){if(q===-1&&G!==-1)q=U}else if(W===59||W===44){if(G===-1)throw SyntaxError(`Unexpected character at index ${U}`);if(q===-1)q=U;if(B9(X,$.slice(G,q),!0),W===44)B9(D,Z,X),X=Object.create(null),Z=void 0;G=q=-1}else if(W===61&&G!==-1&&q===-1)F=$.slice(G,U),G=q=-1;else throw SyntaxError(`Unexpected character at index ${U}`);else if(J){if(LU[W]!==1)throw SyntaxError(`Unexpected character at index ${U}`);if(G===-1)G=U;else if(!Q)Q=!0;J=!1}else if(Y)if(LU[W]===1){if(G===-1)G=U}else if(W===34&&G!==-1)Y=!1,q=U;else if(W===92)J=!0;else throw SyntaxError(`Unexpected character at index ${U}`);else if(W===34&&$.charCodeAt(U-1)===61)Y=!0;else if(q===-1&&LU[W]===1){if(G===-1)G=U}else if(G!==-1&&(W===32||W===9)){if(q===-1)q=U}else if(W===59||W===44){if(G===-1)throw SyntaxError(`Unexpected character at index ${U}`);if(q===-1)q=U;let K=$.slice(G,q);if(Q)K=K.replace(/\\/g,""),Q=!1;if(B9(X,F,K),W===44)B9(D,Z,X),X=Object.create(null),Z=void 0;F=void 0,G=q=-1}else throw SyntaxError(`Unexpected character at index ${U}`);if(G===-1||Y||W===32||W===9)throw SyntaxError("Unexpected end of input");if(q===-1)q=U;let H=$.slice(G,q);if(Z===void 0)B9(D,H,X);else{if(F===void 0)B9(X,H,!0);else if(Q)B9(X,F,H.replace(/\\/g,""));else B9(X,F,H);B9(D,Z,X)}return D}function kG$($){return Object.keys($).map((D)=>{let X=$[D];if(!Array.isArray(X))X=[X];return X.map((Q)=>{return[D].concat(Object.keys(Q).map((J)=>{let Y=Q[J];if(!Array.isArray(Y))Y=[Y];return Y.map((Z)=>Z===!0?J:`${J}=${Z}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}fq0.exports={format:kG$,parse:xG$}});var nN=E((vD1,rq0)=>{var yG$=Q0("events"),fG$=Q0("https"),uG$=Q0("http"),hq0=Q0("net"),bG$=Q0("tls"),{randomBytes:hG$,createHash:gG$}=Q0("crypto"),{Duplex:SD1,Readable:_D1}=Q0("stream"),{URL:Uy}=Q0("url"),n5=QF(),mG$=Fy(),dG$=Wy(),{isBlob:cG$}=JF(),{BINARY_TYPES:uq0,CLOSE_TIMEOUT:lG$,EMPTY_BUFFER:dN,GUID:nG$,kForOnEventAttribute:Hy,kListener:pG$,kStatusCode:iG$,kWebSocket:kD,NOOP:gq0}=w7(),{EventTarget:{addEventListener:rG$,removeEventListener:oG$}}=yq0(),{format:tG$,parse:aG$}=mN(),{toBuffer:sG$}=KU(),mq0=Symbol("kAborted"),Ky=[8,13],E7=["CONNECTING","OPEN","CLOSING","CLOSED"],eG$=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class M$ extends yG${constructor($,D,X){super();if(this._binaryType=uq0[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=dN,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=M$.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,$!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,D===void 0)D=[];else if(!Array.isArray(D))if(typeof D==="object"&&D!==null)X=D,D=[];else D=[D];dq0(this,$,D,X)}else this._autoPong=X.autoPong,this._closeTimeout=X.closeTimeout,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType($){if(!uq0.includes($))return;if(this._binaryType=$,this._receiver)this._receiver._binaryType=$}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket($,D,X){let Q=new mG$({allowSynchronousEvents:X.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:X.maxBufferedChunks,maxFragments:X.maxFragments,maxPayload:X.maxPayload,skipUTF8Validation:X.skipUTF8Validation}),J=new dG$($,this._extensions,X.generateMask);if(this._receiver=Q,this._sender=J,this._socket=$,Q[kD]=this,J[kD]=this,$[kD]=this,Q.on("conclude",X3$),Q.on("drain",Q3$),Q.on("error",J3$),Q.on("message",Y3$),Q.on("ping",Z3$),Q.on("pong",F3$),J.onerror=G3$,$.setTimeout)$.setTimeout(0);if($.setNoDelay)$.setNoDelay();if(D.length>0)$.unshift(D);$.on("close",nq0),$.on("data",lN),$.on("end",pq0),$.on("error",iq0),this._readyState=M$.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=M$.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[n5.extensionName])this._extensions[n5.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=M$.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close($,D){if(this.readyState===M$.CLOSED)return;if(this.readyState===M$.CONNECTING){R4(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===M$.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=M$.CLOSING,this._sender.close($,D,!this._isServer,(X)=>{if(X)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),lq0(this)}pause(){if(this.readyState===M$.CONNECTING||this.readyState===M$.CLOSED)return;this._paused=!0,this._socket.pause()}ping($,D,X){if(this.readyState===M$.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof $==="function")X=$,$=D=void 0;else if(typeof D==="function")X=D,D=void 0;if(typeof $==="number")$=$.toString();if(this.readyState!==M$.OPEN){Oy(this,$,X);return}if(D===void 0)D=!this._isServer;this._sender.ping($||dN,D,X)}pong($,D,X){if(this.readyState===M$.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof $==="function")X=$,$=D=void 0;else if(typeof D==="function")X=D,D=void 0;if(typeof $==="number")$=$.toString();if(this.readyState!==M$.OPEN){Oy(this,$,X);return}if(D===void 0)D=!this._isServer;this._sender.pong($||dN,D,X)}resume(){if(this.readyState===M$.CONNECTING||this.readyState===M$.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send($,D,X){if(this.readyState===M$.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof D==="function")X=D,D={};if(typeof $==="number")$=$.toString();if(this.readyState!==M$.OPEN){Oy(this,$,X);return}let Q={binary:typeof $!=="string",mask:!this._isServer,compress:!0,fin:!0,...D};if(!this._extensions[n5.extensionName])Q.compress=!1;this._sender.send($||dN,Q,X)}terminate(){if(this.readyState===M$.CLOSED)return;if(this.readyState===M$.CONNECTING){R4(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=M$.CLOSING,this._socket.destroy()}}Object.defineProperty(M$,"CONNECTING",{enumerable:!0,value:E7.indexOf("CONNECTING")});Object.defineProperty(M$.prototype,"CONNECTING",{enumerable:!0,value:E7.indexOf("CONNECTING")});Object.defineProperty(M$,"OPEN",{enumerable:!0,value:E7.indexOf("OPEN")});Object.defineProperty(M$.prototype,"OPEN",{enumerable:!0,value:E7.indexOf("OPEN")});Object.defineProperty(M$,"CLOSING",{enumerable:!0,value:E7.indexOf("CLOSING")});Object.defineProperty(M$.prototype,"CLOSING",{enumerable:!0,value:E7.indexOf("CLOSING")});Object.defineProperty(M$,"CLOSED",{enumerable:!0,value:E7.indexOf("CLOSED")});Object.defineProperty(M$.prototype,"CLOSED",{enumerable:!0,value:E7.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(($)=>{Object.defineProperty(M$.prototype,$,{enumerable:!0})});["open","error","close","message"].forEach(($)=>{Object.defineProperty(M$.prototype,`on${$}`,{enumerable:!0,get(){for(let D of this.listeners($))if(D[Hy])return D[pG$];return null},set(D){for(let X of this.listeners($))if(X[Hy]){this.removeListener($,X);break}if(typeof D!=="function")return;this.addEventListener($,D,{[Hy]:!0})}})});M$.prototype.addEventListener=rG$;M$.prototype.removeEventListener=oG$;rq0.exports=M$;function dq0($,D,X,Q){let J={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:lG$,protocolVersion:Ky[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...Q,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if($._autoPong=J.autoPong,$._closeTimeout=J.closeTimeout,!Ky.includes(J.protocolVersion))throw RangeError(`Unsupported protocol version: ${J.protocolVersion} (supported versions: ${Ky.join(", ")})`);let Y;if(D instanceof Uy)Y=D;else try{Y=new Uy(D)}catch{throw SyntaxError(`Invalid URL: ${D}`)}if(Y.protocol==="http:")Y.protocol="ws:";else if(Y.protocol==="https:")Y.protocol="wss:";$._url=Y.href;let Z=Y.protocol==="wss:",F=Y.protocol==="ws+unix:",G;if(Y.protocol!=="ws:"&&!Z&&!F)G=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(F&&!Y.pathname)G="The URL's pathname is empty";else if(Y.hash)G="The URL contains a fragment identifier";if(G){let V=SyntaxError(G);if($._redirects===0)throw V;else{cN($,V);return}}let W=Z?443:80,q=hG$(16).toString("base64"),U=Z?fG$.request:uG$.request,H=new Set,K;if(J.createConnection=J.createConnection||(Z?D3$:$3$),J.defaultPort=J.defaultPort||W,J.port=Y.port||W,J.host=Y.hostname.startsWith("[")?Y.hostname.slice(1,-1):Y.hostname,J.headers={...J.headers,"Sec-WebSocket-Version":J.protocolVersion,"Sec-WebSocket-Key":q,Connection:"Upgrade",Upgrade:"websocket"},J.path=Y.pathname+Y.search,J.timeout=J.handshakeTimeout,J.perMessageDeflate)K=new n5({...J.perMessageDeflate,isServer:!1,maxPayload:J.maxPayload}),J.headers["Sec-WebSocket-Extensions"]=tG$({[n5.extensionName]:K.offer()});if(X.length){for(let V of X){if(typeof V!=="string"||!eG$.test(V)||H.has(V))throw SyntaxError("An invalid or duplicated subprotocol was specified");H.add(V)}J.headers["Sec-WebSocket-Protocol"]=X.join(",")}if(J.origin)if(J.protocolVersion<13)J.headers["Sec-WebSocket-Origin"]=J.origin;else J.headers.Origin=J.origin;if(Y.username||Y.password)J.auth=`${Y.username}:${Y.password}`;if(F){let V=J.path.split(":");J.socketPath=V[0],J.path=V[1]}let O;if(J.followRedirects){if($._redirects===0){$._originalIpc=F,$._originalSecure=Z,$._originalHostOrSocketPath=F?J.socketPath:Y.host;let V=Q&&Q.headers;if(Q={...Q,headers:{}},V)for(let[z,N]of Object.entries(V))Q.headers[z.toLowerCase()]=N}else if($.listenerCount("redirect")===0){let V=F?$._originalIpc?J.socketPath===$._originalHostOrSocketPath:!1:$._originalIpc?!1:Y.host===$._originalHostOrSocketPath;if(!V||$._originalSecure&&!Z){if(delete J.headers.authorization,delete J.headers.cookie,!V)delete J.headers.host;J.auth=void 0}}if(J.auth&&!Q.headers.authorization)Q.headers.authorization="Basic "+Buffer.from(J.auth).toString("base64");if(O=$._req=U(J),$._redirects)$.emit("redirect",$.url,O)}else O=$._req=U(J);if(J.timeout)O.on("timeout",()=>{R4($,O,"Opening handshake has timed out")});if(O.on("error",(V)=>{if(O===null||O[mq0])return;O=$._req=null,cN($,V)}),O.on("response",(V)=>{let z=V.headers.location,N=V.statusCode;if(z&&J.followRedirects&&N>=300&&N<400){if(++$._redirects>J.maxRedirects){R4($,O,"Maximum redirects exceeded");return}O.abort();let w;try{w=new Uy(z,D)}catch(L){let M=SyntaxError(`Invalid URL: ${z}`);cN($,M);return}dq0($,w,X,Q)}else if(!$.emit("unexpected-response",O,V))R4($,O,`Unexpected server response: ${V.statusCode}`)}),O.on("upgrade",(V,z,N)=>{if($.emit("upgrade",V),$.readyState!==M$.CONNECTING)return;O=$._req=null;let w=V.headers.upgrade;if(w===void 0||w.toLowerCase()!=="websocket"){R4($,z,"Invalid Upgrade header");return}let L=gG$("sha1").update(q+nG$).digest("base64");if(V.headers["sec-websocket-accept"]!==L){R4($,z,"Invalid Sec-WebSocket-Accept header");return}let M=V.headers["sec-websocket-protocol"],B;if(M!==void 0){if(!H.size)B="Server sent a subprotocol but none was requested";else if(!H.has(M))B="Server sent an invalid subprotocol"}else if(H.size)B="Server sent no subprotocol";if(B){R4($,z,B);return}if(M)$._protocol=M;let R=V.headers["sec-websocket-extensions"];if(R!==void 0){if(!K){R4($,z,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let P;try{P=aG$(R)}catch(j){R4($,z,"Invalid Sec-WebSocket-Extensions header");return}let v=Object.keys(P);if(v.length!==1||v[0]!==n5.extensionName){R4($,z,"Server indicated an extension that was not requested");return}try{K.accept(P[n5.extensionName])}catch(j){R4($,z,"Invalid Sec-WebSocket-Extensions header");return}$._extensions[n5.extensionName]=K}$.setSocket(z,N,{allowSynchronousEvents:J.allowSynchronousEvents,generateMask:J.generateMask,maxBufferedChunks:J.maxBufferedChunks,maxFragments:J.maxFragments,maxPayload:J.maxPayload,skipUTF8Validation:J.skipUTF8Validation})}),J.finishRequest)J.finishRequest(O,$);else O.end()}function cN($,D){$._readyState=M$.CLOSING,$._errorEmitted=!0,$.emit("error",D),$.emitClose()}function $3$($){return $.path=$.socketPath,hq0.connect($)}function D3$($){if($.path=void 0,!$.servername&&$.servername!=="")$.servername=hq0.isIP($.host)?"":$.host;return bG$.connect($)}function R4($,D,X){$._readyState=M$.CLOSING;let Q=Error(X);if(Error.captureStackTrace(Q,R4),D.setHeader){if(D[mq0]=!0,D.abort(),D.socket&&!D.socket.destroyed)D.socket.destroy();process.nextTick(cN,$,Q)}else D.destroy(Q),D.once("error",$.emit.bind($,"error")),D.once("close",$.emitClose.bind($))}function Oy($,D,X){if(D){let Q=cG$(D)?D.size:sG$(D).length;if($._socket)$._sender._bufferedBytes+=Q;else $._bufferedAmount+=Q}if(X){let Q=Error(`WebSocket is not open: readyState ${$.readyState} (${E7[$.readyState]})`);process.nextTick(X,Q)}}function X3$($,D){let X=this[kD];if(X._closeFrameReceived=!0,X._closeMessage=D,X._closeCode=$,X._socket[kD]===void 0)return;if(X._socket.removeListener("data",lN),process.nextTick(cq0,X._socket),$===1005)X.close();else X.close($,D)}function Q3$(){let $=this[kD];if(!$.isPaused)$._socket.resume()}function J3$($){let D=this[kD];if(D._socket[kD]!==void 0)D._socket.removeListener("data",lN),process.nextTick(cq0,D._socket),D.close($[iG$]);if(!D._errorEmitted)D._errorEmitted=!0,D.emit("error",$)}function bq0(){this[kD].emitClose()}function Y3$($,D){this[kD].emit("message",$,D)}function Z3$($){let D=this[kD];if(D._autoPong)D.pong($,!this._isServer,gq0);D.emit("ping",$)}function F3$($){this[kD].emit("pong",$)}function cq0($){$.resume()}function G3$($){let D=this[kD];if(D.readyState===M$.CLOSED)return;if(D.readyState===M$.OPEN)D._readyState=M$.CLOSING,lq0(D);if(this._socket.end(),!D._errorEmitted)D._errorEmitted=!0,D.emit("error",$)}function lq0($){$._closeTimer=setTimeout($._socket.destroy.bind($._socket),$._closeTimeout)}function nq0(){let $=this[kD];if(this.removeListener("close",nq0),this.removeListener("data",lN),this.removeListener("end",pq0),$._readyState=M$.CLOSING,!this._readableState.endEmitted&&!$._closeFrameReceived&&!$._receiver._writableState.errorEmitted&&this._readableState.length!==0){let D=this.read(this._readableState.length);$._receiver.write(D)}if($._receiver.end(),this[kD]=void 0,clearTimeout($._closeTimer),$._receiver._writableState.finished||$._receiver._writableState.errorEmitted)$.emitClose();else $._receiver.on("error",bq0),$._receiver.on("finish",bq0)}function lN($){if(!this[kD]._receiver.write($))this.pause()}function pq0(){let $=this[kD];$._readyState=M$.CLOSING,$._receiver.end(),this.end()}function iq0(){let $=this[kD];if(this.removeListener("error",iq0),this.on("error",gq0),$)$._readyState=M$.CLOSING,this.destroy()}});var sq0=E((kD1,aq0)=>{var xD1=nN(),{Duplex:W3$}=Q0("stream");function oq0($){$.emit("close")}function q3$(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function tq0($){if(this.removeListener("error",tq0),this.destroy(),this.listenerCount("error")===0)this.emit("error",$)}function U3$($,D){let X=!0,Q=new W3$({...D,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return $.on("message",function(Y,Z){let F=!Z&&Q._readableState.objectMode?Y.toString():Y;if(!Q.push(F))$.pause()}),$.once("error",function(Y){if(Q.destroyed)return;X=!1,Q.destroy(Y)}),$.once("close",function(){if(Q.destroyed)return;Q.push(null)}),Q._destroy=function(J,Y){if($.readyState===$.CLOSED){Y(J),process.nextTick(oq0,Q);return}let Z=!1;if($.once("error",function(G){Z=!0,Y(G)}),$.once("close",function(){if(!Z)Y(J);process.nextTick(oq0,Q)}),X)$.terminate()},Q._final=function(J){if($.readyState===$.CONNECTING){$.once("open",function(){Q._final(J)});return}if($._socket===null)return;if($._socket._writableState.finished){if(J(),Q._readableState.endEmitted)Q.destroy()}else $._socket.once("finish",function(){J()}),$.close()},Q._read=function(){if($.isPaused)$.resume()},Q._write=function(J,Y,Z){if($.readyState===$.CONNECTING){$.once("open",function(){Q._write(J,Y,Z)});return}$.send(J,Z)},Q.on("end",q3$),Q.on("error",tq0),Q}aq0.exports=U3$});var Vy=E((yD1,eq0)=>{var{tokenChars:H3$}=JF();function K3$($){let D=new Set,X=-1,Q=-1,J=0;for(J;J<$.length;J++){let Z=$.charCodeAt(J);if(Q===-1&&H3$[Z]===1){if(X===-1)X=J}else if(J!==0&&(Z===32||Z===9)){if(Q===-1&&X!==-1)Q=J}else if(Z===44){if(X===-1)throw SyntaxError(`Unexpected character at index ${J}`);if(Q===-1)Q=J;let F=$.slice(X,Q);if(D.has(F))throw SyntaxError(`The "${F}" subprotocol is duplicated`);D.add(F),X=Q=-1}else throw SyntaxError(`Unexpected character at index ${J}`)}if(X===-1||Q!==-1)throw SyntaxError("Unexpected end of input");let Y=$.slice(X,J);if(D.has(Y))throw SyntaxError(`The "${Y}" subprotocol is duplicated`);return D.add(Y),D}eq0.exports={parse:K3$}});var JU0=E((uD1,QU0)=>{var O3$=Q0("events"),pN=Q0("http"),{Duplex:fD1}=Q0("stream"),{createHash:V3$}=Q0("crypto"),$U0=mN(),oQ=QF(),z3$=Vy(),L3$=nN(),{CLOSE_TIMEOUT:M3$,GUID:N3$,kWebSocket:B3$}=w7(),w3$=/^[+/0-9A-Za-z]{22}==$/;class XU0 extends O3${constructor($,D){super();if($={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:M3$,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:L3$,...$},$.port==null&&!$.server&&!$.noServer||$.port!=null&&($.server||$.noServer)||$.server&&$.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if($.port!=null)this._server=pN.createServer((X,Q)=>{let J=pN.STATUS_CODES[426];Q.writeHead(426,{"Content-Length":J.length,"Content-Type":"text/plain"}),Q.end(J)}),this._server.listen($.port,$.host,$.backlog,D);else if($.server)this._server=$.server;if(this._server){let X=this.emit.bind(this,"connection");this._removeListeners=R3$(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(Q,J,Y)=>{this.handleUpgrade(Q,J,Y,X)}})}if($.perMessageDeflate===!0)$.perMessageDeflate={};if($.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=$,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close($){if(this._state===2){if($)this.once("close",()=>{$(Error("The server is not running"))});process.nextTick(MU,this);return}if($)this.once("close",$);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(MU,this);else this._shouldEmitClose=!0;else process.nextTick(MU,this)}else{let D=this._server;this._removeListeners(),this._removeListeners=this._server=null,D.close(()=>{MU(this)})}}shouldHandle($){if(this.options.path){let D=$.url.indexOf("?");if((D!==-1?$.url.slice(0,D):$.url)!==this.options.path)return!1}return!0}handleUpgrade($,D,X,Q){D.on("error",DU0);let J=$.headers["sec-websocket-key"],Y=$.headers.upgrade,Z=+$.headers["sec-websocket-version"];if($.method!=="GET"){tQ(this,$,D,405,"Invalid HTTP method");return}if(Y===void 0||Y.toLowerCase()!=="websocket"){tQ(this,$,D,400,"Invalid Upgrade header");return}if(J===void 0||!w3$.test(J)){tQ(this,$,D,400,"Missing or invalid Sec-WebSocket-Key header");return}if(Z!==13&&Z!==8){tQ(this,$,D,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle($)){NU(D,400);return}let F=$.headers["sec-websocket-protocol"],G=new Set;if(F!==void 0)try{G=z3$.parse(F)}catch(U){tQ(this,$,D,400,"Invalid Sec-WebSocket-Protocol header");return}let W=$.headers["sec-websocket-extensions"],q={};if(this.options.perMessageDeflate&&W!==void 0){let U=new oQ({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let H=$U0.parse(W);if(H[oQ.extensionName])U.accept(H[oQ.extensionName]),q[oQ.extensionName]=U}catch(H){tQ(this,$,D,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let U={origin:$.headers[`${Z===8?"sec-websocket-origin":"origin"}`],secure:!!($.socket.authorized||$.socket.encrypted),req:$};if(this.options.verifyClient.length===2){this.options.verifyClient(U,(H,K,O,V)=>{if(!H)return NU(D,K||401,O,V);this.completeUpgrade(q,J,G,$,D,X,Q)});return}if(!this.options.verifyClient(U))return NU(D,401)}this.completeUpgrade(q,J,G,$,D,X,Q)}completeUpgrade($,D,X,Q,J,Y,Z){if(!J.readable||!J.writable)return J.destroy();if(J[B3$])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return NU(J,503);let G=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${V3$("sha1").update(D+N3$).digest("base64")}`],W=new this.options.WebSocket(null,void 0,this.options);if(X.size){let q=this.options.handleProtocols?this.options.handleProtocols(X,Q):X.values().next().value;if(q)G.push(`Sec-WebSocket-Protocol: ${q}`),W._protocol=q}if($[oQ.extensionName]){let q=$[oQ.extensionName].params,U=$U0.format({[oQ.extensionName]:[q]});G.push(`Sec-WebSocket-Extensions: ${U}`),W._extensions=$}if(this.emit("headers",G,Q),J.write(G.concat(`\r
|
|
409
409
|
`).join(`\r
|
|
410
410
|
`)),J.removeListener("error",DU0),W.setSocket(J,Y,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(W),W.on("close",()=>{if(this.clients.delete(W),this._shouldEmitClose&&!this.clients.size)process.nextTick(MU,this)});Z(W,Q)}}QU0.exports=XU0;function R3$($,D){for(let X of Object.keys(D))$.on(X,D[X]);return function(){for(let Q of Object.keys(D))$.removeListener(Q,D[Q])}}function MU($){$._state=2,$.emit("close")}function DU0(){this.destroy()}function NU($,D,X,Q){X=X||pN.STATUS_CODES[D],Q={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(X),...Q},$.once("finish",$.destroy),$.end(`HTTP/1.1 ${D} ${pN.STATUS_CODES[D]}\r
|
|
411
411
|
`+Object.keys(Q).map((J)=>`${J}: ${Q[J]}`).join(`\r
|