{
  "version": 3,
  "sources": ["../../runtime/src/env.ts", "../../runtime/src/worker-call.ts", "../../runtime/src/worker-helper.ts", "../../runtime/src/wasm-loader.ts", "../../runtime/src/validators.ts", "../../runtime/src/image-data-polyfill.ts", "../../runtime/src/index.ts", "../src/validators.ts", "../src/wp2.worker.ts", "../src/bridge.ts", "../src/index.ts"],
  "sourcesContent": [
    "/**\n * Runtime environment detection utilities\n */\n\n/**\n * Detect if running in a Web Worker context\n */\nexport function isWorker(): boolean {\n  return (\n    typeof self !== 'undefined' &&\n    typeof (globalThis as unknown as { DedicatedWorkerGlobalScope?: unknown })\n      .DedicatedWorkerGlobalScope !== 'undefined'\n  );\n}\n\n/**\n * Detect if running in a browser context\n */\nexport function isBrowser(): boolean {\n  return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\n/**\n * Detect if running in Bun\n */\nexport function isBun(): boolean {\n  return typeof Bun !== 'undefined';\n}\n\n/**\n * Detect if running in Node.js\n */\nexport function isNode(): boolean {\n  return (\n    typeof process !== 'undefined' &&\n    process.versions != null &&\n    process.versions.node != null\n  );\n}\n\n/**\n * Check if ImageData is available in the current environment\n */\nexport function hasImageData(): boolean {\n  return typeof ImageData !== 'undefined';\n}\n",
    "/**\n * Generic worker communication helper with support for transferables and AbortSignal\n */\n\nexport interface WorkerRequest<T = unknown> {\n  type: string;\n  id: number;\n  payload: T;\n}\n\nexport interface WorkerResponse<T = unknown> {\n  id: number;\n  ok: boolean;\n  data?: T;\n  error?: string;\n}\n\nlet requestId = 0;\n\n/**\n * Call a worker with a typed request and wait for response\n *\n * @param worker - The worker instance to call\n * @param type - The message type\n * @param payload - The payload to send\n * @param signal - Optional AbortSignal to cancel the operation\n * @param transfer - Optional list of Transferable objects to transfer\n * @returns Promise that resolves with the worker's response data\n */\nexport async function callWorker<TPayload, TResponse>(\n  worker: Worker,\n  type: string,\n  payload: TPayload,\n  signal?: AbortSignal,\n  transfer?: Transferable[]\n): Promise<TResponse> {\n  return new Promise<TResponse>((resolve, reject) => {\n    const id = ++requestId;\n\n    // Check if already aborted\n    if (signal?.aborted) {\n      reject(new DOMException('Aborted', 'AbortError'));\n      return;\n    }\n\n    const handleMessage = (event: MessageEvent) => {\n      const response = event.data as WorkerResponse<TResponse>;\n      if (response.id !== id) return;\n\n      cleanup();\n\n      if (response.ok && response.data !== undefined) {\n        resolve(response.data);\n      } else {\n        reject(new Error(response.error || 'Unknown worker error'));\n      }\n    };\n\n    const handleError = (error: ErrorEvent) => {\n      cleanup();\n      reject(new Error(`Worker error: ${error.message}`));\n    };\n\n    const handleAbort = () => {\n      cleanup();\n      reject(new DOMException('Aborted', 'AbortError'));\n    };\n\n    const cleanup = () => {\n      worker.removeEventListener('message', handleMessage);\n      worker.removeEventListener('error', handleError);\n      signal?.removeEventListener('abort', handleAbort);\n    };\n\n    // Set up listeners\n    worker.addEventListener('message', handleMessage);\n    worker.addEventListener('error', handleError);\n    signal?.addEventListener('abort', handleAbort);\n\n    // Send the request\n    const request: WorkerRequest<TPayload> = { type, id, payload };\n\n    if (transfer && transfer.length > 0) {\n      worker.postMessage(request, transfer);\n    } else {\n      worker.postMessage(request);\n    }\n  });\n}\n",
    "/**\n * Worker helper utilities for creating and managing Web Workers\n *\n * This module provides centralized logic for creating worker instances\n * in different environments (browser, Node.js, Bun) using import.meta.resolve\n * for server-side and package-relative paths for browsers.\n */\n\nimport { isBun } from './env';\n\nexport type CreateWorkerOptions = {\n  assetPath?: string;\n};\n\n/**\n * Create a Web Worker for a specific codec\n *\n * In Node.js/Bun environments, uses import.meta.resolve to locate worker files.\n * In browser environments, uses relative paths within node_modules that Vite can resolve.\n *\n * @param workerFilename - The name of the worker file (e.g., 'resize.worker' or 'webp.worker')\n * @returns Worker instance\n * @throws Error if worker creation fails with detailed error message\n */\nexport function createCodecWorker(\n  workerFilename: string,\n  options?: CreateWorkerOptions\n): Worker {\n  // Ensure filename has correct format\n  const normalizedName = workerFilename.endsWith('.js')\n    ? workerFilename\n    : `${workerFilename}.js`;\n\n  // Map worker filenames to their package and export\n  const workerMap: Record<string, { package: string; specifier: string }> = {\n    'resize.worker.js': {\n      package: '@squoosh-kit/resize',\n      specifier: 'resize.worker.js',\n    },\n    'webp.worker.js': {\n      package: '@squoosh-kit/webp',\n      specifier: 'webp.worker.js',\n    },\n    'avif.worker.js': {\n      package: '@squoosh-kit/avif',\n      specifier: 'avif.worker.js',\n    },\n    'mozjpeg.worker.js': {\n      package: '@squoosh-kit/mozjpeg',\n      specifier: 'mozjpeg.worker.js',\n    },\n    'jxl.worker.js': {\n      package: '@squoosh-kit/jxl',\n      specifier: 'jxl.worker.js',\n    },\n    'oxipng.worker.js': {\n      package: '@squoosh-kit/oxipng',\n      specifier: 'oxipng.worker.js',\n    },\n    'png.worker.js': {\n      package: '@squoosh-kit/png',\n      specifier: 'png.worker.js',\n    },\n    'imagequant.worker.js': {\n      package: '@squoosh-kit/imagequant',\n      specifier: 'imagequant.worker.js',\n    },\n    'qoi.worker.js': {\n      package: '@squoosh-kit/qoi',\n      specifier: 'qoi.worker.js',\n    },\n    'wp2.worker.js': {\n      package: '@squoosh-kit/wp2',\n      specifier: 'wp2.worker.js',\n    },\n    'hqx.worker.js': {\n      package: '@squoosh-kit/hqx',\n      specifier: 'hqx.worker.js',\n    },\n    'rotate.worker.js': {\n      package: '@squoosh-kit/rotate',\n      specifier: 'rotate.worker.js',\n    },\n    'visdif.worker.js': {\n      package: '@squoosh-kit/visdif',\n      specifier: 'visdif.worker.js',\n    },\n  };\n\n  const workerConfig = workerMap[normalizedName];\n  if (!workerConfig) {\n    throw new Error(\n      `Unknown worker: ${normalizedName}. ` +\n        `Supported workers: ${Object.keys(workerMap).join(', ')}`\n    );\n  }\n\n  try {\n    // In browser contexts, use relative paths within the installed packages\n    if (typeof window !== 'undefined') {\n      const packageName = workerConfig.package.split('/')[1]; // Extract 'resize' or 'webp'\n      const workerFile = normalizedName.replace('.js', '.browser.mjs');\n\n      console.log(\n        `[worker-helper] In browser environment. Trying to create worker:`\n      );\n      console.log(`[worker-helper]   - Package Name: ${packageName}`);\n      console.log(`[worker-helper]   - Worker File: ${workerFile}`);\n\n      // If a custom asset path is provided, use it directly\n      if (options?.assetPath) {\n        // Normalize the asset path - ensure it starts with / and ends without /\n        let normalizedAssetPath = options.assetPath;\n        if (!normalizedAssetPath.startsWith('/')) {\n          normalizedAssetPath = '/' + normalizedAssetPath;\n        }\n        if (normalizedAssetPath.endsWith('/')) {\n          normalizedAssetPath = normalizedAssetPath.slice(0, -1);\n        }\n\n        // Construct absolute URL: {origin}{assetPath}/{package}/{workerFile}\n        const workerPath = `${normalizedAssetPath}/${packageName}/${workerFile}`;\n        const workerUrl = new URL(workerPath, window.location.origin).href;\n\n        console.log(\n          `[worker-helper] Using provided assetPath. Full Worker URL: ${workerUrl}`\n        );\n        try {\n          const worker = new Worker(workerUrl, { type: 'module' });\n          console.log(\n            `[worker-helper] Successfully created worker with assetPath: ${workerUrl}`\n          );\n          return worker;\n        } catch (e) {\n          console.error(\n            `[worker-helper] Failed to load worker from assetPath URL: ${workerUrl}`,\n            e\n          );\n          throw new Error(\n            `Worker failed to load from ${workerUrl}: ${e instanceof Error ? e.message : String(e)}`,\n            { cause: e }\n          );\n        }\n      }\n\n      // Try multiple path strategies to support both:\n      // 1. Monorepo development structure: ../../{package}/dist/{workerFile}\n      // 2. npm installed structure: ../../../{package}/dist/{workerFile}\n      const pathStrategies = [\n        // First try monorepo structure (when runtime is at packages/runtime/src)\n        `../../${packageName}/dist/${workerFile}`,\n        // Then try npm structure (when runtime is at node_modules/@squoosh-kit/runtime)\n        `../../../node_modules/@squoosh-kit/${packageName}/dist/${workerFile}`,\n        // Alternative npm structure for cases where packages are flattened\n        `../../../${packageName}/dist/${workerFile}`,\n      ];\n\n      let lastError: Error | null = null;\n\n      for (const relPath of pathStrategies) {\n        console.log('relPath:', relPath);\n        console.log('import.meta.url:', import.meta.url);\n        try {\n          const workerUrl = new URL(relPath, import.meta.url);\n          console.log(\n            `[worker-helper] Trying path strategy. Full Worker URL: ${workerUrl.href}`\n          );\n          const worker = new Worker(workerUrl, {\n            type: 'module',\n          });\n          console.log(\n            `[worker-helper] Successfully created worker with URL: ${workerUrl.href}`\n          );\n          return worker;\n        } catch (error) {\n          console.warn(\n            `[worker-helper] Path strategy failed for ${relPath}:`,\n            error\n          );\n          lastError = error instanceof Error ? error : new Error(String(error));\n          // Continue to next strategy\n        }\n      }\n\n      // If all strategies failed, throw the last error\n      if (lastError) {\n        console.error('[worker-helper] All path strategies failed.', lastError);\n        throw lastError;\n      }\n      throw new Error(\n        `Could not resolve worker ${normalizedName} using any available path strategy`\n      );\n    }\n\n    // Fallbacks for monorepo/dev without build artifacts\n    const platformExt = isBun() ? '.bun.js' : '.node.mjs';\n    const baseName = normalizedName.replace('.js', '');\n    const pkgName = workerConfig.package.split('/')[1]; // e.g. 'avif', 'webp', 'resize'\n\n    // 1) Try TypeScript source first (Bun can transpile TS, works in dev)\n    const srcRelPath = `../../${pkgName}/src/${baseName}.ts`;\n\n    console.log('srcRelPath:', srcRelPath);\n    console.log('import.meta.url:', import.meta.url);\n    try {\n      return new Worker(new URL(srcRelPath, import.meta.url), {\n        type: 'module',\n      });\n    } catch {\n      // 2) Try dist output (if already built)\n      const distRelPath = `../../${pkgName}/dist/${baseName}.${platformExt.slice(1)}`;\n\n      console.log('distRelPath:', distRelPath);\n      console.log('import.meta.url:', import.meta.url);\n      try {\n        return new Worker(new URL(distRelPath, import.meta.url), {\n          type: 'module',\n        });\n      } catch {\n        // 3) Try import.meta.resolve as last resort\n        if (typeof import.meta.resolve === 'function') {\n          try {\n            const resolved = import.meta.resolve(\n              `${workerConfig.package}/${workerConfig.specifier}`\n            );\n            console.log('resolved:', resolved);\n            return new Worker(resolved, { type: 'module' });\n          } catch {\n            // Continue to error below\n          }\n        }\n      }\n    }\n\n    // If we get here, all fallbacks failed\n    throw new Error(\n      `Failed to create worker from ${normalizedName}. ` +\n        `Tried TypeScript source, dist output, and import.meta.resolve. ` +\n        `Ensure the @squoosh-kit/resize and @squoosh-kit/webp packages are installed.`\n    );\n  } catch (error) {\n    const errorMessage = error instanceof Error ? error.message : String(error);\n    throw new Error(\n      `Failed to create worker from ${normalizedName}: ${errorMessage}. ` +\n        `Ensure the @squoosh-kit/resize and @squoosh-kit/webp packages are installed. ` +\n        `If you're using Vite, ensure the worker files are not being optimized as dependencies.`,\n      { cause: error }\n    );\n  }\n}\n\n/**\n * Create a worker with initialization timeout and ready signal handling\n *\n * This is a higher-level function that creates a worker and waits for it\n * to signal that it's ready to receive messages.\n *\n * @param workerFilename - The name of the worker file\n * @param timeoutMs - Timeout in milliseconds (default: 10000)\n * @returns Promise that resolves to a ready Worker instance\n * @throws Error if worker creation fails or times out\n */\nexport function createReadyWorker(\n  workerFilename: string,\n  options?: CreateWorkerOptions,\n  timeoutMs: number = 10000\n): Promise<Worker> {\n  return new Promise((resolve, reject) => {\n    const timeout = setTimeout(() => {\n      reject(\n        new Error(\n          `Worker initialization timeout after ${timeoutMs}ms. Worker file: ${workerFilename}`\n        )\n      );\n    }, timeoutMs);\n\n    let worker: Worker;\n    try {\n      worker = createCodecWorker(workerFilename, options);\n    } catch (error) {\n      clearTimeout(timeout);\n      reject(error);\n      return;\n    }\n\n    const handleMessage = (event: MessageEvent) => {\n      if (event.data?.type === 'worker:ready') {\n        clearTimeout(timeout);\n        worker.removeEventListener('message', handleMessage);\n        worker.removeEventListener('error', handleError);\n        worker.removeEventListener('messageerror', handleMessageError);\n        resolve(worker);\n      }\n    };\n\n    const handleError = (event: ErrorEvent) => {\n      clearTimeout(timeout);\n      worker.removeEventListener('message', handleMessage);\n      worker.removeEventListener('error', handleError);\n      worker.removeEventListener('messageerror', handleMessageError);\n      reject(\n        new Error(\n          `Worker failed to start: ${event?.message || 'Unknown error'}. Worker file: ${workerFilename}`\n        )\n      );\n    };\n\n    const handleMessageError = () => {\n      clearTimeout(timeout);\n      worker.removeEventListener('message', handleMessage);\n      worker.removeEventListener('error', handleError);\n      worker.removeEventListener('messageerror', handleMessageError);\n      reject(\n        new Error(\n          `Worker message error during initialization. Worker file: ${workerFilename}`\n        )\n      );\n    };\n\n    worker.addEventListener('message', handleMessage);\n    worker.addEventListener('error', handleError);\n    worker.addEventListener('messageerror', handleMessageError);\n    worker.postMessage({ type: 'worker:ping' });\n  });\n}\n",
    "/**\n * Load WASM binary from various sources with fallback strategies\n *\n * Supports:\n * - Node.js (fs/promises)\n * - Browsers (fetch)\n * - Workers (fetch)\n */\nexport async function loadWasmBinary(\n  relativePath: string,\n  baseUrlOverride?: string | URL\n): Promise<ArrayBuffer> {\n  // Get the base URL depending on the environment (worker or main thread)\n  // If a base URL is provided, use it; otherwise use import.meta.url from this module\n  // In a worker, import.meta.url is the worker's own URL.\n  // In the main thread, it's the URL of the current module.\n  const baseUrl = baseUrlOverride\n    ? typeof baseUrlOverride === 'string'\n      ? new URL('.', baseUrlOverride)\n      : new URL('.', baseUrlOverride.href)\n    : new URL('.', import.meta.url);\n  const fullUrl = new URL(relativePath, baseUrl);\n\n  console.log(`[WasmLoader] Loading WASM from relative path: ${relativePath}`);\n  console.log(`[WasmLoader] Base URL (import.meta.url): ${baseUrl.href}`);\n  console.log(`[WasmLoader] Constructed full URL: ${fullUrl.href}`);\n\n  try {\n    const response = await fetch(fullUrl.href);\n\n    console.log(\n      `[WasmLoader] Fetch response status for ${fullUrl.href}: ${response.status}`\n    );\n\n    if (!response.ok) {\n      const responseText = await response.text();\n      console.error(\n        `[WasmLoader] Fetch response text (first 500 chars):`,\n        responseText.substring(0, 500)\n      );\n      throw new Error(\n        `Failed to fetch WASM module at ${fullUrl.href}: ${response.status} ${response.statusText}`\n      );\n    }\n\n    const contentType = response.headers.get('content-type');\n    console.log(`[WasmLoader] Response Content-Type: ${contentType}`);\n    if (!contentType || !contentType.includes('application/wasm')) {\n      console.warn(\n        `[WasmLoader] Warning: WASM module at ${fullUrl.href} served with incorrect MIME type: \"${contentType}\". Should be \"application/wasm\".`\n      );\n    }\n\n    return await response.arrayBuffer();\n  } catch (error) {\n    console.error(\n      `[WasmLoader] CRITICAL: Fetching WASM binary from ${fullUrl.href} failed.`,\n      error\n    );\n    throw error;\n  }\n}\n\n/**\n * Load WASM JavaScript module with fallback strategies\n *\n * Strategy 1: Static relative import (works everywhere)\n * Strategy 2: import.meta.resolve (Node.js 22+)\n * Strategy 3: URL-based import (browsers/workers)\n */\nexport async function loadWasmModule(\n  modulePath: string\n): Promise<WebAssembly.Module> {\n  // Strategy 1: Try direct static import\n  try {\n    return await import(/* @vite-ignore */ modulePath);\n\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  } catch (e1) {\n    // Continue to next strategy\n  }\n\n  // Strategy 2: Try import.meta.resolve (Node.js 22+)\n  try {\n    const resolvedPath = await import.meta.resolve(modulePath);\n\n    return await import(/* @vite-ignore */ resolvedPath);\n\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  } catch (e2) {\n    // Continue to next strategy\n  }\n\n  // Strategy 3: Try URL-based import\n  try {\n    const url = new URL(/* @vite-ignore */ modulePath, import.meta.url);\n\n    return await import(/* @vite-ignore */ url.href);\n  } catch (e3) {\n    throw new Error(\n      `Failed to load WASM module from \"${modulePath}\". ` +\n        `Ensure WASM files are in the expected location and the module can be resolved.`,\n      { cause: e3 }\n    );\n  }\n}\n",
    "import type { ImageInput } from './types.js';\n\nexport function validateArrayBuffer(\n  buffer: unknown\n): asserts buffer is ArrayBuffer {\n  // Check if SharedArrayBuffer is defined in the current environment before using it\n  if (\n    typeof SharedArrayBuffer !== 'undefined' &&\n    buffer instanceof SharedArrayBuffer\n  ) {\n    throw new Error(\n      'SharedArrayBuffer is not supported. ' +\n        'Use regular ArrayBuffer or Uint8Array instead.'\n    );\n  }\n\n  if (!(buffer instanceof ArrayBuffer)) {\n    throw new TypeError('image.data.buffer must be an ArrayBuffer');\n  }\n}\n\nexport function validateImageInput(\n  image: unknown\n): asserts image is ImageInput {\n  if (!image || typeof image !== 'object') {\n    throw new TypeError('image must be an object');\n  }\n\n  const imageObj = image as Record<string, unknown>;\n\n  if (!('data' in imageObj)) {\n    throw new TypeError('image.data is required');\n  }\n\n  const { data } = imageObj;\n  if (!(data instanceof Uint8Array || data instanceof Uint8ClampedArray)) {\n    throw new TypeError('image.data must be Uint8Array or Uint8ClampedArray');\n  }\n\n  if (!('width' in imageObj) || !('height' in imageObj)) {\n    throw new TypeError('image.width and image.height are required');\n  }\n\n  const { width, height } = imageObj;\n\n  if (typeof width !== 'number' || !Number.isInteger(width) || width <= 0) {\n    throw new RangeError(\n      `image.width must be a positive integer, got ${width}`\n    );\n  }\n\n  if (typeof height !== 'number' || !Number.isInteger(height) || height <= 0) {\n    throw new RangeError(\n      `image.height must be a positive integer, got ${height}`\n    );\n  }\n\n  const expectedSize = width * height * 4;\n  if (data.length < expectedSize) {\n    throw new RangeError(\n      `image.data too small: ${data.length} bytes, expected at least ${expectedSize} bytes for ${width}x${height} RGBA image`\n    );\n  }\n}\n",
    "/**\n * Polyfill for ImageData in Node/Bun environments where it's not available.\n * Must be called before any WASM decode operation that returns ImageData.\n */\nexport function polyfillImageData(): void {\n  if (typeof ImageData === 'undefined') {\n    (\n      globalThis as {\n        ImageData?: new (\n          data: Uint8ClampedArray,\n          width: number,\n          height: number\n        ) => ImageData;\n      }\n    ).ImageData = class {\n      data: Uint8ClampedArray;\n      width: number;\n      height: number;\n      colorSpace: PredefinedColorSpace = 'srgb';\n      constructor(data: Uint8ClampedArray, width: number, height: number) {\n        this.data = data;\n        this.width = width;\n        this.height = height;\n      }\n    } as unknown as typeof ImageData;\n  }\n}\n",
    "/**\n * @squoosh-kit/runtime\n *\n * Core runtime logic for squoosh-kit, including environment utilities\n * and worker communication helpers.\n */\n\nexport * from './env.js';\nexport * from './worker-call.js';\nexport * from './types.js';\nexport * from './worker-helper.js';\nexport * from './wasm-loader.js';\nexport * from './validators.js';\nexport * from './simd-detector.js';\nexport * from './image-data-polyfill.js';\n",
    "export function validateWp2Options(\n  options: unknown\n): asserts options is Record<string, unknown> | undefined {\n  if (options === undefined) {\n    return;\n  }\n\n  if (typeof options !== 'object' || options === null) {\n    throw new TypeError('options must be an object or undefined');\n  }\n\n  const opts = options as Record<string, unknown>;\n\n  if ('quality' in opts && opts.quality !== undefined) {\n    const quality = opts.quality;\n\n    if (Number.isNaN(quality)) {\n      throw new RangeError(\n        'quality must be a valid number in the range 0-100, got NaN'\n      );\n    }\n\n    if (typeof quality !== 'number') {\n      throw new TypeError('quality must be a number');\n    }\n\n    if (!Number.isFinite(quality) || !Number.isInteger(quality)) {\n      throw new RangeError(\n        'quality must be an integer in the range 0-100, got floating point'\n      );\n    }\n\n    if (quality < 0 || quality > 100) {\n      throw new RangeError(\n        `quality must be in the range 0-100, got ${quality}`\n      );\n    }\n  }\n\n  if ('alpha_quality' in opts && opts.alpha_quality !== undefined) {\n    const alphaQuality = opts.alpha_quality;\n\n    if (Number.isNaN(alphaQuality)) {\n      throw new RangeError(\n        'alpha_quality must be a valid number in the range 0-100, got NaN'\n      );\n    }\n\n    if (typeof alphaQuality !== 'number') {\n      throw new TypeError('alpha_quality must be a number');\n    }\n\n    if (!Number.isFinite(alphaQuality) || !Number.isInteger(alphaQuality)) {\n      throw new RangeError(\n        'alpha_quality must be an integer in the range 0-100, got floating point'\n      );\n    }\n\n    if (alphaQuality < 0 || alphaQuality > 100) {\n      throw new RangeError(\n        `alpha_quality must be in the range 0-100, got ${alphaQuality}`\n      );\n    }\n  }\n\n  if ('effort' in opts && opts.effort !== undefined) {\n    const effort = opts.effort;\n\n    if (Number.isNaN(effort)) {\n      throw new RangeError(\n        'effort must be a valid number in the range 0-9, got NaN'\n      );\n    }\n\n    if (typeof effort !== 'number') {\n      throw new TypeError('effort must be a number');\n    }\n\n    if (!Number.isFinite(effort) || !Number.isInteger(effort)) {\n      throw new RangeError(\n        'effort must be an integer in the range 0-9, got floating point'\n      );\n    }\n\n    if (effort < 0 || effort > 9) {\n      throw new RangeError(`effort must be in the range 0-9, got ${effort}`);\n    }\n  }\n\n  if ('pass' in opts && opts.pass !== undefined) {\n    const pass = opts.pass;\n\n    if (Number.isNaN(pass)) {\n      throw new RangeError(\n        'pass must be a valid number in the range 1-10, got NaN'\n      );\n    }\n\n    if (typeof pass !== 'number') {\n      throw new TypeError('pass must be a number');\n    }\n\n    if (!Number.isFinite(pass) || !Number.isInteger(pass)) {\n      throw new RangeError(\n        'pass must be an integer in the range 1-10, got floating point'\n      );\n    }\n\n    if (pass < 1 || pass > 10) {\n      throw new RangeError(`pass must be in the range 1-10, got ${pass}`);\n    }\n  }\n\n  if ('sns' in opts && opts.sns !== undefined) {\n    const sns = opts.sns;\n\n    if (Number.isNaN(sns)) {\n      throw new RangeError(\n        'sns must be a valid number in the range 0-100, got NaN'\n      );\n    }\n\n    if (typeof sns !== 'number') {\n      throw new TypeError('sns must be a number');\n    }\n\n    if (!Number.isFinite(sns) || !Number.isInteger(sns)) {\n      throw new RangeError(\n        'sns must be an integer in the range 0-100, got floating point'\n      );\n    }\n\n    if (sns < 0 || sns > 100) {\n      throw new RangeError(`sns must be in the range 0-100, got ${sns}`);\n    }\n  }\n}\n",
    "/**\n * WP2 encoder/decoder - single-source worker/client implementation\n */\n\nimport {\n  type WorkerRequest,\n  type WorkerResponse,\n  type ImageInput,\n  loadWasmBinary,\n  validateImageInput,\n  polyfillImageData,\n} from '@squoosh-kit/runtime';\nimport { validateWp2Options } from './validators';\nimport type { WP2Module, EncodeOptions } from '../wasm/wp2-enc/wp2_enc';\nimport type { WP2Module as WP2DecModule } from '../wasm/wp2-dec/wp2_dec';\nimport type { Wp2EncodeOptions } from './types';\n\n// UVMode and Csp numeric values matching the const enums in wp2_enc.d.ts\nconst UVModeAuto = 3;\nconst kYCoCg = 0;\n\nlet cachedModule: WP2Module | null = null;\n\nasync function loadWp2Module(): Promise<WP2Module> {\n  if (cachedModule) {\n    return cachedModule;\n  }\n\n  // Determine the module path based on environment\n  const isNodeOrBun =\n    typeof process !== 'undefined' &&\n    (process.versions?.bun !== undefined ||\n      process.versions?.node !== undefined);\n\n  const modulePath = isNodeOrBun\n    ? 'wp2-enc/wp2_node_enc.js'\n    : 'wp2-enc/wp2_enc.js';\n\n  try {\n    console.log(\n      '[WP2 Worker] Initializing. Environment:',\n      isNodeOrBun ? 'Node/Bun' : 'Browser'\n    );\n    console.log(\n      `[WP2 Worker] Attempting to import module from path: ${modulePath}`\n    );\n\n    // Mock self.location for test environments where it doesn't exist\n    // Emscripten code tries to access self.location.href during initialization\n    const globalSelf = typeof self !== 'undefined' ? self : globalThis;\n    if (!globalSelf.location) {\n      (globalSelf as { location?: { href: string } }).location = {\n        href: import.meta.url,\n      };\n    }\n    // Also ensure self exists if it doesn't (for Emscripten code that checks ENVIRONMENT_IS_WORKER)\n    if (typeof self === 'undefined' && typeof globalThis !== 'undefined') {\n      (globalThis as { self?: typeof globalThis }).self = globalThis;\n    }\n\n    // Try both paths: '../wasm/' first when running from source (tests), './wasm/' first in dist\n    let moduleFactory;\n    const isSource = import.meta.url.includes('/src/');\n    const pathsToTry = isSource\n      ? ['../wasm/' + modulePath, './wasm/' + modulePath]\n      : ['./wasm/' + modulePath, '../wasm/' + modulePath];\n\n    let lastError: Error | null = null;\n    for (const importPath of pathsToTry) {\n      try {\n        moduleFactory = (await import(/* @vite-ignore */ importPath)).default;\n        console.log(\n          `[WP2 Worker] Successfully loaded module from: ${importPath}`\n        );\n        break;\n      } catch (error) {\n        lastError = error instanceof Error ? error : new Error(String(error));\n        console.warn(\n          `[WP2 Worker] Failed to load from ${importPath}, trying next path...`\n        );\n      }\n    }\n\n    if (!moduleFactory) {\n      throw lastError || new Error('Could not load WP2 module from any path');\n    }\n\n    console.log('[WP2 Worker] Module factory loaded successfully.');\n\n    // Determine WASM binary path\n    const wasmFile = isNodeOrBun ? 'wp2_node_enc.wasm' : 'wp2_enc.wasm';\n    const wasmPathsToTry = isSource\n      ? [`../wasm/wp2-enc/${wasmFile}`, `./wasm/wp2-enc/${wasmFile}`]\n      : [`./wasm/wp2-enc/${wasmFile}`, `../wasm/wp2-enc/${wasmFile}`];\n\n    console.log(\n      `[WP2 Worker] Preparing to load WASM binary. Will try paths: ${wasmPathsToTry.join(', ')}`\n    );\n\n    const initModuleWithBinary = async (\n      moduleFactory: (config: {\n        noInitialRun: boolean;\n        wasmBinary?: ArrayBuffer;\n      }) => Promise<WP2Module>,\n      wasmPaths: string[]\n    ): Promise<WP2Module> => {\n      const workerBaseUrl = new URL('.', import.meta.url);\n      let lastError: Error | null = null;\n      for (const wasmPath of wasmPaths) {\n        try {\n          console.log(\n            `[WP2 Worker] Calling loadWasmBinary with path: ${wasmPath}`\n          );\n          const wasmBinary = await loadWasmBinary(wasmPath, workerBaseUrl);\n          console.log(\n            `[WP2 Worker] Successfully fetched WASM binary from ${wasmPath}. Size: ${wasmBinary.byteLength} bytes.`\n          );\n\n          // Ensure self.location exists right before calling moduleFactory\n          const globalSelf = typeof self !== 'undefined' ? self : globalThis;\n          if (!globalSelf.location) {\n            (globalSelf as { location?: { href: string } }).location = {\n              href: import.meta.url,\n            };\n          }\n          if (\n            typeof self === 'undefined' &&\n            typeof globalThis !== 'undefined'\n          ) {\n            (globalThis as { self?: typeof globalThis }).self = globalThis;\n          }\n\n          return await moduleFactory({\n            noInitialRun: true,\n            wasmBinary,\n          });\n        } catch (err) {\n          lastError = err instanceof Error ? err : new Error(String(err));\n          console.warn(\n            `[WP2 Worker] Failed to load WASM from ${wasmPath}, trying next path...`\n          );\n        }\n      }\n      throw (\n        lastError ||\n        new Error('Could not load WASM binary from any of the attempted paths')\n      );\n    };\n\n    cachedModule = await initModuleWithBinary(moduleFactory, wasmPathsToTry);\n    console.log('[WP2 Worker] WP2 module initialized successfully.');\n    return cachedModule;\n  } catch (err) {\n    console.error(\n      `[WP2 Worker] CRITICAL: Failed to load WP2 module from path: ${modulePath}`,\n      err\n    );\n    throw err;\n  }\n}\n\n/**\n * Convert partial options to full EncodeOptions with Squoosh defaults\n */\nfunction createEncodeOptions(options?: Wp2EncodeOptions): EncodeOptions {\n  return {\n    quality: options?.quality ?? 75,\n    alpha_quality: options?.alpha_quality ?? 75,\n    effort: options?.effort ?? 5,\n    pass: options?.pass ?? 1,\n    sns: options?.sns ?? 50,\n    uv_mode: options?.uv_mode ?? UVModeAuto,\n    csp_type: options?.csp_type ?? kYCoCg,\n    error_diffusion: options?.error_diffusion ?? 0,\n    use_random_matrix: options?.use_random_matrix ?? false,\n  };\n}\n\n/**\n * Client-mode WP2 encoder (exported for direct use)\n */\nexport async function wp2EncodeClient(\n  image: ImageInput,\n  options?: Wp2EncodeOptions,\n  signal?: AbortSignal\n): Promise<Uint8Array> {\n  // Validate inputs before starting\n  validateImageInput(image);\n  validateWp2Options(options);\n\n  // Check abort before starting\n  if (signal?.aborted) {\n    throw new DOMException('Aborted', 'AbortError');\n  }\n\n  const width = image.width;\n  const height = image.height;\n  const data = image.data;\n\n  if (!(data instanceof Uint8Array) && !(data instanceof Uint8ClampedArray)) {\n    throw new Error('Image data must be Uint8Array or Uint8ClampedArray');\n  }\n\n  const module = await loadWp2Module();\n\n  // Check abort after async operation\n  if (signal?.aborted) {\n    throw new DOMException('Aborted', 'AbortError');\n  }\n\n  const encodeOptions = createEncodeOptions(options);\n\n  const dataArray =\n    data instanceof Uint8ClampedArray\n      ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n      : new Uint8Array(\n          data.buffer as ArrayBuffer,\n          data.byteOffset,\n          data.length\n        );\n\n  const result = module.encode(dataArray, width, height, encodeOptions);\n\n  if (signal?.aborted) {\n    throw new DOMException('Aborted', 'AbortError');\n  }\n\n  if (!result) {\n    throw new Error('WP2 encoding failed');\n  }\n\n  return result;\n}\n\nlet cachedDecModule: WP2DecModule | null = null;\n\nasync function loadWp2DecModule(): Promise<WP2DecModule> {\n  if (cachedDecModule) {\n    return cachedDecModule;\n  }\n\n  const isNodeOrBun =\n    typeof process !== 'undefined' &&\n    (process.versions?.bun !== undefined ||\n      process.versions?.node !== undefined);\n\n  const modulePath = isNodeOrBun\n    ? 'wp2-dec/wp2_node_dec.js'\n    : 'wp2-dec/wp2_dec.js';\n\n  try {\n    console.log(\n      '[WP2 Worker] Initializing dec. Environment:',\n      isNodeOrBun ? 'Node/Bun' : 'Browser'\n    );\n    console.log(\n      `[WP2 Worker] Attempting to import dec module from path: ${modulePath}`\n    );\n\n    const globalSelf = typeof self !== 'undefined' ? self : globalThis;\n    if (!globalSelf.location) {\n      (globalSelf as { location?: { href: string } }).location = {\n        href: import.meta.url,\n      };\n    }\n    if (typeof self === 'undefined' && typeof globalThis !== 'undefined') {\n      (globalThis as { self?: typeof globalThis }).self = globalThis;\n    }\n\n    // Polyfill ImageData for Node/Bun environments\n    polyfillImageData();\n\n    let moduleFactory;\n    const isSource = import.meta.url.includes('/src/');\n    const pathsToTry = isSource\n      ? ['../wasm/' + modulePath, './wasm/' + modulePath]\n      : ['./wasm/' + modulePath, '../wasm/' + modulePath];\n\n    let lastError: Error | null = null;\n    for (const importPath of pathsToTry) {\n      try {\n        moduleFactory = (await import(/* @vite-ignore */ importPath)).default;\n        console.log(\n          `[WP2 Worker] Successfully loaded dec module from: ${importPath}`\n        );\n        break;\n      } catch (error) {\n        lastError = error instanceof Error ? error : new Error(String(error));\n        console.warn(\n          `[WP2 Worker] Failed to load dec from ${importPath}, trying next path...`\n        );\n      }\n    }\n\n    if (!moduleFactory) {\n      throw (\n        lastError || new Error('Could not load WP2 dec module from any path')\n      );\n    }\n\n    console.log('[WP2 Worker] Dec module factory loaded successfully.');\n\n    const wasmFile = isNodeOrBun ? 'wp2_node_dec.wasm' : 'wp2_dec.wasm';\n    const wasmPathsToTry = isSource\n      ? [`../wasm/wp2-dec/${wasmFile}`, `./wasm/wp2-dec/${wasmFile}`]\n      : [`./wasm/wp2-dec/${wasmFile}`, `../wasm/wp2-dec/${wasmFile}`];\n\n    console.log(\n      `[WP2 Worker] Preparing to load dec WASM binary. Will try paths: ${wasmPathsToTry.join(', ')}`\n    );\n\n    const initDecModuleWithBinary = async (\n      moduleFactory: (config: {\n        noInitialRun: boolean;\n        wasmBinary?: ArrayBuffer;\n      }) => Promise<WP2DecModule>,\n      wasmPaths: string[]\n    ): Promise<WP2DecModule> => {\n      const workerBaseUrl = new URL('.', import.meta.url);\n      let lastError: Error | null = null;\n      for (const wasmPath of wasmPaths) {\n        try {\n          console.log(\n            `[WP2 Worker] Calling loadWasmBinary with dec path: ${wasmPath}`\n          );\n          const wasmBinary = await loadWasmBinary(wasmPath, workerBaseUrl);\n          console.log(\n            `[WP2 Worker] Successfully fetched dec WASM binary from ${wasmPath}. Size: ${wasmBinary.byteLength} bytes.`\n          );\n\n          const globalSelf = typeof self !== 'undefined' ? self : globalThis;\n          if (!globalSelf.location) {\n            (globalSelf as { location?: { href: string } }).location = {\n              href: import.meta.url,\n            };\n          }\n          if (\n            typeof self === 'undefined' &&\n            typeof globalThis !== 'undefined'\n          ) {\n            (globalThis as { self?: typeof globalThis }).self = globalThis;\n          }\n\n          return await moduleFactory({\n            noInitialRun: true,\n            wasmBinary,\n          });\n        } catch (err) {\n          lastError = err instanceof Error ? err : new Error(String(err));\n          console.warn(\n            `[WP2 Worker] Failed to load dec WASM from ${wasmPath}, trying next path...`\n          );\n        }\n      }\n      throw (\n        lastError ||\n        new Error(\n          'Could not load dec WASM binary from any of the attempted paths'\n        )\n      );\n    };\n\n    cachedDecModule = await initDecModuleWithBinary(\n      moduleFactory,\n      wasmPathsToTry\n    );\n    console.log('[WP2 Worker] WP2 dec module initialized successfully.');\n    return cachedDecModule;\n  } catch (err) {\n    console.error(\n      `[WP2 Worker] CRITICAL: Failed to load WP2 dec module from path: ${modulePath}`,\n      err\n    );\n    throw err;\n  }\n}\n\n/**\n * Client-mode WP2 decoder (exported for direct use)\n */\nexport async function wp2DecodeClient(\n  data: BufferSource,\n  signal?: AbortSignal\n): Promise<ImageData> {\n  if (signal?.aborted) {\n    throw new DOMException('Aborted', 'AbortError');\n  }\n\n  const module = await loadWp2DecModule();\n\n  if (signal?.aborted) {\n    throw new DOMException('Aborted', 'AbortError');\n  }\n\n  const result = module.decode(data);\n\n  if (!result) {\n    throw new Error('WP2 decoding failed');\n  }\n\n  return result;\n}\n\n/**\n * Worker message handler\n * Register the handler regardless of environment (for both worker context and tests)\n */\nif (typeof self !== 'undefined') {\n  self.onmessage = async (event: MessageEvent) => {\n    const data = event.data;\n\n    // Handle worker ping for initialization\n    if (data?.type === 'worker:ping') {\n      self.postMessage({ type: 'worker:ready' });\n      return;\n    }\n\n    if (data?.type === 'wp2:encode') {\n      const request = data as WorkerRequest<{\n        image: ImageInput;\n        options?: Wp2EncodeOptions;\n      }>;\n\n      const response: WorkerResponse<Uint8Array> = {\n        id: request.id,\n        ok: false,\n      };\n\n      try {\n        const { image, options } = request.payload;\n        const result = await wp2EncodeClient(image, options);\n        response.ok = true;\n        response.data = result;\n        self.postMessage(response);\n      } catch (error) {\n        response.error = error instanceof Error ? error.message : String(error);\n        self.postMessage(response);\n      }\n      return;\n    }\n\n    if (data?.type === 'wp2:decode') {\n      const request = data as WorkerRequest<{ data: BufferSource }>;\n\n      const response: WorkerResponse<ImageData> = {\n        id: request.id,\n        ok: false,\n      };\n\n      try {\n        const result = await wp2DecodeClient(request.payload.data);\n        response.ok = true;\n        response.data = result;\n        self.postMessage(response);\n      } catch (error) {\n        response.error = error instanceof Error ? error.message : String(error);\n        self.postMessage(response);\n      }\n      return;\n    }\n\n    // Unknown message type\n    const request = data as WorkerRequest<unknown>;\n    const response: WorkerResponse<never> = {\n      id: request.id,\n      ok: false,\n      error: `Unknown message type: ${data?.type}`,\n    };\n    self.postMessage(response);\n  };\n}\n",
    "/**\n * Bridge implementation for the WP2 package, handling worker and client modes.\n */\n\nimport {\n  callWorker,\n  createReadyWorker,\n  type ImageInput,\n} from '@squoosh-kit/runtime';\nimport { validateImageInput } from '@squoosh-kit/runtime';\nimport type { Wp2EncodeOptions } from './types';\n\nexport type BridgeOptions = {\n  assetPath?: string;\n};\n\ninterface WP2Bridge {\n  encode(\n    image: ImageInput,\n    options?: Wp2EncodeOptions,\n    signal?: AbortSignal\n  ): Promise<Uint8Array>;\n  decode(data: BufferSource, signal?: AbortSignal): Promise<ImageData>;\n  terminate(): Promise<void>;\n}\n\nclass Wp2ClientBridge implements WP2Bridge {\n  async encode(\n    image: ImageInput,\n    options?: Wp2EncodeOptions,\n    signal?: AbortSignal\n  ): Promise<Uint8Array> {\n    // Dynamically import the client encoder to avoid module loading issues in Vite\n    const module = await import('./wp2.worker.js');\n    const wp2EncodeClient = module.wp2EncodeClient as (\n      image: ImageInput,\n      options?: Wp2EncodeOptions,\n      signal?: AbortSignal\n    ) => Promise<Uint8Array>;\n    return wp2EncodeClient(image, options, signal);\n  }\n\n  async decode(data: BufferSource, signal?: AbortSignal): Promise<ImageData> {\n    const module = await import('./wp2.worker.js');\n    const wp2DecodeClient = module.wp2DecodeClient as (\n      data: BufferSource,\n      signal?: AbortSignal\n    ) => Promise<ImageData>;\n    return wp2DecodeClient(data, signal);\n  }\n\n  async terminate(): Promise<void> {\n    // Client mode has nothing to terminate\n  }\n}\n\nclass Wp2WorkerBridge implements WP2Bridge {\n  private worker: Worker | null = null;\n  private workerReady: Promise<Worker> | null = null;\n  private options?: BridgeOptions;\n\n  constructor(options?: BridgeOptions) {\n    console.log(\n      '[wp2/bridge] Wp2WorkerBridge constructor called with options:',\n      options\n    );\n    this.options = options;\n  }\n\n  private async getWorker(): Promise<Worker> {\n    if (!this.workerReady) {\n      this.workerReady = this.createWorker();\n    }\n    return this.workerReady;\n  }\n\n  private async createWorker(): Promise<Worker> {\n    console.log('[wp2/bridge] createWorker called. Creating ready worker...');\n    this.worker = await createReadyWorker('wp2.worker.js', this.options);\n    console.log(\n      '[wp2/bridge] createWorker: Ready worker created successfully.'\n    );\n    return this.worker;\n  }\n\n  async encode(\n    image: ImageInput,\n    options?: Wp2EncodeOptions,\n    signal?: AbortSignal\n  ): Promise<Uint8Array> {\n    const worker = await this.getWorker();\n\n    validateImageInput(image);\n    return callWorker(worker, 'wp2:encode', { image, options }, signal);\n  }\n\n  async decode(data: BufferSource, signal?: AbortSignal): Promise<ImageData> {\n    const worker = await this.getWorker();\n    return callWorker(worker, 'wp2:decode', { data }, signal);\n  }\n\n  async terminate(): Promise<void> {\n    if (this.worker) {\n      this.worker.terminate();\n      this.worker = null;\n      this.workerReady = null;\n    }\n  }\n}\n\nexport function createBridge(\n  mode: 'worker' | 'client',\n  options?: BridgeOptions\n): WP2Bridge {\n  console.log(`[wp2/bridge] createBridge called with mode: ${mode}`);\n  if (mode === 'worker') {\n    return new Wp2WorkerBridge(options);\n  }\n  return new Wp2ClientBridge();\n}\n",
    "/**\n * @squoosh-kit/wp2 public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge, type BridgeOptions } from './bridge';\nimport type { Wp2EncodeOptions } from './types';\n\nexport type { ImageInput, Wp2EncodeOptions };\n\n// Re-export UVMode and Csp enum values as plain objects for runtime use\n// (const enums are erased at compile time; these runtime objects allow consumers to use them)\nexport const UVMode = {\n  UVModeAdapt: 0,\n  UVMode420: 1,\n  UVMode444: 2,\n  UVModeAuto: 3,\n} as const;\n\nexport const Csp = {\n  kYCoCg: 0,\n  kYCbCr: 1,\n  kCustom: 2,\n  kYIQ: 3,\n} as const;\n\n// Global bridge instance for encode/decode reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\n\n/**\n * A WP2 image encoder that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type Wp2EncoderFactory = ((\n  imageData: ImageInput,\n  options?: Wp2EncodeOptions,\n  signal?: AbortSignal\n) => Promise<Uint8Array>) & {\n  /**\n   * Terminates the encoder and cleans up resources.\n   * Important for worker mode to prevent memory leaks.\n   *\n   * @example\n   * const encoder = createWp2Encoder('worker');\n   * try {\n   *   const result = await encoder(imageData, options);\n   * } finally {\n   *   await encoder.terminate();\n   * }\n   */\n  terminate(): Promise<void>;\n};\n\n/**\n * A WP2 image decoder that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type Wp2DecoderFactory = ((\n  data: BufferSource,\n  signal?: AbortSignal\n) => Promise<ImageData>) & {\n  /**\n   * Terminates the decoder and cleans up resources.\n   */\n  terminate(): Promise<void>;\n};\n\n/**\n * Encodes an image to WP2 format. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to encode.\n * @param options - WP2 encoding options.\n * @param signal - (Optional) AbortSignal to cancel the encoding operation.\n * @returns A Promise resolving to the encoded WP2 data as a Uint8Array.\n *\n * @example\n * const controller = new AbortController();\n * const result = await encode(imageData, { quality: 85 }, controller.signal);\n */\nexport async function encode(\n  imageData: ImageInput,\n  options?: Wp2EncodeOptions,\n  signal?: AbortSignal\n): Promise<Uint8Array> {\n  if (!globalClientBridge) {\n    globalClientBridge = createBridge('worker');\n  }\n\n  return globalClientBridge.encode(imageData, options, signal);\n}\n\n/**\n * Decodes a WP2 image to raw ImageData. Uses worker mode for UI responsiveness.\n *\n * @param data - The WP2 data to decode.\n * @param signal - (Optional) AbortSignal to cancel the decoding operation.\n * @returns A Promise resolving to an ImageData object with the decoded pixel data.\n */\nexport async function decode(\n  data: BufferSource,\n  signal?: AbortSignal\n): Promise<ImageData> {\n  if (!globalClientBridge) {\n    globalClientBridge = createBridge('worker');\n  }\n\n  return globalClientBridge.decode(data, signal);\n}\n\n/**\n * Creates a reusable WP2 encoder function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @param options - Optional bridge options.\n * @returns A function that encodes an image to WP2 format with optional AbortSignal.\n */\nexport function createWp2Encoder(\n  mode: 'worker' | 'client' = 'worker',\n  options?: BridgeOptions\n): Wp2EncoderFactory {\n  const bridge = createBridge(mode, options);\n\n  return Object.assign(\n    (\n      imageData: ImageInput,\n      options?: Wp2EncodeOptions,\n      signal?: AbortSignal\n    ) => {\n      return bridge.encode(imageData, options, signal);\n    },\n    {\n      terminate: async () => {\n        await bridge.terminate();\n      },\n    }\n  );\n}\n\n/**\n * Creates a reusable WP2 decoder function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @param options - Optional bridge options.\n * @returns A function that decodes WP2 data to ImageData with optional AbortSignal.\n */\nexport function createWp2Decoder(\n  mode: 'worker' | 'client' = 'worker',\n  options?: BridgeOptions\n): Wp2DecoderFactory {\n  const bridge = createBridge(mode, options);\n\n  return Object.assign(\n    (data: BufferSource, signal?: AbortSignal) => {\n      return bridge.decode(data, signal);\n    },\n    {\n      terminate: async () => {\n        await bridge.terminate();\n      },\n    }\n  );\n}\n"
  ],
  "mappings": ";;;;;;;;;;;;;;;;;AAyBO,SAAS,KAAK,GAAY;AAAA,EAC/B,OAAO,OAAO,QAAQ;AAAA;;;ACGxB,eAAsB,UAA+B,CACnD,QACA,MACA,SACA,QACA,UACoB;AAAA,EACpB,OAAO,IAAI,QAAmB,CAAC,SAAS,WAAW;AAAA,IACjD,MAAM,KAAK,EAAE;AAAA,IAGb,IAAI,QAAQ,SAAS;AAAA,MACnB,OAAO,IAAI,aAAa,WAAW,YAAY,CAAC;AAAA,MAChD;AAAA,IACF;AAAA,IAEA,MAAM,gBAAgB,CAAC,UAAwB;AAAA,MAC7C,MAAM,WAAW,MAAM;AAAA,MACvB,IAAI,SAAS,OAAO;AAAA,QAAI;AAAA,MAExB,QAAQ;AAAA,MAER,IAAI,SAAS,MAAM,SAAS,SAAS,WAAW;AAAA,QAC9C,QAAQ,SAAS,IAAI;AAAA,MACvB,EAAO;AAAA,QACL,OAAO,IAAI,MAAM,SAAS,SAAS,sBAAsB,CAAC;AAAA;AAAA;AAAA,IAI9D,MAAM,cAAc,CAAC,UAAsB;AAAA,MACzC,QAAQ;AAAA,MACR,OAAO,IAAI,MAAM,iBAAiB,MAAM,SAAS,CAAC;AAAA;AAAA,IAGpD,MAAM,cAAc,MAAM;AAAA,MACxB,QAAQ;AAAA,MACR,OAAO,IAAI,aAAa,WAAW,YAAY,CAAC;AAAA;AAAA,IAGlD,MAAM,UAAU,MAAM;AAAA,MACpB,OAAO,oBAAoB,WAA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