diff --git a/README.md b/README.md index fe463c9..ee71e03 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LuPhoto -LuPhoto serves photos.luciochen.com. It is one Go program that reads album folders, cuts every photo into 512 px WebP tiles at several resolutions with libvips, and publishes a static site in which the browser stitches the visible tiles back together on a canvas. Design: [docs/DESIGN.md](docs/DESIGN.md). +LuPhoto serves photos.luciochen.com. It is one Go program that reads album folders, cuts every photo into WebP tiles at several resolutions with libvips (at most 512 px, at least a 3 × 3 grid per level), and publishes a static site in which the browser stitches the visible tiles back together on a canvas. A one-time robot check unlocks the tile maps; see [Protection](#protection). Design: [docs/DESIGN.md](docs/DESIGN.md). ## Commands @@ -79,26 +79,42 @@ Unknown fields are errors, so typos are caught. | `paths.albums` | `"/srv/luphoto/albums"` | Album folders. Read only. | | `paths.output` | root or systemd: `/var/lib/luphoto/site`, else `$XDG_DATA_HOME/luphoto/site` | Builds, tiles, `current`. The site key and per-photo records go to `state/` next to it. | | `paths.cache` | root or systemd: `/var/cache/luphoto`, else the user cache dir | Temporary vips files. | -| `images.tile_size` | `512` | Tile edge in pixels. | -| `images.overlap` | `1` | Tile overlap in pixels. | +| `images.tile_size` | `512` | Largest tile edge in pixels. Each level uses min(`tile_size`, short edge ÷ `min_grid`), at least 1 px. | +| `images.min_grid` | `3` | Minimum tile columns and rows per level (1–8). Levels whose short edge would drop below it are not made. Changing it reprocesses everything. | +| `images.overlap` | `1` | Tile overlap in pixels; 0 on levels whose tile is at most twice as wide, and always 0 while `scramble_cells` is on. | | `images.format` | `"webp"` | `"webp"` or `"avif"` (AVIF needs a libheif AV1 encoder). | | `images.quality` | `{ top = 90, mid = 88, low = 88 }` | Top two levels, levels above 1100 px, levels up to 1100 px. | | `images.min_levels` | `6` | Minimum pyramid depth. | | `images.seed_px` | `48` | Long edge of the blurred placeholder. | | `images.tile_names` | `"hashed"` | Only `"hashed"` in v1. | -| `images.scramble_cells` | `false` | Shuffle the 64 px cells inside each tile with a per-photo key; the browser restores them when it decodes a tile. Forces tile overlap 0. Changing it reprocesses everything. | +| `images.scramble_cells` | `true` | Shuffle the 64 px cells inside each tile with a per-photo key; the browser restores them when it decodes a tile. Tiles under two cells wide or high are left alone. Forces tile overlap 0. Changing it reprocesses everything. | | `loading.budget_ms` | `3000` | Time budget per photo in the browser. | | `loading.max_dpr` | `2.0` | Highest device pixel ratio the loader honours. | | `loading.concurrency` | `6` | Parallel tile requests. | | `build.watch` | `true` | Watch the albums folder in `serve` and `export`. | | `build.debounce` | `"30s"` | Quiet time after the last change before rebuilding. | | `build.workers` | `2` | Photos processed in parallel. vips threads per photo = CPUs ÷ workers. | -| `build.keep_builds` | `3` | Builds kept; tiles no kept build uses are deleted. | +| `build.keep_builds` | `3` | Builds kept; tile folders and decoys no kept build uses are deleted. | | `protection.block_context_menu` | `true` | Disable the context menu on photos. | | `protection.hotlink_allow` | `["photos.luciochen.com"]` | Hosts allowed as `Referer` for `/t/*`; empty Referers and the site's own host are always allowed. | +| `protection.decoys` | `4` | Decoy tiles per real tile in each photo folder (0–16); 0 turns decoys off. | +| `protection.gate` | `true` | Show the press-and-hold robot check before photos unlock. `false` publishes the key in the clear and shows no check. | +| `protection.pow_bits` | `20` | Proof-of-work size for the robot check (10–26); each extra bit doubles the average work. | The watcher ignores dotfiles (including rsync's `.name.XXXXXX` temp files), `*.part`, `*.tmp` and editor backups. vips runs at `nice +5` so processing does not starve the web server. +## Protection + +Everything stays static files, so export mode, Caddy, nginx and Cloudflare caching of `/t/` keep working. What a build adds on top of hashed tile names: + +- **Small tiles.** Every level of every photo and cover is cut into at least a 3 × 3 grid (`images.min_grid`), so no single file is a usable picture, not even the small levels. +- **Decoys.** Each photo folder `/t//` also holds `protection.decoys` × as many decoy files as it has real tiles: hard links (copies if linking fails) to real tiles of other photos, from other albums first, with tile sizes as close as possible. A decoy name is an HMAC of the photo, level, slot and source tile, so a name never changes its bytes and `/t/` stays immutable. Decoys are chosen after all photos are processed; unchanged photos keep their decoys from build to build. +- **Sealed maps.** The album manifest and index carry only layout (sizes, tile grid, captions, EXIF). Which file sits where lives in one small JSON per photo and cover, `/a//p/..json`, fetched when that photo is near: per level the shuffled pool of real and decoy ids, plus a `sealed` payload (the blurred seed, the cell-scramble seed, the grid→pool map and tile byte sizes) encrypted with a SHA-256 counter-mode keystream. +- **Robot check.** Each build picks a random salt and a random `n` below 2^`pow_bits`. The key is SHA-256("luphoto-key" | salt | n); only a 16-byte check value is published. On the first visit a small card asks the visitor to press and hold for 0.9 s while a Web Worker finds `n` (at 20 bits about 0.1–0.25 s in desktop V8; phones are several times slower). The pass is kept in `localStorage` for that build. Until it is unlocked, each photo shows a jumble of tiles drawn from its pool. +- **Cell scrambling** (`images.scramble_cells`, on by default), the hotlink rule on `/t/*`, no context menu, and `robots.txt` with `Disallow: /t/` and `Disallow: /a/*/p/`. + +Limits: this raises the cost of bulk downloading; it does not prevent it. A determined scraper that drives a real browser, or reimplements the client, can solve the check in a fraction of a second, decrypt the maps and stitch the tiles; and decoys are byte-identical copies of other photos' tiles, so a crawler that downloads every folder can tell which files are shared. Every visitor's browser must be able to draw the photos, so it always has everything needed to do so. + ## Install ### Ubuntu 22.04 / 24.04, Debian 12 @@ -135,7 +151,7 @@ rsync writes to dotted temp names and renames at the end, which the watcher igno ## Web server - **Serve mode**: LuPhoto serves `current` itself with the right headers (immutable caching for `/t/`, `/og/`, `/assets/`; one minute for HTML and JSON; CSP; hotlink 403 on `/t/*`; precompressed gzip; no directory listings; `404.html` for missing paths). Put Caddy (`packaging/Caddyfile.serve`), nginx (`packaging/nginx.serve.conf`) or a Cloudflare Tunnel in front. -- **Export mode**: serve `/var/lib/luphoto/site/current` with `packaging/Caddyfile` or `packaging/nginx.conf`. Each build writes `.gz` files next to HTML, JSON, JS, CSS and SVG for `precompressed gzip` / `gzip_static`. +- **Export mode**: serve `/var/lib/luphoto/site/current` with `packaging/Caddyfile` or `packaging/nginx.conf`. Each build writes `.gz` files next to HTML, JSON, JS, CSS and SVG for `precompressed gzip` / `gzip_static`. Each build also writes `robots.txt`; serve mode serves the same file. - **Cloudflare**: `packaging/cloudflared.yml` and `packaging/cloudflare.md` (cache rules). ## Building from source @@ -173,8 +189,10 @@ This type-checks with `tsc --noEmit` (strict) and bundles with esbuild. Fonts ar /var/lib/luphoto/ site/ current -> builds/ - builds//index.html, 404.html, index..json, a//index.html, a//manifest..json, assets/, t -> ../../t, og -> ../../og (plus .gz copies) - t//.webp + builds//index.html, 404.html, robots.txt, index..json, a//index.html, a//manifest..json, + a//p/..json, assets/, t -> ../../t, og -> ../../og (plus .gz copies) + builds//.refs every pool id per photo folder, read by the cleanup to find stale decoys (never served) + t//.webp real tiles and decoys (hard links), unordered og/.jpg state/ site.key diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 9892ccb..1aece26 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -1,8 +1,8 @@ # LuPhoto design -LuPhoto serves photos.luciochen.com. It is one Go program that reads album folders from disk, cuts every photo into fixed 512 px tiles at several resolutions, and publishes a fully static, Lucio-branded site that a browser stitches back together on a canvas. No editing, comments, likes, themes, templating or camera RAW support. +LuPhoto serves photos.luciochen.com. It is one Go program that reads album folders from disk, cuts every photo into tiles of at most 512 px (at least 3 × 3 per level) at several resolutions, and publishes a fully static, Lucio-branded site that a browser stitches back together on a canvas. No editing, comments, likes, themes, templating or camera RAW support. -Decisions: name LuPhoto (binary, user and paths lowercase `luphoto`), Go, no resolution cap, hashed tile names in v1, cell scrambling optional and off, JPEGs not listed in album.json are hidden. +Decisions: name LuPhoto (binary, user and paths lowercase `luphoto`), Go, no resolution cap, hashed tile names in v1, cell scrambling on by default, decoy tiles and a sealed tile map behind a one-time robot check, JPEGs not listed in album.json are hidden. ## Architecture @@ -53,20 +53,29 @@ uploads (rsync/SFTP) -> /srv/luphoto/albums -> watcher (debounce) -> processor ( 1. Autorotate by EXIF orientation, convert to sRGB from the embedded profile. 2. Read camera, lens, focal length, aperture, shutter, ISO and date into the manifest. Drop everything else, including GPS. Tiles carry no metadata. -3. Pyramid: tiles 512 px, 1 px overlap; each level halves the previous one until the long edge is under 100 px. Level 0 is the smallest. +3. Pyramid: each level halves the previous one until the long edge is under 100 px (at least `min_levels` levels), but never below a short edge of `min_grid` px. Level 0 is the smallest. Each level has its own tile size, min(`tile_size` 512, ⌊short edge ÷ `min_grid` 3⌋), at least 1 px, so every level is a grid of at least 3 × 3 tiles; covers (32:9) are usually 11 × 3 at every level. Overlap 1 px, 0 when the tile is at most twice the overlap and always 0 with cell scrambling. `dzsave` cuts one level at a time with that level's tile size. 4. WebP by default (AVIF optional); WebP tiles and the seed are saved with `smart_subsample` so chroma stays sharp. Quality per level: `top` for the top two levels, `low` for levels whose long edge is at most 1100 px, `mid` otherwise. -5. Seed: a 48 px (long edge) WebP, base64 inside the album manifest. +5. Seed: a 48 px (long edge) WebP, kept in the per-photo record and published only inside the sealed payload. 6. No resolution cap: the full-resolution level is stored; the loader never fetches beyond screen size × max_dpr. -7. Tile paths: `/t//.webp`. photo-hash = first 16 hex of SHA-256 over the original bytes + a processing-settings fingerprint. tile-id = first 16 hex of HMAC-SHA-256(site key, photo-hash|level|x|y). The site key is generated once and kept in the state folder. On disk and in developer tools the tiles are an unordered pile of patches; only the manifest maps them back. -8. Album manifest `/a//manifest..json`: per photo width, height, level sizes, tile grid per level, tile ids in row-major order per level, byte size of every tile, caption, title, alt, EXIF, slides, seed. Covers are pyramids too and are described in `/index..json`. +7. Tile paths: `/t//.webp`. photo-hash = first 16 hex of SHA-256 over the original bytes + a processing-settings fingerprint (which includes `min_grid` and `scramble_cells`). tile-id = first 16 hex of HMAC-SHA-256(site key, photo-hash|level|x|y). The site key is generated once and kept in the state folder. Each folder also holds decoys (below), so on disk and in developer tools a folder is an unordered pile of patches from many photos. +8. Album manifest `/a//manifest..json`: layout only. Per photo width, height, per level width, height, tile size, cols, rows (and overlap when not 0), caption, title, alt, EXIF, slides, plus the build's `gate` record. Covers are pyramids too and are described in `/index..json`. Tile ids, byte sizes, the seed and the scramble seed are not in it. -Incremental: a photo is reprocessed only when its photo-hash is new. Each build writes `builds//` (HTML, manifests, assets, `404.html`, and a `.gz` copy of every HTML, JSON, JS, CSS and SVG file for precompressed serving) next to a shared `t/` tile folder and a shared `og/` folder of 1200×630 Open Graph JPEGs cut around each album cover (the only non-tiled images; derived, small, metadata stripped); the `current` symlink flips only when the build is complete. Keep the last `keep_builds` builds; delete tile folders no kept build references. Write everything to temporary names and rename, so readers never see partial files. +Incremental: a photo is reprocessed only when its photo-hash is new. Each build writes `builds//` (HTML, manifests, per-photo pool files, assets, `404.html`, `robots.txt`, `.refs`, and a `.gz` copy of every HTML, JSON, JS, CSS and SVG file for precompressed serving) next to a shared `t/` tile folder and a shared `og/` folder of 1200×630 Open Graph JPEGs cut around each album cover (the only non-tiled images; derived, small, metadata stripped); the `current` symlink flips only when the build is complete. Keep the last `keep_builds` builds; delete tile folders no kept build references, and inside live folders delete files no kept build's `.refs` lists. Write everything to temporary names and rename, so readers never see partial files (pool files are written straight into the unpublished stage folder). -Storage: about 1.33× the top level, roughly 6–10 MB of tiles per Z8 photo. +Storage: about 1.33× the top level, roughly 6–10 MB of tiles per Z8 photo. Decoys are hard links and cost directory entries, not bytes; small low-level tiles cost some filesystem block overhead. + +## Protection step (per build, after all photos are processed) + +1. Gate: random 16-byte salt and random n < 2^`pow_bits`. Key s = SHA-256("luphoto-key" | salt | n as 4 bytes big-endian). Published in the index and every manifest: `{build, salt, bits, check}` with check = first 16 bytes of SHA-256("luphoto-check" | salt | n). With `gate = false`: `{build, key}` and no robot check, same code path. +2. Decoys: all live pyramids (photos and covers of every published album, carried albums included) are indexed by tile size; each pyramid's primary album is the first album, in index order, that uses it. For each level with R real tiles, `decoys` × R slots are filled from the bucket whose tile size is closest to the level's, taking candidates from other albums first, then other photos of the same album, then (single-pyramid site only) the photo itself. A slot's source is the next tile on a ring ordered by tile id after a target drawn from a PRNG keyed by HMAC(site key, "pick"|hash|level), skipping ineligible or already used tiles, so selections are stable while the site does not change. Decoy name = first 16 hex of HMAC-SHA-256(site key, "decoy"|photo-hash|level|slot|source tile id). The file is a hard link to the source tile (a copy if linking fails); names already present in the folder are reused (one `ReadDir` per folder). +3. Pool: per level the real ids and decoy names, shuffled with a PRNG keyed by HMAC(site key, "pool"|hash|level), written as one string of 16-hex ids. +4. Seal: plaintext = "luphoto-sealed-1" (16 bytes) + JSON `{seed, scramble, levels: [{map, bytes}]}` where `map` turns a row-major grid index into a pool index. Ciphertext = plaintext XOR keystream, block i = SHA-256(s | nonce | i as 4 bytes big-endian), 12-byte random nonce in front, base64. +5. `/a//p/..json` = `{levels: [pool strings], sealed}` for every photo and the cover of each album; build-named like the manifests, so a new build never pairs with a cached pool. `builds//.refs` lists every pool id per folder (8-byte binary) for the cleanup. ## Loading in the browser -1. Seed (≈0 ms): the manifest is loaded; draw the seed scaled and blurred. +0. Gate: if the gate is on and `localStorage` has no pass for this build, the robot-check card is shown at once and a Web Worker (the tile worker script, a separate instance) brute-forces n with an allocation-free SHA-256 (midstate of the first 7 rounds and the constant schedule words precomputed). Each photo's pool file is fetched when the photo or cover is near. Until unlocked, or when a pool cannot be opened, the photo shows its probe level filled with random pool entries drawn into the grid cells (one fetch per cell at most). After unlocking, pools are decrypted lazily on the main thread (a few hundred SHA-256 blocks per photo), the seed fades in over the jumble, and the real tiles follow as below. +1. Seed: draw the seed scaled and blurred. 2. Needed level: smallest level whose width ≥ displayed width × min(devicePixelRatio, max_dpr). 3. Probe: fetch 1–2 tiles of the level about 1/8 of the needed one; measure throughput; blend with earlier measurements kept in sessionStorage. 4. Final level: highest level up to the needed one whose visible-tile bytes ÷ throughput ≤ (budget − elapsed) × 0.8. If it is 2+ levels above the probe, fetch one intermediate level first. @@ -87,7 +96,11 @@ Lucio brand (source of truth: ../LUCIO_ip): graphite #111114 ground, paper #F3F1 ## Discouraging saves -No `` for photos, only canvas. Output never contains an original. Right-click, drag, selection and long-press callouts are disabled. Hashed tile names (above). Optional `scramble_cells` (off): shuffle the full 64 px cells inside each tile with a per-photo key (HMAC of the site key and photo-hash, then a seeded Fisher–Yates per tile; tile overlap is 0 when on); the client restores each tile once when it decodes it, before it is cached and drawn. Hotlink: Referer check on `/t/*` in the built-in server and the Caddy/nginx examples; an empty Referer and the site's own host are allowed. +No `` for photos, only canvas. Output never contains an original. Right-click, drag, selection and long-press callouts are disabled. Hashed tile names, at least 3 × 3 tiles per level, decoys and sealed maps behind the robot check (above). `scramble_cells` (on by default): shuffle the full 64 px cells inside each tile with a per-photo key (HMAC of the site key and photo-hash, then a seeded Fisher–Yates per tile; tiles under two cells wide or high are left alone; tile overlap is 0 when on); the scramble seed travels only inside the sealed payload, and the client restores each tile once when it decodes it, before it is cached and drawn. Hotlink: Referer check on `/t/*` in the built-in server and the Caddy/nginx examples; an empty Referer and the site's own host are allowed. `robots.txt` disallows `/t/` and `/a/*/p/`. + +Robot check card (index and album pages, only without a pass for the current build): graphite-2 card, mono eyebrow "Photos · Lucio", the line "Press and hold to see the photos" in Bricolage Grotesque, and an 88 px round button with a beam progress ring. Holding for 900 ms (pointer, or Space/Enter while focused) completes it; releasing early resets the ring. If the worker is still searching, the ring turns indeterminate until it finishes. The rest of the page is `inert` while the card is up; focus starts on the button and returns to the page afterwards. The pass `{build, s}` is kept in `localStorage` (memory if storage is blocked); a pass that fails to open a pool is dropped and the card comes back. Reduced motion: no spin, no fade. + +Limits: this raises the cost of bulk downloading; it cannot stop a scraper that drives a real browser or reimplements the client, and decoys are byte-identical to tiles of other photos, so crawling every folder reveals which files are shared. ## Config `/etc/luphoto/config.toml` @@ -110,7 +123,8 @@ quality = { top = 90, mid = 88, low = 88 } min_levels = 6 seed_px = 48 tile_names = "hashed" -scramble_cells = false +scramble_cells = true +min_grid = 3 [loading] budget_ms = 3000 @@ -126,6 +140,9 @@ keep_builds = 3 [protection] block_context_menu = true hotlink_allow = ["photos.luciochen.com"] +decoys = 4 +gate = true +pow_bits = 20 ``` Defaults when a path is missing: running as root or under systemd uses `/var/lib/luphoto/site` and `/var/cache/luphoto`; otherwise `$XDG_DATA_HOME/luphoto/site` and `$XDG_CACHE_HOME/luphoto` (Go `os.UserCacheDir` equivalents). The site key and the per-photo processing records live in the state folder (`state/`) next to the output. SIGHUP re-reads the config and rebuilds. The watcher ignores `.part`, `.tmp`, dotfiles and rsync temp names. diff --git a/internal/build/build.go b/internal/build/build.go index b5783a5..9f213b6 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "io" + "io/fs" "log" "math" "os" @@ -21,6 +22,7 @@ import ( "github.com/luciochen233/luphoto/internal/config" "github.com/luciochen233/luphoto/internal/fsutil" "github.com/luciochen233/luphoto/internal/process" + "github.com/luciochen233/luphoto/internal/protect" "github.com/luciochen233/luphoto/internal/site" ) @@ -37,6 +39,8 @@ type Summary struct { BytesWritten int64 BuildsRemoved int TilesRemoved int + DecoysLinked int + DecoysRemoved int Duration time.Duration } @@ -52,6 +56,7 @@ type albumPlan struct { failed []string problem string manifest *site.Manifest + records []*process.Record carriedOut bool } @@ -253,8 +258,9 @@ func (b *builder) run(ctx context.Context) (*Summary, error) { continue } sum.Skipped++ - if m := b.carryOver(previous, plan.album.Slug, id); m != nil { + if m, recs := b.carryOver(previous, plan.album.Slug, id); m != nil { plan.manifest = m + plan.records = recs plan.carriedOut = true sum.Carried++ b.log.Printf("skip album %s: %s (previous version stays live)", plan.album.Slug, plan.problem) @@ -263,33 +269,57 @@ func (b *builder) run(ctx context.Context) (*Summary, error) { } } - var manifests []*site.Manifest + var published []*albumPlan for _, plan := range plans { if plan.manifest != nil { - manifests = append(manifests, plan.manifest) + published = append(published, plan) } } - sort.SliceStable(manifests, func(i, j int) bool { + sort.SliceStable(published, func(i, j int) bool { + mi, mj := published[i].manifest, published[j].manifest return album.Before( - album.SortKey{Order: manifests[i].Order, Date: manifests[i].Date, Slug: manifests[i].Slug}, - album.SortKey{Order: manifests[j].Order, Date: manifests[j].Date, Slug: manifests[j].Slug}) + album.SortKey{Order: mi.Order, Date: mi.Date, Slug: mi.Slug}, + album.SortKey{Order: mj.Order, Date: mj.Date, Slug: mj.Slug}) }) - for _, m := range manifests { - if m.Hidden { + manifests := make([]*site.Manifest, len(published)) + var lives []*live + seenLive := map[string]bool{} + for i, plan := range published { + manifests[i] = plan.manifest + if plan.manifest.Hidden { sum.Hidden++ } + for _, rec := range plan.records { + if !seenLive[rec.Hash] { + seenLive[rec.Hash] = true + lives = append(lives, &live{rec: rec, album: i}) + } + } } sum.Albums = len(manifests) - if err := b.writeBuild(id, manifests); err != nil { + gate, err := protect.NewGate(b.cfg.Protection.PowBits, b.cfg.Protection.Gate) + if err != nil { + return nil, err + } + poolStart := time.Now() + pools, linked, err := b.pools(lives, gate) + if err != nil { + return nil, fmt.Errorf("decoys: %w", err) + } + sum.DecoysLinked = linked + b.log.Printf("protect: %d pools sealed, %d decoys linked in %s", len(pools), linked, round(time.Since(poolStart))) + + if err := b.writeBuild(id, manifests, gate, lives, pools); err != nil { return nil, err } if err := fsutil.SymlinkAtomic(filepath.Join("builds", id), b.current); err != nil { return nil, fmt.Errorf("switch current: %w", err) } - removedBuilds, removedTiles, err := b.cleanup(id) + removedBuilds, removedTiles, removedDecoys, err := b.cleanup(id) sum.BuildsRemoved = removedBuilds sum.TilesRemoved = removedTiles + sum.DecoysRemoved = removedDecoys if err != nil { b.log.Printf("cleanup: %v", err) } @@ -337,19 +367,10 @@ func coverCrop(c *album.Cover, width, height int) ([4]int, error) { return [4]int{x, y, max(1, w), max(1, h)}, nil } -func (b *builder) overlap() int { - if b.cfg.Images.ScrambleCells { - return 0 - } - return b.cfg.Images.Overlap -} - func (b *builder) tiles() site.Tiles { tiles := site.Tiles{ - Format: b.cfg.Images.Format, - TileSize: b.cfg.Images.TileSize, - Overlap: b.overlap(), - Path: "/t/", + Format: b.cfg.Images.Format, + Path: "/t/", } if b.cfg.Images.ScrambleCells { tiles.Scrambled = true @@ -360,7 +381,6 @@ func (b *builder) tiles() site.Tiles { func (b *builder) manifest(id string, plan *albumPlan, records map[string]*process.Record) *site.Manifest { a := plan.album - cover := records[plan.coverHash].Pyramid m := &site.Manifest{ Build: id, Slug: a.Slug, @@ -372,14 +392,16 @@ func (b *builder) manifest(id string, plan *albumPlan, records map[string]*proce CollapsedFocusY: *a.CollapsedFocusY, ShowEXIF: *a.ShowEXIF, Tiles: b.tiles(), - Cover: &cover, + Cover: site.Layout(&records[plan.coverHash].Pyramid), OG: plan.ogHash, Photos: make([]site.Photo, len(a.Photos)), } + plan.records = make([]*process.Record, 0, len(a.Photos)+1) for i, photo := range a.Photos { rec := records[plan.hashes[i]] + plan.records = append(plan.records, rec) p := site.Photo{ - Pyramid: rec.Pyramid, + Pyramid: *site.Layout(&rec.Pyramid), Title: photo.Title, Caption: photo.Caption, Alt: photo.Alt, @@ -392,6 +414,7 @@ func (b *builder) manifest(id string, plan *albumPlan, records map[string]*proce } m.Photos[i] = p } + plan.records = append(plan.records, records[plan.coverHash]) return m } @@ -407,17 +430,35 @@ func (b *builder) previousBuild() string { return id } -func (b *builder) carryOver(previous, slug, id string) *site.Manifest { +func (b *builder) carryOver(previous, slug, id string) (*site.Manifest, []*process.Record) { if previous == "" { - return nil + return nil, nil } var m site.Manifest path := filepath.Join(b.builds, previous, "a", slug, site.ManifestName(previous)) - if err := fsutil.ReadJSON(path, &m); err != nil || m.Slug != slug || m.Tiles != b.tiles() { - return nil + if err := fsutil.ReadJSON(path, &m); err != nil || m.Slug != slug || m.Tiles != b.tiles() || m.Cover == nil { + return nil, nil + } + hashes := make([]string, 0, len(m.Photos)+1) + for _, p := range m.Photos { + hashes = append(hashes, p.Hash) + } + hashes = append(hashes, m.Cover.Hash) + records := make([]*process.Record, len(hashes)) + for i, hash := range hashes { + rec, ok := b.proc.Lookup(hash) + if !ok || len(rec.Levels) == 0 { + return nil, nil + } + for _, level := range rec.Levels { + if level.TileSize <= 0 || len(level.Tiles) != level.Cols*level.Rows { + return nil, nil + } + } + records[i] = rec } m.Build = id - return &m + return &m, records } func newBuildID() (string, error) { @@ -428,7 +469,7 @@ func newBuildID() (string, error) { return time.Now().UTC().Format("20060102-150405") + "-" + hex.EncodeToString(suffix[:]), nil } -func (b *builder) writeBuild(id string, manifests []*site.Manifest) error { +func (b *builder) writeBuild(id string, manifests []*site.Manifest, gate *protect.Gate, lives []*live, pools map[string]*pool) error { stage := fsutil.TempName(filepath.Join(b.builds, id)) if err := os.MkdirAll(filepath.Join(stage, "a"), 0o755); err != nil { return err @@ -454,11 +495,26 @@ func (b *builder) writeBuild(id string, manifests []*site.Manifest) error { MaxDPR: b.cfg.Loading.MaxDPR, Concurrency: b.cfg.Loading.Concurrency, BlockContextMenu: b.cfg.Protection.BlockContextMenu, + Gate: gate.Enabled, BaseURL: strings.TrimRight(b.cfg.Server.BaseURL, "/"), } - index := &site.Index{Build: id, Tiles: b.tiles(), Albums: []site.IndexAlbum{}} + public := &site.Gate{Build: id} + if gate.Enabled { + public.Salt, public.Bits, public.Check = gate.SaltHex(), gate.Bits, gate.CheckHex() + } else { + public.Key = gate.KeyHex() + } + if err := fsutil.WriteFileAtomic(filepath.Join(stage, "robots.txt"), []byte(site.Robots), 0o644); err != nil { + return err + } + if err := writeRefs(filepath.Join(stage, refsName), lives, pools); err != nil { + return err + } + + index := &site.Index{Build: id, Tiles: b.tiles(), Gate: public, Albums: []site.IndexAlbum{}} for _, m := range manifests { + m.Gate = public if m.Hidden { continue } @@ -485,10 +541,22 @@ func (b *builder) writeBuild(id string, manifests []*site.Manifest) error { limit <- struct{}{} defer func() { <-limit }() dir := filepath.Join(stage, "a", m.Slug) - if err := os.MkdirAll(dir, 0o755); err != nil { + poolDir := filepath.Join(dir, site.PoolDir) + if err := os.MkdirAll(poolDir, 0o755); err != nil { errs[i] = err return } + hashes := make([]string, 0, len(m.Photos)+1) + for _, p := range m.Photos { + hashes = append(hashes, p.Hash) + } + hashes = append(hashes, m.Cover.Hash) + for _, hash := range hashes { + if err := fsutil.WritePublic(filepath.Join(poolDir, site.PoolName(id, hash)), pools[hash].data); err != nil { + errs[i] = err + return + } + } data, err := fsutil.EncodeJSON(m) if err == nil { err = fsutil.WritePublicAtomic(filepath.Join(dir, site.ManifestName(id)), data) @@ -538,10 +606,10 @@ func (b *builder) writeBuild(id string, manifests []*site.Manifest) error { return nil } -func (b *builder) cleanup(id string) (int, int, error) { +func (b *builder) cleanup(id string) (int, int, int, error) { entries, err := os.ReadDir(b.builds) if err != nil { - return 0, 0, err + return 0, 0, 0, err } var names []string for _, entry := range entries { @@ -578,7 +646,7 @@ func (b *builder) cleanup(id string) (int, int, error) { for _, name := range kept { if err := collectRefs(filepath.Join(b.builds, name), name, refs, ogRefs); err != nil { errs = append(errs, fmt.Errorf("build %s unreadable, keeping all tiles: %w", name, err)) - return removed, 0, errors.Join(errs...) + return removed, 0, 0, errors.Join(errs...) } } tilesRemoved, err := b.proc.ForgetUnreferenced(refs) @@ -588,7 +656,20 @@ func (b *builder) cleanup(id string) (int, int, error) { if _, err := b.proc.ForgetOG(ogRefs); err != nil { errs = append(errs, err) } - return removed, tilesRemoved, errors.Join(errs...) + pooled := map[uint64][]uint64{} + for _, name := range kept { + if err := readRefs(filepath.Join(b.builds, name, refsName), pooled); err != nil { + if !errors.Is(err, fs.ErrNotExist) { + errs = append(errs, fmt.Errorf("build %s pool list unreadable, keeping all decoys: %w", name, err)) + } + return removed, tilesRemoved, 0, errors.Join(errs...) + } + } + decoysRemoved, err := b.sweepDecoys(pooled) + if err != nil { + errs = append(errs, err) + } + return removed, tilesRemoved, decoysRemoved, errors.Join(errs...) } type pyramidRef struct { @@ -658,6 +739,6 @@ func megabytes(n int64) string { } func (s *Summary) String() string { - return fmt.Sprintf("build %s: %d albums (%d hidden, %d skipped, %d kept from previous build), %d pyramids processed (%d tiles, %s), %d cached, %d failed; removed %d old builds and %d tile folders; %s total", - s.ID, s.Albums, s.Hidden, s.Skipped, s.Carried, s.Processed, s.TilesWritten, megabytes(s.BytesWritten), s.Cached, s.Failed, s.BuildsRemoved, s.TilesRemoved, round(s.Duration)) + return fmt.Sprintf("build %s: %d albums (%d hidden, %d skipped, %d kept from previous build), %d pyramids processed (%d tiles, %s), %d cached, %d failed, %d decoys linked; removed %d old builds, %d tile folders and %d stale decoys; %s total", + s.ID, s.Albums, s.Hidden, s.Skipped, s.Carried, s.Processed, s.TilesWritten, megabytes(s.BytesWritten), s.Cached, s.Failed, s.DecoysLinked, s.BuildsRemoved, s.TilesRemoved, s.DecoysRemoved, round(s.Duration)) } diff --git a/internal/build/protect.go b/internal/build/protect.go new file mode 100644 index 0000000..06855cc --- /dev/null +++ b/internal/build/protect.go @@ -0,0 +1,426 @@ +package build + +import ( + "bufio" + "encoding/binary" + "errors" + "fmt" + "io" + "io/fs" + "os" + "path/filepath" + "runtime" + "slices" + "sort" + "strconv" + "strings" + "sync" + "sync/atomic" + + "github.com/luciochen233/luphoto/internal/fsutil" + "github.com/luciochen233/luphoto/internal/process" + "github.com/luciochen233/luphoto/internal/protect" + "github.com/luciochen233/luphoto/internal/site" +) + +const refsName = ".refs" + +type live struct { + rec *process.Record + album int +} + +type sourceTile struct { + pos uint64 + owner int32 + level int16 + index int32 +} + +type bucket struct { + size int + tiles []sourceTile + byAlbum map[int]int + byOwner map[int32]int +} + +type decoyIndex struct { + lives []*live + buckets []*bucket +} + +type pool struct { + data []byte + ids []uint64 +} + +type splitmix struct { + s uint64 +} + +func (r *splitmix) next() uint64 { + r.s += 0x9e3779b97f4a7c15 + z := r.s + z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9 + z = (z ^ (z >> 27)) * 0x94d049bb133111eb + return z ^ (z >> 31) +} + +func (r *splitmix) intn(n int) int { + return int(r.next() % uint64(n)) +} + +func newDecoyIndex(lives []*live) *decoyIndex { + idx := &decoyIndex{lives: lives} + bySize := map[int]*bucket{} + for owner, l := range lives { + for li, level := range l.rec.Levels { + b := bySize[level.TileSize] + if b == nil { + b = &bucket{size: level.TileSize, byAlbum: map[int]int{}, byOwner: map[int32]int{}} + bySize[level.TileSize] = b + idx.buckets = append(idx.buckets, b) + } + for i, id := range level.Tiles { + pos, err := strconv.ParseUint(id, 16, 64) + if err != nil { + continue + } + b.tiles = append(b.tiles, sourceTile{pos: pos, owner: int32(owner), level: int16(li), index: int32(i)}) + b.byAlbum[l.album]++ + b.byOwner[int32(owner)]++ + } + } + } + for _, b := range idx.buckets { + slices.SortFunc(b.tiles, func(x, y sourceTile) int { + switch { + case x.pos < y.pos: + return -1 + case x.pos > y.pos: + return 1 + } + return 0 + }) + } + sort.Slice(idx.buckets, func(i, j int) bool { return idx.buckets[i].size < idx.buckets[j].size }) + return idx +} + +type tier func(t sourceTile) bool + +func (idx *decoyIndex) pick(owner int32, size int) (*bucket, tier, int) { + album := idx.lives[owner].album + tiers := []struct { + eligible func(b *bucket) int + accept tier + }{ + {func(b *bucket) int { return len(b.tiles) - b.byAlbum[album] }, func(t sourceTile) bool { return idx.lives[t.owner].album != album }}, + {func(b *bucket) int { return len(b.tiles) - b.byOwner[owner] }, func(t sourceTile) bool { return t.owner != owner }}, + {func(b *bucket) int { return b.byOwner[owner] }, func(t sourceTile) bool { return t.owner == owner }}, + } + for _, t := range tiers { + var best *bucket + bestCount, bestDistance := 0, 0 + for _, b := range idx.buckets { + n := t.eligible(b) + if n == 0 { + continue + } + d := b.size - size + if d < 0 { + d = -d + } + if best == nil || d < bestDistance { + best, bestCount, bestDistance = b, n, d + } + } + if best != nil { + return best, t.accept, bestCount + } + } + return nil, nil, 0 +} + +func (b *builder) pools(lives []*live, gate *protect.Gate) (map[string]*pool, int, error) { + idx := newDecoyIndex(lives) + out := make([]*pool, len(lives)) + errs := make([]error, len(lives)) + var linked atomic.Int64 + var next atomic.Int64 + var wg sync.WaitGroup + for w := 0; w < min(runtime.NumCPU(), len(lives)); w++ { + wg.Add(1) + go func() { + defer wg.Done() + keyed := b.proc.Keyed() + for { + i := int(next.Add(1) - 1) + if i >= len(lives) { + return + } + p, n, err := b.pool(idx, int32(i), keyed, gate) + out[i], errs[i] = p, err + linked.Add(int64(n)) + } + }() + } + wg.Wait() + if err := errors.Join(errs...); err != nil { + return nil, 0, err + } + pools := make(map[string]*pool, len(lives)) + for i, l := range lives { + pools[l.rec.Hash] = out[i] + } + return pools, int(linked.Load()), nil +} + +type link struct { + name string + source string +} + +func (b *builder) pool(idx *decoyIndex, owner int32, keyed *process.Keyed, gate *protect.Gate) (*pool, int, error) { + rec := idx.lives[owner].rec + hash := rec.Hash + decoys := b.cfg.Protection.Decoys + public := site.Pool{Levels: make([]string, len(rec.Levels))} + sealed := site.Sealed{Seed: rec.Seed, Scramble: rec.Scramble, Levels: make([]site.SealedLevel, len(rec.Levels))} + var links []link + var ids []uint64 + used := map[int]bool{} + for li, level := range rec.Levels { + real := len(level.Tiles) + entries := make([]string, real, real*(decoys+1)) + copy(entries, level.Tiles) + if decoys > 0 { + src, accept, eligible := idx.pick(owner, level.TileSize) + if src != nil { + clear(used) + rng := splitmix{s: keyed.Seed("pick", hash, li)} + for slot := 0; slot < decoys*real; slot++ { + if len(used) >= eligible { + clear(used) + } + target := rng.next() + at := sort.Search(len(src.tiles), func(i int) bool { return src.tiles[i].pos >= target }) % len(src.tiles) + for step := 0; step < len(src.tiles); step++ { + j := (at + step) % len(src.tiles) + if !used[j] && accept(src.tiles[j]) { + at = j + break + } + } + used[at] = true + t := src.tiles[at] + from := idx.lives[t.owner].rec + sourceID := from.Levels[t.level].Tiles[t.index] + name := keyed.DecoyName(hash, li, slot, sourceID) + entries = append(entries, name) + links = append(links, link{name: name, source: filepath.Join(from.Hash, sourceID)}) + } + } + } + rng := splitmix{s: keyed.Seed("pool", hash, li)} + order := make([]int32, len(entries)) + for i := range order { + order[i] = int32(i) + } + for i := len(order) - 1; i > 0; i-- { + j := rng.intn(i + 1) + order[i], order[j] = order[j], order[i] + } + var text strings.Builder + text.Grow(len(entries) * 16) + m := make([]int32, real) + for at, from := range order { + text.WriteString(entries[from]) + if int(from) < real { + m[from] = int32(at) + } + if v, err := strconv.ParseUint(entries[from], 16, 64); err == nil { + ids = append(ids, v) + } + } + public.Levels[li] = text.String() + sealed.Levels[li] = site.SealedLevel{Map: m, Bytes: level.Bytes} + } + made, err := b.link(hash, links) + if err != nil { + return nil, made, err + } + plain, err := fsutil.EncodeJSON(sealed) + if err != nil { + return nil, made, err + } + public.Sealed, err = protect.Seal(gate.Key, plain) + if err != nil { + return nil, made, err + } + data, err := fsutil.EncodeJSON(public) + if err != nil { + return nil, made, err + } + return &pool{data: data, ids: ids}, made, nil +} + +func (b *builder) link(hash string, links []link) (int, error) { + if len(links) == 0 { + return 0, nil + } + dir := filepath.Join(b.proc.TilesDir, hash) + entries, err := os.ReadDir(dir) + if err != nil { + return 0, err + } + ext := b.proc.Ext() + have := make(map[string]bool, len(entries)) + for _, entry := range entries { + have[entry.Name()] = true + } + made := 0 + for _, l := range links { + name := l.name + ext + if have[name] { + continue + } + have[name] = true + target := filepath.Join(dir, name) + source := filepath.Join(b.proc.TilesDir, l.source+ext) + if err := os.Link(source, target); err != nil { + if errors.Is(err, fs.ErrExist) { + continue + } + if err := copyFile(source, target); err != nil { + return made, fmt.Errorf("decoy %s: %w", name, err) + } + } + made++ + } + return made, nil +} + +func copyFile(source, target string) error { + in, err := os.Open(source) + if err != nil { + return err + } + defer in.Close() + return fsutil.WriteAtomic(target, 0o644, func(w io.Writer) error { + _, err := io.Copy(w, in) + return err + }) +} + +func writeRefs(path string, lives []*live, pools map[string]*pool) error { + return fsutil.WriteAtomic(path, 0o644, func(w io.Writer) error { + var head [12]byte + var word [8]byte + for _, l := range lives { + h, err := strconv.ParseUint(l.rec.Hash, 16, 64) + if err != nil { + return err + } + ids := pools[l.rec.Hash].ids + binary.LittleEndian.PutUint64(head[:8], h) + binary.LittleEndian.PutUint32(head[8:], uint32(len(ids))) + if _, err := w.Write(head[:]); err != nil { + return err + } + for _, id := range ids { + binary.LittleEndian.PutUint64(word[:], id) + if _, err := w.Write(word[:]); err != nil { + return err + } + } + } + return nil + }) +} + +func readRefs(path string, into map[uint64][]uint64) error { + f, err := os.Open(path) + if err != nil { + return err + } + defer f.Close() + r := bufio.NewReaderSize(f, 256<<10) + var head [12]byte + for { + if _, err := io.ReadFull(r, head[:]); err != nil { + if errors.Is(err, io.EOF) { + return nil + } + return err + } + h := binary.LittleEndian.Uint64(head[:8]) + n := int(binary.LittleEndian.Uint32(head[8:])) + buf := make([]byte, n*8) + if _, err := io.ReadFull(r, buf); err != nil { + return err + } + ids := into[h] + for i := 0; i < n; i++ { + ids = append(ids, binary.LittleEndian.Uint64(buf[i*8:])) + } + into[h] = ids + } +} + +func (b *builder) sweepDecoys(refs map[uint64][]uint64) (int, error) { + hashes := make([]uint64, 0, len(refs)) + for h := range refs { + hashes = append(hashes, h) + } + ext := b.proc.Ext() + var removed atomic.Int64 + var next atomic.Int64 + errs := make([]error, runtime.NumCPU()) + var wg sync.WaitGroup + for w := range errs { + wg.Add(1) + go func(w int) { + defer wg.Done() + for { + i := int(next.Add(1) - 1) + if i >= len(hashes) { + return + } + keep := refs[hashes[i]] + slices.Sort(keep) + dir := filepath.Join(b.proc.TilesDir, fmt.Sprintf("%016x", hashes[i])) + entries, err := os.ReadDir(dir) + if err != nil { + if !errors.Is(err, fs.ErrNotExist) && errs[w] == nil { + errs[w] = err + } + continue + } + for _, entry := range entries { + name := entry.Name() + id, ok := strings.CutSuffix(name, ext) + if !ok || len(id) != 16 { + continue + } + v, err := strconv.ParseUint(id, 16, 64) + if err != nil { + continue + } + if _, found := slices.BinarySearch(keep, v); found { + continue + } + if err := os.Remove(filepath.Join(dir, name)); err != nil { + if errs[w] == nil { + errs[w] = err + } + continue + } + removed.Add(1) + } + } + }(w) + } + wg.Wait() + return int(removed.Load()), errors.Join(errs...) +} diff --git a/internal/config/config.go b/internal/config/config.go index 30a0a6c..5edb158 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -54,6 +54,7 @@ type Images struct { SeedPx int `toml:"seed_px"` TileNames string `toml:"tile_names"` ScrambleCells bool `toml:"scramble_cells"` + MinGrid int `toml:"min_grid"` } type Loading struct { @@ -72,6 +73,9 @@ type Build struct { type Protection struct { BlockContextMenu bool `toml:"block_context_menu"` HotlinkAllow []string `toml:"hotlink_allow"` + Decoys int `toml:"decoys"` + Gate bool `toml:"gate"` + PowBits int `toml:"pow_bits"` } type Duration struct { @@ -102,13 +106,15 @@ func Defaults() Config { Albums: "/srv/luphoto/albums", }, Images: Images{ - TileSize: 512, - Overlap: 1, - Format: "webp", - Quality: Quality{Top: 90, Mid: 88, Low: 88}, - MinLevels: 6, - SeedPx: 48, - TileNames: "hashed", + TileSize: 512, + Overlap: 1, + Format: "webp", + Quality: Quality{Top: 90, Mid: 88, Low: 88}, + MinLevels: 6, + SeedPx: 48, + TileNames: "hashed", + ScrambleCells: true, + MinGrid: 3, }, Loading: Loading{ BudgetMS: 3000, @@ -124,6 +130,9 @@ func Defaults() Config { Protection: Protection{ BlockContextMenu: true, HotlinkAllow: []string{"photos.luciochen.com"}, + Decoys: 4, + Gate: true, + PowBits: 20, }, } } @@ -255,6 +264,9 @@ func (c *Config) Validate() error { if img.TileNames != "hashed" { add("images.tile_names must be \"hashed\"") } + if img.MinGrid < 1 || img.MinGrid > 8 { + add("images.min_grid must be between 1 and 8") + } if c.Loading.BudgetMS < 100 { add("loading.budget_ms must be at least 100") } @@ -273,6 +285,12 @@ func (c *Config) Validate() error { if c.Build.KeepBuilds < 1 { add("build.keep_builds must be at least 1") } + if c.Protection.Decoys < 0 || c.Protection.Decoys > 16 { + add("protection.decoys must be between 0 and 16") + } + if c.Protection.PowBits < 10 || c.Protection.PowBits > 26 { + add("protection.pow_bits must be between 10 and 26") + } for _, host := range c.Protection.HotlinkAllow { if host == "" || strings.ContainsAny(host, "/ ") { add("protection.hotlink_allow entry %q is not a host name", host) diff --git a/internal/fsutil/fsutil.go b/internal/fsutil/fsutil.go index e09ad2b..7dd97c1 100644 --- a/internal/fsutil/fsutil.go +++ b/internal/fsutil/fsutil.go @@ -117,3 +117,21 @@ func WritePublicAtomic(path string, data []byte) error { return zw.Close() }) } + +func WritePublic(path string, data []byte) error { + if err := os.WriteFile(path, data, 0o644); err != nil { + return err + } + var buf bytes.Buffer + zw, err := gzip.NewWriterLevel(&buf, gzip.BestCompression) + if err != nil { + return err + } + if _, err := zw.Write(data); err != nil { + return err + } + if err := zw.Close(); err != nil { + return err + } + return os.WriteFile(path+".gz", buf.Bytes(), 0o644) +} diff --git a/internal/process/keyed.go b/internal/process/keyed.go new file mode 100644 index 0000000..6fe2566 --- /dev/null +++ b/internal/process/keyed.go @@ -0,0 +1,51 @@ +package process + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/binary" + "encoding/hex" + "hash" + "strconv" +) + +type Keyed struct { + mac hash.Hash + buf []byte + sum []byte +} + +func (p *Processor) Keyed() *Keyed { + return &Keyed{mac: hmac.New(sha256.New, p.key), buf: make([]byte, 0, 96), sum: make([]byte, 0, sha256.Size)} +} + +func (k *Keyed) digest(label, hash string, level, slot int, source string) []byte { + b := append(k.buf[:0], label...) + b = append(b, '|') + b = append(b, hash...) + b = append(b, '|') + b = strconv.AppendInt(b, int64(level), 10) + if slot >= 0 { + b = append(b, '|') + b = strconv.AppendInt(b, int64(slot), 10) + b = append(b, '|') + b = append(b, source...) + } + k.buf = b + k.mac.Reset() + k.mac.Write(b) + k.sum = k.mac.Sum(k.sum[:0]) + return k.sum +} + +func (k *Keyed) DecoyName(hash string, level, slot int, source string) string { + return hex.EncodeToString(k.digest("decoy", hash, level, slot, source)[:8]) +} + +func (k *Keyed) Seed(label, hash string, level int) uint64 { + return binary.BigEndian.Uint64(k.digest(label, hash, level, -1, "")) +} + +func (p *Processor) Ext() string { + return "." + p.images.Format +} diff --git a/internal/process/processor.go b/internal/process/processor.go index a20e5c5..6d31c6d 100644 --- a/internal/process/processor.go +++ b/internal/process/processor.go @@ -21,16 +21,18 @@ import ( "github.com/luciochen233/luphoto/internal/fsutil" ) -const processorVersion = "luphoto-pyramid-1" +const processorVersion = "luphoto-pyramid-2" type Level struct { - Width int `json:"width"` - Height int `json:"height"` - Cols int `json:"cols"` - Rows int `json:"rows"` - Quality int `json:"quality"` - Tiles []string `json:"tiles"` - Bytes []int64 `json:"bytes"` + Width int `json:"width"` + Height int `json:"height"` + TileSize int `json:"tile_size"` + Overlap int `json:"overlap,omitempty"` + Cols int `json:"cols"` + Rows int `json:"rows"` + Quality int `json:"quality"` + Tiles []string `json:"tiles"` + Bytes []int64 `json:"bytes"` } type Pyramid struct { @@ -124,6 +126,7 @@ func New(ctx context.Context, cfg *config.Config) (*Processor, error) { "format=" + format, fmt.Sprintf("q=%d,%d,%d", img.Quality.Top, img.Quality.Mid, img.Quality.Low), "min_levels=" + strconv.Itoa(img.MinLevels), + "min_grid=" + strconv.Itoa(img.MinGrid), "seed=" + strconv.Itoa(img.SeedPx), "names=" + img.TileNames, "scramble=" + strconv.FormatBool(img.ScrambleCells), diff --git a/internal/process/pyramid.go b/internal/process/pyramid.go index 2a096bc..c593fd1 100644 --- a/internal/process/pyramid.go +++ b/internal/process/pyramid.go @@ -29,14 +29,27 @@ func (p *Processor) Overlap() int { return p.images.Overlap } -func LevelSizes(width, height, minLevels int) [][2]int { +func (p *Processor) levelTile(size [2]int) (int, int) { + ts := max(1, min(p.images.TileSize, min(size[0], size[1])/p.images.MinGrid)) + overlap := p.Overlap() + if ts <= 2*overlap { + overlap = 0 + } + return ts, overlap +} + +func LevelSizes(width, height, minLevels, minGrid int) [][2]int { sizes := [][2]int{{width, height}} for { w, h := sizes[len(sizes)-1][0], sizes[len(sizes)-1][1] if (max(w, h) < minLongEdge && len(sizes) >= minLevels) || (w == 1 && h == 1) { break } - sizes = append(sizes, [2]int{(w + 1) / 2, (h + 1) / 2}) + next := [2]int{(w + 1) / 2, (h + 1) / 2} + if min(next[0], next[1]) < minGrid { + break + } + sizes = append(sizes, next) } for i, j := 0, len(sizes)-1; i < j; i, j = i+1, j-1 { sizes[i], sizes[j] = sizes[j], sizes[i] @@ -152,7 +165,7 @@ func (p *Processor) process(ctx context.Context, job *Job) (*Record, error) { if err != nil { return nil, err } - sizes := LevelSizes(width, height, p.images.MinLevels) + sizes := LevelSizes(width, height, p.images.MinLevels, p.images.MinGrid) count := len(sizes) seedLevel := count - 1 for i, size := range sizes { @@ -200,9 +213,9 @@ func (p *Processor) process(ctx context.Context, job *Job) (*Record, error) { defer wg.Done() defer src.release() input := src.path - if p.images.ScrambleCells { + if ts, _ := p.levelTile(sizes[i]); p.images.ScrambleCells && ts >= 2*ScrambleCell { scrambled := filepath.Join(work, "s"+strconv.Itoa(i)+".v") - if err := ScrambleV(src.path, scrambled, scrambleSeed, i, p.images.TileSize, ScrambleCell); err != nil { + if err := ScrambleV(src.path, scrambled, scrambleSeed, i, ts, ScrambleCell); err != nil { fail(fmt.Errorf("scramble level %d: %w", i, err)) return } @@ -368,11 +381,12 @@ func (p *Processor) cutLevel(ctx context.Context, hash, src, stage string, level quality := p.levelQuality(level, count, size) base := filepath.Join(stage, strconv.Itoa(level)) ext := "." + p.images.Format + ts, overlap := p.levelTile(size) if err := p.vips.Run(ctx, "dzsave", src, base, "--layout", "dz", "--depth", "one", - "--tile-size", strconv.Itoa(p.images.TileSize), - "--overlap", strconv.Itoa(p.Overlap()), + "--tile-size", strconv.Itoa(ts), + "--overlap", strconv.Itoa(overlap), "--suffix", ext+p.vips.SaveOptions(p.images.Format, quality)); err != nil { return Level{}, err } @@ -384,7 +398,6 @@ func (p *Processor) cutLevel(ctx context.Context, hash, src, stage string, level if err != nil { return Level{}, err } - ts := p.images.TileSize cols := (size[0] + ts - 1) / ts rows := (size[1] + ts - 1) / ts files := make([]tileFile, 0, len(entries)) @@ -405,13 +418,15 @@ func (p *Processor) cutLevel(ctx context.Context, hash, src, stage string, level return Level{}, fmt.Errorf("expected %dx%d tiles, found %d", cols, rows, len(files)) } out := Level{ - Width: size[0], - Height: size[1], - Cols: cols, - Rows: rows, - Quality: quality, - Tiles: make([]string, cols*rows), - Bytes: make([]int64, cols*rows), + Width: size[0], + Height: size[1], + TileSize: ts, + Overlap: overlap, + Cols: cols, + Rows: rows, + Quality: quality, + Tiles: make([]string, cols*rows), + Bytes: make([]int64, cols*rows), } renamers := min(4, (len(files)+31)/32) var wg sync.WaitGroup diff --git a/internal/process/scramble.go b/internal/process/scramble.go index 1152a2d..d50650f 100644 --- a/internal/process/scramble.go +++ b/internal/process/scramble.go @@ -171,10 +171,10 @@ func scrambleBand(in, out *os.File, buf, tmp []byte, header vHeader, band int, r for tx := 0; tx < tiles; tx++ { width := min(tileSize, header.width-tx*tileSize) cols := width / cell - n := cols * cellRows - if n < 2 { + if cols < 2 || cellRows < 2 { continue } + n := cols * cellRows perm := CellPermutation(n, tileSeed(seed, level, tx, band)) origin := tx * tileSize * header.pixelBytes at := func(index, row int) []byte { diff --git a/internal/protect/protect.go b/internal/protect/protect.go new file mode 100644 index 0000000..325a977 --- /dev/null +++ b/internal/protect/protect.go @@ -0,0 +1,88 @@ +package protect + +import ( + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/binary" + "encoding/hex" +) + +const ( + SealMagic = "luphoto-sealed-1" + NonceSize = 12 + keyLabel = "luphoto-key" + chkLabel = "luphoto-check" +) + +type Gate struct { + Salt [16]byte + N uint32 + Bits int + Key [32]byte + Check [16]byte + Enabled bool +} + +func NewGate(bits int, enabled bool) (*Gate, error) { + g := &Gate{Bits: bits, Enabled: enabled} + var raw [4]byte + if _, err := rand.Read(g.Salt[:]); err != nil { + return nil, err + } + if _, err := rand.Read(raw[:]); err != nil { + return nil, err + } + g.N = binary.BigEndian.Uint32(raw[:]) & (uint32(1)< 0; i++ { + binary.BigEndian.PutUint32(block[32+NonceSize:], i) + stream := sha256.Sum256(block[:]) + n := min(len(stream), len(data)) + for j := 0; j < n; j++ { + data[j] ^= stream[j] + } + data = data[n:] + } +} diff --git a/internal/site/site.go b/internal/site/site.go index 8e5c360..2b37cdd 100644 --- a/internal/site/site.go +++ b/internal/site/site.go @@ -32,15 +32,61 @@ const ( type Tiles struct { Format string `json:"format"` - TileSize int `json:"tile_size"` - Overlap int `json:"overlap"` Path string `json:"path"` Scrambled bool `json:"scrambled,omitempty"` Cell int `json:"cell,omitempty"` } +type Level struct { + Width int `json:"width"` + Height int `json:"height"` + TileSize int `json:"tile_size"` + Overlap int `json:"overlap,omitempty"` + Cols int `json:"cols"` + Rows int `json:"rows"` +} + +type Pyramid struct { + Hash string `json:"hash"` + Width int `json:"width"` + Height int `json:"height"` + Levels []Level `json:"levels"` +} + +func Layout(p *process.Pyramid) *Pyramid { + out := &Pyramid{Hash: p.Hash, Width: p.Width, Height: p.Height, Levels: make([]Level, len(p.Levels))} + for i, l := range p.Levels { + out.Levels[i] = Level{Width: l.Width, Height: l.Height, TileSize: l.TileSize, Overlap: l.Overlap, Cols: l.Cols, Rows: l.Rows} + } + return out +} + +type Gate struct { + Build string `json:"build"` + Salt string `json:"salt,omitempty"` + Bits int `json:"bits,omitempty"` + Check string `json:"check,omitempty"` + Key string `json:"key,omitempty"` +} + +type Pool struct { + Levels []string `json:"levels"` + Sealed string `json:"sealed"` +} + +type SealedLevel struct { + Map []int32 `json:"map"` + Bytes []int64 `json:"bytes"` +} + +type Sealed struct { + Seed string `json:"seed"` + Scramble string `json:"scramble,omitempty"` + Levels []SealedLevel `json:"levels"` +} + type Photo struct { - process.Pyramid + Pyramid Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` Alt string `json:"alt,omitempty"` @@ -49,36 +95,38 @@ type Photo struct { } type Manifest struct { - Build string `json:"build"` - Slug string `json:"slug"` - Title string `json:"title"` - Subtitle string `json:"subtitle,omitempty"` - Date string `json:"date,omitempty"` - Order *int `json:"order,omitempty"` - Hidden bool `json:"hidden,omitempty"` - CollapsedFocusY float64 `json:"collapsed_focus_y"` - ShowEXIF bool `json:"show_exif"` - Tiles Tiles `json:"tiles"` - Cover *process.Pyramid `json:"cover"` - OG string `json:"og,omitempty"` - Photos []Photo `json:"photos"` + Build string `json:"build"` + Slug string `json:"slug"` + Title string `json:"title"` + Subtitle string `json:"subtitle,omitempty"` + Date string `json:"date,omitempty"` + Order *int `json:"order,omitempty"` + Hidden bool `json:"hidden,omitempty"` + CollapsedFocusY float64 `json:"collapsed_focus_y"` + ShowEXIF bool `json:"show_exif"` + Tiles Tiles `json:"tiles"` + Gate *Gate `json:"gate,omitempty"` + Cover *Pyramid `json:"cover"` + OG string `json:"og,omitempty"` + Photos []Photo `json:"photos"` } type IndexAlbum struct { - Slug string `json:"slug"` - Title string `json:"title"` - Subtitle string `json:"subtitle,omitempty"` - Date string `json:"date,omitempty"` - CollapsedFocusY float64 `json:"collapsed_focus_y"` - Photos int `json:"photos"` - Manifest string `json:"manifest"` - Cover *process.Pyramid `json:"cover"` - OG string `json:"og,omitempty"` + Slug string `json:"slug"` + Title string `json:"title"` + Subtitle string `json:"subtitle,omitempty"` + Date string `json:"date,omitempty"` + CollapsedFocusY float64 `json:"collapsed_focus_y"` + Photos int `json:"photos"` + Manifest string `json:"manifest"` + Cover *Pyramid `json:"cover"` + OG string `json:"og,omitempty"` } type Index struct { Build string `json:"build"` Tiles Tiles `json:"tiles"` + Gate *Gate `json:"gate,omitempty"` Albums []IndexAlbum `json:"albums"` } @@ -102,6 +150,14 @@ func IndexName(build string) string { return "index." + build + ".json" } +const PoolDir = "p" + +func PoolName(build, hash string) string { + return hash + "." + build + ".json" +} + +const Robots = "User-agent: *\nDisallow: /t/\nDisallow: /a/*/p/\n" + func OGPath(hash string) string { if hash == "" { return "" @@ -115,6 +171,7 @@ type Page struct { MaxDPR float64 Concurrency int BlockContextMenu bool + Gate bool BaseURL string } diff --git a/internal/site/static/app.css b/internal/site/static/app.css index 7e62e67..294a022 100644 --- a/internal/site/static/app.css +++ b/internal/site/static/app.css @@ -1 +1 @@ -:root{--lucio-graphite: #111114;--lucio-graphite-2: #1A1A1F;--lucio-graphite-3: #26262D;--lucio-paper: #F3F1EC;--lucio-paper-2: #E9E6DF;--lucio-paper-3: #D9D6CD;--lucio-beam: #FFF3CF;--lucio-beam-deep: #5E5238;--lucio-beam-glow: #FFFBF0;--lucio-steel: #8A94A6;--lucio-steel-deep: #3F4B60;--lucio-cinnabar: #C3361F;--lucio-cinnabar-light: #F08A77;--lucio-ash: #666A74;--lucio-ash-dark: #43464F;--lucio-ash-light: #A6A9B3;--lucio-font-display: "Bricolage Grotesque", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;--lucio-font-body: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;--lucio-font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;--lucio-font-cjk-display: "Noto Serif SC", "Songti SC", "SimSun", serif;--lucio-font-cjk-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--lucio-space-1: 4px;--lucio-space-2: 8px;--lucio-space-3: 12px;--lucio-space-4: 16px;--lucio-space-5: 24px;--lucio-space-6: 32px;--lucio-space-7: 48px;--lucio-space-8: 64px;--lucio-space-9: 96px;--lucio-space-10: 128px;--lucio-radius-none: 0px;--lucio-radius-sm: 4px;--lucio-radius-md: 8px;--lucio-radius-lg: 16px;--lucio-radius-icon: 22%;--lucio-shadow-glow: 0 0 0 1px rgba(255,243,207,.3), 0 8px 32px -8px rgba(255,243,207,.35);--lucio-motion-fast: .12s;--lucio-ease-fast: cubic-bezier(.2, 0, 0, 1);--lucio-motion-base: .24s;--lucio-ease-base: cubic-bezier(.2, 0, 0, 1);--lucio-motion-glow: .9s;--lucio-ease-glow: cubic-bezier(.16, 1, .3, 1)}@font-face{font-family:Bricolage Grotesque;font-style:normal;font-weight:200 800;font-display:swap;src:url("./bricolage-grotesque-latin-ext-wght-normal.EMW626ZA.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Bricolage Grotesque;font-style:normal;font-weight:200 800;font-display:swap;src:url("./bricolage-grotesque-latin-wght-normal.HY2A4V5R.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:400;font-display:swap;src:url("./ibm-plex-sans-latin-ext-400-normal.EDOVP6TU.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:400;font-display:swap;src:url("./ibm-plex-sans-latin-400-normal.COQVXTP6.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:500;font-display:swap;src:url("./ibm-plex-sans-latin-ext-500-normal.SG2XNXKB.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:500;font-display:swap;src:url("./ibm-plex-sans-latin-500-normal.JTONHBWS.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:600;font-display:swap;src:url("./ibm-plex-sans-latin-ext-600-normal.ZNWKNRXL.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:600;font-display:swap;src:url("./ibm-plex-sans-latin-600-normal.DTNZULF4.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:italic;font-weight:400;font-display:swap;src:url("./ibm-plex-sans-latin-ext-400-italic.VMPJJ47P.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:italic;font-weight:400;font-display:swap;src:url("./ibm-plex-sans-latin-400-italic.PR7YQ55B.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Mono;font-style:normal;font-weight:400;font-display:swap;src:url("./ibm-plex-mono-latin-ext-400-normal.T6XOR2FX.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Mono;font-style:normal;font-weight:400;font-display:swap;src:url("./ibm-plex-mono-latin-400-normal.A2WATXFY.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Mono;font-style:normal;font-weight:500;font-display:swap;src:url("./ibm-plex-mono-latin-ext-500-normal.LJE4XY22.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Mono;font-style:normal;font-weight:500;font-display:swap;src:url("./ibm-plex-mono-latin-500-normal.33HAQIPI.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}:root{color-scheme:dark;--strip-closed: min( 18.75vw , 28vh);--strip-open: min( 28.125vw , 62vh);--strip-gap: var(--lucio-space-2);--gutter: var(--lucio-space-4);--veil: rgba(17, 17, 20, .78)}@media (min-width: 768px){:root{--strip-gap: var(--lucio-space-4);--gutter: var(--lucio-space-6)}}html,body{margin:0;min-height:100%;background:var(--lucio-graphite);color:var(--lucio-paper);font-family:var(--lucio-font-body);font-size:17px;line-height:1.6;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}a{color:var(--lucio-paper);text-decoration-color:var(--lucio-ash-light);text-underline-offset:.15em}::selection{background:var(--lucio-graphite-3);color:var(--lucio-paper)}:focus-visible{outline:2px solid var(--lucio-beam);outline-offset:2px}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.strip-eyebrow,.next-eyebrow{font-family:var(--lucio-font-mono);font-size:12px;line-height:1.4;font-weight:500;letter-spacing:.08em;text-transform:uppercase;color:var(--lucio-ash-light)}.wordmark,.home-mark{display:block;color:var(--lucio-paper);text-decoration:none}.wordmark-text{font-family:var(--lucio-font-display);font-weight:700;font-size:28px;line-height:1;letter-spacing:-.01em}.has-svg .wordmark-text{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.wordmark-svg{display:block;width:100%}.chop{display:block;width:clamp(28px,7vmin,72px);flex:none}.chop svg{display:block;width:100%;height:auto}.site-header{padding:var(--lucio-space-5) var(--gutter)}.site-header .wordmark{width:128px}.strips{display:flex;flex-direction:column;gap:var(--strip-gap)}.strip{position:relative;display:block;height:var(--strip-closed);overflow:hidden;background:var(--lucio-graphite-2);color:var(--lucio-paper);text-decoration:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;transition:height var(--lucio-motion-base) var(--lucio-ease-base)}.strip.is-open{height:var(--strip-open)}.strip:focus-visible{outline:2px solid var(--lucio-beam);outline-offset:-2px;box-shadow:var(--lucio-shadow-glow)}.strip-canvas{position:absolute;top:0;left:0;width:100%;display:block;will-change:transform;transition:transform var(--lucio-motion-base) var(--lucio-ease-base)}.strip:after{content:"";position:absolute;inset:0;background:linear-gradient(to top,var(--veil) 0%,rgba(17,17,20,.3) 40%,rgba(17,17,20,0) 68%);opacity:0;pointer-events:none;transition:opacity var(--lucio-motion-fast) var(--lucio-ease-fast)}.strip-text{position:absolute;left:var(--gutter);right:var(--gutter);bottom:var(--lucio-space-5);z-index:1;display:flex;flex-direction:column;gap:var(--lucio-space-1);max-width:68ch}.strip-eyebrow,.strip-title,.strip-subtitle{opacity:0;transition:opacity var(--lucio-motion-fast) var(--lucio-ease-fast)}.strip-title{font-family:var(--lucio-font-display);font-weight:600;font-size:clamp(22px,2.6vw,36px);line-height:1.15;letter-spacing:-.015em}.strip-subtitle{font-size:14px;line-height:1.5;color:var(--lucio-ash-light)}.strip.is-open:after,.strip.is-open .strip-eyebrow,.strip.is-open .strip-title,.strip.is-open .strip-subtitle{opacity:1;transition:opacity var(--lucio-motion-glow) var(--lucio-ease-glow) var(--lucio-motion-base)}.strip.is-open .strip-title{transition-delay:calc(var(--lucio-motion-base) + var(--lucio-motion-fast))}.strip.is-open .strip-subtitle{transition-delay:calc(var(--lucio-motion-base) + var(--lucio-motion-fast) * 2)}html:not(.has-strips) .strip:after,html:not(.has-strips) .strip-eyebrow,html:not(.has-strips) .strip-title,html:not(.has-strips) .strip-subtitle{opacity:1}.empty{margin:0;padding:var(--lucio-space-9) var(--gutter);color:var(--lucio-ash-light)}.site-footer{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--lucio-space-4);padding:var(--lucio-space-7) var(--gutter) var(--lucio-space-6)}.footer-line{margin:0;font-size:14px;line-height:1.5;color:var(--lucio-ash-light)}.busy{position:fixed;top:50%;right:max(var(--lucio-space-6),calc(env(safe-area-inset-right) + var(--lucio-space-6)));width:56px;height:56px;margin-top:-28px;z-index:5;opacity:0;pointer-events:none;transition:opacity var(--lucio-motion-base) var(--lucio-ease-base)}.busy.is-visible{opacity:1}.busy svg{display:block}.progress{position:fixed;top:0;left:0;width:100%;height:2px;z-index:6;background:var(--lucio-beam);transform:scaleX(0);transform-origin:0 50%;opacity:0;pointer-events:none;transition:transform var(--lucio-motion-base) var(--lucio-ease-base),opacity var(--lucio-motion-base) var(--lucio-ease-base)}.progress.is-visible{opacity:1}.has-viewer body.viewer{position:fixed;inset:0;overflow:hidden;overscroll-behavior:none}.album-fallback{padding:var(--lucio-space-7) var(--gutter)}.has-viewer .album-fallback{display:none}.home-mark{position:fixed;top:max(var(--lucio-space-5),env(safe-area-inset-top));left:max(var(--lucio-space-5),env(safe-area-inset-left));z-index:4;width:88px;transition:opacity var(--lucio-motion-base) var(--lucio-ease-base)}.is-idle:not(.has-caption) .home-mark:not(:focus-visible){opacity:0}.stage{overflow:hidden;background:var(--lucio-graphite);touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;cursor:grab}.has-viewer .stage{position:fixed;inset:0}.stage.is-dragging{cursor:grabbing}.stage-canvas,.stage-fade{position:absolute;inset:0;width:100%;height:100%;display:block}.stage-fade{pointer-events:none;opacity:0;transition:opacity var(--lucio-motion-base) var(--lucio-ease-glow)}.caption{position:absolute;left:0;bottom:0;box-sizing:border-box;max-height:60%;overflow:hidden;padding:var(--lucio-space-8) var(--lucio-space-5) var(--lucio-space-5);background:linear-gradient(to top,#111114e6,#1111149e 55%,#11111400);opacity:0;pointer-events:none;transition:opacity var(--lucio-motion-base) var(--lucio-ease-base)}.caption.is-visible{opacity:1}.caption-meta{margin:0;font-family:var(--lucio-font-mono);font-size:12px;line-height:1.4;letter-spacing:.04em;color:var(--lucio-steel);font-variant-numeric:tabular-nums}.caption-title{margin:var(--lucio-space-2) 0 0;font-family:var(--lucio-font-display);font-size:22px;font-weight:600;line-height:1.2;letter-spacing:-.01em}.caption-text{margin:var(--lucio-space-2) 0 0;max-width:68ch;font-size:14px;line-height:1.5}.caption-text em{font-style:italic}.end-card{position:absolute;top:0;left:0;height:100%;display:flex;align-items:center;justify-content:center;will-change:transform}.next-album{display:block;color:var(--lucio-paper);text-decoration:none}.next-strip{position:relative;display:block;overflow:hidden}.next-album.has-strip .next-strip{background:var(--lucio-graphite-2)}.next-album.has-strip .next-strip:after{content:"";position:absolute;inset:0;background:linear-gradient(to top,var(--veil) 0%,rgba(17,17,20,0) 65%);pointer-events:none}.next-text{display:flex;flex-direction:column;gap:var(--lucio-space-1)}.next-album.has-strip .next-text{position:absolute;left:var(--lucio-space-5);bottom:var(--lucio-space-4);z-index:1}.next-title{font-family:var(--lucio-font-display);font-size:24px;font-weight:600;line-height:1.2;letter-spacing:-.01em}.next-album:hover .next-title{text-decoration:underline;text-decoration-color:var(--lucio-ash-light);text-underline-offset:.15em}.next-album:focus-visible{outline-offset:4px;box-shadow:var(--lucio-shadow-glow)}.signoff{position:absolute;right:var(--lucio-space-6);bottom:var(--lucio-space-6);display:flex;flex-direction:column;align-items:flex-end;gap:var(--lucio-space-2)}.signature{margin:0;font-family:var(--lucio-font-display);font-size:20px;font-weight:600;line-height:1.2}@media (prefers-reduced-motion: reduce){*,*:before,*:after{transition-duration:0ms!important;transition-delay:0ms!important;animation-duration:0ms!important}}html{touch-action:manipulation;-webkit-text-size-adjust:100%;text-size-adjust:100%}.skip-link{position:absolute;top:var(--lucio-space-2);left:var(--lucio-space-4);z-index:10;padding:var(--lucio-space-2) var(--lucio-space-3);background:var(--lucio-graphite-2);color:var(--lucio-paper);font-size:14px;line-height:1.5;text-decoration:none;transform:translateY(-200%)}.skip-link:focus-visible{transform:none}.stage:focus-visible{outline:2px solid var(--lucio-beam);outline-offset:-2px}.strip{touch-action:manipulation}.load-error{color:var(--lucio-ash-light)}.message{padding:var(--lucio-space-9) var(--gutter) var(--lucio-space-8);max-width:68ch}.message-eyebrow{margin:0;font-family:var(--lucio-font-mono);font-size:12px;line-height:1.4;font-weight:500;letter-spacing:.08em;text-transform:uppercase;color:var(--lucio-ash-light)}.message-title{margin:var(--lucio-space-2) 0 var(--lucio-space-4);font-family:var(--lucio-font-display);font-size:36px;font-weight:700;line-height:1.15;letter-spacing:-.015em}.message-text{margin:0;color:var(--lucio-paper)}.message-text a{text-decoration:underline} +:root{--lucio-graphite: #111114;--lucio-graphite-2: #1A1A1F;--lucio-graphite-3: #26262D;--lucio-paper: #F3F1EC;--lucio-paper-2: #E9E6DF;--lucio-paper-3: #D9D6CD;--lucio-beam: #FFF3CF;--lucio-beam-deep: #5E5238;--lucio-beam-glow: #FFFBF0;--lucio-steel: #8A94A6;--lucio-steel-deep: #3F4B60;--lucio-cinnabar: #C3361F;--lucio-cinnabar-light: #F08A77;--lucio-ash: #666A74;--lucio-ash-dark: #43464F;--lucio-ash-light: #A6A9B3;--lucio-font-display: "Bricolage Grotesque", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;--lucio-font-body: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;--lucio-font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;--lucio-font-cjk-display: "Noto Serif SC", "Songti SC", "SimSun", serif;--lucio-font-cjk-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--lucio-space-1: 4px;--lucio-space-2: 8px;--lucio-space-3: 12px;--lucio-space-4: 16px;--lucio-space-5: 24px;--lucio-space-6: 32px;--lucio-space-7: 48px;--lucio-space-8: 64px;--lucio-space-9: 96px;--lucio-space-10: 128px;--lucio-radius-none: 0px;--lucio-radius-sm: 4px;--lucio-radius-md: 8px;--lucio-radius-lg: 16px;--lucio-radius-icon: 22%;--lucio-shadow-glow: 0 0 0 1px rgba(255,243,207,.3), 0 8px 32px -8px rgba(255,243,207,.35);--lucio-motion-fast: .12s;--lucio-ease-fast: cubic-bezier(.2, 0, 0, 1);--lucio-motion-base: .24s;--lucio-ease-base: cubic-bezier(.2, 0, 0, 1);--lucio-motion-glow: .9s;--lucio-ease-glow: cubic-bezier(.16, 1, .3, 1)}@font-face{font-family:Bricolage Grotesque;font-style:normal;font-weight:200 800;font-display:swap;src:url("./bricolage-grotesque-latin-ext-wght-normal.EMW626ZA.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Bricolage Grotesque;font-style:normal;font-weight:200 800;font-display:swap;src:url("./bricolage-grotesque-latin-wght-normal.HY2A4V5R.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:400;font-display:swap;src:url("./ibm-plex-sans-latin-ext-400-normal.EDOVP6TU.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:400;font-display:swap;src:url("./ibm-plex-sans-latin-400-normal.COQVXTP6.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:500;font-display:swap;src:url("./ibm-plex-sans-latin-ext-500-normal.SG2XNXKB.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:500;font-display:swap;src:url("./ibm-plex-sans-latin-500-normal.JTONHBWS.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:600;font-display:swap;src:url("./ibm-plex-sans-latin-ext-600-normal.ZNWKNRXL.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-weight:600;font-display:swap;src:url("./ibm-plex-sans-latin-600-normal.DTNZULF4.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:italic;font-weight:400;font-display:swap;src:url("./ibm-plex-sans-latin-ext-400-italic.VMPJJ47P.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:italic;font-weight:400;font-display:swap;src:url("./ibm-plex-sans-latin-400-italic.PR7YQ55B.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Mono;font-style:normal;font-weight:400;font-display:swap;src:url("./ibm-plex-mono-latin-ext-400-normal.T6XOR2FX.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Mono;font-style:normal;font-weight:400;font-display:swap;src:url("./ibm-plex-mono-latin-400-normal.A2WATXFY.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Mono;font-style:normal;font-weight:500;font-display:swap;src:url("./ibm-plex-mono-latin-ext-500-normal.LJE4XY22.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Mono;font-style:normal;font-weight:500;font-display:swap;src:url("./ibm-plex-mono-latin-500-normal.33HAQIPI.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}:root{color-scheme:dark;--strip-closed: min( 18.75vw , 28vh);--strip-open: min( 28.125vw , 62vh);--strip-gap: var(--lucio-space-2);--gutter: var(--lucio-space-4);--veil: rgba(17, 17, 20, .78)}@media (min-width: 768px){:root{--strip-gap: var(--lucio-space-4);--gutter: var(--lucio-space-6)}}html,body{margin:0;min-height:100%;background:var(--lucio-graphite);color:var(--lucio-paper);font-family:var(--lucio-font-body);font-size:17px;line-height:1.6;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}a{color:var(--lucio-paper);text-decoration-color:var(--lucio-ash-light);text-underline-offset:.15em}::selection{background:var(--lucio-graphite-3);color:var(--lucio-paper)}:focus-visible{outline:2px solid var(--lucio-beam);outline-offset:2px}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.strip-eyebrow,.next-eyebrow{font-family:var(--lucio-font-mono);font-size:12px;line-height:1.4;font-weight:500;letter-spacing:.08em;text-transform:uppercase;color:var(--lucio-ash-light)}.wordmark,.home-mark{display:block;color:var(--lucio-paper);text-decoration:none}.wordmark-text{font-family:var(--lucio-font-display);font-weight:700;font-size:28px;line-height:1;letter-spacing:-.01em}.has-svg .wordmark-text{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.wordmark-svg{display:block;width:100%}.chop{display:block;width:clamp(28px,7vmin,72px);flex:none}.chop svg{display:block;width:100%;height:auto}.site-header{padding:var(--lucio-space-5) var(--gutter)}.site-header .wordmark{width:128px}.strips{display:flex;flex-direction:column;gap:var(--strip-gap)}.strip{position:relative;display:block;height:var(--strip-closed);overflow:hidden;background:var(--lucio-graphite-2);color:var(--lucio-paper);text-decoration:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;transition:height var(--lucio-motion-base) var(--lucio-ease-base)}.strip.is-open{height:var(--strip-open)}.strip:focus-visible{outline:2px solid var(--lucio-beam);outline-offset:-2px;box-shadow:var(--lucio-shadow-glow)}.strip-canvas{position:absolute;top:0;left:0;width:100%;display:block;will-change:transform;transition:transform var(--lucio-motion-base) var(--lucio-ease-base)}.strip:after{content:"";position:absolute;inset:0;background:linear-gradient(to top,var(--veil) 0%,rgba(17,17,20,.3) 40%,rgba(17,17,20,0) 68%);opacity:0;pointer-events:none;transition:opacity var(--lucio-motion-fast) var(--lucio-ease-fast)}.strip-text{position:absolute;left:var(--gutter);right:var(--gutter);bottom:var(--lucio-space-5);z-index:1;display:flex;flex-direction:column;gap:var(--lucio-space-1);max-width:68ch}.strip-eyebrow,.strip-title,.strip-subtitle{opacity:0;transition:opacity var(--lucio-motion-fast) var(--lucio-ease-fast)}.strip-title{font-family:var(--lucio-font-display);font-weight:600;font-size:clamp(22px,2.6vw,36px);line-height:1.15;letter-spacing:-.015em}.strip-subtitle{font-size:14px;line-height:1.5;color:var(--lucio-ash-light)}.strip.is-open:after,.strip.is-open .strip-eyebrow,.strip.is-open .strip-title,.strip.is-open .strip-subtitle{opacity:1;transition:opacity var(--lucio-motion-glow) var(--lucio-ease-glow) var(--lucio-motion-base)}.strip.is-open .strip-title{transition-delay:calc(var(--lucio-motion-base) + var(--lucio-motion-fast))}.strip.is-open .strip-subtitle{transition-delay:calc(var(--lucio-motion-base) + var(--lucio-motion-fast) * 2)}html:not(.has-strips) .strip:after,html:not(.has-strips) .strip-eyebrow,html:not(.has-strips) .strip-title,html:not(.has-strips) .strip-subtitle{opacity:1}.empty{margin:0;padding:var(--lucio-space-9) var(--gutter);color:var(--lucio-ash-light)}.site-footer{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--lucio-space-4);padding:var(--lucio-space-7) var(--gutter) var(--lucio-space-6)}.footer-line{margin:0;font-size:14px;line-height:1.5;color:var(--lucio-ash-light)}.busy{position:fixed;top:50%;right:max(var(--lucio-space-6),calc(env(safe-area-inset-right) + var(--lucio-space-6)));width:56px;height:56px;margin-top:-28px;z-index:5;opacity:0;pointer-events:none;transition:opacity var(--lucio-motion-base) var(--lucio-ease-base)}.busy.is-visible{opacity:1}.busy svg{display:block}.progress{position:fixed;top:0;left:0;width:100%;height:2px;z-index:6;background:var(--lucio-beam);transform:scaleX(0);transform-origin:0 50%;opacity:0;pointer-events:none;transition:transform var(--lucio-motion-base) var(--lucio-ease-base),opacity var(--lucio-motion-base) var(--lucio-ease-base)}.progress.is-visible{opacity:1}.has-viewer body.viewer{position:fixed;inset:0;overflow:hidden;overscroll-behavior:none}.album-fallback{padding:var(--lucio-space-7) var(--gutter)}.has-viewer .album-fallback{display:none}.home-mark{position:fixed;top:max(var(--lucio-space-5),env(safe-area-inset-top));left:max(var(--lucio-space-5),env(safe-area-inset-left));z-index:4;width:88px;transition:opacity var(--lucio-motion-base) var(--lucio-ease-base)}.is-idle:not(.has-caption) .home-mark:not(:focus-visible){opacity:0}.stage{overflow:hidden;background:var(--lucio-graphite);touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;cursor:grab}.has-viewer .stage{position:fixed;inset:0}.stage.is-dragging{cursor:grabbing}.stage-canvas,.stage-fade{position:absolute;inset:0;width:100%;height:100%;display:block}.stage-fade{pointer-events:none;opacity:0;transition:opacity var(--lucio-motion-base) var(--lucio-ease-glow)}.caption{position:absolute;left:0;bottom:0;box-sizing:border-box;max-height:60%;overflow:hidden;padding:var(--lucio-space-8) var(--lucio-space-5) var(--lucio-space-5);background:linear-gradient(to top,#111114e6,#1111149e 55%,#11111400);opacity:0;pointer-events:none;transition:opacity var(--lucio-motion-base) var(--lucio-ease-base)}.caption.is-visible{opacity:1}.caption-meta{margin:0;font-family:var(--lucio-font-mono);font-size:12px;line-height:1.4;letter-spacing:.04em;color:var(--lucio-steel);font-variant-numeric:tabular-nums}.caption-title{margin:var(--lucio-space-2) 0 0;font-family:var(--lucio-font-display);font-size:22px;font-weight:600;line-height:1.2;letter-spacing:-.01em}.caption-text{margin:var(--lucio-space-2) 0 0;max-width:68ch;font-size:14px;line-height:1.5}.caption-text em{font-style:italic}.end-card{position:absolute;top:0;left:0;height:100%;display:flex;align-items:center;justify-content:center;will-change:transform}.next-album{display:block;color:var(--lucio-paper);text-decoration:none}.next-strip{position:relative;display:block;overflow:hidden}.next-album.has-strip .next-strip{background:var(--lucio-graphite-2)}.next-album.has-strip .next-strip:after{content:"";position:absolute;inset:0;background:linear-gradient(to top,var(--veil) 0%,rgba(17,17,20,0) 65%);pointer-events:none}.next-text{display:flex;flex-direction:column;gap:var(--lucio-space-1)}.next-album.has-strip .next-text{position:absolute;left:var(--lucio-space-5);bottom:var(--lucio-space-4);z-index:1}.next-title{font-family:var(--lucio-font-display);font-size:24px;font-weight:600;line-height:1.2;letter-spacing:-.01em}.next-album:hover .next-title{text-decoration:underline;text-decoration-color:var(--lucio-ash-light);text-underline-offset:.15em}.next-album:focus-visible{outline-offset:4px;box-shadow:var(--lucio-shadow-glow)}.signoff{position:absolute;right:var(--lucio-space-6);bottom:var(--lucio-space-6);display:flex;flex-direction:column;align-items:flex-end;gap:var(--lucio-space-2)}.signature{margin:0;font-family:var(--lucio-font-display);font-size:20px;font-weight:600;line-height:1.2}.has-gate,.has-gate body{overflow:hidden}.gate{position:fixed;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:var(--gutter);background:var(--veil);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);transition:opacity var(--lucio-motion-base) var(--lucio-ease-base)}.gate.is-leaving{opacity:0;pointer-events:none}.gate-card{display:flex;flex-direction:column;align-items:center;gap:var(--lucio-space-4);box-sizing:border-box;width:100%;max-width:320px;padding:var(--lucio-space-6) var(--lucio-space-5);background:var(--lucio-graphite-2);border:1px solid var(--lucio-graphite-3);border-radius:var(--lucio-radius-lg);text-align:center}.gate-eyebrow{margin:0;font-family:var(--lucio-font-mono);font-size:12px;line-height:1.4;font-weight:500;letter-spacing:.08em;text-transform:uppercase;color:var(--lucio-ash-light)}.gate-line{margin:0 0 var(--lucio-space-2);font-family:var(--lucio-font-display);font-size:20px;font-weight:600;line-height:1.3;letter-spacing:-.01em;color:var(--lucio-paper)}.gate-hold{display:block;width:88px;height:88px;margin:0;padding:0;border:0;border-radius:50%;background:var(--lucio-graphite-3);cursor:pointer;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;transition:transform var(--lucio-motion-fast) var(--lucio-ease-fast),box-shadow var(--lucio-motion-fast) var(--lucio-ease-fast)}.gate-hold:hover,.gate-hold.is-pressed{box-shadow:var(--lucio-shadow-glow)}.gate-hold.is-pressed{transform:scale(.96)}.gate-hold:focus-visible{outline-offset:4px}.gate-hold:disabled{cursor:default;box-shadow:none}.gate-hold svg{display:block;width:100%;height:100%;transform:rotate(-90deg)}.gate-track,.gate-ring{fill:none;stroke-width:3}.gate-track{stroke:var(--lucio-ash-dark)}.gate-ring{stroke:var(--lucio-beam);stroke-linecap:round;stroke-dasharray:100;stroke-dashoffset:100;transition:stroke-dashoffset var(--lucio-motion-base) var(--lucio-ease-base)}.gate-hold.is-pressed .gate-ring{transition:none}.gate-dot{fill:var(--lucio-paper);transform-origin:32px 32px;transition:transform var(--lucio-motion-fast) var(--lucio-ease-fast)}.gate-hold.is-pressed .gate-dot{transform:scale(1.5)}.gate.is-waiting .gate-hold svg{animation:gate-spin .9s linear infinite}@keyframes gate-spin{0%{transform:rotate(-90deg)}to{transform:rotate(270deg)}}@media (prefers-reduced-motion: reduce){*,*:before,*:after{transition-duration:0ms!important;transition-delay:0ms!important;animation-duration:0ms!important}}html{touch-action:manipulation;-webkit-text-size-adjust:100%;text-size-adjust:100%}.skip-link{position:absolute;top:var(--lucio-space-2);left:var(--lucio-space-4);z-index:10;padding:var(--lucio-space-2) var(--lucio-space-3);background:var(--lucio-graphite-2);color:var(--lucio-paper);font-size:14px;line-height:1.5;text-decoration:none;transform:translateY(-200%)}.skip-link:focus-visible{transform:none}.stage:focus-visible{outline:2px solid var(--lucio-beam);outline-offset:-2px}.strip{touch-action:manipulation}.load-error{color:var(--lucio-ash-light)}.message{padding:var(--lucio-space-9) var(--gutter) var(--lucio-space-8);max-width:68ch}.message-eyebrow{margin:0;font-family:var(--lucio-font-mono);font-size:12px;line-height:1.4;font-weight:500;letter-spacing:.08em;text-transform:uppercase;color:var(--lucio-ash-light)}.message-title{margin:var(--lucio-space-2) 0 var(--lucio-space-4);font-family:var(--lucio-font-display);font-size:36px;font-weight:700;line-height:1.15;letter-spacing:-.015em}.message-text{margin:0;color:var(--lucio-paper)}.message-text a{text-decoration:underline} diff --git a/internal/site/static/app.js b/internal/site/static/app.js index 20df0e8..60506d1 100644 --- a/internal/site/static/app.js +++ b/internal/site/static/app.js @@ -1 +1 @@ -"use strict";(()=>{(function(r){let t={from:"Guoliang",to:"Lucio",letters:[{ch:"G",kind:"keep",shared:"M8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50",fullA:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",fullB:"M8.50 0.00L8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50L80.00 91.50",out:[{d:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00",P:79.21,j:"end"},{d:"M58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",P:73.21,j:"start"}],in:[{d:"M8.50 22.00L8.50 0.00",P:22,j:"start"},{d:"M58.00 91.50L80.00 91.50",P:22,j:"start"}],x0:0,x1:0,dot:null},{ch:"u",kind:"keep",shared:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullA:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullB:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",out:[],in:[],x0:88.8,x1:88,dot:null},{ch:"o",kind:"keep",shared:"M38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullB:"M60.00 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50L60.00 91.50",out:[{d:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50",P:60.41,j:"both"}],in:[{d:"M38.00 46.50L60.00 46.50",P:22,j:"start"},{d:"M38.00 91.50L60.00 91.50",P:22,j:"start"}],x0:159,x1:158.2,dot:null},{ch:"l",kind:"fade",d:"M8.50 0.00L8.50 100.00",x0:230.8,x1:230.8,dot:null},{ch:"i",kind:"keep",shared:"M8.50 38.00L8.50 100.00",fullA:"M8.50 38.00L8.50 100.00",fullB:"M8.50 38.00L8.50 100.00",out:[],in:[],x0:262.8,x1:227.9,dot:[0,14,17]},{ch:"a",kind:"fade",d:"M38.00 91.50L51.50 91.50L51.50 78.00L51.50 60.00L51.50 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",x0:291.6,x1:291.6,dot:null},{ch:"n",kind:"fade",d:"M51.50 100.00L51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00L8.50 100.00",x0:362.7,x1:362.7,dot:null},{ch:"g",kind:"keep",shared:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M0.00 127.50L38.00 127.50A13.50 13.50 0 0 0 51.50 114.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00",fullB:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",out:[{d:"M51.50 60.00L51.50 114.00A13.50 13.50 0 0 1 38.00 127.50L0.00 127.50",P:113.21,j:"start"}],in:[],x0:432.9,x1:256.7,dot:null}],pad:17,vbw:526.9,vbh:170,stroke:17,raysT:"translate(0.000 22.727) scale(0.7727)"},e="M47.6 70.7L71.9 61.1L71.1 58.2L45.2 62.0ZM44.9 61.5L61.2 40.9L59.1 38.8L38.5 55.1ZM38.0 54.8L41.8 28.9L38.9 28.1L29.3 52.4Z",i="http://www.w3.org/2000/svg",s=(d,x)=>{let c=document.createElementNS(i,d);for(let u in x)c.setAttribute(u,x[u]);return c},n=()=>r.matchMedia&&r.matchMedia("(prefers-reduced-motion: reduce)").matches,o=d=>Math.max(0,Math.min(1,d)),a=d=>d*d*(3-2*d),h=.5;function l(d,x){let c=0,u=0,f=null,g=0;function A(y){let b=(y-g)/x;g=y,c=cv(1),reverse:()=>v(0),toggle:()=>v(u?0:1),set:y=>{cancelAnimationFrame(f),f=null,u=c=y,d(c)},stop:()=>{cancelAnimationFrame(f),f=null},get t(){return c}}}function m(d,x,c,u){let f=o(u)*x;if(d.style.visibility=f<.05?"hidden":"visible",c==="both"){let g=f/2;d.setAttribute("stroke-dasharray",g.toFixed(2)+" "+Math.max(0,x-2*g).toFixed(2)+" "+g.toFixed(2)),d.setAttribute("stroke-dashoffset","0")}else c==="end"?(d.setAttribute("stroke-dasharray",f.toFixed(2)+" "+(2*x+20).toFixed(2)),d.setAttribute("stroke-dashoffset",(-(x-f)).toFixed(2))):(d.setAttribute("stroke-dasharray",f.toFixed(2)+" "+(2*x+20).toFixed(2)),d.setAttribute("stroke-dashoffset","0"))}function L(d,x={}){let c=Object.assign({trigger:"hover",color:"currentColor",rays:"#FFF3CF",duration:450,autoDelay:1800},x),u=s("svg",{viewBox:"0 0 "+t.vbw+" "+t.vbh,role:"img","aria-label":"Guoliang Chen, Lucio"});u.style.display="block",u.style.width="100%",u.style.height="auto";let f=s("g",{transform:"translate("+t.pad+" "+t.pad+")",fill:"none",stroke:c.color,"stroke-width":t.stroke,"stroke-linejoin":"miter","stroke-linecap":"butt"});u.appendChild(f);let g=t.letters.map(b=>{let M=s("g",{transform:"translate("+b.x0+" 0)"});f.appendChild(M);let k=Object.assign({g:M,outEls:[],inEls:[]},b);if(b.kind==="fade")k.fadeEl=s("path",{d:b.d}),M.appendChild(k.fadeEl);else{k.fullA=s("path",{d:b.fullA}),M.appendChild(k.fullA),k.fullB=s("path",{d:b.fullB}),M.appendChild(k.fullB),b.shared&&M.appendChild(s("path",{d:b.shared}));for(let T of b.out){let S=s("path",{d:T.d});M.appendChild(S),k.outEls.push([S,T])}for(let T of b.in){let S=s("path",{d:T.d});M.appendChild(S),k.inEls.push([S,T])}}return b.dot&&(k.dotEl=s("rect",{x:b.dot[0],y:b.dot[1],width:b.dot[2],height:b.dot[2],rx:b.dot[2]*.22,fill:c.color,stroke:"none"}),M.appendChild(k.dotEl)),k}),A=s("path",{d:e,fill:c.rays,stroke:"none",opacity:0});f.appendChild(A),d.appendChild(u);function v(b){let M=a(o(b/h)),k=a(o((b-h)/(1-h)));for(let T of g){if(T.kind==="fade")T.fadeEl.setAttribute("opacity",(1-M).toFixed(3)),T.dotEl&&T.dotEl.setAttribute("opacity",(1-M).toFixed(3));else{for(let[S,C]of T.outEls)m(S,C.P,C.j,1-M);for(let[S,C]of T.inEls)m(S,C.P,C.j,M);T.fullA.style.visibility=M<=.001?"visible":"hidden",T.fullB.style.visibility=M>=.999?"visible":"hidden"}T.g.setAttribute("transform","translate("+(T.x0+(T.x1-T.x0)*k).toFixed(2)+" 0)")}A.setAttribute("transform","translate("+(g[0].x0+(g[0].x1-g[0].x0)*k).toFixed(2)+" 0) "+t.raysT),A.setAttribute("opacity",o((b-.8)/.2).toFixed(3))}let y=l(v,c.duration);return v(0),c.trigger==="hover"&&(d.addEventListener("mouseenter",y.play),d.addEventListener("mouseleave",y.reverse),d.addEventListener("focus",y.play),d.addEventListener("blur",y.reverse)),c.trigger==="click"&&d.addEventListener("click",y.toggle),c.trigger==="auto"&&setInterval(y.toggle,c.autoDelay+c.duration),Object.assign(y,{svg:u})}let w={C:[0,.75],L:[.25,.75],U:[.25,1],I:[.75,1],O:[.75,1.75]};function p(d,x,c){let u=x/2,f=c-u,g=u+f,A=f*Math.SQRT1_2,v=b=>b.toFixed(3);return{d:"M"+v(d-g+A)+" "+v(g-A)+"A"+v(f)+" "+v(f)+" 0 0 0 "+v(d-g)+" "+v(u)+"H"+v(g)+"A"+v(f)+" "+v(f)+" 0 0 0 "+v(u)+" "+v(g)+"V"+v(d-g)+"A"+v(f)+" "+v(f)+" 0 0 0 "+v(g)+" "+v(d-u)+"H"+v(d-g)+"A"+v(f)+" "+v(f)+" 0 0 0 "+v(d-u)+" "+v(d-g)+"V"+v(g)+"A"+v(f)+" "+v(f)+" 0 0 0 "+v(d-g+A)+" "+v(g-A)+"Z",P:4*(d-2*g)+2*Math.PI*f}}function E(d,x={}){let c=Object.assign({sequence:"LUCIO",color:"#F3F1EC",track:"#26262D",rays:"#FFF3CF",hold:480,morph:640,size:96,stroke:.17,radius:.22},x),u=120,f=u*c.stroke,g=u*c.radius,A=p(u,f,g),v=s("svg",{viewBox:"0 0 "+u+" "+u,width:c.size,height:c.size,role:"img","aria-label":"Loading"});c.track&&v.appendChild(s("path",{d:A.d,fill:"none",stroke:c.track,"stroke-width":f}));let y=s("path",{d:A.d,fill:"none",stroke:c.color,"stroke-width":f,"stroke-linecap":"butt"}),b=f/22,M=s("path",{d:e,fill:c.rays,transform:"translate("+(f-22*b).toFixed(3)+" "+(u-f-78*b).toFixed(3)+") scale("+b.toFixed(4)+")",opacity:0});v.appendChild(y),v.appendChild(M);let k=(z,N)=>{let I=Math.min(1,Math.max(0,N-z))*A.P;y.setAttribute("stroke-dasharray",I.toFixed(3)+" "+Math.max(0,A.P-I).toFixed(3)),y.setAttribute("stroke-dashoffset",(-z*A.P).toFixed(3))},T=(z,N)=>{let[I,X]=w[N];for(let R=-1;R<6;R++)if(I+R>=z[0]-1e-6&&X+R>=z[1]-1e-6)return[I+R,X+R];return[I,X]},S=c.sequence.split(""),C=0,P=w[S[0]].slice(),st,nt,lt=!1;k(P[0],P[1]),M.setAttribute("opacity",S[0]==="L"?1:0);function ct(){if(lt)return;let z=(C+1)%S.length,N=T(P,S[z]),I=P.slice(),X=S[C]==="L",R=S[z]==="L",dt=()=>{P=N;let U=Math.floor(P[0]);P[0]-=U,P[1]-=U,C=z,k(P[0],P[1]),M.setAttribute("opacity",R?1:0),nt=setTimeout(ct,c.hold)};if(n()){dt();return}let Ht=performance.now(),ut=U=>{let H=Math.min(1,(U-Ht)/c.morph),mt=H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2;k(I[0]+(N[0]-I[0])*mt,I[1]+(N[1]-I[1])*mt),M.setAttribute("opacity",R?Math.max(0,(H-.6)/.4).toFixed(3):X?Math.max(0,1-H*2.5).toFixed(3):0),H<1?st=requestAnimationFrame(ut):dt()};st=requestAnimationFrame(ut)}return nt=setTimeout(ct,c.hold),d.appendChild(v),{svg:v,stop:()=>{lt=!0,cancelAnimationFrame(st),clearTimeout(nt)}}}r.LucioMorph={wordmark:L,loader:E}})(window);var W={graphite:"#111114",graphite3:"#26262D",paper:"#F3F1EC",beam:"#FFF3CF"};function rt(){return window.LucioMorph??null}function D(r,t){let e=rt();if(!e)return null;let i=document.createElement("span");i.className="wordmark-svg",i.setAttribute("aria-hidden","true"),r.appendChild(i);let s=e.wordmark(i,{trigger:"manual",color:W.paper,rays:W.beam});return s.svg.setAttribute("aria-hidden","true"),s.svg.removeAttribute("role"),t||s.set(1),r.classList.add("has-svg"),s}function pt(){let r=document.getElementById("chop-template");if(!(r instanceof HTMLTemplateElement))return null;let t=r.content.firstElementChild;return t?t.cloneNode(!0):null}function qt(r){let t=r.seed+"|"+r.level+"|"+r.x+"|"+r.y,e=2166136261;for(let i=0;i>>0;return e}function Nt(r,t){let e=new Array(r);for(let n=0;n{i=i+1831565813|0;let n=Math.imul(i^i>>>15,1|i);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296};for(let n=r-1;n>0;n--){let o=Math.floor(s()*(n+1)),a=e[n];e[n]=e[o],e[o]=a}return e}function ft(r,t,e,i,s){r.drawImage(t,0,0);let n=s.cell,o=Math.floor(e/n),a=Math.floor(i/n),h=o*a;if(h<2)return;let l=Nt(h,qt(s));for(let m=0;m"u"||e==="")return;let i=(navigator.hardwareConcurrency??2)>=4?2:1;for(let s=0;sthis.onReply(a.data,o),n.onerror=()=>this.dropWorker(o),this.workers.push(n)}catch{break}}request(t,e,i,s,n){return s.aborted?Promise.reject(new F):new Promise((o,a)=>{let h=this.byId.get(t);h?i{m.waiters.delete(l)&&(a(new F),m.waiters.size===0&&setTimeout(()=>{m.waiters.size===0&&this.byKey.get(m.key)===m&&this.cancel(m)},0))},{once:!0}),this.pump()})}cancelAll(){for(let t of[...this.byKey.values()]){let e=[...t.waiters];t.waiters.clear();for(let i of e)i.reject(new F);this.cancel(t)}}cancel(t){if(this.forget(t),!t.running){let e=this.queue.indexOf(t);e>=0&&this.queue.splice(e,1);return}t.running=!1,this.running--,t.controller?t.controller.abort():t.worker>=0&&this.workers[t.worker]&&this.workers[t.worker].postMessage({type:"abort",key:t.key}),this.pump()}forget(t){this.byId.get(t.id)===t&&this.byId.delete(t.id),this.byKey.delete(t.key)}pump(){for(;this.running0;){let t=0;for(let i=1;i0&&(!t.scramble||this.workersUnscramble)){let i=e[this.nextWorker++%e.length];t.worker=i,this.workers[i].postMessage({type:"fetch",key:t.key,url:t.url,scramble:t.scramble});return}this.runOnMainThread(t)}runOnMainThread(t){t.worker=-1,t.controller=new AbortController,this.fetchOnMainThread(t,t.controller.signal)}liveWorkers(){let t=[];return this.workers.forEach((e,i)=>{e&&t.push(i)}),t}dropWorker(t){let e=this.workers[t];if(e){e.terminate(),delete this.workers[t];for(let i of this.byKey.values())i.running&&i.worker===t&&this.runOnMainThread(i)}}async fetchOnMainThread(t,e){let i=performance.now();try{let s=await fetch(t.url,{signal:e,credentials:"same-origin"});if(!s.ok)throw new Error("HTTP "+s.status);let n=await s.blob(),o=performance.now()-i,a=await at(n);t.scramble&&(a=await Dt(a,t.scramble)),this.onReply({key:t.key,ok:!0,bitmap:a,bytes:n.size,ms:o},-1)}catch(s){this.onReply({key:t.key,ok:!1,bytes:0,ms:0,error:String(s)},-1)}}onReply(t,e){let i=this.byKey.get(t.key);if(!i||!i.running||i.worker!==e){t.bitmap&&q(t.bitmap);return}if(!t.ok&&e>=0&&(t.error==="unsupported-bitmap"||t.error==="unsupported-offscreen")){t.error==="unsupported-bitmap"?this.dropWorker(e):(this.workersUnscramble=!1,this.runOnMainThread(i));return}i.running=!1,this.running--,this.forget(i);let s=[...i.waiters];if(i.waiters.clear(),t.ok&&t.bitmap){let n={bitmap:t.bitmap,bytes:t.bytes,ms:t.ms};for(let o of s)o.resolve(n);s.length===0&&q(t.bitmap)}else{let n=new Error(t.error??"tile failed");for(let o of s)o.reject(n)}this.pump()}};var bt=1024*1024;function Wt(){let r=navigator.deviceMemory;if(typeof r=="number"&&r<=4)return!0;let t=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,e=Math.min(screen.width,screen.height);return t&&e<=820}function gt(){return Wt()?120*bt:250*bt}var V=class{constructor(t){this.budget=t;this.entries=new Map;this.used=0}get(t){let e=this.entries.get(t);return e&&(this.entries.delete(t),this.entries.set(t,e)),e}has(t){return this.entries.has(t)}put(t,e){let i=this.entries.get(t);if(i){i.bitmap!==e&&q(e);return}let s=e.width*e.height*4;this.entries.set(t,{bitmap:e,bytes:s,at:performance.now()}),this.used+=s,this.trim(this.budget)}trim(t){for(;this.used>t&&this.entries.size>0;){let e=this.entries.keys().next();if(e.done)return;let i=this.entries.get(e.value);this.entries.delete(e.value),i&&(this.used-=i.bytes,q(i.bitmap))}}};var Ot=400,O=class{constructor(t,e=()=>!0){this.canShow=e;this.handle=null;this.loader=null;this.timer=0;this.hideTimer=0;this.visible=!1;this.element=document.createElement("div"),this.element.className="busy",this.element.setAttribute("role","status"),this.element.setAttribute("aria-label","Loading"),t.appendChild(this.element)}watch(t){if(t===this.loader){this.update(t);return}this.loader=t,clearTimeout(this.timer),this.timer=0,this.hide(),this.update(t)}update(t){if(!t||t!==this.loader)return;let e=t.status;if(!e.active||e.sharp){clearTimeout(this.timer),this.timer=0,this.hide();return}if(!this.visible&&this.timer===0){let i=Math.max(0,Ot-(performance.now()-e.started));this.timer=window.setTimeout(()=>this.check(),i)}}check(){this.timer=0;let t=this.loader;if(!(!t||!t.status.active||t.status.sharp)){if(!this.canShow()){this.timer=window.setTimeout(()=>this.check(),100);return}this.show()}}show(){if(!this.visible){if(clearTimeout(this.hideTimer),this.visible=!0,!this.handle){let t=rt();t&&(this.handle=t.loader(this.element,{size:56,color:W.paper,track:W.graphite3,rays:W.beam}),this.handle.svg.setAttribute("aria-hidden","true"))}this.element.classList.add("is-visible")}}hide(){this.visible&&(this.visible=!1,this.element.classList.remove("is-visible"),clearTimeout(this.hideTimer),this.hideTimer=window.setTimeout(()=>{!this.visible&&this.handle&&(this.handle.stop(),this.handle.svg.remove(),this.handle=null)},300))}},_=class{constructor(t){this.loader=null;this.shown=!1;this.value=-1;this.element=document.createElement("div"),this.element.className="progress",this.element.setAttribute("aria-hidden","true"),t.appendChild(this.element)}watch(t){this.loader=t,this.value=-1,this.update(t)}update(t){if(!t||t!==this.loader)return;let e=t.status,i=e.active&&!e.sharp&&e.planned>0,s=e.planned>0?Math.min(1,e.done/e.planned):0;i!==this.shown&&(this.shown=i,this.element.classList.toggle("is-visible",i));let n=Math.round(s*1e3)/1e3;n!==this.value&&(this.value=n,this.element.style.transform="scaleX("+(i?n:1)+")")}};function K(r,t,e){let i=t*e;for(let s=0;s=i)return s;return r.levels.length-1}function G(r,t,e){let i=Math.max(0,t.u0*r.width),s=Math.min(r.width,t.u1*r.width),n=Math.max(0,t.v0*r.height),o=Math.min(r.height,t.v1*r.height);return s<=i||o<=n?null:{x0:Math.min(r.cols-1,Math.floor(i/e)),x1:Math.min(r.cols-1,Math.ceil(s/e)-1),y0:Math.min(r.rows-1,Math.floor(n/e)),y1:Math.min(r.rows-1,Math.ceil(o/e)-1)}}function yt(r,t,e,i){let s=r.levels[t],n=G(s,e,i);if(!n)return[];let o=(e.u0+e.u1)/2*s.width,a=(e.v0+e.v1)/2*s.height,h=[];for(let l=n.y0;l<=n.y1;l++)for(let m=n.x0;m<=n.x1;m++){let L=(m*i+Math.min((m+1)*i,s.width))/2,w=(l*i+Math.min((l+1)*i,s.height))/2;h.push({level:t,x:m,y:l,index:l*s.cols+m,distance:(L-o)**2+(w-a)**2})}return h.sort((l,m)=>l.distance-m.distance),h.map(({level:l,x:m,y:L,index:w})=>({level:l,x:m,y:L,index:w}))}function wt(r,t,e,i,s,n,o,a,h,l){let m=i*n,L=Math.min((i+1)*n,e.width),w=s*n,p=Math.min((s+1)*n,e.height),E=i>0?m-o:0,d=s>0?w-o:0,x=Math.round(a+m*l),c=Math.round(a+L*l),u=Math.round(h+w*l),f=Math.round(h+p*l);if(c<=x||f<=u)return;let g=Math.max(E,(x-a)/l),A=Math.min(E+t.width,(c-a)/l),v=Math.max(d,(u-h)/l),y=Math.min(d+t.height,(f-h)/l);A<=g||y<=v||r.drawImage(t,g-E,v-d,A-g,y-v,x,u,c-x,f-u)}var xt="luphoto.throughput";function Mt(){try{let r=Number(sessionStorage.getItem(xt));return Number.isFinite(r)&&r>0?r:null}catch{return null}}function Lt(){return Mt()??1e3}function Tt(r){let t=Mt(),e=t===null?r:t*(1-.5)+r*.5;try{sessionStorage.setItem(xt,String(e))}catch{return e}return e}var ht=180,Et=400;function Bt(r,t){return new Promise((e,i)=>{if(t.aborted){i(new F);return}let s=setTimeout(()=>{t.removeEventListener("abort",n),e()},r),n=()=>{clearTimeout(s),i(new F)};t.addEventListener("abort",n,{once:!0})})}var kt=3,J=4,B=class{constructor(t,e){this.pyramid=t;this.env=e;this.seedImage=null;this.seedPromise=null;this.session=null;this.prefetchController=null;this.finalLevel=-1;this.targetLevel=-1;this.status={active:!1,started:0,planned:0,done:0,sharp:!1}}tileUrl(t){let e=this.env.tiles;return e.path+this.pyramid.hash+"/"+t+"."+e.format}ensureSeed(){return this.seedPromise||(this.seedPromise=this.decodeSeed().then(()=>this.env.requestDraw(),()=>{})),this.seedPromise}async decodeSeed(){if(!this.pyramid.seed)return;let t=atob(this.pyramid.seed),e=new Uint8Array(t.length);for(let a=0;a!this.env.cache.has(i[s.index]))}uncachedBytes(t,e){let i=this.pyramid.levels[t].bytes,s=0;for(let n of this.uncached(t,e))s+=i[n.index];return s}fetchAll(t,e,i){return Promise.allSettled(t.map(s=>this.fetchTile(s,e,i)))}probeLevel(t,e){return Math.max(0,K(this.pyramid,t.displayWidth,e)-kt)}notify(){this.env.onStatus?.(this)}track(t,e,i){return this.status.planned+=t.length,this.notify(),Promise.allSettled(t.map(s=>this.fetchTile(s,vt,i).finally(()=>{this.session===e&&(this.status.done++,this.notify())})))}start(t,e,i){this.stopSession();let s=new AbortController;this.session=s,this.targetLevel=-1,this.status.active=!0,this.status.started=performance.now(),this.status.planned=0,this.status.done=0,this.status.sharp=!1,this.notify(),this.run(t,e,s).then(()=>{this.session===s&&(this.session=null,this.status.active=!1,this.notify()),(!s.signal.aborted||s.signal.reason==="deadline")&&i()})}async run(t,e,i){let s=i.signal,n=performance.now(),o=this.env.settings.budgetMs,a=setTimeout(()=>i.abort("deadline"),o);try{if(await this.ensureSeed(),s.aborted)return;let h=K(this.pyramid,t.displayWidth,e),l=Math.max(0,h-kt),m=this.uncached(l,t).slice(0,2);if(m.length>0){let d=await this.track(m,i,s),x=0,c=0;for(let u of d)u.status==="fulfilled"&&(x+=u.value.bytes,c=Math.max(c,u.value.ms));x>0&&c>0&&Tt(x/c)}if(s.aborted)return;this.finalLevel=Math.max(this.finalLevel,l);let L=Lt(),w=o-(performance.now()-n),p=l;for(let d=h;d>l;d--)if(this.uncachedBytes(d,t)/L<=w*.8){p=d;break}let E=[];p-l>=2&&E.push(Math.floor((l+p)/2)),p>l&&E.push(p),this.finalLevel=p,this.targetLevel=p,this.env.requestDraw();for(let d of E)if(await this.track(this.uncached(d,t),i,s),s.aborted)return}finally{clearTimeout(a)}}prefetchProbe(t,e){let i=this.resetPrefetch();this.ensureSeed().then(()=>{i.signal.aborted||this.fetchAll(this.uncached(this.probeLevel(t,e),t),ot,i.signal)})}prefetchLevel(t,e){if(e<0)return;let i=this.resetPrefetch();this.fetchAll(this.uncached(e,t),ot,i.signal)}resetPrefetch(){return this.prefetchController?.abort(),this.prefetchController=new AbortController,this.prefetchController}stopPrefetch(){this.prefetchController?.abort(),this.prefetchController=null}stopSession(){this.session&&(this.session.abort("superseded"),this.session=null,this.status.active=!1,this.notify())}stop(){this.stopSession(),this.stopPrefetch()}draw(t){let{g:e,originX:i,originY:s,width:n,height:o,canvasWidth:a,canvasHeight:h}=t,l=Math.max(0,i),m=Math.max(0,s),L=Math.min(a,i+n),w=Math.min(h,s+o);if(L<=l||w<=m)return!1;this.seedPromise||this.ensureSeed();let p={displayWidth:t.displayWidth,u0:(l-i)/n,u1:(L-i)/n,v0:(m-s)/o,v1:(w-s)/o},E=this.env.tiles.tile_size,d=this.env.tiles.overlap,x=this.env.cache,c=this.pyramid.levels,u=K(this.pyramid,t.displayWidth,t.dpr),f=-1;for(let y=u;y>=0&&f<0;y--){let b=G(c[y],p,E);if(!b)continue;let M=!0;for(let k=b.y0;k<=b.y1&&M;k++)for(let T=b.x0;T<=b.x1;T++){let S=x.get(c[y].tiles[k*c[y].cols+T]);if(!S||t.now-S.at=0?Math.min(this.targetLevel,u):u,A=f>=g;A!==this.status.sharp&&(this.status.sharp=A,queueMicrotask(()=>this.notify()));let v=!1;for(let y=Math.max(0,f);y<=u;y++){let b=c[y],M=G(b,p,E);if(!M)continue;let k=n/b.width;e.imageSmoothingEnabled=!0,e.imageSmoothingQuality=k<1?"high":"medium";for(let T=M.y0;T<=M.y1;T++)for(let S=M.x0;S<=M.x1;S++){let C=x.get(b.tiles[T*b.cols+S]);if(!C)continue;let P=t.now-C.at;Pthis.requestDraw(),onStatus:()=>this.onStatus(this)})}get isOpen(){return this.expanded}get isNear(){return this.near}layout(t){let e=this.cover,i=Math.max(t.width/e.width,t.open/e.height),s=e.width*i,n=e.height*i,o=(t.open-n)/2,a=o+this.focusY*n,h=Math.max(0,Math.min(t.open-t.closed,a-t.closed/2)),l=this.geometry;this.geometry={width:t.width,closed:t.closed,open:t.open,dpr:t.dpr,coverWidth:s,coverHeight:n,x:(t.width-s)/2,y:o,band:h},this.canvas&&(this.sizeCanvas(this.canvasOpen),this.drawNow()),this.near&&l&&(l.width!==t.width||l.closed!==t.closed||l.open!==t.open||l.dpr!==t.dpr)&&this.startSession()}attach(){if(this.canvas)return;let t=document.createElement("canvas");t.className="strip-canvas",t.setAttribute("aria-hidden","true");let e=t.getContext("2d",{alpha:!1});e&&(this.canvas=t,this.g=e,this.element.prepend(t),this.sizeCanvas(this.expanded),this.drawNow())}detach(){this.canvas&&(cancelAnimationFrame(this.frame),this.frame=0,this.canvas.width=0,this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.g=null)}setNear(t){t!==this.near&&(this.near=t,t?this.startSession():this.loader.stop())}setOpen(t){if(t===this.expanded)return;this.expanded=t,this.element.classList.toggle("is-open",t),clearTimeout(this.settleTimer);let e=this.geometry,i=this.canvas;t?i&&this.canvasOpen?(i.style.transition="",i.style.transform="translate3d(0,0,0)"):i&&e&&(this.sizeCanvas(!0),i.style.transition="none",i.style.transform="translate3d(0,"+-e.band+"px,0)",this.drawNow(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.expanded&&this.canvas===i&&(i.style.transition="",i.style.transform="translate3d(0,0,0)")})})):i&&e&&(i.style.transition="",i.style.transform="translate3d(0,"+-e.band+"px,0)",this.settleTimer=window.setTimeout(()=>{!this.expanded&&this.canvas===i&&(this.sizeCanvas(!1),this.drawNow())},Yt)),this.near&&this.startSession()}sizeCanvas(t){let e=this.canvas,i=this.geometry;if(!e||!i)return;this.canvasOpen=t;let s=t?i.open:i.closed,n=Math.max(1,Math.round(i.width*i.dpr)),o=Math.max(1,Math.round(s*i.dpr));(e.width!==n||e.height!==o)&&(e.width=n,e.height=o),e.style.height=s+"px",t||(e.style.transition="none",e.style.transform="translate3d(0,0,0)")}view(){let t=this.geometry;if(!t)return null;let e=this.expanded?0:t.band,i=this.expanded?t.open:t.closed;return{displayWidth:t.coverWidth,u0:Math.max(0,-t.x/t.coverWidth),u1:Math.min(1,(t.width-t.x)/t.coverWidth),v0:Math.max(0,(e-t.y)/t.coverHeight),v1:Math.min(1,(e+i-t.y)/t.coverHeight)}}startSession(){let t=this.view();!t||!this.geometry||this.loader.start(t,this.geometry.dpr,()=>{})}requestDraw(){this.frame===0&&this.canvas&&(this.frame=requestAnimationFrame(t=>{this.frame=0,this.draw(t)&&this.requestDraw()}))}drawNow(){this.draw(performance.now())&&this.requestDraw()}draw(t){let e=this.g,i=this.canvas,s=this.geometry;if(!e||!i||!s)return!1;e.setTransform(1,0,0,1,0,0),e.globalAlpha=1,e.fillStyle="#111114",e.fillRect(0,0,i.width,i.height);let n=this.canvasOpen?0:-s.band;return this.loader.draw({g:e,originX:s.x*s.dpr,originY:(s.y+n)*s.dpr,width:s.coverWidth*s.dpr,height:s.coverHeight*s.dpr,canvasWidth:i.width,canvasHeight:i.height,displayWidth:s.coverWidth,dpr:s.dpr,now:t})}};var Xt=24,j=class{constructor(t,e,i,s){this.root=t;this.settings=i;this.env=s;this.strips=[];this.onScreen=new Set;this.inView=new Set;this.suspended=!1;this.wordmark=null;this.opened=null;this.scrollFrame=0;this.sizeKey="";let n=Array.from(t.querySelectorAll("a.strip")),o=new Map(e.albums.map(h=>[h.slug,h]));for(let h of n){let l=o.get(h.dataset.slug??"");!l||!l.cover||this.strips.push(new Y(h,l.cover,l.collapsed_focus_y??.5,s,m=>this.onStripStatus(m)))}this.hoverMode=matchMedia("(hover: hover) and (pointer: fine)");let a=document.querySelector(".site-header .wordmark");if(this.indicator=new O(document.body,()=>!this.wordmarkMoving()),a){this.wordmark=D(a,!0);let h=()=>{this.wordmark&&!this.indicator.visible&&this.wordmark.play()},l=()=>this.wordmark?.reverse();a.addEventListener("mouseenter",h),a.addEventListener("mouseleave",l),a.addEventListener("focus",h),a.addEventListener("blur",l)}document.documentElement.classList.add("has-strips"),this.measure(),this.observe(),this.bind()}suspend(t){if(!this.suspended){this.suspended=!0;for(let e of this.strips)e.loader.stop(),t&&e.detach();this.env.scheduler.cancelAll(),this.env.cache.trim(t?0:this.env.cache.budget/4)}}resume(){if(this.suspended){this.suspended=!1;for(let t of this.strips)this.inView.has(t)&&t.attach(),t.isNear&&t.startSession()}}wordmarkMoving(){let t=this.wordmark?.t??0;return t>0&&t<1}measure(){let t=this.root.clientWidth||window.innerWidth,e=window.innerHeight,i=Math.round(Math.min(t*6/32,e*.28)),s=Math.round(Math.min(t*9/32,e*.62)),n=Math.min(window.devicePixelRatio||1,this.settings.maxDpr),o=t+"x"+i+"x"+s+"@"+n;if(o!==this.sizeKey){this.sizeKey=o,this.root.style.setProperty("--strip-closed",i+"px"),this.root.style.setProperty("--strip-open",s+"px");for(let a of this.strips)a.layout({width:t,closed:i,open:s,dpr:n})}}observe(){let t=new Map(this.strips.map(n=>[n.element,n])),e=new IntersectionObserver(n=>{for(let o of n)t.get(o.target)?.setNear(o.isIntersecting)},{rootMargin:"100% 0px"}),i=new IntersectionObserver(n=>{for(let o of n){let a=t.get(o.target);a&&(o.isIntersecting?(this.inView.add(a),this.suspended||a.attach()):(this.inView.delete(a),a.detach()))}},{rootMargin:"25% 0px"}),s=new IntersectionObserver(n=>{for(let o of n){let a=t.get(o.target);a&&(o.isIntersecting?this.onScreen.add(a):this.onScreen.delete(a))}this.watchFirst(),this.scheduleCentre()});for(let n of this.strips)e.observe(n.element),i.observe(n.element),s.observe(n.element)}watchFirst(){let t=this.strips.find(e=>this.onScreen.has(e))??null;this.indicator.watch(t?t.loader:null)}onStripStatus(t){this.indicator.update(t.loader)}bind(){for(let t of this.strips){let e=t.element;e.addEventListener("mouseenter",()=>{this.hoverMode.matches&&this.open(t)}),e.addEventListener("mouseleave",()=>{this.hoverMode.matches&&this.opened===t&&this.open(null)}),e.addEventListener("focus",()=>this.open(t)),e.addEventListener("blur",()=>{this.opened===t&&!this.hoverMode.matches?this.scheduleCentre():this.opened===t&&this.open(null)}),e.addEventListener("dragstart",i=>i.preventDefault()),this.settings.blockContextMenu&&e.addEventListener("contextmenu",i=>i.preventDefault())}window.addEventListener("scroll",()=>this.scheduleCentre(),{passive:!0}),new ResizeObserver(()=>{this.measure(),this.scheduleCentre()}).observe(this.root)}open(t){t!==this.opened&&(this.opened?.setOpen(!1),this.opened=t,t?.setOpen(!0))}scheduleCentre(){this.hoverMode.matches||this.scrollFrame!==0||(this.scrollFrame=requestAnimationFrame(()=>{this.scrollFrame=0,this.pickCentre()}))}pickCentre(){if(this.hoverMode.matches)return;let t=window.innerHeight/2,e=null,i=1/0,s=1/0;for(let n of this.onScreen){let o=n.element.getBoundingClientRect(),a=Math.abs(o.top+o.height/2-t);a{let n=Number(i);return Number.isFinite(n)&&n>0?n:s};return{page:t.page??"",build:t.build??"",slug:t.album??"",manifestUrl:t.manifest??"",indexUrl:t.index??"",workerUrl:t.worker??"",budgetMs:e(t.budgetMs,3e3),maxDpr:e(t.maxDpr,2),concurrency:Math.max(1,Math.round(e(t.concurrency,6))),blockContextMenu:t.blockContextMenu!=="false"}}var Ut=/[㐀-鿿豈-﫿]/;function Q(r,t){Ut.test(t)?r.lang="zh":r.removeAttribute("lang")}function At(r){return r<10?"0"+r:String(r)}function Zt(r){let t=(r.model??"").trim(),e=(r.make??"").trim(),i=e.split(/\s+/)[0]??"";i&&t.toLowerCase().startsWith(i.toLowerCase()+" ")&&(t=t.slice(i.length+1).trim());let s=/^([A-Za-z]{1,3}) (\d+[A-Za-z0-9]*)$/.exec(t);return s&&(t=s[1]+s[2]),t||e}function Vt(r){let t=/(\d+(?:\.\d+)?(?:-\d+(?:\.\d+)?)?)\s*mm\s*(?:F|f\/?)\s*([\d.]+(?:-[\d.]+)?)/.exec(r);return t?t[1]+" f/"+t[2]:r.trim()}function $(r){return String(Math.round(r*10)/10)}function _t(r){let t=r.trim();if(t.includes("/")||t.endsWith("s"))return t;let e=Number(t);if(!Number.isFinite(e)||e<=0)return t;if(e>=1)return $(e)+"s";let i=1/e;return i<10&&Math.abs(i-Math.round(i))>.05?"1/"+$(i):"1/"+Math.round(i)}function Kt(r,t,e,i){let s=[At(r+1)+" / "+At(t)],n=e.exif;if(i&&n){let o=Zt(n);o&&s.push(o),n.lens&&s.push(Vt(n.lens)),n.focal_length&&s.push($(n.focal_length)+"mm"),n.f_number&&s.push("f/"+$(n.f_number)),n.exposure&&s.push(_t(n.exposure)),n.iso&&s.push("ISO "+n.iso)}return s.join(" \xB7 ")}function Gt(r,t){r.textContent="",t.split(/\r?\n/).forEach((e,i)=>{i>0&&r.appendChild(document.createElement("br"));let s=e.split("*"),n=(s.length-1)%2===0;s.forEach((o,a)=>{let h=a%2===1;if(h&&(n||a!==s.length-1)){let l=document.createElement("em");l.textContent=o,r.appendChild(l)}else r.appendChild(document.createTextNode((h?"*":"")+o))})})}var tt=class{constructor(t){this.visible=!1;this.placement="";this.element=document.createElement("section"),this.element.className="caption",this.element.setAttribute("aria-label","Caption"),this.meta=document.createElement("p"),this.meta.className="caption-meta",this.title=document.createElement("h2"),this.title.className="caption-title",this.text=document.createElement("p"),this.text.className="caption-text",this.element.append(this.meta,this.title,this.text),t.appendChild(this.element)}set(t,e,i,s){this.meta.textContent=Kt(e,i,t,s),this.title.textContent=t.title??"",this.title.hidden=!t.title,Q(this.title,t.title??""),Gt(this.text,t.caption??""),this.text.hidden=!t.caption,Q(this.text,t.caption??"")}show(t){t!==this.visible&&(this.visible=t,this.element.classList.toggle("is-visible",t))}place(t,e,i){let s=Math.round(t)+","+Math.round(e)+","+Math.round(i);if(s===this.placement)return;this.placement=s;let n=this.element.style;n.width=Math.round(e)+"px",n.transform="translate3d("+Math.round(t)+"px,"+-Math.round(i)+"px,0)"}};var et=24,Ct=10,Jt=300,jt=.35,Pt=.35,Qt=.2,$t=2500,te=120,ee=16,ie=.002,se=.01;function ne(r,t,e,i){let s=3*r,n=3*(e-r)-s,o=1-s-n,a=3*t,h=3*(i-t)-a,l=1-a-h,m=p=>((o*p+n)*p+s)*p,L=p=>((l*p+h)*p+a)*p,w=p=>(3*o*p+2*n)*p+s;return p=>{if(p<=0)return 0;if(p>=1)return 1;let E=p;for(let c=0;c<8;c++){let u=m(E)-p,f=w(E);if(Math.abs(u)<1e-5)return L(E);if(Math.abs(f)<1e-6)break;E-=u/f}let d=0,x=1;E=p;for(let c=0;c<24;c++){let u=m(E);if(Math.abs(u-p)<1e-5)break;uthis.requestDraw(),onStatus:i=>{this.indicator.update(i),this.progress.update(i)}}),this.loaders[t]=e),e}measure(){let t=this.stage.getBoundingClientRect();this.vw=Math.max(1,t.width),this.vh=Math.max(1,t.height),this.ox=t.left,this.oy=t.top,this.dpr=Math.min(window.devicePixelRatio||1,this.settings.maxDpr);let e=Math.max(1,Math.round(this.vw*this.dpr)),i=Math.max(1,Math.round(this.vh*this.dpr));(this.canvas.width!==e||this.canvas.height!==i)&&(this.canvas.width=e,this.canvas.height=i),this.layouts=[],this.stops=[];let s=0;this.manifest.photos.forEach((n,o)=>{let a=Math.max(1,n.slides||1),h=Math.min(this.vw/(n.width/a),this.vh/n.height),l=n.width*h,m=n.height*h,L=l/a,w=s+et/2+(this.vw-L)/2;this.layouts.push({scale:h,width:l,height:m,section:L,slides:a,start:s,left:w,top:(this.vh-m)/2});for(let p=0;p{this.pointerId===null&&document.body.classList.add("is-idle")},$t)}stopForHash(){let t=/^#(\d+)$/.exec(location.hash);if(!t)return 0;let e=Math.min(this.manifest.photos.length,Math.max(1,Number(t[1])))-1,i=this.stops.findIndex(s=>s.photo===e);return i<0?0:i}bind(){let t=this.stage;t.addEventListener("pointerdown",e=>this.onPointerDown(e)),t.addEventListener("pointermove",e=>this.onPointerMove(e)),t.addEventListener("pointerup",e=>this.onPointerUp(e,!1)),t.addEventListener("pointercancel",e=>this.onPointerUp(e,!0)),t.addEventListener("pointerleave",e=>{e.pointerType==="mouse"&&this.pointerId===null&&(this.hover=!1,this.updateCaption())}),t.addEventListener("wheel",e=>this.onWheel(e),{passive:!1}),t.addEventListener("gesturestart",e=>{e.preventDefault(),this.gestureZoom=this.zoom}),t.addEventListener("gesturechange",e=>this.onGesture(e)),t.addEventListener("gestureend",e=>e.preventDefault()),t.addEventListener("dragstart",e=>e.preventDefault()),t.addEventListener("selectstart",e=>e.preventDefault()),this.settings.blockContextMenu&&t.addEventListener("contextmenu",e=>e.preventDefault()),window.addEventListener("keydown",e=>this.onKey(e)),window.addEventListener("hashchange",()=>{let e=this.stopForHash();this.stops[e].photo!==this.stops[this.current].photo?this.jump(e):this.clearZoom()&&(this.startSession(),this.updateCaption())}),new ResizeObserver(()=>this.onResize()).observe(t),this.fade.addEventListener("transitionend",()=>{this.fade.style.opacity==="0"&&(this.fade.width=1,this.fade.height=1)})}onResize(){let t=this.vw+"x"+this.vh+"@"+this.dpr;this.measure(),t!==this.vw+"x"+this.vh+"@"+this.dpr&&(this.clearZoom(),this.tween=null,this.camera=this.stops[this.current].camera,this.requestDraw(),clearTimeout(this.resizeTimer),this.resizeTimer=window.setTimeout(()=>this.startSession(),200))}onKey(t){if(t.altKey||t.ctrlKey||t.metaKey)return;this.wake();let e=t.target;if(!(e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)))){switch(t.key){case"ArrowRight":this.go(this.current+1);break;case"ArrowLeft":this.go(this.current-1);break;case"Home":this.go(0);break;case"End":this.go(this.stops.length-2);break;case"Escape":this.zoomPhoto>=0?this.go(this.current):location.assign("/");break;case"i":case"I":this.pinned=!this.pinned,this.updateCaption();break;default:return}t.preventDefault()}}onPointerDown(t){if(!(t.pointerType==="mouse"&&t.button!==0)){if(this.pointerId!==null){this.secondId===null&&t.pointerType!=="mouse"&&this.pointerType!=="mouse"&&!this.stale&&(this.zoomPhoto>=0||!this.dragging&&this.enterZoom())&&(this.secondId=t.pointerId,this.bx=t.clientX,this.by=t.clientY,this.pinching=!0,this.dragging=!0,this.stage.setPointerCapture(t.pointerId));return}t.target.closest("a, button")||(this.pointerId=t.pointerId,this.pointerType=t.pointerType,this.dragging=!1,this.stale=!1,this.downX=t.clientX,this.downY=t.clientY,this.ax=t.clientX,this.ay=t.clientY,this.downT=t.timeStamp,this.tween=null,this.downCamera=this.camera,this.samples=[{t:t.timeStamp,x:t.clientX}],this.stage.setPointerCapture(t.pointerId))}}onPointerMove(t){if(t.pointerType==="mouse"&&this.wake(),this.pointerId===null){t.pointerType==="mouse"&&(this.hover=this.inCaptionZone(t.clientX,t.clientY),this.updateCaption());return}if(this.pinching&&(t.pointerId===this.pointerId||t.pointerId===this.secondId)){this.pinchMove(t.pointerId,t.clientX,t.clientY);return}if(t.pointerId!==this.pointerId||this.stale)return;let e=t.clientX-this.downX,i=t.clientY-this.downY;if(!this.dragging&&Math.hypot(e,i)>=Ct&&(this.dragging=!0,this.stage.classList.add("is-dragging"),this.updateCaption()),!this.dragging){this.ax=t.clientX,this.ay=t.clientY;return}if(this.zoomPhoto>=0){this.zx+=t.clientX-this.ax,this.zy+=t.clientY-this.ay,this.ax=t.clientX,this.ay=t.clientY,this.settleZoom();return}for(this.samples.push({t:t.timeStamp,x:t.clientX});this.samples.length>2&&t.timeStamp-this.samples[0].t>100;)this.samples.shift();this.camera=this.rubber(this.downCamera-e),this.requestDraw()}onPointerUp(t,e){if(this.pinching&&(t.pointerId===this.pointerId||t.pointerId===this.secondId)){this.endPinch(t.pointerId);return}if(t.pointerId!==this.pointerId)return;this.stage.hasPointerCapture(t.pointerId)&&this.stage.releasePointerCapture(t.pointerId),this.pointerId=null;let i=this.dragging;if(this.dragging=!1,this.stage.classList.remove("is-dragging"),this.stale){this.stale=!1;return}let s=Math.hypot(t.clientX-this.downX,t.clientY-this.downY);if(!e&&!i&&s=0)return;let n=0,o=this.samples[0],a=this.samples[this.samples.length-1];o&&a&&a.t>o.t&&t.timeStamp-a.t<100&&(n=(a.x-o.x)/(a.t-o.t));let h=this.nearestStop(this.camera);if(!e&&Math.abs(n)>jt)if(n<0){let l=this.stops.findIndex(m=>m.camera>this.camera+1);h=l<0?this.stops.length-1:l}else{let l=0;this.stops.forEach((m,L)=>{m.camera=0)return;let i=this.photoRect(e.photo);t.clientX>=i.left&&t.clientX<=i.right&&t.clientY>=i.top&&t.clientY<=i.bottom&&(this.pinned=!this.pinned,this.updateCaption())}onWheel(t){if(t.preventDefault(),this.pinching||this.dragging&&this.zoomPhoto<0)return;let e=t.deltaY;if(t.deltaMode===1?e*=ee:t.deltaMode===2&&(e*=this.vh),e===0)return;let i=Math.max(-1,Math.min(1,e*(t.ctrlKey?se:ie))),s=t.clientX-this.ox,n=t.clientY-this.oy;this.zoomTo(this.zoom*Math.exp(-i),s,n,s,n)}onGesture(t){if(t.preventDefault(),this.pointerId!==null||!t.scale)return;let e=(t.clientX??this.ox+this.vw/2)-this.ox,i=(t.clientY??this.oy+this.vh/2)-this.oy;this.zoomTo(this.gestureZoom*t.scale,e,i,e,i)}pinchMove(t,e,i){let s=(this.ax+this.bx)/2-this.ox,n=(this.ay+this.by)/2-this.oy,o=Math.hypot(this.ax-this.bx,this.ay-this.by);t===this.pointerId?(this.ax=e,this.ay=i):(this.bx=e,this.by=i);let a=Math.hypot(this.ax-this.bx,this.ay-this.by),h=o>1&&a>1?this.zoom*a/o:this.zoom;this.zoomTo(h,s,n,(this.ax+this.bx)/2-this.ox,(this.ay+this.by)/2-this.oy)}endPinch(t){this.stage.hasPointerCapture(t)&&this.stage.releasePointerCapture(t),t===this.pointerId&&(this.pointerId=this.secondId,this.ax=this.bx,this.ay=this.by),this.secondId=null,this.pinching=!1,this.dragging=!0,this.zoomPhoto>=0&&this.settleZoom()}enterZoom(){let t=this.stops[this.current];if(t.photo<0||this.suspended)return!1;let e=this.layouts[t.photo],i=this.manifest.photos[t.photo].width/(window.devicePixelRatio||1)/e.width;return i<=1.001?!1:(this.tween=null,this.camera=t.camera,this.zoomPhoto=t.photo,this.zoomMax=i,this.zoom=1,this.zx=e.left-(this.camera-this.vw/2),this.zy=e.top,this.slackX=this.zx-this.clampAxis(this.zx,e.width,this.vw,0),this.slackY=this.zy-this.clampAxis(this.zy,e.height,this.vh,0),this.updateCaption(),!0)}zoomTo(t,e,i,s,n){if(this.zoomPhoto<0&&(t<=1||!this.enterZoom()))return;let o=Math.max(1,Math.min(this.zoomMax,t)),a=o/this.zoom;this.zx=s-(e-this.zx)*a,this.zy=n-(i-this.zy)*a,this.zoom=o,this.settleZoom()}settleZoom(){let t=this.layouts[this.zoomPhoto];if(this.zx=this.clampAxis(this.zx,t.width*this.zoom,this.vw,this.slackX),this.zy=this.clampAxis(this.zy,t.height*this.zoom,this.vh,this.slackY),this.requestDraw(),this.zoom<=1&&!this.pinching){this.camera=t.left+this.vw/2-this.zx,this.go(this.nearestStop(this.camera));return}clearTimeout(this.zoomTimer),this.zoomTimer=window.setTimeout(()=>this.startZoomSession(),te)}clampAxis(t,e,i,s){let n=(i-e)/2,o=Math.min(i-e,n),a=Math.max(0,n),h=s*Math.max(0,2-this.zoom);return h>0?a+=h:o+=h,Math.min(a,Math.max(o,t))}clearZoom(){return this.zoomPhoto<0?!1:(this.zoomPhoto=-1,this.zoom=1,this.gestureZoom=1,clearTimeout(this.zoomTimer),this.zoomTimer=0,this.pointerId!==null&&(this.stale=!0,this.pinching=!1,this.secondId=null),this.requestDraw(),!0)}levelDpr(){return this.zoomPhoto>=0&&this.zoom>=this.zoomMax*.999?Math.max(this.dpr,window.devicePixelRatio||1):this.dpr}startZoomSession(){if(this.zoomTimer=0,this.suspended||this.zoomPhoto<0)return;let t=this.layouts[this.zoomPhoto],e=t.width*this.zoom,i=t.height*this.zoom,s=Math.max(0,this.zx),n=Math.min(this.vw,this.zx+e),o=Math.max(0,this.zy),a=Math.min(this.vh,this.zy+i);n<=s||a<=o||this.loader(this.zoomPhoto).start({displayWidth:e,u0:(s-this.zx)/e,u1:(n-this.zx)/e,v0:(o-this.zy)/i,v1:(a-this.zy)/i},this.levelDpr(),()=>{})}rubber(t){let e=this.stops[0].camera,i=this.stops[this.stops.length-1].camera;return ti?i+(t-i)*Pt:t}nearestStop(t){let e=0;return this.stops.forEach((i,s)=>{Math.abs(i.camera-t){this.current=e,this.camera=n});else{let o=Math.abs(n-this.camera);o>.5?this.tween={from:this.camera,to:n,start:performance.now(),duration:240+200*Math.min(1,o/this.vw)}:this.camera=n,this.current=e}e!==i?this.activate(i):(s&&this.startSession(),this.updateCaption()),this.requestDraw()}jump(t){let e=this.current;this.clearZoom(),this.tween=null,this.crossfade(()=>{this.current=t,this.camera=this.stops[t].camera}),this.activate(e),this.requestDraw()}crossfade(t){let e=this.fade;(e.width!==this.canvas.width||e.height!==this.canvas.height)&&(e.width=this.canvas.width,e.height=this.canvas.height);let i=e.getContext("2d");i&&i.drawImage(this.canvas,0,0),e.style.transition="none",e.style.opacity="1",t(),this.render(performance.now()),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition="",e.style.opacity="0"})})}activate(t){let e=this.stops[this.current],i=t>=0?this.stops[t]:null;if(i&&i.photo>=0&&i.photo!==e.photo&&this.loaders[i.photo]?.stop(),this.loaders.forEach((s,n)=>{s&&n!==e.photo&&n!==e.photo+1&&s.stopPrefetch()}),e.photo<0&&(this.indicator.watch(null),this.progress.watch(null)),this.describe(e.photo,t>=0),e.photo>=0){let s=this.manifest.photos[e.photo];this.caption.set(s,e.photo,this.manifest.photos.length,this.manifest.show_exif),(t>=0||location.hash!=="")&&location.hash!=="#"+(e.photo+1)&&history.replaceState(history.state,"","#"+(e.photo+1)),this.startSession()}this.syncNextStrip(),this.updateCaption()}describe(t,e){let i=this.manifest.photos.length,s;if(t<0){let n=this.nextLink.querySelector(".next-title")?.textContent??"";s="End of album."+(n?" Next album: "+n+".":"")}else{let n=this.manifest.photos[t],o=n.alt||n.title||"";s="Photo "+(t+1)+" of "+i+(o?": "+o:"")}this.canvas.setAttribute("aria-label",s),clearTimeout(this.announceTimer),e&&(this.announceTimer=window.setTimeout(()=>{this.announcer.textContent=s},500))}suspend(t){if(!this.suspended){this.suspended=!0,this.tween=null;for(let e of this.loaders)e?.stop();this.nextStrip?.loader.stop(),this.env.scheduler.cancelAll(),this.env.cache.trim(t?0:this.env.cache.budget/4),t&&(this.nextStrip?.detach(),this.canvas.width=1,this.canvas.height=1,this.fade.width=1,this.fade.height=1)}}resume(){this.suspended&&(this.suspended=!1,this.clearZoom(),this.canvas.width=0,this.measure(),this.camera=this.stops[this.current].camera,this.syncNextStrip(),this.startSession(),this.requestDraw())}startSession(){let t=this.stops[this.current];if(t.photo<0)return;let e=this.current,i=this.loader(t.photo);i.start(this.viewAt(t),this.dpr,()=>{this.current===e&&this.prefetchAround(e)}),this.indicator.watch(i),this.progress.watch(i)}prefetchAround(t){let e=this.stops[t],i=this.stops[t+1];if(!(!i||i.photo<0)){if(i.photo===e.photo){let s=this.loader(e.photo);s.prefetchLevel(this.viewAt(i),s.finalLevel);let n=this.stops.find(o=>o.photo===e.photo+1);n&&this.loader(n.photo).prefetchProbe(this.viewAt(n),this.dpr);return}this.loader(i.photo).prefetchProbe(this.viewAt(i),this.dpr)}}viewAt(t){let e=this.layouts[t.photo],i=t.camera-this.vw/2,s=Math.max(i,e.left),n=Math.min(i+this.vw,e.left+e.width),o=Math.max(0,e.top),a=Math.min(this.vh,e.top+e.height);return{displayWidth:e.width,u0:(s-e.left)/e.width,u1:(n-e.left)/e.width,v0:(o-e.top)/e.height,v1:(a-e.top)/e.height}}photoRect(t){let e=this.layouts[t],i=e.left-(this.camera-this.vw/2);return{left:Math.max(0,i),right:Math.min(this.vw,i+e.width),top:Math.max(0,e.top),bottom:Math.min(this.vh,e.top+e.height)}}inCaptionZone(t,e){let i=this.stops[this.current];if(i.photo<0)return!1;let s=this.stage.getBoundingClientRect(),n=t-s.left,o=e-s.top,a=this.layouts[i.photo],h=this.photoRect(i.photo),l=a.top+a.height*(1-Qt);return n>=h.left&&n<=h.right&&o>=l&&o<=h.bottom}updateCaption(){let t=this.stops[this.current],e=t.photo>=0&&this.zoomPhoto<0&&!this.dragging&&(this.pinned||this.hover);if(e){let i=this.photoRect(t.photo);this.caption.place(i.left,i.right-i.left,this.vh-i.bottom)}this.caption.show(e),document.body.classList.toggle("has-caption",e)}loadNextAlbum(){this.indexRequested||!this.settings.indexUrl||(this.indexRequested=!0,fetch(this.settings.indexUrl,{credentials:"same-origin"}).then(t=>t.ok?t.json():Promise.reject(new Error("index"))).then(t=>this.showNextAlbum(t)).catch(()=>{this.indexRequested=!1}))}showNextAlbum(t){let e=t.albums;if(e.length===0)return;let i=e.findIndex(a=>a.slug===this.manifest.slug),s=e[(i+1)%e.length];if(!s||s.slug===this.manifest.slug)return;this.nextLink.href="/a/"+encodeURIComponent(s.slug)+"/";let n=this.nextLink.querySelector(".next-eyebrow"),o=this.nextLink.querySelector(".next-title");n&&(n.textContent="Next album"+(s.date?" \xB7 "+s.date:"")),o&&(o.textContent=s.title,Q(o,s.title)),s.cover&&(this.nextStrip=new Y(this.nextFrame,s.cover,s.collapsed_focus_y??.5,{...this.env,tiles:t.tiles},()=>{}),this.nextLink.classList.add("has-strip"),this.layoutNextStrip(),this.syncNextStrip())}requestDraw(){this.frame===0&&(this.frame=requestAnimationFrame(t=>{this.frame=0,this.render(t)}))}render(t){let e=!1;if(this.tween){let w=Math.min(1,(t-this.tween.start)/this.tween.duration);this.camera=this.tween.from+(this.tween.to-this.tween.from)*re(w),w>=1?(this.tween=null,this.updateCaption()):e=!0}let i=this.g,s=this.canvas.width,n=this.canvas.height;i.setTransform(1,0,0,1,0,0),i.globalAlpha=1,i.fillStyle="#111114",i.fillRect(0,0,s,n);let o=this.camera-this.vw/2,a=o+this.vw,h=this.dpr,l=this.stops[this.current].photo,m=Math.max(0,(l<0?this.layouts.length-1:l)-2),L=this.zoomPhoto>=0?-1:Math.min(this.layouts.length-1,(l<0?this.layouts.length-1:l)+2);if(this.zoomPhoto>=0){let w=this.layouts[this.zoomPhoto],p=w.width*this.zoom;this.loader(this.zoomPhoto).draw({g:i,originX:this.zx*h,originY:this.zy*h,width:p*h,height:w.height*this.zoom*h,canvasWidth:s,canvasHeight:n,displayWidth:p,dpr:this.levelDpr(),now:t})&&(e=!0)}for(let w=m;w<=L;w++){let p=this.layouts[w];p.left+p.widtha||this.loader(w).draw({g:i,originX:(p.left-o)*h,originY:p.top*h,width:p.width*h,height:p.height*h,canvasWidth:s,canvasHeight:n,displayWidth:p.width,dpr:h,now:t})&&(e=!0)}this.endCard.style.transform="translate3d("+Math.round(this.endLeft-o)+"px,0,0)",this.caption.element.classList.contains("is-visible")&&this.tween&&this.updateCaption(),e&&this.requestDraw()}};async function zt(r){let t=await fetch(r,{credentials:"same-origin"});if(!t.ok)throw new Error(r+" "+t.status);return await t.json()}function Rt(r){return{scheduler:new Z(r.concurrency,r.workerUrl),cache:new V(gt())}}async function oe(r,t){let e=await zt(t.manifestUrl);if(e.photos.length===0)return;let{scheduler:i,cache:s}=Rt(t);document.documentElement.classList.add("has-viewer"),Ft(new it(r,e,t,{scheduler:i,cache:s,settings:t,tiles:e.tiles}))}async function ae(r,t){let e=await zt(t.indexUrl),{scheduler:i,cache:s}=Rt(t);Ft(new j(r,e,t,{scheduler:i,cache:s,settings:t,tiles:e.tiles}))}function Ft(r){document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?r.suspend(!1):r.resume()}),window.addEventListener("pagehide",()=>r.suspend(!0)),window.addEventListener("pageshow",t=>{t.persisted&&r.resume()})}function he(){document.documentElement.classList.remove("has-viewer"),document.querySelector(".load-error")?.removeAttribute("hidden")}function It(){let r=St(document.body);if(r.page==="album"){let t=document.getElementById("stage");t&&oe(t,r).catch(()=>he())}else if(r.page==="notfound"){let t=document.querySelector(".site-header .wordmark");t&&D(t,!1)}else if(r.page==="index"){let t=document.getElementById("strips");t&&ae(t,r).catch(()=>{document.documentElement.classList.remove("has-strips");let e=document.querySelector(".site-header .wordmark");e&&!e.classList.contains("has-svg")&&D(e,!1)})}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",It,{once:!0}):It();})(); +"use strict";(()=>{(function(n){let t={from:"Guoliang",to:"Lucio",letters:[{ch:"G",kind:"keep",shared:"M8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50",fullA:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",fullB:"M8.50 0.00L8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50L80.00 91.50",out:[{d:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00",P:79.21,j:"end"},{d:"M58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",P:73.21,j:"start"}],in:[{d:"M8.50 22.00L8.50 0.00",P:22,j:"start"},{d:"M58.00 91.50L80.00 91.50",P:22,j:"start"}],x0:0,x1:0,dot:null},{ch:"u",kind:"keep",shared:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullA:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullB:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",out:[],in:[],x0:88.8,x1:88,dot:null},{ch:"o",kind:"keep",shared:"M38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullB:"M60.00 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50L60.00 91.50",out:[{d:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50",P:60.41,j:"both"}],in:[{d:"M38.00 46.50L60.00 46.50",P:22,j:"start"},{d:"M38.00 91.50L60.00 91.50",P:22,j:"start"}],x0:159,x1:158.2,dot:null},{ch:"l",kind:"fade",d:"M8.50 0.00L8.50 100.00",x0:230.8,x1:230.8,dot:null},{ch:"i",kind:"keep",shared:"M8.50 38.00L8.50 100.00",fullA:"M8.50 38.00L8.50 100.00",fullB:"M8.50 38.00L8.50 100.00",out:[],in:[],x0:262.8,x1:227.9,dot:[0,14,17]},{ch:"a",kind:"fade",d:"M38.00 91.50L51.50 91.50L51.50 78.00L51.50 60.00L51.50 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",x0:291.6,x1:291.6,dot:null},{ch:"n",kind:"fade",d:"M51.50 100.00L51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00L8.50 100.00",x0:362.7,x1:362.7,dot:null},{ch:"g",kind:"keep",shared:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M0.00 127.50L38.00 127.50A13.50 13.50 0 0 0 51.50 114.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00",fullB:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",out:[{d:"M51.50 60.00L51.50 114.00A13.50 13.50 0 0 1 38.00 127.50L0.00 127.50",P:113.21,j:"start"}],in:[],x0:432.9,x1:256.7,dot:null}],pad:17,vbw:526.9,vbh:170,stroke:17,raysT:"translate(0.000 22.727) scale(0.7727)"},e="M47.6 70.7L71.9 61.1L71.1 58.2L45.2 62.0ZM44.9 61.5L61.2 40.9L59.1 38.8L38.5 55.1ZM38.0 54.8L41.8 28.9L38.9 28.1L29.3 52.4Z",i="http://www.w3.org/2000/svg",s=(u,g)=>{let d=document.createElementNS(i,u);for(let v in g)d.setAttribute(v,g[v]);return d},r=()=>n.matchMedia&&n.matchMedia("(prefers-reduced-motion: reduce)").matches,o=u=>Math.max(0,Math.min(1,u)),a=u=>u*u*(3-2*u),h=.5;function l(u,g){let d=0,v=0,f=null,M=0;function S(L){let w=(L-M)/g;M=L,d=dp(1),reverse:()=>p(0),toggle:()=>p(v?0:1),set:L=>{cancelAnimationFrame(f),f=null,v=d=L,u(d)},stop:()=>{cancelAnimationFrame(f),f=null},get t(){return d}}}function c(u,g,d,v){let f=o(v)*g;if(u.style.visibility=f<.05?"hidden":"visible",d==="both"){let M=f/2;u.setAttribute("stroke-dasharray",M.toFixed(2)+" "+Math.max(0,g-2*M).toFixed(2)+" "+M.toFixed(2)),u.setAttribute("stroke-dashoffset","0")}else d==="end"?(u.setAttribute("stroke-dasharray",f.toFixed(2)+" "+(2*g+20).toFixed(2)),u.setAttribute("stroke-dashoffset",(-(g-f)).toFixed(2))):(u.setAttribute("stroke-dasharray",f.toFixed(2)+" "+(2*g+20).toFixed(2)),u.setAttribute("stroke-dashoffset","0"))}function b(u,g={}){let d=Object.assign({trigger:"hover",color:"currentColor",rays:"#FFF3CF",duration:450,autoDelay:1800},g),v=s("svg",{viewBox:"0 0 "+t.vbw+" "+t.vbh,role:"img","aria-label":"Guoliang Chen, Lucio"});v.style.display="block",v.style.width="100%",v.style.height="auto";let f=s("g",{transform:"translate("+t.pad+" "+t.pad+")",fill:"none",stroke:d.color,"stroke-width":t.stroke,"stroke-linejoin":"miter","stroke-linecap":"butt"});v.appendChild(f);let M=t.letters.map(w=>{let k=s("g",{transform:"translate("+w.x0+" 0)"});f.appendChild(k);let E=Object.assign({g:k,outEls:[],inEls:[]},w);if(w.kind==="fade")E.fadeEl=s("path",{d:w.d}),k.appendChild(E.fadeEl);else{E.fullA=s("path",{d:w.fullA}),k.appendChild(E.fullA),E.fullB=s("path",{d:w.fullB}),k.appendChild(E.fullB),w.shared&&k.appendChild(s("path",{d:w.shared}));for(let A of w.out){let T=s("path",{d:A.d});k.appendChild(T),E.outEls.push([T,A])}for(let A of w.in){let T=s("path",{d:A.d});k.appendChild(T),E.inEls.push([T,A])}}return w.dot&&(E.dotEl=s("rect",{x:w.dot[0],y:w.dot[1],width:w.dot[2],height:w.dot[2],rx:w.dot[2]*.22,fill:d.color,stroke:"none"}),k.appendChild(E.dotEl)),E}),S=s("path",{d:e,fill:d.rays,stroke:"none",opacity:0});f.appendChild(S),u.appendChild(v);function p(w){let k=a(o(w/h)),E=a(o((w-h)/(1-h)));for(let A of M){if(A.kind==="fade")A.fadeEl.setAttribute("opacity",(1-k).toFixed(3)),A.dotEl&&A.dotEl.setAttribute("opacity",(1-k).toFixed(3));else{for(let[T,C]of A.outEls)c(T,C.P,C.j,1-k);for(let[T,C]of A.inEls)c(T,C.P,C.j,k);A.fullA.style.visibility=k<=.001?"visible":"hidden",A.fullB.style.visibility=k>=.999?"visible":"hidden"}A.g.setAttribute("transform","translate("+(A.x0+(A.x1-A.x0)*E).toFixed(2)+" 0)")}S.setAttribute("transform","translate("+(M[0].x0+(M[0].x1-M[0].x0)*E).toFixed(2)+" 0) "+t.raysT),S.setAttribute("opacity",o((w-.8)/.2).toFixed(3))}let L=l(p,d.duration);return p(0),d.trigger==="hover"&&(u.addEventListener("mouseenter",L.play),u.addEventListener("mouseleave",L.reverse),u.addEventListener("focus",L.play),u.addEventListener("blur",L.reverse)),d.trigger==="click"&&u.addEventListener("click",L.toggle),d.trigger==="auto"&&setInterval(L.toggle,d.autoDelay+d.duration),Object.assign(L,{svg:v})}let y={C:[0,.75],L:[.25,.75],U:[.25,1],I:[.75,1],O:[.75,1.75]};function m(u,g,d){let v=g/2,f=d-v,M=v+f,S=f*Math.SQRT1_2,p=w=>w.toFixed(3);return{d:"M"+p(u-M+S)+" "+p(M-S)+"A"+p(f)+" "+p(f)+" 0 0 0 "+p(u-M)+" "+p(v)+"H"+p(M)+"A"+p(f)+" "+p(f)+" 0 0 0 "+p(v)+" "+p(M)+"V"+p(u-M)+"A"+p(f)+" "+p(f)+" 0 0 0 "+p(M)+" "+p(u-v)+"H"+p(u-M)+"A"+p(f)+" "+p(f)+" 0 0 0 "+p(u-v)+" "+p(u-M)+"V"+p(M)+"A"+p(f)+" "+p(f)+" 0 0 0 "+p(u-M+S)+" "+p(M-S)+"Z",P:4*(u-2*M)+2*Math.PI*f}}function x(u,g={}){let d=Object.assign({sequence:"LUCIO",color:"#F3F1EC",track:"#26262D",rays:"#FFF3CF",hold:480,morph:640,size:96,stroke:.17,radius:.22},g),v=120,f=v*d.stroke,M=v*d.radius,S=m(v,f,M),p=s("svg",{viewBox:"0 0 "+v+" "+v,width:d.size,height:d.size,role:"img","aria-label":"Loading"});d.track&&p.appendChild(s("path",{d:S.d,fill:"none",stroke:d.track,"stroke-width":f}));let L=s("path",{d:S.d,fill:"none",stroke:d.color,"stroke-width":f,"stroke-linecap":"butt"}),w=f/22,k=s("path",{d:e,fill:d.rays,transform:"translate("+(f-22*w).toFixed(3)+" "+(v-f-78*w).toFixed(3)+") scale("+w.toFixed(4)+")",opacity:0});p.appendChild(L),p.appendChild(k);let E=(R,U)=>{let P=Math.min(1,Math.max(0,U-R))*S.P;L.setAttribute("stroke-dasharray",P.toFixed(3)+" "+Math.max(0,S.P-P).toFixed(3)),L.setAttribute("stroke-dashoffset",(-R*S.P).toFixed(3))},A=(R,U)=>{let[P,K]=y[U];for(let H=-1;H<6;H++)if(P+H>=R[0]-1e-6&&K+H>=R[1]-1e-6)return[P+H,K+H];return[P,K]},T=d.sequence.split(""),C=0,I=y[T[0]].slice(),bt,gt,St=!1;E(I[0],I[1]),k.setAttribute("opacity",T[0]==="L"?1:0);function Tt(){if(St)return;let R=(C+1)%T.length,U=A(I,T[R]),P=I.slice(),K=T[C]==="L",H=T[R]==="L",Ct=()=>{I=U;let $=Math.floor(I[0]);I[0]-=$,I[1]-=$,C=R,E(I[0],I[1]),k.setAttribute("opacity",H?1:0),gt=setTimeout(Tt,d.hold)};if(r()){Ct();return}let ae=performance.now(),Pt=$=>{let F=Math.min(1,($-ae)/d.morph),It=F<.5?4*F*F*F:1-Math.pow(-2*F+2,3)/2;E(P[0]+(U[0]-P[0])*It,P[1]+(U[1]-P[1])*It),k.setAttribute("opacity",H?Math.max(0,(F-.6)/.4).toFixed(3):K?Math.max(0,1-F*2.5).toFixed(3):0),F<1?bt=requestAnimationFrame(Pt):Ct()};bt=requestAnimationFrame(Pt)}return gt=setTimeout(Tt,d.hold),u.appendChild(p),{svg:p,stop:()=>{St=!0,cancelAnimationFrame(bt),clearTimeout(gt)}}}n.LucioMorph={wordmark:b,loader:x}})(window);var B={graphite:"#111114",graphite3:"#26262D",paper:"#F3F1EC",beam:"#FFF3CF"};function yt(){return window.LucioMorph??null}function D(n,t){let e=yt();if(!e)return null;let i=document.createElement("span");i.className="wordmark-svg",i.setAttribute("aria-hidden","true"),n.appendChild(i);let s=e.wordmark(i,{trigger:"manual",color:B.paper,rays:B.beam});return s.svg.setAttribute("aria-hidden","true"),s.svg.removeAttribute("role"),t||s.set(1),n.classList.add("has-svg"),s}function zt(){let n=document.getElementById("chop-template");if(!(n instanceof HTMLTemplateElement))return null;let t=n.content.firstElementChild;return t?t.cloneNode(!0):null}function he(n){let t=n.seed+"|"+n.level+"|"+n.x+"|"+n.y,e=2166136261;for(let i=0;i>>0;return e}function le(n,t){let e=new Array(n);for(let r=0;r{i=i+1831565813|0;let r=Math.imul(i^i>>>15,1|i);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296};for(let r=n-1;r>0;r--){let o=Math.floor(s()*(r+1)),a=e[r];e[r]=e[o],e[o]=a}return e}function Rt(n,t,e,i,s){n.drawImage(t,0,0);let r=s.cell,o=Math.floor(e/r),a=Math.floor(i/r);if(o<2||a<2)return;let h=o*a,l=le(h,he(s));for(let c=0;c"u"||e==="")return;let i=(navigator.hardwareConcurrency??2)>=4?2:1;for(let s=0;sthis.onReply(a.data,o),r.onerror=()=>this.dropWorker(o),this.workers.push(r)}catch{break}}request(t,e,i,s,r){return s.aborted?Promise.reject(new z):new Promise((o,a)=>{let h=this.byId.get(t);h?i{c.waiters.delete(l)&&(a(new z),c.waiters.size===0&&setTimeout(()=>{c.waiters.size===0&&this.byKey.get(c.key)===c&&this.cancel(c)},0))},{once:!0}),this.pump()})}cancelAll(){for(let t of[...this.byKey.values()]){let e=[...t.waiters];t.waiters.clear();for(let i of e)i.reject(new z);this.cancel(t)}}cancel(t){if(this.forget(t),!t.running){let e=this.queue.indexOf(t);e>=0&&this.queue.splice(e,1);return}t.running=!1,this.running--,t.controller?t.controller.abort():t.worker>=0&&this.workers[t.worker]&&this.workers[t.worker].postMessage({type:"abort",key:t.key}),this.pump()}forget(t){this.byId.get(t.id)===t&&this.byId.delete(t.id),this.byKey.delete(t.key)}pump(){for(;this.running0;){let t=0;for(let i=1;i0&&(!t.scramble||this.workersUnscramble)){let i=e[this.nextWorker++%e.length];t.worker=i,this.workers[i].postMessage({type:"fetch",key:t.key,url:t.url,scramble:t.scramble});return}this.runOnMainThread(t)}runOnMainThread(t){t.worker=-1,t.controller=new AbortController,this.fetchOnMainThread(t,t.controller.signal)}liveWorkers(){let t=[];return this.workers.forEach((e,i)=>{e&&t.push(i)}),t}dropWorker(t){let e=this.workers[t];if(e){e.terminate(),delete this.workers[t];for(let i of this.byKey.values())i.running&&i.worker===t&&this.runOnMainThread(i)}}async fetchOnMainThread(t,e){let i=performance.now();try{let s=await fetch(t.url,{signal:e,credentials:"same-origin"});if(!s.ok)throw new Error("HTTP "+s.status);let r=await s.blob(),o=performance.now()-i,a=await wt(r);t.scramble&&(a=await ce(a,t.scramble)),this.onReply({key:t.key,ok:!0,bitmap:a,bytes:r.size,ms:o},-1)}catch(s){this.onReply({key:t.key,ok:!1,bytes:0,ms:0,error:String(s)},-1)}}onReply(t,e){let i=this.byKey.get(t.key);if(!i||!i.running||i.worker!==e){t.bitmap&&q(t.bitmap);return}if(!t.ok&&e>=0&&(t.error==="unsupported-bitmap"||t.error==="unsupported-offscreen")){t.error==="unsupported-bitmap"?this.dropWorker(e):(this.workersUnscramble=!1,this.runOnMainThread(i));return}i.running=!1,this.running--,this.forget(i);let s=[...i.waiters];if(i.waiters.clear(),t.ok&&t.bitmap){let r={bitmap:t.bitmap,bytes:t.bytes,ms:t.ms};for(let o of s)o.resolve(r);s.length===0&&q(t.bitmap)}else{let r=new Error(t.error??"tile failed");for(let o of s)o.reject(r)}this.pump()}};var Ht=1024*1024;function de(){let n=navigator.deviceMemory;if(typeof n=="number"&&n<=4)return!0;let t=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,e=Math.min(screen.width,screen.height);return t&&e<=820}function Ft(){return de()?120*Ht:250*Ht}var st=class{constructor(t){this.budget=t;this.entries=new Map;this.used=0}get(t){let e=this.entries.get(t);return e&&(this.entries.delete(t),this.entries.set(t,e)),e}has(t){return this.entries.has(t)}put(t,e){let i=this.entries.get(t);if(i){i.bitmap!==e&&q(e);return}let s=e.width*e.height*4;this.entries.set(t,{bitmap:e,bytes:s,at:performance.now()}),this.used+=s,this.trim(this.budget)}trim(t){for(;this.used>t&&this.entries.size>0;){let e=this.entries.keys().next();if(e.done)return;let i=this.entries.get(e.value);this.entries.delete(e.value),i&&(this.used-=i.bytes,q(i.bitmap))}}};var ue=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Y=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function qt(n,t){for(let e=t;e<64;e++){let i=n[e-15],s=n[e-2],r=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,o=(s>>>17|s<<15)^(s>>>19|s<<13)^s>>>10;n[e]=n[e-16]+r+n[e-7]+o|0}}function Lt(n,t,e,i){let s=n[0],r=n[1],o=n[2],a=n[3],h=n[4],l=n[5],c=n[6],b=n[7];for(let y=e;y>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&l^~h&c)+ue[y]+t[y]|0,x=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&r^s&o^r&o)|0;b=c,c=l,l=h,h=a+m|0,a=o,o=r,r=s,s=m+x|0}n[0]=s,n[1]=r,n[2]=o,n[3]=a,n[4]=h,n[5]=l,n[6]=c,n[7]=b}var xt=new Int32Array(64),Mt=new Int32Array(8),N=new Int32Array(8);function Nt(n,t=new Uint8Array(32)){N.set(Y);let e=n.length,i=Math.ceil((e+9)/64);for(let s=0;s=r+56){let b=l-r-56;c=b<3?0:b===3?e>>>29&255:e*8>>>(7-b)*8&255}a=a<<8|c}xt[o]=a}qt(xt,16),Mt.set(N),Lt(Mt,xt,0,64);for(let o=0;o<8;o++)N[o]=N[o]+Mt[o]|0}for(let s=0;s<8;s++)t[s*4]=N[s]>>>24,t[s*4+1]=N[s]>>>16&255,t[s*4+2]=N[s]>>>8&255,t[s*4+3]=N[s]&255;return t}var me=new TextEncoder;function Ut(n,t,e){let i=me.encode(n),s=new Uint8Array(i.length+t.length+4);s.set(i),s.set(t,i.length);let r=i.length+t.length;return s[r]=e>>>24,s[r+1]=e>>>16&255,s[r+2]=e>>>8&255,s[r+3]=e&255,s}function Dt(n,t){return Nt(Ut("luphoto-key",n,t))}var ot=class{constructor(t,e){this.w=new Int32Array(64);this.mid=new Int32Array(8);this.s=new Int32Array(8);this.target=new Int32Array(4);let i=new Uint8Array(64);i.set(Ut("luphoto-check",t,0)),i[33]=128,i[62]=33*8>>>8,i[63]=33*8&255;let s=this.w;for(let r=0;r<16;r++)s[r]=i[r*4]<<24|i[r*4+1]<<16|i[r*4+2]<<8|i[r*4+3];this.saltTail=i[28]<<24;for(let r=16;r<22;r++){let o=s[r-15],a=s[r-2],h=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,l=(a>>>17|a<<15)^(a>>>19|a<<13)^a>>>10;s[r]=s[r-16]+h+s[r-7]+l|0}this.mid.set(Y),Lt(this.mid,s,0,7);for(let r=0;r<4;r++)this.target[r]=e[r*4]<<24|e[r*4+1]<<16|e[r*4+2]<<8|e[r*4+3]}run(t,e){let i=this.w,s=this.s,r=this.mid,o=this.target[0],a=this.saltTail;for(let h=t;h>>8,i[8]=(h&255)<<24|8388608,qt(i,22),s.set(r),Lt(s,i,7,64),(Y[0]+s[0]|0)===o&&(Y[1]+s[1]|0)===this.target[1]&&(Y[2]+s[2]|0)===this.target[2]&&(Y[3]+s[3]|0)===this.target[3])return h;return-1}},rt="luphoto-sealed-1",nt=12;function j(n){let t=new Uint8Array(n.length>>>1);for(let e=0;e>>24,i[45]=o>>>16&255,i[46]=o>>>8&255,i[47]=o&255,Nt(i,s);let h=Math.min(32,r.length-a);for(let l=0;lthis.onHeld())}onUnlock(t){this.listeners.push(t)}configure(t){if(!this.info){if(this.info=t,t.key){this.found=j(t.key),this.unlock(!1);return}if(this.key&&t.build!==this.build){this.reset();return}this.key||this.search()}}reject(t){t!==this.key||!this.stored||!this.info||this.info.key||this.reset()}abandon(){this.card?.dismiss(),this.card=null,this.worker?.terminate(),this.worker=null}reset(){Yt(null),this.key=null,this.stored=!1,this.held=!1,this.found=null,this.card||(this.card=new at(()=>this.onHeld())),this.search()}search(){let t=this.info;if(!t||!t.salt||!t.check||!t.bits||this.worker)return;let e=j(t.salt),i=r=>{if(this.worker?.terminate(),this.worker=null,r<0){this.card?.fail();return}this.found=Dt(e,r),this.held&&this.unlock(!0)},s=()=>this.searchHere(e,j(t.check??""),t.bits??0,i);if(typeof Worker>"u"||!this.workerUrl){s();return}try{let r=new Worker(this.workerUrl);this.worker=r,r.onmessage=o=>{typeof o.data.pow=="number"&&this.worker===r&&i(o.data.pow)},r.onerror=()=>{this.worker===r&&(r.terminate(),this.worker=null,s())},r.postMessage({type:"pow",salt:t.salt,check:t.check,bits:t.bits})}catch{this.worker=null,s()}}searchHere(t,e,i,s){let r=new ot(t,e),o=2**i,a=0,h=()=>{let l=Math.min(o,a+fe),c=r.run(a,l);if(a=l,c>=0||a>=o){s(c);return}setTimeout(h,0)};setTimeout(h,0)}onHeld(){this.held=!0,this.found?this.unlock(!0):this.card?.wait()}unlock(t){if(this.found){this.key=this.found,this.stored=!1,t&&this.enabled&&Yt({build:this.info?.build??this.build,s:Wt(this.key)}),this.card?.dismiss(),this.card=null;for(let e of this.listeners)e()}}},at=class{constructor(t){this.onHeld=t;this.inert=[];this.start=0;this.frame=0;this.holding=!1;this.finished=!1;this.restore=document.activeElement;let e=document.createElement("div");e.className="gate",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-labelledby","gate-line");let i=document.createElement("div");i.className="gate-card";let s=document.createElement("p");s.className="gate-eyebrow",s.textContent="Photos \xB7 Lucio";let r=document.createElement("p");r.className="gate-line",r.id="gate-line",r.textContent=ve;let o=document.createElement("button");o.type="button",o.className="gate-hold",o.setAttribute("aria-label","Hold to see the photos"),o.setAttribute("aria-describedby","gate-status");let a=document.createElementNS(Bt,"svg");a.setAttribute("viewBox","0 0 64 64"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");let h=(b,y)=>{let m=document.createElementNS(Bt,"circle");return m.setAttribute("class",b),m.setAttribute("cx","32"),m.setAttribute("cy","32"),m.setAttribute("r",y),m},l=h("gate-ring","28");l.setAttribute("pathLength","100"),a.append(h("gate-track","28"),l,h("gate-dot","6")),o.appendChild(a);let c=document.createElement("p");c.className="visually-hidden",c.id="gate-status",c.setAttribute("aria-live","polite"),i.append(s,r,o,c),e.appendChild(i),this.root=e,this.button=o,this.ring=l,this.status=c,this.text=r;for(let b of Array.from(document.body.children))b.hasAttribute("inert")||(b.setAttribute("inert",""),this.inert.push(b));document.body.appendChild(e),document.documentElement.classList.add("has-gate"),this.bind(),o.focus({preventScroll:!0})}bind(){let t=this.button;t.addEventListener("pointerdown",e=>{e.pointerType==="mouse"&&e.button!==0||(e.preventDefault(),t.setPointerCapture(e.pointerId),this.press())});for(let e of["pointerup","pointercancel","lostpointercapture"])t.addEventListener(e,()=>this.release());t.addEventListener("keydown",e=>{(e.key===" "||e.key==="Enter")&&(e.preventDefault(),e.repeat||this.press())}),t.addEventListener("keyup",e=>{(e.key===" "||e.key==="Enter")&&(e.preventDefault(),this.release())}),t.addEventListener("blur",()=>this.release()),t.addEventListener("click",e=>e.preventDefault()),t.addEventListener("contextmenu",e=>e.preventDefault()),this.root.addEventListener("transitionend",e=>{e.target===this.root&&this.root.classList.contains("is-leaving")&&this.root.remove()})}setProgress(t){this.ring.style.setProperty("stroke-dashoffset",String(100-Math.max(0,Math.min(1,t))*100))}press(){if(this.holding||this.finished)return;this.holding=!0,this.start=performance.now(),this.button.classList.add("is-pressed"),this.status.textContent="Keep holding";let t=e=>{if(!this.holding)return;let i=(e-this.start)/pe;if(this.setProgress(i),i>=1){this.holding=!1,this.finished=!0,this.frame=0,this.button.classList.remove("is-pressed"),this.onHeld();return}this.frame=requestAnimationFrame(t)};this.frame=requestAnimationFrame(t)}release(){this.holding&&(this.holding=!1,cancelAnimationFrame(this.frame),this.frame=0,this.button.classList.remove("is-pressed"),this.setProgress(0),this.status.textContent="")}wait(){this.root.classList.add("is-waiting"),this.setProgress(.28),this.status.textContent="One moment"}fail(){this.root.classList.remove("is-waiting"),this.finished=!0,this.setProgress(0),this.button.disabled=!0,this.text.textContent="Something went wrong. Reload the page to try again.",this.status.textContent=this.text.textContent}dismiss(){cancelAnimationFrame(this.frame);let t=this.root.contains(document.activeElement);for(let e of this.inert)e.removeAttribute("inert");document.documentElement.classList.remove("has-gate"),this.root.classList.add("is-leaving"),window.setTimeout(()=>this.root.remove(),400),t&&(this.restore instanceof HTMLElement&&this.restore!==document.body&&this.restore.isConnected?this.restore:document.querySelector("main"))?.focus({preventScroll:!0})}};var ge=400,X=class{constructor(t,e=()=>!0){this.canShow=e;this.handle=null;this.loader=null;this.timer=0;this.hideTimer=0;this.visible=!1;this.element=document.createElement("div"),this.element.className="busy",this.element.setAttribute("role","status"),this.element.setAttribute("aria-label","Loading"),t.appendChild(this.element)}watch(t){if(t===this.loader){this.update(t);return}this.loader=t,clearTimeout(this.timer),this.timer=0,this.hide(),this.update(t)}update(t){if(!t||t!==this.loader)return;let e=t.status;if(!e.active||e.sharp){clearTimeout(this.timer),this.timer=0,this.hide();return}if(!this.visible&&this.timer===0){let i=Math.max(0,ge-(performance.now()-e.started));this.timer=window.setTimeout(()=>this.check(),i)}}check(){this.timer=0;let t=this.loader;if(!(!t||!t.status.active||t.status.sharp)){if(!this.canShow()){this.timer=window.setTimeout(()=>this.check(),100);return}this.show()}}show(){if(!this.visible){if(clearTimeout(this.hideTimer),this.visible=!0,!this.handle){let t=yt();t&&(this.handle=t.loader(this.element,{size:56,color:B.paper,track:B.graphite3,rays:B.beam}),this.handle.svg.setAttribute("aria-hidden","true"))}this.element.classList.add("is-visible")}}hide(){this.visible&&(this.visible=!1,this.element.classList.remove("is-visible"),clearTimeout(this.hideTimer),this.hideTimer=window.setTimeout(()=>{!this.visible&&this.handle&&(this.handle.stop(),this.handle.svg.remove(),this.handle=null)},300))}},ht=class{constructor(t){this.loader=null;this.shown=!1;this.value=-1;this.element=document.createElement("div"),this.element.className="progress",this.element.setAttribute("aria-hidden","true"),t.appendChild(this.element)}watch(t){this.loader=t,this.value=-1,this.update(t)}update(t){if(!t||t!==this.loader)return;let e=t.status,i=e.active&&!e.sharp&&e.planned>0,s=e.planned>0?Math.min(1,e.done/e.planned):0;i!==this.shown&&(this.shown=i,this.element.classList.toggle("is-visible",i));let r=Math.round(s*1e3)/1e3;r!==this.value&&(this.value=r,this.element.style.transform="scaleX("+(i?r:1)+")")}};function lt(n,t,e){let i=t*e;for(let s=0;s=i)return s;return n.levels.length-1}function J(n,t){let e=n.tile_size,i=Math.max(0,t.u0*n.width),s=Math.min(n.width,t.u1*n.width),r=Math.max(0,t.v0*n.height),o=Math.min(n.height,t.v1*n.height);return s<=i||o<=r?null:{x0:Math.min(n.cols-1,Math.floor(i/e)),x1:Math.min(n.cols-1,Math.ceil(s/e)-1),y0:Math.min(n.rows-1,Math.floor(r/e)),y1:Math.min(n.rows-1,Math.ceil(o/e)-1)}}function Xt(n,t,e){let i=n.levels[t],s=i.tile_size,r=J(i,e);if(!r)return[];let o=(e.u0+e.u1)/2*i.width,a=(e.v0+e.v1)/2*i.height,h=[];for(let l=r.y0;l<=r.y1;l++)for(let c=r.x0;c<=r.x1;c++){let b=(c*s+Math.min((c+1)*s,i.width))/2,y=(l*s+Math.min((l+1)*s,i.height))/2;h.push({level:t,x:c,y:l,index:l*i.cols+c,distance:(b-o)**2+(y-a)**2})}return h.sort((l,c)=>l.distance-c.distance),h.map(({level:l,x:c,y:b,index:y})=>({level:l,x:c,y:b,index:y}))}function Vt(n,t,e,i,s,r){let o=n.tile_size,a=Math.round(i+t*o*r),h=Math.round(i+Math.min((t+1)*o,n.width)*r),l=Math.round(s+e*o*r),c=Math.round(s+Math.min((e+1)*o,n.height)*r);return h<=a||c<=l?null:{dx:a,dy:l,dw:h-a,dh:c-l}}function Zt(n,t,e,i,s,r,o,a){let h=e.tile_size,l=e.overlap??0,c=i*h,b=Math.min((i+1)*h,e.width),y=s*h,m=Math.min((s+1)*h,e.height),x=i>0?c-l:0,u=s>0?y-l:0,g=Math.round(r+c*a),d=Math.round(r+b*a),v=Math.round(o+y*a),f=Math.round(o+m*a);if(d<=g||f<=v)return;let M=Math.max(x,(g-r)/a),S=Math.min(x+t.width,(d-r)/a),p=Math.max(u,(v-o)/a),L=Math.min(u+t.height,(f-o)/a);S<=M||L<=p||n.drawImage(t,M-x,p-u,S-M,L-p,g,v,d-g,f-v)}var Kt="luphoto.throughput";function jt(){try{let n=Number(sessionStorage.getItem(Kt));return Number.isFinite(n)&&n>0?n:null}catch{return null}}function _t(){return jt()??1e3}function Gt(n){let t=jt(),e=t===null?n:t*(1-.5)+n*.5;try{sessionStorage.setItem(Kt,String(e))}catch{return e}return e}var W=180,Jt=400,ye=2e3,O=16,Et="j:";function we(n,t){return new Promise((e,i)=>{if(t.aborted){i(new z);return}let s=setTimeout(()=>{t.removeEventListener("abort",r),e()},n),r=()=>{clearTimeout(s),i(new z)};t.addEventListener("abort",r,{once:!0})})}function xe(n,t,e){return t.aborted?Promise.resolve(e):new Promise(i=>{let s=()=>i(e);t.addEventListener("abort",s,{once:!0}),n.then(r=>{t.removeEventListener("abort",s),i(r)})})}var Qt=3,ct=4,V=class{constructor(t,e,i){this.pyramid=t;this.poolUrl=e;this.env=i;this.seedImage=null;this.seedPromise=null;this.seedAt=0;this.pool=null;this.sealed="";this.poolPromise=null;this.poolRetryAt=0;this.opened=null;this.ids=null;this.triedKey=null;this.jumbleLevel=-1;this.jumble=[];this.session=null;this.prefetchController=null;this.finalLevel=-1;this.targetLevel=-1;this.status={active:!1,started:0,planned:0,done:0,sharp:!1}}tileUrl(t){let e=this.env.tiles;return e.path+this.pyramid.hash+"/"+t+"."+e.format}ensurePool(){return this.pool?Promise.resolve(!0):(this.poolPromise||(this.poolPromise=fetch(this.poolUrl,{credentials:"same-origin"}).then(t=>t.ok?t.json():Promise.reject(new Error("pool"))).then(t=>{let e=this.pyramid.levels;if(!Array.isArray(t.levels)||t.levels.length!==e.length||typeof t.sealed!="string")throw new Error("pool");for(let i=0;i(this.poolPromise=null,this.poolRetryAt=performance.now()+ye,!1))),this.poolPromise)}open(){if(this.opened)return!0;let t=this.env.gate.key,e=this.pool;if(!t||!e||t===this.triedKey)return!1;this.triedKey=t;let i=Ot(t,this.sealed),s=null;if(i)try{s=JSON.parse(new TextDecoder().decode(i))}catch{s=null}let r=this.pyramid.levels;if(!s||!Array.isArray(s.levels)||s.levels.length!==r.length)return this.env.gate.reject(t),!1;let o=[];for(let a=0;a=0&&y=this.poolRetryAt&&this.ensurePool();return}this.opened||this.open()}ensureSeed(){return this.opened?(this.seedPromise||(this.seedPromise=this.decodeSeed().then(()=>{this.seedAt=performance.now(),this.env.requestDraw()},()=>{})),this.seedPromise):Promise.resolve()}async decodeSeed(){let t=this.opened?.seed;if(!t)return;let e=await wt(new Blob([kt(t)],{type:"image/"+this.env.tiles.format})),i=document.createElement("canvas");i.width=e.width*ct,i.height=e.height*ct;let s=i.getContext("2d");if(!s){this.seedImage=e;return}s.imageSmoothingEnabled=!0,s.imageSmoothingQuality="high","filter"in s&&(s.filter="blur("+ct*.75+"px)");let r=ct*2;s.drawImage(e,-r,-r,i.width+r*2,i.height+r*2),q(e),this.seedImage=i}async request(t,e,i,s,r){let o=this.tileUrl(e),a;try{a=await this.env.scheduler.request(t,o,i,s,r)}catch(h){if(s.aborted||h instanceof z)throw h;await we(Jt+Math.random()*Jt,s),a=await this.env.scheduler.request(t,o,i,s,r)}return this.env.cache.put(t,a.bitmap),this.env.requestDraw(),a}fetchTile(t,e,i){let s=this.ids,r=this.opened;if(!s||!r)return Promise.reject(new z);let o=s[t.level][t.index],a=this.env.tiles,h=a.cell??64,l=a.scrambled&&r.scramble&&this.pyramid.levels[t.level].tile_size>=2*h?{seed:r.scramble,level:t.level,x:t.x,y:t.y,cell:h}:void 0;return this.request(o,o,e,i,l)}fetchJumble(t,e,i){return this.request(Et+t,t,e,i)}uncached(t,e){let i=this.ids;return i?Xt(this.pyramid,t,e).filter(s=>!this.env.cache.has(i[t][s.index])):[]}uncachedBytes(t,e){let i=this.opened?.levels[t].bytes??[],s=0;for(let r of this.uncached(t,e))s+=i[r.index]??0;return s}chooseJumble(t,e){let i=this.pool;if(!i)return[];if(this.jumbleLevel<0){let s=this.probeLevel(t,e),r=this.pyramid.levels[s].cols*this.pyramid.levels[s].rows,o=i[s].length/O,a=new Array(r);for(let h=0;h!this.env.cache.has(Et+s))}probeLevel(t,e){return Math.max(0,lt(this.pyramid,t.displayWidth,e)-Qt)}notify(){this.env.onStatus?.(this)}track(t,e){return this.status.planned+=t.length,this.notify(),Promise.allSettled(t.map(i=>i().finally(()=>{this.session===e&&(this.status.done++,this.notify())})))}start(t,e,i){this.stopSession();let s=new AbortController;this.session=s,this.targetLevel=-1,this.status.active=!0,this.status.started=performance.now(),this.status.planned=0,this.status.done=0,this.status.sharp=!1,this.notify(),this.run(t,e,s).then(()=>{this.session===s&&(this.session=null,this.status.active=!1,this.notify()),(!s.signal.aborted||s.signal.reason==="deadline")&&i()})}async run(t,e,i){let s=i.signal,r=performance.now(),o=this.env.settings.budgetMs,a=setTimeout(()=>i.abort("deadline"),o);try{let h=await xe(this.ensurePool(),s,!1);if(s.aborted)return;if(!h||!this.open()){let g=this.chooseJumble(t,e);await this.track(g.map(d=>()=>this.fetchJumble(d,et,s)),i);return}if(await this.ensureSeed(),s.aborted)return;let l=lt(this.pyramid,t.displayWidth,e),c=Math.max(0,l-Qt),b=this.uncached(c,t).slice(0,2);if(b.length>0){let g=await this.track(b.map(f=>()=>this.fetchTile(f,et,s)),i),d=0,v=0;for(let f of g)f.status==="fulfilled"&&(d+=f.value.bytes,v=Math.max(v,f.value.ms));d>0&&v>0&&Gt(d/v)}if(s.aborted)return;this.finalLevel=Math.max(this.finalLevel,c);let y=_t(),m=o-(performance.now()-r),x=c;for(let g=l;g>c;g--)if(this.uncachedBytes(g,t)/y<=m*.8){x=g;break}let u=[];x-c>=2&&u.push(Math.floor((c+x)/2)),x>c&&u.push(x),this.finalLevel=x,this.targetLevel=x,this.env.requestDraw();for(let g of u)if(await this.track(this.uncached(g,t).map(d=>()=>this.fetchTile(d,et,s)),i),s.aborted)return}finally{clearTimeout(a)}}prefetchProbe(t,e){let s=this.resetPrefetch().signal;this.ensurePool().then(async r=>{if(!(s.aborted||!r)){if(!this.open()){for(let o of this.chooseJumble(t,e))this.fetchJumble(o,it,s).catch(()=>{});return}if(await this.ensureSeed(),!s.aborted)for(let o of this.uncached(this.probeLevel(t,e),t))this.fetchTile(o,it,s).catch(()=>{})}})}prefetchLevel(t,e){if(e<0||!this.opened)return;let i=this.resetPrefetch().signal;for(let s of this.uncached(e,t))this.fetchTile(s,it,i).catch(()=>{})}resetPrefetch(){return this.prefetchController?.abort(),this.prefetchController=new AbortController,this.prefetchController}stopPrefetch(){this.prefetchController?.abort(),this.prefetchController=null}stopSession(){this.session&&(this.session.abort("superseded"),this.session=null,this.status.active=!1,this.notify())}stop(){this.stopSession(),this.stopPrefetch()}drawJumble(t,e){if(this.jumbleLevel<0)return!1;let{g:i,originX:s,originY:r,width:o,now:a}=t,h=this.pyramid.levels[this.jumbleLevel],l=J(h,e);if(!l)return!1;let c=o/h.width,b=this.env.cache,y=!1;i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="medium";for(let m=l.y0;m<=l.y1;m++)for(let x=l.x0;x<=l.x1;x++){let u=b.get(Et+this.jumble[m*h.cols+x]),g=u?Vt(h,x,m,s,r,c):null;if(!u||!g)continue;let d=a-u.at;d=0&&v<0;p--){let L=J(u[p],m);if(!L)continue;let w=!0;for(let k=L.y0;k<=L.y1&&w;k++)for(let E=L.x0;E<=L.x1;E++){let A=x.get(g[p][k*u[p].cols+E]);if(!A||t.now-A.at=0&&p=0?Math.min(this.targetLevel,d):d,S=g!==null&&v>=M;if(S!==this.status.sharp&&(this.status.sharp=S,queueMicrotask(()=>this.notify())),!g)return f;for(let p=Math.max(0,v);p<=d;p++){let L=u[p],w=J(L,m);if(!w)continue;let k=r/L.width;e.imageSmoothingEnabled=!0,e.imageSmoothingQuality=k<1?"high":"medium";for(let E=w.y0;E<=w.y1;E++)for(let A=w.x0;A<=w.x1;A++){let T=x.get(g[p][E*L.cols+A]);if(!T)continue;let C=t.now-T.at;Cthis.requestDraw(),onStatus:()=>this.onStatus(this)})}get isOpen(){return this.expanded}get isNear(){return this.near}layout(t){let e=this.cover,i=Math.max(t.width/e.width,t.open/e.height),s=e.width*i,r=e.height*i,o=(t.open-r)/2,a=o+this.focusY*r,h=Math.max(0,Math.min(t.open-t.closed,a-t.closed/2)),l=this.geometry;this.geometry={width:t.width,closed:t.closed,open:t.open,dpr:t.dpr,coverWidth:s,coverHeight:r,x:(t.width-s)/2,y:o,band:h},this.canvas&&(this.sizeCanvas(this.canvasOpen),this.drawNow()),this.near&&l&&(l.width!==t.width||l.closed!==t.closed||l.open!==t.open||l.dpr!==t.dpr)&&this.startSession()}attach(){if(this.canvas)return;let t=document.createElement("canvas");t.className="strip-canvas",t.setAttribute("aria-hidden","true");let e=t.getContext("2d",{alpha:!1});e&&(this.canvas=t,this.g=e,this.element.prepend(t),this.sizeCanvas(this.expanded),this.drawNow())}detach(){this.canvas&&(cancelAnimationFrame(this.frame),this.frame=0,this.canvas.width=0,this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.g=null)}setNear(t){t!==this.near&&(this.near=t,t?this.startSession():this.loader.stop())}setOpen(t){if(t===this.expanded)return;this.expanded=t,this.element.classList.toggle("is-open",t),clearTimeout(this.settleTimer);let e=this.geometry,i=this.canvas;t?i&&this.canvasOpen?(i.style.transition="",i.style.transform="translate3d(0,0,0)"):i&&e&&(this.sizeCanvas(!0),i.style.transition="none",i.style.transform="translate3d(0,"+-e.band+"px,0)",this.drawNow(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.expanded&&this.canvas===i&&(i.style.transition="",i.style.transform="translate3d(0,0,0)")})})):i&&e&&(i.style.transition="",i.style.transform="translate3d(0,"+-e.band+"px,0)",this.settleTimer=window.setTimeout(()=>{!this.expanded&&this.canvas===i&&(this.sizeCanvas(!1),this.drawNow())},Me)),this.near&&this.startSession()}sizeCanvas(t){let e=this.canvas,i=this.geometry;if(!e||!i)return;this.canvasOpen=t;let s=t?i.open:i.closed,r=Math.max(1,Math.round(i.width*i.dpr)),o=Math.max(1,Math.round(s*i.dpr));(e.width!==r||e.height!==o)&&(e.width=r,e.height=o),e.style.height=s+"px",t||(e.style.transition="none",e.style.transform="translate3d(0,0,0)")}view(){let t=this.geometry;if(!t)return null;let e=this.expanded?0:t.band,i=this.expanded?t.open:t.closed;return{displayWidth:t.coverWidth,u0:Math.max(0,-t.x/t.coverWidth),u1:Math.min(1,(t.width-t.x)/t.coverWidth),v0:Math.max(0,(e-t.y)/t.coverHeight),v1:Math.min(1,(e+i-t.y)/t.coverHeight)}}startSession(){let t=this.view();!t||!this.geometry||this.loader.start(t,this.geometry.dpr,()=>{})}requestDraw(){this.frame===0&&this.canvas&&(this.frame=requestAnimationFrame(t=>{this.frame=0,this.draw(t)&&this.requestDraw()}))}drawNow(){this.draw(performance.now())&&this.requestDraw()}draw(t){let e=this.g,i=this.canvas,s=this.geometry;if(!e||!i||!s)return!1;e.setTransform(1,0,0,1,0,0),e.globalAlpha=1,e.fillStyle="#111114",e.fillRect(0,0,i.width,i.height);let r=this.canvasOpen?0:-s.band;return this.loader.draw({g:e,originX:s.x*s.dpr,originY:(s.y+r)*s.dpr,width:s.coverWidth*s.dpr,height:s.coverHeight*s.dpr,canvasWidth:i.width,canvasHeight:i.height,displayWidth:s.coverWidth,dpr:s.dpr,now:t})}};function $t(n){let t=n.dataset,e=(i,s)=>{let r=Number(i);return Number.isFinite(r)&&r>0?r:s};return{page:t.page??"",build:t.build??"",slug:t.album??"",manifestUrl:t.manifest??"",indexUrl:t.index??"",workerUrl:t.worker??"",budgetMs:e(t.budgetMs,3e3),maxDpr:e(t.maxDpr,2),concurrency:Math.max(1,Math.round(e(t.concurrency,6))),blockContextMenu:t.blockContextMenu!=="false",gate:t.gate!=="false"}}function Q(n,t,e){return"/a/"+encodeURIComponent(t)+"/p/"+e+"."+n+".json"}var Le=24,dt=class{constructor(t,e,i,s){this.root=t;this.settings=i;this.env=s;this.strips=[];this.onScreen=new Set;this.inView=new Set;this.suspended=!1;this.wordmark=null;this.opened=null;this.scrollFrame=0;this.sizeKey="";let r=Array.from(t.querySelectorAll("a.strip")),o=new Map(e.albums.map(h=>[h.slug,h]));for(let h of r){let l=o.get(h.dataset.slug??"");!l||!l.cover||this.strips.push(new Z(h,l.cover,l.collapsed_focus_y??.5,Q(e.build,l.slug,l.cover.hash),s,c=>this.onStripStatus(c)))}this.hoverMode=matchMedia("(hover: hover) and (pointer: fine)");let a=document.querySelector(".site-header .wordmark");if(this.indicator=new X(document.body,()=>!this.wordmarkMoving()),a){this.wordmark=D(a,!0);let h=()=>{this.wordmark&&!this.indicator.visible&&this.wordmark.play()},l=()=>this.wordmark?.reverse();a.addEventListener("mouseenter",h),a.addEventListener("mouseleave",l),a.addEventListener("focus",h),a.addEventListener("blur",l)}document.documentElement.classList.add("has-strips"),this.measure(),this.observe(),this.bind(),s.gate.onUnlock(()=>{if(!this.suspended)for(let h of this.strips)h.isNear&&h.startSession(),h.requestDraw()})}suspend(t){if(!this.suspended){this.suspended=!0;for(let e of this.strips)e.loader.stop(),t&&e.detach();this.env.scheduler.cancelAll(),this.env.cache.trim(t?0:this.env.cache.budget/4)}}resume(){if(this.suspended){this.suspended=!1;for(let t of this.strips)this.inView.has(t)&&t.attach(),t.isNear&&t.startSession()}}wordmarkMoving(){let t=this.wordmark?.t??0;return t>0&&t<1}measure(){let t=this.root.clientWidth||window.innerWidth,e=window.innerHeight,i=Math.round(Math.min(t*6/32,e*.28)),s=Math.round(Math.min(t*9/32,e*.62)),r=Math.min(window.devicePixelRatio||1,this.settings.maxDpr),o=t+"x"+i+"x"+s+"@"+r;if(o!==this.sizeKey){this.sizeKey=o,this.root.style.setProperty("--strip-closed",i+"px"),this.root.style.setProperty("--strip-open",s+"px");for(let a of this.strips)a.layout({width:t,closed:i,open:s,dpr:r})}}observe(){let t=new Map(this.strips.map(r=>[r.element,r])),e=new IntersectionObserver(r=>{for(let o of r)t.get(o.target)?.setNear(o.isIntersecting)},{rootMargin:"100% 0px"}),i=new IntersectionObserver(r=>{for(let o of r){let a=t.get(o.target);a&&(o.isIntersecting?(this.inView.add(a),this.suspended||a.attach()):(this.inView.delete(a),a.detach()))}},{rootMargin:"25% 0px"}),s=new IntersectionObserver(r=>{for(let o of r){let a=t.get(o.target);a&&(o.isIntersecting?this.onScreen.add(a):this.onScreen.delete(a))}this.watchFirst(),this.scheduleCentre()});for(let r of this.strips)e.observe(r.element),i.observe(r.element),s.observe(r.element)}watchFirst(){let t=this.strips.find(e=>this.onScreen.has(e))??null;this.indicator.watch(t?t.loader:null)}onStripStatus(t){this.indicator.update(t.loader)}bind(){for(let t of this.strips){let e=t.element;e.addEventListener("mouseenter",()=>{this.hoverMode.matches&&this.open(t)}),e.addEventListener("mouseleave",()=>{this.hoverMode.matches&&this.opened===t&&this.open(null)}),e.addEventListener("focus",()=>this.open(t)),e.addEventListener("blur",()=>{this.opened===t&&!this.hoverMode.matches?this.scheduleCentre():this.opened===t&&this.open(null)}),e.addEventListener("dragstart",i=>i.preventDefault()),this.settings.blockContextMenu&&e.addEventListener("contextmenu",i=>i.preventDefault())}window.addEventListener("scroll",()=>this.scheduleCentre(),{passive:!0}),new ResizeObserver(()=>{this.measure(),this.scheduleCentre()}).observe(this.root)}open(t){t!==this.opened&&(this.opened?.setOpen(!1),this.opened=t,t?.setOpen(!0))}scheduleCentre(){this.hoverMode.matches||this.scrollFrame!==0||(this.scrollFrame=requestAnimationFrame(()=>{this.scrollFrame=0,this.pickCentre()}))}pickCentre(){if(this.hoverMode.matches)return;let t=window.innerHeight/2,e=null,i=1/0,s=1/0;for(let r of this.onScreen){let o=r.element.getBoundingClientRect(),a=Math.abs(o.top+o.height/2-t);a=1)return mt(e)+"s";let i=1/e;return i<10&&Math.abs(i-Math.round(i))>.05?"1/"+mt(i):"1/"+Math.round(i)}function Te(n,t,e,i){let s=[te(n+1)+" / "+te(t)],r=e.exif;if(i&&r){let o=Ae(r);o&&s.push(o),r.lens&&s.push(Ee(r.lens)),r.focal_length&&s.push(mt(r.focal_length)+"mm"),r.f_number&&s.push("f/"+mt(r.f_number)),r.exposure&&s.push(Se(r.exposure)),r.iso&&s.push("ISO "+r.iso)}return s.join(" \xB7 ")}function Ce(n,t){n.textContent="",t.split(/\r?\n/).forEach((e,i)=>{i>0&&n.appendChild(document.createElement("br"));let s=e.split("*"),r=(s.length-1)%2===0;s.forEach((o,a)=>{let h=a%2===1;if(h&&(r||a!==s.length-1)){let l=document.createElement("em");l.textContent=o,n.appendChild(l)}else n.appendChild(document.createTextNode((h?"*":"")+o))})})}var pt=class{constructor(t){this.visible=!1;this.placement="";this.element=document.createElement("section"),this.element.className="caption",this.element.setAttribute("aria-label","Caption"),this.meta=document.createElement("p"),this.meta.className="caption-meta",this.title=document.createElement("h2"),this.title.className="caption-title",this.text=document.createElement("p"),this.text.className="caption-text",this.element.append(this.meta,this.title,this.text),t.appendChild(this.element)}set(t,e,i,s){this.meta.textContent=Te(e,i,t,s),this.title.textContent=t.title??"",this.title.hidden=!t.title,ut(this.title,t.title??""),Ce(this.text,t.caption??""),this.text.hidden=!t.caption,ut(this.text,t.caption??"")}show(t){t!==this.visible&&(this.visible=t,this.element.classList.toggle("is-visible",t))}place(t,e,i){let s=Math.round(t)+","+Math.round(e)+","+Math.round(i);if(s===this.placement)return;this.placement=s;let r=this.element.style;r.width=Math.round(e)+"px",r.transform="translate3d("+Math.round(t)+"px,"+-Math.round(i)+"px,0)"}};var ft=24,ee=10,Pe=300,Ie=.35,ie=.35,ze=.2,Re=2500,He=120,Fe=16,qe=.002,Ne=.01;function Ue(n,t,e,i){let s=3*n,r=3*(e-n)-s,o=1-s-r,a=3*t,h=3*(i-t)-a,l=1-a-h,c=m=>((o*m+r)*m+s)*m,b=m=>((l*m+h)*m+a)*m,y=m=>(3*o*m+2*r)*m+s;return m=>{if(m<=0)return 0;if(m>=1)return 1;let x=m;for(let d=0;d<8;d++){let v=c(x)-m,f=y(x);if(Math.abs(v)<1e-5)return b(x);if(Math.abs(f)<1e-6)break;x-=v/f}let u=0,g=1;x=m;for(let d=0;d<24;d++){let v=c(x);if(Math.abs(v-m)<1e-5)break;vthis.onUnlock())}buildEndCard(){let t=document.createElement("section");t.className="end-card",t.setAttribute("aria-label","End of album");let e=document.createElement("a");e.className="next-album",e.href="/";let i=document.createElement("span");i.className="next-strip";let s=document.createElement("span");s.className="next-text";let r=document.createElement("span");r.className="next-eyebrow",r.textContent="All albums";let o=document.createElement("span");o.className="next-title",s.append(r,o),i.appendChild(s),e.appendChild(i);let a=document.createElement("div");a.className="signoff";let h=zt();h&&a.appendChild(h);let l=document.createElement("p");return l.className="signature",l.textContent="\u2014 Lucio",a.appendChild(l),t.append(e,a),t}loader(t){let e=this.loaders[t];if(!e){let i=this.manifest.photos[t];e=new V(i,Q(this.manifest.build,this.manifest.slug,i.hash),{...this.env,requestDraw:()=>this.requestDraw(),onStatus:s=>{this.indicator.update(s),this.progress.update(s)}}),this.loaders[t]=e}return e}measure(){let t=this.stage.getBoundingClientRect();this.vw=Math.max(1,t.width),this.vh=Math.max(1,t.height),this.ox=t.left,this.oy=t.top,this.dpr=Math.min(window.devicePixelRatio||1,this.settings.maxDpr);let e=Math.max(1,Math.round(this.vw*this.dpr)),i=Math.max(1,Math.round(this.vh*this.dpr));(this.canvas.width!==e||this.canvas.height!==i)&&(this.canvas.width=e,this.canvas.height=i),this.layouts=[],this.stops=[];let s=0;this.manifest.photos.forEach((r,o)=>{let a=Math.max(1,r.slides||1),h=Math.min(this.vw/(r.width/a),this.vh/r.height),l=r.width*h,c=r.height*h,b=l/a,y=s+ft/2+(this.vw-b)/2;this.layouts.push({scale:h,width:l,height:c,section:b,slides:a,start:s,left:y,top:(this.vh-c)/2});for(let m=0;m{this.pointerId===null&&document.body.classList.add("is-idle")},Re)}stopForHash(){let t=/^#(\d+)$/.exec(location.hash);if(!t)return 0;let e=Math.min(this.manifest.photos.length,Math.max(1,Number(t[1])))-1,i=this.stops.findIndex(s=>s.photo===e);return i<0?0:i}bind(){let t=this.stage;t.addEventListener("pointerdown",e=>this.onPointerDown(e)),t.addEventListener("pointermove",e=>this.onPointerMove(e)),t.addEventListener("pointerup",e=>this.onPointerUp(e,!1)),t.addEventListener("pointercancel",e=>this.onPointerUp(e,!0)),t.addEventListener("pointerleave",e=>{e.pointerType==="mouse"&&this.pointerId===null&&(this.hover=!1,this.updateCaption())}),t.addEventListener("wheel",e=>this.onWheel(e),{passive:!1}),t.addEventListener("gesturestart",e=>{e.preventDefault(),this.gestureZoom=this.zoom}),t.addEventListener("gesturechange",e=>this.onGesture(e)),t.addEventListener("gestureend",e=>e.preventDefault()),t.addEventListener("dragstart",e=>e.preventDefault()),t.addEventListener("selectstart",e=>e.preventDefault()),this.settings.blockContextMenu&&t.addEventListener("contextmenu",e=>e.preventDefault()),window.addEventListener("keydown",e=>this.onKey(e)),window.addEventListener("hashchange",()=>{let e=this.stopForHash();this.stops[e].photo!==this.stops[this.current].photo?this.jump(e):this.clearZoom()&&(this.startSession(),this.updateCaption())}),new ResizeObserver(()=>this.onResize()).observe(t),this.fade.addEventListener("transitionend",()=>{this.fade.style.opacity==="0"&&(this.fade.width=1,this.fade.height=1)})}onResize(){let t=this.vw+"x"+this.vh+"@"+this.dpr;this.measure(),t!==this.vw+"x"+this.vh+"@"+this.dpr&&(this.clearZoom(),this.tween=null,this.camera=this.stops[this.current].camera,this.requestDraw(),clearTimeout(this.resizeTimer),this.resizeTimer=window.setTimeout(()=>this.startSession(),200))}onKey(t){if(t.altKey||t.ctrlKey||t.metaKey)return;this.wake();let e=t.target;if(!(e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)))){switch(t.key){case"ArrowRight":this.go(this.current+1);break;case"ArrowLeft":this.go(this.current-1);break;case"Home":this.go(0);break;case"End":this.go(this.stops.length-2);break;case"Escape":this.zoomPhoto>=0?this.go(this.current):location.assign("/");break;case"i":case"I":this.pinned=!this.pinned,this.updateCaption();break;default:return}t.preventDefault()}}onPointerDown(t){if(!(t.pointerType==="mouse"&&t.button!==0)){if(this.pointerId!==null){this.secondId===null&&t.pointerType!=="mouse"&&this.pointerType!=="mouse"&&!this.stale&&(this.zoomPhoto>=0||!this.dragging&&this.enterZoom())&&(this.secondId=t.pointerId,this.bx=t.clientX,this.by=t.clientY,this.pinching=!0,this.dragging=!0,this.stage.setPointerCapture(t.pointerId));return}t.target.closest("a, button")||(this.pointerId=t.pointerId,this.pointerType=t.pointerType,this.dragging=!1,this.stale=!1,this.downX=t.clientX,this.downY=t.clientY,this.ax=t.clientX,this.ay=t.clientY,this.downT=t.timeStamp,this.tween=null,this.downCamera=this.camera,this.samples=[{t:t.timeStamp,x:t.clientX}],this.stage.setPointerCapture(t.pointerId))}}onPointerMove(t){if(t.pointerType==="mouse"&&this.wake(),this.pointerId===null){t.pointerType==="mouse"&&(this.hover=this.inCaptionZone(t.clientX,t.clientY),this.updateCaption());return}if(this.pinching&&(t.pointerId===this.pointerId||t.pointerId===this.secondId)){this.pinchMove(t.pointerId,t.clientX,t.clientY);return}if(t.pointerId!==this.pointerId||this.stale)return;let e=t.clientX-this.downX,i=t.clientY-this.downY;if(!this.dragging&&Math.hypot(e,i)>=ee&&(this.dragging=!0,this.stage.classList.add("is-dragging"),this.updateCaption()),!this.dragging){this.ax=t.clientX,this.ay=t.clientY;return}if(this.zoomPhoto>=0){this.zx+=t.clientX-this.ax,this.zy+=t.clientY-this.ay,this.ax=t.clientX,this.ay=t.clientY,this.settleZoom();return}for(this.samples.push({t:t.timeStamp,x:t.clientX});this.samples.length>2&&t.timeStamp-this.samples[0].t>100;)this.samples.shift();this.camera=this.rubber(this.downCamera-e),this.requestDraw()}onPointerUp(t,e){if(this.pinching&&(t.pointerId===this.pointerId||t.pointerId===this.secondId)){this.endPinch(t.pointerId);return}if(t.pointerId!==this.pointerId)return;this.stage.hasPointerCapture(t.pointerId)&&this.stage.releasePointerCapture(t.pointerId),this.pointerId=null;let i=this.dragging;if(this.dragging=!1,this.stage.classList.remove("is-dragging"),this.stale){this.stale=!1;return}let s=Math.hypot(t.clientX-this.downX,t.clientY-this.downY);if(!e&&!i&&s=0)return;let r=0,o=this.samples[0],a=this.samples[this.samples.length-1];o&&a&&a.t>o.t&&t.timeStamp-a.t<100&&(r=(a.x-o.x)/(a.t-o.t));let h=this.nearestStop(this.camera);if(!e&&Math.abs(r)>Ie)if(r<0){let l=this.stops.findIndex(c=>c.camera>this.camera+1);h=l<0?this.stops.length-1:l}else{let l=0;this.stops.forEach((c,b)=>{c.camera=0)return;let i=this.photoRect(e.photo);t.clientX>=i.left&&t.clientX<=i.right&&t.clientY>=i.top&&t.clientY<=i.bottom&&(this.pinned=!this.pinned,this.updateCaption())}onWheel(t){if(t.preventDefault(),this.pinching||this.dragging&&this.zoomPhoto<0)return;let e=t.deltaY;if(t.deltaMode===1?e*=Fe:t.deltaMode===2&&(e*=this.vh),e===0)return;let i=Math.max(-1,Math.min(1,e*(t.ctrlKey?Ne:qe))),s=t.clientX-this.ox,r=t.clientY-this.oy;this.zoomTo(this.zoom*Math.exp(-i),s,r,s,r)}onGesture(t){if(t.preventDefault(),this.pointerId!==null||!t.scale)return;let e=(t.clientX??this.ox+this.vw/2)-this.ox,i=(t.clientY??this.oy+this.vh/2)-this.oy;this.zoomTo(this.gestureZoom*t.scale,e,i,e,i)}pinchMove(t,e,i){let s=(this.ax+this.bx)/2-this.ox,r=(this.ay+this.by)/2-this.oy,o=Math.hypot(this.ax-this.bx,this.ay-this.by);t===this.pointerId?(this.ax=e,this.ay=i):(this.bx=e,this.by=i);let a=Math.hypot(this.ax-this.bx,this.ay-this.by),h=o>1&&a>1?this.zoom*a/o:this.zoom;this.zoomTo(h,s,r,(this.ax+this.bx)/2-this.ox,(this.ay+this.by)/2-this.oy)}endPinch(t){this.stage.hasPointerCapture(t)&&this.stage.releasePointerCapture(t),t===this.pointerId&&(this.pointerId=this.secondId,this.ax=this.bx,this.ay=this.by),this.secondId=null,this.pinching=!1,this.dragging=!0,this.zoomPhoto>=0&&this.settleZoom()}enterZoom(){let t=this.stops[this.current];if(t.photo<0||this.suspended)return!1;let e=this.layouts[t.photo],i=this.manifest.photos[t.photo].width/(window.devicePixelRatio||1)/e.width;return i<=1.001?!1:(this.tween=null,this.camera=t.camera,this.zoomPhoto=t.photo,this.zoomMax=i,this.zoom=1,this.zx=e.left-(this.camera-this.vw/2),this.zy=e.top,this.slackX=this.zx-this.clampAxis(this.zx,e.width,this.vw,0),this.slackY=this.zy-this.clampAxis(this.zy,e.height,this.vh,0),this.updateCaption(),!0)}zoomTo(t,e,i,s,r){if(this.zoomPhoto<0&&(t<=1||!this.enterZoom()))return;let o=Math.max(1,Math.min(this.zoomMax,t)),a=o/this.zoom;this.zx=s-(e-this.zx)*a,this.zy=r-(i-this.zy)*a,this.zoom=o,this.settleZoom()}settleZoom(){let t=this.layouts[this.zoomPhoto];if(this.zx=this.clampAxis(this.zx,t.width*this.zoom,this.vw,this.slackX),this.zy=this.clampAxis(this.zy,t.height*this.zoom,this.vh,this.slackY),this.requestDraw(),this.zoom<=1&&!this.pinching){this.camera=t.left+this.vw/2-this.zx,this.go(this.nearestStop(this.camera));return}clearTimeout(this.zoomTimer),this.zoomTimer=window.setTimeout(()=>this.startZoomSession(),He)}clampAxis(t,e,i,s){let r=(i-e)/2,o=Math.min(i-e,r),a=Math.max(0,r),h=s*Math.max(0,2-this.zoom);return h>0?a+=h:o+=h,Math.min(a,Math.max(o,t))}clearZoom(){return this.zoomPhoto<0?!1:(this.zoomPhoto=-1,this.zoom=1,this.gestureZoom=1,clearTimeout(this.zoomTimer),this.zoomTimer=0,this.pointerId!==null&&(this.stale=!0,this.pinching=!1,this.secondId=null),this.requestDraw(),!0)}levelDpr(){return this.zoomPhoto>=0&&this.zoom>=this.zoomMax*.999?Math.max(this.dpr,window.devicePixelRatio||1):this.dpr}startZoomSession(){if(this.zoomTimer=0,this.suspended||this.zoomPhoto<0)return;let t=this.layouts[this.zoomPhoto],e=t.width*this.zoom,i=t.height*this.zoom,s=Math.max(0,this.zx),r=Math.min(this.vw,this.zx+e),o=Math.max(0,this.zy),a=Math.min(this.vh,this.zy+i);r<=s||a<=o||this.loader(this.zoomPhoto).start({displayWidth:e,u0:(s-this.zx)/e,u1:(r-this.zx)/e,v0:(o-this.zy)/i,v1:(a-this.zy)/i},this.levelDpr(),()=>{})}rubber(t){let e=this.stops[0].camera,i=this.stops[this.stops.length-1].camera;return ti?i+(t-i)*ie:t}nearestStop(t){let e=0;return this.stops.forEach((i,s)=>{Math.abs(i.camera-t){this.current=e,this.camera=r});else{let o=Math.abs(r-this.camera);o>.5?this.tween={from:this.camera,to:r,start:performance.now(),duration:240+200*Math.min(1,o/this.vw)}:this.camera=r,this.current=e}e!==i?this.activate(i):(s&&this.startSession(),this.updateCaption()),this.requestDraw()}jump(t){let e=this.current;this.clearZoom(),this.tween=null,this.crossfade(()=>{this.current=t,this.camera=this.stops[t].camera}),this.activate(e),this.requestDraw()}crossfade(t){let e=this.fade;(e.width!==this.canvas.width||e.height!==this.canvas.height)&&(e.width=this.canvas.width,e.height=this.canvas.height);let i=e.getContext("2d");i&&i.drawImage(this.canvas,0,0),e.style.transition="none",e.style.opacity="1",t(),this.render(performance.now()),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition="",e.style.opacity="0"})})}activate(t){let e=this.stops[this.current],i=t>=0?this.stops[t]:null;if(i&&i.photo>=0&&i.photo!==e.photo&&this.loaders[i.photo]?.stop(),this.loaders.forEach((s,r)=>{s&&r!==e.photo&&r!==e.photo+1&&s.stopPrefetch()}),e.photo<0&&(this.indicator.watch(null),this.progress.watch(null)),this.describe(e.photo,t>=0),e.photo>=0){let s=this.manifest.photos[e.photo];this.caption.set(s,e.photo,this.manifest.photos.length,this.manifest.show_exif),(t>=0||location.hash!=="")&&location.hash!=="#"+(e.photo+1)&&history.replaceState(history.state,"","#"+(e.photo+1)),this.startSession()}this.syncNextStrip(),this.updateCaption()}describe(t,e){let i=this.manifest.photos.length,s;if(t<0){let r=this.nextLink.querySelector(".next-title")?.textContent??"";s="End of album."+(r?" Next album: "+r+".":"")}else{let r=this.manifest.photos[t],o=r.alt||r.title||"";s="Photo "+(t+1)+" of "+i+(o?": "+o:"")}this.canvas.setAttribute("aria-label",s),clearTimeout(this.announceTimer),e&&(this.announceTimer=window.setTimeout(()=>{this.announcer.textContent=s},500))}suspend(t){if(!this.suspended){this.suspended=!0,this.tween=null;for(let e of this.loaders)e?.stop();this.nextStrip?.loader.stop(),this.env.scheduler.cancelAll(),this.env.cache.trim(t?0:this.env.cache.budget/4),t&&(this.nextStrip?.detach(),this.canvas.width=1,this.canvas.height=1,this.fade.width=1,this.fade.height=1)}}resume(){this.suspended&&(this.suspended=!1,this.clearZoom(),this.canvas.width=0,this.measure(),this.camera=this.stops[this.current].camera,this.syncNextStrip(),this.startSession(),this.requestDraw())}onUnlock(){this.suspended||(this.zoomPhoto>=0?this.startZoomSession():this.startSession(),this.nextStrip&&(this.nextStrip.isNear&&this.nextStrip.startSession(),this.nextStrip.requestDraw()),this.requestDraw())}startSession(){let t=this.stops[this.current];if(t.photo<0)return;let e=this.current,i=this.loader(t.photo);i.start(this.viewAt(t),this.dpr,()=>{this.current===e&&this.prefetchAround(e)}),this.indicator.watch(i),this.progress.watch(i)}prefetchAround(t){let e=this.stops[t],i=this.stops[t+1];if(!(!i||i.photo<0)){if(i.photo===e.photo){let s=this.loader(e.photo);s.prefetchLevel(this.viewAt(i),s.finalLevel);let r=this.stops.find(o=>o.photo===e.photo+1);r&&this.loader(r.photo).prefetchProbe(this.viewAt(r),this.dpr);return}this.loader(i.photo).prefetchProbe(this.viewAt(i),this.dpr)}}viewAt(t){let e=this.layouts[t.photo],i=t.camera-this.vw/2,s=Math.max(i,e.left),r=Math.min(i+this.vw,e.left+e.width),o=Math.max(0,e.top),a=Math.min(this.vh,e.top+e.height);return{displayWidth:e.width,u0:(s-e.left)/e.width,u1:(r-e.left)/e.width,v0:(o-e.top)/e.height,v1:(a-e.top)/e.height}}photoRect(t){let e=this.layouts[t],i=e.left-(this.camera-this.vw/2);return{left:Math.max(0,i),right:Math.min(this.vw,i+e.width),top:Math.max(0,e.top),bottom:Math.min(this.vh,e.top+e.height)}}inCaptionZone(t,e){let i=this.stops[this.current];if(i.photo<0)return!1;let s=this.stage.getBoundingClientRect(),r=t-s.left,o=e-s.top,a=this.layouts[i.photo],h=this.photoRect(i.photo),l=a.top+a.height*(1-ze);return r>=h.left&&r<=h.right&&o>=l&&o<=h.bottom}updateCaption(){let t=this.stops[this.current],e=t.photo>=0&&this.zoomPhoto<0&&!this.dragging&&(this.pinned||this.hover);if(e){let i=this.photoRect(t.photo);this.caption.place(i.left,i.right-i.left,this.vh-i.bottom)}this.caption.show(e),document.body.classList.toggle("has-caption",e)}loadNextAlbum(){this.indexRequested||!this.settings.indexUrl||(this.indexRequested=!0,fetch(this.settings.indexUrl,{credentials:"same-origin"}).then(t=>t.ok?t.json():Promise.reject(new Error("index"))).then(t=>this.showNextAlbum(t)).catch(()=>{this.indexRequested=!1}))}showNextAlbum(t){let e=t.albums;if(e.length===0)return;let i=e.findIndex(a=>a.slug===this.manifest.slug),s=e[(i+1)%e.length];if(!s||s.slug===this.manifest.slug)return;this.nextLink.href="/a/"+encodeURIComponent(s.slug)+"/";let r=this.nextLink.querySelector(".next-eyebrow"),o=this.nextLink.querySelector(".next-title");r&&(r.textContent="Next album"+(s.date?" \xB7 "+s.date:"")),o&&(o.textContent=s.title,ut(o,s.title)),s.cover&&(this.nextStrip=new Z(this.nextFrame,s.cover,s.collapsed_focus_y??.5,Q(t.build,s.slug,s.cover.hash),{...this.env,tiles:t.tiles},()=>{}),this.nextLink.classList.add("has-strip"),this.layoutNextStrip(),this.syncNextStrip())}requestDraw(){this.frame===0&&(this.frame=requestAnimationFrame(t=>{this.frame=0,this.render(t)}))}render(t){let e=!1;if(this.tween){let y=Math.min(1,(t-this.tween.start)/this.tween.duration);this.camera=this.tween.from+(this.tween.to-this.tween.from)*De(y),y>=1?(this.tween=null,this.updateCaption()):e=!0}let i=this.g,s=this.canvas.width,r=this.canvas.height;i.setTransform(1,0,0,1,0,0),i.globalAlpha=1,i.fillStyle="#111114",i.fillRect(0,0,s,r);let o=this.camera-this.vw/2,a=o+this.vw,h=this.dpr,l=this.stops[this.current].photo,c=Math.max(0,(l<0?this.layouts.length-1:l)-2),b=this.zoomPhoto>=0?-1:Math.min(this.layouts.length-1,(l<0?this.layouts.length-1:l)+2);if(this.zoomPhoto>=0){let y=this.layouts[this.zoomPhoto],m=y.width*this.zoom;this.loader(this.zoomPhoto).draw({g:i,originX:this.zx*h,originY:this.zy*h,width:m*h,height:y.height*this.zoom*h,canvasWidth:s,canvasHeight:r,displayWidth:m,dpr:this.levelDpr(),now:t})&&(e=!0)}for(let y=c;y<=b;y++){let m=this.layouts[y];m.left+m.widtha||this.loader(y).draw({g:i,originX:(m.left-o)*h,originY:m.top*h,width:m.width*h,height:m.height*h,canvasWidth:s,canvasHeight:r,displayWidth:m.width,dpr:h,now:t})&&(e=!0)}this.endCard.style.transform="translate3d("+Math.round(this.endLeft-o)+"px,0,0)",this.caption.element.classList.contains("is-visible")&&this.tween&&this.updateCaption(),e&&this.requestDraw()}};async function re(n){let t=await fetch(n,{credentials:"same-origin"});if(!t.ok)throw new Error(n+" "+t.status);return await t.json()}function ne(n){return{scheduler:new tt(n.concurrency,n.workerUrl),cache:new st(Ft())}}async function We(n,t,e){let i=await re(t.manifestUrl);if(i.photos.length===0){e.abandon();return}e.configure(i.gate);let{scheduler:s,cache:r}=ne(t);document.documentElement.classList.add("has-viewer"),oe(new vt(n,i,t,{scheduler:s,cache:r,settings:t,gate:e,tiles:i.tiles}))}async function Oe(n,t,e){let i=await re(t.indexUrl);if(i.albums.length===0){e.abandon();return}e.configure(i.gate);let{scheduler:s,cache:r}=ne(t);oe(new dt(n,i,t,{scheduler:s,cache:r,settings:t,gate:e,tiles:i.tiles}))}function oe(n){document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?n.suspend(!1):n.resume()}),window.addEventListener("pagehide",()=>n.suspend(!0)),window.addEventListener("pageshow",t=>{t.persisted&&n.resume()})}function Be(){document.documentElement.classList.remove("has-viewer"),document.querySelector(".load-error")?.removeAttribute("hidden")}function se(){let n=$t(document.body);if(n.page==="album"){let t=document.getElementById("stage");if(t){let e=new G(n.build,n.gate,n.workerUrl);We(t,n,e).catch(()=>{e.abandon(),Be()})}}else if(n.page==="notfound"){let t=document.querySelector(".site-header .wordmark");t&&D(t,!1)}else if(n.page==="index"){let t=document.getElementById("strips");if(t){let e=new G(n.build,n.gate,n.workerUrl);Oe(t,n,e).catch(()=>{e.abandon(),document.documentElement.classList.remove("has-strips");let i=document.querySelector(".site-header .wordmark");i&&!i.classList.contains("has-svg")&&D(i,!1)})}}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",se,{once:!0}):se();})(); diff --git a/internal/site/static/worker.js b/internal/site/static/worker.js index 6cc7ad3..8afaeb3 100644 --- a/internal/site/static/worker.js +++ b/internal/site/static/worker.js @@ -1 +1 @@ -"use strict";(()=>{function k(r){let n=r.seed+"|"+r.level+"|"+r.x+"|"+r.y,o=2166136261;for(let t=0;t>>0;return o}function v(r,n){let o=new Array(r);for(let e=0;e{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296};for(let e=r-1;e>0;e--){let s=Math.floor(a()*(e+1)),m=o[e];o[e]=o[s],o[s]=m}return o}function g(r,n,o,t,a){r.drawImage(n,0,0);let e=a.cell,s=Math.floor(o/e),m=Math.floor(t/e),u=s*m;if(u<2)return;let d=v(u,k(a));for(let c=0;c{let n=r.data;if(n.type==="abort"){i.get(n.key)?.abort(),i.delete(n.key);return}S(n)};function x(r,n){if(!b)throw new Error("unsupported-offscreen");let o=new b(r.width,r.height),t=o.getContext("2d");if(!t)throw new Error("unsupported-offscreen");return g(t,r,r.width,r.height,n),r.close(),o.transferToImageBitmap()}async function S(r){if(!M){l.postMessage({key:r.key,ok:!1,bytes:0,ms:0,error:"unsupported-bitmap"});return}if(r.scramble&&!b){l.postMessage({key:r.key,ok:!1,bytes:0,ms:0,error:"unsupported-offscreen"});return}let n=new AbortController;i.set(r.key,n);let o=performance.now();try{let t=await fetch(r.url,{signal:n.signal,credentials:"same-origin"});if(!t.ok)throw new Error("HTTP "+t.status);let a=await t.blob(),e=performance.now()-o,s=await createImageBitmap(a);if(r.scramble&&(s=x(s,r.scramble)),n.signal.aborted)throw s.close(),new Error("aborted");l.postMessage({key:r.key,ok:!0,bitmap:s,bytes:a.size,ms:e},[s])}catch(t){let a=t instanceof Error?t.message:String(t);l.postMessage({key:r.key,ok:!1,bytes:0,ms:0,error:a})}finally{i.delete(r.key)}}})(); +"use strict";(()=>{function v(t){let a=t.seed+"|"+t.level+"|"+t.x+"|"+t.y,o=2166136261;for(let r=0;r>>0;return o}function M(t,a){let o=new Array(t);for(let e=0;e{r=r+1831565813|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296};for(let e=t-1;e>0;e--){let s=Math.floor(n()*(e+1)),i=o[e];o[e]=o[s],o[s]=i}return o}function A(t,a,o,r,n){t.drawImage(a,0,0);let e=n.cell,s=Math.floor(o/e),i=Math.floor(r/e);if(s<2||i<2)return;let c=s*i,f=M(c,v(n));for(let l=0;l>>7|r<<25)^(r>>>18|r<<14)^r>>>3,s=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10;t[o]=t[o-16]+e+t[o-7]+s|0}}function k(t,a,o,r){let n=t[0],e=t[1],s=t[2],i=t[3],c=t[4],f=t[5],l=t[6],b=t[7];for(let u=o;u>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&l)+U[u]+a[u]|0,h=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&e^n&s^e&s)|0;b=l,l=f,f=c,c=i+d|0,i=s,s=e,e=n,n=d+h|0}t[0]=n,t[1]=e,t[2]=s,t[3]=i,t[4]=c,t[5]=f,t[6]=l,t[7]=b}var H=new Int32Array(64),j=new Int32Array(8),F=new Int32Array(8);var C=new TextEncoder;function B(t,a,o){let r=C.encode(t),n=new Uint8Array(r.length+a.length+4);n.set(r),n.set(a,r.length);let e=r.length+a.length;return n[e]=o>>>24,n[e+1]=o>>>16&255,n[e+2]=o>>>8&255,n[e+3]=o&255,n}var y=class{constructor(a,o){this.w=new Int32Array(64);this.mid=new Int32Array(8);this.s=new Int32Array(8);this.target=new Int32Array(4);let r=new Uint8Array(64);r.set(B("luphoto-check",a,0)),r[33]=128,r[62]=33*8>>>8,r[63]=33*8&255;let n=this.w;for(let e=0;e<16;e++)n[e]=r[e*4]<<24|r[e*4+1]<<16|r[e*4+2]<<8|r[e*4+3];this.saltTail=r[28]<<24;for(let e=16;e<22;e++){let s=n[e-15],i=n[e-2],c=(s>>>7|s<<25)^(s>>>18|s<<14)^s>>>3,f=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10;n[e]=n[e-16]+c+n[e-7]+f|0}this.mid.set(m),k(this.mid,n,0,7);for(let e=0;e<4;e++)this.target[e]=o[e*4]<<24|o[e*4+1]<<16|o[e*4+2]<<8|o[e*4+3]}run(a,o){let r=this.w,n=this.s,e=this.mid,s=this.target[0],i=this.saltTail;for(let c=a;c>>8,r[8]=(c&255)<<24|8388608,S(r,22),n.set(e),k(n,r,7,64),(m[0]+n[0]|0)===s&&(m[1]+n[1]|0)===this.target[1]&&(m[2]+n[2]|0)===this.target[2]&&(m[3]+n[3]|0)===this.target[3])return c;return-1}};function p(t){let a=new Uint8Array(t.length>>>1);for(let o=0;o{let a=t.data;if(a.type==="pow"){let o=new y(p(a.salt),p(a.check));x.postMessage({pow:o.run(0,2**a.bits)});return}if(a.type==="abort"){g.get(a.key)?.abort(),g.delete(a.key);return}E(a)};function T(t,a){if(!w)throw new Error("unsupported-offscreen");let o=new w(t.width,t.height),r=o.getContext("2d");if(!r)throw new Error("unsupported-offscreen");return A(r,t,t.width,t.height,a),t.close(),o.transferToImageBitmap()}async function E(t){if(!O){x.postMessage({key:t.key,ok:!1,bytes:0,ms:0,error:"unsupported-bitmap"});return}if(t.scramble&&!w){x.postMessage({key:t.key,ok:!1,bytes:0,ms:0,error:"unsupported-offscreen"});return}let a=new AbortController;g.set(t.key,a);let o=performance.now();try{let r=await fetch(t.url,{signal:a.signal,credentials:"same-origin"});if(!r.ok)throw new Error("HTTP "+r.status);let n=await r.blob(),e=performance.now()-o,s=await createImageBitmap(n);if(t.scramble&&(s=T(s,t.scramble)),a.signal.aborted)throw s.close(),new Error("aborted");x.postMessage({key:t.key,ok:!0,bitmap:s,bytes:n.size,ms:e},[s])}catch(r){let n=r instanceof Error?r.message:String(r);x.postMessage({key:t.key,ok:!1,bytes:0,ms:0,error:n})}finally{g.delete(t.key)}}})(); diff --git a/internal/site/templates/head.html b/internal/site/templates/head.html index 83deb8c..06c6282 100644 --- a/internal/site/templates/head.html +++ b/internal/site/templates/head.html @@ -24,7 +24,7 @@ {{- end}} -{{define "body-data"}} data-build="{{.Build}}" data-index="{{.IndexURL}}" data-worker="{{.Assets.Worker.URL}}" data-budget-ms="{{.BudgetMS}}" data-max-dpr="{{.MaxDPR}}" data-concurrency="{{.Concurrency}}" data-block-context-menu="{{.BlockContextMenu}}"{{end}} +{{define "body-data"}} data-build="{{.Build}}" data-index="{{.IndexURL}}" data-worker="{{.Assets.Worker.URL}}" data-budget-ms="{{.BudgetMS}}" data-max-dpr="{{.MaxDPR}}" data-concurrency="{{.Concurrency}}" data-block-context-menu="{{.BlockContextMenu}}" data-gate="{{.Gate}}"{{end}} {{define "footer"}}