@effindomv2/runtime 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge.js +3 -3
- package/dist/bridge.js.map +3 -3
- package/dist/effindom.v2.manifest.json +17 -17
- package/dist/runtime/{effindom-ui-v2.wasm32-simd.ThSDClMnSWdwf9d89JZfYor0G1Z6OxR4lOc75rNRuD4.js.symbols → effindom-ui-v2.wasm32-simd.0xi4fGlqRJFxmbgnXvyIDcuMXBhbEzh5nGnuqg_PfmI.js.symbols} +966 -960
- package/dist/runtime/{effindom-ui-v2.wasm32.wved0xEV4EKXVNBU3Sx7giD4faxD2YII9sQ2N_wCP4I.js → effindom-ui-v2.wasm32-simd.45BtMlLa8o8Qf2e2okFB8YJgZWcUT1WDDIgtS_0jUxw.js} +1 -1
- package/dist/runtime/{effindom-ui-v2.wasm32-simd.0Mas1XD03eYvemryTioWaZOBuBA5ij7MFlTa8CgEZWs.wasm → effindom-ui-v2.wasm32-simd.JEwyB4hRYfEZPNeJaj0o66_MdEmUF5ZT_JpejBZ7gb4.wasm} +0 -0
- package/dist/runtime/{effindom-ui-v2.wasm32-simd.wved0xEV4EKXVNBU3Sx7giD4faxD2YII9sQ2N_wCP4I.js → effindom-ui-v2.wasm32.45BtMlLa8o8Qf2e2okFB8YJgZWcUT1WDDIgtS_0jUxw.js} +1 -1
- package/dist/runtime/{effindom-ui-v2.wasm32.tp53X7nHfG_EUq29naDyElfnqhMw2D1Tr1T-BJAYO7w.wasm → effindom-ui-v2.wasm32.QSYIka3OwSNk1LYADdyjtB6GxOyphGBWK3B0ImYo6A4.wasm} +0 -0
- package/dist/runtime/{effindom-ui-v2.wasm32.H7kYg99bT9ADGh0uUvj6H9Dk1L058nVFLv_4R79IXW8.js.symbols → effindom-ui-v2.wasm32.gLKQZGkzDC8oz-QmMIlr4ip7qZ3jHUx-nWN-GUZttFs.js.symbols} +1657 -1652
- package/dist/runtime/{effindom-ui-v2.wasm64-simd.RQaXil22Chu63-vxK9oOuX8wUY044kbo190oYIbBU4M.js.symbols → effindom-ui-v2.wasm64-simd.ChzyWiWKqlexTBfz-_t7pUTGlZpu70XKdI9RqIhmV6Y.js.symbols} +991 -985
- package/dist/runtime/{effindom-ui-v2.wasm64-simd.86tk9Z3xIpgTOykET_8Nn9iUVJnp1AzOHW4fVQRGtQE.wasm → effindom-ui-v2.wasm64-simd.SjylyjV2dXFBkejYTcLBILgsxI92YiWrluWV6vwH84U.wasm} +0 -0
- package/dist/runtime/{effindom-ui-v2.wasm64-simd.ZS1KEAg0XQex-VXkfgpBHE8MIoqPF8qpaf8nOjANb_U.js → effindom-ui-v2.wasm64-simd.nhbyYdlStHVWTLqcSR9k8whssMHhdz1r9FiTvUua5cM.js} +1 -1
- package/dist/runtime/{effindom-ui-v2.wasm64.ioQ9DuM6gR_EjlfRHdF8EvNPBcKCs0PQbbY9-cjTV6Y.wasm → effindom-ui-v2.wasm64.7u5yxjx9YPaeCU16NcNqyo2xpTN65DcccmSH_0UeX58.wasm} +0 -0
- package/dist/runtime/{effindom-ui-v2.wasm64.YSwpMFbr-Q1SBe0Ze8mub1u1PqsvSz3QIYuA3eaUMME.js.symbols → effindom-ui-v2.wasm64._AzZt9rUcw123RSAdjsdeCNSlvc57kvA0GK1Gmg_wD8.js.symbols} +1687 -1682
- package/dist/runtime/{effindom-ui-v2.wasm64.ZS1KEAg0XQex-VXkfgpBHE8MIoqPF8qpaf8nOjANb_U.js → effindom-ui-v2.wasm64.nhbyYdlStHVWTLqcSR9k8whssMHhdz1r9FiTvUua5cM.js} +1 -1
- package/package.json +1 -1
- package/src/bridge/interaction.ts +2 -1
- package/src/bridge/runtime/font-manager.ts +7 -4
- package/src/core-types.ts +2 -1
package/dist/bridge.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var k={NONE:0,WEBGPU:1,WEBGL2:2,CPU:3},ce={OK:0,LOST:1,RECOVERING:2};function
|
|
2
|
-
//# sourceURL=${n.replace(/\s/g,"%20")}`,a=URL.createObjectURL(new Blob([
|
|
3
|
-
//# sourceURL=${n.replace(/\s/g,"%20")}`;return new Function("Module",o)}),un.set(r,i)),await i}async function _n(t,e,n,r){return await new Promise((i,a)=>{let o={HEAPU8:new Uint8Array,HEAPU32:new Uint32Array,usesMemory64:r.selectedWasmArchitecture.startsWith("wasm64"),locateFile:s=>s.endsWith(".wasm")?ue(t.wasm):ue(s),instantiateWasm:(s,l)=>(gn(e,s).then(c=>{r.coreCompileMode=c.compileMode,l(c.instance,c.module)}).catch(c=>{a(nt("Failed to instantiate Core wasm.",c))}),{}),onAbort:s=>{a(new Error(bn(s,"Core wasm aborted.")))},refreshHeapViews:()=>{if(o.wasmMemory!==void 0){let s=o.wasmMemory.buffer;o.HEAPU8=new Uint8Array(s),o.HEAPU32=new Uint32Array(s)}else typeof HEAPU8<"u"&&(o.HEAPU8=HEAPU8,typeof HEAPU32<"u"&&(o.HEAPU32=HEAPU32))},canvas:n,onRuntimeInitialized:()=>{let s=o.memory;s instanceof WebAssembly.Memory&&(o.wasmMemory=s),o.refreshHeapViews?.(),i(o)},_malloc:()=>0,_free:()=>{},_ed_init:()=>{},_ed_init_webgl:()=>{},_ed_init_sw:()=>{},_ed_resize:()=>{},_ed_register_font:()=>{},_ed_unregister_font:()=>{},_ed_register_svg:()=>{},_ed_register_texture_rgba:()=>{},_ed_unregister_texture:()=>{},_ed_execute_command_buffer:()=>{},_ed_reset_scene:()=>{},_ed_render_frame:()=>{},_ed_clear_focus_state:()=>{},_ed_clear_text_input_state:()=>{},_ed_recover_device:()=>{},_ed_hit_test:()=>0,_ed_get_sw_framebuffer:()=>0,_ed_get_backend_type:()=>k.NONE,_ed_get_device_state:()=>ce.OK,_ed_notify_webgl_context_lost:()=>{},_ed_debug_simulate_device_lost:()=>{}};Wr(t.js,t.js_integrity??null).then(s=>{s(o)}).catch(a)})}async function xn(t,e,n){if(window.EffinDomUiV2ModuleFactory===void 0&&await an(t.js,t.js_integrity??null),window.EffinDomUiV2ModuleFactory===void 0)throw new Error("EffinDomUiV2ModuleFactory did not load.");let r=null,i=new Promise((l,c)=>{r=c}),a=window.EffinDomUiV2ModuleFactory({locateFile:l=>l.endsWith(".wasm")?ue(t.wasm):ue(l),instantiateWasm:(l,c)=>(gn(e,l).then(d=>{n.uiCompileMode=d.compileMode,c(d.instance,d.module)}).catch(d=>{r?.(nt("Failed to instantiate Ui wasm.",d))}),{}),onAbort:l=>{r?.(new Error(bn(l,"Ui wasm aborted.")))}}),o=await Promise.race([a,i]);o.usesMemory64=n.selectedWasmArchitecture.startsWith("wasm64");let s=o.memory;return s instanceof WebAssembly.Memory&&(o.wasmMemory=s),o.refreshHeapViews=()=>{if(o.wasmMemory!==void 0){let l=o.wasmMemory.buffer;o.HEAPU8=new Uint8Array(l),o.HEAPU32=new Uint32Array(l)}},o.refreshHeapViews(),o}function Nr(){return new URLSearchParams(window.location.search).get("arch")}function Dr(){let t=new URLSearchParams(window.location.search).get("backend")?.toLowerCase()??"auto";return t==="webgpu"||t==="graphite"?"webgpu":t==="webgl2"||t==="ganesh"?"webgl2":t==="software"||t==="raster"||t==="cpu"?"cpu":"auto"}function vn(t){return t==="webgpu"?[k.WEBGL2,k.CPU]:t==="webgl2"?[k.WEBGL2,k.CPU]:t==="cpu"?[k.CPU]:Oe}async function En(){let t=await Or(),e=t.manifest,n=t.manifestUrl,r=Br(e,Nr()),i=Dr(),a={...r.manifestEntry.core,js:Ae(n,r.manifestEntry.core.js),wasm:Ae(n,r.manifestEntry.core.wasm)},o={...r.manifestEntry.ui,js:Ae(n,r.manifestEntry.ui.js),wasm:Ae(n,r.manifestEntry.ui.wasm)},s=e.assets?.icu;if(s===void 0)throw new Error("Manifest is missing the ICU asset descriptor.");let l={manifestHash:e.manifest_hash??null,requestedWasmArchitecture:r.requestedArchitecture,requestedRendererBackend:i,selectedWasmArchitecture:r.selectedArchitecture,availableWasmArchitectures:r.availableArchitectures,memory64Supported:r.memory64Supported,simdSupported:r.simdSupported,coreCompileMode:"buffer",uiCompileMode:"buffer",icuDataUrl:Ae(n,s.url),activeRenderer:"none",deviceRecoveryCount:0};return{manifest:e,selection:r,loaderInfo:l,coreBundle:a,uiBundle:o,coreWasm:{...cn(a.wasm,a.wasm_integrity??null)},uiWasm:{...cn(o.wasm,o.wasm_integrity??null)},icu:{url:Ae(n,s.url),integrity:s.integrity??null,bytesPromise:Lt(Ae(n,s.url),s.integrity??null)}}}var Ur=/\p{Mark}+/gu,Kr=/[\p{Letter}\p{Number}\p{Mark}_]/u,Gr=new TextEncoder,_e={highlightAll:!1,matchCase:!1,matchDiacritics:!1,wholeWords:!1};function Pt(t){return{highlightAll:t?.highlightAll??_e.highlightAll,matchCase:t?.matchCase??_e.matchCase,matchDiacritics:t?.matchDiacritics??_e.matchDiacritics,wholeWords:t?.wholeWords??_e.wholeWords}}function Tn(t,e){let n=Math.max(0,Math.min(e,t.length));return Gr.encode(t.slice(0,n)).byteLength}function zr(t,e){if(e<=0)return null;let n=e-1,r=t.charCodeAt(n);if(n>0&&r>=56320&&r<=57343){let i=t.charCodeAt(n-1);i>=55296&&i<=56319&&(n-=1)}return t.slice(n,e)}function qr(t,e){let n=t.codePointAt(e);return n===void 0?null:String.fromCodePoint(n)}function Sn(t){return t!==null&&Kr.test(t)}function $r(t,e,n){return!Sn(zr(t,e))&&!Sn(qr(t,n))}function wn(t,e){let n=[],r="",i=0;for(let a of t){let o=i;i+=a.length;let s=i,l=e.matchDiacritics?a:a.normalize("NFD").replace(Ur,"");l=e.matchCase?l:l.toLocaleLowerCase(),r+=l;for(let c=0;c<l.length;c+=1)n.push({start:o,end:s})}return{text:r,tokens:n}}function Ln(t,e,n){let r=Pt(n);if(e.length===0)return{query:e,options:r,matches:[]};let i=wn(e,r).text;if(i.length===0)return{query:e,options:r,matches:[]};let a=[];for(let o of t){let s=wn(o.text,r),l=0;for(;l<=s.text.length-i.length;){let c=s.text.indexOf(i,l);if(c<0)break;let d=c+i.length,f=s.tokens[c],y=s.tokens[d-1];if(f===void 0||y===void 0)break;let u=f.start,F=y.end;(!r.wholeWords||$r(o.text,u,F))&&a.push({handle:o.handle,start:Tn(o.text,u),end:Tn(o.text,F)}),l=c+Math.max(i.length,1)}}return{query:e,options:r,matches:a}}function Fn(){return navigator.userAgentData?.mobile===!0||/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)?!0:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function kt(){let e=(navigator.userAgentData?.platform??navigator.platform??navigator.userAgent).toLowerCase();return e.includes("mac")||e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios")?1:e.includes("win")?2:e.includes("linux")||e.includes("android")||e.includes("x11")||e.includes("cros")?3:0}function Rt(t,e=kt()){return t.altKey?!1:e===1?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey}function Vr(t){return Rt(t)&&(t.key==="f"||t.key==="F")}function Xr(t){return Rt(t)&&(t.key==="g"||t.key==="G")}function Yr(t){let e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width",t==="filter"?"1.6":"1.8"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.style.display="block",n.style.width="16px",n.style.height="16px";let r=i=>{let a=document.createElementNS(e,"path");a.setAttribute("d",i),n.appendChild(a)};switch(t){case"chevronUp":r("M4.5 10.25L8 6.75L11.5 10.25");break;case"chevronDown":r("M4.5 5.75L8 9.25L11.5 5.75");break;case"filter":r("M3 4.5H13"),r("M5 8H11"),r("M6.75 11.5H9.25");break;case"close":r("M4.75 4.75L11.25 11.25"),r("M11.25 4.75L4.75 11.25");break}return n}function rt(t,e,n="plain"){let r=document.createElement("button");return r.type="button",r.setAttribute("aria-label",t),r.setAttribute("data-ed-find-icon-variant",n),r.appendChild(Yr(e)),r.style.width="32px",r.style.height="32px",r.style.display="inline-flex",r.style.alignItems="center",r.style.justifyContent="center",r.style.padding="0",r.style.border="none",r.style.borderRadius="10px",r.style.background="transparent",r.style.outline="none",r.style.appearance="none",r.style.webkitAppearance="none",r.style.boxShadow="none",r.style.cursor="pointer",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.flex="0 0 auto",r.style.transition="background 120ms ease, color 120ms ease, opacity 120ms ease",r.dataset.edHovered="0",r}function jr(t,e){return t?.handle===e?.handle&&t?.start===e?.start&&t?.end===e?.end}var it=class{constructor(e,n){this.matches=[];this.activeMatchIndex=-1;this.options={..._e};this.optionsExpanded=!1;this.handleThemeChange=()=>{this.syncThemeUi()};this.runtime=e;let r=document.body??document.documentElement;if(!(r instanceof HTMLElement))throw new Error("Expected document root for desktop Find dialog.");let i=document.createElement("div");i.setAttribute("data-ed-find-dialog","1"),i.setAttribute("data-ed-open","0"),i.setAttribute("role","dialog"),i.setAttribute("aria-label","Find on page"),i.style.position="fixed",i.style.top="6px",i.style.right="6px",i.style.display="none",i.style.flexDirection="column",i.style.width="min(356px, calc(100vw - 12px))",i.style.boxSizing="border-box",i.style.borderRadius="14px",i.style.border="1px solid transparent",i.style.overflow="hidden",i.style.pointerEvents="auto",i.style.zIndex="2147483647",i.style.boxShadow="0 10px 24px rgba(0, 0, 0, 0.22)",i.style.backdropFilter="blur(10px)",i.style.font="500 13px/1.2 system-ui, sans-serif";let a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.minHeight="42px",a.style.padding="0 8px 0 12px";let o=document.createElement("div");o.style.flex="1 1 auto",o.style.minWidth="0",o.style.display="flex",o.style.alignItems="center",o.style.paddingRight="6px";let s=document.createElement("input");s.type="text",s.autocomplete="off",s.spellcheck=!1,s.placeholder="Find text",s.setAttribute("aria-label","Find query"),s.style.width="100%",s.style.minWidth="0",s.style.height="24px",s.style.padding="0",s.style.margin="0",s.style.border="none",s.style.outline="none",s.style.background="transparent",s.style.font="500 13px/1.2 system-ui, sans-serif",o.appendChild(s);let l=document.createElement("span");l.setAttribute("aria-live","polite"),l.style.minWidth="36px",l.style.textAlign="center",l.style.font="500 13px/1.2 system-ui, sans-serif",l.style.padding="0 4px 0 2px";let c=document.createElement("div");c.setAttribute("aria-hidden","true"),c.style.width="1px",c.style.height="20px",c.style.margin="0 6px 0 4px",c.style.flex="0 0 auto";let d=rt("Previous result","chevronUp"),f=rt("Next result","chevronDown"),y=rt("Show advanced find options","filter","filter"),u=rt("Close find dialog","close"),F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.gap="2px",F.append(d,f,y,u),a.append(o,l,c,F);let h=document.createElement("div");h.style.display="none",h.style.flexDirection="column",h.style.padding="2px 0";let g=(E,N)=>{let B=document.createElement("button");B.type="button",B.setAttribute("data-ed-find-option",E),B.setAttribute("aria-label",N),B.setAttribute("role","switch"),B.style.width="100%",B.style.height="38px",B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="0 12px",B.style.border="none",B.style.background="transparent",B.style.cursor="pointer",B.style.textAlign="left",B.style.font="500 12px/1.2 system-ui, sans-serif";let q=document.createElement("span");q.textContent=N,q.style.pointerEvents="none",q.style.font="inherit";let P=document.createElement("span");P.setAttribute("aria-hidden","true"),P.style.position="relative",P.style.display="inline-flex",P.style.alignItems="center",P.style.width="30px",P.style.height="18px",P.style.borderRadius="999px",P.style.transition="background 120ms ease",P.style.pointerEvents="none";let D=document.createElement("span");return D.style.position="absolute",D.style.top="2px",D.style.left="2px",D.style.width="14px",D.style.height="14px",D.style.borderRadius="999px",D.style.boxShadow="0 1px 2px rgba(0, 0, 0, 0.24)",D.style.transition="transform 120ms ease",D.style.pointerEvents="none",P.appendChild(D),B.append(q,P),{button:B,track:P,thumb:D}},w=g("highlightAll","Highlight all"),S=g("matchCase","Match case"),b=g("matchDiacritics","Match diacritics"),x=g("wholeWords","Match whole word"),v={highlightAll:w.button,matchCase:S.button,matchDiacritics:b.button,wholeWords:x.button},C={highlightAll:w.track,matchCase:S.track,matchDiacritics:b.track,wholeWords:x.track},H={highlightAll:w.thumb,matchCase:S.thumb,matchDiacritics:b.thumb,wholeWords:x.thumb};h.append(v.highlightAll,v.matchCase,v.matchDiacritics,v.wholeWords),i.append(a,h),r.appendChild(i);let M=()=>{this.restoreInputFocus(!1)},p=(E,N)=>{E.dataset.edHovered=N?"1":"0",this.syncStatusUi()},T=(E,N)=>{E.addEventListener("pointerdown",B=>{B.preventDefault()}),E.addEventListener("pointerenter",()=>{p(E,!0)}),E.addEventListener("pointerleave",()=>{p(E,!1)}),E.addEventListener("click",()=>{N(),M()})};i.addEventListener("keydown",E=>{E.stopPropagation()}),s.addEventListener("input",()=>{this.refreshMatches(!1)}),s.addEventListener("keydown",E=>{if(E.key==="Enter"){E.preventDefault(),this.step(E.shiftKey?-1:1);return}if(E.key==="ArrowDown"&&!E.altKey&&!E.ctrlKey&&!E.metaKey){E.preventDefault(),this.step(1);return}if(E.key==="ArrowUp"&&!E.altKey&&!E.ctrlKey&&!E.metaKey){E.preventDefault(),this.step(-1);return}E.key==="Escape"&&(E.preventDefault(),this.hide())}),T(d,()=>{this.step(-1)}),T(f,()=>{this.step(1)}),T(y,()=>{this.optionsExpanded=!this.optionsExpanded,this.syncOptionUi()}),T(u,()=>{this.hide()});for(let[E,N]of Object.entries(v))T(N,()=>{this.options={...this.options,[E]:!this.options[E]},this.syncOptionUi(),this.refreshMatches(!0)});this.root=i,this.input=s,this.status=l,this.advancedPanel=h,this.previousButton=d,this.nextButton=f,this.disclosureButton=y,this.closeButton=u,this.optionButtons=v,this.optionTracks=C,this.optionThumbs=H,this.themeMedia=typeof window.matchMedia=="function"?window.matchMedia("(prefers-color-scheme: dark)"):null,this.themeMedia?.addEventListener?.("change",this.handleThemeChange),this.syncOptionUi(),this.syncThemeUi()}consumeGlobalKeyEvent(e,n){return Fn()?!1:Vr(e)?(e.preventDefault(),e.stopPropagation(),n==="down"&&this.show(),!0):n==="down"&&this.isOpen()&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key==="F3"?(e.preventDefault(),this.step(e.shiftKey?-1:1),!0):n==="down"&&this.isOpen()&&Xr(e)?(e.preventDefault(),this.step(e.shiftKey?-1:1),!0):!!this.containsTarget(e.target)}containsTarget(e){return e instanceof Node&&this.root.contains(e)}destroy(){this.themeMedia?.removeEventListener?.("change",this.handleThemeChange),this.root.remove()}getPalette(){return this.themeMedia?.matches??!0?{colorScheme:"dark",shellBackground:"rgba(36, 36, 36, 0.98)",shellBorder:"rgba(255, 255, 255, 0.08)",divider:"rgba(255, 255, 255, 0.12)",panelBackground:"rgba(0, 0, 0, 0.10)",text:"#f5f5f5",mutedText:"#cfcfcf",errorText:"#fca5a5",buttonText:"#d9d9d9",buttonMutedText:"#7c7c7c",buttonActiveBackground:"rgba(255, 255, 255, 0.08)",buttonPlainHoverBackground:"rgba(255, 255, 255, 0.06)",filterButtonBackground:"transparent",filterButtonActiveBackground:"rgba(255, 255, 255, 0.20)",optionHoverBackground:"rgba(255, 255, 255, 0.03)",toggleTrackOff:"#5a5a5a",toggleTrackOn:"#818cf8",toggleThumb:"#ffffff"}:{colorScheme:"light",shellBackground:"rgba(251, 251, 251, 0.98)",shellBorder:"rgba(15, 23, 42, 0.12)",divider:"rgba(15, 23, 42, 0.12)",panelBackground:"rgba(15, 23, 42, 0.03)",text:"#111827",mutedText:"#4b5563",errorText:"#dc2626",buttonText:"#374151",buttonMutedText:"#9ca3af",buttonActiveBackground:"rgba(15, 23, 42, 0.08)",buttonPlainHoverBackground:"rgba(15, 23, 42, 0.05)",filterButtonBackground:"transparent",filterButtonActiveBackground:"rgba(15, 23, 42, 0.16)",optionHoverBackground:"rgba(15, 23, 42, 0.03)",toggleTrackOff:"#d1d5db",toggleTrackOn:"#818cf8",toggleThumb:"#ffffff"}}isOpen(){return this.root.style.display!=="none"}restoreInputFocus(e){let n=this.input.selectionStart??this.input.value.length,r=this.input.selectionEnd??n;queueMicrotask(()=>{if(this.isOpen()){if(this.input.focus({preventScroll:!0}),e){this.input.select();return}this.input.setSelectionRange(n,r)}})}syncThemeUi(){let e=this.getPalette();this.root.style.colorScheme=e.colorScheme,this.root.style.background=e.shellBackground,this.root.style.borderColor=e.shellBorder,this.root.style.color=e.text,this.advancedPanel.style.background=e.panelBackground,this.advancedPanel.style.borderTop=this.optionsExpanded?`1px solid ${e.divider}`:"none",this.input.style.color=e.text,this.input.style.caretColor=e.text,this.status.style.color=e.mutedText,this.previousButton.style.color=e.buttonText,this.nextButton.style.color=e.buttonText,this.closeButton.style.color=e.buttonText,this.disclosureButton.style.color=e.buttonText,this.previousButton.style.background="transparent",this.nextButton.style.background="transparent",this.closeButton.style.background="transparent",this.disclosureButton.style.background=this.optionsExpanded?e.filterButtonActiveBackground:e.filterButtonBackground,this.syncOptionUi(),this.syncStatusUi()}syncOptionUi(){let e=this.getPalette();this.root.setAttribute("data-ed-open",this.isOpen()?"1":"0"),this.advancedPanel.style.display=this.optionsExpanded?"flex":"none",this.advancedPanel.style.borderTop=this.optionsExpanded?`1px solid ${e.divider}`:"none",this.disclosureButton.setAttribute("aria-label",this.optionsExpanded?"Hide advanced find options":"Show advanced find options");for(let[n,r]of Object.entries(this.optionButtons)){let i=this.options[n];r.setAttribute("aria-checked",i?"true":"false"),r.style.color=e.text,r.style.background="transparent";let a=this.optionTracks[n],o=this.optionThumbs[n];a.style.background=i?e.toggleTrackOn:e.toggleTrackOff,o.style.background=e.toggleThumb,o.style.transform=i?"translateX(12px)":"translateX(0)"}}syncStatusUi(){let e=this.getPalette();this.input.value.length===0?(this.status.textContent="",this.status.style.color=e.mutedText):this.matches.length===0||this.activeMatchIndex<0?(this.status.textContent="0/0",this.status.style.color=e.errorText):(this.status.textContent=`${String(this.activeMatchIndex+1)}/${String(this.matches.length)}`,this.status.style.color=e.mutedText);let r=this.matches.length>0,i=(a,o)=>{a.disabled=!r&&a!==this.disclosureButton&&a!==this.closeButton;let s=!a.disabled,l=a.dataset.edHovered==="1";a.style.opacity=s?"1":"0.45",a.style.cursor=s?"pointer":"default",o==="filter"?this.optionsExpanded?a.style.background=e.filterButtonActiveBackground:s&&l?a.style.background=e.buttonPlainHoverBackground:a.style.background=e.filterButtonBackground:a.style.background=s&&l?e.buttonPlainHoverBackground:"transparent",a.style.color=s?e.buttonText:e.buttonMutedText};i(this.previousButton,"plain"),i(this.nextButton,"plain"),i(this.disclosureButton,"filter"),i(this.closeButton,"plain")}show(){this.root.style.display="flex",this.root.setAttribute("data-ed-open","1"),this.syncThemeUi(),this.refreshMatches(!0),this.restoreInputFocus(!0)}hide(){this.root.style.display="none",this.root.setAttribute("data-ed-open","0"),this.previousButton.dataset.edHovered="0",this.nextButton.dataset.edHovered="0",this.disclosureButton.dataset.edHovered="0",this.closeButton.dataset.edHovered="0",this.runtime.openCanvasApi.setFindState(null)}refreshMatches(e){let n=this.input.value,r=e&&this.activeMatchIndex>=0?this.matches[this.activeMatchIndex]??null:null,i=this.runtime.openCanvasApi.findText(n,this.options);if(this.options={...i.options},this.matches=i.matches.map(a=>({...a})),this.matches.length===0){this.activeMatchIndex=-1,this.runtime.openCanvasApi.setFindState(null),this.syncOptionUi(),this.syncStatusUi(),this.restoreInputFocus(!1);return}if(r!==null){let a=this.matches.findIndex(o=>jr(o,r));this.activeMatchIndex=a>=0?a:0}else(this.activeMatchIndex<0||this.activeMatchIndex>=this.matches.length)&&(this.activeMatchIndex=0);this.applyCurrentState(!0)}step(e){if(this.matches.length===0){this.refreshMatches(!1);return}this.activeMatchIndex=(this.activeMatchIndex+e+this.matches.length)%this.matches.length,this.applyCurrentState(!0)}applyCurrentState(e){let n=this.matches.length===0||this.activeMatchIndex<0||this.activeMatchIndex>=this.matches.length?null:{query:this.input.value,options:{...this.options},matches:this.matches.map(r=>({...r})),activeMatchIndex:this.activeMatchIndex};(n===null||!this.runtime.openCanvasApi.setFindState(n,e))&&(this.matches=[],this.activeMatchIndex=-1,this.runtime.openCanvasApi.setFindState(null)),this.syncOptionUi(),this.syncStatusUi(),this.restoreInputFocus(!1)}};var Cn="effindom-pull-to-refresh";function Jr(){let t=document.getElementById(Cn);if(t instanceof HTMLDivElement){let r=t.firstElementChild;if(r instanceof HTMLSpanElement)return{root:t,icon:r};t.remove()}let e=document.createElement("div"),n=document.createElement("span");return e.id=Cn,e.hidden=!0,e.dataset.visible="false",e.dataset.armed="false",e.setAttribute("aria-hidden","true"),e.style.position="fixed",e.style.left="50%",e.style.top="12px",e.style.width="48px",e.style.height="48px",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.borderRadius="999px",e.style.background="rgba(248, 250, 252, 0.96)",e.style.color="#0f172a",e.style.boxShadow="0 10px 28px rgba(15, 23, 42, 0.22)",e.style.backdropFilter="blur(12px)",e.style.pointerEvents="none",e.style.opacity="0",e.style.transform="translate(-50%, -18px)",e.style.transition="opacity 120ms ease, transform 120ms ease",e.style.zIndex="2147483647",n.textContent="\u21BB",n.style.display="block",n.style.font='600 24px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',n.style.transform="rotate(0deg)",n.style.transition="transform 90ms linear",e.appendChild(n),(document.body??document.documentElement).appendChild(e),{root:e,icon:n}}function An(){let{root:t,icon:e}=Jr(),n=!1,r=0;return{show(i){r!==0&&(window.clearTimeout(r),r=0),n=!0;let a=Math.max(0,i),o=Math.max(0,Math.min(a/88,1)),s=Math.min(a*.75,78);t.hidden=!1,t.dataset.visible="true",t.dataset.armed=o>=1?"true":"false",t.style.transition="none",t.style.opacity=a<=0?"0":`${.15+o*.85}`,t.style.transform=`translate(-50%, ${s-18}px)`,t.style.background=o>=1?"rgba(219, 234, 254, 0.98)":"rgba(248, 250, 252, 0.96)",e.style.transform=`rotate(${Math.round(o*360)}deg)`},hide(i=!1){if(!(!n&&t.hidden)){if(n=!1,t.dataset.visible="false",t.dataset.armed="false",t.style.transition=i?"none":"opacity 90ms ease-out, transform 90ms ease-out, background 90ms ease-out",t.style.opacity="0",t.style.transform="translate(-50%, -18px)",t.style.background="rgba(248, 250, 252, 0.96)",e.style.transform="rotate(0deg)",i){r!==0&&(window.clearTimeout(r),r=0),t.hidden=!0;return}r=window.setTimeout(()=>{t.dataset.visible==="false"&&(t.hidden=!0),r=0},100)}},destroy(){r!==0&&window.clearTimeout(r),t.remove()}}}function Ht(t){let e=t.getBoundingClientRect();(e.width<=0||e.height<=0)&&(t.style.width=`${String(320)}px`,t.style.height=`${String(220)}px`)}function We(t){let e=t.closest("[data-effindom-canvas-size-source]");return e instanceof HTMLElement?e:t}function qe(t){let e=We(t);if(e.clientWidth>0&&e.clientHeight>0)return{width:e.clientWidth,height:e.clientHeight};let n=Number.parseFloat(t.style.width),r=Number.parseFloat(t.style.height);return Number.isFinite(n)&&n>0&&Number.isFinite(r)&&r>0?{width:n,height:r}:{width:t.clientWidth||320,height:t.clientHeight||220}}function Bt(t,e){let n=We(t),r=n.getBoundingClientRect(),i=qe(t),a=r.left+n.clientLeft,o=r.top+n.clientTop,s=n.clientWidth||r.width-(n.clientLeft+n.clientLeft)||320,l=n.clientHeight||r.height-(n.clientTop+n.clientTop)||220,c=s>0?(e.clientX-a)/s*i.width:0,d=l>0?(e.clientY-o)/l*i.height:0;return{x:c,y:d}}function ot(t,e){let n=We(t).getBoundingClientRect();return e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom}function In(t,e){let n=t.deltaX,r=t.deltaY;if(t.deltaMode===WheelEvent.DOM_DELTA_LINE)n*=16,r*=16;else if(t.deltaMode===WheelEvent.DOM_DELTA_PAGE){let i=qe(e);n*=i.width,r*=i.height}return t.shiftKey&&Math.abs(n)<.001&&Math.abs(r)>0?{x:r,y:0}:{x:n,y:r}}var at=1,Qr=2;function Zr(){return BigInt(Math.floor(performance.now()))}function ei(t){return t==="ArrowUp"||t==="ArrowDown"||t==="PageUp"||t==="PageDown"||t==="Home"||t==="End"}function Pn(t){return t==="ArrowLeft"||t==="ArrowRight"||t==="ArrowUp"||t==="ArrowDown"||t==="PageUp"||t==="PageDown"||t==="Home"||t==="End"}function kn(t,e,n){let{ui:r}=t,i=y=>u=>{if(n.consumeGlobalKeyEvent(u,y===at?"down":"up"))return;let F=ze(u),h=e.getActiveTextHandle(),g=e.getActiveTextEditable(),w=e.getActiveTextMultiline(),S=e.isActiveTextInputFocused(),b=h!==null&&g&&S&&!u.ctrlKey&&!u.metaKey&&!u.altKey&&(u.key.length===1||w&&u.key==="Enter"||u.key==="Backspace"||u.key==="Delete"),x=h!==null&&g&&!S&&!u.ctrlKey&&!u.metaKey&&!u.altKey&&(u.key.length===1||w&&u.key==="Enter"||u.key==="Backspace"||u.key==="Delete");if(b){y===at&&(u.key==="Backspace"||u.key==="Delete")&&e.applyActiveTextDeletion(u.key==="Delete")&&u.preventDefault();return}let v=h!==null&&Pn(u.key),C=h!==null&&!g&&(u.key.length===1||u.key==="Backspace"||u.key==="Delete"||Pn(u.key));(x||v||C)&&u.preventDefault(),r._ui_set_interaction_time(Zr()),(u.key==="Tab"||(u.ctrlKey||u.metaKey)&&(u.key==="c"||u.key==="C"||u.key==="a"||u.key==="A"||u.key==="x"||u.key==="X"||u.key==="v"||u.key==="V"||u.key==="z"||u.key==="Z"||u.key==="y"||u.key==="Y"))&&u.preventDefault();let M=Ce(r,u.key),p=!1;try{r._ui_on_key_event(y,M.ptr,M.len,F),!x&&!v&&!C&&(p=window.__effindomCallbacks?.onKeyEventWithKey?.(y,u.key,F)===!0)}finally{M.dispose()}y===at&&(p||!u.ctrlKey&&!u.altKey&&!u.metaKey&&ei(u.key))&&u.preventDefault(),t.commitFrame(),e.getActiveTextHandle()!==null&&!e.isActiveTextInputFocused()&&e.refocusActiveTextInput()},a=i(at),o=i(Qr),s=!0,l=()=>{requestAnimationFrame(()=>{t.syncFindSelection(!0)})},c=()=>{if(e.getActiveTextHandle()===null){l();return}r._ui_request_focus(0n),t.commitFrame(),l()},d=()=>{l()},f=()=>{t.updateCanvasSize(),t.commitFrame()};return window.addEventListener("keydown",a,s),window.addEventListener("keyup",o,s),window.addEventListener("blur",c),window.addEventListener("focus",d),window.addEventListener("resize",f),()=>{window.removeEventListener("keydown",a,s),window.removeEventListener("keyup",o,s),window.removeEventListener("blur",c),window.removeEventListener("focus",d),window.removeEventListener("resize",f)}}function $e(t){return t.uiHasPendingVisualWork()?(t.commitFrame(),!0):!1}var st=class{constructor(e){this.flushMove=e;this.pendingMove=null;this.frameScheduled=!1}enqueue(e){this.pendingMove=e,this.scheduleFlush()}takePending(){let e=this.pendingMove;return this.pendingMove=null,e}clear(){this.pendingMove=null}scheduleFlush(){this.frameScheduled||(this.frameScheduled=!0,requestAnimationFrame(()=>{this.frameScheduled=!1;let e=this.pendingMove;this.pendingMove=null,e!==null&&(this.flushMove(e),this.pendingMove!==null&&this.scheduleFlush())}))}};function ti(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function Rn(t,e,n){let r=t.getSemanticTree();for(let i=r.length-1;i>=0;i-=1){let a=r[i];if(a?.roleName==="textbox"&&ti(a.bounds,e,n))return z(a.handle)}return 0n}function Ie(t,e){if(t===null)return e.type==="press-start"?{pointerId:e.pointerId,phase:"pressed",startX:e.x,startY:e.y,lastX:e.x,lastY:e.y,startedOnTextbox:e.startedOnTextbox,pendingTapTextHandle:e.pendingTextHandle,axisMode:null,pullToRefreshEligible:!1,pullToRefreshCaptured:!1,pullToRefreshDistance:0}:null;switch(t.phase){case"pressed":switch(e.type){case"scroll-threshold-crossed":{let n=e.axis;return{...t,phase:"scrolling",axisMode:n,pullToRefreshEligible:n==="y",pendingTapTextHandle:null}}case"move":return{...t,lastX:e.x,lastY:e.y};case"cancel":case"ended":return null;default:return t}case"scrolling":switch(e.type){case"move":return{...t,lastX:e.x,lastY:e.y};case"axis-unlocked":return{...t,axisMode:"xy",pullToRefreshEligible:!1,pullToRefreshCaptured:!1,pullToRefreshDistance:0};case"pull-to-refresh-captured":return{...t,pullToRefreshCaptured:!0};case"pull-to-refresh-released":return{...t,pullToRefreshCaptured:!1,pullToRefreshDistance:0};case"cancel":case"ended":return null;default:return t}}}var he=1,fe=2,xe=3,pe=5,Hn=30,Bn=8,Mn=1.25,Mt=32,ni=.72,On=8;function ri(t,e){let n=Math.abs(t),r=Math.abs(e);return n>=r*Mn?"x":r>=n*Mn?"y":n>=r?"x":"y"}function ii(t,e,n){if(t===null||t==="xy")return!1;let r=t==="x"?e:n,i=t==="x"?n:e;return r<Mt||i<Mt?!1:i>=Mt&&i>=r*ni}function Pe(){return BigInt(Math.floor(performance.now()))}function Wn(t,e){let n=e.toString();return t.getSemanticTree().find(i=>i.handle===n)?.roleName??null}function Nn(t,e,n){let{canvas:r,ui:i}=t,a=!1,o=null,s=null,l=!1,c=null,d=null,f={x:0,y:0},y=(m,L)=>{!a||c==="touch"||z(i._ui_selection_autoscroll(m,L,Hn))!==0n&&(t.flushPendingCommit(),t.requestFrame())},u=m=>{if(e.setPointerInsideCanvas(m.pointerInsideCanvas),e.setLastPointerClientPosition(m.clientX,m.clientY),e.setLastPointerPosition(m.x,m.y),e.setLastPointerModifiers(m.modifiers),i._ui_set_interaction_time(Pe()),i._ui_on_pointer_event(xe,m.handle,m.x,m.y),$e(t),m.handle===0n){let L=t.getCapturedPointerHandle();L!==null&&window.__effindomCallbacks?.onPointerEventWithCoords?.(xe,L,m.x,m.y,m.modifiers)}y(m.x,m.y),h()},F=new st(u),h=()=>{l||!a||c==="touch"||(l=!0,requestAnimationFrame(()=>{if(l=!1,!a)return;let{x:m,y:L}=e.getLastPointerPosition();z(i._ui_selection_autoscroll(m,L,Hn))!==0n&&(t.commitFrame(),t.flushPendingCommit(),t.requestFrame(),h())}))},g=m=>{r.hasPointerCapture(m)&&r.releasePointerCapture(m)},w=m=>{try{r.setPointerCapture(m)}catch{}},S=(m,L)=>{let R=e.getCapturedPointerHandle();e.setCapturedPointerHandle(null),a=!1,o=null,c=null,F.clear(),i._ui_set_interaction_time(Pe()),i._ui_on_pointer_event(pe,R??0n,m,L),t.commitFrame()},b=(m,L,R)=>{if(m.pointerType!=="touch"||d?.pointerId!==m.pointerId)return!1;let V=L.x-d.startX,te=L.y-d.startY,O=V*V+te*te;if(d.phase==="pressed"){if(O<Bn*Bn)return m.preventDefault(),!0;let be=ri(V,te);if(d=Ie(d,{type:"scroll-threshold-crossed",axis:be}),d===null)return!0;e.cancelTouchTextFocusDeferral(),S(L.x,L.y),i._ui_touch_scroll_begin(t.getHandleFromPoint(d.startX,d.startY),d.startX,d.startY),f={x:0,y:0}}let Q=d;if(d=Ie(d,{type:"move",x:L.x,y:L.y}),d===null)return!0;let Ee=Q.lastX-L.x,X=Q.lastY-L.y,re=Math.abs(Ee),Te=Math.abs(X);if(re>=On&&Te>=On?(f.x+=re,f.y+=Te):f={x:0,y:0},ii(d.axisMode,f.x,f.y)){if(d=Ie(d,{type:"axis-unlocked"}),d===null)return!0;f={x:0,y:0}}let K=d.axisMode==="x"||d.axisMode==="xy"?Ee:0,Se=d.axisMode==="y"||d.axisMode==="xy"?X:0;!d.startedOnTextbox&&!d.pullToRefreshCaptured&&d.pullToRefreshEligible&&te>0&&i._ui_touch_scroll_allows_pull_to_refresh()!==0&&(d=Ie(d,{type:"pull-to-refresh-captured"})??d);let ye=d.pullToRefreshCaptured?0:Se;e.setPointerInsideCanvas(ot(r,m)),e.setLastPointerClientPosition(m.clientX,m.clientY),e.setLastPointerPosition(L.x,L.y),e.setLastPointerModifiers(R),i._ui_set_interaction_time(Pe()),i._ui_on_pointer_event(xe,t.getHandleFromPoint(L.x,L.y),L.x,L.y),i._ui_touch_scroll_update(K,ye);let Ke=d.pullToRefreshCaptured?Math.max(0,te):0;return d.pullToRefreshDistance=Ke,d.pullToRefreshCaptured?n.show(Ke):n.hide(),t.commitFrame(),m.preventDefault(),!0},x=(m,L=!0)=>R=>{let V=ze(R),te=m===pe?!1:ot(r,R),O=Bt(r,R);if(R.pointerType==="touch"&&R.cancelable&&R.preventDefault(),m===he&&R.button===2){window.__effindomCallbacks?.onBeforeContextMenuHitTest?.();let Y=t.getHandleFromPoint(O.x,O.y),ge=e.getActiveTextHandle(),we=ge!==null&&Y===ge;s=R.pointerId,e.setPointerInsideCanvas(te),e.setLastPointerClientPosition(R.clientX,R.clientY),e.setLastPointerPosition(O.x,O.y),e.setLastPointerModifiers(V),we||r.focus({preventScroll:!0}),i._ui_set_interaction_time(Pe()),window.__effindomCallbacks?.onContextMenu?.(Y,O.x,O.y),we&&e.refocusActiveTextInput(),R.preventDefault();return}if(s===R.pointerId){e.setPointerInsideCanvas(te),e.setLastPointerClientPosition(R.clientX,R.clientY),e.setLastPointerPosition(O.x,O.y),e.setLastPointerModifiers(V),(m===fe||m===pe)&&(s=null),R.preventDefault();return}let Q=R.pointerType==="touch",Ee=R.type==="pointercancel",X=null,re=!1;if(m===he)w(R.pointerId),a=!0,o=R.pointerId,c=R.pointerType,Q&&(i._ui_clear_momentum_scroll(),d=Ie(null,{type:"press-start",pointerId:R.pointerId,x:O.x,y:O.y,startedOnTextbox:!1,pendingTextHandle:null}),f={x:0,y:0});else if(d!==null&&d.pointerId===R.pointerId){if(m===xe&&b(R,O,V))return;if(m===fe||m===pe){let Y=d.pendingTapTextHandle,ge=Ee||m===pe,we=d.phase==="scrolling",_=d.pullToRefreshDistance;d=Ie(d,{type:ge?"cancel":"ended",triggered:!1});let A=we&&_>=88;if(we){e.cancelTouchTextFocusDeferral(),e.setCapturedPointerHandle(null),a=!1,o=null,c=null,F.clear(),i._ui_touch_scroll_end(),A?(n.hide(!0),window.location.reload()):n.hide(),g(R.pointerId),R.preventDefault();return}ge||m!==fe?(e.cancelTouchTextFocusDeferral(),re=!0):X=Y,n.hide(!0)}}let Te=e.getCapturedPointerHandle(),K=e.getActiveTextHandle(),Se=L?t.getHandleFromPoint(O.x,O.y):0n,ye=(m===he||K!==null)&&L?Rn(t,O.x,O.y):0n,be=ye!==0n&&(Se===0n||Wn(t,Se)!=="textbox")&&(m===he||ye===K||ye===Te)?ye:Se,J=m===he||L&&te?be:Te??be,Be=m===he&&K!==null&&J===K&&!Q,Ye=m===he&&K!==null&&J!==K,vt=m===he&&Q&&K!==null&&J===K&&e.isActiveTextInputFocused(),Et=m===fe&&K!==null&&J===K&&!Q,je=Q&&m===fe&&!re&&X!==null&&J===X;if(m===fe||m===pe){let Y=F.takePending();Y!==null&&u(Y)}if(m===he){if(Q){let Y=Wn(t,J)==="textbox"?J:0n;if(Y!==0n){let ge=K!==null&&Y===K&&e.isActiveTextInputFocused();d!==null&&(d.startedOnTextbox=!0,d.pendingTapTextHandle=ge?null:Y),e.beginTouchTextFocusDeferral(Y)}else e.cancelTouchTextFocusDeferral()}e.setPointerInsideCanvas(te),e.setLastPointerClientPosition(R.clientX,R.clientY),e.setLastPointerPosition(O.x,O.y),e.setLastPointerModifiers(V),!Be&&!Ye&&!vt&&r.focus({preventScroll:!0}),e.setCapturedPointerHandle(J===0n?null:J),i._ui_set_interaction_time(Pe()),i._ui_on_pointer_event(m,J,O.x,O.y),t.commitFrame(),Ye&&e.getActiveTextHandle()===null&&r.focus({preventScroll:!0}),(Be||!Q&&e.getActiveTextHandle()!==null&&!e.isActiveTextInputFocused())&&e.refocusActiveTextInput(),h()}else if(m===xe){F.enqueue({handle:J,x:O.x,y:O.y,clientX:R.clientX,clientY:R.clientY,pointerInsideCanvas:te,modifiers:V});return}else{if(e.setPointerInsideCanvas(te),e.setLastPointerClientPosition(R.clientX,R.clientY),e.setLastPointerPosition(O.x,O.y),e.setLastPointerModifiers(V),i._ui_set_interaction_time(Pe()),i._ui_on_pointer_event(m,J,O.x,O.y),t.commitFrame(),je?e.commitTouchTextFocusDeferral(J):(Et||!Q&&e.getActiveTextHandle()!==null&&!e.isActiveTextInputFocused())&&e.refocusActiveTextInput(),Q&&m===fe&&!je&&e.cancelTouchTextFocusDeferral(),J===0n){let Y=t.getCapturedPointerHandle();Y!==null&&window.__effindomCallbacks?.onPointerEventWithCoords?.(m,Y,O.x,O.y,V)}h()}(m===fe||m===pe)&&(a=!1,o=null,c=null,e.setCapturedPointerHandle(null)),(m===fe||m===pe)&&g(R.pointerId)},v=m=>{m.preventDefault()},C=x(he),H=x(fe),M=x(xe),p=m=>{if(r.hasPointerCapture(m.pointerId)){a&&x(xe,!1)(m);return}x(pe,!1)(m)},T=m=>{p(m)},E=m=>{p(m)},N=m=>{x(pe,!1)(m)},B=m=>a&&o!==null&&m.pointerId===o&&m.target!==r,q=m=>{B(m)&&M(m)},P=m=>{B(m)&&H(m)},D=m=>{B(m)&&N(m)},ee=m=>{m.preventDefault();let L=Bt(r,m);e.setPointerInsideCanvas(ot(r,m)),e.setLastPointerClientPosition(m.clientX,m.clientY),e.setLastPointerPosition(L.x,L.y),e.setLastPointerModifiers(ze(m)),i._ui_set_interaction_time(Pe());let R=t.getHandleFromPoint(L.x,L.y);i._ui_on_pointer_event(xe,R,L.x,L.y);let V=In(m,r);i._ui_on_wheel_event(V.x,V.y),$e(t)};return r.addEventListener("contextmenu",v),r.addEventListener("pointerdown",C,{passive:!1}),r.addEventListener("pointerup",H,{passive:!1}),r.addEventListener("pointermove",M,{passive:!1}),r.addEventListener("pointerleave",T,{passive:!1}),r.addEventListener("pointerout",E,{passive:!1}),r.addEventListener("pointercancel",N,{passive:!1}),window.addEventListener("pointermove",q,{passive:!1}),window.addEventListener("pointerup",P,{passive:!1}),window.addEventListener("pointercancel",D,{passive:!1}),r.addEventListener("wheel",ee,{passive:!1}),()=>{r.removeEventListener("contextmenu",v),r.removeEventListener("pointerdown",C),r.removeEventListener("pointerup",H),r.removeEventListener("pointermove",M),r.removeEventListener("pointerleave",T),r.removeEventListener("pointerout",E),r.removeEventListener("pointercancel",N),window.removeEventListener("pointermove",q),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",D),r.removeEventListener("wheel",ee)}}function oi(){return window.matchMedia("(pointer: coarse)").matches||navigator.maxTouchPoints>0}function Dn(t,e){let{canvas:n,ui:r}=t,i=new it(t,n),a=An(),o=window.matchMedia("(pointer: coarse)");n.tabIndex=0,n.style.touchAction="none",n.style.outline="none";let s=()=>{r._ui_set_coarse_pointer_mode(oi()?1:0)},l=()=>{r._ui_set_platform_family(kt())};s(),l(),o.addEventListener?.("change",s);let c=Nn(t,e,a),d=kn(t,e,i);return()=>{d(),c(),i.destroy(),a.destroy(),o.removeEventListener?.("change",s)}}var Un=[{id:1,assetFile:"NotoSans-Regular.ttf",fallbackIds:[4,3],preload:!0},{id:2,assetFile:"NotoSans-Bold.ttf",fallbackIds:[4,3],preload:!0},{id:9,assetFile:"NotoSans-Italic.ttf",fallbackIds:[4,3],preload:!0},{id:10,assetFile:"NotoSans-BoldItalic.ttf",fallbackIds:[4,3],preload:!0},{id:3,assetFile:"NotoSansSymbols2-Regular.ttf",fallbackIds:[],preload:!0},{id:4,assetFile:"NotoEmoji-Regular.ttf",fallbackIds:[],preload:!0},{id:5,assetFile:"NotoSansMono-Regular.ttf",fallbackIds:[4,3],preload:!1},{id:6,assetFile:"NotoSansMono-Bold.ttf",fallbackIds:[4,3],preload:!1}],Kn=Un.filter(t=>t.preload);function lt(t){return Un.find(e=>e.id===t)}function ai(){let e=window.__effindomRuntime?.manifestUrl;if(typeof e=="string"&&e.length>0)return new URL("./",new URL(e,document.baseURI)).toString();let n=document.currentScript;return n instanceof HTMLScriptElement&&n.src.length>0?new URL("./",n.src).toString():new URL("./",document.baseURI).toString()}function Ne(t){return new URL(`../fonts/${t}`,ai()).toString()}var si=new TextDecoder;function li(t,e){let n=document.createElement("canvas");return n.width=t,n.height=e,n}async function Gn(t){if(createImageBitmap===void 0)throw new Error("createImageBitmap is unavailable for texture decoding.");return await createImageBitmap(t)}function zn(t){let n=li(t.width,t.height).getContext("2d",{willReadFrequently:!0});if(n===null)throw new Error("Failed to allocate a 2D canvas for texture decoding.");n.clearRect(0,0,t.width,t.height),n.drawImage(t,0,0);let r=n.getImageData(0,0,t.width,t.height);return new Uint8Array(r.data.buffer.slice(r.data.byteOffset,r.data.byteOffset+r.data.byteLength))}function qn(t){if(t===null)return null;let e=t.trim();if(e.length===0)return null;let r=/^([+-]?(?:\d+\.?\d*|\.\d+))/.exec(e)?.[1];if(r===void 0)return null;let i=Number.parseFloat(r);return Number.isFinite(i)&&i>0?i:null}function di(t){if(t===null)return null;let e=t.trim().split(/[\s,]+/).map(i=>Number.parseFloat(i)).filter(i=>Number.isFinite(i));if(e.length!==4)return null;let n=e[2],r=e[3];return n===void 0||r===void 0||n<=0||r<=0?null:{width:n,height:r}}function ci(t){let e=si.decode(t),n=new DOMParser().parseFromString(e,"image/svg+xml").documentElement,r=qn(n.getAttribute("width")),i=qn(n.getAttribute("height"));if(r!==null&&i!==null)return{width:r,height:i};let a=di(n.getAttribute("viewBox"));return a!==null?a:{width:1,height:1}}var dt=class{constructor(e,n,r){this.core=e;this.fontManager=n;this.onCommitFrame=r;this.loadedSvgs=new Map;this.loadedTextures=new Map}async loadSvg(e,n){this.loadedSvgs.set(e,n);let r=await fetch(n);if(!r.ok)throw new Error(`Failed to fetch SVG ${n}: ${String(r.status)}`);let i=new Uint8Array(await r.arrayBuffer()),a=ci(i),o=me(this.core,i);try{this.core._ed_register_svg(e,o.ptr,o.len)}finally{o.dispose()}return this.onCommitFrame(),a}async loadTexture(e,n){this.loadedTextures.set(e,n);let r=await fetch(n);if(!r.ok)throw new Error(`Failed to fetch texture ${n}: ${String(r.status)}`);let i=await r.blob(),a=await Gn(i),o=a.width,s=a.height;try{let l=zn(a),c=me(this.core,l);try{this.core._ed_register_texture_rgba(e,c.ptr,o,s,c.len)}finally{c.dispose()}}finally{a.close?.()}return this.onCommitFrame(),{width:o,height:s}}releaseSvg(e){this.loadedSvgs.delete(e)}releaseTexture(e){this.loadedTextures.delete(e),this.core._ed_unregister_texture(e),this.onCommitFrame()}async replayLoadedAssets(){await Promise.all([this.fontManager.replayLoadedFonts(),...Array.from(this.loadedSvgs.entries(),async([e,n])=>{let r=await fetch(n);if(!r.ok)throw new Error(`Failed to refetch SVG ${n}: ${String(r.status)}`);let i=new Uint8Array(await r.arrayBuffer()),a=me(this.core,i);try{this.core._ed_register_svg(e,a.ptr,a.len)}finally{a.dispose()}}),...Array.from(this.loadedTextures.entries(),async([e,n])=>{let r=await fetch(n);if(!r.ok)throw new Error(`Failed to refetch texture ${n}: ${String(r.status)}`);let i=await r.blob(),a=await Gn(i);try{let o=zn(a),s=me(this.core,o);try{this.core._ed_register_texture_rgba(e,s.ptr,a.width,a.height,s.len)}finally{s.dispose()}}finally{a.close?.()}})])}};var Vn="https://fonts.googleapis.com",ui="https://fonts.gstatic.com";function $n(t,e,n){if(document.head.querySelector(`link[rel="${t}"][href="${e}"]`)instanceof HTMLLinkElement)return;let i=document.createElement("link");i.rel=t,i.href=e,n!==void 0&&(i.crossOrigin=n),document.head.appendChild(i)}function mi(){$n("preconnect",Vn),$n("preconnect",ui,"anonymous")}function hi(t,e){let n=new URLSearchParams;return n.set("family",`${t}:wght@400`),n.set("text",e),n.set("display","swap"),`${Vn}/css2?${n.toString()}`}function fi(t){let e=/src:\s*url\(([^)]+)\)\s*format\((['"]?)(woff2|woff|truetype|opentype)\2\)/.exec(t);if(e?.[1]===void 0)throw new Error("Google Fonts stylesheet did not expose a usable shard URL.");return e[1].trim()}async function Xn(t,e){mi();let n=hi(t,e),r=await fetch(n,{mode:"cors"});if(!r.ok)throw new Error(`Failed to fetch Google Fonts stylesheet ${n}: ${String(r.status)}`);let i=fi(await r.text()),a=await fetch(i);if(!a.ok)throw new Error(`Failed to fetch font ${i}: ${String(a.status)}`);return{url:i,bytes:new Uint8Array(await a.arrayBuffer())}}var pi=1,gi=2,Ve=3,jn=4,yi=new Set([1,2,9,10,5,6]),Yn=[{familyKey:"hebrew",googleFamily:"Noto Sans Hebrew",ranges:[[1424,1535]]},{familyKey:"armenian",googleFamily:"Noto Sans Armenian",ranges:[[1328,1423]]},{familyKey:"georgian",googleFamily:"Noto Sans Georgian",ranges:[[4256,4351],[11520,11567]]},{familyKey:"devanagari",googleFamily:"Noto Sans Devanagari",ranges:[[2304,2431]]},{familyKey:"bengali",googleFamily:"Noto Sans Bengali",ranges:[[2432,2559]]},{familyKey:"gurmukhi",googleFamily:"Noto Sans Gurmukhi",ranges:[[2560,2687]]},{familyKey:"gujarati",googleFamily:"Noto Sans Gujarati",ranges:[[2688,2815]]},{familyKey:"oriya",googleFamily:"Noto Sans Oriya",ranges:[[2816,2943]]},{familyKey:"tamil",googleFamily:"Noto Sans Tamil",ranges:[[2944,3071]]},{familyKey:"telugu",googleFamily:"Noto Sans Telugu",ranges:[[3072,3199]]},{familyKey:"kannada",googleFamily:"Noto Sans Kannada",ranges:[[3200,3327]]},{familyKey:"malayalam",googleFamily:"Noto Sans Malayalam",ranges:[[3328,3455]]},{familyKey:"sinhala",googleFamily:"Noto Sans Sinhala",ranges:[[3456,3583]]},{familyKey:"lao",googleFamily:"Noto Sans Lao",ranges:[[3712,3839]]},{familyKey:"myanmar",googleFamily:"Noto Sans Myanmar",ranges:[[4096,4255]]},{familyKey:"khmer",googleFamily:"Noto Sans Khmer",ranges:[[6016,6143]]},{familyKey:"ethiopic",googleFamily:"Noto Sans Ethiopic",ranges:[[4608,4991],[4992,5023],[11648,11743]]}];function bi(t,e){return e.some(([n,r])=>t>=n&&t<=r)}function Ot(t){let e=new Set,n=[];for(let r of t)e.has(r)||(e.add(r),n.push(r));return n}function _i(t){return t>=12288&&t<=12351||t>=65281&&t<=65295||t>=65306&&t<=65312||t>=65339&&t<=65344||t>=65371&&t<=65381}function ke(t,e,n,r,i){if(i.length===0)return null;let a=i.join("");return{packageId:t,coverageKind:e,familyKey:n,googleFamily:r,text:a}}function xi(t){let e=Ot(t),n=[],r=[],i=[],a=[];for(let s of e){let l=s.codePointAt(0);if(l!==void 0){if(_i(l)){a.push(s);continue}if(l>=12352&&l<=12543||l>=12784&&l<=12799){n.push(s);continue}if(l>=44032&&l<=55215){r.push(s);continue}(l>=13312&&l<=19903||l>=19968&&l<=40959||l>=63744&&l<=64255)&&i.push(s)}}let o=[];return n.length>0&&o.push(ke("cjk-sans",Ve,"cjk-jp","Noto Sans JP",[...n,...i,...a])),r.length>0&&o.push(ke("cjk-sans",Ve,"cjk-kr","Noto Sans KR",[...r,...n.length===0?i:[],...a])),i.length>0&&n.length===0&&r.length===0&&o.push(ke("cjk-sans",Ve,"cjk-sc","Noto Sans SC",[...i,...a])),o.length===0&&a.length>0&&o.push(ke("cjk-sans",Ve,"cjk-sc","Noto Sans SC",a)),o}function vi(t){let e=Ot(t),n=new Map;for(let r of e){let i=r.codePointAt(0);if(i===void 0)continue;let a=Yn.find(s=>bi(i,s.ranges));if(a===void 0)continue;let o=n.get(a.familyKey)??[];o.push(r),n.set(a.familyKey,o)}return Yn.map(r=>ke("supplemental-sans",jn,r.familyKey,r.googleFamily,n.get(r.familyKey)??[])).filter(r=>r!==null)}function Jn(t,e,n){if(!yi.has(t)||n.length===0)return[];let r=Ot(n).join("");return r.length===0?[]:e===pi?[ke("arabic-sans",e,"arabic-core","Noto Naskh Arabic",Array.from(r))]:e===gi?[ke("thai-sans",e,"thai-core","Noto Sans Thai",Array.from(r))]:e===Ve?xi(r):e===jn?vi(r):[]}var Wt={autoGrow:!0,maxCachedShardFonts:8,allowedFontIds:null,blockedPackageIds:null},ct=class{constructor(e,n,r,i){this.core=e;this.ui=n;this.logs=r;this.onCommitFrame=i;this.loadedFonts=new Map;this.fontLoadStates=new Map;this.incrementalFontStates=new Map;this.fontFallbacks=new Map;this.lazyFontSources=new Map;this.pendingFontLoads=new Map;this.pendingIncrementalShardLoads=new Map;this.pendingIncrementalFamilyRequests=new Map;this.scheduledIncrementalFamilyFlushes=new Set;this.incrementalShardCache=new Map;this.shardKeysByPrimaryFont=new Map;this.evictedShardKeys=[];this.nextIncrementalFontId=2130706688;this.shardAccessTick=0;this.incrementalFontPolicy=Wt;this.normalizedIncrementalFontPolicy={autoGrow:Wt.autoGrow,maxCachedShardFonts:Wt.maxCachedShardFonts,allowedFontIds:null,blockedPackageIds:null}}normalizePolicy(e){return{autoGrow:e.autoGrow,maxCachedShardFonts:Math.max(1,Math.floor(e.maxCachedShardFonts)),allowedFontIds:e.allowedFontIds===null?null:new Set(e.allowedFontIds),blockedPackageIds:e.blockedPackageIds===null?null:new Set(e.blockedPackageIds)}}registerFontBytes(e,n){let r=me(this.core,n),i=me(this.ui,n);try{if(this.core._ed_register_font(e,r.ptr,r.len),this.ui._ui_register_font(e,i.ptr,i.len)===0)throw new Error(`Ui rejected font ${String(e)}.`);this.ui._ui_font_loaded(e)}finally{r.dispose(),i.dispose()}}unregisterFont(e){this.core._ed_unregister_font(e),this.ui._ui_unregister_font(e),this.loadedFonts.delete(e),this.fontLoadStates.delete(e)}updateShardAccess(e){let n=this.incrementalShardCache.get(e);n!==void 0&&(this.shardAccessTick+=1,n.lastAccessTick=this.shardAccessTick)}getAutoGrowBlockReason(e,n){return this.normalizedIncrementalFontPolicy.autoGrow?this.normalizedIncrementalFontPolicy.allowedFontIds!==null&&!this.normalizedIncrementalFontPolicy.allowedFontIds.has(e)?"font-not-allowed":n!==null&&this.normalizedIncrementalFontPolicy.blockedPackageIds!==null&&this.normalizedIncrementalFontPolicy.blockedPackageIds.has(n)?"package-blocked":null:"auto-grow-disabled"}releasePrimaryFontShardReference(e,n,r){let i=this.ensureIncrementalFontState(e);i.appliedSegmentIds.delete(n),i.evictedSegmentIds.add(n),i.revision+=1;let a=this.shardKeysByPrimaryFont.get(e);a?.delete(n),a!==void 0&&a.size===0&&this.shardKeysByPrimaryFont.delete(e);let o=this.fontFallbacks.get(e);o!==void 0&&this.fontFallbacks.set(e,o.filter(s=>s!==r)),this.ui._ui_unregister_font_fallback(e,r),this.ui._ui_font_loaded(e)}evictIncrementalShard(e){let n=this.incrementalShardCache.get(e);if(n!==void 0){for(let r of n.primaryFontIds)this.releasePrimaryFontShardReference(r,e,n.fontId);this.incrementalShardCache.delete(e),this.evictedShardKeys.push(e),this.evictedShardKeys.length>32&&this.evictedShardKeys.splice(0,this.evictedShardKeys.length-32),this.unregisterFont(n.fontId),this.onCommitFrame()}}ensureShardCacheCapacityForNewEntry(){for(;this.incrementalShardCache.size>=this.normalizedIncrementalFontPolicy.maxCachedShardFonts;){let e=null;for(let n of this.incrementalShardCache.values())(e===null||n.lastAccessTick<e.lastAccessTick)&&(e=n);if(e===null)return;this.evictIncrementalShard(e.shardKey)}}trimShardCacheToPolicyLimit(){for(;this.incrementalShardCache.size>this.normalizedIncrementalFontPolicy.maxCachedShardFonts;){let e=null;for(let n of this.incrementalShardCache.values())(e===null||n.lastAccessTick<e.lastAccessTick)&&(e=n);if(e===null)return;this.evictIncrementalShard(e.shardKey)}}ensureIncrementalFontState(e){let n=this.incrementalFontStates.get(e);return n!==void 0||(n={sourceUrl:null,sourceState:"unknown",requestedSegmentIds:new Set,pendingSegmentIds:new Set,appliedSegmentIds:new Set,evictedSegmentIds:new Set,requestedCharactersByFamily:new Map,revision:0,blockedPackageIds:new Set,lastBlockedReason:null},this.incrementalFontStates.set(e,n)),n}rememberFontSource(e,n){let r=this.fontLoadStates.get(e);if(r!==void 0&&r.url===n&&(r.state==="loading"||r.state==="loaded"))return;this.fontLoadStates.set(e,{url:n,state:"known"});let i=this.ensureIncrementalFontState(e),a=i.sourceUrl;i.sourceUrl=n,(i.sourceState==="unknown"||i.sourceState==="failed"||a!==n)&&(i.sourceState="known")}markFontLoading(e,n){this.fontLoadStates.set(e,{url:n,state:"loading"});let r=this.ensureIncrementalFontState(e);r.sourceUrl=n,r.sourceState="loading"}markFontLoaded(e,n){this.fontLoadStates.set(e,{url:n,state:"loaded"});let r=this.ensureIncrementalFontState(e);r.sourceUrl=n,r.sourceState="loaded"}markFontLoadFailed(e,n){this.fontLoadStates.set(e,{url:n,state:"failed"});let r=this.ensureIncrementalFontState(e);r.sourceUrl=n,r.sourceState="failed"}isFontLoaded(e,n){let r=this.fontLoadStates.get(e);return r!==void 0&&r.state==="loaded"&&(n===void 0||r.url===n)}async fetchFontBytes(e,n=!1){let r=await fetch(e);if(!r.ok){let i=n?"refetch":"fetch";throw new Error(`Failed to ${i} font ${e}: ${String(r.status)}`)}return new Uint8Array(await r.arrayBuffer())}reportBridgeError(e){window.__bridgeError=e instanceof Error?e.message:String(e)}applyFontFallbacks(e,n){this.fontFallbacks.set(e,[...n]);for(let r of n)this.ui._ui_register_font_fallback(e,r)}async ensureRegisteredFont(e,n,r=[]){this.rememberFontSource(e,n);let i=this.pendingFontLoads.get(e);if(i!==void 0){await i;return}let a=this.registerFont(r.length>0?{id:e,url:n,fallbackIds:r}:{id:e,url:n}).finally(()=>{this.pendingFontLoads.delete(e)});this.pendingFontLoads.set(e,a),await a}async ensureFontWithFallbacks(e,n=new Set){if(n.has(e))return;if(n.add(e),!this.isFontLoaded(e)){let i=this.lazyFontSources.get(e);if(i!==void 0)await this.ensureRegisteredFont(e,i);else{let a=lt(e);a!==void 0&&await this.ensureRegisteredFont(a.id,Ne(a.assetFile),a.fallbackIds)}}let r=this.fontFallbacks.get(e)??[];await Promise.all(r.map(i=>this.ensureFontWithFallbacks(i,n)))}registerSingleFontFallback(e,n){let r=this.fontFallbacks.get(e)??[];r.includes(n)||this.fontFallbacks.set(e,[...r,n]),this.ui._ui_register_font_fallback(e,n)}async ensureIncrementalShardFont(e){let n=this.incrementalShardCache.get(e.shardKey);if(n!==void 0)return this.updateShardAccess(e.shardKey),n.fontId;let r=this.pendingIncrementalShardLoads.get(e.shardKey);if(r!==void 0)return await r;let i=(async()=>{this.ensureShardCacheCapacityForNewEntry();let a=this.nextIncrementalFontId;this.nextIncrementalFontId+=1;let o=await Xn(e.googleFamily,e.text);return this.registerFontBytes(a,o.bytes),this.loadedFonts.set(a,o.url),this.markFontLoaded(a,o.url),this.shardAccessTick+=1,this.incrementalShardCache.set(e.shardKey,{shardKey:e.shardKey,fontId:a,sizeBytes:o.bytes.byteLength,primaryFontIds:new Set,lastAccessTick:this.shardAccessTick}),a})().finally(()=>{this.pendingIncrementalShardLoads.delete(e.shardKey)});return this.pendingIncrementalShardLoads.set(e.shardKey,i),await i}async flushPendingIncrementalFamilyRequest(e,n){let r=`${String(e)}:${n}`;this.scheduledIncrementalFamilyFlushes.delete(r);let i=this.pendingIncrementalFamilyRequests.get(r);if(i===void 0)return;this.pendingIncrementalFamilyRequests.delete(r);let a=this.ensureIncrementalFontState(e),o=Array.from(i.characters.values()).join("");if(o.length===0)return;let s=`${i.familyKey}:${o}`;a.requestedSegmentIds.add(s),a.pendingSegmentIds.add(s),this.logs.incrementalFontPackageRequests.push({primaryFontId:e,coverageKind:i.coverageKind,packageId:i.packageId,segmentIds:[s],sampleText:o});try{let l=await this.ensureIncrementalShardFont({packageId:i.packageId,coverageKind:i.coverageKind,familyKey:i.familyKey,googleFamily:i.googleFamily,text:o,shardKey:s});this.registerSingleFontFallback(e,l);let c=this.incrementalShardCache.get(s);c!==void 0&&(c.primaryFontIds.add(e),this.updateShardAccess(s));let d=this.shardKeysByPrimaryFont.get(e);d===void 0&&(d=new Set,this.shardKeysByPrimaryFont.set(e,d)),d.add(s),a.appliedSegmentIds.has(s)||(a.appliedSegmentIds.add(s),a.revision+=1),a.pendingSegmentIds.delete(s),a.evictedSegmentIds.delete(s),this.ui._ui_font_loaded(e),this.onCommitFrame()}catch(l){a.requestedSegmentIds.delete(s),a.pendingSegmentIds.delete(s);let c=a.requestedCharactersByFamily.get(i.familyKey);if(c!==void 0){for(let d of o)c.delete(d);c.size===0&&a.requestedCharactersByFamily.delete(i.familyKey)}throw this.reportBridgeError(l),l}}async ensureFont(e){await this.ensureFontWithFallbacks(e)}async ensureBuiltInFont(e){let n=lt(e);if(n===void 0)throw new Error(`Unknown built-in font id ${String(e)}.`);await this.ensureRegisteredFont(n.id,Ne(n.assetFile),n.fallbackIds)}getIncrementalFontCacheState(){return{maxCachedShardFonts:this.incrementalFontPolicy.maxCachedShardFonts,cachedShardCount:this.incrementalShardCache.size,cachedShardKeys:Array.from(this.incrementalShardCache.keys()),evictedShardKeys:[...this.evictedShardKeys]}}getIncrementalFontPolicy(){return{autoGrow:this.incrementalFontPolicy.autoGrow,maxCachedShardFonts:this.incrementalFontPolicy.maxCachedShardFonts,allowedFontIds:this.incrementalFontPolicy.allowedFontIds===null?null:[...this.incrementalFontPolicy.allowedFontIds],blockedPackageIds:this.incrementalFontPolicy.blockedPackageIds===null?null:[...this.incrementalFontPolicy.blockedPackageIds]}}setIncrementalFontPolicy(e){let n={autoGrow:e.autoGrow??this.incrementalFontPolicy.autoGrow,maxCachedShardFonts:e.maxCachedShardFonts??this.incrementalFontPolicy.maxCachedShardFonts,allowedFontIds:"allowedFontIds"in e?e.allowedFontIds??null:this.incrementalFontPolicy.allowedFontIds,blockedPackageIds:"blockedPackageIds"in e?e.blockedPackageIds??null:this.incrementalFontPolicy.blockedPackageIds};this.normalizedIncrementalFontPolicy=this.normalizePolicy(n),this.incrementalFontPolicy={...n,maxCachedShardFonts:this.normalizedIncrementalFontPolicy.maxCachedShardFonts},this.trimShardCacheToPolicyLimit()}getIncrementalFontState(e){let n=this.incrementalFontStates.get(e);return n===void 0?null:{fontId:e,sourceUrl:n.sourceUrl,sourceState:n.sourceState,loaded:this.isFontLoaded(e),requestedSegmentIds:Array.from(n.requestedSegmentIds.values()),pendingSegmentIds:Array.from(n.pendingSegmentIds.values()),appliedSegmentIds:Array.from(n.appliedSegmentIds.values()),evictedSegmentIds:Array.from(n.evictedSegmentIds.values()),revision:n.revision,autoGrowAllowed:this.getAutoGrowBlockReason(e,null)===null,blockedPackageIds:Array.from(n.blockedPackageIds.values()),lastBlockedReason:n.lastBlockedReason}}getClipboardFontUrl(e){let n=this.loadedFonts.get(e);if(n!==void 0)return n;let r=this.fontLoadStates.get(e)?.url;if(r!==void 0)return r;let i=this.lazyFontSources.get(e);if(i!==void 0)return i;let a=lt(e);return a===void 0?null:Ne(a.assetFile)}registerLazyFont(e,n){this.lazyFontSources.set(e,n),this.rememberFontSource(e,n),this.loadedFonts.get(e)!==n&&this.loadedFonts.delete(e)}registerFontFallback(e,n){this.registerSingleFontFallback(e,n)}handleMissingFontCoverage(e,n,r){let i=this.ensureIncrementalFontState(e),a=Jn(e,n,r);for(let o of a){let s=this.getAutoGrowBlockReason(e,o.packageId);if(s!==null){i.blockedPackageIds.add(o.packageId),i.lastBlockedReason=s;continue}i.blockedPackageIds.delete(o.packageId),i.blockedPackageIds.size===0&&(i.lastBlockedReason=null);let l=i.requestedCharactersByFamily.get(o.familyKey);l===void 0&&(l=new Set,i.requestedCharactersByFamily.set(o.familyKey,l));let c=`${String(e)}:${o.familyKey}`,d=this.pendingIncrementalFamilyRequests.get(c);d===void 0&&(d={packageId:o.packageId,coverageKind:o.coverageKind,familyKey:o.familyKey,googleFamily:o.googleFamily,characters:new Set},this.pendingIncrementalFamilyRequests.set(c,d));let f=!1;for(let y of o.text)l.has(y)||(l.add(y),d.characters.add(y),f=!0);!f||this.scheduledIncrementalFamilyFlushes.has(c)||(this.scheduledIncrementalFamilyFlushes.add(c),queueMicrotask(()=>{this.flushPendingIncrementalFamilyRequest(e,o.familyKey).catch(()=>{})}))}}async loadFont(e,n){if(!this.isFontLoaded(e,n)){this.rememberFontSource(e,n),this.markFontLoading(e,n);try{let r=await this.fetchFontBytes(n);this.registerFontBytes(e,r),this.loadedFonts.set(e,n),this.markFontLoaded(e,n),this.onCommitFrame()}catch(r){throw this.loadedFonts.get(e)===n&&this.loadedFonts.delete(e),this.markFontLoadFailed(e,n),r}}}async registerFont(e){this.isFontLoaded(e.id,e.url)||await this.loadFont(e.id,e.url),e.fallbackIds!==void 0&&this.applyFontFallbacks(e.id,e.fallbackIds),this.onCommitFrame()}async registerFontStack(e){let n=e.fallbacks??[];await Promise.all([this.loadFont(e.primary.id,e.primary.url),...n.map(r=>this.loadFont(r.id,r.url))]),this.applyFontFallbacks(e.primary.id,n.map(r=>r.id)),this.onCommitFrame()}async replayLoadedFonts(){let e=Array.from(this.loadedFonts.entries(),async([n,r])=>{let i=await this.fetchFontBytes(r,!0);this.registerFontBytes(n,i)});await Promise.all(e);for(let[n,r]of this.fontFallbacks.entries())for(let i of r)this.ui._ui_register_font_fallback(n,i)}};var Ei=new TextEncoder;function Dt(t){return Ei.encode(t).byteLength}function Qn(t){return t instanceof Element?t:t?.parentElement??null}function Nt(t,e){let n=Math.max(0,Math.min(e,t.length));return Dt(t.slice(0,n))}function Zn(t,e){let n=Math.max(0,Math.min(e,Dt(t))),r=0,i=0;for(;i<t.length;){let a=t.codePointAt(i)??0,o=i+(a>65535?2:1),s=Nt(t,o);if(s>n||(i=o,r=s,r===n))break}return i}function er(t,e,n){let r=document.createRange();r.selectNodeContents(t);try{r.setEnd(e,n)}catch{return null}return r.toString().length}function Ti(t,e,n,r){let i=e.get(r.handle);if(i!==void 0)return i;let a=document.createElement("div");return a.setAttribute("data-ed-find-fragment","1"),a.setAttribute("data-ed-canvas-id",n),a.style.display="block",a.style.position="relative",a.style.whiteSpace="pre-wrap",a.style.wordBreak="break-word",a.style.pointerEvents="none",a.style.userSelect="text",t.appendChild(a),e.set(r.handle,a),a}var ut=class{constructor(e,n){this.elementsByHandle=new Map;let r=e.parentElement;if(!(r instanceof HTMLElement))throw new Error("Expected scene shell for Find-on-Page projection.");let i=document.createElement("div");i.id=`find-on-page-layer-${n}`,i.style.position="absolute",i.style.left="0",i.style.top="0",i.style.pointerEvents="none",i.style.opacity="0",i.style.overflow="hidden",i.style.userSelect="text",i.setAttribute("aria-hidden","true"),i.setAttribute("data-ed-find-root","1"),i.setAttribute("data-ed-canvas-id",n);let a=document.createElement("div");a.id=`find-on-page-content-${n}`,a.style.position="absolute",a.style.left="0",a.style.top="0",a.style.width="100%",a.style.minHeight="100%",a.style.pointerEvents="none",a.style.userSelect="text",a.style.whiteSpace="pre-wrap",a.style.color="transparent",a.style.background="transparent",i.appendChild(a),r.appendChild(i),this.layer=i,this.content=a,this.canvasId=n}syncSize(e,n){let r=`${String(e)}px`,i=`${String(n)}px`;this.layer.style.width=r,this.layer.style.height=i}update(e){let n=new Set,r=[];for(let i of e){n.add(i.handle);let a=Ti(this.content,this.elementsByHandle,this.canvasId,i);a.setAttribute("data-ed-handle",i.handle),a.setAttribute("data-ed-start","0"),a.setAttribute("data-ed-end",String(Dt(i.text))),a.textContent!==i.text&&(a.textContent=i.text),r.push(a)}this.content.replaceChildren(...r);for(let[i]of this.elementsByHandle.entries())n.has(i)||this.elementsByHandle.delete(i)}resolveSelection(e){if(e===null||e.rangeCount===0||e.isCollapsed||document.activeElement?.getAttribute("data-effindom-hidden-editor")==="true")return null;let n=e.getRangeAt(0),r=Qn(n.startContainer),i=Qn(n.endContainer);if(r?.closest('[data-effindom-hidden-editor="true"]')!==null||i?.closest('[data-effindom-hidden-editor="true"]')!==null)return null;let a=r?.closest('[data-ed-find-root="1"]'),o=i?.closest('[data-ed-find-root="1"]'),s=r?.closest('[data-ed-find-fragment="1"]'),l=i?.closest('[data-ed-find-fragment="1"]');if(!(a instanceof HTMLElement)||!(o instanceof HTMLElement)||!(s instanceof HTMLElement)||!(l instanceof HTMLElement)||a!==o||s!==l||a.dataset.edCanvasId!==this.canvasId||s.dataset.edCanvasId!==this.canvasId)return null;let c=s.dataset.edHandle,d=Number(s.dataset.edStart),f=Number(s.dataset.edEnd);if(c===void 0||!Number.isFinite(d)||!Number.isFinite(f)||d<0||f<d)return null;let y=s.textContent??"",u=er(s,n.startContainer,n.startOffset),F=er(s,n.endContainer,n.endOffset);if(u===null||F===null)return null;let h=d+Nt(y,u),g=d+Nt(y,F);return h>=g||g>f?null:{handle:c,start:h,end:g}}selectMatch(e){let n=document.getSelection();if(n===null)return!1;if(e===null)return n.removeAllRanges(),!0;let r=this.elementsByHandle.get(e.handle);if(!(r instanceof HTMLElement))return!1;let i=Number(r.dataset.edStart),a=Number(r.dataset.edEnd);if(!Number.isFinite(i)||!Number.isFinite(a)||e.start<i||e.end>a||e.start>=e.end)return!1;let o=r.textContent??"",s=e.start-i,l=e.end-i,c=Zn(o,s),d=Zn(o,l),f=r.firstChild instanceof Text?r.firstChild:document.createTextNode(o);r.firstChild!==f&&r.replaceChildren(f);let y=document.createRange();return y.setStart(f,c),y.setEnd(f,d),n.removeAllRanges(),n.addRange(y),!0}destroy(){this.elementsByHandle.clear(),this.layer.remove()}};var Si=4293606200,mt=class{constructor(e){this.options=e;this.activeFindMatch=null;this.activeFindState=null;this.selectionPollTimer=null;this.selectionClearTimer=null;let n=`ed-canvas-${Math.random().toString(36).slice(2,10)}`;this.findProjector=new ut(e.canvas,n),window.__bridgeFindMatch=null,window.__bridgeFindState=null;let r=()=>{this.handleSelectionChange()};document.addEventListener("selectionchange",r),this.selectionPollTimer=setInterval(()=>{document.hidden||this.handleSelectionChange()},100),this.destroy=(()=>{this.selectionPollTimer!==null&&(clearInterval(this.selectionPollTimer),this.selectionPollTimer=null),this.cancelPendingFindClear(),document.removeEventListener("selectionchange",r),this.storeFindState(null),this.storeFindMatch(null),this.findProjector.destroy()}).bind(this)}syncSize(e,n){this.findProjector.syncSize(e,n)}syncDocuments(){this.findProjector.update(this.options.textDocuments.readFindDocuments())}getFindDocuments(){return this.options.textDocuments.readFindDocuments().map(e=>({...e}))}getFindState(){return this.activeFindState===null?null:{query:this.activeFindState.query,options:{...this.activeFindState.options},matches:this.activeFindState.matches.map(e=>({...e})),activeMatchIndex:this.activeFindState.activeMatchIndex}}activateFindMatch(e,n=!0){return this.applyRetainedFindMatch(e,n)}setFindState(e,n=!1){return this.applyRetainedFindState(e,n)}syncFindSelection(e=!1){return this.handleSelectionChange(e)}clearFindMatch(){return this.findProjector.selectMatch(null),this.applyRetainedFindMatch(null,!1)}destroy(){}isBridgeFindDialogOpen(){return document.querySelector('[data-ed-find-dialog="1"][data-ed-open="1"]')!==null}cancelPendingFindClear(){this.selectionClearTimer!==null&&(clearTimeout(this.selectionClearTimer),this.selectionClearTimer=null)}schedulePendingFindClear(){this.cancelPendingFindClear(),this.selectionClearTimer=window.setTimeout(()=>{this.selectionClearTimer=null,!this.isBridgeFindDialogOpen()&&this.findProjector.resolveSelection(document.getSelection())===null&&this.activeFindMatch!==null&&this.applyRetainedFindState(null,!1)},150)}storeFindMatch(e){this.activeFindMatch=e===null?null:{...e},window.__bridgeFindMatch=this.activeFindMatch}storeFindState(e){this.activeFindState=e===null?null:{query:e.query,options:{...e.options},matches:e.matches.map(n=>({...n})),activeMatchIndex:e.activeMatchIndex},window.__bridgeFindState=this.activeFindState}applyRetainedFindState(e,n){if(e===null)return this.options.ui._ui_clear_text_find_highlights(),this.options.ui._ui_clear_text_find_match(),this.options.commitFrame(),this.options.flushPendingCommit(),this.storeFindState(null),this.storeFindMatch(null),!0;let r=Pt(e.options);if(e.activeMatchIndex<-1||e.activeMatchIndex>=e.matches.length||e.matches.length===0&&e.activeMatchIndex!==-1)return!1;let i=[];for(let o of e.matches){let s=this.options.textDocuments.resolveTextRange(o.handle,o.start,o.end);if(s===null)return!1;i.push({handleArg:s.handleArg,match:{handle:o.handle,start:s.start,end:s.end}})}if(this.options.ui._ui_clear_text_find_highlights(),r.highlightAll)for(let o=0;o<i.length;o+=1){if(o===e.activeMatchIndex)continue;let s=i[o];if(s!==void 0&&this.options.ui._ui_push_text_find_highlight(s.handleArg,s.match.start,s.match.end,Si)===0)return this.options.ui._ui_clear_text_find_highlights(),!1}let a=e.activeMatchIndex>=0?i[e.activeMatchIndex]??null:null;if(a===null)this.options.ui._ui_clear_text_find_match();else{if(this.options.ui._ui_set_text_find_match(a.handleArg,a.match.start,a.match.end)===0)return this.options.ui._ui_clear_text_find_highlights(),!1;if(n&&this.options.ui._ui_reveal_text_range(a.handleArg,a.match.start,a.match.end)===0)return this.options.ui._ui_clear_text_find_highlights(),!1}return this.options.commitFrame(),this.options.flushPendingCommit(),this.storeFindState({query:e.query,options:r,matches:i.map(o=>({...o.match})),activeMatchIndex:a===null?-1:e.activeMatchIndex}),this.storeFindMatch(a?.match??null),!0}applyRetainedFindMatch(e,n){return this.applyRetainedFindState(e===null?null:{query:"",options:{..._e},matches:[{...e}],activeMatchIndex:0},n)}handleSelectionChange(e=!1){let n=this.findProjector.resolveSelection(document.getSelection());return n===null?(e&&!this.isBridgeFindDialogOpen()&&this.activeFindMatch!==null&&this.schedulePendingFindClear(),!1):(this.cancelPendingFindClear(),this.activeFindMatch!==null&&this.activeFindMatch.handle===n.handle&&this.activeFindMatch.start===n.start&&this.activeFindMatch.end===n.end?!0:this.applyRetainedFindMatch(n,!0))}};var wi=new TextDecoder,tr=new DataView(new ArrayBuffer(4)),ht=new WeakMap,Li={0:{roleName:"none",tagName:"span",ariaRole:null},1:{roleName:"button",tagName:"button",ariaRole:"button"},2:{roleName:"textbox",tagName:"input",ariaRole:"textbox"},3:{roleName:"link",tagName:"a",ariaRole:"link"},4:{roleName:"heading",tagName:"h1",ariaRole:"heading"},5:{roleName:"form",tagName:"form",ariaRole:"form"},6:{roleName:"list",tagName:"ul",ariaRole:"list"},7:{roleName:"listitem",tagName:"li",ariaRole:"listitem"},8:{roleName:"img",tagName:"div",ariaRole:"img"},9:{roleName:"dialog",tagName:"dialog",ariaRole:"dialog"},10:{roleName:"text",tagName:"p",ariaRole:null},11:{roleName:"checkbox",tagName:"input",ariaRole:"checkbox"},12:{roleName:"radio",tagName:"input",ariaRole:"radio"},13:{roleName:"radiogroup",tagName:"div",ariaRole:"radiogroup"},14:{roleName:"switch",tagName:"button",ariaRole:"switch"},15:{roleName:"slider",tagName:"div",ariaRole:"slider"},16:{roleName:"combobox",tagName:"div",ariaRole:"combobox"}};function Fi(t){if(t===1)return"false";if(t===2)return"true";if(t===3)return"mixed"}function Ci(t){if(t===1)return"horizontal";if(t===2)return"vertical"}function Re(t){return tr.setUint32(0,t>>>0,!0),tr.getFloat32(0,!0)}function Gt(t){return Li[t]??{roleName:`unknown-${String(t)}`,tagName:"span",ariaRole:null}}function Ai(t,e){return t.role===2&&t.state.multiline===!0?"textarea":e.tagName}function Ii(t,e,n){if(n===0)return"";let r=t.byteOffset+e*4,i=Math.ceil(n/4)*4,a=new Uint8Array(t.buffer,r,i);return wi.decode(a.subarray(0,n))}function rr(t){if(t.length===0)return[];let e=t[0]??0;if(e===0)return[];let n=1,r=[];r.length=0;for(let i=0;i<e;i+=1){if(n+14>t.length)throw new Error("Semantic buffer ended mid-record.");let a=t[n]??0,o=t[n+1]??0,s=t[n+2]??0,l=t[n+7]??0,c=t[n+8]??0,d=t[n+9]??0,f=Re(t[n+10]??0),y=Re(t[n+11]??0),u=Re(t[n+12]??0),F=t[n+13]??0,h=Math.ceil(F/4),g=Gt(a),w=(BigInt(s)<<32n|BigInt(o)).toString(),S={x:Re(t[n+3]??0),y:Re(t[n+4]??0),width:Re(t[n+5]??0),height:Re(t[n+6]??0)},b={},x=Fi(c);x!==void 0&&(b.checked=x),(l&1)!==0&&(b.selected=(l&2)!==0),(l&4)!==0&&(b.expanded=(l&8)!==0),(l&16)!==0&&(b.disabled=(l&32)!==0),(l&128)!==0&&(b.readonly=(l&256)!==0),(l&512)!==0&&(b.multiline=(l&1024)!==0);let v=Ci(d);if(v!==void 0&&(b.orientation=v),(l&64)!==0&&(b.valueNow=f,b.valueMin=y,b.valueMax=u),n+=14,n+h>t.length)throw new Error("Semantic buffer label exceeded record bounds.");let C=Ii(t,n,F);n+=h,r.push({role:a,roleName:g.roleName,handle:w,bounds:S,label:C,state:b})}return r}function Pi(t,e){t.style.left=`${String(e.x)}px`,t.style.top=`${String(e.y)}px`,t.style.width=`${String(e.width)}px`,t.style.height=`${String(e.height)}px`}function ki(t){let e=t.firstElementChild;if(e instanceof HTMLSpanElement&&e.getAttribute("data-semantic-text-run")==="true")return e;let n=document.createElement("span");return n.setAttribute("data-semantic-text-run","true"),n.style.position="absolute",n.style.left="0",n.style.top="0",n.style.display="block",n.style.pointerEvents="none",n.style.margin="0",n.style.padding="0",n.style.border="0",t.replaceChildren(n),n}function Ut(t){let e=t.firstElementChild;if(e instanceof HTMLSpanElement&&e.getAttribute("data-semantic-text-content")==="true")return e;let n=document.createElement("span");return n.setAttribute("data-semantic-text-content","true"),n.style.display="inline-block",n.style.margin="0",n.style.padding="0",n.style.border="0",n.style.whiteSpace="pre-wrap",n.style.overflowWrap="break-word",n.style.color="inherit",n.style.webkitTextFillColor="inherit",n.style.transformOrigin="top left",t.replaceChildren(n),n}function Ri(t){if(t.childNodes.length===1){let n=t.firstChild;if(n instanceof Text)return n}let e=document.createTextNode("");return t.replaceChildren(e),e}function Hi(t){let e=t.firstElementChild;e instanceof HTMLSpanElement&&e.getAttribute("data-semantic-text-run")==="true"&&(ht.delete(e),e.remove())}function Bi(t,e,n){if(n===void 0){ht.delete(t);let h=Ut(t);t.style.left="0",t.style.top="0",t.style.width="",t.style.height="",t.style.overflow="visible",h.style.width="",h.style.height="",h.style.transform="";return}let r=Ut(t),i=n.bounds.x-e.x,a=n.bounds.y-e.y;t.style.left=`${String(i)}px`,t.style.top=`${String(a)}px`,t.style.width=`${String(n.bounds.width)}px`,t.style.height=`${String(n.bounds.height)}px`,t.style.overflow="hidden",r.style.width=`${String(n.bounds.width)}px`,r.style.height="",r.style.transform="";let o=r.firstChild,l=[o instanceof Text?o.data:"",n.bounds.width.toFixed(3),n.bounds.height.toFixed(3)].join(""),c=ht.get(t);if(c?.key===l){r.style.transform=`matrix(${String(c.scaleX)}, 0, 0, ${String(c.scaleY)}, ${String(c.translateX)}, ${String(c.translateY)})`;return}let d=r.firstChild,f=1,y=1,u=0,F=0;if(d instanceof Text&&d.data.length>0){let h=document.createRange();h.selectNodeContents(d);let g=h.getBoundingClientRect(),w=r.getBoundingClientRect(),S=g.width>0?n.bounds.width/g.width:1,b=g.height>0?n.bounds.height/g.height:1;f=Number.isFinite(S)&&S>0?S:1,y=Number.isFinite(b)&&b>0?b:1;let x=g.x-w.x,v=g.y-w.y;u=Number.isFinite(x)?-(x*f):0,F=Number.isFinite(v)?-(v*y):0}r.style.transform=`matrix(${String(f)}, 0, 0, ${String(y)}, ${String(u)}, ${String(F)})`,ht.set(t,{key:l,scaleX:f,scaleY:y,translateX:u,translateY:F})}function Mi(t,e){let n=t.firstElementChild;for(let r of e){if(r===n){n=n.nextElementSibling;continue}t.insertBefore(r,n)}for(;n!==null;){let r=n;n=r.nextElementSibling,r.remove()}}function nr(t,e){return e.x>=t.x&&e.y>=t.y&&e.x+e.width<=t.x+t.width&&e.y+e.height<=t.y+t.height}function Oi(t,e,n){let r=Gt(n.role),i=Ai(n,r),a=e.get(n.handle);if(a?.tagName.toLowerCase()===i)return a;let o=document.createElement(i);if(o.setAttribute("data-handle",n.handle),o.style.position="absolute",o.style.pointerEvents="none",o.style.margin="0",o.style.padding="0",o.style.boxSizing="border-box",o.style.background="transparent",o.style.border="0",o.style.outline="none",o.style.appearance="none",o.style.webkitAppearance="none",o.style.color="transparent",o.style.webkitTextFillColor="transparent",o.style.caretColor="transparent",o.style.lineHeight="normal",o.tabIndex=-1,i==="input"){let s=o;n.role===11?s.type="checkbox":n.role===12?s.type="radio":s.type="text",s.readOnly=n.state.readonly??!0}else if(i==="textarea"){let s=o;s.readOnly=n.state.readonly??!0,s.rows=1,s.style.resize="none"}return n.role===2&&n.state.multiline===!0&&o.setAttribute("aria-multiline","true"),a?.parentElement===t?t.replaceChild(o,a):t.appendChild(o),e.set(n.handle,o),o}function Wi(t){return{role:t.role,roleName:t.roleName,handle:t.handle,bounds:{x:t.bounds.x,y:t.bounds.y,width:t.bounds.width,height:t.bounds.height},label:t.label,state:{...t.state}}}function Ni(t){return t===1||t===2||t===8||t===9||t===11||t===12||t===15||t===16}function Di(t){return t!==1&&t!==8}function Ui(t){switch(t.role){case 1:return"button";case 2:return t.state.multiline===!0?"text area":"text input";case 3:return"link";case 4:return"heading";case 5:return"form";case 6:return"list";case 7:return"list item";case 8:return"image";case 9:return"dialog";case 10:return"text";case 11:return"checkbox";case 12:return"radio button";case 13:return"radio group";case 14:return"switch";case 15:return"slider";case 16:return"combo box";default:return t.roleName}}function Ki(t,e){let n=[],r=t.role===2&&t.label.length===0?e[t.handle]??"":t.label;return r.length>0&&n.push(r),t.role===15&&r.length>0||n.push(Ui(t)),t.state.checked==="mixed"?n.push("mixed"):t.state.checked==="true"?n.push("checked"):t.state.checked==="false"&&(t.role===11||t.role===12||t.role===14)&&n.push("unchecked"),t.state.selected===!0&&n.push("selected"),t.state.expanded===!0?n.push("expanded"):t.state.expanded===!1&&n.push("collapsed"),t.state.readonly===!0&&n.push("read only"),t.state.disabled===!0&&n.push("disabled"),t.state.valueNow!==void 0&&Number.isFinite(t.state.valueNow)&&n.push(`value ${String(t.state.valueNow)}`),n.join(", ")}var Kt=class{constructor(e){this.pendingFrame=null;this.pendingTimer=null;this.clearTimer=null;let n=document.createElement("output");n.id="semantic-live-announcer",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.setAttribute("data-effindom-live-announcer","true"),n.style.position="absolute",n.style.width="1px",n.style.height="1px",n.style.margin="-1px",n.style.padding="0",n.style.border="0",n.style.overflow="hidden",n.style.clip="rect(0 0 0 0)",n.style.clipPath="inset(50%)",n.style.whiteSpace="nowrap",n.style.opacity="0",n.textContent="\xA0",e.appendChild(n),this.element=n}announce(e){e.length!==0&&(this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.pendingTimer!==null&&(clearTimeout(this.pendingTimer),this.pendingTimer=null),this.clearTimer!==null&&(clearTimeout(this.clearTimer),this.clearTimer=null),this.element.textContent="\xA0",this.pendingFrame=requestAnimationFrame(()=>{this.pendingFrame=null,this.pendingTimer=setTimeout(()=>{this.pendingTimer=null,this.element.textContent=e,this.clearTimer=setTimeout(()=>{this.clearTimer=null,this.element.textContent="\xA0"},1500)},50)}))}destroy(){this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.pendingTimer!==null&&(clearTimeout(this.pendingTimer),this.pendingTimer=null),this.clearTimer!==null&&(clearTimeout(this.clearTimer),this.clearTimer=null),this.element.remove()}},ft=class{constructor(e){this.elementsByHandle=new Map;let n=e.parentElement;if(!(n instanceof HTMLElement))throw new Error("Expected canvas parent element for semantic projection.");let r=document.createElement("div");r.id="scene-shell",r.style.position="relative",r.style.display="inline-block",r.style.lineHeight="0",n.replaceChild(r,e);let i=document.createElement("div");i.id="semantic-layer",i.style.position="absolute",i.style.left="0",i.style.top="0",i.style.pointerEvents="none",i.style.overflow="hidden",i.style.lineHeight="normal",i.setAttribute("data-visibility","screen-reader-only");let a=i.attachShadow({mode:"open"}),o=document.createElement("div");o.id="semantic-content",o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.width="100%",o.style.height="100%",o.style.padding="0",o.style.border="0",o.style.overflow="hidden",o.style.whiteSpace="nowrap",o.style.color="transparent",o.style.webkitTextFillColor="transparent",o.style.lineHeight="normal",a.appendChild(o);let s=new Kt(a);r.appendChild(e),r.appendChild(i),e.setAttribute("role","application"),e.setAttribute("aria-label","EffinDom application"),this.canvas=e,this.shell=r,this.layer=i,this.content=o,this.announcer=s}syncSize(e,n){let r=`${String(e)}px`,i=`${String(n)}px`;this.shell.style.width=r,this.shell.style.height=i,this.layer.style.width=r,this.layer.style.height=i}update(e,n,r){let i=new Set,a=[];for(let o of e){i.add(o.handle);let s=Gt(o.role),l=Oi(this.content,this.elementsByHandle,o);a.push(l);let c=o.role===2&&o.label.length===0?n[o.handle]??"":o.label;if(s.ariaRole===null?l.removeAttribute("role"):l.setAttribute("role",s.ariaRole),c.length===0||!Ni(o.role)?l.removeAttribute("aria-label"):l.setAttribute("aria-label",c),o.role===9?(l.setAttribute("aria-modal","true"),l instanceof HTMLDialogElement&&l.setAttribute("open","")):l.removeAttribute("aria-modal"),o.state.checked===void 0?l.removeAttribute("aria-checked"):l.setAttribute("aria-checked",o.state.checked),o.state.selected===void 0?l.removeAttribute("aria-selected"):l.setAttribute("aria-selected",o.state.selected?"true":"false"),o.state.expanded===void 0?l.removeAttribute("aria-expanded"):l.setAttribute("aria-expanded",o.state.expanded?"true":"false"),o.state.disabled===void 0?l.removeAttribute("aria-disabled"):l.setAttribute("aria-disabled",o.state.disabled?"true":"false"),o.state.readonly===void 0?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",o.state.readonly?"true":"false"),o.state.multiline===void 0?l.removeAttribute("aria-multiline"):l.setAttribute("aria-multiline",o.state.multiline?"true":"false"),o.state.orientation===void 0?l.removeAttribute("aria-orientation"):l.setAttribute("aria-orientation",o.state.orientation),o.state.valueNow===void 0?(l.removeAttribute("aria-valuenow"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuemax")):(l.setAttribute("aria-valuenow",String(o.state.valueNow)),l.setAttribute("aria-valuemin",String(o.state.valueMin??0)),l.setAttribute("aria-valuemax",String(o.state.valueMax??0))),l.id=`semantic-node-${o.handle}`,l.setAttribute("data-role",o.roleName),Pi(l,o.bounds),l instanceof HTMLInputElement)if(o.role===11)l.checked=o.state.checked==="true",l.indeterminate=o.state.checked==="mixed";else if(o.role===12)l.checked=o.state.checked==="true";else{let d=n[o.handle]??"";l.value!==d&&(l.value=d),l.readOnly=o.state.readonly??!0}else if(l instanceof HTMLTextAreaElement){let d=n[o.handle]??"";l.value!==d&&(l.value=d),l.readOnly=o.state.readonly??!0}else if(Di(o.role)){let d=ki(l),f=Ri(Ut(d));f.data!==c&&(f.data=c),Bi(d,o.bounds,r[o.handle])}else Hi(l),l.textContent!==""&&(l.textContent="")}for(let o of e){if(o.role!==9)continue;let s=this.elementsByHandle.get(o.handle);if(!(s instanceof HTMLElement))continue;let l=e.find(d=>d.handle!==o.handle&&d.role===4&&nr(o.bounds,d.bounds)),c=e.filter(d=>d.handle!==o.handle&&d.role===10&&nr(o.bounds,d.bounds));l!==void 0?s.setAttribute("aria-labelledby",`semantic-node-${l.handle}`):s.removeAttribute("aria-labelledby"),c.length>0?s.setAttribute("aria-describedby",c.map(d=>`semantic-node-${d.handle}`).join(" ")):s.removeAttribute("aria-describedby")}for(let[o,s]of this.elementsByHandle.entries())i.has(o)||(s.remove(),this.elementsByHandle.delete(o));Mi(this.content,a)}announceNode(e,n,r){let i=n.find(a=>a.handle===e);i!==void 0&&this.announcer.announce(Ki(i,r))}destroy(){this.announcer.destroy();for(let n of this.elementsByHandle.values())n.remove();this.elementsByHandle.clear(),this.layer.remove();let e=this.shell.parentElement;e!==null?e.replaceChild(this.canvas,this.shell):this.shell.remove()}};function pt(t){return t.map(e=>Wi(e))}var gt=class{constructor(e){this.options=e;this.api={getSemanticTree:()=>pt(this.options.semantic.getSemanticTree()),getBoundingBox:n=>this.options.semantic.getBoundingBox(n),getTextVisibleBounds:n=>{let r=this.options.textDocuments.readVisibleTextBounds(n);return r===null?null:{...r}},getTextDocument:n=>{let r=this.options.textDocuments.readTextDocumentSnapshot(n);return r===null?null:{...r.document}},getRangeRects:(n,r,i)=>this.options.textDocuments.readRangeRects(n,r,i).map(a=>({...a})),findText:(n,r)=>{let i=Ln(this.options.textDocuments.readFindDocuments(),n,r);return{query:i.query,options:{...i.options},matches:i.matches.map(a=>({...a}))}},setFindState:(n,r=!1)=>this.options.find.setFindState(n,r),getFindState:()=>this.options.find.getFindState(),setFindMatch:n=>this.options.find.activateFindMatch(n,!1),revealRange:(n,r,i)=>{let a=this.options.textDocuments.resolveTextRange(n,r,i);return a===null||this.options.ui._ui_reveal_text_range(a.handleArg,a.start,a.end)===0?!1:(this.options.commitFrame(),this.options.flushPendingCommit(),!0)}},window.__OPEN_CANVAS_API__=this.api}getApi(){return this.api}destroy(){delete window.__OPEN_CANVAS_API__}};var Gi=50,yt=class{constructor(e,n,r,i){this.ui=n;this.interactionState=r;this.textDocuments=i;this.semanticTree=[];this.semanticTextLayoutsByHandle={};this.semanticAnnouncementTimer=null;this.scheduledSemanticAnnouncementHandle=null;this.projector=new ft(e)}syncSize(e,n){this.projector.syncSize(e,n)}syncSemanticState(){this.semanticTree=rr(sn(this.ui));for(let n of this.semanticTree)n.roleName==="textbox"&&this.interactionState.textByHandle[n.handle]===void 0&&n.label.length!==0&&(this.interactionState.textByHandle[n.handle]=n.label);this.semanticTextLayoutsByHandle=this.buildSemanticTextLayouts(),this.projector.update(this.semanticTree,this.interactionState.textByHandle,this.semanticTextLayoutsByHandle);let e=this.interactionState.getFocusedHandle();for(let n of this.interactionState.consumePendingSemanticAnnouncements())e!==null&&e===n&&this.scheduleSemanticAnnouncement(n);window.__bridgeSemanticTree=pt(this.semanticTree)}getSemanticTree(){return this.semanticTree}getBoundingBox(e){let n=this.semanticTree.find(r=>r.handle===e);return n===void 0?null:{...n.bounds}}destroy(){this.cancelPendingSemanticAnnouncement(),this.semanticTree=[],this.semanticTextLayoutsByHandle={},window.__bridgeSemanticTree=[],this.projector.destroy()}cancelPendingSemanticAnnouncement(){this.semanticAnnouncementTimer!==null&&(window.clearTimeout(this.semanticAnnouncementTimer),this.semanticAnnouncementTimer=null),this.scheduledSemanticAnnouncementHandle=null}scheduleSemanticAnnouncement(e){this.scheduledSemanticAnnouncementHandle=e,this.semanticAnnouncementTimer!==null&&window.clearTimeout(this.semanticAnnouncementTimer),this.semanticAnnouncementTimer=window.setTimeout(()=>{this.semanticAnnouncementTimer=null;let n=this.scheduledSemanticAnnouncementHandle;this.scheduledSemanticAnnouncementHandle=null,!(n===null||this.interactionState.getFocusedHandle()!==n)&&this.projector.announceNode(n,this.semanticTree,this.interactionState.textByHandle)},Gi)}buildSemanticTextLayouts(){let e=Object.create(null);for(let n of this.semanticTree){if(n.label.length===0)continue;let r=this.textDocuments.readVisibleTextBounds(n.handle);if(r===null)continue;let i=Math.max(n.bounds.x,r.x),a=Math.max(n.bounds.y,r.y),o=Math.min(n.bounds.x+n.bounds.width,r.x+r.width),s=Math.min(n.bounds.y+n.bounds.height,r.y+r.height);o<=i||s<=a||(e[n.handle]={bounds:{x:i,y:a,width:o-i,height:s-a}})}return e}};var zi=4294967295,qi=new TextDecoder,bt=class{constructor(e){this.ui=e}readTextDocumentMeta(e){let n=this.toUiHandleArgument(e);if(n===null)return null;let r=this.ui._ui_get_text_document_utf8_length(n);return r<0||r>>>0===zi?null:{handleArg:n,byteLength:r}}resolveTextRange(e,n,r){let i=this.readTextDocumentMeta(e),a=this.normalizeByteRange(n,r);return i===null||a===null||a.end>i.byteLength?null:{handleArg:i.handleArg,byteLength:i.byteLength,start:a.start,end:a.end}}readTextDocumentSnapshot(e){let n=this.readTextDocumentMeta(e);if(n===null)return null;if(n.byteLength===0)return{document:{handle:e,text:""},byteLength:0};let r=Le(this.ui,this.ui._malloc(n.byteLength)),i=r.ptr,a=r.offset;if(a===0)throw new Error("ui text document malloc failed.");try{let o=this.ui._ui_copy_text_document_utf8(n.handleArg,i,n.byteLength);if(this.ui.refreshHeapViews?.(),o===0)return null;let s=qi.decode(this.ui.HEAPU8.slice(a,a+n.byteLength));return{document:{handle:e,text:s},byteLength:n.byteLength}}finally{this.ui._free(i)}}readVisibleTextBounds(e){let n=this.toUiHandleArgument(e);if(n===null)return null;let r=Le(this.ui,this.ui._malloc(16));if(r.offset===0)throw new Error("ui visible text bounds malloc failed.");let i=r.ptr,a=this.addPointerOffset(r.ptr,4),o=this.addPointerOffset(r.ptr,8),s=this.addPointerOffset(r.ptr,12);try{let l=this.ui._ui_get_text_visible_bounds(n,i,a,o,s);if(this.ui.refreshHeapViews?.(),l===0)return null;let c=r.offset>>>2;return{x:this.ui.HEAPF32[c]??0,y:this.ui.HEAPF32[c+1]??0,width:this.ui.HEAPF32[c+2]??0,height:this.ui.HEAPF32[c+3]??0}}finally{this.ui._free(r.ptr)}}readRangeRects(e,n,r){let i=this.resolveTextRange(e,n,r);if(i===null)return[];let a=this.ui._ui_get_text_range_rect_count(i.handleArg,i.start,i.end);if(a===0)return[];let o=Le(this.ui,this.ui._malloc(a*16)),s=o.ptr,l=o.offset;if(l===0)throw new Error("ui range rect malloc failed.");try{let c=this.ui._ui_copy_text_range_rects(i.handleArg,i.start,i.end,s,a);if(this.ui.refreshHeapViews?.(),c===0)return[];let d=this.ui.HEAPF32.slice(l>>>2,(l>>>2)+c*4),f=[];for(let y=0;y<c;y+=1){let u=y*4;f.push({x:d[u]??0,y:d[u+1]??0,width:d[u+2]??0,height:d[u+3]??0})}return f}finally{this.ui._free(s)}}readFindDocuments(){let e=[];for(let n of this.readTextSnapshotHandles()){let r=this.readTextDocumentSnapshot(n);r!==null&&e.push(r.document)}return e}readTextSnapshotHandles(){let e=this.ui._ui_get_text_snapshot_handle_count();if(e===0)return[];let n=Le(this.ui,this.ui._malloc(e*8)),r=n.ptr,i=n.offset;if(i===0)throw new Error("ui text snapshot handle malloc failed.");try{let a=this.ui._ui_copy_text_snapshot_handles(r,e);if(this.ui.refreshHeapViews?.(),a===0)return[];let o=this.ui.HEAPU32.slice(i>>>2,(i>>>2)+a*2),s=[];for(let l=0;l<a;l+=1){let c=o[l*2]??0,d=o[l*2+1]??0;s.push((BigInt(d)<<32n|BigInt(c)).toString())}return s}finally{this.ui._free(r)}}toUiHandleArgument(e){try{return z(e)}catch{return null}}normalizeByteRange(e,n){return!Number.isInteger(e)||!Number.isInteger(n)||e<0||n<0?null:{start:Math.min(e,n),end:Math.max(e,n)}}addPointerOffset(e,n){return typeof e=="bigint"?e+BigInt(n):e+n}};var $i=320,Vi=220,ir=4,zt=5;function or(t,e,n,r,i){let a=$i,o=Vi,s=!1,l=null,c=null,d,f=new ct(t,e,r.logs,()=>d.commitFrame()),y=new dt(t,f,()=>d.commitFrame()),u=new bt(e),F=new yt(n,e,r,u),h=new mt({canvas:n,ui:e,textDocuments:u,commitFrame:()=>d.commitFrame(),flushPendingCommit:()=>d.flushPendingCommit()}),g=new gt({ui:e,semantic:F,find:h,textDocuments:u,commitFrame:()=>d.commitFrame(),flushPendingCommit:()=>d.flushPendingCommit()}),w=()=>{F.syncSemanticState(),h.syncDocuments()},S=(p,T,E,N,B=0)=>{T!==0n&&window.__effindomCallbacks?.onPointerEventWithCoords?.(p,T,E,N,B)},b=()=>{let{x:p,y:T}=r.getLastPointerClientPosition();if(p===null||T===null)return!1;let E=n.getBoundingClientRect();return p>=E.left&&p<=E.right&&T>=E.top&&T<=E.bottom},x=()=>{let{x:p,y:T}=r.getLastPointerPosition(),E=r.getLastInteractivePointerHandle(),N=r.getCapturedPointerHandle();if(N!==null){if(E===N)return;E!==null&&S(zt,E,p,T),r.setLastInteractivePointerHandle(N),S(ir,N,p,T);return}if(!(r.isPointerInsideCanvas()||b())){E!==null&&(r.setLastInteractivePointerHandle(null),S(zt,E,p,T));return}let q=z(t._ed_hit_test(p,T)),P=q===0n?null:q;P!==E&&(E!==null&&S(zt,E,p,T),r.setLastInteractivePointerHandle(P),P!==null&&S(ir,P,p,T))},v=()=>{let p=Math.max(1,window.devicePixelRatio||1),T=qe(n);a=T.width,o=T.height;let E=Math.round(a*p),N=Math.round(o*p);n.style.width=`${String(a)}px`,n.style.height=`${String(o)}px`,(E!==n.width||N!==n.height)&&(n.width=E,n.height=N),F.syncSize(a,o),h.syncSize(a,o),t._ed_resize(E,N,p),e._ui_resize_window(a,o),w(),de(i,ae(t._ed_get_backend_type()))};d={core:t,ui:e,canvas:n,openCanvasApi:g.getApi(),logs:r.logs,updateCanvasSize:v,extractCommandBuffer:()=>Ct(e),executeCommandBuffer:p=>{At(t,p)},syncCommandBufferToCore:()=>{let p=Ct(e);return At(t,p),w(),x(),p},flushPendingCommit:()=>!s&&!r.hasPendingTextMutations()||(r.hasPendingTextMutations()&&(s&&(s=!1,d.syncCommandBufferToCore()),r.materializePendingTextMutations()&&(e._ui_commit_frame(),s=!0)),!s)?null:(s=!1,d.syncCommandBufferToCore()),hasPendingCommit:()=>s||r.hasPendingTextMutations(),commitFrame:()=>{if(r.hasPendingTextMutations()&&(s&&d.flushPendingCommit(),r.materializePendingTextMutations())){e._ui_commit_frame(),s=!0,c?.();return}s&&d.flushPendingCommit(),e._ui_commit_frame(),s=!0,c?.()},requestFrame:()=>{c?.()},setFrameRequester:p=>{c=p},getSemanticTree:()=>F.getSemanticTree(),getActiveTextHandle:()=>r.getActiveTextHandle(),getCapturedPointerHandle:()=>r.getCapturedPointerHandle(),setCapturedPointerHandle:p=>{r.setCapturedPointerHandle(p)},setAppFrameHandler:p=>{l=p,c?.()},runAppFrameHandler:p=>{l?.(p)},uiHasPendingVisualWork:()=>e._ui_has_pending_visual_work()!==0,uiNeedsAnimationFrame:()=>e._ui_needs_animation_frame()!==0,getHandleFromPoint:(p,T)=>z(t._ed_hit_test(p,T)),clearPointerHover:()=>{r.setLastInteractivePointerHandle(null)},refreshPointerHover:()=>{x()},getFindDocuments:()=>h.getFindDocuments(),activateFindMatch:(p,T=!0)=>h.activateFindMatch(p,T),syncFindSelection:(p=!1)=>h.syncFindSelection(p),clearFindMatch:()=>h.clearFindMatch(),ensureFont:async p=>{await f.ensureFont(p)},ensureBuiltInFont:async p=>{await f.ensureBuiltInFont(p)},isFontLoaded:(p,T)=>f.isFontLoaded(p,T),getIncrementalFontState:p=>f.getIncrementalFontState(p),getIncrementalFontCacheState:()=>f.getIncrementalFontCacheState(),getIncrementalFontPolicy:()=>f.getIncrementalFontPolicy(),setIncrementalFontPolicy:p=>{f.setIncrementalFontPolicy(p)},getClipboardFontUrl:p=>f.getClipboardFontUrl(p),registerLazyFont:(p,T)=>{f.registerLazyFont(p,T)},registerFontFallback:(p,T)=>{f.registerFontFallback(p,T)},handleMissingFontCoverage:(p,T,E)=>{f.handleMissingFontCoverage(p,T,E)},loadFont:async(p,T)=>{await f.loadFont(p,T)},registerFont:async p=>{await f.registerFont(p)},registerFontStack:async p=>{await f.registerFontStack(p)},loadSvg:async(p,T)=>await y.loadSvg(p,T),loadTexture:async(p,T)=>await y.loadTexture(p,T),releaseSvg:p=>{y.releaseSvg(p)},releaseTexture:p=>{y.releaseTexture(p)},replayLoadedAssets:async()=>{await y.replayLoadedAssets()},resetLogs:()=>{pn(r.logs)},resetAppSession:()=>{r.resetAppSession()}};let C=()=>{d.updateCanvasSize(),d.commitFrame()},H=We(n),M=typeof ResizeObserver<"u"?new ResizeObserver(()=>{C()}):null;return M!==null&&M.observe(H),{runtime:d,destroy:()=>{M?.disconnect(),d.setFrameRequester(null),d.clearPointerHover(),g.destroy(),h.destroy(),F.destroy(),n.style.cursor="default"}}}var ar=[500,1e3,2e3,4e3];function Xi(t,e){if(t!==null)return t;let n=document.createElement("canvas");n.dataset.effindomSoftwareOverlay="true",n.setAttribute("aria-hidden","true"),n.style.position="absolute",n.style.pointerEvents="none",n.style.display="none",n.style.zIndex="1";let r=e.parentElement;r!==null?(getComputedStyle(r).position==="static"&&(r.style.position="relative"),r.appendChild(n)):document.body.appendChild(n);let i=n.getContext("2d");if(i===null)throw new Error("Canvas 2D context is unavailable for software rendering.");return{canvas:n,ctx:i,imageData:null,width:0,height:0}}function Yi(t,e,n){let r=ie(t,t._ed_get_sw_framebuffer()),i=ne(r);if(i===0)return;n.canvas.style.left=`${String(e.offsetLeft)}px`,n.canvas.style.top=`${String(e.offsetTop)}px`,n.canvas.style.width=e.style.width||`${String(e.clientWidth)}px`,n.canvas.style.height=e.style.height||`${String(e.clientHeight)}px`,n.canvas.style.borderRadius=getComputedStyle(e).borderRadius,n.canvas.style.display="",(n.imageData===null||n.width!==e.width||n.height!==e.height)&&(n.canvas.width=e.width,n.canvas.height=e.height,n.imageData=n.ctx.createImageData(e.width,e.height),n.width=e.width,n.height=e.height);let a=e.width*e.height*4,o=t.HEAPU8.subarray(i,i+a);n.imageData.data.set(o),n.ctx.putImageData(n.imageData,0,0)}function sr(t,e,n=Oe){let{core:r,canvas:i}=t,a=ae(r._ed_get_backend_type()),o=null,s=!1,l=!1,c=a,d=0,f=!1,y=null;async function u(){let b=Math.max(1,window.devicePixelRatio||1);for(;d<ar.length;){let v=ar[d];if(await fn(v),await St(r,i,b,c)){d=0,f=!1,a=c,e.deviceRecoveryCount+=1,de(e,c),await t.replayLoadedAssets(),console.info(`RENDERER RECOVERY: ${Fe(c)} recovered successfully.`),t.commitFrame();return}d+=1}f=!0;let x=n.indexOf(c)+1;for(let v=x;v<n.length;v+=1){let C=n[v];if(await St(r,i,b,C)){a=C,e.deviceRecoveryCount+=1,de(e,C),await t.replayLoadedAssets(),C===k.CPU?console.error(`RENDERER FALLBACK: ${Fe(c)} device lost and recovery failed! Fell back to Software/Raster - performance will be painfully slow`):console.warn(`RENDERER FALLBACK: ${Fe(c)} device lost and recovery failed! Fell back to ${Fe(C)}`),t.commitFrame();return}}throw new Error(`Renderer recovery failed: all backends exhausted after ${Fe(c)} device loss.`)}function F(b){y===null&&(c=b,d=0,f=!1,de(e,k.NONE),y=u().catch(x=>{let v=x instanceof Error?x.message:String(x);window.__bridgeError=v}).finally(()=>{y=null}))}let h=()=>{l||s||(s=!0,requestAnimationFrame(S))};t.setFrameRequester(h);let g=b=>{b.preventDefault(),r._ed_notify_webgl_context_lost?.(),F(a),h()};i.addEventListener("webglcontextlost",g,!1);let w=()=>{l||document.visibilityState==="visible"&&f&&y===null&&(console.info(`RENDERER RECOVERY: Page visible \u2014 attempting to revive ${Fe(c)} after sleep/wake.`),d=0,y=u().catch(b=>{let x=b instanceof Error?b.message:String(b);window.__bridgeError=x}).finally(()=>{y=null}))};document.addEventListener("visibilitychange",w);let S=b=>{if(l){s=!1;return}if(s=!1,y!==null){h();return}r.refreshHeapViews?.(),t.ui.refreshHeapViews?.(),t.runAppFrameHandler(b),!t.hasPendingCommit()&&t.uiNeedsAnimationFrame()&&t.uiHasPendingVisualWork()&&t.commitFrame(),t.flushPendingCommit(),r._ed_render_frame(b),r.refreshHeapViews?.();let x=et(r._ed_get_device_state()),v=ae(r._ed_get_backend_type());if(x===ce.LOST){F(a),h();return}a=v,de(e,v),v===k.CPU?(o=Xi(o,i),Yi(r,i,o)):o!==null&&(o.canvas.style.display="none"),(t.hasPendingCommit()||t.uiNeedsAnimationFrame())&&h()};return h(),()=>{l=!0,s=!1,t.setFrameRequester(null),i.removeEventListener("webglcontextlost",g,!1),document.removeEventListener("visibilitychange",w),o!==null&&(o.canvas.remove(),o=null)}}function ji(t){let e=document.getElementById(t);if(!(e instanceof HTMLCanvasElement))throw new Error(`Expected #${t} canvas.`);return e}async function lr(t){let e=ji("fui-canvas");Ht(e);let{interactionState:n,preparedAssets:r,runtimeRef:i}=t;window.__bridgeLoaderInfo=r.loaderInfo;let[a,o]=await Promise.all([_n(r.coreBundle,r.coreWasm,e,r.loaderInfo),xn(r.uiBundle,r.uiWasm,r.loaderInfo)]),s=or(a,o,e,n,r.loaderInfo),l=s.runtime;i.current=l;let c=Math.max(1,window.devicePixelRatio||1),d=vn(r.loaderInfo.requestedRendererBackend);await nn(a,e,c,r.loaderInfo,d),o._ui_reset();try{await yn(o,r)}catch(u){let F=u instanceof Error?u.message:"Failed to load text engine.";throw hn(F),nt(F,u)}l.updateCanvasSize();let f=Dn(l,n),y=sr(l,r.loaderInfo,d);return await Promise.all(Kn.map(u=>l.registerFont({id:u.id,url:Ne(u.assetFile),fallbackIds:u.fallbackIds}))),delete window.__bridgeError,{runtime:l,destroy:()=>{f(),y(),s.destroy(),i.current===l&&(i.current=null)}}}var dr="web application/x-effindom-richtext+json";function Ji(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function cr(t){let e=t>>>24&255,n=t>>>16&255,r=t>>>8&255,i=t&255;return i>=255?`rgb(${String(e)} ${String(n)} ${String(r)})`:`rgb(${String(e)} ${String(n)} ${String(r)} / ${(i/255).toFixed(3)})`}function Qi(t){return t===void 0?null:/mono/i.test(t)?"monospace":null}function Zi(t){let e=[];t.color!==void 0&&e.push(`color: ${cr(t.color)};`),t.bgColor!==void 0&&t.bgColor!==0&&e.push(`background-color: ${cr(t.bgColor)};`),t.fontSize!==void 0&&e.push(`font-size: ${String(t.fontSize)}px;`);let n=Qi(t.fontUrl);n!==null&&e.push(`font-family: ${n};`);let r=t.decorationFlags??0,i=[];return(r&1)!==0&&i.push("underline"),(r&2)!==0&&i.push("line-through"),i.length>0&&e.push(`text-decoration: ${i.join(" ")};`),e.join(" ")}function eo(t){let e='<div data-effindom-richtext="1" style="white-space: pre-wrap;">';for(let n of t.parts){let r=Ji(n.text),i=Zi(n);if(i.length>0){e+=`<span style="${i}">${r}</span>`;continue}e+=r}return e+="</div>",e}function mr(t,e){let n=t.richText;return n===void 0?t:{plainText:t.plainText,richText:{version:n.version,parts:n.parts.map(r=>{if(r.fontId===void 0||r.fontUrl!==void 0)return r;let i=e(r.fontId);return i===null?r:{...r,fontUrl:i}})}}}async function ur(t){if(navigator.clipboard===void 0||navigator.clipboard.write===void 0||typeof ClipboardItem>"u")return!1;try{return await navigator.clipboard.write([new ClipboardItem(t)]),!0}catch{return!1}}async function hr(t){let e=t.plainText,n=t.richText,r=n===void 0?null:eo(n);if(n!==void 0&&r!==null){let i=JSON.stringify(n);if(await ur({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([r],{type:"text/html"}),[dr]:new Blob([i],{type:dr})})||await ur({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([r],{type:"text/html"})}))return}navigator.clipboard!==void 0&&navigator.clipboard.writeText!==void 0&&await navigator.clipboard.writeText(e)}function qt(t){return t<=127?1:t<=2047?2:t<=65535?3:4}function De(t,e){let n=t.codePointAt(e)??0;return e+(n>65535?2:1)}function fr(t,e){let n=Math.max(0,Math.min(e,t.length));if(n<=0)return 0;let r=n-1,i=t.charCodeAt(r);if(r>0&&i>=56320&&i<=57343){let a=t.charCodeAt(r-1);if(a>=55296&&a<=56319)return r-1}return r}function $(t,e){let n=Math.max(0,Math.min(e,t.length)),r=0;for(let i=0;i<n;i=De(t,i)){let a=t.codePointAt(i)??0;r+=qt(a)}return r}function j(t){return $(t,t.length)}var $t=2048,to=4096,no=512,pr=256,gr=1e4;function ro(t,e){if(e<0||e>=t.length)return!1;let n=t.charCodeAt(e);return n===10||n===13}function io(t){let e=[],n=0;for(;n<t.length;){let r=n,i=n,a=0;for(;i<t.length&&!ro(t,i);){let o=De(t,i);a<gr&&(r=o),a+=1,i=o}if(a>gr&&e.push({start:r,end:i}),i>=t.length)break;t.charCodeAt(i)===13&&i+1<t.length&&t.charCodeAt(i+1)===10?n=i+2:n=i+1}return e}function oo(t,e){let n=Math.max(0,t),r=0;for(let i of e){if(n<=i.start)break;if(n<i.end)return i.start-r;r+=i.end-i.start}return n-r}function ao(t){let e=io(t);if(e.length===0)return{text:t,changed:!1,mapIndex:i=>Math.max(0,Math.min(i,t.length))};let n="",r=0;for(let i of e)n+=t.slice(r,i.start),r=i.end;return n+=t.slice(r),{text:n,changed:!0,mapIndex:i=>oo(i,e)}}function ve(t,e,n){let r=n??j(t),i=Math.max(0,Math.min(e,r)),a=0,o=0;for(;o<t.length;){let s=t.codePointAt(o)??0,l=a+qt(s);if(l>i||(a=l,o=De(t,o),a===i))break}return o}function Ue(t,e){if(t===e)return null;let n=Math.min(t.length,e.length),r=0;for(;r<n&&t.charCodeAt(r)===e.charCodeAt(r);)r+=1;let i=0;for(;i<t.length-r&&i<e.length-r&&t.charCodeAt(t.length-i-1)===e.charCodeAt(e.length-i-1);)i+=1;return{start:r,end:t.length-i,insertedText:e.slice(r,e.length-i)}}function _t(t,e,n,r){let i=ve(t,Math.max(0,e)),a=ve(t,Math.max(i,n));return`${t.slice(0,i)}${r}${t.slice(a)}`}function Vt(t,e){let n=Math.max(0,Math.min(e,t.currentWindowText.length)),r=Ue(t.baseWindowText,t.currentWindowText);if(r===null)return Math.max(0,Math.min(n,t.baseWindowText.length));let i=r.start,a=r.start+r.insertedText.length;if(n<=i)return n;if(n<=a)return r.start;let o=r.insertedText.length-(r.end-r.start);return Math.max(0,Math.min(n-o,t.baseWindowText.length))}function xt(t,e,n,r,i){let a=ve(t,e),o=ve(t,n),s=`${t.slice(0,a)}${r}${t.slice(o)}`,l=ve(s,i),c=ao(s),d=c.mapIndex(l);return{fullNextText:c.text,replacement:Ue(t,c.text),caretByte:$(c.text,d),clampChanged:c.changed}}function Xt(t,e){return e.length<=pr?{handle:t,text:e}:{handle:t,text:`${e.slice(0,pr)}\u2026`,textLength:e.length,truncated:!0}}function yr(t,e,n,r,i){let a=Math.max(0,Math.min(e,t.length)),o=Math.max(a,Math.min(n,t.length)),s=o-a,l=Math.max(to,s+$t*2);if(t.length<=l)return{text:t,docStart:0,docEnd:r,textStart:0,textEnd:t.length};if(i!==void 0){let y=i.textEnd-i.textStart,u=Math.max(0,Math.min(i.textStart,t.length)),F=Math.max(u,Math.min(i.textEnd,t.length));if(y>0&&F>u&&F-u>=l){let h=Math.min(no,Math.max(0,Math.floor((F-u)/4))),g=u+h,w=F-h;if(a>=g&&o<=w)return{text:t.slice(u,F),docStart:i.docStart,docEnd:i.docEnd,textStart:u,textEnd:F}}}let c=Math.max(0,a-$t),d=Math.min(t.length,o+$t),f=d-c;if(f<l){let y=l-f,u=Math.min(c,Math.floor(y/2));c-=u,y-=u;let F=Math.min(t.length-d,y);if(d+=F,y-=F,y>0){let h=Math.min(c,y);c-=h,y-=h,y>0&&(d=Math.min(t.length,d+y))}}return{text:t.slice(c,d),docStart:$(t,c),docEnd:$(t,d),textStart:c,textEnd:d}}function Yt(t){let e=t?document.createElement("textarea"):document.createElement("input");return e instanceof HTMLInputElement?e.type="text":(e.rows=1,e.wrap="off",e.style.resize="none",e.style.whiteSpace="pre"),e.autocapitalize="off",e.autocomplete="off",e.autocorrect=!1,e.spellcheck=!1,e.tabIndex=-1,e.dataset.effindomHiddenEditor="true",e.setAttribute("aria-hidden","true"),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.width="1px",e.style.height="1px",e.style.opacity="0",e.style.pointerEvents="none",e.style.font='16px "Noto Sans Symbols 2", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", monospace',e.style.overflow="hidden",document.body.appendChild(e),e}function jt(t){t.value.length!==0&&(t.value=""),t.setSelectionRange(0,0,"none")}var so=5;function Jt(){return BigInt(Math.floor(performance.now()))}function br(t){let e=!1,n=null,r=null,i=null,a="",o=()=>{n!==null&&(cancelAnimationFrame(n),n=null),r=null,i=null,a=""},s=()=>{let h=t.runtimeRef.current,g=r;if(h===null||g===null)return!1;r=null;let w=z(g.handle),S=g.docStart+$(g.currentWindowText,g.caret);h.ui._ui_set_interaction_time(g.interactionTime);let b=Ue(g.baseWindowText,g.currentWindowText);if(b===null)return t.setPendingLocalSelectionEcho({handle:g.handle,start:S,end:S}),h.ui._ui_set_text_selection_range(w,S,S),!0;let x=g.docStart+$(g.baseWindowText,b.start),v=g.docStart+$(g.baseWindowText,b.end);t.setPendingLocalReplacementEcho({handle:g.handle,start:x,end:v,text:b.insertedText}),t.setPendingLocalSelectionEcho({handle:g.handle,start:S,end:S});let C=Ce(h.ui,b.insertedText);try{h.ui._ui_replace_text_range(w,x,v,C.ptr,C.len,S)}finally{C.dispose()}return!0},l=h=>{let g=r,w=t.getActiveTextHandle(),S=t.getActiveEditorWindow();return g===null||g.kind!=="typing"||g.mutationCount<so||w===null||g.handle!==w.toString()||g.docStart!==S.docStart?!1:(h.value=g.currentWindowText,h.setSelectionRange(g.caret,g.caret,"none"),!0)},c=()=>{let h=t.runtimeRef.current;h===null||r===null||s()&&h.commitFrame()},d=()=>{n===null&&(n=requestAnimationFrame(()=>{n=null,t.runtimeRef.current?.flushPendingCommit()}))},f=(h,g,w,S,b="typing",x=!1)=>{let v=t.runtimeRef.current,C=t.getActiveTextHandle(),H=t.getActiveEditorWindow();if(v===null||C===null)return;let M=Math.max(0,Math.min(w.start,h.length)),p=Math.max(M,Math.min(w.end,h.length)),T=C.toString();r===null&&v.hasPendingCommit()&&v.flushPendingCommit();let E=H.docStart+$(h,M),N=H.docStart+$(h,p),B=H.docStart+$(g,Math.max(0,Math.min(S,g.length))),q=t.textByHandle[T]??"";if(x&&r!==null&&r.handle===T&&r.docStart===H.docStart){let ee=Ue(r.baseWindowText,r.currentWindowText);if(ee!==null){let m=r.docStart+$(r.baseWindowText,ee.start),L=m+j(ee.insertedText);q=_t(q,m,L,r.baseWindowText.slice(ee.start,ee.end))}}let P=xt(q,E,N,w.insertedText,B);if(P.clampChanged?(r!==null&&s()&&v.commitFrame(),v.hasPendingCommit()&&v.flushPendingCommit(),o(),t.textByHandle[T]=P.fullNextText,t.textByteLengthsByHandle[T]=j(P.fullNextText),t.selectionsByHandle[T]={start:P.caretByte,end:P.caretByte},t.syncFocusedInputState()):(t.textByHandle[T]=P.fullNextText,t.textByteLengthsByHandle[T]=j(P.fullNextText),t.selectionsByHandle[T]={start:P.caretByte,end:P.caretByte},t.updateActiveEditorWindowText(g)),P.replacement===null)return;if(P.clampChanged){let ee=$(q,P.replacement.start),m=$(q,P.replacement.end);t.setPendingLocalReplacementEcho({handle:T,start:ee,end:m,text:P.replacement.insertedText}),t.setPendingLocalSelectionEcho({handle:T,start:P.caretByte,end:P.caretByte}),v.ui._ui_set_interaction_time(Jt());let L=Ce(v.ui,P.replacement.insertedText);try{v.ui._ui_replace_text_range(C,ee,m,L.ptr,L.len,P.caretByte)}finally{L.dispose()}v.commitFrame();return}r!==null&&(r.handle!==T||r.docStart!==H.docStart||!x&&r.kind!==b)&&(s()&&v.commitFrame(),v.flushPendingCommit());let D=t.getActiveEditor();r=r===null||x?{handle:T,docStart:H.docStart,baseWindowText:h,currentWindowText:D.value,caret:D.selectionStart??D.value.length,interactionTime:Jt(),kind:b,mutationCount:1}:{...r,currentWindowText:D.value,caret:D.selectionStart??D.value.length,interactionTime:Jt(),mutationCount:b==="paste"?1:r.mutationCount+1},d(),v.requestFrame()},y=(h,g,w="typing",S=!1)=>{let b=t.getActiveEditorWindow().text,x=Ue(b,h);if(x===null){let v=t.runtimeRef.current;v!==null&&$e(v);return}f(b,h,x,g,w,S)};return{applyActiveTextDeletion:h=>{if(t.getActiveTextHandle()===null||!t.getActiveTextEditable()||e||!t.isActiveEditorFocused())return!1;let g=t.getActiveEditor(),w=g.value,S=g.selectionStart??w.length,b=g.selectionEnd??S,x=Math.min(S,b),v=Math.max(S,b),C=w,H=x,M=x,p=v;if(x!==v)C=w.slice(0,x)+w.slice(v);else if(h){if(x>=w.length)return!0;p=De(w,x),C=w.slice(0,x)+w.slice(p)}else{if(x===0)return!0;M=fr(w,x),H=M,C=w.slice(0,H)+w.slice(x)}return g.value=C,g.setSelectionRange(H,H,"none"),f(w,C,{start:M,end:p,insertedText:""},H),!0},attachHiddenEditorListeners:h=>{h.addEventListener("paste",g=>{a=g.clipboardData?.getData("text/plain")??""}),h.addEventListener("beforeinput",g=>{let w=t.getActiveTextHandle(),S=t.getActiveEditorWindow();if(!(g instanceof InputEvent)||g.inputType!=="insertFromPaste"||w===null)return;let b=w.toString();r!==null&&r.handle===b&&r.docStart===S.docStart&&r.kind!=="paste"&&c();let x=h.selectionStart??h.value.length,v=h.selectionEnd??x;i={handle:b,docStart:S.docStart,selectionStart:x,selectionEnd:v,text:typeof g.data=="string"?g.data:a},a=""}),h.addEventListener("compositionstart",()=>{e=!0}),h.addEventListener("input",g=>{let w=t.getActiveTextHandle(),S=t.getActiveEditorWindow();if(!e&&!(g instanceof InputEvent&&g.inputType==="insertText"&&l(h))){if(g instanceof InputEvent&&g.inputType==="insertFromPaste"){let b=i;if(i=null,a="",b!==null&&w!==null&&w.toString()===b.handle&&S.docStart===b.docStart){let x=r!==null&&r.handle===b.handle&&r.docStart===b.docStart&&r.kind==="paste"?r:null,v=x?.baseWindowText??S.text,C=b.selectionStart,H=b.selectionEnd;x!==null&&(C=Vt(x,C),H=Vt(x,H));let M=Math.min(C,H),p=Math.max(C,H),T=`${v.slice(0,M)}${b.text}${v.slice(p)}`,E=M+b.text.length;h.value!==T&&(h.value=T),h.setSelectionRange(E,E,"none"),f(v,T,{start:M,end:p,insertedText:b.text},E,"paste",x!==null);return}}i=null,a="",y(h.value,h.selectionStart??h.value.length,"typing")}}),h.addEventListener("compositionend",()=>{e=!1,i=null,a="",y(h.value,h.selectionStart??h.value.length,"typing")})},clearPendingTextMutations:o,flushPendingTextMutationsToRuntime:c,hasPendingTextMutations:()=>r!==null,materializePendingTextMutations:s,reset:()=>{e=!1,o()}}}var lo=500;function co(){return BigInt(Math.floor(performance.now()))}function _r(t,e){let n=Object.create(null),r=Object.create(null),i=Yt(!1),a=Yt(!0),o=null,s=null,l=null,c=0,d=0,f=0,y=null,u=null,F=!1,h=0,g=!1,w=!1,S={text:"",docStart:0,docEnd:0,textStart:0,textEnd:0},b=Object.create(null),x=Object.create(null),v=null,C=null,H=null,M=null,p=null,T=null,E=new Set;window.__bridgeLogs=e,window.__bridgeTextByHandle=n,window.__bridgeSelectionsByHandle=r,window.__bridgeActiveEditorWindow={handle:null,...S};let N=()=>w?a:i,B=()=>document.activeElement===N(),q=_=>{E.add(_),t.current?.requestFrame()},P=(_,A)=>({start:Math.max(0,Math.min(A.start,_)),end:Math.max(0,Math.min(A.end,_))}),D=()=>{p!==null&&(clearTimeout(p),p=null)},ee=()=>{if(o===null||!B())return!1;let _=o.toString(),A=n[_]??"",I=b[_]??j(A),W=r[_]??{start:I,end:I},{start:U,end:G}=P(I,W);return U===G},m=()=>{p===null&&(p=setTimeout(()=>{p=null,ee()&&(t.current?.requestFrame(),m())},lo))},L=(_=!1)=>{if(!ee()){D();return}_&&D(),m()},R=_=>{window.__bridgeActiveEditorWindow={handle:_,text:S.text,docStart:S.docStart,docEnd:S.docEnd}},V=()=>{S={text:"",docStart:0,docEnd:0,textStart:0,textEnd:0},R(null)},te=()=>{v!==null&&(cancelAnimationFrame(v),v=null);for(let _ of Object.keys(x))delete x[_]},O=_=>{S={text:_,docStart:S.docStart,docEnd:S.docStart+j(_),textStart:S.textStart,textEnd:S.textStart+_.length},R(o?.toString()??null)},Q=()=>{i.blur(),a.blur()},Ee=_=>{let A=t.current;if(A===null)return{isTextbox:!1,isEditable:!1,isMultiline:!1};let I=A.getSemanticTree().find(W=>W.handle===_);return I?.roleName!=="textbox"?{isTextbox:!1,isEditable:!1,isMultiline:!1}:{isTextbox:!0,isEditable:I.state.readonly!==!0,isMultiline:I.state.multiline===!0}},X=()=>{if(o===null){D(),V(),Q(),jt(i),jt(a);return}let _=N(),A=o.toString(),I=n[A]??"",W=b[A]??j(I);b[A]=W;let U=r[A]??{start:W,end:W},{start:G,end:se}=P(W,U),oe=ve(I,G,W),le=ve(I,se,W),Ge=oe===le?"none":G<se?"forward":"backward",Je=Math.min(oe,le),Z=Math.max(oe,le);S=yr(I,Je,Z,W,S),R(A);let Qe=Je-S.textStart,Ze=Z-S.textStart;_.value!==S.text&&(_.value=S.text),_.readOnly=!g,_.setSelectionRange(Qe,Ze,Ge),L()},re=br({runtimeRef:t,textByHandle:n,selectionsByHandle:r,textByteLengthsByHandle:b,getActiveEditor:N,getActiveEditorWindow:()=>S,getActiveTextEditable:()=>g,getActiveTextHandle:()=>o,isActiveEditorFocused:B,setPendingLocalReplacementEcho:_=>{C=_},setPendingLocalSelectionEcho:_=>{H=_},syncFocusedInputState:X,updateActiveEditorWindowText:O}),Te=()=>{re.clearPendingTextMutations()},K=()=>{N().focus({preventScroll:!0}),X(),L(!0)},Se=()=>{if(o===null){if(M===null)return;let _=Ee(M);if(!_.isTextbox)return;o=z(M),g=_.isEditable,w=_.isMultiline,X(),K();return}K()},ye=_=>{M=_.toString()},Ke=()=>{M=null},be=_=>{let A=_.toString();M===A&&(M=null,o?.toString()===A&&(B()||K()))},J=_=>{!x[_]||o?.toString()!==_||v===null&&(v=requestAnimationFrame(()=>{if(v=null,!x[_]||o?.toString()!==_)return;delete x[_];let A=t.current;if(A===null)return;let I=n[_]??"",W=j(I),U=r[_]??{start:W,end:W},{start:G,end:se}=P(W,U);A.ui._ui_set_text_selection_range(z(_),G,se)}))},Be=_=>{for(let A of Object.keys(_))delete _[A]},Ye=()=>{h+=1,Be(n),Be(b),Be(r),te(),re.reset(),C=null,H=null,M=null,D(),o=null,g=!1,w=!1,V(),T=null,E.clear(),y=null,u=null,i.value="",i.setSelectionRange(0,0,"none"),a.value="",a.setSelectionRange(0,0,"none"),Q()};re.attachHiddenEditorListeners(i),re.attachHiddenEditorListeners(a);let vt=(_,A)=>{let I=_.toString(),W={handle:I,isFocused:A};if(e.focusEvents.push(W),A?T=I:T===I&&(T=null),A){let U=Ee(I);if(!U.isTextbox){M=null,delete x[I],o=null,g=!1,w=!1,X(),L(),q(I);return}if(o=z(_),g=U.isEditable,w=U.isMultiline,X(),M===I){L(),q(I);return}window.setTimeout(()=>{o!==null&&o.toString()===I&&K()},0)}else if(o!==null&&o.toString()===I){if(M===I){L();return}M=null,t.current?.flushPendingCommit(),delete x[I],C=null,H=null,Te(),o=null,g=!1,w=!1,X()}L(),A&&q(I)},Et=(_,A)=>{let I=_.toString();if(C!==null&&C.handle===I&&(C=null),n[I]=A,b[I]=j(A),e.textChanges.push(Xt(I,A)),o!==null&&o.toString()===I){if(x[I]=!0,!B()){K(),L(!0);return}X(),L(!0)}},je=_=>{q(_.toString())},Y=(_,A,I,W)=>{let U=_.toString(),G=n[U]??"",se=b[U]??j(G),oe=C!==null&&C.handle===U&&C.start===A&&C.end===I&&C.text===W&&o!==null&&o.toString()===U&&B(),le=oe?G:_t(G,A,I,W);if(oe||(n[U]=le,b[U]=se-(I-A)+j(W)),oe&&(C=null),e.textChanges.push(Xt(U,le)),o!==null&&o.toString()===U){if(x[U]=!0,!B()){K(),L(!0);return}oe||X(),L(!0)}},ge=(_,A,I)=>{let W=_.toString(),U=H!==null&&H.handle===W&&H.start===A&&H.end===I&&o!==null&&o.toString()===W&&B();r[W]={start:A,end:I},H!==null&&H.handle===W&&(H=null);let G={handle:W,start:A,end:I};if(e.selectionChanges.push(G),o!==null&&o.toString()===W){if(!B()){K(),L(!0);return}U||X(),L(!0),J(W)}},we=_=>{let A=t.current;if(A===null)return;let I=z(_),W=h;e.clipboardReadRequests.push(I.toString()),navigator.clipboard.readText().then(U=>{if(W!==h)return;let G=I.toString(),se=n[G]??"",oe=b[G]??j(se),le=r[G]??{start:oe,end:oe},Ge=Math.max(0,Math.min(le.start,le.end)),Je=Math.max(Ge,Math.min(oe,Math.max(le.start,le.end))),Z=xt(se,Ge,Je,U,Ge+j(U));if(n[G]=Z.fullNextText,b[G]=j(Z.fullNextText),r[G]={start:Z.caretByte,end:Z.caretByte},o!==null&&o.toString()===G&&X(),Z.replacement===null)return;A.ui._ui_set_interaction_time(co());let Qe=$(se,Z.replacement.start),Ze=$(se,Z.replacement.end);C={handle:G,start:Qe,end:Ze,text:Z.replacement.insertedText},H={handle:G,start:Z.caretByte,end:Z.caretByte};let Tt=Ce(A.ui,Z.replacement.insertedText);try{A.ui._ui_replace_text_range(I,Qe,Ze,Tt.ptr,Tt.len,Z.caretByte)}finally{Tt.dispose()}A.commitFrame()}).catch(()=>{})};return{logs:e,textByHandle:n,selectionsByHandle:r,hasPendingTextMutations:re.hasPendingTextMutations,materializePendingTextMutations:re.materializePendingTextMutations,getActiveTextEditable:()=>g,getActiveTextHandle:()=>o,getActiveTextMultiline:()=>w,getCapturedPointerHandle:()=>u,getLastPointerClientPosition:()=>({x:s,y:l}),getLastPointerPosition:()=>({x:c,y:d}),getLastPointerModifiers:()=>f,getLastInteractivePointerHandle:()=>y,isActiveTextInputFocused:B,isPointerInsideCanvas:()=>F,applyActiveTextDeletion:re.applyActiveTextDeletion,beginTouchTextFocusDeferral:ye,cancelTouchTextFocusDeferral:Ke,commitTouchTextFocusDeferral:be,refocusActiveTextInput:Se,resetAppSession:Ye,consumePendingSemanticAnnouncements:()=>{let _=Array.from(E.values());return E.clear(),_},getFocusedHandle:()=>T,setCapturedPointerHandle:_=>{u=_},setLastPointerClientPosition:(_,A)=>{s=_,l=A},setLastPointerModifiers:_=>{f=_},setLastPointerPosition:(_,A)=>{c=_,d=A},setLastInteractivePointerHandle:_=>{y=_},setPointerInsideCanvas:_=>{F=_},handleClipboardRead:we,handleFocusChanged:vt,handleRequestSemanticAnnouncement:je,handleSelectionChanged:ge,handleTextChanged:Et,handleTextReplaced:Y}}function xr(){return{pointerEvents:[],focusEvents:[],textChanges:[],selectionChanges:[],crossSelectionChanges:[],clipboardWrites:[],clipboardReadRequests:[],scrollEvents:[],missingFontCoverageRequests:[],incrementalFontPackageRequests:[]}}function vr(t){let e=xr(),n=_r(t,e),r={onPointerEvent:(i,a)=>{let{x:o,y:s}=n.getLastPointerPosition(),l=n.getLastPointerModifiers(),c={handle:Me(i),eventType:a};e.pointerEvents.push(c),window.__effindomCallbacks?.onPointerEventWithCoords?.(a,i,o,s,l)},onFocusChanged:n.handleFocusChanged,onTextChanged:n.handleTextChanged,onRequestSemanticAnnouncement:n.handleRequestSemanticAnnouncement,onTextReplaced:n.handleTextReplaced,onSelectionChanged:n.handleSelectionChanged,onScroll:(i,a,o,s,l,c,d)=>{let f={handle:Me(i),offsetX:a,offsetY:o,contentWidth:s,contentHeight:l,viewportWidth:c,viewportHeight:d};e.scrollEvents.push(f)},onCrossSelectionChanged:(i,a)=>{e.crossSelectionChanges.push({areaHandle:Me(i),text:a})},onClipboardWrite:i=>{e.clipboardWrites.push(i.plainText);let a=t.current,o=a===null?i:mr(i,s=>a.getClipboardFontUrl(s));hr(o).catch(()=>{})},onClipboardRead:n.handleClipboardRead,onRequestFontLoad:(i,a)=>{let o=t.current;o===null||a.length===0||o.loadFont(i,a).catch(s=>{window.__bridgeError=s instanceof Error?s.message:String(s)})},onMissingFontCoverage:(i,a,o)=>{let s=t.current;s!==null&&(e.missingFontCoverageRequests.push({fontId:i,coverageKind:a,sampleText:o}),s.handleMissingFontCoverage(i,a,o))}};return window.__effindomCallbacks=r,n}var He=null,Qt=null,Xe=null,Zt=Promise.resolve(),Er={current:null},uo=vr(Er),mo=En();async function ho(){He?.resetLogs(),Qt?.destroy(),Qt=null;let t=await mo,e=await lr({interactionState:uo,preparedAssets:t,runtimeRef:Er});return Qt=e,He=e.runtime,window.__bridgeReady=!0,window.__bridgeDebug={forceDeviceLost(){e.runtime.core._ed_debug_simulate_device_lost?.(),e.runtime.requestFrame()}},delete window.__bridgeError,e.runtime}function Tr(){return Zt=Zt.catch(()=>{}).then(async()=>{await ho()}),Zt.then(()=>{if(He===null)throw new Error("Bridge runtime failed to boot.");return He})}Xe=Tr().catch(t=>{let e=t instanceof Error?t.message:String(t);throw window.__bridgeReady=!1,window.__bridgeError=e,t});var fo={get ready(){return Xe??Promise.reject(new Error("Bridge runtime is not booting."))},getRuntime:()=>He,recreateRuntime:async()=>(Xe=Tr(),await Xe),resetLogs:()=>{He!==null&&He.resetLogs()},handleToBigInt:z,handleToString:Me,pointerToHeapOffset:ne,normalizePointerForWasm:ie,toHeapPointer:Le};window.__bridgeReady=!1;window.EffinDomBrowserBridge=fo;Xe.catch(()=>{});})();
|
|
1
|
+
"use strict";(()=>{var k={NONE:0,WEBGPU:1,WEBGL2:2,CPU:3},ce={OK:0,LOST:1,RECOVERING:2};function Si(t){if(typeof t=="bigint"||typeof t=="number"||typeof t=="string")return t;let e=t[Symbol.toPrimitive]?.("default");if(typeof e=="bigint"||typeof e=="number"||typeof e=="string")return e;let n=t.valueOf();if(typeof n=="bigint"||typeof n=="number"||typeof n=="string")return n;let i=t.toString();if(typeof i=="string")return i;throw new TypeError(`Cannot convert ${String(t)} to BigInt.`)}function z(t){let e=Si(t);if(typeof e=="bigint")return e;if(typeof e=="number"){if(!Number.isInteger(e))throw new TypeError(`Cannot convert non-integer handle ${String(e)} to BigInt.`);return BigInt(e)}if(typeof e=="string")return BigInt(e);throw new TypeError(`Cannot convert ${String(t)} to BigInt.`)}function Be(t){return z(t).toString()}function ne(t){if(typeof t=="number"){if(!Number.isInteger(t))throw new TypeError(`Cannot convert non-integer pointer ${String(t)} to a heap offset.`);return t}let e=z(t);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new RangeError(`Pointer ${e.toString()} exceeds JavaScript heap offset precision.`);return Number(e)}function re(t,e){return t.usesMemory64===!0?z(e):ne(e)}function Le(t,e){let n=re(t,e);return{ptr:n,offset:ne(n)}}function ae(t){switch(t){case k.WEBGPU:case k.WEBGL2:case k.CPU:return t;default:return k.NONE}}function et(t){switch(t){case ce.LOST:case ce.RECOVERING:return t;default:return ce.OK}}function ze(t){let e=0;return t.shiftKey&&(e|=1),t.ctrlKey&&(e|=2),t.altKey&&(e|=4),t.metaKey&&(e|=8),e}var wi=1500,Oe=[k.WEBGL2,k.CPU];function Li(t){switch(t){case k.WEBGPU:return"webgpu";case k.WEBGL2:return"webgl2";case k.CPU:return"cpu";default:return"none"}}function de(t,e){t.activeRenderer=Li(e),window.__bridgeLoaderInfo=t}async function Fi(){await new Promise(t=>{requestAnimationFrame(()=>{t()})})}async function en(t){let e=performance.now()+wi;for(;performance.now()<e;){let n=ae(t._ed_get_backend_type()),i=et(t._ed_get_device_state());if(n===k.WEBGPU||i!==ce.RECOVERING)return n;await Fi()}return ae(t._ed_get_backend_type())}async function tn(){let t=navigator;if(t.gpu?.requestAdapter===void 0)return!1;try{let e=await t.gpu.requestAdapter();return e!=null}catch{return!1}}function Fe(t){return t===k.WEBGPU?"WebGPU":t===k.WEBGL2?"WebGL2":t===k.CPU?"Software/Raster":"None"}async function St(t,e,n,i){let r=e.width,a=e.height;try{return i===k.WEBGPU?await tn()?(t._ed_init(r,a,n),await en(t)===k.WEBGPU):!1:i===k.WEBGL2?(t._ed_init_webgl(r,a,n),ae(t._ed_get_backend_type())===k.WEBGL2):(t._ed_init_sw(r,a,n),ae(t._ed_get_backend_type())===k.CPU)}catch{return!1}}async function nn(t,e,n,i,r=Oe){let a=e.width,o=e.height,s=r.length>0?r:Oe,l=s[0]??k.WEBGPU,c=!1,d=!1;for(let f of s){if(f===k.WEBGPU){if(!await tn())continue;c=!0,t._ed_init(a,o,n);let y=await en(t);if(y===k.WEBGPU)return de(i,y),y;continue}if(f===k.WEBGL2){if(d=!0,t._ed_init_webgl(a,o,n),ae(t._ed_get_backend_type())===k.WEBGL2)return(c||l===k.WEBGPU)&&console.warn("RENDERER FALLBACK: WebGPU failed to initialize or unavailable! Fell back to WebGL2"),de(i,k.WEBGL2),k.WEBGL2;continue}if(t._ed_init_sw(a,o,n),ae(t._ed_get_backend_type())===k.CPU){let y=[c?"WebGPU":null,d?"WebGL2":null].filter(Boolean).join(" and "),u=y.length>0?`${y} failed to initialize or unavailable!`:"No GPU backend available.";return console.error(`RENDERER FALLBACK: ${u} Fell back to Software/Raster - performance will be painfully slow`),de(i,k.CPU),k.CPU}}throw de(i,k.NONE),new Error("Failed to initialize any renderer backend.")}var rn=new Map;function Ci(t){return new Promise(e=>{window.setTimeout(e,t)})}function ue(t){return new URL(t,document.baseURI).toString()}function on(t){if(t==null||t.length===0)return null;let e=t;if(!e.startsWith("sha256-"))return e;let n=e.slice(7).replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4!==0;)n+="=";return`sha256-${n}`}function Ai(t){let e="";for(let n=0;n<t.length;n+=32768){let i=t.subarray(n,Math.min(n+32768,t.length));e+=String.fromCharCode(...i)}return window.btoa(e)}async function wt(t,e,n){let i=on(n);if(i===null)return e;let r=await globalThis.crypto.subtle.digest("SHA-256",e);if(`sha256-${Ai(new Uint8Array(r))}`!==i)throw new Error(`Integrity mismatch for ${t}`);return e}function Ii(t,e="force-cache"){let n=on(t),i={credentials:"same-origin",cache:e};return n!==null&&(i.integrity=n),i}async function tt(t,e,n,i){let r=null;for(let a=1;a<=e;a+=1)try{let o=await fetch(t,i);if(!o.ok)throw new Error(`Failed to fetch ${t}: ${String(o.status)}`);return await n(o)}catch(o){if(r=o,a===e)break;await Ci(100*a)}throw r instanceof Error?r:new Error(`Failed to fetch ${t}`)}async function Lt(t,e){let n=ue(t),i=await tt(n,4,async r=>await r.arrayBuffer(),Ii(e));return new Uint8Array(await wt(n,i,e))}async function an(t,e){let n=ue(t),i=await Ft(n,e),r=i.includes("//# sourceURL=")?i:`${i}
|
|
2
|
+
//# sourceURL=${n.replace(/\s/g,"%20")}`,a=URL.createObjectURL(new Blob([r],{type:"application/javascript"}));try{await new Promise((o,s)=>{let l=document.createElement("script");l.src=a,l.async=!0,l.addEventListener("load",()=>{l.remove(),o()}),l.addEventListener("error",()=>{l.remove(),s(new Error(`Failed to execute ${n}`))}),document.head.appendChild(l)})}finally{URL.revokeObjectURL(a)}}async function Ft(t,e){let n=ue(t),i=`${n}::${e??""}`,r=rn.get(i);return r===void 0&&(r=Lt(n,e).then(a=>new TextDecoder("utf-8").decode(a)),rn.set(i,r)),await r}var Pi=new TextEncoder;function Ce(t,e){let n=Pi.encode(e),i=re(t,n.byteLength===0?0:t._malloc(n.byteLength)),r=ne(i);if(t.refreshHeapViews?.(),n.byteLength>0&&r===0)throw new Error("WASM string malloc failed.");return n.byteLength>0&&t.HEAPU8.set(n,r),{ptr:i,offset:r,len:n.byteLength,dispose:()=>{r!==0&&t._free(i)}}}function me(t,e){let n=re(t,e.byteLength===0?0:t._malloc(e.byteLength)),i=ne(n);if(t.refreshHeapViews?.(),e.byteLength>0&&i===0)throw new Error("WASM bytes malloc failed.");return e.byteLength>0&&t.HEAPU8.set(e,i),{ptr:n,offset:i,len:e.byteLength,dispose:()=>{i!==0&&t._free(n)}}}function Ct(t){let e=re(t,t._malloc(4)),n=ne(e);if(n===0)throw new Error("ui length malloc failed.");try{let i=t._ui_get_command_buffer(e);t.refreshHeapViews?.();let r=t.HEAPU32[n>>>2]??0,a=ne(re(t,i));if(a===0||r===0)return new Uint32Array;let o=a>>>2;return t.HEAPU32.slice(o,o+r)}finally{t._free(e)}}function sn(t){let e=re(t,t._malloc(4)),n=ne(e);if(n===0)throw new Error("ui semantic length malloc failed.");try{let i=t._ui_get_semantic_buffer(e);t.refreshHeapViews?.();let r=t.HEAPU32[n>>>2]??0,a=ne(re(t,i));if(a===0||r===0)return new Uint32Array;let o=a>>>2;return t.HEAPU32.slice(o,o+r)}finally{t._free(e)}}function At(t,e){if(e.length===0)return;let n=re(t,t._malloc(e.byteLength)),i=ne(n);if(t.refreshHeapViews?.(),i===0)throw new Error("core command malloc failed.");try{t.HEAPU32.set(e,i>>>2),t._ed_execute_command_buffer(n,e.length)}finally{t._free(n)}}var ln=new Uint8Array([0,97,115,109,1,0,0,0,1,15,3,96,2,127,126,1,127,96,1,126,0,96,0,1,126,3,4,3,0,1,2,4,5,1,112,5,1,1,5,6,1,5,130,2,130,2,6,8,1,126,1,66,128,136,4,11,7,104,5,6,109,101,109,111,114,121,2,0,4,109,97,105,110,0,0,25,95,95,105,110,100,105,114,101,99,116,95,102,117,110,99,116,105,111,110,95,116,97,98,108,101,1,0,25,95,101,109,115,99,114,105,112,116,101,110,95,115,116,97,99,107,95,114,101,115,116,111,114,101,0,1,28,101,109,115,99,114,105,112,116,101,110,95,115,116,97,99,107,95,103,101,116,95,99,117,114,114,101,110,116,0,2,10,18,3,4,0,65,0,11,6,0,32,0,36,0,11,4,0,35,0,11]),dn=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,23,1,21,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,11]);function hn(t){let e=document.getElementById("icu-error"),n=document.getElementById("icu-error-message");if(e instanceof HTMLElement&&n instanceof HTMLElement){n.textContent=t,e.style.display="block";return}let i=document.getElementById("effindom-loading-overlay"),r=document.getElementById("effindom-loading-title"),a=document.getElementById("effindom-loading-detail");i instanceof HTMLElement&&r instanceof HTMLElement&&a instanceof HTMLElement&&(i.dataset.state="error",i.hidden=!1,i.setAttribute("aria-hidden","false"),r.textContent="The typesetter dragon sneezed on the runtime.",a.textContent=t)}function nt(t,e){let n=new Error(t);return n.cause=e,n}function fn(t){return new Promise(e=>{window.setTimeout(e,t)})}function pn(t){t.pointerEvents.length=0,t.focusEvents.length=0,t.textChanges.length=0,t.selectionChanges.length=0,t.crossSelectionChanges.length=0,t.clipboardWrites.length=0,t.clipboardReadRequests.length=0,t.scrollEvents.length=0,t.missingFontCoverageRequests.length=0,t.incrementalFontPackageRequests.length=0}function ki(){try{return new WebAssembly.Memory({initial:1,maximum:1,index:"i64"}),WebAssembly.validate!==void 0?WebAssembly.validate(ln):(new WebAssembly.Module(ln),!0)}catch{return!1}}function Ri(){try{return WebAssembly.validate!==void 0?WebAssembly.validate(dn):(new WebAssembly.Module(dn),!0)}catch{return!1}}function Hi(t){let e=(t??"auto").toLowerCase();return e==="wasm32"||e==="wasm32-simd"||e==="wasm64"||e==="wasm64-simd"?e:"auto"}function It(t,e){return t.architectures[e]??null}function Mi(t,e){let n=Hi(e),i=ki(),r=Ri(),a=Object.keys(t.architectures).filter(f=>t.architectures[f]!==void 0),o=null,s,l=f=>f.startsWith("wasm64"),c=f=>f.endsWith("-simd");if(n!=="auto"){if(It(t,n)===null)throw new Error(`Manifest does not include ${n} bundles.`);if(l(n)&&!i)throw new Error(`${n} was explicitly requested but this browser does not support Memory64.`);if(c(n)&&!r)throw new Error(`${n} was explicitly requested but this browser does not support WebAssembly SIMD.`);o=n,s=`Explicit ${n} request.`}else{let f=[];i&&r&&f.push("wasm64-simd"),i&&f.push("wasm64"),r&&f.push("wasm32-simd"),f.push("wasm32");for(let y of f)if(It(t,y)!==null){o=y;break}if(o===null)throw new Error("Manifest does not expose any wasm bundle architectures compatible with this browser.");o==="wasm64-simd"?s="Browser supports Memory64 + SIMD, so EffinDom selected the wasm64-simd bundle set.":o==="wasm64"?s="Browser supports Memory64, so EffinDom selected the wasm64 bundle set.":o==="wasm32-simd"?s="Browser supports SIMD, so EffinDom selected the wasm32-simd bundle set.":s="Browser selected the wasm32 bundle set."}let d=It(t,o);if(d===null)throw new Error(`Manifest entry for ${o} is missing.`);return{requestedArchitecture:n,selectedArchitecture:o,availableArchitectures:a,memory64Supported:i,simdSupported:r,selectionReason:s,manifestEntry:d}}function Bi(){let t=window.__effindomRuntime;if(t===void 0)throw new Error("Missing effindom-runtime-config.js. Expected window.__effindomRuntime.manifestUrl before bridge.js loads.");if(typeof t.manifestUrl!="string"||t.manifestUrl.length===0)throw new Error("Malformed effindom-runtime-config.js. Expected window.__effindomRuntime.manifestUrl to be a non-empty string.");return t.manifestUrl}function Ae(t,e){return new URL(e,t).toString()}async function Oi(){let t=ue(Bi());return{manifest:await tt(t,4,async n=>await n.json(),{cache:"no-store"}),manifestUrl:t}}async function gn(t,e){let n=await t.modulePromise;return{instance:await WebAssembly.instantiate(n,e),module:n,compileMode:"cached-module"}}async function yn(t,e){let n=await e.icu.bytesPromise,i=me(t,n);try{t._ui_register_icu_data(i.ptr,i.len)}finally{i.dispose()}}function bn(t,e){return typeof t=="string"&&t.length>0?t:t instanceof Error&&t.message.length>0?t.message:e}function cn(t,e){let n={credentials:"same-origin",cache:"force-cache"};e!==null&&(n.integrity=e);let i=tt(t,4,async r=>await r.arrayBuffer(),n).then(async r=>await wt(t,r,e));return{url:t,integrity:e,bytesPromise:i,modulePromise:i.then(async r=>await WebAssembly.compile(r))}}var un=new Map;async function Wi(t,e){let n=ue(t),i=`${n}::${e??""}`,r=un.get(i);return r===void 0&&(r=Ft(n,e).then(a=>{let o=`${a}
|
|
3
|
+
//# sourceURL=${n.replace(/\s/g,"%20")}`;return new Function("Module",o)}),un.set(i,r)),await r}async function _n(t,e,n,i){return await new Promise((r,a)=>{let o={HEAPU8:new Uint8Array,HEAPU32:new Uint32Array,usesMemory64:i.selectedWasmArchitecture.startsWith("wasm64"),locateFile:s=>s.endsWith(".wasm")?ue(t.wasm):ue(s),instantiateWasm:(s,l)=>(gn(e,s).then(c=>{i.coreCompileMode=c.compileMode,l(c.instance,c.module)}).catch(c=>{a(nt("Failed to instantiate Core wasm.",c))}),{}),onAbort:s=>{a(new Error(bn(s,"Core wasm aborted.")))},refreshHeapViews:()=>{if(o.wasmMemory!==void 0){let s=o.wasmMemory.buffer;o.HEAPU8=new Uint8Array(s),o.HEAPU32=new Uint32Array(s)}else typeof HEAPU8<"u"&&(o.HEAPU8=HEAPU8,typeof HEAPU32<"u"&&(o.HEAPU32=HEAPU32))},canvas:n,onRuntimeInitialized:()=>{let s=o.memory;s instanceof WebAssembly.Memory&&(o.wasmMemory=s),o.refreshHeapViews?.(),r(o)},_malloc:()=>0,_free:()=>{},_ed_init:()=>{},_ed_init_webgl:()=>{},_ed_init_sw:()=>{},_ed_resize:()=>{},_ed_register_font:()=>{},_ed_unregister_font:()=>{},_ed_register_svg:()=>{},_ed_register_texture_rgba:()=>{},_ed_unregister_texture:()=>{},_ed_execute_command_buffer:()=>{},_ed_reset_scene:()=>{},_ed_render_frame:()=>{},_ed_clear_focus_state:()=>{},_ed_clear_text_input_state:()=>{},_ed_recover_device:()=>{},_ed_hit_test:()=>0,_ed_get_sw_framebuffer:()=>0,_ed_get_backend_type:()=>k.NONE,_ed_get_device_state:()=>ce.OK,_ed_notify_webgl_context_lost:()=>{},_ed_debug_simulate_device_lost:()=>{}};Wi(t.js,t.js_integrity??null).then(s=>{s(o)}).catch(a)})}async function xn(t,e,n){if(window.EffinDomUiV2ModuleFactory===void 0&&await an(t.js,t.js_integrity??null),window.EffinDomUiV2ModuleFactory===void 0)throw new Error("EffinDomUiV2ModuleFactory did not load.");let i=null,r=new Promise((l,c)=>{i=c}),a=window.EffinDomUiV2ModuleFactory({locateFile:l=>l.endsWith(".wasm")?ue(t.wasm):ue(l),instantiateWasm:(l,c)=>(gn(e,l).then(d=>{n.uiCompileMode=d.compileMode,c(d.instance,d.module)}).catch(d=>{i?.(nt("Failed to instantiate Ui wasm.",d))}),{}),onAbort:l=>{i?.(new Error(bn(l,"Ui wasm aborted.")))}}),o=await Promise.race([a,r]);o.usesMemory64=n.selectedWasmArchitecture.startsWith("wasm64");let s=o.memory;return s instanceof WebAssembly.Memory&&(o.wasmMemory=s),o.refreshHeapViews=()=>{if(o.wasmMemory!==void 0){let l=o.wasmMemory.buffer;o.HEAPU8=new Uint8Array(l),o.HEAPU32=new Uint32Array(l)}},o.refreshHeapViews(),o}function Ni(){return new URLSearchParams(window.location.search).get("arch")}function Di(){let t=new URLSearchParams(window.location.search).get("backend")?.toLowerCase()??"auto";return t==="webgpu"||t==="graphite"?"webgpu":t==="webgl2"||t==="ganesh"?"webgl2":t==="software"||t==="raster"||t==="cpu"?"cpu":"auto"}function vn(t){return t==="webgpu"?[k.WEBGL2,k.CPU]:t==="webgl2"?[k.WEBGL2,k.CPU]:t==="cpu"?[k.CPU]:Oe}async function En(){let t=await Oi(),e=t.manifest,n=t.manifestUrl,i=Mi(e,Ni()),r=Di(),a={...i.manifestEntry.core,js:Ae(n,i.manifestEntry.core.js),wasm:Ae(n,i.manifestEntry.core.wasm)},o={...i.manifestEntry.ui,js:Ae(n,i.manifestEntry.ui.js),wasm:Ae(n,i.manifestEntry.ui.wasm)},s=e.assets?.icu;if(s===void 0)throw new Error("Manifest is missing the ICU asset descriptor.");let l={manifestHash:e.manifest_hash??null,requestedWasmArchitecture:i.requestedArchitecture,requestedRendererBackend:r,selectedWasmArchitecture:i.selectedArchitecture,availableWasmArchitectures:i.availableArchitectures,memory64Supported:i.memory64Supported,simdSupported:i.simdSupported,coreCompileMode:"buffer",uiCompileMode:"buffer",icuDataUrl:Ae(n,s.url),activeRenderer:"none",deviceRecoveryCount:0};return{manifest:e,selection:i,loaderInfo:l,coreBundle:a,uiBundle:o,coreWasm:{...cn(a.wasm,a.wasm_integrity??null)},uiWasm:{...cn(o.wasm,o.wasm_integrity??null)},icu:{url:Ae(n,s.url),integrity:s.integrity??null,bytesPromise:Lt(Ae(n,s.url),s.integrity??null)}}}var Ui=/\p{Mark}+/gu,Ki=/[\p{Letter}\p{Number}\p{Mark}_]/u,Gi=new TextEncoder,_e={highlightAll:!1,matchCase:!1,matchDiacritics:!1,wholeWords:!1};function Pt(t){return{highlightAll:t?.highlightAll??_e.highlightAll,matchCase:t?.matchCase??_e.matchCase,matchDiacritics:t?.matchDiacritics??_e.matchDiacritics,wholeWords:t?.wholeWords??_e.wholeWords}}function Tn(t,e){let n=Math.max(0,Math.min(e,t.length));return Gi.encode(t.slice(0,n)).byteLength}function zi(t,e){if(e<=0)return null;let n=e-1,i=t.charCodeAt(n);if(n>0&&i>=56320&&i<=57343){let r=t.charCodeAt(n-1);r>=55296&&r<=56319&&(n-=1)}return t.slice(n,e)}function $i(t,e){let n=t.codePointAt(e);return n===void 0?null:String.fromCodePoint(n)}function Sn(t){return t!==null&&Ki.test(t)}function qi(t,e,n){return!Sn(zi(t,e))&&!Sn($i(t,n))}function wn(t,e){let n=[],i="",r=0;for(let a of t){let o=r;r+=a.length;let s=r,l=e.matchDiacritics?a:a.normalize("NFD").replace(Ui,"");l=e.matchCase?l:l.toLocaleLowerCase(),i+=l;for(let c=0;c<l.length;c+=1)n.push({start:o,end:s})}return{text:i,tokens:n}}function Ln(t,e,n){let i=Pt(n);if(e.length===0)return{query:e,options:i,matches:[]};let r=wn(e,i).text;if(r.length===0)return{query:e,options:i,matches:[]};let a=[];for(let o of t){let s=wn(o.text,i),l=0;for(;l<=s.text.length-r.length;){let c=s.text.indexOf(r,l);if(c<0)break;let d=c+r.length,f=s.tokens[c],y=s.tokens[d-1];if(f===void 0||y===void 0)break;let u=f.start,F=y.end;(!i.wholeWords||qi(o.text,u,F))&&a.push({handle:o.handle,start:Tn(o.text,u),end:Tn(o.text,F)}),l=c+Math.max(r.length,1)}}return{query:e,options:i,matches:a}}function Fn(){return navigator.userAgentData?.mobile===!0||/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)?!0:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function kt(){let e=(navigator.userAgentData?.platform??navigator.platform??navigator.userAgent).toLowerCase();return e.includes("mac")||e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios")?1:e.includes("win")?2:e.includes("linux")||e.includes("android")||e.includes("x11")||e.includes("cros")?3:0}function Rt(t,e=kt()){return t.altKey?!1:e===1?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey}function Vi(t){return Rt(t)&&(t.key==="f"||t.key==="F")}function Xi(t){return Rt(t)&&(t.key==="g"||t.key==="G")}function Yi(t){let e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width",t==="filter"?"1.6":"1.8"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.style.display="block",n.style.width="16px",n.style.height="16px";let i=r=>{let a=document.createElementNS(e,"path");a.setAttribute("d",r),n.appendChild(a)};switch(t){case"chevronUp":i("M4.5 10.25L8 6.75L11.5 10.25");break;case"chevronDown":i("M4.5 5.75L8 9.25L11.5 5.75");break;case"filter":i("M3 4.5H13"),i("M5 8H11"),i("M6.75 11.5H9.25");break;case"close":i("M4.75 4.75L11.25 11.25"),i("M11.25 4.75L4.75 11.25");break}return n}function it(t,e,n="plain"){let i=document.createElement("button");return i.type="button",i.setAttribute("aria-label",t),i.setAttribute("data-ed-find-icon-variant",n),i.appendChild(Yi(e)),i.style.width="32px",i.style.height="32px",i.style.display="inline-flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.padding="0",i.style.border="none",i.style.borderRadius="10px",i.style.background="transparent",i.style.outline="none",i.style.appearance="none",i.style.webkitAppearance="none",i.style.boxShadow="none",i.style.cursor="pointer",i.style.userSelect="none",i.style.webkitUserSelect="none",i.style.flex="0 0 auto",i.style.transition="background 120ms ease, color 120ms ease, opacity 120ms ease",i.dataset.edHovered="0",i}function ji(t,e){return t?.handle===e?.handle&&t?.start===e?.start&&t?.end===e?.end}var rt=class{constructor(e,n){this.matches=[];this.activeMatchIndex=-1;this.options={..._e};this.optionsExpanded=!1;this.handleThemeChange=()=>{this.syncThemeUi()};this.runtime=e;let i=document.body??document.documentElement;if(!(i instanceof HTMLElement))throw new Error("Expected document root for desktop Find dialog.");let r=document.createElement("div");r.setAttribute("data-ed-find-dialog","1"),r.setAttribute("data-ed-open","0"),r.setAttribute("role","dialog"),r.setAttribute("aria-label","Find on page"),r.style.position="fixed",r.style.top="6px",r.style.right="6px",r.style.display="none",r.style.flexDirection="column",r.style.width="min(356px, calc(100vw - 12px))",r.style.boxSizing="border-box",r.style.borderRadius="14px",r.style.border="1px solid transparent",r.style.overflow="hidden",r.style.pointerEvents="auto",r.style.zIndex="2147483647",r.style.boxShadow="0 10px 24px rgba(0, 0, 0, 0.22)",r.style.backdropFilter="blur(10px)",r.style.font="500 13px/1.2 system-ui, sans-serif";let a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.minHeight="42px",a.style.padding="0 8px 0 12px";let o=document.createElement("div");o.style.flex="1 1 auto",o.style.minWidth="0",o.style.display="flex",o.style.alignItems="center",o.style.paddingRight="6px";let s=document.createElement("input");s.type="text",s.autocomplete="off",s.spellcheck=!1,s.placeholder="Find text",s.setAttribute("aria-label","Find query"),s.style.width="100%",s.style.minWidth="0",s.style.height="24px",s.style.padding="0",s.style.margin="0",s.style.border="none",s.style.outline="none",s.style.background="transparent",s.style.font="500 13px/1.2 system-ui, sans-serif",o.appendChild(s);let l=document.createElement("span");l.setAttribute("aria-live","polite"),l.style.minWidth="36px",l.style.textAlign="center",l.style.font="500 13px/1.2 system-ui, sans-serif",l.style.padding="0 4px 0 2px";let c=document.createElement("div");c.setAttribute("aria-hidden","true"),c.style.width="1px",c.style.height="20px",c.style.margin="0 6px 0 4px",c.style.flex="0 0 auto";let d=it("Previous result","chevronUp"),f=it("Next result","chevronDown"),y=it("Show advanced find options","filter","filter"),u=it("Close find dialog","close"),F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.gap="2px",F.append(d,f,y,u),a.append(o,l,c,F);let h=document.createElement("div");h.style.display="none",h.style.flexDirection="column",h.style.padding="2px 0";let g=(E,N)=>{let M=document.createElement("button");M.type="button",M.setAttribute("data-ed-find-option",E),M.setAttribute("aria-label",N),M.setAttribute("role","switch"),M.style.width="100%",M.style.height="38px",M.style.display="flex",M.style.alignItems="center",M.style.justifyContent="space-between",M.style.padding="0 12px",M.style.border="none",M.style.background="transparent",M.style.cursor="pointer",M.style.textAlign="left",M.style.font="500 12px/1.2 system-ui, sans-serif";let $=document.createElement("span");$.textContent=N,$.style.pointerEvents="none",$.style.font="inherit";let P=document.createElement("span");P.setAttribute("aria-hidden","true"),P.style.position="relative",P.style.display="inline-flex",P.style.alignItems="center",P.style.width="30px",P.style.height="18px",P.style.borderRadius="999px",P.style.transition="background 120ms ease",P.style.pointerEvents="none";let D=document.createElement("span");return D.style.position="absolute",D.style.top="2px",D.style.left="2px",D.style.width="14px",D.style.height="14px",D.style.borderRadius="999px",D.style.boxShadow="0 1px 2px rgba(0, 0, 0, 0.24)",D.style.transition="transform 120ms ease",D.style.pointerEvents="none",P.appendChild(D),M.append($,P),{button:M,track:P,thumb:D}},w=g("highlightAll","Highlight all"),S=g("matchCase","Match case"),b=g("matchDiacritics","Match diacritics"),x=g("wholeWords","Match whole word"),v={highlightAll:w.button,matchCase:S.button,matchDiacritics:b.button,wholeWords:x.button},C={highlightAll:w.track,matchCase:S.track,matchDiacritics:b.track,wholeWords:x.track},H={highlightAll:w.thumb,matchCase:S.thumb,matchDiacritics:b.thumb,wholeWords:x.thumb};h.append(v.highlightAll,v.matchCase,v.matchDiacritics,v.wholeWords),r.append(a,h),i.appendChild(r);let B=()=>{this.restoreInputFocus(!1)},p=(E,N)=>{E.dataset.edHovered=N?"1":"0",this.syncStatusUi()},T=(E,N)=>{E.addEventListener("pointerdown",M=>{M.preventDefault()}),E.addEventListener("pointerenter",()=>{p(E,!0)}),E.addEventListener("pointerleave",()=>{p(E,!1)}),E.addEventListener("click",()=>{N(),B()})};r.addEventListener("keydown",E=>{E.stopPropagation()}),s.addEventListener("input",()=>{this.refreshMatches(!1)}),s.addEventListener("keydown",E=>{if(E.key==="Enter"){E.preventDefault(),this.step(E.shiftKey?-1:1);return}if(E.key==="ArrowDown"&&!E.altKey&&!E.ctrlKey&&!E.metaKey){E.preventDefault(),this.step(1);return}if(E.key==="ArrowUp"&&!E.altKey&&!E.ctrlKey&&!E.metaKey){E.preventDefault(),this.step(-1);return}E.key==="Escape"&&(E.preventDefault(),this.hide())}),T(d,()=>{this.step(-1)}),T(f,()=>{this.step(1)}),T(y,()=>{this.optionsExpanded=!this.optionsExpanded,this.syncOptionUi()}),T(u,()=>{this.hide()});for(let[E,N]of Object.entries(v))T(N,()=>{this.options={...this.options,[E]:!this.options[E]},this.syncOptionUi(),this.refreshMatches(!0)});this.root=r,this.input=s,this.status=l,this.advancedPanel=h,this.previousButton=d,this.nextButton=f,this.disclosureButton=y,this.closeButton=u,this.optionButtons=v,this.optionTracks=C,this.optionThumbs=H,this.themeMedia=typeof window.matchMedia=="function"?window.matchMedia("(prefers-color-scheme: dark)"):null,this.themeMedia?.addEventListener?.("change",this.handleThemeChange),this.syncOptionUi(),this.syncThemeUi()}consumeGlobalKeyEvent(e,n){return Fn()?!1:Vi(e)?(e.preventDefault(),e.stopPropagation(),n==="down"&&this.show(),!0):n==="down"&&this.isOpen()&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key==="F3"?(e.preventDefault(),this.step(e.shiftKey?-1:1),!0):n==="down"&&this.isOpen()&&Xi(e)?(e.preventDefault(),this.step(e.shiftKey?-1:1),!0):!!this.containsTarget(e.target)}containsTarget(e){return e instanceof Node&&this.root.contains(e)}destroy(){this.themeMedia?.removeEventListener?.("change",this.handleThemeChange),this.root.remove()}getPalette(){return this.themeMedia?.matches??!0?{colorScheme:"dark",shellBackground:"rgba(36, 36, 36, 0.98)",shellBorder:"rgba(255, 255, 255, 0.08)",divider:"rgba(255, 255, 255, 0.12)",panelBackground:"rgba(0, 0, 0, 0.10)",text:"#f5f5f5",mutedText:"#cfcfcf",errorText:"#fca5a5",buttonText:"#d9d9d9",buttonMutedText:"#7c7c7c",buttonActiveBackground:"rgba(255, 255, 255, 0.08)",buttonPlainHoverBackground:"rgba(255, 255, 255, 0.06)",filterButtonBackground:"transparent",filterButtonActiveBackground:"rgba(255, 255, 255, 0.20)",optionHoverBackground:"rgba(255, 255, 255, 0.03)",toggleTrackOff:"#5a5a5a",toggleTrackOn:"#818cf8",toggleThumb:"#ffffff"}:{colorScheme:"light",shellBackground:"rgba(251, 251, 251, 0.98)",shellBorder:"rgba(15, 23, 42, 0.12)",divider:"rgba(15, 23, 42, 0.12)",panelBackground:"rgba(15, 23, 42, 0.03)",text:"#111827",mutedText:"#4b5563",errorText:"#dc2626",buttonText:"#374151",buttonMutedText:"#9ca3af",buttonActiveBackground:"rgba(15, 23, 42, 0.08)",buttonPlainHoverBackground:"rgba(15, 23, 42, 0.05)",filterButtonBackground:"transparent",filterButtonActiveBackground:"rgba(15, 23, 42, 0.16)",optionHoverBackground:"rgba(15, 23, 42, 0.03)",toggleTrackOff:"#d1d5db",toggleTrackOn:"#818cf8",toggleThumb:"#ffffff"}}isOpen(){return this.root.style.display!=="none"}restoreInputFocus(e){let n=this.input.selectionStart??this.input.value.length,i=this.input.selectionEnd??n;queueMicrotask(()=>{if(this.isOpen()){if(this.input.focus({preventScroll:!0}),e){this.input.select();return}this.input.setSelectionRange(n,i)}})}syncThemeUi(){let e=this.getPalette();this.root.style.colorScheme=e.colorScheme,this.root.style.background=e.shellBackground,this.root.style.borderColor=e.shellBorder,this.root.style.color=e.text,this.advancedPanel.style.background=e.panelBackground,this.advancedPanel.style.borderTop=this.optionsExpanded?`1px solid ${e.divider}`:"none",this.input.style.color=e.text,this.input.style.caretColor=e.text,this.status.style.color=e.mutedText,this.previousButton.style.color=e.buttonText,this.nextButton.style.color=e.buttonText,this.closeButton.style.color=e.buttonText,this.disclosureButton.style.color=e.buttonText,this.previousButton.style.background="transparent",this.nextButton.style.background="transparent",this.closeButton.style.background="transparent",this.disclosureButton.style.background=this.optionsExpanded?e.filterButtonActiveBackground:e.filterButtonBackground,this.syncOptionUi(),this.syncStatusUi()}syncOptionUi(){let e=this.getPalette();this.root.setAttribute("data-ed-open",this.isOpen()?"1":"0"),this.advancedPanel.style.display=this.optionsExpanded?"flex":"none",this.advancedPanel.style.borderTop=this.optionsExpanded?`1px solid ${e.divider}`:"none",this.disclosureButton.setAttribute("aria-label",this.optionsExpanded?"Hide advanced find options":"Show advanced find options");for(let[n,i]of Object.entries(this.optionButtons)){let r=this.options[n];i.setAttribute("aria-checked",r?"true":"false"),i.style.color=e.text,i.style.background="transparent";let a=this.optionTracks[n],o=this.optionThumbs[n];a.style.background=r?e.toggleTrackOn:e.toggleTrackOff,o.style.background=e.toggleThumb,o.style.transform=r?"translateX(12px)":"translateX(0)"}}syncStatusUi(){let e=this.getPalette();this.input.value.length===0?(this.status.textContent="",this.status.style.color=e.mutedText):this.matches.length===0||this.activeMatchIndex<0?(this.status.textContent="0/0",this.status.style.color=e.errorText):(this.status.textContent=`${String(this.activeMatchIndex+1)}/${String(this.matches.length)}`,this.status.style.color=e.mutedText);let i=this.matches.length>0,r=(a,o)=>{a.disabled=!i&&a!==this.disclosureButton&&a!==this.closeButton;let s=!a.disabled,l=a.dataset.edHovered==="1";a.style.opacity=s?"1":"0.45",a.style.cursor=s?"pointer":"default",o==="filter"?this.optionsExpanded?a.style.background=e.filterButtonActiveBackground:s&&l?a.style.background=e.buttonPlainHoverBackground:a.style.background=e.filterButtonBackground:a.style.background=s&&l?e.buttonPlainHoverBackground:"transparent",a.style.color=s?e.buttonText:e.buttonMutedText};r(this.previousButton,"plain"),r(this.nextButton,"plain"),r(this.disclosureButton,"filter"),r(this.closeButton,"plain")}show(){this.root.style.display="flex",this.root.setAttribute("data-ed-open","1"),this.syncThemeUi(),this.refreshMatches(!0),this.restoreInputFocus(!0)}hide(){this.root.style.display="none",this.root.setAttribute("data-ed-open","0"),this.previousButton.dataset.edHovered="0",this.nextButton.dataset.edHovered="0",this.disclosureButton.dataset.edHovered="0",this.closeButton.dataset.edHovered="0",this.runtime.openCanvasApi.setFindState(null)}refreshMatches(e){let n=this.input.value,i=e&&this.activeMatchIndex>=0?this.matches[this.activeMatchIndex]??null:null,r=this.runtime.openCanvasApi.findText(n,this.options);if(this.options={...r.options},this.matches=r.matches.map(a=>({...a})),this.matches.length===0){this.activeMatchIndex=-1,this.runtime.openCanvasApi.setFindState(null),this.syncOptionUi(),this.syncStatusUi(),this.restoreInputFocus(!1);return}if(i!==null){let a=this.matches.findIndex(o=>ji(o,i));this.activeMatchIndex=a>=0?a:0}else(this.activeMatchIndex<0||this.activeMatchIndex>=this.matches.length)&&(this.activeMatchIndex=0);this.applyCurrentState(!0)}step(e){if(this.matches.length===0){this.refreshMatches(!1);return}this.activeMatchIndex=(this.activeMatchIndex+e+this.matches.length)%this.matches.length,this.applyCurrentState(!0)}applyCurrentState(e){let n=this.matches.length===0||this.activeMatchIndex<0||this.activeMatchIndex>=this.matches.length?null:{query:this.input.value,options:{...this.options},matches:this.matches.map(i=>({...i})),activeMatchIndex:this.activeMatchIndex};(n===null||!this.runtime.openCanvasApi.setFindState(n,e))&&(this.matches=[],this.activeMatchIndex=-1,this.runtime.openCanvasApi.setFindState(null)),this.syncOptionUi(),this.syncStatusUi(),this.restoreInputFocus(!1)}};var Cn="effindom-pull-to-refresh";function Ji(){let t=document.getElementById(Cn);if(t instanceof HTMLDivElement){let i=t.firstElementChild;if(i instanceof HTMLSpanElement)return{root:t,icon:i};t.remove()}let e=document.createElement("div"),n=document.createElement("span");return e.id=Cn,e.hidden=!0,e.dataset.visible="false",e.dataset.armed="false",e.setAttribute("aria-hidden","true"),e.style.position="fixed",e.style.left="50%",e.style.top="12px",e.style.width="48px",e.style.height="48px",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.borderRadius="999px",e.style.background="rgba(248, 250, 252, 0.96)",e.style.color="#0f172a",e.style.boxShadow="0 10px 28px rgba(15, 23, 42, 0.22)",e.style.backdropFilter="blur(12px)",e.style.pointerEvents="none",e.style.opacity="0",e.style.transform="translate(-50%, -18px)",e.style.transition="opacity 120ms ease, transform 120ms ease",e.style.zIndex="2147483647",n.textContent="\u21BB",n.style.display="block",n.style.font='600 24px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',n.style.transform="rotate(0deg)",n.style.transition="transform 90ms linear",e.appendChild(n),(document.body??document.documentElement).appendChild(e),{root:e,icon:n}}function An(){let{root:t,icon:e}=Ji(),n=!1,i=0;return{show(r){i!==0&&(window.clearTimeout(i),i=0),n=!0;let a=Math.max(0,r),o=Math.max(0,Math.min(a/88,1)),s=Math.min(a*.75,78);t.hidden=!1,t.dataset.visible="true",t.dataset.armed=o>=1?"true":"false",t.style.transition="none",t.style.opacity=a<=0?"0":`${.15+o*.85}`,t.style.transform=`translate(-50%, ${s-18}px)`,t.style.background=o>=1?"rgba(219, 234, 254, 0.98)":"rgba(248, 250, 252, 0.96)",e.style.transform=`rotate(${Math.round(o*360)}deg)`},hide(r=!1){if(!(!n&&t.hidden)){if(n=!1,t.dataset.visible="false",t.dataset.armed="false",t.style.transition=r?"none":"opacity 90ms ease-out, transform 90ms ease-out, background 90ms ease-out",t.style.opacity="0",t.style.transform="translate(-50%, -18px)",t.style.background="rgba(248, 250, 252, 0.96)",e.style.transform="rotate(0deg)",r){i!==0&&(window.clearTimeout(i),i=0),t.hidden=!0;return}i=window.setTimeout(()=>{t.dataset.visible==="false"&&(t.hidden=!0),i=0},100)}},destroy(){i!==0&&window.clearTimeout(i),t.remove()}}}function Ht(t){let e=t.getBoundingClientRect();(e.width<=0||e.height<=0)&&(t.style.width=`${String(320)}px`,t.style.height=`${String(220)}px`)}function We(t){let e=t.closest("[data-effindom-canvas-size-source]");return e instanceof HTMLElement?e:t}function $e(t){let e=We(t);if(e.clientWidth>0&&e.clientHeight>0)return{width:e.clientWidth,height:e.clientHeight};let n=Number.parseFloat(t.style.width),i=Number.parseFloat(t.style.height);return Number.isFinite(n)&&n>0&&Number.isFinite(i)&&i>0?{width:n,height:i}:{width:t.clientWidth||320,height:t.clientHeight||220}}function Mt(t,e){let n=We(t),i=n.getBoundingClientRect(),r=$e(t),a=i.left+n.clientLeft,o=i.top+n.clientTop,s=n.clientWidth||i.width-(n.clientLeft+n.clientLeft)||320,l=n.clientHeight||i.height-(n.clientTop+n.clientTop)||220,c=s>0?(e.clientX-a)/s*r.width:0,d=l>0?(e.clientY-o)/l*r.height:0;return{x:c,y:d}}function ot(t,e){let n=We(t).getBoundingClientRect();return e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom}function In(t,e){let n=t.deltaX,i=t.deltaY;if(t.deltaMode===WheelEvent.DOM_DELTA_LINE)n*=16,i*=16;else if(t.deltaMode===WheelEvent.DOM_DELTA_PAGE){let r=$e(e);n*=r.width,i*=r.height}return t.shiftKey&&Math.abs(n)<.001&&Math.abs(i)>0?{x:i,y:0}:{x:n,y:i}}var at=1,Qi=2;function Zi(){return BigInt(Math.floor(performance.now()))}function er(t){return t==="ArrowUp"||t==="ArrowDown"||t==="PageUp"||t==="PageDown"||t==="Home"||t==="End"}function Pn(t){return t==="ArrowLeft"||t==="ArrowRight"||t==="ArrowUp"||t==="ArrowDown"||t==="PageUp"||t==="PageDown"||t==="Home"||t==="End"}function kn(t,e,n){let{ui:i}=t,r=y=>u=>{if(n.consumeGlobalKeyEvent(u,y===at?"down":"up"))return;let F=ze(u),h=e.getActiveTextHandle(),g=e.getActiveTextEditable(),w=e.getActiveTextMultiline(),S=e.isActiveTextInputFocused(),b=h!==null&&g&&S&&!u.ctrlKey&&!u.metaKey&&!u.altKey&&(u.key.length===1||w&&u.key==="Enter"||u.key==="Backspace"||u.key==="Delete"),x=h!==null&&g&&!S&&!u.ctrlKey&&!u.metaKey&&!u.altKey&&(u.key.length===1||w&&u.key==="Enter"||u.key==="Backspace"||u.key==="Delete");if(b){y===at&&(u.key==="Backspace"||u.key==="Delete")&&e.applyActiveTextDeletion(u.key==="Delete")&&u.preventDefault();return}let v=h!==null&&Pn(u.key),C=h!==null&&!g&&(u.key.length===1||u.key==="Backspace"||u.key==="Delete"||Pn(u.key));(x||v||C)&&u.preventDefault(),i._ui_set_interaction_time(Zi()),(u.key==="Tab"||(u.ctrlKey||u.metaKey)&&(u.key==="c"||u.key==="C"||u.key==="a"||u.key==="A"||u.key==="x"||u.key==="X"||u.key==="v"||u.key==="V"||u.key==="z"||u.key==="Z"||u.key==="y"||u.key==="Y"))&&u.preventDefault();let B=Ce(i,u.key),p=!1;try{i._ui_on_key_event(y,B.ptr,B.len,F),!x&&!v&&!C&&(p=window.__effindomCallbacks?.onKeyEventWithKey?.(y,u.key,F)===!0)}finally{B.dispose()}y===at&&(p||!u.ctrlKey&&!u.altKey&&!u.metaKey&&er(u.key))&&u.preventDefault(),t.commitFrame(),e.getActiveTextHandle()!==null&&!e.isActiveTextInputFocused()&&e.refocusActiveTextInput()},a=r(at),o=r(Qi),s=!0,l=()=>{requestAnimationFrame(()=>{t.syncFindSelection(!0)})},c=()=>{if(e.getActiveTextHandle()===null){l();return}i._ui_request_focus(0n),t.commitFrame(),l()},d=()=>{l()},f=()=>{t.updateCanvasSize(),t.commitFrame()};return window.addEventListener("keydown",a,s),window.addEventListener("keyup",o,s),window.addEventListener("blur",c),window.addEventListener("focus",d),window.addEventListener("resize",f),()=>{window.removeEventListener("keydown",a,s),window.removeEventListener("keyup",o,s),window.removeEventListener("blur",c),window.removeEventListener("focus",d),window.removeEventListener("resize",f)}}function qe(t){return t.uiHasPendingVisualWork()?(t.commitFrame(),!0):!1}var st=class{constructor(e){this.flushMove=e;this.pendingMove=null;this.frameScheduled=!1}enqueue(e){this.pendingMove=e,this.scheduleFlush()}takePending(){let e=this.pendingMove;return this.pendingMove=null,e}clear(){this.pendingMove=null}scheduleFlush(){this.frameScheduled||(this.frameScheduled=!0,requestAnimationFrame(()=>{this.frameScheduled=!1;let e=this.pendingMove;this.pendingMove=null,e!==null&&(this.flushMove(e),this.pendingMove!==null&&this.scheduleFlush())}))}};function tr(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function Rn(t,e,n){let i=t.getSemanticTree();for(let r=i.length-1;r>=0;r-=1){let a=i[r];if(a?.roleName==="textbox"&&tr(a.bounds,e,n))return z(a.handle)}return 0n}function Ie(t,e){if(t===null)return e.type==="press-start"?{pointerId:e.pointerId,phase:"pressed",startX:e.x,startY:e.y,lastX:e.x,lastY:e.y,startedOnTextbox:e.startedOnTextbox,pendingTapTextHandle:e.pendingTextHandle,axisMode:null,pullToRefreshEligible:!1,pullToRefreshCaptured:!1,pullToRefreshDistance:0}:null;switch(t.phase){case"pressed":switch(e.type){case"scroll-threshold-crossed":{let n=e.axis;return{...t,phase:"scrolling",axisMode:n,pullToRefreshEligible:n==="y",pendingTapTextHandle:null}}case"move":return{...t,lastX:e.x,lastY:e.y};case"cancel":case"ended":return null;default:return t}case"scrolling":switch(e.type){case"move":return{...t,lastX:e.x,lastY:e.y};case"axis-unlocked":return{...t,axisMode:"xy",pullToRefreshEligible:!1,pullToRefreshCaptured:!1,pullToRefreshDistance:0};case"pull-to-refresh-captured":return{...t,pullToRefreshCaptured:!0};case"pull-to-refresh-released":return{...t,pullToRefreshCaptured:!1,pullToRefreshDistance:0};case"cancel":case"ended":return null;default:return t}}}var he=1,fe=2,xe=3,pe=5,Hn=30,Mn=8,Bn=1.25,Bt=32,nr=.72,On=8;function ir(t,e){let n=Math.abs(t),i=Math.abs(e);return n>=i*Bn?"x":i>=n*Bn?"y":n>=i?"x":"y"}function rr(t,e,n){if(t===null||t==="xy")return!1;let i=t==="x"?e:n,r=t==="x"?n:e;return i<Bt||r<Bt?!1:r>=Bt&&r>=i*nr}function Pe(){return BigInt(Math.floor(performance.now()))}function Wn(t,e){let n=e.toString();return t.getSemanticTree().find(r=>r.handle===n)?.roleName??null}function Nn(t,e,n){let{canvas:i,ui:r}=t,a=!1,o=null,s=null,l=!1,c=null,d=null,f={x:0,y:0},y=(m,L)=>{!a||c==="touch"||z(r._ui_selection_autoscroll(m,L,Hn))!==0n&&(t.flushPendingCommit(),t.requestFrame())},u=m=>{if(e.setPointerInsideCanvas(m.pointerInsideCanvas),e.setLastPointerClientPosition(m.clientX,m.clientY),e.setLastPointerPosition(m.x,m.y),e.setLastPointerModifiers(m.modifiers),r._ui_set_interaction_time(Pe()),r._ui_on_pointer_event(xe,m.handle,m.x,m.y),qe(t),m.handle===0n){let L=t.getCapturedPointerHandle();L!==null&&window.__effindomCallbacks?.onPointerEventWithCoords?.(xe,L,m.x,m.y,m.modifiers)}y(m.x,m.y),h()},F=new st(u),h=()=>{l||!a||c==="touch"||(l=!0,requestAnimationFrame(()=>{if(l=!1,!a)return;let{x:m,y:L}=e.getLastPointerPosition();z(r._ui_selection_autoscroll(m,L,Hn))!==0n&&(t.commitFrame(),t.flushPendingCommit(),t.requestFrame(),h())}))},g=m=>{i.hasPointerCapture(m)&&i.releasePointerCapture(m)},w=m=>{try{i.setPointerCapture(m)}catch{}},S=(m,L)=>{let R=e.getCapturedPointerHandle();e.setCapturedPointerHandle(null),a=!1,o=null,c=null,F.clear(),r._ui_set_interaction_time(Pe()),r._ui_on_pointer_event(pe,R??0n,m,L),t.commitFrame()},b=(m,L,R)=>{if(m.pointerType!=="touch"||d?.pointerId!==m.pointerId)return!1;let V=L.x-d.startX,te=L.y-d.startY,O=V*V+te*te;if(d.phase==="pressed"){if(O<Mn*Mn)return m.preventDefault(),!0;let be=ir(V,te);if(d=Ie(d,{type:"scroll-threshold-crossed",axis:be}),d===null)return!0;e.cancelTouchTextFocusDeferral(),S(L.x,L.y),r._ui_touch_scroll_begin(t.getHandleFromPoint(d.startX,d.startY),d.startX,d.startY),f={x:0,y:0}}let Q=d;if(d=Ie(d,{type:"move",x:L.x,y:L.y}),d===null)return!0;let Ee=Q.lastX-L.x,X=Q.lastY-L.y,ie=Math.abs(Ee),Te=Math.abs(X);if(ie>=On&&Te>=On?(f.x+=ie,f.y+=Te):f={x:0,y:0},rr(d.axisMode,f.x,f.y)){if(d=Ie(d,{type:"axis-unlocked"}),d===null)return!0;f={x:0,y:0}}let K=d.axisMode==="x"||d.axisMode==="xy"?Ee:0,Se=d.axisMode==="y"||d.axisMode==="xy"?X:0;!d.startedOnTextbox&&!d.pullToRefreshCaptured&&d.pullToRefreshEligible&&te>0&&r._ui_touch_scroll_allows_pull_to_refresh()!==0&&(d=Ie(d,{type:"pull-to-refresh-captured"})??d);let ye=d.pullToRefreshCaptured?0:Se;e.setPointerInsideCanvas(ot(i,m)),e.setLastPointerClientPosition(m.clientX,m.clientY),e.setLastPointerPosition(L.x,L.y),e.setLastPointerModifiers(R),r._ui_set_interaction_time(Pe()),r._ui_on_pointer_event(xe,t.getHandleFromPoint(L.x,L.y),L.x,L.y),r._ui_touch_scroll_update(K,ye);let Ke=d.pullToRefreshCaptured?Math.max(0,te):0;return d.pullToRefreshDistance=Ke,d.pullToRefreshCaptured?n.show(Ke):n.hide(),t.commitFrame(),m.preventDefault(),!0},x=(m,L=!0)=>R=>{let V=ze(R),te=m===pe?!1:ot(i,R),O=Mt(i,R);if(R.pointerType==="touch"&&R.cancelable&&R.preventDefault(),m===he&&R.button===2){window.__effindomCallbacks?.onBeforeContextMenuHitTest?.();let Y=t.getHandleFromPoint(O.x,O.y),ge=e.getActiveTextHandle(),we=ge!==null&&Y===ge;s=R.pointerId,e.setPointerInsideCanvas(te),e.setLastPointerClientPosition(R.clientX,R.clientY),e.setLastPointerPosition(O.x,O.y),e.setLastPointerModifiers(V),we||i.focus({preventScroll:!0}),r._ui_set_interaction_time(Pe()),window.__effindomCallbacks?.onContextMenu?.(Y,O.x,O.y),we&&e.refocusActiveTextInput(),R.preventDefault();return}if(s===R.pointerId){e.setPointerInsideCanvas(te),e.setLastPointerClientPosition(R.clientX,R.clientY),e.setLastPointerPosition(O.x,O.y),e.setLastPointerModifiers(V),(m===fe||m===pe)&&(s=null),R.preventDefault();return}let Q=R.pointerType==="touch",Ee=R.type==="pointercancel",X=null,ie=!1;if(m===he)w(R.pointerId),a=!0,o=R.pointerId,c=R.pointerType,Q&&(r._ui_clear_momentum_scroll(),d=Ie(null,{type:"press-start",pointerId:R.pointerId,x:O.x,y:O.y,startedOnTextbox:!1,pendingTextHandle:null}),f={x:0,y:0});else if(d!==null&&d.pointerId===R.pointerId){if(m===xe&&b(R,O,V))return;if(m===fe||m===pe){let Y=d.pendingTapTextHandle,ge=Ee||m===pe,we=d.phase==="scrolling",_=d.pullToRefreshDistance;d=Ie(d,{type:ge?"cancel":"ended",triggered:!1});let A=we&&_>=88;if(we){e.cancelTouchTextFocusDeferral(),e.setCapturedPointerHandle(null),a=!1,o=null,c=null,F.clear(),r._ui_touch_scroll_end(),A?(n.hide(!0),window.location.reload()):n.hide(),g(R.pointerId),R.preventDefault();return}ge||m!==fe?(e.cancelTouchTextFocusDeferral(),ie=!0):X=Y,n.hide(!0)}}let Te=e.getCapturedPointerHandle(),K=e.getActiveTextHandle(),Se=L?t.getHandleFromPoint(O.x,O.y):0n,ye=(m===he||K!==null)&&L?Rn(t,O.x,O.y):0n,be=ye!==0n&&(Se===0n||Wn(t,Se)!=="textbox")&&(m===he||ye===K||ye===Te)?ye:Se,J=m===he||L&&te?be:Te??be,Me=m===he&&K!==null&&J===K&&!Q,Ye=m===he&&K!==null&&J!==K,vt=m===he&&Q&&K!==null&&J===K&&e.isActiveTextInputFocused(),Et=m===fe&&K!==null&&J===K&&!Q,je=Q&&m===fe&&!ie&&X!==null&&J===X;if(m===fe||m===pe){let Y=F.takePending();Y!==null&&u(Y)}if(m===he){if(Q){let Y=Wn(t,J)==="textbox"?J:0n;if(Y!==0n){let ge=K!==null&&Y===K&&e.isActiveTextInputFocused();d!==null&&(d.startedOnTextbox=!0,d.pendingTapTextHandle=ge?null:Y),e.beginTouchTextFocusDeferral(Y)}else e.cancelTouchTextFocusDeferral()}e.setPointerInsideCanvas(te),e.setLastPointerClientPosition(R.clientX,R.clientY),e.setLastPointerPosition(O.x,O.y),e.setLastPointerModifiers(V),!Me&&!Ye&&!vt&&i.focus({preventScroll:!0}),e.setCapturedPointerHandle(J===0n?null:J),r._ui_set_interaction_time(Pe()),r._ui_on_pointer_event(m,J,O.x,O.y),t.commitFrame(),Ye&&e.getActiveTextHandle()===null&&i.focus({preventScroll:!0}),(Me||!Q&&e.getActiveTextHandle()!==null&&!e.isActiveTextInputFocused())&&e.refocusActiveTextInput(),h()}else if(m===xe){F.enqueue({handle:J,x:O.x,y:O.y,clientX:R.clientX,clientY:R.clientY,pointerInsideCanvas:te,modifiers:V});return}else{if(e.setPointerInsideCanvas(te),e.setLastPointerClientPosition(R.clientX,R.clientY),e.setLastPointerPosition(O.x,O.y),e.setLastPointerModifiers(V),r._ui_set_interaction_time(Pe()),r._ui_on_pointer_event(m,J,O.x,O.y),t.commitFrame(),je?e.commitTouchTextFocusDeferral(J):(Et||!Q&&e.getActiveTextHandle()!==null&&!e.isActiveTextInputFocused())&&e.refocusActiveTextInput(),Q&&m===fe&&!je&&e.cancelTouchTextFocusDeferral(),J===0n){let Y=t.getCapturedPointerHandle();Y!==null&&window.__effindomCallbacks?.onPointerEventWithCoords?.(m,Y,O.x,O.y,V)}h()}(m===fe||m===pe)&&(a=!1,o=null,c=null,e.setCapturedPointerHandle(null)),(m===fe||m===pe)&&g(R.pointerId)},v=m=>{m.preventDefault()},C=x(he),H=x(fe),B=x(xe),p=m=>{if(i.hasPointerCapture(m.pointerId)){a&&x(xe,!1)(m);return}x(pe,!1)(m)},T=m=>{p(m)},E=m=>{p(m)},N=m=>{x(pe,!1)(m)},M=m=>a&&o!==null&&m.pointerId===o&&m.target!==i,$=m=>{M(m)&&B(m)},P=m=>{M(m)&&H(m)},D=m=>{M(m)&&N(m)},ee=m=>{m.preventDefault();let L=Mt(i,m);e.setPointerInsideCanvas(ot(i,m)),e.setLastPointerClientPosition(m.clientX,m.clientY),e.setLastPointerPosition(L.x,L.y),e.setLastPointerModifiers(ze(m)),r._ui_set_interaction_time(Pe());let R=t.getHandleFromPoint(L.x,L.y);r._ui_on_pointer_event(xe,R,L.x,L.y);let V=In(m,i);r._ui_on_wheel_event(V.x,V.y),qe(t)};return i.addEventListener("contextmenu",v),i.addEventListener("pointerdown",C,{passive:!1}),i.addEventListener("pointerup",H,{passive:!1}),i.addEventListener("pointermove",B,{passive:!1}),i.addEventListener("pointerleave",T,{passive:!1}),i.addEventListener("pointerout",E,{passive:!1}),i.addEventListener("pointercancel",N,{passive:!1}),window.addEventListener("pointermove",$,{passive:!1}),window.addEventListener("pointerup",P,{passive:!1}),window.addEventListener("pointercancel",D,{passive:!1}),i.addEventListener("wheel",ee,{passive:!1}),()=>{i.removeEventListener("contextmenu",v),i.removeEventListener("pointerdown",C),i.removeEventListener("pointerup",H),i.removeEventListener("pointermove",B),i.removeEventListener("pointerleave",T),i.removeEventListener("pointerout",E),i.removeEventListener("pointercancel",N),window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",D),i.removeEventListener("wheel",ee)}}function or(){return window.matchMedia("(pointer: coarse)").matches||navigator.maxTouchPoints>0}function Dn(t,e){let{canvas:n,ui:i}=t,r=new rt(t,n),a=An(),o=window.matchMedia("(pointer: coarse)");n.tabIndex=0,n.style.touchAction="none",n.style.outline="none";let s=()=>{i._ui_set_coarse_pointer_mode(or()?1:0)},l=()=>{i._ui_set_platform_family(kt())};s(),l(),o.addEventListener?.("change",s);let c=Nn(t,e,a),d=kn(t,e,r);return()=>{d(),c(),r.destroy(),a.destroy(),o.removeEventListener?.("change",s)}}var Un=[{id:1,assetFile:"NotoSans-Regular.ttf",fallbackIds:[4,3],preload:!0},{id:2,assetFile:"NotoSans-Bold.ttf",fallbackIds:[4,3],preload:!0},{id:9,assetFile:"NotoSans-Italic.ttf",fallbackIds:[4,3],preload:!0},{id:10,assetFile:"NotoSans-BoldItalic.ttf",fallbackIds:[4,3],preload:!0},{id:3,assetFile:"NotoSansSymbols2-Regular.ttf",fallbackIds:[],preload:!0},{id:4,assetFile:"NotoEmoji-Regular.ttf",fallbackIds:[],preload:!0},{id:5,assetFile:"NotoSansMono-Regular.ttf",fallbackIds:[4,3],preload:!1},{id:6,assetFile:"NotoSansMono-Bold.ttf",fallbackIds:[4,3],preload:!1}],Kn=Un.filter(t=>t.preload);function lt(t){return Un.find(e=>e.id===t)}function ar(){let e=window.__effindomRuntime?.manifestUrl;if(typeof e=="string"&&e.length>0)return new URL("./",new URL(e,document.baseURI)).toString();let n=document.currentScript;return n instanceof HTMLScriptElement&&n.src.length>0?new URL("./",n.src).toString():new URL("./",document.baseURI).toString()}function Ne(t){return new URL(`../fonts/${t}`,ar()).toString()}var sr=new TextDecoder;function lr(t,e){let n=document.createElement("canvas");return n.width=t,n.height=e,n}async function Gn(t){if(createImageBitmap===void 0)throw new Error("createImageBitmap is unavailable for texture decoding.");return await createImageBitmap(t)}function zn(t){let n=lr(t.width,t.height).getContext("2d",{willReadFrequently:!0});if(n===null)throw new Error("Failed to allocate a 2D canvas for texture decoding.");n.clearRect(0,0,t.width,t.height),n.drawImage(t,0,0);let i=n.getImageData(0,0,t.width,t.height);return new Uint8Array(i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength))}function $n(t){if(t===null)return null;let e=t.trim();if(e.length===0)return null;let i=/^([+-]?(?:\d+\.?\d*|\.\d+))/.exec(e)?.[1];if(i===void 0)return null;let r=Number.parseFloat(i);return Number.isFinite(r)&&r>0?r:null}function dr(t){if(t===null)return null;let e=t.trim().split(/[\s,]+/).map(r=>Number.parseFloat(r)).filter(r=>Number.isFinite(r));if(e.length!==4)return null;let n=e[2],i=e[3];return n===void 0||i===void 0||n<=0||i<=0?null:{width:n,height:i}}function cr(t){let e=sr.decode(t),n=new DOMParser().parseFromString(e,"image/svg+xml").documentElement,i=$n(n.getAttribute("width")),r=$n(n.getAttribute("height"));if(i!==null&&r!==null)return{width:i,height:r};let a=dr(n.getAttribute("viewBox"));return a!==null?a:{width:1,height:1}}var dt=class{constructor(e,n,i){this.core=e;this.fontManager=n;this.onCommitFrame=i;this.loadedSvgs=new Map;this.loadedTextures=new Map}async loadSvg(e,n){this.loadedSvgs.set(e,n);let i=await fetch(n);if(!i.ok)throw new Error(`Failed to fetch SVG ${n}: ${String(i.status)}`);let r=new Uint8Array(await i.arrayBuffer()),a=cr(r),o=me(this.core,r);try{this.core._ed_register_svg(e,o.ptr,o.len)}finally{o.dispose()}return this.onCommitFrame(),a}async loadTexture(e,n){this.loadedTextures.set(e,n);let i=await fetch(n);if(!i.ok)throw new Error(`Failed to fetch texture ${n}: ${String(i.status)}`);let r=await i.blob(),a=await Gn(r),o=a.width,s=a.height;try{let l=zn(a),c=me(this.core,l);try{this.core._ed_register_texture_rgba(e,c.ptr,o,s,c.len)}finally{c.dispose()}}finally{a.close?.()}return this.onCommitFrame(),{width:o,height:s}}releaseSvg(e){this.loadedSvgs.delete(e)}releaseTexture(e){this.loadedTextures.delete(e),this.core._ed_unregister_texture(e),this.onCommitFrame()}async replayLoadedAssets(){await Promise.all([this.fontManager.replayLoadedFonts(),...Array.from(this.loadedSvgs.entries(),async([e,n])=>{let i=await fetch(n);if(!i.ok)throw new Error(`Failed to refetch SVG ${n}: ${String(i.status)}`);let r=new Uint8Array(await i.arrayBuffer()),a=me(this.core,r);try{this.core._ed_register_svg(e,a.ptr,a.len)}finally{a.dispose()}}),...Array.from(this.loadedTextures.entries(),async([e,n])=>{let i=await fetch(n);if(!i.ok)throw new Error(`Failed to refetch texture ${n}: ${String(i.status)}`);let r=await i.blob(),a=await Gn(r);try{let o=zn(a),s=me(this.core,o);try{this.core._ed_register_texture_rgba(e,s.ptr,a.width,a.height,s.len)}finally{s.dispose()}}finally{a.close?.()}})])}};var Vn="https://fonts.googleapis.com",ur="https://fonts.gstatic.com";function qn(t,e,n){if(document.head.querySelector(`link[rel="${t}"][href="${e}"]`)instanceof HTMLLinkElement)return;let r=document.createElement("link");r.rel=t,r.href=e,n!==void 0&&(r.crossOrigin=n),document.head.appendChild(r)}function mr(){qn("preconnect",Vn),qn("preconnect",ur,"anonymous")}function hr(t,e){let n=new URLSearchParams;return n.set("family",`${t}:wght@400`),n.set("text",e),n.set("display","swap"),`${Vn}/css2?${n.toString()}`}function fr(t){let e=/src:\s*url\(([^)]+)\)\s*format\((['"]?)(woff2|woff|truetype|opentype)\2\)/.exec(t);if(e?.[1]===void 0)throw new Error("Google Fonts stylesheet did not expose a usable shard URL.");return e[1].trim()}async function Xn(t,e){mr();let n=hr(t,e),i=await fetch(n,{mode:"cors"});if(!i.ok)throw new Error(`Failed to fetch Google Fonts stylesheet ${n}: ${String(i.status)}`);let r=fr(await i.text()),a=await fetch(r);if(!a.ok)throw new Error(`Failed to fetch font ${r}: ${String(a.status)}`);return{url:r,bytes:new Uint8Array(await a.arrayBuffer())}}var pr=1,gr=2,Ve=3,jn=4,yr=new Set([1,2,9,10,5,6]),Yn=[{familyKey:"hebrew",googleFamily:"Noto Sans Hebrew",ranges:[[1424,1535]]},{familyKey:"armenian",googleFamily:"Noto Sans Armenian",ranges:[[1328,1423]]},{familyKey:"georgian",googleFamily:"Noto Sans Georgian",ranges:[[4256,4351],[11520,11567]]},{familyKey:"devanagari",googleFamily:"Noto Sans Devanagari",ranges:[[2304,2431]]},{familyKey:"bengali",googleFamily:"Noto Sans Bengali",ranges:[[2432,2559]]},{familyKey:"gurmukhi",googleFamily:"Noto Sans Gurmukhi",ranges:[[2560,2687]]},{familyKey:"gujarati",googleFamily:"Noto Sans Gujarati",ranges:[[2688,2815]]},{familyKey:"oriya",googleFamily:"Noto Sans Oriya",ranges:[[2816,2943]]},{familyKey:"tamil",googleFamily:"Noto Sans Tamil",ranges:[[2944,3071]]},{familyKey:"telugu",googleFamily:"Noto Sans Telugu",ranges:[[3072,3199]]},{familyKey:"kannada",googleFamily:"Noto Sans Kannada",ranges:[[3200,3327]]},{familyKey:"malayalam",googleFamily:"Noto Sans Malayalam",ranges:[[3328,3455]]},{familyKey:"sinhala",googleFamily:"Noto Sans Sinhala",ranges:[[3456,3583]]},{familyKey:"lao",googleFamily:"Noto Sans Lao",ranges:[[3712,3839]]},{familyKey:"myanmar",googleFamily:"Noto Sans Myanmar",ranges:[[4096,4255]]},{familyKey:"khmer",googleFamily:"Noto Sans Khmer",ranges:[[6016,6143]]},{familyKey:"ethiopic",googleFamily:"Noto Sans Ethiopic",ranges:[[4608,4991],[4992,5023],[11648,11743]]}];function br(t,e){return e.some(([n,i])=>t>=n&&t<=i)}function Ot(t){let e=new Set,n=[];for(let i of t)e.has(i)||(e.add(i),n.push(i));return n}function _r(t){return t>=12288&&t<=12351||t>=65281&&t<=65295||t>=65306&&t<=65312||t>=65339&&t<=65344||t>=65371&&t<=65381}function ke(t,e,n,i,r){if(r.length===0)return null;let a=r.join("");return{packageId:t,coverageKind:e,familyKey:n,googleFamily:i,text:a}}function xr(t){let e=Ot(t),n=[],i=[],r=[],a=[];for(let s of e){let l=s.codePointAt(0);if(l!==void 0){if(_r(l)){a.push(s);continue}if(l>=12352&&l<=12543||l>=12784&&l<=12799){n.push(s);continue}if(l>=44032&&l<=55215){i.push(s);continue}(l>=13312&&l<=19903||l>=19968&&l<=40959||l>=63744&&l<=64255)&&r.push(s)}}let o=[];return n.length>0&&o.push(ke("cjk-sans",Ve,"cjk-jp","Noto Sans JP",[...n,...r,...a])),i.length>0&&o.push(ke("cjk-sans",Ve,"cjk-kr","Noto Sans KR",[...i,...n.length===0?r:[],...a])),r.length>0&&n.length===0&&i.length===0&&o.push(ke("cjk-sans",Ve,"cjk-sc","Noto Sans SC",[...r,...a])),o.length===0&&a.length>0&&o.push(ke("cjk-sans",Ve,"cjk-sc","Noto Sans SC",a)),o}function vr(t){let e=Ot(t),n=new Map;for(let i of e){let r=i.codePointAt(0);if(r===void 0)continue;let a=Yn.find(s=>br(r,s.ranges));if(a===void 0)continue;let o=n.get(a.familyKey)??[];o.push(i),n.set(a.familyKey,o)}return Yn.map(i=>ke("supplemental-sans",jn,i.familyKey,i.googleFamily,n.get(i.familyKey)??[])).filter(i=>i!==null)}function Jn(t,e,n){if(!yr.has(t)||n.length===0)return[];let i=Ot(n).join("");return i.length===0?[]:e===pr?[ke("arabic-sans",e,"arabic-core","Noto Naskh Arabic",Array.from(i))]:e===gr?[ke("thai-sans",e,"thai-core","Noto Sans Thai",Array.from(i))]:e===Ve?xr(i):e===jn?vr(i):[]}var Wt={autoGrow:!0,maxCachedShardFonts:8,allowedFontIds:null,blockedPackageIds:null},ct=class{constructor(e,n,i,r){this.core=e;this.ui=n;this.logs=i;this.onCommitFrame=r;this.loadedFonts=new Map;this.fontLoadStates=new Map;this.incrementalFontStates=new Map;this.fontFallbacks=new Map;this.lazyFontSources=new Map;this.pendingFontLoads=new Map;this.pendingIncrementalShardLoads=new Map;this.pendingIncrementalFamilyRequests=new Map;this.scheduledIncrementalFamilyFlushes=new Set;this.incrementalShardCache=new Map;this.shardKeysByPrimaryFont=new Map;this.evictedShardKeys=[];this.nextIncrementalFontId=2130706688;this.shardAccessTick=0;this.incrementalFontPolicy=Wt;this.normalizedIncrementalFontPolicy={autoGrow:Wt.autoGrow,maxCachedShardFonts:Wt.maxCachedShardFonts,allowedFontIds:null,blockedPackageIds:null}}normalizePolicy(e){return{autoGrow:e.autoGrow,maxCachedShardFonts:Math.max(1,Math.floor(e.maxCachedShardFonts)),allowedFontIds:e.allowedFontIds===null?null:new Set(e.allowedFontIds),blockedPackageIds:e.blockedPackageIds===null?null:new Set(e.blockedPackageIds)}}registerFontBytes(e,n){let i=me(this.core,n),r=me(this.ui,n);try{if(this.core._ed_register_font(e,i.ptr,i.len),this.ui._ui_register_font(e,r.ptr,r.len)===0)throw new Error(`Ui rejected font ${String(e)}.`);this.ui._ui_font_loaded(e)}finally{i.dispose(),r.dispose()}}unregisterFont(e){this.core._ed_unregister_font(e),this.ui._ui_unregister_font(e),this.loadedFonts.delete(e),this.fontLoadStates.delete(e)}updateShardAccess(e){let n=this.incrementalShardCache.get(e);n!==void 0&&(this.shardAccessTick+=1,n.lastAccessTick=this.shardAccessTick)}getAutoGrowBlockReason(e,n){return this.normalizedIncrementalFontPolicy.autoGrow?this.normalizedIncrementalFontPolicy.allowedFontIds!==null&&!this.normalizedIncrementalFontPolicy.allowedFontIds.has(e)?"font-not-allowed":n!==null&&this.normalizedIncrementalFontPolicy.blockedPackageIds!==null&&this.normalizedIncrementalFontPolicy.blockedPackageIds.has(n)?"package-blocked":null:"auto-grow-disabled"}releasePrimaryFontShardReference(e,n,i){let r=this.ensureIncrementalFontState(e);r.appliedSegmentIds.delete(n),r.evictedSegmentIds.add(n),r.revision+=1;let a=this.shardKeysByPrimaryFont.get(e);a?.delete(n),a!==void 0&&a.size===0&&this.shardKeysByPrimaryFont.delete(e);let o=this.fontFallbacks.get(e);o!==void 0&&this.fontFallbacks.set(e,o.filter(s=>s!==i)),this.ui._ui_unregister_font_fallback(e,i),this.ui._ui_font_loaded(e)}evictIncrementalShard(e){let n=this.incrementalShardCache.get(e);if(n!==void 0){for(let i of n.primaryFontIds)this.releasePrimaryFontShardReference(i,e,n.fontId);this.incrementalShardCache.delete(e),this.evictedShardKeys.push(e),this.evictedShardKeys.length>32&&this.evictedShardKeys.splice(0,this.evictedShardKeys.length-32),this.unregisterFont(n.fontId),this.onCommitFrame()}}ensureShardCacheCapacityForNewEntry(){for(;this.incrementalShardCache.size>=this.normalizedIncrementalFontPolicy.maxCachedShardFonts;){let e=null;for(let n of this.incrementalShardCache.values())(e===null||n.lastAccessTick<e.lastAccessTick)&&(e=n);if(e===null)return;this.evictIncrementalShard(e.shardKey)}}trimShardCacheToPolicyLimit(){for(;this.incrementalShardCache.size>this.normalizedIncrementalFontPolicy.maxCachedShardFonts;){let e=null;for(let n of this.incrementalShardCache.values())(e===null||n.lastAccessTick<e.lastAccessTick)&&(e=n);if(e===null)return;this.evictIncrementalShard(e.shardKey)}}ensureIncrementalFontState(e){let n=this.incrementalFontStates.get(e);return n!==void 0||(n={sourceUrl:null,sourceState:"unknown",requestedSegmentIds:new Set,pendingSegmentIds:new Set,appliedSegmentIds:new Set,evictedSegmentIds:new Set,requestedCharactersByFamily:new Map,revision:0,blockedPackageIds:new Set,lastBlockedReason:null},this.incrementalFontStates.set(e,n)),n}rememberFontSource(e,n){let i=this.fontLoadStates.get(e);if(i!==void 0&&i.url===n&&(i.state==="loading"||i.state==="loaded"))return;this.fontLoadStates.set(e,{url:n,state:"known"});let r=this.ensureIncrementalFontState(e),a=r.sourceUrl;r.sourceUrl=n,(r.sourceState==="unknown"||r.sourceState==="failed"||a!==n)&&(r.sourceState="known")}markFontLoading(e,n){this.fontLoadStates.set(e,{url:n,state:"loading"});let i=this.ensureIncrementalFontState(e);i.sourceUrl=n,i.sourceState="loading"}markFontLoaded(e,n){this.fontLoadStates.set(e,{url:n,state:"loaded"});let i=this.ensureIncrementalFontState(e);i.sourceUrl=n,i.sourceState="loaded"}markFontLoadFailed(e,n){this.fontLoadStates.set(e,{url:n,state:"failed"});let i=this.ensureIncrementalFontState(e);i.sourceUrl=n,i.sourceState="failed"}isFontLoaded(e,n){let i=this.fontLoadStates.get(e);return i!==void 0&&i.state==="loaded"&&(n===void 0||i.url===n)}async fetchFontBytes(e,n=!1){let i=await fetch(e);if(!i.ok){let r=n?"refetch":"fetch";throw new Error(`Failed to ${r} font ${e}: ${String(i.status)}`)}return new Uint8Array(await i.arrayBuffer())}reportNonFatalFontError(e,n){let i=n instanceof Error?n.message:String(n);console.error(`[fui_host] ${e}: ${i}`)}applyFontFallbacks(e,n){this.fontFallbacks.set(e,[...n]);for(let i of n)this.ui._ui_register_font_fallback(e,i)}async ensureRegisteredFont(e,n,i=[]){this.rememberFontSource(e,n);let r=this.pendingFontLoads.get(e);if(r!==void 0){await r;return}let a=this.registerFont(i.length>0?{id:e,url:n,fallbackIds:i}:{id:e,url:n}).finally(()=>{this.pendingFontLoads.delete(e)});this.pendingFontLoads.set(e,a),await a}async ensureFontWithFallbacks(e,n=new Set){if(n.has(e))return;if(n.add(e),!this.isFontLoaded(e)){let r=this.lazyFontSources.get(e);if(r!==void 0)await this.ensureRegisteredFont(e,r);else{let a=lt(e);a!==void 0&&await this.ensureRegisteredFont(a.id,Ne(a.assetFile),a.fallbackIds)}}let i=this.fontFallbacks.get(e)??[];await Promise.all(i.map(r=>this.ensureFontWithFallbacks(r,n)))}registerSingleFontFallback(e,n){let i=this.fontFallbacks.get(e)??[];i.includes(n)||this.fontFallbacks.set(e,[...i,n]),this.ui._ui_register_font_fallback(e,n)}async ensureIncrementalShardFont(e){let n=this.incrementalShardCache.get(e.shardKey);if(n!==void 0)return this.updateShardAccess(e.shardKey),n.fontId;let i=this.pendingIncrementalShardLoads.get(e.shardKey);if(i!==void 0)return await i;let r=(async()=>{this.ensureShardCacheCapacityForNewEntry();let a=this.nextIncrementalFontId;this.nextIncrementalFontId+=1;let o=await Xn(e.googleFamily,e.text);return this.registerFontBytes(a,o.bytes),this.loadedFonts.set(a,o.url),this.markFontLoaded(a,o.url),this.shardAccessTick+=1,this.incrementalShardCache.set(e.shardKey,{shardKey:e.shardKey,fontId:a,sizeBytes:o.bytes.byteLength,primaryFontIds:new Set,lastAccessTick:this.shardAccessTick}),a})().finally(()=>{this.pendingIncrementalShardLoads.delete(e.shardKey)});return this.pendingIncrementalShardLoads.set(e.shardKey,r),await r}async flushPendingIncrementalFamilyRequest(e,n){let i=`${String(e)}:${n}`;this.scheduledIncrementalFamilyFlushes.delete(i);let r=this.pendingIncrementalFamilyRequests.get(i);if(r===void 0)return;this.pendingIncrementalFamilyRequests.delete(i);let a=this.ensureIncrementalFontState(e),o=Array.from(r.characters.values()).join("");if(o.length===0)return;let s=`${r.familyKey}:${o}`;a.requestedSegmentIds.add(s),a.pendingSegmentIds.add(s),this.logs.incrementalFontPackageRequests.push({primaryFontId:e,coverageKind:r.coverageKind,packageId:r.packageId,segmentIds:[s],sampleText:o});try{let l=await this.ensureIncrementalShardFont({packageId:r.packageId,coverageKind:r.coverageKind,familyKey:r.familyKey,googleFamily:r.googleFamily,text:o,shardKey:s});this.registerSingleFontFallback(e,l);let c=this.incrementalShardCache.get(s);c!==void 0&&(c.primaryFontIds.add(e),this.updateShardAccess(s));let d=this.shardKeysByPrimaryFont.get(e);d===void 0&&(d=new Set,this.shardKeysByPrimaryFont.set(e,d)),d.add(s),a.appliedSegmentIds.has(s)||(a.appliedSegmentIds.add(s),a.revision+=1),a.pendingSegmentIds.delete(s),a.evictedSegmentIds.delete(s),this.ui._ui_font_loaded(e),this.onCommitFrame()}catch(l){a.requestedSegmentIds.delete(s),a.pendingSegmentIds.delete(s);let c=a.requestedCharactersByFamily.get(r.familyKey);if(c!==void 0){for(let d of o)c.delete(d);c.size===0&&a.requestedCharactersByFamily.delete(r.familyKey)}throw this.reportNonFatalFontError(`incremental font shard fetch failed for ${r.googleFamily} (${s})`,l),l}}async ensureFont(e){await this.ensureFontWithFallbacks(e)}async ensureBuiltInFont(e){let n=lt(e);if(n===void 0)throw new Error(`Unknown built-in font id ${String(e)}.`);await this.ensureRegisteredFont(n.id,Ne(n.assetFile),n.fallbackIds)}getIncrementalFontCacheState(){return{maxCachedShardFonts:this.incrementalFontPolicy.maxCachedShardFonts,cachedShardCount:this.incrementalShardCache.size,cachedShardKeys:Array.from(this.incrementalShardCache.keys()),evictedShardKeys:[...this.evictedShardKeys]}}getIncrementalFontPolicy(){return{autoGrow:this.incrementalFontPolicy.autoGrow,maxCachedShardFonts:this.incrementalFontPolicy.maxCachedShardFonts,allowedFontIds:this.incrementalFontPolicy.allowedFontIds===null?null:[...this.incrementalFontPolicy.allowedFontIds],blockedPackageIds:this.incrementalFontPolicy.blockedPackageIds===null?null:[...this.incrementalFontPolicy.blockedPackageIds]}}setIncrementalFontPolicy(e){let n={autoGrow:e.autoGrow??this.incrementalFontPolicy.autoGrow,maxCachedShardFonts:e.maxCachedShardFonts??this.incrementalFontPolicy.maxCachedShardFonts,allowedFontIds:"allowedFontIds"in e?e.allowedFontIds??null:this.incrementalFontPolicy.allowedFontIds,blockedPackageIds:"blockedPackageIds"in e?e.blockedPackageIds??null:this.incrementalFontPolicy.blockedPackageIds};this.normalizedIncrementalFontPolicy=this.normalizePolicy(n),this.incrementalFontPolicy={...n,maxCachedShardFonts:this.normalizedIncrementalFontPolicy.maxCachedShardFonts},this.trimShardCacheToPolicyLimit()}getIncrementalFontState(e){let n=this.incrementalFontStates.get(e);return n===void 0?null:{fontId:e,sourceUrl:n.sourceUrl,sourceState:n.sourceState,loaded:this.isFontLoaded(e),requestedSegmentIds:Array.from(n.requestedSegmentIds.values()),pendingSegmentIds:Array.from(n.pendingSegmentIds.values()),appliedSegmentIds:Array.from(n.appliedSegmentIds.values()),evictedSegmentIds:Array.from(n.evictedSegmentIds.values()),revision:n.revision,autoGrowAllowed:this.getAutoGrowBlockReason(e,null)===null,blockedPackageIds:Array.from(n.blockedPackageIds.values()),lastBlockedReason:n.lastBlockedReason}}getClipboardFontUrl(e){let n=this.loadedFonts.get(e);if(n!==void 0)return n;let i=this.fontLoadStates.get(e)?.url;if(i!==void 0)return i;let r=this.lazyFontSources.get(e);if(r!==void 0)return r;let a=lt(e);return a===void 0?null:Ne(a.assetFile)}registerLazyFont(e,n){this.lazyFontSources.set(e,n),this.rememberFontSource(e,n),this.loadedFonts.get(e)!==n&&this.loadedFonts.delete(e)}registerFontFallback(e,n){this.registerSingleFontFallback(e,n)}handleMissingFontCoverage(e,n,i){let r=this.ensureIncrementalFontState(e),a=Jn(e,n,i);for(let o of a){let s=this.getAutoGrowBlockReason(e,o.packageId);if(s!==null){r.blockedPackageIds.add(o.packageId),r.lastBlockedReason=s;continue}r.blockedPackageIds.delete(o.packageId),r.blockedPackageIds.size===0&&(r.lastBlockedReason=null);let l=r.requestedCharactersByFamily.get(o.familyKey);l===void 0&&(l=new Set,r.requestedCharactersByFamily.set(o.familyKey,l));let c=`${String(e)}:${o.familyKey}`,d=this.pendingIncrementalFamilyRequests.get(c);d===void 0&&(d={packageId:o.packageId,coverageKind:o.coverageKind,familyKey:o.familyKey,googleFamily:o.googleFamily,characters:new Set},this.pendingIncrementalFamilyRequests.set(c,d));let f=!1;for(let y of o.text)l.has(y)||(l.add(y),d.characters.add(y),f=!0);!f||this.scheduledIncrementalFamilyFlushes.has(c)||(this.scheduledIncrementalFamilyFlushes.add(c),queueMicrotask(()=>{this.flushPendingIncrementalFamilyRequest(e,o.familyKey).catch(()=>{})}))}}async loadFont(e,n){if(!this.isFontLoaded(e,n)){this.rememberFontSource(e,n),this.markFontLoading(e,n);try{let i=await this.fetchFontBytes(n);this.registerFontBytes(e,i),this.loadedFonts.set(e,n),this.markFontLoaded(e,n),this.onCommitFrame()}catch(i){throw this.loadedFonts.get(e)===n&&this.loadedFonts.delete(e),this.markFontLoadFailed(e,n),i}}}async registerFont(e){this.isFontLoaded(e.id,e.url)||await this.loadFont(e.id,e.url),e.fallbackIds!==void 0&&this.applyFontFallbacks(e.id,e.fallbackIds),this.onCommitFrame()}async registerFontStack(e){let n=e.fallbacks??[];await Promise.all([this.loadFont(e.primary.id,e.primary.url),...n.map(i=>this.loadFont(i.id,i.url))]),this.applyFontFallbacks(e.primary.id,n.map(i=>i.id)),this.onCommitFrame()}async replayLoadedFonts(){let e=Array.from(this.loadedFonts.entries(),async([n,i])=>{let r=await this.fetchFontBytes(i,!0);this.registerFontBytes(n,r)});await Promise.all(e);for(let[n,i]of this.fontFallbacks.entries())for(let r of i)this.ui._ui_register_font_fallback(n,r)}};var Er=new TextEncoder;function Dt(t){return Er.encode(t).byteLength}function Qn(t){return t instanceof Element?t:t?.parentElement??null}function Nt(t,e){let n=Math.max(0,Math.min(e,t.length));return Dt(t.slice(0,n))}function Zn(t,e){let n=Math.max(0,Math.min(e,Dt(t))),i=0,r=0;for(;r<t.length;){let a=t.codePointAt(r)??0,o=r+(a>65535?2:1),s=Nt(t,o);if(s>n||(r=o,i=s,i===n))break}return r}function ei(t,e,n){let i=document.createRange();i.selectNodeContents(t);try{i.setEnd(e,n)}catch{return null}return i.toString().length}function Tr(t,e,n,i){let r=e.get(i.handle);if(r!==void 0)return r;let a=document.createElement("div");return a.setAttribute("data-ed-find-fragment","1"),a.setAttribute("data-ed-canvas-id",n),a.style.display="block",a.style.position="relative",a.style.whiteSpace="pre-wrap",a.style.wordBreak="break-word",a.style.pointerEvents="none",a.style.userSelect="text",t.appendChild(a),e.set(i.handle,a),a}var ut=class{constructor(e,n){this.elementsByHandle=new Map;let i=e.parentElement;if(!(i instanceof HTMLElement))throw new Error("Expected scene shell for Find-on-Page projection.");let r=document.createElement("div");r.id=`find-on-page-layer-${n}`,r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.pointerEvents="none",r.style.opacity="0",r.style.overflow="hidden",r.style.userSelect="text",r.setAttribute("aria-hidden","true"),r.setAttribute("data-ed-find-root","1"),r.setAttribute("data-ed-canvas-id",n);let a=document.createElement("div");a.id=`find-on-page-content-${n}`,a.style.position="absolute",a.style.left="0",a.style.top="0",a.style.width="100%",a.style.minHeight="100%",a.style.pointerEvents="none",a.style.userSelect="text",a.style.whiteSpace="pre-wrap",a.style.color="transparent",a.style.background="transparent",r.appendChild(a),i.appendChild(r),this.layer=r,this.content=a,this.canvasId=n}syncSize(e,n){let i=`${String(e)}px`,r=`${String(n)}px`;this.layer.style.width=i,this.layer.style.height=r}update(e){let n=new Set,i=[];for(let r of e){n.add(r.handle);let a=Tr(this.content,this.elementsByHandle,this.canvasId,r);a.setAttribute("data-ed-handle",r.handle),a.setAttribute("data-ed-start","0"),a.setAttribute("data-ed-end",String(Dt(r.text))),a.textContent!==r.text&&(a.textContent=r.text),i.push(a)}this.content.replaceChildren(...i);for(let[r]of this.elementsByHandle.entries())n.has(r)||this.elementsByHandle.delete(r)}resolveSelection(e){if(e===null||e.rangeCount===0||e.isCollapsed||document.activeElement?.getAttribute("data-effindom-hidden-editor")==="true")return null;let n=e.getRangeAt(0),i=Qn(n.startContainer),r=Qn(n.endContainer);if(i?.closest('[data-effindom-hidden-editor="true"]')!==null||r?.closest('[data-effindom-hidden-editor="true"]')!==null)return null;let a=i?.closest('[data-ed-find-root="1"]'),o=r?.closest('[data-ed-find-root="1"]'),s=i?.closest('[data-ed-find-fragment="1"]'),l=r?.closest('[data-ed-find-fragment="1"]');if(!(a instanceof HTMLElement)||!(o instanceof HTMLElement)||!(s instanceof HTMLElement)||!(l instanceof HTMLElement)||a!==o||s!==l||a.dataset.edCanvasId!==this.canvasId||s.dataset.edCanvasId!==this.canvasId)return null;let c=s.dataset.edHandle,d=Number(s.dataset.edStart),f=Number(s.dataset.edEnd);if(c===void 0||!Number.isFinite(d)||!Number.isFinite(f)||d<0||f<d)return null;let y=s.textContent??"",u=ei(s,n.startContainer,n.startOffset),F=ei(s,n.endContainer,n.endOffset);if(u===null||F===null)return null;let h=d+Nt(y,u),g=d+Nt(y,F);return h>=g||g>f?null:{handle:c,start:h,end:g}}selectMatch(e){let n=document.getSelection();if(n===null)return!1;if(e===null)return n.removeAllRanges(),!0;let i=this.elementsByHandle.get(e.handle);if(!(i instanceof HTMLElement))return!1;let r=Number(i.dataset.edStart),a=Number(i.dataset.edEnd);if(!Number.isFinite(r)||!Number.isFinite(a)||e.start<r||e.end>a||e.start>=e.end)return!1;let o=i.textContent??"",s=e.start-r,l=e.end-r,c=Zn(o,s),d=Zn(o,l),f=i.firstChild instanceof Text?i.firstChild:document.createTextNode(o);i.firstChild!==f&&i.replaceChildren(f);let y=document.createRange();return y.setStart(f,c),y.setEnd(f,d),n.removeAllRanges(),n.addRange(y),!0}destroy(){this.elementsByHandle.clear(),this.layer.remove()}};var Sr=4293606200,mt=class{constructor(e){this.options=e;this.activeFindMatch=null;this.activeFindState=null;this.selectionPollTimer=null;this.selectionClearTimer=null;let n=`ed-canvas-${Math.random().toString(36).slice(2,10)}`;this.findProjector=new ut(e.canvas,n),window.__bridgeFindMatch=null,window.__bridgeFindState=null;let i=()=>{this.handleSelectionChange()};document.addEventListener("selectionchange",i),this.selectionPollTimer=setInterval(()=>{document.hidden||this.handleSelectionChange()},100),this.destroy=(()=>{this.selectionPollTimer!==null&&(clearInterval(this.selectionPollTimer),this.selectionPollTimer=null),this.cancelPendingFindClear(),document.removeEventListener("selectionchange",i),this.storeFindState(null),this.storeFindMatch(null),this.findProjector.destroy()}).bind(this)}syncSize(e,n){this.findProjector.syncSize(e,n)}syncDocuments(){this.findProjector.update(this.options.textDocuments.readFindDocuments())}getFindDocuments(){return this.options.textDocuments.readFindDocuments().map(e=>({...e}))}getFindState(){return this.activeFindState===null?null:{query:this.activeFindState.query,options:{...this.activeFindState.options},matches:this.activeFindState.matches.map(e=>({...e})),activeMatchIndex:this.activeFindState.activeMatchIndex}}activateFindMatch(e,n=!0){return this.applyRetainedFindMatch(e,n)}setFindState(e,n=!1){return this.applyRetainedFindState(e,n)}syncFindSelection(e=!1){return this.handleSelectionChange(e)}clearFindMatch(){return this.findProjector.selectMatch(null),this.applyRetainedFindMatch(null,!1)}destroy(){}isBridgeFindDialogOpen(){return document.querySelector('[data-ed-find-dialog="1"][data-ed-open="1"]')!==null}cancelPendingFindClear(){this.selectionClearTimer!==null&&(clearTimeout(this.selectionClearTimer),this.selectionClearTimer=null)}schedulePendingFindClear(){this.cancelPendingFindClear(),this.selectionClearTimer=window.setTimeout(()=>{this.selectionClearTimer=null,!this.isBridgeFindDialogOpen()&&this.findProjector.resolveSelection(document.getSelection())===null&&this.activeFindMatch!==null&&this.applyRetainedFindState(null,!1)},150)}storeFindMatch(e){this.activeFindMatch=e===null?null:{...e},window.__bridgeFindMatch=this.activeFindMatch}storeFindState(e){this.activeFindState=e===null?null:{query:e.query,options:{...e.options},matches:e.matches.map(n=>({...n})),activeMatchIndex:e.activeMatchIndex},window.__bridgeFindState=this.activeFindState}applyRetainedFindState(e,n){if(e===null)return this.options.ui._ui_clear_text_find_highlights(),this.options.ui._ui_clear_text_find_match(),this.options.commitFrame(),this.options.flushPendingCommit(),this.storeFindState(null),this.storeFindMatch(null),!0;let i=Pt(e.options);if(e.activeMatchIndex<-1||e.activeMatchIndex>=e.matches.length||e.matches.length===0&&e.activeMatchIndex!==-1)return!1;let r=[];for(let o of e.matches){let s=this.options.textDocuments.resolveTextRange(o.handle,o.start,o.end);if(s===null)return!1;r.push({handleArg:s.handleArg,match:{handle:o.handle,start:s.start,end:s.end}})}if(this.options.ui._ui_clear_text_find_highlights(),i.highlightAll)for(let o=0;o<r.length;o+=1){if(o===e.activeMatchIndex)continue;let s=r[o];if(s!==void 0&&this.options.ui._ui_push_text_find_highlight(s.handleArg,s.match.start,s.match.end,Sr)===0)return this.options.ui._ui_clear_text_find_highlights(),!1}let a=e.activeMatchIndex>=0?r[e.activeMatchIndex]??null:null;if(a===null)this.options.ui._ui_clear_text_find_match();else{if(this.options.ui._ui_set_text_find_match(a.handleArg,a.match.start,a.match.end)===0)return this.options.ui._ui_clear_text_find_highlights(),!1;if(n&&this.options.ui._ui_reveal_text_range(a.handleArg,a.match.start,a.match.end)===0)return this.options.ui._ui_clear_text_find_highlights(),!1}return this.options.commitFrame(),this.options.flushPendingCommit(),this.storeFindState({query:e.query,options:i,matches:r.map(o=>({...o.match})),activeMatchIndex:a===null?-1:e.activeMatchIndex}),this.storeFindMatch(a?.match??null),!0}applyRetainedFindMatch(e,n){return this.applyRetainedFindState(e===null?null:{query:"",options:{..._e},matches:[{...e}],activeMatchIndex:0},n)}handleSelectionChange(e=!1){let n=this.findProjector.resolveSelection(document.getSelection());return n===null?(e&&!this.isBridgeFindDialogOpen()&&this.activeFindMatch!==null&&this.schedulePendingFindClear(),!1):(this.cancelPendingFindClear(),this.activeFindMatch!==null&&this.activeFindMatch.handle===n.handle&&this.activeFindMatch.start===n.start&&this.activeFindMatch.end===n.end?!0:this.applyRetainedFindMatch(n,!0))}};var wr=new TextDecoder,ti=new DataView(new ArrayBuffer(4)),ht=new WeakMap,Lr={0:{roleName:"none",tagName:"span",ariaRole:null},1:{roleName:"button",tagName:"button",ariaRole:"button"},2:{roleName:"textbox",tagName:"input",ariaRole:"textbox"},3:{roleName:"link",tagName:"a",ariaRole:"link"},4:{roleName:"heading",tagName:"h1",ariaRole:"heading"},5:{roleName:"form",tagName:"form",ariaRole:"form"},6:{roleName:"list",tagName:"ul",ariaRole:"list"},7:{roleName:"listitem",tagName:"li",ariaRole:"listitem"},8:{roleName:"img",tagName:"div",ariaRole:"img"},9:{roleName:"dialog",tagName:"dialog",ariaRole:"dialog"},10:{roleName:"text",tagName:"p",ariaRole:null},11:{roleName:"checkbox",tagName:"input",ariaRole:"checkbox"},12:{roleName:"radio",tagName:"input",ariaRole:"radio"},13:{roleName:"radiogroup",tagName:"div",ariaRole:"radiogroup"},14:{roleName:"switch",tagName:"button",ariaRole:"switch"},15:{roleName:"slider",tagName:"div",ariaRole:"slider"},16:{roleName:"combobox",tagName:"div",ariaRole:"combobox"}};function Fr(t){if(t===1)return"false";if(t===2)return"true";if(t===3)return"mixed"}function Cr(t){if(t===1)return"horizontal";if(t===2)return"vertical"}function Re(t){return ti.setUint32(0,t>>>0,!0),ti.getFloat32(0,!0)}function Gt(t){return Lr[t]??{roleName:`unknown-${String(t)}`,tagName:"span",ariaRole:null}}function Ar(t,e){return t.role===2&&t.state.multiline===!0?"textarea":e.tagName}function Ir(t,e,n){if(n===0)return"";let i=t.byteOffset+e*4,r=Math.ceil(n/4)*4,a=new Uint8Array(t.buffer,i,r);return wr.decode(a.subarray(0,n))}function ii(t){if(t.length===0)return[];let e=t[0]??0;if(e===0)return[];let n=1,i=[];i.length=0;for(let r=0;r<e;r+=1){if(n+14>t.length)throw new Error("Semantic buffer ended mid-record.");let a=t[n]??0,o=t[n+1]??0,s=t[n+2]??0,l=t[n+7]??0,c=t[n+8]??0,d=t[n+9]??0,f=Re(t[n+10]??0),y=Re(t[n+11]??0),u=Re(t[n+12]??0),F=t[n+13]??0,h=Math.ceil(F/4),g=Gt(a),w=(BigInt(s)<<32n|BigInt(o)).toString(),S={x:Re(t[n+3]??0),y:Re(t[n+4]??0),width:Re(t[n+5]??0),height:Re(t[n+6]??0)},b={},x=Fr(c);x!==void 0&&(b.checked=x),(l&1)!==0&&(b.selected=(l&2)!==0),(l&4)!==0&&(b.expanded=(l&8)!==0),(l&16)!==0&&(b.disabled=(l&32)!==0),(l&128)!==0&&(b.readonly=(l&256)!==0),(l&512)!==0&&(b.multiline=(l&1024)!==0);let v=Cr(d);if(v!==void 0&&(b.orientation=v),(l&64)!==0&&(b.valueNow=f,b.valueMin=y,b.valueMax=u),n+=14,n+h>t.length)throw new Error("Semantic buffer label exceeded record bounds.");let C=Ir(t,n,F);n+=h,i.push({role:a,roleName:g.roleName,handle:w,bounds:S,label:C,state:b})}return i}function Pr(t,e){t.style.left=`${String(e.x)}px`,t.style.top=`${String(e.y)}px`,t.style.width=`${String(e.width)}px`,t.style.height=`${String(e.height)}px`}function kr(t){let e=t.firstElementChild;if(e instanceof HTMLSpanElement&&e.getAttribute("data-semantic-text-run")==="true")return e;let n=document.createElement("span");return n.setAttribute("data-semantic-text-run","true"),n.style.position="absolute",n.style.left="0",n.style.top="0",n.style.display="block",n.style.pointerEvents="none",n.style.margin="0",n.style.padding="0",n.style.border="0",t.replaceChildren(n),n}function Ut(t){let e=t.firstElementChild;if(e instanceof HTMLSpanElement&&e.getAttribute("data-semantic-text-content")==="true")return e;let n=document.createElement("span");return n.setAttribute("data-semantic-text-content","true"),n.style.display="inline-block",n.style.margin="0",n.style.padding="0",n.style.border="0",n.style.whiteSpace="pre-wrap",n.style.overflowWrap="break-word",n.style.color="inherit",n.style.webkitTextFillColor="inherit",n.style.transformOrigin="top left",t.replaceChildren(n),n}function Rr(t){if(t.childNodes.length===1){let n=t.firstChild;if(n instanceof Text)return n}let e=document.createTextNode("");return t.replaceChildren(e),e}function Hr(t){let e=t.firstElementChild;e instanceof HTMLSpanElement&&e.getAttribute("data-semantic-text-run")==="true"&&(ht.delete(e),e.remove())}function Mr(t,e,n){if(n===void 0){ht.delete(t);let h=Ut(t);t.style.left="0",t.style.top="0",t.style.width="",t.style.height="",t.style.overflow="visible",h.style.width="",h.style.height="",h.style.transform="";return}let i=Ut(t),r=n.bounds.x-e.x,a=n.bounds.y-e.y;t.style.left=`${String(r)}px`,t.style.top=`${String(a)}px`,t.style.width=`${String(n.bounds.width)}px`,t.style.height=`${String(n.bounds.height)}px`,t.style.overflow="hidden",i.style.width=`${String(n.bounds.width)}px`,i.style.height="",i.style.transform="";let o=i.firstChild,l=[o instanceof Text?o.data:"",n.bounds.width.toFixed(3),n.bounds.height.toFixed(3)].join(""),c=ht.get(t);if(c?.key===l){i.style.transform=`matrix(${String(c.scaleX)}, 0, 0, ${String(c.scaleY)}, ${String(c.translateX)}, ${String(c.translateY)})`;return}let d=i.firstChild,f=1,y=1,u=0,F=0;if(d instanceof Text&&d.data.length>0){let h=document.createRange();h.selectNodeContents(d);let g=h.getBoundingClientRect(),w=i.getBoundingClientRect(),S=g.width>0?n.bounds.width/g.width:1,b=g.height>0?n.bounds.height/g.height:1;f=Number.isFinite(S)&&S>0?S:1,y=Number.isFinite(b)&&b>0?b:1;let x=g.x-w.x,v=g.y-w.y;u=Number.isFinite(x)?-(x*f):0,F=Number.isFinite(v)?-(v*y):0}i.style.transform=`matrix(${String(f)}, 0, 0, ${String(y)}, ${String(u)}, ${String(F)})`,ht.set(t,{key:l,scaleX:f,scaleY:y,translateX:u,translateY:F})}function Br(t,e){let n=t.firstElementChild;for(let i of e){if(i===n){n=n.nextElementSibling;continue}t.insertBefore(i,n)}for(;n!==null;){let i=n;n=i.nextElementSibling,i.remove()}}function ni(t,e){return e.x>=t.x&&e.y>=t.y&&e.x+e.width<=t.x+t.width&&e.y+e.height<=t.y+t.height}function Or(t,e,n){let i=Gt(n.role),r=Ar(n,i),a=e.get(n.handle);if(a?.tagName.toLowerCase()===r)return a;let o=document.createElement(r);if(o.setAttribute("data-handle",n.handle),o.style.position="absolute",o.style.pointerEvents="none",o.style.margin="0",o.style.padding="0",o.style.boxSizing="border-box",o.style.background="transparent",o.style.border="0",o.style.outline="none",o.style.appearance="none",o.style.webkitAppearance="none",o.style.color="transparent",o.style.webkitTextFillColor="transparent",o.style.caretColor="transparent",o.style.lineHeight="normal",o.tabIndex=-1,r==="input"){let s=o;n.role===11?s.type="checkbox":n.role===12?s.type="radio":s.type="text",s.readOnly=n.state.readonly??!0}else if(r==="textarea"){let s=o;s.readOnly=n.state.readonly??!0,s.rows=1,s.style.resize="none"}return n.role===2&&n.state.multiline===!0&&o.setAttribute("aria-multiline","true"),a?.parentElement===t?t.replaceChild(o,a):t.appendChild(o),e.set(n.handle,o),o}function Wr(t){return{role:t.role,roleName:t.roleName,handle:t.handle,bounds:{x:t.bounds.x,y:t.bounds.y,width:t.bounds.width,height:t.bounds.height},label:t.label,state:{...t.state}}}function Nr(t){return t===1||t===2||t===8||t===9||t===11||t===12||t===15||t===16}function Dr(t){return t!==1&&t!==8}function Ur(t){switch(t.role){case 1:return"button";case 2:return t.state.multiline===!0?"text area":"text input";case 3:return"link";case 4:return"heading";case 5:return"form";case 6:return"list";case 7:return"list item";case 8:return"image";case 9:return"dialog";case 10:return"text";case 11:return"checkbox";case 12:return"radio button";case 13:return"radio group";case 14:return"switch";case 15:return"slider";case 16:return"combo box";default:return t.roleName}}function Kr(t,e){let n=[],i=t.role===2&&t.label.length===0?e[t.handle]??"":t.label;return i.length>0&&n.push(i),t.role===15&&i.length>0||n.push(Ur(t)),t.state.checked==="mixed"?n.push("mixed"):t.state.checked==="true"?n.push("checked"):t.state.checked==="false"&&(t.role===11||t.role===12||t.role===14)&&n.push("unchecked"),t.state.selected===!0&&n.push("selected"),t.state.expanded===!0?n.push("expanded"):t.state.expanded===!1&&n.push("collapsed"),t.state.readonly===!0&&n.push("read only"),t.state.disabled===!0&&n.push("disabled"),t.state.valueNow!==void 0&&Number.isFinite(t.state.valueNow)&&n.push(`value ${String(t.state.valueNow)}`),n.join(", ")}var Kt=class{constructor(e){this.pendingFrame=null;this.pendingTimer=null;this.clearTimer=null;let n=document.createElement("output");n.id="semantic-live-announcer",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.setAttribute("data-effindom-live-announcer","true"),n.style.position="absolute",n.style.width="1px",n.style.height="1px",n.style.margin="-1px",n.style.padding="0",n.style.border="0",n.style.overflow="hidden",n.style.clip="rect(0 0 0 0)",n.style.clipPath="inset(50%)",n.style.whiteSpace="nowrap",n.style.opacity="0",n.textContent="\xA0",e.appendChild(n),this.element=n}announce(e){e.length!==0&&(this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.pendingTimer!==null&&(clearTimeout(this.pendingTimer),this.pendingTimer=null),this.clearTimer!==null&&(clearTimeout(this.clearTimer),this.clearTimer=null),this.element.textContent="\xA0",this.pendingFrame=requestAnimationFrame(()=>{this.pendingFrame=null,this.pendingTimer=setTimeout(()=>{this.pendingTimer=null,this.element.textContent=e,this.clearTimer=setTimeout(()=>{this.clearTimer=null,this.element.textContent="\xA0"},1500)},50)}))}destroy(){this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.pendingTimer!==null&&(clearTimeout(this.pendingTimer),this.pendingTimer=null),this.clearTimer!==null&&(clearTimeout(this.clearTimer),this.clearTimer=null),this.element.remove()}},ft=class{constructor(e){this.elementsByHandle=new Map;let n=e.parentElement;if(!(n instanceof HTMLElement))throw new Error("Expected canvas parent element for semantic projection.");let i=document.createElement("div");i.id="scene-shell",i.style.position="relative",i.style.display="inline-block",i.style.lineHeight="0",n.replaceChild(i,e);let r=document.createElement("div");r.id="semantic-layer",r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.pointerEvents="none",r.style.overflow="hidden",r.style.lineHeight="normal",r.setAttribute("data-visibility","screen-reader-only");let a=r.attachShadow({mode:"open"}),o=document.createElement("div");o.id="semantic-content",o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.width="100%",o.style.height="100%",o.style.padding="0",o.style.border="0",o.style.overflow="hidden",o.style.whiteSpace="nowrap",o.style.color="transparent",o.style.webkitTextFillColor="transparent",o.style.lineHeight="normal",a.appendChild(o);let s=new Kt(a);i.appendChild(e),i.appendChild(r),e.setAttribute("role","application"),e.setAttribute("aria-label","EffinDom application"),this.canvas=e,this.shell=i,this.layer=r,this.content=o,this.announcer=s}syncSize(e,n){let i=`${String(e)}px`,r=`${String(n)}px`;this.shell.style.width=i,this.shell.style.height=r,this.layer.style.width=i,this.layer.style.height=r}update(e,n,i){let r=new Set,a=[];for(let o of e){r.add(o.handle);let s=Gt(o.role),l=Or(this.content,this.elementsByHandle,o);a.push(l);let c=o.role===2&&o.label.length===0?n[o.handle]??"":o.label;if(s.ariaRole===null?l.removeAttribute("role"):l.setAttribute("role",s.ariaRole),c.length===0||!Nr(o.role)?l.removeAttribute("aria-label"):l.setAttribute("aria-label",c),o.role===9?(l.setAttribute("aria-modal","true"),l instanceof HTMLDialogElement&&l.setAttribute("open","")):l.removeAttribute("aria-modal"),o.state.checked===void 0?l.removeAttribute("aria-checked"):l.setAttribute("aria-checked",o.state.checked),o.state.selected===void 0?l.removeAttribute("aria-selected"):l.setAttribute("aria-selected",o.state.selected?"true":"false"),o.state.expanded===void 0?l.removeAttribute("aria-expanded"):l.setAttribute("aria-expanded",o.state.expanded?"true":"false"),o.state.disabled===void 0?l.removeAttribute("aria-disabled"):l.setAttribute("aria-disabled",o.state.disabled?"true":"false"),o.state.readonly===void 0?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",o.state.readonly?"true":"false"),o.state.multiline===void 0?l.removeAttribute("aria-multiline"):l.setAttribute("aria-multiline",o.state.multiline?"true":"false"),o.state.orientation===void 0?l.removeAttribute("aria-orientation"):l.setAttribute("aria-orientation",o.state.orientation),o.state.valueNow===void 0?(l.removeAttribute("aria-valuenow"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuemax")):(l.setAttribute("aria-valuenow",String(o.state.valueNow)),l.setAttribute("aria-valuemin",String(o.state.valueMin??0)),l.setAttribute("aria-valuemax",String(o.state.valueMax??0))),l.id=`semantic-node-${o.handle}`,l.setAttribute("data-role",o.roleName),Pr(l,o.bounds),l instanceof HTMLInputElement)if(o.role===11)l.checked=o.state.checked==="true",l.indeterminate=o.state.checked==="mixed";else if(o.role===12)l.checked=o.state.checked==="true";else{let d=n[o.handle]??"";l.value!==d&&(l.value=d),l.readOnly=o.state.readonly??!0}else if(l instanceof HTMLTextAreaElement){let d=n[o.handle]??"";l.value!==d&&(l.value=d),l.readOnly=o.state.readonly??!0}else if(Dr(o.role)){let d=kr(l),f=Rr(Ut(d));f.data!==c&&(f.data=c),Mr(d,o.bounds,i[o.handle])}else Hr(l),l.textContent!==""&&(l.textContent="")}for(let o of e){if(o.role!==9)continue;let s=this.elementsByHandle.get(o.handle);if(!(s instanceof HTMLElement))continue;let l=e.find(d=>d.handle!==o.handle&&d.role===4&&ni(o.bounds,d.bounds)),c=e.filter(d=>d.handle!==o.handle&&d.role===10&&ni(o.bounds,d.bounds));l!==void 0?s.setAttribute("aria-labelledby",`semantic-node-${l.handle}`):s.removeAttribute("aria-labelledby"),c.length>0?s.setAttribute("aria-describedby",c.map(d=>`semantic-node-${d.handle}`).join(" ")):s.removeAttribute("aria-describedby")}for(let[o,s]of this.elementsByHandle.entries())r.has(o)||(s.remove(),this.elementsByHandle.delete(o));Br(this.content,a)}announceNode(e,n,i){let r=n.find(a=>a.handle===e);r!==void 0&&this.announcer.announce(Kr(r,i))}destroy(){this.announcer.destroy();for(let n of this.elementsByHandle.values())n.remove();this.elementsByHandle.clear(),this.layer.remove();let e=this.shell.parentElement;e!==null?e.replaceChild(this.canvas,this.shell):this.shell.remove()}};function pt(t){return t.map(e=>Wr(e))}var gt=class{constructor(e){this.options=e;this.api={getSemanticTree:()=>pt(this.options.semantic.getSemanticTree()),getBoundingBox:n=>this.options.semantic.getBoundingBox(n),getTextVisibleBounds:n=>{let i=this.options.textDocuments.readVisibleTextBounds(n);return i===null?null:{...i}},getTextDocument:n=>{let i=this.options.textDocuments.readTextDocumentSnapshot(n);return i===null?null:{...i.document}},getRangeRects:(n,i,r)=>this.options.textDocuments.readRangeRects(n,i,r).map(a=>({...a})),findText:(n,i)=>{let r=Ln(this.options.textDocuments.readFindDocuments(),n,i);return{query:r.query,options:{...r.options},matches:r.matches.map(a=>({...a}))}},setFindState:(n,i=!1)=>this.options.find.setFindState(n,i),getFindState:()=>this.options.find.getFindState(),setFindMatch:n=>this.options.find.activateFindMatch(n,!1),revealRange:(n,i,r)=>{let a=this.options.textDocuments.resolveTextRange(n,i,r);return a===null||this.options.ui._ui_reveal_text_range(a.handleArg,a.start,a.end)===0?!1:(this.options.commitFrame(),this.options.flushPendingCommit(),!0)}},window.__OPEN_CANVAS_API__=this.api}getApi(){return this.api}destroy(){delete window.__OPEN_CANVAS_API__}};var Gr=50,yt=class{constructor(e,n,i,r){this.ui=n;this.interactionState=i;this.textDocuments=r;this.semanticTree=[];this.semanticTextLayoutsByHandle={};this.semanticAnnouncementTimer=null;this.scheduledSemanticAnnouncementHandle=null;this.projector=new ft(e)}syncSize(e,n){this.projector.syncSize(e,n)}syncSemanticState(){this.semanticTree=ii(sn(this.ui));for(let n of this.semanticTree)n.roleName==="textbox"&&this.interactionState.textByHandle[n.handle]===void 0&&n.label.length!==0&&(this.interactionState.textByHandle[n.handle]=n.label);this.semanticTextLayoutsByHandle=this.buildSemanticTextLayouts(),this.projector.update(this.semanticTree,this.interactionState.textByHandle,this.semanticTextLayoutsByHandle);let e=this.interactionState.getFocusedHandle();for(let n of this.interactionState.consumePendingSemanticAnnouncements())e!==null&&e===n&&this.scheduleSemanticAnnouncement(n);window.__bridgeSemanticTree=pt(this.semanticTree)}getSemanticTree(){return this.semanticTree}getBoundingBox(e){let n=this.semanticTree.find(i=>i.handle===e);return n===void 0?null:{...n.bounds}}destroy(){this.cancelPendingSemanticAnnouncement(),this.semanticTree=[],this.semanticTextLayoutsByHandle={},window.__bridgeSemanticTree=[],this.projector.destroy()}cancelPendingSemanticAnnouncement(){this.semanticAnnouncementTimer!==null&&(window.clearTimeout(this.semanticAnnouncementTimer),this.semanticAnnouncementTimer=null),this.scheduledSemanticAnnouncementHandle=null}scheduleSemanticAnnouncement(e){this.scheduledSemanticAnnouncementHandle=e,this.semanticAnnouncementTimer!==null&&window.clearTimeout(this.semanticAnnouncementTimer),this.semanticAnnouncementTimer=window.setTimeout(()=>{this.semanticAnnouncementTimer=null;let n=this.scheduledSemanticAnnouncementHandle;this.scheduledSemanticAnnouncementHandle=null,!(n===null||this.interactionState.getFocusedHandle()!==n)&&this.projector.announceNode(n,this.semanticTree,this.interactionState.textByHandle)},Gr)}buildSemanticTextLayouts(){let e=Object.create(null);for(let n of this.semanticTree){if(n.label.length===0)continue;let i=this.textDocuments.readVisibleTextBounds(n.handle);if(i===null)continue;let r=Math.max(n.bounds.x,i.x),a=Math.max(n.bounds.y,i.y),o=Math.min(n.bounds.x+n.bounds.width,i.x+i.width),s=Math.min(n.bounds.y+n.bounds.height,i.y+i.height);o<=r||s<=a||(e[n.handle]={bounds:{x:r,y:a,width:o-r,height:s-a}})}return e}};var zr=4294967295,$r=new TextDecoder,bt=class{constructor(e){this.ui=e}readTextDocumentMeta(e){let n=this.toUiHandleArgument(e);if(n===null)return null;let i=this.ui._ui_get_text_document_utf8_length(n);return i<0||i>>>0===zr?null:{handleArg:n,byteLength:i}}resolveTextRange(e,n,i){let r=this.readTextDocumentMeta(e),a=this.normalizeByteRange(n,i);return r===null||a===null||a.end>r.byteLength?null:{handleArg:r.handleArg,byteLength:r.byteLength,start:a.start,end:a.end}}readTextDocumentSnapshot(e){let n=this.readTextDocumentMeta(e);if(n===null)return null;if(n.byteLength===0)return{document:{handle:e,text:""},byteLength:0};let i=Le(this.ui,this.ui._malloc(n.byteLength)),r=i.ptr,a=i.offset;if(a===0)throw new Error("ui text document malloc failed.");try{let o=this.ui._ui_copy_text_document_utf8(n.handleArg,r,n.byteLength);if(this.ui.refreshHeapViews?.(),o===0)return null;let s=$r.decode(this.ui.HEAPU8.slice(a,a+n.byteLength));return{document:{handle:e,text:s},byteLength:n.byteLength}}finally{this.ui._free(r)}}readVisibleTextBounds(e){let n=this.toUiHandleArgument(e);if(n===null)return null;let i=Le(this.ui,this.ui._malloc(16));if(i.offset===0)throw new Error("ui visible text bounds malloc failed.");let r=i.ptr,a=this.addPointerOffset(i.ptr,4),o=this.addPointerOffset(i.ptr,8),s=this.addPointerOffset(i.ptr,12);try{let l=this.ui._ui_get_text_visible_bounds(n,r,a,o,s);if(this.ui.refreshHeapViews?.(),l===0)return null;let c=i.offset>>>2;return{x:this.ui.HEAPF32[c]??0,y:this.ui.HEAPF32[c+1]??0,width:this.ui.HEAPF32[c+2]??0,height:this.ui.HEAPF32[c+3]??0}}finally{this.ui._free(i.ptr)}}readRangeRects(e,n,i){let r=this.resolveTextRange(e,n,i);if(r===null)return[];let a=this.ui._ui_get_text_range_rect_count(r.handleArg,r.start,r.end);if(a===0)return[];let o=Le(this.ui,this.ui._malloc(a*16)),s=o.ptr,l=o.offset;if(l===0)throw new Error("ui range rect malloc failed.");try{let c=this.ui._ui_copy_text_range_rects(r.handleArg,r.start,r.end,s,a);if(this.ui.refreshHeapViews?.(),c===0)return[];let d=this.ui.HEAPF32.slice(l>>>2,(l>>>2)+c*4),f=[];for(let y=0;y<c;y+=1){let u=y*4;f.push({x:d[u]??0,y:d[u+1]??0,width:d[u+2]??0,height:d[u+3]??0})}return f}finally{this.ui._free(s)}}readFindDocuments(){let e=[];for(let n of this.readTextSnapshotHandles()){let i=this.readTextDocumentSnapshot(n);i!==null&&e.push(i.document)}return e}readTextSnapshotHandles(){let e=this.ui._ui_get_text_snapshot_handle_count();if(e===0)return[];let n=Le(this.ui,this.ui._malloc(e*8)),i=n.ptr,r=n.offset;if(r===0)throw new Error("ui text snapshot handle malloc failed.");try{let a=this.ui._ui_copy_text_snapshot_handles(i,e);if(this.ui.refreshHeapViews?.(),a===0)return[];let o=this.ui.HEAPU32.slice(r>>>2,(r>>>2)+a*2),s=[];for(let l=0;l<a;l+=1){let c=o[l*2]??0,d=o[l*2+1]??0;s.push((BigInt(d)<<32n|BigInt(c)).toString())}return s}finally{this.ui._free(i)}}toUiHandleArgument(e){try{return z(e)}catch{return null}}normalizeByteRange(e,n){return!Number.isInteger(e)||!Number.isInteger(n)||e<0||n<0?null:{start:Math.min(e,n),end:Math.max(e,n)}}addPointerOffset(e,n){return typeof e=="bigint"?e+BigInt(n):e+n}};var qr=320,Vr=220,ri=4,zt=5;function oi(t,e,n,i,r){let a=qr,o=Vr,s=!1,l=null,c=null,d,f=new ct(t,e,i.logs,()=>d.commitFrame()),y=new dt(t,f,()=>d.commitFrame()),u=new bt(e),F=new yt(n,e,i,u),h=new mt({canvas:n,ui:e,textDocuments:u,commitFrame:()=>d.commitFrame(),flushPendingCommit:()=>d.flushPendingCommit()}),g=new gt({ui:e,semantic:F,find:h,textDocuments:u,commitFrame:()=>d.commitFrame(),flushPendingCommit:()=>d.flushPendingCommit()}),w=()=>{F.syncSemanticState(),h.syncDocuments()},S=(p,T,E,N,M=0)=>{T!==0n&&window.__effindomCallbacks?.onPointerEventWithCoords?.(p,T,E,N,M)},b=()=>{let{x:p,y:T}=i.getLastPointerClientPosition();if(p===null||T===null)return!1;let E=n.getBoundingClientRect();return p>=E.left&&p<=E.right&&T>=E.top&&T<=E.bottom},x=()=>{let{x:p,y:T}=i.getLastPointerPosition(),E=i.getLastInteractivePointerHandle(),N=i.getCapturedPointerHandle();if(N!==null){if(E===N)return;E!==null&&S(zt,E,p,T),i.setLastInteractivePointerHandle(N),S(ri,N,p,T);return}if(!(i.isPointerInsideCanvas()||b())){E!==null&&(i.setLastInteractivePointerHandle(null),S(zt,E,p,T));return}let $=z(t._ed_hit_test(p,T)),P=$===0n?null:$;P!==E&&(E!==null&&S(zt,E,p,T),i.setLastInteractivePointerHandle(P),P!==null&&S(ri,P,p,T))},v=()=>{let p=Math.max(1,window.devicePixelRatio||1),T=$e(n);a=T.width,o=T.height;let E=Math.round(a*p),N=Math.round(o*p);n.style.width=`${String(a)}px`,n.style.height=`${String(o)}px`,(E!==n.width||N!==n.height)&&(n.width=E,n.height=N),F.syncSize(a,o),h.syncSize(a,o),t._ed_resize(E,N,p),e._ui_resize_window(a,o),w(),de(r,ae(t._ed_get_backend_type()))};d={core:t,ui:e,canvas:n,openCanvasApi:g.getApi(),logs:i.logs,updateCanvasSize:v,extractCommandBuffer:()=>Ct(e),executeCommandBuffer:p=>{At(t,p)},syncCommandBufferToCore:()=>{let p=Ct(e);return At(t,p),w(),x(),p},flushPendingCommit:()=>!s&&!i.hasPendingTextMutations()||(i.hasPendingTextMutations()&&(s&&(s=!1,d.syncCommandBufferToCore()),i.materializePendingTextMutations()&&(e._ui_commit_frame(),s=!0)),!s)?null:(s=!1,d.syncCommandBufferToCore()),hasPendingCommit:()=>s||i.hasPendingTextMutations(),commitFrame:()=>{if(i.hasPendingTextMutations()&&(s&&d.flushPendingCommit(),i.materializePendingTextMutations())){e._ui_commit_frame(),s=!0,c?.();return}s&&d.flushPendingCommit(),e._ui_commit_frame(),s=!0,c?.()},requestFrame:()=>{c?.()},setFrameRequester:p=>{c=p},getSemanticTree:()=>F.getSemanticTree(),getActiveTextHandle:()=>i.getActiveTextHandle(),getCapturedPointerHandle:()=>i.getCapturedPointerHandle(),setCapturedPointerHandle:p=>{i.setCapturedPointerHandle(p)},setAppFrameHandler:p=>{l=p,c?.()},runAppFrameHandler:p=>{l?.(p)},uiHasPendingVisualWork:()=>e._ui_has_pending_visual_work()!==0,uiNeedsAnimationFrame:()=>e._ui_needs_animation_frame()!==0,getHandleFromPoint:(p,T)=>z(t._ed_hit_test(p,T)),clearPointerHover:()=>{i.setLastInteractivePointerHandle(null)},refreshPointerHover:()=>{x()},getFindDocuments:()=>h.getFindDocuments(),activateFindMatch:(p,T=!0)=>h.activateFindMatch(p,T),syncFindSelection:(p=!1)=>h.syncFindSelection(p),clearFindMatch:()=>h.clearFindMatch(),ensureFont:async p=>{await f.ensureFont(p)},ensureBuiltInFont:async p=>{await f.ensureBuiltInFont(p)},isFontLoaded:(p,T)=>f.isFontLoaded(p,T),getIncrementalFontState:p=>f.getIncrementalFontState(p),getIncrementalFontCacheState:()=>f.getIncrementalFontCacheState(),getIncrementalFontPolicy:()=>f.getIncrementalFontPolicy(),setIncrementalFontPolicy:p=>{f.setIncrementalFontPolicy(p)},getClipboardFontUrl:p=>f.getClipboardFontUrl(p),registerLazyFont:(p,T)=>{f.registerLazyFont(p,T)},registerFontFallback:(p,T)=>{f.registerFontFallback(p,T)},handleMissingFontCoverage:(p,T,E)=>{f.handleMissingFontCoverage(p,T,E)},loadFont:async(p,T)=>{await f.loadFont(p,T)},registerFont:async p=>{await f.registerFont(p)},registerFontStack:async p=>{await f.registerFontStack(p)},loadSvg:async(p,T)=>await y.loadSvg(p,T),loadTexture:async(p,T)=>await y.loadTexture(p,T),releaseSvg:p=>{y.releaseSvg(p)},releaseTexture:p=>{y.releaseTexture(p)},replayLoadedAssets:async()=>{await y.replayLoadedAssets()},resetLogs:()=>{pn(i.logs)},resetAppSession:()=>{i.resetAppSession()}};let C=()=>{d.updateCanvasSize(),d.commitFrame()},H=We(n),B=typeof ResizeObserver<"u"?new ResizeObserver(()=>{C()}):null;return B!==null&&B.observe(H),{runtime:d,destroy:()=>{B?.disconnect(),d.setFrameRequester(null),d.clearPointerHover(),g.destroy(),h.destroy(),F.destroy(),n.style.cursor="default"}}}var ai=[500,1e3,2e3,4e3];function Xr(t,e){if(t!==null)return t;let n=document.createElement("canvas");n.dataset.effindomSoftwareOverlay="true",n.setAttribute("aria-hidden","true"),n.style.position="absolute",n.style.pointerEvents="none",n.style.display="none",n.style.zIndex="1";let i=e.parentElement;i!==null?(getComputedStyle(i).position==="static"&&(i.style.position="relative"),i.appendChild(n)):document.body.appendChild(n);let r=n.getContext("2d");if(r===null)throw new Error("Canvas 2D context is unavailable for software rendering.");return{canvas:n,ctx:r,imageData:null,width:0,height:0}}function Yr(t,e,n){let i=re(t,t._ed_get_sw_framebuffer()),r=ne(i);if(r===0)return;n.canvas.style.left=`${String(e.offsetLeft)}px`,n.canvas.style.top=`${String(e.offsetTop)}px`,n.canvas.style.width=e.style.width||`${String(e.clientWidth)}px`,n.canvas.style.height=e.style.height||`${String(e.clientHeight)}px`,n.canvas.style.borderRadius=getComputedStyle(e).borderRadius,n.canvas.style.display="",(n.imageData===null||n.width!==e.width||n.height!==e.height)&&(n.canvas.width=e.width,n.canvas.height=e.height,n.imageData=n.ctx.createImageData(e.width,e.height),n.width=e.width,n.height=e.height);let a=e.width*e.height*4,o=t.HEAPU8.subarray(r,r+a);n.imageData.data.set(o),n.ctx.putImageData(n.imageData,0,0)}function si(t,e,n=Oe){let{core:i,canvas:r}=t,a=ae(i._ed_get_backend_type()),o=null,s=!1,l=!1,c=a,d=0,f=!1,y=null;async function u(){let b=Math.max(1,window.devicePixelRatio||1);for(;d<ai.length;){let v=ai[d];if(await fn(v),await St(i,r,b,c)){d=0,f=!1,a=c,e.deviceRecoveryCount+=1,de(e,c),await t.replayLoadedAssets(),console.info(`RENDERER RECOVERY: ${Fe(c)} recovered successfully.`),t.commitFrame();return}d+=1}f=!0;let x=n.indexOf(c)+1;for(let v=x;v<n.length;v+=1){let C=n[v];if(await St(i,r,b,C)){a=C,e.deviceRecoveryCount+=1,de(e,C),await t.replayLoadedAssets(),C===k.CPU?console.error(`RENDERER FALLBACK: ${Fe(c)} device lost and recovery failed! Fell back to Software/Raster - performance will be painfully slow`):console.warn(`RENDERER FALLBACK: ${Fe(c)} device lost and recovery failed! Fell back to ${Fe(C)}`),t.commitFrame();return}}throw new Error(`Renderer recovery failed: all backends exhausted after ${Fe(c)} device loss.`)}function F(b){y===null&&(c=b,d=0,f=!1,de(e,k.NONE),y=u().catch(x=>{let v=x instanceof Error?x.message:String(x);window.__bridgeError=v}).finally(()=>{y=null}))}let h=()=>{l||s||(s=!0,requestAnimationFrame(S))};t.setFrameRequester(h);let g=b=>{b.preventDefault(),i._ed_notify_webgl_context_lost?.(),F(a),h()};r.addEventListener("webglcontextlost",g,!1);let w=()=>{l||document.visibilityState==="visible"&&f&&y===null&&(console.info(`RENDERER RECOVERY: Page visible \u2014 attempting to revive ${Fe(c)} after sleep/wake.`),d=0,y=u().catch(b=>{let x=b instanceof Error?b.message:String(b);window.__bridgeError=x}).finally(()=>{y=null}))};document.addEventListener("visibilitychange",w);let S=b=>{if(l){s=!1;return}if(s=!1,y!==null){h();return}i.refreshHeapViews?.(),t.ui.refreshHeapViews?.(),t.runAppFrameHandler(b),!t.hasPendingCommit()&&t.uiNeedsAnimationFrame()&&t.uiHasPendingVisualWork()&&t.commitFrame(),t.flushPendingCommit(),i._ed_render_frame(b),i.refreshHeapViews?.();let x=et(i._ed_get_device_state()),v=ae(i._ed_get_backend_type());if(x===ce.LOST){F(a),h();return}a=v,de(e,v),v===k.CPU?(o=Xr(o,r),Yr(i,r,o)):o!==null&&(o.canvas.style.display="none"),(t.hasPendingCommit()||t.uiNeedsAnimationFrame())&&h()};return h(),()=>{l=!0,s=!1,t.setFrameRequester(null),r.removeEventListener("webglcontextlost",g,!1),document.removeEventListener("visibilitychange",w),o!==null&&(o.canvas.remove(),o=null)}}function jr(t){let e=document.getElementById(t);if(!(e instanceof HTMLCanvasElement))throw new Error(`Expected #${t} canvas.`);return e}async function li(t){let e=jr("fui-canvas");Ht(e);let{interactionState:n,preparedAssets:i,runtimeRef:r}=t;window.__bridgeLoaderInfo=i.loaderInfo;let[a,o]=await Promise.all([_n(i.coreBundle,i.coreWasm,e,i.loaderInfo),xn(i.uiBundle,i.uiWasm,i.loaderInfo)]),s=oi(a,o,e,n,i.loaderInfo),l=s.runtime;r.current=l;let c=Math.max(1,window.devicePixelRatio||1),d=vn(i.loaderInfo.requestedRendererBackend);await nn(a,e,c,i.loaderInfo,d),o._ui_reset();try{await yn(o,i)}catch(u){let F=u instanceof Error?u.message:"Failed to load text engine.";throw hn(F),nt(F,u)}l.updateCanvasSize();let f=Dn(l,n),y=si(l,i.loaderInfo,d);return await Promise.all(Kn.map(u=>l.registerFont({id:u.id,url:Ne(u.assetFile),fallbackIds:u.fallbackIds}))),delete window.__bridgeError,{runtime:l,destroy:()=>{f(),y(),s.destroy(),r.current===l&&(r.current=null)}}}var di="web application/x-effindom-richtext+json";function Jr(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ci(t){let e=t>>>24&255,n=t>>>16&255,i=t>>>8&255,r=t&255;return r>=255?`rgb(${String(e)} ${String(n)} ${String(i)})`:`rgb(${String(e)} ${String(n)} ${String(i)} / ${(r/255).toFixed(3)})`}function Qr(t){return t===void 0?null:/mono/i.test(t)?"monospace":null}function Zr(t){let e=[];t.color!==void 0&&e.push(`color: ${ci(t.color)};`),t.bgColor!==void 0&&t.bgColor!==0&&e.push(`background-color: ${ci(t.bgColor)};`),t.fontSize!==void 0&&e.push(`font-size: ${String(t.fontSize)}px;`);let n=Qr(t.fontUrl);n!==null&&e.push(`font-family: ${n};`);let i=t.decorationFlags??0,r=[];return(i&1)!==0&&r.push("underline"),(i&2)!==0&&r.push("line-through"),r.length>0&&e.push(`text-decoration: ${r.join(" ")};`),e.join(" ")}function eo(t){let e='<div data-effindom-richtext="1" style="white-space: pre-wrap;">';for(let n of t.parts){let i=Jr(n.text),r=Zr(n);if(r.length>0){e+=`<span style="${r}">${i}</span>`;continue}e+=i}return e+="</div>",e}function mi(t,e){let n=t.richText;return n===void 0?t:{plainText:t.plainText,richText:{version:n.version,parts:n.parts.map(i=>{if(i.fontId===void 0||i.fontUrl!==void 0)return i;let r=e(i.fontId);return r===null?i:{...i,fontUrl:r}})}}}async function ui(t){if(navigator.clipboard===void 0||navigator.clipboard.write===void 0||typeof ClipboardItem>"u")return!1;try{return await navigator.clipboard.write([new ClipboardItem(t)]),!0}catch{return!1}}async function hi(t){let e=t.plainText,n=t.richText,i=n===void 0?null:eo(n);if(n!==void 0&&i!==null){let r=JSON.stringify(n);if(await ui({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([i],{type:"text/html"}),[di]:new Blob([r],{type:di})})||await ui({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([i],{type:"text/html"})}))return}navigator.clipboard!==void 0&&navigator.clipboard.writeText!==void 0&&await navigator.clipboard.writeText(e)}function $t(t){return t<=127?1:t<=2047?2:t<=65535?3:4}function De(t,e){let n=t.codePointAt(e)??0;return e+(n>65535?2:1)}function fi(t,e){let n=Math.max(0,Math.min(e,t.length));if(n<=0)return 0;let i=n-1,r=t.charCodeAt(i);if(i>0&&r>=56320&&r<=57343){let a=t.charCodeAt(i-1);if(a>=55296&&a<=56319)return i-1}return i}function q(t,e){let n=Math.max(0,Math.min(e,t.length)),i=0;for(let r=0;r<n;r=De(t,r)){let a=t.codePointAt(r)??0;i+=$t(a)}return i}function j(t){return q(t,t.length)}var qt=2048,to=4096,no=512,pi=256,gi=1e4;function io(t,e){if(e<0||e>=t.length)return!1;let n=t.charCodeAt(e);return n===10||n===13}function ro(t){let e=[],n=0;for(;n<t.length;){let i=n,r=n,a=0;for(;r<t.length&&!io(t,r);){let o=De(t,r);a<gi&&(i=o),a+=1,r=o}if(a>gi&&e.push({start:i,end:r}),r>=t.length)break;t.charCodeAt(r)===13&&r+1<t.length&&t.charCodeAt(r+1)===10?n=r+2:n=r+1}return e}function oo(t,e){let n=Math.max(0,t),i=0;for(let r of e){if(n<=r.start)break;if(n<r.end)return r.start-i;i+=r.end-r.start}return n-i}function ao(t){let e=ro(t);if(e.length===0)return{text:t,changed:!1,mapIndex:r=>Math.max(0,Math.min(r,t.length))};let n="",i=0;for(let r of e)n+=t.slice(i,r.start),i=r.end;return n+=t.slice(i),{text:n,changed:!0,mapIndex:r=>oo(r,e)}}function ve(t,e,n){let i=n??j(t),r=Math.max(0,Math.min(e,i)),a=0,o=0;for(;o<t.length;){let s=t.codePointAt(o)??0,l=a+$t(s);if(l>r||(a=l,o=De(t,o),a===r))break}return o}function Ue(t,e){if(t===e)return null;let n=Math.min(t.length,e.length),i=0;for(;i<n&&t.charCodeAt(i)===e.charCodeAt(i);)i+=1;let r=0;for(;r<t.length-i&&r<e.length-i&&t.charCodeAt(t.length-r-1)===e.charCodeAt(e.length-r-1);)r+=1;return{start:i,end:t.length-r,insertedText:e.slice(i,e.length-r)}}function _t(t,e,n,i){let r=ve(t,Math.max(0,e)),a=ve(t,Math.max(r,n));return`${t.slice(0,r)}${i}${t.slice(a)}`}function Vt(t,e){let n=Math.max(0,Math.min(e,t.currentWindowText.length)),i=Ue(t.baseWindowText,t.currentWindowText);if(i===null)return Math.max(0,Math.min(n,t.baseWindowText.length));let r=i.start,a=i.start+i.insertedText.length;if(n<=r)return n;if(n<=a)return i.start;let o=i.insertedText.length-(i.end-i.start);return Math.max(0,Math.min(n-o,t.baseWindowText.length))}function xt(t,e,n,i,r){let a=ve(t,e),o=ve(t,n),s=`${t.slice(0,a)}${i}${t.slice(o)}`,l=ve(s,r),c=ao(s),d=c.mapIndex(l);return{fullNextText:c.text,replacement:Ue(t,c.text),caretByte:q(c.text,d),clampChanged:c.changed}}function Xt(t,e){return e.length<=pi?{handle:t,text:e}:{handle:t,text:`${e.slice(0,pi)}\u2026`,textLength:e.length,truncated:!0}}function yi(t,e,n,i,r){let a=Math.max(0,Math.min(e,t.length)),o=Math.max(a,Math.min(n,t.length)),s=o-a,l=Math.max(to,s+qt*2);if(t.length<=l)return{text:t,docStart:0,docEnd:i,textStart:0,textEnd:t.length};if(r!==void 0){let y=r.textEnd-r.textStart,u=Math.max(0,Math.min(r.textStart,t.length)),F=Math.max(u,Math.min(r.textEnd,t.length));if(y>0&&F>u&&F-u>=l){let h=Math.min(no,Math.max(0,Math.floor((F-u)/4))),g=u+h,w=F-h;if(a>=g&&o<=w)return{text:t.slice(u,F),docStart:r.docStart,docEnd:r.docEnd,textStart:u,textEnd:F}}}let c=Math.max(0,a-qt),d=Math.min(t.length,o+qt),f=d-c;if(f<l){let y=l-f,u=Math.min(c,Math.floor(y/2));c-=u,y-=u;let F=Math.min(t.length-d,y);if(d+=F,y-=F,y>0){let h=Math.min(c,y);c-=h,y-=h,y>0&&(d=Math.min(t.length,d+y))}}return{text:t.slice(c,d),docStart:q(t,c),docEnd:q(t,d),textStart:c,textEnd:d}}function Yt(t){let e=t?document.createElement("textarea"):document.createElement("input");return e instanceof HTMLInputElement?e.type="text":(e.rows=1,e.wrap="off",e.style.resize="none",e.style.whiteSpace="pre"),e.autocapitalize="off",e.autocomplete="off",e.autocorrect=!1,e.spellcheck=!1,e.tabIndex=-1,e.dataset.effindomHiddenEditor="true",e.setAttribute("aria-hidden","true"),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.width="1px",e.style.height="1px",e.style.opacity="0",e.style.pointerEvents="none",e.style.font='16px "Noto Sans Symbols 2", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", monospace',e.style.overflow="hidden",document.body.appendChild(e),e}function jt(t){t.value.length!==0&&(t.value=""),t.setSelectionRange(0,0,"none")}var so=5;function Jt(){return BigInt(Math.floor(performance.now()))}function bi(t){let e=!1,n=null,i=null,r=null,a="",o=()=>{n!==null&&(cancelAnimationFrame(n),n=null),i=null,r=null,a=""},s=()=>{let h=t.runtimeRef.current,g=i;if(h===null||g===null)return!1;i=null;let w=z(g.handle),S=g.docStart+q(g.currentWindowText,g.caret);h.ui._ui_set_interaction_time(g.interactionTime);let b=Ue(g.baseWindowText,g.currentWindowText);if(b===null)return t.setPendingLocalSelectionEcho({handle:g.handle,start:S,end:S}),h.ui._ui_set_text_selection_range(w,S,S),!0;let x=g.docStart+q(g.baseWindowText,b.start),v=g.docStart+q(g.baseWindowText,b.end);t.setPendingLocalReplacementEcho({handle:g.handle,start:x,end:v,text:b.insertedText}),t.setPendingLocalSelectionEcho({handle:g.handle,start:S,end:S});let C=Ce(h.ui,b.insertedText);try{h.ui._ui_replace_text_range(w,x,v,C.ptr,C.len,S)}finally{C.dispose()}return!0},l=h=>{let g=i,w=t.getActiveTextHandle(),S=t.getActiveEditorWindow();return g===null||g.kind!=="typing"||g.mutationCount<so||w===null||g.handle!==w.toString()||g.docStart!==S.docStart?!1:(h.value=g.currentWindowText,h.setSelectionRange(g.caret,g.caret,"none"),!0)},c=()=>{let h=t.runtimeRef.current;h===null||i===null||s()&&h.commitFrame()},d=()=>{n===null&&(n=requestAnimationFrame(()=>{n=null,t.runtimeRef.current?.flushPendingCommit()}))},f=(h,g,w,S,b="typing",x=!1)=>{let v=t.runtimeRef.current,C=t.getActiveTextHandle(),H=t.getActiveEditorWindow();if(v===null||C===null)return;let B=Math.max(0,Math.min(w.start,h.length)),p=Math.max(B,Math.min(w.end,h.length)),T=C.toString();i===null&&v.hasPendingCommit()&&v.flushPendingCommit();let E=H.docStart+q(h,B),N=H.docStart+q(h,p),M=H.docStart+q(g,Math.max(0,Math.min(S,g.length))),$=t.textByHandle[T]??"";if(x&&i!==null&&i.handle===T&&i.docStart===H.docStart){let ee=Ue(i.baseWindowText,i.currentWindowText);if(ee!==null){let m=i.docStart+q(i.baseWindowText,ee.start),L=m+j(ee.insertedText);$=_t($,m,L,i.baseWindowText.slice(ee.start,ee.end))}}let P=xt($,E,N,w.insertedText,M);if(P.clampChanged?(i!==null&&s()&&v.commitFrame(),v.hasPendingCommit()&&v.flushPendingCommit(),o(),t.textByHandle[T]=P.fullNextText,t.textByteLengthsByHandle[T]=j(P.fullNextText),t.selectionsByHandle[T]={start:P.caretByte,end:P.caretByte},t.syncFocusedInputState()):(t.textByHandle[T]=P.fullNextText,t.textByteLengthsByHandle[T]=j(P.fullNextText),t.selectionsByHandle[T]={start:P.caretByte,end:P.caretByte},t.updateActiveEditorWindowText(g)),P.replacement===null)return;if(P.clampChanged){let ee=q($,P.replacement.start),m=q($,P.replacement.end);t.setPendingLocalReplacementEcho({handle:T,start:ee,end:m,text:P.replacement.insertedText}),t.setPendingLocalSelectionEcho({handle:T,start:P.caretByte,end:P.caretByte}),v.ui._ui_set_interaction_time(Jt());let L=Ce(v.ui,P.replacement.insertedText);try{v.ui._ui_replace_text_range(C,ee,m,L.ptr,L.len,P.caretByte)}finally{L.dispose()}v.commitFrame();return}i!==null&&(i.handle!==T||i.docStart!==H.docStart||!x&&i.kind!==b)&&(s()&&v.commitFrame(),v.flushPendingCommit());let D=t.getActiveEditor();i=i===null||x?{handle:T,docStart:H.docStart,baseWindowText:h,currentWindowText:D.value,caret:D.selectionStart??D.value.length,interactionTime:Jt(),kind:b,mutationCount:1}:{...i,currentWindowText:D.value,caret:D.selectionStart??D.value.length,interactionTime:Jt(),mutationCount:b==="paste"?1:i.mutationCount+1},d(),v.requestFrame()},y=(h,g,w="typing",S=!1)=>{let b=t.getActiveEditorWindow().text,x=Ue(b,h);if(x===null){let v=t.runtimeRef.current;v!==null&&qe(v);return}f(b,h,x,g,w,S)};return{applyActiveTextDeletion:h=>{if(t.getActiveTextHandle()===null||!t.getActiveTextEditable()||e||!t.isActiveEditorFocused())return!1;let g=t.getActiveEditor(),w=g.value,S=g.selectionStart??w.length,b=g.selectionEnd??S,x=Math.min(S,b),v=Math.max(S,b),C=w,H=x,B=x,p=v;if(x!==v)C=w.slice(0,x)+w.slice(v);else if(h){if(x>=w.length)return!0;p=De(w,x),C=w.slice(0,x)+w.slice(p)}else{if(x===0)return!0;B=fi(w,x),H=B,C=w.slice(0,H)+w.slice(x)}return g.value=C,g.setSelectionRange(H,H,"none"),f(w,C,{start:B,end:p,insertedText:""},H),!0},attachHiddenEditorListeners:h=>{h.addEventListener("paste",g=>{a=g.clipboardData?.getData("text/plain")??""}),h.addEventListener("beforeinput",g=>{let w=t.getActiveTextHandle(),S=t.getActiveEditorWindow();if(!(g instanceof InputEvent)||g.inputType!=="insertFromPaste"||w===null)return;let b=w.toString();i!==null&&i.handle===b&&i.docStart===S.docStart&&i.kind!=="paste"&&c();let x=h.selectionStart??h.value.length,v=h.selectionEnd??x;r={handle:b,docStart:S.docStart,selectionStart:x,selectionEnd:v,text:typeof g.data=="string"?g.data:a},a=""}),h.addEventListener("compositionstart",()=>{e=!0}),h.addEventListener("input",g=>{let w=t.getActiveTextHandle(),S=t.getActiveEditorWindow();if(!e&&!(g instanceof InputEvent&&g.inputType==="insertText"&&l(h))){if(g instanceof InputEvent&&g.inputType==="insertFromPaste"){let b=r;if(r=null,a="",b!==null&&w!==null&&w.toString()===b.handle&&S.docStart===b.docStart){let x=i!==null&&i.handle===b.handle&&i.docStart===b.docStart&&i.kind==="paste"?i:null,v=x?.baseWindowText??S.text,C=b.selectionStart,H=b.selectionEnd;x!==null&&(C=Vt(x,C),H=Vt(x,H));let B=Math.min(C,H),p=Math.max(C,H),T=`${v.slice(0,B)}${b.text}${v.slice(p)}`,E=B+b.text.length;h.value!==T&&(h.value=T),h.setSelectionRange(E,E,"none"),f(v,T,{start:B,end:p,insertedText:b.text},E,"paste",x!==null);return}}r=null,a="",y(h.value,h.selectionStart??h.value.length,"typing")}}),h.addEventListener("compositionend",()=>{e=!1,r=null,a="",y(h.value,h.selectionStart??h.value.length,"typing")})},clearPendingTextMutations:o,flushPendingTextMutationsToRuntime:c,hasPendingTextMutations:()=>i!==null,materializePendingTextMutations:s,reset:()=>{e=!1,o()}}}var lo=500;function co(){return BigInt(Math.floor(performance.now()))}function _i(t,e){let n=Object.create(null),i=Object.create(null),r=Yt(!1),a=Yt(!0),o=null,s=null,l=null,c=0,d=0,f=0,y=null,u=null,F=!1,h=0,g=!1,w=!1,S={text:"",docStart:0,docEnd:0,textStart:0,textEnd:0},b=Object.create(null),x=Object.create(null),v=null,C=null,H=null,B=null,p=null,T=null,E=new Set;window.__bridgeLogs=e,window.__bridgeTextByHandle=n,window.__bridgeSelectionsByHandle=i,window.__bridgeActiveEditorWindow={handle:null,...S};let N=()=>w?a:r,M=()=>document.activeElement===N(),$=_=>{E.add(_),t.current?.requestFrame()},P=(_,A)=>({start:Math.max(0,Math.min(A.start,_)),end:Math.max(0,Math.min(A.end,_))}),D=()=>{p!==null&&(clearTimeout(p),p=null)},ee=()=>{if(o===null||!M())return!1;let _=o.toString(),A=n[_]??"",I=b[_]??j(A),W=i[_]??{start:I,end:I},{start:U,end:G}=P(I,W);return U===G},m=()=>{p===null&&(p=setTimeout(()=>{p=null,ee()&&(t.current?.requestFrame(),m())},lo))},L=(_=!1)=>{if(!ee()){D();return}_&&D(),m()},R=_=>{window.__bridgeActiveEditorWindow={handle:_,text:S.text,docStart:S.docStart,docEnd:S.docEnd}},V=()=>{S={text:"",docStart:0,docEnd:0,textStart:0,textEnd:0},R(null)},te=()=>{v!==null&&(cancelAnimationFrame(v),v=null);for(let _ of Object.keys(x))delete x[_]},O=_=>{S={text:_,docStart:S.docStart,docEnd:S.docStart+j(_),textStart:S.textStart,textEnd:S.textStart+_.length},R(o?.toString()??null)},Q=()=>{r.blur(),a.blur()},Ee=_=>{let A=t.current;if(A===null)return{isTextbox:!1,isEditable:!1,isMultiline:!1};let I=A.getSemanticTree().find(W=>W.handle===_);return I?.roleName!=="textbox"?{isTextbox:!1,isEditable:!1,isMultiline:!1}:{isTextbox:!0,isEditable:I.state.readonly!==!0,isMultiline:I.state.multiline===!0}},X=()=>{if(o===null){D(),V(),Q(),jt(r),jt(a);return}let _=N(),A=o.toString(),I=n[A]??"",W=b[A]??j(I);b[A]=W;let U=i[A]??{start:W,end:W},{start:G,end:se}=P(W,U),oe=ve(I,G,W),le=ve(I,se,W),Ge=oe===le?"none":G<se?"forward":"backward",Je=Math.min(oe,le),Z=Math.max(oe,le);S=yi(I,Je,Z,W,S),R(A);let Qe=Je-S.textStart,Ze=Z-S.textStart;_.value!==S.text&&(_.value=S.text),_.readOnly=!g,_.setSelectionRange(Qe,Ze,Ge),L()},ie=bi({runtimeRef:t,textByHandle:n,selectionsByHandle:i,textByteLengthsByHandle:b,getActiveEditor:N,getActiveEditorWindow:()=>S,getActiveTextEditable:()=>g,getActiveTextHandle:()=>o,isActiveEditorFocused:M,setPendingLocalReplacementEcho:_=>{C=_},setPendingLocalSelectionEcho:_=>{H=_},syncFocusedInputState:X,updateActiveEditorWindowText:O}),Te=()=>{ie.clearPendingTextMutations()},K=()=>{N().focus({preventScroll:!0}),X(),L(!0)},Se=()=>{if(o===null){if(B===null)return;let _=Ee(B);if(!_.isTextbox)return;o=z(B),g=_.isEditable,w=_.isMultiline,X(),K();return}K()},ye=_=>{B=_.toString()},Ke=()=>{B=null},be=_=>{let A=_.toString();B===A&&(B=null,o?.toString()===A&&(M()||K()))},J=_=>{!x[_]||o?.toString()!==_||v===null&&(v=requestAnimationFrame(()=>{if(v=null,!x[_]||o?.toString()!==_)return;delete x[_];let A=t.current;if(A===null)return;let I=n[_]??"",W=j(I),U=i[_]??{start:W,end:W},{start:G,end:se}=P(W,U);A.ui._ui_set_text_selection_range(z(_),G,se)}))},Me=_=>{for(let A of Object.keys(_))delete _[A]},Ye=()=>{h+=1,Me(n),Me(b),Me(i),te(),ie.reset(),C=null,H=null,B=null,D(),o=null,g=!1,w=!1,V(),T=null,E.clear(),y=null,u=null,r.value="",r.setSelectionRange(0,0,"none"),a.value="",a.setSelectionRange(0,0,"none"),Q()};ie.attachHiddenEditorListeners(r),ie.attachHiddenEditorListeners(a);let vt=(_,A)=>{let I=_.toString(),W={handle:I,isFocused:A};if(e.focusEvents.push(W),A?T=I:T===I&&(T=null),A){let U=Ee(I);if(!U.isTextbox){B=null,delete x[I],o=null,g=!1,w=!1,X(),L(),$(I);return}if(o=z(_),g=U.isEditable,w=U.isMultiline,X(),B===I){L(),$(I);return}window.setTimeout(()=>{o!==null&&o.toString()===I&&K()},0)}else if(o!==null&&o.toString()===I){if(B===I){L();return}B=null,t.current?.flushPendingCommit(),delete x[I],C=null,H=null,Te(),o=null,g=!1,w=!1,X()}L(),A&&$(I)},Et=(_,A)=>{let I=_.toString();if(C!==null&&C.handle===I&&(C=null),n[I]=A,b[I]=j(A),e.textChanges.push(Xt(I,A)),o!==null&&o.toString()===I){if(x[I]=!0,!M()){K(),L(!0);return}X(),L(!0)}},je=_=>{$(_.toString())},Y=(_,A,I,W)=>{let U=_.toString(),G=n[U]??"",se=b[U]??j(G),oe=C!==null&&C.handle===U&&C.start===A&&C.end===I&&C.text===W&&o!==null&&o.toString()===U&&M(),le=oe?G:_t(G,A,I,W);if(oe||(n[U]=le,b[U]=se-(I-A)+j(W)),oe&&(C=null),e.textChanges.push(Xt(U,le)),o!==null&&o.toString()===U){if(x[U]=!0,!M()){K(),L(!0);return}oe||X(),L(!0)}},ge=(_,A,I)=>{let W=_.toString(),U=H!==null&&H.handle===W&&H.start===A&&H.end===I&&o!==null&&o.toString()===W&&M();i[W]={start:A,end:I},H!==null&&H.handle===W&&(H=null);let G={handle:W,start:A,end:I};if(e.selectionChanges.push(G),o!==null&&o.toString()===W){if(!M()){K(),L(!0);return}U||X(),L(!0),J(W)}},we=_=>{let A=t.current;if(A===null)return;let I=z(_),W=h;e.clipboardReadRequests.push(I.toString()),navigator.clipboard.readText().then(U=>{if(W!==h)return;let G=I.toString(),se=n[G]??"",oe=b[G]??j(se),le=i[G]??{start:oe,end:oe},Ge=Math.max(0,Math.min(le.start,le.end)),Je=Math.max(Ge,Math.min(oe,Math.max(le.start,le.end))),Z=xt(se,Ge,Je,U,Ge+j(U));if(n[G]=Z.fullNextText,b[G]=j(Z.fullNextText),i[G]={start:Z.caretByte,end:Z.caretByte},o!==null&&o.toString()===G&&X(),Z.replacement===null)return;A.ui._ui_set_interaction_time(co());let Qe=q(se,Z.replacement.start),Ze=q(se,Z.replacement.end);C={handle:G,start:Qe,end:Ze,text:Z.replacement.insertedText},H={handle:G,start:Z.caretByte,end:Z.caretByte};let Tt=Ce(A.ui,Z.replacement.insertedText);try{A.ui._ui_replace_text_range(I,Qe,Ze,Tt.ptr,Tt.len,Z.caretByte)}finally{Tt.dispose()}A.commitFrame()}).catch(()=>{})};return{logs:e,textByHandle:n,selectionsByHandle:i,hasPendingTextMutations:ie.hasPendingTextMutations,materializePendingTextMutations:ie.materializePendingTextMutations,getActiveTextEditable:()=>g,getActiveTextHandle:()=>o,getActiveTextMultiline:()=>w,getCapturedPointerHandle:()=>u,getLastPointerClientPosition:()=>({x:s,y:l}),getLastPointerPosition:()=>({x:c,y:d}),getLastPointerModifiers:()=>f,getLastInteractivePointerHandle:()=>y,isActiveTextInputFocused:M,isPointerInsideCanvas:()=>F,applyActiveTextDeletion:ie.applyActiveTextDeletion,beginTouchTextFocusDeferral:ye,cancelTouchTextFocusDeferral:Ke,commitTouchTextFocusDeferral:be,refocusActiveTextInput:Se,resetAppSession:Ye,consumePendingSemanticAnnouncements:()=>{let _=Array.from(E.values());return E.clear(),_},getFocusedHandle:()=>T,setCapturedPointerHandle:_=>{u=_},setLastPointerClientPosition:(_,A)=>{s=_,l=A},setLastPointerModifiers:_=>{f=_},setLastPointerPosition:(_,A)=>{c=_,d=A},setLastInteractivePointerHandle:_=>{y=_},setPointerInsideCanvas:_=>{F=_},handleClipboardRead:we,handleFocusChanged:vt,handleRequestSemanticAnnouncement:je,handleSelectionChanged:ge,handleTextChanged:Et,handleTextReplaced:Y}}function xi(){return{pointerEvents:[],focusEvents:[],textChanges:[],selectionChanges:[],crossSelectionChanges:[],clipboardWrites:[],clipboardReadRequests:[],scrollEvents:[],missingFontCoverageRequests:[],incrementalFontPackageRequests:[]}}function vi(t){let e=xi(),n=_i(t,e),i={onPointerEvent:(r,a)=>{let{x:o,y:s}=n.getLastPointerPosition(),l=n.getLastPointerModifiers(),c={handle:Be(r),eventType:a};e.pointerEvents.push(c),window.__effindomCallbacks?.onPointerEventWithCoords?.(a,r,o,s,l)},onFocusChanged:n.handleFocusChanged,onTextChanged:n.handleTextChanged,onRequestSemanticAnnouncement:n.handleRequestSemanticAnnouncement,onTextReplaced:n.handleTextReplaced,onSelectionChanged:n.handleSelectionChanged,onScroll:(r,a,o,s,l,c,d)=>{let f={handle:Be(r),offsetX:a,offsetY:o,contentWidth:s,contentHeight:l,viewportWidth:c,viewportHeight:d};e.scrollEvents.push(f)},onCrossSelectionChanged:(r,a)=>{e.crossSelectionChanges.push({areaHandle:Be(r),text:a})},onClipboardWrite:r=>{e.clipboardWrites.push(r.plainText);let a=t.current,o=a===null?r:mi(r,s=>a.getClipboardFontUrl(s));hi(o).catch(()=>{})},onClipboardRead:n.handleClipboardRead,onRequestFontLoad:(r,a)=>{let o=t.current;o===null||a.length===0||o.loadFont(r,a).catch(s=>{let l=s instanceof Error?s.message:String(s);console.error(`[fui_host] font ${String(r)} failed lazy load from ${a}: ${l}`)})},onMissingFontCoverage:(r,a,o)=>{let s=t.current;s!==null&&(e.missingFontCoverageRequests.push({fontId:r,coverageKind:a,sampleText:o}),s.handleMissingFontCoverage(r,a,o))}};return window.__effindomCallbacks=i,n}var He=null,Qt=null,Xe=null,Zt=Promise.resolve(),Ei={current:null},uo=vi(Ei),mo=En();async function ho(){He?.resetLogs(),Qt?.destroy(),Qt=null;let t=await mo,e=await li({interactionState:uo,preparedAssets:t,runtimeRef:Ei});return Qt=e,He=e.runtime,window.__bridgeReady=!0,window.__bridgeDebug={forceDeviceLost(){e.runtime.core._ed_debug_simulate_device_lost?.(),e.runtime.requestFrame()}},delete window.__bridgeError,e.runtime}function Ti(){return Zt=Zt.catch(()=>{}).then(async()=>{await ho()}),Zt.then(()=>{if(He===null)throw new Error("Bridge runtime failed to boot.");return He})}Xe=Ti().catch(t=>{let e=t instanceof Error?t.message:String(t);throw window.__bridgeReady=!1,window.__bridgeError=e,t});var fo={get ready(){return Xe??Promise.reject(new Error("Bridge runtime is not booting."))},getRuntime:()=>He,recreateRuntime:async()=>(Xe=Ti(),await Xe),resetLogs:()=>{He!==null&&He.resetLogs()},handleToBigInt:z,handleToString:Be,pointerToHeapOffset:ne,normalizePointerForWasm:re,toHeapPointer:Le};window.__bridgeReady=!1;window.EffinDomBrowserBridge=fo;Xe.catch(()=>{});})();
|
|
4
4
|
//# sourceMappingURL=bridge.js.map
|