@jheavenknows/bluerouter 5.3.65 → 5.3.66
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/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +6 -6
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/ai-power-index/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/audit-proxy/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/model-profiles/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cluster/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/local-ai-report/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/console/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/personal/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovider/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovidermonitor/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalquota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-health/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/stt/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/tts/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/resource-monitor/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/routing-topology/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/audit-proxy/route.js +16 -15
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +5 -5
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/!KGRhc2hib2FyZCk/dashboard/ai-power-index/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-keys.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-keys.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys/__PAGE__.segment.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_full.segment.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/model-profiles/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cluster.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cluster.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cluster.segments/!KGRhc2hib2FyZCk/dashboard/cluster/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cluster.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cluster.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/local-ai-report.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/local-ai-report.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/local-ai-report.segments/!KGRhc2hib2FyZCk/dashboard/local-ai-report/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/local-ai-report.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/local-ai-report.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/logs.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/logs.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard/logs/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/logs.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/logs.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/personal.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/personal.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/personal.segments/!KGRhc2hib2FyZCk/dashboard/personal/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/personal.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/personal.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-health.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-health.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/stt.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/stt.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/!KGRhc2hib2FyZCk/dashboard/providers/stt/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/tts.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/tts.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/!KGRhc2hib2FyZCk/dashboard/providers/tts/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/!KGRhc2hib2FyZCk/dashboard/resource-monitor/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/routing-topology.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/routing-topology.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/routing-topology.segments/!KGRhc2hib2FyZCk/dashboard/routing-topology/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/routing-topology.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/routing-topology.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +5 -5
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +6 -6
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +6 -6
- package/app/.next-cli-build/server/chunks/3958.js +13 -13
- package/app/.next-cli-build/server/chunks/4746.js +1 -1
- package/app/.next-cli-build/server/chunks/6328.js +1 -1
- package/app/.next-cli-build/server/chunks/6811.js +1 -1
- package/app/.next-cli-build/server/chunks/6992.js +1 -1
- package/app/.next-cli-build/server/chunks/7639.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/{5263-032eff9b931cc73b.js → 5263-364748ccd1292403.js} +1 -1
- package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite +0 -0
- package/app/package.json +1 -1
- package/package.json +1 -1
- package/app/cli/.build-home/AppData/Roaming/bluerouter/db/backups/upgrade-5.3.59-to-5.3.60-5.3.60-20260823-094447/data.sqlite +0 -0
- /package/app/.next-cli-build/static/{6dTLAa-pms7CttZOuREkg → KCY4ORmC17jFBWLE5W0QX}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{6dTLAa-pms7CttZOuREkg → KCY4ORmC17jFBWLE5W0QX}/_ssgManifest.js +0 -0
|
@@ -21,7 +21,7 @@ Content-Type: text/plain; charset=utf-8\r
|
|
|
21
21
|
Content-Length: ${Buffer.byteLength(d)}\r
|
|
22
22
|
\r
|
|
23
23
|
${d}`)}catch{try{a.destroy()}catch{}}}function F(a={}){let b={};for(let[c,d]of Object.entries(a||{}))b[c]=d;return b}async function G(a){let b=await a.requestCapture.finish(String(a.requestHeaders["content-type"]||""),String(a.requestHeaders["content-encoding"]||"")),c=await a.responseCapture.finish(String(a.responseHeaders?.["content-type"]||""),String(a.responseHeaders?.["content-encoding"]||""));return{id:i.randomUUID(),timestamp:new Date().toISOString(),protocol:a.protocol||"http/1.1",client:{ip:a.clientIp||"",port:a.clientPort||null,userAgent:String(a.requestHeaders["user-agent"]||"")},provider:C(a.target.host),host:w(a.target.host),port:a.target.port,method:a.method,path:n(a.path),model:D(b.body),status:a.statusCode||null,durationMs:Date.now()-a.startedAt,error:a.error?o(a.error.message||a.error):null,request:{headers:l(a.requestHeaders),...b},response:{headers:l(a.responseHeaders||{}),...c}}}a.exports={createAuditProxy:function(a={},b={}){let c={allowedHosts:[],passthroughUnknown:!0,captureBodies:!0,captureLimitBytes:2097152,verifyUpstreamTls:!0,allowedConnectPorts:[443],connectTimeoutMs:1e4,tlsHandshakeTimeoutMs:1e4,responseHeaderTimeoutMs:3e4,idleTimeoutMs:9e5,allowPlainHttp:!1,...a};if(!0!==c.verifyUpstreamTls)throw Error("Upstream TLS verification is mandatory in Audit Proxy mode");let i=b.certificateProvider;if("function"!=typeof i)throw Error("certificateProvider is required");let j="function"==typeof b.onAudit?b.onAudit:()=>{},k="function"==typeof b.onAuditJob?b.onAuditJob:null,l="function"==typeof b.resolveTarget?b.resolveTarget:(a,b)=>p(a,b,{allowedPorts:c.allowedConnectPorts}),m=b.upstreamCa,n=new Set,o=new Map,q=new WeakMap,r=new Set;function s(a){return!a||n.has(a)||(n.add(a),a.once?.("close",()=>n.delete(a))),a}function t(a,b){try{"function"==typeof a.destroy?a.destroy(b):"function"==typeof a.close&&a.close()}catch{}}function u(a){let b=()=>G(a);if(k){try{k(b)}catch(a){console.warn("[audit-proxy] audit enqueue failed:",a?.message||a)}return}setImmediate(()=>{Promise.resolve().then(b).then(j).catch(a=>console.warn("[audit-proxy] audit callback failed:",a?.message||a))})}function v({requestHeaders:a,method:b,path:c,target:d,requestCapture:e,responseCapture:f,responseHeaders:g,statusCode:h,startedAt:i,error:j,socket:k,protocol:l}){let m;return{requestHeaders:F(a),method:b,path:c,target:d,requestCapture:e,responseCapture:f,responseHeaders:F(g),statusCode:h,startedAt:i,error:j,clientIp:(m=k?.remoteAddress||"").startsWith("::ffff:")?m.slice(7):m,clientPort:k?.remotePort||null,protocol:l}}async function w(a,b,{expectContinue:d=!1}={}){let e=a.socket.__auditTarget;if(!e){b.writeHead(502,{"content-type":"text/plain"}),b.end("Audit target is missing");return}let h=Date.now(),i=new B(c.captureBodies?c.captureLimitBytes:0),j=new B(c.captureBodies?c.captureLimitBytes:0),k=z(a.headers,{stripInternal:!0});k.host=443===e.port?e.host:`${e.host}:${e.port}`;let n=null,p=null,q={},r=null,t=!1,x=!1,y=null,A=(b=null)=>{t||(t=!0,y&&clearTimeout(y),u(v({requestHeaders:a.headers,method:a.method,path:a.url,target:e,requestCapture:i,responseCapture:j,responseHeaders:q,statusCode:r,startedAt:h,error:b,socket:a.socket,protocol:"http/1.1"})))};try{let h,t,u=await l(e.host,e.port);(n=f.request({hostname:e.host,port:e.port,method:a.method,path:a.url,headers:k,rejectUnauthorized:!0,servername:g.isIP(e.host)?void 0:e.host,ca:m,ALPNProtocols:["http/1.1"],lookup:u.lookup,autoSelectFamily:!0,agent:(h=`${e.host}:${e.port}`,(t=o.get(h))||(t=new f.Agent({keepAlive:!0,maxSockets:32,maxFreeSockets:8,timeout:c.idleTimeoutMs}),o.set(h,t)),t)})).on("socket",a=>{if(s(a),a.setNoDelay(!0),a.setKeepAlive(!0,3e4),a.setTimeout(c.idleTimeoutMs,()=>a.destroy(Error("Upstream idle timeout"))),a.connecting){let b=setTimeout(()=>a.destroy(Error("Upstream TLS connect timeout")),c.connectTimeoutMs+c.tlsHandshakeTimeoutMs);b.unref?.();let d=()=>clearTimeout(b);a.once("secureConnect",d),a.once("error",d),a.once("close",d)}}),n.on("continue",()=>{d&&!b.headersSent&&b.writeContinue()}),n.on("information",a=>{102===a.statusCode&&"function"==typeof b.writeProcessing&&b.writeProcessing(),103===a.statusCode&&"function"==typeof b.writeEarlyHints&&b.writeEarlyHints(a.headers||{})}),n.on("response",a=>{p=a,y&&clearTimeout(y),r=a.statusCode||502,q=F(a.headers||{});let c=z(a.headers,{stripInternal:!1});b.writeHead(r,c),b.flushHeaders?.(),a.on("data",c=>{j.add(c),b.write(c)||a.pause()}),b.on("drain",()=>a.resume()),a.on("aborted",()=>{let a=Error("Upstream response aborted");b.destroyed||b.destroy(a),A(a)}),a.on("error",a=>{b.destroyed||b.destroy(a),A(a)}),a.on("end",()=>{if(a.trailers&&Object.keys(a.trailers).length)try{b.addTrailers(z(a.trailers,{stripInternal:!1}))}catch{}x=!0,b.end(),A(null)})}),n.on("error",a=>{b.headersSent?b.destroyed||b.destroy(a):(b.writeHead(502,{"content-type":"application/json"}),b.end(JSON.stringify({error:"Verified upstream TLS request failed"})),x=!0),A(a)}),a.on("data",b=>{i.add(b),n.write(b)||a.pause()}),n.on("drain",()=>a.resume()),a.on("end",()=>{if(a.trailers&&Object.keys(a.trailers).length)try{n.addTrailers(z(a.trailers,{stripInternal:!0}))}catch{}n.end(),y=setTimeout(()=>n.destroy(Error("Upstream response header timeout")),c.responseHeaderTimeoutMs),y.unref?.()}),a.on("aborted",()=>n.destroy(Error("Client request aborted"))),a.on("error",a=>n.destroy(a)),b.on("close",()=>{x||(p?.destroy(Error("Client response closed")),n?.destroy(Error("Client response closed")),A(Error("Client response closed")))})}catch(a){b.headersSent||(b.writeHead(502,{"content-type":"application/json"}),b.end(JSON.stringify({error:"Destination validation or connection failed"})),x=!0),A(a)}}let A=d.createServer((a,b)=>{w(a,b)});async function C(a){return a.upstreamPromise||(a.upstreamPromise=(async()=>{let b=a.target,d=await l(b.host,b.port),f=s(h.connect({host:b.host,port:b.port,servername:g.isIP(b.host)?void 0:b.host,rejectUnauthorized:!0,ca:m,ALPNProtocols:["h2"],lookup:d.lookup,autoSelectFamily:!0}));f.setNoDelay(!0),f.setKeepAlive(!0,3e4);let i=setTimeout(()=>f.destroy(Error("Upstream HTTP/2 TLS connect timeout")),c.connectTimeoutMs+c.tlsHandshakeTimeoutMs);i.unref?.(),f.once("secureConnect",()=>{clearTimeout(i),"h2"!==f.alpnProtocol&&f.destroy(Error("Upstream did not negotiate HTTP/2"))}),f.once("error",()=>clearTimeout(i)),f.once("close",()=>clearTimeout(i));let j=`https://${b.host}${443===b.port?"":`:${b.port}`}`,k=e.connect(j,{createConnection:()=>f,settings:{enablePush:!1}});return r.add(k),k.setTimeout(c.idleTimeoutMs,()=>k.destroy(Error("Upstream HTTP/2 idle timeout"))),k.once("close",()=>r.delete(k)),await new Promise((a,b)=>{let d=setTimeout(()=>b(Error("Upstream HTTP/2 session timeout")),c.connectTimeoutMs+c.tlsHandshakeTimeoutMs);d.unref?.();let e=(a,b)=>{clearTimeout(d),k.removeListener("connect",f),k.removeListener("error",g),a(b)},f=()=>e(a,k),g=a=>e(b,a);k.once("connect",f),k.once("error",g)}),k})().catch(b=>{throw a.upstreamPromise=null,b})),a.upstreamPromise}async function D(a,b){let d=q.get(a.session),f=d?.target;if(!d||!f){a.respond({":status":502,"content-type":"text/plain"}),a.end("Audit target is missing");return}a.pause();let g=Date.now(),h=new B(c.captureBodies?c.captureLimitBytes:0),i=new B(c.captureBodies?c.captureLimitBytes:0),j={},k=null,l=!1,m=!1,n=null,o=null,p=null,r=(c=null)=>{l||(l=!0,u(v({requestHeaders:b,method:b[":method"]||"GET",path:b[":path"]||"/",target:f,requestCapture:h,responseCapture:i,responseHeaders:j,statusCode:k,startedAt:g,error:c,socket:a.session.socket,protocol:"h2"})))};try{(n=(await C(d)).request(function(a,b){let c=z(a,{stripInternal:!0}),d={":method":a[":method"]||"GET",":path":a[":path"]||"/",":scheme":"https",":authority":443===b.port?b.host:`${b.host}:${b.port}`};for(let[a,b]of Object.entries(c))a.startsWith(":")||(d[a.toLowerCase()]=b);return d}(b,f),{endStream:!1,waitForTrailers:!0})).setTimeout(c.idleTimeoutMs,()=>n.close(e.constants.NGHTTP2_CANCEL)),a.setTimeout(c.idleTimeoutMs,()=>a.close(e.constants.NGHTTP2_CANCEL)),n.on("response",b=>{j=F(b),k=Number(b[":status"]||502),a.respond(function(a){let b=z(a,{stripInternal:!1}),c={":status":Number(a[":status"]||502)};for(let[a,d]of Object.entries(b))a.startsWith(":")||(c[a.toLowerCase()]=d);return c}(b),{waitForTrailers:!0})}),n.on("trailers",a=>{p=z(a,{stripInternal:!1})}),a.on("wantTrailers",()=>{try{a.sendTrailers(p||{})}catch{}}),a.on("trailers",a=>{o=z(a,{stripInternal:!0})}),n.on("wantTrailers",()=>{try{n.sendTrailers(o||{})}catch{}}),a.on("data",b=>{h.add(b),n.write(b)||a.pause()}),n.on("drain",()=>a.resume()),a.on("end",()=>n.end()),n.on("data",b=>{i.add(b),a.write(b)||n.pause()}),a.on("drain",()=>n.resume()),n.on("end",()=>{m=!0,a.end(),r(null)}),n.on("aborted",()=>{let b=Error("Upstream HTTP/2 stream aborted");a.close(e.constants.NGHTTP2_INTERNAL_ERROR),r(b)}),n.on("error",b=>{a.closed||a.close(e.constants.NGHTTP2_INTERNAL_ERROR),r(b)}),a.on("aborted",()=>{n.close(e.constants.NGHTTP2_CANCEL),r(Error("Client HTTP/2 stream aborted"))}),a.on("error",a=>{n.close(e.constants.NGHTTP2_CANCEL),r(a)}),a.on("close",()=>{m||!n||n.closed||(n.close(e.constants.NGHTTP2_CANCEL),r(Error("Client HTTP/2 stream closed")))}),a.resume()}catch(b){a.headersSent||a.closed||a.respond({":status":502,"content-type":"application/json"}),a.closed||a.end(JSON.stringify({error:"Verified upstream HTTP/2 request failed"})),r(b)}}A.on("checkContinue",(a,b)=>{w(a,b,{expectContinue:!0})}),A.on("clientError",(a,b)=>t(b)),A.headersTimeout=c.responseHeaderTimeoutMs,A.requestTimeout=0,A.keepAliveTimeout=c.idleTimeoutMs;let H=e.createServer({settings:{enablePush:!1}});H.on("session",a=>{let b={target:a.socket.__auditTarget,upstreamPromise:null};q.set(a,b),a.setTimeout(c.idleTimeoutMs,()=>a.destroy(Error("Client HTTP/2 idle timeout"))),a.once("close",()=>{Promise.resolve(b.upstreamPromise).then(a=>a?.close()).catch(()=>{})})}),H.on("stream",(a,b)=>{D(a,b)}),H.on("sessionError",a=>{console.warn("[audit-proxy] HTTP/2 client session error:",a?.message||a)});let I=d.createServer((a,b)=>{b.writeHead(403,{"content-type":"text/plain; charset=utf-8",connection:"close"}),b.end("Audit Proxy accepts HTTPS CONNECT traffic only")});return I.on("connect",(a,b,d)=>{(async()=>{let e,f;try{e=x(a.url,443),await l(e.host,e.port)}catch(a){E(b,"403 Forbidden",a.message||"Destination is not allowed");return}if(!y(e.host,c.allowedHosts)){if(!c.passthroughUnknown)return void E(b,"403 Forbidden","Host is not in the audit allowlist");let a=!1;try{let f=await l(e.host,e.port),h=s(g.connect({host:e.host,port:e.port,lookup:f.lookup,autoSelectFamily:!0})),i=setTimeout(()=>h.destroy(Error("TCP passthrough connect timeout")),c.connectTimeoutMs);i.unref?.(),h.setNoDelay(!0),h.setKeepAlive(!0,3e4),h.setTimeout(c.idleTimeoutMs,()=>h.destroy(Error("TCP passthrough idle timeout"))),h.once("connect",()=>{clearTimeout(i),a=!0,b.write("HTTP/1.1 200 Connection Established\r\nProxy-Agent: BlueRouter-Audit\r\n\r\n"),d?.length&&h.write(d),h.pipe(b),b.pipe(h)}),h.once("error",()=>{clearTimeout(i),a?t(b):E(b,"502 Bad Gateway","TCP passthrough failed")}),b.once("error",()=>t(h)),b.once("close",()=>t(h))}catch(a){E(b,"502 Bad Gateway",a.message||"TCP passthrough failed")}return}try{if(f=i(e.host),!f?.key||!f?.cert)throw Error("Certificate provider returned no certificate")}catch(a){E(b,"500 Internal Server Error",`Cannot issue audit certificate: ${a.message}`);return}b.write("HTTP/1.1 200 Connection Established\r\nProxy-Agent: BlueRouter-Audit\r\n\r\n"),d?.length&&b.unshift(d);let j=s(new h.TLSSocket(b,{isServer:!0,key:f.key,cert:f.cert,ALPNProtocols:["h2","http/1.1"]}));j.__auditTarget=e,j.setNoDelay(!0),j.setKeepAlive(!0,3e4),j.setTimeout(c.idleTimeoutMs,()=>j.destroy(Error("Client TLS idle timeout")));let k=setTimeout(()=>j.destroy(Error("Client TLS handshake timeout")),c.tlsHandshakeTimeoutMs);k.unref?.();let m=!1,n=()=>{m||(m=!0,clearTimeout(k),"h2"===j.alpnProtocol?H.emit("connection",j):A.emit("connection",j))};j.once("secure",n),j.once("secureConnect",n),j.once("error",()=>{clearTimeout(k),t(j)}),j.once("close",()=>clearTimeout(k))})().catch(a=>E(b,"500 Internal Server Error",a.message||"Audit CONNECT failed"))}),I.prependListener("connection",a=>{s(a),a.setNoDelay(!0),a.setKeepAlive(!0,3e4)}),I.on("upgrade",(a,b)=>E(b,"403 Forbidden","Protocol upgrade is not supported")),I.on("clientError",(a,b)=>t(b)),I.headersTimeout=c.responseHeaderTimeoutMs,I.requestTimeout=0,I.keepAliveTimeout=c.idleTimeoutMs,I.forceCloseAll=()=>{for(let a of r)try{a.destroy()}catch{}for(let a of o.values())try{a.destroy()}catch{}for(let a of[...n])t(a)},I.getActiveConnectionCount=()=>n.size,I.auditConfig=c,I.auditCapabilities={http1:!0,http2:!0,plainHttp:!1,publicConnectPorts:[...c.allowedConnectPorts]},I},hostMatches:y,parseAuthority:x,stripHopByHop:z,CaptureBuffer:B,detectProvider:C,extractModel:D,decodeCapturedBuffer:A}},33889:(a,b,c)=>{var d=c(45654),e=c(20096),f=a.exports=d.util=d.util||{};function g(a){if(8!==a&&16!==a&&24!==a&&32!==a)throw Error("Only 8, 16, 24, or 32 bits supported: "+a)}function h(a){if(this.data="",this.read=0,"string"==typeof a)this.data=a;else if(f.isArrayBuffer(a)||f.isArrayBufferView(a))if("u">typeof Buffer&&a instanceof Buffer)this.data=a.toString("binary");else{var b=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,b)}catch(a){for(var c=0;c<b.length;++c)this.putByte(b[c])}}else(a instanceof h||"object"==typeof a&&"string"==typeof a.data&&"number"==typeof a.read)&&(this.data=a.data,this.read=a.read);this._constructedStringLength=0}!function(){if("u">typeof process&&process.nextTick&&1){f.nextTick=process.nextTick,"function"==typeof setImmediate?f.setImmediate=setImmediate:f.setImmediate=f.nextTick;return}if("function"==typeof setImmediate){f.setImmediate=function(){return setImmediate.apply(void 0,arguments)},f.nextTick=function(a){return setImmediate(a)};return}if(f.setImmediate=function(a){setTimeout(a,0)},"u">typeof window&&"function"==typeof window.postMessage){var a="forge.setImmediate",b=[];f.setImmediate=function(c){b.push(c),1===b.length&&window.postMessage(a,"*")},window.addEventListener("message",function(c){if(c.source===window&&c.data===a){c.stopPropagation();var d=b.slice();b.length=0,d.forEach(function(a){a()})}},!0)}if("u">typeof MutationObserver){var c=Date.now(),d=!0,e=document.createElement("div"),b=[];new MutationObserver(function(){var a=b.slice();b.length=0,a.forEach(function(a){a()})}).observe(e,{attributes:!0});var g=f.setImmediate;f.setImmediate=function(a){Date.now()-c>15?(c=Date.now(),g(a)):(b.push(a),1===b.length&&e.setAttribute("a",d=!d))}}f.nextTick=f.setImmediate}(),f.isNodejs="u">typeof process&&process.versions&&process.versions.node,f.globalScope=f.isNodejs?global:"u"<typeof self?window:self,f.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},f.isArrayBuffer=function(a){return"u">typeof ArrayBuffer&&a instanceof ArrayBuffer},f.isArrayBufferView=function(a){return a&&f.isArrayBuffer(a.buffer)&&void 0!==a.byteLength},f.ByteBuffer=h,f.ByteStringBuffer=h,f.ByteStringBuffer.prototype._optimizeConstructedString=function(a){this._constructedStringLength+=a,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},f.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},f.ByteStringBuffer.prototype.isEmpty=function(){return 0>=this.length()},f.ByteStringBuffer.prototype.putByte=function(a){return this.putBytes(String.fromCharCode(a))},f.ByteStringBuffer.prototype.fillWithByte=function(a,b){a=String.fromCharCode(a);for(var c=this.data;b>0;)1&b&&(c+=a),(b>>>=1)>0&&(a+=a);return this.data=c,this._optimizeConstructedString(b),this},f.ByteStringBuffer.prototype.putBytes=function(a){return this.data+=a,this._optimizeConstructedString(a.length),this},f.ByteStringBuffer.prototype.putString=function(a){return this.putBytes(f.encodeUtf8(a))},f.ByteStringBuffer.prototype.putInt16=function(a){return this.putBytes(String.fromCharCode(a>>8&255)+String.fromCharCode(255&a))},f.ByteStringBuffer.prototype.putInt24=function(a){return this.putBytes(String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(255&a))},f.ByteStringBuffer.prototype.putInt32=function(a){return this.putBytes(String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(255&a))},f.ByteStringBuffer.prototype.putInt16Le=function(a){return this.putBytes(String.fromCharCode(255&a)+String.fromCharCode(a>>8&255))},f.ByteStringBuffer.prototype.putInt24Le=function(a){return this.putBytes(String.fromCharCode(255&a)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255))},f.ByteStringBuffer.prototype.putInt32Le=function(a){return this.putBytes(String.fromCharCode(255&a)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>24&255))},f.ByteStringBuffer.prototype.putInt=function(a,b){g(b);var c="";do b-=8,c+=String.fromCharCode(a>>b&255);while(b>0);return this.putBytes(c)},f.ByteStringBuffer.prototype.putSignedInt=function(a,b){return a<0&&(a+=2<<b-1),this.putInt(a,b)},f.ByteStringBuffer.prototype.putBuffer=function(a){return this.putBytes(a.getBytes())},f.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},f.ByteStringBuffer.prototype.getInt16=function(){var a=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,a},f.ByteStringBuffer.prototype.getInt24=function(){var a=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,a},f.ByteStringBuffer.prototype.getInt32=function(){var a=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,a},f.ByteStringBuffer.prototype.getInt16Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,a},f.ByteStringBuffer.prototype.getInt24Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,a},f.ByteStringBuffer.prototype.getInt32Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,a},f.ByteStringBuffer.prototype.getInt=function(a){g(a);var b=0;do b=(b<<8)+this.data.charCodeAt(this.read++),a-=8;while(a>0);return b},f.ByteStringBuffer.prototype.getSignedInt=function(a){var b=this.getInt(a),c=2<<a-2;return b>=c&&(b-=c<<1),b},f.ByteStringBuffer.prototype.getBytes=function(a){var b;return a?(a=Math.min(this.length(),a),b=this.data.slice(this.read,this.read+a),this.read+=a):0===a?b="":(b=0===this.read?this.data:this.data.slice(this.read),this.clear()),b},f.ByteStringBuffer.prototype.bytes=function(a){return void 0===a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)},f.ByteStringBuffer.prototype.at=function(a){return this.data.charCodeAt(this.read+a)},f.ByteStringBuffer.prototype.setAt=function(a,b){return this.data=this.data.substr(0,this.read+a)+String.fromCharCode(b)+this.data.substr(this.read+a+1),this},f.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},f.ByteStringBuffer.prototype.copy=function(){var a=f.createBuffer(this.data);return a.read=this.read,a},f.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},f.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},f.ByteStringBuffer.prototype.truncate=function(a){var b=Math.max(0,this.length()-a);return this.data=this.data.substr(this.read,b),this.read=0,this},f.ByteStringBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.length;++b){var c=this.data.charCodeAt(b);c<16&&(a+="0"),a+=c.toString(16)}return a},f.ByteStringBuffer.prototype.toString=function(){return f.decodeUtf8(this.bytes())},f.DataBuffer=function(a,b){b=b||{},this.read=b.readOffset||0,this.growSize=b.growSize||1024;var c=f.isArrayBuffer(a),d=f.isArrayBufferView(a);if(c||d){c?this.data=new DataView(a):this.data=new DataView(a.buffer,a.byteOffset,a.byteLength),this.write="writeOffset"in b?b.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=a&&this.putBytes(a),"writeOffset"in b&&(this.write=b.writeOffset)},f.DataBuffer.prototype.length=function(){return this.write-this.read},f.DataBuffer.prototype.isEmpty=function(){return 0>=this.length()},f.DataBuffer.prototype.accommodate=function(a,b){if(this.length()>=a)return this;b=Math.max(b||this.growSize,a);var c=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),d=new Uint8Array(this.length()+b);return d.set(c),this.data=new DataView(d.buffer),this},f.DataBuffer.prototype.putByte=function(a){return this.accommodate(1),this.data.setUint8(this.write++,a),this},f.DataBuffer.prototype.fillWithByte=function(a,b){this.accommodate(b);for(var c=0;c<b;++c)this.data.setUint8(a);return this},f.DataBuffer.prototype.putBytes=function(a,b){if(f.isArrayBufferView(a)){var c,d=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),e=d.byteLength-d.byteOffset;this.accommodate(e);var g=new Uint8Array(this.data.buffer,this.write);return g.set(d),this.write+=e,this}if(f.isArrayBuffer(a)){var d=new Uint8Array(a);this.accommodate(d.byteLength);var g=new Uint8Array(this.data.buffer);return g.set(d,this.write),this.write+=d.byteLength,this}if(a instanceof f.DataBuffer||"object"==typeof a&&"number"==typeof a.read&&"number"==typeof a.write&&f.isArrayBufferView(a.data)){var d=new Uint8Array(a.data.byteLength,a.read,a.length());this.accommodate(d.byteLength);var g=new Uint8Array(a.data.byteLength,this.write);return g.set(d),this.write+=d.byteLength,this}if(a instanceof f.ByteStringBuffer&&(a=a.data,b="binary"),b=b||"binary","string"==typeof a){if("hex"===b)return this.accommodate(Math.ceil(a.length/2)),c=new Uint8Array(this.data.buffer,this.write),this.write+=f.binary.hex.decode(a,c,this.write),this;if("base64"===b)return this.accommodate(3*Math.ceil(a.length/4)),c=new Uint8Array(this.data.buffer,this.write),this.write+=f.binary.base64.decode(a,c,this.write),this;if("utf8"===b&&(a=f.encodeUtf8(a),b="binary"),"binary"===b||"raw"===b)return this.accommodate(a.length),c=new Uint8Array(this.data.buffer,this.write),this.write+=f.binary.raw.decode(c),this;if("utf16"===b)return this.accommodate(2*a.length),c=new Uint16Array(this.data.buffer,this.write),this.write+=f.text.utf16.encode(c),this;throw Error("Invalid encoding: "+b)}throw Error("Invalid parameter: "+a)},f.DataBuffer.prototype.putBuffer=function(a){return this.putBytes(a),a.clear(),this},f.DataBuffer.prototype.putString=function(a){return this.putBytes(a,"utf16")},f.DataBuffer.prototype.putInt16=function(a){return this.accommodate(2),this.data.setInt16(this.write,a),this.write+=2,this},f.DataBuffer.prototype.putInt24=function(a){return this.accommodate(3),this.data.setInt16(this.write,a>>8&65535),this.data.setInt8(this.write,a>>16&255),this.write+=3,this},f.DataBuffer.prototype.putInt32=function(a){return this.accommodate(4),this.data.setInt32(this.write,a),this.write+=4,this},f.DataBuffer.prototype.putInt16Le=function(a){return this.accommodate(2),this.data.setInt16(this.write,a,!0),this.write+=2,this},f.DataBuffer.prototype.putInt24Le=function(a){return this.accommodate(3),this.data.setInt8(this.write,a>>16&255),this.data.setInt16(this.write,a>>8&65535,!0),this.write+=3,this},f.DataBuffer.prototype.putInt32Le=function(a){return this.accommodate(4),this.data.setInt32(this.write,a,!0),this.write+=4,this},f.DataBuffer.prototype.putInt=function(a,b){g(b),this.accommodate(b/8);do b-=8,this.data.setInt8(this.write++,a>>b&255);while(b>0);return this},f.DataBuffer.prototype.putSignedInt=function(a,b){return g(b),this.accommodate(b/8),a<0&&(a+=2<<b-1),this.putInt(a,b)},f.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},f.DataBuffer.prototype.getInt16=function(){var a=this.data.getInt16(this.read);return this.read+=2,a},f.DataBuffer.prototype.getInt24=function(){var a=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,a},f.DataBuffer.prototype.getInt32=function(){var a=this.data.getInt32(this.read);return this.read+=4,a},f.DataBuffer.prototype.getInt16Le=function(){var a=this.data.getInt16(this.read,!0);return this.read+=2,a},f.DataBuffer.prototype.getInt24Le=function(){var a=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,a},f.DataBuffer.prototype.getInt32Le=function(){var a=this.data.getInt32(this.read,!0);return this.read+=4,a},f.DataBuffer.prototype.getInt=function(a){g(a);var b=0;do b=(b<<8)+this.data.getInt8(this.read++),a-=8;while(a>0);return b},f.DataBuffer.prototype.getSignedInt=function(a){var b=this.getInt(a),c=2<<a-2;return b>=c&&(b-=c<<1),b},f.DataBuffer.prototype.getBytes=function(a){var b;return a?(a=Math.min(this.length(),a),b=this.data.slice(this.read,this.read+a),this.read+=a):0===a?b="":(b=0===this.read?this.data:this.data.slice(this.read),this.clear()),b},f.DataBuffer.prototype.bytes=function(a){return void 0===a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)},f.DataBuffer.prototype.at=function(a){return this.data.getUint8(this.read+a)},f.DataBuffer.prototype.setAt=function(a,b){return this.data.setUint8(a,b),this},f.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},f.DataBuffer.prototype.copy=function(){return new f.DataBuffer(this)},f.DataBuffer.prototype.compact=function(){if(this.read>0){var a=new Uint8Array(this.data.buffer,this.read),b=new Uint8Array(a.byteLength);b.set(a),this.data=new DataView(b),this.write-=this.read,this.read=0}return this},f.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},f.DataBuffer.prototype.truncate=function(a){return this.write=Math.max(0,this.length()-a),this.read=Math.min(this.read,this.write),this},f.DataBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.byteLength;++b){var c=this.data.getUint8(b);c<16&&(a+="0"),a+=c.toString(16)}return a},f.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());if("binary"===(a=a||"utf8")||"raw"===a)return f.binary.raw.encode(b);if("hex"===a)return f.binary.hex.encode(b);if("base64"===a)return f.binary.base64.encode(b);if("utf8"===a)return f.text.utf8.decode(b);if("utf16"===a)return f.text.utf16.decode(b);throw Error("Invalid encoding: "+a)},f.createBuffer=function(a,b){return b=b||"raw",void 0!==a&&"utf8"===b&&(a=f.encodeUtf8(a)),new f.ByteBuffer(a)},f.fillString=function(a,b){for(var c="";b>0;)1&b&&(c+=a),(b>>>=1)>0&&(a+=a);return c},f.xorBytes=function(a,b,c){for(var d="",e="",f="",g=0,h=0;c>0;--c,++g)e=a.charCodeAt(g)^b.charCodeAt(g),h>=10&&(d+=f,f="",h=0),f+=String.fromCharCode(e),++h;return d+f},f.hexToBytes=function(a){var b="",c=0;for(!0&a.length&&(c=1,b+=String.fromCharCode(parseInt(a[0],16)));c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,2),16));return b},f.bytesToHex=function(a){return f.createBuffer(a).toHex()},f.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(255&a)};var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",j=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],k="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";f.encode64=function(a,b){for(var c,d,e,f="",g="",h=0;h<a.length;)c=a.charCodeAt(h++),d=a.charCodeAt(h++),e=a.charCodeAt(h++),f+=i.charAt(c>>2),f+=i.charAt((3&c)<<4|d>>4),isNaN(d)?f+="==":(f+=i.charAt((15&d)<<2|e>>6),f+=isNaN(e)?"=":i.charAt(63&e)),b&&f.length>b&&(g+=f.substr(0,b)+"\r\n",f=f.substr(b));return g+f},f.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b,c,d,e,f="",g=0;g<a.length;)b=j[a.charCodeAt(g++)-43],c=j[a.charCodeAt(g++)-43],d=j[a.charCodeAt(g++)-43],e=j[a.charCodeAt(g++)-43],f+=String.fromCharCode(b<<2|c>>4),64!==d&&(f+=String.fromCharCode((15&c)<<4|d>>2),64!==e&&(f+=String.fromCharCode((3&d)<<6|e)));return f},f.encodeUtf8=function(a){return unescape(encodeURIComponent(a))},f.decodeUtf8=function(a){return decodeURIComponent(escape(a))},f.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},f.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)},f.binary.raw.decode=function(a,b,c){var d=b;d||(d=new Uint8Array(a.length));for(var e=c=c||0,f=0;f<a.length;++f)d[e++]=a.charCodeAt(f);return b?e-c:d},f.binary.hex.encode=f.bytesToHex,f.binary.hex.decode=function(a,b,c){var d=b;d||(d=new Uint8Array(Math.ceil(a.length/2)));var e=0,f=c=c||0;for(1&a.length&&(e=1,d[f++]=parseInt(a[0],16));e<a.length;e+=2)d[f++]=parseInt(a.substr(e,2),16);return b?f-c:d},f.binary.base64.encode=function(a,b){for(var c,d,e,f="",g="",h=0;h<a.byteLength;)c=a[h++],d=a[h++],e=a[h++],f+=i.charAt(c>>2),f+=i.charAt((3&c)<<4|d>>4),isNaN(d)?f+="==":(f+=i.charAt((15&d)<<2|e>>6),f+=isNaN(e)?"=":i.charAt(63&e)),b&&f.length>b&&(g+=f.substr(0,b)+"\r\n",f=f.substr(b));return g+f},f.binary.base64.decode=function(a,b,c){var d,e,f,g,h=b;h||(h=new Uint8Array(3*Math.ceil(a.length/4))),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var i=0,k=c=c||0;i<a.length;)d=j[a.charCodeAt(i++)-43],e=j[a.charCodeAt(i++)-43],f=j[a.charCodeAt(i++)-43],g=j[a.charCodeAt(i++)-43],h[k++]=d<<2|e>>4,64!==f&&(h[k++]=(15&e)<<4|f>>2,64!==g&&(h[k++]=(3&f)<<6|g));return b?k-c:h.subarray(0,k)},f.binary.base58.encode=function(a,b){return f.binary.baseN.encode(a,k,b)},f.binary.base58.decode=function(a,b){return f.binary.baseN.decode(a,k,b)},f.text={utf8:{},utf16:{}},f.text.utf8.encode=function(a,b,c){a=f.encodeUtf8(a);var d=b;d||(d=new Uint8Array(a.length));for(var e=c=c||0,g=0;g<a.length;++g)d[e++]=a.charCodeAt(g);return b?e-c:d},f.text.utf8.decode=function(a){return f.decodeUtf8(String.fromCharCode.apply(null,a))},f.text.utf16.encode=function(a,b,c){var d=b;d||(d=new Uint8Array(2*a.length));for(var e=new Uint16Array(d.buffer),f=c=c||0,g=c,h=0;h<a.length;++h)e[g++]=a.charCodeAt(h),f+=2;return b?f-c:d},f.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))},f.deflate=function(a,b,c){if(b=f.decode64(a.deflate(f.encode64(b)).rval),c){var d=2;32&b.charCodeAt(1)&&(d=6),b=b.substring(d,b.length-4)}return b},f.inflate=function(a,b,c){var d=a.inflate(f.encode64(b)).rval;return null===d?null:f.decode64(d)};var l=function(a,b,c){if(!a)throw Error("WebStorage not available.");if(null===c?d=a.removeItem(b):(c=f.encode64(JSON.stringify(c)),d=a.setItem(b,c)),void 0!==d&&!0!==d.rval){var d,e=Error(d.error.message);throw e.id=d.error.id,e.name=d.error.name,e}},m=function(a,b){if(!a)throw Error("WebStorage not available.");var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var d=Error(c.error.message);throw d.id=c.error.id,d.name=c.error.name,d}c=null}else c=c.rval;return null!==c&&(c=JSON.parse(f.decode64(c))),c},n=function(a,b,c,d){var e=m(a,b);null===e&&(e={}),e[c]=d,l(a,b,e)},o=function(a,b,c){var d=m(a,b);return null!==d&&(d=c in d?d[c]:null),d},p=function(a,b,c){var d=m(a,b);if(null!==d&&c in d){delete d[c];var e=!0;for(var f in d){e=!1;break}e&&(d=null),l(a,b,d)}},q=function(a,b){l(a,b,null)},r=function(a,b,c){var d,e=null;void 0===c&&(c=["web","flash"]);var f=!1,g=null;for(var h in c){d=c[h];try{if("flash"===d||"both"===d){if(null===b[0])throw Error("Flash local storage not available.");e=a.apply(this,b),f="flash"===d}("web"===d||"both"===d)&&(b[0]=localStorage,e=a.apply(this,b),f=!0)}catch(a){g=a}if(f)break}if(!f)throw g;return e};f.setItem=function(a,b,c,d,e){r(n,arguments,e)},f.getItem=function(a,b,c,d){return r(o,arguments,d)},f.removeItem=function(a,b,c,d){r(p,arguments,d)},f.clearItems=function(a,b,c){r(q,arguments,c)},f.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},f.format=function(a){for(var b,c,d=/%./g,e=0,f=[],g=0;b=d.exec(a);){(c=a.substring(g,d.lastIndex-2)).length>0&&f.push(c),g=d.lastIndex;var h=b[0][1];switch(h){case"s":case"o":e<arguments.length?f.push(arguments[e+++1]):f.push("<?>");break;case"%":f.push("%");break;default:f.push("<%"+h+"?>")}}return f.push(a.substring(g)),f.join("")},f.formatNumber=function(a,b,c,d){var e=a,f=isNaN(b=Math.abs(b))?2:b,g=void 0===d?".":d,h=e<0?"-":"",i=parseInt(e=Math.abs(+e||0).toFixed(f),10)+"",j=i.length>3?i.length%3:0;return h+(j?i.substr(0,j)+g:"")+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+g)+(f?(void 0===c?",":c)+Math.abs(e-i).toFixed(f).slice(2):"")},f.formatSize=function(a){return a>=0x40000000?f.formatNumber(a/0x40000000,2,".","")+" GiB":a>=1048576?f.formatNumber(a/1048576,2,".","")+" MiB":a>=1024?f.formatNumber(a/1024,0)+" KiB":f.formatNumber(a,0)+" bytes"},f.bytesFromIP=function(a){return -1!==a.indexOf(".")?f.bytesFromIPv4(a):-1!==a.indexOf(":")?f.bytesFromIPv6(a):null},f.bytesFromIPv4=function(a){if(4!==(a=a.split(".")).length)return null;for(var b=f.createBuffer(),c=0;c<a.length;++c){var d=parseInt(a[c],10);if(isNaN(d))return null;b.putByte(d)}return b.getBytes()},f.bytesFromIPv6=function(a){for(var b=0,c=(8-(a=a.split(":").filter(function(a){return 0===a.length&&++b,!0})).length+b)*2,d=f.createBuffer(),e=0;e<8;++e){if(!a[e]||0===a[e].length){d.fillWithByte(0,c),c=0;continue}var g=f.hexToBytes(a[e]);g.length<2&&d.putByte(0),d.putBytes(g)}return d.getBytes()},f.bytesToIP=function(a){return 4===a.length?f.bytesToIPv4(a):16===a.length?f.bytesToIPv6(a):null},f.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b.join(".")},f.bytesToIPv6=function(a){if(16!==a.length)return null;for(var b=[],c=[],d=0,e=0;e<a.length;e+=2){for(var g=f.bytesToHex(a[e]+a[e+1]);"0"===g[0]&&"0"!==g;)g=g.substr(1);if("0"===g){var h=c[c.length-1],i=b.length;h&&i===h.end+1?(h.end=i,h.end-h.start>c[d].end-c[d].start&&(d=c.length-1)):c.push({start:i,end:i})}b.push(g)}if(c.length>0){var j=c[d];j.end-j.start>0&&(b.splice(j.start,j.end-j.start+1,""),0===j.start&&b.unshift(""),7===j.end&&b.push(""))}return b.join(":")},f.estimateCores=function(a,b){if("function"==typeof a&&(b=a,a={}),a=a||{},"cores"in f&&!a.update)return b(null,f.cores);if("u">typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return f.cores=navigator.hardwareConcurrency,b(null,f.cores);if("u"<typeof Worker)return f.cores=1,b(null,f.cores);if("u"<typeof Blob)return f.cores=2,b(null,f.cores);var c=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(a){for(var b=Date.now(),c=b+4;Date.now()<c;);self.postMessage({st:b,et:c})})}).toString(),")()"],{type:"application/javascript"}));!function a(d,e,g){if(0===e)return f.cores=Math.max(1,Math.floor(d.reduce(function(a,b){return a+b},0)/d.length)),URL.revokeObjectURL(c),b(null,f.cores);!function(a,b){for(var d=[],e=[],f=0;f<a;++f){var g=new Worker(c);g.addEventListener("message",function(c){if(e.push(c.data),e.length===a){for(var f=0;f<a;++f)d[f].terminate();b(null,e)}}),d.push(g)}for(var f=0;f<a;++f)d[f].postMessage(f)}(g,function(b,c){d.push(function(a,b){for(var c=[],d=0;d<a;++d)for(var e=b[d],f=c[d]=[],g=0;g<a;++g)if(d!==g){var h=b[g];(e.st>h.st&&e.st<h.et||h.st>e.st&&h.st<e.et)&&f.push(g)}return c.reduce(function(a,b){return Math.max(a,b.length)},0)}(g,c)),a(d,e-1,g)})}([],5,16)}},36105:(a,b,c)=>{var d=c(45654);d.pki=d.pki||{};var e=a.exports=d.pki.oids=d.oids=d.oids||{};function f(a,b){e[a]=b,e[b]=a}f("1.2.840.113549.1.1.1","rsaEncryption"),f("1.2.840.113549.1.1.4","md5WithRSAEncryption"),f("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),f("1.2.840.113549.1.1.7","RSAES-OAEP"),f("1.2.840.113549.1.1.8","mgf1"),f("1.2.840.113549.1.1.9","pSpecified"),f("1.2.840.113549.1.1.10","RSASSA-PSS"),f("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),f("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),f("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),f("1.3.101.112","EdDSA25519"),f("1.2.840.10040.4.3","dsa-with-sha1"),f("1.3.14.3.2.7","desCBC"),f("1.3.14.3.2.26","sha1"),f("1.3.14.3.2.29","sha1WithRSASignature"),f("2.16.840.1.101.3.4.2.1","sha256"),f("2.16.840.1.101.3.4.2.2","sha384"),f("2.16.840.1.101.3.4.2.3","sha512"),f("2.16.840.1.101.3.4.2.4","sha224"),f("2.16.840.1.101.3.4.2.5","sha512-224"),f("2.16.840.1.101.3.4.2.6","sha512-256"),f("1.2.840.113549.2.2","md2"),f("1.2.840.113549.2.5","md5"),f("1.2.840.113549.1.7.1","data"),f("1.2.840.113549.1.7.2","signedData"),f("1.2.840.113549.1.7.3","envelopedData"),f("1.2.840.113549.1.7.4","signedAndEnvelopedData"),f("1.2.840.113549.1.7.5","digestedData"),f("1.2.840.113549.1.7.6","encryptedData"),f("1.2.840.113549.1.9.1","emailAddress"),f("1.2.840.113549.1.9.2","unstructuredName"),f("1.2.840.113549.1.9.3","contentType"),f("1.2.840.113549.1.9.4","messageDigest"),f("1.2.840.113549.1.9.5","signingTime"),f("1.2.840.113549.1.9.6","counterSignature"),f("1.2.840.113549.1.9.7","challengePassword"),f("1.2.840.113549.1.9.8","unstructuredAddress"),f("1.2.840.113549.1.9.14","extensionRequest"),f("1.2.840.113549.1.9.20","friendlyName"),f("1.2.840.113549.1.9.21","localKeyId"),f("1.2.840.113549.1.9.22.1","x509Certificate"),f("1.2.840.113549.1.12.10.1.1","keyBag"),f("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),f("1.2.840.113549.1.12.10.1.3","certBag"),f("1.2.840.113549.1.12.10.1.4","crlBag"),f("1.2.840.113549.1.12.10.1.5","secretBag"),f("1.2.840.113549.1.12.10.1.6","safeContentsBag"),f("1.2.840.113549.1.5.13","pkcs5PBES2"),f("1.2.840.113549.1.5.12","pkcs5PBKDF2"),f("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),f("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),f("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),f("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),f("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),f("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),f("1.2.840.113549.2.7","hmacWithSHA1"),f("1.2.840.113549.2.8","hmacWithSHA224"),f("1.2.840.113549.2.9","hmacWithSHA256"),f("1.2.840.113549.2.10","hmacWithSHA384"),f("1.2.840.113549.2.11","hmacWithSHA512"),f("1.2.840.113549.3.7","des-EDE3-CBC"),f("2.16.840.1.101.3.4.1.2","aes128-CBC"),f("2.16.840.1.101.3.4.1.22","aes192-CBC"),f("2.16.840.1.101.3.4.1.42","aes256-CBC"),f("2.5.4.3","commonName"),f("2.5.4.4","surname"),f("2.5.4.5","serialNumber"),f("2.5.4.6","countryName"),f("2.5.4.7","localityName"),f("2.5.4.8","stateOrProvinceName"),f("2.5.4.9","streetAddress"),f("2.5.4.10","organizationName"),f("2.5.4.11","organizationalUnitName"),f("2.5.4.12","title"),f("2.5.4.13","description"),f("2.5.4.15","businessCategory"),f("2.5.4.17","postalCode"),f("2.5.4.42","givenName"),f("2.5.4.65","pseudonym"),f("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),f("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),f("2.16.840.1.113730.1.1","nsCertType"),f("2.16.840.1.113730.1.13","nsComment"),e["2.5.29.1"]="authorityKeyIdentifier",e["2.5.29.2"]="keyAttributes",e["2.5.29.3"]="certificatePolicies",e["2.5.29.4"]="keyUsageRestriction",e["2.5.29.5"]="policyMapping",e["2.5.29.6"]="subtreesConstraint",e["2.5.29.7"]="subjectAltName",e["2.5.29.8"]="issuerAltName",e["2.5.29.9"]="subjectDirectoryAttributes",e["2.5.29.10"]="basicConstraints",e["2.5.29.11"]="nameConstraints",e["2.5.29.12"]="policyConstraints",e["2.5.29.13"]="basicConstraints",f("2.5.29.14","subjectKeyIdentifier"),f("2.5.29.15","keyUsage"),e["2.5.29.16"]="privateKeyUsagePeriod",f("2.5.29.17","subjectAltName"),f("2.5.29.18","issuerAltName"),f("2.5.29.19","basicConstraints"),e["2.5.29.20"]="cRLNumber",e["2.5.29.21"]="cRLReason",e["2.5.29.22"]="expirationDate",e["2.5.29.23"]="instructionCode",e["2.5.29.24"]="invalidityDate",e["2.5.29.25"]="cRLDistributionPoints",e["2.5.29.26"]="issuingDistributionPoint",e["2.5.29.27"]="deltaCRLIndicator",e["2.5.29.28"]="issuingDistributionPoint",e["2.5.29.29"]="certificateIssuer",e["2.5.29.30"]="nameConstraints",f("2.5.29.31","cRLDistributionPoints"),f("2.5.29.32","certificatePolicies"),e["2.5.29.33"]="policyMappings",e["2.5.29.34"]="policyConstraints",f("2.5.29.35","authorityKeyIdentifier"),e["2.5.29.36"]="policyConstraints",f("2.5.29.37","extKeyUsage"),e["2.5.29.46"]="freshestCRL",e["2.5.29.54"]="inhibitAnyPolicy",f("1.3.6.1.4.1.11129.2.4.2","timestampList"),f("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),f("1.3.6.1.5.5.7.3.1","serverAuth"),f("1.3.6.1.5.5.7.3.2","clientAuth"),f("1.3.6.1.5.5.7.3.3","codeSigning"),f("1.3.6.1.5.5.7.3.4","emailProtection"),f("1.3.6.1.5.5.7.3.8","timeStamping")},36902:(a,b,c)=>{var d=c(45654);c(33889),c(32e3),c(29984),function(){if(d.prime){a.exports=d.prime;return}var b=a.exports=d.prime=d.prime||{},c=d.jsbn.BigInteger,e=[6,4,2,4,2,4,6,2],f=new c(null);f.fromInt(30);var g=function(a,b){return a|b};function h(a,b,c,f){var g,h=i(a,b),j=(g=h.bitLength())<=100?27:g<=150?18:g<=200?15:g<=250?12:g<=300?9:g<=350?8:g<=400?7:g<=500?6:g<=600?5:g<=800?4:g<=1250?3:2;"millerRabinTests"in c&&(j=c.millerRabinTests);var k=10;"maxBlockTime"in c&&(k=c.maxBlockTime),function a(b,c,f,g,h,j,k){var l=+new Date;do{if(b.bitLength()>c&&(b=i(c,f)),b.isProbablePrime(h))return k(null,b);b.dAddOffset(e[g++%8],0)}while(j<0||new Date-l<j);d.util.setImmediate(function(){a(b,c,f,g,h,j,k)})}(h,a,b,0,j,k,f)}function i(a,b){var d=new c(a,b),e=a-1;return d.testBit(e)||d.bitwiseTo(c.ONE.shiftLeft(e),g,d),d.dAddOffset(31-d.mod(f).byteValue(),0),d}b.generateProbablePrime=function(a,b,e){"function"==typeof b&&(e=b,b={});var f,g,j,k,l=(b=b||{}).algorithm||"PRIMEINC";"string"==typeof l&&(l={name:l}),l.options=l.options||{};var m=b.prng||d.random;if("PRIMEINC"===l.name){return f=a,g={nextBytes:function(a){for(var b=m.getBytesSync(a.length),c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}},j=l.options,k=e,"workers"in j?function(a,b,e,f){if("u"<typeof Worker)return h(a,b,e,f);var g=i(a,b),j=e.workers,k=e.workLoad||100,l=30*k/8,m=e.workerScript||"forge/prime.worker.js";if(-1===j)return d.util.estimateCores(function(a,b){a&&(b=2),j=b-1,n()});function n(){j=Math.max(1,j);for(var d=[],e=0;e<j;++e)d[e]=new Worker(m);for(var h=j,e=0;e<j;++e)d[e].addEventListener("message",o);var n=!1;function o(e){if(!n){--h;var j=e.data;if(j.found){for(var m=0;m<d.length;++m)d[m].terminate();return n=!0,f(null,new c(j.prime,16))}g.bitLength()>a&&(g=i(a,b));var o=g.toString(16);e.target.postMessage({hex:o,workLoad:k}),g.dAddOffset(l,0)}}}n()}(f,g,j,k):h(f,g,j,k)}throw Error("Invalid prime generation algorithm: "+l.name)}}()},37436:(a,b,c)=>{"use strict";let d=c(29021),e=c(33873),f=c(21820),g="bluerouter";function h(){return"win32"===process.platform?e.join(process.env.APPDATA||e.join(f.homedir(),"AppData","Roaming"),g):e.join(f.homedir(),`.${g}`)}let i=function(){let a=process.env.DATA_DIR;if(!a)return h();try{return d.mkdirSync(a,{recursive:!0}),a}catch(b){if(b?.code==="EACCES"||b?.code==="EPERM")return console.warn(`[DATA_DIR] '${a}' not writable → fallback ~/.${g}`),h();throw b}}(),j=e.join(i,"mitm");a.exports={DATA_DIR:i,MITM_DIR:j}},37691:(a,b,c)=>{var d=c(45654);c(1277),c(33889);var e=a.exports=d.sha512=d.sha512||{};d.md.sha512=d.md.algorithms.sha512=e;var f=d.sha384=d.sha512.sha384=d.sha512.sha384||{};f.create=function(){return e.create("SHA-384")},d.md.sha384=d.md.algorithms.sha384=f,d.sha512.sha256=d.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},d.md["sha512/256"]=d.md.algorithms["sha512/256"]=d.sha512.sha256,d.sha512.sha224=d.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},d.md["sha512/224"]=d.md.algorithms["sha512/224"]=d.sha512.sha224,e.create=function(a){if(h||(g=String.fromCharCode(128)+d.util.fillString("\0",128),i=[[0x428a2f98,0xd728ae22],[0x71374491,0x23ef65cd],[0xb5c0fbcf,0xec4d3b2f],[0xe9b5dba5,0x8189dbbc],[0x3956c25b,0xf348b538],[0x59f111f1,0xb605d019],[0x923f82a4,0xaf194f9b],[0xab1c5ed5,0xda6d8118],[0xd807aa98,0xa3030242],[0x12835b01,0x45706fbe],[0x243185be,0x4ee4b28c],[0x550c7dc3,0xd5ffb4e2],[0x72be5d74,0xf27b896f],[0x80deb1fe,0x3b1696b1],[0x9bdc06a7,0x25c71235],[0xc19bf174,0xcf692694],[0xe49b69c1,0x9ef14ad2],[0xefbe4786,0x384f25e3],[0xfc19dc6,0x8b8cd5b5],[0x240ca1cc,0x77ac9c65],[0x2de92c6f,0x592b0275],[0x4a7484aa,0x6ea6e483],[0x5cb0a9dc,0xbd41fbd4],[0x76f988da,0x831153b5],[0x983e5152,0xee66dfab],[0xa831c66d,0x2db43210],[0xb00327c8,0x98fb213f],[0xbf597fc7,0xbeef0ee4],[0xc6e00bf3,0x3da88fc2],[0xd5a79147,0x930aa725],[0x6ca6351,0xe003826f],[0x14292967,0xa0e6e70],[0x27b70a85,0x46d22ffc],[0x2e1b2138,0x5c26c926],[0x4d2c6dfc,0x5ac42aed],[0x53380d13,0x9d95b3df],[0x650a7354,0x8baf63de],[0x766a0abb,0x3c77b2a8],[0x81c2c92e,0x47edaee6],[0x92722c85,0x1482353b],[0xa2bfe8a1,0x4cf10364],[0xa81a664b,0xbc423001],[0xc24b8b70,0xd0f89791],[0xc76c51a3,0x654be30],[0xd192e819,0xd6ef5218],[0xd6990624,0x5565a910],[0xf40e3585,0x5771202a],[0x106aa070,0x32bbd1b8],[0x19a4c116,0xb8d2d0c8],[0x1e376c08,0x5141ab53],[0x2748774c,0xdf8eeb99],[0x34b0bcb5,0xe19b48a8],[0x391c0cb3,0xc5c95a63],[0x4ed8aa4a,0xe3418acb],[0x5b9cca4f,0x7763e373],[0x682e6ff3,0xd6b2b8a3],[0x748f82ee,0x5defb2fc],[0x78a5636f,0x43172f60],[0x84c87814,0xa1f0ab72],[0x8cc70208,0x1a6439ec],[0x90befffa,0x23631e28],[0xa4506ceb,0xde82bde9],[0xbef9a3f7,0xb2c67915],[0xc67178f2,0xe372532b],[0xca273ece,0xea26619c],[0xd186b8c7,0x21c0c207],[0xeada7dd6,0xcde0eb1e],[0xf57d4f7f,0xee6ed178],[0x6f067aa,0x72176fba],[0xa637dc5,0xa2c898a6],[0x113f9804,0xbef90dae],[0x1b710b35,0x131c471b],[0x28db77f5,0x23047d84],[0x32caab7b,0x40c72493],[0x3c9ebe0a,0x15c9bebc],[0x431d67c4,0x9c100d4c],[0x4cc5d4be,0xcb3e42b6],[0x597f299c,0xfc657e2a],[0x5fcb6fab,0x3ad6faec],[0x6c44198c,0x4a475817]],(j={})["SHA-512"]=[[0x6a09e667,0xf3bcc908],[0xbb67ae85,0x84caa73b],[0x3c6ef372,0xfe94f82b],[0xa54ff53a,0x5f1d36f1],[0x510e527f,0xade682d1],[0x9b05688c,0x2b3e6c1f],[0x1f83d9ab,0xfb41bd6b],[0x5be0cd19,0x137e2179]],j["SHA-384"]=[[0xcbbb9d5d,0xc1059ed8],[0x629a292a,0x367cd507],[0x9159015a,0x3070dd17],[0x152fecd8,0xf70e5939],[0x67332667,0xffc00b31],[0x8eb44a87,0x68581511],[0xdb0c2e0d,0x64f98fa7],[0x47b5481d,0xbefa4fa4]],j["SHA-512/256"]=[[0x22312194,0xfc2bf72c],[0x9f555fa3,0xc84c64c2],[0x2393b86b,0x6f53b151],[0x96387719,0x5940eabd],[0x96283ee2,0xa88effe3],[0xbe5e1e25,0x53863992],[0x2b0199fc,0x2c85b8aa],[0xeb72ddc,0x81c52ca2]],j["SHA-512/224"]=[[0x8c3d37c8,0x19544da2],[0x73e19966,0x89dcd4d6],[0x1dfab7ae,0x32ff9c82],[0x679dd514,0x582f9fcf],[0xf6d2b69,0x7bd44da8],[0x77e36f73,0x4c48942],[0x3f9d85a8,0x6a1d36c8],[0x1112e6ad,0x91d692a1]],h=!0),void 0===a&&(a="SHA-512"),!(a in j))throw Error("Invalid SHA-512 algorithm: "+a);for(var b=j[a],c=null,e=d.util.createBuffer(),f=Array(80),l=0;l<80;++l)f[l]=[,,];var m=64;switch(a){case"SHA-384":m=48;break;case"SHA-512/256":m=32;break;case"SHA-512/224":m=28}var n={algorithm:a.replace("-","").toLowerCase(),blockLength:128,digestLength:m,messageLength:0,fullMessageLength:null,messageLengthSize:16};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength128=[];for(var a=n.messageLengthSize/4,f=0;f<a;++f)n.fullMessageLength.push(0);e=d.util.createBuffer(),c=Array(b.length);for(var f=0;f<b.length;++f)c[f]=b[f].slice(0);return n},n.start(),n.update=function(a,b){"utf8"===b&&(a=d.util.encodeUtf8(a));var g=a.length;n.messageLength+=g,g=[g/0x100000000>>>0,g>>>0];for(var h=n.fullMessageLength.length-1;h>=0;--h)n.fullMessageLength[h]+=g[1],g[1]=g[0]+(n.fullMessageLength[h]/0x100000000>>>0),n.fullMessageLength[h]=n.fullMessageLength[h]>>>0,g[0]=g[1]/0x100000000>>>0;return e.putBytes(a),k(c,f,e),(e.read>2048||0===e.length())&&e.compact(),n},n.digest=function(){var b,h,i=d.util.createBuffer();i.putBytes(e.bytes());var j=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;i.putBytes(g.substr(0,n.blockLength-j));for(var l=8*n.fullMessageLength[0],m=0;m<n.fullMessageLength.length-1;++m)l+=(b=8*n.fullMessageLength[m+1])/0x100000000>>>0,i.putInt32(l>>>0),l=b>>>0;i.putInt32(l);for(var o=Array(c.length),m=0;m<c.length;++m)o[m]=c[m].slice(0);k(o,f,i);var p=d.util.createBuffer();h="SHA-512"===a?o.length:"SHA-384"===a?o.length-2:o.length-4;for(var m=0;m<h;++m)p.putInt32(o[m][0]),(m!==h-1||"SHA-512/224"!==a)&&p.putInt32(o[m][1]);return p},n};var g=null,h=!1,i=null,j=null;function k(a,b,c){for(var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N=c.length();N>=128;){for(G=0;G<16;++G)b[G][0]=c.getInt32()>>>0,b[G][1]=c.getInt32()>>>0;for(;G<80;++G)d=(((H=(J=b[G-2])[0])>>>19|(I=J[1])<<13)^(I>>>29|H<<3)^H>>>6)>>>0,e=((H<<13|I>>>19)^(I<<3|H>>>29)^(H<<26|I>>>6))>>>0,f=(((H=(L=b[G-15])[0])>>>1|(I=L[1])<<31)^(H>>>8|I<<24)^H>>>7)>>>0,g=((H<<31|I>>>1)^(H<<24|I>>>8)^(H<<25|I>>>7))>>>0,K=b[G-7],M=b[G-16],I=e+K[1]+g+M[1],b[G][0]=d+K[0]+f+M[0]+(I/0x100000000>>>0)>>>0,b[G][1]=I>>>0;for(q=a[0][0],r=a[0][1],s=a[1][0],t=a[1][1],u=a[2][0],v=a[2][1],w=a[3][0],x=a[3][1],y=a[4][0],z=a[4][1],A=a[5][0],B=a[5][1],C=a[6][0],D=a[6][1],E=a[7][0],F=a[7][1],G=0;G<80;++G)k=((y>>>14|z<<18)^(y>>>18|z<<14)^(z>>>9|y<<23))>>>0,l=((y<<18|z>>>14)^(y<<14|z>>>18)^(z<<23|y>>>9))>>>0,m=(C^y&(A^C))>>>0,n=(D^z&(B^D))>>>0,h=((q>>>28|r<<4)^(r>>>2|q<<30)^(r>>>7|q<<25))>>>0,j=((q<<4|r>>>28)^(r<<30|q>>>2)^(r<<25|q>>>7))>>>0,o=(q&s|u&(q^s))>>>0,p=(r&t|v&(r^t))>>>0,I=F+l+n+i[G][1]+b[G][1],d=E+k+m+i[G][0]+b[G][0]+(I/0x100000000>>>0)>>>0,e=I>>>0,f=h+o+((I=j+p)/0x100000000>>>0)>>>0,g=I>>>0,E=C,F=D,C=A,D=B,A=y,B=z,y=w+d+((I=x+e)/0x100000000>>>0)>>>0,z=I>>>0,w=u,x=v,u=s,v=t,s=q,t=r,q=d+f+((I=e+g)/0x100000000>>>0)>>>0,r=I>>>0;I=a[0][1]+r,a[0][0]=a[0][0]+q+(I/0x100000000>>>0)>>>0,a[0][1]=I>>>0,I=a[1][1]+t,a[1][0]=a[1][0]+s+(I/0x100000000>>>0)>>>0,a[1][1]=I>>>0,I=a[2][1]+v,a[2][0]=a[2][0]+u+(I/0x100000000>>>0)>>>0,a[2][1]=I>>>0,I=a[3][1]+x,a[3][0]=a[3][0]+w+(I/0x100000000>>>0)>>>0,a[3][1]=I>>>0,I=a[4][1]+z,a[4][0]=a[4][0]+y+(I/0x100000000>>>0)>>>0,a[4][1]=I>>>0,I=a[5][1]+B,a[5][0]=a[5][0]+A+(I/0x100000000>>>0)>>>0,a[5][1]=I>>>0,I=a[6][1]+D,a[6][0]=a[6][0]+C+(I/0x100000000>>>0)>>>0,a[6][1]=I>>>0,I=a[7][1]+F,a[7][0]=a[7][0]+E+(I/0x100000000>>>0)>>>0,a[7][1]=I>>>0,N-=128}}},38627:(a,b,c)=>{var d=c(45654);c(1277),c(33889);var e=a.exports=d.md5=d.md5||{};d.md.md5=d.md.algorithms.md5=e,e.create=function(){j||function(){f=String.fromCharCode(128)+d.util.fillString("\0",64),g=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],h=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],i=Array(64);for(var a=0;a<64;++a)i[a]=Math.floor(0x100000000*Math.abs(Math.sin(a+1)));j=!0}();var a=null,b=d.util.createBuffer(),c=Array(16),e={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return e.start=function(){e.messageLength=0,e.fullMessageLength=e.messageLength64=[];for(var c=e.messageLengthSize/4,f=0;f<c;++f)e.fullMessageLength.push(0);return b=d.util.createBuffer(),a={h0:0x67452301,h1:0xefcdab89,h2:0x98badcfe,h3:0x10325476},e},e.start(),e.update=function(f,g){"utf8"===g&&(f=d.util.encodeUtf8(f));var h=f.length;e.messageLength+=h,h=[h/0x100000000>>>0,h>>>0];for(var i=e.fullMessageLength.length-1;i>=0;--i)e.fullMessageLength[i]+=h[1],h[1]=h[0]+(e.fullMessageLength[i]/0x100000000>>>0),e.fullMessageLength[i]=e.fullMessageLength[i]>>>0,h[0]=h[1]/0x100000000>>>0;return b.putBytes(f),k(a,c,b),(b.read>2048||0===b.length())&&b.compact(),e},e.digest=function(){var g=d.util.createBuffer();g.putBytes(b.bytes());var h=e.fullMessageLength[e.fullMessageLength.length-1]+e.messageLengthSize&e.blockLength-1;g.putBytes(f.substr(0,e.blockLength-h));for(var i,j=0,l=e.fullMessageLength.length-1;l>=0;--l)j=(i=8*e.fullMessageLength[l]+j)/0x100000000>>>0,g.putInt32Le(i>>>0);var m={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3};k(m,c,g);var n=d.util.createBuffer();return n.putInt32Le(m.h0),n.putInt32Le(m.h1),n.putInt32Le(m.h2),n.putInt32Le(m.h3),n},e};var f=null,g=null,h=null,i=null,j=!1;function k(a,b,c){for(var d,e,f,j,k,l,m,n,o=c.length();o>=64;){for(e=a.h0,f=a.h1,j=a.h2,k=a.h3,n=0;n<16;++n)b[n]=c.getInt32Le(),d=e+(k^f&(j^k))+i[n]+b[n],m=h[n],e=k,k=j,j=f,f+=d<<m|d>>>32-m;for(;n<32;++n)d=e+(j^k&(f^j))+i[n]+b[g[n]],m=h[n],e=k,k=j,j=f,f+=d<<m|d>>>32-m;for(;n<48;++n)d=e+(f^j^k)+i[n]+b[g[n]],m=h[n],e=k,k=j,j=f,f+=d<<m|d>>>32-m;for(;n<64;++n)d=e+(j^(f|~k))+i[n]+b[g[n]],m=h[n],e=k,k=j,j=f,f+=d<<m|d>>>32-m;a.h0=a.h0+e|0,a.h1=a.h1+f|0,a.h2=a.h2+j|0,a.h3=a.h3+k|0,o-=64}}},39804:(a,b,c)=>{var d=c(45654);c(45518),c(27080);var e=a.exports=d.tls;function f(a,b,c){var f=b.entity===d.tls.ConnectionEnd.client;a.read.cipherState={init:!1,cipher:d.cipher.createDecipher("AES-CBC",f?c.keys.server_write_key:c.keys.client_write_key),iv:f?c.keys.server_write_IV:c.keys.client_write_IV},a.write.cipherState={init:!1,cipher:d.cipher.createCipher("AES-CBC",f?c.keys.client_write_key:c.keys.server_write_key),iv:f?c.keys.client_write_IV:c.keys.server_write_IV},a.read.cipherFunction=j,a.write.cipherFunction=g,a.read.macLength=a.write.macLength=c.mac_length,a.read.macFunction=a.write.macFunction=e.hmac_sha1}function g(a,b){var c,f=!1,g=b.macFunction(b.macKey,b.sequenceNumber,a);a.fragment.putBytes(g),b.updateSequenceNumber(),c=a.version.minor===e.Versions.TLS_1_0.minor?b.cipherState.init?null:b.cipherState.iv:d.random.getBytesSync(16),b.cipherState.init=!0;var i=b.cipherState.cipher;return i.start({iv:c}),a.version.minor>=e.Versions.TLS_1_1.minor&&i.output.putBytes(c),i.update(a.fragment),i.finish(h)&&(a.fragment=i.output,a.length=a.fragment.length(),f=!0),f}function h(a,b,c){if(!c){var d=a-b.length()%a;b.fillWithByte(d-1,d)}return!0}function i(a,b,c){var d=!0;if(c){for(var e=b.length(),f=b.last(),g=e-1-f;g<e-1;++g)d=d&&b.at(g)==f;d&&b.truncate(f+1)}return d}function j(a,b){var c,f,g,h,j,k=!1;j=a.version.minor===e.Versions.TLS_1_0.minor?b.cipherState.init?null:b.cipherState.iv:a.fragment.getBytes(16),b.cipherState.init=!0;var l=b.cipherState.cipher;l.start({iv:j}),l.update(a.fragment),k=l.finish(i);var m=b.macLength,n=d.random.getBytesSync(m),o=l.output.length();o>=m?(a.fragment=l.output.getBytes(o-m),n=l.output.getBytes(m)):a.fragment=l.output.getBytes(),a.fragment=d.util.createBuffer(a.fragment),a.length=a.fragment.length();var p=b.macFunction(b.macKey,b.sequenceNumber,a);return b.updateSequenceNumber(),k=(c=b.macKey,f=n,g=p,(h=d.hmac.create()).start("SHA1",c),h.update(f),f=h.digest().getBytes(),h.start(null,null),h.update(g),f===(g=h.digest().getBytes())&&k)}e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,a.cipher_type=e.CipherType.block,a.enc_key_length=16,a.block_length=16,a.fixed_iv_length=16,a.record_iv_length=16,a.mac_algorithm=e.MACAlgorithm.hmac_sha1,a.mac_length=20,a.mac_key_length=20},initConnectionState:f},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,a.cipher_type=e.CipherType.block,a.enc_key_length=32,a.block_length=16,a.fixed_iv_length=16,a.record_iv_length=16,a.mac_algorithm=e.MACAlgorithm.hmac_sha1,a.mac_length=20,a.mac_key_length=20},initConnectionState:f}},41702:(a,b,c)=>{var d=c(45654);c(33889),d.mgf=d.mgf||{},(a.exports=d.mgf.mgf1=d.mgf1=d.mgf1||{}).create=function(a){return{generate:function(b,c){for(var e=new d.util.ByteBuffer,f=Math.ceil(c/a.digestLength),g=0;g<f;g++){var h=new d.util.ByteBuffer;h.putInt32(g),a.start(),a.update(b+h.getBytes()),e.putBuffer(a.digest())}return e.truncate(e.length()-c),e.getBytes()}}}},42947:(a,b,c)=>{"use strict";let d=c(29021),e=c(33873),{DATA_DIR:f}=c(37436),{normalizeAllowedClientIps:g}=c(54584),h=e.join(f,"audit-gateway"),i=e.join(h,"config.json"),j=e.join(h,"audit.jsonl"),k=e.join(h,"logs"),l=Object.freeze({enabled:!1,bindHost:"127.0.0.1",port:3128,clientProxyHost:"",clientIpFilterEnabled:!1,allowedClientIps:[],allowedHosts:["api.anthropic.com","*.anthropic.com","claude.ai","*.claude.ai","api.openai.com","*.openai.com","chatgpt.com","*.chatgpt.com"],passthroughUnknown:!0,captureBodies:!0,captureLimitBytes:2097152,retentionDays:7,verifyUpstreamTls:!0,connectTimeoutMs:1e4,tlsHandshakeTimeoutMs:1e4,responseHeaderTimeoutMs:3e4,idleTimeoutMs:9e5,shutdownGraceMs:1500,allowPlainHttp:!1,allowedConnectPorts:[443]});function m(){return{...l,allowedClientIps:[...l.allowedClientIps],allowedHosts:[...l.allowedHosts],allowedConnectPorts:[...l.allowedConnectPorts]}}function n(){d.mkdirSync(h,{recursive:!0}),d.mkdirSync(k,{recursive:!0})}function o(a){return[...new Set((Array.isArray(a)?a:String(a||"").split(/[\r\n,]+/)).map(a=>String(a||"").trim().toLowerCase()).filter(Boolean).filter(a=>!a.includes("://")&&/^[*a-z0-9._-]+$/.test(a)))]}function p(a,b,c,d,e){let f=null==a?b:Number(a);if(!Number.isInteger(f)||f<c||f>d)throw Error(`${e} must be between ${c} and ${d}`);return f}function q(a={}){let b={...l,...a},c=p(b.port,l.port,1,65535,"Proxy port"),d=Number(b.captureLimitBytes);if(!Number.isFinite(d)||d<0||d>0x1000000)throw Error("Capture limit must be between 0 and 16 MB");let e=p(b.retentionDays,l.retentionDays,1,365,"Retention days"),f=p(b.connectTimeoutMs,l.connectTimeoutMs,1e3,12e4,"Connect timeout"),h=p(b.tlsHandshakeTimeoutMs,l.tlsHandshakeTimeoutMs,1e3,12e4,"TLS handshake timeout"),i=p(b.responseHeaderTimeoutMs,l.responseHeaderTimeoutMs,1e3,3e5,"Response header timeout"),j=p(b.idleTimeoutMs,l.idleTimeoutMs,3e4,36e5,"Idle timeout"),k=p(b.shutdownGraceMs,l.shutdownGraceMs,0,3e4,"Shutdown grace period"),m=String(b.bindHost||"127.0.0.1").trim();if(!m||/\s/.test(m))throw Error("Invalid bind address");let n=String(b.clientProxyHost||"").trim();if(/\s/.test(n)||n.includes("://"))throw Error("Client proxy host must be a hostname or IP without protocol");let r=!0===b.clientIpFilterEnabled,s=g(b.allowedClientIps);if(r&&0===s.length)throw Error("Client IP filter requires at least one allowed IP or CIDR");return{enabled:!0===b.enabled,bindHost:m,port:c,clientProxyHost:n,clientIpFilterEnabled:r,allowedClientIps:s,allowedHosts:o(b.allowedHosts),passthroughUnknown:!1!==b.passthroughUnknown,captureBodies:!1!==b.captureBodies,captureLimitBytes:Math.round(d),retentionDays:e,verifyUpstreamTls:!0,connectTimeoutMs:f,tlsHandshakeTimeoutMs:h,responseHeaderTimeoutMs:i,idleTimeoutMs:j,shutdownGraceMs:k,allowPlainHttp:!1,allowedConnectPorts:[443]}}a.exports={AUDIT_DIR:h,CONFIG_PATH:i,AUDIT_LOG_PATH:j,AUDIT_LOG_DIR:k,DEFAULT_CONFIG:l,ensureAuditDir:n,loadConfig:function(){if(n(),!d.existsSync(i))return m();try{return q(JSON.parse(d.readFileSync(i,"utf8")))}catch(a){return console.warn(`[audit-proxy] invalid config ignored: ${a.message||a}`),m()}},saveConfig:function(a){n();let b=q(a),c=`${i}.tmp`;return d.writeFileSync(c,`${JSON.stringify(b,null,2)}
|
|
24
|
-
`,{mode:384}),d.renameSync(c,i),b},validateConfig:q,normalizeAllowedHosts:o,normalizeAllowedClientIps:g}},45518:(a,b,c)=>{var d,e,f,g,h,i=c(45654);function j(a,b){i.cipher.registerAlgorithm(a,function(){return new i.aes.Algorithm(a,b)})}c(66568),c(19396),c(33889),a.exports=i.aes=i.aes||{},i.aes.startEncrypting=function(a,b,c,d){var e=o({key:a,output:c,decrypt:!1,mode:d});return e.start(b),e},i.aes.createEncryptionCipher=function(a,b){return o({key:a,output:null,decrypt:!1,mode:b})},i.aes.startDecrypting=function(a,b,c,d){var e=o({key:a,output:c,decrypt:!0,mode:d});return e.start(b),e},i.aes.createDecryptionCipher=function(a,b){return o({key:a,output:null,decrypt:!0,mode:b})},i.aes.Algorithm=function(a,b){k||l();var c=this;c.name=a,c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return n(c._w,a,b,!1)},decrypt:function(a,b){return n(c._w,a,b,!0)}}}),c._init=!1},i.aes.Algorithm.prototype.initialize=function(a){if(!this._init){var b,c=a.key;if("string"==typeof c&&(16===c.length||24===c.length||32===c.length))c=i.util.createBuffer(c);else if(i.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){b=c,c=i.util.createBuffer();for(var d=0;d<b.length;++d)c.putByte(b[d])}if(!i.util.isArray(c)){b=c,c=[];var e=b.length();if(16===e||24===e||32===e){e>>>=2;for(var d=0;d<e;++d)c.push(b.getInt32())}}if(!i.util.isArray(c)||4!==c.length&&6!==c.length&&8!==c.length)throw Error("Invalid key parameter.");var f=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=m(c,a.decrypt&&!f),this._init=!0}},i.aes._expandKey=function(a,b){return k||l(),m(a,b)},i.aes._updateBlock=n,j("AES-ECB",i.cipher.modes.ecb),j("AES-CBC",i.cipher.modes.cbc),j("AES-CFB",i.cipher.modes.cfb),j("AES-OFB",i.cipher.modes.ofb),j("AES-CTR",i.cipher.modes.ctr),j("AES-GCM",i.cipher.modes.gcm);var k=!1;function l(){k=!0,f=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;b<128;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;d=Array(256),e=Array(256),g=[,,,,],h=[,,,,];for(var b=0;b<4;++b)g[b]=Array(256),h[b]=Array(256);for(var c,i,j,l,m,n,o,p=0,q=0,b=0;b<256;++b){l=(l=q^q<<1^q<<2^q<<3^q<<4)>>8^255&l^99,d[p]=l,e[l]=p,m=a[l],c=a[p],i=a[c],j=a[i],n=m<<24^l<<16^l<<8^(l^m),o=(c^i^j)<<24^(p^j)<<16^(p^i^j)<<8^(p^c^j);for(var r=0;r<4;++r)g[r][p]=n,h[r][l]=o,n=n<<24|n>>>8,o=o<<24|o>>>8;0===p?p=q=1:(p=c^a[a[a[c^j]]],q^=a[a[q]])}}function m(a,b){for(var c,e=a.slice(0),g=1,i=e.length,j=4*(i+6+1),k=i;k<j;++k)c=e[k-1],k%i==0?(c=d[c>>>16&255]<<24^d[c>>>8&255]<<16^d[255&c]<<8^d[c>>>24]^f[g]<<24,g++):i>6&&k%i==4&&(c=d[c>>>24]<<24^d[c>>>16&255]<<16^d[c>>>8&255]<<8^d[255&c]),e[k]=e[k-i]^c;if(b){var l,m=h[0],n=h[1],o=h[2],p=h[3],q=e.slice(0);j=e.length;for(var k=0,r=j-4;k<j;k+=4,r-=4)if(0===k||k===j-4)q[k]=e[r],q[k+1]=e[r+3],q[k+2]=e[r+2],q[k+3]=e[r+1];else for(var s=0;s<4;++s)l=e[r+s],q[k+(3&-s)]=m[d[l>>>24]]^n[d[l>>>16&255]]^o[d[l>>>8&255]]^p[d[255&l]];e=q}return e}function n(a,b,c,f){var i,j,k,l,m,n,o,p,q,r,s,t,u=a.length/4-1;f?(i=h[0],j=h[1],k=h[2],l=h[3],m=e):(i=g[0],j=g[1],k=g[2],l=g[3],m=d),n=b[0]^a[0],o=b[f?3:1]^a[1],p=b[2]^a[2],q=b[f?1:3]^a[3];for(var v=3,w=1;w<u;++w)r=i[n>>>24]^j[o>>>16&255]^k[p>>>8&255]^l[255&q]^a[++v],s=i[o>>>24]^j[p>>>16&255]^k[q>>>8&255]^l[255&n]^a[++v],t=i[p>>>24]^j[q>>>16&255]^k[n>>>8&255]^l[255&o]^a[++v],q=i[q>>>24]^j[n>>>16&255]^k[o>>>8&255]^l[255&p]^a[++v],n=r,o=s,p=t;c[0]=m[n>>>24]<<24^m[o>>>16&255]<<16^m[p>>>8&255]<<8^m[255&q]^a[++v],c[f?3:1]=m[o>>>24]<<24^m[p>>>16&255]<<16^m[q>>>8&255]<<8^m[255&n]^a[++v],c[2]=m[p>>>24]<<24^m[q>>>16&255]<<16^m[n>>>8&255]<<8^m[255&o]^a[++v],c[f?1:3]=m[q>>>24]<<24^m[n>>>16&255]<<16^m[o>>>8&255]<<8^m[255&p]^a[++v]}function o(a){var b,c="AES-"+((a=a||{}).mode||"CBC").toUpperCase(),d=(b=a.decrypt?i.cipher.createDecipher(c,a.key):i.cipher.createCipher(c,a.key)).start;return b.start=function(a,c){var e=null;c instanceof i.util.ByteBuffer&&(e=c,c={}),(c=c||{}).output=e,c.iv=a,d.call(b,c)},b}},45654:a=>{a.exports={options:{usePureJavaScript:!1}}},49345:(a,b,c)=>{var d=c(45654);c(33889);var e=a.exports=d.pem=d.pem||{};function f(a){for(var b=a.name+": ",c=[],d=function(a,b){return" "+b},e=0;e<a.values.length;++e)c.push(a.values[e].replace(/^(\S+\r\n)/,d));b+=c.join(",")+"\r\n";for(var f=0,g=-1,e=0;e<b.length;++e,++f)if(f>65&&-1!==g){var h=b[g];","===h?(++g,b=b.substr(0,g)+"\r\n "+b.substr(g)):b=b.substr(0,g)+"\r\n"+h+b.substr(g+1),f=e-g-1,g=-1,++e}else(" "===b[e]||" "===b[e]||","===b[e])&&(g=e);return b}e.encode=function(a,b){b=b||{};var c,e="-----BEGIN "+a.type+"-----\r\n";if(a.procType&&(e+=f(c={name:"Proc-Type",values:[String(a.procType.version),a.procType.type]})),a.contentDomain&&(e+=f(c={name:"Content-Domain",values:[a.contentDomain]})),a.dekInfo&&(c={name:"DEK-Info",values:[a.dekInfo.algorithm]},a.dekInfo.parameters&&c.values.push(a.dekInfo.parameters),e+=f(c)),a.headers)for(var g=0;g<a.headers.length;++g)e+=f(a.headers[g]);return a.procType&&(e+="\r\n"),e+=d.util.encode64(a.body,b.maxline||64)+"\r\n",e+="-----END "+a.type+"-----\r\n"},e.decode=function(a){for(var b,c=[],e=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,f=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/;b=e.exec(a);){var h=b[1];"NEW CERTIFICATE REQUEST"===h&&(h="CERTIFICATE REQUEST");var i={type:h,procType:null,contentDomain:null,dekInfo:null,headers:[],body:d.util.decode64(b[3])};if(c.push(i),b[2]){for(var j=b[2].split(g),k=0;b&&k<j.length;){for(var l=j[k].replace(/\s+$/,""),m=k+1;m<j.length;++m){var n=j[m];if(!/\s/.test(n[0]))break;l+=n,k=m}if(b=l.match(f)){for(var o={name:b[1],values:[]},p=b[2].split(","),q=0;q<p.length;++q)o.values.push(p[q].replace(/^\s+/,""));if(i.procType)if(i.contentDomain||"Content-Domain"!==o.name)if(i.dekInfo||"DEK-Info"!==o.name)i.headers.push(o);else{if(0===o.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');i.dekInfo={algorithm:p[0],parameters:p[1]||null}}else i.contentDomain=p[0]||"";else{if("Proc-Type"!==o.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==o.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');i.procType={version:p[0],type:p[1]}}}++k}if("ENCRYPTED"===i.procType&&!i.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===c.length)throw Error("Invalid PEM formatted message.");return c}},54584:(a,b,c)=>{"use strict";let d=c(91645);function e(a){let b=String(a||"").trim().toLowerCase();b.startsWith("[")&&b.endsWith("]")&&(b=b.slice(1,-1));let c=b.indexOf("%");return c>=0&&(b=b.slice(0,c)),b.startsWith("::ffff:")&&4===d.isIP(b.slice(7))&&(b=b.slice(7)),b}function f(a){return Buffer.from(a.split(".").map(a=>Number(a)))}function g(a,b){return 4===b?f(a):function(a){let b=e(a),c=b.lastIndexOf(":");if(c>=0){let a=b.slice(c+1);if(4===d.isIP(a)){let d=f(a),e=(d[0]<<8|d[1]).toString(16),g=(d[2]<<8|d[3]).toString(16);b=`${b.slice(0,c)}:${e}:${g}`}}let g=b.split("::");if(g.length>2)throw Error("Invalid IPv6 address");let h=g[0]?g[0].split(":").filter(Boolean):[],i=2===g.length&&g[1]?g[1].split(":").filter(Boolean):[],j=8-h.length-i.length;if(1===g.length&&0!==j||j<0)throw Error("Invalid IPv6 address");let k=2===g.length?[...h,...Array(j).fill("0"),...i]:h;if(8!==k.length)throw Error("Invalid IPv6 address");let l=Buffer.alloc(16);return k.forEach((a,b)=>{let c=Number.parseInt(a||"0",16);if(!Number.isInteger(c)||c<0||c>65535)throw Error("Invalid IPv6 address");l[2*b]=c>>8&255,l[2*b+1]=255&c}),l}(a)}function h(a){let b=String(a||"").trim();if(!b)throw Error("Empty IP rule");let c=b.indexOf("/"),f=e(c>=0?b.slice(0,c):b),g=d.isIP(f);if(!g)throw Error(`Invalid client IP/CIDR: ${b}`);let h=4===g?32:128,i=c>=0?Number(b.slice(c+1)):h;if(!Number.isInteger(i)||i<0||i>h)throw Error(`Invalid CIDR prefix: ${b}`);return{text:c>=0?`${f}/${i}`:f,ip:f,family:g,prefix:i}}a.exports={normalizeIp:e,parseIpRule:h,normalizeAllowedClientIps:function(a){let b=Array.isArray(a)?a:String(a||"").split(/[\r\n,]+/),c=[],d=new Set;for(let a of b){let b=String(a||"").trim();if(!b)continue;let e=h(b);d.has(e.text)||(d.add(e.text),c.push(e.text))}return c},clientIpMatches:function(a,b=[]){let c=e(a),f=d.isIP(c);if(!f)return!1;let i=g(c,f);for(let a of b||[]){let b;try{b=h(a)}catch{continue}if(b.family===f&&function(a,b,c){let d=Math.floor(c/8),e=c%8;for(let c=0;c<d;c+=1)if(a[c]!==b[c])return!1;if(!e)return!0;let f=255<<8-e&255;return(a[d]&f)==(b[d]&f)}(i,g(b.ip,b.family),b.prefix))return!0}return!1}}},56416:(a,b,c)=>{var d=c(45654);c(63070),c(33889);var e=d.asn1,f=a.exports=d.pkcs7asn1=d.pkcs7asn1||{};d.pkcs7=d.pkcs7||{},d.pkcs7.asn1=f;var g={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};f.contentInfoValidator=g;var h={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};f.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(h)},f.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(h)};var i={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};f.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},g,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[i]}]},f.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},62952:(a,b,c)=>{"use strict";let d=c(29021),e=c(33873),f=c(4984),g=c(55511),{AUDIT_LOG_PATH:h,AUDIT_LOG_DIR:i,ensureAuditDir:j,loadConfig:k}=c(42947),{redactObject:l,scrubString:m}=c(14681),n="audit-proxy",o={expiresAt:0,config:null},p=null,q=null,r="",s=Promise.resolve(),t=Promise.resolve(),u=0,v=null,w=new Map,x={queue:[],workers:new Set,activeWorkers:0,clearing:!1,enqueued:0,written:0,dropped:0,failed:0,mysqlWritten:0,mysqlFailed:0,lastError:null,lastWrittenAt:null};function y(a){let b=Date.now();b-u<6e4||(u=b,console.warn(`[AuditProxy][PromptDB] ${a}`))}function z(a){x.lastError=String(a||"Audit store failure"),console.warn(`[AuditProxy][Store] ${x.lastError}`)}async function A(){let a=Date.now();if(o.expiresAt>a)return o.config;p||(p=Promise.all([c.e(689),c.e(3960)]).then(c.bind(c,41170)));let b=await p,d=await b.getPromptLogDbConfig();return o={expiresAt:a+5e3,config:d},d}async function B(a){let b=g.createHash("sha256").update(JSON.stringify({host:a.host,port:Number(a.port||3306),database:a.database,username:a.username,password:a.password,ssl:!!a.ssl})).digest("hex");if(q&&r===b)return q;let d=s.then(async()=>{if(q&&r===b)return q;if(q){try{await q.end()}catch{}q=null,r=""}let d=await c.e(4790).then(c.t.bind(c,94790,19)),e=(d.default||d).createPool({host:a.host,port:Number(a.port||3306),database:a.database,user:a.username,password:a.password,ssl:a.ssl?{rejectUnauthorized:!0}:void 0,connectTimeout:3e3,waitForConnections:!0,connectionLimit:4,maxIdle:4,idleTimeout:6e4,queueLimit:100,enableKeepAlive:!0,keepAliveInitialDelay:3e4});return q=e,r=b,e});return s=d.then(()=>void 0,()=>void 0),d}function C(a){if("string"!=typeof a)return a;let b=a.trim();if(!b||!b.startsWith("{")&&!b.startsWith("["))return a;try{return JSON.parse(b)}catch{return a}}function D(a,b=0,c=[]){if(null==a||b>12||c.join("\n").length>=2e5)return c;if("string"==typeof a)return a.trim()&&c.push(a.trim()),c;if(Array.isArray(a)){for(let d of a)D(d,b+1,c);return c}if("object"!=typeof a)return c;for(let[d,e]of Object.entries(a)){let a=d.toLowerCase();["content","text","prompt","input","message","output_text"].includes(a)?D(e,b+1,c):b<8&&["messages","contents","parts","body","request","payload","response","choices","output","item","items"].includes(a)&&D(e,b+1,c)}return c}async function E(a,b,c,d){if(!c)return null;let e=g.createHash("sha256").update(c).digest("hex"),f=Buffer.byteLength(String(c||""),"utf8");return await a.query(`INSERT INTO prompt_log_payloads (
|
|
24
|
+
`,{mode:384}),d.renameSync(c,i),b},validateConfig:q,normalizeAllowedHosts:o,normalizeAllowedClientIps:g}},45518:(a,b,c)=>{var d,e,f,g,h,i=c(45654);function j(a,b){i.cipher.registerAlgorithm(a,function(){return new i.aes.Algorithm(a,b)})}c(66568),c(19396),c(33889),a.exports=i.aes=i.aes||{},i.aes.startEncrypting=function(a,b,c,d){var e=o({key:a,output:c,decrypt:!1,mode:d});return e.start(b),e},i.aes.createEncryptionCipher=function(a,b){return o({key:a,output:null,decrypt:!1,mode:b})},i.aes.startDecrypting=function(a,b,c,d){var e=o({key:a,output:c,decrypt:!0,mode:d});return e.start(b),e},i.aes.createDecryptionCipher=function(a,b){return o({key:a,output:null,decrypt:!0,mode:b})},i.aes.Algorithm=function(a,b){k||l();var c=this;c.name=a,c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return n(c._w,a,b,!1)},decrypt:function(a,b){return n(c._w,a,b,!0)}}}),c._init=!1},i.aes.Algorithm.prototype.initialize=function(a){if(!this._init){var b,c=a.key;if("string"==typeof c&&(16===c.length||24===c.length||32===c.length))c=i.util.createBuffer(c);else if(i.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){b=c,c=i.util.createBuffer();for(var d=0;d<b.length;++d)c.putByte(b[d])}if(!i.util.isArray(c)){b=c,c=[];var e=b.length();if(16===e||24===e||32===e){e>>>=2;for(var d=0;d<e;++d)c.push(b.getInt32())}}if(!i.util.isArray(c)||4!==c.length&&6!==c.length&&8!==c.length)throw Error("Invalid key parameter.");var f=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=m(c,a.decrypt&&!f),this._init=!0}},i.aes._expandKey=function(a,b){return k||l(),m(a,b)},i.aes._updateBlock=n,j("AES-ECB",i.cipher.modes.ecb),j("AES-CBC",i.cipher.modes.cbc),j("AES-CFB",i.cipher.modes.cfb),j("AES-OFB",i.cipher.modes.ofb),j("AES-CTR",i.cipher.modes.ctr),j("AES-GCM",i.cipher.modes.gcm);var k=!1;function l(){k=!0,f=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;b<128;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;d=Array(256),e=Array(256),g=[,,,,],h=[,,,,];for(var b=0;b<4;++b)g[b]=Array(256),h[b]=Array(256);for(var c,i,j,l,m,n,o,p=0,q=0,b=0;b<256;++b){l=(l=q^q<<1^q<<2^q<<3^q<<4)>>8^255&l^99,d[p]=l,e[l]=p,m=a[l],c=a[p],i=a[c],j=a[i],n=m<<24^l<<16^l<<8^(l^m),o=(c^i^j)<<24^(p^j)<<16^(p^i^j)<<8^(p^c^j);for(var r=0;r<4;++r)g[r][p]=n,h[r][l]=o,n=n<<24|n>>>8,o=o<<24|o>>>8;0===p?p=q=1:(p=c^a[a[a[c^j]]],q^=a[a[q]])}}function m(a,b){for(var c,e=a.slice(0),g=1,i=e.length,j=4*(i+6+1),k=i;k<j;++k)c=e[k-1],k%i==0?(c=d[c>>>16&255]<<24^d[c>>>8&255]<<16^d[255&c]<<8^d[c>>>24]^f[g]<<24,g++):i>6&&k%i==4&&(c=d[c>>>24]<<24^d[c>>>16&255]<<16^d[c>>>8&255]<<8^d[255&c]),e[k]=e[k-i]^c;if(b){var l,m=h[0],n=h[1],o=h[2],p=h[3],q=e.slice(0);j=e.length;for(var k=0,r=j-4;k<j;k+=4,r-=4)if(0===k||k===j-4)q[k]=e[r],q[k+1]=e[r+3],q[k+2]=e[r+2],q[k+3]=e[r+1];else for(var s=0;s<4;++s)l=e[r+s],q[k+(3&-s)]=m[d[l>>>24]]^n[d[l>>>16&255]]^o[d[l>>>8&255]]^p[d[255&l]];e=q}return e}function n(a,b,c,f){var i,j,k,l,m,n,o,p,q,r,s,t,u=a.length/4-1;f?(i=h[0],j=h[1],k=h[2],l=h[3],m=e):(i=g[0],j=g[1],k=g[2],l=g[3],m=d),n=b[0]^a[0],o=b[f?3:1]^a[1],p=b[2]^a[2],q=b[f?1:3]^a[3];for(var v=3,w=1;w<u;++w)r=i[n>>>24]^j[o>>>16&255]^k[p>>>8&255]^l[255&q]^a[++v],s=i[o>>>24]^j[p>>>16&255]^k[q>>>8&255]^l[255&n]^a[++v],t=i[p>>>24]^j[q>>>16&255]^k[n>>>8&255]^l[255&o]^a[++v],q=i[q>>>24]^j[n>>>16&255]^k[o>>>8&255]^l[255&p]^a[++v],n=r,o=s,p=t;c[0]=m[n>>>24]<<24^m[o>>>16&255]<<16^m[p>>>8&255]<<8^m[255&q]^a[++v],c[f?3:1]=m[o>>>24]<<24^m[p>>>16&255]<<16^m[q>>>8&255]<<8^m[255&n]^a[++v],c[2]=m[p>>>24]<<24^m[q>>>16&255]<<16^m[n>>>8&255]<<8^m[255&o]^a[++v],c[f?1:3]=m[q>>>24]<<24^m[n>>>16&255]<<16^m[o>>>8&255]<<8^m[255&p]^a[++v]}function o(a){var b,c="AES-"+((a=a||{}).mode||"CBC").toUpperCase(),d=(b=a.decrypt?i.cipher.createDecipher(c,a.key):i.cipher.createCipher(c,a.key)).start;return b.start=function(a,c){var e=null;c instanceof i.util.ByteBuffer&&(e=c,c={}),(c=c||{}).output=e,c.iv=a,d.call(b,c)},b}},45654:a=>{a.exports={options:{usePureJavaScript:!1}}},49345:(a,b,c)=>{var d=c(45654);c(33889);var e=a.exports=d.pem=d.pem||{};function f(a){for(var b=a.name+": ",c=[],d=function(a,b){return" "+b},e=0;e<a.values.length;++e)c.push(a.values[e].replace(/^(\S+\r\n)/,d));b+=c.join(",")+"\r\n";for(var f=0,g=-1,e=0;e<b.length;++e,++f)if(f>65&&-1!==g){var h=b[g];","===h?(++g,b=b.substr(0,g)+"\r\n "+b.substr(g)):b=b.substr(0,g)+"\r\n"+h+b.substr(g+1),f=e-g-1,g=-1,++e}else(" "===b[e]||" "===b[e]||","===b[e])&&(g=e);return b}e.encode=function(a,b){b=b||{};var c,e="-----BEGIN "+a.type+"-----\r\n";if(a.procType&&(e+=f(c={name:"Proc-Type",values:[String(a.procType.version),a.procType.type]})),a.contentDomain&&(e+=f(c={name:"Content-Domain",values:[a.contentDomain]})),a.dekInfo&&(c={name:"DEK-Info",values:[a.dekInfo.algorithm]},a.dekInfo.parameters&&c.values.push(a.dekInfo.parameters),e+=f(c)),a.headers)for(var g=0;g<a.headers.length;++g)e+=f(a.headers[g]);return a.procType&&(e+="\r\n"),e+=d.util.encode64(a.body,b.maxline||64)+"\r\n",e+="-----END "+a.type+"-----\r\n"},e.decode=function(a){for(var b,c=[],e=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,f=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/;b=e.exec(a);){var h=b[1];"NEW CERTIFICATE REQUEST"===h&&(h="CERTIFICATE REQUEST");var i={type:h,procType:null,contentDomain:null,dekInfo:null,headers:[],body:d.util.decode64(b[3])};if(c.push(i),b[2]){for(var j=b[2].split(g),k=0;b&&k<j.length;){for(var l=j[k].replace(/\s+$/,""),m=k+1;m<j.length;++m){var n=j[m];if(!/\s/.test(n[0]))break;l+=n,k=m}if(b=l.match(f)){for(var o={name:b[1],values:[]},p=b[2].split(","),q=0;q<p.length;++q)o.values.push(p[q].replace(/^\s+/,""));if(i.procType)if(i.contentDomain||"Content-Domain"!==o.name)if(i.dekInfo||"DEK-Info"!==o.name)i.headers.push(o);else{if(0===o.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');i.dekInfo={algorithm:p[0],parameters:p[1]||null}}else i.contentDomain=p[0]||"";else{if("Proc-Type"!==o.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==o.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');i.procType={version:p[0],type:p[1]}}}++k}if("ENCRYPTED"===i.procType&&!i.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===c.length)throw Error("Invalid PEM formatted message.");return c}},54584:(a,b,c)=>{"use strict";let d=c(91645);function e(a){let b=String(a||"").trim().toLowerCase();b.startsWith("[")&&b.endsWith("]")&&(b=b.slice(1,-1));let c=b.indexOf("%");return c>=0&&(b=b.slice(0,c)),b.startsWith("::ffff:")&&4===d.isIP(b.slice(7))&&(b=b.slice(7)),b}function f(a){return Buffer.from(a.split(".").map(a=>Number(a)))}function g(a,b){return 4===b?f(a):function(a){let b=e(a),c=b.lastIndexOf(":");if(c>=0){let a=b.slice(c+1);if(4===d.isIP(a)){let d=f(a),e=(d[0]<<8|d[1]).toString(16),g=(d[2]<<8|d[3]).toString(16);b=`${b.slice(0,c)}:${e}:${g}`}}let g=b.split("::");if(g.length>2)throw Error("Invalid IPv6 address");let h=g[0]?g[0].split(":").filter(Boolean):[],i=2===g.length&&g[1]?g[1].split(":").filter(Boolean):[],j=8-h.length-i.length;if(1===g.length&&0!==j||j<0)throw Error("Invalid IPv6 address");let k=2===g.length?[...h,...Array(j).fill("0"),...i]:h;if(8!==k.length)throw Error("Invalid IPv6 address");let l=Buffer.alloc(16);return k.forEach((a,b)=>{let c=Number.parseInt(a||"0",16);if(!Number.isInteger(c)||c<0||c>65535)throw Error("Invalid IPv6 address");l[2*b]=c>>8&255,l[2*b+1]=255&c}),l}(a)}function h(a){let b=String(a||"").trim();if(!b)throw Error("Empty IP rule");let c=b.indexOf("/"),f=e(c>=0?b.slice(0,c):b),g=d.isIP(f);if(!g)throw Error(`Invalid client IP/CIDR: ${b}`);let h=4===g?32:128,i=c>=0?Number(b.slice(c+1)):h;if(!Number.isInteger(i)||i<0||i>h)throw Error(`Invalid CIDR prefix: ${b}`);return{text:c>=0?`${f}/${i}`:f,ip:f,family:g,prefix:i}}a.exports={normalizeIp:e,parseIpRule:h,normalizeAllowedClientIps:function(a){let b=Array.isArray(a)?a:String(a||"").split(/[\r\n,]+/),c=[],d=new Set;for(let a of b){let b=String(a||"").trim();if(!b)continue;let e=h(b);d.has(e.text)||(d.add(e.text),c.push(e.text))}return c},clientIpMatches:function(a,b=[]){let c=e(a),f=d.isIP(c);if(!f)return!1;let i=g(c,f);for(let a of b||[]){let b;try{b=h(a)}catch{continue}if(b.family===f&&function(a,b,c){let d=Math.floor(c/8),e=c%8;for(let c=0;c<d;c+=1)if(a[c]!==b[c])return!1;if(!e)return!0;let f=255<<8-e&255;return(a[d]&f)==(b[d]&f)}(i,g(b.ip,b.family),b.prefix))return!0}return!1}}},56416:(a,b,c)=>{var d=c(45654);c(63070),c(33889);var e=d.asn1,f=a.exports=d.pkcs7asn1=d.pkcs7asn1||{};d.pkcs7=d.pkcs7||{},d.pkcs7.asn1=f;var g={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};f.contentInfoValidator=g;var h={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};f.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(h)},f.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(h)};var i={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};f.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},g,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[i]}]},f.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},62952:(a,b,c)=>{"use strict";let d=c(29021),e=c(33873),f=c(4984),g=c(55511),{AUDIT_LOG_PATH:h,AUDIT_LOG_DIR:i,ensureAuditDir:j,loadConfig:k}=c(42947),{redactObject:l,scrubString:m}=c(14681),n="audit-proxy",o="client",p="provider_response",q={expiresAt:0,config:null},r=null,s=null,t="",u=Promise.resolve(),v=Promise.resolve(),w=0,x=null,y=new Map,z={queue:[],workers:new Set,activeWorkers:0,clearing:!1,enqueued:0,written:0,dropped:0,failed:0,mysqlWritten:0,mysqlFailed:0,lastError:null,lastWrittenAt:null};function A(a){let b=Date.now();b-w<6e4||(w=b,console.warn(`[AuditProxy][PromptDB] ${a}`))}function B(a){z.lastError=String(a||"Audit store failure"),console.warn(`[AuditProxy][Store] ${z.lastError}`)}async function C(){let a=Date.now();if(q.expiresAt>a)return q.config;r||(r=Promise.all([c.e(689),c.e(3960)]).then(c.bind(c,41170)));let b=await r,d=await b.getPromptLogDbConfig();return q={expiresAt:a+5e3,config:d},d}async function D(a){let b=g.createHash("sha256").update(JSON.stringify({host:a.host,port:Number(a.port||3306),database:a.database,username:a.username,password:a.password,ssl:!!a.ssl})).digest("hex");if(s&&t===b)return s;let d=u.then(async()=>{if(s&&t===b)return s;if(s){try{await s.end()}catch{}s=null,t=""}let d=await c.e(4790).then(c.t.bind(c,94790,19)),e=(d.default||d).createPool({host:a.host,port:Number(a.port||3306),database:a.database,user:a.username,password:a.password,ssl:a.ssl?{rejectUnauthorized:!0}:void 0,connectTimeout:3e3,waitForConnections:!0,connectionLimit:4,maxIdle:4,idleTimeout:6e4,queueLimit:100,enableKeepAlive:!0,keepAliveInitialDelay:3e4});return s=e,t=b,e});return u=d.then(()=>void 0,()=>void 0),d}function E(a){let b=a?new Date(a):new Date;return(Number.isNaN(b.getTime())?new Date:b).toISOString().replace("T"," ").replace("Z","")}function F(a){if("string"!=typeof a)return a;let b=a.trim();if(!b||!b.startsWith("{")&&!b.startsWith("["))return a;try{return JSON.parse(b)}catch{return a}}function G(a,b=0,c=[]){if(null==a||b>12||c.join("\n").length>=2e5)return c;if("string"==typeof a)return a.trim()&&c.push(a.trim()),c;if(Array.isArray(a)){for(let d of a)G(d,b+1,c);return c}if("object"!=typeof a)return c;for(let[d,e]of Object.entries(a)){let a=d.toLowerCase();["content","text","prompt","input","message","output_text"].includes(a)?G(e,b+1,c):b<8&&["messages","contents","parts","body","request","payload","response","choices","output","item","items"].includes(a)&&G(e,b+1,c)}return c}async function H(a,b,c,d){if(!c)return null;let e=g.createHash("sha256").update(c).digest("hex"),f=Buffer.byteLength(String(c||""),"utf8");return await a.query(`INSERT INTO prompt_log_payloads (
|
|
25
25
|
payload_hash, created_at, last_seen_at, content_type, payload_size_bytes, ref_count, payload_json
|
|
26
26
|
) VALUES (?, ?, ?, ?, ?, 1, CAST(? AS JSON))
|
|
27
27
|
ON DUPLICATE KEY UPDATE
|
|
@@ -31,21 +31,21 @@ ${d}`)}catch{try{a.destroy()}catch{}}}function F(a={}){let b={};for(let[c,d]of O
|
|
|
31
31
|
WHEN content_type = VALUES(content_type) THEN content_type
|
|
32
32
|
WHEN content_type IS NULL OR content_type = '' THEN VALUES(content_type)
|
|
33
33
|
ELSE content_type
|
|
34
|
-
END`,[e,b,b,d,f,c]),{payloadHash:e,payloadSizeBytes:f}}async function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`,c=Buffer.byteLength(b),e=await
|
|
44
|
-
`)}catch{}await new Promise((a,b)=>{e.end(a),e.once("error",b)}),await d.promises.rename(b,h)}async function
|
|
34
|
+
END`,[e,b,b,d,f,c]),{payloadHash:e,payloadSizeBytes:f}}async function I(a,b){await a.query(`INSERT INTO prompt_logs (
|
|
35
|
+
id, created_at, session_id, source_format, target_format, model,
|
|
36
|
+
endpoint, stage, provider_url, provider, account_name, connection_id, display_model,
|
|
37
|
+
client_ip, client_port, client_user_agent, client_host,
|
|
38
|
+
source_tool, source_tool_label, source_host, content_mode, payload_hash, payload_size_bytes,
|
|
39
|
+
response_payload_hash, response_payload_size_bytes,
|
|
40
|
+
prompt_text, full_request_json,
|
|
41
|
+
response_text, status_code, error_text, meta_json
|
|
42
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CAST(? AS JSON), ?, ?, ?, CAST(? AS JSON))`,[b.id,b.createdAt,b.sessionId,b.sourceFormat,b.targetFormat,b.model,b.endpoint,b.stage,b.providerUrl,b.provider,b.accountName,b.connectionId,b.displayModel,b.clientIp,b.clientPort,b.clientUserAgent,b.clientHost,b.sourceTool,b.sourceToolLabel,b.sourceHost,b.contentMode,b.payloadHash,b.payloadSizeBytes,b.responsePayloadHash,b.responsePayloadSizeBytes,b.promptText,b.fullRequestJson,b.responseText,b.statusCode,b.errorText,JSON.stringify(b.meta||{})])}async function J(a){let b=null;try{var c;let d,e,f,h,i=await C();if(!i?.enabled)return{written:!1,disabled:!0};if("mysql"!==String(i.type||"").toLowerCase())return A(`Audit mirroring requires MySQL; current type is ${i.type||"unknown"}`),{written:!1,unsupported:!0};let j=function(a){try{let b=JSON.parse(JSON.stringify(a??null)),c=l(b);return JSON.parse(m(JSON.stringify(c)))}catch{return m(String(a??""))}}(a),{requestPayload:k,responsePayload:q}=(d=j.request||{},e=j.response||{},{requestPayload:{timestamp:j.timestamp,protocol:j.protocol||"http/1.1",method:j.method,endpoint:j.path,headers:d.headers||{},body:F(d.body),capturedBytes:Number(d.capturedBytes||0),totalBytes:Number(d.totalBytes||0),wireSha256:d.wireSha256||null,truncated:!0===d.truncated},responsePayload:{timestamp:j.timestamp,protocol:j.protocol||"http/1.1",status:j.status,headers:e.headers||{},body:F(e.body),capturedBytes:Number(e.capturedBytes||0),totalBytes:Number(e.totalBytes||0),wireSha256:e.wireSha256||null,truncated:!0===e.truncated}}),r=JSON.stringify(k),s=JSON.stringify(q),t=Math.max(0,Number(j.durationMs||0)),u=new Date(j.timestamp||Date.now()),v=Number.isNaN(u.getTime())?new Date:u,w=new Date(v.getTime()-t),x=E(w),y=E(v),z=(c=j.client?.userAgent,(f=String(c||"").toLowerCase()).includes("claude")?{tool:"claude-code",label:"Claude Code"}:f.includes("codex")?{tool:"codex",label:"Codex"}:{tool:"audit-proxy",label:"Enterprise AI Audit Proxy"}),B=String(j.provider||"other"),J=j.model?String(j.model):null,K=String(j.host||""),L=Number(j.port||443),M=String(j.path||""),N=K?`https://${K}${443!==L?`:${L}`:""}${M}`:null,O=await D(i);b=await O.getConnection(),await b.beginTransaction();let P=await H(b,x,r,"request_json"),Q=await H(b,y,s,"response_json"),R={source:n,auditEventId:j.id||null,protocol:j.protocol||"http/1.1",host:K||null,port:L,method:j.method||null,path:M||null,durationMs:t,requestCapturedBytes:Number(j.request?.capturedBytes||0),requestTotalBytes:Number(j.request?.totalBytes||0),requestWireSha256:j.request?.wireSha256||null,requestTruncated:j.request?.truncated===!0,responseCapturedBytes:Number(j.response?.capturedBytes||0),responseTotalBytes:Number(j.response?.totalBytes||0),responseWireSha256:j.response?.wireSha256||null,responseTruncated:j.response?.truncated===!0,payloadHash:P?.payloadHash||null,payloadSizeBytes:P?.payloadSizeBytes||0,payloadStorage:P?"prompt_log_payloads":null,responsePayloadHash:Q?.payloadHash||null,responsePayloadSizeBytes:Q?.payloadSizeBytes||0,responsePayloadStorage:Q?"prompt_log_payloads":null},S=String(j.id||g.randomUUID()),T={sessionId:`audit-${S}`,sourceFormat:B,targetFormat:B,model:J,endpoint:M||null,providerUrl:N,provider:B,accountName:null,connectionId:null,displayModel:J?`${B}/${J}`:null,clientIp:j.client?.ip||null,clientPort:j.client?.port!=null?String(j.client.port):null,clientUserAgent:j.client?.userAgent||null,clientHost:K||null,sourceTool:z.tool,sourceToolLabel:z.label,sourceHost:K||null};return await I(b,{...T,id:`${S}:request`,createdAt:x,stage:o,contentMode:j.request?.body?"raw_json_preview":"metadata_only",payloadHash:P?.payloadHash||null,payloadSizeBytes:P?.payloadSizeBytes||0,responsePayloadHash:null,responsePayloadSizeBytes:0,promptText:(h=G(k?.body??k??{}).join("\n\n"))?h.slice(0,2e3):null,fullRequestJson:null,responseText:null,statusCode:null,errorText:null,meta:{...R,auditDirection:"request"}}),await I(b,{...T,id:`${S}:response`,createdAt:y,stage:p,contentMode:j.response?.body?"raw_json_preview":"metadata_only",payloadHash:null,payloadSizeBytes:0,responsePayloadHash:Q?.payloadHash||null,responsePayloadSizeBytes:Q?.payloadSizeBytes||0,promptText:null,fullRequestJson:null,responseText:function(a){let b=a?.body;if("string"==typeof b)return b.slice(0,2e3)||null;let c=G(b??a??{}).join("\n\n");return c?c.slice(0,2e3):null}(q),statusCode:null!=j.status?Number(j.status):null,errorText:j.error||null,meta:{...R,auditDirection:"response"}}),await b.commit(),{written:!0,rowsWritten:2}}catch(a){if(b)try{await b.rollback()}catch{}return A(`Failed to mirror audit event to prompt_logs: ${a.message||a}`),{written:!1,error:a.message||String(a)}}finally{try{b?.release()}catch{}}}async function K(a,b){let c;j();let f=(Number.isNaN((c=a?new Date(a):new Date).getTime())?new Date:c).toISOString().slice(0,10),g=y.get(f);if(!g){let a=await d.promises.readdir(i).catch(()=>[]),b=RegExp(`^audit-${f.replace(/-/g,"\\-")}(?:\\.(\\d+))?\\.jsonl$`),c=0;for(let d of a){let a=d.match(b);a&&(c=Math.max(c,Number(a[1]||0)))}let h=e.join(i,`audit-${f}${c?`.${c}`:""}.jsonl`),j=await d.promises.stat(h).catch(()=>null);g={segment:c,filePath:h,size:j?.size||0},y.set(f,g)}return g.size>0&&g.size+b>0x8000000&&(g={segment:g.segment+1,filePath:e.join(i,`audit-${f}.${g.segment+1}.jsonl`),size:0},y.set(f,g)),g}async function L(a){let b=`${JSON.stringify(a)}
|
|
43
|
+
`,c=Buffer.byteLength(b),e=await K(a.timestamp,c);return await d.promises.appendFile(e.filePath,b,{encoding:"utf8",mode:384}),e.size+=c,e.filePath}async function M(a){try{let b,c=await a.finalize(),d=(v=(b=v.then(()=>L(c))).then(()=>void 0,()=>void 0),b).catch(a=>(B(`Local JSONL write failed: ${a.message||a}`),null)),e=J(c),[,f]=await Promise.all([d,e]);f?.written?z.mysqlWritten+=1:f?.error&&(z.mysqlFailed+=1),z.written+=1,z.lastWrittenAt=new Date().toISOString()}catch(a){z.failed+=1,B(a.message||a)}}async function N(){z.activeWorkers+=1;try{for(;!z.clearing;){let a=z.queue.shift();if(!a)break;await M(a)}}finally{z.activeWorkers=Math.max(0,z.activeWorkers-1)}}function O(){if(!z.clearing)for(;z.queue.length&&z.activeWorkers<4;){let a;a=N().finally(()=>{z.workers.delete(a),!z.clearing&&z.queue.length&&setImmediate(O)}),z.workers.add(a)}}function P(a){return"function"==typeof a&&(z.queue.length>=1e3?(z.dropped+=1,B(`Audit queue full; dropped event ${z.dropped}`),!1):(z.queue.push({finalize:a,enqueuedAt:Date.now()}),z.enqueued+=1,z.clearing||setImmediate(O),!0))}async function Q(){j();let a=(await d.promises.readdir(i).catch(()=>[])).filter(a=>/^audit-\d{4}-\d{2}-\d{2}(?:\.\d+)?\.jsonl$/.test(a)).sort((a,b)=>b.localeCompare(a,void 0,{numeric:!0})).map(a=>e.join(i,a));return d.existsSync(h)&&a.push(h),a}async function R(a,b){let c=await d.promises.stat(a).catch(()=>null);if(!c?.size||b<=0)return[];let e=await d.promises.open(a,"r");try{let a=c.size,d=Buffer.alloc(0),f=0;for(;a>0&&d.length<0x4000000&&f<=b;){let b=Math.min(262144,a,0x4000000-d.length);a-=b;let c=Buffer.alloc(b);await e.read(c,0,b,a),d=Buffer.concat([c,d]),f+=c.reduce((a,b)=>a+ +(10===b),0)}let g=d.toString("utf8");if(a>0){let a=g.indexOf("\n");g=a>=0?g.slice(a+1):""}return g.split("\n").filter(Boolean).slice(-b).reverse().map(a=>{try{return JSON.parse(a)}catch{return null}}).filter(Boolean)}finally{await e.close()}}async function S(a=50){let b=Math.max(1,Math.min(1e3,Number(a)||50)),c=[];for(let a of(await Q())){if(c.length>=b)break;let d=await R(a,b-c.length);c.push(...d)}return c.slice(0,b)}async function T(a){if(!d.existsSync(h))return;let b=`${h}.tmp`,c=d.createReadStream(h,{encoding:"utf8"}),e=d.createWriteStream(b,{encoding:"utf8",mode:384});for await(let b of f.createInterface({input:c,crlfDelay:1/0}))if(b)try{let c=JSON.parse(b);Date.parse(c.timestamp||0)>=a&&e.write(`${b}
|
|
44
|
+
`)}catch{}await new Promise((a,b)=>{e.end(a),e.once("error",b)}),await d.promises.rename(b,h)}async function U(){j();let a=k(),b=Date.now()-24*a.retentionDays*36e5;for(let a of(await d.promises.readdir(i).catch(()=>[]))){if(!/^audit-\d{4}-\d{2}-\d{2}(?:\.\d+)?\.jsonl$/.test(a))continue;let c=e.join(i,a),f=await d.promises.stat(c).catch(()=>null);if(f&&f.mtimeMs<b)for(let[a,b]of(await d.promises.unlink(c).catch(()=>{}),y.entries()))b.filePath===c&&y.delete(a)}await T(b).catch(a=>B(`Legacy log prune failed: ${a.message||a}`))}async function V(a=5e3){let b=Date.now()+Math.max(0,Number(a)||0);for(;(z.queue.length||z.activeWorkers)&&Date.now()<b;){O();let a=[...z.workers];a.length?await Promise.race([Promise.allSettled(a),new Promise(a=>setTimeout(a,50))]):await new Promise(a=>setTimeout(a,10))}return 0===z.queue.length&&0===z.activeWorkers}async function W(){let a=null;try{let b=await C();if(!b?.enabled||"mysql"!==String(b.type||"").toLowerCase())return;let c=await D(b);a=await c.getConnection(),await a.beginTransaction();let d="(stage = ? OR (session_id LIKE 'audit-%' AND stage IN (?, ?)))",[e]=await a.query(`SELECT payload_hash, response_payload_hash FROM prompt_logs WHERE ${d}`,[n,o,p]);await a.query(`DELETE FROM prompt_logs WHERE ${d}`,[n,o,p]);let f=new Map;for(let a of e||[])for(let b of[a.payload_hash,a.response_payload_hash]){let a=String(b||"").trim();a&&f.set(a,(f.get(a)||0)+1)}for(let[b,c]of f.entries())await a.query("UPDATE prompt_log_payloads SET ref_count = GREATEST(ref_count - ?, 0) WHERE payload_hash = ?",[c,b]),await a.query(`DELETE p FROM prompt_log_payloads p
|
|
45
45
|
WHERE p.payload_hash = ?
|
|
46
46
|
AND p.last_seen_at < UTC_TIMESTAMP(3) - INTERVAL 5 MINUTE
|
|
47
47
|
AND NOT EXISTS (SELECT 1 FROM prompt_logs r WHERE r.payload_hash = p.payload_hash)
|
|
48
|
-
AND NOT EXISTS (SELECT 1 FROM prompt_logs r WHERE r.response_payload_hash = p.payload_hash)`,[b]);await a.commit()}catch(b){if(a)try{await a.rollback()}catch{}y(`Failed to clear mirrored audit rows: ${b.message||b}`)}finally{try{a?.release()}catch{}}}a.exports={appendAudit:function(a){return L(async()=>a)},enqueueAuditJob:L,readRecent:async function a(b=50){let c=Math.max(1,Math.min(1e3,Number(b)||50)),d=[];for(let a of(await M())){if(d.length>=c)break;let b=await N(a,c-d.length);d.push(...b)}return d.slice(0,c)},clearAudit:async function a(){x.clearing=!0,x.queue.length=0,x.workers.size&&await Promise.allSettled([...x.workers]),j();let a=await d.promises.readdir(i).catch(()=>[]);await Promise.all(a.filter(a=>a.endsWith(".jsonl")).map(a=>d.promises.unlink(e.join(i,a)).catch(()=>{}))),await d.promises.writeFile(h,"",{mode:384}).catch(()=>{}),w.clear(),await Q(),x.clearing=!1,x.queue.length&&setImmediate(K)},pruneExpired:P,startAuditMaintenance:function(){v||(v=setInterval(()=>void P(),36e5),v.unref?.())},stopAuditMaintenance:function(){v&&clearInterval(v),v=null},flushAuditQueue:async function a(b=5e3){let c=Date.now()+Math.max(0,Number(b)||0);for(;(x.queue.length||x.activeWorkers)&&Date.now()<c;){K();let a=[...x.workers];a.length?await Promise.race([Promise.allSettled(a),new Promise(a=>setTimeout(a,50))]):await new Promise(a=>setTimeout(a,10))}return 0===x.queue.length&&0===x.activeWorkers},getAuditStoreStats:function(){return{queueDepth:x.queue.length,queueLimit:1e3,workerRunning:x.activeWorkers>0,workerConcurrency:4,activeWorkers:x.activeWorkers,mysqlPoolConnections:4,enqueued:x.enqueued,written:x.written,dropped:x.dropped,failed:x.failed,mysqlWritten:x.mysqlWritten,mysqlFailed:x.mysqlFailed,lastError:x.lastError,lastWrittenAt:x.lastWrittenAt,logDirectory:i}},appendPromptLog:F}},63070:(a,b,c)=>{var d=c(45654);c(33889),c(36105);var e=a.exports=d.asn1=d.asn1||{};function f(a,b,c){if(c>b){var d=Error("Too few bytes to parse DER.");throw d.available=a.length(),d.remaining=b,d.requested=c,d}}e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.maxDepth=256,e.create=function(a,b,c,f,g){if(d.util.isArray(f)){for(var h=[],i=0;i<f.length;++i)void 0!==f[i]&&h.push(f[i]);f=h}var j={tagClass:a,type:b,constructed:c,composed:c||d.util.isArray(f),value:f};return g&&"bitStringContents"in g&&(j.bitStringContents=g.bitStringContents,j.original=e.copy(j)),j},e.copy=function(a,b){var c;if(d.util.isArray(a)){c=[];for(var f=0;f<a.length;++f)c.push(e.copy(a[f],b));return c}return"string"==typeof a?a:(c={tagClass:a.tagClass,type:a.type,constructed:a.constructed,composed:a.composed,value:e.copy(a.value,b)},b&&!b.excludeBitStringContents&&(c.bitStringContents=a.bitStringContents),c)},e.equals=function(a,b,c){if(d.util.isArray(a)){if(!d.util.isArray(b)||a.length!==b.length)return!1;for(var f=0;f<a.length;++f)if(!e.equals(a[f],b[f]))return!1;return!0}if(typeof a!=typeof b)return!1;if("string"==typeof a)return a===b;var g=a.tagClass===b.tagClass&&a.type===b.type&&a.constructed===b.constructed&&a.composed===b.composed&&e.equals(a.value,b.value);return c&&c.includeBitStringContents&&(g=g&&a.bitStringContents===b.bitStringContents),g},e.getBerValueLength=function(a){var b=a.getByte();if(128!==b)return 128&b?a.getInt((127&b)<<3):b};var g=function(a,b){var c,d=a.getByte();if(b--,128!==d){if(128&d){var e=127&d;f(a,b,e),c=a.getInt(e<<3)}else c=d;if(c<0)throw Error("Negative length: "+c);return c}};e.fromDer=function(a,b){void 0===b&&(b={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof b&&(b={strict:b,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in b||(b.strict=!0),"parseAllBytes"in b||(b.parseAllBytes=!0),"decodeBitStrings"in b||(b.decodeBitStrings=!0),"maxDepth"in b||(b.maxDepth=e.maxDepth),"string"==typeof a&&(a=d.util.createBuffer(a));var c=a.length(),h=function a(b,c,d,h){if(d>=h.maxDepth)throw Error("ASN.1 parsing error: Max depth exceeded.");f(b,c,2);var i,j,k,l=b.getByte();c--;var m=192&l,n=31&l;i=b.length();var o=g(b,c);if(c-=i-b.length(),void 0!==o&&o>c){if(h.strict){var p=Error("Too few bytes to read ASN.1 value.");throw p.available=b.length(),p.remaining=c,p.requested=o,p}o=c}var q=(32&l)==32;if(q)if(j=[],void 0===o)for(;;){if(f(b,c,2),b.bytes(2)===String.fromCharCode(0,0)){b.getBytes(2),c-=2;break}i=b.length(),j.push(a(b,c,d+1,h)),c-=i-b.length()}else for(;o>0;)i=b.length(),j.push(a(b,o,d+1,h)),c-=i-b.length(),o-=i-b.length();if(void 0===j&&m===e.Class.UNIVERSAL&&n===e.Type.BITSTRING&&(k=b.bytes(o)),void 0===j&&h.decodeBitStrings&&m===e.Class.UNIVERSAL&&n===e.Type.BITSTRING&&o>1){var r=b.read,s=c,t=0;if(n===e.Type.BITSTRING&&(f(b,c,1),t=b.getByte(),c--),0===t)try{i=b.length();var u=a(b,c,d+1,{strict:!0,decodeBitStrings:!0}),v=i-b.length();c-=v,n==e.Type.BITSTRING&&v++;var w=u.tagClass;v===o&&(w===e.Class.UNIVERSAL||w===e.Class.CONTEXT_SPECIFIC)&&(j=[u])}catch(a){}void 0===j&&(b.read=r,c=s)}if(void 0===j){if(void 0===o){if(h.strict)throw Error("Non-constructed ASN.1 object of indefinite length.");o=c}if(n===e.Type.BMPSTRING)for(j="";o>0;o-=2)f(b,c,2),j+=String.fromCharCode(b.getInt16()),c-=2;else j=b.getBytes(o),c-=o}var x=void 0===k?null:{bitStringContents:k};return e.create(m,n,q,j,x)}(a,a.length(),0,b);if(b.parseAllBytes&&0!==a.length()){var i=Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=c,i.remaining=a.length(),i}return h},e.toDer=function(a){var b=d.util.createBuffer(),c=a.tagClass|a.type,f=d.util.createBuffer(),g=!1;if("bitStringContents"in a&&(g=!0,a.original&&(g=e.equals(a,a.original))),g)f.putBytes(a.bitStringContents);else if(a.composed){a.constructed?c|=32:f.putByte(0);for(var h=0;h<a.value.length;++h)void 0!==a.value[h]&&f.putBuffer(e.toDer(a.value[h]))}else if(a.type===e.Type.BMPSTRING)for(var h=0;h<a.value.length;++h)f.putInt16(a.value.charCodeAt(h));else a.type===e.Type.INTEGER&&a.value.length>1&&(0===a.value.charCodeAt(0)&&(128&a.value.charCodeAt(1))==0||255===a.value.charCodeAt(0)&&(128&a.value.charCodeAt(1))==128)?f.putBytes(a.value.substr(1)):f.putBytes(a.value);if(b.putByte(c),127>=f.length())b.putByte(127&f.length());else{var i=f.length(),j="";do j+=String.fromCharCode(255&i),i>>>=8;while(i>0);b.putByte(128|j.length);for(var h=j.length-1;h>=0;--h)b.putByte(j.charCodeAt(h))}return b.putBuffer(f),b},e.oidToDer=function(a){var b,c,e,f,g=a.split("."),h=d.util.createBuffer();h.putByte(40*parseInt(g[0],10)+parseInt(g[1],10));for(var i=2;i<g.length;++i){if(b=!0,c=[],(e=parseInt(g[i],10))>0xffffffff)throw Error("OID value too large; max is 32-bits.");do f=127&e,e>>>=7,b||(f|=128),c.push(f),b=!1;while(e>0);for(var j=c.length-1;j>=0;--j)h.putByte(c[j])}return h},e.derToOid=function(a){"string"==typeof a&&(a=d.util.createBuffer(a));var b,c=a.getByte();b=Math.floor(c/40)+"."+c%40;for(var e=0;a.length()>0;){if(e>0x3fffffffffff)throw Error("OID value too large; max is 53-bits.");c=a.getByte(),e*=128,128&c?e+=127&c:(b+="."+(e+c),e=0)}return b},e.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10);c=c>=50?1900+c:2e3+c;var d=parseInt(a.substr(2,2),10)-1,e=parseInt(a.substr(4,2),10),f=parseInt(a.substr(6,2),10),g=parseInt(a.substr(8,2),10),h=0;if(a.length>11){var i=a.charAt(10),j=10;"+"!==i&&"-"!==i&&(h=parseInt(a.substr(10,2),10),j+=2)}if(b.setUTCFullYear(c,d,e),b.setUTCHours(f,g,h,0),j&&("+"===(i=a.charAt(j))||"-"===i)){var k=60*parseInt(a.substr(j+1,2),10)+parseInt(a.substr(j+4,2),10);k*=6e4,"+"===i?b.setTime(b-k):b.setTime(+b+k)}return b},e.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,e=parseInt(a.substr(6,2),10),f=parseInt(a.substr(8,2),10),g=parseInt(a.substr(10,2),10),h=parseInt(a.substr(12,2),10),i=0,j=0,k=!1;"Z"===a.charAt(a.length-1)&&(k=!0);var l=a.length-5,m=a.charAt(l);return("+"===m||"-"===m)&&(j=(60*parseInt(a.substr(l+1,2),10)+parseInt(a.substr(l+4,2),10))*6e4,"+"===m&&(j*=-1),k=!0),"."===a.charAt(14)&&(i=1e3*parseFloat(a.substr(14),10)),k?(b.setUTCFullYear(c,d,e),b.setUTCHours(f,g,h,i),b.setTime(+b+j)):(b.setFullYear(c,d,e),b.setHours(f,g,h,i)),b},e.dateToUtcTime=function(a){if("string"==typeof a)return a;var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2)),c.push(""+(a.getUTCMonth()+1)),c.push(""+a.getUTCDate()),c.push(""+a.getUTCHours()),c.push(""+a.getUTCMinutes()),c.push(""+a.getUTCSeconds());for(var d=0;d<c.length;++d)c[d].length<2&&(b+="0"),b+=c[d];return b+"Z"},e.dateToGeneralizedTime=function(a){if("string"==typeof a)return a;var b="",c=[];c.push(""+a.getUTCFullYear()),c.push(""+(a.getUTCMonth()+1)),c.push(""+a.getUTCDate()),c.push(""+a.getUTCHours()),c.push(""+a.getUTCMinutes()),c.push(""+a.getUTCSeconds());for(var d=0;d<c.length;++d)c[d].length<2&&(b+="0"),b+=c[d];return b+"Z"},e.integerToDer=function(a){var b=d.util.createBuffer();if(a>=-128&&a<128)return b.putSignedInt(a,8);if(a>=-32768&&a<32768)return b.putSignedInt(a,16);if(a>=-8388608&&a<8388608)return b.putSignedInt(a,24);if(a>=-0x80000000&&a<0x80000000)return b.putSignedInt(a,32);var c=Error("Integer too large; max is 32-bits.");throw c.integer=a,c},e.derToInteger=function(a){"string"==typeof a&&(a=d.util.createBuffer(a));var b=8*a.length();if(b>32)throw Error("Integer too large; max is 32-bits.");return a.getSignedInt(b)},e.validate=function(a,b,c,f){var g=!1;if((a.tagClass===b.tagClass||void 0===b.tagClass)&&(a.type===b.type||void 0===b.type))if(a.constructed===b.constructed||void 0===b.constructed){if(g=!0,b.value&&d.util.isArray(b.value))for(var h=0,i=0;g&&i<b.value.length;++i){var j=b.value[i];g=!!j.optional;var k=a.value[h];if(!k){!j.optional&&(g=!1,f&&f.push("["+b.name+'] Missing required element. Expected tag class "'+j.tagClass+'", type "'+j.type+'"'));continue}if(void 0!==j.tagClass&&void 0!==j.type&&(k.tagClass!==j.tagClass||k.type!==j.type))if(j.optional){g=!0;continue}else{g=!1,f&&f.push("["+b.name+"] Tag mismatch. Expected ("+j.tagClass+","+j.type+"), got ("+k.tagClass+","+k.type+")");break}if(e.validate(k,j,c,f))++h,g=!0;else if(j.optional)g=!0;else{g=!1;break}}if(g&&c&&(b.capture&&(c[b.capture]=a.value),b.captureAsn1&&(c[b.captureAsn1]=a),b.captureBitStringContents&&"bitStringContents"in a&&(c[b.captureBitStringContents]=a.bitStringContents),b.captureBitStringValue&&"bitStringContents"in a))if(a.bitStringContents.length<2)c[b.captureBitStringValue]="";else{if(0!==a.bitStringContents.charCodeAt(0))throw Error("captureBitStringValue only supported for zero unused bits");c[b.captureBitStringValue]=a.bitStringContents.slice(1)}}else f&&f.push("["+b.name+'] Expected constructed "'+b.constructed+'", got "'+a.constructed+'"');else f&&(a.tagClass!==b.tagClass&&f.push("["+b.name+'] Expected tag class "'+b.tagClass+'", got "'+a.tagClass+'"'),a.type!==b.type&&f.push("["+b.name+'] Expected type "'+b.type+'", got "'+a.type+'"'));return g};var h=/[^\\u0000-\\u00ff]/;e.prettyPrint=function(a,b,c){var f="";c=c||2,(b=b||0)>0&&(f+="\n");for(var g="",i=0;i<b*c;++i)g+=" ";switch(f+=g+"Tag: ",a.tagClass){case e.Class.UNIVERSAL:f+="Universal:";break;case e.Class.APPLICATION:f+="Application:";break;case e.Class.CONTEXT_SPECIFIC:f+="Context-Specific:";break;case e.Class.PRIVATE:f+="Private:"}if(a.tagClass===e.Class.UNIVERSAL)switch(f+=a.type,a.type){case e.Type.NONE:f+=" (None)";break;case e.Type.BOOLEAN:f+=" (Boolean)";break;case e.Type.INTEGER:f+=" (Integer)";break;case e.Type.BITSTRING:f+=" (Bit string)";break;case e.Type.OCTETSTRING:f+=" (Octet string)";break;case e.Type.NULL:f+=" (Null)";break;case e.Type.OID:f+=" (Object Identifier)";break;case e.Type.ODESC:f+=" (Object Descriptor)";break;case e.Type.EXTERNAL:f+=" (External or Instance of)";break;case e.Type.REAL:f+=" (Real)";break;case e.Type.ENUMERATED:f+=" (Enumerated)";break;case e.Type.EMBEDDED:f+=" (Embedded PDV)";break;case e.Type.UTF8:f+=" (UTF8)";break;case e.Type.ROID:f+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:f+=" (Sequence)";break;case e.Type.SET:f+=" (Set)";break;case e.Type.PRINTABLESTRING:f+=" (Printable String)";break;case e.Type.IA5String:f+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:f+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:f+=" (Generalized time)";break;case e.Type.BMPSTRING:f+=" (BMP String)"}else f+=a.type;if(f+="\n",f+=g+"Constructed: "+a.constructed+"\n",a.composed){for(var j=0,k="",i=0;i<a.value.length;++i)void 0!==a.value[i]&&(j+=1,k+=e.prettyPrint(a.value[i],b+1,c),i+1<a.value.length&&(k+=","));f+=g+"Sub values: "+j+k}else{if(f+=g+"Value: ",a.type===e.Type.OID){var l=e.derToOid(a.value);f+=l,d.pki&&d.pki.oids&&l in d.pki.oids&&(f+=" ("+d.pki.oids[l]+") ")}if(a.type===e.Type.INTEGER)try{f+=e.derToInteger(a.value)}catch(b){f+="0x"+d.util.bytesToHex(a.value)}else if(a.type===e.Type.BITSTRING){if(a.value.length>1?f+="0x"+d.util.bytesToHex(a.value.slice(1)):f+="(none)",a.value.length>0){var m=a.value.charCodeAt(0);1==m?f+=" (1 unused bit shown)":m>1&&(f+=" ("+m+" unused bits shown)")}}else if(a.type===e.Type.OCTETSTRING)h.test(a.value)||(f+="("+a.value+") "),f+="0x"+d.util.bytesToHex(a.value);else if(a.type===e.Type.UTF8)try{f+=d.util.decodeUtf8(a.value)}catch(b){if("URI malformed"===b.message)f+="0x"+d.util.bytesToHex(a.value)+" (malformed UTF8)";else throw b}else a.type===e.Type.PRINTABLESTRING||a.type===e.Type.IA5String?f+=a.value:h.test(a.value)?f+="0x"+d.util.bytesToHex(a.value):0===a.value.length?f+="[null]":f+=a.value}return f}},65737:(a,b,c)=>{var d=c(45654);c(45518),c(63070),c(88819),c(1277),c(15529),c(36105),c(49345),c(87981),c(10401),c(33889);var e=d.asn1,f=a.exports=d.pki=d.pki||{},g=f.oids,h={};h.CN=g.commonName,h.commonName="CN",h.C=g.countryName,h.countryName="C",h.L=g.localityName,h.localityName="L",h.ST=g.stateOrProvinceName,h.stateOrProvinceName="ST",h.O=g.organizationName,h.organizationName="O",h.OU=g.organizationalUnitName,h.organizationalUnitName="OU",h.E=g.emailAddress,h.emailAddress="E";var i=d.pki.rsa.publicKeyValidator,j={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},i,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},k={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},l={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},i,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},m={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[l,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function n(a,b){"string"==typeof b&&(b={shortName:b});for(var c,d=null,e=0;null===d&&e<a.attributes.length;++e)c=a.attributes[e],b.type&&b.type===c.type||b.name&&b.name===c.name?d=c:b.shortName&&b.shortName===c.shortName&&(d=c);return d}f.RDNAttributesAsArray=function(a,b){for(var c,d,f,i=[],j=0;j<a.value.length;++j){c=a.value[j];for(var k=0;k<c.value.length;++k)f={},d=c.value[k],f.type=e.derToOid(d.value[0].value),f.value=d.value[1].value,f.valueTagClass=d.value[1].type,f.type in g&&(f.name=g[f.type],f.name in h&&(f.shortName=h[f.name])),b&&(b.update(f.type),b.update(f.value)),i.push(f)}return i},f.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=a[c],i=e.derToOid(d.value[0].value),j=d.value[1].value,k=0;k<j.length;++k){var l={};if(l.type=i,l.value=j[k].value,l.valueTagClass=j[k].type,l.type in g&&(l.name=g[l.type],l.name in h&&(l.shortName=h[l.name])),l.type===g.extensionRequest){l.extensions=[];for(var m=0;m<l.value.length;++m)l.extensions.push(f.certificateExtensionFromAsn1(l.value[m]))}b.push(l)}return b};var o=function(a,b,c){var d={};if(a!==g["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:g.sha1},mgf:{algorithmOid:g.mgf1,hash:{algorithmOid:g.sha1}},saltLength:20});var f={},h=[];if(!e.validate(b,k,f,h)){var i=Error("Cannot read RSASSA-PSS parameter block.");throw i.errors=h,i}return void 0!==f.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=e.derToOid(f.hashOid)),void 0!==f.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=e.derToOid(f.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=e.derToOid(f.maskGenHashOid)),void 0!==f.saltLength&&(d.saltLength=f.saltLength.charCodeAt(0)),d},p=function(a){switch(g[a.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return d.md.sha1.create();case"md5WithRSAEncryption":return d.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return d.md.sha256.create();case"sha384WithRSAEncryption":return d.md.sha384.create();case"sha512WithRSAEncryption":return d.md.sha512.create();default:var b=Error("Could not compute "+a.type+" digest. Unknown signature OID.");throw b.signatureOid=a.signatureOid,b}},q=function(a){var b,c,e,f=a.certificate;switch(f.signatureOid){case g.sha1WithRSAEncryption:case g.sha1WithRSASignature:break;case g["RSASSA-PSS"]:if(void 0===(c=g[f.signatureParameters.mgf.hash.algorithmOid])||void 0===d.md[c]){var h=Error("Unsupported MGF hash function.");throw h.oid=f.signatureParameters.mgf.hash.algorithmOid,h.name=c,h}if(void 0===(e=g[f.signatureParameters.mgf.algorithmOid])||void 0===d.mgf[e]){var h=Error("Unsupported MGF function.");throw h.oid=f.signatureParameters.mgf.algorithmOid,h.name=e,h}if(e=d.mgf[e].create(d.md[c].create()),void 0===(c=g[f.signatureParameters.hash.algorithmOid])||void 0===d.md[c]){var h=Error("Unsupported RSASSA-PSS hash function.");throw h.oid=f.signatureParameters.hash.algorithmOid,h.name=c,h}b=d.pss.create(d.md[c].create(),e,f.signatureParameters.saltLength)}return f.publicKey.verify(a.md.digest().getBytes(),a.signature,b)};function r(a){for(var b,c,f=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),g=a.attributes,h=0;h<g.length;++h){var i=(b=g[h]).value,j=e.Type.PRINTABLESTRING;"valueTagClass"in b&&(j=b.valueTagClass)===e.Type.UTF8&&(i=d.util.encodeUtf8(i)),c=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.type).getBytes()),e.create(e.Class.UNIVERSAL,j,!1,i)])]),f.value.push(c)}return f}function s(a){for(var b,c=0;c<a.length;++c){if(void 0===(b=a[c]).name&&(b.type&&b.type in f.oids?b.name=f.oids[b.type]:b.shortName&&b.shortName in h&&(b.name=f.oids[h[b.shortName]])),void 0===b.type)if(b.name&&b.name in f.oids)b.type=f.oids[b.name];else{var d=Error("Attribute type not specified.");throw d.attribute=b,d}if(void 0===b.shortName&&b.name&&b.name in h&&(b.shortName=h[b.name]),b.type===g.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=e.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var i=0;i<b.extensions.length;++i)b.value.push(f.certificateExtensionToAsn1(t(b.extensions[i])))}if(void 0===b.value){var d=Error("Attribute value not specified.");throw d.attribute=b,d}}}function t(a,b){if(b=b||{},void 0===a.name&&a.id&&a.id in f.oids&&(a.name=f.oids[a.id]),void 0===a.id)if(a.name&&a.name in f.oids)a.id=f.oids[a.name];else{var c=Error("Extension ID not specified.");throw c.extension=a,c}if(void 0!==a.value)return a;if("keyUsage"===a.name){var h=0,i=0,j=0;a.digitalSignature&&(i|=128,h=7),a.nonRepudiation&&(i|=64,h=6),a.keyEncipherment&&(i|=32,h=5),a.dataEncipherment&&(i|=16,h=4),a.keyAgreement&&(i|=8,h=3),a.keyCertSign&&(i|=4,h=2),a.cRLSign&&(i|=2,h=1),a.encipherOnly&&(i|=1,h=0),a.decipherOnly&&(j|=128,h=7);var k=String.fromCharCode(h);0!==j?k+=String.fromCharCode(i)+String.fromCharCode(j):0!==i&&(k+=String.fromCharCode(i)),a.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,k)}else if("basicConstraints"===a.name)a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),a.cA&&a.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in a&&a.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.pathLenConstraint).getBytes()));else if("extKeyUsage"===a.name){a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var l=a.value.value;for(var m in a)!0===a[m]&&(m in g?l.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g[m]).getBytes())):-1!==m.indexOf(".")&&l.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(m).getBytes())))}else if("nsCertType"===a.name){var h=0,i=0;a.client&&(i|=128,h=7),a.server&&(i|=64,h=6),a.email&&(i|=32,h=5),a.objsign&&(i|=16,h=4),a.reserved&&(i|=8,h=3),a.sslCA&&(i|=4,h=2),a.emailCA&&(i|=2,h=1),a.objCA&&(i|=1,h=0);var k=String.fromCharCode(h);0!==i&&(k+=String.fromCharCode(i)),a.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,k)}else if("subjectAltName"===a.name||"issuerAltName"===a.name){a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var n,o=0;o<a.altNames.length;++o){var k=(n=a.altNames[o]).value;if(7===n.type&&n.ip){if(null===(k=d.util.bytesFromIP(n.ip))){var c=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw c.extension=a,c}}else 8===n.type&&(k=n.oid?e.oidToDer(e.oidToDer(n.oid)):e.oidToDer(k));a.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,n.type,!1,k))}}else if("nsComment"===a.name&&b.cert){if(!/^[\x00-\x7F]*$/.test(a.comment)||a.comment.length<1||a.comment.length>128)throw Error('Invalid "nsComment" content.');a.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,a.comment)}else if("subjectKeyIdentifier"===a.name&&b.cert){var p=b.cert.generateSubjectKeyIdentifier();a.subjectKeyIdentifier=p.toHex(),a.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===a.name&&b.cert){a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var l=a.value.value;if(a.keyIdentifier){var q=!0===a.keyIdentifier?b.cert.generateSubjectKeyIdentifier().getBytes():a.keyIdentifier;l.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,q))}if(a.authorityCertIssuer){var s=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[r(!0===a.authorityCertIssuer?b.cert.issuer:a.authorityCertIssuer)])];l.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,s))}if(a.serialNumber){var t=d.util.hexToBytes(!0===a.serialNumber?b.cert.serialNumber:a.serialNumber);l.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,t))}}else if("cRLDistributionPoints"===a.name){a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var n,l=a.value.value,u=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),v=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),o=0;o<a.altNames.length;++o){var k=(n=a.altNames[o]).value;if(7===n.type&&n.ip){if(null===(k=d.util.bytesFromIP(n.ip))){var c=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw c.extension=a,c}}else 8===n.type&&(k=n.oid?e.oidToDer(e.oidToDer(n.oid)):e.oidToDer(k));v.value.push(e.create(e.Class.CONTEXT_SPECIFIC,n.type,!1,k))}u.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[v])),l.push(u)}if(void 0===a.value){var c=Error("Extension value not specified.");throw c.extension=a,c}return a}function u(a,b){if(a!==g["RSASSA-PSS"])return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"");var c=[];return void 0!==b.hash.algorithmOid&&c.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),void 0!==b.mgf.algorithmOid&&c.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),void 0!==b.saltLength&&c.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(b.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,c)}f.certificateFromPem=function(a,b,c){var g=d.pem.decode(a)[0];if("CERTIFICATE"!==g.type&&"X509 CERTIFICATE"!==g.type&&"TRUSTED CERTIFICATE"!==g.type){var h=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw h.headerType=g.type,h}if(g.procType&&"ENCRYPTED"===g.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var i=e.fromDer(g.body,c);return f.certificateFromAsn1(i,b)},f.certificateToPem=function(a,b){var c={type:"CERTIFICATE",body:e.toDer(f.certificateToAsn1(a)).getBytes()};return d.pem.encode(c,{maxline:b})},f.publicKeyFromPem=function(a){var b=d.pem.decode(a)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw c.headerType=b.type,c}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");var g=e.fromDer(b.body);return f.publicKeyFromAsn1(g)},f.publicKeyToPem=function(a,b){var c={type:"PUBLIC KEY",body:e.toDer(f.publicKeyToAsn1(a)).getBytes()};return d.pem.encode(c,{maxline:b})},f.publicKeyToRSAPublicKeyPem=function(a,b){var c={type:"RSA PUBLIC KEY",body:e.toDer(f.publicKeyToRSAPublicKey(a)).getBytes()};return d.pem.encode(c,{maxline:b})},f.getPublicKeyFingerprint=function(a,b){var c,g=(b=b||{}).md||d.md.sha1.create();switch(b.type||"RSAPublicKey"){case"RSAPublicKey":c=e.toDer(f.publicKeyToRSAPublicKey(a)).getBytes();break;case"SubjectPublicKeyInfo":c=e.toDer(f.publicKeyToAsn1(a)).getBytes();break;default:throw Error('Unknown fingerprint type "'+b.type+'".')}g.start(),g.update(c);var h=g.digest();if("hex"===b.encoding){var i=h.toHex();return b.delimiter?i.match(/.{2}/g).join(b.delimiter):i}if("binary"===b.encoding)return h.getBytes();if(b.encoding)throw Error('Unknown encoding "'+b.encoding+'".');return h},f.certificationRequestFromPem=function(a,b,c){var g=d.pem.decode(a)[0];if("CERTIFICATE REQUEST"!==g.type){var h=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw h.headerType=g.type,h}if(g.procType&&"ENCRYPTED"===g.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");var i=e.fromDer(g.body,c);return f.certificationRequestFromAsn1(i,b)},f.certificationRequestToPem=function(a,b){var c={type:"CERTIFICATE REQUEST",body:e.toDer(f.certificationRequestToAsn1(a)).getBytes()};return d.pem.encode(c,{maxline:b})},f.createCertificate=function(){var a={};return a.version=2,a.serialNumber="00",a.signatureOid=null,a.signature=null,a.siginfo={},a.siginfo.algorithmOid=null,a.validity={},a.validity.notBefore=new Date,a.validity.notAfter=new Date,a.issuer={},a.issuer.getField=function(b){return n(a.issuer,b)},a.issuer.addField=function(b){s([b]),a.issuer.attributes.push(b)},a.issuer.attributes=[],a.issuer.hash=null,a.subject={},a.subject.getField=function(b){return n(a.subject,b)},a.subject.addField=function(b){s([b]),a.subject.attributes.push(b)},a.subject.attributes=[],a.subject.hash=null,a.extensions=[],a.publicKey=null,a.md=null,a.setSubject=function(b,c){s(b),a.subject.attributes=b,delete a.subject.uniqueId,c&&(a.subject.uniqueId=c),a.subject.hash=null},a.setIssuer=function(b,c){s(b),a.issuer.attributes=b,delete a.issuer.uniqueId,c&&(a.issuer.uniqueId=c),a.issuer.hash=null},a.setExtensions=function(b){for(var c=0;c<b.length;++c)t(b[c],{cert:a});a.extensions=b},a.getExtension=function(b){"string"==typeof b&&(b={name:b});for(var c,d=null,e=0;null===d&&e<a.extensions.length;++e)c=a.extensions[e],b.id&&c.id===b.id?d=c:b.name&&c.name===b.name&&(d=c);return d},a.sign=function(b,c){a.md=c||d.md.sha1.create();var h=g[a.md.algorithm+"WithRSAEncryption"];if(!h){var i=Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw i.algorithm=a.md.algorithm,i}a.signatureOid=a.siginfo.algorithmOid=h,a.tbsCertificate=f.getTBSCertificate(a);var j=e.toDer(a.tbsCertificate);a.md.update(j.getBytes()),a.signature=b.sign(a.md)},a.verify=function(b){var c=!1;if(!a.issued(b)){var d=b.issuer,g=a.subject,h=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw h.expectedIssuer=g.attributes,h.actualIssuer=d.attributes,h}var i=b.md;if(null===i){i=p({signatureOid:b.signatureOid,type:"certificate"});var j=b.tbsCertificate||f.getTBSCertificate(b),k=e.toDer(j);i.update(k.getBytes())}return null!==i&&(c=q({certificate:a,md:i,signature:b.signature})),c},a.isIssuer=function(b){var c=!1,d=a.issuer,e=b.subject;if(d.hash&&e.hash)c=d.hash===e.hash;else if(d.attributes.length===e.attributes.length){c=!0;for(var f,g,h=0;c&&h<d.attributes.length;++h)f=d.attributes[h],g=e.attributes[h],(f.type!==g.type||f.value!==g.value)&&(c=!1)}return c},a.issued=function(b){return b.isIssuer(a)},a.generateSubjectKeyIdentifier=function(){return f.getPublicKeyFingerprint(a.publicKey,{type:"RSAPublicKey"})},a.verifySubjectKeyIdentifier=function(){for(var b=g.subjectKeyIdentifier,c=0;c<a.extensions.length;++c){var e=a.extensions[c];if(e.id===b){var f=a.generateSubjectKeyIdentifier().getBytes();return d.util.hexToBytes(e.subjectKeyIdentifier)===f}}return!1},a},f.certificateFromAsn1=function(a,b){var c={},g=[];if(!e.validate(a,j,c,g)){var h=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw h.errors=g,h}if(e.derToOid(c.publicKeyOid)!==f.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var i=f.createCertificate();i.version=c.certVersion?c.certVersion.charCodeAt(0):0,i.serialNumber=d.util.createBuffer(c.certSerialNumber).toHex(),i.signatureOid=d.asn1.derToOid(c.certSignatureOid),i.signatureParameters=o(i.signatureOid,c.certSignatureParams,!0),i.siginfo.algorithmOid=d.asn1.derToOid(c.certinfoSignatureOid),i.siginfo.parameters=o(i.siginfo.algorithmOid,c.certinfoSignatureParams,!1),i.signature=c.certSignature;var k=[];if(void 0!==c.certValidity1UTCTime&&k.push(e.utcTimeToDate(c.certValidity1UTCTime)),void 0!==c.certValidity2GeneralizedTime&&k.push(e.generalizedTimeToDate(c.certValidity2GeneralizedTime)),void 0!==c.certValidity3UTCTime&&k.push(e.utcTimeToDate(c.certValidity3UTCTime)),void 0!==c.certValidity4GeneralizedTime&&k.push(e.generalizedTimeToDate(c.certValidity4GeneralizedTime)),k.length>2)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(k.length<2)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(i.validity.notBefore=k[0],i.validity.notAfter=k[1],i.tbsCertificate=c.tbsCertificate,b){i.md=p({signatureOid:i.signatureOid,type:"certificate"});var l=e.toDer(i.tbsCertificate);i.md.update(l.getBytes())}var m=d.md.sha1.create(),q=e.toDer(c.certIssuer);m.update(q.getBytes()),i.issuer.getField=function(a){return n(i.issuer,a)},i.issuer.addField=function(a){s([a]),i.issuer.attributes.push(a)},i.issuer.attributes=f.RDNAttributesAsArray(c.certIssuer),c.certIssuerUniqueId&&(i.issuer.uniqueId=c.certIssuerUniqueId),i.issuer.hash=m.digest().toHex();var r=d.md.sha1.create(),t=e.toDer(c.certSubject);return r.update(t.getBytes()),i.subject.getField=function(a){return n(i.subject,a)},i.subject.addField=function(a){s([a]),i.subject.attributes.push(a)},i.subject.attributes=f.RDNAttributesAsArray(c.certSubject),c.certSubjectUniqueId&&(i.subject.uniqueId=c.certSubjectUniqueId),i.subject.hash=r.digest().toHex(),c.certExtensions?i.extensions=f.certificateExtensionsFromAsn1(c.certExtensions):i.extensions=[],i.publicKey=f.publicKeyFromAsn1(c.subjectPublicKeyInfo),i},f.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(f.certificateExtensionFromAsn1(d.value[e]));return b},f.certificateExtensionFromAsn1=function(a){var b={};if(b.id=e.derToOid(a.value[0].value),b.critical=!1,a.value[1].type===e.Type.BOOLEAN?(b.critical=0!==a.value[1].value.charCodeAt(0),b.value=a.value[2].value):b.value=a.value[1].value,b.id in g){if(b.name=g[b.id],"keyUsage"===b.name){var c=e.fromDer(b.value),f=0,h=0;c.value.length>1&&(f=c.value.charCodeAt(1),h=c.value.length>2?c.value.charCodeAt(2):0),b.digitalSignature=(128&f)==128,b.nonRepudiation=(64&f)==64,b.keyEncipherment=(32&f)==32,b.dataEncipherment=(16&f)==16,b.keyAgreement=(8&f)==8,b.keyCertSign=(4&f)==4,b.cRLSign=(2&f)==2,b.encipherOnly=(1&f)==1,b.decipherOnly=(128&h)==128}else if("basicConstraints"===b.name){var c=e.fromDer(b.value);c.value.length>0&&c.value[0].type===e.Type.BOOLEAN?b.cA=0!==c.value[0].value.charCodeAt(0):b.cA=!1;var i=null;c.value.length>0&&c.value[0].type===e.Type.INTEGER?i=c.value[0].value:c.value.length>1&&(i=c.value[1].value),null!==i&&(b.pathLenConstraint=e.derToInteger(i))}else if("extKeyUsage"===b.name)for(var c=e.fromDer(b.value),j=0;j<c.value.length;++j){var k=e.derToOid(c.value[j].value);k in g?b[g[k]]=!0:b[k]=!0}else if("nsCertType"===b.name){var c=e.fromDer(b.value),f=0;c.value.length>1&&(f=c.value.charCodeAt(1)),b.client=(128&f)==128,b.server=(64&f)==64,b.email=(32&f)==32,b.objsign=(16&f)==16,b.reserved=(8&f)==8,b.sslCA=(4&f)==4,b.emailCA=(2&f)==2,b.objCA=(1&f)==1}else if("subjectAltName"===b.name||"issuerAltName"===b.name){b.altNames=[];for(var l,c=e.fromDer(b.value),m=0;m<c.value.length;++m){var n={type:(l=c.value[m]).type,value:l.value};switch(b.altNames.push(n),l.type){case 1:case 2:case 6:break;case 7:n.ip=d.util.bytesToIP(l.value);break;case 8:n.oid=e.derToOid(l.value)}}}else if("subjectKeyIdentifier"===b.name){var c=e.fromDer(b.value);b.subjectKeyIdentifier=d.util.bytesToHex(c.value)}}return b},f.certificationRequestFromAsn1=function(a,b){var c={},g=[];if(!e.validate(a,m,c,g)){var h=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw h.errors=g,h}if(e.derToOid(c.publicKeyOid)!==f.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var i=f.createCertificationRequest();if(i.version=c.csrVersion?c.csrVersion.charCodeAt(0):0,i.signatureOid=d.asn1.derToOid(c.csrSignatureOid),i.signatureParameters=o(i.signatureOid,c.csrSignatureParams,!0),i.siginfo.algorithmOid=d.asn1.derToOid(c.csrSignatureOid),i.siginfo.parameters=o(i.siginfo.algorithmOid,c.csrSignatureParams,!1),i.signature=c.csrSignature,i.certificationRequestInfo=c.certificationRequestInfo,b){i.md=p({signatureOid:i.signatureOid,type:"certification request"});var j=e.toDer(i.certificationRequestInfo);i.md.update(j.getBytes())}var k=d.md.sha1.create();return i.subject.getField=function(a){return n(i.subject,a)},i.subject.addField=function(a){s([a]),i.subject.attributes.push(a)},i.subject.attributes=f.RDNAttributesAsArray(c.certificationRequestInfoSubject,k),i.subject.hash=k.digest().toHex(),i.publicKey=f.publicKeyFromAsn1(c.subjectPublicKeyInfo),i.getAttribute=function(a){return n(i,a)},i.addAttribute=function(a){s([a]),i.attributes.push(a)},i.attributes=f.CRIAttributesAsArray(c.certificationRequestInfoAttributes||[]),i},f.createCertificationRequest=function(){var a={};return a.version=0,a.signatureOid=null,a.signature=null,a.siginfo={},a.siginfo.algorithmOid=null,a.subject={},a.subject.getField=function(b){return n(a.subject,b)},a.subject.addField=function(b){s([b]),a.subject.attributes.push(b)},a.subject.attributes=[],a.subject.hash=null,a.publicKey=null,a.attributes=[],a.getAttribute=function(b){return n(a,b)},a.addAttribute=function(b){s([b]),a.attributes.push(b)},a.md=null,a.setSubject=function(b){s(b),a.subject.attributes=b,a.subject.hash=null},a.setAttributes=function(b){s(b),a.attributes=b},a.sign=function(b,c){a.md=c||d.md.sha1.create();var h=g[a.md.algorithm+"WithRSAEncryption"];if(!h){var i=Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw i.algorithm=a.md.algorithm,i}a.signatureOid=a.siginfo.algorithmOid=h,a.certificationRequestInfo=f.getCertificationRequestInfo(a);var j=e.toDer(a.certificationRequestInfo);a.md.update(j.getBytes()),a.signature=b.sign(a.md)},a.verify=function(){var b=!1,c=a.md;if(null===c){c=p({signatureOid:a.signatureOid,type:"certification request"});var d=a.certificationRequestInfo||f.getCertificationRequestInfo(a),g=e.toDer(d);c.update(g.getBytes())}return null!==c&&(b=q({certificate:a,md:c,signature:a.signature})),b},a};var v=new Date("1950-01-01T00:00:00Z"),w=new Date("2050-01-01T00:00:00Z");function x(a){return a>=v&&a<w?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(a)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(a))}f.getTBSCertificate=function(a){var b=x(a.validity.notBefore),c=x(a.validity.notAfter),g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,d.util.hexToBytes(a.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.siginfo.algorithmOid).getBytes()),u(a.siginfo.algorithmOid,a.siginfo.parameters)]),r(a.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[b,c]),r(a.subject),f.publicKeyToAsn1(a.publicKey)]);return a.issuer.uniqueId&&g.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+a.issuer.uniqueId)])),a.subject.uniqueId&&g.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+a.subject.uniqueId)])),a.extensions.length>0&&g.value.push(f.certificateExtensionsToAsn1(a.extensions)),g},f.getCertificationRequestInfo=function(a){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes()),r(a.subject),f.publicKeyToAsn1(a.publicKey),function(a){var b=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===a.attributes.length)return b;for(var c=a.attributes,f=0;f<c.length;++f){var g=c[f],h=g.value,i=e.Type.UTF8;"valueTagClass"in g&&(i=g.valueTagClass),i===e.Type.UTF8&&(h=d.util.encodeUtf8(h));var j=!1;"valueConstructed"in g&&(j=g.valueConstructed);var k=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,i,j,h)])]);b.value.push(k)}return b}(a)])},f.distinguishedNameToAsn1=function(a){return r(a)},f.certificateToAsn1=function(a){var b=a.tbsCertificate||f.getTBSCertificate(a);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[b,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.signatureOid).getBytes()),u(a.signatureOid,a.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+a.signature)])},f.certificateExtensionsToAsn1=function(a){var b=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),c=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(f.certificateExtensionToAsn1(a[d]));return b},f.certificateExtensionToAsn1=function(a){var b=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);b.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.id).getBytes())),a.critical&&b.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;return"string"!=typeof a.value&&(c=e.toDer(c).getBytes()),b.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c)),b},f.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||f.getCertificationRequestInfo(a);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[b,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.signatureOid).getBytes()),u(a.signatureOid,a.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+a.signature)])},f.createCaStore=function(a){var b={certs:{}};function c(a){return g(a),b.certs[a.hash]||null}function g(a){if(!a.hash){var b=d.md.sha1.create();a.attributes=f.RDNAttributesAsArray(r(a),b),a.hash=b.digest().toHex()}}if(b.getIssuer=function(a){return c(a.issuer)},b.addCertificate=function(a){if("string"==typeof a&&(a=d.pki.certificateFromPem(a)),g(a.subject),!b.hasCertificate(a))if(a.subject.hash in b.certs){var c=b.certs[a.subject.hash];d.util.isArray(c)||(c=[c]),c.push(a),b.certs[a.subject.hash]=c}else b.certs[a.subject.hash]=a},b.hasCertificate=function(a){"string"==typeof a&&(a=d.pki.certificateFromPem(a));var b=c(a.subject);if(!b)return!1;d.util.isArray(b)||(b=[b]);for(var g=e.toDer(f.certificateToAsn1(a)).getBytes(),h=0;h<b.length;++h)if(g===e.toDer(f.certificateToAsn1(b[h])).getBytes())return!0;return!1},b.listAllCertificates=function(){var a=[];for(var c in b.certs)if(b.certs.hasOwnProperty(c)){var e=b.certs[c];if(d.util.isArray(e))for(var f=0;f<e.length;++f)a.push(e[f]);else a.push(e)}return a},b.removeCertificate=function(a){if("string"==typeof a&&(a=d.pki.certificateFromPem(a)),g(a.subject),!b.hasCertificate(a))return null;var h,i=c(a.subject);if(!d.util.isArray(i))return h=b.certs[a.subject.hash],delete b.certs[a.subject.hash],h;for(var j=e.toDer(f.certificateToAsn1(a)).getBytes(),k=0;k<i.length;++k)j===e.toDer(f.certificateToAsn1(i[k])).getBytes()&&(h=i[k],i.splice(k,1));return 0===i.length&&delete b.certs[a.subject.hash],h},a)for(var h=0;h<a.length;++h){var i=a[h];b.addCertificate(i)}return b},f.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},f.verifyCertificateChain=function(a,b,c){"function"==typeof c&&(c={verify:c}),c=c||{};var e=(b=b.slice(0)).slice(0),g=c.validityCheckDate;void 0===g&&(g=new Date);var h=!0,i=null,j=0;do{var k=b.shift(),l=null,m=!1;if(g&&(g<k.validity.notBefore||g>k.validity.notAfter)&&(i={message:"Certificate is not valid yet or has expired.",error:f.certificateError.certificate_expired,notBefore:k.validity.notBefore,notAfter:k.validity.notAfter,now:g}),null===i){if(null===(l=b[0]||a.getIssuer(k))&&k.isIssuer(k)&&(m=!0,l=k),l){var n=l;d.util.isArray(n)||(n=[n]);for(var o=!1;!o&&n.length>0;){l=n.shift();try{o=l.verify(k)}catch(a){}}o||(i={message:"Certificate signature is invalid.",error:f.certificateError.bad_certificate})}null!==i||l&&!m||a.hasCertificate(k)||(i={message:"Certificate is not trusted.",error:f.certificateError.unknown_ca})}if(null===i&&l&&!k.isIssuer(l)&&(i={message:"Certificate issuer is invalid.",error:f.certificateError.bad_certificate}),null===i)for(var p={keyUsage:!0,basicConstraints:!0},q=0;null===i&&q<k.extensions.length;++q){var r=k.extensions[q];!r.critical||r.name in p||(i={message:"Certificate has an unsupported critical extension.",error:f.certificateError.unsupported_certificate})}if(null===i&&(!h||0===b.length&&(!l||m))){var s=k.getExtension("basicConstraints"),t=k.getExtension("keyUsage");null===t||t.keyCertSign&&null!==s||(i={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:f.certificateError.bad_certificate}),null===i&&null===s&&(i={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:f.certificateError.bad_certificate}),null!==i||null===s||s.cA||(i={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:f.certificateError.bad_certificate}),null===i&&null!==t&&"pathLenConstraint"in s&&j-1>s.pathLenConstraint&&(i={message:"Certificate basicConstraints pathLenConstraint violated.",error:f.certificateError.bad_certificate})}var u=null===i||i.error,v=c.verify?c.verify(u,j,e):u;if(!0===v)i=null;else throw!0===u&&(i={message:"The application rejected the certificate.",error:f.certificateError.bad_certificate}),(v||0===v)&&("object"!=typeof v||d.util.isArray(v)?"string"==typeof v&&(i.error=v):(v.message&&(i.message=v.message),v.error&&(i.error=v.error))),i;h=!1,++j}while(b.length>0);return!0}},66568:(a,b,c)=>{var d=c(45654);c(33889),a.exports=d.cipher=d.cipher||{},d.cipher.algorithms=d.cipher.algorithms||{},d.cipher.createCipher=function(a,b){var c=a;if("string"==typeof c&&(c=d.cipher.getAlgorithm(c))&&(c=c()),!c)throw Error("Unsupported algorithm: "+a);return new d.cipher.BlockCipher({algorithm:c,key:b,decrypt:!1})},d.cipher.createDecipher=function(a,b){var c=a;if("string"==typeof c&&(c=d.cipher.getAlgorithm(c))&&(c=c()),!c)throw Error("Unsupported algorithm: "+a);return new d.cipher.BlockCipher({algorithm:c,key:b,decrypt:!0})},d.cipher.registerAlgorithm=function(a,b){a=a.toUpperCase(),d.cipher.algorithms[a]=b},d.cipher.getAlgorithm=function(a){return(a=a.toUpperCase())in d.cipher.algorithms?d.cipher.algorithms[a]:null};var e=d.cipher.BlockCipher=function(a){this.algorithm=a.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=a.decrypt,this.algorithm.initialize(a)};e.prototype.start=function(a){var b={};for(var c in a=a||{})b[c]=a[c];b.decrypt=this._decrypt,this._finish=!1,this._input=d.util.createBuffer(),this.output=a.output||d.util.createBuffer(),this.mode.start(b)},e.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(a){a&&("ECB"===this.mode.name||"CBC"===this.mode.name)&&(this.mode.pad=function(b){return a(this.blockSize,b,!1)},this.mode.unpad=function(b){return a(this.blockSize,b,!0)});var b={};return b.decrypt=this._decrypt,b.overflow=this._input.length()%this.blockSize,(!!this._decrypt||!this.mode.pad||!!this.mode.pad(this._input,b))&&(this._finish=!0,this.update(),(!this._decrypt||!this.mode.unpad||!!this.mode.unpad(this.output,b))&&(!this.mode.afterFinish||!!this.mode.afterFinish(this.output,b)))}},67382:(a,b,c)=>{var d=c(45654);c(33889);var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],f=[1,2,3,5];a.exports=d.rc2=d.rc2||{},d.rc2.expandKey=function(a,b){"string"==typeof a&&(a=d.util.createBuffer(a)),b=b||128;var c,f=a,g=a.length(),h=b,i=Math.ceil(h/8);for(c=g;c<128;c++)f.putByte(e[f.at(c-1)+f.at(c-g)&255]);for(f.setAt(128-i,e[f.at(128-i)&255>>(7&h)]),c=127-i;c>=0;c--)f.setAt(c,e[f.at(c+1)^f.at(c+i)]);return f};var g=function(a,b,c){var e,g,h,i,j=!1,k=null,l=null,m=null,n=[];for(a=d.rc2.expandKey(a,b),h=0;h<64;h++)n.push(a.getInt16Le());c?(e=function(a){for(h=0;h<4;h++){var b,c;a[h]+=n[i]+(a[(h+3)%4]&a[(h+2)%4])+(~a[(h+3)%4]&a[(h+1)%4]),a[h]=(b=a[h])<<(c=f[h])&65535|(65535&b)>>16-c,i++}},g=function(a){for(h=0;h<4;h++)a[h]+=n[63&a[(h+3)%4]]}):(e=function(a){for(h=3;h>=0;h--){var b,c;a[h]=(65535&(b=a[h]))>>(c=f[h])|b<<16-c&65535,a[h]-=n[i]+(a[(h+3)%4]&a[(h+2)%4])+(~a[(h+3)%4]&a[(h+1)%4]),i--}},g=function(a){for(h=3;h>=0;h--)a[h]-=n[63&a[(h+3)%4]]});var o=function(a){var b=[];for(h=0;h<4;h++){var d=k.getInt16Le();null!==m&&(c?d^=m.getInt16Le():m.putInt16Le(d)),b.push(65535&d)}i=63*!c;for(var e=0;e<a.length;e++)for(var f=0;f<a[e][0];f++)a[e][1](b);for(h=0;h<4;h++)null!==m&&(c?m.putInt16Le(b[h]):b[h]^=m.getInt16Le()),l.putInt16Le(b[h])},p=null;return p={start:function(a,b){a&&"string"==typeof a&&(a=d.util.createBuffer(a)),j=!1,k=d.util.createBuffer(),l=b||new d.util.createBuffer,m=a,p.output=l},update:function(a){for(j||k.putBuffer(a);k.length()>=8;)o([[5,e],[1,g],[6,e],[1,g],[5,e]])},finish:function(a){var b=!0;if(c)if(a)b=a(8,k,!c);else{var d=8===k.length()?8:8-k.length();k.fillWithByte(d,d)}if(b&&(j=!0,p.update()),!c&&(b=0===k.length()))if(a)b=a(8,l,!c);else{var e=l.length(),f=l.at(e-1);f>e?b=!1:l.truncate(f)}return b}}};d.rc2.startEncrypting=function(a,b,c){var e=d.rc2.createEncryptionCipher(a,128);return e.start(b,c),e},d.rc2.createEncryptionCipher=function(a,b){return g(a,b,!0)},d.rc2.startDecrypting=function(a,b,c){var e=d.rc2.createDecryptionCipher(a,128);return e.start(b,c),e},d.rc2.createDecryptionCipher=function(a,b){return g(a,b,!1)}},69445:(a,b,c)=>{a.exports=c(1277),c(38627),c(4554),c(6680),c(37691)},70710:(a,b,c)=>{var d,e=c(45654);c(76632),c(1277),c(33889);var f=e.pkcs5=e.pkcs5||{};e.util.isNodejs&&!e.options.usePureJavaScript&&(d=c(55511)),a.exports=e.pbkdf2=f.pbkdf2=function(a,b,c,f,g,h){if("function"==typeof g&&(h=g,g=null),e.util.isNodejs&&!e.options.usePureJavaScript&&d.pbkdf2&&(null===g||"object"!=typeof g)&&(d.pbkdf2Sync.length>4||!g||"sha1"===g))return("string"!=typeof g&&(g="sha1"),a=Buffer.from(a,"binary"),b=Buffer.from(b,"binary"),h)?4===d.pbkdf2Sync.length?d.pbkdf2(a,b,c,f,function(a,b){if(a)return h(a);h(null,b.toString("binary"))}):d.pbkdf2(a,b,c,f,g,function(a,b){if(a)return h(a);h(null,b.toString("binary"))}):4===d.pbkdf2Sync.length?d.pbkdf2Sync(a,b,c,f).toString("binary"):d.pbkdf2Sync(a,b,c,f,g).toString("binary");if(null==g&&(g="sha1"),"string"==typeof g){if(!(g in e.md.algorithms))throw Error("Unknown hash algorithm: "+g);g=e.md[g].create()}var i=g.digestLength;if(f>0xffffffff*i){var j=Error("Derived key is too long.");if(h)return h(j);throw j}var k=Math.ceil(f/i),l=f-(k-1)*i,m=e.hmac.create();m.start(g,a);var n="";if(!h){for(var o=1;o<=k;++o){m.start(null,null),m.update(b),m.update(e.util.int32ToBytes(o)),q=s=m.digest().getBytes();for(var p=2;p<=c;++p)m.start(null,null),m.update(s),r=m.digest().getBytes(),q=e.util.xorBytes(q,r,i),s=r;n+=o<k?q:q.substr(0,l)}return n}var q,r,s,p,o=1;!function a(){if(o>k)return h(null,n);m.start(null,null),m.update(b),m.update(e.util.int32ToBytes(o)),q=s=m.digest().getBytes(),p=2,function b(){if(p<=c)return m.start(null,null),m.update(s),r=m.digest().getBytes(),q=e.util.xorBytes(q,r,i),s=r,++p,e.util.setImmediate(b);n+=o<k?q:q.substr(0,l),++o,a()}()}()}},76103:(a,b,c)=>{var d=c(45654);c(45518),c(63070),c(88819),c(36105),c(49345),c(56416),c(29984),c(33889),c(65737);var e=d.asn1,f=a.exports=d.pkcs7=d.pkcs7||{};function g(a){var b;if(a.type===d.pki.oids.contentType)b=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.value).getBytes());else if(a.type===d.pki.oids.messageDigest)b=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,a.value.bytes());else if(a.type===d.pki.oids.signingTime){var c=new Date("1950-01-01T00:00:00Z"),f=new Date("2050-01-01T00:00:00Z"),g=a.value;if("string"==typeof g){var h=Date.parse(g);g=isNaN(h)?13===g.length?e.utcTimeToDate(g):e.generalizedTimeToDate(g):new Date(h)}b=g>=c&&g<f?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(g)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(g))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[b])])}function h(a,b,c){var f={};if(!e.validate(b,c,f,[])){var g=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw g.errors=g,g}if(e.derToOid(f.contentType)!==d.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(f.encryptedContent){var h="";if(d.util.isArray(f.encryptedContent))for(var i=0;i<f.encryptedContent.length;++i){if(f.encryptedContent[i].type!==e.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");h+=f.encryptedContent[i].value}else h=f.encryptedContent;a.encryptedContent={algorithm:e.derToOid(f.encAlgorithm),parameter:d.util.createBuffer(f.encParameter.value),content:d.util.createBuffer(h)}}if(f.content){var h="";if(d.util.isArray(f.content))for(var i=0;i<f.content.length;++i){if(f.content[i].type!==e.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");h+=f.content[i].value}else h=f.content;a.content=d.util.createBuffer(h)}return a.version=f.version.charCodeAt(0),a.rawCapture=f,f}function i(a){if(void 0===a.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===a.content){var b;switch(a.encryptedContent.algorithm){case d.pki.oids["aes128-CBC"]:case d.pki.oids["aes192-CBC"]:case d.pki.oids["aes256-CBC"]:b=d.aes.createDecryptionCipher(a.encryptedContent.key);break;case d.pki.oids.desCBC:case d.pki.oids["des-EDE3-CBC"]:b=d.des.createDecryptionCipher(a.encryptedContent.key);break;default:throw Error("Unsupported symmetric cipher, OID "+a.encryptedContent.algorithm)}if(b.start(a.encryptedContent.parameter),b.update(a.encryptedContent.content),!b.finish())throw Error("Symmetric decryption failed.");a.content=b.output}}f.messageFromPem=function(a){var b=d.pem.decode(a)[0];if("PKCS7"!==b.type){var c=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw c.headerType=b.type,c}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var g=e.fromDer(b.body);return f.messageFromAsn1(g)},f.messageToPem=function(a,b){var c={type:"PKCS7",body:e.toDer(a.toAsn1()).getBytes()};return d.pem.encode(c,{maxline:b})},f.messageFromAsn1=function(a){var b,c={},g=[];if(!e.validate(a,f.asn1.contentInfoValidator,c,g)){var h=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw h.errors=g,h}var i=e.derToOid(c.contentType);switch(i){case d.pki.oids.envelopedData:b=f.createEnvelopedData();break;case d.pki.oids.encryptedData:b=f.createEncryptedData();break;case d.pki.oids.signedData:b=f.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return b.fromAsn1(c.content.value[0]),b},f.createSignedData=function(){var a=null;return a={type:d.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(b){if(h(a,b,f.asn1.signedDataValidator),a.certificates=[],a.crls=[],a.digestAlgorithmIdentifiers=[],a.contentInfo=null,a.signerInfos=[],a.rawCapture.certificates)for(var c=a.rawCapture.certificates.value,e=0;e<c.length;++e)a.certificates.push(d.pki.certificateFromAsn1(c[e]))},toAsn1:function(){a.contentInfo||a.sign();for(var b=[],c=0;c<a.certificates.length;++c)b.push(d.pki.certificateToAsn1(a.certificates[c]));var f=[],g=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,a.digestAlgorithmIdentifiers),a.contentInfo])]);return b.length>0&&g.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,b)),f.length>0&&g.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,f)),g.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,a.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.type).getBytes()),g])},addSigner:function(b){var c=b.issuer,e=b.serialNumber;if(b.certificate){var f=b.certificate;"string"==typeof f&&(f=d.pki.certificateFromPem(f)),c=f.issuer.attributes,e=f.serialNumber}var g=b.key;if(!g)throw Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof g&&(g=d.pki.privateKeyFromPem(g));var h=b.digestAlgorithm||d.pki.oids.sha1;switch(h){case d.pki.oids.sha1:case d.pki.oids.sha256:case d.pki.oids.sha384:case d.pki.oids.sha512:case d.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+h)}var i=b.authenticatedAttributes||[];if(i.length>0){for(var j=!1,k=!1,l=0;l<i.length;++l){var m=i[l];if(!j&&m.type===d.pki.oids.contentType){if(j=!0,k)break;continue}if(!k&&m.type===d.pki.oids.messageDigest){if(k=!0,j)break;continue}}if(!j||!k)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}a.signers.push({key:g,version:1,issuer:c,serialNumber:e,digestAlgorithm:h,signatureAlgorithm:d.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:i,unauthenticatedAttributes:[]})},sign:function(b){if(b=b||{},("object"!=typeof a.content||null===a.contentInfo)&&(a.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d.pki.oids.data).getBytes())]),"content"in a)){var c;a.content instanceof d.util.ByteBuffer?c=a.content.bytes():"string"==typeof a.content&&(c=d.util.encodeUtf8(a.content)),b.detached?a.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c):a.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c)]))}0!==a.signers.length&&function(b){if(!(c=a.detachedContent?a.detachedContent:(c=a.contentInfo.value[1]).value[0]))throw Error("Could not sign PKCS#7 message; there is no content to sign.");var c,f=e.derToOid(a.contentInfo.value[0].value),h=e.toDer(c);for(var i in h.getByte(),e.getBerValueLength(h),h=h.getBytes(),b)b[i].start().update(h);for(var j=new Date,k=0;k<a.signers.length;++k){var l=a.signers[k];if(0===l.authenticatedAttributes.length){if(f!==d.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var m=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),n=0;n<l.authenticatedAttributes.length;++n){var o=l.authenticatedAttributes[n];o.type===d.pki.oids.messageDigest?o.value=b[l.digestAlgorithm].digest():o.type!==d.pki.oids.signingTime||o.value||(o.value=j),m.value.push(g(o)),l.authenticatedAttributesAsn1.value.push(g(o))}h=e.toDer(m).getBytes(),l.md.start().update(h)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}a.signerInfos=function(a){for(var b=[],c=0;c<a.length;++c)b.push(function(a){var b=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[d.pki.distinguishedNameToAsn1({attributes:a.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,d.util.hexToBytes(a.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(a.authenticatedAttributesAsn1&&b.value.push(a.authenticatedAttributesAsn1),b.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),b.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,a.signature)),a.unauthenticatedAttributes.length>0){for(var c=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),f=0;f<a.unauthenticatedAttributes.length;++f){var h=a.unauthenticatedAttributes[f];c.values.push(g(h))}b.value.push(c)}return b}(a[c]));return b}(a.signers)}(function(){for(var b={},c=0;c<a.signers.length;++c){var f=a.signers[c],g=f.digestAlgorithm;g in b||(b[g]=d.md[d.pki.oids[g]].create()),0===f.authenticatedAttributes.length?f.md=b[g]:f.md=d.md[d.pki.oids[g]].create()}for(var g in a.digestAlgorithmIdentifiers=[],b)a.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return b}())},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(b){"string"==typeof b&&(b=d.pki.certificateFromPem(b)),a.certificates.push(b)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.")}}},f.createEncryptedData=function(){var a=null;return a={type:d.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:d.pki.oids["aes256-CBC"]},fromAsn1:function(b){h(a,b,f.asn1.encryptedDataValidator)},decrypt:function(b){void 0!==b&&(a.encryptedContent.key=b),i(a)}}},f.createEnvelopedData=function(){var a=null;return a={type:d.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:d.pki.oids["aes256-CBC"]},fromAsn1:function(b){var c=h(a,b,f.asn1.envelopedDataValidator);a.recipients=function(a){for(var b=[],c=0;c<a.length;++c)b.push(function(a){var b={},c=[];if(!e.validate(a,f.asn1.recipientInfoValidator,b,c)){var g=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw g.errors=c,g}return{version:b.version.charCodeAt(0),issuer:d.pki.RDNAttributesAsArray(b.issuer),serialNumber:d.util.createBuffer(b.serial).toHex(),encryptedContent:{algorithm:e.derToOid(b.encAlgorithm),parameter:b.encParameter?b.encParameter.value:void 0,content:b.encKey}}}(a[c]));return b}(c.recipientInfos.value)},toAsn1:function(){var b;return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,function(a){for(var b,c=[],f=0;f<a.length;++f)c.push((b=a[f],e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(b.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[d.pki.distinguishedNameToAsn1({attributes:b.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,d.util.hexToBytes(b.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b.encryptedContent.content)])));return c}(a.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,(b=a.encryptedContent,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.algorithm).getBytes()),b.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b.content.getBytes())])]))])])])},findRecipient:function(b){for(var c=b.issuer.attributes,d=0;d<a.recipients.length;++d){var e=a.recipients[d],f=e.issuer;if(e.serialNumber===b.serialNumber&&f.length===c.length){for(var g=!0,h=0;h<c.length;++h)if(f[h].type!==c[h].type||f[h].value!==c[h].value){g=!1;break}if(g)return e}}return null},decrypt:function(b,c){if(void 0===a.encryptedContent.key&&void 0!==b&&void 0!==c)switch(b.encryptedContent.algorithm){case d.pki.oids.rsaEncryption:case d.pki.oids.desCBC:var e=c.decrypt(b.encryptedContent.content);a.encryptedContent.key=d.util.createBuffer(e);break;default:throw Error("Unsupported asymmetric cipher, OID "+b.encryptedContent.algorithm)}i(a)},addRecipient:function(b){a.recipients.push({version:0,issuer:b.issuer.attributes,serialNumber:b.serialNumber,encryptedContent:{algorithm:d.pki.oids.rsaEncryption,key:b.publicKey}})},encrypt:function(b,c){if(void 0===a.encryptedContent.content){switch(c=c||a.encryptedContent.algorithm,b=b||a.encryptedContent.key,c){case d.pki.oids["aes128-CBC"]:e=16,f=16,g=d.aes.createEncryptionCipher;break;case d.pki.oids["aes192-CBC"]:e=24,f=16,g=d.aes.createEncryptionCipher;break;case d.pki.oids["aes256-CBC"]:e=32,f=16,g=d.aes.createEncryptionCipher;break;case d.pki.oids["des-EDE3-CBC"]:e=24,f=8,g=d.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+c)}if(void 0===b)b=d.util.createBuffer(d.random.getBytes(e));else if(b.length()!=e)throw Error("Symmetric key has wrong length; got "+b.length()+" bytes, expected "+e+".");a.encryptedContent.algorithm=c,a.encryptedContent.key=b,a.encryptedContent.parameter=d.util.createBuffer(d.random.getBytes(f));var e,f,g,h=g(b);if(h.start(a.encryptedContent.parameter.copy()),h.update(a.content),!h.finish())throw Error("Symmetric encryption failed.");a.encryptedContent.content=h.output}for(var i=0;i<a.recipients.length;++i){var j=a.recipients[i];if(void 0===j.encryptedContent.content)if(j.encryptedContent.algorithm===d.pki.oids.rsaEncryption)j.encryptedContent.content=j.encryptedContent.key.encrypt(a.encryptedContent.key.data);else throw Error("Unsupported asymmetric cipher, OID "+j.encryptedContent.algorithm)}}}}},76632:(a,b,c)=>{var d=c(45654);c(1277),c(33889),(a.exports=d.hmac=d.hmac||{}).create=function(){var a=null,b=null,c=null,e=null,f={};return f.start=function(f,g){if(null!==f)if("string"==typeof f)if((f=f.toLowerCase())in d.md.algorithms)b=d.md.algorithms[f].create();else throw Error('Unknown hash algorithm "'+f+'"');else b=f;if(null===g)g=a;else{if("string"==typeof g)g=d.util.createBuffer(g);else if(d.util.isArray(g)){var h=g;g=d.util.createBuffer();for(var i=0;i<h.length;++i)g.putByte(h[i])}var j=g.length();j>b.blockLength&&(b.start(),b.update(g.bytes()),g=b.digest()),c=d.util.createBuffer(),e=d.util.createBuffer(),j=g.length();for(var i=0;i<j;++i){var h=g.at(i);c.putByte(54^h),e.putByte(92^h)}if(j<b.blockLength)for(var h=b.blockLength-j,i=0;i<h;++i)c.putByte(54),e.putByte(92);a=g,c=c.bytes(),e=e.bytes()}b.start(),b.update(c)},f.update=function(a){b.update(a)},f.getMac=function(){var a=b.digest().bytes();return b.start(),b.update(e),b.update(a),b.digest()},f.digest=f.getMac,f}},77051:(a,b,c)=>{"use strict";let d=c(14985).promises,e=c(91645),{normalizeIp:f,clientIpMatches:g}=c(54584),h=new Map,i=Object.freeze(["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.2.0/24","192.88.99.0/24","192.168.0.0/16","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","224.0.0.0/4","240.0.0.0/4","::/96","::1/128","100::/64","2001:2::/48","2001:db8::/32","fc00::/7","fe80::/10","ff00::/8"]),j=Object.freeze([".localhost",".local",".internal",".lan",".home.arpa"]);function k(a){return String(a||"").trim().replace(/^\[|\]$/g,"").replace(/\.$/,"").toLowerCase()}function l(a){let b=k(a);return!(!(!b||"localhost"===b||j.some(a=>b.endsWith(a)))&&(e.isIP(b)||b.includes(".")))}function m(a){let b=f(a);return!!e.isIP(b)&&!g(b,i)}function n(a){let b=[...new Set((Array.isArray(a)?a:[a]).map(a=>Number(a)).filter(a=>Number.isInteger(a)&&a>=1&&a<=65535))];return b.length?b:[443]}function o(a){let b=[...a?.addresses||[]];return function(c,d,e){let f=d,g=e;"function"==typeof d&&(g=d,f={});let h="number"==typeof f?f:Number(f?.family||0);if("object"==typeof f&&f?.all===!0){let c=4===h||6===h?b.filter(a=>a.family===h):b;if(!c.length){let b=Error(`No validated public address for ${a.host}`);b.code="ENOTFOUND",g(b);return}g(null,c.map(({address:a,family:b})=>({address:a,family:b})));return}let i=function(a,b=0){let c=Number(b||0);return 4===c||6===c?a.find(a=>a.family===c)||null:a.find(a=>4===a.family)||a[0]||null}(b,h);if(!i){let b=Error(`No validated public address for ${a.host}`);b.code="ENOTFOUND",g(b);return}g(null,i.address,i.family)}}async function p(a,b,c={}){let g=k(a),i=Number(b||443),j=n(c.allowedPorts||[443]);if(!g)throw Error("Destination host is empty");if(!Number.isInteger(i)||!j.includes(i))throw Error(`CONNECT destination port ${i||"unknown"} is not allowed`);if(l(g))throw Error(`Private or local destination hostname is not allowed: ${g}`);let q=e.isIP(f(g));if(q){let a=f(g);if(!m(a))throw Error(`Private or reserved destination address is not allowed: ${a}`);let b={host:g,port:i,addresses:[{address:a,family:q}]};return{...b,lookup:o(b)}}let r=Date.now(),s=h.get(g);if(!s||s.expiresAt<=r){let a=await d.lookup(g,{all:!0,verbatim:!0}),b=[],c=new Set;for(let d of a||[]){let a=f(d.address),g=e.isIP(a);if(!g||!m(a))continue;let h=`${g}:${a}`;c.has(h)||(c.add(h),b.push({address:a,family:g}))}if(!b.length)throw Error(`Destination did not resolve to a public address: ${g}`);s={addresses:b,expiresAt:r+6e4},h.set(g,s)}let t={host:g,port:i,addresses:[...s.addresses]};return{...t,lookup:o(t)}}a.exports={BLOCKED_ADDRESS_RANGES:i,normalizeTargetHost:k,normalizeAllowedPorts:n,isBlockedHostname:l,isPublicAddress:m,createPinnedLookup:o,resolvePublicTarget:p,clearDnsPolicyCache:function(){h.clear()}}},87981:(a,b,c)=>{var d=c(45654);c(29984),c(33889),(a.exports=d.pss=d.pss||{}).create=function(a){3==arguments.length&&(a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var b,c=a.md,e=a.mgf,f=c.digestLength,g=a.salt||null;if("string"==typeof g&&(g=d.util.createBuffer(g)),"saltLength"in a)b=a.saltLength;else if(null!==g)b=g.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==g&&g.length()!==b)throw Error("Given salt length does not match length of given salt.");var h=a.prng||d.random,i={};return i.encode=function(a,i){var j,k,l=i-1,m=Math.ceil(l/8),n=a.digest().getBytes();if(m<f+b+2)throw Error("Message is too long to encrypt.");k=null===g?h.getBytesSync(b):g.bytes();var o=new d.util.ByteBuffer;o.fillWithByte(0,8),o.putBytes(n),o.putBytes(k),c.start(),c.update(o.getBytes());var p=c.digest().getBytes(),q=new d.util.ByteBuffer;q.fillWithByte(0,m-b-f-2),q.putByte(1),q.putBytes(k);var r=q.getBytes(),s=m-f-1,t=e.generate(p,s),u="";for(j=0;j<s;j++)u+=String.fromCharCode(r.charCodeAt(j)^t.charCodeAt(j));return(u=String.fromCharCode(u.charCodeAt(0)&~(65280>>8*m-l&255))+u.substr(1))+p+String.fromCharCode(188)},i.verify=function(a,g,h){var i,j=h-1,k=Math.ceil(j/8);if(g=g.substr(-k),k<f+b+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(k-1))throw Error("Encoded message does not end in 0xBC.");var l=k-f-1,m=g.substr(0,l),n=g.substr(l,f),o=65280>>8*k-j&255;if((m.charCodeAt(0)&o)!=0)throw Error("Bits beyond keysize not zero as expected.");var p=e.generate(n,l),q="";for(i=0;i<l;i++)q+=String.fromCharCode(m.charCodeAt(i)^p.charCodeAt(i));q=String.fromCharCode(q.charCodeAt(0)&~o)+q.substr(1);var r=k-f-b-2;for(i=0;i<r;i++)if(0!==q.charCodeAt(i))throw Error("Leftmost octets not zero as expected");if(1!==q.charCodeAt(r))throw Error("Inconsistent PSS signature, 0x01 marker not found");var s=q.substr(-b),t=new d.util.ByteBuffer;return t.fillWithByte(0,8),t.putBytes(a),t.putBytes(s),c.start(),c.update(t.getBytes()),n===c.digest().getBytes()},i}},88819:(a,b,c)=>{var d=c(45654);function e(a,b){d.cipher.registerAlgorithm(a,function(){return new d.des.Algorithm(a,b)})}c(66568),c(19396),c(33889),a.exports=d.des=d.des||{},d.des.startEncrypting=function(a,b,c,d){var e=o({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});return e.start(b),e},d.des.createEncryptionCipher=function(a,b){return o({key:a,output:null,decrypt:!1,mode:b})},d.des.startDecrypting=function(a,b,c,d){var e=o({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});return e.start(b),e},d.des.createDecryptionCipher=function(a,b){return o({key:a,output:null,decrypt:!0,mode:b})},d.des.Algorithm=function(a,b){var c=this;c.name=a,c.mode=new b({blockSize:8,cipher:{encrypt:function(a,b){return n(c._keys,a,b,!1)},decrypt:function(a,b){return n(c._keys,a,b,!0)}}}),c._init=!1},d.des.Algorithm.prototype.initialize=function(a){if(!this._init){var b=d.util.createBuffer(a.key);if(0===this.name.indexOf("3DES")&&24!==b.length())throw Error("Invalid Triple-DES key size: "+8*b.length());this._keys=function(a){for(var b,c=[0,4,0x20000000,0x20000004,65536,65540,0x20010000,0x20010004,512,516,0x20000200,0x20000204,66048,66052,0x20010200,0x20010204],d=[0,1,1048576,1048577,0x4000000,0x4000001,0x4100000,0x4100001,256,257,1048832,1048833,0x4000100,0x4000101,0x4100100,0x4100101],e=[0,8,2048,2056,0x1000000,0x1000008,0x1000800,0x1000808,0,8,2048,2056,0x1000000,0x1000008,0x1000800,0x1000808],f=[0,2097152,0x8000000,0x8200000,8192,2105344,0x8002000,0x8202000,131072,2228224,0x8020000,0x8220000,139264,2236416,0x8022000,0x8222000],g=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],h=[0,1024,32,1056,0,1024,32,1056,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420],i=[0,0x10000000,524288,0x10080000,2,0x10000002,524290,0x10080002,0,0x10000000,524288,0x10080000,2,0x10000002,524290,0x10080002],j=[0,65536,2048,67584,0x20000000,0x20010000,0x20000800,0x20010800,131072,196608,133120,198656,0x20020000,0x20030000,0x20020800,0x20030800],k=[0,262144,0,262144,2,262146,2,262146,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002],l=[0,0x10000000,8,0x10000008,0,0x10000000,8,0x10000008,1024,0x10000400,1032,0x10000408,1024,0x10000400,1032,0x10000408],m=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],n=[0,0x1000000,512,0x1000200,2097152,0x1200000,2097664,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200],o=[0,4096,0x8000000,0x8001000,524288,528384,0x8080000,0x8081000,16,4112,0x8000010,0x8001010,524304,528400,0x8080010,0x8081010],p=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],q=a.length()>8?3:1,r=[],s=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],t=0,u=0;u<q;u++){var v=a.getInt32(),w=a.getInt32();b=(v>>>4^w)&0xf0f0f0f,w^=b,v^=b<<4,b=(w>>>-16^v)&65535,v^=b,w^=b<<-16,b=(v>>>2^w)&0x33333333,w^=b,v^=b<<2,b=(w>>>-16^v)&65535,v^=b,w^=b<<-16,b=(v>>>1^w)&0x55555555,w^=b,v^=b<<1,b=(w>>>8^v)&0xff00ff,v^=b,w^=b<<8,b=(v>>>1^w)&0x55555555,w^=b,v^=b<<1,b=v<<8|w>>>20&240,v=w<<24|w<<8&0xff0000|w>>>8&65280|w>>>24&240,w=b;for(var x=0;x<s.length;++x){s[x]?(v=v<<2|v>>>26,w=w<<2|w>>>26):(v=v<<1|v>>>27,w=w<<1|w>>>27),w&=-15;var y=c[(v&=-15)>>>28]|d[v>>>24&15]|e[v>>>20&15]|f[v>>>16&15]|g[v>>>12&15]|h[v>>>8&15]|i[v>>>4&15],z=j[w>>>28]|k[w>>>24&15]|l[w>>>20&15]|m[w>>>16&15]|n[w>>>12&15]|o[w>>>8&15]|p[w>>>4&15];b=(z>>>16^y)&65535,r[t++]=y^b,r[t++]=z^b<<16}}return r}(b),this._init=!0}},e("DES-ECB",d.cipher.modes.ecb),e("DES-CBC",d.cipher.modes.cbc),e("DES-CFB",d.cipher.modes.cfb),e("DES-OFB",d.cipher.modes.ofb),e("DES-CTR",d.cipher.modes.ctr),e("3DES-ECB",d.cipher.modes.ecb),e("3DES-CBC",d.cipher.modes.cbc),e("3DES-CFB",d.cipher.modes.cfb),e("3DES-OFB",d.cipher.modes.ofb),e("3DES-CTR",d.cipher.modes.ctr);var f=[0x1010400,0,65536,0x1010404,0x1010004,66564,4,65536,1024,0x1010400,0x1010404,1024,0x1000404,0x1010004,0x1000000,4,1028,0x1000400,0x1000400,66560,66560,0x1010000,0x1010000,0x1000404,65540,0x1000004,0x1000004,65540,0,1028,66564,0x1000000,65536,0x1010404,4,0x1010000,0x1010400,0x1000000,0x1000000,1024,0x1010004,65536,66560,0x1000004,1024,4,0x1000404,66564,0x1010404,65540,0x1010000,0x1000404,0x1000004,1028,66564,0x1010400,1028,0x1000400,0x1000400,0,65540,66560,0,0x1010004],g=[-0x7fef7fe0,-0x7fff8000,32768,1081376,1048576,32,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,1048576,32,-0x7fefffe0,1081344,1048608,-0x7fff7fe0,0,-0x80000000,32768,1081376,-0x7ff00000,1048608,-0x7fffffe0,0,1081344,32800,-0x7fef8000,-0x7ff00000,32800,0,1081376,-0x7fefffe0,1048576,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,32768,-0x7ff00000,-0x7fff8000,32,-0x7fef7fe0,1081376,32,32768,-0x80000000,32800,-0x7fef8000,1048576,-0x7fffffe0,1048608,-0x7fff7fe0,-0x7fffffe0,1048608,1081344,0,-0x7fff8000,32800,-0x80000000,-0x7fefffe0,-0x7fef7fe0,1081344],h=[520,0x8020200,0,0x8020008,0x8000200,0,131592,0x8000200,131080,0x8000008,0x8000008,131072,0x8020208,131080,0x8020000,520,0x8000000,8,0x8020200,512,131584,0x8020000,0x8020008,131592,0x8000208,131584,131072,0x8000208,8,0x8020208,512,0x8000000,0x8020200,0x8000000,131080,520,131072,0x8020200,0x8000200,0,512,131080,0x8020208,0x8000200,0x8000008,512,0,0x8020008,0x8000208,131072,0x8000000,0x8020208,8,131592,131584,0x8000008,0x8020000,0x8000208,520,0x8020000,131592,8,0x8020008,131584],i=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],j=[256,0x2080100,0x2080000,0x42000100,524288,256,0x40000000,0x2080000,0x40080100,524288,0x2000100,0x40080100,0x42000100,0x42080000,524544,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,524544,524288,0x42000100,256,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,256,0x2000000,0x42080000,0x42080100,524544,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,524544,0x2000100,0x40000100,524288,0,0x40080000,0x2080100,0x40000100],k=[0x20000010,0x20400000,16384,0x20404010,0x20400000,16,0x20404010,4194304,0x20004000,4210704,4194304,0x20000010,4194320,0x20004000,0x20000000,16400,0,4194320,0x20004010,16384,4210688,0x20004010,16,0x20400010,0x20400010,0,4210704,0x20404000,16400,4210688,0x20404000,0x20000000,0x20004000,16,0x20400010,4210688,0x20404010,4194304,16400,0x20000010,4194304,0x20004000,0x20000000,16400,0x20000010,0x20404010,4210688,0x20400000,4210704,0x20404000,0,0x20400010,16,16384,0x20400000,4210704,16384,4194320,0x20004010,0,0x20404000,0x20000000,4194320,0x20004010],l=[2097152,0x4200002,0x4000802,0,2048,0x4000802,2099202,0x4200800,0x4200802,2097152,0,0x4000002,2,0x4000000,0x4200002,2050,0x4000800,2099202,2097154,0x4000800,0x4000002,0x4200000,0x4200800,2097154,0x4200000,2048,2050,0x4200802,2099200,2,0x4000000,2099200,0x4000000,2099200,2097152,0x4000802,0x4000802,0x4200002,0x4200002,2,2097154,0x4000000,0x4000800,2097152,0x4200800,2050,2099202,0x4200800,2050,0x4000002,0x4200802,0x4200000,2099200,0,2,0x4200802,0,2099202,0x4200000,2048,0x4000002,0x4000800,2048,2097154],m=[0x10001040,4096,262144,0x10041040,0x10000000,0x10001040,64,0x10000000,262208,0x10040000,0x10041040,266240,0x10041000,266304,4096,64,0x10040000,0x10000040,0x10001000,4160,266240,262208,0x10040040,0x10041000,4160,0,0,0x10040040,0x10000040,0x10001000,266304,262144,266304,262144,0x10041000,4096,64,0x10040040,4096,266304,0x10001000,64,0x10000040,0x10040000,0x10040040,0x10000000,262144,0x10001040,0,0x10041040,262208,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,266240,266240,4160,4160,262208,0x10000000,0x10041000];function n(a,b,c,d){var e,n,o=32===a.length?3:9;e=3===o?d?[30,-2,-2]:[0,32,2]:d?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var p=b[0],q=b[1];n=(p>>>4^q)&0xf0f0f0f,q^=n,p^=n<<4,n=(p>>>16^q)&65535,q^=n,p^=n<<16,n=(q>>>2^p)&0x33333333,p^=n,q^=n<<2,n=(q>>>8^p)&0xff00ff,p^=n,q^=n<<8,n=(p>>>1^q)&0x55555555,q^=n,p^=n<<1,p=p<<1|p>>>31,q=q<<1|q>>>31;for(var r=0;r<o;r+=3){for(var s=e[r+1],t=e[r+2],u=e[r];u!=s;u+=t){var v=q^a[u],w=(q>>>4|q<<28)^a[u+1];n=p,p=q,q=n^(g[v>>>24&63]|i[v>>>16&63]|k[v>>>8&63]|m[63&v]|f[w>>>24&63]|h[w>>>16&63]|j[w>>>8&63]|l[63&w])}n=p,p=q,q=n}n=((p=p>>>1|p<<31)>>>1^(q=q>>>1|q<<31))&0x55555555,q^=n,p^=n<<1,n=(q>>>8^p)&0xff00ff,p^=n,q^=n<<8,n=(q>>>2^p)&0x33333333,p^=n,q^=n<<2,n=(p>>>16^q)&65535,q^=n,p^=n<<16,n=(p>>>4^q)&0xf0f0f0f,q^=n,p^=n<<4,c[0]=p,c[1]=q}function o(a){var b,c="DES-"+((a=a||{}).mode||"CBC").toUpperCase(),e=(b=a.decrypt?d.cipher.createDecipher(c,a.key):d.cipher.createCipher(c,a.key)).start;return b.start=function(a,c){var f=null;c instanceof d.util.ByteBuffer&&(f=c,c={}),(c=c||{}).output=f,c.iv=a,e.call(b,c)},b}},93599:(a,b,c)=>{"use strict";let d=c(73496),e=c(91645),f=c(34631),g=c(74075),h=c(55511),i=c(5019),{createAuditProxy:j,CaptureBuffer:k}=c(33575),{containsLikelySecret:l}=c(14681),{clientIpMatches:m,normalizeAllowedClientIps:n}=c(54584),{isPublicAddress:o}=c(77051);function p(a){return h.createHash("sha256").update(a).digest("hex")}function q(a){let b=i.pki.rsa.generateKeyPair(2048),c=i.pki.createCertificate();c.publicKey=b.publicKey,c.serialNumber=String(Date.now()),c.validity.notBefore=new Date(Date.now()-6e4),c.validity.notAfter=new Date(Date.now()+864e5);let d=[{name:"commonName",value:a}];return c.setSubject(d),c.setIssuer(d),c.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0}]),c.sign(b.privateKey,i.md.sha256.create()),{cert:c,keys:b,certPem:i.pki.certificateToPem(c)}}function r(a,b){let c=i.pki.rsa.generateKeyPair(2048),d=i.pki.createCertificate();return d.publicKey=c.publicKey,d.serialNumber=`${Date.now()}${Math.floor(1e3*Math.random())}`,d.validity.notBefore=new Date(Date.now()-6e4),d.validity.notAfter=new Date(Date.now()+864e5),d.setSubject([{name:"commonName",value:b}]),d.setIssuer(a.cert.subject.attributes),d.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:b}]}]),d.sign(a.keys.privateKey,i.md.sha256.create()),{cert:i.pki.certificateToPem(d),key:i.pki.privateKeyToPem(c.privateKey)}}function s(a,b="127.0.0.1"){return new Promise((c,d)=>{a.once("error",d),a.listen(0,b,()=>{a.removeListener("error",d),c(a.address())})})}function t(a){return new Promise(b=>{if(!a)return b();try{a.forceCloseAll?.()}catch{}if(!a.listening)return b();a.close(()=>b()),setTimeout(b,1e3).unref?.()})}function u(a,b){let c="127.0.0.1";return Promise.resolve({host:a,port:b,addresses:[{address:c,family:4}],lookup:(a,b,d)=>{let e=b,f=d;"function"==typeof b&&(f=b,e={}),e?.all?f(null,[{address:c,family:4}]):f(null,c,4)}})}function v(a,b){return new Promise((c,d)=>{let f=e.connect(a,"127.0.0.1"),g=Buffer.alloc(0),h=setTimeout(()=>d(Error("CONNECT timeout")),7e3);f.once("error",d),f.once("connect",()=>{f.write(`CONNECT ${b} HTTP/1.1\r
|
|
48
|
+
AND NOT EXISTS (SELECT 1 FROM prompt_logs r WHERE r.response_payload_hash = p.payload_hash)`,[b]);await a.commit()}catch(b){if(a)try{await a.rollback()}catch{}A(`Failed to clear mirrored audit rows: ${b.message||b}`)}finally{try{a?.release()}catch{}}}a.exports={appendAudit:function(a){return P(async()=>a)},enqueueAuditJob:P,readRecent:S,clearAudit:async function a(){z.clearing=!0,z.queue.length=0,z.workers.size&&await Promise.allSettled([...z.workers]),j();let a=await d.promises.readdir(i).catch(()=>[]);await Promise.all(a.filter(a=>a.endsWith(".jsonl")).map(a=>d.promises.unlink(e.join(i,a)).catch(()=>{}))),await d.promises.writeFile(h,"",{mode:384}).catch(()=>{}),y.clear(),await W(),z.clearing=!1,z.queue.length&&setImmediate(O)},pruneExpired:U,startAuditMaintenance:function(){x||(x=setInterval(()=>void U(),36e5),x.unref?.())},stopAuditMaintenance:function(){x&&clearInterval(x),x=null},flushAuditQueue:V,getAuditStoreStats:function(){return{queueDepth:z.queue.length,queueLimit:1e3,workerRunning:z.activeWorkers>0,workerConcurrency:4,activeWorkers:z.activeWorkers,mysqlPoolConnections:4,enqueued:z.enqueued,written:z.written,dropped:z.dropped,failed:z.failed,mysqlWritten:z.mysqlWritten,mysqlFailed:z.mysqlFailed,lastError:z.lastError,lastWrittenAt:z.lastWrittenAt,logDirectory:i}},appendPromptLog:J}},63070:(a,b,c)=>{var d=c(45654);c(33889),c(36105);var e=a.exports=d.asn1=d.asn1||{};function f(a,b,c){if(c>b){var d=Error("Too few bytes to parse DER.");throw d.available=a.length(),d.remaining=b,d.requested=c,d}}e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.maxDepth=256,e.create=function(a,b,c,f,g){if(d.util.isArray(f)){for(var h=[],i=0;i<f.length;++i)void 0!==f[i]&&h.push(f[i]);f=h}var j={tagClass:a,type:b,constructed:c,composed:c||d.util.isArray(f),value:f};return g&&"bitStringContents"in g&&(j.bitStringContents=g.bitStringContents,j.original=e.copy(j)),j},e.copy=function(a,b){var c;if(d.util.isArray(a)){c=[];for(var f=0;f<a.length;++f)c.push(e.copy(a[f],b));return c}return"string"==typeof a?a:(c={tagClass:a.tagClass,type:a.type,constructed:a.constructed,composed:a.composed,value:e.copy(a.value,b)},b&&!b.excludeBitStringContents&&(c.bitStringContents=a.bitStringContents),c)},e.equals=function(a,b,c){if(d.util.isArray(a)){if(!d.util.isArray(b)||a.length!==b.length)return!1;for(var f=0;f<a.length;++f)if(!e.equals(a[f],b[f]))return!1;return!0}if(typeof a!=typeof b)return!1;if("string"==typeof a)return a===b;var g=a.tagClass===b.tagClass&&a.type===b.type&&a.constructed===b.constructed&&a.composed===b.composed&&e.equals(a.value,b.value);return c&&c.includeBitStringContents&&(g=g&&a.bitStringContents===b.bitStringContents),g},e.getBerValueLength=function(a){var b=a.getByte();if(128!==b)return 128&b?a.getInt((127&b)<<3):b};var g=function(a,b){var c,d=a.getByte();if(b--,128!==d){if(128&d){var e=127&d;f(a,b,e),c=a.getInt(e<<3)}else c=d;if(c<0)throw Error("Negative length: "+c);return c}};e.fromDer=function(a,b){void 0===b&&(b={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof b&&(b={strict:b,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in b||(b.strict=!0),"parseAllBytes"in b||(b.parseAllBytes=!0),"decodeBitStrings"in b||(b.decodeBitStrings=!0),"maxDepth"in b||(b.maxDepth=e.maxDepth),"string"==typeof a&&(a=d.util.createBuffer(a));var c=a.length(),h=function a(b,c,d,h){if(d>=h.maxDepth)throw Error("ASN.1 parsing error: Max depth exceeded.");f(b,c,2);var i,j,k,l=b.getByte();c--;var m=192&l,n=31&l;i=b.length();var o=g(b,c);if(c-=i-b.length(),void 0!==o&&o>c){if(h.strict){var p=Error("Too few bytes to read ASN.1 value.");throw p.available=b.length(),p.remaining=c,p.requested=o,p}o=c}var q=(32&l)==32;if(q)if(j=[],void 0===o)for(;;){if(f(b,c,2),b.bytes(2)===String.fromCharCode(0,0)){b.getBytes(2),c-=2;break}i=b.length(),j.push(a(b,c,d+1,h)),c-=i-b.length()}else for(;o>0;)i=b.length(),j.push(a(b,o,d+1,h)),c-=i-b.length(),o-=i-b.length();if(void 0===j&&m===e.Class.UNIVERSAL&&n===e.Type.BITSTRING&&(k=b.bytes(o)),void 0===j&&h.decodeBitStrings&&m===e.Class.UNIVERSAL&&n===e.Type.BITSTRING&&o>1){var r=b.read,s=c,t=0;if(n===e.Type.BITSTRING&&(f(b,c,1),t=b.getByte(),c--),0===t)try{i=b.length();var u=a(b,c,d+1,{strict:!0,decodeBitStrings:!0}),v=i-b.length();c-=v,n==e.Type.BITSTRING&&v++;var w=u.tagClass;v===o&&(w===e.Class.UNIVERSAL||w===e.Class.CONTEXT_SPECIFIC)&&(j=[u])}catch(a){}void 0===j&&(b.read=r,c=s)}if(void 0===j){if(void 0===o){if(h.strict)throw Error("Non-constructed ASN.1 object of indefinite length.");o=c}if(n===e.Type.BMPSTRING)for(j="";o>0;o-=2)f(b,c,2),j+=String.fromCharCode(b.getInt16()),c-=2;else j=b.getBytes(o),c-=o}var x=void 0===k?null:{bitStringContents:k};return e.create(m,n,q,j,x)}(a,a.length(),0,b);if(b.parseAllBytes&&0!==a.length()){var i=Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=c,i.remaining=a.length(),i}return h},e.toDer=function(a){var b=d.util.createBuffer(),c=a.tagClass|a.type,f=d.util.createBuffer(),g=!1;if("bitStringContents"in a&&(g=!0,a.original&&(g=e.equals(a,a.original))),g)f.putBytes(a.bitStringContents);else if(a.composed){a.constructed?c|=32:f.putByte(0);for(var h=0;h<a.value.length;++h)void 0!==a.value[h]&&f.putBuffer(e.toDer(a.value[h]))}else if(a.type===e.Type.BMPSTRING)for(var h=0;h<a.value.length;++h)f.putInt16(a.value.charCodeAt(h));else a.type===e.Type.INTEGER&&a.value.length>1&&(0===a.value.charCodeAt(0)&&(128&a.value.charCodeAt(1))==0||255===a.value.charCodeAt(0)&&(128&a.value.charCodeAt(1))==128)?f.putBytes(a.value.substr(1)):f.putBytes(a.value);if(b.putByte(c),127>=f.length())b.putByte(127&f.length());else{var i=f.length(),j="";do j+=String.fromCharCode(255&i),i>>>=8;while(i>0);b.putByte(128|j.length);for(var h=j.length-1;h>=0;--h)b.putByte(j.charCodeAt(h))}return b.putBuffer(f),b},e.oidToDer=function(a){var b,c,e,f,g=a.split("."),h=d.util.createBuffer();h.putByte(40*parseInt(g[0],10)+parseInt(g[1],10));for(var i=2;i<g.length;++i){if(b=!0,c=[],(e=parseInt(g[i],10))>0xffffffff)throw Error("OID value too large; max is 32-bits.");do f=127&e,e>>>=7,b||(f|=128),c.push(f),b=!1;while(e>0);for(var j=c.length-1;j>=0;--j)h.putByte(c[j])}return h},e.derToOid=function(a){"string"==typeof a&&(a=d.util.createBuffer(a));var b,c=a.getByte();b=Math.floor(c/40)+"."+c%40;for(var e=0;a.length()>0;){if(e>0x3fffffffffff)throw Error("OID value too large; max is 53-bits.");c=a.getByte(),e*=128,128&c?e+=127&c:(b+="."+(e+c),e=0)}return b},e.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10);c=c>=50?1900+c:2e3+c;var d=parseInt(a.substr(2,2),10)-1,e=parseInt(a.substr(4,2),10),f=parseInt(a.substr(6,2),10),g=parseInt(a.substr(8,2),10),h=0;if(a.length>11){var i=a.charAt(10),j=10;"+"!==i&&"-"!==i&&(h=parseInt(a.substr(10,2),10),j+=2)}if(b.setUTCFullYear(c,d,e),b.setUTCHours(f,g,h,0),j&&("+"===(i=a.charAt(j))||"-"===i)){var k=60*parseInt(a.substr(j+1,2),10)+parseInt(a.substr(j+4,2),10);k*=6e4,"+"===i?b.setTime(b-k):b.setTime(+b+k)}return b},e.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,e=parseInt(a.substr(6,2),10),f=parseInt(a.substr(8,2),10),g=parseInt(a.substr(10,2),10),h=parseInt(a.substr(12,2),10),i=0,j=0,k=!1;"Z"===a.charAt(a.length-1)&&(k=!0);var l=a.length-5,m=a.charAt(l);return("+"===m||"-"===m)&&(j=(60*parseInt(a.substr(l+1,2),10)+parseInt(a.substr(l+4,2),10))*6e4,"+"===m&&(j*=-1),k=!0),"."===a.charAt(14)&&(i=1e3*parseFloat(a.substr(14),10)),k?(b.setUTCFullYear(c,d,e),b.setUTCHours(f,g,h,i),b.setTime(+b+j)):(b.setFullYear(c,d,e),b.setHours(f,g,h,i)),b},e.dateToUtcTime=function(a){if("string"==typeof a)return a;var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2)),c.push(""+(a.getUTCMonth()+1)),c.push(""+a.getUTCDate()),c.push(""+a.getUTCHours()),c.push(""+a.getUTCMinutes()),c.push(""+a.getUTCSeconds());for(var d=0;d<c.length;++d)c[d].length<2&&(b+="0"),b+=c[d];return b+"Z"},e.dateToGeneralizedTime=function(a){if("string"==typeof a)return a;var b="",c=[];c.push(""+a.getUTCFullYear()),c.push(""+(a.getUTCMonth()+1)),c.push(""+a.getUTCDate()),c.push(""+a.getUTCHours()),c.push(""+a.getUTCMinutes()),c.push(""+a.getUTCSeconds());for(var d=0;d<c.length;++d)c[d].length<2&&(b+="0"),b+=c[d];return b+"Z"},e.integerToDer=function(a){var b=d.util.createBuffer();if(a>=-128&&a<128)return b.putSignedInt(a,8);if(a>=-32768&&a<32768)return b.putSignedInt(a,16);if(a>=-8388608&&a<8388608)return b.putSignedInt(a,24);if(a>=-0x80000000&&a<0x80000000)return b.putSignedInt(a,32);var c=Error("Integer too large; max is 32-bits.");throw c.integer=a,c},e.derToInteger=function(a){"string"==typeof a&&(a=d.util.createBuffer(a));var b=8*a.length();if(b>32)throw Error("Integer too large; max is 32-bits.");return a.getSignedInt(b)},e.validate=function(a,b,c,f){var g=!1;if((a.tagClass===b.tagClass||void 0===b.tagClass)&&(a.type===b.type||void 0===b.type))if(a.constructed===b.constructed||void 0===b.constructed){if(g=!0,b.value&&d.util.isArray(b.value))for(var h=0,i=0;g&&i<b.value.length;++i){var j=b.value[i];g=!!j.optional;var k=a.value[h];if(!k){!j.optional&&(g=!1,f&&f.push("["+b.name+'] Missing required element. Expected tag class "'+j.tagClass+'", type "'+j.type+'"'));continue}if(void 0!==j.tagClass&&void 0!==j.type&&(k.tagClass!==j.tagClass||k.type!==j.type))if(j.optional){g=!0;continue}else{g=!1,f&&f.push("["+b.name+"] Tag mismatch. Expected ("+j.tagClass+","+j.type+"), got ("+k.tagClass+","+k.type+")");break}if(e.validate(k,j,c,f))++h,g=!0;else if(j.optional)g=!0;else{g=!1;break}}if(g&&c&&(b.capture&&(c[b.capture]=a.value),b.captureAsn1&&(c[b.captureAsn1]=a),b.captureBitStringContents&&"bitStringContents"in a&&(c[b.captureBitStringContents]=a.bitStringContents),b.captureBitStringValue&&"bitStringContents"in a))if(a.bitStringContents.length<2)c[b.captureBitStringValue]="";else{if(0!==a.bitStringContents.charCodeAt(0))throw Error("captureBitStringValue only supported for zero unused bits");c[b.captureBitStringValue]=a.bitStringContents.slice(1)}}else f&&f.push("["+b.name+'] Expected constructed "'+b.constructed+'", got "'+a.constructed+'"');else f&&(a.tagClass!==b.tagClass&&f.push("["+b.name+'] Expected tag class "'+b.tagClass+'", got "'+a.tagClass+'"'),a.type!==b.type&&f.push("["+b.name+'] Expected type "'+b.type+'", got "'+a.type+'"'));return g};var h=/[^\\u0000-\\u00ff]/;e.prettyPrint=function(a,b,c){var f="";c=c||2,(b=b||0)>0&&(f+="\n");for(var g="",i=0;i<b*c;++i)g+=" ";switch(f+=g+"Tag: ",a.tagClass){case e.Class.UNIVERSAL:f+="Universal:";break;case e.Class.APPLICATION:f+="Application:";break;case e.Class.CONTEXT_SPECIFIC:f+="Context-Specific:";break;case e.Class.PRIVATE:f+="Private:"}if(a.tagClass===e.Class.UNIVERSAL)switch(f+=a.type,a.type){case e.Type.NONE:f+=" (None)";break;case e.Type.BOOLEAN:f+=" (Boolean)";break;case e.Type.INTEGER:f+=" (Integer)";break;case e.Type.BITSTRING:f+=" (Bit string)";break;case e.Type.OCTETSTRING:f+=" (Octet string)";break;case e.Type.NULL:f+=" (Null)";break;case e.Type.OID:f+=" (Object Identifier)";break;case e.Type.ODESC:f+=" (Object Descriptor)";break;case e.Type.EXTERNAL:f+=" (External or Instance of)";break;case e.Type.REAL:f+=" (Real)";break;case e.Type.ENUMERATED:f+=" (Enumerated)";break;case e.Type.EMBEDDED:f+=" (Embedded PDV)";break;case e.Type.UTF8:f+=" (UTF8)";break;case e.Type.ROID:f+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:f+=" (Sequence)";break;case e.Type.SET:f+=" (Set)";break;case e.Type.PRINTABLESTRING:f+=" (Printable String)";break;case e.Type.IA5String:f+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:f+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:f+=" (Generalized time)";break;case e.Type.BMPSTRING:f+=" (BMP String)"}else f+=a.type;if(f+="\n",f+=g+"Constructed: "+a.constructed+"\n",a.composed){for(var j=0,k="",i=0;i<a.value.length;++i)void 0!==a.value[i]&&(j+=1,k+=e.prettyPrint(a.value[i],b+1,c),i+1<a.value.length&&(k+=","));f+=g+"Sub values: "+j+k}else{if(f+=g+"Value: ",a.type===e.Type.OID){var l=e.derToOid(a.value);f+=l,d.pki&&d.pki.oids&&l in d.pki.oids&&(f+=" ("+d.pki.oids[l]+") ")}if(a.type===e.Type.INTEGER)try{f+=e.derToInteger(a.value)}catch(b){f+="0x"+d.util.bytesToHex(a.value)}else if(a.type===e.Type.BITSTRING){if(a.value.length>1?f+="0x"+d.util.bytesToHex(a.value.slice(1)):f+="(none)",a.value.length>0){var m=a.value.charCodeAt(0);1==m?f+=" (1 unused bit shown)":m>1&&(f+=" ("+m+" unused bits shown)")}}else if(a.type===e.Type.OCTETSTRING)h.test(a.value)||(f+="("+a.value+") "),f+="0x"+d.util.bytesToHex(a.value);else if(a.type===e.Type.UTF8)try{f+=d.util.decodeUtf8(a.value)}catch(b){if("URI malformed"===b.message)f+="0x"+d.util.bytesToHex(a.value)+" (malformed UTF8)";else throw b}else a.type===e.Type.PRINTABLESTRING||a.type===e.Type.IA5String?f+=a.value:h.test(a.value)?f+="0x"+d.util.bytesToHex(a.value):0===a.value.length?f+="[null]":f+=a.value}return f}},65737:(a,b,c)=>{var d=c(45654);c(45518),c(63070),c(88819),c(1277),c(15529),c(36105),c(49345),c(87981),c(10401),c(33889);var e=d.asn1,f=a.exports=d.pki=d.pki||{},g=f.oids,h={};h.CN=g.commonName,h.commonName="CN",h.C=g.countryName,h.countryName="C",h.L=g.localityName,h.localityName="L",h.ST=g.stateOrProvinceName,h.stateOrProvinceName="ST",h.O=g.organizationName,h.organizationName="O",h.OU=g.organizationalUnitName,h.organizationalUnitName="OU",h.E=g.emailAddress,h.emailAddress="E";var i=d.pki.rsa.publicKeyValidator,j={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},i,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},k={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},l={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},i,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},m={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[l,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function n(a,b){"string"==typeof b&&(b={shortName:b});for(var c,d=null,e=0;null===d&&e<a.attributes.length;++e)c=a.attributes[e],b.type&&b.type===c.type||b.name&&b.name===c.name?d=c:b.shortName&&b.shortName===c.shortName&&(d=c);return d}f.RDNAttributesAsArray=function(a,b){for(var c,d,f,i=[],j=0;j<a.value.length;++j){c=a.value[j];for(var k=0;k<c.value.length;++k)f={},d=c.value[k],f.type=e.derToOid(d.value[0].value),f.value=d.value[1].value,f.valueTagClass=d.value[1].type,f.type in g&&(f.name=g[f.type],f.name in h&&(f.shortName=h[f.name])),b&&(b.update(f.type),b.update(f.value)),i.push(f)}return i},f.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=a[c],i=e.derToOid(d.value[0].value),j=d.value[1].value,k=0;k<j.length;++k){var l={};if(l.type=i,l.value=j[k].value,l.valueTagClass=j[k].type,l.type in g&&(l.name=g[l.type],l.name in h&&(l.shortName=h[l.name])),l.type===g.extensionRequest){l.extensions=[];for(var m=0;m<l.value.length;++m)l.extensions.push(f.certificateExtensionFromAsn1(l.value[m]))}b.push(l)}return b};var o=function(a,b,c){var d={};if(a!==g["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:g.sha1},mgf:{algorithmOid:g.mgf1,hash:{algorithmOid:g.sha1}},saltLength:20});var f={},h=[];if(!e.validate(b,k,f,h)){var i=Error("Cannot read RSASSA-PSS parameter block.");throw i.errors=h,i}return void 0!==f.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=e.derToOid(f.hashOid)),void 0!==f.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=e.derToOid(f.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=e.derToOid(f.maskGenHashOid)),void 0!==f.saltLength&&(d.saltLength=f.saltLength.charCodeAt(0)),d},p=function(a){switch(g[a.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return d.md.sha1.create();case"md5WithRSAEncryption":return d.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return d.md.sha256.create();case"sha384WithRSAEncryption":return d.md.sha384.create();case"sha512WithRSAEncryption":return d.md.sha512.create();default:var b=Error("Could not compute "+a.type+" digest. Unknown signature OID.");throw b.signatureOid=a.signatureOid,b}},q=function(a){var b,c,e,f=a.certificate;switch(f.signatureOid){case g.sha1WithRSAEncryption:case g.sha1WithRSASignature:break;case g["RSASSA-PSS"]:if(void 0===(c=g[f.signatureParameters.mgf.hash.algorithmOid])||void 0===d.md[c]){var h=Error("Unsupported MGF hash function.");throw h.oid=f.signatureParameters.mgf.hash.algorithmOid,h.name=c,h}if(void 0===(e=g[f.signatureParameters.mgf.algorithmOid])||void 0===d.mgf[e]){var h=Error("Unsupported MGF function.");throw h.oid=f.signatureParameters.mgf.algorithmOid,h.name=e,h}if(e=d.mgf[e].create(d.md[c].create()),void 0===(c=g[f.signatureParameters.hash.algorithmOid])||void 0===d.md[c]){var h=Error("Unsupported RSASSA-PSS hash function.");throw h.oid=f.signatureParameters.hash.algorithmOid,h.name=c,h}b=d.pss.create(d.md[c].create(),e,f.signatureParameters.saltLength)}return f.publicKey.verify(a.md.digest().getBytes(),a.signature,b)};function r(a){for(var b,c,f=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),g=a.attributes,h=0;h<g.length;++h){var i=(b=g[h]).value,j=e.Type.PRINTABLESTRING;"valueTagClass"in b&&(j=b.valueTagClass)===e.Type.UTF8&&(i=d.util.encodeUtf8(i)),c=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.type).getBytes()),e.create(e.Class.UNIVERSAL,j,!1,i)])]),f.value.push(c)}return f}function s(a){for(var b,c=0;c<a.length;++c){if(void 0===(b=a[c]).name&&(b.type&&b.type in f.oids?b.name=f.oids[b.type]:b.shortName&&b.shortName in h&&(b.name=f.oids[h[b.shortName]])),void 0===b.type)if(b.name&&b.name in f.oids)b.type=f.oids[b.name];else{var d=Error("Attribute type not specified.");throw d.attribute=b,d}if(void 0===b.shortName&&b.name&&b.name in h&&(b.shortName=h[b.name]),b.type===g.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=e.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var i=0;i<b.extensions.length;++i)b.value.push(f.certificateExtensionToAsn1(t(b.extensions[i])))}if(void 0===b.value){var d=Error("Attribute value not specified.");throw d.attribute=b,d}}}function t(a,b){if(b=b||{},void 0===a.name&&a.id&&a.id in f.oids&&(a.name=f.oids[a.id]),void 0===a.id)if(a.name&&a.name in f.oids)a.id=f.oids[a.name];else{var c=Error("Extension ID not specified.");throw c.extension=a,c}if(void 0!==a.value)return a;if("keyUsage"===a.name){var h=0,i=0,j=0;a.digitalSignature&&(i|=128,h=7),a.nonRepudiation&&(i|=64,h=6),a.keyEncipherment&&(i|=32,h=5),a.dataEncipherment&&(i|=16,h=4),a.keyAgreement&&(i|=8,h=3),a.keyCertSign&&(i|=4,h=2),a.cRLSign&&(i|=2,h=1),a.encipherOnly&&(i|=1,h=0),a.decipherOnly&&(j|=128,h=7);var k=String.fromCharCode(h);0!==j?k+=String.fromCharCode(i)+String.fromCharCode(j):0!==i&&(k+=String.fromCharCode(i)),a.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,k)}else if("basicConstraints"===a.name)a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),a.cA&&a.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in a&&a.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.pathLenConstraint).getBytes()));else if("extKeyUsage"===a.name){a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var l=a.value.value;for(var m in a)!0===a[m]&&(m in g?l.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g[m]).getBytes())):-1!==m.indexOf(".")&&l.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(m).getBytes())))}else if("nsCertType"===a.name){var h=0,i=0;a.client&&(i|=128,h=7),a.server&&(i|=64,h=6),a.email&&(i|=32,h=5),a.objsign&&(i|=16,h=4),a.reserved&&(i|=8,h=3),a.sslCA&&(i|=4,h=2),a.emailCA&&(i|=2,h=1),a.objCA&&(i|=1,h=0);var k=String.fromCharCode(h);0!==i&&(k+=String.fromCharCode(i)),a.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,k)}else if("subjectAltName"===a.name||"issuerAltName"===a.name){a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var n,o=0;o<a.altNames.length;++o){var k=(n=a.altNames[o]).value;if(7===n.type&&n.ip){if(null===(k=d.util.bytesFromIP(n.ip))){var c=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw c.extension=a,c}}else 8===n.type&&(k=n.oid?e.oidToDer(e.oidToDer(n.oid)):e.oidToDer(k));a.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,n.type,!1,k))}}else if("nsComment"===a.name&&b.cert){if(!/^[\x00-\x7F]*$/.test(a.comment)||a.comment.length<1||a.comment.length>128)throw Error('Invalid "nsComment" content.');a.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,a.comment)}else if("subjectKeyIdentifier"===a.name&&b.cert){var p=b.cert.generateSubjectKeyIdentifier();a.subjectKeyIdentifier=p.toHex(),a.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===a.name&&b.cert){a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var l=a.value.value;if(a.keyIdentifier){var q=!0===a.keyIdentifier?b.cert.generateSubjectKeyIdentifier().getBytes():a.keyIdentifier;l.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,q))}if(a.authorityCertIssuer){var s=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[r(!0===a.authorityCertIssuer?b.cert.issuer:a.authorityCertIssuer)])];l.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,s))}if(a.serialNumber){var t=d.util.hexToBytes(!0===a.serialNumber?b.cert.serialNumber:a.serialNumber);l.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,t))}}else if("cRLDistributionPoints"===a.name){a.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var n,l=a.value.value,u=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),v=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),o=0;o<a.altNames.length;++o){var k=(n=a.altNames[o]).value;if(7===n.type&&n.ip){if(null===(k=d.util.bytesFromIP(n.ip))){var c=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw c.extension=a,c}}else 8===n.type&&(k=n.oid?e.oidToDer(e.oidToDer(n.oid)):e.oidToDer(k));v.value.push(e.create(e.Class.CONTEXT_SPECIFIC,n.type,!1,k))}u.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[v])),l.push(u)}if(void 0===a.value){var c=Error("Extension value not specified.");throw c.extension=a,c}return a}function u(a,b){if(a!==g["RSASSA-PSS"])return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"");var c=[];return void 0!==b.hash.algorithmOid&&c.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),void 0!==b.mgf.algorithmOid&&c.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),void 0!==b.saltLength&&c.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(b.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,c)}f.certificateFromPem=function(a,b,c){var g=d.pem.decode(a)[0];if("CERTIFICATE"!==g.type&&"X509 CERTIFICATE"!==g.type&&"TRUSTED CERTIFICATE"!==g.type){var h=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw h.headerType=g.type,h}if(g.procType&&"ENCRYPTED"===g.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var i=e.fromDer(g.body,c);return f.certificateFromAsn1(i,b)},f.certificateToPem=function(a,b){var c={type:"CERTIFICATE",body:e.toDer(f.certificateToAsn1(a)).getBytes()};return d.pem.encode(c,{maxline:b})},f.publicKeyFromPem=function(a){var b=d.pem.decode(a)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw c.headerType=b.type,c}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");var g=e.fromDer(b.body);return f.publicKeyFromAsn1(g)},f.publicKeyToPem=function(a,b){var c={type:"PUBLIC KEY",body:e.toDer(f.publicKeyToAsn1(a)).getBytes()};return d.pem.encode(c,{maxline:b})},f.publicKeyToRSAPublicKeyPem=function(a,b){var c={type:"RSA PUBLIC KEY",body:e.toDer(f.publicKeyToRSAPublicKey(a)).getBytes()};return d.pem.encode(c,{maxline:b})},f.getPublicKeyFingerprint=function(a,b){var c,g=(b=b||{}).md||d.md.sha1.create();switch(b.type||"RSAPublicKey"){case"RSAPublicKey":c=e.toDer(f.publicKeyToRSAPublicKey(a)).getBytes();break;case"SubjectPublicKeyInfo":c=e.toDer(f.publicKeyToAsn1(a)).getBytes();break;default:throw Error('Unknown fingerprint type "'+b.type+'".')}g.start(),g.update(c);var h=g.digest();if("hex"===b.encoding){var i=h.toHex();return b.delimiter?i.match(/.{2}/g).join(b.delimiter):i}if("binary"===b.encoding)return h.getBytes();if(b.encoding)throw Error('Unknown encoding "'+b.encoding+'".');return h},f.certificationRequestFromPem=function(a,b,c){var g=d.pem.decode(a)[0];if("CERTIFICATE REQUEST"!==g.type){var h=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw h.headerType=g.type,h}if(g.procType&&"ENCRYPTED"===g.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");var i=e.fromDer(g.body,c);return f.certificationRequestFromAsn1(i,b)},f.certificationRequestToPem=function(a,b){var c={type:"CERTIFICATE REQUEST",body:e.toDer(f.certificationRequestToAsn1(a)).getBytes()};return d.pem.encode(c,{maxline:b})},f.createCertificate=function(){var a={};return a.version=2,a.serialNumber="00",a.signatureOid=null,a.signature=null,a.siginfo={},a.siginfo.algorithmOid=null,a.validity={},a.validity.notBefore=new Date,a.validity.notAfter=new Date,a.issuer={},a.issuer.getField=function(b){return n(a.issuer,b)},a.issuer.addField=function(b){s([b]),a.issuer.attributes.push(b)},a.issuer.attributes=[],a.issuer.hash=null,a.subject={},a.subject.getField=function(b){return n(a.subject,b)},a.subject.addField=function(b){s([b]),a.subject.attributes.push(b)},a.subject.attributes=[],a.subject.hash=null,a.extensions=[],a.publicKey=null,a.md=null,a.setSubject=function(b,c){s(b),a.subject.attributes=b,delete a.subject.uniqueId,c&&(a.subject.uniqueId=c),a.subject.hash=null},a.setIssuer=function(b,c){s(b),a.issuer.attributes=b,delete a.issuer.uniqueId,c&&(a.issuer.uniqueId=c),a.issuer.hash=null},a.setExtensions=function(b){for(var c=0;c<b.length;++c)t(b[c],{cert:a});a.extensions=b},a.getExtension=function(b){"string"==typeof b&&(b={name:b});for(var c,d=null,e=0;null===d&&e<a.extensions.length;++e)c=a.extensions[e],b.id&&c.id===b.id?d=c:b.name&&c.name===b.name&&(d=c);return d},a.sign=function(b,c){a.md=c||d.md.sha1.create();var h=g[a.md.algorithm+"WithRSAEncryption"];if(!h){var i=Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw i.algorithm=a.md.algorithm,i}a.signatureOid=a.siginfo.algorithmOid=h,a.tbsCertificate=f.getTBSCertificate(a);var j=e.toDer(a.tbsCertificate);a.md.update(j.getBytes()),a.signature=b.sign(a.md)},a.verify=function(b){var c=!1;if(!a.issued(b)){var d=b.issuer,g=a.subject,h=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw h.expectedIssuer=g.attributes,h.actualIssuer=d.attributes,h}var i=b.md;if(null===i){i=p({signatureOid:b.signatureOid,type:"certificate"});var j=b.tbsCertificate||f.getTBSCertificate(b),k=e.toDer(j);i.update(k.getBytes())}return null!==i&&(c=q({certificate:a,md:i,signature:b.signature})),c},a.isIssuer=function(b){var c=!1,d=a.issuer,e=b.subject;if(d.hash&&e.hash)c=d.hash===e.hash;else if(d.attributes.length===e.attributes.length){c=!0;for(var f,g,h=0;c&&h<d.attributes.length;++h)f=d.attributes[h],g=e.attributes[h],(f.type!==g.type||f.value!==g.value)&&(c=!1)}return c},a.issued=function(b){return b.isIssuer(a)},a.generateSubjectKeyIdentifier=function(){return f.getPublicKeyFingerprint(a.publicKey,{type:"RSAPublicKey"})},a.verifySubjectKeyIdentifier=function(){for(var b=g.subjectKeyIdentifier,c=0;c<a.extensions.length;++c){var e=a.extensions[c];if(e.id===b){var f=a.generateSubjectKeyIdentifier().getBytes();return d.util.hexToBytes(e.subjectKeyIdentifier)===f}}return!1},a},f.certificateFromAsn1=function(a,b){var c={},g=[];if(!e.validate(a,j,c,g)){var h=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw h.errors=g,h}if(e.derToOid(c.publicKeyOid)!==f.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var i=f.createCertificate();i.version=c.certVersion?c.certVersion.charCodeAt(0):0,i.serialNumber=d.util.createBuffer(c.certSerialNumber).toHex(),i.signatureOid=d.asn1.derToOid(c.certSignatureOid),i.signatureParameters=o(i.signatureOid,c.certSignatureParams,!0),i.siginfo.algorithmOid=d.asn1.derToOid(c.certinfoSignatureOid),i.siginfo.parameters=o(i.siginfo.algorithmOid,c.certinfoSignatureParams,!1),i.signature=c.certSignature;var k=[];if(void 0!==c.certValidity1UTCTime&&k.push(e.utcTimeToDate(c.certValidity1UTCTime)),void 0!==c.certValidity2GeneralizedTime&&k.push(e.generalizedTimeToDate(c.certValidity2GeneralizedTime)),void 0!==c.certValidity3UTCTime&&k.push(e.utcTimeToDate(c.certValidity3UTCTime)),void 0!==c.certValidity4GeneralizedTime&&k.push(e.generalizedTimeToDate(c.certValidity4GeneralizedTime)),k.length>2)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(k.length<2)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(i.validity.notBefore=k[0],i.validity.notAfter=k[1],i.tbsCertificate=c.tbsCertificate,b){i.md=p({signatureOid:i.signatureOid,type:"certificate"});var l=e.toDer(i.tbsCertificate);i.md.update(l.getBytes())}var m=d.md.sha1.create(),q=e.toDer(c.certIssuer);m.update(q.getBytes()),i.issuer.getField=function(a){return n(i.issuer,a)},i.issuer.addField=function(a){s([a]),i.issuer.attributes.push(a)},i.issuer.attributes=f.RDNAttributesAsArray(c.certIssuer),c.certIssuerUniqueId&&(i.issuer.uniqueId=c.certIssuerUniqueId),i.issuer.hash=m.digest().toHex();var r=d.md.sha1.create(),t=e.toDer(c.certSubject);return r.update(t.getBytes()),i.subject.getField=function(a){return n(i.subject,a)},i.subject.addField=function(a){s([a]),i.subject.attributes.push(a)},i.subject.attributes=f.RDNAttributesAsArray(c.certSubject),c.certSubjectUniqueId&&(i.subject.uniqueId=c.certSubjectUniqueId),i.subject.hash=r.digest().toHex(),c.certExtensions?i.extensions=f.certificateExtensionsFromAsn1(c.certExtensions):i.extensions=[],i.publicKey=f.publicKeyFromAsn1(c.subjectPublicKeyInfo),i},f.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(f.certificateExtensionFromAsn1(d.value[e]));return b},f.certificateExtensionFromAsn1=function(a){var b={};if(b.id=e.derToOid(a.value[0].value),b.critical=!1,a.value[1].type===e.Type.BOOLEAN?(b.critical=0!==a.value[1].value.charCodeAt(0),b.value=a.value[2].value):b.value=a.value[1].value,b.id in g){if(b.name=g[b.id],"keyUsage"===b.name){var c=e.fromDer(b.value),f=0,h=0;c.value.length>1&&(f=c.value.charCodeAt(1),h=c.value.length>2?c.value.charCodeAt(2):0),b.digitalSignature=(128&f)==128,b.nonRepudiation=(64&f)==64,b.keyEncipherment=(32&f)==32,b.dataEncipherment=(16&f)==16,b.keyAgreement=(8&f)==8,b.keyCertSign=(4&f)==4,b.cRLSign=(2&f)==2,b.encipherOnly=(1&f)==1,b.decipherOnly=(128&h)==128}else if("basicConstraints"===b.name){var c=e.fromDer(b.value);c.value.length>0&&c.value[0].type===e.Type.BOOLEAN?b.cA=0!==c.value[0].value.charCodeAt(0):b.cA=!1;var i=null;c.value.length>0&&c.value[0].type===e.Type.INTEGER?i=c.value[0].value:c.value.length>1&&(i=c.value[1].value),null!==i&&(b.pathLenConstraint=e.derToInteger(i))}else if("extKeyUsage"===b.name)for(var c=e.fromDer(b.value),j=0;j<c.value.length;++j){var k=e.derToOid(c.value[j].value);k in g?b[g[k]]=!0:b[k]=!0}else if("nsCertType"===b.name){var c=e.fromDer(b.value),f=0;c.value.length>1&&(f=c.value.charCodeAt(1)),b.client=(128&f)==128,b.server=(64&f)==64,b.email=(32&f)==32,b.objsign=(16&f)==16,b.reserved=(8&f)==8,b.sslCA=(4&f)==4,b.emailCA=(2&f)==2,b.objCA=(1&f)==1}else if("subjectAltName"===b.name||"issuerAltName"===b.name){b.altNames=[];for(var l,c=e.fromDer(b.value),m=0;m<c.value.length;++m){var n={type:(l=c.value[m]).type,value:l.value};switch(b.altNames.push(n),l.type){case 1:case 2:case 6:break;case 7:n.ip=d.util.bytesToIP(l.value);break;case 8:n.oid=e.derToOid(l.value)}}}else if("subjectKeyIdentifier"===b.name){var c=e.fromDer(b.value);b.subjectKeyIdentifier=d.util.bytesToHex(c.value)}}return b},f.certificationRequestFromAsn1=function(a,b){var c={},g=[];if(!e.validate(a,m,c,g)){var h=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw h.errors=g,h}if(e.derToOid(c.publicKeyOid)!==f.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var i=f.createCertificationRequest();if(i.version=c.csrVersion?c.csrVersion.charCodeAt(0):0,i.signatureOid=d.asn1.derToOid(c.csrSignatureOid),i.signatureParameters=o(i.signatureOid,c.csrSignatureParams,!0),i.siginfo.algorithmOid=d.asn1.derToOid(c.csrSignatureOid),i.siginfo.parameters=o(i.siginfo.algorithmOid,c.csrSignatureParams,!1),i.signature=c.csrSignature,i.certificationRequestInfo=c.certificationRequestInfo,b){i.md=p({signatureOid:i.signatureOid,type:"certification request"});var j=e.toDer(i.certificationRequestInfo);i.md.update(j.getBytes())}var k=d.md.sha1.create();return i.subject.getField=function(a){return n(i.subject,a)},i.subject.addField=function(a){s([a]),i.subject.attributes.push(a)},i.subject.attributes=f.RDNAttributesAsArray(c.certificationRequestInfoSubject,k),i.subject.hash=k.digest().toHex(),i.publicKey=f.publicKeyFromAsn1(c.subjectPublicKeyInfo),i.getAttribute=function(a){return n(i,a)},i.addAttribute=function(a){s([a]),i.attributes.push(a)},i.attributes=f.CRIAttributesAsArray(c.certificationRequestInfoAttributes||[]),i},f.createCertificationRequest=function(){var a={};return a.version=0,a.signatureOid=null,a.signature=null,a.siginfo={},a.siginfo.algorithmOid=null,a.subject={},a.subject.getField=function(b){return n(a.subject,b)},a.subject.addField=function(b){s([b]),a.subject.attributes.push(b)},a.subject.attributes=[],a.subject.hash=null,a.publicKey=null,a.attributes=[],a.getAttribute=function(b){return n(a,b)},a.addAttribute=function(b){s([b]),a.attributes.push(b)},a.md=null,a.setSubject=function(b){s(b),a.subject.attributes=b,a.subject.hash=null},a.setAttributes=function(b){s(b),a.attributes=b},a.sign=function(b,c){a.md=c||d.md.sha1.create();var h=g[a.md.algorithm+"WithRSAEncryption"];if(!h){var i=Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw i.algorithm=a.md.algorithm,i}a.signatureOid=a.siginfo.algorithmOid=h,a.certificationRequestInfo=f.getCertificationRequestInfo(a);var j=e.toDer(a.certificationRequestInfo);a.md.update(j.getBytes()),a.signature=b.sign(a.md)},a.verify=function(){var b=!1,c=a.md;if(null===c){c=p({signatureOid:a.signatureOid,type:"certification request"});var d=a.certificationRequestInfo||f.getCertificationRequestInfo(a),g=e.toDer(d);c.update(g.getBytes())}return null!==c&&(b=q({certificate:a,md:c,signature:a.signature})),b},a};var v=new Date("1950-01-01T00:00:00Z"),w=new Date("2050-01-01T00:00:00Z");function x(a){return a>=v&&a<w?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(a)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(a))}f.getTBSCertificate=function(a){var b=x(a.validity.notBefore),c=x(a.validity.notAfter),g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,d.util.hexToBytes(a.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.siginfo.algorithmOid).getBytes()),u(a.siginfo.algorithmOid,a.siginfo.parameters)]),r(a.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[b,c]),r(a.subject),f.publicKeyToAsn1(a.publicKey)]);return a.issuer.uniqueId&&g.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+a.issuer.uniqueId)])),a.subject.uniqueId&&g.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+a.subject.uniqueId)])),a.extensions.length>0&&g.value.push(f.certificateExtensionsToAsn1(a.extensions)),g},f.getCertificationRequestInfo=function(a){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes()),r(a.subject),f.publicKeyToAsn1(a.publicKey),function(a){var b=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===a.attributes.length)return b;for(var c=a.attributes,f=0;f<c.length;++f){var g=c[f],h=g.value,i=e.Type.UTF8;"valueTagClass"in g&&(i=g.valueTagClass),i===e.Type.UTF8&&(h=d.util.encodeUtf8(h));var j=!1;"valueConstructed"in g&&(j=g.valueConstructed);var k=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,i,j,h)])]);b.value.push(k)}return b}(a)])},f.distinguishedNameToAsn1=function(a){return r(a)},f.certificateToAsn1=function(a){var b=a.tbsCertificate||f.getTBSCertificate(a);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[b,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.signatureOid).getBytes()),u(a.signatureOid,a.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+a.signature)])},f.certificateExtensionsToAsn1=function(a){var b=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),c=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(f.certificateExtensionToAsn1(a[d]));return b},f.certificateExtensionToAsn1=function(a){var b=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);b.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.id).getBytes())),a.critical&&b.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;return"string"!=typeof a.value&&(c=e.toDer(c).getBytes()),b.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c)),b},f.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||f.getCertificationRequestInfo(a);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[b,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.signatureOid).getBytes()),u(a.signatureOid,a.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+a.signature)])},f.createCaStore=function(a){var b={certs:{}};function c(a){return g(a),b.certs[a.hash]||null}function g(a){if(!a.hash){var b=d.md.sha1.create();a.attributes=f.RDNAttributesAsArray(r(a),b),a.hash=b.digest().toHex()}}if(b.getIssuer=function(a){return c(a.issuer)},b.addCertificate=function(a){if("string"==typeof a&&(a=d.pki.certificateFromPem(a)),g(a.subject),!b.hasCertificate(a))if(a.subject.hash in b.certs){var c=b.certs[a.subject.hash];d.util.isArray(c)||(c=[c]),c.push(a),b.certs[a.subject.hash]=c}else b.certs[a.subject.hash]=a},b.hasCertificate=function(a){"string"==typeof a&&(a=d.pki.certificateFromPem(a));var b=c(a.subject);if(!b)return!1;d.util.isArray(b)||(b=[b]);for(var g=e.toDer(f.certificateToAsn1(a)).getBytes(),h=0;h<b.length;++h)if(g===e.toDer(f.certificateToAsn1(b[h])).getBytes())return!0;return!1},b.listAllCertificates=function(){var a=[];for(var c in b.certs)if(b.certs.hasOwnProperty(c)){var e=b.certs[c];if(d.util.isArray(e))for(var f=0;f<e.length;++f)a.push(e[f]);else a.push(e)}return a},b.removeCertificate=function(a){if("string"==typeof a&&(a=d.pki.certificateFromPem(a)),g(a.subject),!b.hasCertificate(a))return null;var h,i=c(a.subject);if(!d.util.isArray(i))return h=b.certs[a.subject.hash],delete b.certs[a.subject.hash],h;for(var j=e.toDer(f.certificateToAsn1(a)).getBytes(),k=0;k<i.length;++k)j===e.toDer(f.certificateToAsn1(i[k])).getBytes()&&(h=i[k],i.splice(k,1));return 0===i.length&&delete b.certs[a.subject.hash],h},a)for(var h=0;h<a.length;++h){var i=a[h];b.addCertificate(i)}return b},f.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},f.verifyCertificateChain=function(a,b,c){"function"==typeof c&&(c={verify:c}),c=c||{};var e=(b=b.slice(0)).slice(0),g=c.validityCheckDate;void 0===g&&(g=new Date);var h=!0,i=null,j=0;do{var k=b.shift(),l=null,m=!1;if(g&&(g<k.validity.notBefore||g>k.validity.notAfter)&&(i={message:"Certificate is not valid yet or has expired.",error:f.certificateError.certificate_expired,notBefore:k.validity.notBefore,notAfter:k.validity.notAfter,now:g}),null===i){if(null===(l=b[0]||a.getIssuer(k))&&k.isIssuer(k)&&(m=!0,l=k),l){var n=l;d.util.isArray(n)||(n=[n]);for(var o=!1;!o&&n.length>0;){l=n.shift();try{o=l.verify(k)}catch(a){}}o||(i={message:"Certificate signature is invalid.",error:f.certificateError.bad_certificate})}null!==i||l&&!m||a.hasCertificate(k)||(i={message:"Certificate is not trusted.",error:f.certificateError.unknown_ca})}if(null===i&&l&&!k.isIssuer(l)&&(i={message:"Certificate issuer is invalid.",error:f.certificateError.bad_certificate}),null===i)for(var p={keyUsage:!0,basicConstraints:!0},q=0;null===i&&q<k.extensions.length;++q){var r=k.extensions[q];!r.critical||r.name in p||(i={message:"Certificate has an unsupported critical extension.",error:f.certificateError.unsupported_certificate})}if(null===i&&(!h||0===b.length&&(!l||m))){var s=k.getExtension("basicConstraints"),t=k.getExtension("keyUsage");null===t||t.keyCertSign&&null!==s||(i={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:f.certificateError.bad_certificate}),null===i&&null===s&&(i={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:f.certificateError.bad_certificate}),null!==i||null===s||s.cA||(i={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:f.certificateError.bad_certificate}),null===i&&null!==t&&"pathLenConstraint"in s&&j-1>s.pathLenConstraint&&(i={message:"Certificate basicConstraints pathLenConstraint violated.",error:f.certificateError.bad_certificate})}var u=null===i||i.error,v=c.verify?c.verify(u,j,e):u;if(!0===v)i=null;else throw!0===u&&(i={message:"The application rejected the certificate.",error:f.certificateError.bad_certificate}),(v||0===v)&&("object"!=typeof v||d.util.isArray(v)?"string"==typeof v&&(i.error=v):(v.message&&(i.message=v.message),v.error&&(i.error=v.error))),i;h=!1,++j}while(b.length>0);return!0}},66568:(a,b,c)=>{var d=c(45654);c(33889),a.exports=d.cipher=d.cipher||{},d.cipher.algorithms=d.cipher.algorithms||{},d.cipher.createCipher=function(a,b){var c=a;if("string"==typeof c&&(c=d.cipher.getAlgorithm(c))&&(c=c()),!c)throw Error("Unsupported algorithm: "+a);return new d.cipher.BlockCipher({algorithm:c,key:b,decrypt:!1})},d.cipher.createDecipher=function(a,b){var c=a;if("string"==typeof c&&(c=d.cipher.getAlgorithm(c))&&(c=c()),!c)throw Error("Unsupported algorithm: "+a);return new d.cipher.BlockCipher({algorithm:c,key:b,decrypt:!0})},d.cipher.registerAlgorithm=function(a,b){a=a.toUpperCase(),d.cipher.algorithms[a]=b},d.cipher.getAlgorithm=function(a){return(a=a.toUpperCase())in d.cipher.algorithms?d.cipher.algorithms[a]:null};var e=d.cipher.BlockCipher=function(a){this.algorithm=a.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=a.decrypt,this.algorithm.initialize(a)};e.prototype.start=function(a){var b={};for(var c in a=a||{})b[c]=a[c];b.decrypt=this._decrypt,this._finish=!1,this._input=d.util.createBuffer(),this.output=a.output||d.util.createBuffer(),this.mode.start(b)},e.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(a){a&&("ECB"===this.mode.name||"CBC"===this.mode.name)&&(this.mode.pad=function(b){return a(this.blockSize,b,!1)},this.mode.unpad=function(b){return a(this.blockSize,b,!0)});var b={};return b.decrypt=this._decrypt,b.overflow=this._input.length()%this.blockSize,(!!this._decrypt||!this.mode.pad||!!this.mode.pad(this._input,b))&&(this._finish=!0,this.update(),(!this._decrypt||!this.mode.unpad||!!this.mode.unpad(this.output,b))&&(!this.mode.afterFinish||!!this.mode.afterFinish(this.output,b)))}},67382:(a,b,c)=>{var d=c(45654);c(33889);var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],f=[1,2,3,5];a.exports=d.rc2=d.rc2||{},d.rc2.expandKey=function(a,b){"string"==typeof a&&(a=d.util.createBuffer(a)),b=b||128;var c,f=a,g=a.length(),h=b,i=Math.ceil(h/8);for(c=g;c<128;c++)f.putByte(e[f.at(c-1)+f.at(c-g)&255]);for(f.setAt(128-i,e[f.at(128-i)&255>>(7&h)]),c=127-i;c>=0;c--)f.setAt(c,e[f.at(c+1)^f.at(c+i)]);return f};var g=function(a,b,c){var e,g,h,i,j=!1,k=null,l=null,m=null,n=[];for(a=d.rc2.expandKey(a,b),h=0;h<64;h++)n.push(a.getInt16Le());c?(e=function(a){for(h=0;h<4;h++){var b,c;a[h]+=n[i]+(a[(h+3)%4]&a[(h+2)%4])+(~a[(h+3)%4]&a[(h+1)%4]),a[h]=(b=a[h])<<(c=f[h])&65535|(65535&b)>>16-c,i++}},g=function(a){for(h=0;h<4;h++)a[h]+=n[63&a[(h+3)%4]]}):(e=function(a){for(h=3;h>=0;h--){var b,c;a[h]=(65535&(b=a[h]))>>(c=f[h])|b<<16-c&65535,a[h]-=n[i]+(a[(h+3)%4]&a[(h+2)%4])+(~a[(h+3)%4]&a[(h+1)%4]),i--}},g=function(a){for(h=3;h>=0;h--)a[h]-=n[63&a[(h+3)%4]]});var o=function(a){var b=[];for(h=0;h<4;h++){var d=k.getInt16Le();null!==m&&(c?d^=m.getInt16Le():m.putInt16Le(d)),b.push(65535&d)}i=63*!c;for(var e=0;e<a.length;e++)for(var f=0;f<a[e][0];f++)a[e][1](b);for(h=0;h<4;h++)null!==m&&(c?m.putInt16Le(b[h]):b[h]^=m.getInt16Le()),l.putInt16Le(b[h])},p=null;return p={start:function(a,b){a&&"string"==typeof a&&(a=d.util.createBuffer(a)),j=!1,k=d.util.createBuffer(),l=b||new d.util.createBuffer,m=a,p.output=l},update:function(a){for(j||k.putBuffer(a);k.length()>=8;)o([[5,e],[1,g],[6,e],[1,g],[5,e]])},finish:function(a){var b=!0;if(c)if(a)b=a(8,k,!c);else{var d=8===k.length()?8:8-k.length();k.fillWithByte(d,d)}if(b&&(j=!0,p.update()),!c&&(b=0===k.length()))if(a)b=a(8,l,!c);else{var e=l.length(),f=l.at(e-1);f>e?b=!1:l.truncate(f)}return b}}};d.rc2.startEncrypting=function(a,b,c){var e=d.rc2.createEncryptionCipher(a,128);return e.start(b,c),e},d.rc2.createEncryptionCipher=function(a,b){return g(a,b,!0)},d.rc2.startDecrypting=function(a,b,c){var e=d.rc2.createDecryptionCipher(a,128);return e.start(b,c),e},d.rc2.createDecryptionCipher=function(a,b){return g(a,b,!1)}},69445:(a,b,c)=>{a.exports=c(1277),c(38627),c(4554),c(6680),c(37691)},70710:(a,b,c)=>{var d,e=c(45654);c(76632),c(1277),c(33889);var f=e.pkcs5=e.pkcs5||{};e.util.isNodejs&&!e.options.usePureJavaScript&&(d=c(55511)),a.exports=e.pbkdf2=f.pbkdf2=function(a,b,c,f,g,h){if("function"==typeof g&&(h=g,g=null),e.util.isNodejs&&!e.options.usePureJavaScript&&d.pbkdf2&&(null===g||"object"!=typeof g)&&(d.pbkdf2Sync.length>4||!g||"sha1"===g))return("string"!=typeof g&&(g="sha1"),a=Buffer.from(a,"binary"),b=Buffer.from(b,"binary"),h)?4===d.pbkdf2Sync.length?d.pbkdf2(a,b,c,f,function(a,b){if(a)return h(a);h(null,b.toString("binary"))}):d.pbkdf2(a,b,c,f,g,function(a,b){if(a)return h(a);h(null,b.toString("binary"))}):4===d.pbkdf2Sync.length?d.pbkdf2Sync(a,b,c,f).toString("binary"):d.pbkdf2Sync(a,b,c,f,g).toString("binary");if(null==g&&(g="sha1"),"string"==typeof g){if(!(g in e.md.algorithms))throw Error("Unknown hash algorithm: "+g);g=e.md[g].create()}var i=g.digestLength;if(f>0xffffffff*i){var j=Error("Derived key is too long.");if(h)return h(j);throw j}var k=Math.ceil(f/i),l=f-(k-1)*i,m=e.hmac.create();m.start(g,a);var n="";if(!h){for(var o=1;o<=k;++o){m.start(null,null),m.update(b),m.update(e.util.int32ToBytes(o)),q=s=m.digest().getBytes();for(var p=2;p<=c;++p)m.start(null,null),m.update(s),r=m.digest().getBytes(),q=e.util.xorBytes(q,r,i),s=r;n+=o<k?q:q.substr(0,l)}return n}var q,r,s,p,o=1;!function a(){if(o>k)return h(null,n);m.start(null,null),m.update(b),m.update(e.util.int32ToBytes(o)),q=s=m.digest().getBytes(),p=2,function b(){if(p<=c)return m.start(null,null),m.update(s),r=m.digest().getBytes(),q=e.util.xorBytes(q,r,i),s=r,++p,e.util.setImmediate(b);n+=o<k?q:q.substr(0,l),++o,a()}()}()}},76103:(a,b,c)=>{var d=c(45654);c(45518),c(63070),c(88819),c(36105),c(49345),c(56416),c(29984),c(33889),c(65737);var e=d.asn1,f=a.exports=d.pkcs7=d.pkcs7||{};function g(a){var b;if(a.type===d.pki.oids.contentType)b=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.value).getBytes());else if(a.type===d.pki.oids.messageDigest)b=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,a.value.bytes());else if(a.type===d.pki.oids.signingTime){var c=new Date("1950-01-01T00:00:00Z"),f=new Date("2050-01-01T00:00:00Z"),g=a.value;if("string"==typeof g){var h=Date.parse(g);g=isNaN(h)?13===g.length?e.utcTimeToDate(g):e.generalizedTimeToDate(g):new Date(h)}b=g>=c&&g<f?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(g)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(g))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[b])])}function h(a,b,c){var f={};if(!e.validate(b,c,f,[])){var g=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw g.errors=g,g}if(e.derToOid(f.contentType)!==d.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(f.encryptedContent){var h="";if(d.util.isArray(f.encryptedContent))for(var i=0;i<f.encryptedContent.length;++i){if(f.encryptedContent[i].type!==e.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");h+=f.encryptedContent[i].value}else h=f.encryptedContent;a.encryptedContent={algorithm:e.derToOid(f.encAlgorithm),parameter:d.util.createBuffer(f.encParameter.value),content:d.util.createBuffer(h)}}if(f.content){var h="";if(d.util.isArray(f.content))for(var i=0;i<f.content.length;++i){if(f.content[i].type!==e.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");h+=f.content[i].value}else h=f.content;a.content=d.util.createBuffer(h)}return a.version=f.version.charCodeAt(0),a.rawCapture=f,f}function i(a){if(void 0===a.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===a.content){var b;switch(a.encryptedContent.algorithm){case d.pki.oids["aes128-CBC"]:case d.pki.oids["aes192-CBC"]:case d.pki.oids["aes256-CBC"]:b=d.aes.createDecryptionCipher(a.encryptedContent.key);break;case d.pki.oids.desCBC:case d.pki.oids["des-EDE3-CBC"]:b=d.des.createDecryptionCipher(a.encryptedContent.key);break;default:throw Error("Unsupported symmetric cipher, OID "+a.encryptedContent.algorithm)}if(b.start(a.encryptedContent.parameter),b.update(a.encryptedContent.content),!b.finish())throw Error("Symmetric decryption failed.");a.content=b.output}}f.messageFromPem=function(a){var b=d.pem.decode(a)[0];if("PKCS7"!==b.type){var c=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw c.headerType=b.type,c}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var g=e.fromDer(b.body);return f.messageFromAsn1(g)},f.messageToPem=function(a,b){var c={type:"PKCS7",body:e.toDer(a.toAsn1()).getBytes()};return d.pem.encode(c,{maxline:b})},f.messageFromAsn1=function(a){var b,c={},g=[];if(!e.validate(a,f.asn1.contentInfoValidator,c,g)){var h=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw h.errors=g,h}var i=e.derToOid(c.contentType);switch(i){case d.pki.oids.envelopedData:b=f.createEnvelopedData();break;case d.pki.oids.encryptedData:b=f.createEncryptedData();break;case d.pki.oids.signedData:b=f.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return b.fromAsn1(c.content.value[0]),b},f.createSignedData=function(){var a=null;return a={type:d.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(b){if(h(a,b,f.asn1.signedDataValidator),a.certificates=[],a.crls=[],a.digestAlgorithmIdentifiers=[],a.contentInfo=null,a.signerInfos=[],a.rawCapture.certificates)for(var c=a.rawCapture.certificates.value,e=0;e<c.length;++e)a.certificates.push(d.pki.certificateFromAsn1(c[e]))},toAsn1:function(){a.contentInfo||a.sign();for(var b=[],c=0;c<a.certificates.length;++c)b.push(d.pki.certificateToAsn1(a.certificates[c]));var f=[],g=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,a.digestAlgorithmIdentifiers),a.contentInfo])]);return b.length>0&&g.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,b)),f.length>0&&g.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,f)),g.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,a.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.type).getBytes()),g])},addSigner:function(b){var c=b.issuer,e=b.serialNumber;if(b.certificate){var f=b.certificate;"string"==typeof f&&(f=d.pki.certificateFromPem(f)),c=f.issuer.attributes,e=f.serialNumber}var g=b.key;if(!g)throw Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof g&&(g=d.pki.privateKeyFromPem(g));var h=b.digestAlgorithm||d.pki.oids.sha1;switch(h){case d.pki.oids.sha1:case d.pki.oids.sha256:case d.pki.oids.sha384:case d.pki.oids.sha512:case d.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+h)}var i=b.authenticatedAttributes||[];if(i.length>0){for(var j=!1,k=!1,l=0;l<i.length;++l){var m=i[l];if(!j&&m.type===d.pki.oids.contentType){if(j=!0,k)break;continue}if(!k&&m.type===d.pki.oids.messageDigest){if(k=!0,j)break;continue}}if(!j||!k)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}a.signers.push({key:g,version:1,issuer:c,serialNumber:e,digestAlgorithm:h,signatureAlgorithm:d.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:i,unauthenticatedAttributes:[]})},sign:function(b){if(b=b||{},("object"!=typeof a.content||null===a.contentInfo)&&(a.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d.pki.oids.data).getBytes())]),"content"in a)){var c;a.content instanceof d.util.ByteBuffer?c=a.content.bytes():"string"==typeof a.content&&(c=d.util.encodeUtf8(a.content)),b.detached?a.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c):a.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c)]))}0!==a.signers.length&&function(b){if(!(c=a.detachedContent?a.detachedContent:(c=a.contentInfo.value[1]).value[0]))throw Error("Could not sign PKCS#7 message; there is no content to sign.");var c,f=e.derToOid(a.contentInfo.value[0].value),h=e.toDer(c);for(var i in h.getByte(),e.getBerValueLength(h),h=h.getBytes(),b)b[i].start().update(h);for(var j=new Date,k=0;k<a.signers.length;++k){var l=a.signers[k];if(0===l.authenticatedAttributes.length){if(f!==d.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var m=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),n=0;n<l.authenticatedAttributes.length;++n){var o=l.authenticatedAttributes[n];o.type===d.pki.oids.messageDigest?o.value=b[l.digestAlgorithm].digest():o.type!==d.pki.oids.signingTime||o.value||(o.value=j),m.value.push(g(o)),l.authenticatedAttributesAsn1.value.push(g(o))}h=e.toDer(m).getBytes(),l.md.start().update(h)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}a.signerInfos=function(a){for(var b=[],c=0;c<a.length;++c)b.push(function(a){var b=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[d.pki.distinguishedNameToAsn1({attributes:a.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,d.util.hexToBytes(a.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(a.authenticatedAttributesAsn1&&b.value.push(a.authenticatedAttributesAsn1),b.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),b.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,a.signature)),a.unauthenticatedAttributes.length>0){for(var c=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),f=0;f<a.unauthenticatedAttributes.length;++f){var h=a.unauthenticatedAttributes[f];c.values.push(g(h))}b.value.push(c)}return b}(a[c]));return b}(a.signers)}(function(){for(var b={},c=0;c<a.signers.length;++c){var f=a.signers[c],g=f.digestAlgorithm;g in b||(b[g]=d.md[d.pki.oids[g]].create()),0===f.authenticatedAttributes.length?f.md=b[g]:f.md=d.md[d.pki.oids[g]].create()}for(var g in a.digestAlgorithmIdentifiers=[],b)a.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return b}())},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(b){"string"==typeof b&&(b=d.pki.certificateFromPem(b)),a.certificates.push(b)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.")}}},f.createEncryptedData=function(){var a=null;return a={type:d.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:d.pki.oids["aes256-CBC"]},fromAsn1:function(b){h(a,b,f.asn1.encryptedDataValidator)},decrypt:function(b){void 0!==b&&(a.encryptedContent.key=b),i(a)}}},f.createEnvelopedData=function(){var a=null;return a={type:d.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:d.pki.oids["aes256-CBC"]},fromAsn1:function(b){var c=h(a,b,f.asn1.envelopedDataValidator);a.recipients=function(a){for(var b=[],c=0;c<a.length;++c)b.push(function(a){var b={},c=[];if(!e.validate(a,f.asn1.recipientInfoValidator,b,c)){var g=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw g.errors=c,g}return{version:b.version.charCodeAt(0),issuer:d.pki.RDNAttributesAsArray(b.issuer),serialNumber:d.util.createBuffer(b.serial).toHex(),encryptedContent:{algorithm:e.derToOid(b.encAlgorithm),parameter:b.encParameter?b.encParameter.value:void 0,content:b.encKey}}}(a[c]));return b}(c.recipientInfos.value)},toAsn1:function(){var b;return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(a.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,function(a){for(var b,c=[],f=0;f<a.length;++f)c.push((b=a[f],e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(b.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[d.pki.distinguishedNameToAsn1({attributes:b.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,d.util.hexToBytes(b.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b.encryptedContent.content)])));return c}(a.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,(b=a.encryptedContent,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(b.algorithm).getBytes()),b.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b.content.getBytes())])]))])])])},findRecipient:function(b){for(var c=b.issuer.attributes,d=0;d<a.recipients.length;++d){var e=a.recipients[d],f=e.issuer;if(e.serialNumber===b.serialNumber&&f.length===c.length){for(var g=!0,h=0;h<c.length;++h)if(f[h].type!==c[h].type||f[h].value!==c[h].value){g=!1;break}if(g)return e}}return null},decrypt:function(b,c){if(void 0===a.encryptedContent.key&&void 0!==b&&void 0!==c)switch(b.encryptedContent.algorithm){case d.pki.oids.rsaEncryption:case d.pki.oids.desCBC:var e=c.decrypt(b.encryptedContent.content);a.encryptedContent.key=d.util.createBuffer(e);break;default:throw Error("Unsupported asymmetric cipher, OID "+b.encryptedContent.algorithm)}i(a)},addRecipient:function(b){a.recipients.push({version:0,issuer:b.issuer.attributes,serialNumber:b.serialNumber,encryptedContent:{algorithm:d.pki.oids.rsaEncryption,key:b.publicKey}})},encrypt:function(b,c){if(void 0===a.encryptedContent.content){switch(c=c||a.encryptedContent.algorithm,b=b||a.encryptedContent.key,c){case d.pki.oids["aes128-CBC"]:e=16,f=16,g=d.aes.createEncryptionCipher;break;case d.pki.oids["aes192-CBC"]:e=24,f=16,g=d.aes.createEncryptionCipher;break;case d.pki.oids["aes256-CBC"]:e=32,f=16,g=d.aes.createEncryptionCipher;break;case d.pki.oids["des-EDE3-CBC"]:e=24,f=8,g=d.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+c)}if(void 0===b)b=d.util.createBuffer(d.random.getBytes(e));else if(b.length()!=e)throw Error("Symmetric key has wrong length; got "+b.length()+" bytes, expected "+e+".");a.encryptedContent.algorithm=c,a.encryptedContent.key=b,a.encryptedContent.parameter=d.util.createBuffer(d.random.getBytes(f));var e,f,g,h=g(b);if(h.start(a.encryptedContent.parameter.copy()),h.update(a.content),!h.finish())throw Error("Symmetric encryption failed.");a.encryptedContent.content=h.output}for(var i=0;i<a.recipients.length;++i){var j=a.recipients[i];if(void 0===j.encryptedContent.content)if(j.encryptedContent.algorithm===d.pki.oids.rsaEncryption)j.encryptedContent.content=j.encryptedContent.key.encrypt(a.encryptedContent.key.data);else throw Error("Unsupported asymmetric cipher, OID "+j.encryptedContent.algorithm)}}}}},76632:(a,b,c)=>{var d=c(45654);c(1277),c(33889),(a.exports=d.hmac=d.hmac||{}).create=function(){var a=null,b=null,c=null,e=null,f={};return f.start=function(f,g){if(null!==f)if("string"==typeof f)if((f=f.toLowerCase())in d.md.algorithms)b=d.md.algorithms[f].create();else throw Error('Unknown hash algorithm "'+f+'"');else b=f;if(null===g)g=a;else{if("string"==typeof g)g=d.util.createBuffer(g);else if(d.util.isArray(g)){var h=g;g=d.util.createBuffer();for(var i=0;i<h.length;++i)g.putByte(h[i])}var j=g.length();j>b.blockLength&&(b.start(),b.update(g.bytes()),g=b.digest()),c=d.util.createBuffer(),e=d.util.createBuffer(),j=g.length();for(var i=0;i<j;++i){var h=g.at(i);c.putByte(54^h),e.putByte(92^h)}if(j<b.blockLength)for(var h=b.blockLength-j,i=0;i<h;++i)c.putByte(54),e.putByte(92);a=g,c=c.bytes(),e=e.bytes()}b.start(),b.update(c)},f.update=function(a){b.update(a)},f.getMac=function(){var a=b.digest().bytes();return b.start(),b.update(e),b.update(a),b.digest()},f.digest=f.getMac,f}},77051:(a,b,c)=>{"use strict";let d=c(14985).promises,e=c(91645),{normalizeIp:f,clientIpMatches:g}=c(54584),h=new Map,i=Object.freeze(["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.2.0/24","192.88.99.0/24","192.168.0.0/16","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","224.0.0.0/4","240.0.0.0/4","::/96","::1/128","100::/64","2001:2::/48","2001:db8::/32","fc00::/7","fe80::/10","ff00::/8"]),j=Object.freeze([".localhost",".local",".internal",".lan",".home.arpa"]);function k(a){return String(a||"").trim().replace(/^\[|\]$/g,"").replace(/\.$/,"").toLowerCase()}function l(a){let b=k(a);return!(!(!b||"localhost"===b||j.some(a=>b.endsWith(a)))&&(e.isIP(b)||b.includes(".")))}function m(a){let b=f(a);return!!e.isIP(b)&&!g(b,i)}function n(a){let b=[...new Set((Array.isArray(a)?a:[a]).map(a=>Number(a)).filter(a=>Number.isInteger(a)&&a>=1&&a<=65535))];return b.length?b:[443]}function o(a){let b=[...a?.addresses||[]];return function(c,d,e){let f=d,g=e;"function"==typeof d&&(g=d,f={});let h="number"==typeof f?f:Number(f?.family||0);if("object"==typeof f&&f?.all===!0){let c=4===h||6===h?b.filter(a=>a.family===h):b;if(!c.length){let b=Error(`No validated public address for ${a.host}`);b.code="ENOTFOUND",g(b);return}g(null,c.map(({address:a,family:b})=>({address:a,family:b})));return}let i=function(a,b=0){let c=Number(b||0);return 4===c||6===c?a.find(a=>a.family===c)||null:a.find(a=>4===a.family)||a[0]||null}(b,h);if(!i){let b=Error(`No validated public address for ${a.host}`);b.code="ENOTFOUND",g(b);return}g(null,i.address,i.family)}}async function p(a,b,c={}){let g=k(a),i=Number(b||443),j=n(c.allowedPorts||[443]);if(!g)throw Error("Destination host is empty");if(!Number.isInteger(i)||!j.includes(i))throw Error(`CONNECT destination port ${i||"unknown"} is not allowed`);if(l(g))throw Error(`Private or local destination hostname is not allowed: ${g}`);let q=e.isIP(f(g));if(q){let a=f(g);if(!m(a))throw Error(`Private or reserved destination address is not allowed: ${a}`);let b={host:g,port:i,addresses:[{address:a,family:q}]};return{...b,lookup:o(b)}}let r=Date.now(),s=h.get(g);if(!s||s.expiresAt<=r){let a=await d.lookup(g,{all:!0,verbatim:!0}),b=[],c=new Set;for(let d of a||[]){let a=f(d.address),g=e.isIP(a);if(!g||!m(a))continue;let h=`${g}:${a}`;c.has(h)||(c.add(h),b.push({address:a,family:g}))}if(!b.length)throw Error(`Destination did not resolve to a public address: ${g}`);s={addresses:b,expiresAt:r+6e4},h.set(g,s)}let t={host:g,port:i,addresses:[...s.addresses]};return{...t,lookup:o(t)}}a.exports={BLOCKED_ADDRESS_RANGES:i,normalizeTargetHost:k,normalizeAllowedPorts:n,isBlockedHostname:l,isPublicAddress:m,createPinnedLookup:o,resolvePublicTarget:p,clearDnsPolicyCache:function(){h.clear()}}},87981:(a,b,c)=>{var d=c(45654);c(29984),c(33889),(a.exports=d.pss=d.pss||{}).create=function(a){3==arguments.length&&(a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var b,c=a.md,e=a.mgf,f=c.digestLength,g=a.salt||null;if("string"==typeof g&&(g=d.util.createBuffer(g)),"saltLength"in a)b=a.saltLength;else if(null!==g)b=g.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==g&&g.length()!==b)throw Error("Given salt length does not match length of given salt.");var h=a.prng||d.random,i={};return i.encode=function(a,i){var j,k,l=i-1,m=Math.ceil(l/8),n=a.digest().getBytes();if(m<f+b+2)throw Error("Message is too long to encrypt.");k=null===g?h.getBytesSync(b):g.bytes();var o=new d.util.ByteBuffer;o.fillWithByte(0,8),o.putBytes(n),o.putBytes(k),c.start(),c.update(o.getBytes());var p=c.digest().getBytes(),q=new d.util.ByteBuffer;q.fillWithByte(0,m-b-f-2),q.putByte(1),q.putBytes(k);var r=q.getBytes(),s=m-f-1,t=e.generate(p,s),u="";for(j=0;j<s;j++)u+=String.fromCharCode(r.charCodeAt(j)^t.charCodeAt(j));return(u=String.fromCharCode(u.charCodeAt(0)&~(65280>>8*m-l&255))+u.substr(1))+p+String.fromCharCode(188)},i.verify=function(a,g,h){var i,j=h-1,k=Math.ceil(j/8);if(g=g.substr(-k),k<f+b+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(k-1))throw Error("Encoded message does not end in 0xBC.");var l=k-f-1,m=g.substr(0,l),n=g.substr(l,f),o=65280>>8*k-j&255;if((m.charCodeAt(0)&o)!=0)throw Error("Bits beyond keysize not zero as expected.");var p=e.generate(n,l),q="";for(i=0;i<l;i++)q+=String.fromCharCode(m.charCodeAt(i)^p.charCodeAt(i));q=String.fromCharCode(q.charCodeAt(0)&~o)+q.substr(1);var r=k-f-b-2;for(i=0;i<r;i++)if(0!==q.charCodeAt(i))throw Error("Leftmost octets not zero as expected");if(1!==q.charCodeAt(r))throw Error("Inconsistent PSS signature, 0x01 marker not found");var s=q.substr(-b),t=new d.util.ByteBuffer;return t.fillWithByte(0,8),t.putBytes(a),t.putBytes(s),c.start(),c.update(t.getBytes()),n===c.digest().getBytes()},i}},88819:(a,b,c)=>{var d=c(45654);function e(a,b){d.cipher.registerAlgorithm(a,function(){return new d.des.Algorithm(a,b)})}c(66568),c(19396),c(33889),a.exports=d.des=d.des||{},d.des.startEncrypting=function(a,b,c,d){var e=o({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});return e.start(b),e},d.des.createEncryptionCipher=function(a,b){return o({key:a,output:null,decrypt:!1,mode:b})},d.des.startDecrypting=function(a,b,c,d){var e=o({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});return e.start(b),e},d.des.createDecryptionCipher=function(a,b){return o({key:a,output:null,decrypt:!0,mode:b})},d.des.Algorithm=function(a,b){var c=this;c.name=a,c.mode=new b({blockSize:8,cipher:{encrypt:function(a,b){return n(c._keys,a,b,!1)},decrypt:function(a,b){return n(c._keys,a,b,!0)}}}),c._init=!1},d.des.Algorithm.prototype.initialize=function(a){if(!this._init){var b=d.util.createBuffer(a.key);if(0===this.name.indexOf("3DES")&&24!==b.length())throw Error("Invalid Triple-DES key size: "+8*b.length());this._keys=function(a){for(var b,c=[0,4,0x20000000,0x20000004,65536,65540,0x20010000,0x20010004,512,516,0x20000200,0x20000204,66048,66052,0x20010200,0x20010204],d=[0,1,1048576,1048577,0x4000000,0x4000001,0x4100000,0x4100001,256,257,1048832,1048833,0x4000100,0x4000101,0x4100100,0x4100101],e=[0,8,2048,2056,0x1000000,0x1000008,0x1000800,0x1000808,0,8,2048,2056,0x1000000,0x1000008,0x1000800,0x1000808],f=[0,2097152,0x8000000,0x8200000,8192,2105344,0x8002000,0x8202000,131072,2228224,0x8020000,0x8220000,139264,2236416,0x8022000,0x8222000],g=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],h=[0,1024,32,1056,0,1024,32,1056,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420],i=[0,0x10000000,524288,0x10080000,2,0x10000002,524290,0x10080002,0,0x10000000,524288,0x10080000,2,0x10000002,524290,0x10080002],j=[0,65536,2048,67584,0x20000000,0x20010000,0x20000800,0x20010800,131072,196608,133120,198656,0x20020000,0x20030000,0x20020800,0x20030800],k=[0,262144,0,262144,2,262146,2,262146,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002],l=[0,0x10000000,8,0x10000008,0,0x10000000,8,0x10000008,1024,0x10000400,1032,0x10000408,1024,0x10000400,1032,0x10000408],m=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],n=[0,0x1000000,512,0x1000200,2097152,0x1200000,2097664,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200],o=[0,4096,0x8000000,0x8001000,524288,528384,0x8080000,0x8081000,16,4112,0x8000010,0x8001010,524304,528400,0x8080010,0x8081010],p=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],q=a.length()>8?3:1,r=[],s=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],t=0,u=0;u<q;u++){var v=a.getInt32(),w=a.getInt32();b=(v>>>4^w)&0xf0f0f0f,w^=b,v^=b<<4,b=(w>>>-16^v)&65535,v^=b,w^=b<<-16,b=(v>>>2^w)&0x33333333,w^=b,v^=b<<2,b=(w>>>-16^v)&65535,v^=b,w^=b<<-16,b=(v>>>1^w)&0x55555555,w^=b,v^=b<<1,b=(w>>>8^v)&0xff00ff,v^=b,w^=b<<8,b=(v>>>1^w)&0x55555555,w^=b,v^=b<<1,b=v<<8|w>>>20&240,v=w<<24|w<<8&0xff0000|w>>>8&65280|w>>>24&240,w=b;for(var x=0;x<s.length;++x){s[x]?(v=v<<2|v>>>26,w=w<<2|w>>>26):(v=v<<1|v>>>27,w=w<<1|w>>>27),w&=-15;var y=c[(v&=-15)>>>28]|d[v>>>24&15]|e[v>>>20&15]|f[v>>>16&15]|g[v>>>12&15]|h[v>>>8&15]|i[v>>>4&15],z=j[w>>>28]|k[w>>>24&15]|l[w>>>20&15]|m[w>>>16&15]|n[w>>>12&15]|o[w>>>8&15]|p[w>>>4&15];b=(z>>>16^y)&65535,r[t++]=y^b,r[t++]=z^b<<16}}return r}(b),this._init=!0}},e("DES-ECB",d.cipher.modes.ecb),e("DES-CBC",d.cipher.modes.cbc),e("DES-CFB",d.cipher.modes.cfb),e("DES-OFB",d.cipher.modes.ofb),e("DES-CTR",d.cipher.modes.ctr),e("3DES-ECB",d.cipher.modes.ecb),e("3DES-CBC",d.cipher.modes.cbc),e("3DES-CFB",d.cipher.modes.cfb),e("3DES-OFB",d.cipher.modes.ofb),e("3DES-CTR",d.cipher.modes.ctr);var f=[0x1010400,0,65536,0x1010404,0x1010004,66564,4,65536,1024,0x1010400,0x1010404,1024,0x1000404,0x1010004,0x1000000,4,1028,0x1000400,0x1000400,66560,66560,0x1010000,0x1010000,0x1000404,65540,0x1000004,0x1000004,65540,0,1028,66564,0x1000000,65536,0x1010404,4,0x1010000,0x1010400,0x1000000,0x1000000,1024,0x1010004,65536,66560,0x1000004,1024,4,0x1000404,66564,0x1010404,65540,0x1010000,0x1000404,0x1000004,1028,66564,0x1010400,1028,0x1000400,0x1000400,0,65540,66560,0,0x1010004],g=[-0x7fef7fe0,-0x7fff8000,32768,1081376,1048576,32,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,1048576,32,-0x7fefffe0,1081344,1048608,-0x7fff7fe0,0,-0x80000000,32768,1081376,-0x7ff00000,1048608,-0x7fffffe0,0,1081344,32800,-0x7fef8000,-0x7ff00000,32800,0,1081376,-0x7fefffe0,1048576,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,32768,-0x7ff00000,-0x7fff8000,32,-0x7fef7fe0,1081376,32,32768,-0x80000000,32800,-0x7fef8000,1048576,-0x7fffffe0,1048608,-0x7fff7fe0,-0x7fffffe0,1048608,1081344,0,-0x7fff8000,32800,-0x80000000,-0x7fefffe0,-0x7fef7fe0,1081344],h=[520,0x8020200,0,0x8020008,0x8000200,0,131592,0x8000200,131080,0x8000008,0x8000008,131072,0x8020208,131080,0x8020000,520,0x8000000,8,0x8020200,512,131584,0x8020000,0x8020008,131592,0x8000208,131584,131072,0x8000208,8,0x8020208,512,0x8000000,0x8020200,0x8000000,131080,520,131072,0x8020200,0x8000200,0,512,131080,0x8020208,0x8000200,0x8000008,512,0,0x8020008,0x8000208,131072,0x8000000,0x8020208,8,131592,131584,0x8000008,0x8020000,0x8000208,520,0x8020000,131592,8,0x8020008,131584],i=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],j=[256,0x2080100,0x2080000,0x42000100,524288,256,0x40000000,0x2080000,0x40080100,524288,0x2000100,0x40080100,0x42000100,0x42080000,524544,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,524544,524288,0x42000100,256,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,256,0x2000000,0x42080000,0x42080100,524544,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,524544,0x2000100,0x40000100,524288,0,0x40080000,0x2080100,0x40000100],k=[0x20000010,0x20400000,16384,0x20404010,0x20400000,16,0x20404010,4194304,0x20004000,4210704,4194304,0x20000010,4194320,0x20004000,0x20000000,16400,0,4194320,0x20004010,16384,4210688,0x20004010,16,0x20400010,0x20400010,0,4210704,0x20404000,16400,4210688,0x20404000,0x20000000,0x20004000,16,0x20400010,4210688,0x20404010,4194304,16400,0x20000010,4194304,0x20004000,0x20000000,16400,0x20000010,0x20404010,4210688,0x20400000,4210704,0x20404000,0,0x20400010,16,16384,0x20400000,4210704,16384,4194320,0x20004010,0,0x20404000,0x20000000,4194320,0x20004010],l=[2097152,0x4200002,0x4000802,0,2048,0x4000802,2099202,0x4200800,0x4200802,2097152,0,0x4000002,2,0x4000000,0x4200002,2050,0x4000800,2099202,2097154,0x4000800,0x4000002,0x4200000,0x4200800,2097154,0x4200000,2048,2050,0x4200802,2099200,2,0x4000000,2099200,0x4000000,2099200,2097152,0x4000802,0x4000802,0x4200002,0x4200002,2,2097154,0x4000000,0x4000800,2097152,0x4200800,2050,2099202,0x4200800,2050,0x4000002,0x4200802,0x4200000,2099200,0,2,0x4200802,0,2099202,0x4200000,2048,0x4000002,0x4000800,2048,2097154],m=[0x10001040,4096,262144,0x10041040,0x10000000,0x10001040,64,0x10000000,262208,0x10040000,0x10041040,266240,0x10041000,266304,4096,64,0x10040000,0x10000040,0x10001000,4160,266240,262208,0x10040040,0x10041000,4160,0,0,0x10040040,0x10000040,0x10001000,266304,262144,266304,262144,0x10041000,4096,64,0x10040040,4096,266304,0x10001000,64,0x10000040,0x10040000,0x10040040,0x10000000,262144,0x10001040,0,0x10041040,262208,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,266240,266240,4160,4160,262208,0x10000000,0x10041000];function n(a,b,c,d){var e,n,o=32===a.length?3:9;e=3===o?d?[30,-2,-2]:[0,32,2]:d?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var p=b[0],q=b[1];n=(p>>>4^q)&0xf0f0f0f,q^=n,p^=n<<4,n=(p>>>16^q)&65535,q^=n,p^=n<<16,n=(q>>>2^p)&0x33333333,p^=n,q^=n<<2,n=(q>>>8^p)&0xff00ff,p^=n,q^=n<<8,n=(p>>>1^q)&0x55555555,q^=n,p^=n<<1,p=p<<1|p>>>31,q=q<<1|q>>>31;for(var r=0;r<o;r+=3){for(var s=e[r+1],t=e[r+2],u=e[r];u!=s;u+=t){var v=q^a[u],w=(q>>>4|q<<28)^a[u+1];n=p,p=q,q=n^(g[v>>>24&63]|i[v>>>16&63]|k[v>>>8&63]|m[63&v]|f[w>>>24&63]|h[w>>>16&63]|j[w>>>8&63]|l[63&w])}n=p,p=q,q=n}n=((p=p>>>1|p<<31)>>>1^(q=q>>>1|q<<31))&0x55555555,q^=n,p^=n<<1,n=(q>>>8^p)&0xff00ff,p^=n,q^=n<<8,n=(q>>>2^p)&0x33333333,p^=n,q^=n<<2,n=(p>>>16^q)&65535,q^=n,p^=n<<16,n=(p>>>4^q)&0xf0f0f0f,q^=n,p^=n<<4,c[0]=p,c[1]=q}function o(a){var b,c="DES-"+((a=a||{}).mode||"CBC").toUpperCase(),e=(b=a.decrypt?d.cipher.createDecipher(c,a.key):d.cipher.createCipher(c,a.key)).start;return b.start=function(a,c){var f=null;c instanceof d.util.ByteBuffer&&(f=c,c={}),(c=c||{}).output=f,c.iv=a,e.call(b,c)},b}},93599:(a,b,c)=>{"use strict";let d=c(73496),e=c(91645),f=c(34631),g=c(74075),h=c(55511),i=c(5019),{createAuditProxy:j,CaptureBuffer:k}=c(33575),{containsLikelySecret:l}=c(14681),{clientIpMatches:m,normalizeAllowedClientIps:n}=c(54584),{isPublicAddress:o}=c(77051);function p(a){return h.createHash("sha256").update(a).digest("hex")}function q(a){let b=i.pki.rsa.generateKeyPair(2048),c=i.pki.createCertificate();c.publicKey=b.publicKey,c.serialNumber=String(Date.now()),c.validity.notBefore=new Date(Date.now()-6e4),c.validity.notAfter=new Date(Date.now()+864e5);let d=[{name:"commonName",value:a}];return c.setSubject(d),c.setIssuer(d),c.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0}]),c.sign(b.privateKey,i.md.sha256.create()),{cert:c,keys:b,certPem:i.pki.certificateToPem(c)}}function r(a,b){let c=i.pki.rsa.generateKeyPair(2048),d=i.pki.createCertificate();return d.publicKey=c.publicKey,d.serialNumber=`${Date.now()}${Math.floor(1e3*Math.random())}`,d.validity.notBefore=new Date(Date.now()-6e4),d.validity.notAfter=new Date(Date.now()+864e5),d.setSubject([{name:"commonName",value:b}]),d.setIssuer(a.cert.subject.attributes),d.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:b}]}]),d.sign(a.keys.privateKey,i.md.sha256.create()),{cert:i.pki.certificateToPem(d),key:i.pki.privateKeyToPem(c.privateKey)}}function s(a,b="127.0.0.1"){return new Promise((c,d)=>{a.once("error",d),a.listen(0,b,()=>{a.removeListener("error",d),c(a.address())})})}function t(a){return new Promise(b=>{if(!a)return b();try{a.forceCloseAll?.()}catch{}if(!a.listening)return b();a.close(()=>b()),setTimeout(b,1e3).unref?.()})}function u(a,b){let c="127.0.0.1";return Promise.resolve({host:a,port:b,addresses:[{address:c,family:4}],lookup:(a,b,d)=>{let e=b,f=d;"function"==typeof b&&(f=b,e={}),e?.all?f(null,[{address:c,family:4}]):f(null,c,4)}})}function v(a,b){return new Promise((c,d)=>{let f=e.connect(a,"127.0.0.1"),g=Buffer.alloc(0),h=setTimeout(()=>d(Error("CONNECT timeout")),7e3);f.once("error",d),f.once("connect",()=>{f.write(`CONNECT ${b} HTTP/1.1\r
|
|
49
49
|
Host: ${b}\r
|
|
50
50
|
Proxy-Connection: keep-alive\r
|
|
51
51
|
\r
|