PageSourceSearch

https://vgpu.sh/_next/static/immutable/chunks/27_9z23l3jsis.js

js vgpu.sh collected 2026-10-08 10:05:10 UTC 53,414 bytes, 7 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,244822,e=>{"use strict";var t=e.i(322427),r=e.i(927795),a=e.i(888939);let n=[{id:"docs",label:"docs",detail:"read the API",initialPhase:"pending",finalPhase:"surface",timeline:[{kind:"command",command:"npx vgpu docs",output:["Usage: vgpu docs <command> [args] [flags]","Commands: ls · cat · grep · find · path · symbols"],holdMs:600},{kind:"command",command:"npx vgpu docs ls /guides",output:["getting-started.docs.md","concepts-effects.docs.md","shader-workflow.docs.md","texture-formats.docs.md"],holdMs:600},{kind:"command",command:'npx vgpu docs find "surface"',output:["Surface             vgpu    /vgpu/surface.docs.md","SurfaceOptions      vgpu    /vgpu/surface.docs.md","SurfaceResizeEvent  vgpu    /vgpu/surface.docs.md"],holdMs:650},{kind:"command",command:"npx vgpu docs cat Surface",output:["# Surface","Canvas-backed render target created by surface(gpu, canvas, opts)."],phase:"surface",holdMs:900}]},{id:"examples",label:"examples",detail:"pull a reference",initialPhase:"pending",finalPhase:"pulled",timeline:[{kind:"command",command:"npx vgpu examples",output:["Inspect canonical gallery source (never executes code)","Commands: search · show · cat · pull · cache"],holdMs:600},{kind:"command",command:'npx vgpu examples search "black hole" --limit 1 --pretty',output:["1 result","black-hole · Black Hole","6 files · webgpu · multi-pass","revision baa4b04c…"],phase:"found",holdMs:700},{kind:"command",command:"npx vgpu examples cat black-hole index.tsx",output:["import { createRenderer } from './renderer';","const renderer = createRenderer({ canvas, onError });"],phase:"source",holdMs:700},{kind:"command",command:"npx vgpu examples pull black-hole --out ./black-hole --pretty",output:["id: black-hole","files: 6 · bytes: 25246","aggregateSha256: fbeb1a1c…"],phase:"pulled",holdMs:950}]},{id:"check",label:"check",detail:"validate WGSL",initialPhase:"source",finalPhase:"success",timeline:[{kind:"command",command:"npx vgpu check ./shader.wgsl | jq -r -f reflection.jq",output:["error[VGPU-WGSL-NAGA-UNKNOWN]","shader.wgsl:7:26 — expected expression, found ';'","7 │ override exposure: f32 = ;","  │                          ^"],phase:"error",tone:"error",holdMs:1100},{kind:"event",label:"Edited shader.wgsl",phase:"fixed",holdMs:650},{kind:"command",command:"npx vgpu check ./shader.wgsl | jq -r -f reflection.jq",output:["diagnostics: []","bindings:","  0:0  params         buffer","  0:1  image          texture","  0:2  image_sampler  sampler","overrides: exposure = 1.0 · use_tint = true"],phase:"success",tone:"success",holdMs:1e3}]},{id:"doctor",label:"doctor",detail:"repair the runtime",initialPhase:"checking",finalPhase:"healthy",timeline:[{kind:"command",command:"npx vgpu doctor --pretty",output:["Verdict: unhealthy · Adapter: none","[FAIL] Vulkan loader libvulkan.so.1 was not found","[FAIL] No WebGPU adapter available","Fix: npx vgpu install-software-renderer"],phase:"unhealthy",tone:"error",holdMs:1050},{kind:"command",command:"npx vgpu install-software-renderer",output:["Downloaded software renderer","/home/node/.cache/vgpu/software-renderer/25.0.7-vgpu.1"],phase:"repairing",holdMs:1050},{kind:"command",command:"npx vgpu doctor --pretty",output:["Verdict: healthy","Adapter: llvmpipe (LLVM 19.1.7) (cpu)","[OK] rendered and read back a 16×16 target"],phase:"healthy",tone:"success",holdMs:1e3}]}],s=/\S+\s*/g,i="overflow-x-auto whitespace-pre-wrap break-words font-mono text-xs leading-6 text-gray-1000 sm:text-sm",l=["one","two","three"];function o(e){return e.match(s)??[]}function d(e){return new Promise(t=>window.setTimeout(t,e))}function c({value:e}){return o(e).map((e,r)=>(0,t.jsx)("span",{className:"agent-terminal-token",children:e},r+"-"+e))}function u(){return(0,t.jsx)("span",{"aria-hidden":"true",className:"agent-terminal-cursor ml-[0.18em] inline-block h-[1em] w-[0.5em] translate-y-[0.12em] bg-gray-900"})}function m({setProofState:e,stage:r}){let[n,s]=(0,a.useState)([]),[l,p]=(0,a.useState)(!1),h=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let t=!1,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches;return s([]),p(!1),e({stageId:r.id,phase:r.initialPhase}),async function(){if(a){s(r.timeline.map(e=>"event"===e.kind?{kind:"event",label:e.label}:{kind:"command",command:e.command,output:e.output,tone:e.tone??"default"})),e({stageId:r.id,phase:r.finalPhase}),p(!0);return}for(let a of(await d(360),r.timeline)){if(t)return;if("event"===a.kind){s(e=>[...e,{kind:"event",label:a.label}]),e({stageId:r.id,phase:a.phase}),await d(a.holdMs);continue}s(e=>[...e,{kind:"command",command:"",tone:a.tone??"default"}]);let n="";
1for(let e of o(a.command)){if(await d(65),t)return;let r=n+=e;s(e=>[...e.slice(0,-1),{kind:"command",command:r,tone:a.tone??"default"}])}if(await d(180),t)return;s(e=>[...e.slice(0,-1),{kind:"command",command:a.command,output:a.output,tone:a.tone??"default"}]),a.phase&&e({stageId:r.id,phase:a.phase}),await d(45*a.output.length+a.holdMs)}t||p(!0)}(),()=>{t=!0}},[e,r]),(0,a.useEffect)(()=>{let e=h.current;e&&(e.scrollTop=e.scrollHeight)},[n,l]),(0,t.jsxs)("div",{className:"h-full min-h-0 overflow-y-auto p-5 font-mono [scrollbar-width:none] sm:p-7 [&::-webkit-scrollbar]:hidden",ref:h,children:[n.map((e,r)=>{if("event"===e.kind)return(0,t.jsxs)("p",{className:"agent-terminal-event mt-5 text-xs text-green-800 dark:text-[#00ca52] sm:text-[13px]",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"●"})," ",e.label]},r+"-"+e.label);let a=!e.output&&!l;return(0,t.jsxs)("div",{className:0===r?"":"mt-5",children:[(0,t.jsxs)("p",{className:i,children:[(0,t.jsx)("span",{className:"text-gray-700",children:"$"})," ",(0,t.jsx)(c,{value:e.command}),a?(0,t.jsx)(u,{}):null]}),e.output?(0,t.jsx)("pre",{className:`mt-2 whitespace-pre-wrap break-words font-mono text-[10px] leading-5 sm:text-[11px] ${"error"===e.tone?"text-red-800 dark:text-[#e5484d]":"text-gray-900"}`,children:e.output.map((e,r)=>(0,t.jsx)("span",{className:"agent-terminal-output-line",style:{animationDelay:45*r+"ms"},children:e||" "},r+"-"+e))}):null]},r)}),0===n.length?(0,t.jsxs)("p",{"aria-hidden":"true",className:i,children:[(0,t.jsx)("span",{className:"text-gray-700",children:"$"})," ",(0,t.jsx)(u,{})]}):null]})}function p(){return(0,t.jsx)("div",{className:"grid h-full place-items-center p-8","data-proof":!0,children:(0,t.jsx)("div",{"aria-label":"Waiting for output",className:"flex h-6 items-center justify-center gap-2",role:"status",children:l.map((e,r)=>(0,t.jsx)("span",{"aria-hidden":"true",className:"agent-command-waiting-dot size-1.5 rounded-full bg-gray-800",style:{animationDelay:120*r+"ms"}},e))})})}function h(){return(0,t.jsxs)("div",{className:"flex h-full flex-col p-5 sm:p-7","data-proof":!0,children:[(0,t.jsx)("div",{className:"border-b border-gray-alpha-400 pb-5",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-gray-800",children:"/vgpu/surface.docs.md"}),(0,t.jsx)("h3",{className:"mt-2 text-pretty text-xl text-gray-1000",children:"Surface"})]})}),(0,t.jsxs)("p",{className:"mt-5 max-w-lg text-pretty text-sm leading-relaxed text-gray-900",children:["Canvas-backed render target created by"," ",(0,t.jsx)("code",{className:"font-mono text-gray-1000",children:"surface(gpu, canvas)"}),". Use it for browser canvases, offscreen rendering, and resize-driven targets."]}),(0,t.jsx)("pre",{className:"mt-6 overflow-x-auto rounded-lg border border-gray-alpha-400 bg-gray-100 p-4 font-mono text-[11px] leading-6 text-gray-950 sm:text-xs",children:(0,t.jsxs)("code",{children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"interface"})," Surface ",(0,t.jsx)("span",{className:"text-gray-800",children:"extends"})," Target {\n","  readonly canvas: HTMLCanvasElement;\n","  readonly size: readonly [number, number];\n","  resize(size: readonly [number, number]): void;\n","}"]})})]})}function x({phase:e}){let a="pulled"===e,n="source"===e;return(0,t.jsxs)("div",{className:"flex h-full flex-col","data-proof":!0,children:[(0,t.jsxs)("div",{className:"relative aspect-video overflow-hidden border-b border-gray-alpha-400 bg-black",children:[(0,t.jsx)(r.default,{alt:"Black Hole canonical vgpu example",className:"object-cover",fill:!0,sizes:"(max-width: 1024px) 100vw, 50vw",src:"/examples/black-hole.card.png"}),(0,t.jsx)("span",{className:"absolute right-3 top-3 rounded-full border border-white/15 bg-black/70 px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-white/65 backdrop-blur-sm",children:"official"})]}),(0,t.jsxs)("div",{className:"grid flex-1 gap-5 p-5 sm:grid-cols-[1fr_auto] sm:items-end sm:p-7",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-pretty text-xl text-gray-1000",children:"Black Hole"}),(0,t.jsx)("p",{className:"mt-2 max-w-md text-pretty text-sm leading-relaxed text-gray-900",children:a?"Six source files are pinned to one revision and ready in the agent's workspace.":n?"The agent is inspecting the canonical entry point before pulling the complete source.":"The canonical gallery returned one matching WebGPU reference."})]}),(0,t.jsxs)("div",{className:"font-mono text-[10px] leading-5 text-gray-800",children:[(0,t.jsx)("p",{children:"6 files"}),(0,t.jsx)("p",{children:"25.2 KB"}),(0,t.jsx)("p",{className:"text-green-800 dark:text-[#00ca52]",children:a?"integrity verified":n?"source inspected":"match found"})]})]})]})}function f({change:e,children:r,number:a}){return(0,t.jsxs)("span",{className:`relative -mx-5 block min-w-max px-5 before:absolute before:left-0 before:top-[0.2em] before:h-[1.25em] before:w-0.5 before:content-[''] ${"removed"===e?"bg-red-100 before:bg-red-800 dark:before:bg-[#e5484d]":"added"===e?"bg-green-100 before:bg-green-800 dark:before:bg-[#00ca52]":""}`,children:[(0,t.jsx)("span",{className:`mr-2 inline-block w-3 select-none text-center ${"removed"===e?"text-red-800 dark:text-[#e5484d]":"added"===e?"text-green-800 dark:text-[#00ca52]":"text-transparent"}`,children:"removed"===e?"−":"added"===e?"+":"·"}),(0,t.jsx)("span",{className:"mr-4 inline-block w-4 select-none text-right text-gray-700",children:a}),r]})}function g({edited:e}){return(0,t.jsx)("pre",{className:"overflow-x-auto px-5 py-6 font-mono text-[11px] leading-6 text-gray-950 sm:text-xs",children:(0,t.jsxs)("code",{children:[(0,t.jsxs)(f,{number:1,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"struct"})," Params { tint: vec4f }"]}),(0,t.jsx)(f,{number:2,children:" "}),(0,t.jsxs)(f,{number:3,children:[(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"@group(0) @binding(0)"})," var<uniform> params: Params;"]}),(0,t.jsxs)(f,{number:4,children:[(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"@group(0) @binding(1)"})," var image: texture_2d<f32>;"]}),(0,t.jsxs)(f,{number:5,children:[(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"@group(0) @binding(2)"})," var image_sampler: sampler;"]}),(0,t.jsx)(f,{number:6,children:" "}),e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(f,{change:"removed",number:7,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"override"})," exposure: f32 = ;"]}),(0,t.jsxs)(f,{change:"added",number:7,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"override"})," exposure: f32 = 1.0;"]})]}):(0,t.jsxs)(f,{number:7,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"override"})," exposure: f32 = ;"]}),(0,t.jsxs)(f,{number:8,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"override"})," use_tint: bool = true;"]})]})})}function b({phase:e}){return(0,t.jsx)("div",{className:"h-full","data-proof":!0,children:(0,t.jsx)(g,{edited:"fixed"===e||"success"===e})})}function v({phase:e}){let r="healthy"===e,a="unhealthy"===e,n="repairing"===e;return(0,t.jsx)("div",{className:"grid h-full place-items-center p-8","data-proof":!0,children:(0,t.jsxs)("div",{className:"w-full max-w-sm text-center",children:[(0,t.jsxs)("span",{className:`inline-flex items-center gap-2 font-mono text-[10px] uppercase tracking-[0.12em] ${r?"text-green-800 dark:text-[#00ca52]":a?"text-red-800 dark:text-[#e5484d]":"text-gray-800"}`,children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-current"})," ",r?"healthy":a?"unhealthy":n?"repairing":"checking"]}),(0,t.jsx)("h3",{className:"mt-4 text-pretty text-2xl text-gray-1000",children:r?"Ready to render":a?"No WebGPU adapter":n?"Installing renderer":"Checking runtime"}),(0,t.jsx)("p",{className:"mt-3 text-pretty text-sm leading-relaxed text-gray-900",children:r?"llvmpipe · 16×16 render and readback passed":a?"No adapter found. A portable renderer is required.":n?"Downloading and verifying the softw
1are renderer.":"Inspecting the runtime and requesting an adapter."})]})})}function y({phase:e,stage:r}){return"docs"===r.id?"pending"===e?(0,t.jsx)(p,{}):(0,t.jsx)(h,{}):"examples"===r.id?"pending"===e?(0,t.jsx)(p,{}):(0,t.jsx)(x,{phase:e}):"check"===r.id?(0,t.jsx)(b,{phase:e}):(0,t.jsx)(v,{phase:e})}e.s(["AgentCommandDemo",0,function(){let[e,r]=(0,a.useState)(0),[s,i]=(0,a.useState)(!0),[l,d]=(0,a.useState)(0),c=n[e],[u,p]=(0,a.useState)({stageId:c.id,phase:c.initialPhase}),h=360+c.timeline.reduce((e,t)=>"event"===t.kind?e+t.holdMs:e+65*o(t.command).length+180+45*t.output.length+t.holdMs,0),x=u.stageId===c.id?u.phase:c.initialPhase;function f(e){let t=n[e];i(!1),r(e),p({stageId:t.id,phase:t.initialPhase}),d(e=>e+1)}return(0,a.useEffect)(()=>{if(!s||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let e=window.setTimeout(()=>{r(e=>(e+1)%n.length)},h);return()=>window.clearTimeout(e)},[s,h]),(0,t.jsxs)("div",{className:"overflow-hidden rounded-card border border-gray-alpha-400 bg-background-100 shadow-[0_32px_100px_rgba(0,0,0,0.12)]","data-agent-command-demo":!0,children:[(0,t.jsx)("style",{children:"@keyframes agent-terminal-token-in {\n  from { opacity: 0; filter: blur(4px); transform: translateY(0.12em); }\n  to { opacity: 1; filter: blur(0); transform: translateY(0); }\n}\n@keyframes agent-terminal-output-in {\n  from { opacity: 0; transform: translateY(0.35em); }\n  to { opacity: 1; transform: translateY(0); }\n}\n@keyframes agent-terminal-cursor {\n  0%, 46% { opacity: 1; }\n  47%, 100% { opacity: 0; }\n}\n@keyframes agent-command-waiting-dot {\n  0%, 60%, 100% { opacity: 0.2; }\n  30% { opacity: 1; }\n}\n@keyframes agent-command-proof-in {\n  from { opacity: 0; transform: translateY(6px); }\n  to { opacity: 1; transform: translateY(0); }\n}\n@keyframes agent-command-progress {\n  from { transform: scaleX(0); }\n  to { transform: scaleX(1); }\n}\n[data-agent-command-demo] .agent-terminal-token {\n  display: inline-block;\n  animation: agent-terminal-token-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;\n}\n[data-agent-command-demo] .agent-terminal-output-line,\n[data-agent-command-demo] .agent-terminal-event {\n  display: block;\n  animation: agent-terminal-output-in 220ms ease-out both;\n}\n[data-agent-command-demo] .agent-terminal-cursor {\n  animation: agent-terminal-cursor 900ms steps(1, end) infinite;\n}\n[data-agent-command-demo] .agent-command-waiting-dot {\n  animation: agent-command-waiting-dot 900ms ease-in-out infinite;\n}\n[data-agent-command-demo] [data-proof] {\n  animation: agent-command-proof-in 240ms ease-out both;\n}\n[data-agent-command-demo] .agent-command-progress {\n  transform-origin: left;\n  animation: agent-command-progress linear both;\n}\n@media (prefers-reduced-motion: reduce) {\n  [data-agent-command-demo] [data-proof],\n  [data-agent-command-demo] .agent-terminal-token,\n  [data-agent-command-demo] .agent-terminal-output-line,\n  [data-agent-command-demo] .agent-terminal-event,\n  [data-agent-command-demo] .agent-terminal-cursor,\n  [data-agent-command-demo] .agent-command-waiting-dot,\n  [data-agent-command-demo] .agent-command-progress { animation: none; }\n}"}),(0,t.jsx)("div",{"aria-label":"vgpu CLI capabilities",className:"grid grid-cols-4 border-b border-gray-alpha-400 bg-background-200",role:"tablist",children:n.map((r,a)=>{let i=a===e;return(0,t.jsxs)("button",{"aria-controls":"agent-command-panel","aria-selected":i,className:"interactive-tab relative min-w-0 border-r border-gray-alpha-400 px-2 py-3 text-left font-mono transition-colors last:border-r-0 focus-visible:z-10 focus-visible:outline focus-visible:outline-1 focus-visible:outline-gray-1000 focus-visible:outline-offset-[-2px] sm:px-4 "+(i?"text-gray-1000":"text-gray-800 hover:text-gray-1000"),id:"agent-command-tab-"+r.id,onClick:()=>f(a),onKeyDown:e=>(function(e,t){let r=t;if("ArrowRight"===e.key)r=(t+1)%n.length;else if("ArrowLeft"===e.key)r=(t-1+n.length)%n.length;else if("Home"===e.key)r=0;else{if("End"!==e.key)return;r=n.length-1}e.preventDefault(),f(r),document.getElementById("agent-command-tab-"+n[r].id)?.focus()})(e,a),role:"tab",tabIndex:i?0:-1,type:"button",children:[(0,t.jsx)("span",{className:"block truncate text-[11px] sm:text-xs",children:r.label}),(0,t.jsx)("span",{className:"mt-1 hidden truncate text-[11px] text-gray-800 md:block",children:r.detail}),i?(0,t.jsx)("span",{"aria-hidden":"true",className:"absolute inset-x-0 bottom-0 h-px overflow-hidden bg-gray-alpha-400",children:(0,t.jsx)("span",{className:"agent-command-progress block h-full w-full bg-gray-1000",style:{animationDuration:h+"ms"}},c.id+"-"+l+"-"+(s?"auto":"manual"))}):null]},r.id)})}),(0,t.jsxs)("div",{"aria-labelledby":"agent-command-tab-"+c.id,className:"grid lg:h-[30rem] lg:grid-cols-[0.92fr_1.08fr]",id:"agent-command-panel",role:"tabpanel",children:[(0,t.jsx)("section",{className:"h-[25rem] min-w-0 overflow-hidden border-b border-gray-alpha-400 bg-background-100 sm:h-[28rem] lg:h-full lg:border-b-0 lg:border-r",children:(0,t.jsx)(m,{setProofState:p,stage:c},c.id+"-"+l)}),(0,t.jsx)("section",{className:"h-[25rem] min-w-0 overflow-hidden bg-background-100 sm:h-[28rem] lg:h-full",children:(0,t.jsx)(y,{phase:x,stage:c})})]})]})}])},682394,e=>{"use strict";var t=e.i(322427),r=e.i(888939);let a=[{label:"$ pnpm test:render",tone:"command"},{label:"compile eve.wgsl",tone:"step"},{label:"render headless frame",tone:"step"},{label:"compare snapshot",tone:"step"},{label:"1 test passed · 842ms",tone:"success"}];e.s(["CiRunOutput",0,function(){let e=(0,r.useRef)(null),[n,s]=(0,r.useState)(!1),[i,l]=(0,r.useState)(1);return(0,r.useEffect)(()=>
1{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return void l(a.length);let t=e.current;if(!t||"u"<typeof IntersectionObserver)return void s(!0);let r=new IntersectionObserver(([e])=>s(e.isIntersecting),{threshold:.35});return r.observe(t),()=>r.disconnect()},[]),(0,r.useEffect)(()=>{if(!n)return;let e=i===a.length,t=window.setTimeout(()=>l(e=>e===a.length?1:e+1),e?1800:650);return()=>window.clearTimeout(t)},[n,i]),(0,t.jsxs)("div",{className:"flex aspect-video items-center bg-background-100 px-4 font-mono text-[9px] leading-[1.65] sm:text-[10px]",ref:e,children:[(0,t.jsx)("p",{className:"sr-only",children:"CI runs the render test, compiles the shader, renders a headless frame, compares the snapshot, and passes."}),(0,t.jsx)("div",{"aria-hidden":"true",className:"w-full space-y-0.5",children:a.map((e,r)=>{let a=r<i,n="success"===e.tone;return(0,t.jsxs)("p",{className:`truncate transition-opacity duration-300 ${a?"opacity-100":"opacity-0"} ${n?"text-green-800 dark:text-[#00ca52]":"command"===e.tone?"text-gray-1000":"text-gray-900"}`,children:["step"===e.tone?"✓ ":null,n?"● ":null,e.label]},e.label)})})]})}])},322124,e=>{"use strict";var t=e.i(322427),r=e.i(927795),a=e.i(888939);e.s(["DeferredImage",0,function(e){let n=(0,a.useRef)(null),[s,i]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=n.current;if(!e)return;if(!("IntersectionObserver"in window))return void i(!0);let t=new IntersectionObserver(([e])=>{e?.isIntersecting&&(i(!0),t.disconnect())},{rootMargin:"256px 0px"});return t.observe(e),()=>t.disconnect()},[]),(0,t.jsx)("span",{ref:n,className:"absolute inset-0 block",children:s?(0,t.jsx)(r.default,{...e}):null})}])},457403,e=>{"use strict";var t=e.i(322427),r=e.i(888939);function a(e){if(!Number.isFinite(e)||e<0)return"00:00";let t=Math.floor(e),r=Math.floor(t/60);return`${r.toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`}e.s(["EveVideo",0,function(){let e=(0,r.useRef)(null),[n,s]=(0,r.useState)(!1),[i,l]=(0,r.useState)(0),[o,d]=(0,r.useState)(0),c=o>0?Math.min(100,i/o*100):0;return(0,r.useEffect)(()=>{let t=e.current;if(!t)return;if(!("IntersectionObserver"in window))return void s(!0);let r=new IntersectionObserver(([e])=>{e?.isIntersecting&&(s(!0),r.disconnect())},{rootMargin:"256px 0px"});return r.observe(t),()=>r.disconnect()},[]),(0,t.jsxs)("div",{ref:e,className:"flex aspect-video flex-col bg-black",children:[(0,t.jsx)("video",{"aria-label":"Eve shader rendered as video",autoPlay:n,className:"min-h-0 w-full flex-1 object-contain",loop:!0,muted:!0,onDurationChange:e=>d(e.currentTarget.duration),onLoadedMetadata:e=>d(e.currentTarget.duration),onTimeUpdate:e=>{l(e.currentTarget.currentTime),d(e.currentTarget.duration)},playsInline:!0,poster:n?"/examples/eve/eve-billboard.png":void 0,preload:"none",src:n?"/examples/eve/eve-hero-1080p.mp4":void 0}),(0,t.jsxs)("div",{className:"flex h-8 shrink-0 items-center gap-2 border-t border-white/10 bg-black px-2.5",children:[(0,t.jsx)("span",{className:"block size-1.5 shrink-0 rounded-full bg-white"}),(0,t.jsxs)("span",{className:"relative h-px flex-1 bg-white/20",children:[(0,t.jsx)("span",{className:"absolute inset-y-0 left-0 bg-white/80",style:{width:`${c}%`}}),(0,t.jsx)("span",{className:"absolute top-1/2 size-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-white",style:{left:`${c}%`}})]}),(0,t.jsxs)("span",{className:"font-mono text-[9px] tabular-nums text-white/55",children:[a(i)," / ",a(o)]})]})]})}])},966303,e=>{"use strict";var t=e.i(322427),r=e.i(888939),a=e.i(581745),n=e.i(849229),s=e.i(46773);function i(e){return e.replace(/`/g,"")}function l({text:e,mono:a=!0,wrap:n=!1}){return(0,t.jsx)(t.Fragment,{children:e.split("`").map((e,s)=>s%2==0?(0,t.jsx)(r.Fragment,{children:e},s):a?(0,t.jsx)("code",{className:`${n?"whitespace-normal":"whitespace-nowrap"} font-mono text-[0.95em]`,children:e},s):(0,t.jsx)("span",{className:n?"whitespace-normal":"whitespace-nowrap",children:e},s))})}let o={Prompt:{text:"Setup vgpu on my project, run `npx vgpu`",mono:!1,wrap:!1},CLI:{text:"`pnpm add vgpu`",mono:!0,wrap:!1},Skill:{text:"`npx skills add vercel-labs/vgpu`",mono:!0,wrap:!1},MCP:{text:"`npx -y add-mcp https://vgpu.sh/api/mcp -g`",mono:!0,wrap:!0}},d=Object.keys(o);e.s(["HeroTabs",0,function(){let{activeTab:e,setActiveTab:c}=(0,s.useHeroTab)(),[u,m]=(0,r.useState)(null),[p,h]=(0,r.useState)(!1),x=(0,r.useRef)(void 0),f=o[e].text;(0,r.useEffect)(()=>()=>window.clearTimeout(x.current),[]);let g=async()=>{try{await navigator.clipboard.writeText(i(f)),h(!0),window.setTimeout(()=>h(!1),1600)}catch{}};return(0,t.jsxs)("div",{"data-hero-tabs":!0,className:"flex w-full flex-col",children:[(0,t.jsx)("div",{"data-hero-tabs-list":!0,role:"tablist","aria-label":"Setup option",className:"flex items-center justify-center text-[15px] leading-none lg:text-[16
1px]",children:d.map((a,n)=>(0,t.jsxs)(r.Fragment,{children:[n>0&&(0,t.jsx)("span",{"aria-hidden":!0,className:"px-2",children:"·"}),(0,t.jsx)("button",{type:"button",role:"tab","aria-selected":e===a,onClick:()=>{a!==e&&(m(e),c(a),window.clearTimeout(x.current),x.current=window.setTimeout(()=>m(null),150))},className:`text-current transition-opacity ${e===a?"opacity-100":"opacity-50 hover:opacity-80"}`,children:a})]},a))}),(0,t.jsx)("div",{"data-hero-tabs-rule":!0,"aria-hidden":!0,className:"mb-2 mt-5 h-px w-full"}),(0,t.jsxs)("button",{"data-hero-tabs-copy":!0,type:"button",onClick:g,"aria-label":p?"Copied":`Copy: ${i(f)}`,className:"group relative w-full px-7 text-center text-[15px] leading-relaxed text-current opacity-90 transition-opacity hover:opacity-100 lg:text-[16px]",children:[(0,t.jsx)("span",{className:"grid",children:d.map(r=>{let a=r===e?"active":r===u?"leaving":"idle";return(0,t.jsx)("span",{"aria-hidden":"active"!==a,className:`col-start-1 row-start-1 motion-reduce:transition-none ${"active"===a?"translate-y-0 opacity-100 transition duration-200 ease-out":"leaving"===a?"-translate-y-1.5 select-none opacity-0 transition duration-150 ease-out":"translate-y-1.5 select-none opacity-0"}`,children:(0,t.jsx)(l,{text:o[r].text,mono:o[r].mono,wrap:o[r].wrap})},r)})}),(0,t.jsx)("span",{"aria-hidden":!0,className:`absolute right-0 top-1/2 -translate-y-1/2 transition-opacity ${p?"opacity-90":"opacity-0 group-hover:opacity-50"}`,children:p?(0,t.jsx)(a.Check,{className:"h-3.5 w-3.5"}):(0,t.jsx)(n.Copy,{className:"h-3.5 w-3.5"})})]})]})}],966303)},97262,e=>{"use strict";let t,r;var a=e.i(322427),n=e.i(888939),s=e.i(321303),i=e.i(795848),l=e.i(40020),o=e.i(784482),d=e.i(90280),c=e.i(825896),u=e.i(386844),m=e.i(464880),p=e.i(530284),h=e.i(921763);function x(){return t??=e.A(910828).catch(e=>{throw t=void 0,e})}function f(){return r??=e.A(310396).catch(e=>{throw r=void 0,e})}function g(e){("light"===e?x():f()).catch(()=>{})}var b=e.i(284134),v=e.i(252259),y=e.i(783243);function w(e,t,r){let a=t[0]-e[0],n=t[1]-e[1];return 1e-4>Math.abs(a)&&1e-4>Math.abs(n)?e[0]===t[0]&&e[1]===t[1]?void 0:t:[e[0]+a*r,e[1]+n*r]}function j(e,t,r){return Math.min(r,Math.max(t,e))}var k=e.i(872140),N=e.i(941490);let S=(0,n.lazy)(()=>e.A(971530).then(({PrismDebugGraph:e})=>({default:e}))),M={dark:"#000000",light:"#d2ccc2"};function P(){return document.documentElement.classList.contains("light")?"light":"dark"}function R(e,t){return"auto"===e?t:e}function E(){let t=(0,n.useRef)(null),r=(0,n.useRef)(null),E=(0,n.useRef)(y.DEFAULT_PRISM_CONTROLS),L=(0,n.useRef)(0),C=(0,n.useRef)("auto"),I=(0,n.useRef)("auto"),T=(0,n.useRef)("dark"),[A,_]=(0,n.useState)(!1),[F,O]=(0,n.useState)(),[z,D]=(0,n.useState)(y.DEFAULT_PRISM_CONTROLS),[q,U]=(0,n.useState)(y.DEFAULT_PRISM_CONTROLS),[$,H]=(0,n.useState)("dark"),[B,Q]=(0,n.useState)("auto"),[W,G]=(0,n.useState)({preference:"auto",effective:"high",reason:"initial"}),V=(0,n.useCallback)(e=>{console.error("Prism background failed to render.",e)},[]),K=(0,n.useCallback)(e=>{let t=e(E.current);E.current=t,D(t),L.current||(L.current=requestAnimationFrame(()=>{L.current=0,r.current?.setControls?.(E.current)}))},[]),Y=(0,n.useCallback)(e=>{T.current=e,"light"===e&&(0,N.preloadLightAssets)(),g(e);let t=M[e];if(U(e=>e.wallColor===t?e:{...y.DEFAULT_PRISM_CONTROLS,wallColor:t}),t!==E.current.wallColor){let e={...E.current,wallColor:t};E.current=e,D(e),r.current?.setControls?.(e)}let a=r.current;a?a.setMode(e).then(()=>{r.current===a&&T.current===e&&(H(e),O(a.debugSources()))},()=>{}):H(e)},[]),X=(0,n.useCallback)(e=>{C.current=e,Q(e),Y(R(e,P()))},[Y]),J=(0,n.useCallback)(e=>{I.current=e,G(t=>({...t,preference:e,...t.effective===("low"===e?"low":"high")?{reason:"auto"===e?"initial":"forced"}:{}}));let t=r.current;t?t.setQualityPreference(e).then(()=>{if(r.current===t&&I.current===e){let r=t.getQualityState();r.preference===e&&G(r),O(t.debugSources())}},()=>{}):G({preference:e,effective:"low"===e?"low":"high",reason:"auto"===e?"initial":"forced"})},[]);return(0,n.useEffect)(()=>{let a,n=t.current;if(!n)return;let S=new URLSearchParams(window.location.search).has("debug"),R=new URLSearchParams(window.location.search).has("prism-perf");
1_(S);let A=P();"light"===A&&(0,N.preloadLightAssets)(),g(A),T.current=A,H(A);let F=n.closest("[data-hero-theme]"),z=F?.querySelector("[data-triangle-container]"),q={...y.DEFAULT_PRISM_CONTROLS,wallColor:M[A]};E.current=q,D(q),U(q);let $=function(t){var r,a;let n,g,N,S,M,P,R,E,L,C,I,T,A,_,F,O,z,D,q,U,$,H,B=t.performanceSampling?"1"===(n=new URLSearchParams(window.location?.search).get("prism-perf-dpr"))?1:"2"===n?2:void 0:void 0,Q=t.debugPreviews?(0,m.createPrismDebugPreviewRelay)():void 0,W=t.qualityLogger??console,G=!1,V=!1,K=t.initialControls??y.DEFAULT_PRISM_CONTROLS,Y=t.initialMode,X=t.initialQuality??"auto",J="low"===X?"low":"high",Z="auto"===X?"initial":"forced",ee=J,et=Z,er=new Set,ea=0,en=0,es=0,ei=!1,el=!t.performanceSampling,eo=!t.debugPreviews&&el,ed=!1,ec=!0,eu=!0,em=0,ep=!1,eh=!0,ex=!1,ef=-1,eg=0,eb=!1,ev=-1,ey=-1,ew="function"==typeof window.matchMedia?window.matchMedia("(max-width: 767px)"):void 0,ej="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ek=(r=t.canvas,a=()=>{eh=!0},q=D=[y.PRISM_DEFAULT_ARC,.5],$=U=[0,0],{onPointerMove:e=>{if(!1===e.isPrimary)return;let t=r.getBoundingClientRect();t.width<=0||t.height<=0||(H([j((e.clientX-t.left)/t.width,0,1),j((e.clientY-t.top)/t.height,0,1)]),a())},setNormalizedPointer:H=e=>{let t=j(e[0],0,1),r=j(e[1],0,1);D=[r,t],U=[2*t-1,2*r-1]},onPointerLeave(){U=[0,0]},stepAim(){let e=w(q,D,y.LAMP_AIM_LERP);return e&&(q=e),e},stepOrbit(){let e=w($,U,y.CAMERA_ORBIT_LERP);return e&&($=e),e}}),eN=e=>{ew?.matches||ek.onPointerMove(e)},eS=()=>({preference:X,effective:ee,reason:et}),eM=()=>{let e=eS();for(let t of er)t(e)},eP=(e,t)=>{(ee!==e||et!==t)&&(ee=e,et=t,eM())},eR=e=>{if(!G){if(!V){V=!0;try{t.onError?.(e)}catch{}}eU()}},eE=e=>{if(!G)try{t.onError?.(e)}catch{}},eL=()=>{em=0;let e=_,t=F,r=ep;if(_=void 0,F=void 0,ep=!1,!G&&e&&S&&P&&M)try{S.resize([Math.max(1,Math.round(e.width*e.dpr)),Math.max(1,Math.round(e.height*e.dpr))]),P.resize(S.size),r&&(0,h.setRuntimeFramingViewport)(M,t),R?.invalidate(),eh=!0}catch(e){eR(e)}},eC=e=>{G||e.width<=0||e.height<=0||(C?.resetHealth(),_=e,em||(em=requestAnimationFrame(eL)))},eI=()=>P?.quality??J,eT=(e,r=!1)=>{let a=t.canvas.getBoundingClientRect();t.framingElement&&(F=(0,p.viewportWithinCanvas)(a,t.framingElement.getBoundingClientRect()),ep=!0),eC({width:a.width,height:a.height,dpr:"low"===e?1:B??Math.min(2,Math.max(1,window.devicePixelRatio||1))}),r&&em&&(cancelAnimationFrame(em),eL())},eA=()=>eT(J),e_=()=>{en+=1,C?.dispose(),C=void 0,ei=!1,es&&cancelAnimationFrame(es),void 0!==L&&clearTimeout(L),es=0,L=void 0};async function eF(r){try{let a=await (t.loadAutoQuality?.()??e.A(952574));if(G||r!==en||"auto"!==X||"high"!==ee)return;ei=!1,C=a.createPrismAutoQualityController({logger:W,onDowngrade(e){G||r!==en||"auto"!==X||"high"!==ee||eO("low",e,r).catch(()=>{})}})}catch{r===en&&(ei=!1)}}async function eO(e,t,r=en){if(G||r!==en)return;let a=++ea,n=J,s=Z;if(J=e,Z=t,!P&&(await e$,G||a!==ea||r!==en))return;let i=P;if(i){if(i.quality===e&&i.requestedQuality===e){eP(e,t),eh=!0,C?.resetHealth();return}"low"===e&&eT("low",!0);try{if(await i.setQuality(e),G||a!==ea||r!==en)return;"high"===e&&eT("high",!0),eP(e,t),eh=!0,ef=-1,R?.invalidate(),"low"===e&&(C?.dispose(),C=void 0,"forced"!==t&&W.info("[Prism quality] Downgraded to Low.",{preference:X,reason:t,from:"high",to:"low",dpr:1}))}catch(t){if(G||a!==ea||r!==en)return;throw J=n,Z=s,i.setQuality(ee),"low"===e&&eT(ee,!0),eE(t),t}}}let ez=e=>{var r;let a,n=P?.pipeline;if(G||!M||!n||!S)return;let s=E?.beginFrame(n.mode);!s&&ew?.matches&&ek.setNormalizedPointer([.5+.34*Math.cos(a=(Number.isFinite(r=N?.time??0)?r:0)/18*Math.PI*2),.5+.34*Math.sin(a)]);let i=s?s.aim:ek.stepAim(),l=s?s.orbit:ek.stepOrbit(),o=function(){if(t.performanceSampling||ej)return{opacity:1,beamWidth:1};let e=N?.time??0;return z??=e,(0,v.heroRevealProgress)(e-z)}(),d=o.opacity,c=o.beamWidth,u=d!==ev,m=c!==ey,p=s?s.updateScene:!!i||!!l||eh||m,x=s?.dustTime??(N?Math.floor(30*N.time)/30:0),f="dark"===n.mode&&"glass"===K.view,g=f&&x!==ef,b=!!s||p||g||u,y=!s&&(b||f)&&"auto"===X&&"high"===eI()&&ec&&eu,w=e=>{C?.recordFrame({deltaMs:(N?.deltaTime??0)*1e3,active:y,rendered:e,mobile:ew?.matches===!0,workload:!f||p||u?"interactive":"dust"})};if(!s&&!function(){if(t.performanceSampling)return!0;
1if(!eb)return eb=!0,!0;let e=N?.deltaTime??0;if(!Number.isFinite(e)||e<=0)return!0;let r="low"===eI()?60:90,a=1/(ew?.matches?30:r);return!((eg=Math.min(eg+e,2*a))+1e-9<a)&&(eg=Math.max(0,eg-a),!0)}()||!s&&!p&&!g&&!ex&&!u)return void w(!1);if(s||p||g||u)try{i&&(0,h.setRuntimeLampAim)(M,i[0],i[1]),l&&(0,h.setRuntimeOrbit)(M,l[0],l[1]),(i||l)&&R?.invalidate(),n.bind(x,{updateScene:p,revealProgress:d,beamWidthReveal:c}),n.render(e,S,s?{updateScene:p,profile:s.profile}:{updateScene:p}),eh=!1,ef=x,ev=d,ey=c,s?E?.endFrame(s):(w(!0),(()=>{if(G||t.performanceSampling||"auto"!==X||"high"!==ee||C||ei)return;ei=!0;let e=en;es=requestAnimationFrame(()=>{es=0,L=setTimeout(()=>{L=void 0,eF(e)},0)})})())}catch(e){E?.fail(e),eR(e);return}else w(!1);ex=!1;try{R?.render(e,N?.time??0)}catch(e){eE(e)}};function eD(){if(!ed||!g)return;let e=!G&&(!eo||ec&&eu);if(!!I!==e){if(!e){I?.stop(),I=void 0,C?.resetHealth();return}eA(),eh=!0,ef=-1,eg=0,eb=!1,I=(0,i.frameLoop)(g,ez)}}let eq=()=>{el&&!G&&((ec=!document.hidden)||ek.onPointerLeave(),C?.resetHealth(),eo&&eD())};function eU(){if(G)return;G=!0,ed=!1,e_(),er.clear(),I?.stop(),I=void 0,em&&cancelAnimationFrame(em),em=0,_=void 0,F=void 0,ep=!1,T?.disconnect(),T=void 0,A?.disconnect(),A=void 0,window.removeEventListener("pointermove",eN),window.removeEventListener("blur",ek.onPointerLeave),window.removeEventListener("resize",eA),el&&"u">typeof document&&document.removeEventListener("visibilitychange",eq),Q?.setDelegate(m.NOOP_PRISM_DEBUG_PREVIEW_BRIDGE),R?.dispose(),R=void 0,Q?.dispose(),E?.dispose(),E=void 0;let e=P,t=M,r=S,a=g;P=void 0,M=void 0,S=void 0,g=void 0,N=void 0;let n=()=>{t&&(0,k.destroyPrismRuntime)(t),r?.dispose(),a?.dispose()},s=e?.destroy();s?s.then(n,n):n()}let e$=(async()=>{let r,a,n,i,m=await Promise.resolve().then(()=>navigator.gpu?.requestAdapter()).catch(()=>void 0);if(G)return;let p=[];m&&(p=(0,u.prismOptionalFeatures)(m.features,!0===t.performanceSampling),n={async requestDevice(e={}){(0,c.validateRequiredFeatures)(m.features,e.requiredFeatures);let t=await m.requestDevice({label:e.label,requiredFeatures:e.requiredFeatures,requiredLimits:e.requiredLimits});return new d.Device(t,m.info??null)}});let v=n?{adapter:n}:void 0;try{i=await (0,l.init)(p.length>0?{...v,requiredFeatures:p}:v)}catch(e){if(0===p.length)throw e;i=await (0,l.init)(v)}if(G)return void i.dispose();if(g=i,S=(0,o.surface)(g,t.canvas,{autoResize:!1,dpr:"low"===J?1:B??[1,2]}),M=(0,k.createPrismRuntime)(g,S.size,"prism-rainbow",{debugEnvironment:t.debugPreviews,lightMeshLayout:(0,b.lightMeshLayoutForQuality)(J)}),(0,h.setRuntimeControls)(M,K),t.performanceSampling)try{let{createPrismPerformanceSampler:t}=await e.A(118411);if(G||!g||!M)return;E=t({gpu:g,runtime:M})}catch(e){eE(e)}if(P=function({runtime:e,output:t,initialMode:r,initialQuality:a="high",createPipeline:n=(e,t,r)=>"light"===e?x().then(({createLightPipeline:e})=>e(r,{quality:t})):f().then(({createDarkPipeline:e})=>e(r,{quality:t})),onActivate:s}){let i,l,o,d,c,u=r,m=a,p=!1,g=async()=>{for(;!p&&(i?.mode!==u||l!==m);){let r,a=u,d=m;try{r=await n(a,d,e)}catch(e){if(p)return;if(a!==u||d!==m)continue;throw e}if(p||a!==u||d!==m){r.destroy();continue}o=r;try{await r.prepare(t)}catch(e){if(r.destroy(),o===r&&(o=void 0),p)return;if(a!==u||d!==m)continue;throw e}if(o===r&&(o=void 0),p||a!==u||d!==m){r.destroy();continue}r.lightMeshLayout&&(0,h.setRuntimeLightMeshLayout)(e,r.lightMeshLayout),r.resize(e.outputSize);let c=i;i=r,l=d,c?.destroy(),s?.(a,d)}},b=()=>{if(d)return d;let e=g();return d=e,e.then(()=>{d===e&&(d=void 0)},()=>{d===e&&(d=void 0)}),e};return{ready:b(),get pipeline(){return i},get quality(){return l},get requestedMode(){return u},get requestedQuality(){return m},setMode:e=>p?Promise.resolve():(u=e,i?.mode!==e||l!==m||o?b():Promise.resolve()),setQuality:e=>p?Promise.resolve():(m=e,i?.mode!==u||l!==e||o?b():Promise.resolve()),resize(t){p||((0,h.resizeRuntime)(e,t),i?.resize(t),o?.resize(t))},debugSources:()=>i?.debugSources?.()??[],destroy:()=>c||(p?void 0:(p=!0,i?.destroy(),i=void 0,l=void 0,d)?c=d.then(()=>void 0,()=>void 0):void 0)}}({runtime:M,output:S,initialMode:Y,initialQuality:J,onActivate:(e,t)=>
1{let r=void 0!==O&&O!==t;O=t,eh=!0,ef=-1,eg=0,eb=!1,eP(t,t===J?Z:et),C?.resetHealth(),r&&eT(t),R?.invalidate()}}),t.debugPreviews)try{let{createPrismDebugPreviewHost:t}=await e.A(552402);if(G||!g||!M||!P)return;R=t({gpu:g,runtime:M,getPipeline:()=>P?.pipeline,invalidate:()=>{ex=!0},onError:eE}),Q?.setDelegate(R.bridge)}catch(e){eE(e)}window.addEventListener("pointermove",eN,{passive:!0}),window.addEventListener("blur",ek.onPointerLeave),T="u"<typeof ResizeObserver?void 0:new ResizeObserver(eA),T?.observe(t.canvas),t.framingElement&&T?.observe(t.framingElement),window.addEventListener("resize",eA),eA(),await P.ready,G||(N=(0,s.clock)(g),el&&(ec="u"<typeof document||!document.hidden,r=t.canvas.getBoundingClientRect(),eu=!(Number.isFinite(a=window.innerHeight)&&Number.isFinite(r.top)&&Number.isFinite(r.bottom))||r.bottom>=-256&&r.top<=a+256,"u">typeof document&&document.addEventListener("visibilitychange",eq),"u">typeof IntersectionObserver&&(A=new IntersectionObserver(e=>{let t=e[e.length-1];t&&!G&&(eu=t.isIntersecting,C?.resetHealth(),eo&&eD())},{rootMargin:"256px 0px",threshold:0})).observe(t.canvas)),ed=!0,eD())})().catch(e=>{if(!G)throw eR(e),e});return{ready:e$,debugBridge:Q?.bridge??m.NOOP_PRISM_DEBUG_PREVIEW_BRIDGE,debugSources:()=>P?.debugSources()??[],getQualityState:()=>eS(),subscribeQuality:e=>G?()=>{}:(er.add(e),()=>er.delete(e)),async setMode(e){if(!G){if(Y=e,C?.resetHealth(),!P)return void await e$;try{if(await P.setMode(e),G)return;eh=!0,ef=-1,C?.resetHealth(),R?.invalidate()}catch(e){if(G)return;throw eE(e),e}}},async setQualityPreference(e){if(G)return;e_();let t=en;X=e;let r="low"===e?"low":"high",a="auto"===e?"initial":"forced";ee===r&&(et=a),eM(),await eO(r,a,t)},async measurePerformance(e={}){if(G)throw Error("Cannot sample a disposed prism renderer.");await e$;let t=E,r=P,a=S;if(!t||!r?.pipeline||!a)throw Error("Prism performance sampling is disabled. Reload with ?prism-perf.");let n=r.pipeline.mode,s=e.mode??n;s!==n&&(Y=s,await r.setMode(s));try{return await t.start({...e,mode:s,resolution:a.size,invalidate:()=>{eh=!0}})}finally{!G&&s!==n&&P&&(Y=n,await P.setMode(n),eh=!0,ef=-1)}},setControls(e){G||(K={...e},eh=!0,M&&(0,h.setRuntimeControls)(M,K),R?.invalidate())},invalidate(){eh=!0,R?.invalidate()},resize:eC,dispose:eU}}({canvas:n,framingElement:z??void 0,initialMode:A,initialQuality:I.current,initialControls:q,debugPreviews:S,performanceSampling:R,onError:V});r.current=$,G($.getQualityState());let B=$.subscribeQuality(e=>{r.current===$&&(G(e),S&&O($.debugSources()))});R&&e.A(251920).then(({installPrismPerformanceBrowserApi:e})=>{r.current===$&&(a=e($))},V);let Q=new MutationObserver(()=>{"auto"===C.current&&Y(P())});return Q.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),$.ready.then(()=>{S&&r.current===$&&O($.debugSources())},()=>{}),()=>{a?.(),B(),Q.disconnect(),L.current&&cancelAnimationFrame(L.current),L.current=0,r.current=null,$.dispose()}},[Y,V]),(0,a.jsxs)("div",{"data-prism-background":!0,className:"absolute inset-0 overflow-hidden",children:[(0,a.jsx)("canvas",{ref:t,"aria-hidden":"true",className:"block h-full w-full touch-none"}),A?(0,a.jsx)(n.Suspense,{fallback:null,children:(0,a.jsx)(S,{baselineControls:q,bridge:r.current?.debugBridge,controls:z,mode:$,onControlsChange:K,onQualityChange:J,onThemeChange:X,quality:W,sources:F,theme:B})}):null]})}e.s(["PrismBackground",0,function({enabled:e}){return e?(0,a.jsx)(E,{}):null},"resolvePrismMode",0,R],97262)},138486,e=>{"use strict";var t=e.i(322427),r=e.i(888939);let a=["index.ts","main.wgsl","color.wgsl"],n=`struct U{r:vec2f}@group(0)@binding(0)var<uniform>u:U;
2@fragment fn fs_main(@location(0)b:vec2f)->@location(0)vec4f{
3let c=(b-0.5)*(u.r/min(u.r.x,u.r.y));let d=length(c);let e=atan2(c.y,c.x)/6.28318+0.5;
4let f=exp(-95.0*pow(abs(d-0.31),2.0));let h=exp(-18.0*pow(abs(d-0.31),2.0));
5let i=0.82+0.18*sin(e*25.13272+d*42.0);let g=a(e+d*0.65);
6return vec4f(g*(f*i*2.0+h*0.22),1.0)}fn a(b:f32)->vec3f{let c=vec3f(0.0,0.33,0.67);
7return 0.55+0.45*cos(6.28318*(b+c))}`;function s({children:e,highlight:r=!1,number:a}){return(0,t.jsxs)("span",{className:`relative block min-w-max pr-5 ${r?"-mx-3 bg-[rgba(0,202,82,0.08)] px-3 before:absolute before:inset-y-0 before:left-0 before:w-px before:bg-[#00a844] dark:bg-[rgba(0,202,82,0.12)] dark:before:bg-[#00ca52] sm:-mx-5 sm:px-5":""}`,children:[(0,t.jsx)("span",{className:"mr-4 inline-block w-5 select-none text-right text-gray-700",children:a}),e??" "]})}function i(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s,{number:1,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"import"})," { effect, frame, init, surface } ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"from"})," ",(0,t.jsx)("span",{className:"text-green-800 dark:text-[#00ca52]",children:'"vgpu"'}),";"]}),(0,t.jsxs)(s,{highlight:!0,number:2,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"import"})," shaderSource ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"from"})," ",(0,t.jsx)("span",{className:"text-green-800 dark:text-[#00ca52]",children:'"./main.wgsl"'}),";"]}),(0,t.jsx)(s,{number:3}),(0,t.jsxs)(s,{number:4,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"export async function"})," ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"render"}),"(canvas: HTMLCanvasElement) {"]}),(0,t.jsxs)(s,{number:5,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"const"})," gpu = ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"await"})," ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"init"}),"();"]}),(0,t.jsxs)(s,{number:6,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"const"})," output = ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"surface"}),"(gpu, canvas, { dpr: 1 });"]}),(0,t.jsxs)(s,{number:7,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"const"})," shader = ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"effect"}),"(gpu, shaderSource);"]}),(0,t.jsx)(s,{number:8}),(0,t.jsxs)(s,{number:9,children:["  ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"shader.set"}),"({ uniforms: { resolution: output.size } });"]}),(0,t.jsxs)(s,{number:10,children:["  ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"frame"}),"(gpu, (f) => f.pass(output, shader));"]}),(0,t.jsxs)(s,{number:11,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"return"})," () => gpu.",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"dispose"}),"();"]}),(0,t.jsx)(s,{number:12,children:"}"})]})}function l(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s,{highlight:!0,number:1,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"import"})," { palette } ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"from"})," ",(0,t.jsx)("span",{className:"text-green-800 dark:text-[#00ca52]",children:'"./color.wgsl"'}),";"]}),(0,t.jsx)(s,{number:2}),(0,t.jsxs)(s,{number:3,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"struct"})," Uniforms {"]}),(0,t.jsx)(s,{number:4,children:"  resolution: vec2f,"}),(0,t.jsx)(s,{number:5,children:"};"}),(0,t.jsx)(s,{number:6}),(0,t.jsxs)(s,{number:7,children:[(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"@group(0) @binding(0)"})," var<uniform> uniforms: Uniforms;"]}),(0,t.jsx)(s,{number:8}),(0,t.jsx)(s,{number:9,children:(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"@fragment"})}),(0,t.jsxs)(s,{number:10,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"fn"})," ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"fs_main"}),"(@location(0) uv: vec2f) -> @location(0) vec4f {"]}),(0,t.jsxs)(s,{number:11,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," shortest = min(uniforms.resolution.x, uniforms.resolution.y);"]}),(0,t.jsxs)(s,{number:12,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," aspect = uniforms.resolution / shortest;"]}),(0,t.jsxs)(s,{number:13,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," p = (uv - 0.5) * aspect;"]}),(0,t.jsxs)(s,{number:14,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," radius = ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"length"}),"(p);"]}),(0,t.jsxs)(s,{number:15,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," angle = atan2(p.y, p.x) / 6.28318 + 0.5;"]}),(0,t.jsxs)(s,{number:16,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," ring = ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"exp"}),"(-95.0 * pow(abs(radius - 0.31), 2.0));"]}),(0,t.jsxs)(s,{number:17,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," halo = ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"exp"}),"(-18.0 * pow(abs(radius - 0.31), 2.0));"]}),(0,t.jsxs)(s,{number:18,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"}
7)," bands = 0.82 + 0.18 * sin(angle * 25.13272 + radius * 42.0);"]}),(0,t.jsxs)(s,{number:19,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," color = ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"palette"}),"(angle + radius * 0.65);"]}),(0,t.jsxs)(s,{number:20,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"return"})," vec4f(color * (ring * bands * 2.0 + halo * 0.22), 1.0);"]}),(0,t.jsx)(s,{number:21,children:"}"})]})}function o(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s,{number:1,children:[(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"export fn"})," ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"palette"}),"(t: f32) -> vec3f {"]}),(0,t.jsxs)(s,{number:2,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"let"})," phase = vec3f(0.0, 0.33, 0.67);"]}),(0,t.jsxs)(s,{number:3,children:["  ",(0,t.jsx)("span",{className:"text-red-800 dark:text-[#ff518d]",children:"return"})," 0.55 + 0.45 * ",(0,t.jsx)("span",{className:"text-purple-800 dark:text-[#c472fb]",children:"cos"}),"(6.28318 * (t + phase));"]}),(0,t.jsx)(s,{number:4,children:"}"})]})}function d(){let[e,n]=(0,r.useState)("index.ts"),s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{s.current&&(s.current.scrollTop=0)},[e]),(0,t.jsxs)("section",{className:"flex min-h-[28rem] min-w-0 flex-col bg-background-100 lg:min-h-[34rem]",children:[(0,t.jsx)("div",{"aria-label":"TypeScript and shader source files",className:"flex h-12 shrink-0 items-stretch border-b border-gray-alpha-400 bg-background-200",role:"tablist",children:a.map((r,s)=>{let i=r===e;return(0,t.jsx)("button",{"aria-controls":"shader-source-panel","aria-selected":i,className:`interactive-tab relative shrink-0 border-r border-gray-alpha-400 px-3 font-mono text-xs transition-colors focus-visible:outline focus-visible:outline-1 focus-visible:outline-gray-1000 focus-visible:outline-offset-[-2px] sm:px-4 ${i?"text-gray-1000 after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-gray-1000":"text-gray-800 hover:text-gray-1000"}`,id:`shader-source-tab-${r}`,onClick:()=>n(r),onKeyDown:e=>(function(e,t){let r=t;if("ArrowRight"===e.key)r=(t+1)%a.length;else if("ArrowLeft"===e.key)r=(t-1+a.length)%a.length;else if("Home"===e.key)r=0;else{if("End"!==e.key)return;r=a.length-1}e.preventDefault();let s=a[r];n(s),document.getElementById(`shader-source-tab-${s}`)?.focus()})(e,s),role:"tab",tabIndex:i?0:-1,type:"button",children:r},r)})}),(0,t.jsxs)("pre",{"aria-labelledby":`shader-source-tab-${e}`,className:"min-h-0 flex-1 overflow-auto px-3 py-5 font-mono text-[12px] leading-[1.65] text-gray-1000 sm:px-5 sm:text-[13px]",id:"shader-source-panel",ref:s,role:"tabpanel",children:["index.ts"===e?(0,t.jsx)(i,{}):null,"main.wgsl"===e?(0,t.jsx)(l,{}):null,"color.wgsl"===e?(0,t.jsx)(o,{}):null]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-gray-alpha-400 px-4 py-3 font-mono text-[10px] uppercase tracking-[0.12em] text-gray-800",children:[(0,t.jsx)("span",{children:"resolve imports"}),(0,t.jsx)("span",{"aria-hidden":"true",children:"→"}),(0,t.jsx)("span",{children:"remove unused"}),(0,t.jsx)("span",{"aria-hidden":"true",children:"→"}),(0,t.jsx)("span",{children:"minify"})]})]})}function c(){return(0,t.jsxs)("div",{"aria-hidden":"true",className:"absolute inset-0 overflow-hidden bg-black",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_50%_50%,#2b1740_0%,#11121d_40%,#000_72%)]"}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full opacity-90 blur-[0.3px]",style:{background:"conic-gradient(from 20deg, #ff518d, #ffb347, #00ca52, #29b6f6, #8b5cf6, #ff518d)",height:"min(68cqw, 68cqh)",maskImage:"radial-gradient(circle, transparent 0 49%, black 55% 64%, transparent 70%)",WebkitMaskImage:"radial-gradient(circle, transparent 0 49%, black 55% 64%, transparent 70%)",width:"min(68cqw, 68cqh)"}})]})}function u({rootRef:a}){let s=(0,r.useRef)(null),[i,l]=(0,r.useState)(!1),[o,d]=(0,r.useState)(!0),[m,p]=(0,r.useState)("poster"),h=i&&o;return(0,r.useEffect)(()=>{let e=a.current;if(!e||"u"<typeof IntersectionObserver)return void l(!0);let t=new IntersectionObserver(([e])=>l(e.isIntersecting),{rootMargin:"320px 0px"});return t.observe(e),()=>t.disconnect()},[a]),(0,r.useEffect)(()=>{function e(){d("hidden"!==document.visibilityState)}return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,r.useEffect)(()=>{let t,r=s.current;if(!r||!h)return;let a=!1;return p("loading"),e.A(866545).then(({renderShaderPreview:e})=>e(r)).then(e=>{a?e():(t=e,p("running"))}).catch(()=>{a||p("unavailable")}),()=>{a=!0,t?.()}},[h]),(0,t.jsxs)("section",{className:"relative flex min-w-0 flex-col border-t border-gray-alpha-400 bg-background-100 lg:border-l lg:border-t-0",children:[(0,t.jsxs)("span",{"aria-hidden":"true",className:"absolute left-1/2 top-0 z-20 grid size-7 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full border border-gray-alpha-500 bg-background-100 font-mono text-xs text-gray-900 lg:left-0 lg:top-1/2",children:[(0,t.jsx)("span",{className:"lg:hidden",children:"↓"}),(0,t.jsx)("span",{className:"hidden lg:inline",children:"→"})]}),(0,t.jsx)("div",{className:"flex h-12 shrink-0 items-center border-b border-gray-alpha-400 px-4",children:(0,t.jsx)("span",{className:"font-mono text-xs text-gray-1000",children:"result"})}),(0,t.jsxs)("div",{"aria-label":"Rainbow ring rendered from the compiled shader modules",className:"relative aspect-[16/10] min-h-[17rem] overflow-hidden bg-black [container-type:size]",role:"img",children:[(0,t.jsx)(c,{}),(0,t.jsx)("canvas",{"aria-hidden":"true",className:`absolute inset-0 size-full transition-opacity duration-500 ${"running"===m?"opacity-100":"opacity-0"}`,ref:s})]}),(0,t.jsxs)("div",{className:"flex h-12 items-center justify-between border-y border-gray-alpha-400 px-4",children:[(0,t.jsx)("span",{className:"font-mono text-xs text-gray-1000",children:"compiled.wgsl"}),(0,t.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.12em] text-gray-800",children:"397 B"})]}),(0,t.jsx)("pre",{className:"min-h-36 flex-1 overflow-auto whitespace-pre-wrap break-all px-4 py-4 font-mono text-[10px] leading-5 text-gray-900 sm:text-[11px]",children:(0,t.jsx)("code",{children:n})})]})}e.s(["ShaderCodeScalesDemo",0,function(){let e=(0,r.useRef)(null);return(0,t.jsxs)("div",{className:"relative grid overflow-hidden rounded-card border border-gray-alpha-400 bg-background-100 shadow-[0_32px_100px_rgba(0,0,0,0.12)] lg:grid-cols-[1.15fr_0.85fr]",ref:e,children:[(0,t.jsx)(d,{}),(0,t.jsx)(u,{rootRef:e})]})}])},46773,e=>{"use strict";var t=e.i(322427),r=e.i(888939);let a=(0,r.createContext)(null);e.s(["HeroTabProvider",0,function({children:e}){let[n,s]=(0,r.useState)("Prompt"),i=(0,r.useMemo)(()=>({activeTab:n,setActiveTab:s}),[n]);return(0,t.jsx)(a.Provider,{value:i,children:e})},"useHeroTab",0,function(){let e=(0,r.useContext)(a);if(!e)throw Error("useHeroTab must be used inside HeroTabProvider.");return e}])},224370,e=>{"use strict";var t=e.i(736682),r=e.i(848186),a=e.i(888939),n=e.i(322427),s=(0,a.forwardRef)(({href:e,...s},i)=>{let l=(0,r.useParams)(),o=(0,a.useMemo)(()=>e?.replace(/\[.*]/,e=>{let t=e.slice(1,-1),r=t in l?l[t]:void 0;return r?"string"==typeof r?r:r.join("/"):""}),[l,e]);return(0,n.jsx)(t.Link,{ref:i,href:o,...s})});s.displayName="DynamicLink",e.s(["DynamicLink",0,s,"default",0,s])}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.