dsh-ccx 0.0.0-stage → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +23 -0
  3. package/README.md +151 -3
  4. package/assets/icon.svg +27 -0
  5. package/assets/preview-home.png +0 -0
  6. package/assets/preview-market.png +0 -0
  7. package/assets/preview-milkyway.png +0 -0
  8. package/assets/preview-mountain.png +0 -0
  9. package/assets/preview-settings.png +0 -0
  10. package/assets/preview-surface.png +0 -0
  11. package/assets/scene-aurora-ionosphere.png +0 -0
  12. package/assets/scene-black-hole.png +0 -0
  13. package/assets/scene-blinking-squares.png +0 -0
  14. package/assets/scene-cloud-train.png +0 -0
  15. package/assets/scene-glow-horizon.png +0 -0
  16. package/assets/scene-heavenly-cloud.png +0 -0
  17. package/assets/scene-milky-way.png +0 -0
  18. package/assets/scene-mountain.png +0 -0
  19. package/assets/scene-particle-image.png +0 -0
  20. package/assets/scene-pixel-sculpt.png +0 -0
  21. package/cordis.patch.yml +16 -0
  22. package/lib/client.js +1481 -0
  23. package/lib/index.js +779 -0
  24. package/lib/vendor/code-codex/ascii-tiles.js +145 -0
  25. package/lib/vendor/code-codex/aurora-ionosphere.js +442 -0
  26. package/lib/vendor/code-codex/black-hole.js +643 -0
  27. package/lib/vendor/code-codex/blinking-squares.js +401 -0
  28. package/lib/vendor/code-codex/cloud-train.js +627 -0
  29. package/lib/vendor/code-codex/galleries.json +101 -0
  30. package/lib/vendor/code-codex/glow-horizon.js +260 -0
  31. package/lib/vendor/code-codex/heavenly-cloud.js +359 -0
  32. package/lib/vendor/code-codex/milky-way.js +304 -0
  33. package/lib/vendor/code-codex/mountain.js +336 -0
  34. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-image-098c5fbaa5c415ec.png +0 -0
  35. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-image-39894de0da1fa952.png +0 -0
  36. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-image-6447780fc6368ce2.png +0 -0
  37. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-image-746ff537a0eca39e.png +0 -0
  38. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-image-89d064cef83721eb.png +0 -0
  39. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-image-e1c658aa459cfcef.png +0 -0
  40. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-thumbnail-098c5fbaa5c415ec.png +0 -0
  41. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-thumbnail-39894de0da1fa952.png +0 -0
  42. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-thumbnail-6447780fc6368ce2.png +0 -0
  43. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-thumbnail-746ff537a0eca39e.png +0 -0
  44. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-thumbnail-89d064cef83721eb.png +0 -0
  45. package/lib/vendor/code-codex/particle-image/media/CodeCodex-background-particle-image-thumbnail-e1c658aa459cfcef.png +0 -0
  46. package/lib/vendor/code-codex/particle-image.js +1099 -0
  47. package/lib/vendor/code-codex/pixel-sculpt/media/CodeCodex-background-pixel-sculpt-image-079ae375628c240b.png +0 -0
  48. package/lib/vendor/code-codex/pixel-sculpt/media/CodeCodex-background-pixel-sculpt-image-0e0ec1222ff7a1bc.png +0 -0
  49. package/lib/vendor/code-codex/pixel-sculpt/media/CodeCodex-background-pixel-sculpt-image-3fde0595509bc4d5.png +0 -0
  50. package/lib/vendor/code-codex/pixel-sculpt.js +438 -0
  51. package/lib/vendor/code-codex/scene-defaults.json +308 -0
  52. package/lib/vendor/code-codex/scene-schemas.json +2965 -0
  53. package/lib/vendor/code-codex/shallow-ocean-thumbnails.json +12 -0
  54. package/lib/vendor/code-codex/shallow-ocean.js +5094 -0
  55. package/lib/vendor/code-codex/spectral-drape.js +172 -0
  56. package/package.json +70 -6
  57. package/src/client/api.ts +90 -0
  58. package/src/client/background/layer.ts +187 -0
  59. package/src/client/background/pixel-sculpt.ts +167 -0
  60. package/src/client/background/scene-runner.ts +317 -0
  61. package/src/client/background/shallow-ocean.ts +344 -0
  62. package/src/client/background/vendor-loader.ts +297 -0
  63. package/src/client/background/wallpaper.ts +87 -0
  64. package/src/client/index.ts +247 -0
  65. package/src/client/surfaces/corner-patch.ts +100 -0
  66. package/src/client/surfaces/surface-css.ts +155 -0
  67. package/src/client/ui/draft.ts +105 -0
  68. package/src/client/ui/icons.ts +47 -0
  69. package/src/client/ui/panel.ts +1524 -0
  70. package/src/client/ui/shallow-ocean-panel.ts +376 -0
  71. package/src/client/ui/styles.ts +1471 -0
  72. package/src/host/fence.ts +78 -0
  73. package/src/host/index.ts +26 -0
  74. package/src/host/routes.ts +367 -0
  75. package/src/host/storage.ts +109 -0
  76. package/src/host/window-chrome.ts +53 -0
  77. package/src/shared/constants.ts +239 -0
  78. package/src/shared/sanitize.ts +110 -0
  79. package/src/shared/types.ts +145 -0
  80. package/tsconfig.json +16 -0
