Skip to main content

euv_docs/bundle/
const.rs

1/// CLI flag enabling release profile compilation for multi-locale WASM bundles.
2pub const DOCS_FLAG_RELEASE: &str = "--release";
3/// CLI flag enabling debug profile compilation for multi-locale WASM bundles.
4pub const DOCS_FLAG_DEBUG: &str = "--debug";
5/// CLI flag selecting a single locale to build (`--locale <dir|prefix|label>`).
6pub const DOCS_FLAG_LOCALE: &str = "--locale";
7/// CLI flag forcing legacy single-locale static HTML output even when `locales:` is declared.
8pub const DOCS_FLAG_STATIC_HTML: &str = "--static-html";
9
10pub(crate) const BUNDLE_PKG_DIR: &str = "pkg";
11pub(crate) const BUNDLE_INDEX_HTML: &str = "index.html";
12pub(crate) const BUNDLE_NOT_FOUND_HTML: &str = "404.html";
13pub(crate) const BUNDLE_PUBLIC_DIR: &str = "public";
14pub(crate) const BUNDLE_BUILDER_DIR: &str = "euv-docs-wasm-builder";
15pub(crate) const BUNDLE_TARGET_DIR: &str = "euv-docs-wasm-target";
16pub(crate) const BUNDLE_CRATE_NAME: &str = "euv_docs_site";
17pub(crate) const BUNDLE_SHELL_JSON_FILE: &str = "site_shell.json";
18pub(crate) const BUNDLE_BODIES_BIN_FILE: &str = "site_bodies.euvz";
19pub(crate) const BUNDLE_CARGO_TOML: &str = "Cargo.toml";
20pub(crate) const BUNDLE_SRC_DIR: &str = "src";
21pub(crate) const BUNDLE_LIB_RS: &str = "lib.rs";
22pub(crate) const BUNDLE_WASM_PACK_BIN: &str = "wasm-pack";
23pub(crate) const BUNDLE_ARG_BUILD: &str = "build";
24pub(crate) const BUNDLE_ARG_TARGET: &str = "--target";
25pub(crate) const BUNDLE_ARG_WEB: &str = "web";
26pub(crate) const BUNDLE_ARG_NO_TS: &str = "--no-typescript";
27pub(crate) const BUNDLE_ARG_OUT_DIR: &str = "--out-dir";
28pub(crate) const BUNDLE_ARG_OUT_NAME: &str = "--out-name";
29pub(crate) const BUNDLE_ARG_DEV: &str = "--dev";
30pub(crate) const BUNDLE_ENV_TARGET_DIR: &str = "CARGO_TARGET_DIR";
31pub(crate) const BUNDLE_ENV_RUSTC_WRAPPER: &str = "RUSTC_WRAPPER";
32pub(crate) const BUNDLE_NAME_PREFIX: &str = "euv_docs_";
33pub(crate) const BUNDLE_BG_WASM_SUFFIX: &str = "_bg.wasm";
34pub(crate) const BUNDLE_JS_EXT: &str = ".js";
35pub(crate) const BUNDLE_MJS_EXT: &str = ".mjs";
36pub(crate) const BUNDLE_CSS_EXT: &str = ".css";
37pub(crate) const BUNDLE_FORBIDDEN_DIRS: [&str; 2] = ["js", "webfonts"];
38pub(crate) const BUNDLE_SKIP_FILES: [&str; 1] = [".DS_Store"];
39pub(crate) const BUNDLE_EXPORT_PREFIX: &str = "export ";
40pub(crate) const BUNDLE_EXPORT_BRACE: &str = "export {";
41pub(crate) const BUNDLE_EXPORT_DEFAULT: &str = "export default ";
42pub(crate) const BUNDLE_WASM_BINDGEN_VER: &str = "0.2";
43pub(crate) const BUNDLE_DIR_CORE: &str = "core";
44pub(crate) const BUNDLE_DIR_MACROS: &str = "macros";
45pub(crate) const BUNDLE_DIR_UI: &str = "ui";
46pub(crate) const BUNDLE_DEFAULT_LOCALE_SUFFIX: &str = "default";
47pub(crate) const BUNDLE_ESC_AMP: &str = "&amp;";
48pub(crate) const BUNDLE_ESC_LT: &str = "&lt;";
49pub(crate) const BUNDLE_ESC_GT: &str = "&gt;";
50pub(crate) const BUNDLE_ESC_QUOT: &str = "&quot;";
51pub(crate) const BUNDLE_HTML_DOCTYPE_OPEN: &str = "<!DOCTYPE html>\n<html lang=\"";
52pub(crate) const BUNDLE_ERR_NO_LOCALES: &str =
53    "No locales declared in root README.md frontmatter for multi-locale WASM build";
54pub(crate) const BUNDLE_ERR_NO_MATCHING_LOCALE: &str =
55    "No locale matched the requested --locale filter";
56pub(crate) const BUNDLE_ERR_WASM_PACK: &str = "wasm-pack build failed";
57pub(crate) const BUNDLE_WRAPPER_LIB_RS: &str = r#"use wasm_bindgen::prelude::wasm_bindgen;
58
59const SITE_SHELL_JSON: &str = include_str!("site_shell.json");
60const SITE_BODIES_BIN: &[u8] = include_bytes!("site_bodies.euvz");
61
62#[wasm_bindgen]
63pub fn euv_docs_web_start() -> u64 {
64    euv_docs::boot_wasm_docs_compressed_bundle(SITE_SHELL_JSON, SITE_BODIES_BIN)
65}
66
67#[wasm_bindgen]
68pub fn euv_docs_render_route(route: &str) -> u64 {
69    euv_docs::wasm_docs_render_route(route)
70}
71
72#[wasm_bindgen]
73pub fn euv_docs_pointer_move(x: f32, y: f32) -> u64 {
74    euv_docs::wasm_docs_pointer_move(x, y)
75}
76
77#[wasm_bindgen]
78pub fn euv_docs_pointer_down(x: f32, y: f32) -> u64 {
79    euv_docs::wasm_docs_pointer_down(x, y)
80}
81
82#[wasm_bindgen]
83pub fn euv_docs_pointer_up(x: f32, y: f32) -> u64 {
84    euv_docs::wasm_docs_pointer_up(x, y)
85}
86
87#[wasm_bindgen]
88pub fn euv_docs_pointer_event(
89    kind: u8,
90    pointer_id: u32,
91    is_touch: bool,
92    x: f32,
93    y: f32,
94    pressure: f32,
95) -> u64 {
96    euv_docs::wasm_docs_pointer_event(kind, pointer_id, is_touch, x, y, pressure)
97}
98
99#[wasm_bindgen]
100pub fn euv_docs_scroll(dx: f32, dy: f32) -> u64 {
101    euv_docs::wasm_docs_scroll(dx, dy)
102}
103
104#[wasm_bindgen]
105pub fn euv_docs_scroll_at(x: f32, y: f32, dx: f32, dy: f32) -> u64 {
106    euv_docs::wasm_docs_scroll_at(x, y, dx, dy)
107}
108
109#[wasm_bindgen]
110pub fn euv_docs_key_down(key: &str) -> u64 {
111    euv_docs::wasm_docs_key_down(key)
112}
113
114#[wasm_bindgen]
115pub fn euv_docs_key_down_mods(key: &str, ctrl: bool, shift: bool, alt: bool, meta: bool) -> u64 {
116    euv_docs::wasm_docs_key_down_mods(key, ctrl, shift, alt, meta)
117}
118
119#[wasm_bindgen]
120pub fn euv_docs_text_input(text: &str) -> u64 {
121    euv_docs::wasm_docs_text_input(text)
122}
123
124#[wasm_bindgen]
125pub fn euv_docs_has_focused_input() -> bool {
126    euv_docs::wasm_docs_has_focused_input()
127}
128
129#[wasm_bindgen]
130pub fn euv_docs_copy_selected() -> String {
131    euv_docs::wasm_docs_copy_selected()
132}
133
134#[wasm_bindgen]
135pub fn euv_docs_resize(width: u32, height: u32, dpr: f32) -> u64 {
136    euv_docs::wasm_docs_resize(width, height, dpr)
137}
138
139#[wasm_bindgen]
140pub fn euv_docs_resize_physical(phys_w: u32, phys_h: u32, dpr: f32) -> u64 {
141    euv_docs::wasm_docs_resize_physical(phys_w, phys_h, dpr)
142}
143
144#[wasm_bindgen]
145pub fn euv_docs_sync_safe_area() -> u64 {
146    euv_docs::wasm_docs_sync_safe_area()
147}
148
149#[wasm_bindgen]
150pub fn euv_docs_tick(dt_secs: f32) -> u64 {
151    euv_docs::wasm_docs_tick(dt_secs)
152}
153"#;
154pub(crate) const BUNDLE_HTML_HEAD_MID: &str = "\">\n<head>\n<meta charset=\"utf-8\"/>\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,viewport-fit=cover\"/>\n<meta name=\"description\" content=\"";
155pub(crate) const BUNDLE_HTML_DESC_END: &str = "\"/>\n<link rel=\"icon\" type=\"image/png\" href=\"";
156pub(crate) const BUNDLE_HTML_ICON_MID: &str = "\"/>\n<link rel=\"apple-touch-icon\" href=\"";
157pub(crate) const BUNDLE_HTML_TITLE_OPEN: &str = "\"/>\n<title>";
158pub(crate) const BUNDLE_HTML_STYLE_AND_BODY: &str = "</title>\n<style>:root{--euv-safe-top:env(safe-area-inset-top,0px);--euv-safe-right:env(safe-area-inset-right,0px);--euv-safe-bottom:env(safe-area-inset-bottom,0px);--euv-safe-left:env(safe-area-inset-left,0px);--euv-bg:#09090b;--euv-fg:#fafafa;--euv-muted:#a1a1aa;--euv-track:rgba(255,255,255,0.1);--euv-ring:rgba(255,255,255,0.1);--euv-surface:rgba(24,24,27,0.78);--euv-glow:rgba(99,102,241,0.18);}@media (prefers-color-scheme:light){:root{--euv-bg:#fafafa;--euv-fg:#09090b;--euv-muted:#52525b;--euv-track:rgba(9,9,11,0.09);--euv-ring:rgba(9,9,11,0.09);--euv-surface:rgba(255,255,255,0.88);--euv-glow:rgba(99,102,241,0.12);}}html,body{margin:0;padding:0;width:100vw;height:100vh;height:100dvh;overflow:hidden;background:var(--euv-bg);touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;outline:none;}canvas{display:block;width:100%;height:100%;touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;outline:none;}canvas:focus,canvas:focus-visible{outline:none;}#euv-wasm-loader{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;background:radial-gradient(620px circle at 50% 42%,var(--euv-glow),transparent 68%),var(--euv-bg);color:var(--euv-fg);font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Inter,sans-serif;transition:opacity 220ms cubic-bezier(0.22,1,0.36,1);}.euv-wl-card{width:min(320px,86vw);display:flex;flex-direction:column;align-items:center;gap:14px;}.euv-wl-mark{width:56px;height:56px;border-radius:16px;padding:6px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;background:var(--euv-surface);border:1px solid var(--euv-ring);box-shadow:0 8px 28px rgba(0,0,0,0.12);overflow:hidden;}.euv-wl-mark img{display:block;width:42px;height:42px;object-fit:contain;}.euv-wl-title{font-size:16px;font-weight:600;letter-spacing:-0.015em;text-align:center;line-height:1.3;margin:0;}.euv-wl-track{width:100%;height:4px;border-radius:999px;background:var(--euv-track);overflow:hidden;position:relative;}.euv-wl-bar{height:100%;width:0%;border-radius:999px;background:linear-gradient(90deg,#6366f1 0%,#38bdf8 55%,#22d3ee 100%);transition:width 140ms cubic-bezier(0.22,1,0.36,1);position:relative;overflow:hidden;}.euv-wl-bar::after{content:\"\";position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.45) 50%,transparent 100%);transform:translateX(-100%);animation:euv-wl-shimmer 1.3s ease-in-out infinite;}.euv-wl-meta{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:12px;font-weight:500;color:var(--euv-muted);font-variant-numeric:tabular-nums;}.euv-wl-err{display:none;width:100%;flex-direction:column;align-items:center;gap:10px;text-align:center;}.euv-wl-err-msg{font-size:12px;color:#ef4444;line-height:1.45;}.euv-wl-retry{appearance:none;border:1px solid var(--euv-ring);background:var(--euv-surface);color:var(--euv-fg);font:600 12px/1 -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,sans-serif;padding:8px 16px;border-radius:999px;cursor:pointer;}@keyframes euv-wl-shimmer{0%{transform:translateX(-100%);}100%{transform:translateX(220%);}}</style>\n</head>\n<body>\n<div id=\"euv-wasm-loader\" role=\"status\" aria-live=\"polite\" aria-label=\"Loading WebAssembly\"><div class=\"euv-wl-card\"><div class=\"euv-wl-mark\" aria-hidden=\"true\"><img src=\"";
159pub(crate) const BUNDLE_HTML_LOGO_END: &str = "\" width=\"42\" height=\"42\" alt=\"\" decoding=\"sync\"/></div><div class=\"euv-wl-title\" id=\"euv-wasm-title\">";
160pub(crate) const BUNDLE_HTML_LOADER_END: &str = "</div><div class=\"euv-wl-track\"><div class=\"euv-wl-bar\" id=\"euv-wasm-bar\"></div></div><div class=\"euv-wl-meta\"><span id=\"euv-wasm-status\">Downloading WebAssembly…</span><span id=\"euv-wasm-pct\">0%</span></div><div class=\"euv-wl-err\" id=\"euv-wasm-err\"><span class=\"euv-wl-err-msg\" id=\"euv-wasm-err-msg\"></span><button type=\"button\" class=\"euv-wl-retry\" id=\"euv-wasm-retry\">Retry</button></div></div></div>\n<script type=\"module\">\n";
161pub(crate) const BUNDLE_HTML_BOOT_PREFIX: &str = "\nconst __euvWasmUrl='./pkg/";
162pub(crate) const BUNDLE_HTML_BOOT_SUFFIX: &str = r#"';
163const __euvLoader=document.getElementById('euv-wasm-loader');
164const __euvBar=document.getElementById('euv-wasm-bar');
165const __euvStatus=document.getElementById('euv-wasm-status');
166const __euvPct=document.getElementById('euv-wasm-pct');
167const __euvErr=document.getElementById('euv-wasm-err');
168const __euvErrMsg=document.getElementById('euv-wasm-err-msg');
169const __euvRetry=document.getElementById('euv-wasm-retry');
170const __euvFmtMb=(b)=>(b/1048576).toFixed(1)+' MB';
171const __euvSetProg=(p,msg)=>{const c=Math.max(0,Math.min(100,Math.round(p)));if(__euvBar)__euvBar.style.width=c+'%';if(__euvPct)__euvPct.textContent=c+'%';if(__euvStatus&&msg)__euvStatus.textContent=msg;};
172async function __euvFetchWasm(url){
173const resp=await fetch(url);
174if(!resp.ok)throw new Error('HTTP '+resp.status);
175const total=Number(resp.headers.get('content-length')||0);
176if(!resp.body||typeof resp.body.getReader!=='function'){__euvSetProg(50,'Downloading WebAssembly…');return new Uint8Array(await resp.arrayBuffer());}
177const reader=resp.body.getReader();
178const chunks=[];let loaded=0;
179for(;;){const r=await reader.read();if(r.done)break;chunks.push(r.value);loaded+=r.value.byteLength;if(total>0){__euvSetProg(Math.min(90,(loaded/total)*90),__euvFmtMb(loaded)+' / '+__euvFmtMb(total));}else{__euvSetProg(Math.min(85,85*(1-Math.exp(-loaded/3145728))),__euvFmtMb(loaded));}}
180const out=new Uint8Array(loaded);let off=0;
181for(const ch of chunks){out.set(ch,off);off+=ch.byteLength;}
182return out;
183}
184async function __euvBoot(){
185if(__euvErr)__euvErr.style.display='none';
186__euvSetProg(0,'Downloading WebAssembly…');
187try{
188if(typeof fetch==='function'&&typeof ReadableStream!=='undefined'){
189const bytes=await __euvFetchWasm(__euvWasmUrl);
190__euvSetProg(92,'Compiling WebAssembly…');
191await __wbg_init({ module_or_path: bytes });
192}else{
193__euvSetProg(50,'Loading WebAssembly…');
194await __wbg_init({ module_or_path: __euvWasmUrl });
195}
196__euvSetProg(97,'Starting…');
197euv_docs_web_start();
198let obsPhysW=0,obsPhysH=0,lastDpr=0,lastPw=0,lastPh=0;
199function syncSize(){const dpr=Math.max(1,Math.min(6,window.devicePixelRatio||1));const el=document.querySelector('canvas');let cssW=0,cssH=0;if(el){const r=el.getBoundingClientRect();if(r.width>=64&&r.height>=64){cssW=r.width;cssH=r.height;}}if(cssW<64||cssH<64){const vv=window.visualViewport;const vvScale=(vv&&typeof vv.scale==='number'&&vv.scale>0)?vv.scale:1;if(vv&&vvScale<=1.01&&vv.width>=64&&vv.height>=64){cssW=vv.width;cssH=vv.height;}else{const de=document.documentElement;cssW=(de&&de.clientWidth)||window.innerWidth||1200;cssH=(de&&de.clientHeight)||window.innerHeight||800;}}const estW=Math.max(64,Math.min(8192,Math.round(cssW*dpr)));const estH=Math.max(64,Math.min(8192,Math.round(cssH*dpr)));const useObs=obsPhysW>=64&&obsPhysH>=64&&Math.abs(obsPhysW-estW)<=2&&Math.abs(obsPhysH-estH)<=2;const pw=useObs?obsPhysW:estW;const ph=useObs?obsPhysH:estH;if(pw!==lastPw||ph!==lastPh||Math.abs(dpr-lastDpr)>0.005){lastPw=pw;lastPh=ph;lastDpr=dpr;euv_docs_resize_physical(pw,ph,dpr);euv_docs_sync_safe_area();requestAnimationFrame(()=>{euv_docs_tick(0);});}}
200syncSize();
201window.addEventListener('resize',syncSize);
202window.addEventListener('orientationchange',()=>{syncSize();setTimeout(syncSize,120);});
203document.addEventListener('fullscreenchange',()=>{syncSize();setTimeout(syncSize,60);});
204if(window.visualViewport){window.visualViewport.addEventListener('resize',syncSize);}
205if(typeof ResizeObserver==='function'){const target=document.querySelector('canvas')||document.documentElement;const ro=new ResizeObserver((entries)=>{if(entries&&entries.length>0){const e=entries[entries.length-1];const d=e.devicePixelContentBoxSize;if(d&&d.length>0){obsPhysW=Math.round(d[0].inlineSize||0);obsPhysH=Math.round(d[0].blockSize||0);}}syncSize();});window.__euvDocsRo=ro;try{ro.observe(target,{box:'device-pixel-content-box'});}catch(_){ro.observe(target);}}
206if(typeof matchMedia==='function'){const watchDpr=()=>{const q='(resolution: '+(window.devicePixelRatio||1)+'dppx)';const m=matchMedia(q);window.__euvDocsDprMql=m;const on=()=>{if(window.__euvDocsDprMql===m){window.__euvDocsDprMql=null;}syncSize();watchDpr();};if(m.addEventListener){m.addEventListener('change',on,{once:true});}else if(m.addListener){m.addListener(on);}};watchDpr();}
207if(typeof setInterval==='function'){window.__euvDocsDprTimer=setInterval(()=>{const cur=Math.max(1,Math.min(6,window.devicePixelRatio||1));if(Math.abs(cur-lastDpr)>0.005){syncSize();}},250);}
208window.addEventListener('hashchange',()=>{const h=(window.location.hash||'').replace(/^#/,'');if(h.startsWith('/'))euv_docs_render_route(h);syncImeFocus();});
209const imeEl=document.createElement('input');
210imeEl.id='euv-docs-ime-proxy';imeEl.type='text';imeEl.autocomplete='off';imeEl.autocorrect='off';imeEl.autocapitalize='off';imeEl.spellcheck=false;imeEl.setAttribute('aria-label','euv docs text input');
211imeEl.style.cssText='position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;pointer-events:none;border:0;padding:0;margin:0;z-index:-1;font-size:16px;outline:none;-webkit-tap-highlight-color:transparent;';
212if(document.body)document.body.appendChild(imeEl);
213let imeActive=false,imeComposing=false;
214const flushIme=(fallback)=>{const t=imeEl.value||fallback||'';imeEl.value='';if(t&&typeof euv_docs_text_input==='function'){euv_docs_text_input(t);}};
215function syncImeFocus(){const has=typeof euv_docs_has_focused_input==='function'&&!!euv_docs_has_focused_input();if(has){imeActive=true;if(document.activeElement!==imeEl){try{imeEl.focus({preventScroll:true});}catch(_){try{imeEl.focus();}catch(__){}}}}else if(imeActive){imeActive=false;imeComposing=false;imeEl.value='';if(document.activeElement===imeEl){try{imeEl.blur();}catch(_){}}}}
216imeEl.addEventListener('focus',()=>{imeActive=true;});
217imeEl.addEventListener('blur',()=>{imeActive=false;imeComposing=false;imeEl.value='';});
218imeEl.addEventListener('compositionstart',()=>{imeComposing=true;});
219imeEl.addEventListener('compositionupdate',()=>{imeComposing=true;});
220imeEl.addEventListener('compositionend',(ev)=>{imeComposing=false;flushIme(ev&&typeof ev.data==='string'?ev.data:'');});
221imeEl.addEventListener('input',(ev)=>{if(imeComposing||(ev&&ev.isComposing))return;flushIme('');});
222const cvs=document.querySelector('canvas');
223if(cvs){
224const pt=(ev)=>{const r=cvs.getBoundingClientRect();return [ev.clientX-r.left,ev.clientY-r.top];};
225const isTouch=(ev)=>ev.pointerType==='touch';
226const press=(ev)=>(typeof ev.pressure==='number'&&ev.pressure>0)?ev.pressure:(ev.buttons>0?1.0:0.0);
227cvs.addEventListener('pointerdown',(ev)=>{const [x,y]=pt(ev);if(isTouch(ev)){try{cvs.setPointerCapture(ev.pointerId);}catch(_){}}euv_docs_pointer_event(1,ev.pointerId>>>0,isTouch(ev),x,y,press(ev)||1.0);syncImeFocus();});
228cvs.addEventListener('pointermove',(ev)=>{const [x,y]=pt(ev);euv_docs_pointer_event(0,ev.pointerId>>>0,isTouch(ev),x,y,press(ev));});
229cvs.addEventListener('pointerup',(ev)=>{const [x,y]=pt(ev);try{cvs.releasePointerCapture(ev.pointerId);}catch(_){}euv_docs_pointer_event(2,ev.pointerId>>>0,isTouch(ev),x,y,0.0);syncImeFocus();});
230cvs.addEventListener('pointercancel',(ev)=>{const [x,y]=pt(ev);try{cvs.releasePointerCapture(ev.pointerId);}catch(_){}euv_docs_pointer_event(3,ev.pointerId>>>0,isTouch(ev),x,y,0.0);});
231cvs.addEventListener('wheel',(ev)=>{ev.preventDefault();const [x,y]=pt(ev);const mult=ev.deltaMode===1?24:(ev.deltaMode===2?(window.innerHeight||800):1);euv_docs_scroll_at(x,y,ev.deltaX*mult,ev.deltaY*mult);},{passive:false});
232}
233window.addEventListener('keydown',(ev)=>{if(imeComposing||ev.isComposing||ev.key==='Process'||ev.keyCode===229){return;}const cmd=!!(ev.ctrlKey||ev.metaKey);const isSinglePrintable=!cmd&&!ev.altKey&&typeof ev.key==='string'&&Array.from(ev.key).length===1;if(imeActive&&isSinglePrintable){return;}if((cmd&&(ev.key==='k'||ev.key==='K'||ev.key==='a'||ev.key==='A'))||(!cmd&&(ev.key==='PageDown'||ev.key==='PageUp'||ev.key==='Home'||ev.key==='End'||ev.key==='ArrowDown'||ev.key==='ArrowUp'||ev.key==='ArrowLeft'||ev.key==='ArrowRight'||ev.key==='Backspace'||ev.key==='Delete'||(imeActive&&ev.key==='Tab')))){ev.preventDefault();}euv_docs_key_down_mods(ev.key,!!ev.ctrlKey,!!ev.shiftKey,!!ev.altKey,!!ev.metaKey);syncImeFocus();});
234window.addEventListener('paste',(ev)=>{if(!imeActive)return;const t=ev.clipboardData&&ev.clipboardData.getData('text/plain');if(t&&typeof euv_docs_text_input==='function'){ev.preventDefault();euv_docs_text_input(t);}});
235document.addEventListener('copy',(ev)=>{const t=ev.target;if(t&&t.getAttribute&&t.getAttribute('data-euv-copy-proxy')==='1'){return;}const s=euv_docs_copy_selected();if(s&&ev.clipboardData){ev.clipboardData.setData('text/plain',s);ev.preventDefault();}});
236let prevTs=performance.now();
237function frame(ts){const curDpr=Math.max(1,Math.min(6,window.devicePixelRatio||1));if(Math.abs(curDpr-lastDpr)>0.005){syncSize();}const dt=Math.min(0.1,Math.max(0,(ts-prevTs)/1000));prevTs=ts;euv_docs_tick(dt);requestAnimationFrame(frame);}
238requestAnimationFrame(frame);
239__euvSetProg(100,'Ready');
240requestAnimationFrame(()=>{if(__euvLoader){__euvLoader.style.opacity='0';setTimeout(()=>{if(__euvLoader)__euvLoader.remove();},240);}});
241}catch(err){
242if(__euvStatus)__euvStatus.textContent='Load failed';
243if(__euvErrMsg)__euvErrMsg.textContent=(err&&err.message)?String(err.message):'Failed to load WebAssembly module';
244if(__euvErr)__euvErr.style.display='flex';
245}
246}
247if(__euvRetry)__euvRetry.addEventListener('click',__euvBoot);
248__euvBoot();
249</script>
250</body>
251</html>
252"#;