Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.
TypeScript canva-alternativecanvasdesigndesign-tooldrag-and-dropeditorgraphic-designkonvanextjsopen-sourcereactself-hostedtemplatestypescript
feat(v0.15): GIF export — looping social GIFs from any page range, hand-rolled GIF89a + LZW with zero new dependencies (R5) (#36)
Ashiq Hussain Mir4585b01a5186
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3c33beb..cf958cb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,38 @@All notable changes to Canvix will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).+## [0.15.4] — 2026-11-06++### Added++- **Rich content & export, part 5 — GIF export (R5).** Animated,+ looping GIFs from any page range, rendered entirely in the browser+ with **zero new dependencies** (a hand-rolled GIF89a writer + LZW+ compressor, the R2/R4 house pattern). Every dependency decision is+ on record in `docs/GIF-EXPORT.md`; the highlights:+ - **One render session, three engines.** The GIF engine rides the+ exact `createRenderSession` the two video engines use — R2's+ deterministic fixed-timestep pacing and R3's frame-accurate+ autoplay videos apply to GIFs for free.+ - **A real quantizer, not a first-fit hack.** Median cut over 8+ deterministic timeline samples (the same design always yields+ the same palette); each palette colour is the most-popular+ colour of its box, so flat fills pass through exactly. Per-pixel+ indexing is a 15-bit nearest-colour LUT — O(1) per pixel.+ - **Dithering is an option** (default on): standard Floyd–Steinberg,+ error clamped into gamut. Turn it off for smaller files.+ - **Size cap + honest timing.** 480/720/1080 px caps, a 25 MB byte+ cap checked *during* the encode (early abort with advice), an+ 1800-frame cap refused *before* rendering in the dialog. Delays+ are centiseconds and durations are reported from the actual+ encoded delays (15 fps = 7 cs = 14.29 effective — stated, not+ hidden). GIFs are silent; the dialog says so before you click.+ - **Verified**: unit 60 new (PIL golden LZW streams decoded by an+ independent in-test decoder; byte-level container assertions;+ 4096-entry table exhaustion) · new anonymous zero-registration+ e2e with ffprobe as the independent parser, the page-range+ acceptance, and the pre-flight cap refusal.+## [0.15.3] — 2026-11-06### Addeddiff --git a/README.md b/README.mdindex 1e797a1..383601c 100644--- a/README.md+++ b/README.md@@ -38,7 +38,7 @@ Pro tier, no subscription, no trial countdown, no watermark ransom, nois a design tool that never asks you for a credit card:- All **110 templates** — including the entire premium collection — are free-- All **exports** (PNG, JPG, SVG, PDF, video) are free and unwatermarked+- All **exports** (PNG, JPG, SVG, PDF, video, GIF) are free and unwatermarked- All **AI features** (magic edit, magic write, background removal, translate)run against your own API keys, so there is nothing for us to meter- **Accounts are free** — username + password, no email, no verification,@@ -253,6 +253,14 @@ is right here.Honest format detection is shown before you export. No uploads, no serverrendering. Since **v0.11** the page's audio is muxed into the recording(best-effort per browser) and beat-synced pulses render into the video+- **GIF export** *(v0.15 R5)* — animated, looping GIFs from any page+ range: 480/720/1080 px caps, 10/15/20 fps, optional Floyd–Steinberg+ dithering, a 25 MB cap enforced during the encode, and an 1800-frame+ cap refused before rendering. Hand-rolled GIF89a + LZW encoder with+ **zero new dependencies** (decisions on record in+ `docs/GIF-EXPORT.md`); rides the same deterministic frame renderer+ as video export. GIFs are silent — the dialog says so before you+ click- **Audio/video elements & Beat Sync** *(v0.11, video export v0.15)* —upload MP3/WAV/MP4/WebM through the chunked media store (works withinevery serverless body limit); audio renders as a waveform card with thediff --git a/docs/GIF-EXPORT.md b/docs/GIF-EXPORT.mdnew file mode 100644index 0000000..061ac4d--- /dev/null+++ b/docs/GIF-EXPORT.md@@ -0,0 +1,108 @@+# GIF export — architecture & decision record (v0.15 R5)++Social-loop animated GIFs from any page range, rendered entirely in+the browser. This document is the dependency-decision record the+roadmap requires, in the same spirit as `docs/PDF-VECTOR-EXPORT.md`.++## The pipeline++```+page range (dialog) ──► buildTimeline ──► createRenderSession ← the SAME+ │ │ session the+ │ │ video engines+ │ palette pass: 8 deterministic │ use (R2/R3)+ │ timeline samples → median cut │+ │ → 256 colours → 15-bit LUT │+ ▼ ▼+ planGifFrames ──► per frame: prepareFrameAt(t) → renderFrameAt(t)+ (fail-closed: → getImageData → nearest-LUT index+ refuses up front) → optional Floyd–Steinberg dither+ → GifWriter.addFrame (LZW, sub-blocks)+ → byte-cap check EVERY frame+```++- **Deterministic pacing is inherited, not reimplemented**: every+ frame is rendered at `t = frame / fps` with no wall clock in the+ loop — the R2 contract. Autoplay videos sit at their exact source+ frame via the R3 `prepareFrameAt` seek scheduler.+- The palette is built from **8 deterministic timeline samples**+ (first, last, evenly between), stride-sampled to ≤ 400 000 pixels+ — the same design always produces the same palette.++## Dependency decisions (the record)++| Option | Verdict | Why |+| --- | --- | --- |+| **Hand-rolled GIF89a + LZW** (~500 lines across `src/lib/gif/`) | **CHOSEN** | The house rule: zero new dependencies when the format is small, stable, and well-specified (the R2 WebM-muxer and R4 TTF-subsetter precedent). GIF89a is frozen since 1989; the LZW variant is ~80 lines. Fully unit-testable against PIL-generated goldens. |+| `gif.js` (MIT, ~30 KB) | rejected | Adds a dependency for code we can own and verify; its worker-first API fights the shared render session; unmaintained upstream. |+| `gifenc` (MIT, ~10 KB) | rejected | Fast and nice, but still a dependency for ~500 ownable lines; pulls its own quantizer we would bypass anyway (our palette must match the OTHER exporters' colour story). |+| Server-side ffmpeg render | rejected | Violates the local-only export promise (`ShareDialog`: "no uploads, no server rendering"). |++## Colour++- **Global palette, not per-frame local tables.** Median cut over+ the timeline samples; each palette entry is the **most-popular+ colour of its box** (flat design fills pass through exactly, and+ no colour is invented the design never showed). Per-frame local+ tables were rejected: +768 bytes/frame and visible palette+ flicker on gradients.+- **15-bit nearest-colour LUT** (32 768 entries): built once per+ export, then every pixel costs one shift-mask-and-load. Distances+ are measured in the same 5-bit space pixels are reduced into, so+ palette colours map to their own bin.+- **Dithering is a user option** (default on): standard+ raster-order Floyd–Steinberg, error clamped into gamut before+ indexing. Off = nearest colour (smaller files, banding on+ gradients).++## Timing honesty++GIF delays are **centiseconds**. The offered rates map as+10 fps → 10 cs, 15 fps → 7 cs (14.29 effective), 20 fps → 5 cs.+Durations and progress are computed from the **actual** encoded+delays, never from the requested fps. Delays are floored at 2 cs+(browsers freeze GIFs with 0 cs delays).++## Caps (all enforced fail-closed)++| Cap | Value | Rationale |+| --- | --- | --- |+| Dimension | 480 / 720 / 1080 px longest edge | social-platform friendly sizes |+| Output bytes | 25 MB | the strictest common social limit (Discord free tier) — checked **during** the encode so an oversized export aborts early with advice |+| Frames | 1 800 | bounds memory/time on hostile decks (e.g. 180 s at 10 fps); refused **before** rendering in the dialog |++## Honest limits++- **GIFs are silent** — the format has no audio track. The dialog+ says so before you click.+- **No transparency** — the render canvas is opaque by design+ (every other exporter composites the page background too).+- **No frame-diff rect optimization yet** — every frame is a full+ image; LZW still compresses static regions hard. Disposal/restore+ rect diffing is a documented post-R5 evaluation (it is the classic+ source of GIF flicker bugs; the deterministic renderer makes it+ safe to add later).++## Testing++- **Unit** (`src/lib/gif/*.test.ts`, 47 tests): the LZW codec is+ validated against **PIL-generated golden streams** (a real-world+ encoder) and through an **independent in-test decoder**; the+ container writer is asserted byte-for-byte (header, LSD, GCT,+ NETSCAPE block, GCE delays, sub-block chunking, trailer) and+ walked back with a structural parser. The 4096-entry table+ exhaustion + clear-code reset is covered by a 40 000-pixel noise+ case.+- **The interlace lesson, on the record**: the first golden+ generation silently produced wrong vectors because PIL interlaces+ larger images by default and its own decoder de-interlaces+ invisibly — the comparison "passed" against transposed rows for+ row-uniform images and failed everywhere else. Golden generation+ now pins `interlace=False` explicitly. (The R4 lesson repeating:+ *run a real parser, and make sure the fixture tells the truth*.)+- **e2e** (`tests/e2e/gif-export.spec.ts`, anonymous zero-registration):+ structural parse + **ffprobe as the independent second opinion**+ (codec, dimensions, frame count, duration) — the same discipline+ as the WebM spec; no new CI dependencies (ffmpeg is already in+ the e2e job). Plus the page-range acceptance and the pre-flight+ cap refusal.diff --git a/package.json b/package.jsonindex 41ca372..c9036ef 100644--- a/package.json+++ b/package.json@@ -1,8 +1,8 @@{"name": "canvix",- "version": "0.15.3",+ "version": "0.15.4","private": false,- "description": "Canvix — free & open-source graphic design tool. A community-built Canva alternative.",+ "description": "Canvix \u2014 free & open-source graphic design tool. A community-built Canva alternative.","scripts": {"dev": "next dev -p 3000 2>&1 | tee dev.log","build": "node scripts/build.mjs",diff --git a/src/components/editor/ExportDialog.tsx b/src/components/editor/ExportDialog.tsxindex f8f5804..b62b94c 100644--- a/src/components/editor/ExportDialog.tsx+++ b/src/components/editor/ExportDialog.tsx@@ -1,7 +1,7 @@'use client'import { useEffect, useState } from 'react'-import { Download, Loader2, FileImage, FileType2, FileCode2, Film } from 'lucide-react'+import { Download, Loader2, FileImage, FileType2, FileCode2, Film, ImagePlay } from 'lucide-react'import { useEditorStore } from '@/store/editor-store'import { captureStage, canvasBridge } from './canvas/canvas-bridge'import { exportDesignToSVGs, downloadSVG } from '@/lib/svg-export'@@ -12,12 +12,14 @@ import {detectVideoFormat,detectWebCodecsVideoSupport,downloadVideo,+ buildTimeline,estimateVideoDuration,exportVideo,pagesHaveAutoplayAudio,pagesHaveAutoplayVideo,type VideoExportEngineDecision,} from '@/lib/video-export'+import { planGifFrames, selectGifPages, type GifPageRange } from '@/lib/gif-plan'import { toast } from '@/hooks/use-toast'import { Progress } from '@/components/ui/progress'import { Button } from '@/components/ui/button'@@ -56,6 +58,22 @@ const FORMATS = [{ id: 'pdf', label: 'PDF', hint: 'Vector text · all pages', icon: FileType2 },{ id: 'svg', label: 'SVG', hint: 'Vector · editable', icon: FileCode2 },{ id: 'mp4', label: 'Video', hint: 'MP4 / WebM · animated', icon: Film },+ { id: 'gif', label: 'GIF', hint: 'Animated · loops', icon: ImagePlay },+] as const++/** v0.15 (R5): GIF export options — size caps, centisecond-friendly+ * frame rates, and dithering (the roadmap acceptance: "size cap ++ * dithering options"). */+const GIF_SIZES = [+ { id: 480, label: 'Small', hint: '480 px' },+ { id: 720, label: 'Medium', hint: '720 px' },+ { id: 1080, label: 'Large', hint: '1080 px' },+] as const++const GIF_FPSES = [+ { id: 10, label: '10 fps', hint: 'Smallest file' },+ { id: 15, label: '15 fps', hint: 'Balanced' },+ { id: 20, label: '20 fps', hint: 'Smooth' },] as consttype FormatId = (typeof FORMATS)[number]['id']@@ -72,6 +90,14 @@ export function ExportDialog({ open, onOpenChange }: { open: boolean; onOpenChanconst [busy, setBusy] = useState(false)const [progress, setProgress] = useState<number | null>(null)const [progressLabel, setProgressLabel] = useState('')+ // v0.15 (R5): GIF options — size cap, frame rate, dithering, and+ // the page range ("a social-loop GIF from any page range")+ const [gifSize, setGifSize] = useState<number>(720)+ const [gifFps, setGifFps] = useState<number>(15)+ const [gifDither, setGifDither] = useState(true)+ const [gifRangeMode, setGifRangeMode] = useState<'current' | 'all' | 'range'>('all')+ const [gifFrom, setGifFrom] = useState(1)+ const [gifTo, setGifTo] = useState(pages.length)const videoFormat = detectVideoFormat()const videoDuration = estimateVideoDuration(pages)// v0.15 R2: which engine will exportVideo use for THIS design?@@ -105,6 +131,30 @@ export function ExportDialog({ open, onOpenChange }: { open: boolean; onOpenChanconst estWidth = canvasBridge.pageWidth * scaleconst estHeight = canvasBridge.pageHeight * scale+ // GIF pre-flight: which pages, how long, how many frames — computed+ // BEFORE the export so the dialog can refuse the impossible ones+ // up front (the caps are on the record in docs/GIF-EXPORT.md)+ const gifRange: GifPageRange =+ gifRangeMode === 'all'+ ? { mode: 'all' }+ : gifRangeMode === 'current'+ ? { mode: 'current', currentPage }+ : { mode: 'range', from: gifFrom, to: Math.min(gifTo, pages.length) }+ let gifPages: typeof pages | null = null+ let gifError: string | null = null+ let gifDuration = 0+ let gifFrames = 0+ try {+ gifPages = selectGifPages(pages, gifRange)+ const { total } = buildTimeline(gifPages)+ const plan = planGifFrames(total, gifFps)+ gifDuration = plan.durationSec+ gifFrames = plan.frames+ } catch (e) {+ gifError = e instanceof Error ? e.message : String(e)+ }+ const gifSize2d = computeExportSize(canvasBridge.pageWidth || 1080, canvasBridge.pageHeight || 1080, gifSize)+const run = async () => {setBusy(true)setProgress(null)@@ -129,6 +179,32 @@ export function ExportDialog({ open, onOpenChange }: { open: boolean; onOpenChanonOpenChange(false)return}+ if (format === 'gif') {+ if (!gifPages) throw new Error(gifError ?? 'The GIF export has no pages.')+ // the encoder (quantizer + LZW writer) loads on demand — the+ // editor page's module graph stays as light as it was (the+ // pdf-export precedent)+ const { exportGif, downloadGif } = await import('@/lib/gif-export')+ const result = await exportGif({+ designWidth: canvasBridge.pageWidth || 1080,+ designHeight: canvasBridge.pageHeight || 1080,+ pages: gifPages,+ maxWidth: gifSize,+ fps: gifFps,+ dither: gifDither,+ onProgress: (ratio, label) => {+ setProgress(Math.round(ratio * 100))+ setProgressLabel(label)+ },+ })+ downloadGif(result, base)+ toast({+ title: 'GIF downloaded',+ description: `${result.frames} frames · ${result.durationSec.toFixed(1)}s · ${(result.bytes / 1048576).toFixed(1)} MB · loops forever · rendered locally in your browser`,+ })+ onOpenChange(false)+ return+ }if (format === 'svg') {// true vector export — no rasterization of vector elements.// v0.13 (P4): plugin renders are awaited FIRST (bounded by@@ -222,7 +298,7 @@ export function ExportDialog({ open, onOpenChange }: { open: boolean; onOpenChan<div className="space-y-5 py-2"><div><h4 className="text-xs font-semibold text-muted-foreground mb-2">File type</h4>- <div className="grid grid-cols-5 gap-1.5">+ <div className="grid grid-cols-3 gap-1.5">{FORMATS.map((f) => {const Ico = f.iconreturn (@@ -255,6 +331,101 @@ export function ExportDialog({ open, onOpenChange }: { open: boolean; onOpenChanVector text with embedded fonts — selectable & searchable, print-ready.The detail level sets the resolution of photos, stickers and other raster content.</p>+ ) : format === 'gif' ? (+ <div className="text-[11px] text-muted-foreground space-y-3 py-1">+ <p>+ Renders <strong>{gifDuration.toFixed(1)}s</strong> from {gifPages ? gifPages.length : 0} page{gifPages && gifPages.length > 1 ? 's' : ''} — {gifFrames} frames,{' '}+ <strong>looping forever</strong>.+ </p>+ {pagesHaveAutoplayVideo(pages) ? (+ <p>Autoplay videos export with their moving content frame-accurately — non-autoplay videos keep their poster.</p>+ ) : null}+ <p>GIFs are <strong>silent</strong> — the format has no audio track. Capped at 25 MB and 1 800 frames; the export stops with advice if it would exceed either.</p>+ <div>+ <div className="grid grid-cols-3 gap-2">+ {GIF_SIZES.map((sz) => (+ <button+ key={sz.id}+ onClick={() => setGifSize(sz.id)}+ className={cn(+ 'rounded-xl border-2 p-2.5 text-center transition-all',+ gifSize === sz.id ? 'border-[#00C4CC] bg-[#F0FBFC]' : 'border-black/10 hover:border-black/25',+ )}+ >+ <div className="font-bold text-sm">{sz.label}</div>+ <div className="mt-0.5">{sz.hint}</div>+ </button>+ ))}+ </div>+ <p className="mt-1.5">Output: {gifSize2d.width} × {gifSize2d.height} px</p>+ </div>+ <div>+ <div className="grid grid-cols-3 gap-2">+ {GIF_FPSES.map((f) => (+ <button+ key={f.id}+ onClick={() => setGifFps(f.id)}+ className={cn(+ 'rounded-xl border-2 p-2.5 text-center transition-all',+ gifFps === f.id ? 'border-[#00C4CC] bg-[#F0FBFC]' : 'border-black/10 hover:border-black/25',+ )}+ >+ <div className="font-bold text-sm">{f.label}</div>+ <div className="mt-0.5">{f.hint}</div>+ </button>+ ))}+ </div>+ </div>+ <label className="flex items-center justify-between rounded-xl border border-black/10 px-4 py-3 cursor-pointer">+ <span>+ Dithering+ <span className="block font-normal">Smoother gradients, slightly larger file</span>+ </span>+ <input type="checkbox" checked={gifDither} onChange={(e) => setGifDither(e.target.checked)} className="accent-[#00C4CC] h-4 w-4" />+ </label>+ <div className="space-y-1.5">+ <div className="flex items-center gap-4">+ {(['all', 'current', 'range'] as const).map((m) => (+ <label key={m} className="flex items-center gap-1.5 cursor-pointer">+ <input+ type="radio"+ name="gif-page-range"+ checked={gifRangeMode === m}+ onChange={() => setGifRangeMode(m)}+ className="accent-[#00C4CC]"+ />+ {m === 'all' ? 'All pages' : m === 'current' ? 'Current page' : 'Range'}+ </label>+ ))}+ </div>+ {gifRangeMode === 'range' && (+ <div className="flex items-center gap-2 pl-6">+ <span>Pages</span>+ <input+ type="number"+ min={1}+ max={pages.length}+ value={gifFrom}+ onChange={(e) => setGifFrom(Math.max(1, Math.round(Number(e.target.value) || 1)))}+ className="w-16 rounded-lg border border-black/15 px-2 py-1 text-sm"+ aria-label="First page"+ />+ <span>to</span>+ <input+ type="number"+ min={1}+ max={pages.length}+ value={gifTo}+ onChange={(e) => setGifTo(Math.max(1, Math.round(Number(e.target.value) || 1)))}+ className="w-16 rounded-lg border border-black/15 px-2 py-1 text-sm"+ aria-label="Last page"+ />+ <span className="text-muted-foreground">of {pages.length}</span>+ </div>+ )}+ </div>+ {gifError ? <p className="text-red-500">{gifError}</p> : null}+ </div>) : format === 'mp4' ? (<div className="text-[11px] text-muted-foreground space-y-1.5 py-1"><p>@@ -307,7 +478,7 @@ export function ExportDialog({ open, onOpenChange }: { open: boolean; onOpenChan)}</div>- {pages.length > 1 && format !== 'mp4' && (+ {pages.length > 1 && format !== 'mp4' && format !== 'gif' && (<label className="flex items-center justify-between rounded-xl border border-black/10 px-4 py-3 cursor-pointer"><span className="text-sm font-medium">{format === 'pdf' ? 'Include all pages' : 'Download all pages'}@@ -329,9 +500,9 @@ export function ExportDialog({ open, onOpenChange }: { open: boolean; onOpenChan<Button variant="outline" onClick={() => onOpenChange(false)} disabled={busy}>Cancel</Button>- <Button className="btn-brand-gradient gap-2 px-6" onClick={run} disabled={busy}>+ <Button className="btn-brand-gradient gap-2 px-6" onClick={run} disabled={busy || (format === 'gif' && gifError !== null)}>{busy ? <Loader2 size={15} className="animate-spin" /> : <Download size={15} />}- {busy ? 'Exporting…' : `Download ${pageCount} ${format.toUpperCase()}`}+ {busy ? 'Exporting…' : format === 'gif' ? 'Download GIF' : `Download ${pageCount} ${format.toUpperCase()}`}</Button></DialogFooter></DialogContent>diff --git a/src/lib/gif-export.test.ts b/src/lib/gif-export.test.tsnew file mode 100644index 0000000..26218e9--- /dev/null+++ b/src/lib/gif-export.test.ts@@ -0,0 +1,87 @@+import { describe, expect, it } from 'vitest'+import type { PageData } from '@/lib/types'+import { GIF_MAX_FRAMES, gifDelayCs, planGifFrames, selectGifPages } from './gif-plan'++function page(id: string): PageData {+ return {+ id,+ background: { type: 'solid', color: '#ffffff' },+ elements: [],+ } as unknown as PageData+}++describe('gifDelayCs', () => {+ it('maps the dialog rates to exact centiseconds', () => {+ expect(gifDelayCs(10)).toBe(10)+ expect(gifDelayCs(20)).toBe(5)+ expect(gifDelayCs(50)).toBe(2)+ })+ it('rounds honestly (15 fps encodes as 7 cs = 14.29 effective)', () => {+ expect(gifDelayCs(15)).toBe(7)+ expect(gifDelayCs(30)).toBe(3) // 3.33 → 3+ })+ it('never emits a zero delay (browsers freeze on 0)', () => {+ expect(gifDelayCs(200)).toBe(2) // clamped, not 0.5 → 1 → 0+ expect(gifDelayCs(1000)).toBe(2)+ })+ it('fails closed on garbage fps', () => {+ expect(() => gifDelayCs(0)).toThrow(/positive/)+ expect(() => gifDelayCs(-5)).toThrow(/positive/)+ expect(() => gifDelayCs(Number.NaN)).toThrow(/positive/)+ })+})++describe('planGifFrames', () => {+ it('plans frames and reports duration from the ACTUAL delays', () => {+ // 6 s at 15 fps → 90 frames × 7 cs = 6.3 s (not 6.0 — the+ // centisecond rounding is reported, not hidden)+ const plan = planGifFrames(6, 15)+ expect(plan.frames).toBe(90)+ expect(plan.delayCs).toBe(7)+ expect(plan.durationSec).toBeCloseTo(6.3, 10)+ })+ it('clamps a sub-frame timeline to one frame', () => {+ const plan = planGifFrames(0.01, 10)+ expect(plan.frames).toBe(1)+ })+ it('respects a custom maxFrames with an actionable error', () => {+ expect(() => planGifFrames(60, 30, 100)).toThrow(/page range|frame rate|video/)+ expect(planGifFrames(60, 10, 1800).frames).toBe(600) // at the cap: fine+ expect(() => planGifFrames(181, 10, 1800)).toThrow(/cap/)+ })+ it('fails closed on a non-positive timeline', () => {+ expect(() => planGifFrames(0, 15)).toThrow(/duration/)+ expect(() => planGifFrames(-1, 15)).toThrow(/duration/)+ })+})++describe('selectGifPages', () => {+ const pages = [page('p1'), page('p2'), page('p3'), page('p4')]++ it('returns every page for mode=all and one for mode=current', () => {+ expect(selectGifPages(pages, { mode: 'all' })).toHaveLength(4)+ expect(selectGifPages(pages, { mode: 'current', currentPage: 2 })).toEqual([pages[2]])+ })+ it('slices an inclusive 1-based range', () => {+ expect(selectGifPages(pages, { mode: 'range', from: 2, to: 3 })).toEqual([pages[1], pages[2]])+ expect(selectGifPages(pages, { mode: 'range', from: 3, to: 3 })).toEqual([pages[2]])+ expect(selectGifPages(pages, { mode: 'range', from: 1, to: 4 })).toHaveLength(4)+ })+ it('clamps out-of-bounds ranges into the design (typed 99 in a 4-pager = 4)', () => {+ expect(selectGifPages(pages, { mode: 'range', from: 1, to: 99 })).toHaveLength(4)+ expect(selectGifPages(pages, { mode: 'range', from: 0, to: 2 })).toEqual([pages[0], pages[1]])+ })+ it('fails closed on reversed, non-numeric, and out-of-range input', () => {+ expect(() => selectGifPages(pages, { mode: 'range', from: 3, to: 1 })).toThrow(/reversed/)+ expect(() => selectGifPages(pages, { mode: 'range', from: Number.NaN, to: 2 })).toThrow(/numeric/)+ expect(() => selectGifPages(pages, { mode: 'current', currentPage: 4 })).toThrow(/out of range/)+ expect(() => selectGifPages(pages, { mode: 'current', currentPage: -1 })).toThrow(/out of range/)+ expect(() => selectGifPages([], { mode: 'all' })).toThrow(/no pages/)+ })+})++describe('GIF caps are stable constants (documented in docs/GIF-EXPORT.md)', () => {+ it('keeps the frame cap at 1800', () => {+ expect(GIF_MAX_FRAMES).toBe(1800)+ })+})diff --git a/src/lib/gif-export.ts b/src/lib/gif-export.tsnew file mode 100644index 0000000..ac3cc76--- /dev/null+++ b/src/lib/gif-export.ts@@ -0,0 +1,234 @@+// ─────────────────────────────────────────────────────────────+// GIF export (v0.15 R5) — social-loop animated GIFs from any page+// range, entirely in the browser, ZERO new dependencies.+//+// selected pages → the SAME render session the video engines+// use (R2's deterministic fixed-timestep pacing, R3's moving+// videos) → median-cut palette from deterministic timeline+// samples → per-frame nearest-colour indexing (optional+// Floyd–Steinberg dithering) → hand-rolled LZW + GIF89a writer.+//+// Honest limits, on the record in docs/GIF-EXPORT.md: GIFs are+// silent (the format has no audio), delays are centiseconds, and+// there is no frame-diff rect optimization yet (every frame is a+// full image — LZW still crushes the static regions).+// ─────────────────────────────────────────────────────────────++import type { PageData } from '@/lib/types'+import { buildTimeline, computeExportSize, createRenderSession, type VideoExportOptions } from './video-export'+import { buildNearestLUT, medianCutPalette } from './gif/palette'+import { GifWriter } from './gif/gif-encoder'++import { planGifFrames, selectGifPages, type GifPageRange } from './gif-plan'++// the pre-flight helpers live in the light gif-plan module (the+// dialog imports THAT statically); re-exported here for one-stop+// consumption and for the tests+export { gifDelayCs, planGifFrames, selectGifPages, GIF_MAX_FRAMES } from './gif-plan'+export type { GifFramePlan, GifPageRange } from './gif-plan'++/** hard output cap — the strictest common social-platform limit+ * (Discord free tier); enforced DURING the encode so an oversized+ * export aborts early with advice instead of wasting the render */+export const GIF_MAX_BYTES = 25 * 1024 * 1024+/** longest-edge pixel caps offered in the dialog */+export const GIF_SIZE_CHOICES = [480, 720, 1080] as const+/** frame rates offered in the dialog (centisecond-friendly) */+export const GIF_FPS_CHOICES = [10, 15, 20] as const++/** how many timeline times feed the palette pass */+const PALETTE_SAMPLE_FRAMES = 8+/** ceiling on pixels sampled for the palette (across all samples) */+const PALETTE_SAMPLE_BUDGET = 400_000++/** GIF delays are centiseconds — the honest mapping (15 fps encodes+ * as 7 cs = 14.29 effective; durations are reported from the actual+ * delays, never from the requested fps). */+export interface GifExportOptions {+ designWidth: number+ designHeight: number+ pages: PageData[]+ /** longest-edge pixel cap (480 / 720 / 1080) */+ maxWidth?: number+ fps?: number+ /** Floyd–Steinberg error diffusion (default: on — gradients+ * without it band badly at 256 colours) */+ dither?: boolean+ onProgress?: (ratio: number, stage: string) => void+}++export interface GifExportResult {+ blob: Blob+ mimeType: 'image/gif'+ extension: 'gif'+ frames: number+ durationSec: number+ width: number+ height: number+ bytes: number+}++/** blend a canvas pixel over white — defensive: the compositor fills+ * white before every frame, but a transparent pixel must never+ * leak the previous frame's (or the buffer's) RGB into the GIF */+function overWhite(r: number, g: number, b: number, a: number): [number, number, number] {+ if (a >= 255) return [r, g, b]+ if (a <= 0) return [255, 255, 255]+ const al = a / 255+ return [r * al + 255 * (1 - al), g * al + 255 * (1 - al), b * al + 255 * (1 - al)]+}++export async function exportGif(opts: GifExportOptions): Promise<GifExportResult> {+ const fps = opts.fps ?? 15+ const dither = opts.dither ?? true+ if (opts.pages.length === 0) throw new Error('The GIF needs at least one page — adjust the page range.')++ const { width, height } = computeExportSize(opts.designWidth, opts.designHeight, opts.maxWidth ?? 720)+ const { segments, total } = buildTimeline(opts.pages)+ const plan = planGifFrames(total, fps) // throws BEFORE any work on overrun++ const sessionOpts: VideoExportOptions = {+ designWidth: opts.designWidth,+ designHeight: opts.designHeight,+ pages: opts.pages,+ maxWidth: opts.maxWidth,+ fps,+ onProgress: opts.onProgress,+ }+ const session = await createRenderSession(sessionOpts, width, height, segments, plan.frames)+ try {+ const { canvas, ctx, renderFrameAt, prepareFrameAt } = session++ // ── palette pass: deterministic samples across the timeline ──+ const sampleCount = Math.min(PALETTE_SAMPLE_FRAMES, plan.frames)+ const stride = Math.max(1, Math.floor((width * height) / (PALETTE_SAMPLE_BUDGET / PALETTE_SAMPLE_FRAMES)))+ const perFrame = Math.ceil((width * height) / stride)+ const samples = new Uint8Array(sampleCount * perFrame * 3)+ let filled = 0+ for (let s = 0; s < sampleCount; s++) {+ const frameNo = sampleCount === 1 ? 0 : Math.round((s * (plan.frames - 1)) / (sampleCount - 1))+ const t = frameNo / fps+ opts.onProgress?.(0.02 + 0.08 * (s / sampleCount), `Sampling colours ${s + 1} / ${sampleCount}…`)+ await prepareFrameAt(t)+ renderFrameAt(frameNo, t)+ const data = ctx.getImageData(0, 0, width, height).data+ for (let p = 0; p < width * height; p += stride) {+ const q = p * 4+ const [r, g, b] = overWhite(data[q], data[q + 1], data[q + 2], data[q + 3])+ samples[filled++] = r+ samples[filled++] = g+ samples[filled++] = b+ }+ }+ const palette = medianCutPalette(samples.subarray(0, filled))+ const lut = buildNearestLUT(palette)+ const pal = palette.colors++ // ── frame loop: the R2 deterministic contract (t = frame / fps,+ // no wall clock anywhere — slow rendering can only make the+ // export take longer, never drop or duplicate a frame) ──+ const writer = new GifWriter({ width, height, palette, loopCount: 0 })+ const indices = new Uint8Array(width * height)+ // Floyd–Steinberg error rows, one column of guard at each end so+ // x-1 / x+1 never leave the array (col = x + 1)+ let curErr = new Float32Array((width + 2) * 3)+ let nextErr = new Float32Array((width + 2) * 3)+ const breathe = (): Promise<void> => new Promise<void>((r) => setTimeout(r, 0))++ for (let frame = 0; frame < plan.frames; frame++) {+ const t = frame / fps+ await prepareFrameAt(t) // R3: every autoplay video at its exact frame+ renderFrameAt(frame, t)+ const data = ctx.getImageData(0, 0, width, height).data++ if (dither) {+ nextErr.fill(0)+ let p = 0+ for (let y = 0; y < height; y++) {+ for (let x = 0; x < width; x++, p++) {+ const q = p * 4+ const [r0, g0, b0] = overWhite(data[q], data[q + 1], data[q + 2], data[q + 3])+ const col = (x + 1) * 3+ // clamp the diffused colour into gamut before indexing+ const r = Math.min(255, Math.max(0, r0 + curErr[col]))+ const g = Math.min(255, Math.max(0, g0 + curErr[col + 1]))+ const b = Math.min(255, Math.max(0, b0 + curErr[col + 2]))+ const idx = lut[((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3)]+ indices[p] = idx+ const c3 = idx * 3+ const er = r - pal[c3]+ const eg = g - pal[c3 + 1]+ const eb = b - pal[c3 + 2]+ // standard raster-order Floyd–Steinberg (7/16 →, 3/16 ↙,+ // 5/16 ↓, 1/16 ↘)+ curErr[col + 3] += er * 0.4375+ curErr[col + 4] += eg * 0.4375+ curErr[col + 5] += eb * 0.4375+ nextErr[col - 3] += er * 0.1875+ nextErr[col - 2] += eg * 0.1875+ nextErr[col - 1] += eb * 0.1875+ nextErr[col] += er * 0.3125+ nextErr[col + 1] += eg * 0.3125+ nextErr[col + 2] += eb * 0.3125+ nextErr[col + 3] += er * 0.0625+ nextErr[col + 4] += eg * 0.0625+ nextErr[col + 5] += eb * 0.0625+ }+ // swap rows: the filled next-row becomes current+ const swap = curErr+ curErr = nextErr+ nextErr = swap+ nextErr.fill(0)+ }+ } else {+ for (let p = 0; p < width * height; p++) {+ const q = p * 4+ const [r, g, b] = overWhite(data[q], data[q + 1], data[q + 2], data[q + 3])+ indices[p] = lut[((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3)]+ }+ }++ writer.addFrame(indices, plan.delayCs)+ if (writer.byteLength > GIF_MAX_BYTES) {+ throw new Error(+ `The GIF passed ${Math.round(GIF_MAX_BYTES / 1048576)} MB while encoding — lower the size, the frame rate, or narrow the page range.`,+ )+ }+ opts.onProgress?.(0.1 + 0.9 * ((frame + 1) / plan.frames), `Encoding frame ${frame + 1} / ${plan.frames}`)+ await breathe() // let the dialog's progress bar breathe+ }++ const bytes = writer.finish()+ if (writer.frames === 0 || bytes.length === 0) {+ throw new Error('The GIF encoder produced an empty file — try fewer pages or a smaller size.')+ }+ // explicit copy so the Blob gets a plain ArrayBuffer (TS's BlobPart+ // wants Uint8Array<ArrayBuffer>, and the writer's buffer is generic)+ const blobBytes = new Uint8Array(bytes.length)+ blobBytes.set(bytes)+ return {+ blob: new Blob([blobBytes], { type: 'image/gif' }),+ mimeType: 'image/gif',+ extension: 'gif',+ frames: writer.frames,+ durationSec: plan.durationSec,+ width: canvas.width,+ height: canvas.height,+ bytes: bytes.length,+ }+ } finally {+ session.destroy()+ }+}++/** the same object-URL download dance downloadVideo uses */+export function downloadGif(result: GifExportResult, filename: string): void {+ const url = URL.createObjectURL(result.blob)+ const a = document.createElement('a')+ a.href = url+ a.download = `${filename}.gif`+ document.body.appendChild(a)+ a.click()+ a.remove()+ setTimeout(() => URL.revokeObjectURL(url), 10_000)+}diff --git a/src/lib/gif-plan.ts b/src/lib/gif-plan.tsnew file mode 100644index 0000000..08d4e2e--- /dev/null+++ b/src/lib/gif-plan.ts@@ -0,0 +1,74 @@+// ─────────────────────────────────────────────────────────────+// GIF export pre-flight (v0.15 R5) — the pure planning helpers the+// export dialog needs at RENDER time, split from the heavy encoder+// (gif-export.ts) so the editor page's module graph stays light:+// the LZW writer + quantizer load on demand when a GIF is actually+// requested (the pdf-export precedent).+// ─────────────────────────────────────────────────────────────++import type { PageData } from '@/lib/types'++/** hard frame cap — bounds memory and time on hostile inputs */+export const GIF_MAX_FRAMES = 1800++/** GIF delays are centiseconds — the honest mapping (15 fps encodes+ * as 7 cs = 14.29 effective; durations are reported from the actual+ * delays, never from the requested fps). */+export function gifDelayCs(fps: number): number {+ if (!Number.isFinite(fps) || fps <= 0) throw new Error(`gifDelayCs: fps must be positive, got ${fps}`)+ return Math.max(2, Math.round(100 / fps))+}++export interface GifFramePlan {+ frames: number+ delayCs: number+ /** what the encoded delays actually add up to */+ durationSec: number+}++/** The frame plan — computed BEFORE any rendering so the dialog can+ * refuse an impossible export up front. Fail-closed: the error is+ * actionable and names every lever. */+export function planGifFrames(totalSec: number, fps: number, maxFrames = GIF_MAX_FRAMES): GifFramePlan {+ if (!Number.isFinite(totalSec) || totalSec <= 0) {+ throw new Error('planGifFrames: the timeline has no positive duration')+ }+ const delayCs = gifDelayCs(fps)+ const frames = Math.max(1, Math.round(totalSec * fps))+ if (frames > maxFrames) {+ throw new Error(+ `That selection would need ${frames} GIF frames — the cap is ${maxFrames}. Narrow the page range, lower the frame rate, or export the pages as video instead.`,+ )+ }+ return { frames, delayCs, durationSec: (frames * delayCs) / 100 }+}++export type GifPageRange =+ | { mode: 'current'; currentPage: number }+ | { mode: 'all' }+ | { mode: 'range'; from: number; to: number }++/** Page selection for the GIF — 1-based inclusive `from`/`to`.+ * Out-of-bounds values clamp into the design (a typed 99 in a+ * 3-page deck means page 3); reversed or non-numeric input throws+ * (an empty selection is an error, never a silent no-op). */+export function selectGifPages(pages: PageData[], range: GifPageRange): PageData[] {+ if (pages.length === 0) throw new Error('selectGifPages: the design has no pages')+ if (range.mode === 'all') return pages+ if (range.mode === 'current') {+ const i = range.currentPage+ if (!Number.isInteger(i) || i < 0 || i >= pages.length) {+ throw new Error(`selectGifPages: currentPage ${i} is out of range (0..${pages.length - 1})`)+ }+ return [pages[i]]+ }+ const from = Math.round(Number(range.from))+ const to = Math.round(Number(range.to))+ if (!Number.isFinite(from) || !Number.isFinite(to)) {+ throw new Error(`selectGifPages: page range ${range.from}–${range.to} is not numeric`)+ }+ if (from > to) throw new Error(`selectGifPages: page range ${from}–${to} is reversed`)+ const lo = Math.min(Math.max(1, from), pages.length)+ const hi = Math.min(Math.max(1, to), pages.length)+ return pages.slice(lo - 1, hi)+}diff --git a/src/lib/gif/gif-encoder.test.ts b/src/lib/gif/gif-encoder.test.tsnew file mode 100644index 0000000..74e1e87--- /dev/null+++ b/src/lib/gif/gif-encoder.test.ts@@ -0,0 +1,219 @@+import { describe, expect, it } from 'vitest'+import { GifWriter } from './gif-encoder'+import { medianCutPalette, type GifPalette } from './palette'+import { lzwDecode } from './lzw.test'++function paletteOf(...triples: number[]): GifPalette {+ return medianCutPalette(new Uint8Array(triples))+}++function ascii(bytes: Uint8Array, start: number, len: number): string {+ return String.fromCharCode(...Array.from(bytes.subarray(start, start + len)))+}++/** walk the container: header/LSD/GCT/loop block, then per-frame+ * GCE + image descriptor + LZW sub-blocks; returns the delays and+ * the reassembled LZW stream of each frame */+function walkGif(bytes: Uint8Array): {+ version: string+ width: number+ height: number+ gctEntries: number+ loop: number | null+ delays: number[]+ frames: Uint8Array[]+ minCodeSize: number[]+ trailerAt: number+} {+ expect(ascii(bytes, 0, 6)).toMatch(/^GIF8[79]a$/)+ const version = ascii(bytes, 0, 6).slice(3)+ const width = bytes[6] | (bytes[7] << 8)+ const height = bytes[8] | (bytes[9] << 8)+ const packed = bytes[10]+ let pos = 13+ let gctEntries = 0+ if (packed & 0x80) {+ gctEntries = 2 << (packed & 0x07)+ pos += gctEntries * 3+ }+ let loop: number | null = null+ const delays: number[] = []+ const frames: Uint8Array[] = []+ const minCodeSize: number[] = []+ for (;;) {+ const b = bytes[pos]+ if (b === 0x3b) break+ if (b === 0x21) {+ const label = bytes[pos + 1]+ pos += 2+ if (label === 0xff) {+ expect(bytes[pos]).toBe(11)+ expect(ascii(bytes, pos + 1, 11)).toBe('NETSCAPE2.0')+ expect(bytes[pos + 12]).toBe(3)+ expect(bytes[pos + 13]).toBe(1)+ loop = bytes[pos + 14] | (bytes[pos + 15] << 8)+ expect(bytes[pos + 16]).toBe(0)+ pos += 17+ } else if (label === 0xf9) {+ expect(bytes[pos]).toBe(4)+ delays.push(bytes[pos + 2] | (bytes[pos + 3] << 8))+ expect(bytes[pos + 4]).toBe(0)+ pos += 6 // size + 4-byte payload + terminator+ } else {+ while (bytes[pos] !== 0) pos += 1 + bytes[pos]+ pos += 1+ }+ } else if (b === 0x2c) {+ pos += 1+ const l = bytes[pos] | (bytes[pos + 1] << 8)+ const t = bytes[pos + 2] | (bytes[pos + 3] << 8)+ const w = bytes[pos + 4] | (bytes[pos + 5] << 8)+ const h = bytes[pos + 6] | (bytes[pos + 7] << 8)+ expect([l, t, w, h]).toEqual([0, 0, width, height])+ expect(bytes[pos + 8]).toBe(0) // no local table, no interlace+ pos += 9+ const mcs = bytes[pos]+ pos += 1+ const chunks: number[] = []+ while (bytes[pos] !== 0) {+ const len = bytes[pos]+ expect(len).toBeLessThanOrEqual(255)+ for (let i = 0; i < len; i++) chunks.push(bytes[pos + 1 + i])+ pos += 1 + len+ }+ pos += 1+ minCodeSize.push(mcs)+ frames.push(new Uint8Array(chunks))+ } else {+ throw new Error(`walkGif: unknown block 0x${b.toString(16)} at ${pos}`)+ }+ }+ return { version, width, height, gctEntries, loop, delays, frames, minCodeSize, trailerAt: pos }+}++describe('GifWriter container', () => {+ it('writes the exact header / LSD / GCT / loop bytes for a 2-colour image', () => {+ const p = paletteOf(0, 0, 0, 255, 255, 255)+ const w = new GifWriter({ width: 2, height: 2, palette: p })+ w.addFrame(new Uint8Array([0, 1, 1, 0]), 8)+ const bytes = w.finish()+ expect(ascii(bytes, 0, 6)).toBe('GIF89a')+ // LSD: 2×2 canvas, GCT present | colour resolution 7 | size field 0+ expect(Array.from(bytes.subarray(6, 13))).toEqual([2, 0, 2, 0, 0xf0, 0, 0])+ // GCT: the two palette colours, padded to 2 entries+ expect(Array.from(bytes.subarray(13, 19))).toEqual([0, 0, 0, 255, 255, 255])+ // NETSCAPE2.0 loop-forever block, byte for byte+ expect(Array.from(bytes.subarray(19, 38))).toEqual([+ 0x21, 0xff, 0x0b, 0x4e, 0x45, 0x54, 0x53, 0x43, 0x41, 0x50, 0x45, 0x32, 0x2e, 0x30, 0x03, 0x01, 0x00, 0x00, 0x00,+ ])+ // GCE (disposal 1, delay 8cs) + image descriptor+ expect(Array.from(bytes.subarray(38, 46))).toEqual([0x21, 0xf9, 0x04, 0x04, 8, 0, 0x00, 0x00])+ expect(Array.from(bytes.subarray(46, 56))).toEqual([0x2c, 0, 0, 0, 0, 2, 0, 2, 0, 0x00])+ expect(bytes[bytes.length - 1]).toBe(0x3b)+ })++ it('round-trips frames through the independent decoder with correct delays', () => {+ const p = paletteOf(255, 0, 0, 0, 255, 0, 0, 0, 255)+ const w = new GifWriter({ width: 4, height: 3, palette: p, loopCount: 0 })+ const f0 = new Uint8Array(12).fill(0)+ const f1 = new Uint8Array(12).fill(2)+ const f2 = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 1, 0, 2, 1, 0])+ w.addFrame(f0, 10)+ w.addFrame(f1, 5)+ w.addFrame(f2, 7)+ const bytes = w.finish()+ const walk = walkGif(bytes)+ expect(walk.loop).toBe(0)+ expect(walk.delays).toEqual([10, 5, 7])+ expect(walk.frames.length).toBe(3)+ expect(walk.minCodeSize).toEqual([2, 2, 2]) // 3 palette entries pad to 4 → mcs 2+ expect(Array.from(lzwDecode(walk.frames[0], 2, 12))).toEqual(Array.from(f0))+ expect(Array.from(lzwDecode(walk.frames[1], 2, 12))).toEqual(Array.from(f1))+ expect(Array.from(lzwDecode(walk.frames[2], 2, 12))).toEqual(Array.from(f2))+ expect(walk.trailerAt).toBe(bytes.length - 1) // nothing after the trailer+ })++ it('pads a 137-colour palette to 256 entries and uses minCodeSize 8', () => {+ const triples: number[] = []+ for (let i = 0; i < 137; i++) {+ triples.push((i * 3) % 256, (i * 5) % 256, (i * 7) % 256)+ }+ const p = medianCutPalette(new Uint8Array(triples))+ expect(p.size).toBe(137)+ const w = new GifWriter({ width: 4, height: 1, palette: p })+ w.addFrame(new Uint8Array([0, 136, 50, 50]), 4)+ const bytes = w.finish()+ const walk = walkGif(bytes)+ expect(walk.gctEntries).toBe(256)+ expect(walk.minCodeSize).toEqual([8])+ })++ it('keeps a 1-colour palette legal (padded to 2, mcs 2)', () => {+ const p = medianCutPalette(new Uint8Array([9, 9, 9]))+ const w = new GifWriter({ width: 2, height: 1, palette: p })+ w.addFrame(new Uint8Array([0, 0]), 4)+ const walk = walkGif(w.finish())+ expect(walk.gctEntries).toBe(2)+ expect(walk.minCodeSize).toEqual([2])+ })++ it('chunks LZW output into ≤255-byte sub-blocks and reassembles losslessly', () => {+ // 128×64 2-colour TRUE noise (xorshift — an LCG's low bit merely+ // alternates and compresses to nothing): LZW output lands well+ // past 255 bytes, and the 2-symbol alphabet still exhausts the+ // 4096-entry table mid-stream+ const p = paletteOf(0, 0, 0, 255, 255, 255)+ const px = new Uint8Array(128 * 64)+ let s = 42+ for (let i = 0; i < px.length; i++) {+ s ^= s << 13+ s ^= s >>> 17+ s ^= s << 5+ px[i] = s & 1+ }+ const w = new GifWriter({ width: 128, height: 64, palette: p })+ w.addFrame(px, 4)+ const bytes = w.finish()+ const walk = walkGif(bytes)+ expect(walk.frames[0].length).toBeGreaterThan(255)+ expect(Array.from(lzwDecode(walk.frames[0], 2, px.length))).toEqual(Array.from(px))+ })++ it('exposes byteLength and frames for the orchestrator cap checks', () => {+ const p = paletteOf(0, 0, 0, 255, 255, 255)+ const w = new GifWriter({ width: 64, height: 64, palette: p })+ const before = w.byteLength+ w.addFrame(new Uint8Array(64 * 64), 4)+ expect(w.frames).toBe(1)+ expect(w.byteLength).toBeGreaterThan(before)+ })++ it('fails closed on every misuse', () => {+ const p = paletteOf(0, 0, 0, 255, 255, 255)+ const w = new GifWriter({ width: 2, height: 2, palette: p })+ expect(() => new GifWriter({ width: 0, height: 2, palette: p })).toThrow(/width/)+ expect(() => new GifWriter({ width: 2, height: 2, palette: { colors: new Uint8Array(0), size: 0 } })).toThrow(/palette/)+ expect(() => new GifWriter({ width: 2, height: 2, palette: p, loopCount: -1 })).toThrow(/loopCount/)+ expect(() => w.addFrame(new Uint8Array([0, 1]), 4)).toThrow(/expected 4/)+ expect(() => w.addFrame(new Uint8Array([0, 1, 2, 0]), 4)).toThrow(/outside/) // index 2 ≥ size 2+ expect(() => w.addFrame(new Uint8Array(4), 1.5)).toThrow(/delayCs/)+ const done = new GifWriter({ width: 2, height: 2, palette: p })+ done.finish()+ expect(() => done.addFrame(new Uint8Array(4), 4)).toThrow(/finish/)+ expect(() => done.finish()).toThrow(/finish/)+ })++ it('is deterministic end to end', () => {+ const p = paletteOf(10, 20, 30, 200, 100, 50, 1, 2, 3, 250, 250, 250)+ const build = (): Uint8Array => {+ const w = new GifWriter({ width: 8, height: 8, palette: p })+ for (let f = 0; f < 3; f++) {+ const px = new Uint8Array(64)+ for (let i = 0; i < 64; i++) px[i] = (i + f) % 4+ w.addFrame(px, 6)+ }+ return w.finish()+ }+ expect(Array.from(build())).toEqual(Array.from(build()))+ })+})diff --git a/src/lib/gif/gif-encoder.ts b/src/lib/gif/gif-encoder.tsnew file mode 100644index 0000000..a4f1d11--- /dev/null+++ b/src/lib/gif/gif-encoder.ts@@ -0,0 +1,193 @@+// ─────────────────────────────────────────────────────────────+// GIF89a container writer (v0.15 R5) — hand-rolled, zero deps+// (the R2 WebM-muxer pattern applied to GIF). Frames stream in+// one at a time so the orchestrator can enforce the byte cap+// DURING the encode: a too-big export aborts early instead of+// wasting the whole render.+//+// Layout written:+// "GIF89a" · Logical Screen Descriptor · Global Color Table+// · NETSCAPE2.0 loop extension (loop forever by default)+// · per frame: Graphic Control Extension (delay, disposal)+// · Image Descriptor · LZW sub-blocks+// · trailer 0x3B+// ─────────────────────────────────────────────────────────────++import { lzwEncode } from './lzw'+import type { GifPalette } from './palette'++/** smallest power of two ≥ n, floored at 2 (the GIF minimum) */+function pow2AtLeast(n: number): number {+ let p = 2+ while (p < n) p <<= 1+ return p+}++/** log2 of a power-of-two ≥ 2 (exact — no float log involved) */+function log2Pow2(p: number): number {+ return 31 - Math.clz32(p)+}++class ByteBuf {+ private buf = new Uint8Array(4096)+ private len = 0++ get length(): number {+ return this.len+ }++ private ensure(extra: number): void {+ if (this.len + extra <= this.buf.length) return+ let cap = this.buf.length * 2+ while (cap < this.len + extra) cap *= 2+ const grown = new Uint8Array(cap)+ grown.set(this.buf.subarray(0, this.len))+ this.buf = grown+ }++ pushByte(b: number): void {+ this.ensure(1)+ this.buf[this.len++] = b & 0xff+ }++ pushBytes(bytes: Uint8Array): void {+ this.ensure(bytes.length)+ this.buf.set(bytes, this.len)+ this.len += bytes.length+ }++ pushUint16LE(v: number): void {+ this.pushByte(v & 0xff)+ this.pushByte((v >> 8) & 0xff)+ }++ pushAscii(s: string): void {+ for (let i = 0; i < s.length; i++) this.pushByte(s.charCodeAt(i))+ }++ result(): Uint8Array {+ return this.buf.slice(0, this.len)+ }+}++export interface GifWriterOptions {+ width: number+ height: number+ palette: GifPalette+ /** NETSCAPE loop count — 0 (the default) means loop forever */+ loopCount?: number+}++/** Streaming GIF89a writer. `addFrame` takes palette indices (one+ * per pixel, row-major, top-down); `finish` seals the file. */+export class GifWriter {+ readonly width: number+ readonly height: number+ private readonly palette: GifPalette+ private readonly minCodeSize: number+ private readonly buf = new ByteBuf()+ private frameCount = 0+ private finished = false++ constructor(opts: GifWriterOptions) {+ // fail-closed validation of every field the format constrains+ if (!Number.isInteger(opts.width) || opts.width < 1 || opts.width > 0xffff) {+ throw new Error(`GifWriter: width must be an integer 1..65535, got ${opts.width}`)+ }+ if (!Number.isInteger(opts.height) || opts.height < 1 || opts.height > 0xffff) {+ throw new Error(`GifWriter: height must be an integer 1..65535, got ${opts.height}`)+ }+ if (opts.palette.size < 1 || opts.palette.colors.length < opts.palette.size * 3) {+ throw new Error('GifWriter: malformed palette')+ }+ const loop = opts.loopCount ?? 0+ if (!Number.isInteger(loop) || loop < 0 || loop > 0xffff) {+ throw new Error(`GifWriter: loopCount must be an integer 0..65535, got ${loop}`)+ }+ this.width = opts.width+ this.height = opts.height+ this.palette = opts.palette++ // the Global Color Table must be a power-of-two size; pad with+ // black (padded entries are never referenced by any index)+ const padded = pow2AtLeast(opts.palette.size)+ this.minCodeSize = Math.max(2, log2Pow2(padded))+ const sizeField = log2Pow2(padded) - 1 // 3 bits in the LSD++ this.buf.pushAscii('GIF89a')+ // Logical Screen Descriptor: GCT present, colour resolution 7,+ // no sort, GCT size field; background index 0 (never visible —+ // every frame is a full opaque rectangle); square pixels+ this.buf.pushUint16LE(opts.width)+ this.buf.pushUint16LE(opts.height)+ this.buf.pushByte(0x80 | 0x70 | sizeField)+ this.buf.pushByte(0)+ this.buf.pushByte(0)+ // Global Color Table, zero-padded to the declared size+ const gct = new Uint8Array(padded * 3)+ gct.set(opts.palette.colors.subarray(0, opts.palette.size * 3))+ this.buf.pushBytes(gct)+ // NETSCAPE2.0 loop extension — the de-facto standard block+ // every browser/social platform honors (0 = loop forever)+ this.buf.pushBytes(new Uint8Array([0x21, 0xff, 0x0b]))+ this.buf.pushAscii('NETSCAPE2.0')+ this.buf.pushBytes(new Uint8Array([0x03, 0x01]))+ this.buf.pushUint16LE(loop)+ this.buf.pushByte(0)+ }++ get byteLength(): number {+ return this.buf.length+ }++ get frames(): number {+ return this.frameCount+ }++ addFrame(indices: Uint8Array, delayCs: number): void {+ if (this.finished) throw new Error('GifWriter: finish() was already called')+ const n = this.width * this.height+ if (indices.length !== n) {+ throw new Error(`GifWriter.addFrame: expected ${n} palette indices, got ${indices.length}`)+ }+ if (!Number.isInteger(delayCs) || delayCs < 0 || delayCs > 0xffff) {+ throw new Error(`GifWriter.addFrame: delayCs must be an integer 0..65535, got ${delayCs}`)+ }+ for (let i = 0; i < n; i++) {+ if (indices[i] >= this.palette.size) {+ throw new Error(`GifWriter.addFrame: index ${indices[i]} at pixel ${i} is outside the ${this.palette.size}-colour palette`)+ }+ }++ // Graphic Control Extension: disposal 1 (do-not-dispose —+ // every frame covers the full canvas, so nothing can ever+ // show through), no transparency, delay in centiseconds+ this.buf.pushBytes(new Uint8Array([0x21, 0xf9, 0x04, 0x04]))+ this.buf.pushUint16LE(delayCs)+ this.buf.pushBytes(new Uint8Array([0x00, 0x00]))+ // Image Descriptor: full canvas at 0,0, no local table, no interlace+ this.buf.pushByte(0x2c)+ this.buf.pushUint16LE(0)+ this.buf.pushUint16LE(0)+ this.buf.pushUint16LE(this.width)+ this.buf.pushUint16LE(this.height)+ this.buf.pushByte(0x00)+ // LZW minimum code size + sub-block chunking (≤ 255 bytes each)+ this.buf.pushByte(this.minCodeSize)+ const compressed = lzwEncode(indices, this.minCodeSize)+ for (let i = 0; i < compressed.length; i += 255) {+ const len = Math.min(255, compressed.length - i)+ this.buf.pushByte(len)+ this.buf.pushBytes(compressed.subarray(i, i + len))+ }+ this.buf.pushByte(0x00)+ this.frameCount+++ }++ finish(): Uint8Array {+ if (this.finished) throw new Error('GifWriter: finish() was already called')+ this.finished = true+ this.buf.pushByte(0x3b)+ return this.buf.result()+ }+}diff --git a/src/lib/gif/golden-vectors.json b/src/lib/gif/golden-vectors.jsonnew file mode 100644index 0000000..5fa1153--- /dev/null+++ b/src/lib/gif/golden-vectors.json@@ -0,0 +1 @@+[{"name":"two-color","width":8,"height":8,"colors":2,"indices":"AAEAAQABAAEBAAEAAQABAAABAAEAAQABAQABAAEAAQAAAQABAAEAAQEAAQABAAEAAAEAAQABAAEBAAEAAQABAA==","distinctIndices":2,"version":"87a","gct":"00285a43ab1f000000000000","minCodeSize":8,"lzw":"000104104830c0c083040b16448850e1418609211a74082020","interlace":false,"gctEntries":4},{"name":"four-color","width":16,"height":12,"colors":4,"indices":"AAAAAAEBAQECAgICAwMDAwAAAAABAQEBAgICAgMDAwMAAAAAAQEBAQICAgIDAwMDAQEBAQICAgIDAwMDAAAAAAEBAQECAgICAwMDAwAAAAABAQEBAgICAgMDAwMAAAAAAgICAgMDAwMAAAAAAQEBAQICAgIDAwMDAAAAAAEBAQECAgICAwMDAwAAAAABAQEBAwMDAwAAAAABAQEBAgICAgMDAwMAAAAAAQEBAQICAgIDAwMDAAAAAAEBAQECAgIC","distinctIndices":4,"version":"87a","gct":"00285a43ab1f862ee4c9b1a9","minCodeSize":8,"lzw":"0001080410a060000108050c5838602041830915327468f0604286032a46c44811e2c58903357e5ce8702348812211720ce951e5c9870557a26c299124cb82266dcec4993020","interlace":false,"gctEntries":4},{"name":"gradient","width":64,"height":48,"colors":256,"indices":"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+PwABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj8AAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+PwABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj8AAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1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nKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+PwABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj8AAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/","distinctIndices":64,"version":"87a","gct":"00285a0c346e184082244c963058aa3c64be4870d2547ce66088fa6c940e78a02284ac3690b84a9cc45ea8d072b4dc86c0e89accf4aed800c2e40cd6f018ea3fa7c34bb3d757bfeb63cbff6fd7137be32787ef3b93fb4f9f0763ab1377b71f8bc32b9fcf37b3db43c7e74fdbf35befff67030b7317177f2b238b3f2f97537e262c8a3240963e54a24a68ae567cba6290c66ea4d27ab8de86ccea92e0f69ef402aa080eb61c1ac23026ce4432da583ee66c4af28056fe94620aa86e16bcbda595","minCodeSize":8,"lzw":"00010410308040010307102450b0804103070f204490308142050b173064d0b08143070f1f40841031824409132750a450b182450b172f60c4903183460d1b3770e4d0b183470f1f3f0412348850214387102552b4885123478f204592348952254b973065d2b48953274f9f4085163c987061c387112756bc987163c78f2147963c997265cb973167d6bc997367cf9f41078e2d6a1669daa56c9dbe8d2a976addab78b5eeedea176ce0a1648d9e4daa9669dba770a5cead6a176bdead7cbdfe0d2b9868d9a36895ae6dea166adca974addecdaa976bdfaf80c5bad66c58b667c5b6453bd66d5ab26fd59685672e1cbb73e2daa11be72e1db977eacac15b4f87cd19316dd08c719386cc1b3565e0ac3113267f78f6e7c5b7473fde7d7af2efd5970df6da66f51d875d7afa31d79d7bff4527de7c041a771d7af92dc75d7bfe41179e7c031667dd79f829b71d7bfd3d075e7c0212579d79f725a7dd7afc39f71d7c010e475d79f621979d7afb35e7dd7b004a07a1872cea88a08524ca08a4831caa88a381148a08a38f0c6a88a28df44908a28b3c2a88a189340ad9e18a391e58e18831fed8e08629de58e08421bed8e382199e58e378117ed8e28e095e58e28c413e38e6937072d967926a5a79e79064421967977e2ab9e6957812596694727af9e7926c62996791664a39e7978032d966967a1a79e69474821968936e6ab9e7916852596798823af9e6967c22996695768aa9abacaa8aaaa9a48a0a1b6baaa1661a69a2c1e6ba2ca898428a28b0b8c28a2ab58f1efaebadaf9efae9a5ddfa6aababa67a6aa9a3869adb6aa99d56da68a1bdd6fa2ea794324a28afb4b24a2abe8b0ebaebacab8ebae9a4010fcb6cb5de9e0b6fbe0213dbacb5dfa21bafbe0317ebecb5e0a62befbe041bfb2cb6e1aa3b2fbf051f0b6db6e2ae4b6fbf06231badb6e3b25bafbf07272bedb6e4b66befbf082bcbb3cd30ab4cb2c7184bccb0bb40eb4cb3cb288bccb1c5400504","interlace":false,"gctEntries":64},{"name":"runs","width":96,"height":32,"colors":16,"indices":"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQIBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQECAQEBAQEBAQEBAQEBAQEBAQEBAQEBAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgICAgICAgICAgICAgICAgICAgICBAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwQDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMEAwMDAwMDAwMDAwMDAwMDAwMDAwMDBQQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAUEBAQEBA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AwMDAwMDg0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ4NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0ODQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDw4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg8ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4PDg4ODg4ODg4ODg4ODg4ODg4ODg4OAA8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDwAPDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8ADw8PDw8PDw8PDw8PDw8PDw8PDw8P","distinctIndices":16,"version":"87a","gct":"00285a43ab1f862ee4c9b1a90c346e4fb733923af8d5bdbd1840825bc3479e460ce1c9d1244c9667cf5baa5220edd5e5","minCodeSize":8,"lzw":"0003001848b0a0c18308130a4cc8b0a142870d05049848b1a2c58b18334accc8b1a3468f1d07081849b2a4c99328538a4cc9b2a54a972d090c9849b3a6cd9b3873caccc9b3a74e9f3d0b10184ab4a8d1a348930a4dcab4a952a74d0d14984ab5aad5ab58b34acdcab5ab56af5d0f18184bb6acd9b368d38a4dcbb6ad5ab76d111c984bb7aeddbb78f3cacdcbb7af5ebf7d1320184cb8b0e1c388130b4eccb8b162c78d1524984cb9b2e5cb98334bceccb9b366cf9d1728184dbab4e9d3a8538b4ecdbab56ad7ad192c984dbbb6eddbb873cbcecdbbb76edfbd1b30184ebcb8f1e3c8930b4fcebcb972e7cd1d34984ebdbaf5ebd8b34bcfcebdbb76efdd1f38184fbebcf9f3e8d38b4fcfbebd7af7ed013c984fbfbefdfbf8f3cbcfcfbfbf7efffd2d04d1800c0948e08105198820001b81e420470d3e286145114e18c04a3065c812861a765812871e0ab0135024f234628928d674628a032c05d58b4cb908e38c45c94823015b81a5235739eee863553dfe58c05a7015c9169146265916924a1ab0176050f2f5649454d6356595072c06d9968c69c9e59785790926029b81662667659ea9666569ae99c06ab0c5c91a9c72d6591a9d762ab01b707cf2b6679f80d6f667a00b2c07dda1cc198ae8a2c529ca2803db81272977914e6a6975955edac07af075ca1ea79e865a1ea8a23ab01f80a8f2776aaaacd6b76aab0f0404","interlace":false,"gctEntries":16},{"name":"noise","width":128,"height":128,"colors":256,"indices":"QW7Wv6fZ/yB7mlcOh3PJ0A6oOqwLUwgD00rEmYqYiRdbAfqw1O83SBRmefTv+tSFomXex/9TGQjat+21fkxb44u7p+VhZswRad5ONf7AgAhKYb6hEB1eV3xOtwOnsymIYup1Ytbu5vlvyiFqc8fEuj6iDJ9XGF4TlR6yIFLAB1JONHHiffxqDVr97LoaKqlkDWfHKoqMI+Bapf6IBIikeph0FDrmjXsICLruxp2J97pkpdv7nlOkAX8AcXOwxQX+XAWIdChy7d+I1/NecD9G25g8kibJ552FeIWKMOHZdqRdbeozUuqqpO2XahOEXX9QXgFvnt3ex8ZaXXtatcin8ryY1xZMuJ0tk8/ffa1NDhI8Whnu+0qnxFiKDF5P8KXw7qVjvdJj137DEGteQmjrEo408TbAzzHK/lABD1E0TG4s1YYgjHTil9zgNZCdbLWIRgFUNW5c+ECmEm0JENUIV0ESMiTka1XZY3NhWyiGTA549o93N2DD6NcVr3k5lOPUfLCPrXJ62KmcVU/GfgYEUgPrOYHs0s+cUY5fjP3eQozKTtFo3QZaQF5BczfSouatoFbJ8tfffl0yH+62cX3Piv89l33mEgXnhtHz8Wb5wjyni+SmCXvD+248q4ndpANCbkEggb9PpqyQxBGyEYaFvwkAV0y2gPc+1tMPBqREKjobkLgqf0EM/OYHpzMQvM7hAbDoOz9P3kmjvW/L6zeGsixWACFxXn6Byhqgqmo3jZYOeAshN93zwsGeXh7lzuH369zsOH9ftWz7DvPzE9NHOV25ImgAuljr65U1ox8bpWlnj2FcYnsm97Ei00UiGhRh92sWdSoTxe2cYZUFYPmWeCeibaw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IaKwS8D+KLu/GUh9+e5Cf0EpoiEEyLmJ8sdXBvm7V5FLmccuKLaP+DD7nw9tWie6F9VDmAu87HYX2VxuHWQTeBvTjxTeBWUEyjuiXWdxCOvauVxwPTlYAGQBCtWZ83u8NzRXlSUqV+2XJhVI6oYi2r2izqknOXO/hoPF3ti6ffploexhIcLYWiEPPwv/9WvKBfFS/7tJ8p/pu0/AYvCfZb2mUkQwll2ucGM/YHrptTigFHH3ZL2xL4wr27Qpu5iJRUFG8+QyIQqZ7Pgmd2FUfwluQ5bdIGYeWusDMa43rXjli42aQcFJCZuSq9SqOA+nTTAcjnaFT5hDbpu1cFM/jMftFek/gyzFEMBgMNewmORyFHwt+IBK9I+A==","distinctIndices":256,"version":"87a","gct":"00285a43ab1f862ee4c9b1a90c346e4fb733923af8d5bdbd1840825bc3479e460ce1c9d1244c9667cf5baa5220edd5e53058aa73db6fb65e34f9e1f93c64be7fe783c26a4805ed0d4870d28bf397ce765c11f921547ce697ffabda82701d05356088faa30bbfe68e842911496c940eaf17d3f29a98351d5d78a022bb23e7fea6ac41297184ac36c72ffb0ab2c04d358590b84ad33b0f16bed45941999cc45edf472322cae8654dada8d072eb53372ed6fc7159c1b4dc86f75f4b3ae2107d65d5c0e89a036b5f46ee248971e9ccf4ae0f777352fa38957dfdd800c21b83875e064ca18911e40cd6278f9b6a1260ad9525f018ea339baf761e74b9a139fc24fe3fa7c3822a88c5ad4d0830124bb3d78e369cd1b961143c2657bfeb9a42b0ddc57520483a63cbffa64ec4e9d1892c544e6fd713b25ad8f5dd9d3860627be327be66ec01e9b1446c7687ef3bca72000df5c550788a93fb4fd67e141901d95c849e9f0763e28a28250ded6890b2ab1377ee963c311901749cc6b71f8bfaa2503d251580a8dac32b9f06ae644931298cb4eecf37b312ba78553d3d98c002db43c71ec68c614951a4cc16e74fdb2ad2a06d5565b0d82af35bef36deb4796179bce43eff670342eac8856d8dc8f0520b73174ef6dc9179a1d4fc66177f2b5a02f09d85b5e0087a238b3f660e04a991c9ec148e2f9753721a18b59dddf820a23ba3677e262cc1a9f1042cb647af7b8a3240cdb5051038ca53bb8f963e54d9c1191c44de5fc7a3a24a68e5cd2d2850f26bd3b7ae567cf1d941345c0677dfcbba6290fde55540681a83ebdfc66ea409f1694c742e8ff7f3d27ab815fd7d5880429b0307de86cc210991648c56a70f1bea92e02d15a570986ab31b2ff69ef43921b97ca47ebf274302aa08452dcd88b092cb33570eb61c5139e194bca6d73f6b1ac2305d45f5a0c8bae34b7f26ce44695109acd4ceef579332da58755d1db8e0e2fb63a73ee66c816931c4ecf6076fbb4af2808d7545d0f80a137bcf56fe94998159dc041e1f87e3620aa8a58d6de810322b93f76e16bcb19981f41c46379f0b7a22d0bda595","minCodeSize":8,"lzw":"0083b8b1f6eb54b67f20f668bae2e0d09c64d01ca0d2c16ac1140403a62921964911a64417b604d0078bdabb1b482898c943ef9d3e6a854495f176ecdf940c08b4dd6a57cb0f932de316ed3a552e8c196611d2787352c31f3040089484f1150a42072f57f838b935e0d4ac1488c4a8ab23c69a3b73f9de280ba166ce3162ba7c8862f0e90a062f132a799005420ab003529cd08823ae0f3f350db4f463a74b838a54641a9c39a64211a311e0b494f287880022527a30d1a1a0c35ca33d0810e87267ac53a27bbac894dab6cfd3145201fe0088330756b102feb814404407859c76df105d9be705ce0f23db30f1906422d9b94e85f0145204235c363ba4bab45137438a3a55a4da5d52338150973f50bc0478e3a91b4d635abaecd1520bd92979bc60728d054ce0d2490b933cf34d1fad34e180043c6891813bfb28710a315828c280174fc0530a3cee9432462fd28c718d1fc340b0861742a0b18e048ed0108f0dc03c138332fe4011c00351d0c0841b2c546308088cd021ce25dc805303249db0510b22460440450d6e70810f10a648d04602105483c0154148200309e4ac51453663cc11c6162818c2840378d8f3c81d3780310c3ad754f04a1e3950320e357cc0f2482b72e8814d2a9c54f184317e1840801403ac934320ec48f30c275138f20523fd78230423ca38110d1add18a005105e0431c70dd288624e2ba058918c3cd77ce34717327ce08e2d71f4f18c22fff470491fe64850c0398644334f3c66e4230c0fa72c428e2909ec31cc3e6ef0b04a22dd903280106e04014220bf3c610a2b901013812c111852c82f0900700513b600728f0fd64cf38001a410a1820e1b40828b0a7f04c1003fe61c70ca0c10f0e24c3801c082ce0e3f3ce14d12a3f4f2c632ebdc60882c2c580140087178e14720ca68008a2a6adcd08825702e10c20dddcc234c309e78e141390fdfb30e37ece0f0c717b5b0b18f03f3cc33c13447e4d0452e22a001802e58acb34e25358cf2c106a5a471c623617021c61e26dc138b08d314218206148471cf1a16d4a1c204c5b4c34918951400463e96e07182286db0e2400ddc04e3c82ede80524232762c538e1a804ca009356cd0c2c937dae0d18b2f62e8a38408494853cc0a292440c3068810d2893252a491093a1080138417eff0c30b1685e433850111f442c4146470e08d0ba680c08e06153421012c68b49085112818414e047f78f44d20c5ac1249043280610f27e2d8a249390f58224624c82ce18c397af881ca310838e0011ae2ac208d0911c08189130130b08d211558c239d071872f1c0215312845344e618937d882019b18043c06d18925dc601284884505bc21000068e218abb80126bc00066a98821bd8e8401fd271022f9c600c05e88529125182792c8307a300413ca2810736ac02001010462efab18e19ac820ca1c006071e70843af022111bb8023b3890871a94a11efc08461b40d08e738cc013bd88c726f2a18e12b0e2185c80462c0e913d45a0aa1d2110c514e6408a2c34a3118600c52d5001815214c1138c80412fc461031ac8810107e8c61db0d0054efce200fa28c5176a908759e04209bec886080ed10c443042189e70052c3c100914a861201d98823ac451894a04800deca8071534b10a182d010960c8431b2a40824304800ff5f08030ccc0822c68200dca70831bd8810e4298e21c75980119cc218d34a4e0168c60c126fee00b4e2c601bcad844183c3001417441042bd8003404c10135500015d5e8850d96f0b54e00810bafb8c10862318a78f80103c2db471d42608a6cd8c30d03284226f6e0873e14600f9d5002046e10801d10401fe818860384b1860a60e1094498470ad8b0082550a307c3b0c62ca0c10237f480133a2847325c918e04a8e20d5d3802000cb007732082188538a830cef1837bb44200a250c7336660841e78220348088522cc208b72c861112ff0072476c187297882182cd8811cc2c10e1b50c30c9e38823f2ec0816820c30eec780620b6f00b2c1841075be0023894d009385c4106f21802066ab0034b38a30e4e61442894710d07d4030a9b18400a22200411e48000c3f00232b2310d08cca11c4468c73aa8318894bde01093d00103c4818f011c231e029041189c408c2500e11ad7f0440c1650035190880b73184637fea085062c4318bad0c70714000b50f0601f6c60051d5ab1016aa4430779888726e4010c60e0a20e3fb0030710310b265462026030471a48c00327d40208a4c0c511de910966ec611de808030236a1873578e211fc502620d2a18b26b8c003fe80012498618d1210800fd8b080365a3081591ce0072ff84125ba90861774820849a04032e83006030cc31c65a8c42d6ac10d3b28231af550453006710c036c4116be9802179860093af821082dc8453b80218e3200610a4d88e109a8218352e0201ac2b0213fe0a108644c0007a528000ef4a083140c000011e8033338308e3cc8a219d8b046079e50091c30431bd110812d863004118840008d78c7338a00000770a14b1050c501a670073b30a30fed50472618f0837d702019d510413de4f08a1cdcc01a5f00463b67708233d8011aa3c94335b231894340420bce40c4058ce08c7998801705480367ea008f0ab0611315c8023cc2f00b411c82016b28c21b0c400b163c4013c8f8413068818d1584621e63604036f8500a717c6101fb78c21f58f189018ca101e798c104b8918f3f3ce0123148060d7090084914020d67a006264691002ea0401ced28831c14308353d8a31a76c8462544a1072ca4a21a2360413166e0811cdc420dc5d8020b88010c6700a30443a80518fe20077788c1129300020d9e308b557c80171c6847090ca18211c0030e6738c30da0c10c2c4883128568871054d18e52cc231bf578032b1e41825614e3038040870c2a800b3d00c20cb790871780710115fc600bce1043185021815fdc42186f784039c801012360001690b0442688f08a6708631f9411020d40600f6984a21e1a888709eee0830b88420a68684239b4908b8c3c421ed7ee832e7490814c08a30fc09882223c30821d00801ac4a8c02a4c110a1378c0160a7044326ca10572180208d170000fa2f18a32fc630332b8862888c002256ce300bb18c10d84b30c6bd820068028d13aa2010a388c020fa008812d40c0020e8460197dc8c32ec6810f3048e1053940431f7090820e3821190348441a84e1811d9cc3029cc0833c08200a6ca8c01fc740840914d0010475611fe49007139c31825088831bdba004b3400e217007d87004f4200cf50007cdb009b0400152f0049c8000496002000005c2d004c720034050004f400bd150041d500c22e00e442009a67002ac3009e8300914400db5d00e27100eea70041480077d00087a000d870004cef000f4500650c0070d9008fa7003de2007d3c009321003f3000d2d60042e400414a009cce006259008e2400168e00026f008fd400511d00511a005a2f004d01007cd70097e0013b320091dd004962013d4000e3bd00fe8300e14c00ebd95013fc00bca40046650086120079230084b00006cd00c2070047ff00b48200bba9000de300e9910014fd06b93a00663c0042a400a4b600a57200643d607a9f0002170058210008d00043d1001eca00a383003fb708a9fe00ce7700b2c4012fac00d871007f5900a1970084ad00410400034b00ee7f00865f0089110051c300234800e319004f11004e47006f29006b6a00691400c492005bd200384b00405100816d00f70e01fbad00617d00c58b00d8b200018e009d8b00f41d00c98d00a369608d9d00a21c004fa60059820033ad106be10091dc0084ac00a446008375003c7a009e6f004d2100cf3a00355c000f87003cd400169d00146800f4b100e83300070900b63f00401b00f7210040fb0049e9005927001729001ccf00b8b6004ffb00ebdd0016930008a700b1b4008e1300d44700db4f007649002a70008c3e00e649007ea500584200c11e009d3400919800c8890083410001c600607500db0900343e00fc5200dee100798c00c71a005e9b00f6a900d55f001671006253001c9400bdc500ad5400ba4b0053470060ec004e140035e700744900bab000b24200bb6300bf4000bdaf00aad200befb00317900e7a600507900a26300b0c9007da70061500063f304458300609900299500f44600db9a007ec0008f0800527c004ebc00bd600097570083b50088f200a96100594800c03a00a051007bba0007f200b65700aa520071ed008730005e45003d6900179600c3db00a2b800afd500e31700140e003be23528f3008bea00823f00d66e0088690009a60049d8008f0c00202b006a0e00aa3100348900569100b45009e660000ccb00c6da0033f700ce870041b50066df00b263008c5e0037600071d500e639003e4c00149a00ed81009c060097b700068f00e88f00f4b800b5c5004a37007e6c00d26000a1b80016f300057100e2fc0047bf08324200c4e5000f7100352600995c00a239006ed80061f4005b6c009116002bd600d78d00ca8500c5ed00e70800d63c00751100b60f00b85a0059380047d400f845003be400384b002a5100b0fb003ec400bdbb0006e300529900274b00c2f7002444004838205f88006ff400725900be1600c0e900d6f300e1a7073128003deb00d2790030e40031a400b90100dc9c00358e0088a300514a00c1f00060b800f16e026fd6068bdb00c8c20038ab00756a004efe00b6f6007717001084003810009ae200a77000a6c40036ba006e4a08f1d900f2d2002ec90022770006d800da0900e2e100d6c1005bf30020098346e2005da900695b00757b005139000fb900dd2d00ce6e00957e00f95c0021a80028c200af5b00e1c600243a00aaca00b3dc00389000302e005af20001da002478000e86009b5f00fff8047dd100d4d300554300d43a001be50076b400022800bed800ab1200562400434b00d6dd1089f80004000010d307235a001a6f0047190040f800ed20002aa600a8a40033e0007f4d00810a00784e0021b9007d6000cd6f02146000749900107900166f00d8d300488602a18f002a6e0035d00003cc00182b00c6a380125f009ecf001c6000115409bb4d00451100138f0016611046800036f300bf7c0001060089ac002755003d5301c4fc00ba45003f6200211c00635900b7be0050d600e7fb00da3700c0e8900ce000a1d50035eb00c11000bfc2708aad00594400a9b2005ad6004ca10063910072d100651100958d006f98055bae00f48500c9130095ba00a97400642c002f2200b9a900ea700050d400215e00f06900caff00b025008ee0003c7800c64c00904500869900cf5e00374a01d6110040890025fc00ae31003f2c075568000ead00bb1e001f680060a000705b00fb8c40363100ad0c006cf6007c7100288100b2f100bf9500748800efed00494d00b907008e62003ec5001985a0a2c0007f5600c614002d2600154600f6b900316e00b688001aa700c98d005d5500fae70071860069b20015684047ea005f41005983002c1c0079b909f96a00e0f300a83c0098b8005a13003d140c193b0011c5001e3600b09100892a00d2810003a50093ec002715007f560061c000cd0500223900c2a700633500106100f680007c4f00712600c41100e8e8006632003303a076d0008cd200ad28001e90009d0800255300174f006501004b330010e600559900863f00a31d00746500f7fb002bc500226c005e4e00cb920095c6002c5200ac49008ca7108879006a4f0027810096ee001ceb001a88a2a5a100629400d0dbc0592b00641431408100fb6700eae000083400f30200b40800113a00c0580047f090c43f00619d04820800473e008fc300a964074793001b47001eb700acfb00bb2f0078b000df1c00da9200f1d3001b22009bc000e7a000ca950038bb0096280082e600dfda00cac7007f9c10d0ed0078210012e400fae5000abc00b7350010b40014470000080075c4002d030068da0059800038bc00648c00908c50e4a40007ed002a54000f8300478a00253400856500cff8006b0400025f00ddf400f4d3009e29009d94002d720c83ba00d50c00167800903800fde100803000b16400f59100c28e075b3100eb5b006c0d000ccb00282690d40900cad560e71b00462e00100200b9760013c900e6d801848000f041c0d56000242900996e00626b00bc670004aa0063ae007f66003ae8007af900e06f000bf9005fb6001ed900994300287700680900b3e7006e0b00fe3600d7b80072e800314200c19600e1ca008bd900b5ce0087e82043b8001a3c00e5f3001f2800bf9700fd1200823800e36b08209f042f7000889c00254900bb3f00f85c000bd50059e400ff30009ea800c87e00e1fc00752900846900038f07e9bd0030c900ee0d0020fc00942a0006cb0019e80080e400d897002bbc0096a500577f00393100164800ba340091d400f7bf00f105000bc00061b2004d9f0039d600855500009600b30100294d00950b0064330005cc0029560086330061d9000f3700db8f0aa87300a5fe0084c200da9a00eb62003e880025aa0093ea00597e003e410005960071790034c90bef5d00cc4d008a3c008b18006719009a08005aca00380600bba200ecf000d94900658c00db4d0d55ad00d25a00f9cb00eb3c00158d0015c8001969004ce800d27500517000bb500054ae00e46e00b5d600b7b000030a004f5a006e6400396550e009004da4008efb020e910090a5007b2e00475200398000eeab0073a0007b54005a280057c60054e3002fc805bb3d007faa003c91009f020080430001ae006aa2004e690092d2001b3c00cfe000b0970970099053e1000ad80051c900671f003b0400e12000a469008da800d501001b8fe002a9005e790006c600523300a3040059dd009d8600768600780d0032640b34f3004b4b00b67200b9c5007fb200dd29002851007eca00804500fde500579c009a3800c4e000c10200326400e59600afc700a4c70007a2d01b5900ab92000b4500a7b9002c3c00eb6100ccef00d73800a6f600c77b007c0900b91200979800a34e00ac150042fd00b4a5001132009baa004bdb003c3900ecb7000124008c66006a0b0051b100ad67007c0e009762006f7500b8bf0031f100efe800f72000a2f090a754009951002abb00f51f000e1500e6c8009b09005fa7006ce100f3f70042a400090200f92200c44e007c1a08b74b00f98800d64b04e30700a06d00be500013d200dff5006b2600111700ccbb0029ef00716a00205900a82100ea34006cc500aac400fc7900b670006ebc00c52450ea2d007ec200485a004f4e00e9b4806b6900747300348000027020b126d0d28d0ae8a800553107a33000b49e00b3a400077e00cfa3ba3116001d0f006ea8001cf600ec7e00ddc300a37506c3ea0097ed0045f4b0b20600e84200522b00399000487900bb5100702f00557500847a000c1800870300e6d200f2f70002880d7da200a74200066b00b01500d7a10005e8003f8600ddc507e53a00388200b05c006dd200a303106d2b00759ee0465000d36e0092770cedf200323d00100314081205bcba44499e226852401eb50c0f8c34b96236842fe3dc0f1cc5c982cf6e65d5951869cae06ce1a458106a0c8bd34ac3e4899900380152e2e02682a5009db3505388868b357c18a814bff825129466b5da1060d0485a0e14a99ac7b23e4e1d940e64fa77c8488e811110e8ca76f37b861c3748e99a93fb46eec58b3a39f365f0ca87ce187aa1b0916be887dda45a64da16940b079e3d282188926dbd85599e6439d27010976780820249321373426bdb0c50b89876beb125963b545d5a41968b2c501364c43225dd7bc0c4042ced48b1bb250cc8b17add93550c500951bf0c5c7011f9158b87bb049511124a0fe78e960c856976000ee6c82322bda1c6def2c55c851e2532678e942fcf2918bdd3b16233e7402e3edd28d047934b54066154a3c80e5872ad269a13b256438830423cc31a09e0c4e80631f6966c0041a1e1ae8819b2b0611858e2992e9619c54c498649a0d9851039615fe00c70643d610a39823f471e59a2ac441c3034b6280e79355e8d08393172c2821056d7640a20e22ac88c3090734f8028a010458c39c645431a7025d9a89850d4f60e8601c6992c0420609605086022a58f9668f23aaf9c1916b2a4087011a0488c702557e8807167ade08e10f61f041e30b469eb9a7183e1a21679273c0a0279d659831478b48ced0431c1e2aa1841f2f9ee8458e1196a1a509718c61811d1830f1470633e2a867967e343843870e3ed0c78c644289e103187869e5144a64a827936dc6d9661e20d841e616108e79a30c65e2f184874d46a9a310056e51a69e578cf1c415619268061f4c3608a58067a07861872f44414096638aa901094178c9e31d60fe99609b3bec98a1850758d8e68d3eb050a3045104d802902ab2f1260c71c041e01f72e4c14291620e00438025269823986cd000261a75da10e38b39da60039a6ee849848f78ba9406997b508161031bf46085092d86d0a507430270e19e707a93839510c088a78524d449a104529ce9639732de512313540c78231b2bac60e43e6aa650050b2d2a48a190191408279c1ef480820e2aa2b9a60e64aa0825c07cdc1944862ba8f1a3879a6d68801905a450c1026f3ad8a48f5af421a50672f09964904000e86482368411e71a0d9cb8c29a59ccf0a10d2d9410a58257e6894288048690a1930f1ab161816f1ad8008820f6396696018201438617a818869c4c90514312031ee16612571208a0964716906799231c78810c75ee2820163f6021c68102fed8809a560aa8430c25f08185157312b9a28702e6c0658a4e2ed8219d66dc78c60ad2f18fbfc0e31980a044061ca1083680e00d23f0820d8e1108771c610684508627fe4108730c0306244083112c40896998411044eb062cd4e0066ea0420496a0c511ce000951e80203c8a8840da481031fc8c0031b48c50418210c4d740112f82307379e61860aac621f05b0872536e18e5318e316ff0845025ea1047e04020a3f00c62ace610d352c0016258002354e3002149c621783e0463672300f51580116ad80042582e8087470a3027bc0c32266f10639f003116798022c62f10d1cf0a3046c50c31828908e5a2c420bf5f887366a11893a20820b4c4885309ce08f6194c10254c8c511d620023878e201d470813116708970b0c2046018462716700a5d28a01094a0013c42c10c0fb4a00d26b88528146100521861008350810f3ee0027f208210238801150491023408221f9010800df6b18054e0221ae0c00125821089232c000c2c20420f30708c1598201ef138c6066c7182628cc20ef648e2d28cf18c05c0231117f8c66f0c410c18b4801705f88210782005740c600652c8c23f48e08c3d5002134a68c51ccc518678a0e21aaa680217bc51823e4cc01fff40873768a0820fcc61038330c0376e31b53ee8a10e8bc88319b800015874821e430800053e41040d20a10ac09800071441871964a01ab830873f6c31865a40a31cc820061a92540f04c481156ba8c2325ed1804d4c43519e50450e64b18651082202f580863df2e1017a4003173590012b30a10e5d20610606784537ba50896310e104f26047209e51837bb8c1131138832720210308b0401cd1580705d8f18c2078a31a1530843a80900012b4031ea8b8c314eaa1090d70031edcd8011080b0027d488213c5b0c3316e600704c0620a4950c2339871000e24620db90085350081035318010e895807210a01804d20e207b5b0c51c5a10801244a10e27e0400f4491054ce060016fa807cd86500a465c231a93b88323f0118468e4a0148dc04201cab08144a0430c74300201e030878cda600c9950021156f1884264030c6038461ea661025484220bc438c62636210777fca00c603005107411060c34c01f2468432a60c102618c011079a0880b16408c30f88206aca8053bca118063e8830b58e84020eec0810810e300cd98422ab2000a2864c104c598c126405085701c0216dbd8c722a8808b4fe821128cc00610e8800a7ce462169338003d1e500272a82106ee40861b6430813c8800154ed0821c46218635aca30397a0020a6e0305551421078d0003257a810238c020021710c53cee7085054c411e027042370021852f30c0122a404014ca618d1b0ca308a070c12bcca08637606201cd384534eae18509d0c10b62c0011b08b1862e7cc31c9ac8c11ba411053f0c200b233282170e410f2bdc620278988135d8d0840684830f8690833838c08e4e2ca2014b908019ba808a4c20e20e2de84315aa31094960820875488321caf0834a58021f1cd0822d83810477cc4108de18012162a0806078621db688c10886400a4f84c10c51000623e8b00d67d400061460000c2c51065e9c020f5b200021d8c189301c83006138812372c007147080012688c52084b10d4280801f2ae4453130618d580481009a50802df2718e5b54a2096258c60f74310f0b108214a1f8ec39f2908a0f98410ac58043394e60826f3c011c841843027e91083ba48105c1d0443998b18b6d5c60067110c1397cd0045d04e01b7f5041030ec10d77cc800b5f3806101af0052c58c007b82843090c510704f82014b8784529b0e10446186305188082390a708e1590c315a3e085274060821a000211bbc88423e8118c1f60a20f75100227da21826730e1115578022accb10d783c621c81104309ba018f7328c0198840422b6a318a0498630e97108730ca100611d4010d86d8842f72808e09e8021a75b38233a2e18035d4c10e2a934626a08187098000135618c438da810724d8e30277288545c08314700461d8837b00040110034a40054810812cf8024b600730a80442400330f8823ba0810030016350822b608576e0865fa0824a308777f0840b48844278831f10023c90803e20042b888016908549d0854908022f480052208346a0875e18874ca8002e40033108050af08745e88667988604a0824698073868036de80675d00045d0064078807990822d58874a00075ad0063258811d200775f8811250013dc8064ca80366680065508323c0804168833ef8053f98004b28806d73047270034a60007348852980060100877283047e288712200325480004b80127688435288414f08155e08167e8001228854b20851210044668064720802ce00147308420e8866ee3863e38836ae8037d48013058043d680105f8057e10864708840700025078813df8803dbc0739f00262b8005978873ca8041ea8060f30872bc00077c8812ac00207a08235a0015890007718836e880407a0053c70072a6000f3ab0715d88449e80548788109d8820b88077448850170817238037968800490034c908115300015d8864cd8005150866ad0004b388213e8206640852718074628812770837bc8805920023c981427a0036ba8021000057d080221a0066470816e88053710807068821038014640025870040c30055dd08052280621d8834160836590864b88833890821c188779488103208440a0852e78806df88396d18667c83c57d00013a0072310055938036f280302a80347b0843060867b580679900719e08435d0815b68822100011488003300815838045e708371f0847e00021950075260027158064ab8845f88837ef08224b00437580160b00711f80472e0000bd8992c400658500600b8875108011ca88708c0012c800344680131e8033110826e48875638835f50053a38015c380676e88361708098b88339188644080451688735d88027b80660a0861e000241f00274008236388364280443788779680531e007490c003ea80037c00748d00420704b4a208169c8052248074438913ea88c35000245300217400631888027988158b0051330070709862df0835050832ca0012c08846b680613c88127f0873178875fb80054280633a0866fb0805850824c40035b60870290aa44c8824e500033b0823b588441600429a0813c900457900078108517c08445c0055160007928854380871ea0877668007420823ee8002808850170071de0005af08710a08210e80661f00240f80079a0a57fa8840f188103f8846ac0070978050d0882ce2281a853815e208230c0041680041da88456403709988374008257c0023a188230700102980673f80074a00518f80744e8054ff8827760844b98817dc8823fb80508c0850f58854550860ce0833628052698030a288046fa831b580633a80418c0800e1c012118024c580640e8822bd8005ad8054258074b90821600853e48035a280463300471780509a08758c0873c50070eb0821d90842d200125108610308449a0865d18077260802bf0022260067ee80360b8026e30832f58807550871aa88437a8840ef88379b08262708635c4804030032418820c180057c0052c600363b0025228877500851330047c90036b88812270804bc8037ee8010d900127808571b8851c700612180236d8017750004bb0051a300304e8879ddbafdbb9030008822f20812b500603f00266b8316eb8834470072d100655780501b8862fd08322908566500f1228877220805e08054998860a408211888600e0803ca08612a0b37f4881c1b48378a8033318875a10864ce00304c0831760846248852a80072d20442ad88376783170d88661d80776c08010688577e0051a508333b0800e98030268854c60876df8072f700530180020e99e30f88677d001e2b8067de88049308139d0051a788663f0024e388422f80654c0063c58066b000233a8864c58827e20807b88060a90803df00407908220e0052c780347780729e88537a08165d8015e00034c180526388232fb836418853890855ee8053a60834560855d40806ac88074a086a58d827848023bd8073190837330804ec88346b0831af88776000601280677300153f80110e00652a80533880c39688102b08638c8802e50007198073f28807d78003a600541e88176108379308052380375400020d8065dc80460e88321400504988654c8847038876c38821c88d67b70044088061790864f80076360023cb8800c680564500249780003f0050868871c203a00508374400630d8020060075100031780874ba8867028860bf8873e20003f30856ed8835168031128014c38012698040d30805b64013dc0010278067ab0052278852de8046908030468873d78021978ba1338044eb80422f8825e80023dc0ba5550074288075710871168034a90003548832e000605e00014f8065508050c308648a0020f7802eea3806bf8005d30844ea00167e88266d0076a588238b00730d80026f0065868a67e30854650846b2804010882f7d90518d6843c000107408213180011580110988427c8061ed8830008011150811df8836820df16080507b0033398833a70072fb8031700842b48812ee0022110877e68834d58055258014ec0354c20812cd0051760833d10053520841058006008874c08010b20873e08830656027590861fa80742f88450780572e8025e888337b0007ab0845a38060050026f70035fea0534400132508044a8821a48020968054180027ea0877df88734880041f8075768835e308130188565a8810238835bf0822db0837c88075be88177e8012ee00534b80227d8851659834a98826928007978842c208062c887edbb8003e85400f0077000001c100756d08277904763f8857dc0834aa0024a28051bd88072400332288324a8837250012da8037b4081276806da200150700753a0813b70856818025118853108017641847678040470836928620da00274288721300262d0867100026d988673a00474788551c0004920836498845138854168001a908050408539f08736b8822ca8007170836ca086912e0069f80607380078b8800068053950821e18827648052540044b708512688517780745188009300223880470100212e0805e98847188836f308012a8041630052c28075250003288035d208148f08142b08406608250b8032f10811c68024060875920016ca88111a88702680129180118308634088027908659986910b88625200556808476d00438883b5fc0825670000e504d32c8803ed00154b8810230011b70866650826a68811e200232b01d67108068d0073d608069a8017d708311c0833c48021528037eb8007368011d38820c70001ba8044558841770805380844e10817f000214b8030f98823290026608862f708557a8844200039666805a80844880824f508328d88653b08670c88507d801c5650404908339088150508520988128280266a8051f505f39b0b65560031f70861c20030e20031188070940863aa8833b300279988219380319c0852fb0b73988830340025fc80248d08717f882507d003e680019080444700315080209b08504e8045d100126680649808627e0005d288547788163f08513f0043b188167b0857ec8062e50034638875668033ef80726f8854bc00214e8062f188379300416e8801ce08265b3050e70857ba0831ce8030380030ab0004518056480076cf8003f90800938014ce0ee5240006058815920853938831b800745288146488034c8810c10834f78815af8842cb8862ed00155f80067e08613d8004730001190027b880174d86d2e50076180021cd00707b8876a280429a0856fe8852b28811dd80219d8805378074338855cf0015548b37e600302f8045b888559b88554708756488017c0074b60062428063f08821fa0041bf00161c80103280700480038d8855580826520845d28856ee88510d0013c28850f88844860874608032ce08550e80174e88175b8003290815918010eb08484b6021d108560288136a80641e8041248066a588143980456e0066aa0820468817ae887314c066df0043ff0006dc08764c88317f88151a0852938353be8855a100217300315a08545180108a0860470056300065028870d80856a28057b28064650016b00355ff8a523a0022ec88205900212a8864a808022f0856fa09c6728832eb88370f084d25a0731c0865e18010930840fe80106c80722a0810c25817158041a700751308133e8070e088143c8861940851940804ad0831cc08136f8014608806630237f200031380103b88559c88756c0073138847fd88769a88242e0011d78830b000827338290c9666b423d1249f20c80532bcd1271192e747a742c44925b82ec69e9068fd7a976f540102b500616801fd6bee8f8d72a9ba315d8ece18b62ee96bc57d41234a0370153895e01b8790a81611f1726884025ca67ccc8a4473bd05d93f3c0ddaa076d1a81f1f5481802314d842c80820d59b1624902e4ca6408183a257e4c2c016327c4be3140cc213160259f1a67711ab1a851295bb50f185031e830e04f1e641f640879d76753a422a82eb04113251b357ac42665a3b30b85814f1c2e0d2a02c7d2b15b1426acaaf7254f9d25c1bc10b2764808be4b4e42a89187a244982d3fdc04ba21ab851d35e4e25978f3e40c352b653075bba26589847afde0c93250ce1c2c0639505939866e988c3608ea404a634a171d2f29c41000e6074c0ef9a8e0851bbc48910b3ef8b0138c188648a3cb2253e4d283164210224e0a4e0c604e2266ac62070d852092c730cac893c71691a433881db4ccf24938faf0e042111dace2452d89a4738d081314c1ca328a20030416b17ca04b189354f08434a4f0034f30544ca04e34d578230518e69482030f5b349189383744e0ca3396c0314f16f5cc80cd3484ac630f3f4ea853490add58920934935c03cb1ecb74d0cd2fe0307180258270f0c92d6a6443c3359f88f08a212114118f28662c424918ad0c61433b5c80434e0574084146345734f283305184930f2e191820081c2a8c10473bc5c042c32b49f461c7090994b0480792f87308372b18918e016bc073491f5630e2ce0e3da8d24202ff20a00324135011cd29ec50418f07270022c52cf17c200d161f7c1101361cac13c60d363c900e064e0873cf2e8c00c0c703ecdc5185048e08418716f83011c328d52c00c62db860f04f105efca34d0c6b587081237560f28d270458534a13637c20461709d4730913477461440f774861cc06e55073032c69f8f3c8131790e08323563482062db0d0e10c35976800ca17daa8904a0b9b8c1185177158c20c34d5f4b3cc09a2d803071a8dacd10f1a9748a14c1604ac62822ef9f8700403891cb04731b790904a3eada470cb146aa45204308d54b00c0ac1f852431a1aa8b3cf17f6f412c73405b4624118583012043da43c43851e0c04a0ca0bfecc628212a28c5047159fd863c0118b14e0cd345010e146020bece3893fa474d00412541432070ca3a831470ae4b0f04923acd8c2431a14dc91450368a481cb0bbde4000f0c2f4030c8047c8c224e2da474c14d0cfec8d3092203c4f28d0008d4a20a2c63dc52053625fc21cd0f54e0108006f47802cc09f270634622ce71821bc041178ef88435dce00f1e8ca31344d8c1240270026640010b56b8863808508a2a20c00b0fd0073d36a1817b1c83139f08042cdc118b4da0421beda84406a8d0045a6862180a108537c09086222ca10f1a7846021a918343006217cb90c2369440005b98400016a8822b2ee0b2415c8218a360c0274ef18c41b0a004a468473598410f6064821ed528470914918d1db4a2070700c63300a00c2488801fa7e8c10f1690810eec830cc54843040890022bb4a2026b38040ab841841408811484280303e0f18f74b4601093684711d64188134c001a8698c5030ad10e292000050208412a10e00d31c803170140c61670618469b081042fb8c72694910952e0830f294ac5060cd1052b90631d5dd80502da21805498c31c6f30001b24318c59e0a01ed828860f990107082cc1087568070cc2108a7f40c00dd7a8400c4401856488211461108410c8b10a7988620a02d0060d3e518c78e46305ce78813a9c408236600204830846059a90080600030709a8432098d08508fc40017028853168200973c4a31c9ba8441bf611806b20c11720a84334fa71015778e21a5278c6f53ec1852c184200b8f08729fcb00717cc020e76900516a83183176c63094520c400c651886e90a30a7fc9460e4c801705548010cf38c60b0091082518a21c9eb0001330f1095628220756e8441592618c674c61069920443ec6e1091390e01ce43886106270846974e08756b04208b2910e38e8410cae7085024e600b2520800dc370c50eaea0892db4c007ecc845000ec08e0e000019e5880010d4808d6a30400455e0463dee108f532c0118a9b8441b4ae00d5eb4a01cdbc8462b26918e126880010340c53498418b3a18020d6a38850c2661885d1000133d40441b56f0012e34401bbce044270cc1071f40020833f8020840000d5ee8001ff4e8070448e1827dbc420d4f50472ddcb18c30604018959dc12e9eb1877ca441057b58423c90d1b530a401013d300432e601894360e219cf50003754510a322c8300234804398ce1872210c3054e68c2190a510b42ec2103f07803045c610a6834a30bf910013ba8f1895d48e20e6f60013ebc800b0a806207f470c33d58000579d88008dc60c30508200443cc8305cb68c12eaa81096fc9020d5c78c43222a00c6ac0c1089470841b2251017740e3046a48c416da51022054e012acf0c007b6600f7fdcc20c0f600127192107235ca20332c8863a8ce0860d648098b3e0011f28000f043ca31aec60831308008a1ee84107ce7883109a318e4f14a0061230072e26918f62e84311cc28052d567105120c431338f08619aca00819b021159458c00aa2a1816924e1379e90000c62008021dc82051e9884abab0185347020190a108125fcc1043c34211625d8010ec8618b22bc62180f20461a26010e0bc883074588462a5000082380e315d8c8c40d467188599c43111678828a00508b6790410b61f8c50838f005215c631ad7e0032bb2408c4d2ca30c2130c00de2718461d4e3164668c425c0318313cc20072098412f2a400e3ce4031ab678441278900774b46215549087088471035cfc83000430010c64b00c06ec6118cd28c60986408c7a000218f1c0052cba704c7b20a3141d70411326f10c512421090ed87332cea00861a4a308c958c333bc30870494c109bf00c502ece10431dca0090d40c40a92500065174315db08c723585009291081098c78003f921008365c2213c6164527029083479c601e01b84413dae186320ce2106ca8431fb2d08d35fca11edcb8840846610a298883144dd0400320f009431c41109f9886081ea00b2dc4e2b408c8040f7ee1804348f20b3878801a32b0034c840014b388c626a8e0073828e10dbd7041082a306755a8021f91188439f85007517ce01f70184012e6f0084f2441050340403506e14704f4e319d250c40eec800823102302e3c8812db2d10125d4210bc798840a5843045c8212ccc32a78c217544139b08030b0833a0c022ffcc124f883326c42384c00085c4230740206c8020474813f3c013fbc013c14c2101c411640821a580336d8015fb8c02a04823a88810b8c030de403373c813d00820ebc42273c00301cc21b6c0120dc80337040352d4002cc012cd801341801034cdd1ac440194c0308f0023368010f8c410d288219508116480388b90322044239240326d4833184021858c32c644038a4800210c127808229d8c112c8c023f8c02f10030ffc000cb4410ff0c337b841073c820ab4001788433858832024c11ac8423f40823b204128a4020b788216a88125248329d4812cd88304f4833240020e3cc33854c33c10810e7802118c00312cc02bc8c030048215044313080229dc4125d4811d34013b904227d46027f84290408219744230d80304d08310f0023e74c2141081366c812d3c830c5c81206c8101d0013a5cc01f6c802a50c036fc01352c030f30833358820ba8013a20c139d8413c8c8000180018a48303a4c31a68023430c32d5cc2191cc00fc8433194401298c30b20c312ec00297040094c011980012e0841017c802d74400494013bc401358840207c01042c033798032a3c011428c033140310bc432e50421ddcc21f4c011658820ad5010b18013540c00148021d6c810c14422b00413420831da0820c54823acc0227c8c138688307d4c017100323208228244008f84119c8c31618c34209810fb0412bb84210d4431fecc02e14c2128c030a28c10b5c0133e8c03b9c421fa4002580c205bc4329b8813cc0433fa802267c5b28b48322144330f0822f8cc308544038a0c21eb483323c56304c002a40c11a8081266c401a54020578c18fe0831088c1018c4225ec0015184008c8813320c32c70c0192cc126a8c0189c8007a8c00e500017fc011b1c4139dc800bc88104c4c018b04109340321f4415a60c21c64822f84430b54411498c00ef8c11a488302ccc23e28022c58c3369481101803afe440390040172c421894000904832804021d008035ccc32754c02850432224412518c3298c023148c021680331ec0100c04323dc802548800ccc0027fc4207708705d4c337600318500125744000e0c1118c4110a4c23b640075cdc106f441a40481103c403ed081079c420b28822460011b184113a8812d44022e20c009a4c13ce00300e8032058403218023d90413f944217144201a00a1a644323586419dc430ed0031a40c13828020ea8433c984313c041114c000010802b940025104011580111b401031c4221340317c04309044311f80017d0413670023168832758433a7c002804800504803680c3844a032be0832720c20754411ecc523114c129a4c021cc41056c820fa0022af0022c54033fdc003c70813bf8cd0fe40211b0823080c3209c00301c431b9842104c033ed40036c48304948036d4010f3cc236ac831698020140433468c337e8820c38402f60c206b4422e344136f00019d0803ef8c1298cc025a0812df8971df803165c8211fc810250023e34c10328033fb8c0759d412470c03bc8000be8c330b8c1103c013ec8c135cc4216b44122508138b0c223b4c038f4423074c01188c23a8c0311a0402484c114848021dcc01720013854c031bc8a1e248308e4c222d8830b304212b443047c830f5c400fb4830de8820a98422140420bdc02148043024402111c4331488212ec400494c02e280f1fbcc204d0c125f4831f6c413430000c6cc008704326dcc13e58c32210c11ca88114500135a40339fcc33f04832c3c023830c32b3443395c42107402159c8313404102d0411044402860c13b2c0333b800181c00cc1dc03c108014ec011a20420270c03888410c608209a8420d08010bf0832928033e540123fc9b1d10c188fc0009dc0275ce8126b8c31d90c20fec803d0c412ac4161bb0c10fa04134a025260c430578011e80802b94c31048833ebc4118d8c038d00290cc402ee8c33fccc033e0402d50010038030b58803adc031e780035c08232a00129508200f0811598c2076c022f78402598832160c32ad4012b2c401ea4800d0c820ab0c30018eb1e88c22c6c0330540223948239c4406612033aa0801770803494823ed8830d60c13dfc8116ec8015980106e8022cf4c33a6c421288422500923eac032264810ff4c3084c83067c03270cc03e40031a40c02bac023d54411c4c2e2890c319b4c20890c327688026cc831f90822814c11f88033ca00224f440cc0057d545000d300204fc403aa8421ae40202acc01c5cc31218432734c32bdc0331c0020e1cc10588830a7cc0319cc3003c411df08336e0402b50ed1b9c812590c33cecc13730c310d0812ddc820c58003b60c10a34000038c11850810084812928c019dc001404c2399801017c6e171842297cc00228412360003834de124cab15a88308c003258c8011840305784318c8010fbc0332fc811158c02a8482242000385c832140812610433afcc3363cc13f8c0006c05534004330940332584010d8c13450021bd4c32760c23b58021454833214411140b00d14ec2d84400280432810802cb8013bf00223500133a0c03f9842296c8022b05f4499420ce8c02ae0811c44c20d24430164b3299c0304680321a003003cc10e30801f38c3057c0230ec823858811d60001ab08031bcc61f9cc30d44c32f40c12bb4c2189c251eb84028c0803624c33248490ba48319bc82026cc11c88c23f48811c704132e4000c70432b34032cd4801d78c20bf083339cc117a0c21b0c4e0b008102ac022f804014b0802d40c207888015f043076c801e4442122cc33910032a44011e844312e8832b14813d3083366c00195c401e68001108811e140107dc833550810fa0cf32e00139ecc220fc8024fc8209bc00281cc11914030a54c10044415f5d023fad4229388005f88120144010d0c00ed08d0ba4830cb8020cb0c33178021404003188433a904010fcc01b746410b4c307d8832d34420b144220b4802fb44005b409323c021318423cd4c20f7402182c400060022388412174011ef0423cd8031e90c10310c00118812910c20c54c13334c02088402470c12e284325f00214bc803b6c420378833fcc411be4c235e08036c0813d288212b8c130bc832610c21458011274031830021358c3306cc00da8c01a18802454c227acc2166c410a10801888c232c4021704425b82831014823c8cc01ebc0328684228b8403e488306acc11930400b2cc007a48113d8c033f843555f821044820d28af2818c021d0411ee80001004214508027f4c31468c0261c022b20031dc0c039f4c20184400610022b38410b90032344021e989f3afc02275083372c021e1480154c8300f80293c8822c48c0085883f33ec11fec0215c8011fcc423608c337e4c02678822b90c324e481071443294c8127cc010eb08138a0c131e04338a483099cc32a980209780316a8810e9c8020e8817c88811fe401228403340c413d14c328d84220f08103bc4207d0013928811268c038ec001e6c4030dc4306c0000918820db480257401168c00305cc214d8c33abc033050000044813638410030422854430cfc02007c40190043a1de8116988304208337b8410580801f58003dc08123b8400064420e98421938c300f480072c000678402bf84204d0ee1fc843069801280c9e0840003ad80116dc013758801c2823215c412240c238f0803854001acc003b20023ba0032580012760421844013840810c4c00066402106cc337d443b4e40238b4c20f9c401c5c8331b4c12c5c012fb0431fec025571c120c0411ec0401d80c0068c012134431bd8c03e908022844216e0c23858431adc822ba0434350431d5c4131a4c23ab4c0309081312c8230948220cc823fd0802f9c812df8802fb403034cc322c841ef1ec33aac42272c012b34831d64032aa8013420dd2f9c402110811f5c0224e8421e640223e8c31990c237b4811070432fbc830fc40315d40015a8431268320278c03514c13d644308a8403d00c1178483093c402e18035ffb423954411b30822a90033de8010604000054420ec8822b4c0028c865086c810e00c23c88c30970433448c33f508317dc400850832720c33310023294c1ac09000460410ad04138a040233c8017e00307fc422a444123d0410db8c32840021ad8011cd8f618e04328d00239e0020a7cc115800322d0c121e80318a80004e0400f640137c04332e841f3ccc20e2c0010b4821944022c13013530810fa8c105b8c307680113e083310c831720822164803910813aa4c01fa0001d944111e4410bb0423cacc223d80340f079c627cca77ed748f4f8a36b1e1f1f9ec2887001c4172a7f3ede09fac3c314bd10e598b5227428c10d4b14d6b0c914e84c9e356792843ba589d00944df16c50365031a0068ba8a604055cb9b1303b702b8e1a5c488040d859ea99bb62215322e0d7cb4f365028db55a898271eaa64a182871ddd6607a9141cea551f896990b934d1bb463efc6fc09a44b9838113968a1c863c8042b5573c4d00245a5d30376ce6a688b47a0dc917300c4900a5422c48e18eb0ac00a374a43951caa529991b5689b99070c2204e2538a02011f7f2499e8462f8b873c2322083905c21c120e235cb0db92ae933f6acf7090c007a85cba5cc956a9fa75aa5f2a3aee540100a4659437495190045a94a5410b19832c8cd015aa9f904e90de74709208db8205b41eb1e3164946c0c6106cbac062951bfe88859c2802f144922e3c086409568c6841836a6078e317555470e69c43f6f1e6075bfaf06210707aa0e2841cf290c6195cfef045803ad4316480191689e30f6c6070e01b52fe31661a7866190488522a8140896c2ce8e6926646d1a78930b6408782007ec8a797625af841176b206126006c66c8e4125afcf0a31e6988898391143a214797477451c59a210cd1e7061e7e00a01d1d3a50c6c46058f0828d26e27982966fea31e20350cab981196788a88096595071438b6f425806933f6428640b3f1078049316be796691536448e61d6afe49050859b451808f293000248c14faa8c4863baab10287460ac8a305602c31c49b24ce48e5192bbae9c61d133ef0a589539478e006543661639414a63847112f56f102180312c0a0964ef429221953a6b1a69a723210a186628ee8c70c25905041046f72f8a0861906d086b72a0a69c78d68f048049d1372c9650b7ad481430f3c72d1209a512828020536d0f966812a8618a50655ded9c2065a2e40c68554f8f9808b8ae0f1438c6b96a0c11e497cb1e50d52a4492299173679879b338658a705341489e20b7bb2288203175449c0907346e1259756727000124130d945023b44495a9a53ec69e6075a9c00e7844b661922144782a84382256221a0847778d9070b6c9838e5840fe4d163012884a0e6130e8019238c686410009b1320e863172cc241e51d680259e3881e6611059cadeac802865fec19440d2d4a8805017adee023994fa221c68a06ba3960027dc441409a18a4d9051a537ab9461911baf965161c86d001824af4b8621427c27186043022d827183bf8a1200c186e19a1076a72f9c18114f43046145d901081867d7081a00446f268641c0f801927804a46e187306ca01f5538de3036018e6424c01d87580336f2b0045ae4e2040f884109aa108c1af8c11d88680407cae10d1f9421139910820c86c0050a0c82070b98831f3ab18b5814e1067bc8c3091411840958c31f8ae8c516eaa18d475c82139d2883154a80421dc0210b7b980020ba70065c3c800fe5f0052f9ad10110e4011c4f60c60e2ad08d3d3c800b8718410c5e01834c6ca00517d8c732f6900501c8a00d1790841c8c00085a806013451002204ad0812254621aaaf844044e500c814d60165230c50718e0835028a20e0bf0863e12010925a0e0140a50c739e8818d5018e018a210021c4c208c1a58030a0940470caad0813ed4c21ceb60c42ce2210d0554e01b24a80539ea000b4fdc8018d908052ab4d18924a8200df0708604bc00823f60c11ebf30c13534e10e30b822152c58801db6510578f8020c76f00723c0d08f364401178ae0062cccc1896cb5c108c298a115e8f60846f80210a2504517ca00806f6c811b22f88145fe108a59c4220024e0863a16c08142bc200c4e78c314ba810c0fdc2118ca9847004c91095fac000f2b18421352100d06148114a170822402300733d4a11f630080104810817b4c42028b80011c2c608c04cc421a28c0473374e1880388c31bcc908335ac81813e304302a72004003ca10919b8010eeba0440cb0c10831a4e011d4e800375c990453082101d500403c9ca1862dd041124cb0c502daa0815128631782504238e6500b18c0c301d0784713eaf089198803133b380204c4100a5b64611d49208219ba610c6e2ca104c5b0c43f70018b5ef422132278012c003086680c820a94e8861104818c584c82059d20c51c2ab1073124a015e08802346820824000400b98d0c32d3e51807518820c1140840c7a41001ad8011c23d882356c2089862de30900a8021d56908114a08315f52003381e800b687821010078871feec104142023196268032fcaf0852fe4e106d9a8c13cc260883888a002f1c0c00cd4a10c4248228633a0810c24e1033998c3124830c2010ef0885bf4a20eed50830686500a50f8a308bf08872c38c1831d98021e6df8c4015420893cb0c01bece0820eac9a803ae8a21feac0c73c74a00515bc0307410005121ce08360fc600a7d68401f98e0070614e305d058c60240b08478d4e00a87000106e4398d77d86018d5d08438a0e00f50dc210f5e18850838f08c266ce10307e80414ec3186318cc20c9dc8870f76c08326d1c10f684d453dda010a5720601541b0842a4037892e5c631df8306a0a3c900507d0a2194798c60ee230870b0860c8fec8c32614210450f8a107a7f08d077e208c6ecc2208839040246c600a1a10e2089288413f4a90062d00020ce88842177201897f40600ba6b8803ff8c08b1370011e0cd88500c0010e5e28a21206a085156c500715d4e11e46e0c124dca10b121c211cd5e0c112bc008b321802156f688327c6a088572cc21a1510852ca6e0896fb00212a6104000f8c18226e8e30061288637e470826c488102e4c8020742e18003ace306d1a8822174c08535b4210732a0c336be908c38cb020dcd30c229f2c183533c63057d30c2314681855600800bee208222f0d08d6588e20bb3988616ea30023f504113b8f00210e2200f3334a30d65d0c23530018624486205aa58c03b8e11831048420425a80729dcb0816600411fa578c61e5450002fb88207a528061a74900761588213b2b0430be2510a5d98201e149004301400867418011d718042062280891ba4831f43a00420da2184742882055f80442e6611871e1ce1094580c42508310a378061097cf0c223deb1016c08a10a1fa8c53622210b5ec061005e8088261ab1846c54a2132a1002236221030cd8630b698806006e70896cb4431b8a48023770f10c7fac600b4cb0c63dbe510c0b3c031626b8013adeb009548c411590a0c73634500e6b3082178b20c5323cc00a3688011c7b50c630a8a1116260110801060c2002508003a24d1ab60007300113ba601bee4100e6c01ae860032c401274e1034ce014a6c00dd6800816600af86051d0c110d280180a410ddc000d4e4111f4e00694010276400d64001168610496210abc200d3e8105f22108cc810e38a009b0e1139a41115a611e6c00154a8012b44017ea21028c200c2e4114cec00bbac10ba480142440cfd26107e4011204690e9820090c000dfc401c2ee01e9e80181e0007b0410f66000522801bba600b26210c4ca03c04a1024ce11d12a0119e8115b40012b8a016da210bb6411e286003d0411dd4000238210788a10aa84119b801129a801d2ee11ce6400f54601038c00770000d28e007946013a200153ce30c88c01a42010820c11bcec00fd0e00d2e2001c4e00f94a013eec009d0c0167e21101c21155a611ab6401ab0201e7081176a6007ace01bfcc112f0c11a70c100ae011df221129c2110e8810500c11580af0af6200a9c01182a2014a0e111422112462009c84115eac11400c1030c000b3ca10d16001c6e0112e6611d98811d7e800ab4a10ff04100c6801c7c010612200cf860076e411d442112e00008ec2110f2400816800200a0172cc01efc2005cee11974e012bec008c42006d40118fc410872811d9e4006c6611966c08e1a001fb00018f40006b0e10d3c610f700109244112d2c10fc8810feca11576400b56001d7ea00d8a211a9c01017ee117fe801432c00780610af6011cee200968c103f221197e011264c11beaa070b6a017b4801df26017ca811438400d3e201f546109a4a115a0e11f24c00d2ce11e22611628e0056ca00984a10d1c810b92e01e7ac1127ee108e0601bd0010554a1176a401d22e11030811960400e34711f84c00448a10bace110e28014a8e0136c200cfc410b6ae11300a01a444002b6410f14a011e2e41eb88614e0201f840116e0200584e10b320111aa8101f0a114d2a1116c80030c2119ac210b8cc006820108404015662607d641109c6009c8e01c04a000ec210a80800ae24003f6c11002c10c58610aca41d948810682a10080e012e8a0076820056ac10e76e11faa8012ace10ae0a019a0211d0481078a810c52e002f2200d0240032a0d09e421083e2118324118366002b8a00f3c410370e0162ca018488006bc010616601ab6810ea0811f7a40086ec1018c41108a00181c21191c600932800dd6411832800b0ac11c2041180a211460c01dd0a01a5681d782a11ec6e11482a0481c4007c24019a6a00bca8d18f80119e0400716611844200994a01a506114224000b6c1185c2005b825000e4019c240022ac0079aa01fc06117fe801ac0210f9ee10cc4c01c42000d24e00b5aa178b6a00dcc00118221126c6117c861110e40135ac117eee0158ea01386810542610434811da2400b0ac11712a10c4260129cc0194a6381d44108ea81150e210d42e00214e113e8800918d51eaca01664410c6ca0118ac1095c800336c01aa4e11580610fe8e01055c00866211b066106bc21118480106e800bd02104f2201cf48107928107ba0009c6a01d76211c2ea103de010a96e01a68000c98010cf88106fec108ba80102a810bf60011d8031c7c400576f50e8a21052e4110c2e11ab8010992600950c102b0a01cee211f2c610cecc11e248d1c20c0193000006040195e410f3a211e18211ee0611ae2a0085c810c6a81151ac11ecc001e204014f28119e8006d9e800faee11f5a80146cc102c86011e8e003a0c116300007da0f111e2117d6611036801b04801476010fc0c00590e012b4a0908ae00eac611be2a01a94200fce2000e28d0bdae01664401be4a0197aa104708019de2106d4401afe40078e01007e80123240056c400ec00104ec6117e0e01b12200e82c1053e801a94800f42201a82011620001de8d01d90400fd02113e4c1002e210b84c106fe471dd8a102d4c01dc8c10fb8600a72e01610401eb6210f70600100801b504107b28007f04112cca0036c413fbaa118f6e10300e61354000e56010e24a103f2c10da4601932201c38400730010f82811ffe201842600b6c811ce861124280196c8113d2001a80811998011fc200121281083e3304ba811f9ce013f6800acae011d0e11692611bc6011454001a60a0112c611a80601488c017f44002de211f566104dae115bc0117146016cc6009eaa00572c008e2e01f8e610958005598a01628210b6820169660061a811b8c2107fc20060ce117de6011dea0019ac109ec600e32a10ce8a108fa60191e001910e100bacb0286e106cae01cdc810d2ea00deac010f4c004c261177aa0044a2000b6c1090ac1102880180ce00bfcaf1a3ea1097aa11b44e1111ea1169c801fb8a007180007c2a103fc811e7ae118b281171ec11724610682e10f84610a08810cf6e11aae4014208103b4a013c04919d08005ac40155a81016ea012160119aae106e6a000320104b020088c600f3e20092a001456e103ca200a00210922411d08400dd6c00b10401424801208201942813688c10baeef1c40a119dea106100110968110206149704018de0013eac11dba410e58411116800fc8e1112220157e310ccae00c88811a82c111222115c8411286c01a9aa11d566017646017440014ce00078ea0023241125c801c04e105ca201420c113a4c110186118d84009a6a110aee009f0810e1ec0104cc1187cc1080281125e6016aa601c48e0102ca004624045c3201cbe201d94201440a01ef4e10a8a81016a201b7c811eca6115c8c14ae8e106aac10e680001d8e019428004f4010aa0c008d28103186015c661169480186cc1175ea01380e11a90e109f8c10e78400f6c601c4c41066a4113ccc0045aa01b88fa0fe2c012d6a000eea009d0c11632a002d62119bac1f9f620073a60091ae00acc4106e2e00e342111e6f41b94c114988109c0c003f60105fea10fe2801254211abe211e9c401f38a01bcca11460200234811e646109ea4103128134e481150a611d26a10c802003084100224006d8a114ee6000a8a11f8c810966011ab6a01194a115b6010642e00c802107a02118c6210898a11656181bda81993d01150a211882810a2c01185c410f8aa01d2ec10ad0400014e00aec8002c6ea0e360008740000720118028113f8c10cf60015d4e011620112962c0672a1141a2113e6c0044041172ea10d9ee101d6ea19d6c11c4860021601006e410232200c204013c6e10b486114ae600bb20d175621f8d801247ea01e20011932410e1cc113260014caa00a66600ab6a1142cc00c96411bda001554e00f20401c4881058821018c2005ba6108d8c10e620109b0e11cb84014aae10c40c00a483212e4211b92611a22a012ae8009e2c00500210528411ec4210980a00f2681199a21033ce004faac1f96e1182ae01e94c11a12a11118e01cc08016e6c115e80518be60189ca11de280b7f86111a4800f62d618a0c003428118766115cc20186cc11e98201eaa000618810e0ae1183aa11f30a003ce010998001766a00a82a00a7ea00b34011ce6611bc2610b201013ac601c92c01faae118f84119e2400be0c1004a010fbc21102aa11c76c002f6a00836e10276941bd4800e5a60085ca16ad4810e98e10a64c009fc081b8a2116e0e118fae119dce118060007eec0115aa10f86d26d8601d2ed801c48e017620118b8e11e1c21095ce01436e01e0acfab01001208c01d5e200a0ce004d0e119c8a01b24c115c2a0085a400c92a016dc40134ac100d8a1122ec01ab02112f6c116109a1346200bf66113f6a10ab4e00aa0a119e0011b5c600b886100ca61180ebb0602610e4e810042c10b66401148a100f4601d60e01554e009928015b2201cbc0119d6e00600810b6c601f080118782119a001084cc10108c102f8400b562112884102922003ece018a20e01804111ba4100d0a109642004f4a1c67d411bc2a11ec2811bb28111d201106c80101cc11cc8210ffa411970c1424a400292a1423ce016c4c119762114ce21141e4104d280057e810e84820a960005e601006a418cf7410bc2a0099e811e46e1009c001a52e009b0e01288610940211c7aa111806105a02102dc41001ee00f542150a8a00728c110bae0b1aca11f9a8007ace013f8800c4c81107c801948c100c2400878200278e102764118826004ec401f7001075ce11826600e9c41090c801bd2011998e10f4e814cc7210f48a0172ac10a00000774e0026a611fdce00bd0b718e2600132c018bea000320004c861188841030421140e8017e2a11936401d2a610c42001aaae00ad2810a76e104c6401bb481106c6000b6a00f7cc1060022d52856030e5179e32f559674b32289a8c7acdc8d3d6fd4584ae4c05c952af8608cf2032b0f3f381af4d9f186e090913aca72dce842a75d27505b2e499ab7a3883d0d07ceb5e9736355856dd0543119a0cf9d815b471e41c9c74a8bb349756cd13851a21f3622d9229060812f4abb09797049f9a16455994213f2c58a338043ae7676aaf8b0c1495e9f454a40c95aa50ac6be5c8218f4e213e04ca71c2a26a181a7e284306842dabc2b534a1504641fc06900202fdbae0876b4e87b94045591788ce2c5a8a1821bb30bd612187020e785a66c49901842c1c7410d4045283162102cdd944e9e321d10708c1e316d8dd070d1a22546b476896a9d1b3261c6183f94cae1c355001994473f38495a16651707039caa3461a64708813cff584c0926c1374d70e0ca374c5c13041507f482c7104ca43203332408420b117ad8824b257cd8e2c821e1f452472ef070914e213cc0b3453d783050cc389ae8928f0c1aac40002f0f88b3c82ef15072c8379e9073023d12682202044c2c82c9272cd401c71b9bd4920705b97022078e68fc33c80322da538d287b84d207153900b28b33c784d14725c684634d103704d20b0ef134018e155030318a2e25587307048ef4b24a25c70c304d258018000404ad64f1c90dbb0c33471179482145297e642347185438828a182daca20d0bea4832c7253be083060f5db4b3c829df98a28507c648c0410b858802c13cf0fcf28f15bc80f245052fec43cb2729f8b3092dfc18f04202f66ca14d19240c914019da9c63c00cf61ce0ca26532812c0111fd8b1c43612e0234c2fbb08b1492e88504205056ff8304491a978f28c2067d851c111f058424e0e6d48634018e5b802cb0c1a8ca3c7358e60814b36a47040012499e4a2422f4a8c02883e744c130032e7a041453e84d890ce2e571430033eccf8118d1793e0230333513060c0000dec9180234784708430df2042c02b48e01310","interlace":false,"gctEntries":256}]\ No newline at end of filediff --git a/src/lib/gif/lzw.test.ts b/src/lib/gif/lzw.test.tsnew file mode 100644index 0000000..b4028ed--- /dev/null+++ b/src/lib/gif/lzw.test.ts@@ -0,0 +1,145 @@+import { describe, expect, it } from 'vitest'+import golden from './golden-vectors.json'+import { lzwEncode } from './lzw'++/** An INDEPENDENT LZW decoder, written from the GIF89a spec for+ * these tests only — the encoder is never allowed to be validated+ * by its own inverse alone (the R4 lesson: run a real parser).+ * Dictionary entries are plain arrays: obviously correct, and+ * test-sized inputs make the O(n²) copying irrelevant. */+export function lzwDecode(data: Uint8Array, minCodeSize: number, expectedPixels: number): Uint8Array {+ const clear = 1 << minCodeSize+ const eoi = clear + 1+ let pos = 0+ let bitBuf = 0+ let bitCnt = 0+ const readCode = (width: number): number => {+ while (bitCnt < width) {+ if (pos >= data.length) throw new Error('decoder: ran out of LZW data before EOI')+ bitBuf |= data[pos++] << bitCnt+ bitCnt += 8+ }+ const code = bitBuf & ((1 << width) - 1)+ bitBuf >>= width+ bitCnt -= width+ return code+ }+ const table: number[][] = []+ const reset = (): void => {+ table.length = 0+ for (let i = 0; i < clear; i++) table.push([i])+ table.push([]) // clear placeholder — never dereferenced+ table.push([]) // eoi placeholder — never dereferenced+ }+ reset()+ let width = minCodeSize + 1+ let prev: number[] | null = null+ const out: number[] = []+ for (;;) {+ const code = readCode(width)+ if (code === eoi) break+ if (code === clear) {+ reset()+ width = minCodeSize + 1+ prev = null+ continue+ }+ let entry: number[]+ if (code < table.length) {+ entry = table[code]+ } else if (prev !== null && code === table.length) {+ entry = [...prev, prev[0]] // the KwKwK case+ } else {+ throw new Error(`decoder: invalid code ${code} (table size ${table.length})`)+ }+ out.push(...entry)+ if (prev !== null) {+ table.push([...prev, entry[0]])+ // the decoder-side twin of the encoder's bump rule — ONE+ // ENTRY EARLIER: the decoder's table lags the encoder's by a+ // code at every stream position (it defines the entry the+ // encoder defined on the PREVIOUS emission), so it must bump+ // when its table REACHES 2^width, while the encoder bumps+ // when its next slot EXCEEDS it. This asymmetry is the GIF+ // no-early-change rule.+ if (table.length >= 1 << width && width < 12) width+++ }+ prev = entry+ if (out.length > expectedPixels) throw new Error('decoder: produced more pixels than expected')+ }+ if (out.length !== expectedPixels) {+ throw new Error(`decoder: produced ${out.length} pixels, expected ${expectedPixels}`)+ }+ return new Uint8Array(out)+}++function hexToBytes(hex: string): Uint8Array {+ const out = new Uint8Array(hex.length / 2)+ for (let i = 0; i < out.length; i++) out[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16)+ return out+}++function b64ToBytes(b64: string): Uint8Array {+ return new Uint8Array(Buffer.from(b64, 'base64'))+}++describe('lzwEncode against PIL golden streams', () => {+ // PIL wrote each case as a real GIF; the golden vectors hold the+ // pixel indices PIL actually stored (read back from the file) and+ // the exact LZW bytes it emitted (parsed out of the file).+ for (const c of golden) {+ it(`decodes PIL's ${c.name} stream to PIL's own pixels (${c.width}×${c.height})`, () => {+ const pixels = lzwDecode(hexToBytes(c.lzw), c.minCodeSize, c.width * c.height)+ expect(Array.from(pixels)).toEqual(Array.from(b64ToBytes(c.indices)))+ })+ it(`round-trips ${c.name} through the independent decoder`, () => {+ const pixels = b64ToBytes(c.indices)+ const encoded = lzwEncode(pixels, c.minCodeSize)+ const decoded = lzwDecode(encoded, c.minCodeSize, pixels.length)+ expect(Array.from(decoded)).toEqual(Array.from(pixels))+ })+ }+})++describe('lzwEncode behavioural edges', () => {+ it('rejects invalid minCodeSize and empty input (fail-closed)', () => {+ expect(() => lzwEncode(new Uint8Array([0]), 1)).toThrow(/2\.\.8/)+ expect(() => lzwEncode(new Uint8Array([0]), 9)).toThrow(/2\.\.8/)+ expect(() => lzwEncode(new Uint8Array([0]), 2.5)).toThrow(/2\.\.8/)+ expect(() => lzwEncode(new Uint8Array(0), 2)).toThrow(/empty/)+ })++ it('compresses a single-colour image to a couple hundred bytes', () => {+ // LZW table entries grow LINEARLY (entry n = entry n-1 + one+ // char), so 10k same-colour pixels ≈ 140 codes ≈ 160 bytes —+ // not the exponential squash LZ77-style coders achieve+ const px = new Uint8Array(10_000).fill(7)+ const out = lzwEncode(px, 8)+ expect(out.length).toBeLessThan(220)+ expect(Array.from(lzwDecode(out, 8, px.length))).toEqual(Array.from(px))+ })++ it('survives table exhaustion with a clear-code reset (noise input)', () => {+ // 200×200 deterministic noise over 256 colours — the code table+ // passes 4096 entries mid-stream and must reset, not corrupt+ const px = new Uint8Array(40_000)+ let s = 0x5eed1234+ for (let i = 0; i < px.length; i++) {+ s ^= s << 13+ s ^= s >>> 17+ s ^= s << 5+ px[i] = (s >>> 3) & 0xff+ }+ const out = lzwEncode(px, 8)+ expect(out.length).toBeGreaterThan(30_000) // noise barely compresses+ expect(Array.from(lzwDecode(out, 8, px.length))).toEqual(Array.from(px))+ })++ it('is deterministic', () => {+ const px = new Uint8Array(5000)+ for (let i = 0; i < px.length; i++) px[i] = (i * 31) % 200+ const a = lzwEncode(px, 8)+ const b = lzwEncode(new Uint8Array(px), 8)+ expect(Array.from(a)).toEqual(Array.from(b))+ })+})diff --git a/src/lib/gif/lzw.ts b/src/lib/gif/lzw.tsnew file mode 100644index 0000000..3d0d2b8--- /dev/null+++ b/src/lib/gif/lzw.ts@@ -0,0 +1,102 @@+// ─────────────────────────────────────────────────────────────+// GIF LZW compressor (v0.15 R5) — the GIF89a variant: variable+// code width starting at minCodeSize+1, a hard 4096-entry table+// ceiling relieved by clear codes, and NO early change (the+// classic GIF/TIFF divergence — the width bumps only when the+// next code would not fit).+//+// Verified in lzw.test.ts against PIL-generated golden streams+// and through an independent in-test decoder (the R4 lesson:+// never trust only your own re-implementation).+// ─────────────────────────────────────────────────────────────++/** Compress `indices` (one palette index per pixel) into raw LZW+ * data — sub-block chunking is the container writer's job.+ *+ * minCodeSize is the palette's power-of-two log (2..8); the GIF+ * spec floor is 2 even for a 2-colour image. */+export function lzwEncode(indices: Uint8Array, minCodeSize: number): Uint8Array {+ if (!Number.isInteger(minCodeSize) || minCodeSize < 2 || minCodeSize > 8) {+ throw new Error(`lzwEncode: minCodeSize must be an integer 2..8, got ${minCodeSize}`)+ }+ if (indices.length === 0) throw new Error('lzwEncode: empty input')++ const clear = 1 << minCodeSize+ const eoi = clear + 1++ // growable output, LSB-first bit packing (GIF bit order)+ let cap = Math.max(64, indices.length + (indices.length >> 3) + 16)+ let out = new Uint8Array(cap)+ let outLen = 0+ let bitBuf = 0+ let bitCnt = 0+ const pushBits = (code: number, width: number): void => {+ bitBuf |= code << bitCnt+ bitCnt += width+ while (bitCnt >= 8) {+ if (outLen === cap) {+ cap *= 2+ const grown = new Uint8Array(cap)+ grown.set(out)+ out = grown+ }+ out[outLen++] = bitBuf & 0xff+ bitBuf >>>= 8+ bitCnt -= 8+ }+ }++ // dictionary: (prefixCode << 8) | symbol → code. prefix ≤ 4095+ // and symbol ≤ 255, so every key fits in 20 bits.+ let dict = new Map<number, number>()+ let next = eoi + 1+ let width = minCodeSize + 1++ const resetTable = (): void => {+ dict = new Map()+ next = eoi + 1+ width = minCodeSize + 1+ }++ pushBits(clear, width)+ let cur = indices[0]+ for (let i = 1; i < indices.length; i++) {+ const k = indices[i]+ const key = (cur << 8) | k+ const hit = dict.get(key)+ if (hit !== undefined) {+ cur = hit+ continue+ }+ // miss: emit the prefix, then teach the table the new entry+ pushBits(cur, width)+ if (next < 4096) {+ dict.set(key, next)+ next+++ // bump AFTER the insert: when the next code to ASSIGN would+ // not fit in `width` bits, every code emitted from here on is+ // written one bit wider. The decoder's table runs one entry+ // behind at the matching stream position, so both sides bump+ // on the same code — this is the no-early-change GIF rule.+ if (width < 12 && next > 1 << width) width+++ } else {+ // table full: emit a clear and start over so long inputs+ // keep compressing (the giflib/PIL policy)+ pushBits(clear, width)+ resetTable()+ }+ cur = k+ }+ pushBits(cur, width)+ pushBits(eoi, width)+ if (bitCnt > 0) {+ if (outLen === cap) {+ const grown = new Uint8Array(cap * 2)+ grown.set(out)+ out = grown+ cap *= 2+ }+ out[outLen++] = bitBuf & 0xff+ }+ return out.subarray(0, outLen)+}diff --git a/src/lib/gif/palette.test.ts b/src/lib/gif/palette.test.tsnew file mode 100644index 0000000..91d4634--- /dev/null+++ b/src/lib/gif/palette.test.ts@@ -0,0 +1,104 @@+import { describe, expect, it } from 'vitest'+import { buildNearestLUT, medianCutPalette } from './palette'++function rgb(...triples: number[]): Uint8Array {+ return new Uint8Array(triples)+}++describe('medianCutPalette', () => {+ it('passes distinct colours through untouched in first-seen order', () => {+ const p = medianCutPalette(rgb(10, 20, 30, 200, 100, 50, 1, 1, 1))+ expect(p.size).toBe(3)+ expect(Array.from(p.colors)).toEqual([10, 20, 30, 200, 100, 50, 1, 1, 1])+ })++ it('returns a single black entry for empty input', () => {+ const p = medianCutPalette(new Uint8Array(0))+ expect(p.size).toBe(1)+ expect(Array.from(p.colors)).toEqual([0, 0, 0])+ })++ it('caps at 256 colours and only emits colours that were sampled', () => {+ const samples = new Uint8Array(300 * 3)+ for (let i = 0; i < 300; i++) {+ samples[i * 3] = i+ samples[i * 3 + 1] = (i * 7) % 256+ samples[i * 3 + 2] = (i * 13) % 256+ }+ const p = medianCutPalette(samples)+ expect(p.size).toBe(256)+ const seen = new Set<string>()+ for (let i = 0; i < 300; i++) seen.add(`${samples[i * 3]},${samples[i * 3 + 1]},${samples[i * 3 + 2]}`)+ for (let i = 0; i < p.size; i++) {+ expect(seen.has(`${p.colors[i * 3]},${p.colors[i * 3 + 1]},${p.colors[i * 3 + 2]}`)).toBe(true)+ }+ })++ it('keeps the most-popular colour of each box (never invents colours)', () => {+ // 60 samples of pure red, 30 of pure blue, 10 of pure green →+ // two boxes must resolve to red and blue (the popular pair)+ const samples: number[] = []+ for (let i = 0; i < 60; i++) samples.push(255, 0, 0)+ for (let i = 0; i < 30; i++) samples.push(0, 0, 255)+ for (let i = 0; i < 10; i++) samples.push(0, 255, 0)+ const p = medianCutPalette(new Uint8Array(samples), 2)+ expect(p.size).toBe(2)+ const got = new Set([`${p.colors[0]},${p.colors[1]},${p.colors[2]}`, `${p.colors[3]},${p.colors[4]},${p.colors[5]}`])+ expect(got.has('255,0,0')).toBe(true)+ expect(got.has('0,0,255')).toBe(true)+ })++ it('sorts palette entries by descending popularity (short LZW codes first)', () => {+ const samples: number[] = []+ for (let i = 0; i < 100; i++) samples.push(9, 9, 9)+ for (let i = 0; i < 5; i++) samples.push(250, 250, 250)+ const p = medianCutPalette(new Uint8Array(samples))+ expect([p.colors[0], p.colors[1], p.colors[2]]).toEqual([9, 9, 9])+ })++ it('is deterministic for a mixed input', () => {+ const samples = new Uint8Array(999 * 3)+ let s = 12345+ for (let i = 0; i < samples.length; i++) {+ s = (s * 1103515245 + 12345) & 0x7fffffff+ samples[i] = s % 256+ }+ const a = medianCutPalette(samples)+ const b = medianCutPalette(new Uint8Array(samples))+ expect(a.size).toBe(b.size)+ expect(Array.from(a.colors)).toEqual(Array.from(b.colors))+ })++ it('rejects malformed sample arrays', () => {+ expect(() => medianCutPalette(new Uint8Array([1, 2]))).toThrow(/multiple of 3/)+ })+})++describe('buildNearestLUT', () => {+ it('maps every 5-bit-distinct palette colour to its own index', () => {+ // entries on distinct 5-bit bins (multiples of 8)+ const p = medianCutPalette(rgb(0, 0, 0, 64, 128, 192, 248, 248, 248))+ const lut = buildNearestLUT(p)+ const bins = [0, (64 >> 3) << 10 | (128 >> 3) << 5 | (192 >> 3), (248 >> 3) << 10 | (248 >> 3) << 5 | (248 >> 3)]+ bins.forEach((bin, i) => expect(lut[bin]).toBe(i))+ })++ it('snaps a query colour to the nearest palette entry', () => {+ const p = medianCutPalette(rgb(0, 0, 0, 240, 240, 240))+ const lut = buildNearestLUT(p)+ expect(lut[(100 >> 3) << 10 | (100 >> 3) << 5 | (100 >> 3)]).toBe(0)+ expect(lut[(200 >> 3) << 10 | (200 >> 3) << 5 | (200 >> 3)]).toBe(1)+ })++ it('covers all 32768 bins with valid indices', () => {+ const p = medianCutPalette(rgb(3, 6, 9, 100, 150, 200))+ const lut = buildNearestLUT(p)+ let ok = 0+ for (let i = 0; i < 32768; i++) if (lut[i] === 0 || lut[i] === 1) ok+++ expect(ok).toBe(32768)+ })++ it('rejects a malformed palette', () => {+ expect(() => buildNearestLUT({ colors: new Uint8Array(3), size: 5 })).toThrow(/malformed/)+ })+})diff --git a/src/lib/gif/palette.ts b/src/lib/gif/palette.tsnew file mode 100644index 0000000..daaa4da--- /dev/null+++ b/src/lib/gif/palette.ts@@ -0,0 +1,204 @@+// ─────────────────────────────────────────────────────────────+// GIF colour quantization (v0.15 R5) — median cut over a+// deterministic sample of the timeline, plus a 15-bit+// nearest-colour lookup table so per-pixel indexing is O(1).+//+// Pure data-in/data-out: no DOM, node-testable. The sample is+// taken by the orchestrator (gif-export.ts) at fixed timeline+// times, so the same design always yields the same palette.+// ─────────────────────────────────────────────────────────────++/** A quantized palette: `colors` holds `size` RGB triples. */+export interface GifPalette {+ readonly colors: Uint8Array+ readonly size: number+}++export const MAX_GIF_COLORS = 256++interface HistEntry {+ r: number+ g: number+ b: number+ count: number+}++/** One median-cut box: the half-open range [lo, hi) of the shared+ * histogram array, plus its population and widest channel. */+interface Box {+ lo: number+ hi: number+ population: number+ channel: 0 | 1 | 2+ spread: number+}++function boxStats(entries: HistEntry[], lo: number, hi: number): { population: number; channel: 0 | 1 | 2; spread: number } {+ let minR = 255+ let maxR = 0+ let minG = 255+ let maxG = 0+ let minB = 255+ let maxB = 0+ let population = 0+ for (let i = lo; i < hi; i++) {+ const e = entries[i]+ if (e.r < minR) minR = e.r+ if (e.r > maxR) maxR = e.r+ if (e.g < minG) minG = e.g+ if (e.g > maxG) maxG = e.g+ if (e.b < minB) minB = e.b+ if (e.b > maxB) maxB = e.b+ population += e.count+ }+ const ranges: [number, number, number] = [maxR - minR, maxG - minG, maxB - minB]+ let channel: 0 | 1 | 2 = 0+ if (ranges[1] > ranges[channel]) channel = 1+ if (ranges[2] > ranges[channel]) channel = 2+ return { population, channel, spread: ranges[channel] }+}++/** Median-cut quantization. `samples` is a flat RGB triple array+ * (length divisible by 3; the orchestrator strides it down to a+ * bounded budget). Deterministic: histogram keeps first-seen+ * order, box selection tie-breaks fully, and Array#sort is+ * stable — the same input always produces the same palette.+ *+ * Each palette entry is the MOST-POPULAR colour of its box, not+ * the box average: flat design fills pass through EXACTLY, and+ * the palette never invents a colour the design never showed. */+export function medianCutPalette(samples: Uint8Array, maxColors = MAX_GIF_COLORS): GifPalette {+ if (samples.length % 3 !== 0) throw new Error('medianCutPalette: samples length must be a multiple of 3')+ const limit = Math.max(2, Math.min(MAX_GIF_COLORS, Math.floor(maxColors)))++ const hist = new Map<number, HistEntry>()+ for (let i = 0; i + 2 < samples.length; i += 3) {+ const r = samples[i]+ const g = samples[i + 1]+ const b = samples[i + 2]+ const key = (r << 16) | (g << 8) | b+ const e = hist.get(key)+ if (e) e.count+++ else hist.set(key, { r, g, b, count: 1 })+ }+ if (hist.size === 0) return { colors: new Uint8Array([0, 0, 0]), size: 1 }++ const entries = Array.from(hist.values())+ if (entries.length <= limit) {+ const colors = new Uint8Array(entries.length * 3)+ entries.forEach((e, i) => {+ colors[i * 3] = e.r+ colors[i * 3 + 1] = e.g+ colors[i * 3 + 2] = e.b+ })+ return { colors, size: entries.length }+ }++ let boxes: Box[] = []+ {+ const s = boxStats(entries, 0, entries.length)+ boxes.push({ lo: 0, hi: entries.length, ...s })+ }+ while (boxes.length < limit) {+ // the splittable box with the largest channel spread; ties →+ // larger population, then lower lo (full determinism)+ let best = -1+ for (let i = 0; i < boxes.length; i++) {+ const bx = boxes[i]+ if (bx.hi - bx.lo < 2 || bx.spread === 0) continue+ if (best === -1) {+ best = i+ continue+ }+ const cur = boxes[best]+ if (+ bx.spread > cur.spread ||+ (bx.spread === cur.spread && (bx.population > cur.population || (bx.population === cur.population && bx.lo < cur.lo)))+ ) {+ best = i+ }+ }+ if (best === -1) break // every box is a single colour already+ const bx = boxes[best]+ // sort the range by its widest channel (stable sort ⇒ deterministic)+ const ch = bx.channel+ const seg = entries.slice(bx.lo, bx.hi)+ seg.sort((a, b) => (ch === 0 ? a.r - b.r : ch === 1 ? a.g - b.g : a.b - b.b))+ for (let i = 0; i < seg.length; i++) entries[bx.lo + i] = seg[i]+ // split at the population median so each side keeps ~half the pixels+ const half = bx.population / 2+ let acc = 0+ let cut = bx.lo+ for (let i = bx.lo; i < bx.hi - 1; i++) {+ acc += entries[i].count+ if (acc >= half) {+ cut = i + 1+ break+ }+ }+ if (cut <= bx.lo) cut = bx.lo + 1+ if (cut >= bx.hi) cut = bx.hi - 1+ boxes.splice(best, 1)+ boxes.push({ lo: bx.lo, hi: cut, ...boxStats(entries, bx.lo, cut) })+ boxes.push({ lo: cut, hi: bx.hi, ...boxStats(entries, cut, bx.hi) })+ }++ // most-popular colour per box; stable sort by descending+ // popularity so common colours get the low (short) LZW codes+ const picked: HistEntry[] = boxes.map((bx) => {+ let best = entries[bx.lo]+ for (let i = bx.lo + 1; i < bx.hi; i++) if (entries[i].count > best.count) best = entries[i]+ return best+ })+ picked.sort((a, b) => b.count - a.count)+ const colors = new Uint8Array(picked.length * 3)+ picked.forEach((e, i) => {+ colors[i * 3] = e.r+ colors[i * 3 + 1] = e.g+ colors[i * 3 + 2] = e.b+ })+ return { colors, size: picked.length }+}++/** A 15-bit (5 bits/channel) direct-mapped nearest-colour table:+ * index = (r5 << 10) | (g5 << 5) | b5 → palette index. Distances+ * are measured in 5-bit channel space — the same space the+ * indexer reduces pixels into — so every palette colour maps to+ * its own bin (identity for exact matches). Built once per+ * export (32 768 × size distance evaluations, a few ms), then+ * every pixel costs one shift-mask-and-load. */+export function buildNearestLUT(palette: GifPalette): Int16Array {+ if (palette.size < 1 || palette.colors.length < palette.size * 3) {+ throw new Error('buildNearestLUT: malformed palette')+ }+ const size = palette.size+ const pr = new Uint8Array(size)+ const pg = new Uint8Array(size)+ const pb = new Uint8Array(size)+ for (let i = 0; i < size; i++) {+ pr[i] = palette.colors[i * 3] >> 3+ pg[i] = palette.colors[i * 3 + 1] >> 3+ pb[i] = palette.colors[i * 3 + 2] >> 3+ }+ const lut = new Int16Array(32768)+ for (let idx = 0; idx < 32768; idx++) {+ const r5 = (idx >> 10) & 31+ const g5 = (idx >> 5) & 31+ const b5 = idx & 31+ let best = 0+ let bestD = Number.POSITIVE_INFINITY+ for (let i = 0; i < size; i++) {+ const dr = r5 - pr[i]+ const dg = g5 - pg[i]+ const db = b5 - pb[i]+ const d = dr * dr + dg * dg + db * db+ if (d < bestD) {+ bestD = d+ best = i+ if (d === 0) break+ }+ }+ lut[idx] = best+ }+ return lut+}diff --git a/src/lib/video-export.ts b/src/lib/video-export.tsindex 49f7fe6..2eba7e6 100644--- a/src/lib/video-export.ts+++ b/src/lib/video-export.ts@@ -71,7 +71,7 @@ export function detectVideoFormat(): { mimeType: string; extension: string; labereturn null}-interface TimelineSegment {+export interface TimelineSegment {page: PageData/** hold time before the transition (seconds) */hold: number@@ -1044,7 +1044,7 @@ export function chooseVideoExportEngine(inputs: VideoEngineInputs): VideoExportE* rendered pixel-perfect by this same compositor. *//** Everything both engines share: the render canvas, the per-page* Konva stages, and the timeline compositor (renderFrameAt). */-interface RenderSession {+export interface RenderSession {readonly canvas: HTMLCanvasElementreadonly ctx: CanvasRenderingContext2Dreadonly segments: TimelineSegment[]@@ -1060,7 +1060,10 @@ interface RenderSession {destroy(): void}-async function createRenderSession(+/** v0.15 (R5): the GIF engine rides the SAME render session as+ * the two video engines — one compositor, one source of truth+ * about what is on screen at time t. */+export async function createRenderSession(opts: VideoExportOptions,width: number,height: number,diff --git a/tests/e2e/gif-export.spec.ts b/tests/e2e/gif-export.spec.tsnew file mode 100644index 0000000..127fb1d--- /dev/null+++ b/tests/e2e/gif-export.spec.ts@@ -0,0 +1,250 @@+import { test, expect, type APIRequestContext, type Page } from '@playwright/test'+import { execFileSync } from 'node:child_process'+import { readFileSync } from 'node:fs'++/**+ * v0.15 (R5): GIF export — acceptance.+ *+ * 1. an animated design exports as a real looping GIF: structural+ * parse (GIF89a, Logical Screen 480×320, 256-colour Global+ * Color Table, NETSCAPE2.0 loop-forever, uniform centisecond+ * delays, trailer at EOF) + ffprobe as the INDEPENDENT second+ * opinion (codec, dimensions, frame count, duration — the+ * same "verify with a real tool" discipline the WebM and PDF+ * specs use).+ * 2. the PAGE RANGE acceptance: "Current page" exports ONE page's+ * timeline — far fewer frames than the whole deck.+ * 3. the pre-flight cap: a 100-page deck at 15 fps exceeds the+ * 1800-frame cap and the dialog refuses BEFORE rendering, with+ * the error visible and the download button disabled.+ *+ * Register budget: ZERO — anonymous designs, fresh contexts.+ */++const BASE = process.env.BASE_URL ?? 'http://localhost:3000'+const FPS = 15+const DELAY_CS = 7 // 100/15 rounded — the honest centisecond delay++interface RectElement {+ id: string+ type: 'rect'+ x: number+ y: number+ width: number+ height: number+ rotation: number+ opacity: number+ locked: boolean+ visible: boolean+ fill: string+ stroke: string+ strokeWidth: number+ cornerRadius: number+ animation: { kind: 'fade' | 'rise' | 'pan'; duration: number; delay: number; easing: 'easeOut'; direction?: 'up' | 'left' }+}++function animatedRect(i: number, page: number): RectElement {+ const col = i % 4+ const row = Math.floor(i / 4)+ return {+ id: `R${page}-${i}`,+ type: 'rect',+ x: 40 + col * 250,+ y: 60 + row * 160,+ width: 200,+ height: 120,+ rotation: 0,+ opacity: 1,+ locked: false,+ visible: true,+ // spread hues so the median-cut palette has real work to do+ fill: `hsl(${(i * 47 + page * 180) % 360} 72% 55%)`,+ stroke: '',+ strokeWidth: 0,+ cornerRadius: 8,+ animation: { kind: i % 3 === 0 ? 'rise' : i % 3 === 1 ? 'pan' : 'fade', duration: 0.4, delay: (i % 4) * 0.05, easing: 'easeOut', direction: i % 2 === 0 ? 'up' : 'left' },+ }+}++async function createDesign(request: APIRequestContext, pageCount: number): Promise<string> {+ const pages = Array.from({ length: pageCount }, (_, p) => ({+ id: `p${p + 1}`,+ background: { type: 'solid' as const, color: '#ffffff' },+ transition: p > 0 ? { kind: 'fade' as const, duration: 0.7 } : undefined,+ elements: Array.from({ length: 8 }, (_, i) => animatedRect(i, p)),+ }))+ const res = await request.post(`${BASE}/api/designs`, {+ data: { name: `r5 gif acceptance ${pageCount}p`, width: 1080, height: 720, pages },+ })+ expect(res.status(), `create design: ${await res.text()}`).toBeLessThan(300)+ return ((await res.json()) as { id: string }).id+}++async function openEditor(page: Page, designId: string): Promise<void> {+ await page.goto(`/design/${designId}`)+ await page.addStyleTag({ content: 'nextjs-portal { display: none !important; }' })+ await expect(page.getByLabel('Design canvas')).toBeVisible({ timeout: 60_000 })+}++/** structural GIF walk — the container assertions ffprobe cannot make+ * (loop extension, per-frame delays, trailer-at-EOF) */+function parseGif(bytes: Buffer): {+ width: number+ height: number+ gctEntries: number+ loop: number | null+ delays: number[]+ frames: number+ trailerIsLastByte: boolean+} {+ expect(bytes.subarray(0, 6).toString('ascii')).toBe('GIF89a')+ const width = bytes[6] | (bytes[7] << 8)+ const height = bytes[8] | (bytes[9] << 8)+ const packed = bytes[10]+ expect(packed & 0x80, 'GCT flag').toBe(0x80)+ const gctEntries = 2 << (packed & 0x07)+ let pos = 13 + gctEntries * 3+ let loop: number | null = null+ const delays: number[] = []+ let frames = 0+ for (;;) {+ const b = bytes[pos]+ if (b === 0x3b) break+ if (b === 0x21) {+ const label = bytes[pos + 1]+ pos += 2+ if (label === 0xff) {+ expect(bytes.subarray(pos + 1, pos + 12).toString('ascii')).toBe('NETSCAPE2.0')+ loop = bytes[pos + 14] | (bytes[pos + 15] << 8)+ pos += 17+ } else if (label === 0xf9) {+ delays.push(bytes[pos + 2] | (bytes[pos + 3] << 8))+ pos += 6+ } else {+ while (bytes[pos] !== 0) pos += 1 + bytes[pos]+ pos += 1+ }+ } else if (b === 0x2c) {+ frames+++ pos += 10+ pos += 1 // min code size+ while (bytes[pos] !== 0) pos += 1 + bytes[pos] // LZW sub-blocks+ pos += 1+ } else {+ throw new Error(`unknown block 0x${b.toString(16)} at ${pos}`)+ }+ }+ return { width, height, gctEntries, loop, delays, frames, trailerIsLastByte: pos === bytes.length - 1 }+}++test('animated design exports as a looping GIF — structure + ffprobe agree', async ({ page, request }) => {+ test.setTimeout(240_000)++ const designId = await createDesign(request, 2)+ await openEditor(page, designId)++ await page.getByLabel('Download').click()+ const dlg = page.getByRole('dialog')+ await expect(dlg.getByText('Download your design')).toBeVisible()+ await dlg.getByRole('button', { name: /GIF Animated/ }).click()++ // the honest copy is visible BEFORE the export starts+ await expect(dlg.getByText(/looping forever/)).toBeVisible()+ await expect(dlg.getByText(/silent/)).toBeVisible()++ // Small (480 px cap) for a quick export+ await dlg.getByRole('button', { name: 'Small 480 px' }).click()++ const [download] = await Promise.all([+ page.waitForEvent('download', { timeout: 200_000 }),+ dlg.getByRole('button', { name: /^Download/ }).click(),+ ])+ const path = (await download.path())!+ expect(download.suggestedFilename()).toMatch(/\.gif$/)++ const bytes = readFileSync(path)+ expect(bytes.length, 'file size sanity').toBeGreaterThan(2_000)+ expect(bytes.length, 'byte cap').toBeLessThan(25 * 1024 * 1024)+ const gif = parseGif(bytes)++ // 1080×720 design at the 480 cap → 480×320+ expect(gif.width).toBe(480)+ expect(gif.height).toBe(320)+ expect(gif.gctEntries).toBe(256)+ expect(gif.loop, 'NETSCAPE loop count 0 = forever').toBe(0)+ expect(gif.trailerIsLastByte, 'nothing after the trailer').toBe(true)+ expect(gif.delays.length).toBe(gif.frames)+ expect(new Set(gif.delays)).toEqual(new Set([DELAY_CS]))++ // 2 pages, each ≥ 2.2 s hold + 0.7 s transition → ≥ 5.1 s → ≥ 76 frames+ expect(gif.frames, `frames: ${gif.frames}`).toBeGreaterThanOrEqual(70)+ expect(gif.frames).toBeLessThanOrEqual(140)++ // ── ffprobe: the independent second opinion ──+ const probe = JSON.parse(+ execFileSync('ffprobe', [+ '-v', 'error',+ '-count_frames',+ '-show_entries', 'stream=codec_name,width,height,nb_read_frames',+ '-show_entries', 'format=format_name,duration',+ '-of', 'json',+ path,+ ]).toString(),+ ) as {+ streams: { codec_name: string; width: number; height: number; nb_read_frames: string }[]+ format: { format_name: string; duration: string }+ }+ const stream = probe.streams[0]+ expect(stream.codec_name).toBe('gif')+ expect(stream.width).toBe(480)+ expect(stream.height).toBe(320)+ expect(probe.format.format_name).toBe('gif')+ expect(Number(stream.nb_read_frames)).toBe(gif.frames)+ // duration = frames × the honest 7 cs delay (± a rounding breath)+ expect(Math.abs(Number(probe.format.duration) - (gif.frames * DELAY_CS) / 100)).toBeLessThanOrEqual(0.15)+})++test('page range — "Current page" exports one page of the timeline', async ({ page, request }) => {+ test.setTimeout(240_000)++ const designId = await createDesign(request, 2)+ await openEditor(page, designId)++ await page.getByLabel('Download').click()+ const dlg = page.getByRole('dialog')+ await expect(dlg.getByText('Download your design')).toBeVisible()+ await dlg.getByRole('button', { name: /GIF Animated/ }).click()+ await dlg.getByRole('button', { name: 'Small 480 px' }).click()++ // ONE page instead of the whole deck+ await dlg.getByLabel('Current page').check()++ const [download] = await Promise.all([+ page.waitForEvent('download', { timeout: 200_000 }),+ dlg.getByRole('button', { name: /^Download/ }).click(),+ ])+ const path = (await download.path())!+ const gif = parseGif(readFileSync(path))++ // a single page ≈ one hold (2.2–3.5 s) → at most ~50 frames, far+ // fewer than the two-page deck's 70++ expect(gif.frames, `frames: ${gif.frames}`).toBeLessThanOrEqual(52)+ expect(gif.frames).toBeGreaterThanOrEqual(30)+ expect(gif.loop).toBe(0)+})++test('pre-flight cap — a 100-page deck is refused before rendering', async ({ page, request }) => {+ test.setTimeout(120_000)++ const designId = await createDesign(request, 100)+ await openEditor(page, designId)++ await page.getByLabel('Download').click()+ const dlg = page.getByRole('dialog')+ await expect(dlg.getByText('Download your design')).toBeVisible()+ await dlg.getByRole('button', { name: /GIF Animated/ }).click()++ // the frame-cap error is actionable and visible BEFORE any export+ await expect(dlg.getByText(/cap is 1800/)).toBeVisible({ timeout: 30_000 })+ await expect(dlg.getByRole('button', { name: /^Download/ })).toBeDisabled()+})