"""Extract only assets used by this deck from the user-specified PPTX."""
import argparse, hashlib, json, zipfile
from pathlib import Path
from PIL import Image
ap=argparse.ArgumentParser();ap.add_argument('source',type=Path);args=ap.parse_args()
root=Path(__file__).resolve().parents[6]
out=root/'oss/local-deliveries/k12-campus-meal-refined-20260912/assets';out.mkdir(parents=True,exist_ok=True)
expected='a81fb1688b5f84edda97c7786180290321662eab9a58443e61e6c3844ccd307b'
actual=hashlib.sha256(args.source.read_bytes()).hexdigest()
if actual!=expected:raise SystemExit('Source version mismatch; review before rebuilding')
media=['image32.jpeg','image44.png','image64.png','image74.png','image68.png','image69.png','image62.png','image75.png']
with zipfile.ZipFile(args.source) as z:
 for name in media:(out/name).write_bytes(z.read('ppt/media/'+name))
master=root/'standards-stack/agent-skills/skills/kangbite-ppt-template/assets/content-master-background-1920x1080.jpg'
with Image.open(master) as im:im.crop((1620,20,1900,155)).save(out/'brand-logo.png')
print(json.dumps({'source_sha256':actual,'extracted':media},ensure_ascii=False))
