@poe-platform/safe-bash 0.1.682 → 0.1.684

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.
Files changed (45) hide show
  1. package/README.md +10 -0
  2. package/dist/safe-bash/chunks/chunk-4MPK7VIM.js +519 -0
  3. package/dist/safe-bash/chunks/chunk-4MPK7VIM.js.map +7 -0
  4. package/dist/safe-bash/chunks/{chunk-6R7IR2MV.js → chunk-BONY6MX5.js} +731 -15
  5. package/dist/safe-bash/chunks/chunk-BONY6MX5.js.map +7 -0
  6. package/dist/safe-bash/commands/python/index.browser.js +12 -2
  7. package/dist/safe-bash/commands/python/index.d.ts +5 -0
  8. package/dist/safe-bash/commands/python/index.d.ts.map +1 -1
  9. package/dist/safe-bash/commands/python/index.js +15 -3
  10. package/dist/safe-bash/commands/python/index.js.map +1 -1
  11. package/dist/safe-bash/commands/python/jspi-assets.d.ts +14 -0
  12. package/dist/safe-bash/commands/python/jspi-assets.d.ts.map +1 -0
  13. package/dist/safe-bash/commands/python/jspi-assets.js +51 -0
  14. package/dist/safe-bash/commands/python/jspi-assets.js.map +1 -0
  15. package/dist/safe-bash/commands/python/jspi-scheduler.d.ts +8 -0
  16. package/dist/safe-bash/commands/python/jspi-scheduler.d.ts.map +1 -0
  17. package/dist/safe-bash/commands/python/jspi-scheduler.js +49 -0
  18. package/dist/safe-bash/commands/python/jspi-scheduler.js.map +1 -0
  19. package/dist/safe-bash/commands/python/jspi-trampoline.d.ts +5 -0
  20. package/dist/safe-bash/commands/python/jspi-trampoline.d.ts.map +1 -0
  21. package/dist/safe-bash/commands/python/jspi-trampoline.js +90 -0
  22. package/dist/safe-bash/commands/python/jspi-trampoline.js.map +1 -0
  23. package/dist/safe-bash/commands/python/jspi.d.ts +22 -0
  24. package/dist/safe-bash/commands/python/jspi.d.ts.map +1 -0
  25. package/dist/safe-bash/commands/python/jspi.js +295 -0
  26. package/dist/safe-bash/commands/python/jspi.js.map +1 -0
  27. package/dist/safe-bash/commands/python/runtime-scripts.d.ts +6 -0
  28. package/dist/safe-bash/commands/python/runtime-scripts.d.ts.map +1 -0
  29. package/dist/safe-bash/commands/python/runtime-scripts.js +168 -0
  30. package/dist/safe-bash/commands/python/runtime-scripts.js.map +1 -0
  31. package/dist/safe-bash/commands/python/worker.browser.js +13 -368
  32. package/dist/safe-bash/commands/python/worker.browser.js.map +3 -3
  33. package/dist/safe-bash/commands/python/worker.d.ts.map +1 -1
  34. package/dist/safe-bash/commands/python/worker.js +6 -168
  35. package/dist/safe-bash/commands/python/worker.js.map +1 -1
  36. package/dist/safe-bash/core.browser.js +12 -2
  37. package/dist/safe-bash/core.browser.js.map +1 -1
  38. package/dist/safe-bash/playwright/capability-events.d.ts +1 -1
  39. package/dist/safe-bash/playwright/capability-events.d.ts.map +1 -1
  40. package/dist/safe-bash/playwright/capability-events.js +51 -25
  41. package/dist/safe-bash/playwright/capability-events.js.map +1 -1
  42. package/package.json +2 -2
  43. package/dist/safe-bash/chunks/chunk-3G3EZZ63.js +0 -145
  44. package/dist/safe-bash/chunks/chunk-3G3EZZ63.js.map +0 -7
  45. package/dist/safe-bash/chunks/chunk-6R7IR2MV.js.map +0 -7
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commands/python/index.ts", "../../src/commands/python/reply.ts", "../../src/commands/python/installation.ts", "../../src/commands/python/provisioning.ts", "../../../../node_modules/@noble/hashes/sha2.js", "../../../../node_modules/@noble/hashes/_md.js", "../../../../node_modules/@noble/hashes/_u64.js", "../../../../node_modules/@noble/hashes/utils.js", "../../src/commands/python/manifest.ts", "../../src/commands/python/cache.ts", "../../src/commands/python/executor-pool.ts"],
4
- "sourcesContent": ["import { PythonFileSystem, PythonStatTranslator, type FileStat } from '@poe-code/safe-fs/core';\nimport type { CommandContext, CommandDefinition, VirtualShellPlugin } from '../../contracts/index.js';\nimport { validateExitCode } from '../../contracts/command.js';\nimport { openCommandFile } from '../../contracts/filesystem-descriptor.js';\nimport { encodePythonReply } from './reply.js';\nimport { parsePythonInvocation, PythonInvocationError } from './invocation.js';\nimport { parsePythonInstallation, pythonInstallationHelp } from './installation.js';\nimport { createPythonPackageEnvironment, pythonDocumentPackages, type PythonPackageOptions, type PythonPackageStart, type PythonPackageEnvironment } from './provisioning.js';\nimport { readBytes, writeBytes } from '../../contracts/io.js';\nimport { createOutputOperation, type OutputOperation } from '../../contracts/output.js';\nimport { inheritYieldCheckpoint, yieldTurn } from '../../contracts/yield.js';\nimport { PythonFailure, isPythonFailureCategory, reportPythonFailure, type PythonDiagnosticObserver, type PythonFailureCategory } from './diagnostics.js';\n\nclass PythonInputChunkError extends RangeError {}\n\n/** A dedicated interpreter worker. The service event loop must never block. */\nexport interface PythonWorkerEndpoint {\n postMessage(value: unknown): void;\n subscribe(listener: (value: unknown) => void, onError: (error: unknown) => void): () => void;\n terminate(): void | Promise<void>;\n}\nexport interface PythonInitializationProgress {\n readonly phase: 'initializing' | 'ready' | 'finished';\n readonly command: string;\n}\nexport interface PythonCommandsOptions {\n readonly createWorker?: () => PythonWorkerEndpoint;\n readonly createExecutor?: () => PythonAsyncExecutor;\n /** Explicit distribution requirements; no import scanning or implicit package downloads. */\n readonly packages?: readonly string[];\n /** Requirements files in the canonical filesystem. */\n readonly requirements?: readonly string[];\n readonly packageProfile?: 'documents';\n readonly provisioning?: PythonPackageOptions;\n readonly environment?: PythonPackageEnvironment;\n /** Host UI lifecycle; never written to guest stdout/stderr. */\n readonly onProgress?: (event: PythonInitializationProgress) => void;\n readonly onDiagnostic?: PythonDiagnosticObserver;\n readonly runtimeMount?: string;\n readonly maxTransferBytes?: number;\n readonly maxOpenFiles?: number;\n /** Fail immediately at capacity; queued pipeline stages can deadlock. Shared by both aliases. */\n readonly maxConcurrentWorkers?: number;\n /** Largest upstream stdin fragment retained by the bridge, independent of transfer size. */\n readonly maxInputChunkBytes?: number;\n readonly replace?: boolean;\n}\nexport interface PythonWorkerStart {\n readonly type: 'start';\n readonly packages?: PythonPackageStart;\n readonly installOnly?: boolean;\n readonly shared: SharedArrayBuffer;\n readonly invocation: { readonly command?: string; readonly args: readonly string[]; readonly cwd: string; readonly env: Readonly<Record<string, string>> };\n readonly runtimeMount: string;\n readonly maxTransferBytes: number;\n}\n\nexport interface PythonExecutorStart extends Omit<PythonWorkerStart, 'type' | 'shared'> {\n readonly signal: AbortSignal;\n dispatch(request: { readonly op: string; readonly args: unknown[] }): Promise<unknown>;\n onReady(): void;\n}\n\nexport interface PythonAsyncExecutor {\n run(start: PythonExecutorStart): Promise<number>;\n terminate(): void | Promise<void>;\n}\n\nexport function createPythonCommands(options: PythonCommandsOptions): readonly CommandDefinition[] {\n if (!options || (typeof options.createWorker === 'function') === (typeof options.createExecutor === 'function')\n || options.createWorker !== undefined && typeof options.createWorker !== 'function'\n || options.createExecutor !== undefined && typeof options.createExecutor !== 'function') throw new PythonFailure('executor-unavailable');\n if (options.onDiagnostic !== undefined && typeof options.onDiagnostic !== 'function') throw new TypeError('Python onDiagnostic must be a function');\n if (options.environment && options.provisioning) throw new TypeError('A borrowed Python environment cannot be combined with provisioning options');\n const maxTransferBytes = options.maxTransferBytes ?? 65536;\n const maxOpenFiles = options.maxOpenFiles ?? 256;\n const maxConcurrentWorkers = options.maxConcurrentWorkers ?? 4;\n const maxInputChunkBytes = options.maxInputChunkBytes ?? 1048576;\n if (!Number.isSafeInteger(maxConcurrentWorkers) || maxConcurrentWorkers < 1 || maxConcurrentWorkers > 64) throw new RangeError('Invalid Python worker concurrency limit');\n if (!Number.isSafeInteger(maxInputChunkBytes) || maxInputChunkBytes < 1 || maxInputChunkBytes > 16777216) throw new RangeError('Invalid Python input chunk limit');\n let activeWorkers = 0;\n for (const size of [maxTransferBytes, maxOpenFiles]) if (!Number.isSafeInteger(size) || size < 1 || size > 1048576) throw new RangeError('Invalid Python resource limit');\n const runtimeMount = options.runtimeMount ?? '/.pyodide-runtime';\n if (!runtimeMount.startsWith('/') || runtimeMount === '/' || runtimeMount.slice(1).includes('/') || runtimeMount.includes('\\0') || runtimeMount.split('/').some(part => part === '..' || part === '.')) throw new TypeError('Python runtime mount must be an absolute top-level canonical path');\n const environment = options.environment ?? createPythonPackageEnvironment(options.provisioning);\n const execute = async (context: CommandContext) => {\n let installation;\n try {\n parsePythonInvocation(context.args, context.env);\n installation = parsePythonInstallation(context.args);\n } catch (error) {\n if (!(error instanceof PythonInvocationError)) throw error;\n await writeBytes(context.stderr, new TextEncoder().encode('python: ' + error.message + '\\n'), context.signal);\n return { exitCode: 2 };\n }\n if (installation?.help) {\n await writeBytes(context.stdout, new TextEncoder().encode(pythonInstallationHelp), context.signal);\n return { exitCode: 0 };\n }\n context.signal.throwIfAborted();\n if (activeWorkers >= maxConcurrentWorkers) {\n const failure = reportPythonFailure('capacity', undefined, options.onDiagnostic);\n await writeBytes(context.stderr, new TextEncoder().encode('python: ' + failure.message + '\\n'), context.signal);\n return { exitCode: 1 };\n }\n const controller = new AbortController();\n const signal = AbortSignal.any([context.signal, controller.signal]);\n inheritYieldCheckpoint(context.signal, signal);\n // The service is the single registered owner of descriptors and late acquisition.\n const fileContext = { ...context, descriptorCleanup: \"caller\" as const };\n const metadata = new PythonStatTranslator();\n const service = new PythonFileSystem(context.fs, { cwd: context.cwd, signal, maxTransferBytes, maxOpenFiles,\n open: (path, settings) => openCommandFile(fileContext, path, settings) });\n let stdoutOperation: OutputOperation | undefined;\n let stderrOperation: OutputOperation | undefined;\n let endpoint: PythonWorkerEndpoint | undefined;\n let executor: PythonAsyncExecutor | undefined;\n let packages: PythonPackageStart | undefined;\n let unsubscribe: (() => void) | undefined;\n let admitted = false;\n let closed = false;\n let closing: Promise<void> | undefined;\n const pending = new Set<Promise<void>>();\n const input = readBytes(context.stdin, signal)[Symbol.asyncIterator]();\n let fragment: Uint8Array | undefined;\n let offset = 0;\n let inputBytes = 0;\n let rejectRun!: (reason: unknown) => void;\n const close = (): Promise<void> => {\n if (closing) return closing;\n let finish!: () => void;\n let fail!: (reason: unknown) => void;\n closing = new Promise<void>((resolve, reject) => { finish = resolve; fail = reject; });\n closed = true;\n controller.abort(new Error('Python invocation retired'));\n void (async () => {\n signal.removeEventListener('abort', aborted);\n const subscription = Promise.resolve().then(() => unsubscribe?.());\n const termination = Promise.resolve().then(() => executor ? executor.terminate() : endpoint?.terminate());\n const results = await Promise.allSettled([subscription, termination, service.close(), stdoutOperation?.close(), stderrOperation?.close(), ...pending]);\n await input.return?.(undefined);\n fragment = undefined;\n if (packages) environment.finish(packages);\n for (const result of results) if (result.status === 'rejected') throw result.reason;\n })().then(() => {\n if (admitted) { activeWorkers--; admitted = false; }\n finish();\n }, reason => {\n // A failed termination cannot establish retirement: retain its capacity slot.\n fail(reportPythonFailure('cleanup', reason, options.onDiagnostic));\n });\n return closing;\n };\n const aborted = (): void => { rejectRun?.(signal.reason); };\n context.registerCleanup?.(close);\n let primary: { reason: unknown } | undefined;\n let ready = false;\n const filesystemDiagnostics = new Set<PythonFailureCategory>();\n let result = 1;\n try {\n signal.throwIfAborted();\n activeWorkers++;\n admitted = true;\n const outputContext = { signal, ...(context.registerCleanup ? { registerCleanup: context.registerCleanup } : {}) };\n stdoutOperation = createOutputOperation(outputContext, context.stdout);\n stderrOperation = createOutputOperation(outputContext, context.stderr);\n const diagnoseFilesystemFailure = async (operation: string, error: unknown): Promise<void> => {\n if (typeof error !== 'object' || error === null || !('code' in error) || error.code !== 'ENOTSUP') return;\n const category: PythonFailureCategory = operation === 'open' ? 'filesystem-open'\n : operation === 'read' ? 'filesystem-read'\n : operation === 'write' || operation === 'ftruncate' ? 'filesystem-write'\n : operation === 'readdir' ? 'filesystem-directory' : 'filesystem-operation';\n if (!filesystemDiagnostics.has(category)) {\n filesystemDiagnostics.add(category);\n const failure = reportPythonFailure(category, error, options.onDiagnostic);\n await writeBytes(stderrOperation!.output, new TextEncoder().encode('python: ' + failure.message + '\\n'), signal);\n }\n };\n const dispatch = async (request: { op: string; args: unknown[] }): Promise<unknown> => {\n signal.throwIfAborted();\n if (request.op.startsWith('package-')) return environment.dispatch(request.op, request.args, {fs:context.fs, cwd:context.cwd, signal});\n if (request.op === 'stdin') {\n const length = request.args[0];\n if (!Number.isSafeInteger(length) || (length as number) < 1 || (length as number) > maxTransferBytes) throw new RangeError('Invalid Python input request');\n let pulls = 0;\n while (!fragment || offset === fragment.length) {\n if (++pulls % 128 === 0) await yieldTurn(signal);\n const next = await input.next();\n if (next.done) return [];\n inputBytes += next.value.length;\n context.inputBudget?.check(inputBytes);\n if (next.value.length > maxInputChunkBytes) throw new PythonInputChunkError('Python input chunk exceeds maxInputChunkBytes');\n // The retained fragment owns its bytes before producer advancement/finalization.\n fragment = Uint8Array.from(next.value);\n offset = 0;\n }\n const end = Math.min(fragment.length, offset + (length as number));\n const bytes = Array.from(fragment.subarray(offset, end));\n offset = end;\n return bytes;\n }\n if (request.op === 'stdout' || request.op === 'stderr') {\n const bytes = request.args[0];\n if (!Array.isArray(bytes) || bytes.length > maxTransferBytes || bytes.some(value => !Number.isInteger(value) || value < 0 || value > 255)) throw new TypeError('Invalid Python output bytes');\n const operation = request.op === 'stdout' ? stdoutOperation! : stderrOperation!;\n await writeBytes(operation.output, Uint8Array.from(bytes), signal);\n return bytes.length;\n }\n const value = await service.dispatch(request);\n return request.op === 'stat' || request.op === 'lstat' || request.op === 'fstat'\n ? metadata.translate(value as FileStat) : value;\n };\n options.onProgress?.({ phase: 'initializing', command: context.command });\n const preparation = environment.prepare({ fs: context.fs, cwd: context.cwd, signal,\n requirements: [...(options.packages ?? []), ...(options.packageProfile ? pythonDocumentPackages : []), ...(installation?.packages ?? [])],\n requirementFiles: [...(options.requirements ?? []), ...(installation?.requirements ?? [])],\n }).then(value => { packages = value; });\n pending.add(preparation);\n try { await preparation; } finally { pending.delete(preparation); }\n signal.throwIfAborted();\n if (options.createExecutor) {\n try { executor = options.createExecutor(); }\n catch (reason) { throw reportPythonFailure(reason instanceof PythonFailure ? reason.category : 'startup', reason, options.onDiagnostic); }\n if (!executor || typeof executor.run !== 'function' || typeof executor.terminate !== 'function') throw reportPythonFailure('executor-unavailable', undefined, options.onDiagnostic);\n let requesting = false;\n let running = true;\n const start: PythonExecutorStart = {\n invocation: { command: context.command, args: [...context.args], cwd: context.cwd, env: { ...context.env } },\n runtimeMount, maxTransferBytes, signal, ...(packages ? { packages } : {}), installOnly: !!installation,\n onReady() {\n if (closed || !running || signal.aborted || ready) return;\n ready = true;\n try { options.onProgress?.({ phase: 'ready', command: context.command }); }\n catch (reason) { running = false; rejectRun?.(reason); throw reason; }\n },\n async dispatch(request) {\n signal.throwIfAborted();\n if (closed || !running || requesting || !request || typeof request.op !== 'string' || !Array.isArray(request.args)) throw reportPythonFailure('transport-unavailable', undefined, options.onDiagnostic);\n requesting = true;\n const operation = Promise.resolve().then(() => dispatch(request)).catch(async error => {\n signal.throwIfAborted();\n if (error instanceof PythonInputChunkError) rejectRun?.(error);\n if (request.op.startsWith('package-')) throw Object.assign(reportPythonFailure('runtime-assets', error, options.onDiagnostic), { code: 'EPACKAGE' });\n await diagnoseFilesystemFailure(request.op, error);\n throw error;\n });\n const tracked = operation.then(() => {}, () => {});\n pending.add(tracked);\n try { return await operation; }\n finally { requesting = false; pending.delete(tracked); }\n },\n };\n const execution = Promise.resolve().then(() => {\n signal.throwIfAborted();\n return executor!.run(start);\n }).catch(reason => {\n running = false;\n if (signal.aborted) throw signal.reason;\n throw reportPythonFailure(reason instanceof PythonFailure ? reason.category : ready ? 'runtime' : 'startup', reason, options.onDiagnostic);\n }).then(status => {\n running = false;\n if (requesting) throw reportPythonFailure('transport-unavailable', undefined, options.onDiagnostic);\n try { return validateExitCode(status); }\n catch (reason) { throw reportPythonFailure('transport-unavailable', reason, options.onDiagnostic); }\n });\n const tracked = execution.then(() => {}, () => {});\n pending.add(tracked);\n void tracked.then(() => pending.delete(tracked));\n result = await new Promise<number>((resolve, reject) => {\n rejectRun = reject;\n signal.addEventListener('abort', aborted, { once: true });\n if (signal.aborted) aborted();\n execution.then(resolve, reject);\n });\n } else {\n let shared: SharedArrayBuffer;\n try { shared = new SharedArrayBuffer(8 + maxTransferBytes * 6 + 65536); }\n catch (reason) { throw reportPythonFailure('transport-unavailable', reason, options.onDiagnostic); }\n const control = new Int32Array(shared, 0, 2);\n const payload = new Uint8Array(shared, 8);\n const reply = (value: unknown, status: number): void => {\n if (closed) return;\n let bytes: Uint8Array;\n try { bytes = encodePythonReply(value, payload.length); }\n catch (error) {\n if (typeof error !== 'object' || error === null || !('code' in error) || error.code !== 'EFBIG') throw error;\n bytes = encodePythonReply({ code: 'EFBIG' }, payload.length); status = 2;\n }\n payload.set(bytes);\n try {\n Atomics.store(control, 1, bytes.length);\n Atomics.store(control, 0, status);\n Atomics.notify(control, 0);\n } catch (reason) { throw reportPythonFailure('transport-unavailable', reason, options.onDiagnostic); }\n };\n try { endpoint = options.createWorker!(); }\n catch (reason) { throw reportPythonFailure(reason instanceof PythonFailure ? reason.category : 'startup', reason, options.onDiagnostic); }\n signal.throwIfAborted();\n result = await new Promise<number>((resolve, reject) => {\n let settled = false;\n const fail = (reason: unknown): void => { settled = true; reject(reason); };\n rejectRun = fail;\n signal.addEventListener('abort', aborted, { once: true });\n const transportFailure = (reason: unknown): void => { fail(reportPythonFailure('transport-unavailable', reason, options.onDiagnostic)); };\n try { unsubscribe = endpoint!.subscribe(value => {\n if (closed || settled) return;\n if (typeof value !== 'object' || value === null) { transportFailure(new TypeError('Invalid Python worker message')); return; }\n const message = value as Record<string, unknown>;\n if (message.type === 'ready') {\n ready = true;\n try { options.onProgress?.({ phase: 'ready', command: context.command }); }\n catch (error) { fail(error); }\n return;\n }\n if (message.type === 'exit') {\n if (pending.size) { transportFailure(new TypeError('Python worker exited with an outstanding request')); return; }\n try {\n const status = validateExitCode(message.exitCode as number);\n settled = true;\n resolve(status);\n } catch (error) { transportFailure(error); }\n return;\n }\n if (message.type === 'error') {\n fail(reportPythonFailure(isPythonFailureCategory(message.category) ? message.category : ready ? 'runtime' : 'startup', message.message, options.onDiagnostic));\n return;\n }\n if (typeof message.op !== 'string' || !Array.isArray(message.args) || pending.size) { transportFailure(new TypeError('Invalid concurrent Python worker request')); return; }\n const work = dispatch({ op: message.op, args: message.args }).then(\n value => { pending.delete(work); reply(value, 1); },\n async error => {\n if (signal.aborted) { pending.delete(work); fail(signal.reason); return; }\n if (typeof message.op === 'string' && message.op.startsWith('package-')) {\n const failure = reportPythonFailure('runtime-assets', error, options.onDiagnostic);\n pending.delete(work);\n reply({code:'EPACKAGE', message:failure.message}, 2);\n return;\n }\n if (typeof error !== 'object' || error === null || !('code' in error) || typeof error.code !== 'string') { pending.delete(work); fail(error); return; }\n await diagnoseFilesystemFailure(message.op as string, error);\n pending.delete(work);\n reply({ code: error.code }, 2);\n },\n );\n pending.add(work);\n void work.catch(reason => { pending.delete(work); fail(reason); });\n }, transportFailure); }\n catch (reason) { transportFailure(reason); }\n if (settled) return;\n const start: PythonWorkerStart = { type: 'start', shared, invocation: { command: context.command, args: [...context.args], cwd: context.cwd, env: { ...context.env } }, runtimeMount, maxTransferBytes, ...(packages ? {packages} : {}), installOnly: !!installation };\n signal.throwIfAborted();\n try { endpoint!.postMessage(start); }\n catch (reason) { transportFailure(reason); }\n });\n }\n } catch (reason) {\n if (!signal.aborted && reason instanceof PythonInputChunkError) {\n try { await writeBytes(stderrOperation!.output, new TextEncoder().encode('python: ' + reason.message + '\\n'), signal); }\n catch (error) { primary = {reason:error}; }\n } else if (!signal.aborted && typeof reason === 'object' && reason !== null && 'code' in reason && reason.code === 'EPACKAGE') {\n primary = { reason: reportPythonFailure('runtime-assets', reason, options.onDiagnostic) };\n } else primary = { reason };\n }\n try { await close(); } catch (reason) {\n primary ??= { reason };\n }\n try { options.onProgress?.({ phase: 'finished', command: context.command }); }\n catch (reason) { primary ??= { reason }; }\n context.signal.throwIfAborted();\n if (primary) {\n if (!(primary.reason instanceof PythonFailure)) throw primary.reason;\n const failure = primary.reason;\n await writeBytes(context.stderr, new TextEncoder().encode('python: ' + failure.message + '\\n'), context.signal);\n return { exitCode: 1 };\n }\n return { exitCode: result };\n };\n return ['python', 'python3'].map(name => ({ name, description: 'Python with an explicit interpreter executor and canonical filesystem', execute }));\n}\n\nexport function pythonCommands(options: PythonCommandsOptions): VirtualShellPlugin {\n if (!options || (typeof options.createWorker === 'function') === (typeof options.createExecutor === 'function')) throw new PythonFailure('executor-unavailable');\n if (options?.environment && options.provisioning) throw new TypeError('A borrowed Python environment cannot be combined with provisioning options');\n const { provisioning, ...configuration } = options;\n const environment = options.environment ?? createPythonPackageEnvironment(provisioning);\n const commands = createPythonCommands({ ...configuration, environment });\n return { name: 'python-commands', ...(options.environment ? {} : { dispose: environment.dispose }), setup(host) {\n if (!options.replace) for (const command of commands) if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);\n for (const command of commands) host.commands.register(command, { replace: options.replace ?? false });\n } };\n}\n\nexport { createPythonPackageEnvironment, pythonDocumentPackages } from './provisioning.js';\nexport type { PythonPackageOptions, PythonPackageCache, PythonPackageProgress, PythonPackageStart, PythonPackageContext, PythonPackageEnvironment, PythonPackagePrepareContext } from './provisioning.js';\nexport { PythonPackageConflictError, createPythonPackageManifestStore } from './manifest.js';\nexport type { PythonPackageManifest, PythonPackageManifestStore } from './manifest.js';\nexport { createPythonPackageCache } from './cache.js';\nexport { createPythonExecutorPool } from './executor-pool.js';\nexport type { PythonExecutorPool, PythonExecutorPoolOptions } from './executor-pool.js';\nexport { PythonFailure, inspectPythonCapabilities } from './diagnostics.js';\nexport type { PythonFailureCategory, PythonDiagnostic, PythonDiagnosticObserver, PythonFileSystemRequirement, PythonCapabilityOptions, PythonCapabilityReport } from './diagnostics.js';\n", "import { FsError } from '../../contracts/errors.js';\n\n/** Own and admit a finite wire value before allocating its serialized payload. */\nexport function encodePythonReply(value: unknown, maxBytes: number): Uint8Array {\n let used = 0;\n const ancestors = new Set<object>();\n const reserve = (bytes: number): void => {\n used += bytes;\n if (used > maxBytes) throw new FsError('EFBIG', { syscall: 'python reply' });\n };\n const string = (text: string): string => {\n // Every UTF-16 code unit needs at least one output byte, even before quoting.\n if (text.length + 2 > maxBytes - used) throw new FsError('EFBIG', { syscall: 'python reply' });\n reserve(2);\n for (let index = 0; index < text.length; index++) {\n const code = text.charCodeAt(index);\n if (code < 32) reserve([8, 9, 10, 12, 13].includes(code) ? 2 : 6);\n else if (code === 34 || code === 92) reserve(2);\n else if (code < 128) reserve(1);\n else if (code < 2048) reserve(2);\n else if (code >= 0xd800 && code <= 0xdbff && text.charCodeAt(index + 1) >= 0xdc00 && text.charCodeAt(index + 1) <= 0xdfff) { reserve(4); index++; }\n else reserve(code >= 0xd800 && code <= 0xdfff ? 6 : 3);\n }\n return text;\n };\n const own = (input: unknown, depth: number): unknown => {\n if (depth > 64) throw new FsError('EFBIG', { syscall: 'python reply' });\n if (input === null || input === undefined) { reserve(4); return null; }\n if (typeof input === 'string') return string(input);\n if (typeof input === 'number') { reserve(Number.isFinite(input) ? String(input).length : 4); return input; }\n if (typeof input === 'boolean') { reserve(input ? 4 : 5); return input; }\n if (typeof input !== 'object') throw new TypeError('Invalid Python reply value');\n if (ancestors.has(input)) throw new TypeError('Cyclic Python reply value');\n ancestors.add(input);\n try {\n if (input instanceof Uint8Array || Array.isArray(input)) {\n // Each slot contributes at least one value byte and one separator.\n if (input.length > maxBytes - used) throw new FsError('EFBIG', { syscall: 'python reply' });\n reserve(2);\n const output: unknown[] = [];\n for (let index = 0; index < input.length; index++) {\n if (index) reserve(1);\n const descriptor = Object.getOwnPropertyDescriptor(input, String(index));\n if (descriptor && !('value' in descriptor)) throw new TypeError('Accessor Python reply');\n output.push(own(descriptor?.value, depth + 1));\n }\n return output;\n }\n reserve(2);\n const output: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n let count = 0;\n let visited = 0;\n for (const key in input) {\n if (!Object.hasOwn(input, key)) continue;\n if (++visited > maxBytes) throw new FsError('EFBIG', { syscall: 'python reply' });\n const descriptor = Object.getOwnPropertyDescriptor(input, key)!;\n if (!('value' in descriptor)) throw new TypeError('Accessor Python reply');\n if (descriptor.value === undefined || typeof descriptor.value === 'function') continue;\n if (count++) reserve(1);\n string(key); reserve(1);\n output[key] = own(descriptor.value, depth + 1);\n }\n return output;\n } finally { ancestors.delete(input); }\n };\n const owned = own(value, 0);\n return new TextEncoder().encode(JSON.stringify(owned));\n}\n", "import { PythonInvocationError } from './invocation.js';\n\nexport interface PythonInstallation {\n readonly packages: readonly string[];\n readonly requirements: readonly string[];\n readonly help: boolean;\n}\n\nexport const pythonInstallationHelp = `Usage: python -m pip install [-r FILE | --requirement FILE] PACKAGE ...\nInstalls compatible wheels and dependencies using the configured Pyodide installer.\nPACKAGE is a package requirement or a canonical filesystem wheel path.\nSupported options: -r, --requirement, -h, --help, --.\nAll other pip options and commands are unsupported, including --upgrade,\n--force-reinstall, --no-index, --no-deps, --target, --user, --prefix, --root, --editable,\n--index-url, --extra-index-url, --find-links, --trusted-host, --require-hashes,\n--constraint, --dry-run, --quiet, --verbose and cache/build/configuration flags.\nConfigure transport and integrity through the Python package SDK configuration.\n`;\n\n/** Recognize only the actual -m pip entrypoint, never application arguments. */\nexport function parsePythonInstallation(args: readonly string[]): PythonInstallation | undefined {\n let pipArgs: readonly string[] | undefined;\n scan: for (let index = 0; index < args.length; index++) {\n const option = args[index]!;\n if (option === '--' || option === '-' || !option.startsWith('-') || option.startsWith('--')) return undefined;\n for (let offset = 1; offset < option.length; offset++) {\n const flag = option[offset]!;\n if ('h?V'.includes(flag)) return undefined;\n if ('cmWX'.includes(flag)) {\n const operand = option.slice(offset + 1) || args[++index];\n if (flag === 'c') return undefined;\n if (flag === 'm') {\n if (operand !== 'pip') return undefined;\n pipArgs = args.slice(index + 1);\n break scan;\n }\n break;\n }\n }\n }\n if (!pipArgs) return undefined;\n const packages: string[] = [];\n const requirements: string[] = [];\n if (pipArgs.length === 0) return { packages, requirements, help: true };\n if (pipArgs[0] === '--help' || pipArgs[0] === '-h') {\n if (pipArgs.length > 1) throw new PythonInvocationError('unsupported pip option or argument after help: ' + pipArgs[1]);\n return { packages, requirements, help: true };\n }\n if (pipArgs[0] !== 'install') throw new PythonInvocationError('unsupported pip command ' + pipArgs[0]);\n let operands = false;\n let help = false;\n for (let index = 1; index < pipArgs.length; index++) {\n const option = pipArgs[index]!;\n if (operands || !option.startsWith('-')) { packages.push(option); continue; }\n if (option === '--') { operands = true; continue; }\n if (option === '--help' || option === '-h') { help = true; continue; }\n if (option === '-r' || option === '--requirement' || option.startsWith('--requirement=') || option.startsWith('-r')) {\n const path = option.startsWith('--requirement=') ? option.slice('--requirement='.length)\n : option !== '-r' && option.startsWith('-r') ? option.slice(2) : pipArgs[++index];\n if (!path || path.startsWith('-')) throw new PythonInvocationError(option + ' requires a path');\n requirements.push(path);\n continue;\n }\n throw new PythonInvocationError('unsupported pip option ' + option);\n }\n if (!help && packages.length === 0 && requirements.length === 0) throw new PythonInvocationError('pip install requires at least one package or requirements file');\n return { packages, requirements, help };\n}\n", "import { sha256 } from '@noble/hashes/sha2.js';\nimport type { FileSystem } from '../../contracts/filesystem.js';\nimport { resolvePath as resolve, dirname } from '../../contracts/path.js';\nimport type { HttpTransport, NetworkAuthorizer } from '../network/types.js';\nimport { inheritYieldCheckpoint } from '../../contracts/yield.js';\nimport { PythonPackageConflictError, type PythonPackageManifest, type PythonPackageManifestStore } from './manifest.js';\nimport { createPythonPackageCache, pythonPackageRuntimeKey as runtimeKey, type PythonPackageCache } from './cache.js';\n\nexport type { PythonPackageCache } from './cache.js';\nexport interface PythonPackageProgress {\n readonly phase: 'download' | 'cached' | 'installed';\n readonly url?: string;\n readonly bytes?: number;\n readonly totalBytes?: number;\n}\nexport interface PythonPackageOptions {\n readonly requirements?: readonly string[];\n readonly requirementFiles?: readonly string[];\n readonly profile?: 'documents';\n readonly offline?: boolean;\n readonly transport?: HttpTransport;\n readonly authorize?: NetworkAuthorizer;\n readonly cache?: PythonPackageCache;\n readonly manifestStore?: PythonPackageManifestStore;\n readonly scope?: string;\n /** Canonical filesystem directory, scoped to this package environment. */\n readonly cacheDirectory?: string;\n readonly maxDownloadBytes?: number;\n /** Byte budget for the built-in memory cache; external cache retention belongs to its owner. */\n readonly maxCacheBytes?: number;\n readonly onProgress?: (event: PythonPackageProgress) => void;\n}\nexport interface PythonPackageStart { readonly session: string; readonly requirements: readonly string[]; readonly offline: boolean }\nexport interface PythonPackageContext { readonly fs: FileSystem; readonly cwd: string; readonly signal: AbortSignal }\nexport interface PythonPackagePrepareContext extends PythonPackageContext {\n readonly requirements?: readonly string[];\n readonly requirementFiles?: readonly string[];\n readonly offline?: boolean;\n}\nexport interface PythonPackageEnvironment {\n prepare(context: PythonPackagePrepareContext): Promise<PythonPackageStart>;\n dispatch(operation: string, args: unknown[], context: PythonPackageContext): Promise<unknown>;\n finish(start: PythonPackageStart): void;\n dispose(): Promise<void>;\n}\nexport const pythonDocumentPackages: readonly string[] = Object.freeze([\n 'lxml==6.0.2','pillow==12.2.0','python-docx==1.2.0','openpyxl==3.1.5','XlsxWriter==3.2.9',\n 'pypdf==6.18.1','fpdf2==2.8.8','fonttools==4.65.0','defusedxml==0.7.1','et-xmlfile==2.0.0','typing-extensions==4.16.0',\n]);\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\nfunction digest(value: Uint8Array): string { return Array.from(sha256(value),byte=>byte.toString(16).padStart(2,'0')).join(''); }\nfunction failure(message: string, cause?: unknown): Error & {code:string} { return Object.assign(new Error(message,{cause}),{code:'EPACKAGE'}); }\nfunction missing(error: unknown): boolean { return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT'; }\nfunction normalizeRequirement(value: string, cwd: string): string {\n const requirement = value.trim();\n if (!requirement || requirement.startsWith('-')) throw failure(`Unsupported requirement: ${value}`);\n if (requirement.endsWith('.whl') && !requirement.includes('://')) return 'file://' + resolve(cwd,requirement).split('/').map(encodeURIComponent).join('/');\n return requirement;\n}\ninterface Session extends PythonPackageContext {\n readonly cache: PythonPackageCache;\n readonly offline: boolean;\n readonly requirements: readonly string[];\n readonly opened: Map<string, Uint8Array>;\n opening: boolean;\n closed: boolean;\n readonly manifest: string;\n readonly manifestCache: PythonPackageCache;\n readonly manifestRevision: string | undefined;\n readonly controller: AbortController;\n readonly aborted: () => void;\n}\n\nfunction checkSession(session: Session): void {\n session.signal.throwIfAborted();\n if(session.closed)throw failure('Python package session is closed');\n}\n\n/** Trusted host cache; content is rehashed on every read. No runtime or network work at construction. */\nexport function createPythonPackageEnvironment(options: PythonPackageOptions = {}): PythonPackageEnvironment {\n if (options.cache && options.cacheDirectory) throw new TypeError('Choose package cache or cacheDirectory, not both');\n if (options.manifestStore && (typeof options.scope !== 'string' || !options.scope.trim() || options.scope.length > 1024)) throw new TypeError('Shared Python manifests require an explicit nonempty scope');\n if (options.scope !== undefined && !options.manifestStore) throw new TypeError('Python scope requires a manifestStore');\n const manifestKey = options.manifestStore ? runtimeKey+'-environment-'+digest(encoder.encode(JSON.stringify(options.scope))) : runtimeKey+'-environment';\n if (options.profile !== undefined && options.profile !== 'documents') throw new TypeError('Unknown Python package profile');\n const maxBytes = options.maxDownloadBytes ?? 64 * 1024 * 1024;\n if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) throw new RangeError('maxDownloadBytes must be a positive integer');\n const maxCacheBytes = options.maxCacheBytes ?? 128 * 1024 * 1024;\n if (!Number.isSafeInteger(maxCacheBytes) || maxCacheBytes < 1) throw new RangeError('maxCacheBytes must be a positive integer');\n const defaultCache = createPythonPackageCache({maxBytes:maxCacheBytes});\n const sessions = new Map<string,Session>();\n const controller = new AbortController();\n const pending = new Set<Promise<unknown>>();\n let disposed = false;\n let disposing: Promise<void> | undefined;\n const admit = <Args extends unknown[], Result>(operation: (...args: Args) => Promise<Result>) => (...args: Args): Promise<Result> => {\n if(disposed)return Promise.reject(failure('Python package environment is disposed'));\n const work=Promise.resolve().then(()=>{if(disposed)throw failure('Python package environment is disposed');return operation(...args);});\n pending.add(work);\n void work.then(()=>{pending.delete(work);},()=>{pending.delete(work);});\n return work;\n };\n let counter = 0;\n let committing = Promise.resolve();\n async function prepare(input: PythonPackagePrepareContext): Promise<PythonPackageStart> {\n const invocation = new AbortController();\n const signal = AbortSignal.any([input.signal, controller.signal, invocation.signal]);\n inheritYieldCheckpoint(input.signal, signal);\n const context = { ...input, signal };\n context.signal.throwIfAborted();\n const directory = options.cacheDirectory === undefined ? undefined : resolve(context.cwd,options.cacheDirectory,runtimeKey);\n const cache = options.cache ?? (directory === undefined ? defaultCache : {\n async get(key: string) { try { return await context.fs.readFile(resolve(directory,key),{signal:context.signal,maxBytes}); } catch(error) { if(missing(error))return undefined;throw error; } },\n async set(key: string,bytes:Uint8Array) { await context.fs.mkdir(directory,{recursive:true,signal:context.signal});await context.fs.writeFile(resolve(directory,key),bytes,{signal:context.signal}); },\n });\n const manifestCache = options.cacheDirectory === undefined ? defaultCache : cache;\n let snapshot: PythonPackageManifest | undefined;\n if(options.manifestStore) {\n try { snapshot=await options.manifestStore.get(manifestKey,context); }\n catch(error) { context.signal.throwIfAborted();throw failure('Cannot read Python package environment manifest',error); }\n }\n context.signal.throwIfAborted();\n if(snapshot!==undefined && (typeof snapshot!=='object' || snapshot===null || typeof snapshot.revision!=='string' || !snapshot.revision || snapshot.revision.length>1024 || !(snapshot.bytes instanceof Uint8Array))) throw failure('Invalid Python package manifest snapshot');\n const manifestRevision = snapshot?.revision;\n const stored = options.manifestStore ? snapshot?.bytes : await manifestCache.get(manifestKey);\n context.signal.throwIfAborted();\n if(stored && stored.length>maxBytes)throw failure('Python package manifest exceeds maxDownloadBytes');\n const manifest = stored === undefined ? '' : decoder.decode(stored);\n let previous: unknown;\n try { previous = stored === undefined ? [] : JSON.parse(manifest); } catch { throw failure('Invalid Python package environment manifest'); }\n if (!Array.isArray(previous) || previous.some(value=>typeof value!=='string')) throw failure('Invalid Python package environment manifest');\n const requirements = [...previous as string[],...(options.profile === 'documents' ? pythonDocumentPackages:[]),...(options.requirements??[]),...(context.requirements??[])].map(value=>normalizeRequirement(value,context.cwd));\n for (const file of [...options.requirementFiles??[],...context.requirementFiles??[]]) {\n const path = resolve(context.cwd,file);\n let source: string;\n try { source = decoder.decode(await context.fs.readFile(path,{signal:context.signal,maxBytes:1024*1024})); } catch(error) { context.signal.throwIfAborted();throw failure(`Cannot read Python requirements ${path}: ${error instanceof Error ? error.message : String(error)}`); }\n for (const line of source.split('\\n')) {\n // Only whitespace-delimited hashes begin comments; URL integrity fragments survive.\n const comment=line.split('').findIndex((character,index)=>character==='#' && (index===0 || line[index-1]!.trim()===''));\n const text=(comment<0?line:line.slice(0,comment)).trim(); if (!text)continue;\n if (text.endsWith('\\\\') || text.startsWith('-')) throw failure(`Unsupported requirements option or continuation in ${path}: ${text}`);\n requirements.push(normalizeRequirement(text,dirname(path)));\n }\n }\n context.signal.throwIfAborted();\n const session=String(++counter);\n const unique=[...new Set(requirements)];\n const aborted=()=>{const current=sessions.get(session);if(current){current.closed=true;current.opened.clear();}sessions.delete(session);};\n sessions.set(session,{...context,cache,manifestCache,manifestRevision,controller:invocation,offline:context.offline??options.offline??false,requirements:unique,opened:new Map(),opening:false,closed:false,manifest,aborted});\n context.signal.addEventListener('abort',aborted,{once:true});\n return {session,requirements:unique,offline:context.offline??options.offline??false};\n }\n async function dispatch(op:string,args:unknown[],_context:PythonPackageContext):Promise<unknown> {\n _context.signal.throwIfAborted();\n const session=sessions.get(String(args[0]));\n if(!session)throw failure('Python package session is closed');\n checkSession(session);\n if(op==='package-commit') {\n const pinned=args[1];\n if(!Array.isArray(pinned)||pinned.some(value=>typeof value!=='string'))throw failure('Invalid installed package manifest');\n // Pins supplement the original sources (including canonical local wheels).\n const merged=[...new Set([...session.requirements,...pinned as string[]])];\n const manifestBytes=encoder.encode(JSON.stringify(merged));\n if(manifestBytes.length>maxBytes)throw failure('Python package manifest exceeds maxDownloadBytes');\n const commit = committing.then(async()=>{\n checkSession(session);\n if(options.manifestStore) {\n const committed=await options.manifestStore.compareAndSet(manifestKey,session.manifestRevision,manifestBytes,{signal:session.signal});\n checkSession(session);\n if(typeof committed!=='boolean')throw failure('Invalid Python package manifest publication result');\n if(!committed)throw new PythonPackageConflictError();\n } else {\n const current = await session.manifestCache.get(manifestKey);\n checkSession(session);\n if(current && current.length>maxBytes)throw failure('Python package manifest exceeds maxDownloadBytes');\n if ((current===undefined?'':decoder.decode(current))!==session.manifest) throw new PythonPackageConflictError();\n await session.manifestCache.set(manifestKey,manifestBytes);\n }\n checkSession(session);\n });\n committing=commit.catch(()=>{});\n await commit;\n options.onProgress?.({phase:'installed'});\n return null;\n }\n if(op==='package-read') {\n const bytes=session.opened.get(String(args[1]));const offset=args[2];const length=args[3];\n if(!bytes||!Number.isSafeInteger(offset)||!Number.isSafeInteger(length)||(offset as number)<0||(length as number)<1||(length as number)>65536)throw failure('Invalid package chunk request');\n return Array.from(bytes.subarray(offset as number,(offset as number)+(length as number)));\n }\n if(op==='package-close') {session.opened.delete(String(args[1]));return null;}\n if(op!=='package-open'||typeof args[1]!=='string')throw failure('Invalid package operation');\n if(session.opening)throw failure('Package download already in progress');\n session.opening=true;\n session.opened.clear();\n try {\n const url=args[1];const expected=args[2];\n if(expected!==undefined && expected!==null && (typeof expected!=='string'||expected.length!==64||Array.from(expected).some(c=>!'0123456789abcdef'.includes(c))))throw failure('Invalid SHA-256 package integrity value');\n const address=runtimeKey+'-url-'+digest(encoder.encode(url));\n const canonicalWheel=url.startsWith('file:')||url.startsWith('emfs:');\n const metadata=canonicalWheel?undefined:await session.cache.get(address);\n checkSession(session);\n let bytes:Uint8Array|undefined;let headers:readonly(readonly[string,string])[]=[];\n if(metadata){\n if(metadata.length>maxBytes)throw failure('Python package cache metadata exceeds maxDownloadBytes');\n let record: {digest:string,headers:readonly(readonly[string,string])[]};\n try { record=JSON.parse(decoder.decode(metadata)) as typeof record; } catch { throw failure(`Invalid package cache metadata: ${url}`); }\n if(typeof record!=='object'||record===null||typeof record.digest!=='string'||record.digest.length!==64||Array.from(record.digest).some(char=>!'0123456789abcdef'.includes(char))||!Array.isArray(record.headers)||record.headers.some(pair=>!Array.isArray(pair)||pair.length!==2||pair.some(value=>typeof value!=='string')))throw failure(`Invalid package cache metadata: ${url}`);\n bytes=await session.cache.get(runtimeKey+'-sha256-'+record.digest);headers=record.headers;\n checkSession(session);\n if(bytes && bytes.length>maxBytes)throw failure('Cached package exceeds maxDownloadBytes');\n // Cache implementations may lend mutable buffers; retain the bytes we authenticate.\n if(bytes)bytes=Uint8Array.from(bytes);\n if(bytes && digest(bytes)!==record.digest)throw failure(`Package cache integrity mismatch: ${url}`);\n if(bytes)options.onProgress?.({phase:'cached',url,bytes:bytes.length});\n }\n if(!bytes){\n if(canonicalWheel){\n const path = new URL(url);\n if(path.host && path.host!=='localhost')throw failure('Local wheels must use the canonical filesystem');\n try { bytes=await session.fs.readFile(decodeURIComponent(path.pathname),{signal:session.signal,maxBytes}); } catch(error) { checkSession(session);throw failure(`Cannot read canonical Python wheel ${path.pathname}: ${error instanceof Error ? error.message : String(error)}`); }\n }else{\n if(session.offline)throw failure(`Offline package cache miss: ${url}`);\n if(!options.transport||!options.authorize)throw failure('Python package download requires configured transport and authorization');\n let current=new URL(url);let redirectFrom:string|undefined;\n for(let redirect=0;;redirect++){\n if(current.protocol!=='https:'&&current.protocol!=='http:')throw failure(`Unsupported package transport protocol: ${current.protocol}`);\n if(current.username||current.password)throw failure('Package URLs with credentials are unsupported');\n let denyPrivate=false;\n const allowed=await options.authorize({url:current.href,method:'GET',attempt:0,signal:session.signal,...redirectFrom===undefined?{}:{redirectFrom},requirePrivateNetworkDeny(){denyPrivate=true;}});\n checkSession(session);\n if(!allowed)throw failure(`Python package download authorization denied: ${current.href}`);\n if(denyPrivate&&!options.transport.supportsPrivateNetworkDeny)throw failure('Package transport cannot enforce private network denial');\n checkSession(session);\n const response=await options.transport({url:current.href,method:'GET',headers:[['accept','application/vnd.pypi.simple.v1+json, application/json;q=0.9, */*;q=0.1']],signal:session.signal,...denyPrivate?{denyPrivateNetworks:true}:{}});\n try{\n checkSession(session);\n if([301,302,303,307,308].includes(response.status)){\n if(redirect>=5)throw failure('Too many package redirects');\n const location=response.headers.find(([key])=>key.toLowerCase()==='location')?.[1];if(!location)throw failure('Package redirect has no location');\n redirectFrom=current.href;current=new URL(location,current);continue;\n }\n if(response.status<200||response.status>=300)throw failure(`Package download failed: HTTP ${response.status} ${current.href}`);\n headers=response.headers;\n const encoding=headers.find(([key])=>key.toLowerCase()==='content-encoding')?.[1].trim().toLowerCase();\n const length=headers.find(([key])=>key.toLowerCase()==='content-length')?.[1];const total=length===undefined||(encoding!==undefined&&encoding!=='identity')?undefined:Number(length);\n if(total!==undefined&&Number.isFinite(total)&&total>maxBytes)throw failure('Package download exceeds maxDownloadBytes');\n const chunks:Uint8Array[]=[];let count=0;\n for await(const chunk of response.body){checkSession(session);if(chunk.length===0)continue;count+=chunk.length;if(count>maxBytes)throw failure('Package download exceeds maxDownloadBytes');chunks.push(Uint8Array.from(chunk));options.onProgress?.({phase:'download',url,bytes:count,...typeof total==='number'&&Number.isSafeInteger(total)?{totalBytes:total}:{}});}\n bytes=new Uint8Array(count);let offset=0;for(const chunk of chunks){bytes.set(chunk,offset);offset+=chunk.length;}\n break;\n }finally{await response.dispose();}\n }\n }\n checkSession(session);\n if(expected&&digest(bytes)!==expected)throw failure(`Package integrity mismatch: ${url}`);\n const hash=digest(bytes);\n const metadataBytes=encoder.encode(JSON.stringify({digest:hash,headers}));\n if(metadataBytes.length>maxBytes)throw failure('Python package cache metadata exceeds maxDownloadBytes');\n await session.cache.set(runtimeKey+'-sha256-'+hash,Uint8Array.from(bytes));\n checkSession(session);\n if(!canonicalWheel)await session.cache.set(address,metadataBytes);\n checkSession(session);\n }\n checkSession(session);\n if(expected&&digest(bytes)!==expected)throw failure(`Package integrity mismatch: ${url}`);\n const key=digest(bytes);session.opened.set(key,bytes);\n return {key,size:bytes.length,headers};\n } finally {session.opening=false;}\n }\n return {\n prepare:admit(prepare),dispatch:admit(dispatch),\n finish(start:PythonPackageStart){\n const session=sessions.get(start.session);\n if(session){session.closed=true;session.opened.clear();session.signal.removeEventListener('abort',session.aborted);session.controller.abort(failure('Python package session is closed'));}\n sessions.delete(start.session);\n },\n dispose(){\n if(!disposing){\n disposed=true;\n controller.abort(failure('Python package environment is disposed'));\n disposing=Promise.allSettled([...pending]).then(()=>{sessions.clear();defaultCache.dispose();});\n }\n return disposing;\n },\n };\n}\n", "/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out {@link https://www.rfc-editor.org/rfc/rfc4634 | RFC 4634} and\n * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf | FIPS 180-4}.\n * @module\n */\nimport { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from \"./_md.js\";\nimport * as u64 from \"./_u64.js\";\nimport { clean, createHasher, oidNist, rotr } from \"./utils.js\";\n/**\n * SHA-224 / SHA-256 round constants from RFC 6234 \u00A75.1: the first 32 bits\n * of the cube roots of the first 64 primes (2..311).\n */\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n/** Reusable SHA-224 / SHA-256 message schedule buffer `W_t` from RFC 6234 \u00A76.2 step 1. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\n/** Internal SHA-224 / SHA-256 compression engine from RFC 6234 \u00A76.2. */\nclass SHA2_32B extends HashMD {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n // Numeric initializers matter: starting the fields as `undefined` changes\n // V8's field representation and makes sha256 3x slower (measured).\n A = 0;\n B = 0;\n C = 0;\n D = 0;\n E = 0;\n F = 0;\n G = 0;\n H = 0;\n constructor(outputLen, IV) {\n super(64, outputLen, 8, false);\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n this.F = IV[5] | 0;\n this.G = IV[6] | 0;\n this.H = IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n _cloneInto(to) {\n (to ||= new this.constructor()).set(...this.get());\n return this._cloneIntoMeta(to);\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n clean(SHA256_W);\n }\n destroy() {\n // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves\n // update()/digest() callable on reused instances.\n this.destroyed = true;\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n/** Internal SHA-256 hash class grounded in RFC 6234 \u00A76.2. */\nexport class _SHA256 extends SHA2_32B {\n constructor() {\n super(32, SHA256_IV);\n }\n}\n/** Internal SHA-224 hash class grounded in RFC 6234 \u00A76.2 and \u00A78.5. */\nexport class _SHA224 extends SHA2_32B {\n constructor() {\n super(28, SHA224_IV);\n }\n}\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n// SHA-384 / SHA-512 round constants from RFC 6234 \u00A75.2:\n// 80 full 64-bit words split into high/low halves.\n// prettier-ignore\nconst K512 = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n// Reusable high-half schedule buffer for the RFC 6234 \u00A76.4 64-bit `W_t` words.\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\n// Reusable low-half schedule buffer for the RFC 6234 \u00A76.4 64-bit `W_t` words.\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\n/** Internal SHA-384 / SHA-512 compression engine from RFC 6234 \u00A76.4. */\nclass SHA2_64B extends HashMD {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n // h -- high 32 bits, l -- low 32 bits\n // Numeric initializers matter: starting the fields as `undefined` changes\n // V8's field representation and slows hashing down (measured on sha256).\n Ah = 0;\n Al = 0;\n Bh = 0;\n Bl = 0;\n Ch = 0;\n Cl = 0;\n Dh = 0;\n Dl = 0;\n Eh = 0;\n El = 0;\n Fh = 0;\n Fl = 0;\n Gh = 0;\n Gl = 0;\n Hh = 0;\n Hl = 0;\n constructor(outputLen, IV) {\n super(128, outputLen, 16, false);\n this.Ah = IV[0] | 0;\n this.Al = IV[1] | 0;\n this.Bh = IV[2] | 0;\n this.Bl = IV[3] | 0;\n this.Ch = IV[4] | 0;\n this.Cl = IV[5] | 0;\n this.Dh = IV[6] | 0;\n this.Dl = IV[7] | 0;\n this.Eh = IV[8] | 0;\n this.El = IV[9] | 0;\n this.Fh = IV[10] | 0;\n this.Fl = IV[11] | 0;\n this.Gh = IV[12] | 0;\n this.Gl = IV[13] | 0;\n this.Hh = IV[14] | 0;\n this.Hl = IV[15] | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n _cloneInto(to) {\n (to ||= new this.constructor()).set(...this.get());\n return this._cloneIntoMeta(to);\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA512_W[i] = s0 + s1 + SHA512_W[i - 7] + SHA512_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n clean(SHA512_W_H, SHA512_W_L);\n }\n destroy() {\n // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves\n // update()/digest() callable on reused instances.\n this.destroyed = true;\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\n/** Internal SHA-512 hash class grounded in RFC 6234 \u00A76.3 and \u00A76.4. */\nexport class _SHA512 extends SHA2_64B {\n constructor() {\n super(64, SHA512_IV);\n }\n}\n/** Internal SHA-384 hash class grounded in RFC 6234 \u00A76.3 and \u00A76.4. */\nexport class _SHA384 extends SHA2_64B {\n constructor() {\n super(48, SHA384_IV);\n }\n}\n/**\n * Truncated SHA512/256 and SHA512/224.\n * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as \"intermediary\" IV of SHA512/t.\n * Then t hashes string to produce result IV.\n * See the repo-side derivation recipe in `test/misc/sha2-gen-iv.js`.\n * These IV literals are checked against that script rather than a dedicated\n * local RFC section.\n */\n/** SHA-512/224 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and\n * stored as sixteen big-endian 32-bit halves. */\nconst T224_IV = /* @__PURE__ */ Uint32Array.from([\n 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,\n 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,\n]);\n/** SHA-512/256 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and\n * stored as sixteen big-endian 32-bit halves. */\nconst T256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,\n 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,\n]);\n/** Internal SHA-512/224 hash class using the derived `T224_IV` and the shared\n * RFC 6234 \u00A76.4 compression engine. */\nexport class _SHA512_224 extends SHA2_64B {\n constructor() {\n super(28, T224_IV);\n }\n}\n/** Internal SHA-512/256 hash class using the derived `T256_IV` and the shared\n * RFC 6234 \u00A76.4 compression engine. */\nexport class _SHA512_256 extends SHA2_64B {\n constructor() {\n super(32, T256_IV);\n }\n}\n/**\n * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:\n *\n * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.\n * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n * - Each sha256 hash is executing 2^18 bit operations.\n * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-256.\n * ```ts\n * sha256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(), \n/* @__PURE__ */ oidNist(0x01));\n/**\n * SHA2-224 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-224.\n * ```ts\n * sha224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha224 = /* @__PURE__ */ createHasher(() => new _SHA224(), \n/* @__PURE__ */ oidNist(0x04));\n/**\n * SHA2-512 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512.\n * ```ts\n * sha512(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512 = /* @__PURE__ */ createHasher(() => new _SHA512(), \n/* @__PURE__ */ oidNist(0x03));\n/**\n * SHA2-384 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-384.\n * ```ts\n * sha384(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha384 = /* @__PURE__ */ createHasher(() => new _SHA384(), \n/* @__PURE__ */ oidNist(0x02));\n/**\n * SHA2-512/256 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512/256.\n * ```ts\n * sha512_256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512_256 = /* @__PURE__ */ createHasher(() => new _SHA512_256(), \n/* @__PURE__ */ oidNist(0x06));\n/**\n * SHA2-512/224 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512/224.\n * ```ts\n * sha512_224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512_224 = /* @__PURE__ */ createHasher(() => new _SHA512_224(), \n/* @__PURE__ */ oidNist(0x05));\n", "/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { setU64FromNum } from \"./_u64.js\";\nimport { abytes, aexists, aoutput, createView } from \"./utils.js\";\n/**\n * Shared 32-bit conditional boolean primitive reused by SHA-256, SHA-1, and MD5 `F`.\n * Returns bits from `b` when `a` is set, otherwise from `c`.\n * The XOR form is equivalent to MD5's `F(X,Y,Z) = XY v not(X)Z` because the masked terms never\n * set the same bit.\n * @param a - selector word\n * @param b - word chosen when selector bit is set\n * @param c - word chosen when selector bit is clear\n * @returns Mixed 32-bit word.\n * @example\n * Combine three words with the shared 32-bit choice primitive.\n * ```ts\n * Chi(0xffffffff, 0x12345678, 0x87654321);\n * ```\n */\nexport function Chi(a, b, c) {\n return (a & b) ^ (~a & c);\n}\n/**\n * Shared 32-bit majority primitive reused by SHA-256 and SHA-1.\n * Returns bits shared by at least two inputs.\n * @param a - first input word\n * @param b - second input word\n * @param c - third input word\n * @returns Mixed 32-bit word.\n * @example\n * Combine three words with the shared 32-bit majority primitive.\n * ```ts\n * Maj(0xffffffff, 0x12345678, 0x87654321);\n * ```\n */\nexport function Maj(a, b, c) {\n return (a & b) ^ (a & c) ^ (b & c);\n}\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n * Accepts only byte-aligned `Uint8Array` input, even when the underlying spec describes bit\n * strings with partial-byte tails.\n * @param blockLen - internal block size in bytes\n * @param outputLen - digest size in bytes\n * @param padOffset - trailing length field size in bytes\n * @param isLE - whether length and state words are encoded in little-endian\n * @example\n * Use a concrete subclass to get the shared Merkle-Damgard update/digest flow.\n * ```ts\n * import { _SHA1 } from '@noble/hashes/legacy.js';\n * const hash = new _SHA1();\n * hash.update(new Uint8Array([97, 98, 99]));\n * hash.digest();\n * ```\n */\nexport class HashMD {\n blockLen;\n outputLen;\n canXOF = false;\n padOffset;\n isLE;\n // For partial updates less than block size\n buffer;\n view;\n finished = false;\n length = 0;\n pos = 0;\n destroyed = false;\n constructor(blockLen, outputLen, padOffset, isLE) {\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n aexists(this);\n abytes(data);\n const { view, buffer, blockLen } = this;\n const len = data.length;\n let processed = false;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path only when there is no buffered partial block: `take === blockLen` implies\n // `this.pos === 0`, so we can process full blocks directly from the input view.\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n processed = true;\n continue;\n }\n // When the whole input is buffered in one go (common for short messages), passing `data`\n // directly avoids allocating a subarray view.\n buffer.set(pos === 0 && take === len ? data : data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n processed = true;\n }\n }\n this.length += data.length;\n // Shared schedule buffers only pick up input-derived words inside process(); if everything\n // was buffered without processing, there is nothing to zero.\n if (processed)\n this.roundClean();\n return this;\n }\n digestInto(out) {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message, then zero-pad the rest of the block\n buffer[pos++] = 0b10000000;\n buffer.fill(0, pos);\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n buffer.fill(0);\n }\n // `padOffset` reserves the whole length field. For SHA-384/512 the high 64 bits stay zero from\n // the padding fill above, and JS will overflow before user input can make that half non-zero.\n // So we only need to write the low 64 bits here (`length * 8` only scales the exponent of an\n // integer below 2**53, so the split inside the helper stays exact).\n setU64FromNum(view, blockLen - 8, this.length * 8, isLE);\n this.process(view, 0);\n // The final block above is processed outside update(), so the shared message-schedule\n // buffers (e.g. SHA256_W) would otherwise retain input-derived words after digest().\n this.roundClean();\n // digest() passes our own `buffer` as `out`; reuse its cached view instead of allocating one.\n const oview = out === buffer ? view : createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT\n const outLen = len / 4;\n const state = this.get();\n // Subclass-misconfiguration invariant: outputLen must be 32-bit aligned and fit the state.\n if (len % 4 || outLen > state.length)\n throw new Error('invalid outputLen');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n // Copy before destroy(): subclasses wipe `buffer` during cleanup, but `digest()` must return\n // fresh bytes to the caller.\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneIntoMeta(to) {\n const { buffer, length, finished, destroyed, pos } = this;\n to.destroyed = destroyed;\n to.finished = finished;\n to.length = length;\n to.pos = pos;\n // Only partial-block bytes need copying: when `length % blockLen === 0`, `pos === 0` and\n // later `update()` / `digestInto()` overwrite `to.buffer` from the start before reading it.\n if (pos)\n to.buffer.set(buffer); // Avoid a hot modulo guard.\n return to;\n }\n clone() {\n return this._cloneInto();\n }\n}\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n/** Initial SHA256 state from RFC 6234 \u00A76.1: the first 32 bits of the fractional parts of the\n * square roots of the first eight prime numbers. Exported as a shared table; callers must treat\n * it as read-only because constructors copy words from it by index. */\nexport const SHA256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n/** Initial SHA224 state `H(0)` from RFC 6234 \u00A76.1. Exported as a shared table; callers must\n * treat it as read-only because constructors copy words from it by index. */\nexport const SHA224_IV = /* @__PURE__ */ Uint32Array.from([\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,\n]);\n/** Initial SHA384 state from RFC 6234 \u00A76.3: eight RFC 64-bit `H(0)` words stored as sixteen\n * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the ninth\n * through sixteenth prime numbers. Exported as a shared table; callers must treat it as read-only\n * because constructors copy halves from it by index. */\nexport const SHA384_IV = /* @__PURE__ */ Uint32Array.from([\n 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,\n]);\n/** Initial SHA512 state from RFC 6234 \u00A76.3: eight RFC 64-bit `H(0)` words stored as sixteen\n * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the first\n * eight prime numbers. Exported as a shared table; callers must treat it as read-only because\n * constructors copy halves from it by index. */\nexport const SHA512_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,\n]);\n", "const U32_MASK64 = /* @__PURE__ */ (() => BigInt(2 ** 32 - 1))();\nconst _32n = /* @__PURE__ */ BigInt(32);\n// Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high\n// }` to match little-endian word order rather than the property names.\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\n// Split bigint list into `[highWords, lowWords]` when `le=false`; with `le=true`, the first array\n// holds the low halves because `fromBig(...)` swaps the semantic meaning of `h` and `l`.\nfunction split(lst, le = false) {\n const len = lst.length;\n let Ah = new Uint32Array(len);\n let Al = new Uint32Array(len);\n for (let i = 0; i < len; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\n// Combine explicit `(high, low)` 32-bit halves into a bigint; `>>> 0` normalizes signed JS\n// bitwise results back to uint32 first, and little-endian callers must swap.\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// Split a JS number into u32 halves without a BigInt allocation. Exact only for integers\n// `0 <= n < 2**53`; callers use it on byte / bit counters, which JS length math caps far below\n// that (an ArrayBuffer cannot exceed 2**53 - 1 bytes).\nconst fromNumH = (n) => (n / 2 ** 32) | 0;\nconst fromNumL = (n) => n >>> 0;\n// Drop-in replacement for `view.setBigUint64(byteOffset, BigInt(n), isLE)` without the per-call\n// BigInt allocation. Same `n < 2**53` precondition as `fromNumH`/`fromNumL`.\nfunction setU64FromNum(view, byteOffset, n, isLE) {\n const h = fromNumH(n);\n const l = fromNumL(n);\n view.setUint32(byteOffset, isLE ? l : h, isLE);\n view.setUint32(byteOffset + 4, isLE ? h : l, isLE);\n}\n// High 32-bit half of a 64-bit logical right shift for `s` in `0..31`.\nconst shrSH = (h, _l, s) => h >>> s;\n// Low 32-bit half of a 64-bit logical right shift, valid for `s` in `1..31`.\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half.\nconst rotr32H = (_h, l) => l;\n// Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half.\nconst rotr32L = (h, _l) => h;\n// 64-bit left rotates (rotl*) are not defined here: sha3.ts, their only consumer, keeps\n// local copies so V8 inlines them into keccakP.\n// Add two split 64-bit words and return the split `{ h, l }` sum.\n// JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out\n// of the low sum and instead use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\n// Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`.\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\n// High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`.\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 4-way addition; pass the raw result into `add4H(...)`.\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\n// High-word finalize step for 4-way addition; `low` must be the untruncated output of `add4L(...)`.\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 5-way addition; pass the raw result into `add5H(...)`.\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\n// High-word finalize step for 5-way addition; `low` must be the untruncated output of `add5L(...)`.\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, fromNumH, fromNumL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, setU64FromNum, shrSH, shrSL, split, toBig };\n", "/**\n * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true.\n * @param a - value to test\n * @returns `true` when the value is a Uint8Array-compatible view.\n * @example\n * Check whether a value is a Uint8Array-compatible view.\n * ```ts\n * isBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function isBytes(a) {\n // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases.\n // The fallback still requires a real ArrayBuffer view, so plain\n // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and\n // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views.\n return (a instanceof Uint8Array ||\n (ArrayBuffer.isView(a) &&\n a.constructor.name === 'Uint8Array' &&\n 'BYTES_PER_ELEMENT' in a &&\n a.BYTES_PER_ELEMENT === 1));\n}\n// Shared error-message prefix builder. Only called on throw paths, so assert\n// success paths never pay for the string concatenation.\nconst atitle = (title) => (title ? `\"${title}\" ` : '');\n/**\n * Asserts something is a non-negative integer.\n * @param n - number to validate\n * @param title - label included in thrown errors\n * @returns The validated number.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a non-negative integer option.\n * ```ts\n * anumber(32, 'length');\n * ```\n */\nexport function anumber(n, title = '') {\n if (typeof n !== 'number')\n throw new TypeError(atitle(title) + 'expected number, got ' + typeof n);\n if (!Number.isSafeInteger(n) || n < 0)\n throw new RangeError(atitle(title) + 'expected integer >= 0, got ' + n);\n return n;\n}\n/**\n * Asserts something is a boolean.\n * @param value - value to validate\n * @param title - label included in thrown errors\n * @returns The validated boolean.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a boolean option.\n * ```ts\n * abool(true, 'enableXOF');\n * ```\n */\nexport function abool(value, title = '') {\n if (typeof value !== 'boolean')\n throw new TypeError(atitle(title) + 'expected boolean, got type=' + typeof value);\n return value;\n}\n/**\n * Asserts something is Uint8Array.\n * @param value - value to validate\n * @param length - optional exact length constraint\n * @param title - label included in thrown errors\n * @returns The validated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate that a value is a byte array.\n * ```ts\n * abytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function abytes(value, length, title = '') {\n // Success path first: this runs at the start of every update() / digestInto(), and the\n // common `abytes(data)` form must not pay for length handling it does not use.\n if (isBytes(value) && (length === undefined || value.length === length))\n return value;\n // Error path: recompute freely to build the exact message.\n if (length !== undefined)\n anumber(length, 'length');\n const bytes = isBytes(value);\n const ofLen = length !== undefined ? ` of length ${length}` : '';\n const got = bytes ? `length=${value.length}` : `type=${typeof value}`;\n const message = atitle(title) + 'expected Uint8Array' + ofLen + ', got ' + got;\n if (!bytes)\n throw new TypeError(message);\n throw new RangeError(message);\n}\n/**\n * Copies bytes into a fresh Uint8Array.\n * Buffer-style slices can alias the same backing store, so callers that need ownership should copy.\n * @param bytes - source bytes to clone\n * @returns Freshly allocated copy of `bytes`.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Clone a byte array before mutating it.\n * ```ts\n * const copy = copyBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function copyBytes(bytes) {\n // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict\n // because callers use it at byte-validation boundaries before mutating the detached copy.\n return Uint8Array.from(abytes(bytes));\n}\n/**\n * Asserts something is a wrapped hash constructor.\n * @param h - hash constructor to validate\n * @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError}\n * @throws On invalid hash metadata ranges or values. {@link RangeError}\n * @throws If the hash metadata allows empty outputs or block sizes. {@link Error}\n * @example\n * Validate a callable hash wrapper.\n * ```ts\n * import { ahash } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * ahash(sha256);\n * ```\n */\nexport function ahash(h) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new TypeError('expected hash wrapped by utils.createHasher');\n anumber(h.outputLen);\n anumber(h.blockLen);\n // HMAC and KDF callers treat these as real byte lengths; allowing zero lets fake wrappers pass\n // validation and can produce empty outputs instead of failing fast.\n if (h.outputLen < 1 || h.blockLen < 1)\n throw new Error('hash blockLen / outputLen must be >= 1');\n}\nconst aobject = (value, label) => {\n if (value === null || typeof value !== 'object' || Array.isArray(value))\n throw new TypeError((label === 'object' ? '' : `\"${label}\" `) + 'expected object, got type=' + typeof value);\n};\nconst aopts = (value, label) => {\n aobject(value, label);\n const proto = Object.getPrototypeOf(value);\n if (proto !== Object.prototype && proto !== null)\n throw new TypeError(`\"${label}\" expected plain object`);\n // Object.assign() treats an own \"__proto__\" source key as a write to the target's legacy\n // prototype setter. Reject it before merging so inherited option values cannot be injected.\n if (Object.hasOwn(value, '__proto__'))\n throw new TypeError(`\"${label}.__proto__\" is not allowed`);\n};\n/**\n * Asserts a hash instance has not been destroyed or finished.\n * @param instance - hash instance to validate\n * @param checkFinished - whether to reject finalized instances\n * @throws If the hash instance has already been destroyed or finalized. {@link Error}\n * @example\n * Validate that a hash instance is still usable.\n * ```ts\n * import { aexists } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aexists(hash);\n * ```\n */\nexport function aexists(instance, checkFinished = true) {\n // Runs on every update()/digestInto(); the flags are library-owned booleans, so only their\n // truthiness is checked - re-validating their type per call was pure hot-path overhead.\n if (instance.destroyed)\n throw new Error('hash was destroyed');\n if (checkFinished && instance.finished)\n throw new Error('digest() was already called');\n}\n/**\n * Asserts output is a sufficiently-sized byte array.\n * @param out - destination buffer\n * @param instance - hash instance providing output length\n * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a caller-provided digest buffer.\n * ```ts\n * import { aoutput } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aoutput(new Uint8Array(hash.outputLen), hash);\n * ```\n */\nexport function aoutput(out, instance) {\n abytes(out, undefined, 'output');\n // `outputLen` is a library-owned readonly number; the negated comparison keeps failing fast\n // when it is missing/NaN (comparisons with undefined/NaN are false) without an anumber() call.\n const min = instance.outputLen;\n if (!(out.length >= min)) {\n throw new RangeError('\"output\" expected length >= ' + min);\n }\n}\n/**\n * Casts a typed array view to Uint8Array.\n * @param arr - source typed array\n * @returns Uint8Array view over the same buffer.\n * @example\n * Reinterpret a typed array as bytes.\n * ```ts\n * u8(new Uint32Array([1, 2]));\n * ```\n */\nexport function u8(arr) {\n return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Casts a typed array view to Uint32Array.\n * `arr.byteOffset` must already be 4-byte aligned or the platform\n * Uint32Array constructor will throw.\n * @param arr - source typed array\n * @returns Uint32Array view over the same buffer.\n * @example\n * Reinterpret a byte array as 32-bit words.\n * ```ts\n * u32(new Uint8Array(8));\n * ```\n */\nexport function u32(arr) {\n return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/**\n * Zeroizes typed arrays in place. Warning: JS provides no guarantees.\n * @param arrays - arrays to overwrite with zeros\n * @example\n * Zeroize sensitive buffers in place.\n * ```ts\n * clean(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function clean(...arrays) {\n for (let i = 0; i < arrays.length; i++) {\n arrays[i].fill(0);\n }\n}\n/**\n * Creates a DataView for byte-level manipulation.\n * @param arr - source typed array\n * @returns DataView over the same buffer region.\n * @example\n * Create a DataView over an existing buffer.\n * ```ts\n * createView(new Uint8Array(4));\n * ```\n */\nexport function createView(arr) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Rotate-right operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the right.\n * ```ts\n * rotr(0x12345678, 8);\n * ```\n */\nexport function rotr(word, shift) {\n return (word << (32 - shift)) | (word >>> shift);\n}\n/**\n * Rotate-left operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the left.\n * ```ts\n * rotl(0x12345678, 8);\n * ```\n */\nexport function rotl(word, shift) {\n return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n/** Whether the current platform is little-endian. */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n/**\n * Byte-swap operation for uint32 values.\n * @param word - source word\n * @returns Word with reversed byte order.\n * @example\n * Reverse the byte order of a 32-bit word.\n * ```ts\n * byteSwap(0x11223344);\n * ```\n */\nexport function byteSwap(word) {\n return (((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff));\n}\n/**\n * Conditionally byte-swaps one 32-bit word on big-endian platforms.\n * @param n - source word\n * @returns Original or byte-swapped word depending on platform endianness.\n * @example\n * Normalize a 32-bit word for host endianness.\n * ```ts\n * swap8IfBE(0x11223344);\n * ```\n */\nexport const swap8IfBE = isLE\n ? (n) => n\n : (n) => byteSwap(n) >>> 0;\n/**\n * Byte-swaps every word of a Uint32Array in place.\n * @param arr - array to mutate\n * @returns The same array after mutation; callers pass live state arrays here.\n * @example\n * Reverse the byte order of every word in place.\n * ```ts\n * byteSwap32(new Uint32Array([0x11223344]));\n * ```\n */\nexport function byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n return arr;\n}\n/**\n * Conditionally byte-swaps a Uint32Array on big-endian platforms.\n * @param u - array to normalize for host endianness\n * @returns Original or byte-swapped array depending on platform endianness.\n * On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`.\n * @example\n * Normalize a word array for host endianness.\n * ```ts\n * swap32IfBE(new Uint32Array([0x11223344]));\n * ```\n */\nexport const swap32IfBE = isLE\n ? (u) => u\n : byteSwap32;\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string.\n * Uses the built-in function when available and assumes it matches the tested\n * fallback semantics.\n * @param bytes - bytes to encode\n * @returns Lowercase hexadecimal string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Convert bytes to lowercase hexadecimal.\n * ```ts\n * bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123'\n * ```\n */\nexport function bytesToHex(bytes) {\n abytes(bytes);\n // @ts-ignore\n if (hasHexBuiltin)\n return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// Strict ASCII nibble parser: non-ASCII hex lookalikes are rejected as undefined.\n// ASCII codes: '0'..'9' = 48..57, 'A'..'F' = 65..70, 'a'..'f' = 97..102.\n// prettier-ignore\nfunction asciiToBase16(ch) {\n return ch >= 48 && ch <= 57 ? ch - 48 // '2' => 50-48\n : ch >= 65 && ch <= 70 ? ch - (65 - 10) // 'B' => 66-(65-10)\n : ch >= 97 && ch <= 102 ? ch - (97 - 10) // 'b' => 98-(97-10)\n : undefined;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @param hex - hexadecimal string to decode\n * @returns Decoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Decode lowercase hexadecimal into bytes.\n * ```ts\n * hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n * ```\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new TypeError('hex string expected, got ' + typeof hex);\n if (hasHexBuiltin) {\n try {\n return Uint8Array.fromHex(hex);\n }\n catch (error) {\n if (error instanceof SyntaxError)\n throw new RangeError(error.message);\n throw error;\n }\n }\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new RangeError('hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi)); // parse first char, multiply it by 16\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); // parse second char\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new RangeError('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2; // example: 'A9' => 10*16 + 9\n }\n return array;\n}\n/**\n * Yields to the host task scheduler so timers, I/O, and rendering can make progress.\n * Uses the Web Scheduling API when available or `setTimeout` as a cross-platform fallback.\n * Host-task yields are much slower than microtasks (roughly 1ms with the timer fallback), so\n * async loops should use `asyncTick >= 10` to amortize scheduling overhead to about 10% while\n * still allowing other event-loop work to proceed.\n * @param onReject - optional cleanup invoked only if the host yield fails\n * @example\n * Yield to the next scheduler tick.\n * ```ts\n * await nextTick();\n * ```\n */\nexport function nextTick(onReject) {\n const host = globalThis;\n if (typeof host.scheduler?.yield === 'function') {\n const promise = host.scheduler.yield();\n // Keep the original scheduler rejection; this handler exists only for cleanup.\n if (onReject)\n promise.catch(onReject);\n return promise;\n }\n return new Promise((resolve) => host.setTimeout(resolve, 0));\n}\n/**\n * Returns control to the host event loop every `tick` milliseconds to avoid blocking long loops.\n * @param iters - number of loop iterations to run\n * @param tick - maximum time slice in milliseconds\n * @param cb - callback executed on each iteration\n * @param onReject - optional cleanup invoked only if a host yield fails\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Run a loop that periodically yields back to the event loop.\n * ```ts\n * await asyncLoop(2, 0, () => {});\n * ```\n */\nexport async function asyncLoop(iters, tick, cb, onReject) {\n anumber(iters, 'iters');\n anumber(tick, 'tick');\n if (typeof cb !== 'function')\n throw new TypeError('callback must be a function');\n // Callback is synchronous by contract; asyncLoop only yields between sync work windows.\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick(onReject);\n // Track only synchronous work time; scheduler delay after yielding is outside our budget.\n ts = Date.now();\n }\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * Built-in doesn't validate input to be string: we do the check.\n * Non-ASCII details are delegated to the platform `TextEncoder`.\n * @param str - string to encode\n * @returns UTF-8 encoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Encode a string as UTF-8 bytes.\n * ```ts\n * utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99])\n * ```\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new TypeError('string expected');\n const encoded = new TextEncoder().encode(str);\n try {\n // Copy into the current realm for Firefox extension contexts. Callers that own the returned\n // buffer can then wipe it independently of TextEncoder's temporary result.\n return new Uint8Array(encoded); // https://bugzil.la/1681809\n }\n finally {\n clean(encoded);\n }\n}\n/**\n * Helper for KDFs: consumes Uint8Array or string.\n * String inputs are UTF-8 encoded; byte-array inputs stay aliased to the caller buffer.\n * @param data - user-provided KDF input\n * @param errorTitle - label included in thrown errors\n * @returns Byte representation of the input.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Normalize KDF input to bytes.\n * ```ts\n * kdfInputToBytes('password');\n * ```\n */\nexport function kdfInputToBytes(data, errorTitle = '') {\n if (typeof data === 'string')\n return utf8ToBytes(data);\n return abytes(data, undefined, errorTitle);\n}\n/**\n * Copies several Uint8Arrays into one.\n * @param arrays - arrays to concatenate\n * @returns Concatenated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Concatenate multiple byte arrays.\n * ```ts\n * concatBytes(new Uint8Array([1]), new Uint8Array([2]));\n * ```\n */\nexport function concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n/**\n * Validates declared required and optional field types on a plain object.\n * This walks field schemas and formats detailed errors, so avoid it on hot paths; use direct\n * one-line guards such as `abytes()`, `abool()`, or `anumber()` instead.\n * @param object - object to validate\n * @param fields - map of required field names to expected types\n * @param optFields - map of optional field names to expected types\n * @param title - label included in thrown errors\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate required and optional option fields.\n * ```ts\n * validateObject({ N: 1024, dkLen: 32 }, { N: 'number' }, { dkLen: 'number' });\n * ```\n */\nexport const validateObject = (object, fields = {}, optFields = {}, title = 'object') => {\n aobject(object, title);\n aobject(fields, 'fields');\n aobject(optFields, 'optFields');\n function checkField(fieldName, expectedType, isOpt) {\n const label = title === 'object' ? `param \"${String(fieldName)}\"` : `\"${title}.${String(fieldName)}\"`;\n // Config fields must be explicit own properties. Optional inherited values are rejected too\n // because callers keep reading the same options object after validation.\n const val = object[fieldName];\n // Runtime objects such as Field instances intentionally satisfy required method slots\n // via their shared prototype.\n if (!Object.hasOwn(object, fieldName) &&\n (isOpt ? val !== undefined : expectedType !== 'function')) {\n throw new TypeError(`${label} is invalid: expected own property`);\n }\n if (isOpt && val === undefined)\n return;\n const current = typeof val;\n if (current !== expectedType || val === null)\n throw new TypeError(`${label} is invalid: expected ${expectedType}, got ${current}`);\n }\n const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt));\n iter(fields, false);\n iter(optFields, true);\n};\n/**\n * Merges default options and passed options.\n * @param defaults - base option object\n * @param opts - user overrides\n * @param title - label included in thrown override errors\n * @returns Fresh merged option object with a null prototype.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Merge user overrides onto default options.\n * ```ts\n * checkOpts({ dkLen: 32 }, { asyncTick: 10 });\n * ```\n */\nexport function checkOpts(defaults, opts, title = 'opts') {\n aopts(defaults, 'defaults');\n if (opts !== undefined)\n aopts(opts, title);\n // Callers read optional fields directly, so omitted values must not fall through to ambient\n // Object.prototype pollution (for example a forged `dkLen` changing SHAKE's default output).\n const merged = Object.assign(Object.create(null), defaults, opts);\n return merged;\n}\n/**\n * Creates a callable hash function from a stateful class constructor.\n * @param hashCons - hash constructor or factory\n * @param info - optional metadata such as DER OID\n * @returns Frozen callable hash wrapper with `.create()`.\n * Wrapper construction eagerly calls `hashCons(undefined)` once to read\n * `outputLen` / `blockLen`, so constructor side effects happen at module\n * init time.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Wrap a stateful hash constructor into a callable helper.\n * ```ts\n * import { createHasher } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const wrapped = createHasher(sha256.create, { oid: sha256.oid });\n * wrapped(new Uint8Array([1]));\n * ```\n */\nexport function createHasher(hashCons, info = {}) {\n if (typeof hashCons !== 'function')\n throw new TypeError('\"hashCons\" expected function, got type=' + typeof hashCons);\n info = checkOpts({}, info, 'info');\n const hashC = (msg, opts) => hashCons(opts)\n .update(msg)\n .digest();\n const tmp = hashCons(undefined);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.canXOF = tmp.canXOF;\n hashC.create = (opts) => hashCons(opts);\n Object.assign(hashC, info);\n return Object.freeze(hashC);\n}\n/**\n * Cryptographically secure PRNG backed by `crypto.getRandomValues`.\n * @param bytesLength - number of random bytes to generate\n * @returns Random bytes.\n * The platform `getRandomValues()` implementation still defines any\n * single-call length cap, and this helper rejects oversize requests\n * with a stable library `RangeError` instead of host-specific errors.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If the current runtime does not provide `crypto.getRandomValues`. {@link Error}\n * @example\n * Generate a fresh random key or nonce.\n * ```ts\n * const key = randomBytes(16);\n * ```\n */\nexport function randomBytes(bytesLength = 32) {\n // Match the repo's other length-taking helpers instead of relying on Uint8Array coercion.\n anumber(bytesLength, 'bytesLength');\n const cr = typeof globalThis === 'object' ? globalThis.crypto : null;\n if (typeof cr?.getRandomValues !== 'function')\n throw new Error('crypto.getRandomValues must be defined');\n // Web Cryptography API Level 2 \u00A710.1.1:\n // if `byteLength > 65536`, throw `QuotaExceededError`.\n // Keep the guard explicit so callers can see the quota in code\n // instead of discovering it by reading the spec or host errors.\n // This wrapper surfaces the same quota as a stable library RangeError.\n if (bytesLength > 65536)\n throw new RangeError(`\"bytesLength\" expected <= 65536, got ${bytesLength}`);\n return cr.getRandomValues(new Uint8Array(bytesLength));\n}\n/**\n * Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`.\n * @param suffix - final OID byte for the selected hash.\n * The helper accepts any byte even though only the documented NIST hash\n * suffixes are meaningful downstream.\n * @returns Object containing the DER-encoded OID.\n * @example\n * Build OID metadata for a NIST hash.\n * ```ts\n * oidNist(0x01);\n * ```\n */\nexport const oidNist = (suffix) => ({\n // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet.\n // Larger suffix values would need base-128 OID encoding and a different length byte.\n oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),\n});\n", "export interface PythonPackageManifest {\n readonly revision: string;\n readonly bytes: Uint8Array;\n}\n\nexport interface PythonPackageManifestStore {\n get(scope: string, options: { readonly signal: AbortSignal }): Promise<PythonPackageManifest | undefined>;\n compareAndSet(scope: string, revision: string | undefined, bytes: Uint8Array, options: { readonly signal: AbortSignal }): Promise<boolean>;\n}\n\nexport class PythonPackageConflictError extends Error {\n readonly code = 'EPACKAGECONFLICT';\n readonly retryable = true;\n constructor() {\n super('Python package environment changed during installation; retry the command');\n this.name = 'PythonPackageConflictError';\n }\n}\n\nexport function createPythonPackageManifestStore(options: { readonly maxBytes?: number } = {}): PythonPackageManifestStore & { dispose(): void } {\n const maxBytes = options.maxBytes ?? 1048576;\n if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) throw new RangeError('Python manifest maxBytes must be a positive integer');\n const manifests = new Map<string, PythonPackageManifest>();\n let retainedBytes = 0;\n let revision = 0;\n let disposed = false;\n const check = (scope: string, signal: AbortSignal): void => {\n signal.throwIfAborted();\n if (disposed) throw new Error('Python manifest store is disposed');\n if (typeof scope !== 'string' || !scope || scope.length > 1024) throw new TypeError('Invalid Python manifest scope');\n };\n return {\n async get(scope, { signal }) {\n check(scope, signal);\n const value = manifests.get(scope);\n return value ? { revision: value.revision, bytes: value.bytes.slice() } : undefined;\n },\n async compareAndSet(scope, expected, bytes, { signal }) {\n check(scope, signal);\n const current = manifests.get(scope);\n if (current?.revision !== expected) return false;\n if (!(bytes instanceof Uint8Array)) throw new TypeError('Python manifest must contain bytes');\n const nextBytes = retainedBytes - (current?.bytes.length ?? 0) + bytes.length;\n if (nextBytes > maxBytes || (!current && manifests.size >= 1024) || revision >= Number.MAX_SAFE_INTEGER) {\n throw new RangeError('Python manifest store budget exhausted');\n }\n manifests.set(scope, { revision: String(++revision), bytes: Uint8Array.from(bytes) });\n retainedBytes = nextBytes;\n return true;\n },\n dispose() { disposed = true; manifests.clear(); retainedBytes = 0; },\n };\n}\n", "export const pythonPackageRuntimeKey = 'pyodide-314.0.6-cp314-emscripten-wasm32-v1';\n\nexport interface PythonPackageCache {\n get(key: string): Promise<Uint8Array | undefined>;\n set(key: string, bytes: Uint8Array): Promise<void>;\n}\n\nexport function createPythonPackageCache(options: { readonly maxBytes?: number } = {}): PythonPackageCache & { dispose(): void } {\n const maxBytes = options.maxBytes ?? 128 * 1024 * 1024;\n if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) throw new RangeError('Python cache maxBytes must be a positive integer');\n const values = new Map<string, Uint8Array>();\n const manifestKey = pythonPackageRuntimeKey + '-environment';\n let retainedBytes = 0;\n let disposed = false;\n return {\n async get(key) {\n if (disposed) throw new Error('Python package cache is disposed');\n return values.get(key)?.slice();\n },\n async set(key, bytes) {\n if (disposed) throw new Error('Python package cache is disposed');\n if (key === manifestKey && bytes.length > maxBytes) throw new RangeError('Python package manifest exceeds maxCacheBytes');\n const previous = values.get(key);\n if (previous) { retainedBytes -= previous.length; values.delete(key); }\n if (bytes.length > maxBytes) return;\n while (values.size && (retainedBytes + bytes.length > maxBytes || values.size >= 1024)) {\n const oldest = [...values.keys()].find(entry => entry !== manifestKey);\n if (oldest === undefined) return;\n retainedBytes -= values.get(oldest)!.length;\n values.delete(oldest);\n }\n values.set(key, Uint8Array.from(bytes));\n retainedBytes += bytes.length;\n },\n dispose() { disposed = true; values.clear(); retainedBytes = 0; },\n };\n}\n", "import type { PythonAsyncExecutor, PythonExecutorStart } from './index.js';\nimport { PythonFailure } from './diagnostics.js';\n\nexport interface PythonExecutorPoolOptions {\n readonly createExecutor: () => PythonAsyncExecutor;\n readonly maxConcurrentExecutors: number;\n}\n\nexport interface PythonExecutorPool {\n createExecutor(): PythonAsyncExecutor;\n inspect(): { readonly active: number; readonly capacity: number; readonly closed: boolean };\n dispose(): Promise<void>;\n}\n\nexport function createPythonExecutorPool(options: PythonExecutorPoolOptions): PythonExecutorPool {\n if (typeof options?.createExecutor !== 'function') throw new TypeError('Python executor pool requires a factory');\n const factory = options.createExecutor;\n const capacity = options.maxConcurrentExecutors;\n if (!Number.isSafeInteger(capacity) || capacity < 1) throw new RangeError('Invalid Python executor pool capacity');\n const entries = new Set<{ retire(): Promise<void> }>();\n let closed = false;\n let disposal: Promise<void> | undefined;\n return {\n createExecutor() {\n if (closed) throw new PythonFailure('executor-unavailable');\n if (entries.size >= capacity) throw new PythonFailure('capacity');\n let acquired!: (executor: PythonAsyncExecutor | undefined) => void;\n const acquisition = new Promise<PythonAsyncExecutor | undefined>(resolve => { acquired = resolve; });\n let retirement: Promise<void> | undefined;\n let execution: Promise<void> | undefined;\n let started = false;\n const entry = {\n retire() {\n retirement ??= Promise.resolve().then(async () => {\n const executor = await acquisition;\n if (executor !== undefined) {\n const results = await Promise.allSettled([Promise.resolve().then(() => {\n const terminate = executor?.terminate;\n if (typeof terminate !== 'function') throw new PythonFailure('cleanup');\n return terminate.call(executor);\n }), execution]);\n const failed = results.find(result => result.status === 'rejected');\n if (failed?.status === 'rejected') throw failed.reason;\n }\n entries.delete(entry);\n });\n return retirement;\n },\n };\n entries.add(entry);\n let executor: PythonAsyncExecutor;\n try { executor = factory(); }\n catch (error) { acquired(undefined); entries.delete(entry); throw error; }\n acquired(executor);\n try {\n if (closed || !executor || typeof executor.run !== 'function' || typeof executor.terminate !== 'function') throw new PythonFailure('executor-unavailable');\n } catch (error) {\n void entry.retire().catch(() => {});\n throw error;\n }\n return {\n async run(start: PythonExecutorStart) {\n if (started || closed || retirement) throw new PythonFailure('executor-unavailable');\n started = true;\n const running = Promise.resolve().then(() => {\n if (closed || retirement) throw new PythonFailure('executor-unavailable');\n return executor.run(start);\n });\n execution = running.then(() => {}, () => {});\n return running;\n },\n terminate: entry.retire,\n };\n },\n inspect() { return { active: entries.size, capacity, closed }; },\n dispose() {\n closed = true;\n disposal ??= Promise.allSettled([...entries].map(entry => entry.retire())).then(results => {\n const failed = results.find(result => result.status === 'rejected');\n if (failed?.status === 'rejected') throw failed.reason;\n });\n return disposal;\n },\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,kBAAkB,4BAA2C;;;ACAtE;AAGO,SAAS,kBAAkB,OAAgB,UAA8B;AAC9E,MAAI,OAAO;AACX,QAAM,YAAY,oBAAI,IAAY;AAClC,QAAM,UAAU,CAAC,UAAwB;AACvC,YAAQ;AACR,QAAI,OAAO,SAAU,OAAM,IAAI,QAAQ,SAAS,EAAE,SAAS,eAAe,CAAC;AAAA,EAC7E;AACA,QAAM,SAAS,CAAC,SAAyB;AAEvC,QAAI,KAAK,SAAS,IAAI,WAAW,KAAM,OAAM,IAAI,QAAQ,SAAS,EAAE,SAAS,eAAe,CAAC;AAC7F,YAAQ,CAAC;AACT,aAAS,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;AAChD,YAAM,OAAO,KAAK,WAAW,KAAK;AAClC,UAAI,OAAO,GAAI,SAAQ,CAAC,GAAG,GAAG,IAAI,IAAI,EAAE,EAAE,SAAS,IAAI,IAAI,IAAI,CAAC;AAAA,eACvD,SAAS,MAAM,SAAS,GAAI,SAAQ,CAAC;AAAA,eACrC,OAAO,IAAK,SAAQ,CAAC;AAAA,eACrB,OA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