CircleCrop HEIC reader - LGPL-3.0 notice
=========================================

The HEIC reader of this site (the file libheif-<hash>.worker.js) is a modified
copy of the libheif worker built into heic-to 1.6.6. It contains:

  - libheif 1.23.6   https://github.com/strukturag/libheif/tree/v1.23.6   LGPL-3.0
  - libde265 1.0.16  https://github.com/strukturag/libde265/tree/v1.0.16  LGPL-3.0
  - heic-to 1.6.6    https://github.com/hoppergee/heic-to/tree/v1.6.6     LGPL-3.0

These libraries are free software under the GNU Lesser General Public License,
version 3 (LGPL-3.0.txt), which supplements the GNU General Public License,
version 3 (GPL-3.0.txt). Both texts are in this folder and in the source archive.

Build of the unmodified worker (heic-to README, "How to build libheif.js"):

  cd libheif && mkdir buildjs && cd buildjs
  LIBDE265_VERSION=1.0.16 USE_UNSAFE_EVAL=0 USE_WASM=0 ../build-emscripten.sh ..

heic-to bundles that output in dist/csp/heic-to.js as a string and starts it as
a Worker from a blob: URL. CircleCrop takes that string at build time
(heic-worker-vite-plugin.ts) and serves it as a file of its own origin, with
two modifications (libheif-patch.ts), each applied to exactly one target:

  1. primary-item: decode the primary image item (is_primary()) instead of the
     first top-level item:
       let X=Y[0],      ->  let X=Y.find(i=>i.is_primary())||Y[0],
  2. transfer: transfer the decoded frame's buffer to the caller instead of
     copying it:
       postMessage({id,imageData,error:""})
         -> postMessage({id,imageData,error:""},[imageData.data.buffer])

The modified worker, heic-worker-vite-plugin.ts and libheif-patch.ts are
distributed under the LGPL-3.0. The complete corresponding source is served
from this site, for as long as the worker is served, as
libheif-source-1.23.6.tar.xz: the heic-to v1.6.6, libheif v1.23.6 (with
build-emscripten.sh) and libde265 v1.0.16 source archives, this notice, the
build line above, both licence texts and the two CircleCrop files.

You may replace libheif-<hash>.worker.js with any compatible build of libheif:
the site loads it as a separate same-origin Worker file that answers the message
{ id, buffer } with { id, imageData, error }.
