# HEIC codec source and replacement

ERITHRA loads the unmodified `heic-to@1.6.6` CSP ESM build as a separate,
replaceable `/vendor/heic-to.js` library. It is licensed under LGPL-3.0;
the application does not prevent modification or reverse engineering of this
library for debugging modifications.

Corresponding source retained alongside this file:

- `heic-to-1.6.6.tar.gz`: wrapper source, bundled libheif JS/WASM source modules,
  `esbuild.mjs`, package metadata and license.
- `libheif-1.23.6.tar.gz`: libheif C/C++ source and its build instructions.
- `libde265-1.0.16.tar.gz`: HEVC decoder C/C++ source and build instructions.
- `LGPL-3.0.txt`: library license.

Original repositories: https://github.com/hoppergee/heic-to/tree/v1.6.6,
https://github.com/strukturag/libheif/tree/v1.23.6,
https://github.com/strukturag/libde265/tree/v1.0.16.

To rebuild the wrapper, unpack its archive, install its pinned esbuild-compatible
development dependencies and run `node esbuild.mjs`. The checked-in
`src/lib/libheif-without-unsafe-eval.js` is the upstream CSP decoder module;
the source header identifies libheif 1.23.6 and libde265 1.0.16. To replace the
decoder, compile the matching C/C++ sources for Emscripten using libheif's
documented WASM build and substitute the exported libheif module before running
the wrapper build. No ERITHRA patches are applied to these libraries.

For a local modified installation, replace `public/vendor/heic-to.js` after
`node scripts/prepare-assets.mjs` and before `astro build`, or change the copy
source in `scripts/prepare-assets.mjs` to your rebuilt `dist/csp/heic-to.js`.
The only application call is `heicTo({blob, type:'bitmap'})`; no application
rebuild is required when substituting an API-compatible asset in an existing
deployment. Production updates still follow the repository's GitHub → Netlify
workflow. See the root repository for the complete application source.
