asciify-engine 4.12.1 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/kit.cjs +1 -0
- package/dist/kit.d.cts +907 -0
- package/dist/kit.d.ts +907 -0
- package/dist/kit.js +1 -0
- package/package.json +11 -1
- package/skills/asciify-engine/SKILL.md +5 -4
- package/skills/asciify-engine/references/components.md +263 -813
- package/skills/asciify-engine/references/kit.md +426 -0
package/dist/kit.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isGlyphFieldSupported as e,mountGlyphField as t}from"./field.js";var n,r=(e,t=0,n=1)=>Math.min(n,Math.max(t,e)),o=(e,t)=>{const n=43758.5453*Math.sin(127.1*e+311.7*t);return n-Math.floor(n)},a=(e,t=3)=>1-(1-r(e))**t,i=(e,t,n)=>{const o=r((n-e)/(t-e));return o*o*(3-2*o)},s=e=>{if(e<=0)return 0;if(e>=1)return 1;const t=(e,t,n)=>3*t*e*(1-e)**2+3*n*e*e*(1-e)+e**3;let n=0,r=1,o=e;for(let a=0;a<22;a++)o=(n+r)/2,t(o,.16,.3)<e?n=o:r=o;return t(o,1,1)},l=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,c={scene:"none",background:"transparent",color:"ink",levels:"none",fit:"cover",focus:{x:.5,y:.5},vignette:0,drift:0,hover:"none",shade:0,contrast:1,brightness:0,gamma:1,maxPixelRatio:2,clear:!1};function d(e,t,r){let o=(e??"").trim();const a=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/.exec(o);if(a?o=u(t,a[1])||(a[2]??"").trim():o.startsWith("--")&&(o=u(t,o)),!o)return r?d(r,t):null;if(/^#[\da-f]{6}$/i.test(o))return o.toLowerCase();if(/^#[\da-f]{3}$/i.test(o))return`#${[...o.slice(1)].map(e=>e+e).join("")}`.toLowerCase();const i=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(o);if(i)return h([+i[1],+i[2],+i[3]]);if(void 0===n)try{n="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0})}catch{n=null}if(!n)return r?d(r,t):null;n.clearRect(0,0,1,1),n.fillStyle="#000",n.fillStyle=o,n.fillRect(0,0,1,1);const[s,l,c]=n.getImageData(0,0,1,1).data;return h([s,l,c])}var u=(e,t)=>"function"==typeof getComputedStyle?getComputedStyle(e).getPropertyValue(t).trim():"",h=e=>`#${e.map(e=>Math.round(r(e,0,255)).toString(16).padStart(2,"0")).join("")}`,p=e=>{const t=parseInt(e.slice(1,7),16);return[t>>16&255,t>>8&255,255&t]},f=(e,t,n)=>{const r=p(e),o=p(t);return h(r.map((e,t)=>e+(o[t]-e)*n))};function m(e){const t="function"==typeof getComputedStyle?getComputedStyle(e):null,n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?/i.exec(t?.backgroundColor??"");if(n){if((void 0===n[4]?1:n[4].endsWith("%")?parseFloat(n[4])/100:parseFloat(n[4]))>=.5)return.2126*+n[1]+.7152*+n[2]+.0722*+n[3]<128}const r=d(t?.color??"",e);if(!r)return"function"==typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches;const[o,a,i]=p(r);return.2126*o+.7152*a+.0722*i>140}function g(){const e=[];return{set(t,n,r){e.some(([e,r])=>e===t&&r===n)||e.push([t,n,t.style.getPropertyValue(n)]),t.style.setProperty(n,r)},restore(){for(const[t,n,r]of e.reverse())r?t.style.setProperty(n,r):t.style.removeProperty(n);e.length=0}}}function v(e="",t=!1){const n=document.createElement("span");return n.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0"),t&&n.setAttribute("aria-live","polite"),n.textContent=e,n}function b(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=n.width/(e.offsetWidth||n.width||1)||1;return{x:(r.left-n.left)/o,y:(r.top-n.top)/o,w:r.width/o,h:r.height/o}}function y(n){const{host:r,layer:o="over",outset:a=0}=n;if("undefined"==typeof document||!e())return null;const i=g(),s=document.createElement("canvas"),u=document.createElement("canvas"),h=u.getContext("2d");if(!h)return null;"static"===getComputedStyle(r).position&&i.set(r,"position","relative"),"under"===o&&i.set(r,"isolation","isolate"),s.setAttribute("aria-hidden","true"),s.dataset.asciiKit="";const p=s.style;p.position="absolute",p.left=p.top=-a+"px",p.width=p.height=`calc(100% + ${2*a}px)`,p.pointerEvents="none",p.zIndex="under"===o?"-1":"";const f=()=>{const e=getComputedStyle(r);p.borderRadius=[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius].map(e=>a&&/^[\d.]+px$/.test(e)?`${parseFloat(e)+a}px`:e).join(" ")};f(),r.appendChild(s);let v=m(r);const y=()=>d(n.ink(v),r,v?"#d8d6cf":"#1d1d1b")??"#888888";let x,w=!1;try{x=t(s,{...c,...n.look(),ink:y(),interactionTarget:r,label:"",onError:()=>{w||(w=!0,N(),n.onFail?.())}})}catch{return s.remove(),i.restore(),null}s.removeAttribute("role"),s.removeAttribute("aria-label");let M=0,k=!1,S=!0,A=!1;const E=()=>!!(n.reducedMotion()??l()),C=e=>b(s,e),L=e=>{if(M=0,A||k)return;const t=(e=>{const t=Math.max(1,s.clientWidth||r.clientWidth+2*a),o=Math.max(1,s.clientHeight||r.clientHeight+2*a),i=n.resolution??1,[l,c]="function"==typeof i?i(t,o):[Math.max(1,Math.round(t*i)),Math.max(1,Math.round(o*i))];u.width===l&&u.height===c||(u.width=l,u.height=c),h.setTransform(1,0,0,1,0,0),h.globalAlpha=1,h.globalCompositeOperation="source-over",h.filter="none",h.fillStyle="#000",h.fillRect(0,0,l,c);let d=!1;try{d=n.paint({pen:h,width:l,height:c,w:t,h:o,scale:l/t,now:e,still:E(),dark:v,box:C})}catch(e){"undefined"!=typeof console&&console.error(e)}return x.setSource(u).then(()=>{A||x.redraw()}),d})(e);!t||E()||!S||"undefined"!=typeof document&&document.hidden||(M=requestAnimationFrame(L))},$=()=>{M||A||k||(M=requestAnimationFrame(L))},R="function"==typeof ResizeObserver?new ResizeObserver(()=>{f(),x.resize(),$()}):null;R?.observe(r);const I="function"==typeof IntersectionObserver?new IntersectionObserver(([e])=>{S=e.isIntersecting,S&&$()},{rootMargin:"64px"}):null;I?.observe(r);const T=()=>{document.hidden||$()};document.addEventListener("visibilitychange",T);let F=0;const P=()=>{F||A||(F=requestAnimationFrame(()=>{F=0,A||(v=m(r),x.update({ink:y()}),n.onTheme?.(),$())}))},W="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;W?.addEventListener?.("change",P);const z="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;z?.addEventListener?.("change",$);const O="function"==typeof MutationObserver?new MutationObserver(P):null;for(const e of[document.documentElement,document.body])e&&O?.observe(e,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});function N(){if(!A){A=!0,M&&cancelAnimationFrame(M),F&&cancelAnimationFrame(F),M=F=0,R?.disconnect(),I?.disconnect(),O?.disconnect(),document.removeEventListener("visibilitychange",T),W?.removeEventListener?.("change",P),z?.removeEventListener?.("change",$),x.destroy();try{s.getContext("webgl2")?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}s.remove(),i.restore(),u.width=u.height=1}}return x.ready.then($),$(),{get field(){return x},canvas:s,kick:$,refresh(){A||(v=m(r),x.update({...n.look(),ink:y()}),$())},still:E,dark:()=>v,box:C,play(){k&&(k=!1,x.play(),$())},pause(){k=!0,M&&cancelAnimationFrame(M),M=0,x.pause()},destroy:N}}function x(e,t,n,r,o=()=>{}){let a=!1;const i={get supported(){return!!e()&&!a},get field(){return a?null:e()?.field??null},update(e){a||(t.current={...t.current,...e},n(t.current))},play(){a||e()?.play()},pause(){a||e()?.pause()},destroy(){a||(a=!0,e()?.destroy(),o())}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}var w={colorful:["#22c55e","#06b6d4","#6366f1","#d946ef","#f43f5e","#f59e0b"],mono:["#ffffff"],ocean:["#22d3ee","#3b82f6","#2dd4bf","#818cf8"],sunset:["#f97316","#f43f5e","#ec4899","#fbbf24"]},M={palette:"colorful",mode:"rotate",grain:"dots",speed:1,hover:!0,depth:18},k=["rotate","pulse","progress"],S=e=>{const t=/^#[\da-f]{3}$/i.test(e)?`#${[...e.slice(1)].map(e=>e+e).join("")}`:e;return[1,3,5].map(e=>(parseInt(t.slice(e,e+2),16)||0)/255)},A=(e,t,n)=>e.map((e,r)=>e+(t[r]-e)*n),E=S("#ff4a4a"),C=S("#2fd67b");function L(e){const t=("string"==typeof e?w[e]??w.colorful:e.length?e:w.colorful).map(S),n=new Float32Array(1024);for(let e=0;e<256;e++){const r=e/256*t.length,o=Math.floor(r),a=r-o,i=1===t.length?t[0]:A(t[o%t.length],t[(o+1)%t.length],a*a*(3-2*a)),s=Math.max(...i,.01);n.set([i[0]/s,i[1]/s,i[2]/s,(.2126*i[0]+.7152*i[1]+.0722*i[2])/s],4*e)}return n}var $=(e,t)=>{const n=(-e%1+1)%1,r=1-n;return Math.max(n<t?(1-n/t)**2.2:0,r<.03?(1-r/.03)**2:0)},R=e=>Math.max($(e,.3),.75*$(e-.5,.22)),I=(e,t)=>e<=t?.42+.4*(e/Math.max(t,.001))**1.6+.38*Math.exp(-(((t-e)/.03)**2)):e-t<.014?1.2*(1-(e-t)/.014)**2:0,T=(e,t)=>r((e-.68*t)/.07);function F(e,t={}){const n={current:{...M,...t}};let a="idle",s=0,l=L(n.current.palette),c=!1;const d=()=>"mono"===n.current.palette,u=e=>{const t=!e.dark();e.canvas.style.opacity=t?"0.72":"",e.canvas.style.filter=t&&!d()?"brightness(1.45) saturate(.9)":""};let h=null,p=null,f=new Uint8Array(0),m="",g=0,v=null,b=0,w=.62,S=0,A=0,$=0,F=0,P=0,W=0;const z={rotate:0,pulse:0,progress:0};z[n.current.mode]=1;let O=null;O=y({host:e,look:()=>({..."glyphs"===n.current.grain?{mark:"glyph",charset:" ·.:-+*",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.6,glyphScale:1}:{mark:"dot",cellSize:3.5,cellAspect:1,dotScale:.82},color:d()?"ink":"source",saturation:1.25,shade:.55,contrast:2.4,brightness:.58,...n.current.look}),ink:e=>n.current.ink??(e?"#b3b1aa":"#8a8882"),reducedMotion:()=>n.current.reducedMotion,onTheme:()=>O&&u(O),onFail:()=>{O=null},resolution:(e,t)=>[Math.max(1,Math.round(e)),Math.max(1,Math.round(t))],paint:t=>{const{pen:d,w:u,h:y,now:x,still:M,dark:L}=t,N=n.current,B=getComputedStyle(e),G=Math.min(e.clientWidth||u,e.clientHeight||y),H=Math.max(2,Math.min(N.depth,Math.min(parseFloat(B.paddingTop)||N.depth,parseFloat(B.paddingLeft)||N.depth)-2)),D=[B.borderTopLeftRadius,B.borderTopRightRadius,B.borderBottomRightRadius,B.borderBottomLeftRadius].map(e=>((e,t)=>e.endsWith("%")?parseFloat(e)/100*t:parseFloat(e)||0)(e??"",G)),q=`${u}x${y}:${N.grain}:${H}:${D.join(",")}`;if(q!==m){m=q,O.canvas.style.clipPath=`inset(0 round ${D.map(e=>`${e}px`).join(" ")})`;const e=Math.min(globalThis.devicePixelRatio||1,2),t=Math.max(2,Math.round(("glyphs"===N.grain?5:3.5)*e)),n=("glyphs"===N.grain?Math.max(2,Math.round(.6*t)):t)/e,r=t/e;h=function(e,t,n,r,a,i,s){const l=Math.ceil(e/n),c=e/2,d=t/2,u=Math.min(c,d),[h,p,f,m]=[0,1,2,3].map(e=>Math.max(0,Math.min(i[e]??i[0]??0,u))),g=new Int32Array(l*Math.ceil(t/r)).fill(-1),v=[],b=[],y=[];for(let e=0;e<g.length;e++){const t=(e%l+.5)*n-c,i=(Math.floor(e/l)+.5)*r-d,u=t<0?i<0?h:m:i<0?p:f,x=Math.abs(t)-c+u,w=Math.abs(i)-d+u,M=-(Math.hypot(Math.max(x,0),Math.max(w,0))+Math.min(Math.max(x,w),0)-u),k=M>0?Math.min(Math.max(0,1-M/Math.max(1,a))**1.7,M/Math.max(.1,s)):0;if(k<.004)continue;g[e]=v.length,v.push(k);const S=Math.atan2(i/Math.max(1,d),t/Math.max(1,c))/(2*Math.PI)+.25,A=S-Math.floor(S);b.push(A),y.push(.78*o(Math.floor(46*A),5)+.22*o(e,9))}const x=Math.max(1,Math.round(e)),w=Math.max(1,Math.round(t)),M=[],k=[];for(let e=0;e<w;e++)for(let t=0;t<x;t++){const o=g[Math.min(l-1,Math.floor((t+.5)/n))+l*Math.floor((e+.5)/r)];o>=0&&(M.push(e*x+t),k.push(o))}return{W:x,H:w,weight:Float32Array.from(v),turn:Float32Array.from(b),crack:Float32Array.from(y),pixel:Int32Array.from(M),owner:Int32Array.from(k)}}(u,y,n,r,H,D,"glyphs"===N.grain?Math.min(n,r)/2:.82*n/2),p=d.createImageData(h.W,h.H),f=new Uint8Array(3*h.weight.length)}const j=h,U=p.data,V=j.crack,X=(e,t,n,o,a)=>{f.fill(0);for(let i=0;i<j.weight.length;i++){const s=j.turn[i],c=r(j.weight[i]*e(s,i))*(L?1.12:.8);if(c<.03)continue;const d=4*(255&Math.floor(((s-t)%1+1)%1*256));let u=l[d],h=l[d+1],p=l[d+2],m=l[d+3];const g=a&&L?a(s):0;(o>0||n>0||g>0)&&(o>0&&(u+=(C[0]-u)*o,h+=(C[1]-h)*o,p+=(C[2]-p)*o),n>0&&(u+=(E[0]-u)*n,h+=(E[1]-h)*n,p+=(E[2]-p)*n),g>0&&(u+=(1-u)*g,h+=(1-h)*g,p+=(1-p)*g),m=.2126*u+.7152*h+.0722*p);const v=255*Math.min(1,(c+.12)/2.4/Math.max(m,.01));f[3*i]=u*v,f[3*i+1]=h*v,f[3*i+2]=p*v}U.fill(0);for(let e=0;e<j.pixel.length;e++){const t=4*j.pixel[e],n=3*j.owner[e];U[t]=f[n],U[t+1]=f[n+1],U[t+2]=f[n+2],U[t+3]=255}d.putImageData(p,0,0)};if(M){const e="progress"===N.mode?e=>"running"===a||"error"===a?I(e,s):.14:e=>("running"===a?.75:.55)*(.7+.3*Math.cos(2*Math.PI*(e-.12)));return"success"===a?X(()=>.62,0,0,.9):"error"===a?X((t,n)=>.5*e(t)*T(V[n],1),0,.9,0):X(e,0,0,0),!1}const Y=g?Math.min(48,x-g):16;g=x,a!==v&&("running"===a&&"running"!==v&&(P=0),b=x,v=a);let K=x-b;"success"===a&&K>2700&&(a=v="idle",s=0,b=x,K=0);const J="running"===a,_="error"===a,Q="success"===a,Z=N.hover&&c;for(const e of k)z[e]+=((e===N.mode?1:0)-z[e])*(1-Math.exp(-Y/260));if(_)A=0;else{const e=(J?1500-500*s:"pulse"===N.mode?9e3:2600)/Math.max(.05,N.speed);A+=(1/e*(Z?1.35:1)-A)*(1-Math.exp(-Y/320)),w+=A*Y,W+=Y,S+=Y/("pulse"===N.mode?14e3:26e3)*(1-z.progress),(J||Q)&&(P+=((Q?1:s)-P)*(1-Math.exp(-Y/110)))}$+=((Z?1:0)-$)*(1-Math.exp(-Y/220)),F=_?.9*i(0,60,K):F*Math.exp(-Y/180);const ee=1+.22*$,te=.32+.68*(.5-.5*Math.cos(2*Math.PI*W/2400)),ne=.05+.1*(.5-.5*Math.cos(2*Math.PI*W/5200)),re=J||Q||_,oe=e=>ee*(z.rotate*R(e-w)+z.pulse*(J||_?R(e-w):te*(.78+.22*Math.cos(2*Math.PI*(e-w))))+z.progress*(re?I(e,P):ne));if(Q){const e=i(0,260,K),t=r((K-240)/620),n=1-i(860,1060,K),o=i(780,1e3,K),a=i(1350,2450,K),s=(L?.86:.55)*e*(1-o)+.62*o*(1-a),l=1-e*(1-i(1900,2700,K)*(1-z.progress)),c=e=>{if(K<240)return 0;const r=t-e;return n*(r>=0?r<.2?(1-r/.2)**2:0:r>-.02?(1+r/.02)**2:0)};return X(e=>Math.max(oe(e)*l,s*(.9+.1*Math.cos(2*Math.PI*(e-.1))),1.3*c(e),z.progress*ne*a),S,0,.9*o*(1-a),e=>r(.8*c(e))),!0}if(_){const e=K<90?1.2:K<170?.1:K<260?1.2:K<340?.1:1,t=i(380,1150,K),n=1-.5*i(700,1500,K),r=Math.floor(K/50);return X((a,i)=>{const s=T(V[i],t);return s<=0?0:oe(a)*e*s*n*(1-1.4*t*(1-t)*o(i,r))},S,F,0),K<1600||Math.abs($-(Z?1:0))>.01}return X(oe,S,F,0),!0}});const N=()=>{c=!0,O?.kick()},B=()=>{c=!1,O?.kick()},G=e=>{c=e.target?.matches?.(":focus-visible")??!1,O?.kick()};O&&(u(O),e.addEventListener("pointerenter",N),e.addEventListener("pointerleave",B),e.addEventListener("focusin",G),e.addEventListener("focusout",B));const H=e=>{a=e,O?.kick()};return x(()=>O,n,e=>{l=L(e.palette),O?.refresh(),O&&u(O)},{progress(e){s=r(Number.isFinite(e)?e:0),H("running")},success(){H("success")},error(){H("error")},reset(){s=0,H("idle")}},()=>{e.removeEventListener("pointerenter",N),e.removeEventListener("pointerleave",B),e.removeEventListener("focusin",G),e.removeEventListener("focusout",B)})}var P={duration:900,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function W(e,t,n=.82){const r=e.getContext("2d");if(!r)return;const a=e.width,i=e.height,s=r.createImageData(a,i),l=e=>e*e*(3-2*e),c=(e,t)=>{const n=Math.floor(e),r=Math.floor(t),a=l(e-n),i=l(t-r),s=o(n,r),c=o(n+1,r),d=o(n,r+1);return s+(c-s)*a+(d-s)*i+(s-c-d+o(n+1,r+1))*a*i};for(let e=0;e<i;e++)for(let r=0;r<a;r++){const o=.6*c(r/6+2.4*t,e/3.5-.8*t)+.4*c(r/2.5-3*t,e/2),l=Math.min(1,2.4*(1-Math.hypot(2*(r/a-.5),2*(e/i-.5))*n)),d=.72*Math.max(0,o-.42)*Math.max(0,l)*255,u=4*(e*a+r);s.data[u]=s.data[u+1]=s.data[u+2]=d,s.data[u+3]=255}r.putImageData(s,0,0)}function z(e,t={}){const n={current:{...P,...t}},r=g(),a=document.createElement("canvas"),i=document.createElement("canvas");let l=-1,c="",d=!1,u=!1,h=null;const p=(t,r)=>{const o=`${t}x${r}:${n.current.text??""}:${e.textContent}`;if(o===c)return;c=o,a.width=t,a.height=r;const i=a.getContext("2d");i.fillStyle="#000",i.fillRect(0,0,t,r),void 0!==n.current.text?function(e,t,n,r,o){const a=getComputedStyle(t),i=n.split("\n");e.fillStyle="#fff",e.textAlign="center",e.textBaseline="middle",e.font=`${a.fontWeight} 100px ${a.fontFamily}`;const s=Math.max(1,...i.map(t=>e.measureText(t).width)),l=Math.min(.94*r/s*100,.9*o/i.length);e.font=`${a.fontWeight} ${l}px ${a.fontFamily}`,i.forEach((t,n)=>e.fillText(t,r/2,o/2+(n-(i.length-1)/2)*l*1.04))}(i,e,n.current.text,t,r):function(e,t,n,r){const o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),a=document.createRange();e.fillStyle="#fff",e.textAlign="left",e.textBaseline="alphabetic";for(let t=o.nextNode();t;t=o.nextNode()){const o=t.parentElement;if(!o)continue;const i=getComputedStyle(o);e.font=`${i.fontStyle} ${i.fontWeight} ${parseFloat(i.fontSize)*r}px ${i.fontFamily}`,"letterSpacing"in e&&(e.letterSpacing=(parseFloat(i.letterSpacing)||0)*r+"px");const s=e.measureText("Hg"),l=s.fontBoundingBoxAscent||parseFloat(i.fontSize)*r*.8,c=s.fontBoundingBoxDescent||parseFloat(i.fontSize)*r*.2,d="uppercase"===i.textTransform?e=>e.toUpperCase():"lowercase"===i.textTransform?e=>e.toLowerCase():e=>e;for(const o of t.data.matchAll(/\S+/g)){a.setStart(t,o.index),a.setEnd(t,o.index+o[0].length);const i=a.getClientRects()[0];if(!i)continue;const s=(i.top-n.top)*r,u=i.height*r;e.fillText(d(o[0]),(i.left-n.left)*r,s+(u-l-c)/2+l)}}a.detach?.()}(i,e,e.getBoundingClientRect(),t/(e.getBoundingClientRect().width||1))};h=y({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4.5,cellAspect:.62,glyphScale:.92,contrast:1.35,hover:"trail",trail:{strength:.6,radius:.2},...n.current.look}),ink:()=>n.current.ink??getComputedStyle(e).color,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{h=null,r.restore()},paint:({pen:e,width:t,height:r,now:c,still:h})=>{p(t,r);const m=n.current,g="text"===m.settle;if(l<0||h)return!(!u&&"visible"===m.trigger&&!h)&&(g&&l>=0||e.drawImage(a,0,0),l>=0&&f(),!1);const v=c-l,b=.3*m.duration,y=.7*m.duration,x=Math.max(2,Math.ceil(t/20)),w=Math.max(2,Math.ceil(r/20));if(i.width===x&&i.height===w||(i.width=x,i.height=w),W(i,v/1e3),e.imageSmoothingEnabled=!0,v<b)return e.drawImage(i,0,0,t,r),d&&(e.globalAlpha=1-s(v/b),e.drawImage(a,0,0),e.globalAlpha=1),!0;const M=Math.min(1,(v-b)/y),k=(1.18*M-.02)*t,S=.14*t,A=5.58,E=Math.floor(c/16);if(M>=1)return g||e.drawImage(a,0,0),f(),!1;e.drawImage(i,0,0,t,r),k>0&&e.drawImage(a,0,0,k,r,0,0,k,r);for(let t=Math.max(0,Math.floor(k/A)*A);t<k+S;t+=A){const n=(t-k)/S;for(let i=0;i<r;i+=9)o(t+13*E,i)<n||(e.globalAlpha=.35+.65*o(i+7*E,t),e.fillStyle="#000",e.fillRect(t,i,A,9),e.drawImage(a,t,i,A,9,t,i,A,9))}return e.globalAlpha=1,!0}});const f=()=>{l=-1,d="text"!==n.current.settle,d||r.restore()},m=()=>{h&&(r.set(e,"-webkit-text-fill-color","transparent"),u=!0,l=performance.now(),h.kick())};let v=!1;const b=h&&"visible"===n.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([e])=>{e.isIntersecting&&!v&&m(),v=e.isIntersecting},{threshold:.5}):null;h&&("text"!==n.current.settle&&r.set(e,"-webkit-text-fill-color","transparent"),d="text"!==n.current.settle&&"manual"===n.current.trigger,b?b.observe(e):"visible"===n.current.trigger&&m());const w=()=>{n.current.replayOnHover&&l<0&&m()};return h&&e.addEventListener("pointerenter",w),h&&document.fonts?.ready.then(()=>{c="",h?.kick()}),x(()=>h,n,()=>{c="",h?.refresh()},{replay:m},()=>{b?.disconnect(),e.removeEventListener("pointerenter",w),r.restore()})}var O={value:0,duration:360,stagger:60,glyphs:"#%*+=-:",format:e=>e.toLocaleString()};function N(e,t){const n=(e,t)=>e[e.length-1-t]??"";for(let r=t.length-1;r>=0;r--)if(/\d/.test(n(t,r))&&n(e,r)!==n(t,r))return r;return-1}function B(e,t={}){const n=parseFloat((e.textContent??"").replace(/[^\d.-]/g,"")),a={current:{...O,...t,value:t.value??(Number.isFinite(n)?n:0)}},l=g();let c=a.current.value,d=a.current.format(c),u={from:d,to:d,t0:-1e9,up:!0,first:-1},h=null;const p=v(d,!0),f=document.createElement("span"),m=()=>{f.replaceChildren(...[...d].map(e=>Object.assign(document.createElement("span"),{textContent:e}))),p.textContent=d};h=y({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:3,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...a.current.look}),ink:()=>a.current.ink??getComputedStyle(e).color,reducedMotion:()=>a.current.reducedMotion,resolution:2,onFail:()=>{h=null,e.textContent=d,l.restore()},paint:({pen:e,now:t,still:n,box:l,scale:c})=>{const d=getComputedStyle(f),h=parseFloat(d.fontSize),p=parseFloat(d.letterSpacing)||0,m=`${d.fontStyle} ${d.fontWeight} ${d.fontSize} ${d.fontFamily}`;e.setTransform(c,0,0,c,0,0),e.font=m,e.textAlign="center",e.textBaseline="alphabetic";const g=e.measureText("0"),v=g.fontBoundingBoxAscent||.8*h,b=g.fontBoundingBoxDescent||.2*h,{from:y,to:x,t0:w,up:M,first:k}=u,S=[...f.children],A=a.current,E=(e,t)=>e[e.length-1-t]??"";let C=!1;return S.forEach((a,c)=>{const d=S.length-1-c,u=l(a),f=u.x+(u.w-p)/2,g=u.y,L=u.h,$=g+(L-v-b)/2+v,R=E(x,d),I=k-d,T=!n&&k>=0&&I>=0&&/\d/.test(R)?r((t-w)/(A.duration+I*A.stagger)):1,F=s(T),P=T<1?i(.72,1,T).toFixed(3):"";if(a.style.opacity!==P&&(a.style.opacity=P),T>=1)return;C=!0,e.globalAlpha=1-i(.72,1,T);const W=5+2*I,z=[E(y,d),...Array.from({length:W},(e,t)=>A.glyphs[Math.floor(o(t+7*d,w)*A.glyphs.length)]??""),R];M||z.reverse();const O=(z.length-1)*L,N=M?F*O:O-F*O;e.save(),e.beginPath(),e.rect(f-u.w,g,2*u.w,L),e.clip(),z.forEach((t,n)=>{const r=$+n*L-N;if(r<g-L||r>g+2*L)return;const o=n>0&&n<z.length-1;e.font=o?`600 ${.84*h}px "Geist Mono", ui-monospace, monospace`:m,e.fillStyle=o?"#d0d0d0":"#fff",e.fillText(t,f,r)}),e.restore()}),e.globalAlpha=1,C}}),h&&(l.set(f,"display","inline-flex"),f.setAttribute("aria-hidden","true"),e.replaceChildren(p,f,h.canvas),m(),document.fonts?.ready.then(()=>h?.kick()));const b=t=>{if(!Number.isFinite(t))return;const n=c,r=d;c=t,d=a.current.format(t),h?r!==d&&(u={from:r,to:d,up:t>=n,first:N(r,d),t0:performance.now()},m(),h.kick()):e.textContent=d};return x(()=>h,a,e=>{e.value!==c?b(e.value):(d=e.format(c),m(),h?.refresh())},{set:b,get value(){return c}},()=>{h&&(e.textContent=d),l.restore()})}var G={check:!0,shake:!0};function H(e,t,n,r,a,i=0){const s=24*n+170;if(t<s){const n=(t-24*e)/170;return n<1?1+Math.floor(o(e+i,Math.floor(t/46))*(n<0?3:9)):0}if(!r||a)return 0;const l=(((t-s)/1250-.07*e)%1+1)%1;return l<.3?1+Math.round(8*Math.sin(Math.PI*(l/.3))):0}function D(t,n={}){const r={current:{...G,...n}},o=g(),a=r.current.label??t,i=r.current.text??(a.textContent??"").trim(),s=[...a.childNodes];let l="idle",c=i,d=-1e9,u=0,h=null,p={cw:9,ch:15,cellSize:15};const f=v(i),m=document.createElement("span"),b=()=>{const e=Math.min(globalThis.devicePixelRatio||1,2);p=function(e,t){const n=Math.max(3,3*Math.round(e*t/3));return{cw:n/3*2/t,ch:n/t,cellSize:n/t}}(parseFloat(getComputedStyle(a).fontSize)||15,e)},w=()=>{const e=[...c];m.replaceChildren(...e.map((e,t)=>{const n=document.createElement("span");return n.textContent=e,n.setAttribute("style",`position:absolute;top:0;left:${t*p.cw}px;width:${p.cw}px;height:${p.ch}px;line-height:${p.ch}px;text-align:center`),n})),h&&m.appendChild(h.canvas),m.style.width=e.length*p.cw+"px",m.style.height=`${p.ch}px`,f.textContent=c,u=Math.max(u,t.offsetWidth),u&&o.set(t,"min-width",`${u}px`)},M="undefined"!=typeof document&&e();M&&(b(),m.setAttribute("aria-hidden","true"),m.setAttribute("style","display:inline-block;vertical-align:middle;position:relative;white-space:pre"),a.replaceChildren(f,m),w()),h=M?y({host:m,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:p.cellSize,cellAspect:2/3,glyphScale:.94,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(a).color,reducedMotion:()=>r.current.reducedMotion,resolution:(e,t)=>[Math.max(2,2*Math.round(e/p.cw)),Math.max(3,3*Math.round(t/p.ch))],onFail:()=>{h=null,a.replaceChildren(...s),a.textContent=c,o.restore()},paint:({pen:e,now:t,still:n})=>{const r=m.children,o=t-d;let a="loading"===l&&!n;for(let t=0;t<r.length;t++){const i=n?0:H(t,o,r.length,"loading"===l,n,c.length);o<24*r.length+170&&(a=!0);const s=" "===c[t];if(r[t].style.visibility=i&&!s?"hidden":"",!i||s)continue;const d=Math.round(i/9*255);e.fillStyle=`rgb(${d} ${d} ${d})`,e.fillRect(2*t,0,2,3)}return a}}):null,M&&!h&&(a.replaceChildren(...s),o.restore());const k=(e,n)=>{l=e,c="success"===e&&r.current.check&&h?`✓ ${n}`:n,t.dataset.state=e,"loading"===e?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),r.current.announce&&(r.current.announce.textContent="idle"===e?"":n),h?(d=performance.now(),w(),h.kick(),"error"===e&&r.current.shake&&!h.still()&&"function"==typeof t.animate&&t.animate([{translate:"0"},{translate:"-4px 0"},{translate:"4px 0"},{translate:"-2px 0"},{translate:"0"}],{duration:280,easing:"cubic-bezier(.16, 1, .3, 1)"})):a.textContent=n};return x(()=>h,r,()=>{h&&(b(),w(),h.refresh())},{start(e=`${i}…`){k("loading",e)},succeed(e="Done"){k("success",e)},fail(e="Retry"){k("error",e)},reset(e=i){k("idle",e)},get state(){return l}},()=>{h&&a.replaceChildren(...s),delete t.dataset.state,t.removeAttribute("aria-busy"),o.restore()})}var q={colourByState:!0,ring:!0},j={success:["--ascii-success","#17844a","#3ccf7e"],warning:["--ascii-warning","#9a6700","#f5b83d"],error:["--ascii-error","#c93636","#ff6b6b"]},U=120,V=280,X=520,Y=2*Math.PI,K=Y/1050,J=e=>1-(1-e)**4,_=e=>`rgb(${255*e} ${255*e} ${255*e})`,Q=e=>e*K-Math.PI/2,Z=(e,t=0)=>78+5*Math.sin(e/1600*Y)*(1-t);function ee(e,t,n=78,r=24){e.strokeStyle=_(t),e.lineWidth=r,e.beginPath(),e.arc(U,U,n,0,Y),e.stroke()}function te(e,t,n,r=0,o=1){if(ee(e,(.3+(n-78)/100)*o,n,24-6*r),r>=1)return void ee(e,.72*o,n,18);const a=3.4+(Y-3.4)*r;e.lineCap="round";for(let i=0;i<32;i++){const s=i/32,l=.3+.7*(1-s)**1.6;e.strokeStyle=_((l+(.72-l)*r)*o),e.lineWidth=28-6*s+(18-(28-6*s))*r,e.beginPath(),e.arc(U,U,n,t-(s+1/32)*a,t-s*a),e.stroke()}}function ne(e,t,n,r=800,o=0,a=!0){if("idle"===t)return void ee(e,.34);if("loading"===t)return void te(e,Q(n),Z(n));const i=(e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2)(Math.min(1,r/V)),s=Math.min(r,V),l=o+K*(s-s*s/560);a?te(e,l,Z(n,i),i):i<1&&te(e,l,Z(n,i),0,1-i);const c=(r-196)/X;a&&c>0&&c<1&&ee(e,.5*(1-c)**2,88+24*c,16-8*c),function(e,t,n,r=30){e.strokeStyle="#fff",e.lineWidth=r,e.lineCap="round",e.lineJoin="round";const o=(t,n)=>{const r=t.slice(1).map((e,n)=>Math.hypot(e[0]-t[n][0],e[1]-t[n][1]));let o=n*r.reduce((e,t)=>e+t,0);e.beginPath(),e.moveTo(t[0][0],t[0][1]);for(let n=1;n<t.length&&o>0;n++){const a=Math.min(1,o/r[n-1]);e.lineTo(t[n-1][0]+(t[n][0]-t[n-1][0])*a,t[n-1][1]+(t[n][1]-t[n-1][1])*a),o-=r[n-1]}e.stroke()};"success"===t?o([[86,122],[110,146],[156,96]],n):"warning"===t?(e.lineWidth=r-4,o([[U,74],[U,114]],Math.min(1,n/.7)),n>.7&&(e.fillStyle="#fff",e.beginPath(),e.arc(U,152,r/2*J((n-.7)/.3),0,Y),e.fill())):(o([[92,92],[148,148]],n),o([[148,92],[92,148]],n))}(e,t,J(Math.min(1,Math.max(0,(r-40)/260))),a?24:30)}function re(e,t={}){const n={current:{...q,...t}};let r="idle",o=0,a=0,i="",s="",l=-1e9,c="",u=null;const h=t=>{if(!n.current.colourByState||"idle"===r||"loading"===r)return(t=>d(n.current.ink??"--ascii-ink-strong",e,t?"#d8d6cf":"#1d1d1b"))(t);const[o,a,i]=j[r];return d(n.current.colors?.[r]??o,e,t?i:a)};u=y({host:e,look:()=>({mark:"glyph",fit:"contain",charset:" .:-=+*#%@",cellSize:5,cellAspect:.62,glyphScale:.94,font:'"Geist Mono", ui-monospace, monospace',fontWeight:600,contrast:1.1,shade:.5,...n.current.look}),ink:e=>h(e),reducedMotion:()=>n.current.reducedMotion,resolution:()=>[240,240],onFail:()=>{u=null},onTheme:()=>{l=-1e9,c=""},paint:({pen:e,now:t,still:d,dark:p})=>{const m=t-o;ne(e,r,d?380:t,d?800:m,a,n.current.ring);const g=h(p);g!==s&&(i=s||g,s=g,l=t);const v=d?1:J(Math.min(1,(t-l)/200)),b=v<1?f(i,s,v):s;return b!==c&&(c=b,u?.field.update({ink:b})),"loading"===r||m<800||v<1}});const p=t=>{const n=performance.now();"loading"===r&&"loading"!==t&&(a=Q(n)),r=t,o=n,e.dataset.state=t,"error"===t&&u&&!u.still()&&"function"==typeof e.animate&&e.animate({translate:["0","-5px 0","4px 0","-2px 0","0"]},{duration:260,easing:"cubic-bezier(.16, 1, .3, 1)"}),u?.kick()};return x(()=>u,n,()=>u?.refresh(),{idle:()=>p("idle"),loading:()=>p("loading"),success:()=>p("success"),warning:()=>p("warning"),error:()=>p("error"),get state(){return r}},()=>{delete e.dataset.state})}var oe={blocks:"[data-block]",shimmer:1250,resolve:240,stagger:60,develop:560},ae=e=>`rgb(${255*e} ${255*e} ${255*e})`;function ie(e){const t=e.dataset.block;return"text"===t||"photo"===t||"avatar"===t?t:"IMG"===e.tagName||"PICTURE"===e.tagName||"VIDEO"===e.tagName?/^50%|^9999px/.test(getComputedStyle(e).borderTopLeftRadius)?"avatar":"photo":"text"}function se(e,t={}){const n={current:{...oe,...t}},r=g();let o=0,i=null,s=null,l=null,c=null;const d=()=>[...e.querySelectorAll(n.current.blocks)].map((e,t)=>({el:e,kind:ie(e),delay:void 0!==e.dataset.delay?Number(e.dataset.delay):80+t*n.current.stagger})),u=()=>{r.restore(),e.removeAttribute("aria-busy"),s?.(),s=null};c=y({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",cellSize:5,cellAspect:.62,glyphScale:.92,font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,contrast:1.15,shade:.35,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",reducedMotion:()=>n.current.reducedMotion,onFail:()=>{c=null,u()},paint:({pen:e,now:t,still:s,box:l,w:c})=>{if(null!==i&&s)return u(),!1;const h=n.current,p=null===i?-1:t-i;if(null!==i&&p>Math.max(n.current.develop,...d().map(e=>e.delay+n.current.resolve))+16)return u(),!1;null!==i&&(e=>{for(const{el:t,kind:o,delay:a}of d()){const i=Math.min(1,Math.max(0,(e-a)/n.current.resolve));r.set(t,"opacity",i>0?"text"===o?"1":String(i):"0"),"text"===o&&r.set(t,"clip-path",`inset(-2px ${100*(1-i)}% -2px 0)`)}})(p);const f=(s?.3:(t-o)/h.shimmer%1)*c*1.7-.35*c,m=s?1:.4+.6*Math.min(1,(t-o)/160),g=e.createLinearGradient(f-90,0,f+90,60);g.addColorStop(0,ae(.3)),g.addColorStop(.5,ae(.82)),g.addColorStop(1,ae(.3));const v=(t,n,r,o,a)=>{e.beginPath(),e.roundRect(t,n,Math.max(0,r),o,Math.min(a,o/2,Math.max(0,r)/2))};for(const{el:t,kind:n,delay:r}of d()){const{x:o,y:i,w:s,h:c}=l(t),d=p<0?0:Math.min(1,Math.max(0,(p-r)/h.resolve));if(e.fillStyle=g,"photo"===n){const n=p<0?0:a(p/h.develop,4);e.globalAlpha=(1-d)*m,v(o,i,s,c,10),e.fill();const r=t instanceof HTMLImageElement?t:t.querySelector("img");if(n>0&&r?.complete&&r.naturalWidth){const t=Math.max(s/r.naturalWidth,c/r.naturalHeight),a=r.naturalWidth*t,l=r.naturalHeight*t;e.save(),v(o,i,s,c,10),e.clip(),e.globalAlpha=n*(1-d),e.drawImage(r,o+(s-a)/2,i+(c-l)/2,a,l),e.restore()}}else if("avatar"===n)e.globalAlpha=(1-d)*m,e.beginPath(),e.arc(o+s/2,i+c/2,Math.min(s,c)/2,0,2*Math.PI),e.fill();else{const t=Math.min(.62*c,12),n=i+(c-t)/2,r=o+s*d;e.globalAlpha=m,v(r,n,o+s-r,t,t/2),e.fill(),e.globalAlpha=1,d>0&&d<1&&(e.fillStyle="#fff",e.fillRect(r-2,n-1,6,t+2))}e.globalAlpha=1}return!0}});const h=()=>{o=performance.now(),i=null,e.setAttribute("aria-busy","true"),c&&((()=>{for(const{el:e}of d())r.set(e,"opacity","0"),e.style.removeProperty("clip-path")})(),c.kick())};return h(),x(()=>c,n,()=>c?.refresh(),{resolve:()=>c?(null!==i&&l||(i=performance.now(),l=new Promise(e=>{s=e}),c.kick()),l):(e.removeAttribute("aria-busy"),Promise.resolve()),reset(){s?.(),s=null,l=null,h()},get loading(){return null===i}},()=>{u()})}var le={tone:"neutral",live:!1,indicator:!0,sheen:!0},ce={light:{green:[22,150,82],amber:[200,128,10],red:[214,52,52],neutral:[120,120,114],new:[98,72,214]},dark:{green:[120,240,170],amber:[255,206,110],red:[255,156,156],neutral:[200,200,192],new:[180,164,255]}},de={light:{charset:" .:+*"+"#".repeat(15),top:.32},dark:{charset:" .:+*"+"#".repeat(4),top:.9}},ue=[[255,130,225],[205,175,255],[120,215,255]],he=(e,t,n)=>e.map((e,r)=>e+(t[r]-e)*n),pe=(e,t)=>Math.exp(-((e/t)**2));function fe(e,t){const n=Math.max(1,...e),r=e.map(e=>e/n*255),o=(.2126*r[0]+.7152*r[1]+.0722*r[2])/255,a=Math.min(1,t/Math.max(o,.01));return`rgb(${r.map(e=>Math.round(Math.max(0,Math.min(255,e*a)))).join(" ")})`}var me=(e,t)=>{return"green"===(n=e.dataset.tone)||"amber"===n||"red"===n||"neutral"===n||"new"===n?e.dataset.tone:t;var n};function ge(e,t={}){const n={current:{...le,...t}},r=e instanceof HTMLElement?[e]:[...e],o=1===r.length,i=o?r[0]:r.length?function(e){let t=e[0].parentElement;for(;t&&!e.every(e=>t.contains(e));)t=t.parentElement;return t??document.body}(r):null,s=g(),l=new Map,c=new Map,d=new Map,u=new Map,h=[],p=e=>void 0!==e.dataset.count?"count":"new"===me(e,n.current.tone)?"new":"status",f=(e=-1e6)=>{for(const t of r){const r=me(t,n.current.tone),o=l.get(t);o?o.to!==r&&l.set(t,{from:o.to,to:r,at:e}):l.set(t,{from:r,to:r,at:-1e6})}};f();const b=()=>w?.dark()??(!i||m(i))?"dark":"light";let w=null,M="";function k(){for(;h.length;)h.pop()();s.restore()}w=i?y({host:i,layer:o?"under":"over",look:()=>({mark:"glyph",charset:de[b()].charset,font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.92,color:"source",saturation:1,shade:0,...n.current.look}),ink:()=>n.current.ink,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{w=null,k()},onTheme:()=>w?.field.update({charset:de[b()].charset}),paint:({pen:e,now:t,still:o,dark:i,box:s})=>{const h=n.current,f=i?"dark":"light",m={...ce[f],...h.tones?.[f]},g=de[f].top,v=Math.min(2,globalThis.devicePixelRatio||1),b=Math.round(8*v)/v,y=Math.round(8*v*.6)/v,x=(e,t)=>fe(e,t*g),k=r.map(e=>function(e,t,n){const r=Math.round((e.y+e.h/2)/n-.5)*n,o=Math.ceil((e.x+5)/t)*t,a=Math.floor((e.x+e.w-5)/t)*t;return{x:o,y:r,w:Math.max(0,a-o)}}(s(e),y,b)),S=function(e,t){const n=e=>e.toFixed(2),r=e.filter(e=>e.w>4).map(({x:e,y:r,w:o})=>`M${n(e+2)} ${n(r)}H${n(e+o-2)}Q${n(e+o)} ${n(r)} ${n(e+o)} ${n(r+2)}V${n(r+t-2)}Q${n(e+o)} ${n(r+t)} ${n(e+o-2)} ${n(r+t)}H${n(e+2)}Q${n(e)} ${n(r+t)} ${n(e)} ${n(r+t-2)}V${n(r+2)}Q${n(e)} ${n(r)} ${n(e+2)} ${n(r)}Z`).join("");return r?`path("${r}")`:"inset(50%)"}(k,b);S!==M&&(M=S,w.canvas.style.clipPath=S);let A=!1;return r.forEach((r,i)=>{const{x:f,y:g,w:v}=k[i],w=p(r);if(!(v<=0)){if(e.save(),e.beginPath(),e.rect(f,g,v,b),e.clip(),"status"===w){const c=l.get(r),d=o?1:a((t-c.at)/240);d<1&&(A=!0);const u=he(m[c.from],m[c.to],d),p=!o&&(e=>void 0!==e.dataset.live?"false"!==e.dataset.live:n.current.live)(r);if(p){A=!0;const n=(t+1300*i)%4200/1100;if(n<1){const t=f-12+a(n)*(v+24);for(let n=f;n<f+v;n+=2){const r=.42*pe(n-t,9);r>.05&&(e.fillStyle=x(u,r),e.fillRect(n,g,2,b))}}}const w=r.querySelector("[data-dot]");if(w&&h.indicator){const n=s(w),r=(M=n.x+n.w/2,Math.round(M/y-.5)*y),o=p?.5-.5*Math.cos(t/1800*Math.PI*2):.6,a="neutral"===c.to?.7:1,i=a*(.4+.4*o);e.fillStyle=x(u,i),e.fillRect(r-y,g,3*y,b),e.fillStyle=x(u,a),e.fillRect(r,g,y,b)}}else if("new"===w){const n=(t-(c.get(r)??-1e6))/900;if(n<1&&!o){A=!0;const t=f-20+a(n)*(v+40),r=Math.sin(Math.PI*Math.min(1,1.15*n));for(let n=f;n<f+v;n+=2){const o=(n-f)/v,a=o<.5?he(ue[0],ue[1],2*o):he(ue[1],ue[2],2*o-1),i=r*pe(n-t,11);i>.2&&(e.fillStyle=fe(a,.55+.4*i),e.fillRect(n,g,2,b))}}}else{const n=d.get(r),i=u.get(r)?.digits.children,l=n?(t-n.at)/600:1;if(i)if(l>=1||o)for(const e of i)e.style.opacity="",e.style.translate="";else A=!0,[...i].forEach((r,o)=>{if(!n.changed[o])return;const i=r,l=s(i),c=(t-n.at-70*o)/460,d=a((c-.72)/.28);i.style.opacity=String(d),i.style.translate=`0 ${3*(d-1)}px`,c<=0||c>=1||(e.fillStyle=x(m.neutral,(.3+2.6*c%1*.7)*Math.min(1,(1-c)/.3)),e.fillRect(l.x,g,l.w,b))})}var M;e.restore()}}),A}}):null;const S=e=>[...e].map(e=>Object.assign(document.createElement("span"),{textContent:" "===e?"":e}));if(w){o||(w.canvas.style.zIndex="1");for(const e of r){const t=p(e);if("count"===t){const t=(e.textContent??"").trim(),n=[...e.childNodes],r=v(t),o=document.createElement("span");o.setAttribute("aria-hidden","true"),s.set(o,"display","inline-flex"),o.replaceChildren(...S(t)),e.replaceChildren(r,o),u.set(e,{text:t,live:r,digits:o}),h.push(()=>{const r=u.get(e)?.text??t;r===t?e.replaceChildren(...n):e.textContent=r})}else if("status"===t&&n.current.indicator&&!e.querySelector("[data-dot]")){const t=document.createElement("span");t.dataset.dot="",t.setAttribute("aria-hidden","true"),t.setAttribute("style","display:inline-block;flex:none;width:15px;height:8px;margin-inline-end:4px;vertical-align:middle"),e.prepend(t),h.push(()=>t.remove())}if("new"===t&&e.addEventListener("pointerenter",C),!o)for(const t of[...e.childNodes])if(3===t.nodeType&&t.textContent?.trim()){const e=document.createElement("span");t.parentElement.insertBefore(e,t),e.appendChild(t),h.push(()=>{e.parentElement?.insertBefore(t,e),e.remove()}),A(e)}else t instanceof HTMLElement&&void 0===t.dataset.dot&&A(t)}u.size&&document.fonts?.ready.then(()=>w?.kick())}function A(e){"static"===getComputedStyle(e).position&&s.set(e,"position","relative"),s.set(e,"z-index","2")}function E(e){const t=performance.now();for(const n of e?[e]:r.filter(e=>"new"===p(e)))c.set(n,t);w?.kick()}function C(e){n.current.sheen&&E(e.currentTarget)}return x(()=>w,n,()=>{f(performance.now()),w?.refresh()},{sheen:E,count:(e,t)=>{const n=t??r.find(e=>"count"===p(e));if(!n)return;const o=String(e),a=u.get(n);if(!a)return void(n.textContent=o);if(o===a.text)return;const i=Math.max(o.length,a.text.length),s=a.text.padStart(i," "),l=o.padStart(i," "),c=w?.still()??!0;a.text=o,a.live.textContent=o,a.digits.replaceChildren(...S(l)),d.set(n,{at:c?-1e6:performance.now(),changed:[...l].map((e,t)=>e!==s[t])}),w?.kick()},refresh:()=>{f(performance.now()),w?.kick()}},()=>{for(const e of r)e.removeEventListener("pointerenter",C);k()})}var ve={tabs:'[role="tab"]',duration:280,panels:"hidden",manage:!0};function be(e,t={}){const n={current:{...ve,...t}},r=()=>[...e.querySelectorAll(n.current.tabs)],i=r().findIndex(e=>"true"===e.getAttribute("aria-selected"));let s=Math.max(0,n.current.active??(i>=0?i:0)),l=s,c=-1e6;let d=null;d=y({host:e,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.96,...n.current.look}),ink:e=>n.current.ink??(e?"#7a7872":"#76746e"),reducedMotion:()=>n.current.reducedMotion,onFail:()=>{d=null},paint:({pen:e,now:t,still:i,box:d})=>{const u=r(),h=u[l],p=u[s];if(!h||!p)return!1;const f=d(h),m=d(p),g=i?1:(t-c)/n.current.duration;if(g>=1){const t=m.x+1,n=m.y+1.5,r=m.w-2,o=m.h-3;e.save(),e.beginPath(),e.roundRect(t,n,Math.max(0,r),Math.max(0,o),Math.max(0,o/2)),e.clip();for(let a=0;a<r;a+=2){const i=Math.round(255*(.2+.5*Math.max(0,1-Math.min(a,r-a)/22)));e.fillStyle=`rgb(${i} ${i} ${i})`,e.fillRect(t+a,n,2,o)}return e.restore(),!1}const{left:v,right:b,dir:y}=function(e,t,n){const r=Math.sign(t.x-e.x)||1,o=a(n/.8),i=a((n-.22)/.78),s=(r>0?e.x+e.w:e.x)+((r>0?t.x+t.w:t.x)-(r>0?e.x+e.w:e.x))*o,l=(r>0?e.x:e.x+e.w)+((r>0?t.x:t.x+t.w)-(r>0?e.x:e.x+e.w))*i;return{left:Math.min(s,l),right:Math.max(s,l),dir:r}}(f,m,g),x=Math.max(1,b-v),w=f.y,M=f.h,k=3.72,S=Math.floor(t/40);e.save(),e.beginPath(),e.roundRect(v,w+1.5,x,Math.max(0,M-3),Math.max(0,(M-3)/2)),e.clip();for(let t=v;t<b;t+=k){const n=y>0?(t-v)/x:(b-t)/x,r=Math.min(1,1.4*g),a=.25+.75*(r+(1-r)*n**1.6);for(let i=0;i<M;i+=6){if(o(Math.round(t/k),i+S)>=a)continue;const s=i<5||i>M-8,l=Math.round((s?150:70+110*(1-r)*n)*(.6+.4*a));e.fillStyle=`rgb(${l} ${l} ${l})`,e.fillRect(t,w+i,k,6)}}return e.restore(),!0}});const u=()=>{const e=n.current;r().forEach((t,n)=>{const r=n===s;e.manage&&(t.setAttribute("aria-selected",String(r)),t.tabIndex=r?0:-1);const o=t.getAttribute("aria-controls")?document.getElementById(t.getAttribute("aria-controls")):null;o&&"none"!==e.panels&&("hidden"===e.panels?o.hidden=!r:o.toggleAttribute("data-active",r))})},h=(e,t=!1)=>{const o=r();if(!o.length)return;const a=(e%o.length+o.length)%o.length;t&&o[a].focus(),a!==s&&(l=s,s=a,c=performance.now(),u(),d?.kick(),n.current.onChange?.(a,o[a]))},p=e=>{if(!n.current.manage)return;const t=e.target.closest?.(n.current.tabs),o=t?r().indexOf(t):-1;o>=0&&h(o)},f=e=>{if(!n.current.manage)return;const t={ArrowRight:s+1,ArrowLeft:s-1,Home:0,End:r().length-1};e.key in t&&(e.preventDefault(),h(t[e.key],!0))};return e.addEventListener("click",p),e.addEventListener("keydown",f),u(),x(()=>d,n,e=>{void 0!==e.active&&e.active!==s&&h(e.active),u(),d?.refresh()},{select:h,get active(){return s}},()=>{e.removeEventListener("click",p),e.removeEventListener("keydown",f)})}var ye=280,xe={preview:[{k:.5,blur:9},{k:.78,blur:4}],final:{k:1,blur:0}},we=async e=>{if("function"==typeof createImageBitmap)return createImageBitmap("string"==typeof e?await(await fetch(e)).blob():e);const t=new Image;return t.crossOrigin="anonymous",t.src="string"==typeof e?e:URL.createObjectURL(e),await t.decode(),t};function Me(e,t={}){const n={current:{...t}},r=g(),o=document.createElement("canvas");let a="idle",i=0,l=0,c="",d=null;const u={from:{img:null,k:0,blur:12},to:{img:null,k:0,blur:12},at:-1e6},h=()=>void 0===n.current.image?e.querySelector("img"):n.current.image,p=(e,t)=>{const n=t?1:s(Math.min(1,Math.max(0,(e-u.at)/ye))),r=u.from.blur+(u.to.blur-u.from.blur)*n;return[{...u.from,k:u.from.k*(1-n),blur:r},{...u.to,k:u.from.k+(u.to.k-u.from.k)*n,blur:r}]},f=(e,t,n)=>{const r=performance.now(),[o,a]=p(r,!!d?.still());u.from={img:a.img??o.img,k:o.k+a.k,blur:a.blur},u.to={img:e,k:t,blur:n},u.at=r,d?.kick()};d=y({host:e,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,contrast:1.4,drift:.5,speed:.6,hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",reducedMotion:()=>n.current.reducedMotion,resolution:(e,t)=>{const n=Math.min(480,Math.max(2,Math.round(e)));return[n,Math.max(2,Math.round(n*t/Math.max(1,e)))]},onFail:()=>{d=null,r.restore()},paint:({pen:e,width:t,height:r,now:s,still:l})=>{const c="generating"===a,d=l?0:(s-i)/1e3;c&&n.current.elapsed&&(n.current.elapsed.textContent=(e=>{const t=e/1e3;return t<60?`${t.toFixed(1)}s`:`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`})(s-i));const h=c&&!l?1+.12*Math.sin(2.1*d)*(.7+.3*Math.sin(.37*d)):1,f=Math.max(2,Math.round(t/20)),m=Math.max(2,Math.ceil(r/20));o.width===f&&o.height===m||(o.width=f,o.height=m),W(o,3.1+(c?.55*d:0),.35);const g=p(s,l),v=Math.min(1,g.reduce((e,t)=>e+(t.img?t.k:0),0));e.imageSmoothingEnabled=!0,e.globalAlpha=Math.max(0,1-v),e.filter=`brightness(${1.7*h})`,e.drawImage(o,0,0,t,r);for(const{img:n,k:o,blur:a}of g){if(!n||o<=0)continue;const i=n.width,s=n.height,l=Math.min(s,i*r/t),c=Math.min(i,s*t/r);e.globalAlpha=Math.min(1,1.25*o),e.filter=`brightness(1.3) blur(${a}px)`,e.drawImage(n,(i-c)/2,Math.max(0,.45*(s-l)),c,l,0,0,t,r)}return e.filter="none",e.globalAlpha=1,c||s-u.at<ye}});const m=(t,r)=>{a=t,e.dataset.state=t,e.setAttribute("aria-busy",String("generating"===t)),n.current.onState?.(t,r)},v=e=>{const t=h();t&&d&&(r.set(t,"transition",d.still()?"none":"opacity 280ms cubic-bezier(.16, 1, .3, 1)"),r.set(t,"opacity",e?"1":"0"))},b=e=>new Promise(t=>setTimeout(t,e)),w=e=>{const t=h();t&&(c&&URL.revokeObjectURL(c),c="string"==typeof e?"":URL.createObjectURL(e),t.src=c||e,d||r.set(t,"visibility","visible"))},M=async(e=n.current.stream)=>{if(!e)return a;const t=++l,r=()=>t===l,o=!!d?.still();i=performance.now(),m("generating"),v(!1),f(null,0,12);let s=0;try{for await(const t of"function"==typeof e?e():e){if(!r())return a;if(!(t.final??t.preview))continue;if(t.final){w(t.final),d&&f(await we(t.final),xe.final.k,xe.final.blur);break}if(!d){w(t.preview);continue}const e=xe.preview[Math.min(s++,xe.preview.length-1)];f(await we(t.preview),e.k,e.blur)}if(await b(o?0:ye),!r())return a;m("done"),v(!0),d?.kick()}catch(e){if(!r())return a;f(null,0,12),await b(o?0:ye),m("failed",e)}return a};{const e=h();e&&r.set(e,d?"opacity":"visibility",d?"0":e.getAttribute("src")?"visible":"hidden")}return n.current.stream&&M(),x(()=>d,n,()=>d?.refresh(),{run:M,reset(){l++,f(null,0,12),m("idle"),v(!1)},get state(){return a}},()=>{l++,c&&URL.revokeObjectURL(c),delete e.dataset.state,e.removeAttribute("aria-busy"),r.restore()})}var ke=e=>new Promise(t=>setTimeout(t,e));function Se(n){const{host:r,layer:o="under"}=n;if("undefined"==typeof document||!e())return null;const a=g(),i=document.createElement("canvas");"static"===getComputedStyle(r).position&&a.set(r,"position","relative"),"under"===o&&a.set(r,"isolation","isolate"),i.dataset.asciiKit="",i.setAttribute("style",`position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:inherit;z-index:${"under"===o?-1:"auto"}`),r.appendChild(i);let s=m(r),u=!1;const h=()=>{const e=n.reducedMotion();return!0===e?{speed:0,drift:0,respectReducedMotion:!0}:{respectReducedMotion:!1!==e}},p=()=>d(n.ink(s),r,s?"#d8d6cf":"#1d1d1b")??"#888888";let f;try{f=t(i,{...c,...n.look(s),...h(),ink:p(),source:n.source??null,interactionTarget:r,label:n.label??"",onError:()=>{u||(M(),n.onFail?.())}})}catch{return i.remove(),a.restore(),null}n.label||(i.removeAttribute("role"),i.removeAttribute("aria-label"),i.setAttribute("aria-hidden","true"));let v=0;const b=()=>{u||(s=m(r),f.update({...n.look(s),...h(),ink:p()}))},y=()=>{v||u||(v=requestAnimationFrame(()=>{v=0,b()}))},x="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;x?.addEventListener?.("change",y);const w="function"==typeof MutationObserver?new MutationObserver(y):null;for(const e of[document.documentElement,document.body])e&&w?.observe(e,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});function M(){if(!u){u=!0,v&&cancelAnimationFrame(v),w?.disconnect(),x?.removeEventListener?.("change",y),f.destroy();try{i.getContext("webgl2")?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}i.remove(),a.restore()}}return{get field(){return f},canvas:i,dark:()=>s,still:()=>!!(n.reducedMotion()??l()),refresh:b,destroy:M}}function Ae(e,t,n,r,o=()=>{}){let a=!1;const i={get supported(){return!!e()&&!a},get field(){return a?null:e()?.field??null},update(r){a||(t.current={...t.current,...r},n(t.current),e()?.refresh())},play(){a||e()?.field.play()},pause(){a||e()?.field.pause()},destroy(){a||(a=!0,o(),e()?.destroy())}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}function Ee(e,t){const n=Object.assign(document.createElement("canvas"),{width:e,height:t}),r=n.getContext("2d");return r.fillStyle="#000",r.fillRect(0,0,e,t),{canvas:n,pen:r}}function Ce(e,t,n){if(!t)return void e.pulse({strength:n});if("getBoundingClientRect"in t)return void e.pulse({element:t,strength:n});const r=e.canvas.getBoundingClientRect();e.pulse({x:t.x-r.left,y:t.y-r.top,strength:n})}var Le={preset:"hero",clear:!1,text:"404",ripple:!0},$e=28,Re='600 440px "Geist", Arial, sans-serif',Ie=()=>"number"==typeof innerWidth&&innerWidth<760,Te=e=>({mark:"glyph",scene:"drift",levels:"auto",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:10,cellAspect:.62,glyphScale:.86,color:"ink",shade:0,hover:"trail",trail:{strength:.9,radius:.32},...e}),Fe={mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.4,fit:"contain",clear:!1,focus:{x:.5,y:.5},drift:.8,speed:.7,levels:"auto",hover:"trail",trail:{strength:1,radius:.42}};var Pe=[...Array.from({length:10},(e,t)=>(t+1)/10),1,1,1,...Array.from({length:14},(e,t)=>1-(t+1)/14)];function We(e,t,n,r){const o=t.getContext("2d");o.globalAlpha=1,o.fillStyle="#000",o.fillRect(0,0,t.width,t.height);for(const t of n){const n=Math.min(1,Math.max(0,(r-t.lag*(1-r))/(1-.5*t.lag))),a=n*n*(3-2*n);o.globalAlpha=1-.72*a,o.drawImage(e,t.x,t.y,$e,$e,t.x+t.dx*a,t.y+t.dy*a,$e,$e)}o.globalAlpha=1}function ze(e,t={}){const n={current:{...Le,...t}},r=()=>"notFound"===n.current.preset;let a=0,i=!1,s=0;const l={x:-1e4,y:-1e4,at:-1e6},c=()=>function(e){const t=document.createElement("canvas").getContext("2d");t.font=Re;const n=Math.max(320,Math.ceil(t.measureText(e).width)+160),{canvas:r,pen:o}=Ee(n,560);return o.fillStyle="#fff",o.textAlign="center",o.textBaseline="middle",o.font=Re,o.letterSpacing="-10px",o.fillText(e,n/2,296),r}(n.current.text);let d=null;d=Se({host:e,look:()=>{const e=n.current,t=e.clear,r=e=>!!t&&{element:t,padding:-14,feather:e,shape:"ellipse"};return{..."notFound"===e.preset?Fe:"brand"===e.preset?Te({scale:Ie()?1.4:1.6,brightness:.24,contrast:1.1,clear:r(.3)}):Te({scale:Ie()?1.6:1.9,brightness:.26,contrast:1.15,clear:r(.22)}),...e.look}},ink:e=>{const t=n.current,r=t.palette,o="string"==typeof r?r:r?.[e?"dark":"light"];return o??t.ink?o??t.ink:"notFound"===t.preset?e?"#d8d6cf":"#1d1d1b":"brand"===t.preset?`var(--brand, ${e?"#8f80ff":"#5b4bd1"})`:e?"#8a8881":"#6b6964"},source:r()?c():null,label:n.current.label??(r()?n.current.text:void 0),reducedMotion:()=>n.current.reducedMotion,onFail:()=>{d=null}}),d&&r()&&document.fonts?.load?.(Re).then(()=>{d&&r()&&!i&&d.field.setSource(c())},()=>{});const u=(e,t=1.4)=>{d&&!d.still()&&(s=performance.now()+1400,Ce(d.field,e,t))},h=e=>{const t=n.current,o=performance.now();!d||r()||!t.ripple||d.still()||o<s||o-l.at<520||Math.hypot(e.clientX-l.x,e.clientY-l.y)<36||(Object.assign(l,{x:e.clientX,y:e.clientY,at:o}),Ce(d.field,{x:e.clientX,y:e.clientY},.65))};d&&e.addEventListener("pointermove",h);let p=n.current.preset,f=n.current.text;return Ae(()=>d,n,e=>{d&&((e.preset!==p||"notFound"===e.preset&&e.text!==f)&&(a++,i=!1,d.field.setSource("notFound"===e.preset?c():null)),p=e.preset,f=e.text)},{pulse:u,scatter:async e=>{const t=d?.field;if(!t)return;if(!r())return void u(e);if(e&&u(e,1.2),i||d.still())return;i=!0;const n=++a,s=c(),l=function(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height).data,n=[];for(let r=0;r<e.height;r+=$e)for(let a=0;a<e.width;a+=$e){let i=!1;for(let n=0;n<$e&&!i;n+=4)for(let o=0;o<$e&&!i;o+=4)i=(t[4*((r+n)*e.width+a+o)]??0)>40;if(!i)continue;const s=n.length,l=o(s,1)*Math.PI*2,c=120+420*o(s,2);n.push({x:a,y:r,dx:Math.cos(l)*c+.5*(a-e.width/2),dy:Math.sin(l)*c*.6,lag:.35*o(s,3)})}return n}(s),h=Ee(s.width,s.height).canvas;for(const e of Pe){const r=performance.now();if(We(s,h,l,e),await t.setSource(h),await ke(Math.max(0,44-(performance.now()-r))),n!==a||!d)return void(i=!1)}await t.setSource(s),i=!1}},()=>{a++,e.removeEventListener("pointermove",h)})}var Oe={font:'Georgia, "Times New Roman", serif',fontWeight:600};function Ne(e,t={}){const n=(e.textContent??"").trim(),r={current:{...Oe,...t}};let o=r.current.text??n;const a=g(),i=()=>function(e,t=Oe.font,n=Oe.fontWeight){const{canvas:r,pen:o}=Ee(1800,520),a=Math.min(400,1700/Math.max(3,.56*[...e].length));return o.fillStyle="#fff",o.textAlign="center",o.textBaseline="middle",o.font=`${n} ${a}px ${t}`,o.fillText(e||" ",r.width/2,r.height/2+.05*a),r}(o,r.current.font,r.current.fontWeight),s=!n;let l=null;l=Se({host:e,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"contain",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.62,radius:.22},...r.current.look}),ink:e=>r.current.ink??(e?"#d8d6cf":"#1d1d1b"),source:i(),label:s?o:void 0,reducedMotion:()=>r.current.reducedMotion,onFail:()=>{l=null,a.restore()}}),l&&n&&a.set(e,"color","transparent"),l&&document.fonts?.load?.(`${r.current.fontWeight} 100px ${r.current.font}`).then(()=>{l&&l.field.setSource(i())},()=>{});const c=t=>{if(t!==o)if(o=t,l)if(l.field.setSource(i()),s)l.field.update({label:o||" "});else{for(const t of[...e.childNodes])t!==l.canvas&&t.remove();e.prepend(document.createTextNode(o))}else n&&(e.textContent=o)};return Ae(()=>l,r,e=>{void 0!==e.text&&e.text!==o?c(e.text):l&&l.field.setSource(i())},{setText:c,get text(){return o}},()=>a.restore())}var Be="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;pointer-events:none";function Ge(e,t={}){const n={current:{...t}},r=g(),o=[],a=e.querySelector("video"),i=n.current.src??a??null,s=()=>n.current.reducedMotion??l();let c=null;c=i?Se({host:e,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.25,levels:"auto",fit:"cover",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:e=>n.current.ink??(e?"#d8d6cf":"#1d1d1b"),source:i,label:n.current.label??"Video, drawn in characters",reducedMotion:()=>n.current.reducedMotion,onFail:()=>{c=null,r.restore(),f()}}):null,c&&i instanceof HTMLVideoElement&&(e.contains(i)&&r.set(i,"opacity","0"),i.muted=!0,i.loop=!0,i.playsInline=!0);let d=null;n.current.poster&&i&&(d=Object.assign(document.createElement("img"),{alt:"",decoding:"async"}),d.className="ascii-video-poster",d.setAttribute("aria-hidden","true"),d.setAttribute("style",`${Be};transition:opacity 280ms cubic-bezier(.16, 1, .3, 1)`),d.src=n.current.poster,"static"===getComputedStyle(e).position&&r.set(e,"position","relative"),e.appendChild(d),o.push(d));let u=!1;const h=()=>{d&&(d.style.opacity=c&&u&&(m||!s())?"0":"1")};let p=null;function f(){!p&&i&&(i instanceof HTMLVideoElement?p=i:(p=document.createElement("video"),p.src=i,p.setAttribute("style",Be),p.setAttribute("aria-label",n.current.label??"Video"),"static"===getComputedStyle(e).position&&r.set(e,"position","relative"),d?e.insertBefore(p,d):e.appendChild(p),o.push(p)),n.current.poster&&!p.poster&&(p.poster=n.current.poster),p.muted=!0,p.loop=!0,p.playsInline=!0,d&&(d.style.opacity="0"),m&&p.play?.()?.catch?.(()=>{}))}let m=n.current.autoplay??!(c?c.still():s());c?(c.field.ready.then(()=>{u=!0,m||c?.field.pause(),h()}),m&&i instanceof HTMLVideoElement&&i.play?.()?.catch?.(()=>{}),h()):f();const v=Ae(()=>c,n,()=>{},{toggle:()=>(m?v.pause():v.play(),m),get playing(){return m}},()=>{o.forEach(e=>e.remove()),r.restore()}),b=v.play,y=v.pause;return v.play=()=>{c&&!v.supported||(m=!0,c?b():p?.play?.()?.catch?.(()=>{}),h())},v.pause=()=>{c&&!v.supported||(m=!1,c?y():p?.pause?.(),h())},v}function He(e,t={}){const n={current:{...t}},r=g(),o=e.querySelector("img"),a=n.current.image??o??null;let i=null;i=a?Se({host:e,look:()=>{const e=n.current;return{mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"cover",focus:e.focus??{x:.5,y:.4},hover:"trail",trail:{strength:.95,radius:.42},clear:!!e.clear&&{element:e.clear,padding:8,feather:.12,shape:"rect"},...e.look}},ink:e=>n.current.ink??(e?"#d8d6cf":"#1d1d1b"),source:a,label:n.current.label??(a instanceof HTMLImageElement&&a.alt||void 0),reducedMotion:()=>n.current.reducedMotion,onFail:()=>{i=null,r.restore()}}):null,i&&o&&a===o&&r.set(o,"opacity","0");let s=0,l=!1;return Ae(()=>i,n,()=>{},{pulse:(e,t=1)=>{i&&!i.still()&&Ce(i.field,e,t)},shimmer:e=>{const t=i?.field;if(!t||e===l||e&&i.still())return;const n=++s;l=e,e?(async()=>{let e;try{e=await(async()=>{if(a instanceof HTMLImageElement)return a.complete||await a.decode(),a;const e=new Image;return e.crossOrigin="anonymous",e.src=a,await e.decode(),e})()}catch{return}const r=Math.min(1,1400/Math.max(e.naturalWidth,e.naturalHeight,1)),o=Object.assign(document.createElement("canvas"),{width:Math.max(1,Math.round(e.naturalWidth*r)),height:Math.max(1,Math.round(e.naturalHeight*r))}),l=o.getContext("2d"),c=o.width,d=o.height,u=performance.now();for(;n===s&&i?.field===t;){const n=performance.now(),r=-.4*c+1.8*((n-u)/1100%1)*c;l.globalCompositeOperation="source-over",l.drawImage(e,0,0,c,d);const a=l.createLinearGradient(r-.22*c,.3*r,r+.22*c,.3*r+.3*d);a.addColorStop(0,"rgb(0 0 0 / 0)"),a.addColorStop(.5,"rgb(255 255 255 / .42)"),a.addColorStop(1,"rgb(0 0 0 / 0)"),l.globalCompositeOperation="lighter",l.fillStyle=a,l.fillRect(0,0,c,d),await t.setSource(o),await ke(Math.max(0,48-(performance.now()-n)))}})():t.setSource(a)}},()=>{s++,r.restore()})}var De={saving:null,font:'"Geist", Arial, sans-serif'};function qe(e,t,n,r=De.font){const o=Math.max(2,Math.round(2*e.offsetWidth)),a=Math.max(2,Math.round(2*e.offsetHeight)),{canvas:i,pen:s}=Ee(o,a),l=s.createRadialGradient(o,0,0,o,0,.52*Math.hypot(o,a));l.addColorStop(0,"rgb(150 150 150)"),l.addColorStop(.4,"rgb(64 64 64)"),l.addColorStop(1,"rgb(0 0 0)"),s.fillStyle=l,s.fillRect(0,0,o,a);const c=t?function(e,t){const n=e.getBoundingClientRect(),r=n.height?e.offsetHeight/n.height:1,o=t?.getBoundingClientRect().top??n.top+n.height;let a=t;for(;a&&a.parentElement!==e;)a=a.parentElement;let i=n.top;for(const t of Array.from(e.children)){if(t===a)break;if(void 0!==t.dataset?.asciiKit)continue;const e=t.getBoundingClientRect();e.height&&(i=Math.max(i,e.top+e.height))}return{middle:((i+o)/2-n.top)*r,height:(o-i)*r}}(e,n):null;if(t&&c&&c.height>=30){const e=Math.min(2*c.height*.9,.34*o),n=o-.07*o,a=2*c.middle+.04*e;s.font=`600 ${e}px ${r}`,s.letterSpacing=.04*-e+"px",s.textAlign="right",s.textBaseline="middle",s.lineJoin="round",s.lineWidth=.28*e,s.strokeStyle="rgb(0 0 0 / .85)",s.strokeText(t,n,a),s.fillStyle="#fff",s.fillText(t,n,a)}return i}function je(e,t={}){const n={current:{...De,...t}},r=(t=n.current.saving)=>qe(e,t,(()=>{const t=n.current.price;return"string"==typeof t?e.querySelector(t):t??e.querySelector("[data-price]")})(),n.current.font);let o=null,a=0,i=0,s=0,l=null;l=Se({host:e,look:()=>({mark:"dot",scene:"drift",scale:"number"==typeof innerWidth&&innerWidth<760?1.7:1,cellSize:4,cellAspect:1,dotScale:.92,color:"ink",shade:0,fit:"cover",focus:{x:.5,y:.5},levels:"none",contrast:1.1,brightness:-.04,drift:.5,hover:"lantern",lantern:{radius:.26,strength:.4,trail:.7,follow:8},trail:{strength:.9,radius:.4},fluid:{radius:.09,refraction:.03,glow:.6},...n.current.look}),ink:e=>n.current.ink??(e?"#aeaca5":"#5c5a55"),source:o=r(),reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,c?.disconnect()}}),i=e.offsetWidth,s=e.offsetHeight;const c=l&&"function"==typeof ResizeObserver?new ResizeObserver(()=>{!l||Math.abs(e.offsetWidth-i)<2&&Math.abs(e.offsetHeight-s)<2||(i=e.offsetWidth,s=e.offsetHeight,a++,l.field.setSource(o=r()))}):null;c?.observe(e);const d=async e=>{const t=l?.field,n=o;if(o=e,!t)return;const r=++a;if(!n||l.still())return void await t.setSource(e);const i=Ee(e.width,e.height),s=i.pen,c=e.width,d=e.height,u=.34*c;for(let o=1;o<=9&&r===a;o++){const r=performance.now(),a=o/9*(c+2*u)-u,l=Math.max(0,Math.min(c,a));s.globalCompositeOperation="source-over",s.drawImage(n,0,0,c,d),l>0&&s.drawImage(e,0,0,l,d,0,0,l,d);const h=s.createLinearGradient(a-u,0,a+.4*u,0);h.addColorStop(0,"rgb(0 0 0 / 0)"),h.addColorStop(.72,"rgb(255 255 255 / .5)"),h.addColorStop(1,"rgb(0 0 0 / 0)"),s.globalCompositeOperation="lighter",s.fillStyle=h,s.fillRect(0,0,c,d),await t.setSource(i.canvas),await ke(Math.max(0,48-(performance.now()-r)))}r===a&&l?.field===t&&await t.setSource(e)};return Ae(()=>l,n,()=>{d(r())},{sweep:()=>d(r()),saving:e=>(n.current={...n.current,saving:e},d(r(e))),pulse:(e,t=1.6)=>{l&&!l.still()&&Ce(l.field,e,t)}},()=>{a++,c?.disconnect()})}var Ue={aurora:["#2ee6c8","#9d7bff","#ff6fb5"],brand:["#ffb000","#ffd84d"]},Ve={palette:"aurora",swell:!0},Xe=e=>"mono"===e?[]:"string"==typeof e?[...Ue[e]??Ue.aurora]:[...e];function Ye(e,t){if(1===e.length)return e[0];const n=r(t)*(e.length-1),o=Math.min(e.length-2,Math.floor(n)),a=n-o,[i,s]=[e[o],e[o+1]].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)||0));return`rgb(${i.map((e,t)=>Math.round(e+(s[t]-e)*a)).join(" ")})`}function Ke(e,t={}){const n={current:{...Ve,...t}},o=g();let a="idle",i=0,l=r(n.current.level??0),c=l,d=0,u=0,h=Xe(n.current.palette),p=null,f=null,m=0;const v=e=>{e.canvas.style.filter=!e.dark()&&h.length?"brightness(.68) saturate(1.35)":""},b=t=>{e.style.setProperty("--ascii-level",t.toFixed(3)),n.current.swell&&o.set(e,"scale",String(1+.1*t))};p=y({host:e,outset:Math.round(.08*(e.offsetWidth||0)),look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.92,fit:"cover",color:h.length?"source":"ink",contrast:2.2,brightness:1.1-.5,saturation:1.4,...n.current.look}),ink:e=>n.current.ink??(e?"#d8d6cf":"#1d1d1b"),reducedMotion:()=>n.current.reducedMotion,onTheme:()=>p&&v(p),onFail:()=>{p=null},paint:({pen:e,w:t,h:n,now:o,still:p})=>{const m=u?Math.min(64,o-u):16;u=o;const g=r((e=>"listening"===a?f?f.read():l:"thinking"===a?.2+.1*Math.sin((e-i)/120):"done"===a?d*(1-s(r((e-i)/420))):l)(o));return p||"done"===a?c=g:c+=(g-c)*(1-(1-(g>c?.45:.12))**(m/16.7)),p||b(c),function(e,t,n,o,a,i){const s=e=>{const t=Math.round(255*r(e)/2.2);return`rgb(${t} ${t} ${t})`},l=t/2,c=n/2,d=.36/(.92-.16*a)*Math.min(t,n),u=.86+.46*a,h=o*(.25+.6*a),p=e.createRadialGradient(l,c,.92*d,l,c,1.3*d);p.addColorStop(0,s(.36*u)),p.addColorStop(1,"#000"),e.fillStyle=p,e.fillRect(0,0,t,n),e.save(),e.beginPath(),e.arc(l,c,d,0,2*Math.PI),e.clip();const f=l+.8*Math.cos(h)*d*.62,m=c-.55*d*.62,g=e.createRadialGradient(f,m,0,f,m,1.7*d);g.addColorStop(0,s(.95*u)),g.addColorStop(.55,s(.5*u)),g.addColorStop(1,s(.18)),e.fillStyle=g,e.fillRect(l-d,c-d,2*d,2*d),e.globalCompositeOperation="lighter",e.lineWidth=Math.max(1.5,.05*d);for(let t=0;t<6;t++){const n=t/6*Math.PI+.35*o,r=Math.sin(n);r<0||(e.strokeStyle=s(.16*r),e.beginPath(),e.ellipse(l,c,d*Math.abs(Math.cos(n)),d,0,0,2*Math.PI),e.stroke())}e.globalCompositeOperation="source-over";const v=e.createRadialGradient(l,c,.7*d,l,c,d);if(v.addColorStop(0,"rgb(0 0 0 / 0)"),v.addColorStop(1,s(.3)),e.fillStyle=v,e.fillRect(l-d,c-d,2*d,2*d),e.restore(),!i.length)return;e.globalCompositeOperation="color";const b=.4*o,y=.5*a,x=e.createLinearGradient(l-Math.cos(b)*d,c-Math.sin(b)*d,l+Math.cos(b)*d,c+Math.sin(b)*d);x.addColorStop(0,Ye(i,y)),x.addColorStop(.5,Ye(i,y+.25)),x.addColorStop(1,Ye(i,y+.5)),e.fillStyle=x,e.fillRect(0,0,t,n),e.globalCompositeOperation="source-over"}(e,t,n,p?0:o/1e3,c,h),!0}}),p&&v(p);const w=()=>{m++,f&&(f.stream.getTracks().forEach(e=>e.stop()),f.context.close().catch(()=>{}),f=null)},M=t=>{"listening"!==t&&w(),"done"===t&&(d=c),a=t,i=performance.now(),e.dataset.state=t,p||b("listening"===t?l:0),p?.kick()};return x(()=>p,n,e=>{h=Xe(e.palette),void 0!==e.level&&(l=r(e.level)),p?.refresh(),p&&v(p)},{level(e){l=r(Number.isFinite(e)?e:0),p||"listening"!==a||b(l),p?.kick()},listen:()=>M("listening"),think:()=>M("thinking"),done:()=>M("done"),idle:()=>{l=0,M("idle")},async mic(){w();const e=m,t="undefined"!=typeof navigator?navigator.mediaDevices:void 0,n=globalThis.AudioContext;if(!t?.getUserMedia||!n)return!1;let r;try{r=await t.getUserMedia({audio:!0})}catch{return!1}if(e!==m)return r.getTracks().forEach(e=>e.stop()),!1;const o=new n,a=o.createAnalyser();a.fftSize=1024,o.createMediaStreamSource(r).connect(a);const i=new Uint8Array(a.fftSize);return f={stream:r,context:o,read(){a.getByteTimeDomainData(i);let e=0;for(const t of i)e+=((t-128)/128)**2;return 5*Math.sqrt(e/i.length)}},M("listening"),!0},get state(){return a},get current(){return c}},()=>{w(),o.restore(),e.style.removeProperty("--ascii-level"),delete e.dataset.state})}var Je=e=>{const t=Math.round(255*Math.min(1,Math.max(0,e)));return`rgb(${t} ${t} ${t})`},_e=e=>{if(!e||"transparent"===e)return 0;const t=/\/\s*([\d.]+)(%?)\s*\)$/.exec(e);if(t)return parseFloat(t[1])/(t[2]?100:1);const n=/^rgba\([^)]*,\s*([\d.]+)\s*\)$/.exec(e);return n?parseFloat(n[1]):1},Qe=/^(IMG|PICTURE|VIDEO|CANVAS|SVG|svg)$/;function Ze(e,t,n){const r=(e,t)=>Math.max(0,Math.min(parseFloat(e.borderTopLeftRadius)||0,t.w/2,t.h/2)),o=[t,...t.querySelectorAll("*")];e.save();for(const a of o){if("CANVAS"===a.tagName&&void 0!==a.dataset?.asciiKit)continue;const o=n(a);if(o.w<=0||o.h<=0)continue;const i=getComputedStyle(a);if("hidden"===i.visibility||"none"===i.display)continue;const s=_e(i.backgroundColor)>.03,l=(parseFloat(i.borderTopWidth)||0)>0&&_e(i.borderTopColor)>.1;if(e.beginPath(),a===t)(s||l)&&(e.strokeStyle=Je(.42),e.lineWidth=3,e.roundRect(o.x+1.5,o.y+1.5,o.w-3,o.h-3,r(i,o)),e.stroke());else{if(Qe.test(a.tagName)){e.fillStyle=Je(.5),o.w<32&&o.h<32?e.arc(o.x+o.w/2,o.y+o.h/2,.36*Math.min(o.w,o.h),0,2*Math.PI):e.roundRect(o.x,o.y,o.w,o.h,r(i,o)),e.fill();continue}s?(e.fillStyle=Je(.22),e.roundRect(o.x,o.y,o.w,o.h,r(i,o)),e.fill()):l&&(e.strokeStyle=Je(.32),e.lineWidth=1.5,e.roundRect(o.x+.75,o.y+.75,o.w-1.5,o.h-1.5,r(i,o)),e.stroke())}if("INPUT"===a.tagName||"TEXTAREA"===a.tagName){const t=a,n=t.value||t.placeholder||"";n&&et(e,n,o.x+(parseFloat(i.paddingLeft)||0),o.y,o.h,i,t.value?.82:.5)}}!function(e,t,n){if("function"!=typeof document.createTreeWalker)return;const r=document.createTreeWalker(t,4),o=document.createRange(),a=n(t),i=t.getBoundingClientRect(),s=i.width/(t.offsetWidth||i.width||1)||1;let l=0;for(let t=r.nextNode();t&&l<2e3;t=r.nextNode()){const n=t.parentElement;if(!n)continue;const r=getComputedStyle(n);if("hidden"===r.visibility)continue;const c=(parseFloat(r.fontWeight)||400)>=600||/^H[1-6]$/.test(n.tagName)?1:.8;for(const n of t.data.matchAll(/\S+/g)){o.setStart(t,n.index),o.setEnd(t,n.index+n[0].length);const d=o.getClientRects()[0];d&&(l++,et(e,n[0],a.x+(d.left-i.left)/s,a.y+(d.top-i.top)/s,d.height/s,r,c))}}o.detach?.()}(e,t,n),e.restore()}function et(e,t,n,r,o,a,i){const s=Math.min(900,(parseFloat(a.fontWeight)||400)+200);e.font=`${a.fontStyle||"normal"} ${s} ${a.fontSize} ${a.fontFamily}`,e.fillStyle=Je(i),e.shadowColor=Je(i),e.shadowBlur=3,e.textBaseline="middle",e.fillText(t,n,r+o/2),e.shadowBlur=0}function tt(e,t,n,r,o=2){const a=document.createElement("canvas");a.width=Math.max(2,Math.round(n*o)),a.height=Math.max(2,Math.round(r*o));const i=a.getContext("2d",{willReadFrequently:!0});return i?(i.setTransform(o,0,0,o,0,0),i.fillStyle="#000",i.fillRect(0,0,n,r),Ze(i,e,t),a):a}var nt={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0},rt=e=>{const t=Math.round(255*r(e));return`rgb(${t} ${t} ${t})`};function ot(e,t={}){const n={current:{...nt,...t}},a=g(),i=()=>[...e.querySelectorAll(n.current.rows)],c=()=>e.querySelector(n.current.input);let d=n.current.open??!e.hasAttribute("hidden"),u=0,h=null,p=!1,f=0,m=0,v=null,w=!1,M=0,k=null;const S=()=>!!(n.current.reducedMotion??l());k=y({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:e=>n.current.ink??(e?"#d8d6cf":"#1d1d1b"),reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{k=null},paint:({pen:e,now:t,still:n,box:o})=>{e.setTransform(2,0,0,2,0,0);const a=m?Math.min(48,t-m):16;if(m=t,v){const o=v,a=(t-o.start)/(o.closing?200:260);if(!(a>=1||n)){const t=o.closing?1-1.02*s(a):1.04*s(a);return function(e,t,n,r,o,a,i=1,s=.32,l=2){for(let c=0;c<n.length;c++){const d=n[c],u=(o-r[c]*(1-s))/s;if(u<=0)continue;const h=u>=1?0:1-u;let p=d.x,f=d.y;if(h>0){const[e,t]=a(d,h);p+=e,f+=t}e.globalAlpha=i*(1-h*h),e.drawImage(t,d.x*l,d.y*l,4*l,6*l,p,f,4,6)}e.globalAlpha=1}(e,o.snap,o.blocks,o.order,t,(e,t)=>[(o.ox-e.x)*t*.9,(o.oy-e.y)*t*.9],o.closing?1:1-r((a-.72)/.28),.4),!0}v=null}if(!d||w)return!1;const l=i()[u];if(!l)return!1;const c=o(l),g=h?.y??c.y;if(!h||n)h={...c};else{const e=1-Math.exp(-a/45);h={x:c.x,w:c.w,y:h.y+(c.y-h.y)*e,h:h.h+(c.h-h.h)*e}}f+=((p?1:0)-f)*(n?1:1-Math.exp(-a/70));const b=h.x+4,y=Math.max(4,h.h-14),x=h.y+7;return Math.abs(g-h.y)>.5&&(e.fillStyle=rt(.32),e.fillRect(b,Math.min(g,h.y)+7,6,Math.abs(g-h.y)+y)),e.fillStyle=rt(.7+.3*f),e.beginPath(),e.roundRect(b,x,6,y,3),e.fill(),Math.abs(c.y-h.y)>.3||Math.abs((p?1:0)-f)>.01}}),k&&(e.dataset.gpu="");const A=()=>{const e=i();if(u=e.length?Math.min(Math.max(0,u),e.length-1):0,!n.current.manage)return;e.forEach((e,t)=>e.setAttribute("aria-selected",String(t===u)));const t=c(),r=e[u]?.id;t&&r&&t.setAttribute("aria-activedescendant",r)},E=()=>`inset(0 round ${getComputedStyle(e).borderTopLeftRadius||"0px"})`,C=()=>{const t=n.current.trigger,r=e.offsetWidth,o=e.offsetHeight;if(!t)return`inset(0 ${Math.max(0,r/2-40)}px ${Math.max(0,o-36)}px round 18px)`;const a=b(e,t);return`inset(${a.y}px ${r-a.x-a.w}px ${o-a.y-a.h}px ${a.x}px round ${a.h/2}px)`},L=t=>{const r=k;if(!r)return;const a=e.offsetWidth,i=e.offsetHeight,s=tt(e,r.box,a,i,2),l=function(e,t=2){const n=e.getContext("2d",{willReadFrequently:!0});if(!n)return[];const r=e.width,a=e.height,i=n.getImageData(0,0,r,a).data,s=[];for(let e=0;e<a/t;e+=6)for(let n=0;n<r/t;n+=4){let l=!1;for(let o=0;o<6*t&&!l;o+=3)for(let s=0;s<4*t&&!l;s+=2){const c=Math.round(n*t+s),d=Math.round(e*t+o);c<r&&d<a&&i[4*(d*r+c)]>10&&(l=!0)}l&&s.push({x:n,y:e,seed:o(n,e)})}return s}(s,2),c=n.current.trigger,d=c?r.box(c):{x:a/2,y:0,w:0,h:0},u=d.x+d.w/2,h=d.y+d.h/2,p=Math.hypot(a,i)||1;v={snap:s,blocks:l,order:Float32Array.from(l,e=>Math.hypot(e.x-u,e.y-h)/p*.7+.3*e.seed),ox:u,oy:h,start:performance.now(),closing:t},r.kick()},$=t=>{if(t)for(const t of[...e.children])"CANVAS"===t.tagName&&void 0!==t.dataset.asciiKit||a.set(t,"opacity","0");else a.restore()},R=(t,n,r="none")=>"function"!=typeof e.animate?null:e.animate(t.map(e=>({clipPath:e})),{duration:n,easing:"cubic-bezier(.16, 1, .3, 1)",fill:r}),I=()=>{M&&clearTimeout(M),M=0},T=(t=!0)=>{!d||w?(I(),d=!0,w=!1,h=null,u=0,e.removeAttribute("hidden"),e.dataset.open="",n.current.trigger?.setAttribute("aria-expanded","true"),A(),t&&c()?.focus({preventScroll:!0}),n.current.onOpenChange?.(!0),S()?k?.kick():(e.dataset.state="opening",R([C(),E()],260),k&&(w=!0,$(!0),L(!1)),M=setTimeout(()=>{M=0,delete e.dataset.state,w=!1,$(!1),k?.kick()},143))):t&&c()?.focus({preventScroll:!0})},F=()=>{if(!d)return;I();const t=e.contains(document.activeElement),r=()=>{M=0,w=!1,d=!1,v=null,delete e.dataset.state,delete e.dataset.open,$(!1),e.setAttribute("hidden",""),n.current.trigger?.setAttribute("aria-expanded","false"),t&&n.current.trigger?.focus({preventScroll:!0}),k?.kick(),n.current.onOpenChange?.(!1)};if(S())return void r();w=!0,e.dataset.state="closing",k&&(L(!0),$(!0));const o=R([E(),C()],200,"forwards");M=setTimeout(()=>{r(),o?.cancel()},200)},P=e=>{const t=i().length;t&&(u=(Math.round(e)%t+t)%t,A(),k?.kick())},W=(e=u)=>{const t=i()[e];if(!t||w)return;P(e),k?.field.pulse({element:t,strength:.6}),t.dataset.run="",n.current.onRun?.(e,t);const r=()=>{delete t.dataset.run,n.current.closeOnRun&&F()};S()?r():setTimeout(r,240)},z=e=>{if(!n.current.manage)return;const t=i().length;if("Escape"===e.key&&d)return e.preventDefault(),e.stopPropagation(),void F();if(e.target!==c()&&!i().includes(e.target))return;const r="ArrowDown"===e.key?u+1:"ArrowUp"===e.key?u-1:"Home"===e.key?0:"End"===e.key?t-1:null;if(null!==r)return e.preventDefault(),p=!1,void P(r);"Enter"===e.key&&(e.preventDefault(),W())},O=e=>{const t=e.target?.closest?.(n.current.rows);return t?i().indexOf(t):-1},N=e=>{if(!n.current.manage)return;const t=O(e);t<0||(p=!0,t!==u?P(t):k?.kick())},B=()=>{p=!1,k?.kick()},G=e=>{if(!n.current.manage)return;const t=O(e);t>=0&&W(t)},H=()=>{n.current.manage&&(p=!1,h=null,P(0))},D=()=>{d?F():T(!0)},q=e=>{const t=n.current.hotkey;t&&e.key?.toLowerCase()===t.toLowerCase()&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d?document.activeElement===c()?F():c()?.focus():T(!0))},j=t=>{if(!n.current.manage||!d||w)return;const r=t.target;e.contains(r)||n.current.trigger?.contains(r)||F()};e.addEventListener("keydown",z),e.addEventListener("pointermove",N),e.addEventListener("pointerleave",B),e.addEventListener("click",G),e.addEventListener("input",H);const U=n.current.trigger;return U?.addEventListener("click",D),U?.setAttribute("aria-expanded",String(d)),U?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",q),document.addEventListener("pointerdown",j),d?e.dataset.open="":e.setAttribute("hidden",""),A(),x(()=>k,n,()=>{A(),k?.refresh()},{open:T,close:F,select:P,run:W,toggle(){d?F():T(!0)},get isOpen(){return d},get selected(){return u}},()=>{I(),$(!1),e.removeEventListener("keydown",z),e.removeEventListener("pointermove",N),e.removeEventListener("pointerleave",B),e.removeEventListener("click",G),e.removeEventListener("input",H),U?.removeEventListener("click",D),document.removeEventListener("keydown",q),document.removeEventListener("pointerdown",j),delete e.dataset.gpu,delete e.dataset.state})}var at={thumb:'[role="slider"]',label:"[data-label]",threshold:.9,resetAfter:0},it=720,st=(e,t,n)=>e+(t-e)*n,lt=e=>1-(1-e)**3,ct=(e,t,n)=>({x:e,v:0,to:e,k:t,z:n});function dt(e,t,n=.4){const r=2*Math.sqrt(e.k)*e.z,o=Math.max(1,Math.ceil(240*t)),a=t/o;for(let t=0;t<o;t++)e.v+=(-e.k*(e.x-e.to)-r*e.v)*a,e.x+=e.v*a;return!(Math.abs(e.x-e.to)<n&&Math.abs(e.v)<12*n)||(e.x=e.to,e.v=0,!1)}var ut=e=>{e.x=e.to,e.v=0};function ht(e,t){const n=e.filter(([,e])=>t-e<80);if(n.length<2)return 0;const[r,o]=n[0],[a,i]=n[n.length-1];return i>o?(a-r)/(i-o)*1e3:0}function pt(e,t={}){const n={current:{...at,...t}},o=g(),a=e.querySelector(n.current.thumb)??e.firstElementChild,i=()=>e.querySelector(n.current.label),s=()=>!!(n.current.reducedMotion??l());let c=ct(0,520,.8),u=ct(0,150,1),h=!1,p=0,m=!1,v=0,b=0,w=[],M=0,k=0,S=0,A="",E=null;const C=()=>{if(!a)return null;const t=Math.max(0,(e.clientHeight-a.offsetHeight)/2);return{pad:t,size:a.offsetHeight,max:Math.max(1,e.clientWidth-a.offsetWidth-2*t)}},L=()=>e.getBoundingClientRect().width/(e.clientWidth||1)||1,$=t=>d(n.current.ink??"--ascii-ink-strong",e,t?"#d8d6cf":"#1d1d1b");E=y({host:e,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.94,...n.current.look}),ink:$,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{E=null},onTheme:()=>{A=""},paint:({pen:t,w:o,h:a,now:i,still:s,dark:l,box:h})=>{const p=C();if(!p)return!1;const g=m?s?1:r((i-v)/it):0,y=lt(r(g/.5)),x=lt(r((g-.36)/.3)),w=lt(r((g-.46)/.4)),M=r((g-.5)/.5),k=1+.07*Math.sin(Math.PI*M)*(1-M),S=b?1-r((i-b)/260):1,L=n.current.mark?h(n.current.mark):{x:o/2-18,y:a/2-18,w:36,h:36},R=L.x+L.w/2,I=L.y+L.h/2,T=Math.min(L.w/2,a/2-2)*k,F=m?f($(l),(t=>d(n.current.color??"--ascii-success",e,t?"#5ad08e":"#1c8a4f"))(l),lt(r(s?1:(i-v)/360))):$(l);F!==A&&(A=F,E?.field.update({ink:F})),t.save(),t.globalAlpha=S,t.beginPath(),o>4&&a>4&&t.roundRect(2,2,o-4,a-4,(a-4)/2),t.clip(),t.fillStyle=`rgba(255,255,255,${.1*(1-y)})`,t.fillRect(0,0,o,a);const P=p.pad+c.x+p.size/2,W=m?1:u.x,z=st(0,R-T,y),O=st(P,R+T,y),N=st(0,I-T,y),B=st(a,I+T,y);if(O-z>1&&W>.004){const e=t.createLinearGradient(z,0,O,0);e.addColorStop(0,`rgba(255,255,255,${st(.14,1,y)*W})`),e.addColorStop(.62,`rgba(255,255,255,${st(.48,1,y)*W})`),e.addColorStop(1,`rgba(255,255,255,${W})`),t.fillStyle=e,t.globalAlpha=S*(1-.28*x),t.beginPath(),t.roundRect(z,N,O-z,B-N,st(0,T,y)),t.fill()}return x>0&&(t.globalAlpha=1,t.fillStyle="#000",t.beginPath(),t.arc(R,I,Math.max(0,T-5)*x,0,2*Math.PI),t.fill()),t.restore(),w>0&&function(e,t,n,r,o,a,i){if(o<=0||a<=0)return;const s=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([e,o])=>[t+e*r,n+o*r]),l=Math.hypot(s[1][0]-s[0][0],s[1][1]-s[0][1])+Math.hypot(s[2][0]-s[1][0],s[2][1]-s[1][1]);e.save(),e.globalAlpha=a,e.strokeStyle="#fff",e.lineWidth=i,e.lineCap="round",e.lineJoin="round",e.setLineDash([l*o,l]),e.beginPath(),e.moveTo(s[0][0],s[0][1]),e.lineTo(s[1][0],s[1][1]),e.lineTo(s[2][0],s[2][1]),e.stroke(),e.restore()}(t,R+.02*T,I+.07*T,.55*T,w,S,4.5),!1}});const R=()=>{const e=C();if(!e||!a)return;const t=c.x/e.max;o.set(a,"translate",`${c.x}px 0`),a.setAttribute("aria-valuenow",String(Math.round(100*r(t))));const n=i();n&&o.set(n,"opacity",String(m?0:1-r(1.7*t)))},I=t=>{M=0;const n=Math.min(1/30,Math.max(0,(t-k)/1e3));k=t;let r=!h&&dt(c,n,.3);r=dt(u,n,.003)||r,b&&(t-b>=260||s())&&(b=0,m=!1,c=ct(0,520,.8),u=ct(0,150,1),e.dataset.state="idle",delete e.dataset.confirmed,a&&(o.set(a,"opacity","1"),o.set(a,"scale","1"),a.tabIndex=0)),m&&t-v>302.4&&(e.dataset.confirmed=""),R(),E?.kick(),(r||h||m&&t-v<760||b>0)&&(M=requestAnimationFrame(I))},T=()=>{M||(k=performance.now(),M=requestAnimationFrame(I))},F=()=>{const t=C();if(!t||m)return;const r=t.max-c.x;h=!1,m=!0,c.to=t.max,u.to=1,v=performance.now()+(r>4?200:90),s()&&(ut(c),ut(u),v=-1e6,e.dataset.confirmed=""),e.dataset.state="confirmed",a&&(a.setAttribute("aria-valuetext","Confirmed"),a.tabIndex=-1,o.set(a,"transition","opacity 200ms 160ms, scale 240ms 160ms"),o.set(a,"opacity","0"),o.set(a,"scale",".6")),S&&clearTimeout(S),n.current.resetAfter>0&&(S=setTimeout(P,n.current.resetAfter)),R(),T(),n.current.onConfirm?.()};function P(){if(S&&clearTimeout(S),S=0,!m)return c.to=0,u.to=0,void T();b=performance.now(),a?.removeAttribute("aria-valuetext"),T()}const W=()=>{const t=C();if(!h||!t)return;h=!1;const o=ht(w,performance.now());c.x>=t.max*n.current.threshold||o>900&&c.x>.5*t.max?F():(c.to=0,c.v=.25*r(o,-1500,1500),u.to=0,s()&&(ut(c),ut(u)),e.dataset.state="idle",T())},z=t=>{0===t.button&&!m&&a&&(a.contains(t.target)?(a.setPointerCapture?.(t.pointerId),h=!0,p=t.clientX-c.x*L(),u.to=1,w=[],e.dataset.state="dragging",T()):h||s()||(c.v+=420,u.to=0,T()))},O=e=>{const t=C();h&&t&&(c.x=c.to=r((e.clientX-p)/L(),0,t.max),c.v=0,w.push([c.x,performance.now()]),w.length>8&&w.shift(),c.x>=t.max-.5?F():T())},N=e=>{const t=C();if(!t||m)return;if("Enter"===e.key||" "===e.key||"End"===e.key)return e.preventDefault(),void F();const n={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1}[e.key],o="Home"===e.key?0:void 0!==n?r(c.to+n*t.max/4,0,t.max):null;null!==o&&(e.preventDefault(),c.to=o,u.to=o>0?1:0,s()&&(ut(c),ut(u)),o>=t.max-.5?F():T())};a&&(a.hasAttribute("role")||a.setAttribute("role","slider"),a.hasAttribute("tabindex")||(a.tabIndex=0),a.hasAttribute("aria-label")||a.setAttribute("aria-label",i()?.textContent?.trim()||"Slide to confirm"),a.setAttribute("aria-valuemin","0"),a.setAttribute("aria-valuemax","100"),a.setAttribute("aria-valuenow","0"),o.set(a,"touch-action","none"),a.addEventListener("keydown",N));const B=e=>e.preventDefault();return e.dataset.state="idle",e.addEventListener("pointerdown",z),e.addEventListener("pointermove",O),e.addEventListener("pointerup",W),e.addEventListener("pointercancel",W),e.addEventListener("lostpointercapture",W),e.addEventListener("dragstart",B),x(()=>E,n,()=>E?.refresh(),{confirm:F,reset:P,get confirmed(){return m}},()=>{M&&cancelAnimationFrame(M),S&&clearTimeout(S),M=S=0,a?.removeEventListener("keydown",N),e.removeEventListener("pointerdown",z),e.removeEventListener("pointermove",O),e.removeEventListener("pointerup",W),e.removeEventListener("pointercancel",W),e.removeEventListener("lostpointercapture",W),e.removeEventListener("dragstart",B),o.restore(),delete e.dataset.state,delete e.dataset.confirmed})}var ft={kind:"heart",icon:"svg",manage:!0,outset:40},mt=e=>1-(1-r(e))**3;function gt(e,t,n,r,o){if(e.beginPath(),"heart"===t){const t=o/29;for(let o=0;o<=56;o++){const a=o/56*Math.PI*2,i=16*Math.sin(a)**3,s=-(13*Math.cos(a)-5*Math.cos(2*a)-2*Math.cos(3*a)-Math.cos(4*a));0===o?e.moveTo(n+i*t,r+(s-2.5)*t):e.lineTo(n+i*t,r+(s-2.5)*t)}}else{const t=.7*o,a=r-o/2,i=n-t/2,s=.12*o;e.moveTo(i,a+s),e.arcTo(i,a,i+s,a,s),e.lineTo(i+t-s,a),e.arcTo(i+t,a,i+t,a+s,s),e.lineTo(i+t,r+o/2),e.lineTo(n,r+o/2-.27*o),e.lineTo(i,r+o/2)}e.closePath()}function vt(e,t,n,r,o,a){const i=e.createRadialGradient(n,r-.1*o,0,n,r,.62*o);i.addColorStop(0,"#fff"),i.addColorStop(.7,"#e6e6e6"),i.addColorStop(1,"#8c8c8c"),e.globalAlpha=a,e.fillStyle=i,e.shadowColor="#bbb",e.shadowBlur=Math.max(2,.08*o),gt(e,t,n,r,o),e.fill(),e.shadowBlur=0,e.globalAlpha=1}function bt(e,t,n,a,i){const s=n.x+n.w/2,l=n.y+n.h/2,c=n.h,d=1.45*c,u=(e=>e>=1?1:1-Math.exp(-5*e)*Math.cos(9*e))(a/.3),h=(e=>e<.5?4*e**3:1-(-2*e+2)**3/2)(r((a-.42)/.3)),p=h>0?d+(c-d)*h:.7*c+(d-.7*c)*u,f=r((a-.04)/.46);f>0&&f<1&&(e.strokeStyle=(e=>{const t=Math.round(255*r(e));return`rgb(${t} ${t} ${t})`})(.8*(1-f)**1.4),e.lineWidth=2.4-1.2*f,e.lineJoin="round",gt(e,t,s,l,c*(1.2+.5*mt(f))),e.stroke());e.fillStyle="#fff";for(let t=0;t<7;t++){const n=(a-.1-.05*o(t,i))/.5;if(n<=0||n>=1)continue;const r=-Math.PI/2+(t-3)/7*Math.PI*1.7+.3*(o(i+1,t)-.5),d=c*(.75+(.55+.35*o(t,i+2))*mt(n)),u=1.8*(1-.6*n);e.globalAlpha=1-n*n,e.beginPath(),e.arc(s+Math.cos(r)*d*1.15,l+Math.sin(r)*d*.85,u,0,2*Math.PI),e.fill()}e.globalAlpha=1,vt(e,t,s,l,p,1-r((a-.72)/.28))}function yt(e,t={}){const n={current:{...ft,...t}},r=g(),a=()=>e.querySelector(n.current.icon)??e,i=()=>!!(n.current.reducedMotion??l());let s="true"===e.getAttribute("aria-pressed"),c=[],d=[],u=null;u=y({host:e,outset:n.current.outset,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:e=>n.current.ink??("heart"===n.current.kind?`var(--ascii-like, ${e?"#ff6b70":"#e5484d"})`:e?"#d8d6cf":"#1d1d1b"),reducedMotion:()=>n.current.reducedMotion,onFail:()=>{u=null},paint:({pen:e,w:t,now:r,box:i})=>{const s=i(a()),l=n.current.kind;c=c.filter(t=>{const n=(r-t.start)/("burst"===t.kind?560:300);if(n>=1)return!1;if(n<0)return!0;if(e.save(),"burst"===t.kind)bt(e,l,s,n,t.seed);else{const t=s.x+s.w/2,r=s.y+s.h/2+3*mt(n),a=s.h*(1+.12*mt(n));vt(e,l,t,r,a,(1-n)**1.4),e.fillStyle="#000";for(let i=r-a/2;i<r+a/2;i+=3)for(let r=t-a/2;r<t+a/2;r+=2)o(r,i)<1.15*n&&e.fillRect(r,i,2,3)}return e.restore(),!0});const d=n.current.limit;if(d&&c.length){const n=i(d),r=n.y+n.h,o=e.createLinearGradient(0,r-2,0,r+8);o.addColorStop(0,"#000"),o.addColorStop(1,"rgb(0 0 0 / 0)"),e.fillStyle="#000",e.fillRect(0,0,t,r-2),e.fillStyle=o,e.fillRect(0,r-2,t,10)}return c.length>0}});const h=()=>{d.forEach(clearTimeout),d=[]},p=()=>{if(h(),r.restore(),!u||i())return;const t=performance.now(),n=a();c=c.filter(e=>"undo"!==e.kind),c.push({kind:"burst",start:t,seed:Math.floor(t)%97}),n!==e&&r.set(n,"opacity","0"),d.push(setTimeout(()=>{r.restore(),n!==e&&"function"==typeof n.animate&&n.animate({scale:[".6","1.12","1"]},{duration:220,easing:"cubic-bezier(.34, 1.56, .64, 1)"})},347.2)),u.kick()},f=()=>{h(),r.restore(),u&&!i()&&(c=c.filter(e=>"burst"!==e.kind),c.push({kind:"undo",start:performance.now(),seed:0}),u.kick())},m=(t=!s)=>{s=t,e.setAttribute("aria-pressed",String(s)),s?p():f()},v=()=>{n.current.manage&&(m(),n.current.onChange?.(s))};return!e.hasAttribute("aria-pressed")&&n.current.manage&&e.setAttribute("aria-pressed","false"),e.addEventListener("click",v),x(()=>u,n,()=>u?.refresh(),{burst:p,undo:f,toggle:m,get pressed(){return s}},()=>{h(),r.restore(),e.removeEventListener("click",v)})}var xt={values:[],duration:520},wt=e=>{const t=Math.round(255*r(e));return`rgb(${t} ${t} ${t})`};function Mt(e,t={}){const n={current:{...xt,...t}};let o=n.current.values,a=null,i=performance.now(),l=[],c=0,d=!1,u=null;const h=()=>n.current.values??[];u=y({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:7,cellAspect:.6,glyphScale:.95,shade:.35,...n.current.look}),ink:e=>n.current.ink??(e?"#d8d6cf":"#1d1d1b"),reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{u=null},paint:({pen:e,w:t,h:o,now:d,still:u})=>{e.setTransform(2,0,0,2,0,0);const p=h(),f=p.length;if(!f)return!1;const m=c?Math.min(64,d-c):16;c=d;const g=t/f,v=Math.max(3,g*(f<=7?.56:.64)),b=n.current.max??1.04*Math.max(...p,0),y=n.current.stagger??(f<=7?45:9);let x=!1;for(let t=0;t<f;t++){const c=u?1:r((d-i-t*y)/n.current.duration);c<1&&(x=!0);const h=null===a?t===f-1?1:.55:t===a?1:.3,w=l[t]??h;l[t]=u?h:w+(h-w)*(1-Math.exp(-m/90)),Math.abs(l[t]-h)>.01&&(x=!0);const M=(b>0?Math.max(0,p[t])/b:0)*(o-2)*s(c),k=o-M,S=g*(t+.5)-v/2;if(M<=0)continue;const A=.16+.84*l[t],E=e.createLinearGradient(0,k,0,o);E.addColorStop(0,wt(A)),E.addColorStop(1,wt(.5*A)),e.fillStyle=E,e.fillRect(S,k,v,M)}return x}});const p=g(),f=u?null:document.createElement("div"),m=()=>{if(!f)return;const e=h(),t=e.length,o=n.current.max??1.04*Math.max(...e,0);f.replaceChildren(...e.map((e,n)=>{const i=document.createElement("div"),s=null===a?n===t-1?1:.55:n===a?1:.3;return i.setAttribute("style",`flex:1 1 0;height:${o>0?(100*r(e/o)).toFixed(2):0}%;margin:0 ${t<=7?22:18}%;background:currentColor;opacity:${.9*(.16+.84*s)}`),i}))};f&&("static"===getComputedStyle(e).position&&p.set(e,"position","relative"),f.setAttribute("aria-hidden","true"),f.setAttribute("style","position:absolute;inset:0;display:flex;align-items:flex-end;pointer-events:none"),e.appendChild(f));const v=document.createElement("table");v.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0");const b=()=>{const e=n.current.format??(e=>e.toLocaleString()),t=n.current.labels??[],r=document.createElement("tbody");h().forEach((n,o)=>{const a=document.createElement("tr"),i=document.createElement("th"),s=document.createElement("td");i.setAttribute("scope","row"),i.textContent=t[o]??String(o+1),s.textContent=e(n),a.appendChild(i),a.appendChild(s),r.appendChild(a)}),v.replaceChildren(r)};b(),e.appendChild(v);const w=!e.hasAttribute("tabindex"),M=!e.hasAttribute("role");w&&(e.tabIndex=0),M&&e.setAttribute("role","group");const k=e=>{const t=h().length,r=null!==e&&t?Math.min(t-1,Math.max(0,Math.round(e))):null;r!==a&&(a=r,u?.kick(),m(),n.current.onHover?.(a,null===a?null:h()[a],null===a?null:n.current.labels?.[a]??null))},S=()=>{o=h(),i=performance.now(),l=h().map((e,t,n)=>t===n.length-1?1:.55),u?.kick(),m()};m();const A=t=>{const n=e.getBoundingClientRect();if(!n.width)return;const r=(t.clientX-n.left)/n.width,o=t.clientY-n.top;r<0||r>1||o<0||o>n.height?k(null):k(((e,t)=>t?Math.min(t-1,Math.max(0,Math.floor(e*t))):-1)(r,h().length))},E=()=>k(null),C=e=>{const t=h().length,n="ArrowRight"===e.key?null===a?0:Math.min(t-1,a+1):"ArrowLeft"===e.key?null===a?t-1:Math.max(0,a-1):"Home"===e.key?0:"End"===e.key?t-1:"Escape"===e.key?null:void 0;void 0!==n&&t&&(e.preventDefault(),k(n))};e.addEventListener("pointermove",A),e.addEventListener("pointerdown",A),e.addEventListener("pointerleave",E),e.addEventListener("keydown",C),e.addEventListener("blur",E);const L="function"==typeof IntersectionObserver?new IntersectionObserver(([e])=>{e?.isIntersecting&&!d&&(d=!0,S())},{threshold:.4}):null;return L?.observe(e),x(()=>u,n,e=>{b(),e.values!==o&&S(),u?.refresh()},{set(e,t){n.current={...n.current,values:[...e],...t?{labels:[...t]}:{}},null!==a&&a>=e.length&&k(null),b(),S()},highlight:k,get active(){return a},get values(){return h()}},()=>{L?.disconnect(),v.remove(),f?.remove(),p.restore(),e.removeEventListener("pointermove",A),e.removeEventListener("pointerdown",A),e.removeEventListener("pointerleave",E),e.removeEventListener("keydown",C),e.removeEventListener("blur",E),w&&e.removeAttribute("tabindex"),M&&e.removeAttribute("role")})}var kt={dissolve:140,condense:160},St=10,At=16;function Et(e,t={}){const n={current:{...kt,...t}},r=g();let a=null,i=0,c=Promise.resolve(),d=0,u=null;u=y({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.9,contrast:1.15,shade:.55,...n.current.look}),ink:e=>n.current.ink??(e?"#d8d6cf":"#1d1d1b"),reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{u=null;const e=a;a=null,r.restore(),e?.done()},paint:({pen:e,now:t})=>{const n=a;if(!n)return!1;const r=Math.min(1,(t-n.start)/n.ms),l=n.from<n.to?r*r:s(r),c=n.from+(n.to-n.from)*l;return function(e,t,n,r,a){const i=t.width,s=t.height,l=[],c=Math.max(...[[0,0],[i,0],[0,s],[i,s]].map(([e,t])=>Math.hypot(e-r.x,t-r.y)))||1;for(let d=0;d<s;d+=At)for(let s=0;s<i;s+=St){const i=Math.hypot(s+5-r.x,d+8-r.y)/c*.72+.28*o(s,d)-n;if(i>0&&e.drawImage(t,s,d,St,At,s,d,St,At),i>0&&i<.07)l.push([s,d]);else if(i<=0&&i>-.12){const n=-i/.12;e.globalAlpha=1-n,e.drawImage(t,s,d,St,At,s+18*(o(d,s+a)-.5)*n,d-10*n,St,At),e.globalAlpha=1}}e.globalCompositeOperation="lighter";for(const[n,r]of l)e.drawImage(t,n,r,St,At,n,r,St,At);e.globalCompositeOperation="source-over"}(e,n.art,c,n.at,++i),u?.field.update({brightness:-.22*(n.from<n.to?l:1-l)}),!(r>=1)||(a=null,n.done(),!1)}});const h=()=>[...e.children].filter(e=>!("CANVAS"===e.tagName&&void 0!==e.dataset.asciiKit)),p=(e,t,n,r,o,i)=>new Promise(s=>{a={art:t,from:n,to:r,start:performance.now(),ms:Math.max(1,o),at:i,done:s},e.kick()}),f=t=>tt(e,t.box,e.offsetWidth,e.offsetHeight,2),m=async(t,o)=>{const a=u;if(!a||(n.current.reducedMotion??l()))return void await t();const i=((t,n)=>{if(t&&"getBoundingClientRect"in t){const e=n.box(t);return{x:2*(e.x+e.w/2),y:2*(e.y+e.h/2)}}return t?{x:2*t.x,y:2*t.y}:{x:e.offsetWidth/2*2,y:0}})(o??n.current.origin,a),s=f(a);e.dataset.state="out";for(const e of h())r.set(e,"opacity","0");if(await p(a,s,0,1.12,n.current.dissolve,i),await t(),u){a.canvas.isConnected&&a.canvas.parentElement===e||e.appendChild(a.canvas);for(const e of h())r.set(e,"opacity","0");e.dataset.state="in",await p(a,f(a),.92,-.12,n.current.condense,i),r.restore(),u?.field.update({brightness:0}),u?.kick()}};return x(()=>u,n,()=>u?.refresh(),{swap(t,n){d++;const r=c.then(()=>m(t,n)).finally(()=>{0===--d&&delete e.dataset.state});return c=r.catch(()=>{}),r},get busy(){return d>0}},()=>{const t=a;a=null,r.restore(),delete e.dataset.state,t?.done()})}var Ct={cards:"[data-card]",loop:!0,threshold:.4,outset:56},Lt=(e,t,n)=>e+(t-e)*n,$t=(e,t,n)=>({x:e,v:0,to:e,k:t,z:n}),Rt=Array.from({length:96},(e,t)=>{const n=43758.5453*Math.sin(127.1*t+311.7);return n-Math.floor(n)});function It(e,t={}){const n={current:{...Ct,...t}},o=g(),a=()=>!!(n.current.reducedMotion??l()),i=()=>[...e.querySelectorAll(n.current.cards)];let s=0,c=$t(0,380,.72),d=$t(0,380,.8),u=$t(0,260,.9),h=!1,p=0,f=0,m=null,v=[],b=0,w=0,M=new Map,k=null,S=null;const A=e=>i()[C(e)]??null,E=()=>e.clientWidth||160,C=e=>{const t=i().length;return t?(e%t+t)%t:0},L=(t,o,a,s)=>{const l=A(t);if(!l||!n.current.loop&&t>=i().length)return null;const c="IMG"===l.tagName?l:l.querySelector("img"),d=`${c?.currentSrc||c?.src||""}|${c?.complete}|${Math.round(o)}x${Math.round(a)}|${s}`,u=M.get(l);if(u?.key===d)return u.canvas;const h=document.createElement("canvas");h.width=Math.max(1,Math.round(o)),h.height=Math.max(1,Math.round(a));const p=h.getContext("2d");if(!p)return null;const f=n.current.radius??(parseFloat(getComputedStyle(e).borderTopLeftRadius)||16);p.beginPath(),p.roundRect(0,0,h.width,h.height,Math.min(f,h.width/2,h.height/2)),p.clip();const m=c?function(e,t,n=.04){if(!e.complete||!e.naturalWidth)return null;const o=Math.min(1,420/Math.max(e.naturalWidth,e.naturalHeight)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(e.naturalWidth*o)),a.height=Math.max(1,Math.round(e.naturalHeight*o));const i=a.getContext("2d",{willReadFrequently:!0});if(!i)return null;try{i.drawImage(e,0,0,a.width,a.height);const o=i.getImageData(0,0,a.width,a.height),s=o.data,l=new Uint32Array(256),c=s.length/4,d=e=>.2126*s[e]+.7152*s[e+1]+.0722*s[e+2];for(let e=0;e<s.length;e+=4)l[Math.round(d(e))]++;let u=0,h=255,p=0;for(let e=0;e<256;e++)if(p+=l[e],p>=.02*c){u=e;break}p=0;for(let e=255;e>=0;e--)if(p+=l[e],p>=.02*c){h=e;break}const f=Math.max(1,h-u);for(let e=0;e<s.length;e+=4){let o=r((d(e)-u)/f);t&&(o=1-o),s[e]=s[e+1]=s[e+2]=Math.round(255*(n+(1-n)*o)),s[e+3]=255}return i.putImageData(o,0,0),a}catch{return null}}(c,s):null;if(m){const e=Math.max(h.width/m.width,h.height/m.height),t=h.width/e,n=h.height/e;p.drawImage(m,(m.width-t)/2,(m.height-n)/2,t,n,0,0,h.width,h.height)}else p.fillStyle="rgb(60 60 60)",p.fillRect(0,0,h.width,h.height);return p.strokeStyle="rgb(150 150 150)",p.lineWidth=6,p.stroke(),M.set(l,{key:d,canvas:h}),h};function $(){const t=i(),r=s+(m?1:0),a=!n.current.loop&&r>=t.length?null:A(r);t.forEach(e=>{S?(o.set(e,"opacity","0"),e!==a?e.setAttribute("aria-hidden","true"):e.removeAttribute("aria-hidden")):e.hidden=e!==a}),e.setAttribute("aria-label",a?`${a.getAttribute("aria-label")||a.querySelector("img")?.alt||a.textContent?.trim()||"Card"}. Left arrow to pass, right arrow to keep.`:"No more cards")}S=y({host:e,outset:n.current.outset,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.94,contrast:1.3,...n.current.look}),ink:e=>n.current.ink??(e?"#d8d6cf":"#1d1d1b"),reducedMotion:()=>n.current.reducedMotion,onFail:()=>{S=null,o.restore(),$()},onTheme:()=>{M=new Map},paint:({pen:t,w:n,now:o,dark:a,box:i})=>{const l=i(e),h=l.w,p=l.h,f=l.x+h/2,g=l.y+p/2,v=r(u.x),b=(e,n,r,o,i=0)=>{const s=L(e,h,p,!a);!s||o<=0||(t.save(),t.translate(f,g+r),t.scale(n,n),t.globalAlpha=o,t.drawImage(s,-h/2,-p/2),i>0&&(t.globalCompositeOperation="destination-out",t.globalAlpha=i,t.drawImage(((e,t)=>{let n=k;if(!n||n.width!==Math.round(e)||n.height!==Math.round(t)){n=k=document.createElement("canvas"),n.width=Math.max(1,Math.round(e)),n.height=Math.max(1,Math.round(t));const r=n.getContext("2d");if(r)for(let e=0;e<n.height;e+=6)for(let t=0;t<n.width;t+=4){const n=43758.5453*Math.sin(12.9898*t+78.233*e);n-Math.floor(n)<.55&&(r.fillStyle="#000",r.fillRect(t,e,4,6))}}return n})(h,p),-h/2,-p/2)),t.restore())};b(s+2,Lt(.86,.93,v),Lt(24,12,v),Lt(.3,.55,v),.3),b(s+1,Lt(.93,1,v),Lt(12,0,v),Lt(.55,1,v),.4*(1-v));const y=L(s,h,p,!a);if(!y)return!1;const x=m?r((o-m.start)/620):0,w=m?.dir??1,M=m?m.x0+w*h*.9*(1-(1-x)**3):c.x,S=m?m.y0:d.x;if(t.save(),t.translate(f+M,g+S),t.rotate(.22*r(M/h,-1.6,1.6)),!m)return t.drawImage(y,-h/2,-p/2),t.restore(),!1;const A=Math.ceil(p/6);for(let e=0;e<A;e++){const o=Rt[e%Rt.length],a=r(1.55*x-.55*o);if(a>=1)continue;const i=w*a*a*h*(.5+.9*o),s=6*e,l=Math.min(6,p-s),c=w>0?f+M+i+.62*h:f+M+i-.62*h,d=w>0?n-4-c:c-4;t.globalAlpha=(1-a*a)*r(d/56),t.drawImage(y,0,s,h,l,-h/2+i,-p/2+s,h,l)}return t.restore(),!1}});const R=t=>{b=0;const n=Math.min(1/30,Math.max(0,(t-w)/1e3));w=t;let a=!1;h||m||(a=dt(c,n,.3),a=dt(d,n,.3)||a),a=dt(u,n,.002)||a,m&&t-m.start>=620&&(m=null,s+=1,T()),(()=>{e.style.setProperty("--ascii-lean",String(m?0:r(c.x/(.4*E()),-1,1)));const t=A(s);!S&&t&&o.set(t,"transform",`translate(${c.x}px, ${d.x}px) rotate(${.22*r(c.x/E(),-1.6,1.6)}rad)`)})(),S?.kick(),(a||h||m)&&(b=requestAnimationFrame(R))},I=()=>{b||(w=performance.now(),b=requestAnimationFrame(R))},T=()=>{c=$t(0,380,.72),d=$t(0,380,.8),u=$t(0,260,.9)},F=(e=1)=>{const t=i();if(m||!t.length||!n.current.loop&&s>=t.length)return!1;const r=A(s),l=C(s);return h=!1,a()||!S?(s+=1,T(),S||o.set(r,"transform","")):(m={dir:e,start:performance.now(),x0:c.x,y0:d.x},u.to=1),$(),I(),n.current.onSwipe?.(e,l,r),!0},P=()=>{if(!h)return;h=!1;const e=ht(v,performance.now()),t=E();Math.abs(c.x)>t*n.current.threshold||Math.abs(e)>650&&Math.sign(e)===Math.sign(c.x)&&Math.abs(c.x)>16?F(c.x<0?-1:1):(c.to=0,d.to=0,u.to=0,c.v=.2*r(e,-1600,1600),a()&&(c.x=d.x=u.x=0,c.v=d.v=u.v=0),I())},W=()=>e.getBoundingClientRect().width/(e.clientWidth||1)||1,z=t=>{if(0!==t.button||m)return;e.setPointerCapture?.(t.pointerId);const n=W();h=!0,p=t.clientX-c.x*n,f=t.clientY-d.x/.3*n,v=[],I()},O=e=>{if(!h)return;const t=W();c.x=c.to=(e.clientX-p)/t,d.x=d.to=(e.clientY-f)/t*.3,c.v=d.v=0,u.to=.5*r(Math.abs(c.x)/E()),v.push([c.x,performance.now()]),v.length>8&&v.shift(),I()},N=e=>{"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||(e.preventDefault(),F("ArrowRight"===e.key?1:-1))},B=()=>S?.kick(),G=e=>e.preventDefault();return e.hasAttribute("tabindex")||(e.tabIndex=0),e.setAttribute("role",e.getAttribute("role")??"group"),e.setAttribute("aria-roledescription","card"),o.set(e,"touch-action","none"),$(),e.addEventListener("pointerdown",z),e.addEventListener("pointermove",O),e.addEventListener("pointerup",P),e.addEventListener("pointercancel",P),e.addEventListener("lostpointercapture",P),e.addEventListener("keydown",N),e.addEventListener("load",B,!0),e.addEventListener("dragstart",G),x(()=>S,n,()=>{M=new Map,$(),S?.refresh()},{next:F,get index(){return C(s+(m?1:0))}},()=>{b&&cancelAnimationFrame(b),b=0,o.restore(),i().forEach(e=>{e.hidden=!1,e.removeAttribute("aria-hidden")}),e.style.removeProperty("--ascii-lean"),e.removeAttribute("aria-roledescription"),e.removeEventListener("pointerdown",z),e.removeEventListener("pointermove",O),e.removeEventListener("pointerup",P),e.removeEventListener("pointercancel",P),e.removeEventListener("lostpointercapture",P),e.removeEventListener("keydown",N),e.removeEventListener("load",B,!0),e.removeEventListener("dragstart",G)})}var Tt={length:6,accept:"digits",cells:"[data-cell]"},Ft=560,Pt=e=>{const t=Math.round(255*r(e));return`rgb(${t} ${t} ${t})`};function Wt(e,t={}){const n={current:{...Tt,...t}},a=g(),i=g(),c=[],d=()=>!!(n.current.reducedMotion??l()),u=()=>Math.max(1,Math.round(n.current.length));let h="",p="idle",f=!1,m=[],v="",b=-1e9,w="",M=-1e9,k=[],S=[],A=0,E=null;const C=new Map;"static"===getComputedStyle(e).position&&a.set(e,"position","relative");let L=e.querySelector("input");L||(L=document.createElement("input"),L.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;font-size:16px;cursor:text"),e.appendChild(L),c.push(L));const $=L;$.setAttribute("inputmode","digits"===n.current.accept?"numeric":"text"),$.setAttribute("autocomplete","one-time-code"),$.setAttribute("maxlength",String(u())),"digits"===n.current.accept&&$.setAttribute("pattern","[0-9]*"),$.hasAttribute("aria-label")||$.hasAttribute("aria-labelledby")||$.setAttribute("aria-label",`Verification code, ${u()} ${"digits"===n.current.accept?"digits":"characters"}`);const R=()=>{const t=[...e.querySelectorAll(n.current.cells)];for(;t.length<u();){const n=document.createElement("span");n.dataset.cell="",n.setAttribute("aria-hidden","true"),$.parentElement===e?e.insertBefore(n,$):e.appendChild(n),c.push(n),t.push(n)}return t.slice(0,u())},I=e=>{let t=e.querySelector("[data-digit]");return t||(t=document.createElement("span"),t.dataset.digit="",e.appendChild(t),c.push(t)),t},T=(e,t,n,r,a,i,s,l=1,c=0,d=0,u=1)=>{const h=((e,t,n,r)=>{const o=`${e}|${Math.round(t)}x${Math.round(n)}|${r}`;let a=C.get(o);if(!a){a=document.createElement("canvas"),a.width=Math.max(2,Math.round(2*t)),a.height=Math.max(2,Math.round(2*n));const i=a.getContext("2d");i&&(i.scale(2,2),i.fillStyle="#fff",i.shadowColor="#fff",i.shadowBlur=3,i.font=`600 ${Math.round(.6*n)}px ${r}`,i.textAlign="center",i.textBaseline="middle",i.fillText(e,t/2,n/2+1)),C.set(o,a)}return a})(t,n.w,n.h,s);e.globalAlpha=l;const p=n.w*u,f=n.h*u,m=n.x+(n.w-p)/2+c,g=n.y+(n.h-f)/2+d;for(let t=0;t<n.h;t+=4)for(let s=0;s<n.w;s+=3){if(o(s+31*i,t)>1.3*r-.12)continue;const n=3*(1-r);e.drawImage(h,2*s,2*t,6,8,m+s*u+(o(s,t+a)-.5)*n,g+t*u+(o(t,s+a)-.5)*n,3*u,4*u)}e.globalAlpha=1},F=(e,t)=>{e.toggleAttribute("data-shown",t),i.set(I(e),"opacity",t?"1":"0")};E=y({host:e,outset:16,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:e=>n.current.ink??(e?"#d8d6cf":"#1d1d1b"),reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{E=null,i.restore(),R().forEach(e=>F(e,!0))},paint:({pen:t,w:n,h:o,now:a,still:i,box:l})=>{t.setTransform(2,0,0,2,0,0);const c=R(),d=i?0:Math.floor(a/110),u=getComputedStyle(e).fontFamily||"sans-serif";if("success"===p){const e=i?1:(a-M)/700,l=n/2,h=o/2;if(c.forEach(e=>F(e,!1)),e<.55){const n=(e/.55)**2;k.forEach((e,r)=>w[r]&&T(t,w[r],e,1,d,r,u,1-n**3,(l-e.x-e.w/2)*n,(h-e.y-e.h/2)*n,1-.65*n))}const p=r((e-.45)/.55);return p>0&&p<1&&(t.strokeStyle=Pt(.55*(1-p)),t.lineWidth=3,t.beginPath(),t.arc(l,h,18+44*(e=>1-(1-r(e))**3)(p),0,2*Math.PI),t.stroke()),((e,t,n,r)=>{if(r<=0)return;const o=[[t-20,n+1],[t-7,n+14],[t+21,n-14]],a=Math.hypot(13,13),i=Math.hypot(28,28);let s=r*(a+i);e.strokeStyle="#fff",e.lineWidth=8,e.lineCap="round",e.lineJoin="round",e.shadowColor="#fff",e.shadowBlur=4,e.beginPath(),e.moveTo(o[0][0],o[0][1]);const l=Math.min(1,s/a);if(e.lineTo(o[0][0]+(o[1][0]-o[0][0])*l,o[0][1]+(o[1][1]-o[0][1])*l),s-=a,s>0){const t=Math.min(1,s/i);e.lineTo(o[1][0]+(o[2][0]-o[1][0])*t,o[1][1]+(o[2][1]-o[1][1])*t)}e.stroke(),e.shadowBlur=0})(t,l,h+1,s(r((e-.4)/.45))),e<1}let g=!1;const y=a-b;return c.forEach((e,n)=>{const r=l(e),o=h[n];if(y<Ft&&v[n])return F(e,!1),T(t,v[n],r,1-y/Ft,d,n,u),void(g=!0);if(o){const s=i?1:(a-m[n])/300;if(F(e,s>=.7),s>=1)return;return g=!0,void(s>0&&T(t,o,r,s,d,n,u,s>.7?1-(s-.7)/.3:1))}if(F(e,!1),f&&n===h.length&&y>=Ft){const e=i?.6:.5-.5*Math.cos(a/1600*Math.PI*2);t.fillStyle=Pt(.2+.26*e),t.beginPath(),t.roundRect(r.x+r.w/2-1.5,r.y+r.h/2-11,3,22,1.5),t.fill(),g=!0}}),g}});const P=(e,t)=>{S.push(setTimeout(t,e))},W=()=>{S.forEach(clearTimeout),S=[]},z=()=>{e.dataset.state=p,"error"===p?$.setAttribute("aria-invalid","true"):$.removeAttribute("aria-invalid");const t=f&&"success"!==p?Math.min(h.length,u()-1):-1;R().forEach((e,n)=>{I(e).textContent=h[n]??"",e.toggleAttribute("data-active",n===t),E||F(e,!0),"success"===p&&E?(a.set(e,"transition","opacity 200ms, scale 240ms cubic-bezier(.16, 1, .3, 1)"),a.set(e,"opacity","0"),a.set(e,"scale",".86")):(e.style.removeProperty("opacity"),e.style.removeProperty("scale"))}),$.value!==h&&($.value=h),E?.kick()},O=e=>{W(),"idle"!==p&&(p="idle",M=-1e9),v="",b=-1e9;const t=((e,t,n="digits")=>("digits"===n?e.replace(/\D/g,""):e.replace(/[^a-z\d]/gi,"").toUpperCase()).slice(0,t))(e,u(),n.current.accept),r=performance.now();let o=0;for(let e=0;e<t.length;e++)t[e]!==h[e]&&(m[e]=d()?-1e9:r+A*o++);h=t,z(),t.length===u()&&P(d()||!E?0:300+A*Math.max(0,o-1)+80,()=>n.current.onComplete?.(t)),A=0},N=()=>O($.value),B=()=>{A=55},G=()=>{f=!0,z()},H=()=>{f=!1,z()};return $.addEventListener("input",N),$.addEventListener("paste",B),$.addEventListener("focus",G),$.addEventListener("blur",H),$.value?O($.value):z(),x(()=>E,n,()=>{$.setAttribute("maxlength",String(u())),z(),E?.refresh()},{verify:t=>{W();const n=performance.now();if(t)return w=h,k=E?R().map(e=>E.box(e)):[],M=n,p="success",void z();v=h,b=d()||!E?n-Ft:n,p="error",z(),d()||"function"!=typeof e.animate||e.animate([{translate:"0"},{translate:"-9px"},{translate:"7px"},{translate:"-4px"},{translate:"2px"},{translate:"0"}],{duration:380,easing:"ease-out"});const r=h;P(d()||!E?0:Ft,()=>{v===r&&(v="",h="",z())})},clear:()=>{W(),v="",b=-1e9,M=-1e9,h="",p="idle",z()},get value(){return h},get state(){return p}},()=>{W(),$.removeEventListener("input",N),$.removeEventListener("paste",B),$.removeEventListener("focus",G),$.removeEventListener("blur",H),i.restore(),a.restore();for(const e of c)e.remove();for(const t of e.querySelectorAll(n.current.cells))t.removeAttribute("data-shown"),t.removeAttribute("data-active");delete e.dataset.state})}function zt(e){const t=()=>({image:e,width:e.naturalWidth,height:e.naturalHeight});return e.complete&&e.naturalWidth?Promise.resolve(t()):new Promise((n,r)=>{const o=()=>{i(),n(t())},a=()=>{i(),r(new Error(`Could not load ${e.src}`))},i=()=>{e.removeEventListener("load",o),e.removeEventListener("error",a)};e.addEventListener("load",o),e.addEventListener("error",a)})}function Ot(e,t=document.createElement("img")){return(e=>{try{return"undefined"!=typeof location&&new URL(e,location.href).origin!==location.origin}catch{return!1}})(e)&&!t.crossOrigin&&(t.crossOrigin="anonymous"),t.decoding="async",t.src=e,t}function Nt(e,t,n,r,o,a,i=.5,s=.5){if(o<=0||a<=0||!t.width||!t.height)return;const l=Math.max(o/t.width,a/t.height),c=o/l,d=a/l;e.drawImage(t.image,(t.width-c)*i,(t.height-d)*s,c,d,n,r,o,a)}function Bt(e,t,n=.08){const o=Math.min(1,420/Math.max(1,e.width,e.height)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(e.width*o)),a.height=Math.max(1,Math.round(e.height*o));const i=a.getContext("2d",{willReadFrequently:!0});if(!i)return e;let s;i.drawImage(e.image,0,0,a.width,a.height);try{s=i.getImageData(0,0,a.width,a.height)}catch{return e}const l=s.data,c=new Uint32Array(256),d=l.length/4,u=e=>.2126*l[e]+.7152*l[e+1]+.0722*l[e+2];for(let e=0;e<l.length;e+=4)c[Math.round(u(e))]++;let h=0,p=255,f=0;for(let e=0;e<256;e++)if(f+=c[e],f>=.02*d){h=e;break}f=0;for(let e=255;e>=0;e--)if(f+=c[e],f>=.02*d){p=e;break}const m=Math.max(1,p-h);for(let e=0;e<l.length;e+=4){let o=r((u(e)-h)/m);t&&(o=1-o),l[e]=l[e+1]=l[e+2]=Math.round(255*(n+(1-n)*o)),l[e+3]=255}return i.putImageData(s,0,0),{image:a,width:a.width,height:a.height}}var Gt={strong:1,text:.82,meta:.55,tile:.42,icon:.62},Ht=new Set(["IMG","SVG","svg","VIDEO","PICTURE"]),Dt=e=>[...e.children].flatMap(e=>Ht.has(e.tagName)?[e]:[e,...Dt(e)]);function qt(e,t,n,o){const a=document.createElement("canvas");a.width=Math.max(2,Math.round(2*t)),a.height=Math.max(2,Math.round(2*n));const i=[],s=a.getContext("2d");if(!s)return{canvas:a,rects:i};s.scale(2,2),s.fillStyle="#000",s.fillRect(0,0,t,n);const l=o(e),c=e.getBoundingClientRect(),d=c.width/(e.offsetWidth||c.width||1)||1,u=t=>{for(let n=t;n&&n!==e.parentElement;n=n.parentElement){const e=n.dataset?.paint;if(e&&void 0!==Gt[e])return Gt[e]}return parseFloat(t?getComputedStyle(t).fontWeight:"400")>=500?1:.7},h=e=>{const t=Math.round(255*r(e));return`rgb(${t} ${t} ${t})`},p=Dt(e),f=[e,...p].filter(e=>{const t=e.dataset?.paint;return"tile"===t||"icon"===t||!t&&Ht.has(e.tagName)&&!e.closest("[data-paint]")});for(const e of f){const t=o(e);if(t.w<=0||t.h<=0)continue;const n=e.dataset?.paint;s.fillStyle=h("icon"===n?Gt.icon:Gt.tile),s.beginPath(),"icon"===n||"svg"===e.tagName.toLowerCase()?s.arc(t.x+t.w/2,t.y+t.h/2,.4*Math.min(t.w,t.h),0,2*Math.PI):s.roundRect(t.x,t.y,t.w,t.h,Math.min(parseFloat(getComputedStyle(e).borderTopLeftRadius)||0,t.h/2)),s.fill(),i.push(t)}const m=document.createTreeWalker(e,4),g=document.createRange();s.textBaseline="middle";for(let e=m.nextNode();e;e=m.nextNode()){const t=e.parentElement;if(!t||t.closest('[data-paint="none"]'))continue;const n=getComputedStyle(t);s.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,s.fillStyle=h(u(t)),s.shadowColor=s.fillStyle,s.shadowBlur=4;for(const t of e.data.matchAll(/\S+/g)){g.setStart(e,t.index),g.setEnd(e,t.index+t[0].length);const n=g.getClientRects()[0];if(!n)continue;const r={x:l.x+(n.left-c.left)/d,y:l.y+(n.top-c.top)/d,w:n.width/d,h:n.height/d};s.fillText(t[0],r.x,r.y+r.h/2),i.push(r)}}return s.shadowBlur=0,g.detach?.(),{canvas:a,rects:i}}function jt(e,t,n,r,o,a,i=1,s=.32){for(let l=0;l<n.length;l++){const c=n[l],d=(o-r[l]*(1-s))/s;if(d<=0)continue;const u=d>=1?0:1-d;let h=c.x,p=c.y;if(u>0){const[e,t]=a(c,u);h+=e,p+=t}e.globalAlpha=i*(1-u*u),e.drawImage(t,2*c.x,2*c.y,8,12,h,p,4,6)}e.globalAlpha=1}function Ut(e,t){if("undefined"==typeof document||document.getElementById(e))return;const n=document.createElement("style");n.setAttribute("id",e),n.textContent=t,(document.head??document.documentElement).appendChild(n)}var Vt={max:3,duration:6e3,label:"Notifications"},Xt="cubic-bezier(.16, 1, .3, 1)",Yt=`\n:where(.ascii-toasts){position:relative;margin:0;padding:0;list-style:none;min-height:52px}\n:where(.ascii-toast){position:absolute;left:0;right:0;bottom:0;box-sizing:border-box;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 8px 8px 10px;border-radius:13px;background:var(--ascii-toast-bg,Canvas);color:var(--ascii-toast-ink,CanvasText);box-shadow:0 0 0 1px rgb(128 128 128 / .22),0 8px 24px rgb(0 0 0 / .12);z-index:calc(10 - var(--d,0));transform-origin:50% 0;translate:0 calc(var(--d,0) * -10px);scale:calc(1 - var(--d,0) * .05);transition:translate 280ms ${Xt},scale 280ms ${Xt},opacity 160ms ${Xt}}\n:where(.ascii-toast) > *{transition:opacity 160ms ${Xt}}\n:where(.ascii-toast[data-back]) > *{opacity:0}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]) > *{pointer-events:none}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast){translate:0 calc(var(--d,0) * (-100% - 8px));scale:1}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast[data-back]) > *{opacity:1}\n:where(.ascii-toast[data-forming]){animation:ascii-toast-in 200ms ${Xt} both}\n:where(.ascii-toast[data-forming],.ascii-toast[data-gone]) > *{opacity:0;transition:none}\n:where(.ascii-toast[data-gone]){opacity:0;pointer-events:none}\n@keyframes ascii-toast-in{from{opacity:0}}\n:where(.ascii-toast-icon){display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:8px;background:rgb(128 128 128 / .14)}\n:where(.ascii-toast-text){display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}\n:where(.ascii-toast-title){overflow:hidden;font-size:14px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-body){overflow:hidden;font-size:13px;opacity:.68;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-action,.ascii-toast-close){flex:none;border:0;background:rgb(128 128 128 / .14);color:inherit;font:inherit;cursor:pointer}\n:where(.ascii-toast-action){height:32px;padding:0 12px;border-radius:999px;font-size:14px;font-weight:500}\n:where(.ascii-toast-close){display:grid;place-items:center;width:28px;height:28px;border-radius:999px;background:transparent;font-size:18px;line-height:1;opacity:.6}\n@media (prefers-reduced-motion:reduce){:where(.ascii-toast){transition:none}:where(.ascii-toast[data-forming]){animation:none}}\n`;function Kt(e,t={}){const n={current:{...Vt,...t}},a=g(),i=document.createElement("ol"),l=v("",!1);l.setAttribute("role","status");let c=[],d=[],u=0,h=!1,p=!1,f=!1,m=!1,b=null;const w=[];Ut("ascii-kit-toast",Yt),i.className="ascii-toasts",i.setAttribute("aria-label",n.current.label),e.append(i,l),b=y({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),outset:24,resolution:2,ink:()=>n.current.ink??"--ascii-ink-strong",reducedMotion:()=>n.current.reducedMotion,onFail:()=>{b=null,d=[];for(const e of c)delete e.node.dataset.forming},paint:({pen:e,now:t,scale:n})=>(e.setTransform(n,0,0,n,0,0),d=d.filter(n=>{const a=(t-n.start)/n.ms;return n.form&&a>=.62&&delete n.node.dataset.forming,!(a>=1)&&(n.form?jt(e,n.snap,n.blocks,n.order,1.04*s(a),(e,t)=>[70*(e.seed-.5)*t,(14+26*o(e.x,e.y))*t],1-r((a-.62)/.28)):jt(e,n.snap,n.blocks,n.order,1-1.04*(1-(1-a)**3),(e,t)=>[(14+34*e.seed)*t,14*(o(e.y,e.x)-.35)*t],1-r((a-.75)/.25)),!0)}),d.length>0)});const M=()=>!!b&&!b.still(),k=()=>{c.forEach((e,t)=>{const n=c.length-1-t;a.set(e.node,"--d",String(n)),0===n?(e.node.dataset.front="",delete e.node.dataset.back):(e.node.dataset.back="",delete e.node.dataset.front)})},S=(t,n)=>{if(!b)return;const r=qt(t,b.canvas.clientWidth||e.clientWidth+48,b.canvas.clientHeight||e.clientHeight+48,b.box),a=function(e){const t=new Set,n=[];for(const r of e)for(let e=6*Math.floor((r.y-2)/6);e<r.y+r.h+2;e+=6)for(let a=4*Math.floor((r.x-2)/4);a<r.x+r.w+2;a+=4){const r=`${a},${e}`;t.has(r)||(t.add(r),n.push({x:a,y:e,seed:o(a,e)}))}return n}(r.rects),i=Math.max(1,...a.map(e=>e.x)),s=Float32Array.from(a,e=>(n?.3:.62)*(e.x/i)+(n?.7:.38)*e.seed);d.push({start:performance.now(),ms:n?340:440,snap:r.canvas,blocks:a,order:s,form:n,node:t}),b.kick()},A=e=>{e.timer&&clearTimeout(e.timer),e.timer=0,h||e.left<=0||(e.since=performance.now(),e.timer=setTimeout(()=>I(e.id),e.left))},E=()=>(e=>{if(e!==h){h=e,e?i.dataset.open="":delete i.dataset.open;for(const t of c)e&&t.timer&&(clearTimeout(t.timer),t.timer=0,t.left=Math.max(400,t.left-(performance.now()-t.since))),e||A(t)}})(p||f),C=()=>{p=!0,E()},L=()=>{p=!1,E()},$=()=>{f=!0,E()},R=e=>{i.contains(e.relatedTarget)||(f=!1,E())};function I(e){const t=c.find(t=>t.id===e);if(!t||void 0!==t.node.dataset.gone)return;t.timer&&clearTimeout(t.timer);const n=()=>{c=c.filter(e=>e!==t),d=d.filter(e=>e.node!==t.node),t.node.remove(),k(),c.length||(p=f=!1,E())},r=c[c.length-1]===t;M()&&(r||h)?(delete t.node.dataset.forming,S(t.node,!1),t.node.dataset.gone="",w.push(setTimeout(n,150))):n()}i.addEventListener("pointerenter",C),i.addEventListener("pointerleave",L),i.addEventListener("focusin",$),i.addEventListener("focusout",R);return x(()=>b,n,e=>{i.setAttribute("aria-label",e.label),b?.refresh()},{push:e=>{if(m)return-1;const t=++u,r=c.filter(e=>void 0===e.node.dataset.gone),o=r.length+1-Math.max(1,n.current.max);o>0&&r.slice(0,o).forEach(e=>I(e.id));const a=n.current.render?n.current.render(e,t):function(e,t){const n=(e,t,n)=>{const r=document.createElement(e);return r.className=t,n&&(r.dataset.paint=n),r},r=n("li","ascii-toast");if(void 0!==e.icon){const t=n("span","ascii-toast-icon","tile");t.setAttribute("aria-hidden","true"),"string"==typeof e.icon?t.textContent=e.icon:t.appendChild(e.icon),r.appendChild(t)}const o=n("span","ascii-toast-text"),a=n("b","ascii-toast-title","strong");if(a.textContent=e.title,o.appendChild(a),e.body){const t=n("span","ascii-toast-body","meta");t.textContent=e.body,o.appendChild(t)}if(r.appendChild(o),e.action){const{label:o,onClick:a}=e.action,i=n("button","ascii-toast-action","text");i.type="button",i.textContent=o,i.addEventListener("click",()=>{a(),t()}),r.appendChild(i)}const i=n("button","ascii-toast-close","none");return i.type="button",i.setAttribute("aria-label",`Dismiss ${e.title}`),i.textContent="×",i.addEventListener("click",t),r.appendChild(i),r}(e,()=>I(t));a.dataset.toast=String(t);const s={id:t,node:a,timer:0,left:e.duration??n.current.duration,since:0};return c.push(s),i.appendChild(a),k(),l.textContent=e.body?`${e.title}. ${e.body}`:e.title,M()&&(a.dataset.forming="",S(a,!0)),A(s),t},dismiss:I,clear(){[...c].forEach(e=>I(e.id))},get toasts(){return c.filter(e=>void 0===e.node.dataset.gone).map(e=>e.id)}},()=>{m=!0;for(const e of c)e.timer&&clearTimeout(e.timer);w.forEach(clearTimeout),i.removeEventListener("pointerenter",C),i.removeEventListener("pointerleave",L),i.removeEventListener("focusin",$),i.removeEventListener("focusout",R),c=[],d=[],i.remove(),l.remove(),a.restore()})}var Jt={lines:3,start:!0,stagger:38,rule:!0},_t=420,Qt=e=>`Thought for ${e}s`;function Zt(e,t={}){const n={current:{...Jt,...t}},r=g(),i=[...e.childNodes];let s="done",l=0,c=-1e9,d=-1e9,u=0,h="",p=null;const f=document.createElement("canvas"),m=()=>{const t=getComputedStyle(e),n=parseFloat(t.lineHeight);return Number.isFinite(n)&&n>0?n:1.45*(parseFloat(t.fontSize)||15)},v=e=>{n.current.label&&(n.current.label.textContent=e)};p=y({host:e,layer:"under",look:()=>({mark:"dot",cellSize:5,cellAspect:1,dotScale:.86,contrast:1.2,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink",reducedMotion:()=>n.current.reducedMotion,onFail:()=>{p=null},paint:({pen:e,w:t,h:r,now:i,still:u})=>{const h=n.current,p=m(),g="thinking"===s?1:u?0:1-a((i-c)/_t),v="done"===s&&h.rule?u?.7:.7*a((i-d-280)/_t):0,b=u?0:(i-l)/1e3;if(g>0){const n=Math.max(2,Math.round(t/10)),a=Math.max(2,Math.round(r/10));f.width===n&&f.height===a||(f.width=n,f.height=a),W(f,1.7+.45*b,.15),e.save(),e.beginPath();for(let n=0;n<h.lines;n++){const r=n===h.lines-1&&h.lines>1?.62:.92-.06*o(n,2);e.rect(0,n*p+.22*p,t*r,.56*p)}e.clip(),e.globalAlpha=g,e.imageSmoothingEnabled=!0,e.globalCompositeOperation="lighter",e.drawImage(f,0,0,t,r),e.drawImage(f,0,0,t,r),e.fillStyle="rgb(46 46 46)",e.fillRect(0,0,t,r),e.restore()}if(v>0&&(e.globalAlpha=v,e.fillStyle="#fff",e.fillRect(0,r-5,t,4),e.globalAlpha=1),g>0||v>0){const n=e.createLinearGradient(.6*t,0,.98*t,0);n.addColorStop(0,"#fff"),n.addColorStop(1,"#000"),e.globalCompositeOperation="multiply",e.fillStyle=n,e.fillRect(0,0,t,r),e.globalCompositeOperation="source-over"}return"thinking"===s||!u&&(i-c<_t||"done"===s&&i-d<700)}});const b=document.createElement("span"),w=()=>{u++,s="thinking",l=performance.now(),c=d=-1e9,h="",b.replaceChildren(),e.replaceChildren(b),p&&e.appendChild(p.canvas),r.set(e,"min-height",`${Math.round(n.current.lines*m())}px`),e.setAttribute("aria-busy","true"),v(n.current.labels?.thinking??"Thinking…"),p?.kick()};let M=0,k=0;return n.current.start&&w(),x(()=>p,n,()=>p?.refresh(),{think:w,stream:async t=>{"thinking"!==s&&w();const o=u;M=0;let a="";const i=()=>{"thinking"===s&&(s="streaming",c=k=performance.now(),r.set(e,"min-height",""),v((n.current.labels?.done??Qt)(Math.max(1,Math.round((c-l)/1e3)))),p?.kick())},f=(e,t)=>{a+=e;const o=t?a.length:a.search(/\s\S*$/)+1;o<=0||(i(),h+=a.slice(0,o),(e=>{const t=!!p&&!p.still();for(const o of e.match(/\s+|\S+/g)??[]){if(/^\s/.test(o)){b.append(o);continue}const e=document.createElement("span");if(e.textContent=o,t){r.set(e,"opacity","0");const t=Math.max(0,M*n.current.stagger-(performance.now()-k));r.set(e,"transition",`opacity 260ms cubic-bezier(.16, 1, .3, 1) ${Math.round(t)}ms`),requestAnimationFrame(()=>requestAnimationFrame(()=>e.style.setProperty("opacity","1")))}M++,b.appendChild(e)}})(a.slice(0,o)),a=a.slice(o))};if("string"==typeof t)f(t,!0);else{for await(const e of t){if(o!==u)return;f(e,!1)}if(o!==u)return;f("",!0)}i();const m=!p||p.still()?0:Math.max(0,M*n.current.stagger-(performance.now()-k))+260;await new Promise(e=>setTimeout(e,m)),o===u&&(s="done",d=performance.now(),e.setAttribute("aria-busy","false"),p?.kick())},get state(){return s}},()=>{u++,r.restore(),e.removeAttribute("aria-busy"),h?e.textContent=h:e.replaceChildren(...i)})}var en={caret:!0,settle:60,stagger:18,reasoningLines:2},tn="cubic-bezier(.16, 1, .3, 1)",nn=`\n:where(.ascii-reasoning){display:grid;grid-template-rows:1fr;transition:grid-template-rows 260ms ${tn},opacity 200ms ${tn}}\n:where(.ascii-reasoning[data-collapsed]){grid-template-rows:0fr;opacity:0}\n:where(.ascii-reasoning-in){min-height:0;overflow:hidden}\n:where(.ascii-reasoning ol){height:calc(var(--ascii-reasoning-lines, 2) * 1.5em);margin:0 0 .5em;padding:0;list-style:none;overflow:hidden;-webkit-mask-image:linear-gradient(to bottom,transparent,#000 45%);mask-image:linear-gradient(to bottom,transparent,#000 45%)}\n:where(.ascii-reasoning li){height:1.5em;line-height:1.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.62;translate:0 calc(var(--ascii-reasoning-shift, 0) * -1.5em);transition:translate 240ms ${tn},opacity 200ms ${tn}}\n:where(.ascii-reasoning li[data-new]){opacity:0}\n@media (prefers-reduced-motion: reduce){:where(.ascii-reasoning, .ascii-reasoning li){transition:none}}\n`;function rn(e,t={}){const n={current:{...en,...t}},a=[...e.childNodes];let i="idle",s="",c=[],d=null,u=0,h=null,p=null,f=null;const m=()=>{const t=getComputedStyle(e),n=parseFloat(t.fontSize)||15,r=parseFloat(t.lineHeight);return{size:n,line:Number.isFinite(r)&&r>0?r:1.5*n}};let g=null,v=null;const b=t=>{i!==t&&(i=t,"done"!==t&&"stopped"!==t||(g?.setAttribute("data-collapsed",""),g?.setAttribute("aria-hidden","true")),"streaming"===t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),n.current.onState?.(t))},w=e=>e.span.style.removeProperty("color"),M=()=>{c.forEach(w),c=[],"streaming"===i&&h&&b("done"),h?.(),h=null};if(f=y({host:e,look:()=>{const{size:e,line:t}=m();return{mark:"glyph",charset:" :-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:t,cellAspect:.6*e/t,glyphScale:r(1.05*e/t,.4,1),shade:.6,...n.current.look}},ink:()=>n.current.ink??getComputedStyle(e).color,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{f=null,M()},paint:({pen:e,now:t,still:r,box:a})=>{const{line:s}=m(),l=Math.floor(t/48),u=(t,n)=>{const r=Math.floor((t.y+t.h/2)/s)*s,o=Math.round(255*n);e.fillStyle=`rgb(${o} ${o} ${o})`,e.fillRect(t.x,r,Math.max(1,t.w),s)};if(r&&(c.forEach(w),c=[]),c=c.filter(e=>t>=e.at?(w(e),!1):(u(a(e.span),.55+.45*o(l,e.seed)),!0)),!c.length&&h&&M(),n.current.caret&&"idle"!==i){const{size:e}=m(),t=d?a(d):{x:0,y:0,w:0,h:s};u({x:t.x+t.w+.3*e,y:t.y,w:.6*e,h:t.h},"streaming"===i?1:.7)}return c.length>0}}),f){const t=getComputedStyle(e),n=f.canvas.style,r=e=>parseFloat(e??"")||0,o=r(t.paddingTop),a=r(t.paddingRight),i=r(t.paddingBottom),s=r(t.paddingLeft);n.top=`${o}px`,n.left=`${s}px`,n.width=`calc(100% - ${s+a}px)`,n.height=`calc(100% - ${o+i}px)`}return x(()=>f,n,()=>f?.refresh(),{write:t=>{if(!t)return;"streaming"!==i&&("idle"===i&&(e.replaceChildren(),f&&e.appendChild(f.canvas)),p=null,b("streaming")),s+=t;const r=t=>e.appendChild(t);if(!f)return void r(document.createTextNode(t));const o=performance.now(),a=n.current,l=f.still();let h=0;for(const e of t.match(/\s+|\S/g)??[]){if(/^\s/.test(e)){r(document.createTextNode(e));continue}const t=document.createElement("span");t.textContent=e,l||(t.style.setProperty("color","transparent"),c.push({span:t,at:o+a.settle+h*a.stagger,seed:31*u+h})),r(t),d=t,h++}u++,f.kick()},done:()=>p||("streaming"!==i?Promise.resolve():(p=new Promise(e=>{h=e}),f&&c.length?f.kick():M(),p)),stop(){"streaming"===i&&(c.forEach(w),c=[],b("stopped"),h?.(),h=null,f?.kick())},reasoning:t=>{if(!t||"undefined"==typeof document)return;if(!g||!v){Ut("ascii-kit-reasoning",nn),g=document.createElement("div"),g.className="ascii-reasoning";const t=document.createElement("div");t.className="ascii-reasoning-in",v=document.createElement("ol"),t.appendChild(v),g.appendChild(t),e.parentElement?.insertBefore(g,e)}g.removeAttribute("data-collapsed"),g.removeAttribute("aria-hidden");const r=Math.max(1,Math.round(n.current.reasoningLines));g.style.setProperty("--ascii-reasoning-lines",String(r));const o=document.createElement("li");o.textContent=t;const a=n.current.reducedMotion??l();a||o.setAttribute("data-new",""),v.appendChild(o),g.style.setProperty("--ascii-reasoning-shift",String(Math.max(0,v.children.length-r))),a||requestAnimationFrame(()=>o.removeAttribute("data-new"))},reset(){c=[],s="",d=null,u=0,g?.remove(),g=v=null,h?.(),h=null,p=null,e.replaceChildren(),f&&e.appendChild(f.canvas),b("idle"),f?.kick()},get state(){return i},get text(){return s}},()=>{h?.(),h=null,g?.remove(),g=v=null,e.removeAttribute("aria-busy"),s?e.textContent=s:e.replaceChildren(...a)})}function on(e,t){const n={current:{position:50,label:"Photo and ASCII split",...t}},o=g();let a=r(n.current.position,0,100),i=null,l=null,c={from:a,to:a,at:-1e9},d=0,u=!1;const h=[];let p=n.current.position;l=y({host:e,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:600,cellSize:6,cellAspect:.8,glyphScale:.96,color:"source",saturation:1.3,contrast:1.45,gamma:.85,brightness:.14,hover:"trail",trail:{strength:.7,radius:.3},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",reducedMotion:()=>n.current.reducedMotion,resolution:(e,t)=>{const n=Math.min(640,Math.max(2,Math.round(e)));return[n,Math.max(2,Math.round(n*t/Math.max(1,e)))]},onFail:()=>{l=null},paint:({pen:e,width:t,height:n})=>(i&&Nt(e,i,0,0,t,n),!1)});const f="string"==typeof n.current.image?Ot(n.current.image):n.current.image,m=document.createElement("div"),v=document.createElement("span"),b=()=>{const t=Math.round(a);o.set(e,"--ascii-pos",`${a}%`),m.setAttribute("aria-valuenow",String(t)),m.setAttribute("aria-valuetext",`${t}% photo, ${100-t}% ASCII`)},w=(e,t=!1)=>{if(e=r(e,0,100),!l)return void(a=e);if(d&&(cancelAnimationFrame(d),d=0),!t||l.still()||Math.abs(e-a)<.5)return a=e,b(),void n.current.onChange?.(a);c={from:a,to:e,at:performance.now()};const o=e=>{const t=r((e-c.at)/280);a=c.from+(c.to-c.from)*s(t),b(),n.current.onChange?.(a),d=t<1?requestAnimationFrame(o):0};d=requestAnimationFrame(o)},M=t=>{const n=e.getBoundingClientRect();return n.width?(t-n.left)/n.width*100:a},k=t=>{if(0!==t.button)return;e.setPointerCapture?.(t.pointerId),u=!0;const n=M(t.clientX);w(n,Math.abs(n-a)>3),m.focus({preventScroll:!0})},S=e=>{u&&w(M(e.clientX))},A=()=>{u=!1},E=e=>{const t={ArrowLeft:-5,ArrowDown:-5,ArrowRight:5,ArrowUp:5,PageDown:-20,PageUp:20}[e.key],n="Home"===e.key?0:"End"===e.key?100:void 0!==t?5*Math.round(a/5)+t:null;null!==n&&(e.preventDefault(),w(n,!0))};let C=()=>{};if(l){Ut("ascii-kit-compare","\n:where(.ascii-compare-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;clip-path:inset(0 calc(100% - var(--ascii-pos, 50%)) 0 0)}\n:where(.ascii-compare-line){position:absolute;top:0;bottom:0;left:var(--ascii-pos, 50%);width:2px;translate:-50% 0;background:#fff;box-shadow:0 0 0 .5px rgb(0 0 0 / .25),0 0 12px rgb(0 0 0 / .45);pointer-events:none}\n:where(.ascii-compare-handle){position:absolute;top:50%;left:var(--ascii-pos, 50%);display:grid;place-items:center;width:40px;height:40px;translate:-50% -50%;border-radius:50%;background:#fff;color:#111;box-shadow:0 0 0 1px rgb(0 0 0 / .08),0 4px 14px rgb(0 0 0 / .4);cursor:grab;touch-action:none}\n:where(.ascii-compare-handle:focus-visible){outline:2px solid #fff;outline-offset:3px}\n"),o.set(e,"overflow","hidden"),o.set(e,"touch-action","pan-y"),o.set(e,"user-select","none"),o.set(e,"cursor","ew-resize");const t={className:f.className,hidden:f.getAttribute("aria-hidden")};C=()=>{f.className=t.className,null===t.hidden?f.removeAttribute("aria-hidden"):f.setAttribute("aria-hidden",t.hidden)},f.className=(t.className?`${t.className} `:"")+"ascii-compare-photo",f.setAttribute("aria-hidden","true"),f.draggable=!1,v.className="ascii-compare-line",v.setAttribute("aria-hidden","true"),m.className="ascii-compare-handle",m.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 7-5 5 5 5M15 7l5 5-5 5"/></svg>',m.setAttribute("role","slider"),m.tabIndex=0,m.setAttribute("aria-label",n.current.label),m.setAttribute("aria-valuemin","0"),m.setAttribute("aria-valuemax","100"),m.setAttribute("aria-orientation","horizontal");for(const t of[f,v,m])e.contains(t)||(e.appendChild(t),h.push(t));b(),e.addEventListener("pointerdown",k),e.addEventListener("pointermove",S),e.addEventListener("pointerup",A),e.addEventListener("pointercancel",A),m.addEventListener("keydown",E),zt(f).then(e=>{i=e,l?.kick()},()=>{})}else e.contains(f)||("static"===getComputedStyle(e).position&&o.set(e,"position","relative"),f.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit"),e.appendChild(f),h.push(f));return x(()=>l,n,e=>{m.setAttribute("aria-label",e.label),e.position!==p&&(p=e.position,w(e.position,!0)),l?.refresh()},{set:w,get position(){return a}},()=>{d&&cancelAnimationFrame(d),e.removeEventListener("pointerdown",k),e.removeEventListener("pointermove",S),e.removeEventListener("pointerup",A),e.removeEventListener("pointercancel",A),m.removeEventListener("keydown",E),h.forEach(e=>e.remove()),C(),o.restore()})}var an=e=>"string"==typeof e?{src:e}:e;function sn(e,t){const n={current:{open:0,duration:280,label:"Images",...t}},o=g(),i=n.current.images.map(an);let s=r(Math.round(n.current.open),0,Math.max(0,i.length-1)),l=0,c=performance.now(),d=i.map((e,t)=>t===s?1:0);const u=i.map(()=>null),h=i.map(()=>null);let p=null;const f=i.map(e=>{const t=document.createElement("button");t.type="button",t.className="ascii-acc-panel",t.setAttribute("aria-label",[e.title??e.alt,e.meta].filter(Boolean).join(", ")||e.src);const n=Ot(e.src);if(n.className="ascii-acc-photo",n.alt="",n.draggable=!1,e.focus&&n.style.setProperty("object-position",`${100*e.focus.x}% ${100*e.focus.y}%`),t.appendChild(n),e.title||e.meta){const n=document.createElement("span");n.className="ascii-acc-caption",n.setAttribute("aria-hidden","true");for(const[t,r]of[["ascii-acc-title",e.title],["ascii-acc-meta",e.meta]]){if(!r)continue;const e=document.createElement("span");e.className=t,e.textContent=r,n.appendChild(e)}t.appendChild(n)}return t});p=y({host:e,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.94,hover:"trail",trail:{strength:.5,radius:.25},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",reducedMotion:()=>n.current.reducedMotion,onFail:()=>{p=null,delete e.dataset.asciiField},onTheme:()=>{u.forEach((e,t)=>{h[t]=e&&p?Bt(e,!p.dark()):null}),p?.kick()},paint:({pen:e,now:t,still:o,box:u})=>{const p=l?Math.min(64,t-l):16;l=t;let m=!1;return d=d.map((e,t)=>{const r=t===s?1:0,a=o?r:e+Math.sign(r-e)*Math.min(Math.abs(r-e),p/Math.max(1,n.current.duration));return a!==r&&(m=!0),a}),f.forEach((t,n)=>{const o=h[n],s=a(d[n]);if(!o||s>=1)return;const l=u(t),c=parseFloat(getComputedStyle(t).borderTopLeftRadius)||0;e.save(),e.beginPath(),e.roundRect(l.x,l.y,l.w,l.h,c),e.clip(),e.globalAlpha=1-s,Nt(e,o,l.x,l.y,l.w,l.h,i[n].focus?.x,i[n].focus?.y);const p=.4*Math.sin(Math.PI*r(1.4*s));p>.01&&(e.globalCompositeOperation="lighter",e.globalAlpha=p,e.fillStyle="#fff",e.fillRect(l.x,l.y,l.w,l.h)),e.restore()}),t-c<n.current.duration+60&&(m=!0),m||(l=0),m}});const m=()=>{f.forEach((e,t)=>{e.setAttribute("aria-expanded",String(t===s)),e.tabIndex=t===s?0:-1})},v=(e,t=!1)=>{e=r(Math.round(e),0,f.length-1),t&&f[e]?.focus(),e!==s&&(s=e,c=performance.now(),m(),n.current.onChange?.(e),p?.kick())},b=f.map((e,t)=>{const n=()=>v(t),r=()=>{e.matches(":focus-visible")&&v(t)},o=e=>{const n={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key],r="Home"===e.key?0:"End"===e.key?f.length-1:void 0!==n?(t+n+f.length)%f.length:null;null!==r&&(e.preventDefault(),v(r,!0))};return e.addEventListener("pointermove",n),e.addEventListener("pointerdown",n),e.addEventListener("click",n),e.addEventListener("focus",r),e.addEventListener("keydown",o),()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerdown",n),e.removeEventListener("click",n),e.removeEventListener("focus",r),e.removeEventListener("keydown",o)}});Ut("ascii-kit-accordion",'\n:where([data-ascii-accordion]){display:flex;gap:6px}\n:where(.ascii-acc-panel){position:relative;flex:1 1 0;min-width:0;margin:0;padding:0;border:0;border-radius:12px;overflow:hidden;background:transparent;color:#fff;font:inherit;text-align:left;cursor:pointer;transition:flex-grow var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where(.ascii-acc-panel[aria-expanded="true"]){flex-grow:4.2;cursor:default}\n:where(.ascii-acc-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;scale:1.04;transition:opacity 160ms cubic-bezier(.16, 1, .3, 1),scale var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where([data-ascii-accordion]:not([data-ascii-field])) :where(.ascii-acc-photo){opacity:.45}\n:where(.ascii-acc-panel[aria-expanded="true"]) :where(.ascii-acc-photo){opacity:1;scale:1;transition:opacity 240ms cubic-bezier(.16, 1, .3, 1) 40ms,scale var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where(.ascii-acc-caption){position:absolute;inset:auto 0 0;display:flex;color:#fff;flex-direction:column;gap:2px;padding:28px 12px 11px;background:linear-gradient(to top, rgb(0 0 0 / .62), transparent);white-space:nowrap;opacity:0;translate:0 6px;transition:opacity 120ms,translate 200ms}\n:where(.ascii-acc-panel[aria-expanded="true"]) :where(.ascii-acc-caption){opacity:1;translate:0 0;transition-delay:160ms}\n:where(.ascii-acc-title){font-size:15px;font-weight:500}\n:where(.ascii-acc-meta){font-size:14px;opacity:.8}\n@media (prefers-reduced-motion:reduce){:where(.ascii-acc-panel,.ascii-acc-photo,.ascii-acc-caption){transition:none}}\n'),e.dataset.asciiAccordion="",p&&(e.dataset.asciiField="");const w=e.getAttribute("role"),M=e.getAttribute("aria-label");return w||e.setAttribute("role","group"),M||e.setAttribute("aria-label",n.current.label),o.set(e,"--ascii-acc-ms",`${n.current.duration}ms`),f.forEach(t=>e.appendChild(t)),m(),f.forEach((e,t)=>{const n=e.querySelector("img");n&&zt(n).then(e=>{u[t]=e,h[t]=p?Bt(e,!p.dark()):null,p?.kick()},()=>{})}),x(()=>p,n,t=>{o.set(e,"--ascii-acc-ms",`${t.duration}ms`),M||e.setAttribute("aria-label",t.label),p?.refresh()},{select:v,get open(){return s}},()=>{b.forEach(e=>e()),f.forEach(e=>e.remove()),delete e.dataset.asciiAccordion,delete e.dataset.asciiField,w||e.removeAttribute("role"),M||e.removeAttribute("aria-label"),o.restore()})}var ln={maxBytes:10485760,develop:720};function cn(e,t={}){const n={current:{...ln,...t}};let r="empty",o=null,i="",s="",l="image",c=0,d=0,u=!1,h=0,p=0,f=0,g=null,b=null;const w=v("",!0),M=document.createElement("input"),k=[w,M];let S=null;const A=!e.children.length;b=y({host:e,layer:"under",look:()=>"empty"===r?{mark:"glyph",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:1,glyphScale:.9,...n.current.look}:{mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,background:m(e)?"transparent":"#0b0b0a",color:"source",saturation:1.15,contrast:1.15,hover:"trail",trail:{strength:.6,radius:.3},...n.current.look},ink:()=>n.current.ink??"--ascii-ink",reducedMotion:()=>n.current.reducedMotion,onFail:()=>{b=null,i&&L(i)},paint:({pen:t,w:i,h:s,now:l,still:d})=>{if("empty"!==r){if(!o)return!1;const e=d?1:a((l-c)/n.current.develop,3);return Nt(t,o,0,0,i,s),t.fillStyle="#000",t.globalAlpha=Math.max(0,1-1.08*e),t.fillRect(0,0,i,s),t.globalAlpha=1,e>=1&&"developing"===r&&C(),e<1}const h=f?Math.min(64,l-f):16;f=l;const m=u?1:0;p=d?m:p+(m-p)*(1-Math.exp(-h/70));const g=d?.5:.5-.5*Math.cos(l/1300*Math.PI*2),v=Math.max(4,(parseFloat(getComputedStyle(e).borderTopLeftRadius)||16)-6),b=(e,n)=>{if(n<=0)return;const r=Math.round(255*Math.min(1,n));t.strokeStyle=`rgb(${r} ${r} ${r})`,t.lineWidth=6,t.beginPath(),t.roundRect(e+3,e+3,i-2*e-6,s-2*e-6,Math.max(0,v-e+6)),t.stroke()};b(6,.56+p*(.14+.28*g)),b(12,.55*(.56+.42*p)*p*(.4+.6*g));const y=u||Math.abs(m-p)>.004;return y||(f=0),y}});const E=t=>{const n=r;r=t,e.dataset.state=t,"empty"===n!=("empty"===t)&&b?.refresh()},C=()=>{E("done"),w.textContent=`${l} ready`,o&&n.current.onImage?.({file:g,src:i,width:o.width,height:o.height})};function L(t){S??(S=Object.assign(document.createElement("img"),{className:"ascii-drop-img",alt:""})),S.src=t,S.parentElement!==e&&(e.prepend(S),k.push(S))}const $=async(e,t=null)=>{const n=++d;let a;s&&URL.revokeObjectURL(s),s="string"==typeof e?"":URL.createObjectURL(e),i=s||e,g=t??("undefined"!=typeof File&&e instanceof File?e:null),l=g?.name??("string"==typeof e&&e.split("/").pop()?.split("?")[0]||"image"),w.textContent=`Converting ${l}`;try{a=await zt(Ot(i))}catch{return void(n===d&&(w.textContent=`Could not load ${l}`))}if(n===d){if(o=a,!b)return L(i),E("done"),void C();c=performance.now(),E(b.still()?"done":"developing"),b.field.pulse({strength:1}),b.kick(),"done"===r&&C()}},R=e=>{const t=t=>{w.textContent=t,n.current.onError?.(t,e)};return e.type.startsWith("image/")?e.size>n.current.maxBytes?t(`${e.name} is over ${Math.round(n.current.maxBytes/1024/1024)} MB.`):void $(e,e):t(`${e.name} isn’t an image.`)},I=()=>{d++,o=null,i="",g=null,s&&URL.revokeObjectURL(s),s="",S?.remove(),E("empty"),w.textContent="",b?.kick()},T=()=>M.click(),F=t=>new Promise(a=>{const i=b?.field;if(!i||!o||"done"!==r)return void a(null);const s=document.createElement("canvas");s.width=i.canvas.width,s.height=i.canvas.height;const c=s.getContext("2d");c?(c.fillStyle=getComputedStyle(e).backgroundColor||"#000",c.fillRect(0,0,s.width,s.height),i.redraw(),c.drawImage(i.canvas,0,0),s.toBlob(e=>{if(e){const r=document.createElement("a");r.href=URL.createObjectURL(e),r.download=t??n.current.filename??`${l.replace(/\.[^.]+$/,"")}-ascii.png`,r.click(),setTimeout(()=>URL.revokeObjectURL(r.href),1e3)}a(e)},"image/png")):a(null)}),P=()=>{f=0,b?.kick()},W=t=>{t.preventDefault(),h++,u||(u=!0,e.dataset.over="",P())},z=e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},O=()=>{h=Math.max(0,h-1),!h&&u&&(u=!1,delete e.dataset.over,P())},N=t=>{if(t.preventDefault(),h=0,u=!1,delete e.dataset.over,b){const n=e.getBoundingClientRect();b.field.pulse({x:t.clientX-n.left,y:t.clientY-n.top,strength:1})}const n=t.dataTransfer?.files?.[0];n?R(n):P()},B=e=>{const t=e.target?.closest?.("[data-dropzone]")?.getAttribute("data-dropzone");"pick"===t?T():"clear"===t?I():"download"===t&&F()},G=()=>{const e=M.files?.[0];M.value="",e&&R(e)};Ut("ascii-kit-dropzone",'\n:where(.ascii-drop-empty){position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:100%;min-height:inherit;padding:24px;box-sizing:border-box;text-align:center}\n:where([data-ascii-dropzone]:not([data-state="empty"])) :where(.ascii-drop-empty){display:none}\n:where(.ascii-drop-title){margin:0;font-weight:500}\n:where(.ascii-drop-hint){margin:0;font-size:14px;opacity:.65}\n:where(.ascii-drop-pick){margin-top:8px;height:34px;padding:0 14px;border:0;border-radius:999px;background:currentColor;font:inherit;font-size:14px;cursor:pointer}\n:where(.ascii-drop-pick) > span{color:Canvas}\n:where(.ascii-drop-img){position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n'),e.dataset.asciiDropzone="",M.type="file",M.accept="image/*",M.tabIndex=-1,M.hidden=!0,M.setAttribute("aria-hidden","true"),A&&k.push(function(){const e=document.createElement("div"),t=document.createElement("p"),n=document.createElement("p"),r=document.createElement("button"),o=document.createElement("span");return e.className="ascii-drop-empty",t.className="ascii-drop-title",t.textContent="Drop an image",n.className="ascii-drop-hint",n.textContent="PNG, JPG or WebP",r.type="button",r.className="ascii-drop-pick",r.dataset.dropzone="pick",o.textContent="Choose file",r.appendChild(o),e.append(t,n,r),e}());for(const t of k)e.appendChild(t);return E("empty"),e.addEventListener("dragenter",W),e.addEventListener("dragover",z),e.addEventListener("dragleave",O),e.addEventListener("drop",N),e.addEventListener("click",B),M.addEventListener("change",G),x(()=>b,n,()=>b?.refresh(),{setImage:e=>$(e),clear:I,pick:T,download:F,get state(){return r}},()=>{d++,s&&URL.revokeObjectURL(s),e.removeEventListener("dragenter",W),e.removeEventListener("dragover",z),e.removeEventListener("dragleave",O),e.removeEventListener("drop",N),e.removeEventListener("click",B),M.removeEventListener("change",G),k.forEach(e=>e.remove()),delete e.dataset.asciiDropzone,delete e.dataset.state,delete e.dataset.over})}var dn={duration:620,collapse:!0,remove:!1},un=16,hn=new WeakMap;function pn(e,t={}){const n=hn.get(e);if(n)return n;const o={...dn,...t},a=g(),i=e.offsetHeight,l=()=>{for(const t of e.children)a.set(t,"opacity","0");a.set(e,"color","transparent"),a.set(e,"pointer-events","none"),e.setAttribute("aria-hidden","true")},c=t=>{o.collapse&&(a.set(e,"box-sizing","border-box"),a.set(e,"overflow","hidden"),a.set(e,"min-height","0"),a.set(e,"height",`${(i*(1-t)).toFixed(2)}px`),t>=1&&(a.set(e,"padding-block","0"),a.set(e,"margin-block","0"),a.set(e,"border-width","0")))},d=o.host??e.parentElement??e;let u=0,h=null,p={x:0,y:0,w:0,h:0},f=()=>{};const m=y({host:d,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,contrast:1.6,...o.look}),outset:un,resolution:2,ink:()=>o.ink??"--ascii-ink-strong",reducedMotion:()=>o.reducedMotion,onFail:()=>f(),paint:({pen:e,now:t,still:n,scale:a})=>{if(n||!h)return queueMicrotask(f),!1;const i=t-u,l=r(i/o.duration);e.setTransform(a,0,0,a,0,0),i>=300&&c(s(r((i-300)/260))),e.save(),e.globalAlpha=r(2.2*(1-l))*(1-.9*l*l),e.translate(8*l,-14*l),e.drawImage(h,0,0,h.width/2,h.height/2),e.globalCompositeOperation="destination-out";const d=p.x+p.w,m=d-(1.3*l-.3)*p.w,g=d-1.3*l*p.w,v=e.createLinearGradient(g,0,Math.max(g+1,m),0);v.addColorStop(0,"rgba(0,0,0,0)"),v.addColorStop(1,"rgba(0,0,0,1)"),e.globalAlpha=1,e.fillStyle=v,e.fillRect(p.x-un,p.y-un,p.w+32,p.h+32),e.restore();const b=i>=Math.max(o.duration,o.collapse?560:0);return b&&queueMicrotask(f),!b}}),v=new Promise(t=>{let n=!1;if(f=()=>{n||(n=!0,m?.destroy(),c(1),o.remove&&e.remove(),hn.delete(e),t())},!m||m.still())return l(),void f();p=m.box(e),h=qt(e,m.canvas.clientWidth||p.w+32,m.canvas.clientHeight||p.h+32,m.box).canvas,l(),u=performance.now(),m.kick()});return hn.set(e,v),v}var fn={threshold:88},mn=.3;function gn(e,t){const n={current:{...fn,...t}},o=g(),i=()=>n.current.content??e.children[0]??null,s=v("",!0),l={x:0,v:0,to:0};let c="idle",d=!1,u=!1,h=0,p=-1,f=0,m=0,b=0,w=!0,M=null,k=[];const S=new WeakSet,A=e=>{s.textContent=e};M=y({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.94,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{M=null},paint:({pen:e,w:t,now:s,still:u,scale:h,box:p})=>{const g=b?Math.min(1/30,(s-b)/1e3):1/60;b=s;let v=d;u?(l.x=l.to,l.v=0):d||(v=function(e,t,n=300,r=.86,o=.2){const a=2*Math.sqrt(n)*r,i=Math.max(1,Math.ceil(240*t)),s=t/i;for(let t=0;t<i;t++)e.v+=(-n*(e.x-e.to)-a*e.v)*s,e.x+=e.v*s;return!(Math.abs(e.x-e.to)<o&&Math.abs(e.v)<12*o&&(e.x=e.to,e.v=0,1))}(l,g)||v),"refreshing"===c&&(f+=7.5*g,v=!0),"done"===c&&s-m<320&&(v=!0);const y=i();y&&o.set(y,"translate",`0 ${Math.max(0,l.x).toFixed(2)}px`),e.setTransform(h,0,0,h,0,0);const x=Math.max(0,l.x),M=t/2,S=x/2,A=r(x/n.current.threshold);if(x>.5){if(e.save(),e.beginPath(),e.rect(0,0,t,x),e.clip(),"idle"===c||"pulling"===c){const t=10+32*A,n=e.createRadialGradient(M,S,0,M,S,t);n.addColorStop(0,`rgba(255,255,255,${.25+.75*A*A})`),n.addColorStop(.55,`rgba(255,255,255,${.12+.5*A*A})`),n.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=n,e.fillRect(M-t,S-t,2*t,2*t),A>=1&&(e.strokeStyle="rgba(255,255,255,.9)",e.lineWidth=8,e.beginPath(),e.arc(M,S,28,0,2*Math.PI),e.stroke())}else{const t="done"===c&&w?u?1:a((s-m)/300):0;e.lineWidth=9,e.lineCap="round";for(let n=0;n<18;n++){const r=f+n/18*Math.PI*1.5;e.strokeStyle=`rgba(255,255,255,${(.15+n/17*.85)*(1-t)*("done"!==c||w?1:.4)})`,e.beginPath(),e.arc(M,S,28,r,r+1.5*Math.PI/18+.02),e.stroke()}t>0&&function(e,t,n,r,o){if(o<=0)return;const a=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([e,o])=>[t+e*r,n+o*r]),i=Math.hypot(a[1][0]-a[0][0],a[1][1]-a[0][1])+Math.hypot(a[2][0]-a[1][0],a[2][1]-a[1][1]);e.save(),e.strokeStyle="#fff",e.lineWidth=.44*r,e.lineCap="round",e.lineJoin="round",e.setLineDash([i*o,i]),e.beginPath(),e.moveTo(a[0][0],a[0][1]),e.lineTo(a[1][0],a[1][1]),e.lineTo(a[2][0],a[2][1]),e.stroke(),e.restore()}(e,M,S,26,t)}e.restore()}return k=k.filter(t=>{if(!t.row.isConnected)return C(t,!0),!1;const n=u?1:(s-t.start)/760;if(n<0||!Number.isFinite(n))return v=v||Number.isFinite(n),!0;if(n>=mn&&C(t),n>=1)return C(t,!0),!1;const r=p(t.row);return e.globalAlpha=n<mn?a(n/mn,3):1-a((n-mn)/.7,3),e.drawImage(t.snap,r.x,r.y,r.w,r.h),e.globalAlpha=1,v=!0,!0}),v||(b=0),v}});const E=()=>M?.kick();function C(e,t=!1){const n=e.row.style;e.shown||(e.shown=!0,n.transition="opacity 280ms cubic-bezier(.16, 1, .3, 1)",n.opacity=e.opacity),t&&(n.transition=e.transition)}const L=(e,t)=>{const n=M;if(n&&!n.still()){for(const r of e){if(!(r instanceof HTMLElement)||S.has(r))continue;S.add(r);const e=n.box(r),o=qt(r,e.w,e.h,e=>{const t=n.box(e),o=n.box(r);return{x:t.x-o.x,y:t.y-o.y,w:t.w,h:t.h}}).canvas;k.push({row:r,snap:o,start:t,opacity:r.style.opacity,transition:r.style.transition,shown:!1}),r.style.transition="none",r.style.opacity="0"}E()}},$=()=>{const e=performance.now();k.forEach(t=>{t.start===1/0&&(t.start=e)}),E()},R=e=>new Promise(t=>setTimeout(t,e)),I=async()=>{if("refreshing"===c||"done"===c)return;const t=n.current,r=!M||M.still();c="refreshing",d=u=!1,l.to=t.threshold,m=performance.now(),e.setAttribute("aria-busy","true"),A(t.messages?.refreshing??"Refreshing."),E(),w=!0;try{await Promise.all([t.onRefresh(),R(r?0:600)])}catch{w=!1}if("refreshing"===c){if(w&&t.reveal&&!r){await new Promise(e=>"function"==typeof requestAnimationFrame?requestAnimationFrame(()=>e()):e());const e=i();e&&L(e.querySelectorAll(t.reveal),1/0)}c="done",m=performance.now(),A(w?t.messages?.done??"Updated.":t.messages?.failed??"Couldn’t refresh."),E(),await R(r?0:620),"done"===c?(c="idle",l.to=0,$(),e.removeAttribute("aria-busy"),E()):$()}},T=t=>{0!==t.button||"idle"!==c||e.scrollTop>0||(d=!0,u=!1,h=t.clientY,p=t.pointerId)},F=t=>{if(!d||t.pointerId!==p)return;t.clientY<h&&(h=t.clientY);const n=(t.clientY-h)/(e.getBoundingClientRect().height/(e.clientHeight||1)||1);if(!u){if(n<6)return;u=!0,c="pulling",e.setPointerCapture?.(t.pointerId)}l.x=l.to=(e=>128*(1-Math.exp(-Math.max(0,e)/128)))(n-6),l.v=0,E()},P=()=>{if(d&&(d=!1,u)){if(u=!1,l.x>=n.current.threshold)return c="idle",void I();c="idle",l.to=0,E()}},W=e=>{u&&e.preventDefault()},z=e=>{d&&e.preventDefault()};return M?(o.set(e,"overscroll-behavior-y","contain"),e.appendChild(s),e.addEventListener("pointerdown",T),e.addEventListener("pointermove",F),e.addEventListener("pointerup",P),e.addEventListener("pointercancel",P),e.addEventListener("touchmove",W,{passive:!1}),e.addEventListener("dragstart",z),e.addEventListener("selectstart",z)):e.appendChild(s),x(()=>M,n,()=>M?.refresh(),{refresh:I,revealRows:e=>L(e,performance.now()),get state(){return c}},()=>{c="idle",k.forEach(e=>{e.row.style.opacity=e.opacity,e.row.style.transition=e.transition}),k=[],e.removeEventListener("pointerdown",T),e.removeEventListener("pointermove",F),e.removeEventListener("pointerup",P),e.removeEventListener("pointercancel",P),e.removeEventListener("touchmove",W),e.removeEventListener("dragstart",z),e.removeEventListener("selectstart",z),e.removeAttribute("aria-busy"),s.remove(),o.restore()})}export{w as BEAM_PALETTES,ce as PILL_TONES,Ue as VOICE_PALETTES,sn as accordion,He as artPanel,Ge as asciiVideo,F as beam,L as beamPalette,Mt as blockChart,D as buttonLoading,Wt as codeInput,ot as commandPalette,on as compare,z as decode,pn as disintegrate,cn as dropzone,ze as fieldBackground,Me as imageGenerate,yt as likeBurst,y as mountSurface,B as odometer,Et as pageDissolve,ge as pill,je as pricingGlow,gn as pullRefresh,d as resolveColor,se as skeleton,pt as slideToConfirm,re as statusOrb,rn as streamText,It as swipeDeck,be as tabs,Zt as thinking,Kt as toastStack,Ke as voiceOrb,Ne as wordmark};//# sourceMappingURL=kit.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asciify-engine",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "Framework-agnostic ASCII art engine. Convert images, videos, and GIFs into ASCII art rendered on canvas, or run full-bleed GPU character fields with a fluid cursor wake.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -56,6 +56,16 @@
|
|
|
56
56
|
"types": "./dist/field.d.cts",
|
|
57
57
|
"default": "./dist/field.cjs"
|
|
58
58
|
}
|
|
59
|
+
},
|
|
60
|
+
"./kit": {
|
|
61
|
+
"import": {
|
|
62
|
+
"types": "./dist/kit.d.ts",
|
|
63
|
+
"default": "./dist/kit.js"
|
|
64
|
+
},
|
|
65
|
+
"require": {
|
|
66
|
+
"types": "./dist/kit.d.cts",
|
|
67
|
+
"default": "./dist/kit.cjs"
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
},
|
|
61
71
|
"files": [
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
name: asciify-engine
|
|
3
3
|
description: Build and tune browser ASCII art with asciify-engine so it fits the user's request, preferences and the project's design. Use for photo, video and GIF conversion, interactive heroes, GPU character fields with the user's own words, ambient backgrounds, text banners, art styles and export, hover and motion choices, layered HTML typography, and rendering performance.
|
|
4
4
|
metadata:
|
|
5
|
-
tested-engine: "4.
|
|
5
|
+
tested-engine: "4.13.0"
|
|
6
6
|
updated: "2026-10-14"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Asciify Engine
|
|
10
10
|
|
|
11
|
-
Use the published `asciify-engine` npm package for browser canvas rendering. Tested against **4.
|
|
11
|
+
Use the published `asciify-engine` npm package for browser canvas rendering. Tested against **4.13.0**. Check the application's installed version and its public types before using newer options; a local checkout can contain unpublished changes.
|
|
12
12
|
|
|
13
13
|
- Agent entry: https://asciify.org/skill (redirects to this Markdown document).
|
|
14
14
|
- Playground: https://asciify.org/editor
|
|
@@ -19,7 +19,7 @@ Use the published `asciify-engine` npm package for browser canvas rendering. Tes
|
|
|
19
19
|
npm install asciify-engine@latest
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Entries: `asciify-engine` and `/core` for media and text conversion; `/hover` for the website hovers and living-image motion; `/studio` for art styles, looks and export; `/field` for GPU character fields. Each optional entry loads only when imported. Procedural background templates are downloaded from asciify.org/backgrounds and are not npm exports. GIF decoding loads `gifuct-js` when a GIF API is called.
|
|
22
|
+
Entries: `asciify-engine` and `/core` for media and text conversion; `/hover` for the website hovers and living-image motion; `/studio` for art styles, looks and export; `/field` for GPU character fields; `/kit` for interface components, one call each. Each optional entry loads only when imported. Procedural background templates are downloaded from asciify.org/backgrounds and are not npm exports. GIF decoding loads `gifuct-js` when a GIF API is called.
|
|
23
23
|
|
|
24
24
|
## Start here: the request, then the design
|
|
25
25
|
|
|
@@ -31,12 +31,13 @@ Most requests are a feeling ("make the hero feel alive", "retro", "subtle behind
|
|
|
31
31
|
4. **Decide living or still.** A still photo can be made to feel alive (field `drift`, studio `motion`), but some users want it still. Follow their words; keep art behind text, in grids and in data views still; reduced motion always gets a still. See [living or still](references/design-matching.md#living-or-still).
|
|
32
32
|
5. **Say what you chose in one line** and offer one alternative. Ask only when the media is missing or motion would be new to a site that has none.
|
|
33
33
|
|
|
34
|
-
[references/components.md](references/components.md)
|
|
34
|
+
**For any UI component, start with [references/components.md](references/components.md) and [references/kit.md](references/kit.md).** `asciify-engine/kit` makes each component one call that handles theme ink, reduced motion, the no-WebGL fallback and cleanup; components.md has 31 of them as short kit snippets: controls (button loading, slide to confirm, like burst, verification code, command palette, pills, tabs), feedback (loading states, skeleton loader, toast stack, pull to refresh), AI (voice orb, thinking, streaming text, image generation), transitions (page transition, delete into characters), data (chart, odometer, border beam), media (before and after, dropzone, accordion, swipe cards, video), text (decode headline, wordmark) and pages (sign-in, pricing, 404, hero background), each with the prompt a person gives and the kit code. Start there when the request matches one; drop to the raw `/field` helper at the end of components.md only for a look the kit has no option for.
|
|
35
35
|
|
|
36
36
|
[references/design-matching.md](references/design-matching.md) maps mood words to settings, explains light themes, contrast and fonts, and gives tested recipes for the common requests. Read it whenever the user describes a look rather than an option.
|
|
37
37
|
|
|
38
38
|
| The user wants | Use |
|
|
39
39
|
| --- | --- |
|
|
40
|
+
| A UI component in characters (button loading, border beam, toasts, tabs, AI states, pages) | `asciify-engine/kit` ([components.md](references/components.md), [kit.md](references/kit.md)) |
|
|
40
41
|
| Their photo, video or GIF as ASCII on the page, optionally answering the cursor | `asciify` / `asciifyVideo` / `asciifyGif`, plus `mountHover` from `/hover` for the website hovers |
|
|
41
42
|
| A full-bleed hero or brand field that stays smooth under the cursor, or their own word as the characters | `mountGlyphField` from `/field` ([glyph-field.md](references/glyph-field.md)); `hover: 'trail'` for the classic Asciify Trail on pure characters, `'fluid'` for bold and liquid, `'lantern'` for a subtle light |
|
|
42
43
|
| A calm background behind product content (SaaS hero, pricing, docs), light or dark | `mountGlyphField` with `mark: 'dot'`, `scene: 'drift'`, `clear` around the copy, and `pulse()` on events (4.12) |
|