Files
Guoliang ChenandClaude Opus 5.5 4cdbd66fcf Sharper first view and smoke loader sign-off
The loader now measures throughput from whole tile batches, not just the
two probe tiles, and after a session settles inside its deadline it tops
up in the background: the needed level if the budget cut it short, then
one level above it on capable devices with a fast connection (drawn
downscaled), within time and memory caps and never under Save-Data.

The chop in the album end card and the page footer is replaced by the
LUCIO loader in smoke from lucioIP, falling back to the SVG loader
without WebGL. sync-brand.sh now copies lucio-loaders.js and defaults to
../lucioIP.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 01:47:44 -08:00

280 lines
100 KiB
JavaScript

"use strict";(()=>{(function(n){let e={from:"Guoliang",to:"Lucio",letters:[{ch:"G",kind:"keep",shared:"M8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50",fullA:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",fullB:"M8.50 0.00L8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50L80.00 91.50",out:[{d:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00",P:79.21,j:"end"},{d:"M58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",P:73.21,j:"start"}],in:[{d:"M8.50 22.00L8.50 0.00",P:22,j:"start"},{d:"M58.00 91.50L80.00 91.50",P:22,j:"start"}],x0:0,x1:0,dot:null},{ch:"u",kind:"keep",shared:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullA:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullB:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",out:[],in:[],x0:88.8,x1:88,dot:null},{ch:"o",kind:"keep",shared:"M38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullB:"M60.00 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50L60.00 91.50",out:[{d:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50",P:60.41,j:"both"}],in:[{d:"M38.00 46.50L60.00 46.50",P:22,j:"start"},{d:"M38.00 91.50L60.00 91.50",P:22,j:"start"}],x0:159,x1:158.2,dot:null},{ch:"l",kind:"fade",d:"M8.50 0.00L8.50 100.00",x0:230.8,x1:230.8,dot:null},{ch:"i",kind:"keep",shared:"M8.50 38.00L8.50 100.00",fullA:"M8.50 38.00L8.50 100.00",fullB:"M8.50 38.00L8.50 100.00",out:[],in:[],x0:262.8,x1:227.9,dot:[0,14,17]},{ch:"a",kind:"fade",d:"M38.00 91.50L51.50 91.50L51.50 78.00L51.50 60.00L51.50 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",x0:291.6,x1:291.6,dot:null},{ch:"n",kind:"fade",d:"M51.50 100.00L51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00L8.50 100.00",x0:362.7,x1:362.7,dot:null},{ch:"g",kind:"keep",shared:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M0.00 127.50L38.00 127.50A13.50 13.50 0 0 0 51.50 114.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00",fullB:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",out:[{d:"M51.50 60.00L51.50 114.00A13.50 13.50 0 0 1 38.00 127.50L0.00 127.50",P:113.21,j:"start"}],in:[],x0:432.9,x1:256.7,dot:null}],pad:17,vbw:526.9,vbh:170,stroke:17,raysT:"translate(0.000 22.727) scale(0.7727)"},t="M47.6 70.7L71.9 61.1L71.1 58.2L45.2 62.0ZM44.9 61.5L61.2 40.9L59.1 38.8L38.5 55.1ZM38.0 54.8L41.8 28.9L38.9 28.1L29.3 52.4Z",i="http://www.w3.org/2000/svg",s=(v,E)=>{let p=document.createElementNS(i,v);for(let y in E)p.setAttribute(y,E[y]);return p},r=()=>n.matchMedia&&n.matchMedia("(prefers-reduced-motion: reduce)").matches,o=v=>Math.max(0,Math.min(1,v)),a=v=>v*v*(3-2*v),l=.5;function h(v,E){let p=0,y=0,x=null,M=0;function F(T){let A=(T-M)/E;M=T,p=p<y?Math.min(y,p+A):Math.max(y,p-A),v(p),x=p===y?null:requestAnimationFrame(F)}function w(T){if(y=T,r()){p=T,v(p);return}x===null&&(M=performance.now(),x=requestAnimationFrame(F))}return{play:()=>w(1),reverse:()=>w(0),toggle:()=>w(y?0:1),set:T=>{cancelAnimationFrame(x),x=null,y=p=T,v(p)},stop:()=>{cancelAnimationFrame(x),x=null},get t(){return p}}}function c(v,E,p,y){let x=o(y)*E;if(v.style.visibility=x<.05?"hidden":"visible",p==="both"){let M=x/2;v.setAttribute("stroke-dasharray",M.toFixed(2)+" "+Math.max(0,E-2*M).toFixed(2)+" "+M.toFixed(2)),v.setAttribute("stroke-dashoffset","0")}else p==="end"?(v.setAttribute("stroke-dasharray",x.toFixed(2)+" "+(2*E+20).toFixed(2)),v.setAttribute("stroke-dashoffset",(-(E-x)).toFixed(2))):(v.setAttribute("stroke-dasharray",x.toFixed(2)+" "+(2*E+20).toFixed(2)),v.setAttribute("stroke-dashoffset","0"))}function f(v,E={}){let p=Object.assign({trigger:"hover",color:"currentColor",rays:"#FFF3CF",duration:450,autoDelay:1800},E),y=s("svg",{viewBox:"0 0 "+e.vbw+" "+e.vbh,role:"img","aria-label":"Guoliang Chen, Lucio"});y.style.display="block",y.style.width="100%",y.style.height="auto";let x=s("g",{transform:"translate("+e.pad+" "+e.pad+")",fill:"none",stroke:p.color,"stroke-width":e.stroke,"stroke-linejoin":"miter","stroke-linecap":"butt"});y.appendChild(x);let M=e.letters.map(A=>{let P=s("g",{transform:"translate("+A.x0+" 0)"});x.appendChild(P);let N=Object.assign({g:P,outEls:[],inEls:[]},A);if(A.kind==="fade")N.fadeEl=s("path",{d:A.d}),P.appendChild(N.fadeEl);else{N.fullA=s("path",{d:A.fullA}),P.appendChild(N.fullA),N.fullB=s("path",{d:A.fullB}),P.appendChild(N.fullB),A.shared&&P.appendChild(s("path",{d:A.shared}));for(let C of A.out){let R=s("path",{d:C.d});P.appendChild(R),N.outEls.push([R,C])}for(let C of A.in){let R=s("path",{d:C.d});P.appendChild(R),N.inEls.push([R,C])}}return A.dot&&(N.dotEl=s("rect",{x:A.dot[0],y:A.dot[1],width:A.dot[2],height:A.dot[2],rx:A.dot[2]*.22,fill:p.color,stroke:"none"}),P.appendChild(N.dotEl)),N}),F=s("path",{d:t,fill:p.rays,stroke:"none",opacity:0});x.appendChild(F),v.appendChild(y);function w(A){let P=a(o(A/l)),N=a(o((A-l)/(1-l)));for(let C of M){if(C.kind==="fade")C.fadeEl.setAttribute("opacity",(1-P).toFixed(3)),C.dotEl&&C.dotEl.setAttribute("opacity",(1-P).toFixed(3));else{for(let[R,_]of C.outEls)c(R,_.P,_.j,1-P);for(let[R,_]of C.inEls)c(R,_.P,_.j,P);C.fullA.style.visibility=P<=.001?"visible":"hidden",C.fullB.style.visibility=P>=.999?"visible":"hidden"}C.g.setAttribute("transform","translate("+(C.x0+(C.x1-C.x0)*N).toFixed(2)+" 0)")}F.setAttribute("transform","translate("+(M[0].x0+(M[0].x1-M[0].x0)*N).toFixed(2)+" 0) "+e.raysT),F.setAttribute("opacity",o((A-.8)/.2).toFixed(3))}let T=h(w,p.duration);return w(0),p.trigger==="hover"&&(v.addEventListener("mouseenter",T.play),v.addEventListener("mouseleave",T.reverse),v.addEventListener("focus",T.play),v.addEventListener("blur",T.reverse)),p.trigger==="click"&&v.addEventListener("click",T.toggle),p.trigger==="auto"&&setInterval(T.toggle,p.autoDelay+p.duration),Object.assign(T,{svg:y})}let b={C:[0,.75],L:[.25,.75],U:[.25,1],I:[.75,1],O:[.75,1.75]};function g(v,E,p){let y=E/2,x=p-y,M=y+x,F=x*Math.SQRT1_2,w=A=>A.toFixed(3);return{d:"M"+w(v-M+F)+" "+w(M-F)+"A"+w(x)+" "+w(x)+" 0 0 0 "+w(v-M)+" "+w(y)+"H"+w(M)+"A"+w(x)+" "+w(x)+" 0 0 0 "+w(y)+" "+w(M)+"V"+w(v-M)+"A"+w(x)+" "+w(x)+" 0 0 0 "+w(M)+" "+w(v-y)+"H"+w(v-M)+"A"+w(x)+" "+w(x)+" 0 0 0 "+w(v-y)+" "+w(v-M)+"V"+w(M)+"A"+w(x)+" "+w(x)+" 0 0 0 "+w(v-M+F)+" "+w(M-F)+"Z",P:4*(v-2*M)+2*Math.PI*x}}function L(v,E={}){let p=Object.assign({sequence:"LUCIO",color:"#F3F1EC",track:"#26262D",rays:"#FFF3CF",hold:480,morph:640,size:96,stroke:.17,radius:.22},E),y=120,x=y*p.stroke,M=y*p.radius,F=g(y,x,M),w=s("svg",{viewBox:"0 0 "+y+" "+y,width:p.size,height:p.size,role:"img","aria-label":"Loading"});p.track&&w.appendChild(s("path",{d:F.d,fill:"none",stroke:p.track,"stroke-width":x}));let T=s("path",{d:F.d,fill:"none",stroke:p.color,"stroke-width":x,"stroke-linecap":"butt"}),A=x/22,P=s("path",{d:t,fill:p.rays,transform:"translate("+(x-22*A).toFixed(3)+" "+(y-x-78*A).toFixed(3)+") scale("+A.toFixed(4)+")",opacity:0});w.appendChild(T),w.appendChild(P);let N=(m,S)=>{let z=Math.min(1,Math.max(0,S-m))*F.P;T.setAttribute("stroke-dasharray",z.toFixed(3)+" "+Math.max(0,F.P-z).toFixed(3)),T.setAttribute("stroke-dashoffset",(-m*F.P).toFixed(3))},C=(m,S)=>{let[z,d]=b[S];for(let H=-1;H<6;H++)if(z+H>=m[0]-1e-6&&d+H>=m[1]-1e-6)return[z+H,d+H];return[z,d]},R=p.sequence.split(""),_=0,O=b[R[0]].slice(),$,Q,pe=!1;N(O[0],O[1]),P.setAttribute("opacity",R[0]==="L"?1:0);function oe(){if(pe)return;let m=(_+1)%R.length,S=C(O,R[m]),z=O.slice(),d=R[_]==="L",H=R[m]==="L",D=()=>{O=S;let U=Math.floor(O[0]);O[0]-=U,O[1]-=U,_=m,N(O[0],O[1]),P.setAttribute("opacity",H?1:0),Q=setTimeout(oe,p.hold)};if(r()){D();return}let u=performance.now(),X=U=>{let q=Math.min(1,(U-u)/p.morph),I=q<.5?4*q*q*q:1-Math.pow(-2*q+2,3)/2;N(z[0]+(S[0]-z[0])*I,z[1]+(S[1]-z[1])*I),P.setAttribute("opacity",H?Math.max(0,(q-.6)/.4).toFixed(3):d?Math.max(0,1-q*2.5).toFixed(3):0),q<1?$=requestAnimationFrame(X):D()};$=requestAnimationFrame(X)}return Q=setTimeout(oe,p.hold),v.appendChild(w),{svg:w,stop:()=>{pe=!0,cancelAnimationFrame($),clearTimeout(Q)}}}n.LucioMorph={wordmark:f,loader:L}})(window);(function(n){let s=33.599999999999994,r=2*s,o=Math.PI/2*16.2,a=4*(r+o),l=a/4,h=96,c=64,f=10.2*.85;function b(m){m=((m-o/2)%a+a)%a;let S=(z,d,H)=>[z+16.2*Math.cos(H),d+16.2*Math.sin(H)];return m<r?[49.8,-s+m]:(m-=r,m<o?S(s,s,m/16.2):(m-=o,m<r?[s-m,49.8]:(m-=r,m<o?S(-s,s,Math.PI/2+m/16.2):(m-=o,m<r?[-49.8,s-m]:(m-=r,m<o?S(-s,-s,Math.PI+m/16.2):(m-=o,m<r?[-s+m,-49.8]:(m-=r,S(s,-s,-Math.PI/2+m/16.2))))))))}let g=`
precision highp float;
uniform vec2 uRes;
uniform float uPx, uTime, uDark;
uniform vec3 uColor;
#define PI 3.14159265
#define HPI 1.5707963
const float HB = ${49.8.toFixed(4)}, CR = ${16.2.toFixed(4)}, HW = ${10.2.toFixed(4)}, H = ${s.toFixed(4)};
const float SL = ${r.toFixed(4)}, CL = ${o.toFixed(4)}, PER = ${a.toFixed(4)}, Q = ${l.toFixed(4)};
const vec2 L2 = vec2(0.6608, 0.7506); // the brand's one light: from the upper right
float sdRB(vec2 p) { vec2 q = abs(p) - vec2(H); return length(max(q, 0.)) + min(max(q.x, q.y), 0.) - CR; }
// arc length of the nearest centreline point, CCW, 0 at the bottom-right corner's 45-degree point
float pathS(vec2 p) {
if (abs(p.x) <= H && abs(p.y) <= H) { if (abs(p.x) > abs(p.y)) p.x = sign(p.x) * (H + 1e-3); else p.y = sign(p.y) * (H + 1e-3); }
float s;
if (p.x > H && p.y > H) s = SL + atan(p.y - H, p.x - H) * CR;
else if (p.x < -H && p.y > H) s = 2. * SL + CL + (atan(p.y - H, p.x + H) - HPI) * CR;
else if (p.x < -H && p.y < -H) s = 3. * SL + 2. * CL + atan(-(p.y + H), -(p.x + H)) * CR;
else if (p.x > H && p.y < -H) s = 4. * SL + 3. * CL + (atan(p.y + H, p.x - H) + HPI) * CR;
else if (p.x > H) s = p.y + H;
else if (p.y > H) s = SL + CL + (H - p.x);
else if (p.x < -H) s = 2. * SL + 2. * CL + (H - p.y);
else s = 3. * SL + 3. * CL + (p.x + H);
return mod(s + CL * 0.5, PER);
}
float hash11(float n) { return fract(sin(n * 127.1 + 11.7) * 43758.5453); }
float hash12(vec2 p) { vec3 p3 = fract(vec3(p.xyx) * .1031); p3 += dot(p3, p3.yzx + 33.33); return fract((p3.x + p3.y) * p3.z); }
vec2 hash22(vec2 p) { vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973)); p3 += dot(p3, p3.yzx + 33.33); return fract((p3.xx + p3.yz) * p3.zy); }
// simplex noise 3D (Ashima Arts / Stefan Gustavson, MIT)
vec3 mod289(vec3 x) { return x - floor(x * (1. / 289.)) * 289.; }
vec4 mod289(vec4 x) { return x - floor(x * (1. / 289.)) * 289.; }
vec4 permute(vec4 x) { return mod289(((x * 34.) + 1.) * x); }
vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }
float snoise(vec3 v) {
const vec2 C = vec2(1. / 6., 1. / 3.); const vec4 D = vec4(0., .5, 1., 2.);
vec3 i = floor(v + dot(v, C.yyy)); vec3 x0 = v - i + dot(i, C.xxx);
vec3 g = step(x0.yzx, x0.xyz); vec3 l = 1. - g; vec3 i1 = min(g.xyz, l.zxy); vec3 i2 = max(g.xyz, l.zxy);
vec3 x1 = x0 - i1 + C.xxx; vec3 x2 = x0 - i2 + C.yyy; vec3 x3 = x0 - D.yyy;
i = mod289(i);
vec4 p = permute(permute(permute(i.z + vec4(0., i1.z, i2.z, 1.)) + i.y + vec4(0., i1.y, i2.y, 1.)) + i.x + vec4(0., i1.x, i2.x, 1.));
float n_ = 0.142857142857; vec3 ns = n_ * D.wyz - D.xzx;
vec4 j = p - 49. * floor(p * ns.z * ns.z);
vec4 x_ = floor(j * ns.z); vec4 y_ = floor(j - 7. * x_);
vec4 x = x_ * ns.x + ns.yyyy; vec4 y = y_ * ns.x + ns.yyyy; vec4 h = 1. - abs(x) - abs(y);
vec4 b0 = vec4(x.xy, y.xy); vec4 b1 = vec4(x.zw, y.zw);
vec4 s0 = floor(b0) * 2. + 1.; vec4 s1 = floor(b1) * 2. + 1.; vec4 sh = -step(h, vec4(0.));
vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
vec3 p0 = vec3(a0.xy, h.x); vec3 p1 = vec3(a0.zw, h.y); vec3 p2 = vec3(a1.xy, h.z); vec3 p3 = vec3(a1.zw, h.w);
vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;
vec4 m = max(.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.); m = m * m;
return 42. * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
}
// premultiplied "over": c with coverage a goes on top of dst
void over(inout vec4 dst, vec3 c, float a) { a = clamp(a, 0., 1.); dst = vec4(c * a, a) + dst * (1. - a); }
vec2 frag() { return (gl_FragCoord.xy - 0.5 * uRes) * uPx; }
`,L=`
uniform float uHead, uLen, uSurge, uMid, uFlowA, uFlowB, uFlowW;
uniform sampler2D uWet; // how recently each stretch of pipe was under water, 1 = now
const float RI = 0.84; // bore radius / outer radius: the rest is glass wall
const float MEN = 0.55; // meniscus depth, fraction of bore radius
// x: coverage, y: distance behind the head along the pipe, z: distance inside the nearest meniscus
vec3 slug(float s, float vi) {
float rel = mod(uHead - s + 24., PER) - 24.;
float gap = PER - uLen, full = 1. - smoothstep(0.3, 1.5, gap); // O: the two ends meet and the ring closes
float c = sqrt(max(0., 1. - vi * vi));
float m = MEN * HW * RI * smoothstep(0., 30., gap);
float front = m * c * (1. - 0.4 * uSurge); // concave: the water climbs the wall ahead of the centre
float back = uLen + m * (1. - c) * (1. + 0.4 * uSurge);
float dIn = mix(min(rel - front, back - rel), 60., full);
return vec3(clamp(dIn / uPx + 0.5, 0., 1.), rel, dIn);
}
// noise laid on a circle, so the texture wraps the loop without a seam
float ringNoise(float s, float vi, float freq, float z) {
float a = 6.2831853 * s / PER, R = PER / 6.2831853 * freq;
return snoise(vec3(R * cos(a) + uTime * 0.3, R * sin(a) - uTime * 0.2, vi * 1.25 + z));
}
float flowTex(float s, float vi, float z) {
return 0.5 + 0.5 * (0.6 * ringNoise(s, vi, 0.06, z) + 0.28 * ringNoise(s, vi * 1.8, 0.13, z + 3.1) + 0.12 * ringNoise(s, vi * 3.6, 0.27, z + 7.7));
}
void main() {
vec2 p = frag();
vec4 o = vec4(0.);
// contact shadow thrown down-left, and the light the water focuses into it
vec2 so = -L2 * 5.5;
vec2 ps = p - so;
float dsh = sdRB(ps);
float sr = abs(dsh) / HW; // glass passes most light: the shadow is darkest under the walls
o.a = (1. - smoothstep(-4., 10., abs(dsh) - HW)) * mix(0.05, 0.2, uDark) + exp(-pow((sr - 0.95) / 0.35, 2.)) * mix(0.08, 0.06, uDark);
{
vec3 Ws = slug(pathS(ps), clamp(dsh / (HW * RI), -1., 1.));
float cz = exp(-pow((dsh / HW + 0.2) / 0.3, 2.)) * Ws.x;
o.rgb += mix(uColor, vec3(1.), 0.25) * cz * mix(0.45, 0.12, uDark);
}
float dc = sdRB(p);
float v = dc / HW;
float tube = clamp((HW - abs(dc)) / uPx + 0.5, 0., 1.);
if (tube <= 0.) { gl_FragColor = o; return; }
vec2 n2 = normalize(p - clamp(p, -H, H) + 1e-4);
vec2 t2 = vec2(-n2.y, n2.x);
float s = pathS(p);
float vc = clamp(v, -1., 1.);
vec3 N = vec3(n2 * vc, sqrt(max(0., 1. - vc * vc)));
vec3 Ld = normalize(vec3(L2 * 0.78, 0.62));
vec3 Hh = normalize(Ld + vec3(0., 0., 1.));
vec3 gTint = mix(vec3(0.42, 0.50, 0.53), vec3(0.78, 0.88, 0.92), uDark);
vec3 hiC = vec3(1.0, 0.985, 0.95);
// glass: the walls are thicker to the eye near the silhouette
float gl = 2. * (sqrt(max(0., 1. - vc * vc)) - sqrt(max(0., RI * RI - vc * vc)));
float gA = 1. - exp(-gl * 0.42);
over(o, gTint, gA * 0.3 * tube);
float vi = clamp(v / RI, -1., 1.);
float bore = clamp((RI * HW - abs(dc)) / uPx + 0.5, 0., 1.);
vec3 W = slug(s, vi);
float cov = W.x * bore;
vec2 hl = vec2(dot(L2, -t2), dot(L2, n2)); // light direction in the slug's local frame
vec3 wetC = mix(uColor, vec3(1.), 0.35);
// where the water has just left: a film on the walls and beads that drain away
float wet = texture2D(uWet, vec2(s / PER, 0.5)).r * (1. - W.x);
if (wet > 0.01 && bore > 0.) {
over(o, wetC, wet * 0.22 * smoothstep(0.5, 0.95, abs(vi)) * bore);
float cs = PER / 110.;
float gx = floor(s / cs), gy = floor((vi + 1.) * 2.);
for (int a = -1; a <= 1; a++) for (int b = -1; b <= 1; b++) {
vec2 cell = vec2(gx + float(a), gy + float(b));
if (cell.y < 0. || cell.y > 3.) continue;
vec2 hc = vec2(mod(cell.x, 110.), cell.y);
vec2 h = hash22(hc);
float h3 = hash12(hc.yx + 17.);
float pres = smoothstep(h3, h3 + 0.3, wet * 1.2) * step(0.45, hash12(hc + 3.7));
if (pres <= 0.01) continue;
vec2 c = vec2((cell.x + h.x) * cs, clamp(-1. + (cell.y + h.y) * 0.5, -0.88, 0.88));
float r = mix(0.35, 1.3, h.x * h.y) * sqrt(pres);
vec2 dl = vec2(s - c.x, (vi - c.y) * RI * HW);
float d = length(dl) - r;
float fill = clamp(-d / uPx + 0.5, 0., 1.) * bore;
over(o, wetC * 0.75, fill * 0.45);
over(o, uColor * 0.4, exp(-pow(d / 0.25, 2.)) * 0.35 * bore);
over(o, hiC, exp(-pow(length(dl - vec2(-hl.x, hl.y) * r * 0.45) / (0.28 * r + 0.08), 2.)) * 0.85 * bore);
}
}
if (cov > 0.) {
float th = sqrt(max(0., 1. - vi * vi));
float kv = 1. + 0.4 * (1. - 2. * vi * vi); // the centre runs ahead of the walls
float tex = mix(flowTex(s - kv * uFlowA, vi, 0.), flowTex(s - kv * uFlowB, vi, 7.3), uFlowW);
float side = dot(n2 * vi, L2);
vec3 wc = mix(mix(uColor, vec3(1.), 0.55), uColor, smoothstep(0.05, 0.9, th)); // Beer-Lambert: thicker is deeper
wc *= 1. - 0.55 * smoothstep(0.62, 1.0, abs(vi)); // total internal reflection at the wall
wc += mix(uColor, vec3(1.), 0.65) * exp(-pow((side + 0.42) / 0.17, 2.)) * 0.42; // caustic on the far wall
wc *= 0.8 + 0.4 * tex;
float spA = smoothstep(0.62, 0.9, ringNoise(s - kv * uFlowA, vi * 4., 0.45, 11.));
float spB = smoothstep(0.62, 0.9, ringNoise(s - kv * uFlowB, vi * 4., 0.45, 19.));
wc += 0.25 * mix(spA, spB, uFlowW);
wc *= 1. - 0.6 * exp(-pow(W.z / 1.1, 2.)); // meniscus: dark refracted band
wc += 0.5 * exp(-pow((W.z - 2.1) / 0.7, 2.)) * mix(uColor, vec3(1.), 0.75); // and its bright inner lip
over(o, wc, (0.58 + 0.34 * th + 0.2 * exp(-pow(W.z / 1.5, 2.))) * cov);
// entrained bubbles ride the flow; they only move when the water does
float full = 1. - smoothstep(0.3, 1.5, PER - uLen);
for (int i = 0; i < 12; i++) {
float fi = float(i);
float bv = (hash11(fi + 1.3) * 2. - 1.) * 0.62;
float br = mix(0.5, 1.9, hash11(fi + 7.9) * hash11(fi + 3.1));
float bk = 1. + 0.35 * (1. - 2. * bv * bv) + 0.2 * (hash11(fi + 4.4) - 0.5);
float bs = mod(hash11(fi + 9.2) * PER + bk * uMid, PER);
float bx = mod(uHead - bs + 24., PER) - 24.;
float fade = mix(smoothstep(4., 9., bx) * smoothstep(uLen, uLen - 9., bx), 1., full);
vec2 dl = vec2(W.y - bx, (vi - bv) * RI * HW);
dl.x -= PER * floor(dl.x / PER + 0.5);
float d = length(dl) - br;
if (d < 1.2 && fade > 0.) {
float f = fade * cov;
over(o, mix(wc, vec3(1.), 0.5), clamp(-d / uPx + 0.5, 0., 1.) * 0.3 * f);
over(o, wc * 0.3, exp(-pow(d / 0.28, 2.)) * 0.6 * f);
over(o, hiC, exp(-pow(length(dl - hl * br * 0.42) / (0.22 * br + 0.12), 2.)) * 0.9 * f);
}
}
}
// front wall, reflections
over(o, gTint, gA * 0.3 * tube);
float ndh = max(dot(N, Hh), 0.);
float spec = pow(ndh, 110.) * 0.95 + pow(ndh, 14.) * 0.09;
spec += pow(max(dot(vec3(-N.xy, N.z), Hh), 0.), 70.) * 0.28; // the back inner surface
float fres = pow(1. - N.z, 3.) * mix(0.12, 0.3, uDark);
float wl = exp(-pow((abs(v) - RI) * HW / 0.3, 2.)) * 0.2; // bore wall seen edge-on
over(o, hiC, (spec + fres + wl) * tube);
over(o, gTint * 0.55, exp(-pow((abs(v) - 1.) * HW / 0.45, 2.)) * mix(0.45, 0.1, uDark) * tube);
gl_FragColor = o;
}`,v=`
uniform vec4 uPuff[${c}]; // one puff per stretch of the frame: centre xy, radius, weight
const float W0 = ${f.toFixed(4)};
float fbm(vec3 p) { float f = 0., a = 0.55; for (int i = 0; i < 4; i++) { f += a * snoise(p); p = p * 2.03 + vec3(1.7, 9.2, 3.1); a *= 0.42; } return f; }
vec2 warpAt(vec2 p) { vec3 np = vec3(p * 0.022, uTime * 0.12); return vec2(snoise(np), snoise(np + vec3(19.1, 7.3, 3.7))); }
// x: density, y: mean growth of the puffs here (released smoke has grown)
vec2 puffs(vec2 p, vec2 warp) {
float D = 0., G = 0.;
for (int i = 0; i < ${c}; i++) {
vec4 f = uPuff[i];
float grow = f.z - W0;
vec2 q = p - warp * (1.5 + 0.6 * grow) - f.xy; // turbulence displaces older smoke further (kept below folding)
float g = f.w * exp(-dot(q, q) / (f.z * f.z));
D += g; G += g * grow;
}
return vec2(D, G / max(D, 1e-5));
}
void main() {
vec2 p = frag();
vec2 wp = warpAt(p);
vec2 P = puffs(p, wp);
float ext = min(0.5 * uRes.x * uPx - abs(p.x), 0.5 * uRes.y * uPx - abs(p.y));
P.x *= smoothstep(0., 16., ext);
if (P.x < 0.004) { gl_FragColor = vec4(0.); return; }
// billows: domain-warped noise evolving in place, eaten away as the smoke ages
vec2 pw = p - wp * (1.5 + 0.6 * P.y);
vec3 dp = vec3(pw * 0.035, uTime * 0.16);
vec2 q = vec2(snoise(dp), snoise(dp + vec3(5.2, 1.3, 2.8)));
float n = fbm(vec3(pw * 0.045 + 1.1 * q, uTime * 0.2 + 3.));
float bil = smoothstep(-0.7, 0.55, n + 0.1 - 0.04 * P.y);
float d = P.x * (0.5 + 0.75 * bil);
// light from the upper right: shade by how much smoke lies toward it
vec2 pl = p + L2 * 7.;
float dl = puffs(pl, warpAt(pl)).x;
float lit = clamp(mix(0.55, 0.85, uDark) - (dl - P.x) * mix(1.3, 0.9, uDark), 0., 1.) * (0.88 + 0.16 * bil);
float a = 1. - exp(-d * 1.9);
vec3 shade = uColor * mix(vec3(0.62, 0.64, 0.70), vec3(0.50, 0.53, 0.60), uDark);
vec3 c = mix(shade, uColor, clamp(lit, 0., 1.));
c += uColor * 0.18 * (1. - a) * lit; // thin wisps let light through
gl_FragColor = vec4(min(c, vec3(1.)) * a, a);
}`,E=`
uniform float uSegA, uLen, uMix, uMove, uHum, uTR;
uniform vec3 uColA, uColB;
uniform vec2 uPts[${h}];
vec3 emit(float s) {
float x = mod(s - uSegA, PER); // distance ahead of the tail
float din = x <= uLen ? min(x, uLen - x) : -min(x - uLen, PER - x);
din = mix(din, 1e3, step(PER - 0.5, uLen));
float on = smoothstep(-0.6, 0.6, din);
float strike = uMove * exp(-max(uLen - x, 0.) / 18.) * on; // the end being struck stutters while it runs
float fl = mix(1., 0.15 + 0.85 * step(0.3, hash12(vec2(floor(x / 6.), floor(uTime * 30.)))), strike);
float after = uMove * exp(-mod(uSegA - s, PER) / 10.) * (1. - on) * 0.6; // the tail lets go with an afterglow
vec3 col = mix(uColB, uColA, uMix);
return (col * (on * fl * (1. + 0.6 * strike) + after) + vec3(0.35) * strike * fl) * uHum;
}
void main() {
vec2 p = frag();
float dc = sdRB(p), d = abs(dc), s = pathS(p);
vec3 e = emit(s);
// light spilling onto the wall: integrated over the whole tube so every lit stretch contributes
vec3 g = vec3(0.);
for (int i = 0; i < ${h}; i++) {
vec2 dv = p - uPts[i];
float r2 = dot(dv, dv);
g += emit((float(i) + 0.5) * (PER / ${h}.)) * (exp(-r2 / 60.) + 0.35 * exp(-r2 / 420.));
}
g *= (PER / ${h}.) / 40.;
float vt = clamp(dc / uTR, -1., 1.);
float tm = clamp((uTR - d) / uPx + 0.5, 0., 1.);
float I = max(max(e.r, e.g), e.b);
float core = exp(-vt * vt * 3.2);
vec3 tubeL = e * (0.4 + 0.85 * core) + vec3(1.) * I * pow(core, 4.) * 0.55; // white-hot centre, saturated rim
vec3 nearL = e * exp(-max(d - uTR * 0.8, 0.) / 1.2) * 0.6;
vec3 L = g + nearL * (1. - tm) + tubeL * tm;
vec3 mapped = 1. - exp(-L * 1.25);
// the glass itself, visible where it is dark
vec2 n2 = normalize(p - clamp(p, -H, H) + 1e-4);
vec3 N = vec3(n2 * vt, sqrt(max(0., 1. - vt * vt)));
vec3 Hh = normalize(normalize(vec3(L2 * 0.78, 0.62)) + vec3(0., 0., 1.));
vec3 gTint = mix(vec3(0.22, 0.24, 0.27), vec3(0.62, 0.66, 0.72), uDark);
vec4 o = vec4(0.);
over(o, gTint, tm * (0.14 + 0.35 * pow(1. - N.z, 2.)) * (1. - clamp(I, 0., 1.) * 0.6));
if (uDark > 0.5) o.rgb += mapped;
else { // on paper light can't add; lay the hue down instead, keeping it saturated
vec3 Lc = g + nearL * (1. - tm) + e * (0.4 + 0.85 * core) * tm;
float m = max(max(Lc.r, Lc.g), Lc.b);
over(o, Lc / max(m, 1e-3), (1. - exp(-m * 1.4)) * mix(0.85, 1., tm));
over(o, vec3(1.), pow(core, 4.) * min(I, 1.) * 0.6 * tm);
}
over(o, vec3(1.), pow(max(dot(N, Hh), 0.), 60.) * 0.5 * tm);
gl_FragColor = o;
}`,p={water:L,smoke:v,neon:E},y={water:1.3,smoke:1.9,neon:1.8},x={water:{color:"#2FA8FF"},smoke:{color:"#F5F5F2"},neon:{colors:["#FF2E88","#2EF0FF","#FFB020","#7CFF4F","#9B5CFF"],tube:.58}},M={sequence:"LUCIO",hold:.7,morph:.45,speed:1,size:96},F=m=>{let S=m.replace("#",""),z=S.length===3?S.split("").map(d=>d+d).join(""):S;return[0,2,4].map(d=>parseInt(z.slice(d,d+2),16)/255)},w=()=>n.matchMedia&&n.matchMedia("(prefers-reduced-motion: reduce)").matches,T=m=>m<.5?4*m*m*m:1-Math.pow(-2*m+2,3)/2,A=m=>m-Math.floor(m),P=m=>A(Math.sin(m*127.1+11.7)*43758.5453),N=(m,S,z)=>{let d=Math.min(1,Math.max(0,(z-m)/(S-m)));return d*d*(3-2*d)};function C(m){for(let S=m;S&&S.nodeType===1;S=S.parentElement){let z=getComputedStyle(S).backgroundColor.match(/[\d.]+/g);if(z&&(z.length<4||+z[3]>.5))return(.2126*z[0]+.7152*z[1]+.0722*z[2])/255<.5}return!!(n.matchMedia&&n.matchMedia("(prefers-color-scheme: dark)").matches)}let R={C:[0,.75],L:[.25,.75],U:[.25,1],I:[.75,1],O:[.75,1.75]};function _(m){let S=()=>{let X=(m.sequence||"LUCIO").toUpperCase().split("").filter(U=>R[U]);return X.length?X:["O"]},z=(X,U)=>{let[q,I]=R[U];for(let j=-1;j<6;j++)if(q+j>=X[0]-1e-6&&I+j>=X[1]-1e-6)return[q+j,I+j];return[q,I]},d={i:0,j:0,seg:R[S()[0]].slice(),u:1,f:1,moving:!1,travel:0,vHead:0},H=d.seg,D=d.seg,u=0;return d.step=X=>{let U=d.seg.slice();if(u+=X,!d.moving&&u>=m.hold){let q=S();d.j=(d.i+1)%q.length,H=d.seg.slice(),D=z(d.seg,q[d.j]),d.moving=!0,u-=m.hold}if(d.moving){let q=w()?0:m.morph;d.f=q>0?Math.min(1,u/q):1,d.u=T(d.f),d.seg=[H[0]+(D[0]-H[0])*d.u,H[1]+(D[1]-H[1])*d.u],d.f>=1&&(d.moving=!1,d.i=d.j,u=0)}else d.f=1,d.u=1;if(d.travel+=(d.seg[0]-U[0]+(d.seg[1]-U[1]))/2*a,d.vHead=X>0?(d.seg[1]-U[1])*a/X:0,!d.moving){let q=Math.floor(d.seg[0]);d.seg[0]-=q,d.seg[1]-=q}},d.units=()=>({a:a*(d.seg[0]+.25),len:Math.min(a,(d.seg[1]-d.seg[0])*a)}),d.reset=()=>{d.i=d.j=0,d.seg=R[S()[0]].slice(),d.moving=!1,u=0},d}let O=new Set,$=0,Q=0;function pe(m){let S=Q?Math.min(.1,(m-Q)/1e3):0;Q=m;for(let z of O)z.frame(S);$=O.size?requestAnimationFrame(pe):0,$||(Q=0)}function oe(m,S,z){let d=Object.assign({},M,x[m],z||{}),H=document.createElement("div");H.className="lucio-fx lucio-fx-"+m,H.setAttribute("role","img"),H.setAttribute("aria-label","Loading"),H.style.cssText="position:relative;display:inline-block;vertical-align:middle;flex:none";let D=document.createElement("canvas");D.style.cssText="position:absolute;pointer-events:none",H.appendChild(D),S.appendChild(H);let u=D.getContext("webgl",{premultipliedAlpha:!0,alpha:!0,antialias:!1});if(!u)return console.warn("LucioLoaders: WebGL unavailable"),null;let X=(k,K)=>{let W=u.createShader(k);if(u.shaderSource(W,K),u.compileShader(W),!u.getShaderParameter(W,u.COMPILE_STATUS))throw new Error(m+": "+u.getShaderInfoLog(W));return W},U=u.createProgram();if(u.attachShader(U,X(u.VERTEX_SHADER,"attribute vec2 a; void main(){ gl_Position = vec4(a, 0., 1.); }")),u.attachShader(U,X(u.FRAGMENT_SHADER,g+p[m])),u.linkProgram(U),!u.getProgramParameter(U,u.LINK_STATUS))throw new Error(m+": "+u.getProgramInfoLog(U));u.useProgram(U),u.bindBuffer(u.ARRAY_BUFFER,u.createBuffer()),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),u.STATIC_DRAW),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,u.FLOAT,!1,0,0);let q={},I=k=>k in q?q[k]:q[k]=u.getUniformLocation(U,k);if(m==="neon"){let k=[];for(let K=0;K<h;K++)k.push(...b((K+.5)*a/h));u.uniform2fv(I("uPts[0]"),new Float32Array(k))}let j=64,mt=new Float32Array(j).fill(-1e3),ft=new Uint8Array(j);m==="water"&&(u.bindTexture(u.TEXTURE_2D,u.createTexture()),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.REPEAT),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.uniform1i(I("uWet"),0));let vt=new Float32Array(c*4),ae=new Float32Array(c),ye=new Float32Array(c),Y=_(d),gt=(k,K,W)=>{if(W>=a-.5)return 1e3;let G=((k-K)%a+a)%a;return G<=W?Math.min(G,W-G):-Math.min(G-W,a-G)},ie=0,Ge=d.theme==="light"?!1:d.theme==="dark"?!0:C(S),Zt=0,bt=!0,xe=n.IntersectionObserver?new IntersectionObserver(k=>{bt=k[0].isIntersecting}):null;xe&&xe.observe(H);function yt(k){d.size=k;let K=Math.min(n.devicePixelRatio||1,2),W=k*y[m];H.style.width=H.style.height=k+"px",D.style.width=D.style.height=W+"px",D.style.left=D.style.top=-(W-k)/2+"px",D.width=D.height=Math.round(W*K),u.viewport(0,0,D.width,D.height),u.uniform2f(I("uRes"),D.width,D.height),u.uniform1f(I("uPx"),120/(k*D.width/W))}yt(d.size);function xt(k){if((d.theme==="auto"||!d.theme)&&++Zt%30===0&&(Ge=C(S)),!bt)return;k*=d.speed,ie+=k*(w()?.35:1),Y.step(k);let{a:K,len:W}=Y.units();if(u.uniform1f(I("uTime"),ie),u.uniform1f(I("uDark"),Ge?1:0),m==="water"){let le=A(Y.travel/70),B=A(Y.travel/70+.5);u.uniform3fv(I("uColor"),F(d.color)),u.uniform1f(I("uHead"),K+W),u.uniform1f(I("uLen"),W),u.uniform1f(I("uSurge"),Math.min(1,Math.max(0,Y.vHead/700))),u.uniform1f(I("uMid"),Y.travel),u.uniform1f(I("uFlowA"),le*70),u.uniform1f(I("uFlowB"),B*70),u.uniform1f(I("uFlowW"),1-Math.abs(2*B-1));for(let Z=0;Z<j;Z++)gt((Z+.5)*a/j,K,W)>-2&&(mt[Z]=ie),ft[Z]=Math.round(255*Math.exp(-(ie-mt[Z])/1.1));u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,j,1,0,u.LUMINANCE,u.UNSIGNED_BYTE,ft)}else if(m==="smoke"){u.uniform3fv(I("uColor"),F(d.color));let G=1-Math.exp(-k*20),le=Math.exp(-k*4.2);for(let B=0;B<c;B++){let Z=(B+.5)*a/c,Ve=N(-6,6,gt(Z,K,W));Ve>=ae[B]?(ae[B]+=(Ve-ae[B])*G,ye[B]*=Math.exp(-k*8)):(ae[B]=Math.max(Ve,ae[B]*le),ye[B]+=k);let Ze=f+10*ye[B],[Jt,$t]=b(Z);vt.set([Jt,$t+9*ye[B],Ze,ae[B]*(f*1.6/(Ze+.6*f))*(a/c)/(1.7725*Ze)],B*4)}u.uniform4fv(I("uPuff[0]"),vt)}else{let G=d.colors.map(F),le=G.length;u.uniform1f(I("uTR"),10.2*d.tube),u.uniform1f(I("uHum"),.975+.025*Math.sin(ie*46)*Math.sin(ie*7.3)+(P(Math.floor(ie*9))>.985?-.2:0)),u.uniform1f(I("uSegA"),K),u.uniform1f(I("uLen"),W),u.uniform3fv(I("uColB"),G[Y.i%le]),u.uniform3fv(I("uColA"),G[(Y.moving?Y.j:Y.i)%le]),u.uniform1f(I("uMix"),Y.moving?N(.05,.35,Y.f):1),u.uniform1f(I("uMove"),Y.moving?Math.sin(Math.PI*Y.f):0)}u.drawArrays(u.TRIANGLES,0,3)}let wt={frame:xt};return O.add(wt),$||($=requestAnimationFrame(pe)),{el:H,canvas:D,tick:xt,setColor(k){d.color=k,m==="neon"&&(d.colors=[k])},setColors(k){d.colors=k.slice()},setTiming({hold:k,morph:K}){k!=null&&(d.hold=k),K!=null&&(d.morph=K)},setSequence(k){d.sequence=k,Y.reset()},setSpeed(k){d.speed=k},setSize:yt,setTheme(k){d.theme=k,Ge=k==="light"?!1:k==="dark"?!0:C(S)},stop(){O.delete(wt),xe&&xe.disconnect(),H.remove();let k=u.getExtension("WEBGL_lose_context");k&&k.loseContext()}}}n.LucioLoaders={water:(m,S)=>oe("water",m,S),smoke:(m,S)=>oe("smoke",m,S),neon:(m,S)=>oe("neon",m,S),geometry:{HB:49.8,CR:16.2,HW:10.2,PER:a,pathP:b,LET:R}}})(window);var J={graphite:"#111114",graphite3:"#26262D",paper:"#F3F1EC",beam:"#FFF3CF",smoke:"#F5F5F2"};function we(){return window.LucioMorph??null}function se(n,e){let t=we();if(!t)return null;let i=document.createElement("span");i.className="wordmark-svg",i.setAttribute("aria-hidden","true"),n.appendChild(i);let s=t.wordmark(i,{trigger:"manual",color:J.paper,rays:J.beam});return s.svg.setAttribute("aria-hidden","true"),s.svg.removeAttribute("role"),e||s.set(1),n.classList.add("has-svg"),s}var Qt=44;function Mt(n){return Math.round(n.getBoundingClientRect().width)||Qt}function me(n){if(n.dataset.mounted==="1")return;let e=Mt(n),t=window.LucioLoaders,i=Array.from(n.childNodes);n.replaceChildren();let s=null;try{s=t?t.smoke(n,{size:e,theme:"dark",color:J.smoke}):null}catch{s=null}if(s){s.el.removeAttribute("role"),s.el.removeAttribute("aria-label");let r=s;if(typeof ResizeObserver=="function"){let o=e;new ResizeObserver(()=>{let a=Mt(n);a!==o&&(o=a,r.setSize(a))}).observe(n)}}else{n.replaceChildren();let r=we();if(r){let o=r.loader(n,{size:e,color:J.paper,track:null,rays:J.beam}).svg;o.setAttribute("aria-hidden","true"),o.style.width="100%",o.style.height="auto"}else n.append(...i)}n.dataset.mounted="1"}function ei(n){let e=n.seed+"|"+n.level+"|"+n.x+"|"+n.y,t=2166136261;for(let i=0;i<e.length;i++)t=Math.imul(t^e.charCodeAt(i),16777619)>>>0;return t}function ti(n,e){let t=new Array(n);for(let r=0;r<n;r++)t[r]=r;let i=e|0,s=()=>{i=i+1831565813|0;let r=Math.imul(i^i>>>15,1|i);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296};for(let r=n-1;r>0;r--){let o=Math.floor(s()*(r+1)),a=t[r];t[r]=t[o],t[o]=a}return t}function Lt(n,e,t,i,s){n.drawImage(e,0,0);let r=s.cell,o=Math.floor(t/r),a=Math.floor(i/r);if(o<2||a<2)return;let l=o*a,h=ti(l,ei(s));for(let c=0;c<l;c++){let f=h[c];if(f===c)continue;let b=c%o*r,g=Math.floor(c/o)*r,L=f%o*r,v=Math.floor(f/o)*r;n.drawImage(e,b,g,r,r,L,v,r,r)}}var Le=0,ke=1,V=class extends Error{constructor(){super("aborted"),this.name="AbortError"}};function ee(n){"close"in n?n.close():n instanceof HTMLCanvasElement&&(n.width=0,n.height=0)}async function Je(n){if(typeof createImageBitmap=="function")return createImageBitmap(n);let e=URL.createObjectURL(n);try{let t=new Image;return t.decoding="async",t.src=e,await t.decode(),t}finally{URL.revokeObjectURL(e)}}async function ii(n,e){let t=document.createElement("canvas");t.width=n.width,t.height=n.height;let i=t.getContext("2d");if(!i)return n;if(Lt(i,n,n.width,n.height,e),ee(n),typeof createImageBitmap=="function"){let s=await createImageBitmap(t);return t.width=0,t.height=0,s}return t}var Me=class{constructor(e,t){this.concurrency=e;this.byId=new Map;this.byKey=new Map;this.queue=[];this.workers=[];this.workersUnscramble=!0;this.running=0;this.nextKey=1;this.nextSeq=1;this.nextWorker=0;if(typeof Worker>"u"||t==="")return;let i=(navigator.hardwareConcurrency??2)>=4?2:1;for(let s=0;s<i;s++)try{let r=new Worker(t),o=this.workers.length;r.onmessage=a=>this.onReply(a.data,o),r.onerror=()=>this.dropWorker(o),this.workers.push(r)}catch{break}}request(e,t,i,s,r){return s.aborted?Promise.reject(new V):new Promise((o,a)=>{let l=this.byId.get(e);l?i<l.priority&&(l.priority=i):(l={key:this.nextKey++,id:e,url:t,scramble:r,priority:i,seq:this.nextSeq++,waiters:new Set,running:!1,worker:-1,controller:null},this.byId.set(e,l),this.byKey.set(l.key,l),this.queue.push(l));let h={resolve:o,reject:a};l.waiters.add(h);let c=l;s.addEventListener("abort",()=>{c.waiters.delete(h)&&(a(new V),c.waiters.size===0&&setTimeout(()=>{c.waiters.size===0&&this.byKey.get(c.key)===c&&this.cancel(c)},0))},{once:!0}),this.pump()})}cancelAll(){for(let e of[...this.byKey.values()]){let t=[...e.waiters];e.waiters.clear();for(let i of t)i.reject(new V);this.cancel(e)}}cancel(e){if(this.forget(e),!e.running){let t=this.queue.indexOf(e);t>=0&&this.queue.splice(t,1);return}e.running=!1,this.running--,e.controller?e.controller.abort():e.worker>=0&&this.workers[e.worker]&&this.workers[e.worker].postMessage({type:"abort",key:e.key}),this.pump()}forget(e){this.byId.get(e.id)===e&&this.byId.delete(e.id),this.byKey.delete(e.key)}pump(){for(;this.running<this.concurrency&&this.queue.length>0;){let e=0;for(let i=1;i<this.queue.length;i++){let s=this.queue[i],r=this.queue[e];(s.priority<r.priority||s.priority===r.priority&&s.seq<r.seq)&&(e=i)}let t=this.queue.splice(e,1)[0];t.running=!0,this.running++,this.start(t)}}start(e){let t=this.liveWorkers();if(t.length>0&&(!e.scramble||this.workersUnscramble)){let i=t[this.nextWorker++%t.length];e.worker=i,this.workers[i].postMessage({type:"fetch",key:e.key,url:e.url,scramble:e.scramble});return}this.runOnMainThread(e)}runOnMainThread(e){e.worker=-1,e.controller=new AbortController,this.fetchOnMainThread(e,e.controller.signal)}liveWorkers(){let e=[];return this.workers.forEach((t,i)=>{t&&e.push(i)}),e}dropWorker(e){let t=this.workers[e];if(t){t.terminate(),delete this.workers[e];for(let i of this.byKey.values())i.running&&i.worker===e&&this.runOnMainThread(i)}}async fetchOnMainThread(e,t){let i=performance.now();try{let s=await fetch(e.url,{signal:t,credentials:"same-origin"});if(!s.ok)throw new Error("HTTP "+s.status);let r=await s.blob(),o=performance.now()-i,a=await Je(r);e.scramble&&(a=await ii(a,e.scramble)),this.onReply({key:e.key,ok:!0,bitmap:a,bytes:r.size,ms:o},-1)}catch(s){this.onReply({key:e.key,ok:!1,bytes:0,ms:0,error:String(s)},-1)}}onReply(e,t){let i=this.byKey.get(e.key);if(!i||!i.running||i.worker!==t){e.bitmap&&ee(e.bitmap);return}if(!e.ok&&t>=0&&(e.error==="unsupported-bitmap"||e.error==="unsupported-offscreen")){e.error==="unsupported-bitmap"?this.dropWorker(t):(this.workersUnscramble=!1,this.runOnMainThread(i));return}i.running=!1,this.running--,this.forget(i);let s=[...i.waiters];if(i.waiters.clear(),e.ok&&e.bitmap){let r={bitmap:e.bitmap,bytes:e.bytes,ms:e.ms};for(let o of s)o.resolve(r);s.length===0&&ee(e.bitmap)}else{let r=new Error(e.error??"tile failed");for(let o of s)o.reject(r)}this.pump()}};var kt=1024*1024;function si(){let n=navigator.deviceMemory;if(typeof n=="number"&&n<=4)return!0;let e=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,t=Math.min(screen.width,screen.height);return e&&t<=820}function Et(){return si()?120*kt:250*kt}var Ee=class{constructor(e){this.budget=e;this.entries=new Map;this.used=0}get(e){let t=this.entries.get(e);return t&&(this.entries.delete(e),this.entries.set(e,t)),t}has(e){return this.entries.has(e)}put(e,t){let i=this.entries.get(e);if(i){i.bitmap!==t&&ee(t);return}let s=t.width*t.height*4;this.entries.set(e,{bitmap:t,bytes:s,at:performance.now()}),this.used+=s,this.trim(this.budget)}trim(e){for(;this.used>e&&this.entries.size>0;){let t=this.entries.keys().next();if(t.done)return;let i=this.entries.get(t.value);this.entries.delete(t.value),i&&(this.used-=i.bytes,ee(i.bitmap))}}};var At="luphoto.entropy";var ri=Math.cos(Math.PI/6),ni=100,oi=10,$e=class{constructor(){this.path=0;this.turns=0;this.cells=0;this.gestures=0;this.scrolls=0;this.keys=0;this.seen=new Uint32Array(128);this.lastX=0;this.lastY=0;this.hasLast=!1;this.segX=0;this.segY=0;this.prevX=0;this.prevY=0;this.hasPrev=!1;this.touchId=-1;this.touchX=0;this.touchY=0;this.touchMoved=!1;this.lastScroll=-1/0;this.memory=null;this.load();let e={passive:!0,capture:!0};addEventListener("pointermove",t=>this.onMove(t),e),addEventListener("pointerdown",t=>this.onDown(t),e),addEventListener("pointerup",t=>this.onUp(t),e),addEventListener("pointercancel",t=>this.onCancel(t),e),addEventListener("wheel",t=>this.onScroll(t),e),addEventListener("scroll",t=>this.onScroll(t),e),addEventListener("keydown",t=>this.onKey(t),e),addEventListener("pagehide",()=>this.save()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.save()})}onMove(e){if(!e.isTrusted)return;let t=e.clientX,i=e.clientY;if(e.pointerType!=="mouse"){e.pointerId===this.touchId&&!this.touchMoved&&Math.abs(t-this.touchX)+Math.abs(i-this.touchY)>oi&&(this.touchMoved=!0);return}let s=((t>>3)*73856093^(i>>3)*19349663)&4095,r=1<<(s&31);if(this.seen[s>>>5]&r||(this.seen[s>>>5]|=r,this.cells++),!this.hasLast){this.lastX=t,this.lastY=i,this.hasLast=!0;return}let o=t-this.lastX,a=i-this.lastY;if(this.lastX=t,this.lastY=i,o===0&&a===0)return;this.path+=Math.sqrt(o*o+a*a),this.segX+=o,this.segY+=a;let l=Math.sqrt(this.segX*this.segX+this.segY*this.segY);if(!(l<8)){if(this.hasPrev){let h=Math.sqrt(this.prevX*this.prevX+this.prevY*this.prevY);(this.segX*this.prevX+this.segY*this.prevY)/(l*h)<ri&&this.turns++}this.prevX=this.segX,this.prevY=this.segY,this.hasPrev=!0,this.segX=0,this.segY=0}}onDown(e){!e.isTrusted||e.pointerType==="mouse"||(this.touchId=e.pointerId,this.touchX=e.clientX,this.touchY=e.clientY,this.touchMoved=!1)}onUp(e){e.pointerId===this.touchId&&(this.touchMoved&&this.gestures++,this.touchId=-1)}onCancel(e){e.pointerId===this.touchId&&(this.gestures++,this.touchId=-1)}onScroll(e){e.isTrusted&&e.timeStamp-this.lastScroll>=ni&&(this.lastScroll=e.timeStamp,this.scrolls++)}onKey(e){e.isTrusted&&!e.repeat&&this.keys++}score(){let t=Math.min(25,this.path/120)+Math.min(35,this.turns*2.5)+Math.min(20,this.cells/6)+Math.min(45,this.gestures*8)+Math.min(15,this.scrolls*1.5)+Math.min(20,this.keys*2);return this.save(),Math.min(100,Math.round(t))}load(){let e=null;try{let i=sessionStorage.getItem(At);e=i?JSON.parse(i):null}catch{e=this.memory}if(!e)return;let t=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?i:0;this.path=t(e.p),this.turns=t(e.t),this.cells=t(e.c),this.gestures=t(e.g),this.scrolls=t(e.s),this.keys=t(e.k)}save(){let e={p:Math.round(this.path),t:this.turns,c:this.cells,g:this.gestures,s:this.scrolls,k:this.keys};this.memory=e;try{sessionStorage.setItem(At,JSON.stringify(e))}catch{return}}},Qe=null;function et(){Qe??(Qe=new $e)}function Ae(){return et(),Qe?Qe.score():0}var ai=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),st=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function St(n,e){for(let t=e;t<64;t++){let i=n[t-15],s=n[t-2],r=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,o=(s>>>17|s<<15)^(s>>>19|s<<13)^s>>>10;n[t]=n[t-16]+r+n[t-7]+o|0}}function rt(n,e,t,i){let s=n[0],r=n[1],o=n[2],a=n[3],l=n[4],h=n[5],c=n[6],f=n[7];for(let b=t;b<i;b++){let g=f+((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&h^~l&c)+ai[b]+e[b]|0,L=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&r^s&o^r&o)|0;f=c,c=h,h=l,l=a+g|0,a=o,o=r,r=s,s=g+L|0}n[0]=s,n[1]=r,n[2]=o,n[3]=a,n[4]=l,n[5]=h,n[6]=c,n[7]=f}var tt=new Int32Array(64),it=new Int32Array(8),te=new Int32Array(8);function li(n,e=new Uint8Array(32)){te.set(st);let t=n.length,i=Math.ceil((t+9)/64);for(let s=0;s<i;s++){let r=s*64;for(let o=0;o<16;o++){let a=0;for(let l=0;l<4;l++){let h=r+o*4+l,c=0;if(h<t)c=n[h];else if(h===t)c=128;else if(s===i-1&&h>=r+56){let f=h-r-56;c=f<3?0:f===3?t>>>29&255:t*8>>>(7-f)*8&255}a=a<<8|c}tt[o]=a}St(tt,16),it.set(te),rt(it,tt,0,64);for(let o=0;o<8;o++)te[o]=te[o]+it[o]|0}for(let s=0;s<8;s++)e[s*4]=te[s]>>>24,e[s*4+1]=te[s]>>>16&255,e[s*4+2]=te[s]>>>8&255,e[s*4+3]=te[s]&255;return e}var Ce=4294967296,Pe=class{constructor(e,t){this.w=new Int32Array(64);this.mid=new Int32Array(8);this.s=new Int32Array(8);let i=this.w;for(let s=0;s<8;s++)i[s]=e.charCodeAt(s*4)<<24|e.charCodeAt(s*4+1)<<16|e.charCodeAt(s*4+2)<<8|e.charCodeAt(s*4+3);i[10]=-2147483648,i[15]=320,this.mid.set(st),rt(this.mid,i,0,8),this.shift=32-Math.max(1,Math.min(32,t))}run(e,t,i){let s=this.w,r=this.s,o=this.mid,a=this.shift,l=st[0];s[8]=e|0;for(let h=t;h<i;h++)if(s[9]=h|0,St(s,16),r.set(o),rt(r,s,8,64),!(l+r[0]>>>a))return h;return-1}},Se="luphoto-sealed-1",Te=12;function Ie(n){let e=new Uint8Array(n.length>>>1);for(let t=0;t<e.length;t++)e[t]=parseInt(n.substr(t*2,2),16);return e}function nt(n){let e=atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function Tt(n,e){let t=nt(e);if(t.length<Te+Se.length)return null;let i=new Uint8Array(32+Te+4);i.set(n.subarray(0,32)),i.set(t.subarray(0,Te),32);let s=new Uint8Array(32),r=t.subarray(Te);for(let o=0,a=0;a<r.length;o++,a+=32){i[44]=o>>>24,i[45]=o>>>16&255,i[46]=o>>>8&255,i[47]=o&255,li(i,s);let l=Math.min(32,r.length-a);for(let h=0;h<l;h++)r[a+h]^=s[h];if(o===0){for(let h=0;h<Se.length;h++)if(r[h]!==Se.charCodeAt(h))return null}}return r.subarray(Se.length)}var at="luphoto.pass",lt="luphoto.nav",hi=3e4,ci=900,ui=16384,Pt="http://www.w3.org/2000/svg",di="Press and hold to see the photos",pi=/^[A-Za-z0-9_-]{32}$/,ht=null,fe=null,he=class extends Error{constructor(t,i){super("keys "+t);this.status=t;this.retryAfter=i}};function ze(){let n=ht;try{n=localStorage.getItem(at)??n}catch{n=ht}return n&&pi.test(n)?n:""}function He(n){ht=n;try{n?localStorage.setItem(at,n):localStorage.removeItem(at)}catch{return}}function Ct(n){fe=JSON.stringify({slug:n,at:Date.now()});try{sessionStorage.setItem(lt,fe)}catch{return}}function It(n){let e=fe;try{e=sessionStorage.getItem(lt)??e,sessionStorage.removeItem(lt)}catch{e=fe}if(fe=null,!e)return!1;try{let t=JSON.parse(e),i=Date.now()-Number(t.at);return t.slug===n&&i>=0&&i<=hi}catch{return!1}}async function ve(n){let e=await fetch("/k",{method:"POST",credentials:"same-origin",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw new he(e.status,Number(e.headers.get("Retry-After"))||0);return await e.json()}function ot(n){return new Promise(e=>{let t=new Pe(n.token,n.bits),i=0,s=0,r=()=>{let o=Math.min(Ce,s+ui),a=t.run(i,s,o);if(a>=0){e(i*Ce+a);return}s=o,s>=Ce&&(i++,s=0),setTimeout(r,0)};setTimeout(r,0)})}function mi(n,e){return n.token.length!==32||!(n.bits>=1&&n.bits<=32)?Promise.reject(new Error("puzzle")):typeof Worker>"u"||!e?ot(n):new Promise((t,i)=>{let s;try{s=new Worker(e)}catch{t(ot(n));return}s.onmessage=r=>{let o=r.data.pow;typeof o=="number"&&(s.terminate(),o<0?i(new Error("puzzle")):t(o))},s.onerror=()=>{s.terminate(),t(ot(n))},s.postMessage({type:"pow",token:n.token,bits:n.bits})})}var Re=null;function ut(n,e,t,i){if(Re)return Re.then(()=>null);let s=new Promise(r=>{let o=()=>{},a=new Promise(c=>{o=c}),l=new ct(()=>{o(),l.wait()},i?()=>r(null):null);(async()=>{let c=await n;for(;c.challenge;){let f=c.challenge,b=mi(f,t);await a,c=await e({token:f.token,nonce:await b})}return c})().then(c=>{l.dismiss(),r(c)},()=>{l.fail(),r(null)})});return Re=s,s.then(()=>{Re=null}),s}function Fe(n,e,t){n.addEventListener("click",i=>{let s=e();if(i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||!s)return;if(t.score()>=t.minEntropy()||ze()){Ct(s);return}i.preventDefault();let r=n.href,o=()=>({build:t.build,album:s,photos:[],context:"nav",entropy:t.score()});ut(ve(o()),a=>ve({...o(),challenge:a}),t.workerUrl,!0).then(a=>{a&&(a.pass&&He(a.pass),Ct(s),location.assign(r))})})}function fi(n,e){try{n.setPointerCapture(e)}catch{return}}var ct=class{constructor(e,t){this.onHeld=e;this.onCancel=t;this.inert=[];this.start=0;this.frame=0;this.holding=!1;this.finished=!1;this.gone=!1;this.onEscape=e=>{e.key==="Escape"&&!this.gone&&(e.preventDefault(),e.stopPropagation(),this.dismiss(),this.onCancel?.())};this.restore=document.activeElement;let i=document.createElement("div");i.className="gate",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-labelledby","gate-line");let s=document.createElement("div");s.className="gate-card";let r=document.createElement("p");r.className="gate-eyebrow",r.textContent="Photos \xB7 Lucio";let o=document.createElement("p");o.className="gate-line",o.id="gate-line",o.textContent=di;let a=document.createElement("button");a.type="button",a.className="gate-hold",a.setAttribute("aria-label","Hold to see the photos"),a.setAttribute("aria-describedby","gate-status");let l=document.createElementNS(Pt,"svg");l.setAttribute("viewBox","0 0 64 64"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");let h=(b,g)=>{let L=document.createElementNS(Pt,"circle");return L.setAttribute("class",b),L.setAttribute("cx","32"),L.setAttribute("cy","32"),L.setAttribute("r",g),L},c=h("gate-ring","28");c.setAttribute("pathLength","100"),l.append(h("gate-track","28"),c,h("gate-dot","6")),a.appendChild(l);let f=document.createElement("p");f.className="visually-hidden",f.id="gate-status",f.setAttribute("aria-live","polite"),s.append(r,o,a,f),i.appendChild(s),this.root=i,this.button=a,this.ring=c,this.status=f,this.text=o;for(let b of Array.from(document.body.children))b.hasAttribute("inert")||(b.setAttribute("inert",""),this.inert.push(b));document.body.appendChild(i),document.documentElement.classList.add("has-gate"),this.bind(),a.focus({preventScroll:!0})}bind(){let e=this.button;e.addEventListener("pointerdown",t=>{t.pointerType==="mouse"&&t.button!==0||(t.preventDefault(),fi(e,t.pointerId),this.press())});for(let t of["pointerup","pointercancel","lostpointercapture"])e.addEventListener(t,()=>this.release());e.addEventListener("keydown",t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),t.repeat||this.press())}),e.addEventListener("keyup",t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),this.release())}),e.addEventListener("blur",()=>this.release()),e.addEventListener("click",t=>t.preventDefault()),e.addEventListener("contextmenu",t=>t.preventDefault()),this.root.addEventListener("transitionend",t=>{t.target===this.root&&this.root.classList.contains("is-leaving")&&this.root.remove()}),this.onCancel&&document.addEventListener("keydown",this.onEscape,!0)}setProgress(e){this.ring.style.setProperty("stroke-dashoffset",String(100-Math.max(0,Math.min(1,e))*100))}press(){if(this.holding||this.finished)return;this.holding=!0,this.start=performance.now(),this.button.classList.add("is-pressed"),this.status.textContent="Keep holding";let e=t=>{if(!this.holding)return;let i=(t-this.start)/ci;if(this.setProgress(i),i>=1){this.holding=!1,this.finished=!0,this.frame=0,this.button.classList.remove("is-pressed"),this.onHeld();return}this.frame=requestAnimationFrame(e)};this.frame=requestAnimationFrame(e)}release(){this.holding&&(this.holding=!1,cancelAnimationFrame(this.frame),this.frame=0,this.button.classList.remove("is-pressed"),this.setProgress(0),this.status.textContent="")}wait(){this.root.classList.add("is-waiting"),this.setProgress(.28),this.status.textContent="One moment"}fail(){this.root.classList.remove("is-waiting"),this.finished=!0,this.setProgress(0),this.button.disabled=!0,this.text.textContent="Something went wrong. Reload the page to try again.",this.status.textContent=this.text.textContent}dismiss(){if(this.gone)return;this.gone=!0,document.removeEventListener("keydown",this.onEscape,!0),cancelAnimationFrame(this.frame);let e=this.root.contains(document.activeElement);for(let t of this.inert)t.removeAttribute("inert");document.documentElement.classList.remove("has-gate"),this.root.classList.add("is-leaving"),window.setTimeout(()=>this.root.remove(),400),e&&(this.restore instanceof HTMLElement&&this.restore!==document.body&&this.restore.isConnected?this.restore:document.querySelector("main"))?.focus({preventScroll:!0})}};var vi=400,ce=class{constructor(e,t=()=>!0){this.canShow=t;this.handle=null;this.loader=null;this.timer=0;this.hideTimer=0;this.visible=!1;this.element=document.createElement("div"),this.element.className="busy",this.element.setAttribute("role","status"),this.element.setAttribute("aria-label","Loading"),e.appendChild(this.element)}watch(e){if(e===this.loader){this.update(e);return}this.loader=e,clearTimeout(this.timer),this.timer=0,this.hide(),this.update(e)}update(e){if(!e||e!==this.loader)return;let t=e.status;if(!t.active||t.sharp){clearTimeout(this.timer),this.timer=0,this.hide();return}if(!this.visible&&this.timer===0){let i=Math.max(0,vi-(performance.now()-t.started));this.timer=window.setTimeout(()=>this.check(),i)}}check(){this.timer=0;let e=this.loader;if(!(!e||!e.status.active||e.status.sharp)){if(!this.canShow()){this.timer=window.setTimeout(()=>this.check(),100);return}this.show()}}show(){if(!this.visible){if(clearTimeout(this.hideTimer),this.visible=!0,!this.handle){let e=we();e&&(this.handle=e.loader(this.element,{size:56,color:J.paper,track:J.graphite3,rays:J.beam}),this.handle.svg.setAttribute("aria-hidden","true"))}this.element.classList.add("is-visible")}}hide(){this.visible&&(this.visible=!1,this.element.classList.remove("is-visible"),clearTimeout(this.hideTimer),this.hideTimer=window.setTimeout(()=>{!this.visible&&this.handle&&(this.handle.stop(),this.handle.svg.remove(),this.handle=null)},300))}},Ne=class{constructor(e){this.loader=null;this.shown=!1;this.value=-1;this.element=document.createElement("div"),this.element.className="progress",this.element.setAttribute("aria-hidden","true"),e.appendChild(this.element)}watch(e){this.loader=e,this.value=-1,this.update(e)}update(e){if(!e||e!==this.loader)return;let t=e.status,i=t.active&&!t.sharp&&t.planned>0,s=t.planned>0?Math.min(1,t.done/t.planned):0;i!==this.shown&&(this.shown=i,this.element.classList.toggle("is-visible",i));let r=Math.round(s*1e3)/1e3;r!==this.value&&(this.value=r,this.element.style.transform="scaleX("+(i?r:1)+")")}};function qe(n,e,t){let i=e*t;for(let s=0;s<n.levels.length;s++)if(n.levels[s].width>=i)return s;return n.levels.length-1}function ge(n,e){let t=n.tile_size,i=Math.max(0,e.u0*n.width),s=Math.min(n.width,e.u1*n.width),r=Math.max(0,e.v0*n.height),o=Math.min(n.height,e.v1*n.height);return s<=i||o<=r?null:{x0:Math.min(n.cols-1,Math.floor(i/t)),x1:Math.min(n.cols-1,Math.ceil(s/t)-1),y0:Math.min(n.rows-1,Math.floor(r/t)),y1:Math.min(n.rows-1,Math.ceil(o/t)-1)}}function Rt(n,e,t){let i=n.levels[e],s=i.tile_size,r=ge(i,t);if(!r)return[];let o=(t.u0+t.u1)/2*i.width,a=(t.v0+t.v1)/2*i.height,l=[];for(let h=r.y0;h<=r.y1;h++)for(let c=r.x0;c<=r.x1;c++){let f=(c*s+Math.min((c+1)*s,i.width))/2,b=(h*s+Math.min((h+1)*s,i.height))/2;l.push({level:e,x:c,y:h,index:h*i.cols+c,distance:(f-o)**2+(b-a)**2})}return l.sort((h,c)=>h.distance-c.distance),l.map(({level:h,x:c,y:f,index:b})=>({level:h,x:c,y:f,index:b}))}function zt(n,e,t,i,s,r){let o=n.tile_size,a=Math.round(i+e*o*r),l=Math.round(i+Math.min((e+1)*o,n.width)*r),h=Math.round(s+t*o*r),c=Math.round(s+Math.min((t+1)*o,n.height)*r);return l<=a||c<=h?null:{dx:a,dy:h,dw:l-a,dh:c-h}}function Ht(n,e,t,i,s,r,o,a){let l=t.tile_size,h=t.overlap??0,c=i*l,f=Math.min((i+1)*l,t.width),b=s*l,g=Math.min((s+1)*l,t.height),L=i>0?c-h:0,v=s>0?b-h:0,E=Math.round(r+c*a),p=Math.round(r+f*a),y=Math.round(o+b*a),x=Math.round(o+g*a);if(p<=E||x<=y)return;let M=Math.max(L,(E-r)/a),F=Math.min(L+e.width,(p-r)/a),w=Math.max(v,(y-o)/a),T=Math.min(v+e.height,(x-o)/a);F<=M||T<=w||n.drawImage(e,M-L,w-v,F-M,T-w,E,y,p-E,x-y)}var Ft="luphoto.throughput";function Nt(){try{let n=Number(sessionStorage.getItem(Ft));return Number.isFinite(n)&&n>0?n:null}catch{return null}}function dt(){return Nt()??1e3}function De(n){let e=Nt(),t=e===null?n:e*(1-.5)+n*.5;try{sessionStorage.setItem(Ft,String(t))}catch{return t}return t}var re=180,qt=400,gi=2e3,ne=16,pt="j:";function bi(n,e){return new Promise((t,i)=>{if(e.aborted){i(new V);return}let s=setTimeout(()=>{e.removeEventListener("abort",r),t()},n),r=()=>{clearTimeout(s),i(new V)};e.addEventListener("abort",r,{once:!0})})}function yi(n,e,t){return e.aborted?Promise.resolve(t):new Promise(i=>{let s=()=>i(t);e.addEventListener("abort",s,{once:!0}),n.then(r=>{e.removeEventListener("abort",s),i(r)})})}var Dt=3,We=4,xi=6e3,wi=4e3,Mi=1500,Li=.35;function ki(){let n=navigator.connection;return!!n&&(n.saveData===!0||/2g|3g/.test(n.effectiveType??""))}function Ei(){let n=navigator;return(n.hardwareConcurrency??4)<4?!1:typeof n.deviceMemory!="number"||n.deviceMemory>=4}function Wt(n,e){let t=0;for(let i of n)i.status==="fulfilled"&&(t+=i.value.bytes);return t>0&&e>0?t/e:0}var ue=class{constructor(e,t,i){this.pyramid=e;this.poolUrl=t;this.env=i;this.seedImage=null;this.seedPromise=null;this.seedAt=0;this.pool=null;this.sealed="";this.poolPromise=null;this.poolRetryAt=0;this.opened=null;this.ids=null;this.triedKey=null;this.jumbleLevel=-1;this.jumble=[];this.settling=!1;this.session=null;this.prefetchController=null;this.enhancer=null;this.enhanceLevel=-1;this.finalLevel=-1;this.targetLevel=-1;this.status={active:!1,started:0,planned:0,done:0,sharp:!1}}get stalled(){return!this.opened&&!this.settling}tileUrl(e){let t=this.env.tiles;return t.path+this.pyramid.hash+"/"+e+"."+t.format}ensurePool(){return this.pool?Promise.resolve(!0):(this.poolPromise||(this.poolPromise=fetch(this.poolUrl,{credentials:"same-origin"}).then(e=>e.ok?e.json():Promise.reject(new Error("pool"))).then(e=>{let t=this.pyramid.levels;if(!Array.isArray(e.levels)||e.levels.length!==t.length||typeof e.sealed!="string")throw new Error("pool");for(let i=0;i<t.length;i++)if(typeof e.levels[i]!="string"||e.levels[i].length<t[i].cols*t[i].rows*ne)throw new Error("pool");return this.pool=e.levels,this.sealed=e.sealed,this.env.requestDraw(),!0}).catch(()=>(this.poolPromise=null,this.poolRetryAt=performance.now()+gi,!1))),this.poolPromise)}open(){if(this.opened)return!0;let e=this.env.keys.key(this.pyramid.hash),t=this.pool;if(!e||!t||e===this.triedKey)return!1;this.triedKey=e;let i=Tt(e,this.sealed),s=null;if(i)try{s=JSON.parse(new TextDecoder().decode(i))}catch{s=null}let r=this.pyramid.levels;if(!s||!Array.isArray(s.levels)||s.levels.length!==r.length)return!1;let o=[];for(let a=0;a<r.length;a++){let l=s.levels[a].map,h=t[a].length/ne;if(!Array.isArray(l)||l.length!==r[a].cols*r[a].rows)return!1;let c=new Array(l.length);for(let f=0;f<l.length;f++){let b=l[f];if(!(b>=0&&b<h))return!1;c[f]=t[a].substr(b*ne,ne)}o.push(c)}return this.opened=s,this.ids=o,this.sealed="",this.ensureSeed(),!0}prepare(){if(!this.pool){!this.poolPromise&&performance.now()>=this.poolRetryAt&&this.ensurePool();return}this.opened||this.open()}ensureSeed(){return this.opened?(this.seedPromise||(this.seedPromise=this.decodeSeed().then(()=>{this.seedAt=performance.now(),this.env.requestDraw()},()=>{})),this.seedPromise):Promise.resolve()}async decodeSeed(){let e=this.opened?.seed;if(!e)return;let t=await Je(new Blob([nt(e)],{type:"image/"+this.env.tiles.format})),i=document.createElement("canvas");i.width=t.width*We,i.height=t.height*We;let s=i.getContext("2d");if(!s){this.seedImage=t;return}s.imageSmoothingEnabled=!0,s.imageSmoothingQuality="high","filter"in s&&(s.filter="blur("+We*.75+"px)");let r=We*2;s.drawImage(t,-r,-r,i.width+r*2,i.height+r*2),ee(t),this.seedImage=i}async request(e,t,i,s,r){let o=this.tileUrl(t),a;try{a=await this.env.scheduler.request(e,o,i,s,r)}catch(l){if(s.aborted||l instanceof V)throw l;await bi(qt+Math.random()*qt,s),a=await this.env.scheduler.request(e,o,i,s,r)}return this.env.cache.put(e,a.bitmap),this.env.requestDraw(),a}fetchTile(e,t,i){let s=this.ids,r=this.opened;if(!s||!r)return Promise.reject(new V);let o=s[e.level][e.index],a=this.env.tiles,l=a.cell??64,h=a.scrambled&&r.scramble&&this.pyramid.levels[e.level].tile_size>=2*l?{seed:r.scramble,level:e.level,x:e.x,y:e.y,cell:l}:void 0;return this.request(o,o,t,i,h)}fetchJumble(e,t,i){return this.request(pt+e,e,t,i)}uncached(e,t){let i=this.ids;return i?Rt(this.pyramid,e,t).filter(s=>!this.env.cache.has(i[e][s.index])):[]}uncachedBytes(e,t){let i=this.opened?.levels[e].bytes??[],s=0;for(let r of this.uncached(e,t))s+=i[r.index]??0;return s}chooseJumble(e,t){let i=this.pool;if(!i)return[];if(this.jumbleLevel<0){let s=this.probeLevel(e,t),r=this.pyramid.levels[s].cols*this.pyramid.levels[s].rows,o=i[s].length/ne,a=new Array(r);for(let l=0;l<r;l++){let h=Math.floor(Math.random()*o);a[l]=i[s].substr(h*ne,ne)}this.jumbleLevel=s,this.jumble=a}return Array.from(new Set(this.jumble)).filter(s=>!this.env.cache.has(pt+s))}probeLevel(e,t){return Math.max(0,qe(this.pyramid,e.displayWidth,t)-Dt)}notify(){this.env.onStatus?.(this)}track(e,t){return this.status.planned+=e.length,this.notify(),Promise.allSettled(e.map(i=>i().finally(()=>{this.session===t&&(this.status.done++,this.notify())})))}start(e,t,i,s=!1){this.stopSession();let r=new AbortController;this.session=r,this.targetLevel=-1,this.status.active=!0,this.status.started=performance.now(),this.status.planned=0,this.status.done=0,this.status.sharp=!1,this.notify(),this.run(e,t,r).then(o=>{let a=this.session===r;a&&(this.session=null,this.status.active=!1,this.notify()),(!r.signal.aborted||r.signal.reason==="deadline")&&i(),s&&a&&o&&!r.signal.aborted&&this.enhance(e,o)})}async run(e,t,i){let s=i.signal,r=performance.now(),o=this.env.settings.budgetMs,a=setTimeout(()=>i.abort("deadline"),o);try{let l=await yi(this.ensurePool(),s,!1);if(s.aborted||l&&!this.open()&&(this.settling=!0,await this.env.keys.settle(this.pyramid.hash,s),this.settling=!1,s.aborted))return null;if(!l||!this.open()){let p=this.chooseJumble(e,t);return await this.track(p.map(y=>()=>this.fetchJumble(y,Le,s)),i),null}if(await this.ensureSeed(),s.aborted)return null;let h=qe(this.pyramid,e.displayWidth,t),c=Math.max(0,h-Dt),f=this.uncached(c,e).slice(0,2);if(f.length>0){let p=await this.track(f.map(M=>()=>this.fetchTile(M,Le,s)),i),y=0,x=0;for(let M of p)M.status==="fulfilled"&&(y+=M.value.bytes,x=Math.max(x,M.value.ms));y>0&&x>0&&De(y/x)}if(s.aborted)return null;this.finalLevel=Math.max(this.finalLevel,c);let b=dt(),g=o-(performance.now()-r),L=c;for(let p=h;p>c;p--)if(this.uncachedBytes(p,e)/b<=g*.8){L=p;break}let v=[];L-c>=2&&v.push(Math.floor((c+L)/2)),L>c&&v.push(L),this.finalLevel=L,this.targetLevel=L,this.env.requestDraw();let E=0;for(let p of v){let y=this.uncached(p,e),x=performance.now(),M=await this.track(y.map(w=>()=>this.fetchTile(w,Le,s)),i);if(s.aborted)return null;let F=y.length>=2?Wt(M,performance.now()-x):0;F>0&&(E=De(F))}return{needed:h,final:L,throughput:E||dt()}}finally{clearTimeout(a)}}async enhance(e,t){if(!this.opened||ki())return;let i=this.pyramid.levels,{needed:s}=t,r=Ei()?Math.min(i.length-1,s+1):s;if(t.final>=r)return;this.enhancer?.abort();let o=new AbortController;this.enhancer=o;let a=o.signal,l=this.env.cache.budget*Li,h=t.throughput,c=0;for(let f=Math.max(t.final+1,s);f<=r;f++){let b=f>s;if(b){let p=i[f],y=p.width*(e.u1-e.u0)*p.height*(e.v1-e.v0)*4;if(h<Mi||y>l)break}if(c+=this.uncachedBytes(f,e)/h,c>(b?wi:xi))break;b&&(this.enhanceLevel=Math.max(this.enhanceLevel,f));let g=this.uncached(f,e),L=performance.now(),v=await Promise.allSettled(g.map(p=>this.fetchTile(p,ke,a)));if(a.aborted)return;let E=g.length>=2?Wt(v,performance.now()-L):0;E>0&&(h=De(E)),b||(this.finalLevel=Math.max(this.finalLevel,f))}this.enhancer===o&&(this.enhancer=null)}prefetchProbe(e,t){let s=this.resetPrefetch().signal;this.ensurePool().then(async r=>{if(!(s.aborted||!r||!this.open())&&(await this.ensureSeed(),!s.aborted))for(let o of this.uncached(this.probeLevel(e,t),e))this.fetchTile(o,ke,s).catch(()=>{})})}prefetchLevel(e,t){if(t<0||!this.opened)return;let i=this.resetPrefetch().signal;for(let s of this.uncached(t,e))this.fetchTile(s,ke,i).catch(()=>{})}resetPrefetch(){return this.prefetchController?.abort(),this.prefetchController=new AbortController,this.prefetchController}stopPrefetch(){this.prefetchController?.abort(),this.prefetchController=null}stopSession(){this.enhancer?.abort(),this.enhancer=null,this.session&&(this.session.abort("superseded"),this.session=null,this.status.active=!1,this.notify())}stop(){this.stopSession(),this.stopPrefetch()}drawJumble(e,t){if(this.jumbleLevel<0)return!1;let{g:i,originX:s,originY:r,width:o,now:a}=e,l=this.pyramid.levels[this.jumbleLevel],h=ge(l,t);if(!h)return!1;let c=o/l.width,f=this.env.cache,b=!1;i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="medium";for(let g=h.y0;g<=h.y1;g++)for(let L=h.x0;L<=h.x1;L++){let v=f.get(pt+this.jumble[g*l.cols+L]),E=v?zt(l,L,g,s,r,c):null;if(!v||!E)continue;let p=a-v.at;p<re&&(i.globalAlpha=Math.max(0,p/re),b=!0),i.drawImage(v.bitmap,0,0,v.bitmap.width,v.bitmap.height,E.dx,E.dy,E.dw,E.dh),i.globalAlpha=1}return b}draw(e){let{g:t,originX:i,originY:s,width:r,height:o,canvasWidth:a,canvasHeight:l}=e,h=Math.max(0,i),c=Math.max(0,s),f=Math.min(a,i+r),b=Math.min(l,s+o);if(f<=h||b<=c)return!1;this.prepare();let g={displayWidth:e.displayWidth,u0:(h-i)/r,u1:(f-i)/r,v0:(c-s)/o,v1:(b-s)/o},L=this.env.cache,v=this.pyramid.levels,E=this.ids,p=qe(this.pyramid,e.displayWidth,e.dpr),y=Math.max(p,Math.min(this.enhanceLevel,p+1)),x=-1;for(let T=y;E&&T>=0&&x<0;T--){let A=ge(v[T],g);if(!A)continue;let P=!0;for(let N=A.y0;N<=A.y1&&P;N++)for(let C=A.x0;C<=A.x1;C++){let R=L.get(E[T][N*v[T].cols+C]);if(!R||e.now-R.at<re){P=!1;break}}P&&(x=T)}let M=!1;if(x<0){if(t.save(),t.beginPath(),t.rect(h,c,f-h,b-c),t.clip(),M=this.drawJumble(e,g),this.seedImage){let T=e.now-this.seedAt;this.jumbleLevel>=0&&T<re&&(t.globalAlpha=Math.max(0,T/re),M=!0),t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="low",t.drawImage(this.seedImage,i,s,r,o),t.globalAlpha=1}t.restore()}let F=this.targetLevel>=0?Math.min(this.targetLevel,p):p,w=E!==null&&x>=F;if(w!==this.status.sharp&&(this.status.sharp=w,queueMicrotask(()=>this.notify())),!E)return M;for(let T=Math.max(0,x);T<=y;T++){let A=v[T],P=ge(A,g);if(!P)continue;let N=r/A.width;t.imageSmoothingEnabled=!0,t.imageSmoothingQuality=N<1?"high":"medium";for(let C=P.y0;C<=P.y1;C++)for(let R=P.x0;R<=P.x1;R++){let _=L.get(E[T][C*A.cols+R]);if(!_)continue;let O=e.now-_.at;O<re&&(t.globalAlpha=Math.max(0,O/re),M=!0),Ht(t,_.bitmap,A,R,C,i,s,N),t.globalAlpha=1}}return M}};var Ai=260,de=class{constructor(e,t,i,s,r,o){this.element=e;this.cover=t;this.focusY=i;this.onStatus=o;this.canvas=null;this.g=null;this.geometry=null;this.expanded=!1;this.canvasOpen=!1;this.near=!1;this.settleTimer=0;this.frame=0;this.loader=new ue(t,s,{...r,requestDraw:()=>this.requestDraw(),onStatus:()=>this.onStatus(this)})}get isOpen(){return this.expanded}get isNear(){return this.near}layout(e){let t=this.cover,i=Math.max(e.width/t.width,e.open/t.height),s=t.width*i,r=t.height*i,o=(e.open-r)/2,a=o+this.focusY*r,l=Math.max(0,Math.min(e.open-e.closed,a-e.closed/2)),h=this.geometry;this.geometry={width:e.width,closed:e.closed,open:e.open,dpr:e.dpr,coverWidth:s,coverHeight:r,x:(e.width-s)/2,y:o,band:l},this.canvas&&(this.sizeCanvas(this.canvasOpen),this.drawNow()),this.near&&h&&(h.width!==e.width||h.closed!==e.closed||h.open!==e.open||h.dpr!==e.dpr)&&this.startSession()}attach(){if(this.canvas)return;let e=document.createElement("canvas");e.className="strip-canvas",e.setAttribute("aria-hidden","true");let t=e.getContext("2d",{alpha:!1});t&&(this.canvas=e,this.g=t,this.element.prepend(e),this.sizeCanvas(this.expanded),this.drawNow())}detach(){this.canvas&&(cancelAnimationFrame(this.frame),this.frame=0,this.canvas.width=0,this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.g=null)}setNear(e){e!==this.near&&(this.near=e,e?this.startSession():this.loader.stop())}setOpen(e){if(e===this.expanded)return;this.expanded=e,this.element.classList.toggle("is-open",e),clearTimeout(this.settleTimer);let t=this.geometry,i=this.canvas;e?i&&this.canvasOpen?(i.style.transition="",i.style.transform="translate3d(0,0,0)"):i&&t&&(this.sizeCanvas(!0),i.style.transition="none",i.style.transform="translate3d(0,"+-t.band+"px,0)",this.drawNow(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.expanded&&this.canvas===i&&(i.style.transition="",i.style.transform="translate3d(0,0,0)")})})):i&&t&&(i.style.transition="",i.style.transform="translate3d(0,"+-t.band+"px,0)",this.settleTimer=window.setTimeout(()=>{!this.expanded&&this.canvas===i&&(this.sizeCanvas(!1),this.drawNow())},Ai)),this.near&&this.startSession()}sizeCanvas(e){let t=this.canvas,i=this.geometry;if(!t||!i)return;this.canvasOpen=e;let s=e?i.open:i.closed,r=Math.max(1,Math.round(i.width*i.dpr)),o=Math.max(1,Math.round(s*i.dpr));(t.width!==r||t.height!==o)&&(t.width=r,t.height=o),t.style.height=s+"px",e||(t.style.transition="none",t.style.transform="translate3d(0,0,0)")}view(){let e=this.geometry;if(!e)return null;let t=this.expanded?0:e.band,i=this.expanded?e.open:e.closed;return{displayWidth:e.coverWidth,u0:Math.max(0,-e.x/e.coverWidth),u1:Math.min(1,(e.width-e.x)/e.coverWidth),v0:Math.max(0,(t-e.y)/e.coverHeight),v1:Math.min(1,(t+i-e.y)/e.coverHeight)}}startSession(){let e=this.view();!e||!this.geometry||this.loader.start(e,this.geometry.dpr,()=>{})}requestDraw(){this.frame===0&&this.canvas&&(this.frame=requestAnimationFrame(e=>{this.frame=0,this.draw(e)&&this.requestDraw()}))}drawNow(){this.draw(performance.now())&&this.requestDraw()}draw(e){let t=this.g,i=this.canvas,s=this.geometry;if(!t||!i||!s)return!1;t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle="#111114",t.fillRect(0,0,i.width,i.height);let r=this.canvasOpen?0:-s.band;return this.loader.draw({g:t,originX:s.x*s.dpr,originY:(s.y+r)*s.dpr,width:s.coverWidth*s.dpr,height:s.coverHeight*s.dpr,canvasWidth:i.width,canvasHeight:i.height,displayWidth:s.coverWidth,dpr:s.dpr,now:e})}};function Ut(n){let e=n.dataset,t=(i,s)=>{let r=Number(i);return Number.isFinite(r)&&r>0?r:s};return{page:e.page??"",build:e.build??"",slug:e.album??"",manifestUrl:e.manifest??"",indexUrl:e.index??"",workerUrl:e.worker??"",budgetMs:t(e.budgetMs,3e3),maxDpr:t(e.maxDpr,2),concurrency:Math.max(1,Math.round(t(e.concurrency,6))),blockContextMenu:e.blockContextMenu!=="false",gate:e.gate==="off"?"off":"server",minEntropy:e.minEntropy&&Number.isFinite(Number(e.minEntropy))?Number(e.minEntropy):20}}function be(n,e,t){return"/a/"+encodeURIComponent(e)+"/p/"+t+"."+n+".json"}var Si=24,Ue=class{constructor(e,t,i,s){this.root=e;this.settings=i;this.env=s;this.strips=[];this.onScreen=new Set;this.inView=new Set;this.suspended=!1;this.wordmark=null;this.opened=null;this.scrollFrame=0;this.sizeKey="";let r=Array.from(e.querySelectorAll("a.strip")),o=new Map(t.albums.map(l=>[l.slug,l]));for(let l of r){let h=o.get(l.dataset.slug??"");!h||!h.cover||this.strips.push(new de(l,h.cover,h.collapsed_focus_y??.5,be(t.build,h.slug,h.cover.hash),s,c=>this.onStripStatus(c)))}this.hoverMode=matchMedia("(hover: hover) and (pointer: fine)");let a=document.querySelector(".site-header .wordmark");if(this.indicator=new ce(document.body,()=>!this.wordmarkMoving()),a){this.wordmark=se(a,!0);let l=()=>{this.wordmark&&!this.indicator.visible&&this.wordmark.play()},h=()=>this.wordmark?.reverse();a.addEventListener("mouseenter",l),a.addEventListener("mouseleave",h),a.addEventListener("focus",l),a.addEventListener("blur",h)}document.documentElement.classList.add("has-strips"),this.measure(),this.observe(),this.bind()}suspend(e){if(!this.suspended){this.suspended=!0;for(let t of this.strips)t.loader.stop(),e&&t.detach();this.env.scheduler.cancelAll(),this.env.cache.trim(e?0:this.env.cache.budget/4)}}resume(){if(this.suspended){this.suspended=!1;for(let e of this.strips)this.inView.has(e)&&e.attach(),e.isNear&&e.startSession()}}wordmarkMoving(){let e=this.wordmark?.t??0;return e>0&&e<1}measure(){let e=this.root.clientWidth||window.innerWidth,t=window.innerHeight,i=Math.round(Math.min(e*6/32,t*.28)),s=Math.round(Math.min(e*9/32,t*.62)),r=Math.min(window.devicePixelRatio||1,this.settings.maxDpr),o=e+"x"+i+"x"+s+"@"+r;if(o!==this.sizeKey){this.sizeKey=o,this.root.style.setProperty("--strip-closed",i+"px"),this.root.style.setProperty("--strip-open",s+"px");for(let a of this.strips)a.layout({width:e,closed:i,open:s,dpr:r})}}observe(){let e=new Map(this.strips.map(r=>[r.element,r])),t=new IntersectionObserver(r=>{for(let o of r)e.get(o.target)?.setNear(o.isIntersecting)},{rootMargin:"100% 0px"}),i=new IntersectionObserver(r=>{for(let o of r){let a=e.get(o.target);a&&(o.isIntersecting?(this.inView.add(a),this.suspended||a.attach()):(this.inView.delete(a),a.detach()))}},{rootMargin:"25% 0px"}),s=new IntersectionObserver(r=>{for(let o of r){let a=e.get(o.target);a&&(o.isIntersecting?this.onScreen.add(a):this.onScreen.delete(a))}this.watchFirst(),this.scheduleCentre()});for(let r of this.strips)t.observe(r.element),i.observe(r.element),s.observe(r.element)}watchFirst(){let e=this.strips.find(t=>this.onScreen.has(t))??null;this.indicator.watch(e?e.loader:null)}onStripStatus(e){this.indicator.update(e.loader)}bind(){for(let e of this.strips){let t=e.element;t.addEventListener("mouseenter",()=>{this.hoverMode.matches&&this.open(e)}),t.addEventListener("mouseleave",()=>{this.hoverMode.matches&&this.opened===e&&this.open(null)}),t.addEventListener("focus",()=>this.open(e)),t.addEventListener("blur",()=>{this.opened===e&&!this.hoverMode.matches?this.scheduleCentre():this.opened===e&&this.open(null)}),t.addEventListener("dragstart",i=>i.preventDefault()),this.settings.blockContextMenu&&t.addEventListener("contextmenu",i=>i.preventDefault())}window.addEventListener("scroll",()=>this.scheduleCentre(),{passive:!0}),new ResizeObserver(()=>{this.measure(),this.scheduleCentre()}).observe(this.root)}open(e){e!==this.opened&&(this.opened?.setOpen(!1),this.opened=e,e?.setOpen(!0))}scheduleCentre(){this.hoverMode.matches||this.scrollFrame!==0||(this.scrollFrame=requestAnimationFrame(()=>{this.scrollFrame=0,this.pickCentre()}))}pickCentre(){if(this.hoverMode.matches)return;let e=window.innerHeight/2,t=null,i=1/0,s=1/0;for(let r of this.onScreen){let o=r.element.getBoundingClientRect(),a=Math.abs(o.top+o.height/2-e);a<i&&(i=a,t=r),r===this.opened&&(s=a)}t&&t!==this.opened&&i+Si<s&&this.open(t)}};function Ke(n){let e=/^[0-9a-f]{64}$/.test(n)?Ie(n):null;return{key:()=>e,settle:()=>Promise.resolve()}}var Ti=8,Pi=400,Ci=2e3,Ot=/^[0-9a-f]{64}$/,Oe=class{constructor(e,t,i,s){this.gate=e;this.slug=t;this.context=i;this.workerUrl=s;this.keys=new Map;this.inflight=new Set;this.waiters=new Set;this.listeners=[];this.queue=[];this.busy=!1;this.blocked=!1;this.failed=!1;this.pausedUntil=0;this.page="";if(this.server=e.mode!=="off",!this.server)for(let[r,o]of Object.entries(e.keys??{}))Ot.test(o)&&this.keys.set(r,Ie(o))}onKeys(e){this.listeners.push(e)}key(e){return this.keys.get(e)??null}has(e){return this.keys.has(e)}want(e,t){if(!this.server||e.every(s=>this.keys.has(s)||this.inflight.has(s)))return;let i=s=>!this.keys.has(s)&&!this.inflight.has(s);this.queue=Array.from(new Set(e.concat(t))).filter(i),this.pump()}settle(e,t){return new Promise(i=>{if(this.keys.has(e)||this.blocked||this.failed||t.aborted){i();return}let s=()=>{clearTimeout(o),this.waiters.delete(r),t.removeEventListener("abort",s),i()},r=()=>{(this.keys.has(e)||this.blocked||this.failed)&&s()},o=window.setTimeout(s,Pi);this.waiters.add(r),t.addEventListener("abort",s,{once:!0})})}wake(){for(let e of Array.from(this.waiters))e()}body(e,t){let i={build:this.gate.build,album:this.slug,photos:e,context:this.context,entropy:Ae()};return t&&(i.pass=t),this.page&&(i.page=this.page),i}pump(){if(this.busy||this.blocked||this.failed||this.queue.length===0||performance.now()<this.pausedUntil)return;let e=this.queue.slice(0,Ti);this.queue=[],this.send(e)}pause(e,t){this.pausedUntil=performance.now()+e,window.setTimeout(()=>{this.queue=Array.from(new Set(t.concat(this.queue))).filter(i=>!this.keys.has(i)&&!this.inflight.has(i)),this.pump()},e)}async send(e){this.busy=!0;for(let s of e)this.inflight.add(s);let t=[],i=0;try{let s=ze(),r=await ve(this.body(e,s));if(this.absorb(r,s),r.challenge){this.blocked=!0,this.wake();let o=await ut(Promise.resolve(r),a=>ve({...this.body(e,""),challenge:a}),this.workerUrl,!1);this.blocked=!1,o?this.absorb(o,""):this.failed=!0}}catch(s){s instanceof he&&s.status===429?(i=Math.max(1,s.retryAfter)*1e3,t=e):s instanceof he&&s.status>=400&&s.status<500?this.failed=!0:(i=Ci,t=e)}finally{for(let s of e)this.inflight.delete(s);this.busy=!1,this.wake()}i>0?this.pause(i,t.filter(s=>!this.keys.has(s))):this.pump()}absorb(e,t){e.stale&&t&&ze()===t&&He(null),e.pass&&He(e.pass),e.page&&(this.page=e.page);let i=[];for(let[s,r]of Object.entries(e.keys??{}))Ot.test(r)&&!this.keys.has(s)&&(this.keys.set(s,Ie(r)),i.push(s));if(i.length>0){this.wake();for(let s of this.listeners)s(i)}}};var Ii=/[㐀-鿿豈-﫿]/;function Be(n,e){Ii.test(e)?n.lang="zh":n.removeAttribute("lang")}function Kt(n){return n<10?"0"+n:String(n)}function Ri(n){let e=(n.model??"").trim(),t=(n.make??"").trim(),i=t.split(/\s+/)[0]??"";i&&e.toLowerCase().startsWith(i.toLowerCase()+" ")&&(e=e.slice(i.length+1).trim());let s=/^([A-Za-z]{1,3}) (\d+[A-Za-z0-9]*)$/.exec(e);return s&&(e=s[1]+s[2]),e||t}function zi(n){let e=/(\d+(?:\.\d+)?(?:-\d+(?:\.\d+)?)?)\s*mm\s*(?:F|f\/?)\s*([\d.]+(?:-[\d.]+)?)/.exec(n);return e?e[1]+" f/"+e[2]:n.trim()}function _e(n){return String(Math.round(n*10)/10)}function Hi(n){let e=n.trim();if(e.includes("/")||e.endsWith("s"))return e;let t=Number(e);if(!Number.isFinite(t)||t<=0)return e;if(t>=1)return _e(t)+"s";let i=1/t;return i<10&&Math.abs(i-Math.round(i))>.05?"1/"+_e(i):"1/"+Math.round(i)}function Fi(n,e,t,i){let s=[Kt(n+1)+" / "+Kt(e)],r=t.exif;if(i&&r){let o=Ri(r);o&&s.push(o),r.lens&&s.push(zi(r.lens)),r.focal_length&&s.push(_e(r.focal_length)+"mm"),r.f_number&&s.push("f/"+_e(r.f_number)),r.exposure&&s.push(Hi(r.exposure)),r.iso&&s.push("ISO "+r.iso)}return s.join(" \xB7 ")}function Ni(n,e){n.textContent="",e.split(/\r?\n/).forEach((t,i)=>{i>0&&n.appendChild(document.createElement("br"));let s=t.split("*"),r=(s.length-1)%2===0;s.forEach((o,a)=>{let l=a%2===1;if(l&&(r||a!==s.length-1)){let h=document.createElement("em");h.textContent=o,n.appendChild(h)}else n.appendChild(document.createTextNode((l?"*":"")+o))})})}var Xe=class{constructor(e){this.visible=!1;this.placement="";this.element=document.createElement("section"),this.element.className="caption",this.element.setAttribute("aria-label","Caption"),this.meta=document.createElement("p"),this.meta.className="caption-meta",this.title=document.createElement("h2"),this.title.className="caption-title",this.text=document.createElement("p"),this.text.className="caption-text",this.element.append(this.meta,this.title,this.text),e.appendChild(this.element)}set(e,t,i,s){this.meta.textContent=Fi(t,i,e,s),this.title.textContent=e.title??"",this.title.hidden=!e.title,Be(this.title,e.title??""),Ni(this.text,e.caption??""),this.text.hidden=!e.caption,Be(this.text,e.caption??"")}show(e){e!==this.visible&&(this.visible=e,this.element.classList.toggle("is-visible",e))}place(e,t,i){let s=Math.round(e)+","+Math.round(t)+","+Math.round(i);if(s===this.placement)return;this.placement=s;let r=this.element.style;r.width=Math.round(t)+"px",r.transform="translate3d("+Math.round(e)+"px,"+-Math.round(i)+"px,0)"}};var Ye=24,Bt=10,qi=300,Di=.35,_t=.35,Wi=.2,Ui=2500,Oi=120,Ki=16,Bi=.002,_i=.01;function Xi(n,e,t,i){let s=3*n,r=3*(t-n)-s,o=1-s-r,a=3*e,l=3*(i-e)-a,h=1-a-l,c=g=>((o*g+r)*g+s)*g,f=g=>((h*g+l)*g+a)*g,b=g=>(3*o*g+2*r)*g+s;return g=>{if(g<=0)return 0;if(g>=1)return 1;let L=g;for(let p=0;p<8;p++){let y=c(L)-g,x=b(L);if(Math.abs(y)<1e-5)return f(L);if(Math.abs(x)<1e-6)break;L-=y/x}let v=0,E=1;L=g;for(let p=0;p<24;p++){let y=c(L);if(Math.abs(y-g)<1e-5)break;y<g?v=L:E=L,L=(v+E)/2}return f(L)}}var Yi=Xi(.16,1,.3,1),je=class{constructor(e,t,i,s,r,o){this.stage=e;this.manifest=t;this.settings=i;this.env=s;this.keys=r;this.nextStrip=null;this.nextSlug="";this.idleTimer=0;this.announceTimer=0;this.suspended=!1;this.layouts=[];this.stops=[];this.endLeft=0;this.vw=0;this.vh=0;this.dpr=1;this.camera=0;this.current=0;this.tween=null;this.frame=0;this.pointerId=null;this.pointerType="";this.dragging=!1;this.downX=0;this.downY=0;this.downT=0;this.downCamera=0;this.samples=[];this.hover=!1;this.pinned=!1;this.resizeTimer=0;this.indexRequested=!1;this.ox=0;this.oy=0;this.secondId=null;this.ax=0;this.ay=0;this.bx=0;this.by=0;this.pinching=!1;this.stale=!1;this.zoom=1;this.zoomMax=1;this.zoomPhoto=-1;this.zx=0;this.zy=0;this.slackX=0;this.slackY=0;this.zoomTimer=0;this.gestureZoom=1;this.canvas=document.createElement("canvas"),this.canvas.className="stage-canvas",this.canvas.setAttribute("role","img"),this.announcer=document.createElement("p"),this.announcer.className="visually-hidden",this.announcer.setAttribute("aria-live","polite"),this.announcer.setAttribute("aria-atomic","true"),this.fade=document.createElement("canvas"),this.fade.className="stage-fade",this.fade.setAttribute("aria-hidden","true"),this.fade.width=1,this.fade.height=1;let a=this.canvas.getContext("2d",{alpha:!1});if(!a)throw new Error("canvas 2d unavailable");this.g=a,this.signoffMark=document.createElement("span"),this.signoffMark.className="chop",this.signoffMark.setAttribute("aria-hidden","true"),this.endCard=this.buildEndCard(),this.nextLink=this.endCard.querySelector("a.next-album"),this.nextFrame=this.endCard.querySelector(".next-strip"),e.prepend(this.canvas,this.fade),e.appendChild(this.endCard),e.appendChild(this.announcer),this.caption=new Xe(e),this.progress=new Ne(document.body),this.indicator=new ce(document.body),this.homeMark=document.querySelector(".home-mark"),this.homeMark&&se(this.homeMark,!1),this.loaders=new Array(t.photos.length),this.reducedMotion=matchMedia("(prefers-reduced-motion: reduce)"),this.measure(),this.current=this.stopForHash(),this.camera=this.stops[this.current].camera,r.onKeys(l=>this.onKeys(l)),o&&Fe(this.nextLink,()=>this.nextSlug,o),this.bind(),this.activate(-1),this.requestDraw(),this.wake(),this.loadNextAlbum()}buildEndCard(){let e=document.createElement("section");e.className="end-card",e.setAttribute("aria-label","End of album");let t=document.createElement("a");t.className="next-album",t.href="/";let i=document.createElement("span");i.className="next-strip";let s=document.createElement("span");s.className="next-text";let r=document.createElement("span");r.className="next-eyebrow",r.textContent="All albums";let o=document.createElement("span");o.className="next-title",s.append(r,o),i.appendChild(s),t.appendChild(i);let a=document.createElement("div");a.className="signoff",a.appendChild(this.signoffMark);let l=document.createElement("p");return l.className="signature",l.textContent="\u2014 Lucio",a.appendChild(l),e.append(t,a),e}loader(e){let t=this.loaders[e];if(!t){let i=this.manifest.photos[e];t=new ue(i,be(this.manifest.build,this.manifest.slug,i.hash),{...this.env,requestDraw:()=>this.requestDraw(),onStatus:s=>{this.indicator.update(s),this.progress.update(s)}}),this.loaders[e]=t}return t}measure(){let e=this.stage.getBoundingClientRect();this.vw=Math.max(1,e.width),this.vh=Math.max(1,e.height),this.ox=e.left,this.oy=e.top,this.dpr=Math.min(window.devicePixelRatio||1,this.settings.maxDpr);let t=Math.max(1,Math.round(this.vw*this.dpr)),i=Math.max(1,Math.round(this.vh*this.dpr));(this.canvas.width!==t||this.canvas.height!==i)&&(this.canvas.width=t,this.canvas.height=i),this.layouts=[],this.stops=[];let s=0;this.manifest.photos.forEach((r,o)=>{let a=Math.max(1,r.slides||1),l=Math.min(this.vw/(r.width/a),this.vh/r.height),h=r.width*l,c=r.height*l,f=h/a,b=s+Ye/2+(this.vw-f)/2;this.layouts.push({scale:l,width:h,height:c,section:f,slides:a,start:s,left:b,top:(this.vh-c)/2});for(let g=0;g<a;g++)this.stops.push({photo:o,slide:g,camera:s+Ye/2+this.vw/2+g*f});s+=this.vw+(a-1)*f+Ye}),this.endLeft=s+Ye/2,this.stops.push({photo:-1,slide:0,camera:this.endLeft+this.vw/2}),this.endCard.style.width=this.vw+"px",this.layoutNextStrip()}layoutNextStrip(){if(!this.nextStrip)return;let e=Math.max(1,Math.min(this.vw-64,1200)),t=Math.round(Math.min(e*6/32,this.vh*.28));this.nextFrame.style.width=e+"px",this.nextFrame.style.height=t+"px",this.nextStrip.layout({width:e,closed:t,open:Math.round(t*9/6),dpr:this.dpr})}syncNextStrip(){let e=this.nextStrip;if(!e)return;let t=this.stops[this.current],i=t.photo<0||t.photo===this.manifest.photos.length-1;i?e.attach():e.detach(),e.setNear(i)}wake(){document.body.classList.remove("is-idle"),clearTimeout(this.idleTimer),this.idleTimer=window.setTimeout(()=>{this.pointerId===null&&document.body.classList.add("is-idle")},Ui)}stopForHash(){let e=/^#(\d+)$/.exec(location.hash);if(!e)return 0;let t=Math.min(this.manifest.photos.length,Math.max(1,Number(e[1])))-1,i=this.stops.findIndex(s=>s.photo===t);return i<0?0:i}bind(){let e=this.stage;e.addEventListener("pointerdown",t=>this.onPointerDown(t)),e.addEventListener("pointermove",t=>this.onPointerMove(t)),e.addEventListener("pointerup",t=>this.onPointerUp(t,!1)),e.addEventListener("pointercancel",t=>this.onPointerUp(t,!0)),e.addEventListener("pointerleave",t=>{t.pointerType==="mouse"&&this.pointerId===null&&(this.hover=!1,this.updateCaption())}),e.addEventListener("wheel",t=>this.onWheel(t),{passive:!1}),e.addEventListener("gesturestart",t=>{t.preventDefault(),this.gestureZoom=this.zoom}),e.addEventListener("gesturechange",t=>this.onGesture(t)),e.addEventListener("gestureend",t=>t.preventDefault()),e.addEventListener("dragstart",t=>t.preventDefault()),e.addEventListener("selectstart",t=>t.preventDefault()),this.settings.blockContextMenu&&e.addEventListener("contextmenu",t=>t.preventDefault()),window.addEventListener("keydown",t=>this.onKey(t)),window.addEventListener("hashchange",()=>{let t=this.stopForHash();this.stops[t].photo!==this.stops[this.current].photo?this.jump(t):this.clearZoom()&&(this.startSession(),this.updateCaption())}),new ResizeObserver(()=>this.onResize()).observe(e),this.fade.addEventListener("transitionend",()=>{this.fade.style.opacity==="0"&&(this.fade.width=1,this.fade.height=1)})}onResize(){let e=this.vw+"x"+this.vh+"@"+this.dpr;this.measure(),e!==this.vw+"x"+this.vh+"@"+this.dpr&&(this.clearZoom(),this.tween=null,this.camera=this.stops[this.current].camera,this.requestDraw(),clearTimeout(this.resizeTimer),this.resizeTimer=window.setTimeout(()=>this.startSession(),200))}onKey(e){if(e.altKey||e.ctrlKey||e.metaKey)return;this.wake();let t=e.target;if(!(t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)))){switch(e.key){case"ArrowRight":this.go(this.current+1);break;case"ArrowLeft":this.go(this.current-1);break;case"Home":this.go(0);break;case"End":this.go(this.stops.length-2);break;case"Escape":this.zoomPhoto>=0?this.go(this.current):location.assign("/");break;case"i":case"I":this.pinned=!this.pinned,this.updateCaption();break;default:return}e.preventDefault()}}onPointerDown(e){if(!(e.pointerType==="mouse"&&e.button!==0)){if(this.pointerId!==null){this.secondId===null&&e.pointerType!=="mouse"&&this.pointerType!=="mouse"&&!this.stale&&(this.zoomPhoto>=0||!this.dragging&&this.enterZoom())&&(this.secondId=e.pointerId,this.bx=e.clientX,this.by=e.clientY,this.pinching=!0,this.dragging=!0,this.stage.setPointerCapture(e.pointerId));return}e.target.closest("a, button")||(this.pointerId=e.pointerId,this.pointerType=e.pointerType,this.dragging=!1,this.stale=!1,this.downX=e.clientX,this.downY=e.clientY,this.ax=e.clientX,this.ay=e.clientY,this.downT=e.timeStamp,this.tween=null,this.downCamera=this.camera,this.samples=[{t:e.timeStamp,x:e.clientX}],this.stage.setPointerCapture(e.pointerId))}}onPointerMove(e){if(e.pointerType==="mouse"&&this.wake(),this.pointerId===null){e.pointerType==="mouse"&&(this.hover=this.inCaptionZone(e.clientX,e.clientY),this.updateCaption());return}if(this.pinching&&(e.pointerId===this.pointerId||e.pointerId===this.secondId)){this.pinchMove(e.pointerId,e.clientX,e.clientY);return}if(e.pointerId!==this.pointerId||this.stale)return;let t=e.clientX-this.downX,i=e.clientY-this.downY;if(!this.dragging&&Math.hypot(t,i)>=Bt&&(this.dragging=!0,this.stage.classList.add("is-dragging"),this.updateCaption()),!this.dragging){this.ax=e.clientX,this.ay=e.clientY;return}if(this.zoomPhoto>=0){this.zx+=e.clientX-this.ax,this.zy+=e.clientY-this.ay,this.ax=e.clientX,this.ay=e.clientY,this.settleZoom();return}for(this.samples.push({t:e.timeStamp,x:e.clientX});this.samples.length>2&&e.timeStamp-this.samples[0].t>100;)this.samples.shift();this.camera=this.rubber(this.downCamera-t),this.requestDraw()}onPointerUp(e,t){if(this.pinching&&(e.pointerId===this.pointerId||e.pointerId===this.secondId)){this.endPinch(e.pointerId);return}if(e.pointerId!==this.pointerId)return;this.stage.hasPointerCapture(e.pointerId)&&this.stage.releasePointerCapture(e.pointerId),this.pointerId=null;let i=this.dragging;if(this.dragging=!1,this.stage.classList.remove("is-dragging"),this.stale){this.stale=!1;return}let s=Math.hypot(e.clientX-this.downX,e.clientY-this.downY);if(!t&&!i&&s<Bt&&e.timeStamp-this.downT<qi){this.onTap(e);return}if(!i||this.zoomPhoto>=0)return;let r=0,o=this.samples[0],a=this.samples[this.samples.length-1];o&&a&&a.t>o.t&&e.timeStamp-a.t<100&&(r=(a.x-o.x)/(a.t-o.t));let l=this.nearestStop(this.camera);if(!t&&Math.abs(r)>Di)if(r<0){let h=this.stops.findIndex(c=>c.camera>this.camera+1);l=h<0?this.stops.length-1:h}else{let h=0;this.stops.forEach((c,f)=>{c.camera<this.camera-1&&(h=f)}),l=h}this.pointerType==="mouse"&&(this.hover=this.inCaptionZone(e.clientX,e.clientY)),this.go(l)}onTap(e){let t=this.stops[this.current];if(t.photo<0||this.zoomPhoto>=0)return;let i=this.photoRect(t.photo);e.clientX>=i.left&&e.clientX<=i.right&&e.clientY>=i.top&&e.clientY<=i.bottom&&(this.pinned=!this.pinned,this.updateCaption())}onWheel(e){if(e.preventDefault(),this.pinching||this.dragging&&this.zoomPhoto<0)return;let t=e.deltaY;if(e.deltaMode===1?t*=Ki:e.deltaMode===2&&(t*=this.vh),t===0)return;let i=Math.max(-1,Math.min(1,t*(e.ctrlKey?_i:Bi))),s=e.clientX-this.ox,r=e.clientY-this.oy;this.zoomTo(this.zoom*Math.exp(-i),s,r,s,r)}onGesture(e){if(e.preventDefault(),this.pointerId!==null||!e.scale)return;let t=(e.clientX??this.ox+this.vw/2)-this.ox,i=(e.clientY??this.oy+this.vh/2)-this.oy;this.zoomTo(this.gestureZoom*e.scale,t,i,t,i)}pinchMove(e,t,i){let s=(this.ax+this.bx)/2-this.ox,r=(this.ay+this.by)/2-this.oy,o=Math.hypot(this.ax-this.bx,this.ay-this.by);e===this.pointerId?(this.ax=t,this.ay=i):(this.bx=t,this.by=i);let a=Math.hypot(this.ax-this.bx,this.ay-this.by),l=o>1&&a>1?this.zoom*a/o:this.zoom;this.zoomTo(l,s,r,(this.ax+this.bx)/2-this.ox,(this.ay+this.by)/2-this.oy)}endPinch(e){this.stage.hasPointerCapture(e)&&this.stage.releasePointerCapture(e),e===this.pointerId&&(this.pointerId=this.secondId,this.ax=this.bx,this.ay=this.by),this.secondId=null,this.pinching=!1,this.dragging=!0,this.zoomPhoto>=0&&this.settleZoom()}enterZoom(){let e=this.stops[this.current];if(e.photo<0||this.suspended)return!1;let t=this.layouts[e.photo],i=this.manifest.photos[e.photo].width/(window.devicePixelRatio||1)/t.width;return i<=1.001?!1:(this.tween=null,this.camera=e.camera,this.zoomPhoto=e.photo,this.zoomMax=i,this.zoom=1,this.zx=t.left-(this.camera-this.vw/2),this.zy=t.top,this.slackX=this.zx-this.clampAxis(this.zx,t.width,this.vw,0),this.slackY=this.zy-this.clampAxis(this.zy,t.height,this.vh,0),this.updateCaption(),!0)}zoomTo(e,t,i,s,r){if(this.zoomPhoto<0&&(e<=1||!this.enterZoom()))return;let o=Math.max(1,Math.min(this.zoomMax,e)),a=o/this.zoom;this.zx=s-(t-this.zx)*a,this.zy=r-(i-this.zy)*a,this.zoom=o,this.settleZoom()}settleZoom(){let e=this.layouts[this.zoomPhoto];if(this.zx=this.clampAxis(this.zx,e.width*this.zoom,this.vw,this.slackX),this.zy=this.clampAxis(this.zy,e.height*this.zoom,this.vh,this.slackY),this.requestDraw(),this.zoom<=1&&!this.pinching){this.camera=e.left+this.vw/2-this.zx,this.go(this.nearestStop(this.camera));return}clearTimeout(this.zoomTimer),this.zoomTimer=window.setTimeout(()=>this.startZoomSession(),Oi)}clampAxis(e,t,i,s){let r=(i-t)/2,o=Math.min(i-t,r),a=Math.max(0,r),l=s*Math.max(0,2-this.zoom);return l>0?a+=l:o+=l,Math.min(a,Math.max(o,e))}clearZoom(){return this.zoomPhoto<0?!1:(this.zoomPhoto=-1,this.zoom=1,this.gestureZoom=1,clearTimeout(this.zoomTimer),this.zoomTimer=0,this.pointerId!==null&&(this.stale=!0,this.pinching=!1,this.secondId=null),this.requestDraw(),!0)}levelDpr(){return this.zoomPhoto>=0&&this.zoom>=this.zoomMax*.999?Math.max(this.dpr,window.devicePixelRatio||1):this.dpr}startZoomSession(){if(this.zoomTimer=0,this.suspended||this.zoomPhoto<0)return;let e=this.layouts[this.zoomPhoto],t=e.width*this.zoom,i=e.height*this.zoom,s=Math.max(0,this.zx),r=Math.min(this.vw,this.zx+t),o=Math.max(0,this.zy),a=Math.min(this.vh,this.zy+i);r<=s||a<=o||this.loader(this.zoomPhoto).start({displayWidth:t,u0:(s-this.zx)/t,u1:(r-this.zx)/t,v0:(o-this.zy)/i,v1:(a-this.zy)/i},this.levelDpr(),()=>{})}rubber(e){let t=this.stops[0].camera,i=this.stops[this.stops.length-1].camera;return e<t?t-(t-e)*_t:e>i?i+(e-i)*_t:e}nearestStop(e){let t=0;return this.stops.forEach((i,s)=>{Math.abs(i.camera-e)<Math.abs(this.stops[t].camera-e)&&(t=s)}),t}go(e){let t=Math.max(0,Math.min(this.stops.length-1,e)),i=this.current,s=this.clearZoom(),r=this.stops[t].camera;if(this.reducedMotion.matches)this.crossfade(()=>{this.current=t,this.camera=r});else{let o=Math.abs(r-this.camera);o>.5?this.tween={from:this.camera,to:r,start:performance.now(),duration:240+200*Math.min(1,o/this.vw)}:this.camera=r,this.current=t}t!==i?this.activate(i):(s&&this.startSession(),this.updateCaption()),this.requestDraw()}jump(e){let t=this.current;this.clearZoom(),this.tween=null,this.crossfade(()=>{this.current=e,this.camera=this.stops[e].camera}),this.activate(t),this.requestDraw()}crossfade(e){let t=this.fade;(t.width!==this.canvas.width||t.height!==this.canvas.height)&&(t.width=this.canvas.width,t.height=this.canvas.height);let i=t.getContext("2d");i&&i.drawImage(this.canvas,0,0),t.style.transition="none",t.style.opacity="1",e(),this.render(performance.now()),requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transition="",t.style.opacity="0"})})}activate(e){let t=this.stops[this.current],i=e>=0?this.stops[e]:null;if(i&&i.photo>=0&&i.photo!==t.photo&&this.loaders[i.photo]?.stop(),this.loaders.forEach((s,r)=>{s&&r!==t.photo&&r!==t.photo+1&&s.stopPrefetch()}),t.photo<0&&(this.indicator.watch(null),this.progress.watch(null)),this.describe(t.photo,e>=0),t.photo>=0){let s=this.manifest.photos[t.photo];this.caption.set(s,t.photo,this.manifest.photos.length,this.manifest.show_exif),(e>=0||location.hash!=="")&&location.hash!=="#"+(t.photo+1)&&history.replaceState(history.state,"","#"+(t.photo+1))}this.wantKeys(),t.photo>=0&&this.startSession(),(t.photo<0||t.photo===this.manifest.photos.length-1)&&me(this.signoffMark),this.syncNextStrip(),this.updateCaption()}describe(e,t){let i=this.manifest.photos.length,s;if(e<0){let r=this.nextLink.querySelector(".next-title")?.textContent??"";s="End of album."+(r?" Next album: "+r+".":"")}else{let r=this.manifest.photos[e],o=r.alt||r.title||"";s="Photo "+(e+1)+" of "+i+(o?": "+o:"")}this.canvas.setAttribute("aria-label",s),clearTimeout(this.announceTimer),t&&(this.announceTimer=window.setTimeout(()=>{this.announcer.textContent=s},500))}suspend(e){if(!this.suspended){this.suspended=!0,this.tween=null;for(let t of this.loaders)t?.stop();this.nextStrip?.loader.stop(),this.env.scheduler.cancelAll(),this.env.cache.trim(e?0:this.env.cache.budget/4),e&&(this.nextStrip?.detach(),this.canvas.width=1,this.canvas.height=1,this.fade.width=1,this.fade.height=1)}}resume(){this.suspended&&(this.suspended=!1,this.clearZoom(),this.canvas.width=0,this.measure(),this.camera=this.stops[this.current].camera,this.syncNextStrip(),this.startSession(),this.requestDraw())}wantKeys(){let e=this.manifest.photos,t=this.stops[this.current],i=t.photo<0?e.length-1:t.photo,s=r=>{let o=[];for(let a of r){let l=i+a;l>=0&&l<e.length&&o.push(e[l].hash)}return o};this.keys.want(s([0,1,-1,2,3]),s([4,5,6,7,-2,8,9]))}onKeys(e){if(this.suspended)return;let t=this.manifest.photos,i=r=>r>=0&&r<t.length&&e.includes(t[r].hash),s=this.stops[this.current];this.zoomPhoto>=0?i(this.zoomPhoto)&&this.loader(this.zoomPhoto).stalled&&this.startZoomSession():s.photo>=0&&i(s.photo)&&this.loader(s.photo).stalled?this.startSession():s.photo>=0&&i(s.photo+1)&&!this.loader(s.photo).status.active&&this.prefetchAround(this.current),this.requestDraw()}startSession(){let e=this.stops[this.current];if(e.photo<0)return;let t=this.current,i=this.loader(e.photo);i.start(this.viewAt(e),this.dpr,()=>{this.current===t&&this.prefetchAround(t)},!0),this.indicator.watch(i),this.progress.watch(i)}prefetchAround(e){let t=this.stops[e],i=this.stops[e+1];if(!(!i||i.photo<0)){if(i.photo===t.photo){let s=this.loader(t.photo);s.prefetchLevel(this.viewAt(i),s.finalLevel);let r=this.stops.find(o=>o.photo===t.photo+1);r&&this.loader(r.photo).prefetchProbe(this.viewAt(r),this.dpr);return}this.loader(i.photo).prefetchProbe(this.viewAt(i),this.dpr)}}viewAt(e){let t=this.layouts[e.photo],i=e.camera-this.vw/2,s=Math.max(i,t.left),r=Math.min(i+this.vw,t.left+t.width),o=Math.max(0,t.top),a=Math.min(this.vh,t.top+t.height);return{displayWidth:t.width,u0:(s-t.left)/t.width,u1:(r-t.left)/t.width,v0:(o-t.top)/t.height,v1:(a-t.top)/t.height}}photoRect(e){let t=this.layouts[e],i=t.left-(this.camera-this.vw/2);return{left:Math.max(0,i),right:Math.min(this.vw,i+t.width),top:Math.max(0,t.top),bottom:Math.min(this.vh,t.top+t.height)}}inCaptionZone(e,t){let i=this.stops[this.current];if(i.photo<0)return!1;let s=this.stage.getBoundingClientRect(),r=e-s.left,o=t-s.top,a=this.layouts[i.photo],l=this.photoRect(i.photo),h=a.top+a.height*(1-Wi);return r>=l.left&&r<=l.right&&o>=h&&o<=l.bottom}updateCaption(){let e=this.stops[this.current],t=e.photo>=0&&this.zoomPhoto<0&&!this.dragging&&(this.pinned||this.hover);if(t){let i=this.photoRect(e.photo);this.caption.place(i.left,i.right-i.left,this.vh-i.bottom)}this.caption.show(t),document.body.classList.toggle("has-caption",t)}loadNextAlbum(){this.indexRequested||!this.settings.indexUrl||(this.indexRequested=!0,fetch(this.settings.indexUrl,{credentials:"same-origin"}).then(e=>e.ok?e.json():Promise.reject(new Error("index"))).then(e=>this.showNextAlbum(e)).catch(()=>{this.indexRequested=!1}))}showNextAlbum(e){let t=e.albums;if(t.length===0)return;let i=t.findIndex(a=>a.slug===this.manifest.slug),s=t[(i+1)%t.length];if(!s||s.slug===this.manifest.slug)return;this.nextLink.href="/a/"+encodeURIComponent(s.slug)+"/",this.nextSlug=s.slug;let r=this.nextLink.querySelector(".next-eyebrow"),o=this.nextLink.querySelector(".next-title");r&&(r.textContent="Next album"+(s.date?" \xB7 "+s.date:"")),o&&(o.textContent=s.title,Be(o,s.title)),s.cover&&(this.nextStrip=new de(this.nextFrame,s.cover,s.collapsed_focus_y??.5,be(e.build,s.slug,s.cover.hash),{...this.env,keys:Ke(e.gate.cover),tiles:e.tiles},()=>{}),this.nextLink.classList.add("has-strip"),this.layoutNextStrip(),this.syncNextStrip())}requestDraw(){this.frame===0&&(this.frame=requestAnimationFrame(e=>{this.frame=0,this.render(e)}))}render(e){let t=!1;if(this.tween){let b=Math.min(1,(e-this.tween.start)/this.tween.duration);this.camera=this.tween.from+(this.tween.to-this.tween.from)*Yi(b),b>=1?(this.tween=null,this.updateCaption()):t=!0}let i=this.g,s=this.canvas.width,r=this.canvas.height;i.setTransform(1,0,0,1,0,0),i.globalAlpha=1,i.fillStyle="#111114",i.fillRect(0,0,s,r);let o=this.camera-this.vw/2,a=o+this.vw,l=this.dpr,h=this.stops[this.current].photo,c=Math.max(0,(h<0?this.layouts.length-1:h)-2),f=this.zoomPhoto>=0?-1:Math.min(this.layouts.length-1,(h<0?this.layouts.length-1:h)+2);if(this.zoomPhoto>=0){let b=this.layouts[this.zoomPhoto],g=b.width*this.zoom;this.loader(this.zoomPhoto).draw({g:i,originX:this.zx*l,originY:this.zy*l,width:g*l,height:b.height*this.zoom*l,canvasWidth:s,canvasHeight:r,displayWidth:g,dpr:this.levelDpr(),now:e})&&(t=!0)}for(let b=c;b<=f;b++){let g=this.layouts[b];g.left+g.width<o||g.left>a||this.loader(b).draw({g:i,originX:(g.left-o)*l,originY:g.top*l,width:g.width*l,height:g.height*l,canvasWidth:s,canvasHeight:r,displayWidth:g.width,dpr:l,now:e})&&(t=!0)}this.endCard.style.transform="translate3d("+Math.round(this.endLeft-o)+"px,0,0)",this.caption.element.classList.contains("is-visible")&&this.tween&&this.updateCaption(),t&&this.requestDraw()}};async function Yt(n){let e=await fetch(n,{credentials:"same-origin"});if(!e.ok)throw new Error(n+" "+e.status);return await e.json()}function jt(n){return{scheduler:new Me(n.concurrency,n.workerUrl),cache:new Ee(Et())}}function Gt(n,e){return n.gate==="off"?null:{build:n.build,workerUrl:n.workerUrl,minEntropy:e,score:Ae}}async function ji(n,e,t){let i=await Yt(e.manifestUrl);if(i.photos.length===0)return;let s=new Oe(i.gate,i.slug,t?"nav":"land",e.workerUrl),{scheduler:r,cache:o}=jt(e);document.documentElement.classList.add("has-viewer");let a=i.gate.min_entropy??e.minEntropy;Vt(new je(n,i,e,{scheduler:r,cache:o,settings:e,keys:s,tiles:i.tiles},s,Gt(e,()=>a)))}async function Gi(n,e,t){let i=await Yt(e.indexUrl);if(typeof i.gate.min_entropy=="number"&&t(i.gate.min_entropy),i.albums.length===0)return;let{scheduler:s,cache:r}=jt(e);Vt(new Ue(n,i,e,{scheduler:s,cache:r,settings:e,keys:Ke(i.gate.cover),tiles:i.tiles}))}function Vt(n){document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?n.suspend(!1):n.resume()}),window.addEventListener("pagehide",()=>n.suspend(!0)),window.addEventListener("pageshow",e=>{e.persisted&&n.resume()})}function Vi(){document.documentElement.classList.remove("has-viewer"),document.querySelector(".load-error")?.removeAttribute("hidden")}function Zi(){let n=Array.from(document.querySelectorAll(".site-footer .chop"));if(n.length===0)return;if(typeof IntersectionObserver!="function"){n.forEach(me);return}let e=new IntersectionObserver(t=>{for(let i of t)i.isIntersecting&&(e.unobserve(i.target),me(i.target))},{rootMargin:"200px"});n.forEach(t=>e.observe(t))}function Xt(){et(),Zi();let n=Ut(document.body);if(n.page==="album"){let e=document.getElementById("stage");e&&ji(e,n,It(n.slug)).catch(Vi)}else if(n.page==="notfound"){let e=document.querySelector(".site-header .wordmark");e&&se(e,!1)}else if(n.page==="index"){let e=document.getElementById("strips");if(e){let t=n.minEntropy,i=Gt(n,()=>t);if(i)for(let s of Array.from(e.querySelectorAll("a.strip")))Fe(s,()=>s.dataset.slug??"",i);Gi(e,n,s=>{t=s}).catch(()=>{document.documentElement.classList.remove("has-strips");let s=document.querySelector(".site-header .wordmark");s&&!s.classList.contains("has-svg")&&se(s,!1)})}}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Xt,{once:!0}):Xt();})();