Spaces:
Running
Running
Upload 15 files
Browse filesFiles changed (16)
- .gitattributes+1
- Qwen4MoeForConditionalGeneration.jsAdded
- _shared/chat-page.cssAdded+1
- app.jsAdded+764
- assets/blue-noise.binAdded+3
- assets/flare-wordmark.svgAdded
- assets/geist.woff2Added
- assets/qwen.svgAdded
- assets/wordmark.pngAdded
- chat.cssAdded+1
- index.html+169-17
- licenses/geist.txtAdded+93
- licenses/lobehub.txtAdded+21
- licenses/vgpu.txtAdded+21
- model-panel.cssAdded+1
- style.cssAdded+1
32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textassets/wordmark.png filter=lfs diff=lfs merge=lfs -text1*{box-sizing:border-box;margin:0;padding:0}button,textarea,input{font:inherit;color:inherit}button{appearance:none;background:none;border:0;cursor:pointer}a{color:inherit;text-decoration:none}::selection{background:#ffffff2e}.chat-head-inner{margin:0 auto;max-width:var(--maxw);padding:16px 28px;display:flex;align-items:center;gap:16px}.to-top:hover{opacity:.7}.status{flex:1;min-width:0;display:flex;align-items:center;gap:9px;color:var(--t2);font-size:13px}.status-dot{width:7px;height:7px;border-radius:50%;background:var(--t4);flex-shrink:0;transition:background .3s ease,box-shadow .3s ease}.status.loading .status-dot{background:var(--warn);box-shadow:0 0 10px #ffcd6b80}.status.error .status-dot{background:var(--danger);box-shadow:0 0 10px #ff7a6b80}.status-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}.chat-head-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.head-btn{display:inline-flex;align-items:center;gap:7px;padding:8px 15px;font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--t2);border:1px solid var(--line);border-radius:100px;transition:border-color .2s ease,color .2s ease,opacity .2s ease}.head-btn:hover:not(:disabled){border-color:#ffffff59;color:var(--t1)}.head-btn:disabled{opacity:.35;cursor:not-allowed}.head-btn[hidden]{display:none}.thread{margin:0 auto;max-width:var(--maxw);min-height:100%;padding:40px 28px 24px;display:flex;flex-direction:column;gap:32px}.welcome{margin:auto 0;text-align:center;padding:4vh 0;animation:rise .7s cubic-bezier(.2,.7,.2,1) both}.welcome h2 .thin{color:var(--t3)}.seeds{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}.seed{padding:9px 16px;font-size:13.5px;color:var(--t2);background:var(--panel);border:1px solid var(--line);border-radius:100px;transition:border-color .2s ease,color .2s ease,background .2s ease,transform .15s ease,opacity .2s ease}.seed:hover:not(:disabled){border-color:#ffffff4d;color:var(--t1);background:var(--panel-hover);transform:translateY(-1px)}.seed:disabled{opacity:.4;cursor:not-allowed}.msg{display:flex;flex-direction:column;animation:rise .4s cubic-bezier(.2,.7,.2,1) both}.role{display:flex;align-items:center;gap:8px;font-family:var(--mono);font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;margin-bottom:10px}.role:before{content:"";width:5px;height:5px;border-radius:50%}.msg.user{align-items:flex-end}.msg.user .role{color:var(--t3)}.msg.user .role:before{background:var(--t3)}.msg.assistant .role{color:var(--ok)}.msg.assistant .role:before{background:var(--ok)}.bubble{overflow-wrap:anywhere}.bubble.user{background:var(--user-bubble);border:1px solid var(--line);border-radius:16px 16px 4px;padding:12px 17px;line-height:1.55;max-width:min(82%,600px);white-space:pre-wrap;color:var(--t1)}.bubble.assistant{font-size:16px;line-height:1.72;color:var(--t1);max-width:100%}.bubble.assistant>:first-child{margin-top:0}.bubble.assistant>:last-child{margin-bottom:0}.bubble.assistant p{margin:0 0 .9em}.bubble.assistant em{font-style:italic}.bubble.assistant a{color:#8ab4ff;text-decoration:underline;text-underline-offset:2px}.bubble.assistant a:hover{color:#aecbff}.bubble.assistant h1,.bubble.assistant h2,.bubble.assistant h3,.bubble.assistant h4,.bubble.assistant h5,.bubble.assistant h6{color:#fff;font-weight:600;line-height:1.25;margin:1.3em 0 .6em}.bubble.assistant h1{font-size:1.5em}.bubble.assistant h2{font-size:1.3em}.bubble.assistant h3{font-size:1.13em}.bubble.assistant h4,.bubble.assistant h5,.bubble.assistant h6{font-size:1em}.bubble.assistant ul,.bubble.assistant ol{margin:0 0 .9em;padding-left:1.5em}.bubble.assistant li{margin:.25em 0}.bubble.assistant li::marker{color:var(--t3)}.bubble.assistant blockquote{margin:0 0 .9em;padding:2px 0 2px 16px;border-left:2px solid var(--line);color:var(--t2)}.bubble.assistant hr{border:0;border-top:1px solid var(--line);margin:1.3em 0}.bubble.assistant code{font-family:var(--mono);font-size:.85em;background:var(--panel);border:1px solid var(--line);border-radius:5px;padding:1px 5px}.bubble.assistant pre{margin:0 0 .9em;padding:14px 16px;background:#0a0a0c;border:1px solid var(--line);border-radius:12px;overflow-x:auto;overflow-y:hidden}.bubble.assistant pre code{background:none;border:0;padding:0;font-size:.82em;line-height:1.6}.bubble.assistant table{border-collapse:collapse;margin:0 0 .9em;font-size:.92em;display:block;overflow-x:auto;overflow-y:hidden}.bubble.assistant th,.bubble.assistant td{border:1px solid var(--line);padding:6px 11px;text-align:left}.bubble.assistant th{background:var(--panel);color:var(--t1);font-weight:600}.bubble.assistant pre::-webkit-scrollbar,.bubble.assistant table::-webkit-scrollbar{height:8px}.bubble.assistant pre::-webkit-scrollbar-thumb,.bubble.assistant table::-webkit-scrollbar-thumb{background:var(--line);border-radius:8px}.meta{font-family:var(--mono);font-size:10.5px;letter-spacing:.04em;color:var(--t3);margin-top:12px}.thinking{display:inline-flex;gap:5px;padding:4px 0}.thinking span{width:7px;height:7px;border-radius:50%;background:var(--ok);opacity:.5;animation:bob 1.3s ease-in-out infinite}.thinking span:nth-child(2){animation-delay:.18s}.thinking span:nth-child(3){animation-delay:.36s}.caret{display:inline-block;width:2px;height:1.05em;margin-left:2px;vertical-align:-.16em;background:var(--ok);animation:blink 1s steps(2) infinite}.composer{margin:0 auto;max-width:var(--maxw);padding:0 28px 22px}.field{display:grid;grid-template-columns:1fr 44px;align-items:flex-end;gap:8px;background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:8px 8px 8px 18px;transition:border-color .2s ease,background .2s ease}.field:focus-within{border-color:#ffffff47;background:#ffffff0d}textarea{background:transparent;border:0;outline:none;resize:none;width:100%;min-height:42px;max-height:180px;padding:8px 0;color:var(--t1)}textarea::placeholder{color:var(--t3)}.icon-button{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;transition:background .2s ease,opacity .2s ease,transform .1s ease}.icon-button svg{width:19px;height:19px}.icon-button:active:not(:disabled){transform:scale(.94)}.icon-button:disabled{opacity:.3;cursor:not-allowed}.send-button{background:#fff;color:#000}.send-button:hover:not(:disabled){opacity:.86}.stop-button{background:#ff7a6b24;color:var(--danger);border:1px solid rgba(255,122,107,.3);display:none}.stop-button:hover:not(:disabled){background:#ff7a6b38}.composer-meta{display:flex;align-items:center;justify-content:center;gap:12px;margin:10px 4px 0;min-height:22px;font-family:var(--mono);font-size:10.5px;letter-spacing:.04em;text-transform:uppercase;color:var(--t3)}.thread-scroll::-webkit-scrollbar{width:10px}.thread-scroll::-webkit-scrollbar-thumb{background:var(--line);border:3px solid var(--bg);border-radius:10px}textarea:focus,textarea:focus-visible{outline:none}.kx{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;padding:28px}.kx[hidden]{display:none}.kx-backdrop{position:absolute;inset:0;background:#0000009e;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);animation:kxFade .25s ease}.kx-panel{position:relative;display:flex;flex-direction:column;width:min(1080px,100%);height:min(86vh,920px);background:#0a0a0c;border:1px solid var(--line);border-radius:18px;overflow:hidden;box-shadow:0 40px 120px -30px #000000e6;animation:kxRise .3s cubic-bezier(.2,.7,.2,1)}.kx-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 22px;border-bottom:1px solid var(--line-soft)}.kx-sub{display:block;margin-top:7px;font-size:12.5px;color:var(--t3)}.kx-close{display:grid;place-items:center;width:34px;height:34px;flex-shrink:0;border-radius:9px;color:var(--t2);border:1px solid var(--line);transition:color .2s ease,border-color .2s ease,background .2s ease}.kx-close:hover{color:var(--t1);border-color:#ffffff59;background:var(--panel)}.kx-close svg{width:15px;height:15px}.kx-body{flex:1;display:grid;grid-template-columns:236px 1fr;min-height:0}.kx-side{position:relative;min-width:0;min-height:0;border-right:1px solid var(--line-soft)}.kx-list{height:100%;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:2px}.kx-side:after{content:"";position:absolute;left:0;right:1px;bottom:0;height:54px;background:linear-gradient(transparent,#0a0a0c 88%);pointer-events:none;opacity:1;transition:opacity .25s ease}.kx-side.at-end:after{opacity:0}.kx-item{flex-shrink:0;text-align:left;padding:9px 12px;border-radius:8px;font-family:var(--mono);font-size:12px;line-height:1.5;color:var(--t2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background .15s ease,color .15s ease}.kx-item:hover{background:var(--panel);color:var(--t1)}.kx-item.active{background:var(--panel-hover);color:#fff}.kx-view{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}.kx-view-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;border-bottom:1px solid var(--line-soft)}.kx-name{font-family:var(--mono);font-size:13px;color:var(--t1);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kx-view-actions{display:flex;align-items:center;gap:14px;flex-shrink:0}.kx-lines{font-family:var(--mono);font-size:11px;color:var(--t4)}.kx-copy{font-family:var(--mono);font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--t2);border:1px solid var(--line);border-radius:100px;padding:5px 13px;transition:color .2s ease,border-color .2s ease}.kx-copy:hover{color:var(--t1);border-color:#ffffff59}.kx-code{flex:1;min-height:0;min-width:0;overflow:auto;margin:0;padding:18px 20px;font-family:var(--mono);font-size:12.5px;line-height:1.65;color:var(--t2);tab-size:2}.kx-code code{white-space:pre}.k-cm{color:#5d6b6f;font-style:italic}.k-kw{color:#c792ea}.k-ty{color:#6fb3ff}.k-at{color:#ffb074}.k-nu{color:#7ee787}.kx-source{flex:1;min-height:0;display:flex;flex-direction:column}.kx-source[hidden]{display:none}.kx-intro{flex:1;min-height:0;overflow-y:auto;display:flex;align-items:center;justify-content:center;padding:34px 30px}.kx-intro[hidden]{display:none}.kx-intro-inner{max-width:540px;text-align:center;animation:kxIntroRise .6s cubic-bezier(.2,.7,.2,1) both}.kx-spark{position:relative;width:60px;height:60px;margin:0 auto 24px}.kx-spark-ring{position:absolute;inset:0;border-radius:50%;background:conic-gradient(from 0deg,#ff7a6b,#ffcd6b,#64ffa0,#6fb3ff,#c792ea,#ff7a6b);animation:kxSpin 6s linear infinite}.kx-spark-ring:after{content:"";position:absolute;inset:-7px;border-radius:50%;background:inherit;filter:blur(13px);opacity:.5}.kx-spark-core{position:absolute;inset:2px;border-radius:50%;background:#0a0a0c}.kx-spark-icon{position:absolute;inset:0;margin:auto;width:32px;height:32px;color:#fff}.kx-points{list-style:none;display:flex;flex-direction:column;gap:13px;text-align:left;margin-bottom:28px}.kx-points li{position:relative;padding-left:22px;font-size:13.5px;line-height:1.62;color:var(--t2)}.kx-points li:before{content:"";position:absolute;left:2px;top:.6em;width:6px;height:6px;border-radius:50%}.kx-points li:nth-child(1):before{background:#ff7a6b;box-shadow:0 0 8px #ff7a6bb3}.kx-points li:nth-child(2):before{background:#6fb3ff;box-shadow:0 0 8px #6fb3ffb3}.kx-points li:nth-child(3):before{background:#64ffa0;box-shadow:0 0 8px #64ffa0b3}.kx-points b{color:var(--t1);font-weight:600}.kx-intro-hint{font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--t3)}.kx-code::-webkit-scrollbar,.kx-list::-webkit-scrollbar{width:10px;height:10px}.kx-code::-webkit-scrollbar-thumb,.kx-list::-webkit-scrollbar-thumb{background:var(--line);border:3px solid #0a0a0c;border-radius:10px}body.kx-locked{overflow:hidden}@keyframes kxFade{0%{opacity:0}to{opacity:1}}@keyframes kxRise{0%{opacity:0;transform:translateY(12px) scale(.99)}to{opacity:1;transform:none}}@keyframes kxSpin{to{transform:rotate(360deg)}}@keyframes kxIntroRise{0%{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}@keyframes rise{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}.caret{opacity:1}}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764var En=Object.defineProperty;var Be=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var _n=(t,e)=>{for(var n in e)En(t,n,{get:e[n],enumerable:!0})};var kt,wt=Be(()=>{kt=`struct VertexOutput {@builtin(position) position: vec4f,@location(0) uv: vec2f,}@vertex fn vs_main(@builtin(vertex_index) index: u32) -> VertexOutput {let corner = vec2f(f32((index << 1u) & 2u), f32(index & 2u));var v: VertexOutput;v.position = vec4f(corner * 2.0 - 1.0, 0.0, 1.0);v.uv = vec2f(corner.x, 1.0 - corner.y);return v;}`});var Ct,St=Be(()=>{Ct=`struct Params { logoCenter: vec2f, logoScale: vec2f, uvInset: vec2f, edge: f32, _pad: f32 }@group(0) @binding(0) var logoSampler: sampler;@group(0) @binding(1) var logoTexture: texture_2d<f32>;@group(0) @binding(2) var<uniform> params: Params;@fragment fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {let local = (uv - params.logoCenter) / params.logoScale + vec2f(0.5);let inside = all(local >= vec2f(0.0)) && all(local <= vec2f(1.0));let sampleUv = mix(params.uvInset, vec2f(1.0) - params.uvInset, clamp(local, vec2f(0.0), vec2f(1.0)));let texel = textureSample(logoTexture, logoSampler, sampleUv);let luma = dot(texel.rgb, vec3f(0.299, 0.587, 0.114));let bright = mix(0.4, 1.0, smoothstep(0.04, 0.8, luma));var mask = texel.a * bright * select(0.0, 1.0, inside);mask = (mask + pow(mask, 3.0) * 0.6) * params.edge;return vec4f(vec3f(mask), 1.0);}`});var Lt,Mt=Be(()=>{Lt=`struct Params { light: vec2f, sceneTexel: vec2f, aspect: vec2f, spotReach: f32, spotStroke: f32 }@group(0) @binding(0) var linearSampler: sampler;@group(0) @binding(1) var sceneTexture: texture_2d<f32>;@group(0) @binding(2) var<uniform> params: Params;@fragment fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {var sharp = 0.0;let radius = max(0.5, params.spotStroke);for (var j = -3; j <= 3; j++) {for (var i = -3; i <= 3; i++) {let offset = vec2f(f32(i), f32(j)) * (radius / 3.0);if (length(offset) <= radius + 0.001) {sharp = max(sharp, textureSample(sceneTexture, linearSampler, uv + offset * params.sceneTexel).r);}}}let present = smoothstep(0.0015, 0.02, sharp);let distanceToLight = length((params.light - uv) * params.aspect);let falloff = mix(9.0, 0.4, params.spotReach);let lit = (sharp * sharp) * present / (1.0 + distanceToLight * distanceToLight * falloff);return vec4f(vec3f(lit), 1.0);}`});var Et,Tt=Be(()=>{Et=`const MAX_TAPS: u32 = 8u;struct Params {direction: vec2f,texelSize: vec2f,taps: array<vec4f, 8>,centerWeight: f32,tapCount: u32,}@group(0) @binding(0) var linearSampler: sampler;@group(0) @binding(1) var sourceTexture: texture_2d<f32>;@group(0) @binding(2) var<uniform> params: Params;fn sampleClamped(uv: vec2f) -> vec3f {let halfTexel = params.texelSize * 0.5;return textureSample(sourceTexture, linearSampler, clamp(uv, halfTexel, vec2f(1.0) - halfTexel)).rgb;}@fragment fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {var color = sampleClamped(uv) * params.centerWeight;for (var index = 0u; index < MAX_TAPS; index += 1u) {if (index >= params.tapCount) {break;}let tap = params.taps[index];color += sampleClamped(uv + params.direction * tap.x) * tap.y;color += sampleClamped(uv - params.direction * tap.x) * tap.y;}return vec4f(color, 1.0);}`});var At,_t=Be(()=>{At=`struct Params {light: vec2f,aspect: vec2f,flareColor: vec3f,rimIntensity: f32,extension: f32,beamIntensity: f32,filmGrain: f32,smoothness: f32,logoOpacity: f32,frameIndex: u32,spotFocus: f32,scatter: f32,rimFill: f32,}@group(0) @binding(0) var linearSampler: sampler;@group(0) @binding(1) var sceneTexture: texture_2d<f32>;@group(0) @binding(2) var rimTexture: texture_2d<f32>;@group(0) @binding(3) var rimBlurTexture: texture_2d<f32>;@group(0) @binding(4) var blueNoiseTexture: texture_2d<f32>;@group(0) @binding(5) var<uniform> params: Params;fn resolveDarkColor(radiance: vec3f) -> vec3f {return max(vec3f(0.0), vec3f(1.0) - exp(-radiance * 1.3));}@fragment fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {let scene = textureSample(sceneTexture, linearSampler, uv).r;let rimSample = textureSample(rimTexture, linearSampler, uv).r;let rimBlur = textureSample(rimBlurTexture, linearSampler, uv).r;let direction = uv - params.light;let decay = mix(0.85, 0.975, params.extension);let density = mix(0.35, 1.15, params.extension);let delta = direction * (density / 48.0);let dimensions = textureDimensions(rimTexture);let pixel = vec2u(clamp(uv * vec2f(dimensions), vec2f(0.0), vec2f(dimensions) - vec2f(1.0)));let offset = vec2u(params.frameIndex * 73u, params.frameIndex * 23u);let noisePixel = (pixel + offset) & vec2u(127u);let blueNoise = textureLoad(blueNoiseTexture, vec2i(noisePixel), 0).r;let jitter = fract(blueNoise + f32(params.frameIndex) * 0.61803398875);var coordinate = uv - delta * jitter * params.smoothness;var illumination = 1.0;var illuminationSum = 0.0;var rimRays = 0.0;let stepLength = length(delta * params.aspect) / params.aspect.x;for (var i = 0; i < 48; i++) {coordinate -= delta;let sharpRay = textureSample(rimTexture, linearSampler, coordinate).r;let blurredRay = textureSample(rimBlurTexture, linearSampler, coordinate).r;let distanceFromStroke = (f32(i + 1) + jitter * params.smoothness) * stepLength;let reach = 1. - smoothstep(0.035, 0.153, distanceFromStroke);rimRays += mix(sharpRay, blurredRay, params.smoothness) * illumination * reach;illuminationSum += illumination;illumination *= decay;}rimRays = rimRays / max(illuminationSum, 0.001) * 4.102966;let haloDelta = (uv - params.light) * params.aspect;let haloRadius = mix(0.05, 0.6, params.spotFocus);let halo = exp(-dot(haloDelta, haloDelta) / (haloRadius * haloRadius));let lineCoverage = max(scene, rimBlur * 0.65);let haloLine = halo * lineCoverage * params.rimIntensity * 1.1;let spot = max(rimSample, rimBlur * 0.85 * params.rimFill) * (1.0 + halo * 1.5);let scatterSignal = rimRays * params.beamIntensity * params.scatter;var radiance = params.flareColor * haloLine;radiance += vec3f(scene) * params.logoOpacity * 0.22;radiance += mix(vec3f(1.0), params.flareColor, 0.5) * spot * params.rimIntensity;radiance += params.flareColor * spot * 0.4 * params.rimIntensity;radiance += params.flareColor * scatterSignal;let composed = resolveDarkColor(radiance);let grainOffset = vec2u(params.frameIndex * 37u + 53u, params.frameIndex * 109u + 17u);let grainPixel = (pixel * vec2u(3u, 5u) + grainOffset) & vec2u(127u);let grainSample = textureLoad(blueNoiseTexture, vec2i(grainPixel), 0).r;let grain = (fract(grainSample + f32(params.frameIndex) * 0.61803398875 + 0.38196601125) - 0.5) * 2.0;let beamGate = smoothstep(0.003, 0.05, scatterSignal) * (1.0 - smoothstep(0.4, 1.0, scatterSignal));let logoCoverage = max(scene, max(rimSample, rimBlur));let grainMask = beamGate * (1.0 - smoothstep(0.02, 0.3, logoCoverage));let grained = clamp(composed + vec3f(grain * params.filmGrain * grainMask), vec3f(0.0), vec3f(1.0));return vec4f(grained,max(grained.r,max(grained.g,grained.b)));}`});var Rt={};_n(Rt,{createScene:()=>Gn});function zt(t,e,n){let r=new Float32Array(40);return r.set([n?1/t:0,n?0:1/e,1/t,1/e]),Pt.forEach((a,i)=>r.set(a,4+i*4)),r[36]=.0799404796215474,new Uint32Array(r.buffer)[37]=Pt.length,r}function On(t){let e=Math.max(t,0);for(let n=0;;n++){let r=Math.sin(n*127.1+311.7)*43758.5453,a=n===0?6:3+(r-Math.floor(r))*3,i=n%2===0;if(e<a)return i?1:.2;if(e-=a,e<2){let l=e/2,d=l*l*(3-2*l);return .2+.8*(i?1-d:d)}e-=2}}async function Bt(t,e){let n=await fetch(new URL("./assets/"+t,import.meta.url));if(!n.ok)throw new Error("Flare asset unavailable: "+t);return n[e]()}async function Gn({device:t,canvas:e,context:n,format:r}){let a=["logo","rim","blur","composite"],i={fullscreen:kt,logo:Ct,rim:Lt,blur:Et,composite:At},[l,d]=await Promise.all([Bt("blue-noise.bin","arrayBuffer"),Bt("wordmark.png","blob")]),b=Object.fromEntries(Object.entries(i).map(([F,W])=>[F,t.createShaderModule({label:"flare/"+F,code:W})])),p=Object.fromEntries(await Promise.all(a.map(async F=>[F,await t.createRenderPipelineAsync({label:"flare/"+F,layout:"auto",vertex:{module:b.fullscreen,entryPoint:"vs_main"},fragment:{module:b[F],targets:[{format:F==="composite"?r:"rgba8unorm"}]},primitive:{topology:"triangle-list"}})]))),m=await createImageBitmap(d,{colorSpaceConversion:"none",premultiplyAlpha:"none"}),s=m.width/m.height,f=t.createTexture({label:"flare/wordmark",size:[m.width,m.height],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});t.queue.copyExternalImageToTexture({source:m},{texture:f},[m.width,m.height]),m.close();let g=t.createTexture({label:"flare/blue-noise",size:[128,128],format:"r8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST});t.queue.writeTexture({texture:g},l,{bytesPerRow:128},[128,128]);let y=t.createSampler({magFilter:"linear",minFilter:"linear"}),u=Object.fromEntries(Object.entries({logo:32,rim:32,blurH:160,blurV:160,composite:80}).map(([F,W])=>[F,t.createBuffer({label:"flare/"+F,size:W,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})])),c=0,h=0,x=[],E={},w=0,S=0,B=!0,N=.5,P=.5;function O(F,W,Z){let U=[y,...Z.map(H=>H.createView()),{buffer:u[F]}];return t.createBindGroup({label:"flare/"+F,layout:p[W].getBindGroupLayout(0),entries:U.map((H,V)=>({binding:V,resource:H}))})}function ae(){c=e.width,h=e.height;for(let J of x)J.destroy();let F=(globalThis.devicePixelRatio??1)<1.5&&Math.max(c,h)*2<=t.limits.maxTextureDimension2D?2:1;x=["scene","rim","blur-horizontal","blur-vertical"].map((J,ie)=>{let se=ie===0?F:1;return t.createTexture({label:"flare/"+J,size:[c*se,h*se],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT})});let[W,Z,U,H]=x;E={logo:O("logo","logo",[f]),rim:O("rim","rim",[W]),blurH:O("blurH","blur",[Z]),blurV:O("blurV","blur",[U]),composite:O("composite","composite",[W,Z,H,g])};let V=c*(.969/1.76);t.queue.writeBuffer(u.logo,0,new Float32Array([.5,.5,V/c,V/s/h,0,0,1.1,0])),t.queue.writeBuffer(u.blurH,0,zt(c,h,!0)),t.queue.writeBuffer(u.blurV,0,zt(c,h,!1)),B=!0}function oe(F,W){(e.width!==c||e.height!==h)&&ae();let Z=Math.min(c,h),U=[c/Z,h/Z],H=[.5+W[0]*.2,.5-W[1]*.185],V=Math.min(Math.max(F-S,0),.05);S=F;let J=1-Math.exp(-V/.3);N+=(H[0]-N)*J,P+=(H[1]-P)*J;let ie=.82+.18*On(F);t.queue.writeBuffer(u.rim,0,new Float32Array([N,P,1/c,1/h,...U,.5,.9]));let se=new Float32Array(20);se.set([N,P,...U]),se.set([179/255,191/255,1,ie,.6,.8*ie,.03,1,1,0,.08,1,1],4),new Uint32Array(se.buffer)[13]=w++,t.queue.writeBuffer(u.composite,0,se);let ve=t.createCommandEncoder({label:"flare"});function fe(Pe,ue,le){let ne=ve.beginRenderPass({label:"flare/"+ue,colorAttachments:[{view:le.createView(),loadOp:"clear",storeOp:"store",clearValue:{r:0,g:0,b:0,a:1}}]});ne.setPipeline(p[Pe]),ne.setBindGroup(0,E[ue]),ne.draw(3),ne.end()}B&&(fe("logo","logo",x[0]),B=!1),fe("rim","rim",x[1]),fe("blur","blurH",x[2]),fe("blur","blurV",x[3]),fe("composite","composite",n.getCurrentTexture()),t.queue.submit([ve.finish()])}function D(){for(let F of[f,g,...x,...Object.values(u)])F.destroy()}return{frame:oe,destroy:D}}var Pt,Ot=Be(()=>{"use strict";wt();St();Mt();Tt();_t();Pt=[[1.48500449838059,.15215191554518462],[3.4650570548417856,.12482060361420404],[5.445220764892785,.08739756064091182],[7.42555748318834,.052228984400379486],[9.406126897065857,.026638884372877224],[11.386985823860664,.011595876612829572],[13.368187582263898,.004307876491458321],[15,.0008880585113811997]]});function je(t,e,n=!1){let r=n?Math.min(t/680,e/610):Math.min(t/1200,e/800),a=t/r,i=e/r;return[(n?860:600)-a/2,400-i/2,a,i]}function Gt(t,e,n){let r,a,i=!1,l=e.parentElement;function d(){l.classList.remove("flare-live"),r?.destroy(),r=null,a?.unconfigure()}async function b(){let{createScene:p}=await Promise.resolve().then(()=>(Ot(),Rt));if(i||(a=e.getContext("webgpu"),!a))return;a.configure({device:t,format:n,alphaMode:"premultiplied"});let m=await p({device:t,canvas:e,context:a,format:n});i?m.destroy():r=m}return b().catch(p=>{i||(d(),console.warn("Wordmark preview:",p))}),{frame(p,m){if(!r||!e.clientWidth)return;let s=e.getBoundingClientRect(),f=Math.min(devicePixelRatio||1,2,1600/s.width),g=Math.max(1,Math.round(s.width*f)),y=Math.max(1,Math.round(s.height*f));(g!==e.width||y!==e.height)&&(e.width=g,e.height=y),r.frame(p,m),l.classList.add("flare-live")},destroy(){i=!0,d()}}}var Re=[[0,-.985],[1.022,-.985],[1.022,0],[3.918,0],[3.918,1],[0,1]],Ft=(t,e)=>t.map((n,r)=>n-e[r]),Ut=(t,e)=>t[0]*e[1]-t[1]*e[0];function Fn(t){let e=t.map((a,i)=>i),n=[],r=(a,i,l)=>Ut(Ft(i,a),Ft(l,a));for(;e.length>3;){let a=!1;for(let i=0;i<e.length;i++){let l=e[(i+e.length-1)%e.length],d=e[i],b=e[(i+1)%e.length],p=t[l],m=t[d],s=t[b];if(!(r(p,m,s)<=1e-8)&&!e.some(f=>f!==l&&f!==d&&f!==b&&r(p,m,t[f])>=-1e-8&&r(m,s,t[f])>=-1e-8&&r(s,p,t[f])>=-1e-8)){n.push([l,d,b]),e.splice(i,1),a=!0;break}}if(!a)throw new Error("Invalid glass cap")}return n.push(e),n}var Ve=.174,Xe=.178,Ne=12,ct=9.479,In=ct*Math.sqrt(3),lt=3.95,It=[101.2,100],Nt=[864,390],Nn=Math.SQRT2*ct;function Un(t){let e=[];return Re.forEach(([n,r],a)=>{let i=Re[(a+5)%6],l=Re[(a+1)%6],d=[Math.sign(n-i[0]),Math.sign(r-i[1])],b=[Math.sign(l[0]-n),Math.sign(l[1]-r)],p=Ut(d,b),m=[d[1],-d[0]],s=[b[1],-b[0]],f=n-p*Xe*(m[0]+s[0]),g=r-p*Xe*(m[1]+s[1]);for(let y=0;y<=Ne;y++){let L=p*Math.PI*.5*y/Ne,u=m[0]*Math.cos(L)-m[1]*Math.sin(L),c=m[0]*Math.sin(L)+m[1]*Math.cos(L),h=p*Xe-t;e.push({p:[f+h*u,g+h*c],n:[u,c]})}}),e}function Hn(t){let e=Math.cos(t),n=Math.sin(t);function r([p,m,s],f){let g=ct*(2*p-m-s)+(f?85.06-It[0]:0),y=In*(m-s)+(f?64.92-It[1]:0),L=Nn*(p+m+s-(f?2.48:0));return[(e*g-n*y)*lt+(f?Nt[0]:0),(n*g+e*y)*lt+(f?Nt[1]:0),L*lt]}let a=[],i=[];function l(p,m,s){let f=r(m,!1),g=Math.hypot(...f);return a.push(...r(p,!0),...f.map(y=>y/g),0,0,s,0),a.length/10-1}let d=[];for(let p of[-1,1])for(let m=0;m<=Ne;m++){let s=Math.PI*.5*(p<0?m:Ne-m)/Ne,f=Math.sin(s),g=Math.cos(s),y=p<0?Ve*(1-g):1.051-Ve*(1-g),L=Un(Ve*(1-f));if(d.push(L.map(({p:u,n:c})=>l([...u,y],[c[0]*f,c[1]*f,p*g],Math.abs(g*f)*2))),g>.999)for(let[u,c,h]of Fn(L.map(x=>x.p))){let x=d.at(-1);i.push(x[u],x[p<0?h:c],x[p<0?c:h])}}for(let p=1;p<d.length;p++){let m=d[p-1],s=d[p];for(let f=0;f<m.length;f++){let g=(f+1)%m.length;i.push(m[f],m[g],s[g],m[f],s[g],s[f])}}let b=[[1,0,0],[0,1,0],[0,0,1]].map(p=>r(p,!1));return{vertices:a,indices:i,axes:b,origin:r([0,0,0],!0),pivot:r([1.65,.25,.5],!0)}}var ee={length:Re[3][0],width:Re[1][0],hook:-Re[0][1],depth:1.051,radius:Ve,corner:Xe};function Ht(){return[0,-2*Math.PI/3,2*Math.PI/3].map(Hn)}var Te=(t,e,n)=>[t[0]+n*e[0],t[1]+n*e[1],t[2]+n*e[2]],Ue=(t,e)=>t[0]*e[0]+t[1]*e[1]+t[2]*e[2],He=t=>{let e=Math.hypot(...t);return t.map(n=>n/e)},Wt=(t,e)=>t.map((n,r)=>n-e[r]),pt=(t,e,n)=>Math.max(e,Math.min(n,t)),jt=(t,e)=>t.map(n=>n*e),$n=1/0;function $t(t,e,n){let[r,a,i]=t,l=e[0]*a-n[0]*i,d=n[0]*a+e[0]*i,b=e[1]*r+n[1]*d;return[e[2]*b-n[2]*l,n[2]*b+e[2]*l,-n[1]*r+e[1]*d]}function Dn(t,e){return t.map(({origin:n,pivot:r,axes:a},i)=>{let l=i*4,d=[e[l+12],e[l+13],e[l+2]],b=d.map(Math.cos),p=d.map(Math.sin),m=e[l+3],s=[r[0]+e[l],r[1]+e[l+1],r[2]+e[l+14]];return{origin:Te(s,$t(Wt(n,r),b,p),m),axes:a.map(f=>He($t(f,b,p))),scale:Math.hypot(...a[0])*m}})}var te=ee.radius,Oe=ee.corner;function Dt(t,e,n,r,a,i){let l=Oe-te,d=Math.abs(t-.5*(n+a))-.5*(a-n)+l,b=Math.abs(e-.5*(r+i))-.5*(i-r)+l;return Math.hypot(Math.max(0,d),Math.max(0,b))+Math.min(Math.max(d,b),0)-l}function Le(t,e,n){let r=Math.min(Dt(t,e,te,te,ee.length-te,1-te),Dt(t,e,te,-ee.hook+te,ee.width-te,1-te)),a=t-ee.width-Oe,i=e+Oe;a<=0&&i>=0&&a>-(Oe+te)*1.8&&i<(Oe+te)*1.8&&(r=Oe+te-Math.hypot(a,i));let l=Math.abs(n-ee.depth*.5)-ee.depth*.5+te;return Math.hypot(Math.max(r,0),Math.max(l,0))+Math.min(Math.max(r,l),0)-te}function Kn(t,e,n,r){let a=Wt(e,t.origin),i=t.axes.map(s=>Ue(s,a)/t.scale),l=t.axes.map(s=>Ue(s,n)),d=5e-4,b=1/0,p=[0,-ee.hook,0],m=[ee.length,1,ee.depth];for(let s=0;s<3;s++){if(Math.abs(l[s])<1e-7){if(i[s]<p[s]||i[s]>m[s])return null;continue}let f=(p[s]-i[s])/l[s],g=(m[s]-i[s])/l[s];d=Math.max(d,Math.min(f,g)),b=Math.min(b,Math.max(f,g))}if(d>b+5e-4)return null;for(let s=0;s<64&&d<=b+5e-4;s++){let f=i[0]+l[0]*d,g=i[1]+l[1]*d,y=i[2]+l[2]*d,L=Le(f,g,y)*(r?-1:1);if(L<3e-4){let c=[Le(f+18e-5,g,y)-Le(f-18e-5,g,y),Le(f,g+18e-5,y)-Le(f,g-18e-5,y),Le(f,g,y+18e-5)-Le(f,g,y-18e-5)],h=[0,1,2].map(x=>t.axes[0][x]*c[0]+t.axes[1][x]*c[1]+t.axes[2][x]*c[2]);return{t:d*t.scale,n:He(h)}}d+=Math.max(3e-4,L)}return null}function qn(t,e,n){let r=-Ue(e,t),a=1-n*n*(1-r*r);return a>0?He(Te(jt(t,n),e,n*r-Math.sqrt(a))):null}function Kt(t,e,n,r){let a=-1,i=1,l=[];for(let d=0;d<Vt;d++){let b=$n,p,m;for(let L=0;L<3;L++){if(a>=0&&L!==a)continue;let u=Kn(t[L],e,n,L===a);u&&u.t<b&&(b=u.t,p=u.n,m=L)}if(l.push({p:e,d:n,medium:a,power:i,t:b}),!isFinite(b))break;let s=a<0,f=s?p:jt(p,-1),g=qn(n,f,s?1/r:r);if(g){let L=((r-1)/(r+1))**2,u=L+(1-L)*(1-pt(-Ue(n,f),0,1))**5;i*=1-u,a=s?m:-1,n=g}else n=He(Te(n,f,-2*Ue(n,f)));let y=Te(e,l.at(-1).d,b);e=Te(y,n,.14)}return l}var Vt=10,dt=1520,Xt=.279,Yt=.252,qt=He([-1,-Xt,Yt]),ft=[dt,492+(dt-1067)*Xt,-15.5-(dt-1067)*Yt],ut=(t,e)=>{let n=Math.max(.25,1+e*t[2]);return[600+(t[0]-600)/n,400+(t[1]-400)/n]},Wn=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]);function Qt(t){let e=new Float32Array(4+Vt*12);return(n,r,a)=>{let i=Dn(t,n),l=[ft[0],ft[1]+pt(r[1]-.3*r[0],-1,1)*.32,ft[2]],d=Kt(i,l,qt,1.535),b=Kt(i,l,qt,1.552);e[0]=d.length;let p=!0,m=0,s=null,f=null,g=0;for(let y=0;y<d.length;y++){let L=d[y],u=b[y],c=d[y+1],h=b[y+1],x=s??ut(L.p,a),E=c?c.p:Te(L.p,L.d,Math.min(L.t,2400)),w=ut(E,a),S=Wn(w,x),B=(w[0]-x[0])/Math.max(S,.001),N=(w[1]-x[1])/Math.max(S,.001),P=[N,-B],O=f??x,ae=(O[0]-x[0])*P[0]+(O[1]-x[1])*P[1];if(p=p&&!!u&&u.medium===L.medium&&!!c==!!h&&(!c||c.medium===h.medium),p){let W=h?h.p:Te(u.p,u.d,Math.min(u.t,2400)),Z=ut(W,a),U=7.1*((Z[0]-w[0])*P[0]+(Z[1]-w[1])*P[1]);g=pt((U-ae)/Math.max(1,S),-.4,.4)}ae+=g*S;let oe=[w[0]+P[0]*ae,w[1]+P[1]*ae],D=y===0?5e3:0,F=m+(y===0?0:S);e.set([x[0]-B*D,x[1]-N*D,w[0],w[1],O[0]-B*D,O[1]-N*D,oe[0],oe[1],L.medium,L.power,m,F],4+y*12),s=w,f=oe,m=F}return e}}var Ee=Object.freeze({duration:3.2,travel:1,ambient:1,beam:1,pointer:!0}),Zt=[[.16,.81,290,-385,62,.19,-.32,.53,120],[0,.6,-800,-150,80,-.38,-.35,.23,-105],[.08,.71,495,-230,72,.23,-.43,-.52,105]],Ye=Math.max(...Zt.map(t=>t[1]));function Jt(t,e){let n=[],r=[];for(let[a,i,l,d,b,p,m,s,f]of Zt){let g=Math.min(1,Math.max(0,(t-a)/(i-a))),y=(1-g)**3*(1+1.7*g),L=4*g*(1-g)**2,u=(1-g*g*(3-2*g))*e;n.push(l*y*e,(d*y-b*L)*e,p*(y+.18*L)*e,1-.12*y*e),r.push(m*u,s*u,f*y*e,0)}return[...n,...r]}var $e=`struct Rig {light: vec2f, viewport: vec2f,timing: vec4f,pose: array<vec4f,3>,tilt: array<vec4f,3>,glassRect: vec4f,glassPixels: vec4f,beamMeta:vec4f,beamPath:array<vec4f,30>,view:vec4f,}fn rotateGlass(v:vec3f, angles:vec3f)->vec3f {let c=cos(angles); let s=sin(angles);let pitch=vec3f(v.x,c.x*v.y-s.x*v.z,s.x*v.y+c.x*v.z);let yaw=vec3f(c.y*pitch.x+s.y*pitch.z,pitch.y,-s.y*pitch.x+c.y*pitch.z);return vec3f(c.z*yaw.x-s.z*yaw.y,s.z*yaw.x+c.z*yaw.y,yaw.z);}`;var en=`struct Softbox { normal:vec3f, u:vec3f, v:vec3f, feather:f32, radiance:vec3f }const softboxes=array(Softbox(vec3f(0.80209, -0.45757, -0.38376), vec3f(-0.33788, 0.11137, -0.83899), vec3f(4.58241, 8.62070, -0.70110), 0.2413, vec3f(5.10000, 6.00000, 6.30000)),Softbox(vec3f(-0.40703, -0.87352, 0.26700), vec3f(-0.11170, 0.14569, 0.30635), vec3f(-2.63499, 0.81557, -1.34867), 0.0800, vec3f(0.04500, 0.30000, 0.75016)),Softbox(vec3f(-0.65448, -0.64515, -0.39426), vec3f(-0.15316, 0.26650, -0.18185), vec3f(1.14882, -0.30289, -1.41145), 0.1076, vec3f(0.01568, 0.25500, 4.17979)),Softbox(vec3f(0.90224, -0.36649, 0.22728), vec3f(0.27838, 0.45843, -0.36589), vec3f(2.95609, 38.88367, 50.96614), 0.2764, vec3f(11.70000, 1.73390, 2.57054)),Softbox(vec3f(0.21684, 0.90987, -0.35371), vec3f(0.14872, -0.35358, -0.81834), vec3f(-1.41842, 0.20363, -0.34576), 0.3978, vec3f(0.03000, 0.57353, 4.50000)),Softbox(vec3f(-0.83246, 0.54853, -0.07822), vec3f(2.08392, 3.16258, 0.00000), vec3f(4.66569, -3.07429, -71.20970), 0.1340, vec3f(4.80000, 3.30000, 0.88076)),Softbox(vec3f(-0.66384, 0.61050, 0.43199), vec3f(0.25679, -0.65886, 1.32572), vec3f(0.82089, 0.74362, 0.21056), 0.1384, vec3f(0.22237, 0.41646, 0.90310)),Softbox(vec3f(0.72761, -0.68543, 0.02775), vec3f(0.15633, 0.15041, -0.38380), vec3f(0.58724, 0.64326, 0.49128), 0.9400, vec3f(0.72500, 0.75335, 2.94105)),Softbox(vec3f(-0.74515, -0.12341, -0.65538), vec3f(-1.03500, -0.86423, 1.33949), vec3f(-0.72132, 1.65262, 0.50891), 0.0800, vec3f(0.27850, 0.87884, 5.22000)),Softbox(vec3f(0.01788, 0.89696, -0.44176), vec3f(0.09246, 0.26192, 0.53555), vec3f(9.00982, -0.76218, -1.18281), 0.1003, vec3f(1.90421, 8.80476, 11.40000)),Softbox(vec3f(-0.47701, 0.20154, 0.85548), vec3f(0.52870, -2.43099, 0.86752), vec3f(4.71031, 1.80957, 2.20016), 0.1500, vec3f(0.05011, 0.22666, 0.68642)),Softbox(vec3f(0.47427, 0.01046, 0.88032), vec3f(1.57243, 0.42956, -0.85225), vec3f(-2.08315, 9.62519, 1.00794), 0.9300, vec3f(0.00828, 0.16597, 1.43699)),Softbox(vec3f(0.16466, 0.34008, 0.92587), vec3f(7.19542, 2.81300, -2.31287), vec3f(-12.01394, 24.95182, -7.02841), 0.9500, vec3f(3.00000, 1.60000, 2.00000)),Softbox(vec3f(0.03110, 0.61312, 0.78938), vec3f(1.02010, 1.67414, -1.34051), vec3f(-10.83700, 4.28205, -2.89896), 0.7459, vec3f(0.00580, 0.03451, 1.07434)),Softbox(vec3f(0.2385,0.8573,-0.4563), vec3f(-2.9369,-0.1419,-1.8015), vec3f(-4.6203,5.0809,7.1321), 0.64, vec3f(22.0000,22.1000,24.0000)),Softbox(vec3f(-0.1310,0.8820,-0.4528), vec3f(-3.5553,0.2170,1.4512), vec3f(3.9376,5.1422,8.8776), 0.78, vec3f(0.0400,9.5000,19.0000)),Softbox(vec3f(0.8362,-0.5055,-0.2128), vec3f(-0.3244,0.9106,-3.4381), vec3f(5.9442,9.0579,1.8382), 0.82, vec3f(5.0000,5.1000,4.7500)),Softbox(vec3f(-0.47591,0.33024,0.81514),vec3f(1.67984,3.96134,-0.62414),vec3f(-17.95644,5.60501,-12.75457),0.61,vec3f(2.60000,1.80000,1.27000)),Softbox(vec3f(-0.46971,-0.48970,0.73455),vec3f(-7.77733,4.16233,-2.19837),vec3f(-3.96179,-13.49088,-11.52731),0.73,vec3f(1.60000,0.06500,0.74000)),Softbox(vec3f(-0.44047,-0.41545,0.79586),vec3f(7.70544,1.90953,5.26144),vec3f(-9.04846,20.63360,5.76305),0.65,vec3f(0.04000,0.70000,0.56000)));const SLIT_INDEX=12u;const BAND_OFFSET=vec3f(-.034,-.004,.035)/.035;fn diffuser(x:f32,soft:f32)->f32 {return 1.-smoothstep(1.-soft,1.+soft,abs(x));}fn panelRadiance(d:vec3f,emitter:Softbox,offset:vec3f)->vec3f{let incidence=dot(d,emitter.normal);if(incidence<=.001){return vec3f(0);}let x=dot(d,emitter.u)/incidence;if(abs(x)>1.+emitter.feather){return vec3f(0);}let y=vec3f(dot(d,emitter.v)/incidence)-offset;let coverage=1.-smoothstep(vec3f(1.-emitter.feather),vec3f(1.+emitter.feather),abs(y));return emitter.radiance*diffuser(x,emitter.feather)*coverage*exp(-.46*x*x-.95*y*y);}fn studioRadiance(dir:vec3f)->vec3f{var energy=vec3f(.0008,.0016,.007);for(var j=0u;j<20u;j++){if(j!=SLIT_INDEX){energy+=panelRadiance(dir,softboxes[j],vec3f(0));}}return energy;}`;var tn=`@group(0) @binding(0) var environment:texture_storage_2d_array<rgba16float,write>;@compute @workgroup_size(8,8)fn exposeStudio(@builtin(global_invocation_id) id:vec3u){let size=textureDimensions(environment);if(any(id.xy>=size) || id.z>=6u){return;}let uv=2.*(vec2f(id.xy)+.5)/vec2f(size)-1.;var d=vec3f(0.);switch id.z {case 0u:{d=vec3f(1.,-uv.y,-uv.x);}case 1u:{d=vec3f(-1.,-uv.y,uv.x);}case 2u:{d=vec3f(uv.x,1.,uv.y);}case 3u:{d=vec3f(uv.x,-1.,-uv.y);}case 4u:{d=vec3f(uv.x,-uv.y,1.);}default:{d=vec3f(-uv.x,-uv.y,-1.);}}textureStore(environment,id.xy,id.z,vec4f(studioRadiance(normalize(d)),1.));}@group(0) @binding(1) var previous:texture_2d_array<f32>;@group(0) @binding(2) var filtered:texture_storage_2d_array<rgba16float,write>;@compute @workgroup_size(8,8)fn prefilterStudio(@builtin(global_invocation_id) id:vec3u){if(any(id.xy>=textureDimensions(filtered)) || id.z>=6u){return;}let p=vec2i(id.xy)*2;let face=i32(id.z);let c=textureLoad(previous,p,face,0)+textureLoad(previous,p+vec2i(1,0),face,0)+textureLoad(previous,p+vec2i(0,1),face,0)+textureLoad(previous,p+vec2i(1),face,0);textureStore(filtered,id.xy,id.z,c*.25);}`;var Qe=`const PRISM_FLUX = array<vec3f, 33>(vec3f(0.000000, 0.000000, 0.000000),vec3f(0.009445, 0.000614, 0.000000),vec3f(0.043532, 0.000620, 0.002780),vec3f(0.119924, 0.000620, 0.013605),vec3f(0.244988, 0.000620, 0.029691),vec3f(0.403202, 0.000811, 0.037375),vec3f(0.570993, 0.012511, 0.037375),vec3f(0.735798, 0.053631, 0.037375),vec3f(0.892855, 0.149816, 0.037375),vec3f(0.976997, 0.275621, 0.037375),vec3f(0.990026, 0.394357, 0.041220),vec3f(0.990026, 0.506157, 0.086260),vec3f(0.990026, 0.611302, 0.157886),vec3f(0.990026, 0.708883, 0.242576),vec3f(0.990026, 0.797059, 0.336861),vec3f(0.990026, 0.873097, 0.440689),vec3f(0.990026, 0.935287, 0.556832),vec3f(0.990026, 0.974858, 0.668633),vec3f(0.990026, 0.992449, 0.758046),vec3f(0.990026, 0.998658, 0.826327),vec3f(0.990049, 0.999985, 0.877710),vec3f(0.991129, 1.000000, 0.915893),vec3f(0.993156, 1.000000, 0.943481),vec3f(0.995171, 1.000000, 0.962673),vec3f(0.996761, 1.000000, 0.975466),vec3f(0.997772, 1.000000, 0.983727),vec3f(0.998387, 1.000000, 0.989011),vec3f(0.998850, 1.000000, 0.992720),vec3f(0.999235, 1.000000, 0.995392),vec3f(0.999546, 1.000000, 0.997256),vec3f(0.999779, 1.000000, 0.998544),vec3f(0.999927, 1.000000, 0.999415),vec3f(1.000000, 1.000000, 1.000000),);fn prismFluxAt(displacement:f32)->vec3f {let index=clamp(displacement,0.,1.)*32.;let lo=min(u32(index),31u);return mix(PRISM_FLUX[lo],PRISM_FLUX[lo+1u],index-f32(lo));}fn prismFluxBand(offset:f32,halfWidth:f32)->vec3f {return prismFluxAt(offset+halfWidth)-prismFluxAt(offset-halfWidth);}fn prismProfile(across:f32, spread:f32, halfWidth:f32)->vec3f {let radius=abs(across-.5*spread)/halfWidth;let white=vec3f(1.02,1.,.98)*(exp(-1.6*radius*radius)*(1.-smoothstep(.55,1.,radius))+.07*exp(-.43*radius*radius));let separation=abs(spread);if(separation<halfWidth*.05){return white;}let f=across/spread;let aperture=halfWidth/separation;let bands=.38*prismFluxBand(f,.27*aperture)+.48*prismFluxBand(f,.61*aperture)+.14*prismFluxBand(f,1.03*aperture)+.066*prismFluxBand(f,2.13*aperture);return mix(white,bands,smoothstep(.05,.85,separation/halfWidth));}fn prismBundle(p:vec2f, medium:f32)->vec3f {let sweep=rig.timing.z;if(sweep<=0. || rig.timing.y<=0.){return vec3f(0.);}let front=mix(rig.view.x+rig.view.z+48.,rig.view.x-48.,smoothstep(0.,1.,sweep));let reveal=smoothstep(front-36.,front+36.,p.x);if(reveal<=0.){return vec3f(0.);}var result=vec3f(0.);let count=min(u32(rig.beamMeta.x),10u);for(var i=0u;i<count;i++){let info=rig.beamPath[3u*i+2u];if(info.x!=medium){continue;}let red=rig.beamPath[3u*i];let blue=rig.beamPath[3u*i+1u];let lo=min(min(red.xy,red.zw),min(blue.xy,blue.zw));let hi=max(max(red.xy,red.zw),max(blue.xy,blue.zw));if(any(p<lo-62.) || any(p>hi+62.)){continue;}let delta=red.zw-red.xy;let len=max(.01,length(delta));let dir=delta/len;let along=dot(p-red.xy,dir);let t=clamp(along/len,0.,1.);let depth=mix(info.z,info.w,t);let halfWidth=5.8+min(13.,.0105*depth);let n=vec2f(dir.y,-dir.x);let spread=dot(mix(blue.xy-red.xy,blue.zw-red.zw,t),n);let across=dot(p-red.xy,n);if(across < min(0.,spread)-3.1*halfWidth ||across > max(0.,spread)+3.1*halfWidth){continue;}let endDistance=max(-along,along-len);let cap=1.-smoothstep(0.,halfWidth,endDistance);if(cap<=0.){continue;}let energy=1.10*info.y*reveal*(1.+depth/340.)/pow(1.+depth/490.,1.18);result=max(result,energy*cap*prismProfile(across,spread,halfWidth));}return result;}fn prismBeam(p:vec2f)->vec3f {return prismBundle(p,-1.);}fn prismBeamGlass(p:vec2f,piece:u32)->vec3f {return .64*prismBundle(p,f32(piece));}`;var nn=`const STAGE_CONTACT_Y=652.;const STAGE_LEFT_FOOT=vec2f(733.,STAGE_CONTACT_Y);const STAGE_RIGHT_FOOT=vec2f(908.,STAGE_CONTACT_Y);fn stageBackdrop(p:vec2f,light:vec2f)->vec3f{let h=(p+vec2f(355.,170.)-light*vec2f(18.,12.))/vec2f(646.,329.);let r=dot(h,h);let blue=exp(-pow(r,1.5)*2.23);let wall=vec3f(.00012,.00015,.00063)+vec3f(.0005,.081,3.05)*blue;let cyc=(p-vec2f(857.,614.))/vec2f(357.,79.);return wall+vec3f(.0003,.0024,.036)*exp(-dot(cyc,cyc));}fn stageFold(offset:f32, width:f32, aperture:f32)->f32{let bounds=sqrt(clamp((offset+vec2f(-aperture,aperture))/width,vec2f(0),vec2f(1)));return (bounds.y-bounds.x)*sqrt(width/(2.*aperture));}fn stagePrismFan(p:vec2f,source:vec2f,side:f32,light:vec2f)->vec3f{let local=p-source;let run=local.x*side;if(run<0.){return vec3f(0);}let reach=exp(-run/658.);let inc=light.x*.043+light.y*.025;var radiance=vec3f(0);for(var i=0;i<3;i++){let ray=f32(i);let slope=select(-.092+.000166*run-.133*ray,-.065+.000063*run+.042*ray,side>0.);let axis=run*(slope+inc);let width=2.3+(7.5+ray*11.)*(1.-exp(-run/100.));let footprint=1.1+.0076*run;let dy=local.y-axis;let edge=stageFold(-dy,width,footprint);let halo=exp(-dy*dy/(3.*width*width));let open=exp(-run/123.);let beam=mix(vec3f(.002,.048,1.32),vec3f(.08,.39,1.85),open)*(edge+.29*halo);radiance+=beam/(1.+.42*ray)*reach*exp(-pow(ray*run/200.,1.75));}let localFill=exp(-run/63.-abs(local.y)/(4.+.20*run));return (radiance+vec3f(.036,.086,.20)*localFill)*smoothstep(0.,9.,run);}fn footStreak(dx:f32, z:f32, slope:f32, axisColor:vec3f, tail:vec3f, spread:vec3f)->vec3f{let path=1.-exp(-z/24.);let radius=3.9+.25*z/(1.+z/235.);let delta=(dx-slope*z-path*spread)/radius;let envelope=exp(-.5*delta*delta-z/112.);return envelope*mix(axisColor,tail,smoothstep(26.,88.,z));}fn shadeStage(p:vec2f,light:vec2f,footX:vec2f,contact:vec2f)->vec3f{var energy=stageBackdrop(p,light);let z=p.y-STAGE_CONTACT_Y;if(z< -190.){return energy;}energy+=vec3f(.0002,.0024,.063)*exp(-z*z/(2.*25.*25.));let foot=p.x-footX;if(contact.x>.001){energy+=stagePrismFan(p,vec2f(footX.x-17.,STAGE_CONTACT_Y),-1.,light)*contact.x;}if(contact.y>.001){energy+=stagePrismFan(p,vec2f(footX.y+30.,STAGE_CONTACT_Y),1.,light)*contact.y;}let nearFeet=exp(-.5*(foot.x/70.)*(foot.x/70.))*contact.x+exp(-.5*(foot.y/92.)*(foot.y/92.))*contact.y;let lift=z+1.7;energy+=nearFeet*vec3f(.058,.17,.51)*exp(-lift*lift/28.);if(z<=0.){return energy;}let drift=light.x*.17+light.y*.09;var transmitted=vec3f(0);if(contact.x>.001){let left=foot.x+27.;var c=footStreak(left,z,-.34+drift,vec3f(2.40,1.58,1.27),vec3f(.072,.21,2.55),vec3f(1.,-1.,-20.));let pool=(left+.38*z+10.)/(10.+.20*z);c+=vec3f(.001,.045,.57)*exp(-.5*pool*pool-z/220.);c+=footStreak(foot.x-46.,z,.22+drift,vec3f(.61,.42,.21),vec3f(.055,.045,.07),vec3f(.6,0,-1.));transmitted+=contact.x*c;}if(contact.y>.001){var c=footStreak(foot.y+57.,z,.12+drift,vec3f(.23,.58,2.05),vec3f(.018,.11,1.44),vec3f(0,0,-4));c+=footStreak(foot.y+6.,z,-.055+drift,vec3f(.75,.26,1.88)*exp(-z*vec3f(.033,.024,0.)),vec3f(.002,.024,1.64),vec3f(1,1,-5));c+=footStreak(foot.y-51.,z,.18+drift,vec3f(.62,1.28,2.55),vec3f(.023,.19,1.79),vec3f(0,4,8));let x=foot.y-179.-light.x*20.;let y=z-57.-light.y*10.;let across=x+.18*y;let stop=smoothstep(10.,31.,across);let yBeam=y+.33*x;let wavelength=(yBeam-vec3f(-5.,9.,30.))/vec3f(17.,21.,47.);let wing=exp(-vec3f(.5)*wavelength*wavelength);let soft=across/26.;c+=vec3f(1.54,.53,.14)*wing*exp(-.5*soft*soft)*(1.-stop);let rim=vec2f((across-15.)/7.8,(yBeam-17.)/26.);c+=vec3f(.30,.012,1.14)*exp(-.5*dot(rim,rim));let hand=vec2f((foot.y-118.-2.5*z)/37.,(z-7.-(foot.y-118.)*.055)/3.2);c+=exp(-dot(hand,hand))*vec3f(.50,.055,.065);transmitted+=contact.y*c;}let grain=fract(dot(fract(vec3f(floor(p).xyx)*vec3f(.1031,.11369,.13787)),vec3f(12.93,15.71,18.37)));return energy+vec3f(.00025,.00065,.011)+transmitted*(.91+.18*grain)*smoothstep(0.,2.8,z);}`;var mt=`fn glassAt(p:vec2f)->vec4f{let uv=(p-rig.glassRect.xy)/rig.glassRect.zw;if(any(uv<vec2f(0)) || any(uv>vec2f(1))){return vec4f(0);}let xy=clamp(uv*rig.glassPixels.xy,vec2f(.5),rig.glassPixels.xy-.5);return textureSampleLevel(glass,glassSampler,xy/vec2f(textureDimensions(glass)),0.);}`;var rn=`@group(0) @binding(0) var<uniform> rig: Rig;@group(0) @binding(1) var radiance:texture_storage_2d<rgba16float,write>;@group(0) @binding(2) var glass:texture_2d<f32>;@group(0) @binding(3) var glassSampler:sampler;@group(0) @binding(4) var backdrop:texture_storage_2d<rgba16float,write>;@compute @workgroup_size(8,8)fn transport(@builtin(global_invocation_id) id:vec3u){let size=textureDimensions(radiance);if(any(id.xy>=size)){return;}let p=rig.view.xy+(vec2f(id.xy)+.5)*rig.view.zw/vec2f(size);let contact=exp(-abs(vec2f(rig.pose[1].y,rig.pose[2].y))/22.);let feet=vec2f(STAGE_LEFT_FOOT.x+rig.pose[1].x, STAGE_RIGHT_FOOT.x+rig.pose[2].x);let base=shadeStage(p,rig.light,feet,contact*vec2f(.13,1.))+rig.timing.y*prismBeam(p);let background=base+floorReflection(p);let g=glassAt(p);textureStore(backdrop,id.xy,vec4f(background,1));textureStore(radiance,id.xy,vec4f(g.rgb+background*(1.-g.a),g.a));}`;var an=`@group(0) @binding(0) var src:texture_2d<f32>;@group(0) @binding(1) var dst:texture_storage_2d<rgba16float,write>;@group(0) @binding(2) var linearSampler:sampler;struct Blur {axis:vec2f, extract:u32, _pad:u32}@group(0) @binding(3) var<uniform> cfg:Blur;@compute @workgroup_size(8,8)fn blur(@builtin(global_invocation_id) id:vec3u){let size=textureDimensions(dst);if(any(id.xy>=size)){return;}let uv=(vec2f(id.xy)+.5)/vec2f(size);var light=vec3f(0);var weights=0.;for(var i=-6;i<=6;i++){let w=exp(-f32(i*i)/14.);let offset=cfg.axis * f32(i)/vec2f(size);var c=textureSampleLevel(src,linearSampler,uv+offset,0.).rgb;if(cfg.extract!=0u){let peak=dot(c,vec3f(.2126,.7152,.0722));c*=max(0.,peak-.76)/max(peak,.0001);}light+=w*c;weights+=w;}textureStore(dst,id.xy,vec4f(light/weights,1.));}`;var on=`const SLOPES=array(vec2f(.28,.20), vec2f(-.50,.57), vec2f(.39,-.93),vec2f(1.27,.46), vec2f(.23,1.61), vec2f(-1.83,.88));fn floorReflection(p:vec2f)->vec3f{let z=p.y-652.;if(z<0.){return vec3f(0);}let mirror=vec2f(p.x,652.-z*1.48);let coord=floor(p);let orient=fract((coord.x+coord.y*11.)*.618034);let rough=vec2f(select(-1.,1.,orient>.5)*(1.4+z*.095),2.5+z*.26);var reflected=vec3f(0);for(var i=0u;i<6u;i++){let offset=rough*SLOPES[i];reflected+=glassAt(mirror+offset).rgb+glassAt(mirror-offset).rgb;}return reflected*(.28/12.)*exp(-z/42.);}`;var ht=`@group(0) @binding(0) var<uniform> rig: Rig;@group(0) @binding(1) var walls: texture_cube<f32>;@group(0) @binding(2) var studioSampler: sampler;struct Surface {@builtin(position) clip: vec4f,@location(0) @interpolate(perspective, centroid) local: vec3f,@location(1) @interpolate(perspective, centroid) normal: vec3f,@location(2) @interpolate(flat) piece: u32,@location(3) polish: vec4f,}fn localToWorld(p:vec3f, i:u32)->vec3f {let pivot=PIVOTS[i];return pivot + vec3f(rig.pose[i].xy,rig.tilt[i].z) + rotateGlass(p-pivot,angles(i))*rig.pose[i].w;}fn angles(i:u32)->vec3f { return vec3f(rig.tilt[i].xy,rig.pose[i].z); }fn inverseRotate(v:vec3f,a:vec3f)->vec3f {let c=cos(a); let s=sin(a);let roll=vec3f(c.z*v.x+s.z*v.y,-s.z*v.x+c.z*v.y,v.z);let yaw=vec3f(c.y*roll.x-s.y*roll.z,roll.y,s.y*roll.x+c.y*roll.z);return vec3f(yaw.x,c.x*yaw.y+s.x*yaw.z,-s.x*yaw.y+c.x*yaw.z);}@vertex fn flightVertex(@location(0) p:vec3f,@location(1) n:vec3f,@location(2) polish:vec4f,@builtin(instance_index) i:u32)->Surface {let w=localToWorld(p,i);let depthW=1.+rig.timing.w*w.z;let projected=vec2f(600,400)+(w.xy-vec2f(600,400))/depthW;let ndc=((projected-rig.glassRect.xy)/rig.glassRect.zw*2.-1.)*vec2f(1,-1);return Surface(vec4f(ndc*depthW,.5*depthW+w.z/2200.,depthW),p,n,i,polish);}struct Hit { t:f32, n:vec3f, curve:f32 }fn slabSpan(p:vec3f, inv:vec3f, lo:vec3f, hi:vec3f)->vec2f {let a=(lo-p)*inv; let b=(hi-p)*inv;let near=min(a,b); let far=max(a,b);return vec2f(max(near.x,max(near.y,near.z)),min(far.x,min(far.y,far.z)));}fn rectDistance(p:vec2f,lo:vec2f,hi:vec2f,r:f32)->vec3f{let h=(hi-lo)*.5;let u=p-(lo+h);let edge=abs(u)-h+r;let outside=max(edge,vec2f(0.));let l=length(outside);let normal=select(select(vec2f(0,1),vec2f(1,0),edge.x>edge.y),outside/max(l,.00001),l>.00001)*sign(u);return vec3f(normal,l+min(max(edge.x,edge.y),0.)-r);}fn polishedDistance(p:vec3f)->vec4f{let r=STOCK_RADIUS;let corner=STOCK_CORNER;let a=rectDistance(p.xy,vec2f(r),vec2f(STOCK_LENGTH-r,1.-r),corner-r);let b=rectDistance(p.xy,vec2f(r,-STOCK_HOOK+r),vec2f(STOCK_WIDTH-r,1.-r),corner-r);var edge=select(a,b,b.z<a.z);let center=vec2f(STOCK_WIDTH+corner,-corner);let d=p.xy-center;if(d.x<=0. && d.y>=0. && d.x>-(corner+r)*1.8 && d.y<(corner+r)*1.8){let l=max(length(d),.0001);edge=vec3f(-d/l,corner+r-l);}let z=p.z-STOCK_DEPTH*.5;let q=vec2f(edge.z,abs(z)-STOCK_DEPTH*.5+r);let outside=max(q,vec2f(0.));let l=length(outside);let w=select(select(vec2f(0,1),vec2f(1,0),q.x>q.y),outside/max(l,.00001),l>.00001);return vec4f(vec3f(w.x*edge.xy,w.y*sign(z)),l+min(max(q.x,q.y),0.)-r);}fn exitSurface(i:u32, origin:vec3f, ray:vec3f)->Hit {let basis=BASES[i]*(1./STOCK_SCALE);let p=transpose(basis)*(origin-ORIGINS[i])/STOCK_SCALE;let d=transpose(basis)*ray;let inv=select(vec3f(-1.),vec3f(1.),d>=vec3f(0.))/max(abs(d),vec3f(.000001));let a=slabSpan(p,inv,vec3f(0),vec3f(STOCK_LENGTH,1.,STOCK_DEPTH));let b=slabSpan(p,inv,vec3f(0,-STOCK_HOOK,0),vec3f(STOCK_WIDTH,1.,STOCK_DEPTH));let aheadA=a.y>=max(0.,a.x);let aheadB=b.y>=max(0.,b.x);var t=select(b.y,a.y,aheadA && (!aheadB || a.x<b.x));if(aheadA && aheadB && max(a.x,b.x)<=min(a.y,b.y)){t=max(a.y,b.y);}if((!aheadA && !aheadB) || t<.0001){return Hit(1e5,vec3f(0,0,1),0.);}var hit=polishedDistance(p+d*t);if(hit.w>.0002){for(var k=0;k<2;k++){t=max(.0001,t-clamp(hit.w/max(.15,dot(hit.xyz,d)),0.,.55));hit=polishedDistance(p+d*t);}}let absN=abs(hit.xyz);let curve=smoothstep(.002,.12,1.-max(absN.x,max(absN.y,absN.z)));return Hit(t*STOCK_SCALE,normalize(basis*hit.xyz),curve);}fn studio(p:vec3f,r:vec3f,lod:f32)->vec3f {let offset=(p-vec3f(864,390,0))/365.;let o=offset/max(1.,length(offset)/.92);let b=dot(o,r);let d=normalize(o+r*(sqrt(max(.001,b*b+1.-dot(o,o)))-b)+vec3f(rig.light*.095,0.));return textureSampleLevel(walls,studioSampler,d,lod).rgb;}fn fresnel(c:f32)->f32{return .043+ .957*pow(1.-clamp(c,0.,1.),5.);}fn radianceGaussian(x:f32)->f32{return exp(-.5*x*x);}fn filteredLamp(offset:f32, sigma:f32, variance:f32)->f32 {let inv=inverseSqrt(sigma*sigma+variance);return sigma*inv*radianceGaussian(offset*inv);}fn pixelVariance(d:vec2f)->f32 { return dot(d,d)/12.; }const cardAxes=array(vec2f(-1.,0.),vec2f(.5,-.8660254),vec2f(.5,.8660254));fn stripBank(p:vec3f,r:vec3f)->vec3f {var radiance=vec3f(0.);for(var k=0u;k<3u;k++){let axis=cardAxes[k];let lamp=vec3f(.94281*axis,.33333);let side=vec3f(-axis.y,axis.x,0.);let up=vec3f(-.33333*axis,.94281);let den=dot(r,lamp);let local=p-vec3f(864,390,-12.);let wall=local+r*(485.-dot(local,lamp))/max(.42,den);let x=dot(wall,side)-rig.light.x*27.;let y=dot(wall,up)-rig.light.y*15.;let dx=vec2f(dpdx(x),dpdy(x));let dy=vec2f(dpdx(y),dpdy(y));let box=pixelVariance(dx);let width=pixelVariance(dy+.39*dx);let gel=pixelVariance(dx+.22*dy);if(den>=.42){let bank=filteredLamp(x+30.,290.,box)*smoothstep(.42,.55,den);let t=y+.39*x+28.;let wash=filteredLamp(t-35.,65.,width);let edge=filteredLamp(t-78.,14.,width);let flag=(.20+.80*smoothstep(-165.,115.,x));radiance+=bank*flag*(wash*vec3f(.006,1.85,18.)+edge*vec3f(4.,9.,9.));if(k==0u){let h=x+34.+.22*(y+57.);let normalized=(y+57.)/49.;let aperture=radianceGaussian(normalized*normalized);let magenta=filteredLamp(h-16.,6.8,gel);let gold=filteredLamp(h-6.,6.2,gel);let white=filteredLamp(h+2.,5.9,gel);let cyan=filteredLamp(h+12.,7.4,gel);radiance+=aperture*(magenta*vec3f(8.,.10,2.6)+gold*vec3f(15.,6.4,.02)+white*vec3f(12.,15.,12.)+cyan*vec3f(.01,4.9,13.));}let strip=t+106.;let streak=filteredLamp(x+93.,128.,box);radiance+=streak*(filteredLamp(strip,10.,width)*vec3f(8.,6.,3.8)+filteredLamp(strip-13.,5.,width)*vec3f(6.,.38,.12)+filteredLamp(strip+14.,7.,width)*vec3f(.08,2.5,6.));}}let d=normalize(r*425.+p-vec3f(864,390,0)+vec3f(rig.light*34.,0.));let t=d.y+.30*d.x-.16*d.z;let slitVariance=pixelVariance(vec2f(dpdx(t),dpdy(t)));let aperture=radianceGaussian((d.x-.1)/.57);radiance+=aperture*(filteredLamp(t-.34,.043,slitVariance)*vec3f(12.,.08,1.3)+filteredLamp(t-.285,.032,slitVariance)*vec3f(17.,6.2,.03)+filteredLamp(t-.237,.037,slitVariance)*vec3f(.65,12.,18.));return radiance;}fn rimLight(p:vec3f,r:vec3f)->vec3f {let o=(p-vec3f(864,390,0))/1050.;let d=normalize(r+o+vec3f(rig.light*.09,0.));let key=pow(max(0.,dot(d,normalize(vec3f(-.64,-.51,-.57)))),165.);let fill=pow(max(0.,dot(d,normalize(vec3f(.45,.67,-.57)))),205.);let line=dot(d,normalize(vec3f(.54,-.33,.77)));let ribbon=exp(-line*line/.0015);let u=dot(d,normalize(vec3f(-.51,.61,.61)));return key*vec3f(3.8,3.5,3.)+fill*vec3f(1.8,2.5,3.)+ribbon*(vec3f(.28,.68,1.3)+vec3f(2.1,1.2,.28)*exp(-18.*(u-.4)*(u-.4)));}@fragment fn flightGlass(v:Surface)->@location(0) vec4f {let i=v.piece; let a=angles(i); let w=localToWorld(v.local,i);let eye=normalize(vec3f(rig.timing.w*(w.xy-vec2f(600,400)),1.+rig.timing.w*w.z));let incident=inverseRotate(eye,a);let n=faceForward(normalize(v.normal),incident,normalize(v.normal));let front=fresnel(-dot(n,incident));let reflection=rotateGlass(reflect(incident,n),a);var ray=refract(incident,n,1./1.51);let bevel=smoothstep(.01,.54,v.polish.z);let strip=stripBank(w,reflection);var color=(studio(w,reflection,0.)+strip)*front+rimLight(w,reflection)*bevel;var throughput=vec3f(mix(.34,.91,bevel)*(1.-front));var origin=v.local+.07*ray;var blur=bevel*.7;for(var bounce=0;bounce<4;bounce++){let h=exitSurface(i,origin,ray);if(h.t>1e4){break;}blur=max(blur,h.curve*2.5)+.28;let hit=origin+h.t*ray;let ci=dot(ray,h.n);throughput*=exp(-h.t*vec3f(.0035,.00165,.00038));let eta=vec3f(1.502,1.510,1.518);let cos2=1.-eta*eta*(1.-ci*ci);if(cos2.x>0.) {let q=localToWorld(hit,i);var reflectance=vec3f(1.);for(var channel=0u;channel<3u;channel++){if(cos2[channel]<=0.){continue;}let ct=sqrt(cos2[channel]);let k=eta[channel];let rs=(k*ci-ct)/(k*ci+ct); let rp=(ci-k*ct)/(ci+k*ct);let f=.5*(rs*rs+rp*rp);let d=k*(ray-ci*h.n)+ct*h.n;color[channel]+=throughput[channel]*(1.-f)*studio(q,rotateGlass(d,a),blur)[channel];reflectance[channel]=f;}throughput*=reflectance;if(max(throughput.x,max(throughput.y,throughput.z))<.07){break;}}ray=reflect(ray,h.n); origin=hit+ray*.12;}let projected=vec2f(600,400)+(w.xy-vec2f(600,400))/(1.+rig.timing.w*w.z);color+=rig.timing.y*prismBeamGlass(projected,i);let exposed=color*color/(color+vec3f(.050,.055,.072));return vec4f(exposed,1.);}`;var sn=`@group(0) @binding(0) var<uniform> rig:Rig;@group(0) @binding(1) var hdr:texture_2d<f32>;@group(0) @binding(2) var halo:texture_2d<f32>;@group(0) @binding(3) var glassSampler:sampler;@group(0) @binding(4) var glass:texture_2d<f32>;@vertex fn vs(@builtin(vertex_index) i:u32)->@builtin(position) vec4f {let a=vec2f(f32((i<<1u)&2u),f32(i&2u));return vec4f(a*2.-1.,0.,1.);}fn displayRadiance(c:vec3f)->vec3f{let linear=max(c,vec3f(0));let knee=min(linear,vec3f(.70)) + .32*(1.-exp(-max(linear-.70,vec3f(0))/.32));return select(1.055*pow(knee,vec3f(1./2.4))-.055,12.92*knee,knee<=vec3f(.0031308));}@fragment fn fs(@builtin(position) pix:vec4f)->@location(0) vec4f {let zoom=rig.viewport.x/rig.view.z;let uv=pix.xy/rig.viewport;let bg=textureSampleLevel(hdr,glassSampler,uv,0.).rgb;let bloom=textureSampleLevel(halo,glassSampler,uv,0.).rgb;let p=rig.view.xy+uv*rig.view.zw;let dx=vec2f(.35,.16)/zoom;let dy=vec2f(-.16,.35)/zoom;let g=.25*(glassAt(p+dx)+glassAt(p-dx)+glassAt(p+dy)+glassAt(p-dy));return vec4f(displayRadiance(g.rgb+(1.-g.a)*bg+.10*bloom),1.);}`;function ar(t){let e=r=>"vec3f("+r.map(a=>a.toFixed(6)).join(",")+")",n=(r,a)=>"const "+r+" = array("+a.join(",")+");";return[n("PIVOTS",t.map(r=>e(r.pivot))),n("ORIGINS",t.map(r=>e(r.origin))),n("BASES",t.map(r=>"mat3x3f("+r.axes.map(e).join(",")+")")),`const STOCK_SCALE = ${Math.hypot(...t[0].axes[0]).toFixed(8)};`,...Object.entries(ee).map(([r,a])=>`const STOCK_${r.toUpperCase()} = ${a.toFixed(8)};`)].join(``)}async function ln(t,e,n){let r=ar(n),a=(x,E)=>t.createShaderModule({label:"Crystal / "+x,code:E}),i=a("stage composite",[$e,Qe,nn,mt,on,rn].join(``)),l=a("bloom",an),d=a("display",[$e,mt,sn].join(``)),b=a("solid glass transport",[r,$e,Qe,ht].join(``)),p=a("studio lights",en+``+tn),m=a("polished fillet samples",[r,$e,Qe,ht.replaceAll("perspective, centroid","perspective, sample").replace("@location(3) polish:","@location(3) @interpolate(perspective, sample) polish:")].join(``)),s=x=>t.createRenderPipelineAsync({layout:"auto",vertex:{module:x,entryPoint:"flightVertex",buffers:[{arrayStride:40,attributes:[{shaderLocation:0,offset:0,format:"float32x3"},{shaderLocation:1,offset:12,format:"float32x3"},{shaderLocation:2,offset:24,format:"float32x4"}]}]},fragment:{module:x,entryPoint:"flightGlass",targets:[{format:"rgba16float"}]},primitive:{topology:"triangle-list",cullMode:"back"},depthStencil:{format:"depth24plus",depthCompare:"less",depthWriteEnabled:!0},multisample:{count:4}}),[f,g,y,L,u,c,h]=await Promise.all([t.createComputePipelineAsync({layout:"auto",compute:{module:p,entryPoint:"exposeStudio"}}),t.createComputePipelineAsync({layout:"auto",compute:{module:p,entryPoint:"prefilterStudio"}}),t.createComputePipelineAsync({layout:"auto",compute:{module:i,entryPoint:"transport"}}),t.createComputePipelineAsync({layout:"auto",compute:{module:l,entryPoint:"blur"}}),t.createRenderPipelineAsync({layout:"auto",vertex:{module:d,entryPoint:"vs"},fragment:{module:d,entryPoint:"fs",targets:[{format:e}]},primitive:{topology:"triangle-list"}}),s(b),s(m)]);return{exposeStudio:f,prefilter:g,trace:y,blur:L,display:u,drawFlight:c,drawFillets:h}}function cn(t){let e=[],n=[],r=[];for(let{vertices:a,indices:i,...l}of t){let d=n.length,b=e.length/10;for(let s of a)e.push(s);let p=[];for(let s=0;s<i.length;s+=3){let f=i[s],g=i[s+1],y=i[s+2];([3,4,5].every(u=>Math.abs(a[10*f+u]-a[10*g+u])<1e-6&&Math.abs(a[10*f+u]-a[10*y+u])<1e-6)?n:p).push(f+b,g+b,y+b)}let m=n.length-d;for(let s of p)n.push(s);r.push({...l,first:d,count:i.length,flatCount:m})}return{vertices:new Float32Array(e),indices:new Uint32Array(n),pieces:r}}var De=()=>GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING;async function dn({device:t,canvas:e,context:n,format:r,motionSettings:a=Ee,titleCanvas:i,getView:l=je}){let d=cn(Ht()),b=Qt(d.pieces),{exposeStudio:p,prefilter:m,trace:s,blur:f,display:g,drawFlight:y,drawFillets:L}=await ln(t,r,d.pieces),u=new Set,c=U=>(u.add(U),U),h=(U,H,V,J=1)=>c(t.createTexture({label:"Crystal / "+U,size:H,mipLevelCount:J,format:"rgba16float",usage:V})),x=(U,H)=>c(t.createBuffer({label:"Crystal / "+U,size:H,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})),E=t.createSampler({minFilter:"linear",magFilter:"linear",mipmapFilter:"linear"}),w=new AbortController,S={...Ee,...a},B,N=null,P=null,O=null;try{let ve=function(_,k,I){let j=c(t.createBuffer({label:_,size:k.byteLength,usage:I,mappedAtCreation:!0}));return new Uint8Array(j.getMappedRange()).set(new Uint8Array(k.buffer,k.byteOffset,k.byteLength)),j.unmap(),j},xe=function(_,k,I,j){let $=_.beginRenderPass({label:"Shade polished glass solids",colorAttachments:[{view:k.color,resolveTarget:k.resolved,loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0},storeOp:"discard"}],depthStencilAttachment:{view:k.depth,depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"discard"}}),[pe,Q]=I;$.setViewport(0,0,pe,Q,0,1),$.setScissorRect(0,0,pe,Q),$.setPipeline(y),$.setBindGroup(0,ne),$.setVertexBuffer(0,fe),$.setIndexBuffer(Pe,"uint32"),d.pieces.forEach(({count:be,flatCount:me,first:re},he)=>$.drawIndexed(j?be:me,1,re,0,he)),j||($.setPipeline(L),$.setBindGroup(0,tt),d.pieces.forEach(({count:be,flatCount:me,first:re},he)=>$.drawIndexed(be-me,1,re+me,0,he))),$.end()},Ke=function(_){let k=e.width*1200/_[2],I=Math.min(3840,Math.max(384,Math.ceil(k/96)*96)),j=Math.min(1,1600/e.width,960/e.height),$=[e.width,e.height].map(K=>Math.max(48,Math.ceil(K*j/48)*48));if(ce?.bucket===I&&$.every((K,de)=>K===ce.transportSize[de]))return ce;if(ce)for(let K of ce.resources)K.destroy(),u.delete(K);let pe=new Set(u),Q=$.map(K=>Math.ceil(K/3)),be=Math.min(3,Math.max(1.3,I*1.18/1200)),me=Ge.slice(2).map(K=>Math.ceil(K*be)),re=me.map((K,de)=>Math.max(K,$[de])),he=h("linear scene radiance",$,De()).createView(),ye=h("studio and floor",$,De()).createView(),we=h("bloom horizontal",Q,De()).createView(),Fe=h("bloom vertical",Q,De()).createView(),ze=h("resolved glass",re,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING).createView(),ke=(K,de)=>c(t.createTexture({label:K,size:re,format:de,sampleCount:4,usage:GPUTextureUsage.RENDER_ATTACHMENT})).createView(),Ie=ke("Glass edge coverage","rgba16float"),qe=ke("Glass depth","depth24plus"),nt=H(s,[{buffer:U},he,ze,E,ye]);function We(K,de,it,st,Se){let Ce=x("bloom axes",16),Y=new ArrayBuffer(16);return new Float32Array(Y).set([it,st]),new Uint32Array(Y)[2]=Se,t.queue.writeBuffer(Ce,0,Y),H(f,[K,de,E,{buffer:Ce}])}let rt=[We(he,we,1,0,1),We(we,Fe,0,1,0)],at=H(g,[{buffer:U},ye,Fe,E,ze]),ot=[...u].filter(K=>!pe.has(K));return ce={bucket:I,transportSize:$,bloomSize:Q,settledPixels:me,color:Ie,depth:qe,resolved:ze,composite:nt,groups:rt,show:at,resources:ot},O=null,ce},v=function(_){if(_.isPrimary===!1)return;let k=e.getBoundingClientRect();N=[Math.min(1,Math.max(-1,2*(_.clientX-k.left)/k.width-1)),Math.min(1,Math.max(-1,1-2*(_.clientY-k.top)/k.height))]},C=function(){N=null},M=function(_,k,I,j,$,pe=1){let Q=_.beginComputePass({label:k});Q.setPipeline(I),Q.setBindGroup(0,j),Q.dispatchWorkgroups(Math.ceil($[0]/8),Math.ceil($[1]/8),pe),Q.end()};var ae=ve,oe=xe,D=Ke,F=v,W=C,Z=M;let U=x("light and assembly",672),H=(_,k)=>t.createBindGroup({layout:_.getBindGroupLayout(0),entries:k.map((I,j)=>({resource:I,binding:j}))}),V=256,J=6,ie=h("procedural studio enclosure",[V,V,6],De(),J),se=H(p,[ie.createView({dimension:"2d-array",baseMipLevel:0,mipLevelCount:1})]),fe=ve("Glass surface vertices",d.vertices,GPUBufferUsage.VERTEX),Pe=ve("Glass index buffer",d.indices,GPUBufferUsage.INDEX),ue=t.createCommandEncoder({label:"Crystal studio lighting"});M(ue,"Expose six studio walls",p,se,[V,V],6);for(let _=1;_<J;_++){let k=j=>ie.createView({dimension:"2d-array",baseMipLevel:j,mipLevelCount:1}),I=t.createBindGroup({layout:m.getBindGroupLayout(0),entries:[{binding:1,resource:k(_-1)},{binding:2,resource:k(_)}]});M(ue,"Prefilter studio reflection",m,I,[V>>_,V>>_],6)}t.queue.submit([ue.finish()]);let le=[{buffer:U},ie.createView({dimension:"cube"}),E],ne=H(y,le),tt=H(L,le),Ge=[586,112,552,552],ce=null,o=(_,k)=>e.addEventListener(_,k,{passive:!0,signal:w.signal});o("pointermove",v),o("pointerdown",v),o("pointerleave",C),o("pointercancel",C),o("pointerup",_=>{_.pointerType!=="mouse"&&C()});let T=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)"),R=i?Gt(t,i,r):null,A=1,z=0,G=16;return{reportFrameCost(_){!Number.isFinite(_)||_<=0||(G+=.22*(Math.min(_,250)-G),!(++z<8)&&(G>20&&A>0?(A--,z=0):G<11&&A<2&&(A++,z=0)))},setMotion(_){Object.assign(S,_)},frame(_){let k=T?.matches?1:Math.min(1,Math.max(0,_/S.duration)),j=Math.max(0,_-S.duration)*2*Math.PI/10,$=T?.matches?0:S.ambient,pe=[$*.53*Math.sin(j),$*.28*Math.sin(2*j)],Q=S.pointer&&N?N:[0,0],be=B===void 0?1/60:Math.max(0,Math.min(.12,_-B));B=_,(!P||_===0)&&(P=[0,0]);let me=1-Math.exp(-be*9);P=P.map((Y,Me)=>Math.abs(Y-Q[Me])<1e-4?Q[Me]:Y+(Q[Me]-Y)*me);let re=Jt(k,S.travel),he=Math.min(1,Math.max(...[12,16,20].map(Y=>Math.hypot(re[Y],re[Y+1]))))/1550,ye=[pe[0]+P[0],pe[1]+P[1]],we=k<Ye&&S.travel>0,Fe=we?A:2,ze=[.55,.78,1][Fe],ke=l(e.width,e.height),Ie=Ke(ke),{transportSize:qe,bloomSize:nt,composite:We,groups:rt,show:at}=Ie,ot=we?ke:Ge,K=we?qe.map(Y=>Math.max(1,Math.round(Y*ze))):Ie.settledPixels;re[15]=ze;let de=[k,Fe,...ye,S.beam,...re,...ke],it=Math.max(0,(k-Ye)/(1-Ye)),st=b(re,ye,he);t.queue.writeBuffer(U,0,new Float32Array([...ye,e.width,e.height,k,S.beam,it,he,...re,...ot,...K,0,0,...st,...ke]));let Se=t.createCommandEncoder({label:"Crystal illumination"});(!O||de.some((Y,Me)=>Y!==O[Me]))&&(xe(Se,Ie,K,we),M(Se,"Three-prism transport",s,We,qe),rt.forEach((Y,Me)=>M(Se,"Bloom "+Me,f,Y,nt)),O=de);let Ce=Se.beginRenderPass({colorAttachments:[{view:n.getCurrentTexture().createView(),loadOp:"clear",clearValue:{r:0,g:0,b:0,a:1},storeOp:"store"}]});Ce.setPipeline(g),Ce.setBindGroup(0,at),Ce.draw(3),Ce.end(),t.queue.submit([Se.finish()]),k>.75&&R?.frame(_,ye)},destroy(){R?.destroy(),w.abort(),u.forEach(_=>_.destroy())}}}catch(U){throw w.abort(),u.forEach(H=>H.destroy()),U}}var Ze=class{constructor(e,n,r,a){this.canvas=e,this.options=n,this.onFrame=r,this.onFallback=a,this.paused=!1,this.time=0,this.request=0,this.inFlight=0,this.failed=!1,this.fit=new ResizeObserver(()=>this.invalidate()),this.fit.observe(e),document.addEventListener("visibilitychange",()=>this.invalidate())}async start(){try{let e=await navigator.gpu?.requestAdapter();if(!e)throw new Error("No WebGPU adapter");let n=await e.requestDevice();this.device=n,n.lost.then(l=>this.fallback(l.message));let r=this.canvas.getContext("webgpu");if(!r)throw new Error("WebGPU canvas unavailable");let a=navigator.gpu.getPreferredCanvasFormat();r.configure({device:n,format:a,alphaMode:"opaque"}),this.resize();let i=await dn({device:n,canvas:this.canvas,context:r,format:a,...this.options});this.failed?i.destroy():(this.scene=i,this.invalidate())}catch(e){this.fallback(e.message)}}fallback(e){this.failed||(this.failed=!0,cancelAnimationFrame(this.request),this.fit.disconnect(),this.scene?.destroy(),this.scene=null,this.device?.destroy(),this.onFallback(e))}dispose(){this.failed=!0,cancelAnimationFrame(this.request),this.request=0,this.fit.disconnect(),this.scene?.destroy(),this.scene=null,this.device?.destroy()}resize(){let{canvas:e,device:n}=this,r=Math.max(1,e.clientWidth),a=Math.max(1,e.clientHeight),i=Math.min(devicePixelRatio||1,2,n.limits.maxTextureDimension2D/Math.max(r,a)),l=Math.max(1,Math.round(r*i)),d=Math.max(1,Math.round(a*i));e.width!==l&&(e.width=l),e.height!==d&&(e.height=d)}invalidate(){!this.request&&this.scene&&!document.hidden&&(this.last=performance.now(),this.request=requestAnimationFrame(e=>this.draw(e)))}draw(e){if(this.request=0,!(!this.scene||document.hidden)){if(this.inFlight>=2){this.request=requestAnimationFrame(n=>this.draw(n));return}this.resize(),this.paused||(this.time+=Math.max(0,(e-this.last)/1e3)),this.last=e;try{this.scene.frame(this.time);let n=performance.now(),r=++this.inFlight,a=()=>{this.inFlight--,this.scene?.reportFrameCost((performance.now()-n)/r)};this.device.queue.onSubmittedWorkDone().then(a,a),this.onFrame(this.time)}catch(n){this.fallback(n.message);return}this.paused||(this.request=requestAnimationFrame(n=>this.draw(n)))}}};var vt="unsloth/Qwen4-35B-A3B-GGUF",or=[["Q2_K_XL",[16161538144,11520258240],486792192]],fn="Q2_K_XL",Je=or.map(([t,e,n=0])=>{let r="Qwen4-35B-A3B-UD-"+t,a=String(e.length).padStart(5,"0"),i=e.length===1?[{filename:r+".gguf",quant:t,bytes:e[0]}]:e.map((l,d)=>({filename:`UD-${t}/${r}-${String(d+1).padStart(5,"0")}-of-${a}.gguf`,quant:t,bytes:l}));return{quant:t,filename:i[0].filename,files:i,bytes:e.reduce((l,d)=>l+d,0),unreadBytes:n}}),un="F16",et=[["F16",899283072]].map(([t,e])=>({filename:"mmproj-"+t+".gguf",precision:t,bytes:e}));var X=t=>document.getElementById(t),ge=t=>(t/1e9).toFixed(2)+" GB",ir=t=>t.toLocaleString("en-US")+" bytes",pn={checking:"Checking local cache",downloading:"Downloading model",preparing:"Preparing WebGPU",ready:"Model ready",error:"Load interrupted"};function mn(){let t=X("model-quant"),e=X("model-projector"),n=X("addons"),r=X("model-selection"),a=X("model-transfer"),i=X("model-load"),l=X("transfer-back"),d=a.querySelector('[role="progressbar"]'),b=null,p=u=>u.filename+" \xB7 "+ir(u.bytes);function m(u,c,h){let x=new Option(c,h.filename);x.title=(h.files??[h]).map(p).join(``),u.add(x)}let s=u=>u.unreadBytes?`The `+ge(u.unreadBytes)+" multi-token-prediction block is not downloaded. The n-gram table is kept on this device, so no row is fetched while generating.":"";for(let u of Je)m(t,"Qwen4-35B-A3B \xB7 "+u.quant+" \xB7 "+ge(u.bytes-u.unreadBytes),u),t.options[t.options.length-1].title+=s(u);t.value=Je.find(u=>u.quant===fn).filename;for(let u of et)m(e,u.precision+" \xB7 "+ge(u.bytes),u);e.value=et.find(u=>u.precision===un).filename;function f(){let u=Je.find(E=>E.filename===t.value),c=[...u.files],h=et.find(E=>E.filename===e.value);h&&c.push(h);let x=c.reduce((E,w)=>E+w.bytes,0)-u.unreadBytes;return{model:u,files:c,downloadBytes:x}}function g(){let{model:u,files:c,downloadBytes:h}=f(),x=ge(h)+" download";X("model-size").textContent=x,X("addons-total").textContent=x,X("model-size").title=c.map(p).join(``)+s(u),X("addons-open").textContent=e.value?"Add-ons (1)":"Add-ons"}for(let u of[t,e])u.addEventListener("change",g);X("addons-open").onclick=()=>n.showModal(),X("addons-close").onclick=X("addons-done").onclick=()=>n.close(),g();function y(u){i.disabled=!0,i.firstChild.textContent="Unavailable ";let c=X("model-note");c.textContent=u,c.hidden=!1}function L(u=!1){let c=b;b=null,c?.abort(),a.hidden=!0,r.inert=!1,u&&i.focus({preventScroll:!0})}return l.onclick=()=>L(!0),i.onclick=()=>{let u=f(),c=new AbortController;b=c,r.inert=!0,a.hidden=!1,d.hidden=!1,l.title=l.ariaLabel="Cancel loading",l.focus({preventScroll:!0});let h=!1;function x(S,B,N,P){let O=X("transfer-phase");O.textContent!==S&&(O.textContent=S),X("transfer-value").textContent=N,O.title=P,d.setAttribute("aria-valuetext",P),B===null?d.removeAttribute("aria-valuenow"):d.setAttribute("aria-valuenow",String(Math.floor(100*B))),d.style.setProperty("--fraction",B??0)}let E=u.model.quant+" \xB7 "+ge(u.downloadBytes);function w({phase:S,loadedBytes:B,totalBytes:N=u.downloadBytes,message:P}={}){if(b!==c||h||!Object.hasOwn(pn,S))return;let O=null,ae=P||E,oe="";if(S==="ready")O=1;else if(Number.isFinite(B)&&Number.isFinite(N)&&N>0){let D=Math.max(0,Math.min(B,N));O=D/N,oe=(D/1e9).toFixed(2)+" of "+ge(N)+" \xB7 "+Math.floor(O*100)+"%",ae=P||ge(D)+" of "+ge(N)}x(S==="error"&&P?P:pn[S],O,oe,ae),a.toggleAttribute("data-error",S==="error"),(S==="ready"||S==="error")&&(h=!0,b=null,l.title=l.ariaLabel="Back to models",d.hidden=S==="error")}w({phase:"checking"}),window.dispatchEvent(new CustomEvent("qwen:load-model",{detail:{...u,signal:c.signal,report:w}}))},{block:y}}var sr={"&":"&","<":"<",">":">",'"':""","'":"'"};function _e(t){return String(t).replace(/[&<>"']/g,e=>sr[e])}function lr(t){return t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/`([^`]+?)`/g,"<code>$1</code>")}function cr(t){let e=document.createElement("template");return e.innerHTML=t,e.content.querySelectorAll("script,style,iframe,object,embed,link,meta,form").forEach(n=>n.remove()),e.content.querySelectorAll("*").forEach(n=>{for(let r of[...n.attributes]){let a=r.name.toLowerCase();(a.startsWith("on")||(a==="href"||a==="src")&&/^\s*(javascript|data):/i.test(r.value))&&n.removeAttribute(r.name)}}),e.innerHTML}function vn(t){return/cannot run on this GPU\/browser|maxBufferSize|storage buffers per shader stage|WebGPU isn't available/i.test(t)}var dr=new Set(["fn","let","var","const","const_assert","struct","if","else","for","loop","return","break","continue","switch","case","default","while","override","enable","requires","discard","alias","true","false","workgroup","storage","uniform","function","private","read","write","read_write","bitcast"]),fr=new Set(["u32","i32","f32","f16","bool","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat2x3","mat3x2","mat2x4","mat4x2","mat3x4","mat4x3","array","atomic","ptr","sampler"]),hn=/(\/\/[^\n]*|\/\*[\s\S]*?\*\/)|(@[A-Za-z_]\w*)|([A-Za-z_]\w*)|(\d[\w.]*)|(\s+)|([\s\S])/g;function ur(t){let e="";hn.lastIndex=0;let n;for(;n=hn.exec(t);){let[r,a,i,l,d,b]=n;if(a)e+=`<span class="k-cm">${_e(a)}</span>`;else if(i)e+=`<span class="k-at">${_e(i)}</span>`;else if(l){let p=dr.has(l)?"k-kw":fr.has(l)?"k-ty":null;e+=p?`<span class="${p}">${l}</span>`:_e(l)}else d?e+=`<span class="k-nu">${_e(d)}</span>`:b?e+=b:e+=_e(r)}return e}var pr={sub:t=>`${t} WGSL compute shaders \xB7 running on your GPU`,emptyLoaded:"No kernels compiled yet \u2014 send a message first.",emptyUnloaded:"Load the model to inspect its compiled kernels.",lines:t=>`${t} lines`,copy:"Copy",copied:"Copied"},mr='<span class="kx-spark-ring"></span><span class="kx-spark-core"></span><svg class="kx-spark-icon" viewBox="0 0 20 20" fill="currentColor"><path d="M11.7858 1.66699C11.9437 1.66699 12.0957 1.72951 12.2074 1.84115C12.3189 1.95276 12.3815 2.10483 12.3815 2.2627V3.45247H15.3568C15.6725 3.45247 15.9767 3.57757 16.1999 3.80078C16.4231 4.02403 16.5482 4.32813 16.5482 4.64388V7.61914H17.738C17.8957 7.61914 18.0479 7.68181 18.1595 7.79329C18.2712 7.90491 18.3337 8.05698 18.3337 8.21484C18.3336 8.37247 18.2709 8.52323 18.1595 8.63477C18.0478 8.7464 17.8958 8.81055 17.738 8.81055H16.5482V11.1901H17.738C17.8958 11.1901 18.0478 11.2543 18.1595 11.3659C18.2709 11.4774 18.3336 11.6282 18.3337 11.7858C18.3337 11.9437 18.2712 12.0957 18.1595 12.2074C18.0479 12.3188 17.8957 12.3815 17.738 12.3815H16.5482V15.3568C16.5482 15.6725 16.4231 15.9767 16.1999 16.1999C15.9767 16.4231 15.6725 16.5482 15.3568 16.5482H12.3815V17.738C12.3815 17.8959 12.3188 18.0479 12.2074 18.1595C12.0957 18.271 11.9437 18.3337 11.7858 18.3337C11.6282 18.3336 11.4774 18.2707 11.3659 18.1595C11.2543 18.0478 11.1901 17.896 11.1901 17.738V16.5482H8.81055V17.738C8.81055 17.896 8.7464 18.0478 8.63477 18.1595C8.52323 18.2707 8.37247 18.3336 8.21484 18.3337C8.05698 18.3337 7.90491 18.271 7.79329 18.1595C7.68181 18.0479 7.61914 17.8958 7.61914 17.738V16.5482H4.64388C4.32813 16.5482 4.02403 16.4231 3.80078 16.1999C3.57756 15.9767 3.45247 15.6725 3.45247 15.3568V12.3815H2.2627C2.10485 12.3815 1.95276 12.3189 1.84115 12.2074C1.72951 12.0957 1.66699 11.9437 1.66699 11.7858C1.66708 11.6283 1.72987 11.4774 1.84115 11.3659C1.95276 11.2543 2.10483 11.1901 2.2627 11.1901H3.45247V8.81055H2.2627C2.10483 8.81055 1.95276 8.7464 1.84115 8.63477C1.72987 8.52324 1.66704 8.37243 1.66699 8.21484C1.66699 8.05698 1.72951 7.90491 1.84115 7.79329C1.95275 7.68175 2.1049 7.61914 2.2627 7.61914H3.45247V4.64388C3.45247 4.32813 3.57751 4.02403 3.80078 3.80078C4.02403 3.57753 4.32813 3.45247 4.64388 3.45247H7.61914V2.2627C7.61914 2.10488 7.68175 1.95275 7.79329 1.84115C7.90491 1.72951 8.05698 1.66699 8.21484 1.66699C8.37243 1.66704 8.52324 1.72987 8.63477 1.84115C8.7464 1.95276 8.81055 2.10481 8.81055 2.2627V3.45247H11.1901V2.2627C11.1901 2.10481 11.2543 1.95276 11.3659 1.84115C11.4774 1.72987 11.6283 1.66708 11.7858 1.66699ZM6.14616 5.31445C5.6863 5.31489 5.31445 5.68782 5.31445 6.14779V13.8529C5.31445 14.3131 5.68755 14.6862 6.14779 14.6862H13.8529C14.3131 14.6862 14.6862 14.3131 14.6862 13.8529V6.14779C14.6862 5.68755 14.3131 5.31445 13.8529 5.31445H6.14616Z" fill-opacity="0.4"></path><rect x="5.31348" y="5.31445" width="9.37256" height="9.37256" rx="0.833333" fill-opacity="0.15"></rect><path d="M8.19238 7.91225V12.254C8.19238 12.585 8.55699 12.7862 8.83777 12.606L12.2491 10.4351C12.3088 10.3973 12.358 10.3451 12.3921 10.2831C12.4262 10.2212 12.4441 10.1517 12.4441 10.081C12.4441 10.0103 12.4262 9.9408 12.3921 9.87889C12.358 9.81697 12.3088 9.76468 12.2491 9.72688L8.83777 7.56022C8.77456 7.51934 8.70149 7.49627 8.62626 7.49346C8.55103 7.49064 8.47644 7.50819 8.41035 7.54423C8.34426 7.58028 8.28913 7.6335 8.25077 7.69827C8.2124 7.76304 8.19223 7.83697 8.19238 7.91225Z" fill-opacity="0.8"></path></svg>',hr={title:"What are Kernels?",lead:"Kernels are the low-level GPU programs that do the model's actual math \u2014 the matrix multiplications, attention, and normalization behind every token. And how well they're optimized can dramatically speed up inference.",points:["<b>WebGPU & WGSL.</b> Each kernel is a WebGPU compute shader, written in WGSL \u2014 the language that runs general-purpose math on the GPU \u2014 entirely locally in your browser.","<b>Measured optimization.</b> Kernel variants are tested for correctness and benchmarked on the workloads they serve.","<b>Local inference.</b> Model execution stays on the device through WebGPU."],hint:"Select a kernel to read its real source",sparkHtml:mr};function vr(t,e){let n={...hr,...e},r=document.createElement("div");r.innerHTML=`<div class="kx" id="kernelsOverlay" hidden> <div class="kx-backdrop" data-close></div> <div class="kx-panel" role="dialog" aria-modal="true" aria-label="Rendered kernels"> <div class="kx-head"> <div class="kx-title"> <h3>Kernels</h3> <span class="kx-sub" id="kxSub"></span> </div> <button class="kx-close" id="kxClose" type="button" aria-label="Close" data-close> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6 6 18"/></svg> </button> </div> <div class="kx-body"> <div class="kx-side"><div class="kx-list" id="kxList"></div></div> <div class="kx-view"> <div class="kx-intro" id="kxIntro"> <div class="kx-intro-inner"> <div class="kx-spark" aria-hidden="true">${n.sparkHtml}</div> <h2 class="kx-intro-title">${n.title}</h2> <p class="kx-intro-lead">${n.lead}</p> <ul class="kx-points">${n.points.map(i=>`<li>${i}</li>`).join("")}</ul> <div class="kx-intro-hint">${n.hint}</div> </div> </div> <div class="kx-source" id="kxSource" hidden> <div class="kx-view-head"> <span class="kx-name" id="kxName"></span> <div class="kx-view-actions"> <span class="kx-lines" id="kxLines"></span> <button class="kx-copy" id="kxCopy" type="button">${t.copy}</button> </div> </div> <pre class="kx-code"><code id="kxCode"></code></pre> </div> </div> </div> </div></div>`;let a=r.firstElementChild;return document.body.appendChild(a),a}function gn(t){let e=s=>document.getElementById(s),n={...pr,...t.labels},r=e("kernelsOverlay")??vr(n,t.intro),a=[],i="";function l(){let s=t.getModel();a=s?s.renderedShaders():[],t.filterKernels&&(a=a.filter(t.filterKernels)),t.sortKernels&&(a=[...a].sort(t.sortKernels));let f=e("kxList");f.replaceChildren(),e("kxSub").textContent=a.length?n.sub(a.length):s?n.emptyLoaded:n.emptyUnloaded,a.forEach((g,y)=>{let L=document.createElement("button");L.className="kx-item",L.type="button",L.textContent=g.name,L.addEventListener("click",()=>b(y)),f.appendChild(L)}),e("kxSource").hidden=!0,e("kxIntro").hidden=!1,i="",t.onListed?.(a,f),r.hidden=!1,document.body.classList.add("kx-locked"),f.scrollTop=0,requestAnimationFrame(d)}function d(){let s=e("kxList"),f=s.scrollHeight<=s.clientHeight+4||s.scrollTop>=s.scrollHeight-s.clientHeight-4;s.parentElement?.classList.toggle("at-end",f)}function b(s){let f=a[s];f&&(e("kxIntro").hidden=!0,e("kxSource").hidden=!1,[...e("kxList").children].forEach((g,y)=>g.classList.toggle("active",y===s)),e("kxName").textContent=t.formatName?t.formatName(f):f.name,e("kxLines").textContent=n.lines(f.source.split(``).length),e("kxCode").innerHTML=ur(f.source),e("kxCode").parentElement.scrollTop=0,i=f.source)}function p(){r.hidden=!0,document.body.classList.remove("kx-locked")}async function m(){if(i)try{await navigator.clipboard.writeText(i),e("kxCopy").textContent=n.copied,setTimeout(()=>{e("kxCopy").textContent=n.copy},1200)}catch{}}return r.addEventListener("click",s=>{s.target.closest("[data-close]")&&p()}),e("kxList").addEventListener("scroll",d,{passive:!0}),e("kxCopy").addEventListener("click",()=>{m()}),document.addEventListener("keydown",s=>{s.key==="Escape"&&!r.hidden&&p()}),{open:l}}var gr=/^(P|UL|OL|LI|BLOCKQUOTE|H[1-6]|PRE|CODE|EM|STRONG)$/;function xn(t={}){let e=t.caretClassName??"caret",n=null,r=null,a=new Map,i=null,l=null,d=!1,b=0;function p(c,h){let x=(h?"d:":"i:")+c,E=a.get(x);if(E===void 0){try{E=r.renderToString(c.trim(),{throwOnError:!1,displayMode:h})}catch{E=_e(c)}a.set(x,E)}return E}function m(c,h){let x=p(c,h);return i?`<!--katex:${i.push(x)-1}-->`:x}function s(){let c={name:"katexInline",level:"inline",start(w){return w.match(/\\\(/)?.index},tokenizer(w){let S=/^\\\(([\s\S]+?)\\\)/.exec(w);if(S)return{type:"katexInline",raw:S[0],text:S[1]}},renderer(w){return m(w.text,!1)}},h={name:"katexBlock",level:"inline",start(w){return w.match(/\\\[/)?.index},tokenizer(w){let S=/^\\\[([\s\S]+?)\\\]/.exec(w);if(S)return{type:"katexBlock",raw:S[0],text:S[1]}},renderer(w){return m(w.text,!0)}};return t.dollarMath?{extensions:[{name:"katexDollarBlock",level:"inline",start(w){return w.match(/\$\$/)?.index},tokenizer(w){let S=/^\$\$([\s\S]+?)\$\$/.exec(w);if(S)return{type:"katexDollarBlock",raw:S[0],text:S[1]}},renderer(w){return m(w.text,!0)}},h,c,{name:"katexDollarInline",level:"inline",start(w){return w.match(/\$/)?.index},tokenizer(w){let S=/^\$(?!\s|\$)((?:\\.|[^\\$\n])+?)(?<!\s)\$(?!\d)/.exec(w);if(S)return{type:"katexDollarInline",raw:S[0],text:S[1]}},renderer(w){return m(w.text,!1)}}]}:{extensions:[c,h]}}function f(){if(document.querySelector("link[data-katex]"))return;let c=document.createElement("link");c.rel="stylesheet",c.href="https://cdn.jsdelivr.net/npm/katex@0.16/dist/katex.min.css",c.dataset.katex="1",document.head.appendChild(c)}function g(c){let h=-1;for(let[x,E]of[["\\[","\\]"],["\\(","\\)"]]){let w=c.lastIndexOf(x);w!==-1&&c.indexOf(E,w+x.length)===-1&&(h===-1||w<h)&&(h=w)}if(t.dollarMath){if((c.split("$$").length-1)%2===1){let S=c.lastIndexOf("$$");(h===-1||S<h)&&(h=S)}let E=h===-1?c:c.slice(0,h),w=/\$(?![\s\d$])[^$\n]*$/.exec(E);w&&E.split("$").length%2===0&&(h===-1||w.index<h)&&(h=w.index)}return h===-1?c:c.slice(0,h)}function y(c){let h=document.createElement("span");if(h.className=e,!t.caretDescend){(c.querySelector("p:last-of-type")??c).appendChild(h);return}let x=c;for(;;){let E=x.lastChild;for(;E&&E.nodeType===Node.TEXT_NODE&&!E.textContent?.trim();)E=E.previousSibling;if(!E||E.nodeType!==Node.ELEMENT_NODE||!gr.test(E.tagName))break;x=E}x.appendChild(h)}function L(c,h,x){let E=x&&r?g(h||""):h||"";if(n)try{i=[];let B=cr(n.parse(E));i.length&&(B=B.replace(/<!--katex:(\d+)-->/g,(N,P)=>i?.[+P]??"")),c.innerHTML=B,x&&y(c);return}catch{}finally{i=null}let S=_e(E).split(/\n{2,}/).map(B=>B.trim()).filter(Boolean);c.innerHTML=S.map(B=>`<p>${lr(B).replace(/\n/g,"<br>")}</p>`).join(""),x&&y(c)}function u(c,h){if(l={el:c,raw:h},d)return;d=!0;let x=t.streamRenderMs??0,E=()=>{if(!l){d=!1;return}if(x>0&&performance.now()-b<x){requestAnimationFrame(E);return}d=!1,b=performance.now(),L(l.el,l.raw,!0),t.onRendered?.()};requestAnimationFrame(E)}return{useMarked(c){n=c.marked,n.use({gfm:!0,breaks:!0})},useKatex(c){r=c.default??c,n?.use(s()),t.injectKatexCss&&f()},render:L,schedule:u,cancel(){l=null}}}var xt=new URLSearchParams(location.search),gt=xt.get("src"),xr=Math.max(512,Number(xt.get("ctx"))||8192),br=2048,bn=import("./Qwen4MoeForConditionalGeneration.js"),q=t=>document.getElementById(t);function yn({panel:t,leaveLanding:e}){let n=null;if(!navigator.gpu)t.block("WebGPU is not available in this browser.");else{let o={file:q("model-quant").value,mmproj:q("model-projector").value};bn.then(({Qwen4MoeForConditionalGeneration:v})=>v.checkAvailability(gt??vt,r(o))).then(v=>{!n&&!v.ok&&v.reason&&t.block(v.reason)}).catch(()=>{})}function r({file:o,mmproj:v}){return{...gt?{}:{file:o},mmproj:v,maxLength:xr,...xt.has("nocache")?{cache:!1}:{}}}window.addEventListener("qwen:load-model",o=>{let{model:v,files:C,signal:M,report:T}=o.detail,R=C.find(A=>A.filename.startsWith("mmproj-"))?.filename??null;a({file:v.filename,mmproj:R},v.quant,M,T)});async function a(o,v,C,M){let T=0,R=A=>{C.aborted||(A.kind==="bytes"&&typeof A.fraction=="number"?(T=A.fraction,M({phase:"downloading",loadedBytes:A.loaded,totalBytes:A.total})):A.status!=="ready"&&!(T>0&&T<1)&&M({phase:A.status==="weights"||T>=1?"preparing":"checking",message:A.message}))};try{let{Qwen4MoeForConditionalGeneration:A}=await bn,z=await A.from_pretrained(gt??vt,{...r(o),signal:C,onProgress:R});if(C.aborted){await z.dispose();return}n=z,M({phase:"ready"}),q("chat-quant").textContent="UD-"+v,z.lost.then(G=>{n===z&&(D("error",`${G.message} \xB7 reload the page to start again`),F(!1))}),setTimeout(i,500)}catch(A){if(C.aborted||A?.name==="AbortError")return;console.error(A);let z=String(A?.message??A);M({phase:"error",message:vn(z)?"This device cannot run the model: "+z:z})}}function i(){e(),l.hidden=!1,document.body.classList.add("chatting");let o=n.deviceInfo();D("ready",`Ready \xB7 ${n.contextLength.toLocaleString("en-US")}-token context \xB7 ${o.vendor||"GPU"} ${o.architecture||""}`.trim()),F(!0),p.placeholder="Ask anything, or attach an image\u2026",p.focus()}let l=q("chat"),d=q("thread"),b=q("threadScroll"),p=q("input"),m=q("sendBtn"),s=q("stopBtn"),f=q("clearBtn"),g=q("attachBtn"),y=q("thinkBtn"),L=q("fileInput"),u=q("attachments"),c=q("liveStat"),h=q("hint"),x=h.textContent,E=xn({dollarMath:!0,injectKatexCss:!0,streamRenderMs:50});import("https://esm.sh/marked@17").then(o=>(E.useMarked(o),import("https://esm.sh/katex@0.16").then(v=>E.useKatex(v)).catch(()=>{}))).catch(()=>{});let w=null,S=[],B=[],N=[],P=null,O=!0;d.replaceChildren(oe());let ae=Z(b,d);function oe(){let o=document.createElement("div");o.className="welcome",o.id="welcome",o.innerHTML=` <h2>What can I <span class="thin">help with?</span></h2> <p>Qwen 4 runs entirely on your GPU. Attach, paste or drop an image to ask about it.</p> <div class="seeds"></div>`;let v=[{label:"Explain mixture-of-experts",prompt:"Explain how a mixture-of-experts language model works, and why only a few experts run per token."},{label:"Write a WGSL kernel",prompt:"Write a WGSL compute shader that adds two arrays of f32 element-wise, with a short explanation."},{label:"Plan a trip",prompt:"Plan a three-day trip to Kyoto in autumn, with one highlight per morning, afternoon and evening."}];return o.querySelector(".seeds").replaceChildren(...v.map(({label:C,prompt:M})=>{let T=document.createElement("button");return T.className="seed",T.type="button",T.textContent=C,T.disabled=!n,T.addEventListener("click",()=>{!n||P||(p.value=M,ie())}),T})),o}function D(o,v){q("status").className="status"+(o?" "+o:""),q("statusText").textContent=v}function F(o){for(let v of[p,g,y,f])v.disabled=!o;document.querySelectorAll(".seed").forEach(v=>{v.disabled=!o}),W()}function W(){m.disabled=!n||!!P||p.value.trim()===""&&B.length===0}function Z(o,v){let C=!0,M=o.scrollTop,T=()=>{o.scrollTop=o.scrollHeight,M=o.scrollTop},R=()=>{let z=o.scrollTop,G=o.scrollHeight-o.clientHeight-z;z<M&&G>1?C=!1:G<=24&&(C=!0),M=z},A=new ResizeObserver(()=>{C&&T()});return o.addEventListener("scroll",R,{passive:!0}),A.observe(v),A.observe(o),{resume(){C=!0,T()},stop(){A.disconnect(),o.removeEventListener("scroll",R)}}}function U(){p.style.height="auto",p.style.height=`${Math.min(p.scrollHeight,180)}px`}async function H(o){if(!(!n||P)){for(let v of o){if(!v.type.startsWith("image/"))continue;let C;try{C=await createImageBitmap(v,{imageOrientation:"from-image"})}catch(k){D("error",`Could not read ${v.name}: ${k?.message??k}`);continue}let M=Math.min(1,br/Math.max(C.width,C.height)),T=Math.max(1,Math.round(C.width*M)),R=Math.max(1,Math.round(C.height*M)),z=new OffscreenCanvas(T,R).getContext("2d",{willReadFrequently:!0});z.drawImage(C,0,0,T,R),C.close();let G=z.getImageData(0,0,T,R),_=URL.createObjectURL(v);B.push({pixels:G,url:_})}V(),W()}}function V(){u.hidden=B.length===0,u.replaceChildren(...B.map((o,v)=>{let C=document.createElement("div");C.className="attachment";let M=document.createElement("img");M.src=o.url,M.alt="";let T=document.createElement("button");return T.type="button",T.className="attachment-remove",T.setAttribute("aria-label","Remove image"),T.textContent="\xD7",T.addEventListener("click",()=>{URL.revokeObjectURL(o.url),B.splice(v,1),V(),W()}),C.append(M,T),C}))}g.addEventListener("click",()=>L.click()),L.addEventListener("change",()=>{let o=[...L.files];L.value="",H(o)}),document.addEventListener("paste",o=>{let v=[...o.clipboardData?.files??[]].filter(C=>C.type.startsWith("image/"));v.length===0||l.hidden||(o.preventDefault(),H(v))}),l.addEventListener("dragover",o=>{n&&(o.preventDefault(),l.classList.add("dropping"))}),l.addEventListener("dragleave",o=>{l.contains(o.relatedTarget)||l.classList.remove("dropping")}),l.addEventListener("drop",o=>{o.preventDefault(),l.classList.remove("dropping"),H([...o.dataTransfer?.files??[]])}),y.addEventListener("click",()=>{O=!O,y.setAttribute("aria-pressed",String(O))}),p.addEventListener("input",()=>{U(),W()}),p.addEventListener("keydown",o=>{o.key==="Enter"&&!o.shiftKey&&!o.isComposing&&(o.preventDefault(),m.disabled||ie())}),m.addEventListener("click",()=>{ie()}),s.addEventListener("click",()=>P?.cancel()),f.addEventListener("click",()=>{if(!P){w?.reset(),S=[];for(let o of N.splice(0))URL.revokeObjectURL(o);d.replaceChildren(oe()),p.focus()}});function J(o){p.disabled=o,f.disabled=o,g.disabled=o,m.style.display=o?"none":"",s.style.display=o?"grid":"none",h.textContent=o?"Generating on your GPU\u2026":x,o||(c.textContent=""),W()}async function ie(){let o=p.value.trim();if(!n||P||!o&&B.length===0)return;w??=n.create_session(),q("welcome")?.remove();let v=B.splice(0);V(),p.value="",U(),N.push(...v.map(k=>k.url)),ae.resume(),ve(o,v.map(k=>k.url));let C=v.length===0?o:[...v.map(({pixels:k})=>({type:"image",image:k})),...o?[{type:"text",text:o}]:[]],M=S.length;S.push({role:"user",content:C});let T=fe(),R="",A="",z=0,G=0,_=P=w.generate(S,{enable_thinking:O});J(!0),D("loading",v.length?"Reading the image\u2026":"Reading the prompt\u2026");try{for await(let I of _){if(I.type==="prefill"){D("loading",`Reading the prompt \xB7 ${I.done.toLocaleString("en-US")} / ${I.total.toLocaleString("en-US")} tokens`);continue}I.type==="reasoning"?(A||(z=performance.now(),T.showReasoning(),D("busy","Thinking\u2026")),A+=I.text,T.reasoningText.textContent=A):I.type==="text"&&(R||(A&&T.finishReasoning(performance.now()-z),D("busy","Answering\u2026")),R+=I.text,E.schedule(T.bubble,R));let j=performance.now();j-G>150&&_.completion_tokens>1&&(G=j,c.textContent=`${_.timings.tokens_per_second.toFixed(1)} tok/s`)}let k=await _.result;E.cancel(),E.render(T.bubble,R,!1),T.meta(k),k.finish_reason==="cancelled"?T.element.classList.add("stopped"):S.push(k.message),D("ready","Ready \xB7 on-device")}catch(k){console.error(k),S.length=M,E.cancel();let I=k?.name==="ContextOverflowError"?`This conversation needs ${k.required} tokens; the context holds ${k.capacity}. Start a new chat.`:String(k?.message??k);E.render(T.bubble,R,!1),T.error(I),D("error","Stopped by an error")}finally{A&&!R&&T.finishReasoning(performance.now()-z),P=null,J(!1),p.focus()}}function se(o){let v=document.createElement("div");return v.className="role",v.textContent=o,v}function ve(o,v){let C=document.createElement("div");if(C.className="msg user",C.append(se("You")),v.length){let M=document.createElement("div");M.className="msg-images";for(let T of v){let R=document.createElement("img");R.src=T,R.alt="Attached image",M.append(R)}C.append(M)}if(o){let M=document.createElement("div");M.className="bubble user",M.textContent=o,C.append(M)}d.append(C)}function fe(){let o=document.createElement("div");o.className="msg assistant",o.append(se("Qwen 4"));let v=document.createElement("details");v.className="reasoning",v.open=!0;let C=document.createElement("summary");C.textContent="Thinking\u2026";let M=document.createElement("div");M.className="reasoning-text";let T=document.createElement("div");M.append(T),v.append(C,M);let R=Z(M,T),A=document.createElement("div");return A.className="bubble assistant",A.innerHTML='<span class="thinking"><span></span><span></span><span></span></span>',o.append(A),d.append(o),{element:o,bubble:A,reasoningText:T,showReasoning(){o.insertBefore(v,A)},finishReasoning(z){C.textContent=`Thought for ${(z/1e3).toFixed(1)} s`,R.stop(),M.scrollTop=0,v.open=!1},meta({finish_reason:z,usage:G,timings:_}){let k=[`${G.completion_tokens} tokens`];G.reasoning_tokens&&k.push(`${G.reasoning_tokens} thinking`),G.image_tokens&&k.push(`${G.image_tokens} image tokens read`),k.push(`first token ${(_.ttft_ms/1e3).toFixed(2)} s`),G.completion_tokens>1&&k.push(`${_.tokens_per_second.toFixed(1)} tok/s`),z==="cancelled"?k.push("stopped"):z==="length"&&k.push("cut at the length limit");let I=document.createElement("div");I.className="meta",I.textContent=k.join(" \xB7 "),o.append(I)},error(z){let G=document.createElement("div");G.className="meta error",G.textContent=z,o.append(G)}}}let Pe=o=>{let v=o.op??"",C=v&&o.kernelId?.startsWith(`${v}.`)?o.kernelId.slice(v.length+1):"",M=C.lastIndexOf("."),T=M<0?"":C.slice(M+1);return{op:(v||o.name).replace(/^(?:[a-z][a-z0-9-]*\.)+/,""),detail:[M<0?C:C.slice(0,M),T==="main"?"":T].filter(Boolean).join(" \xB7 ")}},ue=o=>{let{op:v,detail:C}=Pe(o);return`${v} ${C}`},le=document.createElement("label");le.className="kx-filter",le.innerHTML='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4.3-4.3"/></svg><input type="search" placeholder="Search kernels" spellcheck="false" autocomplete="off" aria-label="Search kernels" /><span class="kx-filter-count"></span>';let ne=le.querySelector("input"),tt=le.querySelector(".kx-filter-count"),xe=document.createElement("p");xe.className="kx-empty",xe.textContent="No kernel matches that.";let Ge=()=>[...document.querySelectorAll("#kxList .kx-item")];function ce(){let o=ne.value.toLowerCase().split(/\s+/).filter(Boolean),v=Ge(),C=0;for(let T of v)T.hidden=!o.every(R=>T.dataset.search.includes(R)),T.hidden||(C+=1);xe.hidden=C>0,tt.textContent=o.length?`${C}/${v.length}`:"";let M=q("kxList");M.scrollTop=0,M.parentElement.classList.toggle("at-end",M.scrollHeight<=M.clientHeight+4)}ne.addEventListener("input",ce),ne.addEventListener("keydown",o=>{o.key==="Escape"&&ne.value?(o.stopPropagation(),ne.value="",ce()):o.key==="Enter"&&Ge().find(v=>!v.hidden)?.click()});let Ke=gn({getModel:()=>n,filterKernels:o=>!/\btranscode\b|\.transcode\./i.test(o.name),sortKernels:(o,v)=>ue(o).localeCompare(ue(v),"en",{numeric:!0,sensitivity:"base"}),onListed:(o,v)=>{let C=v.querySelectorAll(".kx-item");o.forEach((M,T)=>{let{op:R,detail:A}=Pe(M),z=C[T],G=document.createElement("span");if(G.className="kx-op",G.textContent=R,z.replaceChildren(G),A){let _=document.createElement("span");_.className="kx-variant",_.textContent=A.replaceAll("_","_\u200B"),z.append(_)}z.title=M.kernelId??M.name,z.dataset.search=`${R} ${A} ${M.name} ${M.kernelId??""}`.toLowerCase()}),le.isConnected||v.before(le),v.append(xe),ne.value="",ce()},formatName:o=>(o.kernelId??o.name).replace(/\.main$/,""),labels:{sub:o=>`${o} WGSL compute shaders \xB7 compiled for your GPU`},intro:{lead:"Kernels are the GPU programs that do Qwen 4's math: the hybrid attention, the routed experts, the hyper-connection mixers and the normalizations behind every token. Each one is a WGSL compute shader your browser compiled for this GPU."}});q("kernelsBtn").addEventListener("click",Ke.open)}var yt=t=>document.getElementById(t),Mn=matchMedia("(max-width: 760px), (max-aspect-ratio: 1/1)"),Ln=matchMedia("(prefers-reduced-motion: reduce)"),wn=yt("scene"),bt=document.querySelector(".hero"),kn=yt("model-panel"),yr=(t,e)=>je(t,e,Mn.matches),Sn=-1;function Cn(t,e){bt.hasAttribute("data-ready")||(bt.dataset.ready="");let n=Math.max(0,Math.min(1,(t/e-.76)/.24)),r=n*n*(3-2*n);r!==Sn&&(kn.style.setProperty("--reveal",r),kn.inert=r===0,Sn=r)}var Ae=new Ze(wn,{motionSettings:Ee,titleCanvas:yt("title-flare"),getView:yr},t=>Cn(t,Ee.duration),()=>{wn.hidden=!0,Cn(1,1)});function Tn(){Ae.paused=Ln.matches,Ae.paused&&(Ae.time=Ee.duration),Ae.invalidate()}var wr=mn();yn({panel:wr,leaveLanding(){Ae.dispose(),bt.hidden=!0}});Mn.addEventListener("change",()=>Ae.invalidate());Ln.addEventListener("change",Tn);Tn();Ae.start();123version https://git-lfs.github.com/spec/v1oid sha256:2b8f100499e99e328c5192d1dad32b19fbb4cd96dd3a98199a063cbf061b053asize 163841:root{--bg: #04060b;--t1: #f4f6ff;--t2: #b6c0da;--t3: #7d89a6;--t4: rgba(214, 226, 255, .22);--line: rgba(170, 190, 235, .16);--line-soft: rgba(170, 190, 235, .09);--panel: rgba(200, 215, 255, .035);--panel-hover: rgba(200, 215, 255, .07);--ok: #b8d5ff;--warn: #ffd58a;--danger: #ff8a7a;--user-bubble: rgba(160, 185, 255, .08);--maxw: 820px}dialog{margin:auto}#chat{position:fixed;inset:0;z-index:10;display:flex;flex-direction:column;color:var(--t1);background:radial-gradient(90% 60% at 50% 120%,#78a0ff1a,#78a0ff00 60%),radial-gradient(70% 50% at 85% -10%,#be96ff12,#be96ff00 60%),var(--bg);animation:chat-in .6s ease both}@keyframes chat-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}#chat.dropping:after{content:"Drop images to attach";position:absolute;inset:12px;display:grid;place-items:center;border:1.5px dashed var(--ok);border-radius:18px;background:#04060bd1;color:var(--t1);font-size:18px;pointer-events:none}.chat-head{flex:0 0 auto;border-bottom:1px solid var(--line-soft);background:#04060bb8;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}.chat-brand{display:flex;align-items:center;gap:10px;flex-shrink:0}.chat-model{font-weight:600;letter-spacing:-.01em}.chat-quant{padding:3px 8px;border:1px solid var(--line);border-radius:6px;color:var(--t2);font:11px/1.3 var(--mono)}.status.ready .status-dot,.status.busy .status-dot{background:var(--ok);box-shadow:0 0 10px #b8d5ff8c}.status.busy .status-dot{animation:status-pulse 1.2s ease-in-out infinite}@keyframes status-pulse{50%{opacity:.35}}.thread-scroll{flex:1 1 auto;min-height:0;overflow-y:auto}.welcome h2{margin-bottom:14px;font-size:clamp(30px,6vw,44px);font-weight:600;line-height:1.08;letter-spacing:-.025em}.welcome p{max-width:46ch;margin:0 auto 28px;color:var(--t2)}.bubble.assistant strong{color:#fff}.bubble.assistant .katex-display{overflow-x:auto;overflow-y:hidden}.msg.stopped .bubble.assistant{opacity:.6}.meta.error{color:var(--danger)}.msg-images{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-bottom:8px}.msg-images img{max-width:min(260px,70vw);max-height:200px;border:1px solid var(--line);border-radius:12px;object-fit:cover}.reasoning{margin-bottom:14px;border-left:2px solid var(--line);padding-left:14px;color:var(--t3)}.reasoning summary{cursor:pointer;font:11px/1.6 var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--t2);list-style:none}.reasoning summary::-webkit-details-marker{display:none}.reasoning summary:before{content:"▸ "}.reasoning[open] summary:before{content:"▾ "}.reasoning-text{margin-top:8px;max-height:320px;overflow-y:auto;white-space:pre-wrap;font-size:14px;line-height:1.6}.composer-wrap{flex:0 0 auto;padding-top:8px;background:linear-gradient(rgba(4,6,11,0),var(--bg) 30%)}.field{grid-template-columns:42px 1fr auto 42px;align-items:end;padding:8px}.attach-button{color:var(--t2)}.attach-button:hover:not(:disabled){color:var(--t1);background:var(--panel-hover)}.send-button{background:linear-gradient(125deg,#fcfcff,#cbdcff);color:#0b152a}.think-toggle{align-self:center;padding:7px 12px;border:1px solid var(--line);border-radius:100px;color:var(--t3);font:11px/1 var(--mono);letter-spacing:.08em;text-transform:uppercase;transition:color .2s ease,border-color .2s ease,background .2s ease}.think-toggle[aria-pressed=true]{color:var(--ok);border-color:#b8d5ff73;background:#b8d5ff14}.think-toggle:disabled{opacity:.35;cursor:not-allowed}.attachments{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}.attachment{position:relative}.attachment img{display:block;width:64px;height:64px;border:1px solid var(--line);border-radius:10px;object-fit:cover}.attachment-remove{position:absolute;top:-7px;right:-7px;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:#1b2233;border:1px solid var(--line);color:var(--t1);font-size:14px;line-height:1}.kx-title h3{font-size:24px;font-weight:600;line-height:1;letter-spacing:-.01em;color:#fff}.kx-intro-title{margin-bottom:16px;font-size:clamp(26px,3vw,32px);font-weight:600;line-height:1.12;letter-spacing:-.015em;color:#fff}.kx-intro-lead{max-width:48ch;margin:0 auto 26px;font-size:14.5px;line-height:1.7;color:var(--t2)}.kx-body{grid-template-columns:300px 1fr}.kx-side{display:flex;flex-direction:column}.kx-list{flex:1;height:auto;min-height:0}.kx-filter{display:flex;align-items:center;gap:8px;flex-shrink:0;height:36px;margin:10px 10px 0;padding:0 11px;border:1px solid var(--line);border-radius:9px;background:var(--panel);color:var(--t3);cursor:text;transition:border-color .15s ease,color .15s ease}.kx-filter:focus-within{border-color:#ffffff59;color:var(--t1)}.kx-filter svg{width:14px;height:14px;flex-shrink:0}.kx-filter input{flex:1;min-width:0;height:100%;border:0;outline:0;background:none;color:var(--t1);font:12.5px/1 var(--mono)}.kx-filter input::placeholder{color:var(--t4)}.kx-filter input::-webkit-search-cancel-button{display:none}.kx-filter-count{flex-shrink:0;font:11px/1 var(--mono);color:var(--t4)}.kx-item{white-space:normal}.kx-item[hidden],.kx-empty[hidden]{display:none}.kx-op{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kx-variant{display:block;margin-top:1px;font-size:11px;color:var(--t3);transition:color .15s ease}.kx-item:hover .kx-variant,.kx-item.active .kx-variant{color:var(--t2)}.kx-empty{padding:14px 12px;font-size:12.5px;color:var(--t3)}@media(max-width:640px){.kx-body{grid-template-columns:minmax(0,42%) 1fr}.chat-head-inner{padding:12px 16px;gap:10px}.chat-model,.chat-quant{display:none}.thread{padding:28px 16px 20px}.composer{padding:0 16px 16px}.head-btn{padding:8px 12px}}12345678910111213141516171823456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171<!doctype html><html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>My static Space</title> <link rel="stylesheet" href="style.css" /> </head> <body> <div class="card"> <h1>Welcome to your static Space!</h1> <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p> <p> Also don't forget to check the <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>. </p> </div> </body><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><meta name="theme-color" content="#000000" /><metaname="description"content="Run Qwen 4 locally in your browser with WebGPU."/><style>html{background:#000}.hero:not([data-ready]){visibility:hidden;opacity:0}</style><title>Qwen 4 WebGPU</title><link rel="icon" href="./assets/qwen.svg" /><linkrel="preload"as="font"type="font/woff2"href="./assets/geist.woff2"crossorigin/><link rel="stylesheet" href="./_shared/chat-page.css" /><link rel="stylesheet" href="./style.css" /><link rel="stylesheet" href="./model-panel.css" /><link rel="stylesheet" href="./chat.css" /></head><body><main class="hero" aria-labelledby="crystal-title"><div class="visual" aria-hidden="true"><canvas id="scene"></canvas></div><section inert id="model-panel" aria-labelledby="crystal-title"><h1 id="crystal-title"><imgsrc="./assets/flare-wordmark.svg"alt="Qwen 4"width="1000"height="263"/><canvas id="title-flare" aria-hidden="true"></canvas></h1><p class="model-intro">Run Qwen 4 locally in your browser with WebGPU.</p><div class="model-controls"><div id="model-selection"><div class="model-labels"><label for="model-quant">Model</label><button type="button" id="addons-open" aria-haspopup="dialog">Add-ons</button></div><div class="model-select-wrap"><select id="model-quant" aria-describedby="model-size"></select><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></div><div class="model-action-row"><button type="button" id="model-load">Load model<span id="model-size"></span></button></div><p class="model-note" id="model-note" role="status" hidden></p></div><div id="model-transfer" hidden><div class="transfer-heading"><span id="transfer-phase" role="status"></span><span id="transfer-value"></span><buttontype="button"id="transfer-back"aria-label="Cancel loading"title="Cancel loading"><svgaria-hidden="true"width="14"height="14"viewBox="0 0 16 16"fill="none"stroke="currentColor"stroke-width="1.5"><path d="m4 4 8 8m0-8-8 8" /></svg></button></div><divclass="transfer-meter"role="progressbar"aria-label="Model loading"aria-valuemin="0"aria-valuemax="100"><span></span></div></div></div></section></main><section id="chat" aria-label="Chat with Qwen 4" hidden><header class="chat-head"><div class="chat-head-inner"><div class="chat-brand"><img src="./assets/qwen.svg" alt="" width="22" height="22" /><span class="chat-model">Qwen4-35B-A3B</span><span class="chat-quant" id="chat-quant"></span></div><div class="status" id="status"><span class="status-dot"></span><span class="status-text" id="statusText">Ready · on-device</span></div><div class="chat-head-actions"><button class="head-btn" id="kernelsBtn" type="button">Kernels</button><button class="head-btn" id="clearBtn" type="button" disabled>New chat</button></div></div></header><div class="thread-scroll" id="threadScroll"><div class="thread" id="thread"></div></div><footer class="composer-wrap"><div class="composer" id="composer"><div class="attachments" id="attachments" hidden></div><div class="field"><button class="icon-button attach-button" id="attachBtn" type="button" aria-label="Attach images" title="Attach images (or paste / drop them)" disabled><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2.5" /><circle cx="9" cy="10" r="1.8" /><path d="m21 16-5.2-5.2a1.5 1.5 0 0 0-2.1 0L5 19.5" /></svg></button><textarea id="input" rows="1" placeholder="Loading…" disabled></textarea><button class="think-toggle" id="thinkBtn" type="button" aria-pressed="true" title="Reason before answering" disabled>Think</button><button class="icon-button send-button" id="sendBtn" type="button" disabled aria-label="Send message"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14" /><path d="m13 6 6 6-6 6" /></svg></button><button class="icon-button stop-button" id="stopBtn" type="button" aria-label="Stop generation"><svg viewBox="0 0 24 24" fill="currentColor"><rect x="7" y="7" width="10" height="10" rx="1.5" /></svg></button></div><input id="fileInput" type="file" accept="image/*" multiple hidden /><div class="composer-meta"><span id="hint">Runs fully on-device — prompts and images never leave your machine</span><span id="liveStat"></span></div></div></footer></section><dialog id="addons" aria-labelledby="addons-title"><div class="dialog-head"><span class="dialog-kicker">Qwen4-35B-A3B</span><button id="addons-close" class="close" aria-label="Close add-ons">×</button></div><h2 id="addons-title">Model add-ons</h2><div class="model-labels"><label for="model-projector">Vision projector</label></div><div class="model-select-wrap"><select id="model-projector"></select><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></div><div class="model-action-row"><button type="button" id="addons-done">Done</button><span id="addons-total"></span></div></dialog><script type="module" src="./app.js"></script></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font.git)
This Font Software is licensed under the SIL Open Font License, Version 1.1.This license is copied below, and is also available with a FAQ at:https://openfontlicense.org
-----------------------------------------------------------SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007-----------------------------------------------------------
PREAMBLEThe goals of the Open Font License (OFL) are to stimulate worldwidedevelopment of collaborative font projects, to support the font creationefforts of academic and linguistic communities, and to provide a free andopen framework in which fonts may be shared and improved in partnershipwith others.
The OFL allows the licensed fonts to be used, studied, modified andredistributed freely as long as they are not sold by themselves. Thefonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reservednames are not used by derivative works. The fonts and derivatives,however, cannot be released under any other type of license. Therequirement for fonts to remain under this license does not applyto any document created using the fonts or their derivatives.
DEFINITIONS"Font Software" refers to the set of files released by the CopyrightHolder(s) under this license and clearly marked as such. This mayinclude source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after thecopyright statement(s).
"Original Version" refers to the collection of Font Software components asdistributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,or substituting -- in part or in whole -- any of the components of theOriginal Version, by changing formats or by porting the Font Software to anew environment.
"Author" refers to any designer, engineer, programmer, technicalwriter or other person who contributed to the Font Software.
PERMISSION & CONDITIONSPermission is hereby granted, free of charge, to any person obtaininga copy of the Font Software, to use, study, copy, merge, embed, modify,redistribute, and sell modified and unmodified copies of the FontSoftware, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,redistributed and/or sold with any software, provided that each copycontains the above copyright notice and this license. These can beincluded either as stand-alone text files, human-readable headers orin the appropriate machine-readable metadata fields within text orbinary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved FontName(s) unless explicit written permission is granted by the correspondingCopyright Holder. This restriction only applies to the primary font name aspresented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the FontSoftware shall not be used to promote, endorse or advertise anyModified Version, except to acknowledge the contribution(s) of theCopyright Holder(s) and the Author(s) or with their explicit writtenpermission.
5) The Font Software, modified or unmodified, in part or in whole,must be distributed entirely under this license, and must not bedistributed under any other license. The requirement for fonts toremain under this license does not apply to any document createdusing the Font Software.
TERMINATIONThis license becomes null and void if any of the above conditions arenot met.
DISCLAIMERTHE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENTOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THECOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIALDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROMOTHER DEALINGS IN THE FONT SOFTWARE.123456789101112131415161718192021MIT License
Copyright (c) 2023 LobeHub
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.123456789101112131415161718192021MIT License
Copyright (c) 2025 Vercel, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.1#model-panel{--plate: min(100cqw, 150cqh);--extra-width: calc(.12 * (100cqw - var(--plate)));--title-width: calc(.424 * var(--plate) + var(--extra-width));position:absolute;top:47%;left:calc(50% - .443 * var(--plate) - var(--extra-width));width:var(--title-width);color:#f7f8ff;opacity:var(--reveal, 0);transform:translateY(calc(-50% + (1 - var(--reveal, 0)) * 10px))}#model-panel[inert]{visibility:hidden}#crystal-title{position:relative;width:100%;margin:0 0 clamp(10px,1.4cqh,18px) -1.6%;line-height:0;aspect-ratio:1000 / 263;margin-top:calc(.263 * (min(.373 * var(--plate),480px) - var(--title-width)))}#crystal-title img,#title-flare{position:absolute;display:block;left:-38%;top:-120%;width:176%;height:340%;pointer-events:none}#title-flare{visibility:hidden}#crystal-title.flare-live #title-flare{visibility:visible}#crystal-title.flare-live img{opacity:.42}.model-intro{margin:0 0 clamp(18px,3cqh,32px);font:400 clamp(16px,1.45cqw,21px) / 1.45 Geist,sans-serif;letter-spacing:-.015em;color:#dbe3f8;text-wrap:balance}.model-controls{position:relative;width:min(100%,350px)}#model-selection[inert]{visibility:hidden}#model-transfer{position:absolute;inset:0}.model-labels,.model-action-row,.transfer-heading{display:flex;align-items:baseline;justify-content:space-between;gap:10px}.model-labels{margin-bottom:7px;font-size:13px;color:#ccd0df}#addons-open,#transfer-back{color:#a3afcf;padding:2px 0;font-size:12px}#addons-open:hover,#transfer-back:hover{color:#fff;text-decoration:underline}.model-select-wrap{position:relative}.model-select-wrap select{appearance:none;width:100%;padding:12px 34px 12px 13px;border:1px solid #586178;border-radius:7px;color:#f2f5ff;background:linear-gradient(115deg,#151a27ed,#10141deb);font:500 14px/1.4 Geist,sans-serif;cursor:pointer;text-overflow:ellipsis}.model-select-wrap option{background:#151923;color:#f3f5ff}.model-select-wrap select:focus-visible{outline:2px solid #a2c5ff;outline-offset:3px}.model-select-wrap svg{position:absolute;right:12px;top:calc(50% - 8px);width:16px;fill:none;stroke:#c6d1ec;stroke-width:1.4;pointer-events:none}.model-action-row{justify-content:flex-start;align-items:center;margin-top:13px;gap:14px}#model-load,#addons-done{display:inline-flex;gap:10px;align-items:center;padding:10px 15px;border:1px solid #e9f0ff;border-radius:7px;background:linear-gradient(125deg,#fcfcff,#cbdcff);color:#0b152a;font-size:14px;font-weight:620}#model-load:hover,#addons-done:hover{background:#fff}#model-size{border-left:1px solid #92a4c3;padding-left:10px;font:500 12px/1.35 Geist,sans-serif;color:#334560;font-variant-numeric:tabular-nums;white-space:nowrap}#addons-total,#transfer-value{color:#aab8d4;font:11px/1.5 var(--mono);font-variant-numeric:tabular-nums}#addons{width:min(390px,calc(100% - 32px))}#addons h2{margin-bottom:24px}.transfer-heading{align-items:center;color:#edf2ff;font-size:15px;font-weight:540;margin-bottom:12px}#transfer-phase{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#transfer-value{white-space:nowrap}#transfer-back{display:grid;place-items:center;width:28px;height:28px;padding:0;border-radius:50%;color:#ced8ed}#transfer-back:hover,#transfer-back:focus-visible{color:#fff;background:#283044}.transfer-meter{height:7px;border-radius:99px;overflow:hidden;background:#30394e;box-shadow:0 0 0 1px #8d9abb55}.transfer-meter>span{display:block;height:100%;background:#d3e2ff;border-radius:inherit;transform-origin:left;transform:scaleX(var(--fraction, 0));transition:transform .18s linear}.transfer-meter:not([aria-valuenow])>span{width:32%;animation:transfer-sweep 1.65s ease-in-out infinite alternate}@keyframes transfer-sweep{0%{transform:translate(0)}to{transform:translate(212.5%)}}@media(prefers-reduced-motion:reduce){.transfer-meter>span{transition:none}.transfer-meter:not([aria-valuenow])>span{animation:none;transform:translate(106.25%)}}@media(max-width:760px),(max-aspect-ratio:1/1){#model-panel{position:relative;left:auto;top:auto;width:min(100%,650px);margin:0 auto;padding:3px var(--pad) 30px;transform:none}#crystal-title{width:100%;margin:0 0 8px -1.6%}.model-intro{font-size:16px;margin-bottom:22px}.model-controls{width:min(100%,400px)}}@media(prefers-reduced-motion:reduce){#model-panel{transform:translateY(-50%)}}@media(prefers-reduced-motion:reduce)and (max-width:760px),(prefers-reduced-motion:reduce)and (max-aspect-ratio:1/1){#model-panel{transform:none}}#model-transfer[data-error] #transfer-phase{white-space:normal;font-size:13px;line-height:1.45;color:#ffc2b6}.model-note{margin:12px 0 0;font-size:13px;line-height:1.45;color:#ffc2b6;text-wrap:pretty}1@font-face{font-family:Geist;src:url(./assets/geist.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;background:#000;color:#f4f6ff;font-family:Geist,Arial,sans-serif;--pad: clamp(22px, 5vw, 68px);--mono: ui-monospace, SFMono-Regular, Consolas, monospace}*{box-sizing:border-box}body{margin:0}[hidden]{display:none!important}button,select,input{font:inherit}button{cursor:pointer;border:0;color:inherit;background:none}button:disabled,input:disabled{opacity:.5;cursor:default}:focus-visible{outline:2px solid #b8d5ff;outline-offset:3px}.hero{position:relative;isolation:isolate;container-type:size;height:100svh;min-height:420px;overflow:hidden;background:#000}.hero[data-ready]{animation:scene-entrance .65s ease-out backwards}@keyframes scene-entrance{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.hero[data-ready]{animation-duration:.15s}}.visual{position:absolute;inset:0;overflow:hidden}.visual canvas{width:100%;height:100%;display:block;touch-action:pan-y}dialog{border:1px solid #52607a;background:#101522;color:#f0f4ff;border-radius:12px;padding:20px;box-shadow:0 12px 45px #0009}.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:10px}dialog::backdrop{background:#000a}.dialog-kicker{color:#b2c0db;font:12px/1.5 var(--mono)}.close{font-size:23px}@media(max-width:760px),(max-aspect-ratio:1/1){.hero{container-type:normal;display:flex;flex-direction:column;justify-content:center;height:auto;min-height:100svh;padding:16px 0}.visual{position:relative;inset:auto;width:100%;height:clamp(260px,83vw,520px);mask-image:linear-gradient(#000 87%,transparent)}}.gitattributes+1
Qwen4MoeForConditionalGeneration.jsAdded
_shared/chat-page.cssAdded+1
app.jsAdded+764
assets/blue-noise.binAdded+3
assets/flare-wordmark.svgAdded
assets/geist.woff2Added
assets/qwen.svgAdded
assets/wordmark.pngAdded

Large File Pointer Details
- SHA256: adbd640cd84c275de3799e4faccc6d1f5d124ef6a07a6d22917914470f260469
- Pointer size: 131 Bytes
- Size of remote file: 100 kB
chat.cssAdded+1
index.html+169-17
licenses/geist.txtAdded+93
licenses/lobehub.txtAdded+21
licenses/vgpu.txtAdded+21
model-panel.cssAdded+1
style.cssAdded+1