@@ -0,0 +1,145 @@
1
+ (()=>{var b=class{constructor(e){this.report=e;this.signal=this.#e.signal}#s=!1;#a=new Set;signal;#e=new AbortController;get disposed(){return this.#s}own(e){let i=!0,n=()=>{i&&(i=!1,this.#a.delete(n),e())};return this.#s?n():this.#a.add(n),n}listen(e,i,n,t){return this.#s?()=>{}:(e.addEventListener(i,n,t),this.own(()=>e.removeEventListener(i,n,t)))}dispose(){if(!this.#s){this.#s=!0,this.#e.abort();for(let e of[...this.#a].reverse())try{e()}catch(i){try{this.report(i)}catch{}}}}};function D(r){let e=0,i=0,n=0,t=(o,l)=>{if(++i>8192||l>10)throw Error("BG_ASSET_SHAPE: Visual asset structure exceeds its budget.");if(ArrayBuffer.isView(o)){if((o instanceof Float32Array||o instanceof Float64Array)&&!o.every(Number.isFinite))throw Error("BG_ASSET_NUMBER: Prepared visual numbers must be finite.");if(e+=o.byteLength,e>32*1024*1024)throw Error("BG_ASSET_SIZE: Prepared visual assets exceed 32 MiB.");return o}if(Array.isArray(o))return o.map(d=>t(d,l+1));if(o&&typeof o=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(o))){let d={};for(let[p,E]of Object.entries(o)){if(y({[p]:null}),n+=new TextEncoder().encode(p).length+4,n>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");d[p]=t(E,l+1)}return d}let c=y(o);if(n+=new TextEncoder().encode(JSON.stringify(c)).length,n>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");return c};return t(r,0)}function y(r){let e=0,i=(t,o)=>{if(++e>4096||o>8)throw Error("BG_STATE_LIMIT: Visual state exceeds the bounded schema.");if(t===null||typeof t=="boolean")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw Error("BG_STATE_NUMBER: Visual numbers must be finite.");return t}if(typeof t=="string"){if(t.length>1024)throw Error("BG_STATE_STRING: Visual strings must be bounded.");return t}if(Array.isArray(t))return t.map(l=>i(l,o+1));if(t&&typeof t=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(t))){let l={};for(let[c,d]of Object.entries(t)){if(/^(?:__proto__|constructor|prototype|token|accessToken|refreshToken|authorization|cookie|bridge|conversation|history|source|url|path)$/i.test(c))throw Error("BG_STATE_FIELD: Visual state contains an unsupported field.");d!==void 0&&(l[c]=i(d,o+1))}return l}throw Error("BG_STATE_TYPE: Visual state must contain serializable visual values.")},n=i(r,0);if(new TextEncoder().encode(JSON.stringify(n)).length>65536)throw Error("BG_STATE_SIZE: Visual state exceeds the message budget.");return n}function _(r,e){if(![r.width,r.height,r.left,r.top,e].every(Number.isFinite)||r.width<0||r.height<0)throw Error("BG_VIEWPORT_INVALID: Invalid visual dimensions.");let i=Math.max(1,Math.min(8192,r.width)),n=Math.max(1,Math.min(8192,r.height)),t=Math.min(3,Math.max(.5,e),Math.sqrt(16777216/(i*n)));return{width:i,height:n,left:r.left,top:r.top,dpr:t}}var z=/(token|cookie|password|secret|credential|authorization|apikey)/i,X=/^(content|text|body|prompt|messages|title|filename|name|raw|data|database64|commandline|sessionid|accountid|threadid|projectid)$|(?:path|url|uri)$/i;function f(r){return r.slice(0,8e3).replace(/\b[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s"'<>]+/g,i=>{try{let n=new URL(i);if(["127.0.0.1","localhost","[::1]"].includes(n.hostname)&&!n.username&&!n.password&&["/json/version","/json/list","/"].includes(n.pathname))return`${n.origin}${n.pathname}`}catch{}return"[url]"}).replace(/(?:\b[A-Za-z]:[\\/]|\\\\|\/(?:Users|home|tmp|var|etc|opt|mnt)\/|~\/)[^\r\n"'<>]*/g,"[path]").replace(/\b(?:Bearer\s+\S+|(?:authorization|password|secret|(?:access[_-]?|refresh[_-]?)?token|api[_-]?key|cookie)\s*[:=]\s*[^,;\r\n]+)/gi,"[credential]").replace(/\bsk-[A-Za-z0-9_-]{8,}|\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,"[credential]").replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,"[email]").slice(0,4e3)+(r.length>8e3?" [truncated]":"")}function G(r){let e=256,i=new WeakSet,n=(t,o)=>{if(--e<0||o>6)return"[truncated]";if(typeof t=="string")return f(t);if(t===null||typeof t=="boolean"||typeof t=="number")return t;if(typeof t!="object")return"[unsupported]";if(i.has(t))return"[circular]";if(i.add(t),t instanceof Error)return{name:f(t.name),message:f(t.message)};if(Array.isArray(t))return t.slice(0,128).map(c=>n(c,o+1));let l=Object.create(null);for(let[c,d]of Object.entries(t).slice(0,128)){let p=c.replace(/[^a-z0-9]/gi,"");l[f(c).slice(0,160)]=z.test(p)||X.test(p)?"[redacted]":n(d,o+1)}return l};try{return n(r,0)}catch{return{redactionFailed:!0}}}var q=Symbol.for("code-codex:runtime-events:v1"),j=window,T=j[q]??={events:[],dropped:0};function h(r,e,i,n={}){let t={source:f(r).slice(0,160),action:f(e).slice(0,160),outcome:f(i).slice(0,160),details:{...G(n),observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}},o=new TextEncoder().encode(JSON.stringify(t)).length;o>7e3&&(t.details={truncated:!0,originalBytes:o,observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}),T.events.push(t),T.events.length>1e3&&(T.events.splice(0,200),T.dropped+=200)}var V=Symbol.for("code-codex:background-startup-hold:v1");function K(){let r=window;return r[V]??={active:!1,layers:new Set,next:-1,pending:new Map,painted:new WeakSet,openings:new WeakMap}}function Y(r){return r.closest("[data-code-codex-particle-layer]")}function A(r){return!!Y(r)&&K().active}var I=()=>{let r=window;return r[Symbol.for("code-codex:background-isolation:v1")]??=new Map},x=class{constructor(e,i,n,t,o,l=()=>{},c={}){this.host=n;this.onError=l;if(typeof Worker!="function"||typeof t.transferControlToOffscreen!="function")throw Error("BG_BACKEND_UNAVAILABLE: Independent background rendering is unavailable.");let d=y(o),p=_(n.getBoundingClientRect(),devicePixelRatio||1);this.#t={id:e,mode:"worker",phase:"preparing",frames:0,pending:0},I().set(this,this.#t),this.#e=new b(s=>h("background","resource release","failed",{id:e,error:String(s)})),this.ready=this.firstFrame=new Promise((s,a)=>{this.#s=s,this.#a=a}),this.ready.catch(()=>{}),this.#p=p;let E=URL.createObjectURL(new Blob([i],{type:"text/javascript"}));this.#e.own(()=>URL.revokeObjectURL(E));try{this.#m=new Worker(E,{name:"code-codex-background-"+e})}catch(s){throw this.#e.dispose(),I().delete(this),s}let w=this.#m,B=setTimeout(()=>this.#o("BG_FIRST_FRAME_TIMEOUT: The background did not produce a first frame within 15 seconds."),15e3);this.#e.own(()=>clearTimeout(B)),this.#e.listen(t,"webglcontextlost",s=>{s.preventDefault(),this.#o("BG_WORKER_CONTEXT_LOST: The transferred background graphics context was lost. Enable the background again to retry.")}),this.#e.listen(w,"error",s=>this.#o("BG_WORKER_ERROR: "+s.message)),this.#e.listen(w,"messageerror",()=>this.#o("BG_WORKER_PROTOCOL: The background response could not be decoded.")),this.#e.listen(w,"message",s=>{let a=s.data;if(!(this.#i||a?.v!==1||a.session!==this.#u)){if(a.type==="failed"){this.#o("BG_WORKER_RENDER_FAILED: "+String(a.message).slice(0,1500));return}if(a.type==="first-frame"&&!this.#d&&(this.#d=!0,this.#t.frames=a.frames??1,clearTimeout(B),this.#t.phase="running",this.#s(),this.#v(),h("background","isolated first frame","ready",{id:e,backend:"worker"})),a.type==="sample"&&Number.isSafeInteger(a.frames)&&(this.#t.frames=a.frames),a.type==="event"&&typeof a.event=="string"&&this.kernelEvent(a.event,a.value),a.type==="result"&&Number.isSafeInteger(a.callId)){let u=this.#c.get(a.callId);u&&(clearTimeout(u.timer),this.#c.delete(a.callId),a.error?u.reject(Error("BG_KERNEL_FAILED: "+String(a.error))):u.resolve(a.value))}a.type==="ack"&&a.seq===this.#l&&(clearTimeout(this.#g),this.#g=void 0,this.#l=0,this.#t.pending=0,this.#f())}});let L=new ResizeObserver(()=>{let s=_(this.host.getBoundingClientRect(),devicePixelRatio||1);JSON.stringify(s)!==JSON.stringify(this.#p)&&(this.#p=s,this.#h({viewport:s}))});L.observe(n),this.#e.own(()=>L.disconnect());let P=new IntersectionObserver(s=>{this.#E=s[0]?.isIntersecting??!0,this.#v()});P.observe(n),this.#e.own(()=>P.disconnect());let k=matchMedia("(prefers-reduced-motion: reduce)");this.#e.listen(k,"change",()=>this.#h({reduced:k.matches})),this.#e.listen(document,"visibilitychange",()=>this.#v()),this.#e.listen(window,"code-codex:background-hold-changed",()=>this.#v()),this.#e.listen(window,"pagehide",()=>this.dispose());let W=s=>{if(!this.#d||this.#i||c.interactive===!1||!["pointerup","pointercancel"].includes(s.type)&&s.composedPath().some(v=>v instanceof Element&&v.matches('button,a,input,textarea,select,[contenteditable],dialog,[role="menu"],[role="menubar"],[popover]')))return;let a=s,u=this.#p;if(s instanceof PointerEvent&&!["pointermove","pointerleave","pointerup","pointercancel"].includes(s.type)&&(a.clientX<u.left||a.clientX>u.left+u.width||a.clientY<u.top||a.clientY>u.top+u.height))return;let g={type:s.type};if(s instanceof PointerEvent)Object.assign(g,{clientX:a.clientX,clientY:a.clientY,pointerId:a.pointerId,button:a.button,buttons:a.buttons,isPrimary:a.isPrimary,pointerType:a.pointerType});else if(s instanceof WheelEvent){let v=this.#r.find(m=>m.type==="state"&&m.input?.type==="wheel");if(v){let m=v.input;m.deltaX=Math.max(-1e4,Math.min(1e4,m.deltaX+s.deltaX)),m.deltaY=Math.max(-1e4,Math.min(1e4,m.deltaY+s.deltaY));return}Object.assign(g,{deltaX:s.deltaX,deltaY:s.deltaY,deltaMode:s.deltaMode,clientX:s.clientX,clientY:s.clientY})}else s instanceof KeyboardEvent&&Object.assign(g,{repeat:s.repeat,isComposing:s.isComposing,altKey:s.altKey,ctrlKey:s.ctrlKey,metaKey:s.metaKey,shiftKey:s.shiftKey,key:"",code:""});s.type==="pointermove"?((a.clientX<u.left||a.clientX>u.left+u.width||a.clientY<u.top||a.clientY>u.top+u.height)&&(g.type="pointerleave"),this.#h({input:g})):this.#r.length<8?(this.#r.push({type:"state",input:g}),this.#f()):this.#o("BG_INPUT_QUEUE_FULL: Background input exceeded the bounded discrete-event queue.")};for(let s of["pointermove","pointerleave","pointerdown","pointerup","pointercancel","wheel","keydown"])this.#e.listen(window,s,W,{passive:!0});try{let s=t.transferControlToOffscreen();w.postMessage({v:1,session:this.#u,type:"init",canvas:s,settings:d,viewport:this.#p,reduced:k.matches,held:A(n)},[s])}catch(s){this.#o("BG_CANVAS_TRANSFER: "+String(s))}}ready;firstFrame;#s;#a;#e;#m;#u=crypto.randomUUID();#y=0;#l=0;#n;#r=[];#c=new Map;#w=0;#d=!1;#i=!1;#E=!0;#p;#g;#t;get diagnostics(){return{...this.#t}}setSettings(e){this.#h({settings:y(e)})}updateSettings(e){this.setSettings(e)}replay(){if(!this.#i){if(this.#r.length>=8)throw Error("BG_COMMAND_QUEUE_FULL: Wait for the pending visual command.");this.#r.push({type:"replay"}),this.#f()}}kernelEvent(e,i){}activityChanged(e){}call(e,i=[],n=3e4){if(this.#i)return Promise.reject(Error("BG_KERNEL_DISPOSED: The visual worker has been retired."));if(this.#c.size>=8||this.#r.length>=8)return Promise.reject(Error("BG_COMMAND_QUEUE_FULL: Wait for the pending visual command."));let t=D(i),o=++this.#w,l=new Promise((c,d)=>{let p=setTimeout(()=>{this.#c.delete(o),d(Error("BG_KERNEL_TIMEOUT: The visual command did not confirm completion. It was not replayed."))},n);this.#c.set(o,{resolve:c,reject:d,timer:p})});return this.#r.push({type:"call",method:e,args:t,callId:o}),this.#f(),l}resumeOpening(){this.replay()}#v=()=>{let e=!document.hidden&&this.#E&&(!this.#d||!A(this.host));this.#h({visible:e}),this.activityChanged(e)};#h(e){this.#i||(this.#n={...this.#n,...e},this.#f())}#f(){if(this.#i||this.#l)return;let e;if(this.#n&&["settings","viewport","visible","reduced"].some(i=>i in this.#n)){let{input:i,...n}=this.#n;e={type:"state",...n},this.#n=i?{input:i}:void 0}else if(this.#r.length)e=this.#r.shift();else if(this.#n)e={type:"state",...this.#n},this.#n=void 0;else return;this.#l=++this.#y,this.#t.pending=1;try{this.#m.postMessage({v:1,session:this.#u,seq:this.#l,...e})}catch(i){this.#o("BG_WORKER_SEND_FAILED: "+String(i));return}this.#g=setTimeout(()=>this.#o("BG_WORKER_ACK_TIMEOUT: The visual worker stopped acknowledging bounded updates."),5e3)}#o(e){if(!this.#i){this.#t.phase="failed",this.#t.error=e,this.#a(Error(e)),h("background","visual worker","failed",{id:this.#t.id,session:this.#u,sequence:this.#y,pending:this.#l,message:e});try{this.onError(e)}finally{this.dispose()}}}dispose(){if(this.#i)return;this.#i=!0,this.#e.dispose(),clearTimeout(this.#g),this.#n=void 0,this.#r=[],this.#d||this.#a(new DOMException("Background preparation was cancelled.","AbortError"));for(let c of this.#c.values())clearTimeout(c.timer),c.reject(new DOMException("Background command was cancelled.","AbortError"));this.#c.clear();let e=this.#m,i=this.#u,n=++this.#y;this.#t.phase="disposing";let t=!1,o=()=>{t||(t=!0,clearTimeout(l),e.terminate(),I().delete(this))},l=setTimeout(()=>{h("background","worker disposal","unconfirmed",{id:this.#t.id,timeoutMs:1500}),o()},1500);e.addEventListener("message",c=>{c.data?.session===i&&c.data?.type==="disposed"&&o()});try{e.postMessage({v:1,session:i,seq:n,type:"dispose"})}catch{o()}}};var O=Object.freeze({speed:.87,glyphSize:9,tileDensity:6.7,tileShear:-.31,tileGap:18.5,outlineWidth:1.25,outlineStrength:.6,bevelWidth:.13,bevelSoftness:.1,refractionStrength:46,chromaticSpread:.66,specularExponent:256,specularStrength:1,patternFreqX:9.4,patternFreqY:4,patternFreqXY:10,glyphColor:"#ffffff",recessColor:"#000000",backgroundColor:"#000000",opacity:.6,dpr:1.5,cursorInteraction:!0,cursorRadius:110,cursorIntensity:1,cursorRecovery:.95,waveSpeed:5.5,waveHeight:36,clickStrength:1.5}),M=Object.freeze({speed:[0,3,.01],glyphSize:[4,24,1],tileDensity:[1,12,.1],tileShear:[-.5,.5,.01],bevelWidth:[0,.5,.005],tileGap:[0,40,.5],outlineWidth:[0,6,.25],outlineStrength:[0,1,.01],bevelSoftness:[.01,.4,.005],refractionStrength:[0,120,1],chromaticSpread:[0,1,.01],specularExponent:[1,256,1],specularStrength:[0,3,.01],patternFreqX:[0,20,.1],patternFreqY:[0,20,.1],patternFreqXY:[0,20,.1],opacity:[0,1,.01],dpr:[1,3,.1],cursorRadius:[20,400,1],cursorIntensity:[0,3,.01],cursorRecovery:[.4,4,.05],waveSpeed:[1,12,.1],waveHeight:[0,80,1],clickStrength:[0,3,.01]});function C(r={}){let e={...O};for(let i of Object.keys(M)){let[n,t]=M[i],o=r[i];typeof o=="number"&&Number.isFinite(o)&&(e[i]=Math.min(t,Math.max(n,o)))}for(let i of["glyphColor","recessColor","backgroundColor"])typeof r[i]=="string"&&/^#[\da-f]{6}$/i.test(r[i])&&(e[i]=r[i]);return typeof r.cursorInteraction=="boolean"&&(e.cursorInteraction=r.cursorInteraction),e}function H(r){try{let e=[],i=new Set,n=r;for(;n!=null&&e.length<8&&!i.has(n);)if(i.add(n),n instanceof Error)e.push(`${n.name}: ${n.message}`),n=n.cause;else{e.push(typeof n=="string"?n:"Non-Error rejection");break}let t=r&&typeof r=="object"&&"code"in r?r.code:void 0,o={errorChain:e,...typeof t=="string"||typeof t=="number"?{errorCode:typeof t=="string"?t.slice(0,160):t}:{},...r instanceof Error&&r.stack?{exceptionStack:r.stack.slice(0,3e3)}:{},chainTruncated:n!=null&&e.length>=8},l=new TextEncoder().encode(JSON.stringify(o)).length;return l>5800&&(o.errorChain=e.map(c=>c.slice(0,80)),typeof o.exceptionStack=="string"&&(o.exceptionStack=o.exceptionStack.slice(0,200)),o.detailsTruncated=!0,o.originalDetailBytes=l),o}catch{return{errorChain:["Exception details could not be inspected safely."]}}}var R=new Map;function F(r,e){try{let i=performance.now(),n=R.has(r)||R.size<256?r:"other handlers",t=R.get(n);if(t||(t={start:i,count:0,suppressed:0},R.set(n,t)),i-t.start>1e4&&(t.suppressed&&h("handled-exception",n,"throttled",{suppressedCount:t.suppressed}),t.start=i,t.count=0,t.suppressed=0),++t.count>3){t.suppressed++;return}let o=H(e),l=(e instanceof Error||e instanceof DOMException)&&e.name==="AbortError";h("handled-exception",n,l?"cancelled":"failed",{...o,recovery:"Existing handler continues; recording does not retry, reset settings or prove recovery succeeded."})}catch{}}var Z="code-codex:ascii-tiles-background:v1",$={...O,paused:!1};function J(r){let e=r&&typeof r=="object"?r:{};return{...C(e),paused:e.paused===!0}}function U(){try{return J(JSON.parse(localStorage.getItem(Z)??"{}"))}catch(r){return F("ASCII settings read",r),{...$}}}var N=class extends x{constructor(r,e,i,n){super("ascii-tiles",`"use strict";(()=>{globalThis.window=globalThis;function We(e,n,o){let r=globalThis,i=n,a=!0,p=!1,d=new Set,f=new Set,v=new EventTarget,g=Object.assign(new EventTarget,{matches:!1,media:"(prefers-reduced-motion: reduce)"}),E=()=>({...i,x:i.left,y:i.top,right:i.left+i.width,bottom:i.top+i.height,toJSON(){return this}}),t=Object.assign(new EventTarget,{getBoundingClientRect:E,closest:()=>null,style:{setProperty(){},removeProperty(){}},dataset:{},contains:()=>!1}),l=new Map,y={},b=new Proxy(e,{get(h,m){if(m==="getBoundingClientRect")return E;if(m==="clientWidth"||m==="offsetWidth")return i.width;if(m==="clientHeight"||m==="offsetHeight")return i.height;if(m==="closest")return()=>null;if(m==="parentElement")return t;if(m==="setPointerCapture"||m==="releasePointerCapture"||m==="replaceWith")return()=>{};if(m==="style")return t.style;if(m==="dataset")return y;if(m==="getContext")return(W,P)=>{if(l.has(W))return l.get(W);let O=h.getContext(W,P);if(!O)return null;let T=null,H=new Map,k=new Proxy(O,{get(F,S){let U=Reflect.get(F,S,F);return typeof U!="function"?U:(H.has(S)||H.set(S,(...s)=>{let c=Reflect.apply(U,F,s);return S==="bindFramebuffer"&&(s[0]===F.FRAMEBUFFER||s[0]===F.DRAW_FRAMEBUFFER)&&(T=s[1]),(S==="drawArrays"||S==="drawElements"||S==="drawArraysInstanced"||S==="drawElementsInstanced")&&T===null&&o(),c}),H.get(S))}});return l.set(W,k),k};let I=Reflect.get(h,m,h);return typeof I=="function"?I.bind(h):I},set(h,m,I){return Reflect.set(h,m,I,h)}});Object.defineProperties(t,{clientWidth:{get:()=>i.width},clientHeight:{get:()=>i.height}});let A=Object.assign(v,{get hidden(){return!a},get visibilityState(){return a?"visible":"hidden"}});Object.defineProperties(A,{hidden:{get:()=>!a},visibilityState:{get:()=>a?"visible":"hidden"}}),r.window=r,r.document=A,r.matchMedia=()=>g,r.Element=class extends EventTarget{},Object.defineProperties(r,{innerWidth:{configurable:!0,get:()=>i.width},innerHeight:{configurable:!0,get:()=>i.height},devicePixelRatio:{configurable:!0,get:()=>i.dpr}}),r.ResizeObserver=class{constructor(h){this.callback=h;d.add(this)}observe(){this.callback([{target:t,contentRect:E()}])}disconnect(){d.delete(this)}},r.IntersectionObserver=class{constructor(h){this.callback=h;f.add(this)}observe(){this.callback([{target:t,isIntersecting:a,intersectionRatio:a?1:0}])}disconnect(){f.delete(this)}};let M=(h,m)=>{let I=new Event(h);for(let[W,P]of Object.entries(m))Object.defineProperty(I,W,{value:P});return I};return{host:t,canvas:b,viewport(h){i=h;for(let m of d)m.callback([{target:t,contentRect:E()}]);r.dispatchEvent(new Event("resize"))},visibility(h){if(a!==h){a=h,v.dispatchEvent(new Event("visibilitychange"));for(let m of f)m.callback([{target:t,isIntersecting:h,intersectionRatio:h?1:0}])}},motion(h){p!==h&&(p=h,g.matches=h,g.dispatchEvent(new Event("change")))},input(h,m){r.dispatchEvent(M(h,m)),t.dispatchEvent(M(h,m)),e.dispatchEvent(M(h,m))},dispose(){d.clear(),f.clear();for(let h of l.values())try{h.getExtension("WEBGL_lose_context")?.loseContext()}catch{}l.clear()}}}function ne(e){let n=0,o=0,r=0,i=(a,p)=>{if(++o>8192||p>10)throw Error("BG_ASSET_SHAPE: Visual asset structure exceeds its budget.");if(ArrayBuffer.isView(a)){if((a instanceof Float32Array||a instanceof Float64Array)&&!a.every(Number.isFinite))throw Error("BG_ASSET_NUMBER: Prepared visual numbers must be finite.");if(n+=a.byteLength,n>32*1024*1024)throw Error("BG_ASSET_SIZE: Prepared visual assets exceed 32 MiB.");return a}if(Array.isArray(a))return a.map(f=>i(f,p+1));if(a&&typeof a=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(a))){let f={};for(let[v,g]of Object.entries(a)){if(K({[v]:null}),r+=new TextEncoder().encode(v).length+4,r>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");f[v]=i(g,p+1)}return f}let d=K(a);if(r+=new TextEncoder().encode(JSON.stringify(d)).length,r>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");return d};return i(e,0)}function K(e){let n=0,o=(i,a)=>{if(++n>4096||a>8)throw Error("BG_STATE_LIMIT: Visual state exceeds the bounded schema.");if(i===null||typeof i=="boolean")return i;if(typeof i=="number"){if(!Number.isFinite(i))throw Error("BG_STATE_NUMBER: Visual numbers must be finite.");return i}if(typeof i=="string"){if(i.length>1024)throw Error("BG_STATE_STRING: Visual strings must be bounded.");return i}if(Array.isArray(i))return i.map(p=>o(p,a+1));if(i&&typeof i=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(i))){let p={};for(let[d,f]of Object.entries(i)){if(/^(?:__proto__|constructor|prototype|token|accessToken|refreshToken|authorization|cookie|bridge|conversation|history|source|url|path)$/i.test(d))throw Error("BG_STATE_FIELD: Visual state contains an unsupported field.");f!==void 0&&(p[d]=o(f,a+1))}return p}throw Error("BG_STATE_TYPE: Visual state must contain serializable visual values.")},r=o(e,0);if(new TextEncoder().encode(JSON.stringify(r)).length>65536)throw Error("BG_STATE_SIZE: Visual state exceeds the message budget.");return r}function he(e,n){if(![e.width,e.height,e.left,e.top,n].every(Number.isFinite)||e.width<0||e.height<0)throw Error("BG_VIEWPORT_INVALID: Invalid visual dimensions.");let o=Math.max(1,Math.min(8192,e.width)),r=Math.max(1,Math.min(8192,e.height)),i=Math.min(3,Math.max(.5,n),Math.sqrt(16777216/(o*r)));return{width:o,height:r,left:e.left,top:e.top,dpr:i}}var ot=()=>{};function Fe(e){ot=e}var ge=\`#version 300 es
2
+ precision highp float;
3
+ uniform vec2 uResolution;
4
+ uniform float uTime;
5
+ uniform sampler2D uAtlas;
6
+ uniform sampler2D uWaveGrid;
7
+ uniform ivec2 uWaveOrigin;
8
+ uniform float uWaveHeight;
9
+ uniform vec3 uGlyphColor, uRecessColor, uBackgroundColor;
10
+ uniform float uGlyphSize, uTileDensity, uTileShear, uBevelWidth, uBevelSoftness;
11
+ uniform float uTileGap, uOutlineWidth, uOutlineStrength;
12
+ uniform float uRefraction, uChromatic, uSpecularExp, uSpecularStrength;
13
+ uniform vec3 uFrequency;
14
+ uniform vec2 uPointer;
15
+ uniform float uReducedHover, uRadius, uIntensity, uOpacity;
16
+ uniform float uIntroProgress, uIntroStrength;
17
+ in vec2 vUV;
18
+ out vec4 outColor;
19
+
20
+ // An independently constructed interference field, not the Pro source shader.
21
+ float field(vec2 pixel) {
22
+ vec2 p = (pixel - uResolution * 0.5) / max(uResolution.x, uResolution.y);
23
+ float t = uTime * 0.34;
24
+ float wave = sin(p.x * uFrequency.x * 3.14159 + t)
25
+ + sin(p.y * uFrequency.y * 3.14159 - t * 1.25)
26
+ + sin(p.x * p.y * uFrequency.z * 12.0 + t * 0.7);
27
+ return clamp(0.48 + wave * 0.24, 0.0, 1.0);
28
+ }
29
+
30
+ float ascii(vec2 pixel) {
31
+ vec2 cell = floor(pixel / uGlyphSize);
32
+ float density = field((cell + 0.5) * uGlyphSize);
33
+ float glyph = floor(clamp(density, 0.0, 0.9999) * 10.0);
34
+ vec2 local = fract(pixel / uGlyphSize);
35
+ // Ten equally spaced slots in a one-row monospace atlas; no font work per frame.
36
+ vec2 atlasUV = vec2((glyph + local.x) / 10.0, local.y);
37
+ return texture(uAtlas, atlasUV).r * mix(0.3, 1.0, density);
38
+ }
39
+
40
+ vec4 brickWave(ivec2 id) {
41
+ ivec2 cell = id - uWaveOrigin;
42
+ if (any(lessThan(cell, ivec2(0))) || any(greaterThanEqual(cell, textureSize(uWaveGrid, 0)))) return vec4(0);
43
+ return texelFetch(uWaveGrid, cell, 0);
44
+ }
45
+
46
+ void main() {
47
+ // All dimensions are CSS pixels, independent of device pixel ratio.
48
+ vec2 pixel = vUV * uResolution;
49
+ float edge = max(uResolution.x, uResolution.y);
50
+ vec2 p = (pixel - uResolution * 0.5) / edge;
51
+ mat2 lattice = mat2(1.0, uTileShear, -uTileShear, 1.0);
52
+ vec2 latticePoint = lattice * p * uTileDensity + vec2(0.42, 0.35);
53
+ ivec2 brickID = ivec2(floor(latticePoint));
54
+ vec4 wave = brickWave(brickID);
55
+ // Subpixel spring tails must not shimmer the distant character grid. Keep
56
+ // the physical spring state continuous; fade only its rendered displacement.
57
+ wave *= smoothstep(0.04, 0.12, abs(wave.x));
58
+ vec2 restQ = fract(latticePoint);
59
+ vec2 restDistances = 0.5 - abs(restQ - 0.5);
60
+ float restNearest = min(restDistances.x, restDistances.y);
61
+ // Keep gaps and outlines in CSS pixels, even when density, shear or DPR changes.
62
+ float pixelToTile = uTileDensity * sqrt(1.0 + uTileShear * uTileShear) / edge;
63
+ // Very dense grids must still leave some visible glass instead of overlapping.
64
+ float seam = min(uTileGap * 0.5 * pixelToTile, 0.44);
65
+ float aa = max(fwidth(restNearest) * 0.5, 0.00001);
66
+ float rim = max(min(uBevelWidth + uBevelSoftness * 0.25, 0.48 - seam), 0.001);
67
+ // The frame has ONE stationary bevel/outline, not a second shifted wire grid.
68
+ // The face inside it retains the original spring-driven press and rebound.
69
+ float tile = uTileGap > 0.0 ? smoothstep(seam - aa, seam + aa, restNearest) : 1.0;
70
+ vec2 q = restQ;
71
+ vec2 signedEdge = q - 0.5;
72
+ vec2 distances = 0.5 - abs(signedEdge);
73
+ float nearest = min(distances.x, distances.y);
74
+ float slope = 1.0 - smoothstep(seam, seam + rim, nearest);
75
+ vec2 gradient = distances.x < distances.y ? vec2(sign(signedEdge.x), 0.0) : vec2(0.0, sign(signedEdge.y));
76
+ gradient = transpose(lattice) * gradient;
77
+ vec2 offset = gradient * slope * uRefraction;
78
+ float pitch = 1.0 / pixelToTile;
79
+ vec2 centerGrid = (vec2(brickID) + 0.5 - vec2(0.42, 0.35)) / uTileDensity;
80
+ vec2 centerPixel = uResolution * 0.5 + inverse(lattice) * centerGrid * edge;
81
+ float entrance = 1.0;
82
+ float entranceLift = 0.0;
83
+ float entranceLight = 0.0;
84
+ if (uIntroProgress < 1.0) {
85
+ // Tile-sized phases: a diagonal cascade with small, stable timing offsets.
86
+ float seed = fract(sin(dot(vec2(brickID), vec2(127.1, 311.7))) * 43758.5453);
87
+ float order = dot(clamp(centerPixel / uResolution, 0.0, 1.0), vec2(0.48, 0.52));
88
+ float delay = order * 0.46 + seed * 0.12;
89
+ float local = clamp((uIntroProgress - delay) / 0.42, 0.0, 1.0);
90
+ entrance = smoothstep(0.0, 0.36, local);
91
+ float settle = (1.0 - local) * (1.0 - local);
92
+ entranceLift = cos(local * 8.0) * settle * min(pitch * 0.22, 80.0) * uIntroStrength;
93
+ entranceLight = sin(local * 3.14159265) * settle * uIntroStrength;
94
+ }
95
+ float lift = clamp(wave.x, -1.5, 1.5) * min(uWaveHeight, pitch * 0.12);
96
+ lift += entranceLift;
97
+ float faceBlend = smoothstep(seam, seam + rim * 0.8, restNearest);
98
+ vec2 faceShift = vec2(0.22, 0.7) * lift;
99
+ float faceScale = clamp(1.0 + lift / pitch * 0.65, 0.85, 1.15);
100
+ vec2 refracted = centerPixel + (pixel - centerPixel - faceShift * faceBlend)
101
+ / mix(1.0, faceScale, faceBlend) + offset;
102
+ float r = ascii(refracted + offset * uChromatic);
103
+ float g = ascii(refracted);
104
+ float b = ascii(refracted - offset * uChromatic);
105
+ vec2 coupledTilt = transpose(lattice) * wave.yz * min(uWaveHeight / pitch, 0.12) * 2.8;
106
+ vec3 normal = normalize(vec3(-gradient * slope * 2.4 - coupledTilt, 1.0));
107
+ vec3 light = normalize(vec3(-0.6, 0.8, 0.65));
108
+ float highlight = pow(max(dot(normal, normalize(light + vec3(0, 0, 1))), 0.0), uSpecularExp);
109
+ float bevelLight = 0.45 + max(dot(normal, light), 0.0) * 0.65;
110
+ float rimFacing = max(dot(normal.xy, normalize(light.xy)), 0.0);
111
+ float rimReflection = slope * pow(rimFacing, mix(1.2, 3.5, uSpecularExp / 256.0));
112
+ vec3 glyphs = vec3(r, g, b) * uGlyphColor * mix(0.9, bevelLight, slope);
113
+ // Glass catches white light on the upper bevel while glyphs retain dispersion.
114
+ glyphs += vec3(highlight * uSpecularStrength) * (0.08 + vec3(r,g,b) * 0.92);
115
+ glyphs += vec3(r,g,b) * rimReflection * uSpecularStrength * 4.5;
116
+ float energy = clamp((abs(wave.x) + abs(wave.w) * 0.02) * uWaveHeight / 36.0, 0.0, 0.35);
117
+ // Reduced motion retains a static material cue instead of a moving wave.
118
+ energy += uReducedHover * uIntensity * 0.18 * (1.0 - smoothstep(0.0, uRadius, length(pixel - uPointer)));
119
+ // Geometric pressing supplies interaction; never add a dark cursor veil.
120
+ glyphs *= 1.0 + energy * slope * 0.12;
121
+ glyphs *= 1.0 + entranceLight * (0.4 + slope * 0.8);
122
+ vec3 color = mix(uRecessColor, mix(uBackgroundColor, glyphs, clamp(max(max(r,g),b) * 3.0,0.0,1.0)), tile);
123
+ if (uOutlineWidth > 0.0 && uOutlineStrength > 0.0) {
124
+ // Material transition at the INSIDE of the bevel, not a painted line.
125
+ // Modulate existing glyph light so empty/dark areas never grow a wireframe.
126
+ float faceEdge = seam + rim;
127
+ float halfWidth = uOutlineWidth * pixelToTile * 0.5;
128
+ float transitionWidth = max(halfWidth + aa, aa * 2.0);
129
+ float lip = exp(-2.0 * pow((nearest - faceEdge) / transitionWidth, 2.0));
130
+ float shadow = exp(-2.0 * pow((nearest - (faceEdge - halfWidth * 1.5)) / transitionWidth, 2.0));
131
+ float facing = max(dot(normalize(gradient), normalize(light.xy)), 0.0);
132
+ color *= 1.0 - shadow * uOutlineStrength * tile * 0.22;
133
+ color *= 1.0 + lip * uOutlineStrength * tile * (facing * 0.28 - 0.08);
134
+ }
135
+ color = mix(uBackgroundColor, color, entrance);
136
+ outColor = vec4(clamp(color, 0.0, 1.0), uOpacity);
137
+ }
138
+ \`;var at=Object.freeze({speed:.87,glyphSize:9,tileDensity:6.7,tileShear:-.31,tileGap:18.5,outlineWidth:1.25,outlineStrength:.6,bevelWidth:.13,bevelSoftness:.1,refractionStrength:46,chromaticSpread:.66,specularExponent:256,specularStrength:1,patternFreqX:9.4,patternFreqY:4,patternFreqXY:10,glyphColor:"#ffffff",recessColor:"#000000",backgroundColor:"#000000",opacity:.6,dpr:1.5,cursorInteraction:!0,cursorRadius:110,cursorIntensity:1,cursorRecovery:.95,waveSpeed:5.5,waveHeight:36,clickStrength:1.5}),Ge=Object.freeze({speed:[0,3,.01],glyphSize:[4,24,1],tileDensity:[1,12,.1],tileShear:[-.5,.5,.01],bevelWidth:[0,.5,.005],tileGap:[0,40,.5],outlineWidth:[0,6,.25],outlineStrength:[0,1,.01],bevelSoftness:[.01,.4,.005],refractionStrength:[0,120,1],chromaticSpread:[0,1,.01],specularExponent:[1,256,1],specularStrength:[0,3,.01],patternFreqX:[0,20,.1],patternFreqY:[0,20,.1],patternFreqXY:[0,20,.1],opacity:[0,1,.01],dpr:[1,3,.1],cursorRadius:[20,400,1],cursorIntensity:[0,3,.01],cursorRecovery:[.4,4,.05],waveSpeed:[1,12,.1],waveHeight:[0,80,1],clickStrength:[0,3,.01]});function ve(e={}){let n={...at};for(let o of Object.keys(Ge)){let[r,i]=Ge[o],a=e[o];typeof a=="number"&&Number.isFinite(a)&&(n[o]=Math.min(i,Math.max(r,a)))}for(let o of["glyphColor","recessColor","backgroundColor"])typeof e[o]=="string"&&/^#[\\da-f]{6}$/i.test(e[o])&&(n[o]=e[o]);return typeof e.cursorInteraction=="boolean"&&(n.cursorInteraction=e.cursorInteraction),n}function Ce(e){return[1,3,5].map(n=>parseInt(e.slice(n,n+2),16)/255)}function Ue(e,n,o,r,i,a){let p=Math.max(e,n,1),d=(i-e*.5)/p,f=(n*.5-a)/p;return[(d-r*f)*o+.42,(r*d+f)*o+.35]}function Ee(e,n,o,r){let i=[[0,0],[e,0],[0,n],[e,n]].map(([g,E])=>Ue(e,n,o,r,g,E)),a=Math.floor(Math.min(...i.map(g=>g[0])))-2,p=Math.floor(Math.min(...i.map(g=>g[1])))-2,d=Math.floor(Math.max(...i.map(g=>g[0])))+3-a,f=Math.floor(Math.max(...i.map(g=>g[1])))+3-p,v=d*f;return{width:e,height:n,density:o,shear:r,columns:d,rows:f,originX:a,originY:p,layoutKey:\`\${e}:\${n}:\${o}:\${r}\`,heights:new Float32Array(v),velocities:new Float32Array(v),accelerations:new Float32Array(v),data:new Float32Array(v*4),active:!1,dirty:!0,quietFor:0}}function Y(e){e.heights.fill(0),e.velocities.fill(0),e.data.fill(0),e.active=!1,e.dirty=!0,e.quietFor=0}function we(e,n,o,r,i){if(!Number.isFinite(r)||r===0)return;let[a,p]=Ue(e.width,e.height,e.density,e.shear,n,o),d=Math.max(e.width,e.height)/(e.density*Math.sqrt(1+e.shear*e.shear)),f=Math.max(1e-4,i/(3*d));for(let v=0;v<e.rows;v++)for(let g=0;g<e.columns;g++){let E=Math.max(Math.abs(e.originX+g+.5-a)-.5,0),t=Math.max(Math.abs(e.originY+v+.5-p)-.5,0),l=E*E+t*t;if(l>f*f*9)continue;let y=Math.exp(-l/(2*f*f)),b=v*e.columns+g;e.velocities[b]=Math.max(-36,Math.min(36,e.velocities[b]+r*y))}e.active=!0,e.quietFor=0}function ze(e,n,o,r,i,a,p,d){let f=Math.hypot(r-n,i-o);if(f<.5||d<=0)return;let v=f/Math.max(a,.004),g=.7+Math.min(2,v/1e3),E=Math.max(e.width,e.height)/e.density,t=Math.min(64,Math.max(1,Math.ceil(f/Math.min(24,E*.22)))),l=-Math.min(f,120)*.08*d*g/t;for(let y=1;y<=t;y++){let b=y/t;we(e,n+(r-n)*b,o+(i-o)*b,l,p)}}function q(e,n,o){return n<0||n>=e.columns||o<0||o>=e.rows?0:e.heights[o*e.columns+n]}function ye(e){for(let n=0;n<e.rows;n++)for(let o=0;o<e.columns;o++){let r=n*e.columns+o;e.data[r*4]=e.heights[r],e.data[r*4+1]=(q(e,o+1,n)-q(e,o-1,n))*.5,e.data[r*4+2]=(q(e,o,n+1)-q(e,o,n-1))*.5,e.data[r*4+3]=e.velocities[r]}e.dirty=!0}function Ne(e,n,o,r){if(!e.active||n<=0)return;if(e.quietFor+=n,e.quietFor>=r){Y(e);return}let i=Math.min(n,.05),a=Math.ceil(i*120),p=i/a,d=o*o,f=12/Math.max(r,.4);for(let E=0;E<a;E++){for(let t=0;t<e.rows;t++)for(let l=0;l<e.columns;l++){let y=t*e.columns+l,b=e.heights[y],A=q(e,l-1,t)+q(e,l+1,t)+q(e,l,t-1)+q(e,l,t+1)-b*4,M=l<2||t<2||l>=e.columns-2||t>=e.rows-2?1.6:1;e.accelerations[y]=d*A-36*b-f*M*e.velocities[y]}for(let t=0;t<e.heights.length;t++)e.velocities[t]+=e.accelerations[t]*p,e.heights[t]+=e.velocities[t]*p}let v=0,g=0;for(let E=0;E<e.heights.length;E++)v=Math.max(v,Math.abs(e.heights[E])),g=Math.max(g,Math.abs(e.velocities[E]));v<2e-4&&g<.002?Y(e):ye(e)}var st=/(token|cookie|password|secret|credential|authorization|apikey)/i,ct=/^(content|text|body|prompt|messages|title|filename|name|raw|data|database64|commandline|sessionid|accountid|threadid|projectid)$|(?:path|url|uri)$/i;function X(e){return e.slice(0,8e3).replace(/\\b[A-Za-z][A-Za-z0-9+.-]*:\\/\\/[^\\s"'<>]+/g,o=>{try{let r=new URL(o);if(["127.0.0.1","localhost","[::1]"].includes(r.hostname)&&!r.username&&!r.password&&["/json/version","/json/list","/"].includes(r.pathname))return\`\${r.origin}\${r.pathname}\`}catch{}return"[url]"}).replace(/(?:\\b[A-Za-z]:[\\\\/]|\\\\\\\\|\\/(?:Users|home|tmp|var|etc|opt|mnt)\\/|~\\/)[^\\r\\n"'<>]*/g,"[path]").replace(/\\b(?:Bearer\\s+\\S+|(?:authorization|password|secret|(?:access[_-]?|refresh[_-]?)?token|api[_-]?key|cookie)\\s*[:=]\\s*[^,;\\r\\n]+)/gi,"[credential]").replace(/\\bsk-[A-Za-z0-9_-]{8,}|\\beyJ[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+/g,"[credential]").replace(/\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b/g,"[email]").slice(0,4e3)+(e.length>8e3?" [truncated]":"")}function qe(e){let n=256,o=new WeakSet,r=(i,a)=>{if(--n<0||a>6)return"[truncated]";if(typeof i=="string")return X(i);if(i===null||typeof i=="boolean"||typeof i=="number")return i;if(typeof i!="object")return"[unsupported]";if(o.has(i))return"[circular]";if(o.add(i),i instanceof Error)return{name:X(i.name),message:X(i.message)};if(Array.isArray(i))return i.slice(0,128).map(d=>r(d,a+1));let p=Object.create(null);for(let[d,f]of Object.entries(i).slice(0,128)){let v=d.replace(/[^a-z0-9]/gi,"");p[X(d).slice(0,160)]=st.test(v)||ct.test(v)?"[redacted]":r(f,a+1)}return p};try{return r(e,0)}catch{return{redactionFailed:!0}}}var lt=Symbol.for("code-codex:runtime-events:v1"),ut=window,re=ut[lt]??={events:[],dropped:0};function Xe(e,n,o,r={}){let i={source:X(e).slice(0,160),action:X(n).slice(0,160),outcome:X(o).slice(0,160),details:{...qe(r),observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}},a=new TextEncoder().encode(JSON.stringify(i)).length;a>7e3&&(i.details={truncated:!0,originalBytes:a,observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}),re.events.push(i),re.events.length>1e3&&(re.events.splice(0,200),re.dropped+=200)}var dt=Symbol.for("code-codex:background-startup-hold:v1");function be(){let e=window;return e[dt]??={active:!1,layers:new Set,next:-1,pending:new Map,painted:new WeakSet,openings:new WeakMap}}function ft(e){return e.closest("[data-code-codex-particle-layer]")}function pt(e,n){n.native=requestAnimationFrame(o=>{let r=be();n.native=void 0,r.pending.has(e)&&(r.active&&r.painted.has(n.layer)||(r.pending.delete(e),r.active&&(r.painted.add(n.layer),r.layers.add(n.layer),Xe("background-opening","initial frame","prepared")),n.callback(o)))})}function Ve(e,n){let o=ft(e);if(!o)return requestAnimationFrame(n);let r=be(),i=r.next--,a={layer:o,callback:n};return r.pending.set(i,a),pt(i,a),i}function je(e){if(e>=0){cancelAnimationFrame(e);return}let n=be(),o=n.pending.get(e);o?.native!==void 0&&cancelAnimationFrame(o.native),n.pending.delete(e)}var mt=\`#version 300 es
139
+ out vec2 vUV;
140
+ void main() {
141
+ vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
142
+ vUV = p;
143
+ gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
144
+ }\`;function ht(){let e=typeof document.createElement=="function"?document.createElement("canvas"):new OffscreenCanvas(480,48);e.width=480,e.height=48;let n=e.getContext("2d");if(!n)throw new Error("Cannot create the ASCII glyph atlas.");return n.fillStyle="black",n.fillRect(0,0,e.width,e.height),n.fillStyle="white",[[0,0,0,0,0],[0,0,0,0,4],[0,4,0,4,0],[0,0,14,0,0],[0,14,0,14,0],[4,4,31,4,4],[21,14,31,14,21],[10,31,10,31,10],[25,26,4,11,19],[31,17,29,21,31]].forEach((r,i)=>r.forEach((a,p)=>{for(let d=0;d<5;d++)a&1<<4-d&&n.fillRect(i*48+4+d*8,4+p*8,8,8)})),e}function He(e,n,o){let r=e.createShader(n);if(!r)throw new Error("Cannot create shader.");if(e.shaderSource(r,o),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){let i=e.getShaderInfoLog(r);throw e.deleteShader(r),new Error(i||"Shader compilation failed.")}return r}var oe=class{constructor(n,o,r,i=()=>{}){let a={current:r},p={current:null},d={current:null},f=null,v=!0,g=E=>{E&&v&&(f=E),v||i(E??void 0)};this.dispose=(()=>{let E=o.getContext("webgl2",{alpha:!0,antialias:!1,premultipliedAlpha:!1,depth:!1,stencil:!1});if(!E)throw new Error("ASCII_WEBGL_UNAVAILABLE: WebGL 2 is required. Enable hardware acceleration and retry.");let t=E,l=null,y=null,b=null,A=null,M=0,h=!1,m=!1,I=!document.hidden,W=!0,P=1,O=1,T=n.getBoundingClientRect(),H=0,k=0,F=-1e3,S=-1e3,U=!1,s=ve(a.current),c=Ee(1,1,s.tileDensity,s.tileShear),L=null,se=0,R={},B=window.matchMedia("(prefers-reduced-motion: reduce)"),z=B.matches?1:0,tt=2.4,nt=u=>{let w=u instanceof Error?u.message:String(u);g(w),a.current.onError?.(w)},ce=()=>{l&&t.deleteProgram(l),y&&t.deleteTexture(y),b&&t.deleteTexture(b),A&&t.deleteVertexArray(A),l=null,y=null,b=null,A=null};function D(){!M&&!h&&!m&&I&&W&&l&&(M=Ve(n,rt))}let Te=()=>{if(s=ve(a.current),(!s.cursorInteraction||B.matches)&&c.active&&Y(c),!l||m)return;t.useProgram(l);let u={uGlyphSize:s.glyphSize,uTileDensity:s.tileDensity,uTileShear:s.tileShear,uBevelWidth:s.bevelWidth,uTileGap:s.tileGap,uOutlineWidth:s.outlineWidth,uOutlineStrength:s.outlineStrength,uBevelSoftness:s.bevelSoftness,uRefraction:s.refractionStrength,uChromatic:s.chromaticSpread,uSpecularExp:s.specularExponent,uSpecularStrength:s.specularStrength,uRadius:s.cursorRadius,uIntensity:s.cursorIntensity,uOpacity:s.opacity,uWaveHeight:s.waveHeight,uIntroStrength:1};for(let[w,x]of Object.entries(u))t.uniform1f(R[w],x);t.uniform3f(R.uFrequency,s.patternFreqX,s.patternFreqY,s.patternFreqXY);for(let[w,x]of[["uGlyphColor",s.glyphColor],["uRecessColor",s.recessColor],["uBackgroundColor",s.backgroundColor]]){let[N,V,_]=Ce(x);t.uniform3f(R[w],N,V,_)}Q(),k=0,D()};function Q(){T=n.getBoundingClientRect(),P=Math.max(1,T.width),O=Math.max(1,T.height);let u=t.getParameter(t.MAX_RENDERBUFFER_SIZE),w=Math.min(window.devicePixelRatio||1,s.dpr,u/P,u/O),x=Math.max(1,Math.round(P*w)),N=Math.max(1,Math.round(O*w));if((o.width!==x||o.height!==N)&&(o.width=x,o.height=N),t.viewport(0,0,x,N),l){t.useProgram(l),t.uniform2f(R.uResolution,P,O);let V=\`\${P}:\${O}:\${s.tileDensity}:\${s.tileShear}\`;if(c.layoutKey!==V){let _=c;if(c=Ee(P,O,s.tileDensity,s.tileShear),_.active&&_.density===c.density&&_.shear===c.shear){for(let ee=0;ee<c.rows;ee++)for(let te=0;te<c.columns;te++){let pe=te+c.originX-_.originX,me=ee+c.originY-_.originY;if(pe>=0&&me>=0&&pe<_.columns&&me<_.rows){let Be=ee*c.columns+te,De=me*_.columns+pe;c.heights[Be]=_.heights[De],c.velocities[Be]=_.velocities[De]}}c.active=!0,c.quietFor=_.quietFor,ye(c)}t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,b),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,c.columns,c.rows,0,t.RGBA,t.FLOAT,c.data),c.dirty=!1}t.uniform2i(R.uWaveOrigin,c.originX,c.originY)}D()}function rt(u){if(M=0,h||m||!I||!W||!l)return;let w=!a.current.paused&&s.speed>0&&!B.matches,x=k?Math.min((u-k)/1e3,.05):1/60;z<1&&(z=Math.min(1,z+x/tt)),s.cursorInteraction&&!B.matches&&Ne(c,x,s.waveSpeed,s.cursorRecovery),w&&k&&(H+=Math.min((u-k)/1e3,.05)*s.speed),k=u,t.useProgram(l),t.bindVertexArray(A),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,y),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,b),c.dirty&&(t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.texSubImage2D(t.TEXTURE_2D,0,0,0,c.columns,c.rows,t.RGBA,t.FLOAT,c.data),c.dirty=!1),t.uniform1f(R.uTime,H),t.uniform1f(R.uIntroProgress,z),(z<1||o.dataset.introProgress!=="1.0000")&&(o.dataset.introProgress=z.toFixed(4)),t.uniform2f(R.uPointer,F,S),t.uniform1f(R.uReducedHover,B.matches&&U&&s.cursorInteraction?1:0),t.drawArrays(t.TRIANGLES,0,3),(w||c.active||z<1)&&D()}let Se=()=>{let u=null,w=null;try{if(u=He(t,t.VERTEX_SHADER,mt),w=He(t,t.FRAGMENT_SHADER,ge),l=t.createProgram(),!l)throw new Error("Cannot create shader program.");if(t.attachShader(l,u),t.attachShader(l,w),t.linkProgram(l),!t.getProgramParameter(l,t.LINK_STATUS))throw new Error(t.getProgramInfoLog(l)||"Shader linking failed.");R={};for(let x of ge.matchAll(/\\bu[A-Z]\\w*/g))R[x[0]]=t.getUniformLocation(l,x[0]);if(A=t.createVertexArray(),t.activeTexture(t.TEXTURE0),y=t.createTexture(),b=t.createTexture(),!y||!b||!A)throw new Error("Cannot allocate WebGL resources.");t.bindTexture(t.TEXTURE_2D,y),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,ht()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.useProgram(l),t.uniform1i(R.uAtlas,0),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,b),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,c.columns,c.rows,0,t.RGBA,t.FLOAT,c.data),t.uniform1i(R.uWaveGrid,1),g(null),Te()}catch(x){ce(),nt(x)}finally{u&&t.deleteShader(u),w&&t.deleteShader(w)}},$=()=>{je(M),M=0,k=0},le=()=>{L=null,c.active&&performance.now()/1e3-se>=s.cursorRecovery&&Y(c)},Re=()=>{I=!document.hidden,le(),$(),D()},ke=()=>{T=n.getBoundingClientRect()},_e=u=>{F=u.clientX-T.left,S=O-(u.clientY-T.top),U=F>=0&&F<=P&&S>=0&&S<=O},ue=u=>{_e(u),L={x:u.clientX-T.left,y:u.clientY-T.top,time:performance.now()/1e3},s.cursorInteraction&&D()},Ae=u=>{if(u.composedPath().some(V=>V instanceof Element&&V.matches("button,input,select,a,textarea,[contenteditable=true],[role=dialog],[role=menu],[role=slider]"))){L=null,U=!1;return}_e(u);let w=performance.now()/1e3,x=u.clientX-T.left,N=u.clientY-T.top;s.cursorInteraction&&!B.matches&&U&&L&&Math.hypot(x-L.x,N-L.y)>=.5&&s.cursorIntensity>0&&(c.active||(k=0),ze(c,L.x,L.y,x,N,w-L.time,s.cursorRadius,s.cursorIntensity),se=w),L={x,y:N,time:w},s.cursorInteraction&&D()},Z=()=>{U=!1,L=null,D()},Ie=u=>{u.button!==0||u.composedPath().some(w=>w instanceof Element&&w.matches("button,input,select,a,textarea,[contenteditable=true],[role=dialog]"))||(ue(u),s.cursorInteraction&&!B.matches&&s.clickStrength>0&&(c.active||(k=0),we(c,u.clientX-T.left,u.clientY-T.top,-14*s.clickStrength,s.cursorRadius),se=performance.now()/1e3,D()))},Me=u=>{u.pointerType==="touch"&&Z()},Pe=u=>{u.preventDefault(),m=!0,$(),l=null,y=null,b=null,A=null,R={},g("ASCII_CONTEXT_LOST: Waiting for graphics context restoration.")},Oe=()=>{m=!1,le(),Se()},Le=()=>{B.matches&&(Y(c),z=1),$(),D()},de=new ResizeObserver(()=>{m||Q()}),fe=new IntersectionObserver(([u])=>{W=u.isIntersecting,le(),$(),D()});if(Se(),f)throw de.disconnect(),fe.disconnect(),ce(),new Error(f);return de.observe(n),fe.observe(n),p.current=Te,d.current=()=>{z=B.matches?1:0,k=0,D()},window.addEventListener("pointermove",Ae),window.addEventListener("pointerenter",ue),window.addEventListener("pointerdown",Ie),window.addEventListener("pointerleave",Z),window.addEventListener("pointercancel",Z),window.addEventListener("pointerup",Me),document.addEventListener("visibilitychange",Re),window.addEventListener("scroll",ke,{passive:!0,capture:!0}),window.addEventListener("resize",Q),B.addEventListener("change",Le),o.addEventListener("webglcontextlost",Pe),o.addEventListener("webglcontextrestored",Oe),()=>{h=!0,$(),p.current=null,d.current=null,de.disconnect(),fe.disconnect(),window.removeEventListener("pointermove",Ae),window.removeEventListener("pointerenter",ue),window.removeEventListener("pointerdown",Ie),window.removeEventListener("pointerleave",Z),window.removeEventListener("pointercancel",Z),window.removeEventListener("pointerup",Me),document.removeEventListener("visibilitychange",Re),window.removeEventListener("scroll",ke,!0),window.removeEventListener("resize",Q),B.removeEventListener("change",Le),o.removeEventListener("webglcontextlost",Pe),o.removeEventListener("webglcontextrestored",Oe),ce()}})(),v=!1,this.setSettings=E=>{a.current=E,p.current?.()},this.replay=()=>d.current?.(),this.ready=Promise.resolve()}};var Ke=[];function Ye(e,n,o,r){return new oe(e,n,o,r)}var J=globalThis,ie="",$e=0,Ze=!1,j,G,xe=0,Je=!1,Qe=0,C=(e,n={})=>J.postMessage({v:1,session:ie,type:e,...n}),ae=e=>C("failed",{code:"BG_WORKER_RENDER_FAILED",message:String(e instanceof Error?e.message:e).slice(0,1500)});J.addEventListener("error",e=>ae(e.error??e.message));J.addEventListener("unhandledrejection",e=>ae(e.reason));J.addEventListener("message",e=>{let n=e.data;if(!(Ze||!n||n.v!==1||typeof n.session!="string"))try{if(n.type==="init"){if(ie||!(n.canvas instanceof OffscreenCanvas)||n.session.length>100)throw Error("BG_INIT_INVALID: Invalid or duplicate background initialization.");ie=n.session,Fe((r,i)=>C("event",{event:r,value:ne(i)}));let o=he(n.viewport,n.viewport.dpr);G=We(n.canvas,o,()=>{xe++,Je||(Je=!0,C("first-frame",{frames:xe}),n.held===!0&&queueMicrotask(()=>G?.visibility(!1)));let r=performance.now();r-Qe>=1e3&&(Qe=r,C("sample",{frames:xe,at:r}))}),G.motion(n.reduced===!0),j=Ye(G.host,G.canvas,K(n.settings),r=>{r&&ae(r)});return}if(n.session!==ie||!Number.isSafeInteger(n.seq)||n.seq<=$e)return;if($e=n.seq,n.type==="state"){if(n.settings!==void 0){let o=K(n.settings);j.setSettings?j.setSettings(o):j.updateSettings?.(o)}if(n.viewport&&G?.viewport(he(n.viewport,n.viewport.dpr)),typeof n.reduced=="boolean"&&G?.motion(n.reduced),typeof n.visible=="boolean"&&G?.visibility(n.visible),n.input){let{type:o,...r}=n.input;if(!["pointermove","pointerdown","pointerup","pointercancel","pointerleave","wheel","keydown"].includes(o))throw Error("BG_INPUT_METHOD: Unsupported background input.");G?.input(o,K(r))}C("ack",{seq:n.seq});return}if(n.type==="replay"){j.replay?.(),C("ack",{seq:n.seq});return}if(n.type==="call"){if(typeof n.method!="string"||!Ke.includes(n.method)||!Array.isArray(n.args)||n.args.length>8||!Number.isSafeInteger(n.callId))throw Error("BG_KERNEL_COMMAND: The visual kernel command is not supported.");let o=ne(n.args);C("ack",{seq:n.seq}),Promise.resolve().then(()=>j[n.method](...o)).then(r=>C("result",{callId:n.callId,value:ne(r??null)}),r=>C("result",{callId:n.callId,error:String(r).slice(0,1500)}));return}if(n.type==="dispose"){Ze=!0;try{j?.dispose()}finally{G?.dispose(),C("disposed"),setTimeout(()=>J.close(),0)}return}throw Error("BG_WORKER_METHOD: Unsupported background command.")}catch(o){ae(o)}});})();
145
+ `,r,e,i,n)}},Q=Symbol.for("code-codex:background-modules:v1");(window[Q]??=new Map).set("ascii-tiles",{id:"ascii-tiles",api:1,version:"1.0.8",exports:{AsciiTilesRenderer:N},startup(r,e){let i=document.createElement("canvas");return i.style.cssText="width:100%;height:100%;display:block",r.append(i),new N(r,i,U(),e)}});})();